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

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListStreamProcessorsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     * Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the
     * next set of stream processors.
     *

     */
    private String nextToken;
    /**
     *

     * Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The default is
     * 1000.
     *

     */
    private Integer maxResults;

    /**
     *

     * If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     * Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the
     * next set of stream processors.
     *

     *
     * @param nextToken
     *        If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     *        Rekognition Video returns a pagination token in the response. You can use this pagination token to
     *        retrieve the next set of stream processors.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     * Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the
     * next set of stream processors.
     *

     *
     * @return If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     *         Rekognition Video returns a pagination token in the response. You can use this pagination token to
     *         retrieve the next set of stream processors.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     * Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the
     * next set of stream processors.
     *

     *
     * @param nextToken
     *        If the previous response was incomplete (because there are more stream processors to retrieve), Amazon
     *        Rekognition Video returns a pagination token in the response. You can use this pagination token to
     *        retrieve the next set of stream processors.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListStreamProcessorsRequest withNextToken(String nextToken) {
        setNextToken(nextToken);
        return this;
    }

    /**
     *

     * Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The default is
     * 1000.
     *

     *
     * @param maxResults
     *        Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The
     *        default is 1000.
     */

    public void setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
    }

    /**
     *

     * Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The default is
     * 1000.
     *

     *
     * @return Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The
     *         default is 1000.
     */

    public Integer getMaxResults() {
        return this.maxResults;
    }

    /**
     *

     * Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The default is
     * 1000.
     *

     *
     * @param maxResults
     *        Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The
     *        default is 1000.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListStreamProcessorsRequest withMaxResults(Integer maxResults) {
        setMaxResults(maxResults);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getNextToken() != null)
            sb.append("NextToken: ").append(getNextToken()).append(",");
        if (getMaxResults() != null)
            sb.append("MaxResults: ").append(getMaxResults());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof ListStreamProcessorsRequest == false)
            return false;
        ListStreamProcessorsRequest other = (ListStreamProcessorsRequest) obj;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        if (other.getMaxResults() == null ^ this.getMaxResults() == null)
            return false;
        if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
        return hashCode;
    }

    @Override
    public ListStreamProcessorsRequest clone() {
        return (ListStreamProcessorsRequest) super.clone();
    }

}


text:
/* global describe, it, before, afterEach */

import expect from 'expect.js';
import sinon from 'sinon';

import Router from '../router.js';
import RouteStore from '../stores/RouteStore.js';

describe('Router', function () {
  var routes,
    ResetRoute,
    IndexRoute,
    MailboxRoute,
    started = false;

  before(function () {
    ResetRoute = sinon.spy();
    IndexRoute = sinon.spy();
    MailboxRoute = sinon.spy();

    routes = {
      reset: {
        path: '_reset_',
        route: ResetRoute
      },

      index: {
        path: '',
        route: IndexRoute
      },

      mailbox: {
        path: 'box/:mailboxId',
        route: MailboxRoute
      },

      message: {
        path: 'box/:mailboxId/message/:messageId',
        route: MailboxRoute
      }
    };
  });

  afterEach(function () {
    Router.clearEach();

    if (started) {
      Router.linkTo('reset');
    }

    ResetRoute.reset();
    IndexRoute.reset();
    MailboxRoute.reset();
  });

  it('has the right properties', function () {
    expect(Router).to.be.ok();
    expect(Router.start).to.be.a('function');
    expect(Router.getURLFromRoute).to.be.a('function');
    expect(Router.linkTo).to.be.a('function');
    expect(Router.transitionTo).to.be.a('function');
    expect(Router.beforeEach).to.be.a('function');
    expect(Router.afterEach).to.be.a('function');
    expect(Router.clearEach).to.be.a('function');
  });

  it('should initially invoke the index route', function () {
    Router.start(routes);
    started = true;

    // index route called once
    expect(IndexRoute.calledOnce).to.be(true);

    // mailbox route not called
    expect(MailboxRoute.called).to.be(false);
  });

  it('should NOT linkTo reset when there already', function () {
    Router.linkTo('reset');

    expect(ResetRoute.called).to.be(false);
    expect(IndexRoute.called).to.be(false);
    expect(MailboxRoute.called).to.be(false);
  });

  it('should linkTo mailbox from index', function () {
    Router.linkTo('mailbox', [5]);

    expect(IndexRoute.called).to.be(false);
    expect(MailboxRoute.calledWithExactly('5')).to.be(true);
  });

  it('should linkTo index from mailbox', function () {
    Router.linkTo('index');

    expect(IndexRoute.calledWithExactly()).to.be(true);
    expect(MailboxRoute.called).to.be(false);
  });

  it('should linkTo message from mailbox', function () {
    Router.linkTo('message', [5, 2]);

    expect(IndexRoute.called).to.be(false);
    expect(MailboxRoute.calledWithExactly('5', '2')).to.be(true);
  });

  it('should linkTo mailbox from message', function () {
    Router.linkTo('mailbox', [5]);

    expect(IndexRoute.called).to.be(false);
    expect(MailboxRoute.calledWithExactly('5')).to.be(true);
  });

  it('should transitionTo mailbox', function () {
    Router.transitionTo('mailbox', [5]);

    expect(ResetRoute.called).to.be(false);
    expect(IndexRoute.called).to.be(false);
    expect(MailboxRoute.called).to.be(false);
    expect(RouteStore.getRouteName()).to.be('mailbox');
    expect(RouteStore.getRouteParams()[0]).to.be(5); // todo: consistent with linkTo?
    expect(RouteStore.getRouteParams().length).to.be(1);
    expect(RouteStore.getURL()).to.be('#box/5');
  });

  it('should call beforeEach', function () {
    var spy = sinon.spy();
    Router.beforeEach(spy);

    Router.linkTo('index');

    expect(IndexRoute.calledOnce).to.be(true);
    expect(spy.calledWithExactly('index', [])).to.be(true);
  });

  it('should call afterEach', function () {
    var spy = sinon.spy();
    Router.afterEach(spy);

    Router.linkTo('mailbox', [1]);

    expect(MailboxRoute.calledOnce).to.be(true);
    expect(spy.calledWithExactly('mailbox', ['1'])).to.be(true);
    expect(RouteStore.getRouteName()).to.be('mailbox');
    expect(RouteStore.getRouteParams()[0]).to.be('1');
    expect(RouteStore.getRouteParams().length).to.be(1);
    expect(RouteStore.getURL()).to.be('#box/1');
  });

  it('should call multiple beforeEach and afterEach', function () {
    var spy1 = sinon.spy();
    var spy2 = sinon.spy();
    var spy3 = sinon.spy();

    Router.beforeEach(spy1);
    Router.beforeEach(spy2);
    Router.afterEach(spy2);
    Router.afterEach(spy3);

    Router.linkTo('index');

    expect(IndexRoute.calledOnce).to.be(true);

    expect(spy1.calledWithExactly('index', [])).to.be(true);
    expect(spy2.calledWithExactly('index', [])).to.be(true);
    expect(spy3.calledWithExactly('index', [])).to.be(true);

    expect(spy1.calledOnce).to.be(true);
    expect(spy2.calledTwice).to.be(true);
    expect(spy3.calledOnce).to.be(true);
  });
});

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Static utility class because PHP's autoloaders don't support the concept
 * of namespaced function autoloading.
 */
class puzzle_stream_Utils
{
    /**
     * @var Exception
     */
    private static $_open_ex;

    /**
     * @var string
     */
    private static $_open_filename;

    /**
     * @var string
     */
    private static $_open_mode;

    /**
     * Safely opens a PHP stream resource using a filename.
     *
     * When fopen fails, PHP normally raises a warning. This function adds an
     * error handler that checks for errors and throws an exception instead.
     *
     * @param string $filename File to open
     * @param string $mode     Mode used to open the file
     *
     * @return resource
     * @throws RuntimeException if the file cannot be opened
     */
    public static function open($filename, $mode)
    {
        self::$_open_filename = $filename;
        self::$_open_mode     = $mode;
        self::$_open_ex       = null;
        set_error_handler(array('puzzle_stream_Utils', '___error_handler'));

        $handle = fopen($filename, $mode);
        restore_error_handler();

        if (self::$_open_ex) {

            throw self::$_open_ex;
        }

        return $handle;
    }

