text:
using System.Diagnostics.Contracts;
using System.Security.Cryptography;

namespace FxSsh.Algorithms
{
    public class CtrModeCryptoTransform : ICryptoTransform
    {
        private readonly SymmetricAlgorithm _algorithm;
        private readonly ICryptoTransform _transform;
        private readonly byte[] _iv;
        private readonly byte[] _block;

        public CtrModeCryptoTransform(SymmetricAlgorithm algorithm)
        {
            Contract.Requires(algorithm != null);

            algorithm.Mode = CipherMode.ECB;
            algorithm.Padding = PaddingMode.None;

            _algorithm = algorithm;
            _transform = algorithm.CreateEncryptor();
            _iv = algorithm.IV;
            _block = new byte[algorithm.BlockSize >> 3];
        }

        public bool CanReuseTransform
        {
            get { return true; }
        }

        public bool CanTransformMultipleBlocks
        {
            get { return true; }
        }

        public int InputBlockSize
        {
            get { return _algorithm.BlockSize; }
        }

        public int OutputBlockSize
        {
            get { return _algorithm.BlockSize; }
        }

        public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
        {
            var written = 0;
            var bytesPerBlock = InputBlockSize >> 3;

            for (var i = 0; i < inputCount; i += bytesPerBlock)
            {
                written += _transform.TransformBlock(_iv, 0, bytesPerBlock, _block, 0);

                for (var j = 0; j < bytesPerBlock; j++)
                    outputBuffer[outputOffset + i + j] = (byte)(_block[j] ^ inputBuffer[inputOffset + i + j]);

                var k = _iv.Length;
                while (--k >= 0 && ++_iv[k] == 0) ;
            }

            return written;
        }

        public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
        {
            var output = new byte[inputCount];
            TransformBlock(inputBuffer, inputOffset, inputCount, output, 0);
            return output;
        }

        public void Dispose()
        {
            _transform.Dispose();
        }
    }
}


text:
<?php
class Excel_export extends CI_Controller{
    function __construct()
    {
        parent :: __construct();
        $this->load->model('Excel_model');
        // Hereyoushouldaddsomesortofuservalidation
        // topreventstrangersfrompullingyourtabledata
    }

    function index()
    {

        $query = $this->Excel_model->get();
        if(!$query)
            return false;
        // StartingthePHPExcellibrary
        $this ->load-> library('PHPExcel');
        $this ->load-> library('PHPExcel/IOFactory');
        $objPHPExcel = new PHPExcel();
        $objPHPExcel -> getProperties() -> setTitle("export") -> setDescription("none");
        $objPHPExcel -> setActiveSheetIndex(0);
        // Fieldnamesinthefirstrow
        $fields = $query -> list_fields();
        $col = 0;
        foreach($fields as $field)
        {
            $objPHPExcel -> getActiveSheet() -> setCellValueByColumnAndRow($col, 1, $field);
            $col++;
            }
        // Fetchingthetabledata
        $row = 2;
        foreach($query -> result()as$data)
        {
            $col = 0;
            foreach($fields as $field)
            {
                $objPHPExcel -> getActiveSheet() -> setCellValueByColumnAndRow($col, $row, $data -> $field);
                $col++;
                }
            $row++;
            }
        $objPHPExcel -> setActiveSheetIndex(0);
        $objWriter = IOFactory :: createWriter($objPHPExcel, 'Excel5');
        // Sendingheaderstoforcetheusertodownloadthefile
        header('Content-Type:application/vnd.ms-excel');
        header('Content-Disposition:attachment;filename="Products_' . date('dMy') . '.xls"');
        header('Cache-Control:max-age=0');
        $objWriter -> save('php://output');
        }
    }

redpajama_set_name: RedPajamaGithub


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var main_service_1 = require("../../common/main.service");
var CampingSafariComponent = (function () {
    function CampingSafariComponent(mainService) {
        this.mainService = mainService;
        this.routerComponent = 'book-event';
        this.generation = "coconut trees";
    }
    CampingSafariComponent.prototype.ngOnInit = function () {
        this.data = this.mainService.getDataByTitle("Camping Site and Safari");
    };
    return CampingSafariComponent;
}());
CampingSafariComponent = __decorate([
    core_1.Component({
        templateUrl: 'app/our-services/our-service.component.html'
    }),
    __metadata("design:paramtypes", [main_service_1.MainService])
], CampingSafariComponent);
exports.CampingSafariComponent = CampingSafariComponent;
//# sourceMappingURL=camping-safari.component.js.map


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Acha Tugi long-fingered frog factsheet on ARKive - Cardioglossa schioetzi</title>
        <link rel="canonical" href="http://www.arkive.org/acha-tugi-long-fingered-frog/cardioglossa-schioetzi/" />
		<link rel="stylesheet" type="text/css" media="screen,print" href="/rcss/factsheet.css" />
		<link rel="icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

Acha Tugi long-fingered frog (Cardioglossa schioetzi)

Kingdom	Animalia

Phylum	Chordata

Class	Amphibia

Order	Anura

Family	Arthroleptidae

Genus	Cardioglossa (1)

Classified as Endangered (EN) on the IUCN Red List 2006 (1).

ARKive is working with the Global Amphibian Assessment (GAA) to source images of the world's threatened amphibian species.

A collaboration among scientists from IUCN - The World Conservation Union, Conservation International and NatureServe, the GAA is the first ever comprehensive assessment of the conservation strategy for the world's known species of frogs, toads, salamanders, newts and caecilians.

The GAA website presents results of this assessment for every amphibian species, including information on IUCN Red List category, range, ecology, threats and conservation.

For more information on the Global Amphibian Assessment, please see:
www.globalamphibians.org

This information is awaiting authentication by a species expert, and will be updated as soon as possible. If you are able to help please contact:
arkive@wildscreen.org.uk

IUCN Red List (June, 2006)
http://www.iucnredlist.org


text:
var game = {
    // game assets
    assets : [
        { name: "alien",   type:"image", src:"data/gfx/alien.png" },
        { name: "flushed", type:"image", src:"data/gfx/flushed.png" },
        { name: "scream",  type:"image", src:"data/gfx/scream.png" },
        { name: "smile",   type:"image", src:"data/gfx/smile.png" },
        { name: "smirk",   type:"image", src:"data/gfx/smirk.png" },
        { name: "brick",   type:"image", src:"data/gfx/brick.png" }
    ],

    onload: function()
    {
        // Initialize the video.
        if (!me.video.init(1024, 768, {wrapper : "screen", scale : 'auto'})) {
            alert("Your browser does not support HTML5 canvas.");
            return;
        }

        // install the debug panel plugin
        me.plugin.register(me.debug.Panel, "debug");
        me.debug.renderQuadTree = true;

        // set all resources to be loaded
        me.loader.onload = this.loaded.bind(this);

        // set all resources to be loaded
        me.loader.preload(game.assets);

        // load everything & display a loading screen
        me.state.change(me.state.LOADING);
    },

    loaded: function () {
        // set the "Play/Ingame" Screen Object
        me.state.set(me.state.PLAY, new PlayScreen());

        // switch to PLAY state
        me.state.change(me.state.PLAY);
    }
};

var PlayScreen = me.ScreenObject.extend( {
    onResetEvent: function() {
         // clear the background
        me.game.world.addChild(new me.ColorLayer("background", "#5E3F66", 0), 0);

        // Add some objects
        for (var i = 0; i < 200; i++) {
            me.game.world.addChild(new Smilie(i), 3);
        }
    }
});

var Smilie = me.Entity.extend({
    init : function (i) {
        this._super(
            me.Entity,
            "init",
            [
                (-15).random(1024),
                (-15).random(768),
                {
                    width : 16,
                    height : 16,
                }
            ]
        );

        // disable gravity and add a random velocity
        this.body.gravity = 0;
        this.body.vel.set((-4).randomFloat(4), (-4).randomFloat(4));

        this.alwaysUpdate = true;

        // add the coin sprite as renderable
        this.renderable = new me.Sprite(0, 0, {image: me.loader.getImage(game.assets[i % 5].name)});

        // add a collision shape
        this.body.addShape(new me.Ellipse(4, 4, 8, 8));
    },

    update : function (dt) {
        this.pos.add(this.body.vel);

        // world limit check
        if( this.pos.x >= 1024 ) this.pos.x = -15;
        if( this.pos.x < -15 ) this.pos.x = 1024 - 1;
        if( this.pos.y >= 768 ) this.pos.y = -15;
        if( this.pos.y < -15 ) this.pos.y = 768 - 1;

        // update the entity bounds since
        // we manipulated the entity pos manually
        this.updateBounds();

        if (me.collision.check(this)) {
            // me.collision.check returns true in case of collision
            this.renderable.setOpacity(1.0);
        } else {
            this.renderable.setOpacity(0.5);
        };
        return true;
    },

    // collision handler
    onCollision : function (response) {

        this.pos.sub(response.overlapN);
        if (response.overlapN.x !== 0) {
            this.body.vel.x = (-4).randomFloat(4) * -this.body.vel.x.sign();
        }
        if (response.overlapN.y !== 0) {
            this.body.vel.y = (-4).randomFloat(4) * -this.body.vel.y.sign();
        }
        this.updateBounds();

        return false;
    }
});

/* Bootstrap */
window.onReady(function onReady() {
    game.onload();
});


text: Build PostgreSQL from source


text:
apt-get -y update
apt-get -y install python-software-properties
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get -y update

# set up a silent install of MySQL
dbpass=$1
moodleVersion=$2
installOfficePlugins=$3

export DEBIAN_FRONTEND=noninteractive
echo mysql-server-5.6 mysql-server/root_password password $dbpass | debconf-set-selections
echo mysql-server-5.6 mysql-server/root_password_again password $dbpass | debconf-set-selections

# install the LAMP stack
apt-get -y install apache2 mysql-client mysql-server php5

# install moodle requirements
apt-get -y install graphviz aspell php5-pspell php5-curl php5-gd php5-intl php5-mysql php5-xmlrpc php5-ldap

# create moodle database
MYSQL=`which mysql`

Q1="CREATE DATABASE moodle DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;"
Q2="GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'root'@'%' IDENTIFIED BY '$dbpass' WITH GRANT OPTION;"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"

$MYSQL -uroot -p$dbpass -e "$SQL"

apt-get install unzip

# install Moodle
cd /var/www/html
curl -k --max-redirs 10 https://github.com/moodle/moodle/archive/$moodleVersion.zip -L -o moodle.zip
unzip moodle.zip
mv moodle-$moodleVersion moodle

