text:
/*
 * This is not the original file distributed by the Apache Software Foundation
 * It has been modified by the Hipparchus project
 */

package org.hipparchus.util;

import java.util.NoSuchElementException;

import org.hipparchus.exception.MathIllegalArgumentException;
import org.junit.Assert;
import org.junit.Test;

/**
 * Test cases for the {@link MultidimensionalCounter} class.
 */
public class MultidimensionalCounterTest {
    @Test
    public void testPreconditions() {
        MultidimensionalCounter c;

        try {
            c = new MultidimensionalCounter(0, 1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c = new MultidimensionalCounter(2, 0);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c = new MultidimensionalCounter(-1, 1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }

        c = new MultidimensionalCounter(2, 3);
        try {
            c.getCount(1, 1, 1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c.getCount(3, 1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c.getCount(0, -1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c.getCounts(-1);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
        try {
            c.getCounts(6);
            Assert.fail("MathIllegalArgumentException expected");
        } catch (MathIllegalArgumentException e) {
            // Expected.
        }
    }

    @Test
    public void testIteratorPreconditions() {
        MultidimensionalCounter.Iterator iter = (new MultidimensionalCounter(2, 3)).iterator();
        try {
            iter.getCount(-1);
            Assert.fail("IndexOutOfBoundsException expected");
        } catch (IndexOutOfBoundsException e) {
            // Expected.
        }
        try {
            iter.getCount(2);
            Assert.fail("IndexOutOfBoundsException expected");
        } catch (IndexOutOfBoundsException e) {
            // Expected.
        }
    }

    @Test
    public void testIterator() {
        final int dim1 = 3;
        final int dim2 = 4;

        final MultidimensionalCounter.Iterator iter
            = new MultidimensionalCounter(dim1, dim2).iterator();

        final int max = dim1 * dim2;
        for (int i = 0; i < max; i++) {
            Assert.assertTrue(iter.hasNext());

            // Should not throw.
            iter.next();
        }

        Assert.assertFalse(iter.hasNext());
    }

    @Test(expected=NoSuchElementException.class)
    public void testIteratorNoMoreElements() {
        final MultidimensionalCounter.Iterator iter
            = new MultidimensionalCounter(4, 2).iterator();

        while (iter.hasNext()) {
            iter.next();
        }

        // No more elements: should throw.
        iter.next();
    }

    @Test
    public void testMulti2UniConversion() {
        final MultidimensionalCounter c = new MultidimensionalCounter(2, 4, 5);
        Assert.assertEquals(c.getCount(1, 2, 3), 33);
    }

    @Test
    public void testAccessors() {
        final int[] originalSize = new int[] {2, 6, 5};
        final MultidimensionalCounter c = new MultidimensionalCounter(originalSize);
        final int nDim = c.getDimension();
        Assert.assertEquals(nDim, originalSize.length);

        final int[] size = c.getSizes();
        for (int i = 0; i < nDim; i++) {
            Assert.assertEquals(originalSize[i], size[i]);
        }
    }

    @Test
    public void testIterationConsistency() {
        final MultidimensionalCounter c = new MultidimensionalCounter(2, 3, 4);
        final int[][] expected = new int[][] {
            { 0, 0, 0 },
            { 0, 0, 1 },
            { 0, 0, 2 },
            { 0, 0, 3 },
            { 0, 1, 0 },
            { 0, 1, 1 },
            { 0, 1, 2 },
            { 0, 1, 3 },
            { 0, 2, 0 },
            { 0, 2, 1 },
            { 0, 2, 2 },
            { 0, 2, 3 },
            { 1, 0, 0 },
            { 1, 0, 1 },
            { 1, 0, 2 },
            { 1, 0, 3 },
            { 1, 1, 0 },
            { 1, 1, 1 },
            { 1, 1, 2 },
            { 1, 1, 3 },
            { 1, 2, 0 },
            { 1, 2, 1 },
            { 1, 2, 2 },
            { 1, 2, 3 }
        };

        final int totalSize = c.getSize();
        Assert.assertEquals(expected.length, totalSize);

        final int nDim = c.getDimension();
        final MultidimensionalCounter.Iterator iter = c.iterator();
        for (int i = 0; i < totalSize; i++) {
            if (!iter.hasNext()) {
                Assert.fail("Too short");
            }
            final int uniDimIndex = iter.next().intValue();
            Assert.assertEquals("Wrong iteration at " + i, i, uniDimIndex);

            for (int dimIndex = 0; dimIndex < nDim; dimIndex++) {
                Assert.assertEquals("Wrong multidimensional index for [" + i + "][" + dimIndex + "]",
                                    expected[i][dimIndex], iter.getCount(dimIndex));
            }

            Assert.assertEquals("Wrong unidimensional index for [" + i + "]",
                                c.getCount(expected[i]), uniDimIndex);

            final int[] indices = c.getCounts(uniDimIndex);
            for (int dimIndex = 0; dimIndex < nDim; dimIndex++) {
                Assert.assertEquals("Wrong multidimensional index for [" + i + "][" + dimIndex + "]",
                                    expected[i][dimIndex], indices[dimIndex]);
            }
        }

        if (iter.hasNext()) {
            Assert.fail("Too long");
        }
    }
}


text:
<?php

namespace noFlash\CherryHttp\Tests\Http\Response;

use noFlash\CherryHttp\Http\Response\ErrorResponse;
use noFlash\CherryHttp\Http\Response\ResponseCode;
use noFlash\CherryHttp\Http\Response\ResponseInterface;

class ErrorResponseTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ErrorResponse
     */
    private $subjectUnderTest;

    public function setUp()
    {
        $this->subjectUnderTest = new ErrorResponse();
    }

    public function testObjectImplementsResponseInterface()
    {
        $this->assertInstanceOf(ResponseInterface::class, $this->subjectUnderTest);
    }

    public function testFreshInstanceContainsInternalServerErrorCodeWithIanaReasonPhrase()
    {
        $expectedCode = ResponseCode::INTERNAL_SERVER_ERROR;
        $expectedReasonPhrase = ResponseCode::getReasonPhraseByCode($expectedCode);

        $this->assertSame($expectedCode, $this->subjectUnderTest->getStatusCode());
        $this->assertSame($expectedReasonPhrase, $this->subjectUnderTest->getReasonPhrase());
    }

    public function testFreshInstanceContainsGenericExplanation()
    {
        $this->assertSame('No further details are available.', $this->subjectUnderTest->getExplanation());
    }

    public function testExplanationCanBeSetUsingDedicatedMethod()
    {
        $this->subjectUnderTest->setExplanation('Too much derping for today!');
        $this->assertSame('Too much derping for today!', $this->subjectUnderTest->getExplanation());

        $this->subjectUnderTest->setExplanation('FooBaz day is over :(');
        $this->assertSame('FooBaz day is over :(', $this->subjectUnderTest->getExplanation());
    }

    public function errorCodesProvider()
    {
        return [
            [ResponseCode::BAD_GATEWAY],
            [ResponseCode::BAD_REQUEST],
            [ResponseCode::METHOD_NOT_ALLOWED],
            [ResponseCode::GONE],
            [ResponseCode::NOT_FOUND],
            [ResponseCode::LOOP_DETECTED],
            [ResponseCode::HTTP_VERSION_NOT_SUPPORTED],
            [487], //Future codes
            [499],
            [512],
            [598]
        ];
    }

    /**
     * @dataProvider errorCodesProvider
     */
    public function testStatusAcceptsErrorCodes($code)
    {
        $this->subjectUnderTest->setStatus($code);
        $this->assertSame($code, $this->subjectUnderTest->getStatusCode());
    }

    public function nonErrorCodesProvider()
    {
        return [
            [ResponseCode::CONTINUE_INFORMATION],
            [ResponseCode::OK],
            [ResponseCode::NOT_MODIFIED],
            [ResponseCode::PERMANENT_REDIRECT],
            [652],
            [781],
            [833],
            [911]
        ];
    }

    /**
     * @dataProvider nonErrorCodesProvider
     */
    public function testStatusRejectsNonErrorCodes($code)
    {
        $this->expectException(\LogicException::class);
        $this->subjectUnderTest->setStatus($code);
    }

    public function testFreshInstanceContainsHtmlContentType()
    {
        $this->assertTrue($this->subjectUnderTest->hasHeader('content-type'));
        $this->assertStringStartsWith('text/html', $this->subjectUnderTest->getHeader('content-type')[0]);
    }

    public function testHtmlBodyIsAutogeneratedIfNotSet()
    {
        $body = $this->subjectUnderTest->getBody();
        $this->assertNotEmpty($body);
        $this->assertRegExp('/^\<html.*?\>\<\/html\>/is', $body);

        $this->subjectUnderTest->setBody('foo');
        $this->assertSame('foo', $this->subjectUnderTest->getBody());

        $this->subjectUnderTest->setBody(null);
        $body = $this->subjectUnderTest->getBody();
        $this->assertNotEmpty($body);
        $this->assertRegExp('/^\<html.*?\>\<\/html\>/is', $body);
    }

    public function testAutoGeneratedHtmlContainsExplanationSet()
    {
        $this->subjectUnderTest->setExplanation('Because We Can');
        $this->assertRegExp('/Because We Can/is', $this->subjectUnderTest->getBody());

        $this->subjectUnderTest->setExplanation('Yet another error');
        $this->assertRegExp('/Yet another error/is', $this->subjectUnderTest->getBody());
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?hh // strict
namespace Usox\Sharesta;

use namespace HH\Lib\Str;

final class Router implements RouterInterface {

	const HTTP_OK = 200;
	const HTTP_BAD_REQUEST = 400;
	const HTTP_NOT_FOUND = 404;
	const HTTP_INTERNAL_SERVER_ERROR = 500;

	private vec<string> $response_headers = vec[];

	public function __construct(
		private ApiFactoryInterface $api_factory,
		private RequestInterface $request
	): void {
	}

	private dict<string, (function (RequestInterface): \JsonSerializable)> $routes = dict[];

	public function register(string $route, (function (RequestInterface): \JsonSerializable) $callback, ?string $http_method = null): void {
		if ($http_method !== null) {
			$route = Str\format(
				'%s:%s',
				$http_method,
				$route
			);
		}

		$this->routes[$route] = $callback;
	}

	public function get(string $route, (function (RequestInterface): \JsonSerializable) $callback): void {
		$this->register($route, $callback, 'GET');
	}

	public function post(string $route, (function (RequestInterface): \JsonSerializable) $callback): void {
		$this->register($route, $callback, 'POST');
	}

	public function put(string $route, (function (RequestInterface): \JsonSerializable) $callback): void {
		$this->register($route, $callback, 'PUT');
	}

	public function delete(string $route, (function (RequestInterface): \JsonSerializable) $callback): void {
		$this->register($route, $callback, 'DELETE');
	}

	public function route(string $base_path): void {
		try {
			$response = \json_encode($this->matchRoute($base_path));
			$status_code = static::HTTP_OK;
		} catch (Exception\SharestaException $e) {
			$response = $e->getMessage();
			$status_code = $e->getHttpStatusCode();
		} catch (\Exception $e) {
			$response = 'Internal server error';
			$status_code = static::HTTP_INTERNAL_SERVER_ERROR;
		}

		$this->api_factory->createResponse(
			$status_code,
			$response
		)->send(
			$this->response_headers
		);
	}

	public function addResponseHeader(string $header): void {
		$this->response_headers[] = $header;
	}

	private function matchRoute(string $base_path): \JsonSerializable {
		$requested_route = $this->request->getRoute($base_path);
		$http_method = $this->request->getHttpMethod();
		$route_parameters = dict[];

		foreach ($this->routes as $route => $callback) {
			// if the route also defines a HTTP method, use it as prefix for the lookup
			$route_method = \strstr($route, ':', true);
			$request_prepend = '';

			if ($route_method && \substr($route_method, -1) !== '/') {
				$request_prepend = Str\format('%s:', $http_method);
			}

			$route_pattern = \preg_replace(
				'%/:([^ /?]+)(\?)?%',
				'/\2(?P<\1>[^ /?]+)\2',
				$route
			);

			$uri_params = darray[];
			if (\preg_match_with_matches('%^'.$route_pattern.'$%', $request_prepend.$requested_route, inout $uri_params)) {

				foreach ($uri_params as $key => $value) {
					if (!\is_numeric($key)) {
						$route_parameters[$key] = $value;
					}
				}
				$this->request->setRouteParameters($route_parameters);

				return $callback($this->request);
			}
		}
		throw new Exception\NotFoundException('The requested resource was not found');
	}
}


text:
package com.bluelinelabs.logansquare.processor.type.field;

import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec.Builder;
import com.squareup.javapoet.TypeName;

import static com.bluelinelabs.logansquare.processor.ObjectMapperInjector.JSON_PARSER_VARIABLE_NAME;

public class DoubleFieldType extends NumberFieldType {

    public DoubleFieldType(boolean isPrimitive) {
        super(isPrimitive);
    }

    @Override
    public TypeName getTypeName() {
        return (isPrimitive ? TypeName.DOUBLE : ClassName.get(Double.class));
    }

    @Override
    public TypeName getNonPrimitiveTypeName() {
        return ClassName.get(Double.class);
    }

    @Override
    public void parse(Builder builder, int depth, String setter, Object... setterFormatArgs) {
        if (isPrimitive) {
            setter = replaceLastLiteral(setter, "$L.getValueAsDouble()");
            builder.addStatement(setter, expandStringArgs(setterFormatArgs, JSON_PARSER_VARIABLE_NAME));
        } else {
            setter = replaceLastLiteral(setter, "$L.getCurrentToken() == JsonToken.VALUE_NULL ? null : Double.valueOf($L.getValueAsDouble())");
            builder.addStatement(setter, expandStringArgs(setterFormatArgs, JSON_PARSER_VARIABLE_NAME, JSON_PARSER_VARIABLE_NAME));
        }
    }
}


text:
#include <iostream>
#include <vector>
#include <algorithm>
#include "Window.h"
#include "Render.h"
#include "StructureHeaders.h"
using namespace std;
Render render;
CommandAllocator cmdalloc;
CommandList cmdlist;
Window windows;
Pipeline pipeline;
Fence fence;
HANDLE fenceEvet;
UINT frameIndex;
Buffer vertexBuffer;
Buffer indexBuffer;
RootSignature rootsig;
ViewPort viewport;
Scissor scissor;
DescriptorHeap srvheap;
DescriptorHeap samplerheap;
Texture texture;
static uint32_t swapChainCount = 3;
const UINT TextureWidth = 256;
const UINT TextureHeight = 256;

ShaderSet shaderset;
Sampler sampler;

void initializeRender()
{
	render.initialize();
	RenderTargetFormat rtformat;
	render.createSwapChain(windows, swapChainCount, rtformat.mRenderTargetFormat[0]);
	cmdalloc.initialize(render.mDevice);
	cmdlist.initial(render.mDevice, cmdalloc);

	fence.initialize(render);

	srvheap.ininitialize(render.mDevice, 1);
	samplerheap.ininitialize(render.mDevice, 1, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
	if (!vertexBuffer.createVertexBuffer(render.mDevice, 4 * 4 * sizeof(float), 4 * sizeof(float)))
	{
		cout << "Fail for create vertex buffer" << endl;
	}
	if (!indexBuffer.createIndexBuffer(render.mDevice, sizeof(UINT) * 6))
	{
		cout << "Fail for create index buffer" << endl;
	}

	/*texture.CreateTexture(render.mDevice, DXGI_FORMAT_R8G8B8A8_UNORM, TextureWidth, TextureHeight);
	texture.addSahderResorceView(srvheap);*/

	texture.CreateTexture(render,srvheap, DXGI_FORMAT_R8G8B8A8_UNORM, TextureWidth, TextureHeight);

	rootsig.mParameters.resize(2);
	rootsig.mParameters[0].mType = PARAMETERTYPE_SRV;
	rootsig.mParameters[0].mResCounts = 1;
	rootsig.mParameters[0].mBindSlot = 0;
	rootsig.mParameters[0].mResource = &texture;
	rootsig.mParameters[0].mVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
	rootsig.mParameters[1].mType = PARAMETERTYPE_SAMPLER;
	rootsig.mParameters[1].mResCounts = 1;
	rootsig.mParameters[1].mBindSlot = 0;
	rootsig.mParameters[1].mSampler = &sampler;

	rootsig.initialize(render.mDevice);

	shaderset.shaders[VS].load("Shaders/SimpleDraw.hlsl", "VSMain", VS);
	shaderset.shaders[PS].load("Shaders/SimpleDraw.hlsl", "PSMain", PS);
	pipeline.createGraphicsPipeline(render.mDevice, rootsig, shaderset, rtformat,DepthStencilState::DepthStencilState(),BlendState::BlendState(), RasterizerState::RasterizerState());

	viewport.setup(0.0f, 0.0f, (float)windows.mWidth, (float)windows.mHeight);
	scissor.setup(0, windows.mWidth, 0, windows.mHeight);

}

void loadAsset()
{

	const UINT rowPitch = TextureWidth * 4;
	const UINT cellPitch = rowPitch >> 3;		// The width of a cell in the checkboard texture.
	const UINT cellHeight = TextureWidth >> 3;	// The height of a cell in the checkerboard texture.
	const UINT textureSize = rowPitch * TextureHeight;

	std::vector<UINT8> data(textureSize);
	UINT8* pData = &data[0];

	for (UINT n = 0; n < textureSize; n += 4)
	{
		UINT x = n % rowPitch;
		UINT y = n / rowPitch;
		UINT i = x / cellPitch;
		UINT j = y / cellHeight;

		if (i % 2 == j % 2)
		{
			pData[n] = 0x00;		// R
			pData[n + 1] = 0x00;	// G
			pData[n + 2] = 0x00;	// B
			pData[n + 3] = 0xff;	// A
		}
		else
		{
			pData[n] = 0xff;		// R
			pData[n + 1] = 0xff;	// G
			pData[n + 2] = 0xff;	// B
			pData[n + 3] = 0xff;	// A
		}
	}

	float tridata[] =
	{
		0.0f,0.25f,0.5f,0.0f,
		0.25f,-0.25f,1.0f,1.0f,
		-0.25f,-0.25f,0.0f,1.0f,
		0.0f,-0.75f,0.5f,0.0f

	};
	unsigned int indexdata[] = {0,1,2,2,1,3 };

	sampler.createSampler(samplerheap);

	cmdalloc.reset();
	cmdlist.reset(Pipeline());
	cmdlist.resourceTransition(vertexBuffer, D3D12_RESOURCE_STATE_COPY_DEST);
	cmdlist.resourceTransition(texture, D3D12_RESOURCE_STATE_COPY_DEST);
	cmdlist.resourceTransition(indexBuffer, D3D12_RESOURCE_STATE_COPY_DEST,true);
	cmdlist.updateBufferData(vertexBuffer, tridata, 4 * 4 * sizeof(float));
	cmdlist.updateBufferData(indexBuffer, indexdata, 6 * sizeof(int));
	cmdlist.updateTextureData(texture, &(data[0]));
	cmdlist.resourceTransition(vertexBuffer, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
	cmdlist.resourceTransition(texture, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
	cmdlist.resourceTransition(indexBuffer,D3D12_RESOURCE_STATE_INDEX_BUFFER,true);
	cmdlist.close();
	render.executeCommands(&cmdlist);
	render.insertSignalFence(fence);
	render.waitFenceIncreament(fence);
}

void releaseRender()
{

	indexBuffer.release();
	samplerheap.release();
	texture.release();
	srvheap.release();
	pipeline.release();
	rootsig.realease();
	vertexBuffer.release();
	fence.release();
	cmdlist.release();
	cmdalloc.release();
	render.releaseSwapChain();
	render.release();
	CloseHandle(fenceEvet);
}

void update()
{
	frameIndex = render.getCurrentSwapChainIndex();
	cmdalloc.reset();
	cmdlist.reset(pipeline);

	cmdlist.bindDescriptorHeaps(&srvheap, &samplerheap);
	cmdlist.bindGraphicsRootSigature(rootsig);
	cmdlist.setViewPort(viewport);
	cmdlist.setScissor(scissor);
	cmdlist.swapChainBufferTransition(render.mSwapChainRenderTarget[frameIndex], D3D12_RESOURCE_STATE_RENDER_TARGET,true);
	cmdlist.bindRenderTarget(render.mSwapChainRenderTarget[frameIndex]);
	const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
	cmdlist.clearRenderTarget(render.mSwapChainRenderTarget[frameIndex], clearColor);
	cmdlist.setTopolgy(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	cmdlist.bindVertexBuffer(vertexBuffer);
	cmdlist.bindIndexBuffer(indexBuffer);
	cmdlist.drawIndexedInstanced(6, 1, 0, 0);
	cmdlist.swapChainBufferTransition(render.mSwapChainRenderTarget[frameIndex], D3D12_RESOURCE_STATE_PRESENT,true);
	cmdlist.close();
	render.executeCommands(&cmdlist);
	render.present();

	render.insertSignalFence(fence);
	render.waitFenceIncreament(fence);
}
int main()
{
	windows.initialize(1600, 900, "IndexBuffer");
	windows.openWindow();
	int limit = 10000;
	int count = 0;
	initializeRender();
	loadAsset();
	while (windows.isRunning())
	{

		windows.pollInput();
		update();
	}
	releaseRender();
	windows.closeWindow();
	windows.termianate();
	return 0;
}


text:
function [varargout] = ft_plot_text(X, Y, str, varargin)

% FT_PLOT_TEXT helper function for plotting text, which can also be used in
% combination with the multiple channel layout display in FieldTrip.
%
% Use as
%   ft_plot_text(X, Y, str, ...)
%
% Optional arguments should come in key-value pairs and can include
%   Color               =
%   FontSize            =
%   FontName            =
%   HorizontalAlignment =
%   tag                 =
%
% It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specfied as follows
%   hpos        = horizontal position of the center of the local axes
%   vpos        = vertical position of the center of the local axes
%   width       = width of the local axes
%   height      = height of the local axes
%   hlim        = horizontal scaling limits within the local axes
%   vlim        = vertical scaling limits within the local axes

% Copyrights (C) 2009-2011, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id: ft_plot_text.m 7267 2012-12-27 13:08:34Z roboos $

ws = warning('on', 'MATLAB:divideByZero');

% get the optional input arguments
hpos                = ft_getopt(varargin, 'hpos');
vpos                = ft_getopt(varargin, 'vpos');
width               = ft_getopt(varargin, 'width');
height              = ft_getopt(varargin, 'height');
hlim                = ft_getopt(varargin, 'hlim');
vlim                = ft_getopt(varargin, 'vlim');
Color               = ft_getopt(varargin, 'Color', 'k');
FontSize            = ft_getopt(varargin, 'FontSize');
FontName            = ft_getopt(varargin, 'FontName');
HorizontalAlignment = ft_getopt(varargin, 'HorizontalAlignment', 'center');
rotation            = ft_getopt(varargin, 'rotation', 0);
VerticalAlignment   = ft_getopt(varargin, 'VerticalAlignment', 'middle');
tag                 = ft_getopt(varargin, 'tag', '');
interpreter         = ft_getopt(varargin, 'interpreter', 'tex');

if isempty(hlim) && isempty(vlim) && isempty(hpos) && isempty(vpos) && isempty(height) && isempty(width)
  % no scaling is needed, the input X and Y are already fine
  % use a shortcut to speed up the plotting

else
  % use the full implementation
  abc = axis;
  if isempty(hlim)
    hlim = abc([1 2]);
  end

  if isempty(vlim)
    vlim = abc([3 4]);
  end

  if isempty(hpos);
    hpos = (hlim(1)+hlim(2))/2;
  end

  if isempty(vpos);
    vpos = (vlim(1)+vlim(2))/2;
  end

  if isempty(width),
    width = hlim(2)-hlim(1);
  end

  if isempty(height),
    height = vlim(2)-vlim(1);
  end

  % first shift the horizontal axis to zero
  X = X - (hlim(1)+hlim(2))/2;
  % then scale to length 1
  X = X ./ (hlim(2)-hlim(1));
  % then scale to the new width
  X = X .* width;
  % then shift to the new horizontal position
  X = X + hpos;

  % first shift the vertical axis to zero
  Y = Y - (vlim(1)+vlim(2))/2;
  % then scale to length 1
  Y = Y ./ (vlim(2)-vlim(1));
  % then scale to the new width
  Y = Y .* height;
  % then shift to the new vertical position
  Y = Y + vpos;

end % shortcut

% it fails on single inputs
X = double(X);
Y = double(Y);

h = text(X, Y, str);
set(h, 'HorizontalAlignment', HorizontalAlignment);
set(h, 'Color', Color);
set(h, 'rotation', rotation);
set(h, 'VerticalAlignment',VerticalAlignment);
if ~isempty(FontSize), set(h, 'FontSize', FontSize); end
if ~isempty(FontName), set(h, 'FontName', FontName); end
set(h, 'tag', tag);
set(h, 'interpreter', interpreter);

% the (optional) output is the handle
if nargout == 1;
  varargout{1} = h;
end

warning(ws); %revert to original state


text: Proof of concept HTML5 canvas + JS snake game


text:
package org.apache.spark.dict;

import java.io.Serializable;

public class NGlobalDictMetaInfo implements Serializable {

    private int bucketSize;
    private long dictCount;
    private long[] bucketOffsets;
    private long[] bucketCount;

    NGlobalDictMetaInfo(int bucketSize, long[] bucketOffsets, long dictCount, long[] bucketCount) {
        this.bucketSize = bucketSize;
        this.dictCount = dictCount;
        this.bucketOffsets = bucketOffsets;
        this.bucketCount = bucketCount;
    }

    long getOffset(int point) {
        return bucketOffsets[point];
    }

    public int getBucketSize() {
        return bucketSize;
    }

    public void setBucketSize(int bucketSize) {
        this.bucketSize = bucketSize;
    }

    public long getDictCount() {
        return this.dictCount;
    }

    public long[] getBucketOffsets() {
        return this.bucketOffsets;
    }

    public long[] getBucketCount() {
        return this.bucketCount;
    }

    public void setDictCount(long dictCount) {
        this.dictCount = dictCount;
    }

    public void setBucketOffsets(long[] bucketOffsets) {
        this.bucketOffsets = bucketOffsets;
    }

    public void setBucketCount(long[] bucketCount) {
        this.bucketCount = bucketCount;
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof NGlobalDictMetaInfo)) return false;
        final NGlobalDictMetaInfo other = (NGlobalDictMetaInfo) o;
        if (!other.canEqual((Object) this)) return false;
        if (this.getBucketSize() != other.getBucketSize()) return false;
        if (this.getDictCount() != other.getDictCount()) return false;
        if (!java.util.Arrays.equals(this.getBucketOffsets(), other.getBucketOffsets())) return false;
        if (!java.util.Arrays.equals(this.getBucketCount(), other.getBucketCount())) return false;
        return true;
    }

    protected boolean canEqual(final Object other) {
        return other instanceof NGlobalDictMetaInfo;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        result = result * PRIME + this.getBucketSize();
        final long $dictCount = this.getDictCount();
        result = result * PRIME + (int) ($dictCount >>> 32 ^ $dictCount);
        result = result * PRIME + java.util.Arrays.hashCode(this.getBucketOffsets());
        result = result * PRIME + java.util.Arrays.hashCode(this.getBucketCount());
        return result;
    }
}


text: from botfriend.bot import RetweetBot as Bot


text:
from projects.service.ZohoProjects import ZohoProjects
from projects.model.Bug import Bug
from projects.exception.ProjectsException import ProjectsException

authtoken = '{auth_token}'
zoho_portals = ZohoProjects(authtoken)

try:

    portal_id = zoho_portals.get_portals_api().get_portals()[0].get_id()
    zoho_projects = ZohoProjects(authtoken, portal_id)

    projects_api = zoho_projects.get_projects_api()
    project_id = projects_api.get_projects()[0].get_id()

    user_api = zoho_projects.get_users_api()

    #Get all users

    print user_api.get_users(project_id)

except ProjectsException as pe:
    print "Error code:" + pe.get_code() + "\nError Message: " + pe.get_message()