    /**
     * Copy the contents of a stream into a string until the given number of
     * bytes have been read.
     *
     * @param puzzle_stream_StreamInterface $stream Stream to read
     * @param int                           $maxLen Maximum number of bytes to read. Pass -1
     *                                              to read the entire stream.
     * @return string
     */
    public static function copyToString(puzzle_stream_StreamInterface $stream, $maxLen = -1)
    {
        $buffer = '';

        if ($maxLen === -1) {
            while (!$stream->eof()) {
                $buf = $stream->read(1048576);
                if ($buf === '' || $buf === false) {
                    break;
                }
                $buffer .= $buf;
            }

            return $buffer;
        }

        $len = 0;
        while (!$stream->eof() && $len < $maxLen) {
            $buf = $stream->read($maxLen - $len);
            if ($buf === '' || $buf === false) {
                break;
            }
            $buffer .= $buf;
            $len = strlen($buffer);
        }

        return $buffer;
    }

    /**
     * Copy the contents of a stream into another stream until the given number
     * of bytes have been read.
     *
     * @param puzzle_stream_StreamInterface $source Stream to read from
     * @param puzzle_stream_StreamInterface $dest   Stream to write to
     * @param int                           $maxLen Maximum number of bytes to read. Pass -1
     *                                              to read the entire stream.
     */
    public static function copyToStream(
        puzzle_stream_StreamInterface $source,
        puzzle_stream_StreamInterface $dest,
        $maxLen = -1
    ) {
        if ($maxLen === -1) {
            while (!$source->eof()) {
                if (!$dest->write($source->read(1048576))) {
                    break;
                }
            }
            return;
        }

        $bytes = 0;
        while (!$source->eof()) {
            $buf = $source->read($maxLen - $bytes);
            if (!($len = strlen($buf))) {
                break;
            }
            $bytes += $len;
            $dest->write($buf);
            if ($bytes == $maxLen) {
                break;
            }
        }
    }

    /**
     * Calculate a hash of a Stream
     *
     * @param puzzle_stream_StreamInterface $stream    Stream to calculate the hash for
     * @param string                        $algo      Hash algorithm (e.g. md5, crc32, etc)
     * @param bool                          $rawOutput Whether or not to use raw output
     *
     * @return string Returns the hash of the stream
     * @throws puzzle_stream_exception_SeekException
     */
    public static function hash(
        puzzle_stream_StreamInterface $stream,
        $algo,
        $rawOutput = false
    ) {
        $pos = $stream->tell();

        if ($pos > 0 && !$stream->seek(0)) {
            throw new puzzle_stream_exception_SeekException($stream);
        }

        $ctx = hash_init($algo);
        while (!$stream->eof()) {
            hash_update($ctx, $stream->read(1048576));
        }

        $out = hash_final($ctx, (bool) $rawOutput);
        $stream->seek($pos);

        return $out;
    }

    /**
     * Read a line from the stream up to the maximum allowed buffer length
     *
     * @param puzzle_stream_StreamInterface $stream    Stream to read from
     * @param int                           $maxLength Maximum buffer length
     *
     * @return string|bool
     */
    public static function readline(puzzle_stream_StreamInterface $stream, $maxLength = null)
    {
        $buffer = '';
        $size = 0;

        while (!$stream->eof()) {
            if (false === ($byte = $stream->read(1))) {
                return $buffer;
            }
            $buffer .= $byte;
            // Break when a new line is found or the max length - 1 is reached
            if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
                break;
            }
        }

        return $buffer;
    }

    /**
     * Alias of puzzle_stream_Stream::factory.
     *
     * @param mixed $resource Resource to create
     * @param int   $size     Size if known up front
     *
     * @return puzzle_stream_MetadataStreamInterface
     *
     * @see puzzle_stream_Stream::factory
     */
    public static function create($resource, $size = null)
    {
        return puzzle_stream_Stream::factory($resource, $size);
    }

    public static function ___error_handler()
    {
        $funcArgs = func_get_args();
        $arg1     = $funcArgs[1];

        self::$_open_ex = new RuntimeException(sprintf(
            'Unable to open %s using mode %s: %s',
            self::$_open_filename,
            self::$_open_mode,
            $arg1
        ));
    }
}


text:
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
    xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
    <wsp:ExactlyOne>
        <wsp:All>
            <sp:EndorsingSupportingTokens>
                <wsp:Policy>
                    <sp:KerberosToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Once">
                        <wsp:Policy>
                            <sp:WssGssKerberosV5ApReqToken11 />
                        </wsp:Policy>
                    </sp:KerberosToken>
                </wsp:Policy>
            </sp:EndorsingSupportingTokens>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--845 Price Authorization Acknowledgment/Status-->
<TransactionSpecification TransactionSetIdentifierCode="845" xmlns="http://tempuri.org/X12ParserSpecification.xsd">
  <Segment SegmentId="BPA" Usage="Required" Repeat="1" />
  <Segment SegmentId="CUR" Repeat="1" />
  <Segment SegmentId="NTE" Repeat="10" />
  <Segment SegmentId="REF" Repeat="12" />
  <Segment SegmentId="PER" Repeat="3" />
  <Segment SegmentId="DTM" Repeat="10" />
  <Segment SegmentId="CTT" Usage="Required" Repeat="1" Trailer="true" />
  <Loop LoopId="N1" LoopRepeat="10000">
    <Name>Name</Name>
    <StartingSegment SegmentId="N1" />
    <Segment SegmentId="N2" Repeat="2" />
    <Segment SegmentId="N3" Repeat="2" />
    <Segment SegmentId="N4" Repeat="1" />
    <Segment SegmentId="REF" Repeat="12" />
    <Segment SegmentId="PER" Repeat="3" />
    <Segment SegmentId="DTM" Repeat="10" />
  </Loop>
  <Loop LoopId="CON" LoopRepeat="10000">
    <Name>Contract Number Detail</Name>
    <StartingSegment SegmentId="CON" />
    <Segment SegmentId="REF" Repeat="12" />
    <Segment SegmentId="PER" Repeat="3" />
    <Segment SegmentId="DTM" Repeat="10" />
    <Segment SegmentId="CTB" Repeat="10" />
    <Segment SegmentId="ITD" Repeat="2" />
    <Loop LoopId="N1" LoopRepeat="10000">
      <Name>Name</Name>
      <StartingSegment SegmentId="N1" />
      <Segment SegmentId="N2" Repeat="2" />
      <Segment SegmentId="N3" Repeat="2" />
      <Segment SegmentId="N4" Repeat="1" />
      <Segment SegmentId="REF" Repeat="12" />
      <Segment SegmentId="PER" Repeat="3" />
      <Segment SegmentId="DTM" Repeat="2" />
      <Segment SegmentId="CTB" Repeat="25" />
    </Loop>
    <Loop LoopId="PAD">
      <Name>Product Adjustment Detail</Name>
      <StartingSegment SegmentId="PAD" />
      <Segment SegmentId="CTB" Repeat="10" />
      <Segment SegmentId="PID" Repeat="200" />
      <Segment SegmentId="MEA" Repeat="40" />
      <Segment SegmentId="UIT" Repeat="20" />
      <Segment SegmentId="QTY" Repeat="5" />
      <Segment SegmentId="AMT" Repeat="5" />
      <Segment SegmentId="CUR" Repeat="1" />
      <Segment SegmentId="SSS" Repeat="1" />
      <Segment SegmentId="SHP" Repeat="1" />
      <Segment SegmentId="DTM" Repeat="2" />
      <Loop LoopId="LIN" LoopRepeat="1">
        <Name>Item Identification</Name>
        <StartingSegment SegmentId="LIN" />
        <Segment SegmentId="G53" Repeat="1" />
        <Segment SegmentId="SLN" Repeat="100" />
      </Loop>
      <Loop LoopId="N1" LoopRepeat="10000">
        <Name>Name</Name>
        <StartingSegment SegmentId="N1" />
        <Segment SegmentId="N2" Repeat="2" />
        <Segment SegmentId="N3" Repeat="2" />
        <Segment SegmentId="N4" Repeat="1" />
        <Segment SegmentId="DTM" Repeat="10" />
        <Segment SegmentId="CTB" Repeat="25" />
      </Loop>
      <Loop LoopId="CTP" LoopRepeat="25">
        <Name>Pricing Information</Name>
        <StartingSegment SegmentId="CTP" />
        <Segment SegmentId="DTM" Repeat="10" />
        <Segment SegmentId="CTB" Repeat="25" />
        <Loop LoopId="N1" LoopRepeat="10000">
          <Name>Name</Name>
          <StartingSegment SegmentId="N1" />
          <Segment SegmentId="N2" Repeat="2" />
          <Segment SegmentId="N3" Repeat="2" />
          <Segment SegmentId="N4" Repeat="1" />
          <Segment SegmentId="DTM" Repeat="10" />
          <Segment SegmentId="CTB" Repeat="25" />
        </Loop>
      </Loop>
    </Loop>
  </Loop>
</TransactionSpecification>


text:
package org.red5.io.utils;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;

import org.xml.sax.EntityResolver;