# install Office 365 plugins if asked for
if [ "$installOfficePlugins" = "True" ]; then
    curl -k --max-redirs 10 https://github.com/Microsoft/o365-moodle/archive/$moodleVersion.zip -L -o o365.zip
    unzip o365.zip

    # The plugins below are not required for new installations
    rm -rf o365-moodle-$moodleVersion/blocks/onenote
    rm -rf o365-moodle-$moodleVersion/local/m*
    rm -rf o365-moodle-$moodleVersion/local/o365docs
    rm -rf o365-moodle-$moodleVersion/local/office365
    rm -rf o365-moodle-$moodleVersion/local/onenote
    rm -rf o365-moodle-$moodleVersion/mod/assign
    rm -rf o365-moodle-$moodleVersion/user/profile/
    rm -rf o365-moodle-$moodleVersion/repository/onenote
    cp -r o365-moodle-$moodleVersion/* moodle

    cp -r o365-moodle-$moodleVersion/* moodle
    rm -rf o365-moodle-$moodleVersion
fi

# make the moodle directory writable for owner
chown -R www-data moodle
chmod -R 770 moodle

# create moodledata directory
mkdir /var/www/moodledata
chown -R www-data /var/www/moodledata
chmod -R 770 /var/www/moodledata

# create cron entry
# It is scheduled for once per day. It can be changed as needed.
echo '0 0 * * * php /var/www/html/moodle/admin/cli/cron.php > /dev/null 2>&1' > cronjob
crontab cronjob

# restart MySQL
service mysql restart

# restart Apache
apachectl restart


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

<title>MappedObjectTransformer (LWJGL API)</title>
<meta name="date" content="2013-12-02">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

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

org.lwjgl.util.mapped

Class MappedObjectTransformer

java.lang.Object

org.lwjgl.util.mapped.MappedObjectTransformer

public class MappedObjectTransformer
extends java.lang.Object

This class implements the bytecode transformation that mapped object go through.
 Mapped object classes need to first be registered with the transformer, see register(Class).

 The transformer supports some debugging tools, enabled through JVM system properties:

 org.lwjgl.util.mapped.PrintTiming=true, prints timing information for the transformation step.

 org.lwjgl.util.mapped.PrintActivity=true, prints activity information.

 org.lwjgl.util.mapped.PrintBytecode=true, prints the transformed bytecode.

 org.lwjgl.util.Debug must also be set to true for the above to work.

Author:

Riven

Constructor Summary

Constructors

Constructor and Description

MappedObjectTransformer()

Method Summary

Methods

Modifier and Type
Method and Description

static void
register(java.lang.Class<? extends MappedObject> type)

Registers a class as a mapped object.

Methods inherited from class java.lang.Object

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

Constructor Detail

MappedObjectTransformer

public MappedObjectTransformer()

Method Detail

register

public static void register(java.lang.Class<? extends MappedObject> type)

Registers a class as a mapped object.
 The class must extend MappedObject and be annotated with MappedField.

Parameters:

type - the mapped object class.

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

Copyright © 2002-2009 lwjgl.org. All Rights Reserved.


text:
LuaCoroutine::LuaCoroutine(std::shared_ptr<lua_State> state, int index) : LuaReference(state, index)
{
	if (GetType() != LuaType::thread)
	{
		const char *msg = lua_pushfstring(state.get(), "thread expected, got %s", luaL_typename(state.get(), index));
		luaL_argerror(state.get(), index, msg);
	}
}

std::string LuaCoroutine::RunScript(std::string script)
{
	PushToStack(state.get());
	lua_State* thread = lua_tothread(state.get(), -1);
	lua_pop(state.get(), 1);
	int status = luaL_loadstring(thread, script.c_str());
	status = lua_resume(thread, NULL, 0);

	if (status != LUA_OK && status != LUA_YIELD)
	{
		return LuaGetLastError(thread);
	}
	return "No errors";
}

std::string LuaCoroutine::Resume()
{
	PushToStack(state.get());
	lua_State* thread = lua_tothread(state.get(), -1);
	lua_pop(state.get(), 1);
	int status = lua_resume(thread, NULL, lua_gettop(thread));

	if (status != LUA_OK && status != LUA_YIELD)
	{
		return LuaGetLastError(thread);
	}
	return "No errors";
}

bool LuaCoroutine::CanResume() const
{
	PushToStack(state.get());
	lua_State* thread = lua_tothread(state.get(), -1);
	lua_pop(state.get(), 1);
	if (lua_status(thread) == LUA_YIELD)
	{
		return true;
	}
	return false;
}


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

public class Scroller : MonoBehaviour {

    public List<GameObject> list = new List<GameObject>();
    public int current;

    private int y;
    private int max;
	// Use this for initialization
	void Start () {
        y = (int)transform.position.y;
        InitList();
	}

    private void InitList()
    {
        max = GameObject.FindGameObjectWithTag("Central").GetComponent<Central>().bonus.Count;

        list[0].SendMessage("SetText", value: "" + (max -1));
        list[1].SendMessage("SetText", value: ""+max);
        list[2].SendMessage("SetText", value: "1");
        list[3].SendMessage("SetText", value: "2");
        list[4].SendMessage("SetText", value: "3");
        current = 1;
    }

	// Update is called once per frame
	void Update () {

        if (transform.position.y - y >= 2)
        {
            GoUp();
            y = y + 2;
            transform.position =new Vector2(transform.position.x, y);
        }
        else if ( transform.position.y - y <= -2)
        {
            GoDown();
            y = y - 2;
            transform.position = new Vector2(transform.position.x, y);
        }
	}

    private void GoUp()
    {
        GameObject t = list[0];
        list.RemoveAt(0);
        int a = current + 3;
        if (a > max)
        {
            a = a - max;
        }
        t.SendMessage("SetText", value: "" + a);
        t.SendMessage("AddOffset", new Vector3(0, -10, 0));
        list.Add(t);
        current++;
        if(current>max)
        {
            current = current - max;
        }
    }

    private void GoDown()
    {
        GameObject t = list[4];
        list.RemoveAt(4);

        int a = current - 3;
        if(a<1)
        {
            if (a == 0)
                a = max;
            else
                a = max + a;
        }
        t.SendMessage("SetText", value: "" + a);
        t.SendMessage("AddOffset", new Vector3(0, 10, 0));
        list.Insert(0, t);
        current--;
        if (current == 0)
            current = max;
    }
}


text:
layout: post
title:  "Hello World!"
date:   2017-07-29 19:14:46 +1000
categories: ["all"]
---
This is the fist post on my site! Progress!
SO that means I go it to work. It was pretty hard to get Jekyll to work, but now that I finally managed to do so, it will hopefully be much easier to get work done.

I am, for my text, choosing _The Time Machine_ which was written in 1895 by H.G. Wells.

My general plan is to make a game as my appropriation with time travel as a main mechanic.


text:
using ::spdy::AcceptChOriginValuePair;
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::Pair;

namespace net {
namespace {

TEST(AlpsDecoderTest, EmptyInput) {
  AlpsDecoder decoder;
  EXPECT_THAT(decoder.GetAcceptCh(), IsEmpty());
  EXPECT_THAT(decoder.GetSettings(), IsEmpty());
  EXPECT_EQ(0, decoder.settings_frame_count());

  AlpsDecoder::Error error = decoder.Decode({});
  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);

  EXPECT_THAT(decoder.GetAcceptCh(), IsEmpty());
  EXPECT_THAT(decoder.GetSettings(), IsEmpty());
  EXPECT_EQ(0, decoder.settings_frame_count());
}

TEST(AlpsDecoderTest, EmptyAcceptChFrame) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000000"       // length
                               "89"           // type ACCEPT_CH
                               "00"           // flags
                               "00000000"));  // stream ID

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
  EXPECT_THAT(decoder.GetAcceptCh(), IsEmpty());
  EXPECT_THAT(decoder.GetSettings(), IsEmpty());
  EXPECT_EQ(0, decoder.settings_frame_count());
}

TEST(AlpsDecoderTest, EmptySettingsFrame) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000000"       // length
                               "04"           // type SETTINGS
                               "00"           // flags
                               "00000000"));  // stream ID

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
  EXPECT_THAT(decoder.GetAcceptCh(), IsEmpty());
  EXPECT_THAT(decoder.GetSettings(), IsEmpty());
  EXPECT_EQ(1, decoder.settings_frame_count());
}

TEST(AlpsDecoderTest, ParseSettingsAndAcceptChFrames) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error = decoder.Decode(HexDecode(
      // ACCEPT_CH frame
      "00003d"                    // length
      "89"                        // type ACCEPT_CH
      "00"                        // flags
      "00000000"                  // stream ID
      "0017"                      // origin length
      "68747470733a2f2f7777772e"  //
      "6578616d706c652e636f6d"    // origin "https://www.example.com"
      "0003"                      // value length
      "666f6f"                    // value "foo"
      "0018"                      // origin length
      "68747470733a2f2f6d61696c"  //
      "2e6578616d706c652e636f6d"  // origin "https://mail.example.com"
      "0003"                      // value length
      "626172"                    // value "bar"
      // SETTINGS frame
      "00000c"       // length
      "04"           // type
      "00"           // flags
      "00000000"     // stream ID
      "0dab"         // identifier
      "01020304"     // value
      "1234"         // identifier
      "fedcba98"));  // value

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
  EXPECT_THAT(
      decoder.GetAcceptCh(),
      ElementsAre(AcceptChOriginValuePair{"https://www.example.com", "foo"},
                  AcceptChOriginValuePair{"https://mail.example.com", "bar"}));
  EXPECT_THAT(decoder.GetSettings(),
              ElementsAre(Pair(0x0dab, 0x01020304), Pair(0x1234, 0xfedcba98)));
  EXPECT_EQ(1, decoder.settings_frame_count());
}

TEST(AlpsDecoderTest, IncompleteFrame) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("00000c"    // length
                               "04"        // type
                               "00"        // flags
                               "00000000"  // stream ID
                               "0dab"      // identifier
                               "01"));     // first byte of value

  EXPECT_EQ(AlpsDecoder::Error::kNotOnFrameBoundary, error);
}

TEST(AlpsDecoderTest, TwoSettingsFrames) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000006"       // length
                               "04"           // type SETTINGS
                               "00"           // flags
                               "00000000"     // stream ID
                               "0dab"         // identifier
                               "01020304"     // value
                               "000006"       // length
                               "04"           // type SETTINGS
                               "00"           // flags
                               "00000000"     // stream ID
                               "1234"         // identifier
                               "fedcba98"));  // value

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
  EXPECT_EQ(2, decoder.settings_frame_count());
  EXPECT_THAT(decoder.GetSettings(),
              ElementsAre(Pair(0x0dab, 0x01020304), Pair(0x1234, 0xfedcba98)));
}

TEST(AlpsDecoderTest, AcceptChOnInvalidStream) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error = decoder.Decode(
      HexDecode("00001e"                    // length
                "89"                        // type ACCEPT_CH
                "00"                        // flags
                "00000001"                  // invalid stream ID: should be zero
                "0017"                      // origin length
                "68747470733a2f2f7777772e"  //
                "6578616d706c652e636f6d"    // origin "https://www.example.com"
                "0003"                      // value length
                "666f6f"));                 // value "foo"

  EXPECT_EQ(AlpsDecoder::Error::kAcceptChInvalidStream, error);
}

// According to
// https://davidben.github.io/http-client-hint-reliability/ \
// draft-davidben-http-client-hint-reliability.html#name-http-2-accept_ch-frame
// "If a user agent receives an ACCEPT_CH frame whose stream [...] flags
// field is non-zero, it MUST respond with a connection error [...]."
TEST(AlpsDecoderTest, AcceptChWithInvalidFlags) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error = decoder.Decode(
      HexDecode("00001e"                    // length
                "89"                        // type ACCEPT_CH
                "02"                        // invalid flags: should be zero
                "00000000"                  // stream ID
                "0017"                      // origin length
                "68747470733a2f2f7777772e"  //
                "6578616d706c652e636f6d"    // origin "https://www.example.com"
                "0003"                      // value length
                "666f6f"));                 // value "foo"

  EXPECT_EQ(AlpsDecoder::Error::kAcceptChWithFlags, error);
}

TEST(AlpsDecoderTest, SettingsOnInvalidStream) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000006"    // length
                               "04"        // type SETTINGS
                               "00"        // flags
                               "00000001"  // invalid stream ID: should be zero
                               "1234"      // identifier
                               "fedcba98"));  // value

  EXPECT_EQ(AlpsDecoder::Error::kFramingError, error);
}

TEST(AlpsDecoderTest, SettingsAck) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000000"       // length
                               "04"           // type SETTINGS
                               "01"           // ACK flag
                               "00000000"));  // stream ID

  EXPECT_EQ(AlpsDecoder::Error::kSettingsWithAck, error);
}

// According to https://httpwg.org/specs/rfc7540.html#FrameHeader:
// "Flags that have no defined semantics for a particular frame type MUST be
// ignored [...]"
TEST(AlpsDecoderTest, SettingsWithInvalidFlags) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000006"       // length
                               "04"           // type SETTINGS
                               "02"           // invalid flag
                               "00000000"     // stream ID
                               "1234"         // identifier
                               "fedcba98"));  // value

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
}

TEST(AlpsDecoderTest, ForbiddenFrame) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000003"     // length
                               "00"         // frame type DATA
                               "01"         // flags END_STREAM
                               "00000001"   // stream ID
                               "666f6f"));  // payload "foo"

  EXPECT_EQ(AlpsDecoder::Error::kForbiddenFrame, error);
}

TEST(AlpsDecoderTest, UnknownFrame) {
  AlpsDecoder decoder;
  AlpsDecoder::Error error =
      decoder.Decode(HexDecode("000003"     // length
                               "2a"         // unknown frame type
                               "ff"         // flags
                               "00000008"   // stream ID
                               "666f6f"));  // payload "foo"

  EXPECT_EQ(AlpsDecoder::Error::kNoError, error);
  EXPECT_THAT(decoder.GetAcceptCh(), IsEmpty());
  EXPECT_THAT(decoder.GetSettings(), IsEmpty());
  EXPECT_EQ(0, decoder.settings_frame_count());
}

TEST(AlpsDecoderTest, MalformedAcceptChFrame) {
  // Correct, complete payload.
  std::string payload = HexDecode(
      "0017"  // origin length
      "68747470733a2f2f7777772e"
      "6578616d706c652e636f6d"  // origin "https://www.example.com"
      "0003"                    // value length
      "666f6f");                // value "foo"

  for (uint8_t payload_length = 1; payload_length < payload.length();
       payload_length++) {
    // First two bytes of length.
    std::string frame = HexDecode("0000");
    // Last byte of length.
    frame.push_back(static_cast<char>(payload_length));

    frame.append(
        HexDecode("89"           // type ACCEPT_CH
                  "00"           // flags
                  "00000000"));  // stream ID
    // Incomplete, malformed payload.
    frame.append(payload.data(), payload_length);

    AlpsDecoder decoder;
    AlpsDecoder::Error error = decoder.Decode(frame);

    EXPECT_EQ(AlpsDecoder::Error::kAcceptChMalformed, error);
  }
}

}  // namespace
}  // namespace net


text:
package cgeo.geocaching.connector.gc;

import org.eclipse.jdt.annotation.NonNull;

import java.util.Locale;
import java.util.regex.Pattern;

/**
 * These patterns have been optimized for speed. Improve them only if you can prove
 * that *YOUR* pattern is faster. Use RegExRealPerformanceTest to show.
 *
 * For further information about patterns have a look at
 * http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html
 */