/**
 * Misc XML utils
 *
 * @author The Red5 Project
 * @author Luke Hubbard, Codegent Ltd (luke@codegent.com)
 * @author Paul Gregoire (mondain@gmail.com)
 */
public class XMLUtils {
    /**
     * Logger
     */
    protected static Logger log = LoggerFactory.getLogger(XMLUtils.class);

    /**
     * Converts string representation of XML into Document
     *
     * @param str
     *            String representation of XML
     * @return DOM object
     * @throws IOException
     *             I/O exception
     */
    public static Document stringToDoc(String str) throws IOException {
        if (StringUtils.isNotEmpty(str)) {
            try (Reader reader = new StringReader(str)) {
                DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                EntityResolver noop = (publicId, systemId) -> new InputSource(new StringReader(""));
                db.setEntityResolver(noop);
                Document doc = db.parse(new InputSource(reader));
                return doc;
            } catch (Exception ex) {
                log.debug("String: {}", str);
                throw new IOException(String.format("Error converting from string to doc %s", ex.getMessage()));
            }
        } else {
            throw new IOException("Error - could not convert empty string to doc");
        }
    }

    /**
     * Converts doc to String
     *
     * @param dom
     *            DOM object to convert
     * @return XML as String
     */
    public static String docToString(Document dom) {
        return XMLUtils.docToString1(dom);
    }

    /**
     * Convert a DOM tree into a String using Dom2Writer
     *
     * @return XML as String
     * @param dom
     *            DOM object to convert
     */
    public static String docToString1(Document dom) {
        StringWriter sw = new StringWriter();
        DOM2Writer.serializeAsXML(dom, sw);
        return sw.toString();
    }

    /**
     * Convert a DOM tree into a String using transform
     *
     * @param domDoc
     *            DOM object
     * @throws java.io.IOException
     *             I/O exception
     * @return XML as String
     */
    public static String docToString2(Document domDoc) throws IOException {
        try {
            TransformerFactory transFact = TransformerFactory.newInstance();
            Transformer trans = transFact.newTransformer();
            trans.setOutputProperty(OutputKeys.INDENT, "no");
            StringWriter sw = new StringWriter();
            Result result = new StreamResult(sw);
            trans.transform(new DOMSource(domDoc), result);
            return sw.toString();
        } catch (Exception ex) {
            throw new IOException(String.format("Error converting from doc to string %s", ex.getMessage()));
        }
    }

}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=fn.channel.html">

Redirecting to fn.channel.html...


text:
function testcase() {
"use strict";
var f = Function("return typeof this;");
return f() !== "undefined";
}
if(testcase()) {
  console.log('passed');
}


text:
.class Landroid/support/v4/view/ef;
.super Landroid/database/DataSetObserver;

# instance fields
.field final synthetic a:Landroid/support/v4/view/ViewPager;

# direct methods
.method private constructor <init>(Landroid/support/v4/view/ViewPager;)V
    .locals 0

    iput-object p1, p0, Landroid/support/v4/view/ef;->a:Landroid/support/v4/view/ViewPager;

    invoke-direct {p0}, Landroid/database/DataSetObserver;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Landroid/support/v4/view/ViewPager;Landroid/support/v4/view/dv;)V
    .locals 0

    invoke-direct {p0, p1}, Landroid/support/v4/view/ef;-><init>(Landroid/support/v4/view/ViewPager;)V

    return-void
.end method

# virtual methods
.method public onChanged()V
    .locals 1

    iget-object v0, p0, Landroid/support/v4/view/ef;->a:Landroid/support/v4/view/ViewPager;

    invoke-virtual {v0}, Landroid/support/v4/view/ViewPager;->b()V

    return-void
.end method

.method public onInvalidated()V
    .locals 1

    iget-object v0, p0, Landroid/support/v4/view/ef;->a:Landroid/support/v4/view/ViewPager;

    invoke-virtual {v0}, Landroid/support/v4/view/ViewPager;->b()V

    return-void
.end method


text:
<?php
namespace Grav\Common\Processors;

class AssetsProcessor extends ProcessorBase implements ProcessorInterface {

    public $id = 'assets';
    public $title = 'Assets';

    public function process() {
      $this->container['assets']->init();
      $this->container->fireEvent('onAssetsInitialized');
    }

}


text:
import java.awt.Font;
import java.awt.GridLayout;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * A view with buttons for the tic tac toe game.
 *
 * @author Aaron Bungay
 *
 */
public class TicTacToeView extends JFrame implements Observer
{
	private static final String GAME_WIN_MSG = " won the tic tac toe game!";

	private static final long serialVersionUID = 4283567925948886520L;

	private static final int GRID_SIZE = 3;
	private static final int FRAME_HEIGHT = 400;
	private static final int FRAME_WIDTH = 400;
	private static final String FRAME_TITLE = "Tic Tac Toe";
	private static final Font BUTTON_GRID_FONT = new Font("Arial", Font.BOLD, 60);

	private TicTacToeController controller;
	private JButton[][] buttonGrid;

	/**
	 * Constructor for the tic tac toe view.
	 */
	public TicTacToeView(TicTacToeController controller)
	{
		super(FRAME_TITLE);
		this.controller = controller;
		this.buttonGrid = new JButton[GRID_SIZE][GRID_SIZE];

		setDefaultCloseOperation(EXIT_ON_CLOSE);
		getContentPane().setLayout(new GridLayout(GRID_SIZE, GRID_SIZE));
		setSize(FRAME_WIDTH, FRAME_HEIGHT);
		setLocationRelativeTo(null);

		// fill grid with buttons
		for (int i = 0; i < GRID_SIZE; i++)
		{
			for (int j = 0; j < GRID_SIZE; j++)
			{
				JButton button = new JButton();
				button.setActionCommand(i + "," + j);
				button.addActionListener(controller);
				button.setFont(BUTTON_GRID_FONT);
				button.setFocusPainted(false);
				buttonGrid[i][j] = button;
				add(button);
			}
		}

		setVisible(true);
	}

	/**
	 *
	 */
	@Override
	public void update(Observable obs, Object arg)
	{
		TicTacToeEvent ttte = (TicTacToeEvent) arg;
		buttonGrid[ttte.getX()][ttte.getY()].setText(ttte.getCurrentPlayer().name());

		if (ttte.isGameWon())
		{
			JOptionPane.showMessageDialog(this, ttte.getCurrentPlayer().name() + GAME_WIN_MSG);

			// disable all buttons after a win
			for (JButton[] b1 : buttonGrid)
			{
				for (JButton b2 : b1)
				{
					b2.setEnabled(false);
				}
			}
		}
	}
}


text:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ZYSocket;
using ZYSocket.Server;
using ZYSocket.Server.Builder;

namespace PlatformBenchmarks
{
    public class ZYHttpServer : IHostedService
    {
        public ISocketServer SocketServer { get; private set; }
        public IServiceProvider serviceProvider { get; private set; }

        public HttpHandler @HttpHandler { get; private set; }

        public ZYHttpServer()
        {
            ArraySegment<byte> date = GMTDate.Default.DATE;
            var containerBuilder = new ServiceCollection();
            new SockServBuilder(containerBuilder, p =>
            {
                return new ZYSocketSuper(p)
                {
                    BinaryInput = new BinaryInputHandler(BinaryInputHandler),
                    Connetions = new ConnectionFilter(ConnectionFilter),
                    MessageInput = new DisconnectHandler(DisconnectHandler)
                };
            })
             .ConfigServer(p =>
             {
                 p.Port = 8080;
                 p.MaxBufferSize = 4096;
                 p.MaxConnectCout = 20000;
             });

            serviceProvider = containerBuilder.BuildServiceProvider();
            SocketServer = serviceProvider.GetRequiredService<ISocketServer>();
            @HttpHandler = new HttpHandler();
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            SocketServer.Start();
            return Task.CompletedTask;
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            SocketServer.Stop();
            return Task.CompletedTask;
        }

        bool ConnectionFilter(ISockAsyncEvent socketAsync) => true;

        void DisconnectHandler(string message, ISockAsyncEvent socketAsync, int erorr)
        {
            socketAsync.UserToken = null;
            socketAsync.AcceptSocket.Dispose();
        }

        async void BinaryInputHandler(ISockAsyncEvent socketAsync)
        {
            var fiberRw = await socketAsync.GetFiberRw<HttpToken>();
            fiberRw.UserToken = new HttpToken
            {
                Db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance)
            };

            using var data_r = fiberRw.GetMemory(4096);
            using var write = new WriteBytes(fiberRw);
            for (; ; )
            {
                await HttpHandler.Receive(fiberRw, data_r.Memory, write);
            }

        }
    }
}


text:
WASM_EXPORT int start() {
  char* bad_ptr = (char*)0xffffffff;
  biP256PrivateKeyFromBin(bad_ptr);
  return 0;
}


text:
// Copyright 2017 Elias Kosunen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This file is a part of scnlib:
//     https://github.com/eliaskosunen/scnlib
//
// The contents of this file are based on utfcpp:
//     https://github.com/nemtrif/utfcpp
//     Copyright (c) 2006 Nemanja Trifunovic
//     Distributed under the Boost Software License, version 1.0

#ifndef SCN_UNICODE_COMMON_H
#define SCN_UNICODE_COMMON_H

#include "../detail/fwd.h"

#include <cstdint>

namespace scn {
    SCN_BEGIN_NAMESPACE

    /**
     * A Unicode code point
     */
    enum class code_point : uint32_t {};

    template <typename T>
    constexpr bool operator==(code_point a, T b)
    {
        return static_cast<uint32_t>(a) == static_cast<uint32_t>(b);
    }
    template <typename T>
    constexpr bool operator!=(code_point a, T b)
    {
        return static_cast<uint32_t>(a) != static_cast<uint32_t>(b);
    }
    template <typename T>
    constexpr bool operator<(code_point a, T b)
    {
        return static_cast<uint32_t>(a) < static_cast<uint32_t>(b);
    }
    template <typename T>
    constexpr bool operator>(code_point a, T b)
    {
        return static_cast<uint32_t>(a) > static_cast<uint32_t>(b);
    }
    template <typename T>
    constexpr bool operator<=(code_point a, T b)
    {
        return static_cast<uint32_t>(a) <= static_cast<uint32_t>(b);
    }
    template <typename T>
    constexpr bool operator>=(code_point a, T b)
    {
        return static_cast<uint32_t>(a) >= static_cast<uint32_t>(b);
    }

    namespace detail {
        static constexpr const uint16_t lead_surrogate_min = 0xd800;
        static constexpr const uint16_t lead_surrogate_max = 0xdbff;
        static constexpr const uint16_t trail_surrogate_min = 0xdc00;
        static constexpr const uint16_t trail_surrogate_max = 0xdfff;
        static constexpr const uint16_t lead_offset =
            lead_surrogate_min - (0x10000u >> 10);
        static constexpr const uint32_t surrogate_offset =
            0x10000u - (lead_surrogate_min << 10) - trail_surrogate_min;
        static constexpr const uint32_t code_point_max = 0x10ffff;

        template <typename Octet>
        constexpr uint8_t mask8(Octet o)
        {
            return static_cast<uint8_t>(0xff & o);
        }
        template <typename U16>
        constexpr uint16_t mask16(U16 v)
        {
            return static_cast<uint16_t>(0xffff & v);
        }
        template <typename U16>
        constexpr bool is_lead_surrogate(U16 cp)
        {
            return cp >= lead_surrogate_min && cp <= lead_surrogate_max;
        }
        template <typename U16>
        constexpr bool is_trail_surrogate(U16 cp)
        {
            return cp >= trail_surrogate_min && cp <= trail_surrogate_max;
        }
        template <typename U16>
        constexpr bool is_surrogate(U16 cp)
        {
            return cp >= lead_surrogate_min && cp <= trail_surrogate_max;
        }

        constexpr inline bool is_code_point_valid(code_point cp)
        {
            return cp <= code_point_max && !is_surrogate(cp);
        }
    }  // namespace detail

    template <typename T>
    constexpr code_point make_code_point(T ch)
    {
        return static_cast<code_point>(ch);
    }

    /**
     * Returns `true`, if `cp` is valid, e.g. is less than or equal to the
     * maximum value for a code point (U+10FFFF), and is not a surrogate (U+D800
     * to U+DFFF).
     */
    constexpr inline bool is_valid_code_point(code_point cp)
    {
        return detail::is_code_point_valid(cp);
    }
    /**
     * Returns `true` if `cp` can be encoded in ASCII as-is (is between U+0 and
     * U+7F)
     */
    constexpr inline bool is_ascii_code_point(code_point cp)
    {
        return cp <= 0x7f;
    }

    SCN_END_NAMESPACE
}  // namespace scn

#endif