public final class GCConstants {

    static final String GC_URL = "http://www.geocaching.com/";
    static final String GC_TILE_URL = "http://tiles.geocaching.com/";
    /** Live Map */
    public final static @NonNull String URL_LIVE_MAP = GC_URL + "map/default.aspx";
    /** Live Map pop-up */
    public final static @NonNull String URL_LIVE_MAP_DETAILS = GC_TILE_URL + "map.details";
    /** Caches in a tile */
    public final static @NonNull String URL_MAP_INFO = GC_TILE_URL + "map.info";
    /** Tile itself */
    public final static @NonNull String URL_MAP_TILE = GC_TILE_URL + "map.png";

    /**
     * Patterns for parsing the result of a (detailed) search
     */
    public final static Pattern PATTERN_HINT = Pattern.compile("
]*>(.*?)
", Pattern.DOTALL);
    public final static Pattern PATTERN_DESC = Pattern.compile("(.*?)\\s*
\\s*
\\s*
\\s*
", Pattern.DOTALL);
    public final static Pattern PATTERN_SHORTDESC = Pattern.compile("(.*?)\\s*
", Pattern.DOTALL);
    public final static Pattern PATTERN_GEOCODE = Pattern.compile("class=\"CoordInfoCode\">(GC[0-9A-Z]+)");
    public final static Pattern PATTERN_CACHEID = Pattern.compile("/seek/log\\.aspx\\?ID=(\\d+)");
    public final static Pattern PATTERN_GUID = Pattern.compile(Pattern.quote("&wid=") + "([0-9a-z\\-]+)" + Pattern.quote("&"));
    public final static Pattern PATTERN_SIZE = Pattern.compile("
[^<]*
]*>[^S]*Size[^:]*:[^<]*]*>[^<]*]*>[^<]*[^<]*[^<]*[^<]*
");
    public final static Pattern PATTERN_LATLON = Pattern.compile("]*>(.*?)");
    public final static Pattern PATTERN_LATLON_ORIG = Pattern.compile("\\{\"isUserDefined\":true[^}]+?\"oldLatLngDisplay\":\"([^\"]+)\"\\}");
    public final static Pattern PATTERN_LOCATION = Pattern.compile(Pattern.quote("In ") + "(?:]*>)?(.*?)<");
    public final static Pattern PATTERN_PERSONALNOTE = Pattern.compile("]*>(.*?)", Pattern.DOTALL);
    public final static Pattern PATTERN_NAME = Pattern.compile("(.*?)");
    public final static Pattern PATTERN_DIFFICULTY = Pattern.compile("]*>[^<]*<img src=\"[^\"]*/images/stars/stars([0-9_]+)\\.gif\"");
    public final static Pattern PATTERN_TERRAIN = Pattern.compile("]*>[^<]*<img src=\"[^\"]*/images/stars/stars([0-9_]+)\\.gif\"");
    public final static Pattern PATTERN_OWNER_USERID = Pattern.compile("other caches hidden or");
    public final static Pattern PATTERN_FOUND = Pattern.compile("ctl00_ContentBody_GeoNav_logText\">(Found It|Attended)");
    public final static Pattern PATTERN_FOUND_ALTERNATIVE = Pattern.compile("
Logged on: ([^<]+?)<");
    public final static Pattern PATTERN_OWNER_DISPLAYNAME = Pattern.compile("
[^<]+([^<]+)");
    public final static Pattern PATTERN_TYPE = Pattern.compile("<a href=\"/seek/nearest.aspx\\?tx=([0-9a-f-]+)");
    public final static Pattern PATTERN_HIDDEN = Pattern.compile("
\\W*Hidden[\\s:]*([^<]+?)
");
    public final static Pattern PATTERN_HIDDENEVENT = Pattern.compile("Event\\s*Date\\s*:\\s*([^<]+)
", Pattern.DOTALL);
    public final static Pattern PATTERN_FAVORITE = Pattern.compile("
"); // without 'class="hideMe"' inside the tag !
    public final static Pattern PATTERN_FAVORITECOUNT = Pattern.compile("\\D*([0-9]+?)\\D*");
    public final static Pattern PATTERN_COUNTLOGS = Pattern.compile("<p(.+?)
");
    public final static Pattern PATTERN_LOGBOOK = Pattern.compile("initalLogs = (\\{.+\\});"); // The "inital" typo really comes from gc.com site
    /** Two groups ! */
    public final static Pattern PATTERN_COUNTLOG = Pattern.compile("]+> (\\d*[,.]?\\d+)");
    public static final Pattern PATTERN_PREMIUMMEMBERS = Pattern.compile("
This is a Premium Member Only cache.
");
    public final static Pattern PATTERN_ATTRIBUTES = Pattern.compile("Attributes\\s*
[^<]*
((?:[^<]*]*>)+?)[^<]*<p");
    /** Two groups ! */
    public final static Pattern PATTERN_ATTRIBUTESINSIDE = Pattern.compile("[^<]*<img src=\"([^\"]+)\" alt=\"([^\"]+?)\"");
    public final static Pattern PATTERN_SPOILER_IMAGE = Pattern.compile("]+>([^<]+)(?:
([^<]+)

)?");
    public final static Pattern PATTERN_INVENTORY = Pattern.compile("\\W*Inventory[^<]*[^<]*
[^<]*
([^<]*
(([^<]*
[^<]*]*>[^<]*]*>[^<]*[^<]+<\\/span>[^<]*<\\/a>[^<]*<\\/li>)+)[^<]*<\\/ul>)?");
    public final static Pattern PATTERN_INVENTORYINSIDE = Pattern.compile("[^<]*
[^<]*]*>[^<]*]*>[^<]*([^<]+)<\\/span>[^<]*<\\/a>[^<]*<\\/li>");
    public final static Pattern PATTERN_WATCHLIST = Pattern.compile(Pattern.quote("watchlist.aspx") + ".{1,50}" + Pattern.quote("action=rem"));

    // Info box top-right
    public static final Pattern PATTERN_LOGIN_NAME = Pattern.compile("\"SignedInProfileLink\">([^<]+)");
    public static final Pattern PATTERN_MEMBER_STATUS = Pattern.compile("([^<]+)");
    public static final String MEMBER_STATUS_RENEW = "<a id=\"ctl00_hlRenew";
    public static final String MEMBER_STATUS_PM = "Premium Member";
    /** Use replaceAll("[,.]","") on the resulting string before converting to an int */
    public static final Pattern PATTERN_CACHES_FOUND = Pattern.compile("]*>.*?([\\d,.]+) Caches? Found", Pattern.DOTALL);
    public static final Pattern PATTERN_AVATAR_IMAGE_PROFILE_PAGE = Pattern.compile("src=\"(https?://imgcdn.geocaching.com/avatar/[0-9a-f-]+\\.jpg)\"[^>]*alt=\"Avatar\"");
    public static final Pattern PATTERN_LOGIN_NAME_LOGIN_PAGE = Pattern.compile("ctl00_ContentBody_lbUsername\">.*(.*)");
    public static final Pattern PATTERN_CUSTOMDATE = Pattern.compile("<option selected=\"selected\" value=\"([ /Mdy-]+)\">");
    public static final Pattern PATTERN_MAP_LOGGED_IN = Pattern.compile("<a href=\"https?://www.geocaching.com/my/\" class=\"CommonUsername\"");

    /**
     * Patterns for parsing trackables
     */
    public final static Pattern PATTERN_TRACKABLE_GUID = Pattern.compile("]*>[^<]*");
    public final static Pattern PATTERN_TRACKABLE_GEOCODE = Pattern.compile("(TB[0-9A-Z]+)[^<]* to reference this item.");

    // multiple error codes, depending on the search term for the trackable code
    public final static String ERROR_TB_DOES_NOT_EXIST = "does not exist in the system";
    public final static String ERROR_TB_ELEMENT_EXCEPTION = "ElementNotFound Exception";
    public final static String ERROR_TB_ARITHMETIC_OVERFLOW = "operation resulted in an overflow";
    public final static String ERROR_TB_NOT_ACTIVATED = "hasn't been activated";
    /**
     * some parts of the webpage don't correctly encode the name, therefore this pattern must be checked with a
     * trackable name that needs HTML encoding
     */
    public final static Pattern PATTERN_TRACKABLE_NAME = Pattern.compile("(.*?)");
    /** Two groups ! */
    public final static Pattern PATTERN_TRACKABLE_OWNER = Pattern.compile("]+href=\"https?://www.geocaching.com/profile/\\?guid=(.*?)\">(.*?)");
    public final static Pattern PATTERN_TRACKABLE_RELEASES = Pattern.compile("
\\W*Released:[^<]*
[^<]*
[^<]*([^<]+)<\\/span>[^<]*
");
    public final static Pattern PATTERN_TRACKABLE_ORIGIN = Pattern.compile("
\\W*Origin:[^<]*
[^<]*
[^<]*([^<]+)<\\/span>[^<]*
");
    /** Two groups ! */
    public final static Pattern PATTERN_TRACKABLE_SPOTTEDCACHE = Pattern.compile("
\\W*Recently Spotted:[^<]*
[^<]*
[^<]*In ([^<]+)[^<]*
");
    /** Two groups ! */
    public final static Pattern PATTERN_TRACKABLE_SPOTTEDUSER = Pattern.compile("
\\W*Recently Spotted:[^<]*
[^<]*
[^<]*In the hands of ([^<]+).[^<]*
");
    public final static Pattern PATTERN_TRACKABLE_SPOTTEDUNKNOWN = Pattern.compile("
\\W*Recently Spotted:[^<]*
[^<]*
[^<]*Unknown Location[^<]*[^<]*
");
    public final static Pattern PATTERN_TRACKABLE_SPOTTEDOWNER = Pattern.compile("
\\W*Recently Spotted:[^<]*
[^<]*
[^<]*In the hands of the owner[^<]*[^<]*
");
    public final static Pattern PATTERN_TRACKABLE_GOAL = Pattern.compile("
[^<]*
(.*?)
[^<]*
", Pattern.DOTALL);
    /** Four groups */
    public final static Pattern PATTERN_TRACKABLE_DETAILSIMAGE = Pattern.compile("
\\W*About This Item[^<]*
[^<]*
([^<]*
([^<]*]*>)?[^<]*
)?[^<]*
]*>(.*)
[^<]*

");
    public final static Pattern PATTERN_TRACKABLE_ICON = Pattern.compile("]*>");
    public final static Pattern PATTERN_TRACKABLE_TYPE = Pattern.compile("]*>");
    public final static Pattern PATTERN_TRACKABLE_DISTANCE = Pattern.compile("
]*\\W*Tracking History \\(([0-9.,]+(km|mi))[^\\)]*\\)");
    public final static Pattern PATTERN_TRACKABLE_LOG = Pattern.compile("
]+> ([^<]+)	.+?guid.+?>([^<]+).+?(?:guid=([^\"]+)\">(]+>)?([^<]+)</.+?)?\\s*
(.*?)
\\s*(?:
)?\\s*	\\s*
");
    public final static Pattern PATTERN_TRACKABLE_LOG_IMAGES = Pattern.compile("
([^<]+)</");

    /**
     * Patterns for parsing the result of a search (next)
     */
    public final static Pattern PATTERN_SEARCH_TYPE = Pattern.compile(".*?]*>[^<]*");
    public final static Pattern PATTERN_SEARCH_GUIDANDDISABLED = Pattern.compile("SearchResultsWptType.*?([^<]*)[^|]*[|][^|]*[|]([^<]*)<");
    /** Two groups **/
    public final static Pattern PATTERN_SEARCH_TRACKABLES = Pattern.compile("]*>(.*)");
    /** Second group used */
    public final static Pattern PATTERN_SEARCH_TRACKABLESINSIDE = Pattern.compile("([^<]*)");
    public final static Pattern PATTERN_SEARCH_DIRECTION_DISTANCE = Pattern.compile("]*>[^<]*
([^<]+)");
    public final static Pattern PATTERN_SEARCH_DIFFICULTY_TERRAIN = Pattern.compile("([0-5]([\\.,]5)?)/([0-5]([\\.,]5)?)
");
    public final static Pattern PATTERN_SEARCH_CONTAINER = Pattern.compile("([0-9,.]+)");
    public final static Pattern PATTERN_SEARCH_TOTALCOUNT = Pattern.compile("Total Records\\D*(\\d+)<");
    public final static Pattern PATTERN_SEARCH_RECAPTCHA = Pattern.compile("


text:
pkg_name=shield-daemon
pkg_origin=starkandwayne
pkg_version="0.10.9"
pkg_maintainer="Justin Carter <justin@starkandwayne.com>"
pkg_license=('MIT')
pkg_description="A standalone system that can perform backup and restore functions for a wide variety of pluggable data systems."
pkg_upstream_url="https://github.com/starkandwayne/shield"
pkg_source="https://github.com/starkandwayne/shield/archive/v${pkg_version}.tar.gz"
pkg_shasum="dbea689596bc496e2f16f8a4bf2aaade8fb693b3934f11b5b7e956573ebbc599"

pkg_deps=(core/bash core/glibc starkandwayne/postgresql)
pkg_build_deps=(core/go core/git core/gcc core/make core/gox)

pkg_bin_dirs=(bin)

pkg_exports=(
  [provisioning_key]=auth.provisioning_key
)

pkg_svc_user=root
pkg_svc_group=$pkg_svc_user

# Optional.
# An associative array representing services which you depend on and the configuration keys that
# you expect the service to export (by their `pkg_exports`). These binds *must* be set for the
# supervisor to load the service. The loaded service will wait to run until it's bind becomes
# available. If the bind does not contain the expected keys, the service will not start
# successfully.
pkg_binds=(
  [database]="port superuser_name superuser_password"
)

# Optional.
# Same as `pkg_binds` but these represent optional services to connect to.
# pkg_binds_optional=(
#   [storage]="port host"
# )

# Optional.
# An array of interpreters used in shebang lines for scripts. Specify the
# subdirectory where the binary is relative to the package, for example,
# bin/bash or libexec/neverland, since binaries can be located in directories
# besides bin. This list of interpreters will be written to the metadata
# INTERPRETERS file, located inside a package, with their fully-qualified path.
# Then these can be used with the fix_interpreter function.
# pkg_interpreters=(bin/bash)

# Optional.
# The user to run the service as. The default is hab.
# pkg_svc_user="hab"

# Optional.
# The group to run the service as. The default is hab.
# pkg_svc_group="$pkg_svc_user"

do_begin() {
  export SHIELD_SRC_PATH="${HAB_CACHE_SRC_PATH}/shield-$pkg_version/src/github.com/starkandwayne/shield"
  export GOPATH="$HAB_CACHE_SRC_PATH/shield-$pkg_version"
}

do_prepare() {
  rm -rf $HAB_CACHE_SRC_PATH/shield
  mkdir -p ${HAB_CACHE_SRC_PATH}/shield
  mv $HAB_CACHE_SRC_PATH/shield-$pkg_version/* $HAB_CACHE_SRC_PATH/shield/

  mkdir -p ${SHIELD_SRC_PATH}
  mv $HAB_CACHE_SRC_PATH/shield/* ${SHIELD_SRC_PATH}

  export PATH=$PATH:$GOPATH/bin

  git config --global url."git://github.com/".insteadOf "https://github.com/"
  go get github.com/tools/godep
  cd ${SHIELD_SRC_PATH}
}

do_build() {
  export VERSION=${pkg_version}
  cd ${SHIELD_SRC_PATH}
  make release
}

do_install() {
  cd ${SHIELD_SRC_PATH}/artifacts
  tar -xvzf shield-server-linux-amd64.tar.gz
  cd shield-server-linux-amd64

  cp cli/shield           ${pkg_prefix}/bin
  cp daemon/shieldd       ${pkg_prefix}/bin
  cp daemon/shield-schema ${pkg_prefix}/bin
  cp -R webui             ${pkg_prefix}/webui
}


text:
#import <UIKit/UIKit.h>
#import <ResearchKit/ResearchKit.h>

/*
 This custom task is used to verify correct behavior of `ORKTaskViewController`
 when it is used on a task that is not an `ORKOrderedTask` subclass.

 This also tests turning off navigation-bar progress indication for a task.
 */
@interface DynamicTask : NSObject <ORKTask>

@end


text:
using System;
using slang.Compilation;
using slang.Compiler.Core.Compilation;
using System.Linq;
using sc.Terminal;

namespace sc
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Messages.WriteLogo ();
            Messages.WriteHeader ();
            ValidateArgs (args);
            var solution = BuildCompilationRoot (args[0]);

            try {
                SlangCompiler.Compile (solution);
            } catch (Exception e) {
                Messages.WriteError ("{0}", e.Message);
                Environment.Exit (e.HResult);
            }

            Environment.Exit (0);
        }

        static void ValidateArgs (string [] args)
        {
            if (args.Length < 1) {
                Messages.WriteError ("No project.json file specified.");
                Messages.WriteUsage ();
                Environment.Exit (1);
            }
        }

        static CompilationRoot BuildCompilationRoot (string projectName)
        {
            var projectMetadata = new CompilationMetadata (projectName, string.Empty, AssemblyType.Executable);
            var project = new CompilationUnit (projectMetadata, Enumerable.Empty<string> ());
            return new CompilationRoot (new [] { project });
        }
    }
}


text:
Reports enhanced switch statements and expressions, and suggests replacing them with a traditional switch
statement.

Example:

  boolean even = switch (condition) {
    case 1, 3, 5, 7, 9 -> false;
    default -> true;
  };

After the quick-fix is applied the result looks like:

  boolean even;
  switch (condition) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 9:
      even = false;
      break;
    default:
      even = true;
      break;
}

New in 2019.1


text:
from django.contrib import admin
from .models import *

class DeviceReportEntryAdmin(admin.ModelAdmin):

    model = DeviceReportEntry
    list_display = [
        'xform_id',
        'msg',
        'type',
        'domain',
        'date',
        'username',
    ]

    search_fields = [
        'xform_id',
        'msg',
        'type',
        'domain',
        'date',
        'username',
    ]

admin.site.register(DeviceReportEntry, DeviceReportEntryAdmin)
admin.site.register(UserEntry)


text:
"""
setuptools config file
"""

import sys

# Check minimum Python version
PYVER_MAJOR = 3
PYVER_MINOR = 3
if not (sys.version_info[0] == PYVER_MAJOR and sys.version_info[1] >= PYVER_MINOR):
    print("Sorry, Python >= 3.3 is supported (for the moment")
    sys.exit(1)

from setuptools import setup, find_packages
import versioneer
import os
from m2bk.const import PKG_NAME, PKG_URL

# versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = "{p}/_version.py".format(p=PKG_NAME)
versioneer.versionfile_build = "{p}/_version.py".format(p=PKG_NAME)
versioneer.tag_prefix = ''
versioneer.parentdir_prefix = "{p}-".format(p=PKG_NAME)

# default config file location
if sys.prefix != '/usr':
    conf_dir = os.path.join(sys.prefix, 'etc')
else:
    conf_dir = '/etc'

pkg_ver = versioneer.get_version()

setup(
    name=PKG_NAME,
    version=pkg_ver,
    cmdclass=versioneer.get_cmdclass(),
    packages=find_packages(exclude=["tests"]),
    author="Alejandro Ricoveri",
    author_email="alejandroricoveri@gmail.com",
    description="A command line tool to simplify MongoDB backups",
    long_description=open('README.rst').read(),
    url=PKG_URL,
    license='MIT',
    download_url="{url}/tarball/{version}".format(url=PKG_URL, version=pkg_ver),
    keywords=['mongodb', 'aws', 'backup', 's3'],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console	',
        'Topic :: Database',
        'Natural Language :: English',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.3',
    ],
    entry_points={
        'console_scripts': [
            'm2bk = m2bk.app:main',
        ],
    },
    install_requires = [
        'boto  == 2.38.0',
        'envoy >= 0.0.3',
        'pyyaml >= 3.11',
        'clint >= 0.4.1'
    ],
    tests_require = ['nose >= 1.3'],
    test_suite="nose.collector",
    data_files=[(conf_dir, ['data/m2bk.yaml'])]
)


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

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

public class CrossSellErrorReason implements java.io.Serializable {
    private java.lang.String _value_;
    private static java.util.HashMap _table_ = new java.util.HashMap();

    // Constructor
    protected CrossSellErrorReason(java.lang.String value) {
        _value_ = value;
        _table_.put(_value_,this);
    }

    public static final java.lang.String _UNSUPPORTED_RESERVATION_TYPE = "UNSUPPORTED_RESERVATION_TYPE";
    public static final java.lang.String _NO_VALID_ELIGIBLE_RESERVATION_TYPES = "NO_VALID_ELIGIBLE_RESERVATION_TYPES";
    public static final java.lang.String _COMPANY_IS_NOT_DISTRIBUTION_PARTNER = "COMPANY_IS_NOT_DISTRIBUTION_PARTNER";
    public static final java.lang.String _CHANGING_PARTNER_NETWORK_IS_NOT_SUPPORTED = "CHANGING_PARTNER_NETWORK_IS_NOT_SUPPORTED";
    public static final java.lang.String _MISSING_DISTRIBUTOR_PARTNER_NAME = "MISSING_DISTRIBUTOR_PARTNER_NAME";
    public static final java.lang.String _DISTRIBUTOR_NETWORK_MISSING_PUBLISHER_FEATURE = "DISTRIBUTOR_NETWORK_MISSING_PUBLISHER_FEATURE";
    public static final java.lang.String _CONTENT_PROVIDER_NETWORK_MISSING_PUBLISHER_FEATURE = "CONTENT_PROVIDER_NETWORK_MISSING_PUBLISHER_FEATURE";
    public static final java.lang.String _INVALID_DISTRIBUTOR_PARTNER_NAME = "INVALID_DISTRIBUTOR_PARTNER_NAME";
    public static final java.lang.String _INVALID_CONTENT_PROVIDER_NETWORK = "INVALID_CONTENT_PROVIDER_NETWORK";
    public static final java.lang.String _CONTENT_PROVIDER_NETWORK_CANNOT_BE_ACTIVE_NETWORK = "CONTENT_PROVIDER_NETWORK_CANNOT_BE_ACTIVE_NETWORK";
    public static final java.lang.String _CONTENT_PROVIDER_NETWORK_ALREADY_ENABLED_FOR_CROSS_SELLING = "CONTENT_PROVIDER_NETWORK_ALREADY_ENABLED_FOR_CROSS_SELLING";
    public static final java.lang.String _DISTRIBUTOR_RULE_VIOLATION_ERROR = "DISTRIBUTOR_RULE_VIOLATION_ERROR";
    public static final java.lang.String _DISTRIBUTOR_RULE_VIOLATION_WARNING = "DISTRIBUTOR_RULE_VIOLATION_WARNING";
    public static final java.lang.String _UNKNOWN = "UNKNOWN";
    public static final CrossSellErrorReason UNSUPPORTED_RESERVATION_TYPE = new CrossSellErrorReason(_UNSUPPORTED_RESERVATION_TYPE);
    public static final CrossSellErrorReason NO_VALID_ELIGIBLE_RESERVATION_TYPES = new CrossSellErrorReason(_NO_VALID_ELIGIBLE_RESERVATION_TYPES);
    public static final CrossSellErrorReason COMPANY_IS_NOT_DISTRIBUTION_PARTNER = new CrossSellErrorReason(_COMPANY_IS_NOT_DISTRIBUTION_PARTNER);
    public static final CrossSellErrorReason CHANGING_PARTNER_NETWORK_IS_NOT_SUPPORTED = new CrossSellErrorReason(_CHANGING_PARTNER_NETWORK_IS_NOT_SUPPORTED);
    public static final CrossSellErrorReason MISSING_DISTRIBUTOR_PARTNER_NAME = new CrossSellErrorReason(_MISSING_DISTRIBUTOR_PARTNER_NAME);
    public static final CrossSellErrorReason DISTRIBUTOR_NETWORK_MISSING_PUBLISHER_FEATURE = new CrossSellErrorReason(_DISTRIBUTOR_NETWORK_MISSING_PUBLISHER_FEATURE);
    public static final CrossSellErrorReason CONTENT_PROVIDER_NETWORK_MISSING_PUBLISHER_FEATURE = new CrossSellErrorReason(_CONTENT_PROVIDER_NETWORK_MISSING_PUBLISHER_FEATURE);
    public static final CrossSellErrorReason INVALID_DISTRIBUTOR_PARTNER_NAME = new CrossSellErrorReason(_INVALID_DISTRIBUTOR_PARTNER_NAME);
    public static final CrossSellErrorReason INVALID_CONTENT_PROVIDER_NETWORK = new CrossSellErrorReason(_INVALID_CONTENT_PROVIDER_NETWORK);
    public static final CrossSellErrorReason CONTENT_PROVIDER_NETWORK_CANNOT_BE_ACTIVE_NETWORK = new CrossSellErrorReason(_CONTENT_PROVIDER_NETWORK_CANNOT_BE_ACTIVE_NETWORK);
    public static final CrossSellErrorReason CONTENT_PROVIDER_NETWORK_ALREADY_ENABLED_FOR_CROSS_SELLING = new CrossSellErrorReason(_CONTENT_PROVIDER_NETWORK_ALREADY_ENABLED_FOR_CROSS_SELLING);
    public static final CrossSellErrorReason DISTRIBUTOR_RULE_VIOLATION_ERROR = new CrossSellErrorReason(_DISTRIBUTOR_RULE_VIOLATION_ERROR);
    public static final CrossSellErrorReason DISTRIBUTOR_RULE_VIOLATION_WARNING = new CrossSellErrorReason(_DISTRIBUTOR_RULE_VIOLATION_WARNING);
    public static final CrossSellErrorReason UNKNOWN = new CrossSellErrorReason(_UNKNOWN);
    public java.lang.String getValue() { return _value_;}
    public static CrossSellErrorReason fromValue(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        CrossSellErrorReason enumeration = (CrossSellErrorReason)
            _table_.get(value);
        if (enumeration==null) throw new java.lang.IllegalArgumentException();
        return enumeration;
    }
    public static CrossSellErrorReason fromString(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}
    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumSerializer(
            _javaType, _xmlType);
    }
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumDeserializer(
            _javaType, _xmlType);
    }
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(CrossSellErrorReason.class);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201306", "CrossSellError.Reason"));
    }
    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

}


text:
/*
* Name: BarChartActivity.java
* Package: it.kaizenteam.app.view
* Location: Sources/Applicazione/main/java/it/kaizenteam/app/view
* Date: 2015-05-19
* Version: v1.00
*
* History:
* =================================================================
* Version	Date	Programmer	Changes
* =================================================================
* v1.00 2015-06-15  Carlon Chiara  Approved
* =================================================================
* v0.04 2015-06-01  Moretto Alessandro  Verify
* =================================================================
* v0.03 2015-05-28  Rubin Marco Edit
* =================================================================
* v0.02 2015-05-22  Dal Bianco Davide   Verify
* =================================================================
* v0.01 2015-05-19  Moretto Alessandro  Creation
* =================================================================
*
*/

package it.kaizenteam.app.view;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.HorizontalBarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;

import java.util.ArrayList;

import it.kaizenteam.app.R;
import it.kaizenteam.app.model.NorrisChart.BarChartDataImpl;
import it.kaizenteam.app.model.NorrisChart.ChartData;
import it.kaizenteam.app.presenter.BarChartPresenter;
import it.kaizenteam.app.presenter.PresenterImpl;

/**
 * BarChartActivity specializes ChartActivity and constitutes an Activity for bar charts. It provides static constants that represent the possible values to be passed to methods to change the view.
 */
public class BarChartActivity extends ChartActivity implements BarChartView{
    private BarChart chart;

    /**
     * This method is performed by android at the creation of the Activity. It will be tasked to initializing its presenter.
     * @param savedInstanceState instance state
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bar_chart);
        chart=(BarChart)findViewById(R.id.chartv);
        presenter= PresenterImpl.create(PresenterImpl.ChartType.BARCHART_TYPE,this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        ((BarChartPresenter)presenter).setChart(getIntent().getStringExtra("id"));
        chart.setDescription("");
        chart.invalidate();
    }

    @Override
    protected void onPause() {
        super.onPause();
        ((BarChartPresenter)presenter).onPause();
        chart.setDescription("");
        chart.invalidate();
    }

    /**
     * This method will display correctly the chart passed as a parameter.
     * @param data chart
     */
    @Override
    public void renderChart(ChartData data) {
        chart.clear();
        BarData datanew =((BarChartDataImpl) data).getData();
        float max=-1212121;
        float min=+1212121;
        for(int i =0;i<datanew.getDataSets().size();i++){
            for(int j =0;j<datanew.getDataSets().get(i).getYVals().size();j++){
                if(datanew.getDataSets().get(i).getYVals().get(j).getVal()>max)
                    max=datanew.getDataSets().get(i).getYVals().get(j).getVal();
                else
                    if(datanew.getDataSets().get(i).getYVals().get(j).getVal()<min)
                        min=datanew.getDataSets().get(i).getYVals().get(j).getVal();
            }
        }
        chart.setData(datanew);
        chart.getAxisLeft().setAxisMaxValue(max + 1);
        chart.getAxisRight().setAxisMaxValue(max + 1);
        if(min<0) {
            chart.getAxisLeft().setStartAtZero(false);
            chart.getAxisRight().setStartAtZero(false);
        }
        chart.getAxisLeft().setAxisMinValue(min - 1);
        chart.getAxisRight().setAxisMinValue(min - 1);
        chart.invalidate();
    }

    /**
     * This method provides the ability to display in the view the name of axes of the chart.
     * @param x name of x-axis
     * @param y name of y-axis
     */
    @Override
    public void setAxisName(String x, String y) {
        if (chart instanceof HorizontalBarChart) {
            ((TextView) findViewById(R.id.xlabelbar)).setText(y);
            ((TextView) findViewById(R.id.ylabelbar)).setText(x.replace("", "\n"));
        }
        else{
            ((TextView) findViewById(R.id.xlabelbar)).setText(x);
            ((TextView) findViewById(R.id.ylabelbar)).setText(y.replace("", "\n"));
        }
    }

    /**
     * This method provides the ability to view or not the grid in the chart. If the parameter is true appears and hidden otherwise.
     * @param show boolean show / hidden the chart grid
     */
    @Override
    public void showGrid(boolean show) {
        chart.getXAxis().setDrawGridLines(show);
        chart.getAxisRight().setDrawGridLines(show);
        chart.getAxisLeft().setDrawGridLines(show);
        chart.invalidate();
    }

    /**
     * This method provides the ability to set the position of the legend. The positions available are eligible as static variables of the class.
     * @param position position of the legend
     */
    @Override
    public void setLegendPosition(int position) {
        chart.getLegend().setEnabled(true);
        if(position==0){
            chart.getLegend().setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
            return;
        }
        if(position==1){
            chart.getLegend().setPosition(Legend.LegendPosition.BELOW_CHART_CENTER);
            return;
        }
        if(position==2){
            chart.getLegend().setPosition(Legend.LegendPosition.BELOW_CHART_RIGHT);
            return;
        }
        if(position==3){
            chart.getLegend().setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
            return;
        }
        if(position==4){
            chart.getLegend().setPosition(Legend.LegendPosition.RIGHT_OF_CHART_INSIDE);
            return;
        }
        if(position==5){
            chart.getLegend().setEnabled(false);
            return;
        }
        chart.invalidate();
    }

    /**
     * This method provides the ability to change the orientation of the chart based on the parameter.
     * The parameters allowed are available in static constants in the class.
     * @param orientation orientation of the chart
     */
    @Override
    public void setOrientation(String orientation) {
        BarData data=chart.getBarData();
        if(orientation.equals("horizontal")){
            chart=(HorizontalBarChart)findViewById(R.id.charth);
            (findViewById(R.id.chartv)).setVisibility(View.INVISIBLE);
            (findViewById(R.id.charth)).setVisibility(View.VISIBLE);
        }
        else{
            chart=(BarChart)findViewById(R.id.chartv);
            (findViewById(R.id.charth)).setVisibility(View.INVISIBLE);
            (findViewById(R.id.chartv)).setVisibility(View.VISIBLE);
        }
        chart.setDescription("");
        renderChart(new BarChartDataImpl(data));
        chart.invalidate();
    }

    /**
     * Sets the stace between two bar
     * @param barValueSpacing space between two bar
     */
    public void setBarValueSpacing(int barValueSpacing) {
        ArrayList<BarDataSet> set =chart.getBarData().getDataSets();
        for(int i=0;i<set.size();i++)
            set.get(i).setBarSpacePercent(barValueSpacing);
        chart.invalidate();
    }

    /**
     * Sets the stace between two sets
     * @param barDataSetSpacing space between two sets
     */
    public void setBarDataSetSpacing(int barDataSetSpacing) {
        Log.e("ERRRRRR", ""+barDataSetSpacing);
        BarData data =chart.getBarData();
        data.setGroupSpace(barDataSetSpacing);
        chart.invalidate();
    }
}


text:
# Developed by Aditya Atluri
# Date: 18 Jan 2014
# Mail: pyurutu@gmail.com
# This file contains the OpenCL implementation of the Python Code
# It converts Python Code to OpenCL code
# Modified: 15 Jun 2014

import inspect,shlex
import numpy as np
import execl
import threads, blocks, declare, grammar
import device

class cl_test:
	arguments = []
	arg_nam = [""]
	returns = []
	var_nam = []
	var_val = []
	kernel_final = []
	kernel_args = ""
	kernel = "/*This is callable OpenCL kernel code generated by Urutu*/\n"
	device = "/*This is OpenCL device code generated by Urutu*/\n"
	threads = [1, 1, 1]
	blocks = [1, 1, 1]
	threads_dec = [False, False, False]
	blocks_dec = [False, False, False]
	global_func = []
	code = ""
	args = []
	type_args = []
	type_vars = []
	words = []
	sentences = []
	__global = []
	__shared = []
	__register = []
	__constant = []
	tabs = 0
	count_def = 0
	num_return = 0
	count_return = 0
	is_device_code = False
	device_py = [[]]
	device_tab = 0
	device_body_buff = ""
	device_func_name = []
	device_var_nam = [[]]
	device_type_vars = [[]]
	device_scope = False
	device_sentences = [[]]
	device_threads_dec = [False,False,False]
	device_blocks_dec = [False, False, False]
	return_kernel = False
	modules = []
	arg_mask = []

	def __init__(self, fn, args):
		stri = inspect.getsource(fn)
		sh = shlex.shlex(stri)
		self.code = stri
		self.args = args
		if type(args[0]) is list and type(args[1]) is not list:
			self.threads = args[0]
			self.args = args[1:]
		if type(args[0]) is list and type(args[1]) is list:
			self.threads = args[0]
			self.blocks = args[1]
			self.args = args[2:]
		if args[0] == True:
			self.return_kernel = True
			self.args = args[1:]
		self.typeargs()

	def decarrays(self, phrase):
#		print phrase
		if phrase[0] == '__global' and phrase[1] == 'is':
			phrase.pop(0)
			phrase.pop(0)
			for word in phrase:
				if word != ',':
					self.__global.append(word)
#			print self.__global
		if phrase[0] == '__shared' and phrase[1] == 'is':
			phrase.pop(0)
			phrase.pop(0)
			for word in phrase:
				if word != ',':
					self.__shared.append(word)
#			print self.__shared
		if phrase[0] == '__register' and phrase[1] == 'is':
			phrase.pop(0)
			phrase.pop(0)
			for word in phrase:
				if word != ',':
					self.__register.append(word)
#			print self.__register
		if phrase[0] == '__constant' and phrase[1] == 'is':
			phrase.pop(0)
			phrase.pop(0)
			for word in phrase:
				if word != ',':
					self.__constant.append(word)
#			print self.__constant

	def typeargs(self):
		id = 0
		self.args = list(self.args)
		for arg in self.args:
			try:
				j = str(type(arg[0])).split("'")
			except:
				j = str(type(arg)).split("'")
			if 'numpy' in j[1]:
				j = j[1].split(".")
				self.type_args.append(j[1]+"*")
				self.type_vars.append(j[1]+"*")
				self.arg_mask.append(True)
			else:
				arg_type = type(self.args[id])
				if type(1) == arg_type:
					self.args[id] = np.int32(self.args[id])
				if type(1.0) == arg_type:
					self.args[id] = np.float32(self.args[id])
				if type(long(1)) == arg_type:
					self.args[id] = np.int64(self.args[id])
				self.type_args.append(j[0])
				self.type_vars.append(j[0])
				self.arg_mask.append(False)
			id = id + 1

	def funcname_cl(self, control):
		self.func_name = self.keys[control + 1]
		self.kernel = self.kernel + "__kernel void CL_kernel("
		return control + 2

	def semi_colon(self, phrase):
		self.kernel = self.kernel + phrase + ";\n"

	def declare_workitems(self,keys,kernel):
#		The keys are strings
#		print "\n\nDEC_WORKITEMS", keys, self.device_threads_dec, self.device_blocks_dec
		if keys.find('tx') > -1:
			kernel, self.device_threads_dec[0] = threads.tx(self.device_threads_dec[0], kernel)
		if keys.find('ty') > -1:
			kernel, self.device_threads_dec[1] = threads.ty(self.device_threads_dec[1], kernel)
		if keys.find('tz') > -1:
			kernel, self.device_threads_dec[2] = threads.tz(self.device_threads_dec[2], kernel)
		if keys.find('bx') > -1:
			kernel, self.device_blocks_dec[0] = blocks.bx(self.device_blocks_dec[0], kernel)
		if keys.find('bx') > -1:
			kernel, self.device_blocks_dec[1] = blocks.by(self.device_blocks_dec[1], kernel)
		if keys.find('bz') > -1:
			kernel, self.device_blocks_dec[2] = blocks.bz(self.device_blocks_dec[2], kernel)
		return kernel

	def inspect_it(self,sentence,kernel):
#		print "Inside inspect_it()",sentence,kernel
		phrase = sentence.split('\t')
		if phrase.count('#') > 0:
			return
		tab = phrase.count('')
##		if tab > self.tabs and tab != len(phrase):
#			for j in range(tab - self.tabs):
#				kernel = kernel + "{\n"
		if tab < self.tabs:
			for j in range(self.tabs - tab):
				kernel = kernel + "}\n"
		self.tabs = phrase.count('')
		sh = shlex.shlex(phrase[-1])
		i = sh.get_token()
		if i == '@' or i == 'def' or i == '' or i == '#' or i == '//' or i == '"""':
			return kernel
		stmt = []
		while i is not sh.eof:
			stmt.append(i)
			i = sh.get_token()
#		print stmt
		for j in self.device_func_name:
			if stmt.count(j) > 0:
				kernel += self.device_create_func(self.device_func_name.index(j),j, stmt)
				kernel = self.device_body_buff + "}\n" + kernel
				self.device_body_buff = ""
				return kernel
		if self.keys.count('tx') > 0 or self.keys.count("__shared"):
			kernel, self.threads_dec[0] = threads.tx(self.threads_dec[0], kernel)
		if self.keys.count('ty') > 0:
			kernel, self.threads_dec[1] = threads.ty(self.threads_dec[1], kernel)
		if self.keys.count('tz') > 0:
			kernel, self.threads_dec[2] = threads.tz(self.threads_dec[2], kernel)
		if self.keys.count('bx') > 0:
			kernel, self.blocks_dec[0] = blocks.bx(self.blocks_dec[0], kernel)
		if self.keys.count('bx') > 0:
			kernel, self.blocks_dec[1] = blocks.by(self.blocks_dec[1], kernel)
		if self.keys.count('bz') > 0:
			kernel, self.blocks_dec[2] = blocks.bz(self.blocks_dec[2], kernel)
		if stmt.count('Tx') == 1 or stmt.count('Ty') == 1 or stmt.count('Tz') == 1:
			threads.threads_decl(stmt, self.var_nam, self.var_val, self.threads, self.type_vars)
			return kernel
		if stmt.count('Bx') == 1 or stmt.count('By') == 1 or stmt.count('Bz') == 1:
			blocks.blocks_decl(stmt, self.var_nam, self.var_val, self.blocks)
			return kernel
		if stmt[0] == '__global' or stmt[0] == '__shared' or stmt[0] == '__register' or stmt[0] == '__constant' :
			self.decarrays(stmt)
			return kernel
		if stmt.count('for') > 0:
			kernel += self._for(stmt, kernel)
			return kernel
		if stmt.count('if') > 0:
			return kernel + grammar.keyword(stmt, kernel)
		if stmt.count('else') > 0:
			kernel = kernel + "else{\n "
			self.tabs+=1
			return kernel
		if stmt.count('Urmod') > 0:
			self.modules.append(stmt[2:])
			self.kernel_final.append(kernel+"}")
			kernel = "__kernel void" + self.global_func + "_" + str(len(self.modules)+1) + "(" + self.kernel_args + "){\n"
			kernel = "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" + kernel
			self.threads_dec = [False, False, False]
			self.blocks_dec = [False, False, False]
			self.kernel = kernel
			return kernel
		else:
#			print "Entering Checkvars"
			return self.checkvars(stmt,phrase[-1],kernel)
#		print stmt, self.tabs

	def Urmod(self,stmt,cl_args):
		id = stmt.index('(')
		function = stmt[id-1]
		module = stmt[id-3]
		string_args = [""]
		var = ""
		for i in stmt[id+1:-1]:
			if i is not ',':
				if self.arg_nam.count(i) > 0:
					string_args[-1] = "args[" + str(self.arg_nam.index(i)) + "]"
				elif i == "size":
					size = self.args[self.arg_nam.index(stmt[stmt.index(i)-2])].size
					string_args[-1] = str(size)
				else:
					string_args[-1] += str(i)
			else:
				string_args.append("")
		module.execute(module,function,string_args,cu_args)

	def device_create_func(self,index,name,stmt):
#		print "Inside DCF",name, stmt, self.device_py
		device_keys = self.device_py[index]
		self.device_scope = True
#		print "Device Keys",device_keys
		if stmt[stmt.index("(")+1] == "[" and stmt[stmt.index("(")+3] == "]":
			print "Dynamic Parallelism"
		else:
			self.device_funcname(stmt[:],device_keys[device_keys.index('(')+1:device_keys.index(')')],True)
#			print self.device_body_buff
#			print "Inititiate threads"
#			print stmt
			index = self.device_func_name.index(name)
			for i in self.device_sentences[index]:
				self.device_body_buff = self.declare_workitems(i,self.device_body_buff)
#			print "Inside CREATING DEVICE BODY"
			for i in self.device_sentences[index]:
				self.device_body_buff = self.inspect_it(i,self.device_body_buff)
#			print self.device_body_buff
		self.device_scope = False
		self.kernel = self.device_body_buff + self.kernel
		self.device_threads_dec = [False, False, False]
		self.device_blocks_dec = [False, False, False]
		return self.stringize(stmt) + "; \n"

	def device_funcname(self,stmt,args,device):
#		print "Inside device_funcname: ", stmt
		while ',' in args:
			args.remove(',')
		if device == True:
			self.device_body_buff = ""
		else:
			self.device_body_buff = "__global__ "
		index = stmt.index("(")
		tmp = " " + str(stmt[index-1]) + "("
		if self.device_func_name.count(stmt[0]) == 1:
			self.device_body_buff += "void "
		elif stmt[1] == "[":
			self.device_body_buff += self.type_vars[self.var_nam.index(stmt[0])][:-1]
		else:
			self.device_body_buff += self.type_vars[self.var_nam.index(stmt[0])]
		self.device_body_buff += tmp
#		print stmt,index
		idx = 0
		stmt[index], stmt[-1] = ',',','
		l=stmt.remove(stmt[0])
#		print args
		for j in range(len(stmt[index:])):
			i = stmt[j+index]
			if i is not ",":
#				print i
				if self.var_nam.count(i) == 1:
					if stmt[stmt.index(i)+1] == '[':
						type_var = self.type_vars[self.var_nam.index(i)][:-1]
						self.device_body_buff += type_var + " " + args[idx] + ", "
						self.device_var_nam[-1].append(args[idx])
						self.device_type_vars[-1].append(type_var)
					else:
						type_var = self.type_vars[self.var_nam.index(i)]
						if self.__shared.count(i) == 1:
							self.device_body_buff += "__local "
						elif self.__register.count(i) == 1:
							self.device_body_buff += "__private "
						elif self.__constant.count(i) == 1:
							self.device_body_buff += "__constant "
						else:
							self.device_body_buff += "__global "
						self.device_body_buff += type_var + " " + args[idx] + ", "
						self.device_var_nam[-1].append(args[idx])
						self.device_type_vars[-1].append(type_var)
				else:
					if stmt[j+1+index] is '.':
						self.device_body_buff += "float " + args[idx] + ", "
						j+=2
						self.device_var_nam[-1].append(args[idx])
						self.device_type_vars[-1].append("float")
					elif type(stmt[j]) is int or stmt[j] is '-':
						self.device_body_buff += "int " + args[idx] + ", "
						self.device_var_nam[-1].append(args[idx])
						self.device_type_vars[-1].append("int")
			else:
				idx += 1
		dec_threads = True
		self.device_body_buff = self.device_body_buff[:-2]
		self.device_body_buff +="){\n"
#		print "DBB",self.device_body_buff

	def checkchars(self, var):
		return False

# convert the list into string
	def stringize(self, stmt):
		phrase = ''
		for i in stmt:
			phrase = phrase + str(i)
		return phrase

# Checking the type of variable to be created
	def checktype(self,var,val):
#		print var, val
		if val.count('.') == 1:
			return 'float ', self.stringize(var[:]) , '',  self.stringize(val[:])
		try:
			int(self.stringize(val))
			return 'int ', self.stringize(var[:]), '', self.stringize(val[:])
		except:
			if self.stringize(val).find('"') != -1:
				return 'char ', self.stringize(var[:]), '[]',  self.stringize(val[:])
			elif self.stringize(val).find("'") != -1:
				val = str(val[0]).split("'")
				quote = ['"']
				quote.append(val[1])
				quote.append('"')
				return 'char ' , self.stringize(var[:]), '[]', self.stringize(quote)
			else:
				return '','',self.stringize(var[:]), self.stringize(val[:])

# a = 10 type variables are declared here!
	def decvars(self,stmt,phrase,kernel):
#		print "Inside Dec vars",kernel,phrase,stmt
		if kernel[-2] == '}':
			kernel = kernel[:-2]
#			kernel += "\n"
		if stmt.count('return') == 1:
			kernel += phrase+";\n"
#			print "Adding return",kernel
			return kernel
		elif stmt.count('=') == 0:
			return kernel
		else:
			ideq = stmt.index('=')
			commavarid = [-1]
			commavalid = [ideq]
			tmp = stmt
			for k in tmp:
				if k == ',' and tmp.index(k) < ideq:
					commavarid.append(tmp.index(k))
					tmp[tmp.index(k)] = ''
				if k == ',' and tmp.index(k) > ideq:
					commavalid.append(tmp.index(k))
					tmp[tmp.index(k)] = ''
			commacount = len(commavarid)
			commavalid.append(len(tmp))
			commavarid.append(ideq)
			for i in range(commacount):
				if self.var_nam.count(i) == 0 and stmt.index('=') > i:
					ret_checktype = self.checktype(stmt[commavarid[i]+1:commavarid[i+1]],stmt[commavalid[i]+1:commavalid[i+1]])
#					print "ret_checktype",ret_checktype
					kernel += ret_checktype[0] + ret_checktype[1] + ret_checktype[2] + " = " + ret_checktype[3] + ";\n"
#			print "Exiting decvars",kernel
			return kernel

#	CHECKVARS here!!
	def checkvars(self,stmt,phrase,kernel):
#		print "Inside Check Vars",phrase, stmt, kernel
		if self.__shared.count(stmt[0]) == 1 and self.var_nam.count(stmt[0]) == 0:
			kernel, self.var_nam, self.type_vars = declare.decshared(stmt, self.type_vars, self.var_nam, self.args, kernel)
			return kernel
		elif self.__global.count(stmt[0]) == 1 and self.var_nam.count(stmt[0]) == 0:
			kernel, self.var_nam, self.type_vars = declare.decglobal(stmt, self.type_vars, self.var_nam, self.args, kernel)
			return kernel
		elif self.__register.count(stmt[0]) == 1 and self.var_nam.count(stmt[0]) == 0:
			kernel, self.var_nam, self.type_vars = declare.decregister(stmt, self.type_vars, self.var_nam, self.args, kernel)
			return kernel
		elif self.__constant.count(stmt[0]) == 1 and self.var_nam.count(stmt[0]) == 0:
			kernel, self.var_nam, self.type_vars = declare.decconstant(stmt, self.type_vars, self.var_nam, self.args, kernel)
			return kernel
		else:
			kernel = self.decvars(stmt,phrase,kernel)
		return kernel

# body (self) here!
	def body(self):
		for sentence in self.sentences:
			if sentence.split('\t')>1:
				phrase = sentence.split('\t')
				tabs = phrase.count('')
#				print "Inside Body",phrase, tabs
				sh = shlex.shlex(phrase[-1])
				i = sh.get_token()
#				print i
				if i == "def":
#					print "In DEF"
#					print self.device_py
					self.is_device_code = True
					self.device_tab = tabs
					self.device_py.append([i])
					if self.device_py[0] == []:
						self.device_py.pop(0)
					i = sh.get_token()
					self.device_func_name.append(i)
#					print "DEC",self.device_func_name, self.device_py
					while i is not sh.eof:
						self.device_py[-1].append(i)
						i = sh.get_token()
					self.device_sentences.append([])
				elif self.device_tab < tabs and self.is_device_code == True:
					for j in phrase[tabs:]:
						self.device_sentences[-1].append(j)
					if self.device_sentences[0] == []:
						self.device_sentences.pop(0)
#					print "Body!!", self.device_py, self.device_sentences
				else:
					self.kernel = self.inspect_it(sentence,self.kernel)
		return

	def defargs(self,comma,control,kernel):
		if self.arguments.count(self.keys[control]) < 2:
			self.arguments.append(self.keys[control])
			kernel_arg = ""
			if comma == True:
				if "int64*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", __global long* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "long*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "int32*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", __global int* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "int*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float32*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", __global float* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "float*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float64*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", __global double* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "double*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "int" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", int " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "int"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = ", float " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "float"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
			elif comma == False:
				if "int64*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " __global long* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "long*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "int32*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " __global int* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "int*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float32*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " __global float* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "float*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float64*" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " __global double* " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "double*"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "int" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " int " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "int"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
				elif "float" == self.type_args[len(self.arguments) - 1]:
					kernel_arg = " float " + self.keys[control]
					self.type_vars[len(self.arguments) - 1] = "float"
					self.arg_nam[-1] = self.keys[control]
					self.arg_nam.append("")
			self.kernel_args += kernel_arg
			kernel += kernel_arg
			self.var_nam.append(self.keys[control])
		return kernel

	def _for(self, words, kernel):
		iterator = words[1]
		if words.count('range') > 0:
			if words.count(',') == 0:
				ind = words.index('(')
				if words[ind+1] == "len":
					str_for = "for(int " + str(iterator)
					var_for = words[ind+3]
					str_for += " = 0; " + str(iterator) + " < sizeof(" + str(var_for) + ")/sizeof(" + str(var_for) + "[0])"
					if words[words[ind:].index(')')+ind+1] != ")":
						ind_closed = words[ind+1:].index(")")+ind+2
						print words[ind_closed]
						ind_total_close = words[ind+1:].index(")")+ind_closed-1
						print words[ind_total_close]
						for i in range(ind_closed, ind_total_close):
							str_for += str(words[i])
						str_for += "; " + str(iterator) + "++){\n"
						type_var_for = str(self.type_vars[self.var_nam.index(var_for)][:-1])
						self.var_nam.append(str(iterator))
						self.type_vars.append(type_var_for)
				else:
					str_for = "for(int " + str(iterator)
					var_for = words[ind+3]
					str_for += " = 0; " + str(iterator) + " < "
					range_id = words.index("range")
					end_id = words.index(":")
					for i in range(range_id+1,end_id):
						str_for += str(words[i])
					str_for += "; " + str(iterator) + "++){\n"
#					type_var_for = str(self.type_vars[self.var_nam.index(var_for)][:-1])
#					self.var_nam.append(str(iterator))
#					self.type_vars.append(type_var_for)
#			if words.count(',')
		else:
			str_for = "for(int _" + str(iterator)
			var_for = words[words.index('in')+1]
			str_for += " = 0; " + "_"+str(iterator) + " < sizeof(" + str(var_for) + ")/sizeof(" + str(var_for) + "[0]); _" + str(iterator) + "++){\n"
			type_var_for = str(self.type_vars[self.var_nam.index(var_for)][:-1])
			str_for += type_var_for + " " + str(iterator) + " = " + str(var_for) + "[_" + str(iterator) + "];\n"
			self.var_nam.append(str(iterator))
			self.type_vars.append(type_var_for)
#			print self.type_vars, self.var_nam
		self.tabs += 1
		return str_for

	def execute(self):
		tmp = execl.cl_exe()
		sh = shlex.shlex(self.code)
		i = sh.get_token()
		self.keys = [i]
		while i is not sh.eof:
			i = sh.get_token()
			self.keys.append(i)
		self.num_return = self.keys.count('return')
		control = self.keys.index('def')
		control = self.funcname_cl(control)
		comma = False
		if self.keys[control] == '(':
			control = control + 1
			while self.keys[control] != ')':
				if self.keys[control] == ',':
					control = control + 1
				self.kernel = self.defargs(comma, control, self.kernel)
				comma = True
				control = control + 1
			ret = len(self.keys) - self.keys[::-1].index('return')
			while self.keys[ret] != '':
				if self.keys[ret] == ',':
					ret = ret + 1
				self.returns.append(self.keys[ret])
				ret = ret + 1
			self.kernel = self.kernel + "){\n"
			control = control + 1
		if self.keys[control] == ':':
			control = control + 1
		self.sentences = self.code.split("\n")
		self.sentences.remove(self.sentences[1])
		self.sentences.remove(self.sentences[-2])
#		print self.kernel, "Entering body()"
		self.body()
		self.kernel = "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"+self.kernel + "}"
		self.arg_nam.pop(-1)
		self.kernel_final.append(self.kernel)
#		self.print_cl()
#		print self.var_nam, self.type_vars, self.__shared, self.__global
#		print self.kernel
		if self.return_kernel == False:
			tmp.start(self.args,self.arg_nam, self.arg_mask)
			tmp.exe_cl(self.kernel_final[0], self.func_name, self.threads, self.blocks)
			return tmp.get_returns(self.returns)
		elif self.return_kernel == True:
			return self.kernel_final

	def print_cl(self):
		print "In print_cl:"
		print self.type_args
		print self.arguments
		print self.returns
		print self.var_nam
		print self.var_val
		print self.kernel
		print self.threads
		print self.blocks
		print self.func_name
		print self.code
		print self.words
		print self.sentences


text:
<!DOCTYPE html>

    <title>Kanbano Features</title>
    <meta name="author" content="Jamie Hill" />
    <link href="css/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />

RambleRunner

Home

Testing

Eventually there will be controls here to play/stop features as well as picking which features to run etc.
        Also, the plan is to have a "Record" button allowing features to be build up via a UI.

TODO: Make panes draggable

        TODO: Create a Ramble.Report when finished

        TODO: Add report output to HTMLOutputter

        Design Copyright © 2010
        SonicIQ Ltd. all rights reserved.


text:
package com.alibaba.android.arouter.facade.model;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * Used for get type of target object.
 *
 * @author Alex Contact me.
 * @version 1.0
 * @since 17/10/26 11:56:22
 */
public class TypeWrapper<T> {
    protected final Type type;

    protected TypeWrapper() {
        Type superClass = getClass().getGenericSuperclass();

        type = ((ParameterizedType) superClass).getActualTypeArguments()[0];
    }

    public Type getType() {
        return type;
    }
}


text:
package ch.ntb.inf.deep.strings;

public class H8String extends HString {

    /**
     * Constructs a new string of 8 bit (latin1) chars.
     * The new string begins at the specified startIndex and
     * extends to the character at index endIndex - 1.
     * Thus the length of the string is endIndex-startIndex.
     *
     * @param chars8bit  array containing 8 bit chars, one per array element (the lower 8 bits of each char are picked up to form an new char).
     * @param startIndex the beginning index, inclusive.
     * @param endIndex  the ending index, exclusive.
     */
	H8String(char[] chars8bit, int startIndex, int endIndex){
//vrb.println(">H8String: startIndex="+startIndex +", endIndex="+endIndex);
    	this.chars = getH8Array(chars8bit, startIndex, endIndex);
    	this.length = (char)(endIndex - startIndex);
		this.arrayLen = (char)((length+1)>>1);
		hashCode();
//vrb.println(">H8String: hash="+hash +", arrayLen="+(int)arrayLen +", length="+(int)length);
	}

    /**
     * Constructs a new string of 8 bit (latin1) chars.
     * The new string begins with the first char in the given array and
     * extends to the character at index length - 1.
     * Thus the length of the string is length.
     *
     * @param chars8bit  array containing 8 bit chars, one per array element.
     * @param      length   length of the new string.
     */
	H8String(char[] chars8bit, int length){
		this(chars8bit, 0, length);
	}

	public boolean equals(char[] jchars, int length) {
	   	if(length > Math.min(length, jchars.length)) throw new StringIndexOutOfBoundsException(length);
	   	int arrLength = (length+1)>>1;
		if (length != this.length || (length != this.arrayLen && arrLength != this.arrayLen))  return false;

//vrb.println(">equals10: lenght="+length +", this.length="+(int)this.length +", jchar.length="+jchars.length); HString.printChars(jchars, length);

		assert length == this.length;
		char[] h8chars = this.chars;
		int jIndex = length-1;
		int hIndex  = jIndex>>1;
		if( (length&1) != 0){
			if( (h8chars[hIndex--]>>8) != jchars[jIndex--]) return false;
		}
//vrb.println(">equals20: hIndex="+hIndex +", jIndex="+jIndex +", jchar.length="+jchars.length); HString.printChars(h8chars, h8chars.length);
		while (hIndex >= 0){
			int hval = h8chars[hIndex--];
			if ( (hval & 0xFF) != jchars[jIndex--] || (hval>>8) != jchars[jIndex--]) break;
		}
//vrb.println(">equals30: hIndex="+hIndex +", jIndex="+jIndex);
		return jIndex < 0;
	}

	/**
     * Returns the java hash code for this string: javaHashCode == this.toString().hashCode() (see also java.lang.String).
     * @return  a hash code value for this object.
     */
    public int hashCode() {
    	if(hash != 0) return hash;
    	int haschCode = 0;
    	int end = length>>1;
    	for(int n = 0; n < end; n++) haschCode = (haschCode*31 + (chars[n]>>>8) )*31 + (chars[n] & 0xFF);
    	if( (length&1) != 0) haschCode = haschCode*31 + (chars[end]>>>8);
    	hash = haschCode;
        return haschCode;
    }

    /**
     * Returns the char value at the specified index.
     * See base class for details.
     * @param index
     * @return the char, specified by index
     */
    public char charAt(int index){
    	if(index < 0 || index >= length) throw new StringIndexOutOfBoundsException(index);
    	int value = chars[index>>1];
		if( (index&1) == 0 ) value = value>>>8;  else value = value& 0xFF;
		return (char)value;
    }

	public int indexOf(int ch, int fromIndex){
    	if(fromIndex >= length) throw new StringIndexOutOfBoundsException(fromIndex);
		int end = length>>1;
		if( (fromIndex&1) != 0 && (chars[fromIndex>>1]&0xFF) == ch )  return fromIndex;

		int index = (fromIndex+1)>>1;
		int hch = ch<<8;
		int m = -1;
		while(index < end){
			int value = chars[index];
			if( (value&0xFF00) == hch) { m = 0; break; }
			if( (value&0xFF) == ch)  { m = 1; break; }
			index++;
		}
		if(m >= 0)  return index*2 + m;  //found
		else if (index == end){
			if( (length&1) != 0){
				if( (chars[end]&0xFF00) == hch) return end*2;
			}
		}
		return -1;
	}

	public int indexOf(int ch){
		return indexOf(ch, 0);
	}

	public int lastIndexOf(int ch){
		if( (ch& -0x100) != 0) return -1;
		int n = length>>1;
//vrb.println("LI0: length="+(int)length +", n="+n);
		int hch = ch<<8;
		if( (length&1) != 0){
			if( (chars[n]&0xFF00) == hch) return n*2;
		}
		n--;
//vrb.println("LI1: length="+(int)length +", n="+n);
		int m = -1;
		while(n >= 0){
			int value = chars[n];
			if( (value&0xFF00) == hch) { m = 0; break; }
			if( (value&0xFF) == ch)  { m = 1; break; }
			n--;
		}
		if(n >= 0) return n*2 + m;
		return -1;
	}

	public void getChars(int srcStartIndex, int srcEndIndex, char[] dstChars, int dstStartIndex){
		if(checkPre){
		   	if(srcEndIndex > length) throw new StringIndexOutOfBoundsException(srcEndIndex);
		   	if( srcStartIndex < 0 || srcStartIndex > srcEndIndex ) throw new StringIndexOutOfBoundsException(srcStartIndex);
		   	if(dstStartIndex > dstChars.length) throw new StringIndexOutOfBoundsException(srcStartIndex);
		}
	   	int length = Math.min(this.length, srcEndIndex-srcStartIndex);
		length = Math.min(dstChars.length-dstStartIndex, length);
		for(int n = 0; n < length; n++) dstChars[dstStartIndex++] = charAt(srcStartIndex++);
	}

	public HString substring(int startIndex, int endIndex){
		if(endIndex > length) throw new StringIndexOutOfBoundsException(endIndex);
		if(startIndex > endIndex) throw new StringIndexOutOfBoundsException(startIndex);
		int length = endIndex - startIndex;
		char[] dstChars = new char[length];
		getChars(startIndex, endIndex, dstChars, 0);
		return new H8String(dstChars, length);
	}

	public HString substring(int start){
		return substring(start, length);
	}

    public String toString(){
//vrb.println(">toString");
//    	printlnChars(chars, chars.length);
    	char[] strChars = new char[length];
    	int index = length-1;
    	if((length&1) == 1) {
    		strChars[index] = (char)(chars[index>>1]>>>8);
    		index--;
    	}
    	for(; index > 0; index -= 2){
    		int couple = chars[index>>1];
       		strChars[index] = (char)(couple & 0xFF);
       		strChars[index-1] = (char)(couple>>8);
       	}
//vrb.println("<toString");
//    	printlnChars(strChars, strChars.length);
    	return new String(strChars);
    }

    public int sizeInByte() {
    	return length;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<type language="gradle" name="org.gradle.nativeplatform.test.cunit.plugins.CUnitPlugin" version="3.0">
    <description> A plugin that sets up the infrastructure for testing native binaries with CUnit.

</description>
    <method name="apply" returnType="void">
        <parameter type="org.gradle.api.Project" name="project"/>
    </method>
    <interface name="org.gradle.api.Plugin"/>
</type>


text:
<?php

namespace Kraken\_Unit\Console\Client\_T;

use Dazzle\Channel\ChannelInterface;
use Kraken\Runtime\Command\CommandInterface;
use Kraken\Console\Client\Command\Command;
use Kraken\Test\TUnit;
use Exception;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class TCommand extends TUnit
{
    /**
     * @var string
     */
    protected $class = '';

    /**
     * @var CommandInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $cmd;

    /**
     *
     */
    public function setUp()
    {
        parent::setUp();

        $this->cmd = null;
    }

    /**
     *
     */
    public function testApiConstructor_CreatesInstance()
    {
        $command = $this->createCommand();

        $this->assertInstanceOf(Command::class, $command);
    }

    /**
     *
     */
    public function testApiConstruct_DoesNotThrowException()
    {
        $command = $this->createCommand();
        $this->callProtectedMethod($command, 'construct');
    }

    /**
     *
     */
    public function testApiDestructor_DoesNotThrowException()
    {
        $command = $this->createCommand();
        unset($command);
    }

    /**
     *
     */
    public function testApiDestruct_DoesNotThrowException()
    {
        $command = $this->createCommand();
        $this->callProtectedMethod($command, 'destruct');
    }

    /**
     * @param Command $command
     * @param string $name
     * @param string $desc
     * @param mixed[] $args
     * @param mixed[] $opts
     */
    public function assertCommand(Command $command, $name, $desc = "#(.*?)#si", $args = [], $opts = [])
    {
        $this->assertSame($name, $command->getName());
        $this->assertRegExp($desc, $command->getDescription());

        $def = $command->getDefinition();

        foreach ($args as $arg)
        {
            $this->assertTrue($def->hasArgument($arg[0]));

            if ($arg[1] === InputArgument::REQUIRED)
            {
                $this->assertTrue($def->getArgument($arg[0])->isRequired());
            }
            if ($arg[1] === InputArgument::OPTIONAL)
            {
                $this->assertFalse($def->getArgument($arg[0])->isRequired());
            }
            if ($arg[1] === InputArgument::IS_ARRAY)
            {
                $this->assertTrue($def->getArgument($arg[0])->isArray());
            }

            if (isset($arg[2]))
            {
                $this->assertRegExp($arg[2], $def->getArgument($arg[0])->getDescription());
            }
        }

        foreach ($opts as $opt)
        {
            $this->assertTrue($def->hasOption($opt[0]));

            if (isset($opt[1]))
            {
                $this->assertSame($opt[1], $def->getOption($opt[0])->getShortcut());
            }

            if ($opt[2] === InputOption::VALUE_REQUIRED)
            {
                $this->assertTrue($def->getOption($opt[0])->isValueRequired());
            }
            if ($opt[2] === InputOption::VALUE_OPTIONAL)
            {
                $this->assertTrue($def->getOption($opt[0])->isValueOptional());
            }
            if ($opt[2] === InputOption::VALUE_IS_ARRAY)
            {
                $this->assertTrue($def->getOption($opt[0])->isArray());
            }

            if (isset($opt[3]))
            {
                $this->assertRegExp($opt[3], $def->getOption($opt[0])->getDescription());
            }

            if (isset($opt[4]))
            {
                $this->assertSame($opt[4], $def->getOption($opt[0])->getDefault());
            }
        }
    }

    /**
     * @param string[]|null $methods
     * @return InputInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    public function createInputMock($methods = [])
    {
        $input = $this->getMock(InputInterface::class, $methods, [], '', false);

        if (!in_array('getArgument', $methods))
        {
            $input
                ->expects($this->any())
                ->method('getArgument')
                ->will($this->returnArgument(0));
        }

        if (!in_array('getOption', $methods))
        {
            $input
                ->expects($this->any())
                ->method('getOption')
                ->will($this->returnArgument(0));
        }

        return $input;
    }

    /**
     * @param string[]|null $methods
     * @return OutputInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    public function createOutputMock($methods = [])
    {
        $output = $this->getMock(OutputInterface::class, $methods, [], '', false);

        return $output;
    }

    /**
     * @param string[]|null $methods
     * @return Command|\PHPUnit_Framework_MockObject_MockObject
     * @throws Exception
     */
    public function createCommand($methods = null)
    {
        if ($this->class === '')
        {
            throw new Exception('Class not set');
        }

        $channel  = $this->getMock(ChannelInterface::class, [], [], '', false);
        $receiver = 'default';

        $this->cmd = $this->getMock($this->class, $methods, [ $channel, $receiver ]);

        return $this->cmd;
    }
}


text:
package compiler.util;

import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;

import driver.Context;

public class ThrowingDiagnosticListener
implements DiagnosticListener<JavaFileObject>
{
  /****************************************************************************/
  @Override public void report(Diagnostic<? extends JavaFileObject> diagnostic)
  {
    throw new Error("Compilation error in file " + Context.get().currentFile
      + " : " + diagnostic.getMessage(null));
  }
}