text:
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Ads.GoogleAds.V11.Resources {

  /// Holder for reflection information generated from google/ads/googleads/v11/resources/ad_group_extension_setting.proto
  public static partial class AdGroupExtensionSettingReflection {

    #region Descriptor
    /// File descriptor for google/ads/googleads/v11/resources/ad_group_extension_setting.proto
    public static pbr::FileDescriptor Descriptor {
      get { return descriptor; }
    }
    private static pbr::FileDescriptor descriptor;

    static AdGroupExtensionSettingReflection() {
      byte[] descriptorData = global::System.Convert.FromBase64String(
          string.Concat(
            "CkNnb29nbGUvYWRzL2dvb2dsZWFkcy92MTEvcmVzb3VyY2VzL2FkX2dyb3Vw",
            "X2V4dGVuc2lvbl9zZXR0aW5nLnByb3RvEiJnb29nbGUuYWRzLmdvb2dsZWFk",
            "cy52MTEucmVzb3VyY2VzGj1nb29nbGUvYWRzL2dvb2dsZWFkcy92MTEvZW51",
            "bXMvZXh0ZW5zaW9uX3NldHRpbmdfZGV2aWNlLnByb3RvGjNnb29nbGUvYWRz",
            "L2dvb2dsZWFkcy92MTEvZW51bXMvZXh0ZW5zaW9uX3R5cGUucHJvdG8aH2dv",
            "b2dsZS9hcGkvZmllbGRfYmVoYXZpb3IucHJvdG8aGWdvb2dsZS9hcGkvcmVz",
            "b3VyY2UucHJvdG8i0gQKF0FkR3JvdXBFeHRlbnNpb25TZXR0aW5nEk8KDXJl",
            "c291cmNlX25hbWUYASABKAlCOOBBBfpBMgowZ29vZ2xlYWRzLmdvb2dsZWFw",
            "aXMuY29tL0FkR3JvdXBFeHRlbnNpb25TZXR0aW5nElwKDmV4dGVuc2lvbl90",
            "eXBlGAIgASgOMj8uZ29vZ2xlLmFkcy5nb29nbGVhZHMudjExLmVudW1zLkV4",
            "dGVuc2lvblR5cGVFbnVtLkV4dGVuc2lvblR5cGVCA+BBBRI/CghhZF9ncm91",
            "cBgGIAEoCUIo4EEF+kEiCiBnb29nbGVhZHMuZ29vZ2xlYXBpcy5jb20vQWRH",
            "cm91cEgAiAEBEk0KFGV4dGVuc2lvbl9mZWVkX2l0ZW1zGAcgAygJQi/6QSwK",
            "Kmdvb2dsZWFkcy5nb29nbGVhcGlzLmNvbS9FeHRlbnNpb25GZWVkSXRlbRJh",
            "CgZkZXZpY2UYBSABKA4yUS5nb29nbGUuYWRzLmdvb2dsZWFkcy52MTEuZW51",
            "bXMuRXh0ZW5zaW9uU2V0dGluZ0RldmljZUVudW0uRXh0ZW5zaW9uU2V0dGlu",
            "Z0RldmljZTqHAepBgwEKMGdvb2dsZWFkcy5nb29nbGVhcGlzLmNvbS9BZEdy",
            "b3VwRXh0ZW5zaW9uU2V0dGluZxJPY3VzdG9tZXJzL3tjdXN0b21lcl9pZH0v",
            "YWRHcm91cEV4dGVuc2lvblNldHRpbmdzL3thZF9ncm91cF9pZH1+e2V4dGVu",
            "c2lvbl90eXBlfUILCglfYWRfZ3JvdXBCjgIKJmNvbS5nb29nbGUuYWRzLmdv",
            "b2dsZWFkcy52MTEucmVzb3VyY2VzQhxBZEdyb3VwRXh0ZW5zaW9uU2V0dGlu",
            "Z1Byb3RvUAFaS2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFw",
            "aXMvYWRzL2dvb2dsZWFkcy92MTEvcmVzb3VyY2VzO3Jlc291cmNlc6ICA0dB",
            "QaoCIkdvb2dsZS5BZHMuR29vZ2xlQWRzLlYxMS5SZXNvdXJjZXPKAiJHb29n",
            "bGVcQWRzXEdvb2dsZUFkc1xWMTFcUmVzb3VyY2Vz6gImR29vZ2xlOjpBZHM6",
            "Okdvb2dsZUFkczo6VjExOjpSZXNvdXJjZXNiBnByb3RvMw=="));
      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
          new pbr::FileDescriptor[] { global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceReflection.Descriptor, global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeReflection.Descriptor, global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Api.ResourceReflection.Descriptor, },
          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V11.Resources.AdGroupExtensionSetting), global::Google.Ads.GoogleAds.V11.Resources.AdGroupExtensionSetting.Parser, new[]{ "ResourceName", "ExtensionType", "AdGroup", "ExtensionFeedItems", "Device" }, new[]{ "AdGroup" }, null, null, null)
          }));
    }
    #endregion

  }
  #region Messages
  ///
  /// An ad group extension setting.
  ///
  public sealed partial class AdGroupExtensionSetting : pb::IMessage<AdGroupExtensionSetting>
  #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      , pb::IBufferMessage
  #endif
  {
    private static readonly pb::MessageParser<AdGroupExtensionSetting> _parser = new pb::MessageParser<AdGroupExtensionSetting>(() => new AdGroupExtensionSetting());
    private pb::UnknownFieldSet _unknownFields;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pb::MessageParser<AdGroupExtensionSetting> Parser { get { return _parser; } }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Ads.GoogleAds.V11.Resources.AdGroupExtensionSettingReflection.Descriptor.MessageTypes[0]; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    pbr::MessageDescriptor pb::IMessage.Descriptor {
      get { return Descriptor; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public AdGroupExtensionSetting() {
      OnConstruction();
    }

    partial void OnConstruction();

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public AdGroupExtensionSetting(AdGroupExtensionSetting other) : this() {
      resourceName_ = other.resourceName_;
      extensionType_ = other.extensionType_;
      adGroup_ = other.adGroup_;
      extensionFeedItems_ = other.extensionFeedItems_.Clone();
      device_ = other.device_;
      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public AdGroupExtensionSetting Clone() {
      return new AdGroupExtensionSetting(this);
    }

    /// Field number for the "resource_name" field.
    public const int ResourceNameFieldNumber = 1;
    private string resourceName_ = "";
    ///
    /// Immutable. The resource name of the ad group extension setting.
    /// AdGroupExtensionSetting resource names have the form:
    ///
    /// `customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}`
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public string ResourceName {
      get { return resourceName_; }
      set {
        resourceName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
      }
    }

    /// Field number for the "extension_type" field.
    public const int ExtensionTypeFieldNumber = 2;
    private global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType extensionType_ = global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified;
    ///
    /// Immutable. The extension type of the ad group extension setting.
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType ExtensionType {
      get { return extensionType_; }
      set {
        extensionType_ = value;
      }
    }

    /// Field number for the "ad_group" field.
    public const int AdGroupFieldNumber = 6;
    private string adGroup_;
    ///
    /// Immutable. The resource name of the ad group. The linked extension feed items will
    /// serve under this ad group.
    /// AdGroup resource names have the form:
    ///
    /// `customers/{customer_id}/adGroups/{ad_group_id}`
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public string AdGroup {
      get { return adGroup_ ?? ""; }
      set {
        adGroup_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
      }
    }
    /// Gets whether the "ad_group" field is set
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public bool HasAdGroup {
      get { return adGroup_ != null; }
    }
    /// Clears the value of the "ad_group" field
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void ClearAdGroup() {
      adGroup_ = null;
    }

    /// Field number for the "extension_feed_items" field.
    public const int ExtensionFeedItemsFieldNumber = 7;
    private static readonly pb::FieldCodec<string> _repeated_extensionFeedItems_codec
        = pb::FieldCodec.ForString(58);
    private readonly pbc::RepeatedField<string> extensionFeedItems_ = new pbc::RepeatedField<string>();
    ///
    /// The resource names of the extension feed items to serve under the ad group.
    /// ExtensionFeedItem resource names have the form:
    ///
    /// `customers/{customer_id}/extensionFeedItems/{feed_item_id}`
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public pbc::RepeatedField<string> ExtensionFeedItems {
      get { return extensionFeedItems_; }
    }

    /// Field number for the "device" field.
    public const int DeviceFieldNumber = 5;
    private global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice device_ = global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified;
    ///
    /// The device for which the extensions will serve. Optional.
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice Device {
      get { return device_; }
      set {
        device_ = value;
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override bool Equals(object other) {
      return Equals(other as AdGroupExtensionSetting);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public bool Equals(AdGroupExtensionSetting other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (ResourceName != other.ResourceName) return false;
      if (ExtensionType != other.ExtensionType) return false;
      if (AdGroup != other.AdGroup) return false;
      if(!extensionFeedItems_.Equals(other.extensionFeedItems_)) return false;
      if (Device != other.Device) return false;
      return Equals(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override int GetHashCode() {
      int hash = 1;
      if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode();
      if (ExtensionType != global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified) hash ^= ExtensionType.GetHashCode();
      if (HasAdGroup) hash ^= AdGroup.GetHashCode();
      hash ^= extensionFeedItems_.GetHashCode();
      if (Device != global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified) hash ^= Device.GetHashCode();
      if (_unknownFields != null) {
        hash ^= _unknownFields.GetHashCode();
      }
      return hash;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override string ToString() {
      return pb::JsonFormatter.ToDiagnosticString(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void WriteTo(pb::CodedOutputStream output) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      output.WriteRawMessage(this);
    #else
      if (ResourceName.Length != 0) {
        output.WriteRawTag(10);
        output.WriteString(ResourceName);
      }
      if (ExtensionType != global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified) {
        output.WriteRawTag(16);
        output.WriteEnum((int) ExtensionType);
      }
      if (Device != global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified) {
        output.WriteRawTag(40);
        output.WriteEnum((int) Device);
      }
      if (HasAdGroup) {
        output.WriteRawTag(50);
        output.WriteString(AdGroup);
      }
      extensionFeedItems_.WriteTo(output, _repeated_extensionFeedItems_codec);
      if (_unknownFields != null) {
        _unknownFields.WriteTo(output);
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
      if (ResourceName.Length != 0) {
        output.WriteRawTag(10);
        output.WriteString(ResourceName);
      }
      if (ExtensionType != global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified) {
        output.WriteRawTag(16);
        output.WriteEnum((int) ExtensionType);
      }
      if (Device != global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified) {
        output.WriteRawTag(40);
        output.WriteEnum((int) Device);
      }
      if (HasAdGroup) {
        output.WriteRawTag(50);
        output.WriteString(AdGroup);
      }
      extensionFeedItems_.WriteTo(ref output, _repeated_extensionFeedItems_codec);
      if (_unknownFields != null) {
        _unknownFields.WriteTo(ref output);
      }
    }
    #endif

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public int CalculateSize() {
      int size = 0;
      if (ResourceName.Length != 0) {
        size += 1 + pb::CodedOutputStream.ComputeStringSize(ResourceName);
      }
      if (ExtensionType != global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified) {
        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ExtensionType);
      }
      if (HasAdGroup) {
        size += 1 + pb::CodedOutputStream.ComputeStringSize(AdGroup);
      }
      size += extensionFeedItems_.CalculateSize(_repeated_extensionFeedItems_codec);
      if (Device != global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified) {
        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Device);
      }
      if (_unknownFields != null) {
        size += _unknownFields.CalculateSize();
      }
      return size;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(AdGroupExtensionSetting other) {
      if (other == null) {
        return;
      }
      if (other.ResourceName.Length != 0) {
        ResourceName = other.ResourceName;
      }
      if (other.ExtensionType != global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType.Unspecified) {
        ExtensionType = other.ExtensionType;
      }
      if (other.HasAdGroup) {
        AdGroup = other.AdGroup;
      }
      extensionFeedItems_.Add(other.extensionFeedItems_);
      if (other.Device != global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unspecified) {
        Device = other.Device;
      }
      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(pb::CodedInputStream input) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      input.ReadRawMessage(this);
    #else
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
            break;
          case 10: {
            ResourceName = input.ReadString();
            break;
          }
          case 16: {
            ExtensionType = (global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType) input.ReadEnum();
            break;
          }
          case 40: {
            Device = (global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice) input.ReadEnum();
            break;
          }
          case 50: {
            AdGroup = input.ReadString();
            break;
          }
          case 58: {
            extensionFeedItems_.AddEntriesFrom(input, _repeated_extensionFeedItems_codec);
            break;
          }
        }
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
            break;
          case 10: {
            ResourceName = input.ReadString();
            break;
          }
          case 16: {
            ExtensionType = (global::Google.Ads.GoogleAds.V11.Enums.ExtensionTypeEnum.Types.ExtensionType) input.ReadEnum();
            break;
          }
          case 40: {
            Device = (global::Google.Ads.GoogleAds.V11.Enums.ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice) input.ReadEnum();
            break;
          }
          case 50: {
            AdGroup = input.ReadString();
            break;
          }
          case 58: {
            extensionFeedItems_.AddEntriesFrom(ref input, _repeated_extensionFeedItems_codec);
            break;
          }
        }
      }
    }
    #endif

  }

  #endregion

}

#endregion Designer generated code


text:
package press.io;

import java.io.File;
import java.io.FileFilter;

import play.vfs.VirtualFile;
import press.PressFileWriter;

public class PressFileFilter implements FileFilter {
    String extension;

    public PressFileFilter(String extension) {
        this.extension = extension;
    }

    public boolean accept(File file) {
        if (!file.getName().endsWith(extension)) {
            return false;
        }

        // If the file contains a compression header, it's a press
        // compressed file
        return PressFileWriter.hasPressHeader(file);
    }
}


text:
package danlobo.mikrotik.filter;

import org.apache.mina.core.filterchain.IoFilterAdapter;

public class MikrotikResponseFilter extends IoFilterAdapter {
}


text:
package main

import "crypto/sha256"
import "encoding/hex"
import "encoding/json"
import "fmt"
import "io"
import "io/ioutil"
import "log"
import "os"
import "os/exec"
import "path"
import "path/filepath"
import "strings"

import "github.com/cheggaaa/pb"
import "github.com/coreos/go-semver/semver"

type Package struct {
	Arch string `json:"arch"`
	Basename string `json:"basename"`
	Bytes int `json:"bytes"`
	Md5 string `json:"md5"`
	Platform string `json:"platform"`
	PlatformVersion string `json:"platform_version"`
	Sha256 string `json:"sha256"`
	URL string `json:"url"`
	VersionString string `json:"version"`
	semVersion *semver.Version `json:"-"`
}

func PackageFromJson(json_path string) (*Package, error) {
	var pkg Package
	if metadata_json, err := ioutil.ReadFile(json_path) ; err != nil {
		return nil, Err(err)
	} else {
		if err := json.Unmarshal(metadata_json, &pkg) ; err != nil {
			return nil, Err(err)
		}
		pkg_path, err := filepath.Abs(path.Join(path.Dir(json_path), pkg.Basename))
		if err != nil { return nil, Err(err) }
		pkg.URL = strings.Join([]string{"file://", pkg_path}, "")
		if fi, err := os.Stat(pkg_path) ; err != nil {
			return nil, Err(err)
		} else {
			pkg.Bytes = int(fi.Size())
		}
		return &pkg, nil
	}
}

func (pkg *Package) Version() *semver.Version {
	if pkg.semVersion == nil {
		if sv, err := semver.NewVersion(pkg.VersionString) ; err != nil {
			panic(err)
		} else {
			pkg.semVersion = sv
		}
	}
	return pkg.semVersion
}

func (pkg *Package) String() string {
	return fmt.Sprintf("<%v (%v) %v-%v-%v>",
		pkg.Basename, pkg.Version(),
		pkg.Platform, pkg.PlatformVersion, pkg.Arch)
}

func (pkg *Package) IsPreRelease() bool {
	return pkg.Version().Metadata != ""
}

func (pkg *Package) Download() error {
	log.Println("Downloading package from", pkg.URL)

	resp, err := Get(pkg.URL)
	if err != nil { return Err(err) }
	defer resp.Body.Close()

	// Create output file to write to
	pkg_f, err := os.Create(pkg.Basename)
	if err != nil { return Err(err) }
	defer pkg_f.Close()

	// Calculate checksum as we go
	dl_sha256 := sha256.New()

	// Display progress bar as we go
	dl_pbar := pb.New(pkg.Bytes)
	dl_pbar.SetUnits(pb.U_BYTES)

	dl_pbar.Start()
	io.Copy(pkg_f, dl_pbar.NewProxyReader(io.TeeReader(resp.Body, dl_sha256)))
	dl_pbar.Finish()

	// Verify download
	if dl_sha256 := hex.EncodeToString(dl_sha256.Sum(nil)) ; dl_sha256 == pkg.Sha256 {
		log.Println("Package checksum correct: SHA256", pkg.Sha256)
	} else {
		return NewErrf("Package checksum mismatch: expected SHA256 %v, got %v",
			pkg.Sha256, dl_sha256)
	}

	return nil
}

func runCommand(words ...string) error {
	cmd := exec.Command(words[0], words[1:]...)
	cmd.Stdin  = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	log.Println("Running", words)
	if err := cmd.Run() ; err != nil {
		return Errf(err, "%v", words)
	}
	return nil
}

func (pkg *Package) Install() error {
	// Compose installation command
	var install_command []string
	if os.Getuid() != 0 {
		tmpdir := os.Getenv("TMPDIR")
		if tmpdir == "" {
			// Fallback. Normally we have tmpdir set by the run script.
			tmpdir = "/tmp"
		}
		install_command = append(install_command, "/usr/bin/sudo", "/usr/bin/env", fmt.Sprintf("TMPDIR=%v", tmpdir))
	}

	switch {
	case strings.HasSuffix(pkg.Basename,  ".sh"):
		install_command = append(install_command,
			"/bin/sh", pkg.Basename)
	case strings.HasSuffix(pkg.Basename, ".deb"):
		install_command = append(install_command,
			"/usr/bin/dpkg", "-i", pkg.Basename)
	default:
		return NewErrf("Unrecognized package type %v", pkg.Basename)
	}

	// Install PKG
	if err := runCommand(install_command...) ; err != nil { return Err(err) }

	// Setup IDK
	if err := runCommand("/opt/idk/bin/idk", "setup") ; err != nil { return Err(err) }

	return nil
}


text:
package com.jadic.cmd;

import org.jboss.netty.buffer.ChannelBuffer;

/**
 * 55域数据格式
 * @author Jadic
 * @created 2012-11-30
 */
public class D5Data {

	final static int D5Data_MAX_SIZE = 126;

	private byte[] cipherText = new byte[8];//	应用密文	b64	2+8
	private byte[] infoData = new byte[1];//	应用信息数据	b8	2+1
	private byte[] appData = new byte[33];//	发卡行应用数据	b…256	2+1+32
	private byte[] unknownNumber = new byte[4];//	不可预知数	b32	2+4
	private byte[] transCounter = new byte[2];//	应用交易计数器	b16	2+2
	private byte[] transDate = new byte[3];//	交易日期	n6	1+3
	private byte[] appVer = new byte[2];//	应用版本号	B16	2+2
	private byte[] transCurrencyCode = new byte[2];//	交易货币代码	N2	2+2
	private byte[] interactionFeature = new byte[2];//	应用交互特征	b16	1+2
	private byte[] terminalCountryCode = new byte[2];//	终端国家代码	n3	2+2
	private byte[] otherAmount = new byte[6];//	其它金额	n12	2+6
	private byte[] terminalPerformance = new byte[3];//	终端性能	b24	2+3
	private byte[] specFileName = new byte[17];//	专用文件名称	b…128	1+1+16
	private byte[] transSNoCounter = new byte[5];//	交易序列计数器	b…32	2+1+4
	private byte[] authCode = new byte[6];//	电子现金发卡行授权码	a6	2+6
	private byte[] panSNo = new byte[1];//	应用PAN序列号	b8	2+1
	private byte[] terminalCheckRet = new byte[5];//	终端验证结果	b…40	1+5
	private byte[] authAmount = new byte[6];//	授权金额	n12	2+6
	private byte[] terminalType = new byte[1];//	终端类型	b16	2+1
	private byte[] devSNo = new byte[4];//	接口设备序列号	b32	2+4
	public D5Data () {

	}

	public boolean disposeData(ChannelBuffer channelBuffer) {
		if (channelBuffer == null || channelBuffer.readableBytes() < D5Data_MAX_SIZE) {
			return false;
		}
		try {
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(cipherText);//	应用密文	b64	2+8
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(infoData);//	应用信息数据	b8	2+1
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(appData);//	发卡行应用数据	b…256	2+1+32
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(unknownNumber);//	不可预知数	b32	2+4
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(transCounter);//	应用交易计数器	b16	2+2
			channelBuffer.skipBytes(1);
			channelBuffer.readBytes(transDate);//	交易日期	n6	1+3
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(appVer);//	应用版本号	B16	2+2
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(transCurrencyCode);//	交易货币代码	N2	2+2
			channelBuffer.skipBytes(1);
			channelBuffer.readBytes(interactionFeature);//	应用交互特征	b16	1+2
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(terminalCountryCode);//	终端国家代码	n3	2+2
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(otherAmount);//	其它金额	n12	2+6
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(terminalPerformance);//	终端性能	b24	2+3
			channelBuffer.skipBytes(1);
			channelBuffer.readBytes(specFileName);//	专用文件名称	b…128	1+1+16
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(transSNoCounter);//	交易序列计数器	b…32	2+1+4
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(authCode);//	电子现金发卡行授权码	a6	2+6
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(panSNo);//	应用PAN序列号	b8	2+1
			channelBuffer.skipBytes(1);
			channelBuffer.readBytes(terminalCheckRet);//	终端验证结果	b…40	1+5
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(authAmount);//	授权金额	n12	2+6
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(terminalType);//	终端类型	b16	2+1
			channelBuffer.skipBytes(2);
			channelBuffer.readBytes(devSNo);//	接口设备序列号	b32	2+4
			return true;
		} catch (Exception e) {
		}
		return false;
	}

	public byte[] getCipherText() {
		return cipherText;
	}

	public byte[] getInfoData() {
		return infoData;
	}

	public byte[] getAppData() {
		return appData;
	}

	public byte[] getUnknownNumber() {
		return unknownNumber;
	}

	public byte[] getTransCounter() {
		return transCounter;
	}

	public byte[] getTransDate() {
		return transDate;
	}

	public byte[] getInteractionFeature() {
		return interactionFeature;
	}

	public byte[] getTerminalCountryCode() {
		return terminalCountryCode;
	}

	public byte[] getOtherAmount() {
		return otherAmount;
	}

	public byte[] getTerminalPerformance() {
		return terminalPerformance;
	}

	public byte[] getSpecFileName() {
		return specFileName;
	}

	public byte[] getTransSNoCounter() {
		return transSNoCounter;
	}

	public byte[] getAuthCode() {
		return authCode;
	}

	public byte[] getPanSNo() {
		return panSNo;
	}

	public byte[] getAppVer() {
		return appVer;
	}

	public byte[] getTransCurrencyCode() {
		return transCurrencyCode;
	}

	public byte[] getTerminalCheckRet() {
		return terminalCheckRet;
	}

	public byte[] getAuthAmount() {
		return authAmount;
	}

	public byte[] getTerminalType() {
		return terminalType;
	}

	public byte[] getDevSNo() {
		return devSNo;
	}

}


text:
This is the {{role}} with topic '{{ctopic}}'.

  <button (click)="incrCount()">Increment me</button>


text:
@interface AddBusinessViewController : UIViewController

@property (strong, nonatomic) SqlDB *myDb;
@property (strong, nonatomic) Business *business;
@property (strong, nonatomic) BusinessDb * businessDb;

@property (strong, nonatomic) IBOutlet UITextField *businessName;
@property (strong, nonatomic) IBOutlet UITextField *address;
@property (strong, nonatomic) IBOutlet UITextField *address2;
@property (strong, nonatomic) IBOutlet UITextField *city;
@property (strong, nonatomic) IBOutlet UITextField *state;
@property (strong, nonatomic) IBOutlet UITextField *zip;
- (IBAction)saveBusiness:(id)sender;

@end


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkThreadedImageAlgorithmWrap.h"
#include "vtkImageNonMaximumSuppressionWrap.h"
#include "vtkObjectWrap.h"
#include "vtkImageDataWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkImageNonMaximumSuppressionWrap::ptpl;

VtkImageNonMaximumSuppressionWrap::VtkImageNonMaximumSuppressionWrap()
{ }

VtkImageNonMaximumSuppressionWrap::VtkImageNonMaximumSuppressionWrap(vtkSmartPointer<vtkImageNonMaximumSuppression> _native)
{ native = _native; }

VtkImageNonMaximumSuppressionWrap::~VtkImageNonMaximumSuppressionWrap()
{ }

void VtkImageNonMaximumSuppressionWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkImageNonMaximumSuppression").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ImageNonMaximumSuppression").ToLocalChecked(), ConstructorGetter);
}

void VtkImageNonMaximumSuppressionWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkImageNonMaximumSuppressionWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkThreadedImageAlgorithmWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkThreadedImageAlgorithmWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkImageNonMaximumSuppressionWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetDimensionality", GetDimensionality);
	Nan::SetPrototypeMethod(tpl, "getDimensionality", GetDimensionality);

	Nan::SetPrototypeMethod(tpl, "GetDimensionalityMaxValue", GetDimensionalityMaxValue);
	Nan::SetPrototypeMethod(tpl, "getDimensionalityMaxValue", GetDimensionalityMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetDimensionalityMinValue", GetDimensionalityMinValue);
	Nan::SetPrototypeMethod(tpl, "getDimensionalityMinValue", GetDimensionalityMinValue);

	Nan::SetPrototypeMethod(tpl, "GetHandleBoundaries", GetHandleBoundaries);
	Nan::SetPrototypeMethod(tpl, "getHandleBoundaries", GetHandleBoundaries);

	Nan::SetPrototypeMethod(tpl, "HandleBoundariesOff", HandleBoundariesOff);
	Nan::SetPrototypeMethod(tpl, "handleBoundariesOff", HandleBoundariesOff);

	Nan::SetPrototypeMethod(tpl, "HandleBoundariesOn", HandleBoundariesOn);
	Nan::SetPrototypeMethod(tpl, "handleBoundariesOn", HandleBoundariesOn);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetDimensionality", SetDimensionality);
	Nan::SetPrototypeMethod(tpl, "setDimensionality", SetDimensionality);

	Nan::SetPrototypeMethod(tpl, "SetHandleBoundaries", SetHandleBoundaries);
	Nan::SetPrototypeMethod(tpl, "setHandleBoundaries", SetHandleBoundaries);

	Nan::SetPrototypeMethod(tpl, "SetMagnitudeInputData", SetMagnitudeInputData);
	Nan::SetPrototypeMethod(tpl, "setMagnitudeInputData", SetMagnitudeInputData);

	Nan::SetPrototypeMethod(tpl, "SetVectorInputData", SetVectorInputData);
	Nan::SetPrototypeMethod(tpl, "setVectorInputData", SetVectorInputData);

#ifdef VTK_NODE_PLUS_VTKIMAGENONMAXIMUMSUPPRESSIONWRAP_INITPTPL
	VTK_NODE_PLUS_VTKIMAGENONMAXIMUMSUPPRESSIONWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkImageNonMaximumSuppressionWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkImageNonMaximumSuppression> native = vtkSmartPointer<vtkImageNonMaximumSuppression>::New();
		VtkImageNonMaximumSuppressionWrap* obj = new VtkImageNonMaximumSuppressionWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkImageNonMaximumSuppressionWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkImageNonMaximumSuppressionWrap::GetDimensionality(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDimensionality();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkImageNonMaximumSuppressionWrap::GetDimensionalityMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDimensionalityMaxValue();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkImageNonMaximumSuppressionWrap::GetDimensionalityMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDimensionalityMinValue();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkImageNonMaximumSuppressionWrap::GetHandleBoundaries(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetHandleBoundaries();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkImageNonMaximumSuppressionWrap::HandleBoundariesOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->HandleBoundariesOff();
}

void VtkImageNonMaximumSuppressionWrap::HandleBoundariesOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->HandleBoundariesOn();
}

void VtkImageNonMaximumSuppressionWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageNonMaximumSuppressionWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	vtkImageNonMaximumSuppression * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkImageNonMaximumSuppressionWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkImageNonMaximumSuppressionWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkImageNonMaximumSuppressionWrap *w = new VtkImageNonMaximumSuppressionWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkImageNonMaximumSuppressionWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkImageNonMaximumSuppression * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkImageNonMaximumSuppressionWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkImageNonMaximumSuppressionWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkImageNonMaximumSuppressionWrap *w = new VtkImageNonMaximumSuppressionWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageNonMaximumSuppressionWrap::SetDimensionality(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetDimensionality(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageNonMaximumSuppressionWrap::SetHandleBoundaries(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetHandleBoundaries(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageNonMaximumSuppressionWrap::SetMagnitudeInputData(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkImageDataWrap::ptpl))->HasInstance(info[0]))
	{
		VtkImageDataWrap *a0 = ObjectWrap::Unwrap<VtkImageDataWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetMagnitudeInputData(
			(vtkImageData *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageNonMaximumSuppressionWrap::SetVectorInputData(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageNonMaximumSuppressionWrap *wrapper = ObjectWrap::Unwrap<VtkImageNonMaximumSuppressionWrap>(info.Holder());
	vtkImageNonMaximumSuppression *native = (vtkImageNonMaximumSuppression *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkImageDataWrap::ptpl))->HasInstance(info[0]))
	{
		VtkImageDataWrap *a0 = ObjectWrap::Unwrap<VtkImageDataWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetVectorInputData(
			(vtkImageData *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}


text:
<?php
/**
 * Calculations library for Interestelegram Bot
 * 	- This library should contain every method to do the relative calculations between entities.
 * @author Gustavo <a.gustavo.soto@gmail.com>
 * @version 0.1
 */
class Calculations {

	private $CI = null;
	private $baseAgility = 55;
	private $agilityMultiplier = 5;
	private $healthCrewIncrement = 5;

	public function __construct() {
		$this->CI =& get_instance();
	}

	/*
	 * SHIP CALCULATION METHODS
	 * - The ship calculations methods will require the Ship model entitiy and not its id.
	 */

	private function _chance($chance, $min=0, $max=100) {
		$rand = rand(0, 100);
		if ($chance < $min) $chance = $min;
		if ($chance > $max) $chance = $max;
		//log_message('error', '($rand'.$rand.' <= $chance'.$chance.')');
		return ($rand <= $chance);
	}

	public function attack_success($attackerShip, $defenderShip) {
		if (empty($attackerShip)) return false;
		if (empty($defenderShip)) return false;
		$diffCrew = $defenderShip->total_crew - $attackerShip->total_crew;

		$chance = $this->baseAgility + ($diffCrew * $this->agilityMultiplier);

		$this->CI->load->model('Asteroids');
		if ($this->CI->Asteroids->ship_is_in_asteroid($attackerShip)) {
			$chance -= 60;
		}

		if ($this->CI->Asteroids->ship_is_in_asteroid($defenderShip)) {
			$chance -= 40;
		}

		return $this->_chance($chance, 5, 95);
	}

	/**
	 * Ship_health
	 * - this method will return the new ship health and max health for a ship based on its crew.
	 * @param $ship 	Object 		The ship model object
	 * @param $crew 	Integer 	Number of new crew members, could be a negative number.
 	 */
	public function ship_health($ship, $crewIncrement) {

		$actualCrew = $ship->total_crew;
		$actualHP = $ship->health;
		$actualMAXHP = $ship->max_health;
		$increment = ( $crewIncrement * $this->healthCrewIncrement );

		$max_health = $actualMAXHP + $increment;
		$health = ( ( ( $actualCrew + $crewIncrement ) * $this->healthCrewIncrement ) - ( $actualCrew * $this->healthCrewIncrement ) + $actualHP );

		return array(
			'max_shield' => ( ( $actualCrew + $crewIncrement ) * $this->healthCrewIncrement ),
			'max_health' => ( $max_health <= 0 ) ? 1 : $max_health,
			'health' => ( $health <= 0 ) ? 1 : $health
		);

	}

	/**
	 * ship_damage
	 * - The ship damage
	 * @param $ship 			<Ship Model Entity> 	The ship that is doing the damage.
	 * @param $target_ship 		<Ship Model Entity> 	The ship that will recieve the damage.
	 */
	public function ship_damage( $ship ) {}

	/**
	 * ship_resistance
	 * - The ship resistance
	 * @param $ship 			<Ship Model Entity> 	The ship that is doing the damage.
	 * @param $target_ship 		<Ship Model Entity> 	The ship that will recieve the damage.
	 */
	public function ship_resistance( $ship ) {}

	/**
	 * ship_dodge
	 * - The ship dodge
	 * @param $ship 			<Ship Model Entity> 	The ship that is doing the damage.
	 * @param $target_ship 		<Ship Model Entity> 	The ship that will recieve the damage.
	 */

	/**

	//ajustar formula

	*/
	public function ship_dodge($mainShip, $attackerShip=null) {
		if (empty($mainShip)) return false;
		if (empty($attackerShip)) return false;

		$distance = round (sqrt( pow($mainShip->x - $attackerShip->x, 2) + pow($mainShip->y - $attackerShip->y, 2) ),1);

		return ($this->_chance($distance*10, 5, 100));
	}

	/**
	 * ship_damage_vs_ship
	 * - The ship damage vs another ship.
	 * @param $ship 			<Ship Model Entity> 	The ship that is doing the damage.
	 * @param $target_ship 		<Ship Model Entity> 	The ship that will recieve the damage.
	 */
	public function ship_damage_vs_ship( $ship, $target_ship ) {}

	/**
	 * ship_resistance_vs_ship
	 * - The ship resistance vs another ship
	 * @param $ship 			<Ship Model Entity> 	The ship that is going to resist the damage.
	 * @param $damagin_ship 	<Ship Model Entity>		The ship tiat is doing damage.
	 */
	public function ship_resistance_vs_ship( $ship, $damagin_ship ) {}

	/**
	 * ship_dodge_vs_ship
	 * - The ship dodge vs another ship
	 * @param $ship 			<Ship Model Entity> 	The ship that is going to resist the damage.
	 * @param $damagin_ship 	<Ship Model Entity>		The ship tiat is doing damage.
	 */
	public function ship_dodge_vs_ship( $ship, $damagin_ship ) {}

	// concepts
	public function ship_damage_vs_other( $ship, $other, $other_type ) {}
	public function ship_resistance_vs_other( $ship, $other, $other_type ) {}
	public function ship_dodge_vs_other( $ship, $other, $other_type ) {}

	public function coordinatesInArray($x, $y, $set) {
		if (!is_array($set)) return false;
		$flag = false;
		foreach ($set as $value) {
			$flag = $flag || ($value->x == $x && $value->y == $y);
		}
		return $flag;
	}

	public function scanFailsOnAsteroids() {
		return $this->_chance(85);
	}

	public function moveAsteroid($hoursPast) {
		$base = 100;

		return $this->_chance($base + ($base * $hoursPast));
	}

	public function getPowerUpRarityString($rarity) {
		switch ($rarity) {
			case 0:
				return 'common';
				break;
			case 1:
				return 'rare';
				break;
			default:
				return 'common';
				break;
		}
	}

	public function getPowerUpTypeString($type) {
		switch ($type) {
			case 0:
				return 'shield';
				break;
			case 1:
				return 'health';
				break;
			case 2:
				return 'points';
				break;
			default:
				return 'shield';
				break;
		}
	}

	public function consume_powerups($ship, $powerups) {
		$this->CI->load->model(array('Ships', 'Powerups'));
		foreach ($powerups as $pwr) {
			$this->CI->Powerups->consume($pwr->id);
			switch ($pwr->type) {
				case 0: // shield
					$shield = ($pwr->rarity + 1) * 5;
					$ship->shield += $shield;
					if ($ship->shield > $ship->max_shield) $ship->shield = $ship->max_shield;
					$this->CI->Ships->update(array('shield' => $ship->shield), $ship->id);
					break;
				case 1: // health
					$health = ($pwr->rarity + 1) * 5;
					$ship->health += $health;
					if ($ship->health > $ship->max_health) $ship->health = $ship->max_health;
					$this->CI->Ships->update(array('health' => $ship->health), $ship->id);
					break;
				case 2: // points
					$score = 100 * ($pwr->rarity + 1);
					$ship->score += $score;
					$this->CI->Ships->update(array('score' => $ship->score), $ship->id);
					break;
			}
		}
	}

	public function getMineralTypeString($type) {
		switch ($type) {
			case 0:
				return 'interestelegraminium';
				break;
			default:
				return 'dust';
				break;
		}
	}

	public function obtainMinerals($minerals = false) {

		$this->CI->load->model(array('Ships', 'Minerals'));

		$remindfull = array(); //listado de naves llenas a las que vamos a mandar mensaje
		$full = array(); // listado de naves llenas
		$empty = array(); // listado de naves llenandose

		foreach ($minerals as $mineral){

		//buscamos los players que están en las mismas coordenadas
		//le sumamos 1 a la carga de minerales, comprobando que no se pase del max de la carga

			$update_data = array('minerals' => 'minerals + 1');
			$this->CI->Ships->update($update_data,array( 'x' =>$mineral->x , 'y'=>$mineral->y , 'minerals < max_minerals '=> null ),false);

			$fullships = $this->CI->Ships->where(array( 'x' =>$mineral->x , 'y'=>$mineral->y , 'minerals = max_minerals '=> null ))->get_all();
			if (!empty($fullships)){
				$full = array_merge($full, $fullships);
			}
			$remindfullships = $this->CI->Ships->where(array( 'x' =>$mineral->x , 'y'=>$mineral->y , 'minerals = max_minerals '=> null , 'dont_remind_full_minerals' => 0 ))->get_all();
			if (!empty($remindfullships)){
				$remindfull = array_merge($remindfull, $remindfullships);
			}
			$emptyships = $this->CI->Ships->where(array( 'x' =>$mineral->x , 'y'=>$mineral->y , 'minerals < max_minerals '=> null ))->get_all();
			if (!empty($emptyships)){
				$empty = array_merge($empty, $emptyships);
			}

			$this->CI->Minerals->consume($mineral,count($emptyships[0]));

		}
		return array('full' => $remindfull , 'empty' => $empty);
	}

	public function trollKeyboardV1(){
		if ($this->_chance(50))
			return array( array("SI", "NO") );
		else
			return array( array("NO", "SI") );
	}

}

/* EOF */