text:
<?php

use GuzzleHttp\Psr7\Response;
use Wps\Models\Site;
use WpsTest\MockSdk as Sdk;

class SiteTest extends PHPUnit_Framework_TestCase
{

    /**
     * @test
     */
    public function it_gets_a_site_collection()
    {
        $wps = new Sdk();

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->sitesResponse()))
        ]);

        $sites = $wps->site()->all();

        $this->assertEquals(['/sites/'], $wps->getRequestUris());
        $this->assertInstanceOf(Illuminate\Support\Collection::class, $sites);
        $this->assertContainsOnlyInstancesOf(Site::class, $sites);
        $this->assertEquals([1, 2], [$sites[0]->id, $sites[1]->id]);
    }

    /**
     * @test
     */
    public function it_gets_a_site_resource()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1)))
        ]);

        $site = $wps->site()->find(1);

        $this->assertEquals(['/sites/1/'], $wps->getRequestUris());
        $this->assertInstanceOf(Site::class, $site);
        $this->assertEquals([$wps->siteResponse(1)['data']['id'], $wps->siteResponse(1)['data']['name']], [$site->id, $site->name]);
    }

    /**
     * @test
     */
    public function it_creates_a_new_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(3))),
        ]);
        $site = $wps->site([
            'name'        => 'Site 3',
            'description' => 'Description for site 3',
            'unknown'     => 'should not be on object'
        ]);
        $site->save();
        $this->assertEquals(['/sites/'], $wps->getRequestUris());
        $this->assertEquals(['{"name":"Site 3","description":"Description for site 3"}'], $wps->getRequestBodies());
        $this->assertInstanceOf(Site::class, $site);
        $this->assertEquals([3, 'Site 3', null], [$site->id, $site->name, $site->unknown]);
    }

    /**
     * @test
     */
    public function it_updates_a_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->siteResponse(1))),
        ]);
        $site = $wps->site()->find(1);
        $site->name = "new site name";
        $success = $site->save();
        $this->assertEquals(['/sites/1/', '/sites/1/'], $wps->getRequestUris());
        $this->assertEquals([null, '{"name":"new site name","description":"Description for site 1"}'], $wps->getRequestBodies());
        $this->assertInstanceOf(Site::class, $site);
        $this->assertEquals([true, 'new site name'], [$success, $site->name]);
    }

    /**
     * @test
     */
    public function it_deletes_a_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(3))),
            new Response(204, []),
        ]);

        $site = $wps->site()->find(3);

        $success = $site->delete();

        $this->assertEquals(['/sites/3/', '/sites/3/'], $wps->getRequestUris());
        $this->assertEquals(true, $success);
    }

    /**
     * @test
     */
    public function it_gets_products_for_a_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productsResponse()))
        ]);

        $products = $wps->site()->find(1)->products;

        $this->assertEquals(['/sites/1/', '/sites/1/products/'], $wps->getRequestUris());
        $this->assertInstanceOf(\Illuminate\Support\Collection::class, $products);
        $this->assertContainsOnlyInstancesOf(\Wps\Models\Product::class, $products);
    }

    /**
     * @test
     */
    public function it_adds_a_product_to_a_site()
    {
        $wps = new Sdk();

        $new_product = [
            'id'                  => 3,
            'supplier_product_id' => '123456',
            'variableproduct_id'  => 13,
            'brand_id'            => 1,
            'country_id'          => 3,
            'name'                => 'test product',
            'list_price'          => '1.73',
            'estimated_weight'    => "25.676",
            'sku'                 => '12-1234',
            'upc'                 => '123456789123',
            'description'         => 'Here is a description of product 1',
            'published_at'        => '2015-06-05',
            'has_map_policy'      => false,
        ];

        $response = $wps->productsResponse();
        array_push($response['data'], $new_product);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(3))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $wps->product([
            'supplier_product_id' => '123456',
            'variableproduct_id'  => 13,
            'brand_id'            => 1,
            'country_id'          => 3,
            'name'                => 'test product',
            'list_price'          => '1.73',
            'estimated_weight'    => "25.676",
            'sku'                 => '12-1234',
            'upc'                 => '123456789123',
            'description'         => 'Here is a description of product 1',
            'published_at'        => '2015-06-05',
            'has_map_policy'      => false,
        ]);

        $product->save();

        $site->products()->attach([$product->id]);

        $keys = $site->products->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/', '/sites/1/products/'], $wps->getRequestUris());
        $this->assertEquals([
            null,
            '{"supplier_product_id":"123456","variableproduct_id":13,"brand_id":1,"country_id":3,"name":"test product","list_price":"1.73","estimated_weight":"25.676","sku":"12-1234","upc":"123456789123","description":"Here is a description of product 1","published_at":"2015-06-05 00:00:00","has_map_policy":false}',
            '[{"id":3}]'
        ], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Product::class, $site->products);
        $this->assertTrue($keys->contains(3));
    }

    /**
     * @test
     */
    public function it_removes_a_product_from_a_site()
    {
        $wps = new Sdk();

        $response = $wps->productsResponse();
        unset($response['data'][1]);
        $response['data'] = array_values($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(204, []),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);
        $site->products()->detach([2]);

        $keys = $site->products->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/sites/1/products/2/', '/sites/1/products/'], $wps->getRequestUris());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Product::class, $site->products);
        $this->assertNotTrue($keys->contains(2));
    }

    /**
     * @test
     */
    public function it_syncs_products_on_a_site()
    {
        $wps = new Sdk();

        $response = $wps->productsResponse();

        $response['data'] = array_reverse($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $site->products()->sync([2, 1]);

        $keys = $site->products->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/sites/1/products/'], $wps->getRequestUris());
        $this->assertEquals([null, '[{"id":2},{"id":1}]'], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Product::class, $site->products);
        $this->assertEquals([2, 1], $keys->toArray());
    }

    /**
     * @test
     */
    public function it_gets_images_for_a_product_on_a_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(2))),
            new Response(200, [], json_encode($wps->imagesResponse())),
        ]);

        $images = $wps->site()->find(1)->products(2)->images;

        $this->assertEquals(['/sites/1/', '/products/2/', '/sites/1/products/2/images/'], $wps->getRequestUris());
        $this->assertInstanceOf(\Illuminate\Support\Collection::class, $images);
        $this->assertContainsOnlyInstancesOf(\Wps\Models\Image::class, $images);
    }

    /**
     * @test
     */
    public function it_attaches_an_image_to_a_product_on_a_site()
    {
        $wps = new Sdk();

        $new_image = [
            'id'    => 3,
            'name'  => 'image-3.png',
            'alt'   => 'Alt for image 3',
            'mime'  => 'image/png',
            'size'  => 1234567,
            'links' =>
                [
                    [
                        'rel' => 'self',
                        'uri' => '/images/3',
                    ],
                    [
                        'rel' => 'image.imagestyles',
                        'uri' => '/images/3/imagestyles',
                    ],
                ]
        ];

        $response = $wps->imagesResponse();
        array_push($response['data'], $new_image);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->images()->attach([1]);

        $keys = $product->images->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/images/'], $wps->getRequestUris());
        $this->assertEquals([null, null, '[{"id":1}]'], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Image::class, $product->images);
        $this->assertTrue($keys->contains(3));
    }

    /**
     * @test
     */
    public function it_detaches_an_image_to_a_product_on_a_site()
    {
        $wps = new Sdk();

        $response = $wps->imagesResponse();
        unset($response['data'][1]);
        $response['data'] = array_values($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(204, []),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->images()->detach([2]);

        $keys = $product->images->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/images/2/', '/sites/1/products/1/images/'], $wps->getRequestUris());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Image::class, $product->images);
        $this->assertNotTrue($keys->contains(2));
    }

    /**
     * @test
     */
    public function it_syncs_images_for_a_product_on_a_site()
    {
        $wps = new Sdk();

        $response = $wps->imagesResponse();

        $response['data'] = array_reverse($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->images()->sync([2, 1]);

        $keys = $product->images->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/images/'], $wps->getRequestUris());
        $this->assertEquals([null, null, '[{"id":2},{"id":1}]'], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Image::class, $product->images);
        $this->assertEquals([2, 1], $keys->toArray());
    }

    /**
     * @test
     */
    public function it_gets_blocks_for_a_product_on_a_site()
    {
        $wps = new Sdk();
        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(2))),
            new Response(200, [], json_encode($wps->blocksResponse())),
        ]);

        $blocks = $wps->site()->find(1)->products(2)->blocks;

        $this->assertEquals(['/sites/1/', '/products/2/', '/sites/1/products/2/blocks/'], $wps->getRequestUris());
        $this->assertInstanceOf(\Illuminate\Support\Collection::class, $blocks);
        $this->assertContainsOnlyInstancesOf(\Wps\Models\Block::class, $blocks);
    }

    /**
     * @test
     */
    public function it_attaches_a_block_to_a_product_on_a_site()
    {
        $wps = new Sdk();

        $new_block = [
            'id'    => 3,
            'data'  => 'data for block 3',
            'links' =>
                [
                    [
                        'rel' => 'self',
                        'uri' => '/blocks/3',
                    ],
                ]
        ];

        $response = $wps->blocksResponse();
        array_push($response['data'], $new_block);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->blocks()->attach([1]);

        $keys = $product->blocks->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/blocks/'], $wps->getRequestUris());
        $this->assertEquals([null, null, '[{"id":1}]'], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Block::class, $product->blocks);
        $this->assertTrue($keys->contains(3));
    }

    /**
     * @test
     */
    public function it_detaches_a_block_to_a_product_on_a_site()
    {
        $wps = new Sdk();

        $response = $wps->blocksResponse();
        unset($response['data'][1]);
        $response['data'] = array_values($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(204, []),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->blocks()->detach([2]);

        $keys = $product->blocks->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/blocks/2/', '/sites/1/products/1/blocks/'], $wps->getRequestUris());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Block::class, $product->blocks);
        $this->assertNotTrue($keys->contains(2));
    }

    /**
     * @test
     */
    public function it_syncs_blocks_for_a_product_on_a_site()
    {
        $wps = new Sdk();

        $response = $wps->blocksResponse();

        $response['data'] = array_reverse($response['data']);

        $wps->addMockResults([
            new Response(200, [], json_encode($wps->siteResponse(1))),
            new Response(200, [], json_encode($wps->productResponse(1))),
            new Response(200, [], json_encode($response)),
        ]);

        $site = $wps->site()->find(1);

        $product = $site->products(1);

        $product->blocks()->sync([2, 1]);

        $keys = $product->blocks->map(function ($item, $key) {
            return $item->getKey();
        });

        $this->assertEquals(['/sites/1/', '/products/1/', '/sites/1/products/1/blocks/'], $wps->getRequestUris());
        $this->assertEquals([null, null, '[{"id":2},{"id":1}]'], $wps->getRequestBodies());
        $this->assertContainsOnlyInstancesOf(Wps\Models\Block::class, $product->blocks);
        $this->assertEquals([2, 1], $keys->toArray());
    }
}


text:
<!DOCTYPE html>

<title>MessageArraySuccessCallback_onsuccess</title>
<meta charset="utf-8">

redpajama_set_name: RedPajamaGithub


text:
<?php

use PragmaRX\Support\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateClippingLocalitiesTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function migrateUp()
	{
		Schema::create('clipping_localities', function(Blueprint $table)
		{
			$table->uuid('id')->unique()->primary()->index();

			$table->string('name');

			$table->string('latitude')->nullable();

			$table->string('longitude')->nullable();

			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function migrateDown()
	{
		Schema::drop('clipping_localities');
	}
}


text:
package com.codestd.springstudy.lesson02;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

public class MainBean {

	private String str;
	private Map<String,String> map;
	private List<String> list;

	private EnumerationType enumType;

	@Resource
	//@Autowired(required=false)
	private SubBean subBean;

	public String getStr() {
		return str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	public Map<String, String> getMap() {
		return map;
	}

	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	public List<String> getList() {
		return list;
	}

	public void setList(List<String> list) {
		this.list = list;
	}

	public EnumerationType getEnumType() {
		return enumType;
	}

	public void setEnumType(EnumerationType enumType) {
		this.enumType = enumType;
	}

	public void setSubBean(SubBean subBean) {
		this.subBean = subBean;
	}

	public void print(){
		System.out.println("str:"+this.str);
		System.out.println("map:"+this.map);
		System.out.println("list:"+this.list);
		System.out.println("enumType:"+this.enumType);
		System.out.println("subBean:"+this.subBean);
	}
}


text:
#include <iomanip>
#include <sstream>
#include <assert.h>

#include "ValStats.h"

ValStats::ValStats()
{
  ValStats::reset();
}

ValStats::~ValStats()
{
}

void ValStats::reset()
{
  for (unsigned vOrig = 0; vOrig < BRIDGE_FORMAT_LABELS_SIZE; vOrig++)
  {
    for (unsigned vRef = 0; vRef < BRIDGE_FORMAT_LABELS_SIZE; vRef++)
    {
      ValStat& stat = stats[vOrig][vRef];
      for (unsigned s = 0; s < BRIDGE_VAL_SUMM_SIZE; s++)
        stat.count[s] = 0;
    }
  }
}

void ValStats::add(
  const Format formatOrig,
  const Format formatRef,
  const ValProfile& prof)
{
  assert(formatOrig != BRIDGE_FORMAT_LABELS_SIZE);
  assert(formatRef != BRIDGE_FORMAT_LABELS_SIZE);

  ValStat& current = stats[formatOrig][formatRef];

  bool minorFlag, pavlicekBugFlag, programErrorFlag;

  current.profile.addRange(prof, 0, BRIDGE_VAL_TXT_ALL_PASS,
    minorFlag);

  current.profile.addRange(prof, BRIDGE_VAL_TXT_ALL_PASS, BRIDGE_VAL_ERROR,
    pavlicekBugFlag);

  current.profile.addRange(prof, BRIDGE_VAL_ERROR, BRIDGE_VAL_SIZE,
    programErrorFlag);

  current.count[BRIDGE_VAL_ALL]++;

  if (minorFlag)
    current.count[BRIDGE_VAL_MINOR]++;

  if (pavlicekBugFlag)
    current.count[BRIDGE_VAL_PAVLICEK]++;

  if (programErrorFlag)
    current.count[BRIDGE_VAL_MAJOR]++;
}

void ValStats::operator += (const ValStats& statsIn)
{
  for (unsigned vOrig = 0; vOrig < BRIDGE_FORMAT_LABELS_SIZE; vOrig++)
  {
    for (unsigned vRef = 0; vRef < BRIDGE_FORMAT_LABELS_SIZE; vRef++)
    {
      ValStat& current = stats[vOrig][vRef];
      const ValStat& currentIn = statsIn.stats[vOrig][vRef];

      current.profile += currentIn.profile;
      for (unsigned s = 0; s < BRIDGE_VAL_SUMM_SIZE; s++)
        current.count[s] += currentIn.count[s];
    }
  }
}

string ValStats::posOrDash(const unsigned u) const
{
  if (u == 0)
    return "-";
  else
    return STR(u);
}

bool ValStats::rowHasEntries(
  const ValStat stat[],
  const unsigned label) const
{
  for (auto &g: FORMAT_ACTIVE)
    if (stat[g].profile.labelIsSet(label))
      return true;

  return false;
}

bool ValStats::summRowHasEntries(
  const ValStat stat[],
  const unsigned summLabel) const
{
  assert(summLabel < BRIDGE_VAL_SUMM_SIZE);

  for (auto &g: FORMAT_ACTIVE)
    if (stat[g].count[summLabel])
      return true;

  return false;
}

void ValStats::printRow(
  ostream& fstr,
  const ValStat stat[],
  const unsigned label) const
{
  fstr << "  " << setw(5) << left << ValErrors[label].nameShort;
  for (auto &g: FORMAT_ACTIVE)
    fstr << setw(7) << right << posOrDash(stat[g].profile.getCount(label));
  fstr << "\n";
}

void ValStats::printRows(
  ostream& fstr,
  const ValStat stat[],
  const unsigned lower,
  const unsigned upper) const
{
  for (unsigned v = lower; v < upper; v++)
  {
    if (ValStats::rowHasEntries(stat, v))
      printRow(fstr, stat, v);
  }
}

void ValStats::printSummRow(
  ostream& fstr,
  const ValStat stat[],
  const string& header,
  const ValSumm summLabel) const
{
  if (! ValStats::summRowHasEntries(stat, summLabel))
    return;

  fstr << setw(7) << left << header;
  for (auto &g: FORMAT_ACTIVE)
    fstr << setw(7) << right << posOrDash(stat[g].count[summLabel]);
  fstr << "\n";
}

void ValStats::print(
  ostream& fstr,
  const bool detailFlag) const
{
  fstr << setw(7) << "";
  for (auto &f: FORMAT_ACTIVE)
    fstr << setw(7) << right << FORMAT_NAMES[f];
  fstr << "\n\n";

  for (auto &f: FORMAT_ACTIVE)
  {
    ValStats::printSummRow(fstr, stats[f], FORMAT_NAMES[f], BRIDGE_VAL_ALL);

    if (detailFlag)
      ValStats::printRows(fstr, stats[f], 0, BRIDGE_VAL_TXT_ALL_PASS);

    ValStats::printSummRow(fstr, stats[f], "MINOR", BRIDGE_VAL_MINOR);

    if (detailFlag)
      ValStats::printRows(fstr, stats[f],
        BRIDGE_VAL_TXT_ALL_PASS, BRIDGE_VAL_ERROR);

    ValStats::printSummRow(fstr, stats[f], "RPBUG", BRIDGE_VAL_PAVLICEK);

    if (detailFlag)
      ValStats::printRows(fstr, stats[f],
        BRIDGE_VAL_ERROR, BRIDGE_VAL_SIZE);

    ValStats::printSummRow(fstr, stats[f], "MAJOR", BRIDGE_VAL_MAJOR);

    if (ValStats::summRowHasEntries(stats[f], BRIDGE_VAL_ALL))
      fstr << "\n";
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. trimest. Soc. mycol. Fr. 98(2): 165 (1982)

#### Original name
Amanita asteropus Sabo ex Romagn.

### Remarks
null


text:
<?php

// This file is generated by Composer
require_once '../vendor/autoload.php';

use \Databox\DataboxClient;
use \Databox\DataboxClientBuilder;
use \Databox\DataboxException;
use \Databox\DataboxBuilder;
use \Guzzle\Common\Exception\RuntimeException;
use \Exception;
use \Databox\Widget as Widget;
use \Databox\Widget\Table as Table;
use \Databox\KPI as KPI;

//Instantiate the client
$client = new DataboxClient('https://app.databox.com/');
$client->setApiKey('2fvbxy97j1wkccgw44sk0o44wk0w4kgk'); // username: test@databox.com pw: test123 connection: PHP SDK Test
$client->setUniqueUrl('32lkojmk5sw08o44');
//The client builder extends Guzzle Client, so you can add Guzzle compatible event subscribers and plugins to it if you like

//Instantiate the builder
$builder = new DataboxBuilder();

//The addKpi method uses the accepts $key, $value, $date (in that order). Date should be a timestamp in the format Y-m-d\TH:i:s. Date may be NULL, in which case the current UTC time will be used.
$builder->addKpi(new KPI("testmain", mt_rand(1,600)));
$builder->addKpi(new KPI("testbignumber", mt_rand(1,600)));
$builder->addKpi(new KPI("testcompare", mt_rand(1,600)));
$builder->addKpi(new KPI("testcompare", mt_rand(1,600)));
$builder->addKpi(new KPI("testintervalvalues", mt_rand(1,600)));
$builder->addKpi(new KPI("testlinechart", mt_rand(1,600)));
$builder->addKpi(new KPI("testbarchart", mt_rand(1,600)));

$table = new Widget\Table("testtable");
$table->addColumn("KPI", "string");
$table->addColumn("Today", "float");
$table->addColumn("Yesterday", "float");
$table->addRow(new Table\ColumnData("Visitors"), new Table\ColumnData(1234, 567), new Table\ColumnData(9876, 123));
$builder->addWidget($table);

$progress = new Widget\Progress("testprogress");
$progress->setMax(123);
$progress->setLabel("Life achievements");
$progress->setValue(10);
$builder->addWidget($progress);

$messages = new Widget\Messages("testmessages");
$messages->addMessage("I like pie!", "USD");
$messages->addMessage("Sweden", "USD");
$builder->addWidget($messages);

$pie = new Widget\Pie("testpie");
$pie->addSlice("Pepperoni", 20);
$pie->addSlice("Salami", 50, -10);
$pie->addSlice("Tuna", 70, -30);
$builder->addWidget($pie);

$pie = new Widget\Funnel("testfunnel");
$pie->addSlice("Cheese", 5);
$pie->addSlice("Meat", 90, -10);
$pie->addSlice("Apples", 10, -30);
$builder->addWidget($pie);

$pie = new Widget\Pipeline("testpipeline");
$pie->addSlice("Mac", 20, 24);
$pie->addSlice("PC", 30, -10);
$pie->addSlice("Amiga", 10, -10);
$builder->addWidget($pie);

//You must provide uniqueURL and payload parameters. Payload can be any JSON string, but we reccommend you use our builder class.
try {
    //If no Exception is raised everything went through as it should've :)
    $returnedResult = $client->pushData($builder);
    is_array($returnedResult) ? print_r($returnedResult) : print($returnedResult);
} catch (DataboxException $e) {
    echo $e->getType();
    echo $e->getWebMessage();
    echo $e->getMessage();
} catch (RuntimeException $e) {
    echo $e->getMessage();
    echo $e->getCode();
} catch (Exception $e) {
    echo $e->getMessage();
}

//Fetch the saved data log
$log = $client->getPushLog();

echo $log;


text:
# frpc

RPC between iframes and windows using postMessage

[![Dependency Status](https://david-dm.org/rpcjs/frpc/status.svg?style=flat)](https://david-dm.org/rpcjs/frpc)
[![Build Status](https://travis-ci.org/rpcjs/frpc.svg?branch=master)](https://travis-ci.org/rpcjs/frpc)
[![npm version](https://badge.fury.io/js/frpc.svg)](http://badge.fury.io/js/frpc)

## Installation

```
npm install --save frpc
```

## Usage example

Lets say we want to change the height of an iframe. We don't know from the parent window when should the iframe be resized and what should be the size of it, so we have to call a function in the parent and pass the heigh to it.

```js
/* parent window code */
var Server = require('frpc').Server;

var server = new Server({
  channel: 'foo',
  targets: [
    window: targetIframe.contentWindow,
    origin: '*' /* this is default value of origin as well */
  ]
});

server.addMethod('resize', function(newHeight) {
  targetIframe.style.height = newHeight + 'px';
});

/* iframe window code */
var Client = require('frpc').Client;

var client = new Client({
  channel: 'foo',
  targets: [
    window: window.parent
  ]
});

client.register(['resize']);

client.methods.resize(1200);
```

It is also possible to get a response from a remote procedure call. Lets say we want to get a value from an input inside the iframe.

```js
/* iframe window code */
var Server = require('frpc').Server;

var server = new Server({
  channel: 'foo',
  targets: [
    window: window.parent
  ]
});

server.addMethod('getInputValue', function(cb) {
  cb($('input').val());
});

/* parent window code */
var Client = require('frpc').Client;

var client = new Client({
  channel: 'foo',
  targets: [
    window: targetIframe.contentWindow
  ]
});

client.register(['getInputValue']);

client.methods.getInputValue(function(value) {
  console.log(value);
});
```

## License

MIT


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>My AngularJS App</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="css/app.css">


text:
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
public:
    int diameterOfBinaryTree(TreeNode* root) {
        int maxLen = 0;
        dfs(root, maxLen);
        return maxLen;
    }

private:
    int dfs(TreeNode* root, int& maxLen) {
        if (root == nullptr) {
            return 0;
        }

        int left = dfs(root->left, maxLen);
        int right = dfs(root->right, maxLen);
        maxLen = max(maxLen, left + right);
        return  1 + max(left, right);
    }
};


text:
package com.keekan.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import com.keekan.tool.BaseTools;
import com.keekan.tool.Configurats;
import com.keekan.tool.DateTime;
import com.keekan.tool.ImageCut;
import com.keekan.tool.ImageManager;

@SuppressWarnings("unchecked")
public class AvatarAction extends BaseAction {

	private static final long serialVersionUID = 1L;
	private File photo;				//照片域
	private String photoFileName;	//照片名
	private String photoType;
	private String avatarPath;
	private String avatarName;
	private String rawName;			//原名字
	private String shrinkName;		//压缩后的名字
	private String cutName;			//切割后的名字
	private String rawPath;			//上传后原图片地址//raw
	private String shrinkPath;		//上传后压缩图片地址//Shrink
	private String dataName;		//时间名字

	private String x;
	private String y;
	private String w;
	private String h;
	private Integer width;
	private Integer height;
	private String photoName;

	private Integer belongAlbumId;
	private String uploadDate;

	private List avatarList;		//头像List
	/**
	 * 头像
	 * @return
	 * @throws Exception
	 */
	public String avatar() throws Exception {
		keeno = (Integer) BaseTools.getSessionAttribute("keeno");
		avatarList = avatarServe.viewAllAvatar(keeno);
		return "success";
	}

	/**
	 * 头像编辑
	 * @return
	 * @throws Exception
	 */
	public String avatarEditor() throws Exception {

		return "success";
	}
	/**
	 * 头像上传
	 * @return
	 * @throws Exception
	 */
	public String avatarUpload() throws Exception {
		keeno = (Integer) BaseTools.getSessionAttribute("keeno");
		avatarPath = Configurats.getFilePath("USER_FILE")+keeno+"/avatar/";
		photoType = photoFileName.substring(photoFileName.lastIndexOf("."));
		dataName = DateTime.getYearMonthDay();
		avatarName = dataName+"_r"+photoType;
		shrinkName = dataName+"_s"+photoType;
		FileOutputStream fos = new FileOutputStream(avatarPath+avatarName);
		FileInputStream fis = new FileInputStream(getPhoto());
		byte[] buffer = new byte[1024];
		int len = 0;
		while ((len = fis.read(buffer)) > 0) {
			fos.write(buffer, 0, len);
		}
		belongAlbumId  = albumServe.getAlbumId(keeno, "贴图相册");
		uploadDate = DateTime.getDateTime();
		photoServe.photoUpload(photoFileName, avatarName, "", belongAlbumId, uploadDate);
		rawPath = avatarPath+avatarName;
		shrinkPath = avatarPath+shrinkName;

		ImageManager imageManager = new ImageManager();
		boolean dis = imageManager.zoomImg(imageManager, rawPath, shrinkPath, 770, 350);

		if (dis == true) {
			avatarName = shrinkName;
		}
		HttpServletResponse response = BaseTools.getResponse();
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		out.print(keeno +"#"+ avatarName );
		out.flush();
		out.close();
		return null;
	}

	/**
	 * 头像切割
	 * @return
	 * @throws Exception
	 */
	public String avatarCut() throws Exception {
		keeno = (Integer) BaseTools.getSessionAttribute("keeno");
		avatarPath = Configurats.getFilePath("USER_FILE")+keeno+"/avatar/";
		photoType = photoName.substring(photoName.lastIndexOf("."));
		dataName = DateTime.getYearMonthDay();
		rawName = avatarPath+photoName;
		avatarName = avatarPath+dataName+"_c"+photoType;

		int xs = Integer.parseInt(x);
		int ys = Integer.parseInt(y);
		int ws = Integer.parseInt(w);
		int hs = Integer.parseInt(h);
		ImageCut.abscut(rawName, avatarName, xs,ys,ws, hs);	//进行剪切图片操作
		String[] avatarNames = new String[3];
		 for (int i = 0; i <= 2; i++) {
			 if (i == 0) {
				cutName = dataName+"_100"+photoType;
				width = 100;
				height = 100;
			}else if (i == 1) {
				cutName = dataName+"_50"+photoType;
				width = 50;
				height = 50;
			}else if (i == 2) {
				cutName = dataName+"_30"+photoType;
				width = 30;
				height = 30;
			}
			avatarNames[i] = cutName;
			ImageManager imageManager = new ImageManager();
			imageManager.zoomImg(imageManager, avatarName, avatarPath + cutName, width, height);

		}
		 uploadDate = DateTime.getDateTime();
		 //avatarServe.initAddAvatar(keeno, avatarNames[0], avatarNames[1], avatarNames[2], uploadDate, "yes");
		 avatarServe.renewAvatar(keeno, avatarNames[0], avatarNames[1], avatarNames[2], uploadDate, "yes");
		 File f = new File(avatarName);
		 if(f.exists()){

		 }
		return SUCCESS;
	}
	public File getPhoto() {
		return photo;
	}
	public void setPhoto(File photo) {
		this.photo = photo;
	}
	public String getPhotoFileName() {
		return photoFileName;
	}
	public void setPhotoFileName(String photoFileName) {
		this.photoFileName = photoFileName;
	}
	public String getPhotoType() {
		return photoType;
	}
	public void setPhotoType(String photoType) {
		this.photoType = photoType;
	}
	public String getAvatarPath() {
		return avatarPath;
	}
	public void setAvatarPath(String avatarPath) {
		this.avatarPath = avatarPath;
	}
	public String getAvatarName() {
		return avatarName;
	}
	public void setAvatarName(String avatarName) {
		this.avatarName = avatarName;
	}
	public String getRawName() {
		return rawName;
	}
	public void setRawName(String rawName) {
		this.rawName = rawName;
	}
	public String getShrinkName() {
		return shrinkName;
	}
	public void setShrinkName(String shrinkName) {
		this.shrinkName = shrinkName;
	}
	public String getRawPath() {
		return rawPath;
	}
	public void setRawPath(String rawPath) {
		this.rawPath = rawPath;
	}
	public String getShrinkPath() {
		return shrinkPath;
	}
	public void setShrinkPath(String shrinkPath) {
		this.shrinkPath = shrinkPath;
	}
	public String getDataName() {
		return dataName;
	}
	public void setDataName(String dataName) {
		this.dataName = dataName;
	}
	public String getX() {
		return x;
	}
	public void setX(String x) {
		this.x = x;
	}
	public String getY() {
		return y;
	}
	public void setY(String y) {
		this.y = y;
	}
	public String getW() {
		return w;
	}
	public void setW(String w) {
		this.w = w;
	}
	public String getH() {
		return h;
	}
	public void setH(String h) {
		this.h = h;
	}
	public Integer getWidth() {
		return width;
	}
	public void setWidth(Integer width) {
		this.width = width;
	}
	public Integer getHeight() {
		return height;
	}
	public void setHeight(Integer height) {
		this.height = height;
	}
	public String getPhotoName() {
		return photoName;
	}
	public void setPhotoName(String photoName) {
		this.photoName = photoName;
	}
	public void setCutName(String cutName) {
		this.cutName = cutName;
	}
	public String getCutName() {
		return cutName;
	}

	public void setBelongAlbumId(Integer belongAlbumId) {
		this.belongAlbumId = belongAlbumId;
	}

	public Integer getBelongAlbumId() {
		return belongAlbumId;
	}
	public String getUploadDate() {
		return uploadDate;
	}

	public void setUploadDate(String uploadDate) {
		this.uploadDate = uploadDate;
	}

	public void setAvatarList(List avatarList) {
		this.avatarList = avatarList;
	}

	public List getAvatarList() {
		return avatarList;
	}

}


text:
/**
 *
 */
package leertaak7;

/**
 * @author berto_000
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}


text:
import React from 'react'
import { Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers'
import DocumentTitle from 'react-document-title'
import SocialIcons from '../components/socialIcons'
import { config } from 'config'

export default class Index extends React.Component {
  render () {
    return (
      <DocumentTitle title={config.siteTitle}>

              HalfAtheist

{config.tagLine}

<Link to={prefixLink('/videos/')} title="My videos">Videos</Link>

<Link to={prefixLink('/about/')} title="About me">About</Link>

          <SocialIcons />

      </DocumentTitle>
    )
  }
}


text:
package com.intellij.facet.impl.ui.libraries;

import com.intellij.framework.library.DownloadableLibraryDescription;
import com.intellij.framework.library.DownloadableLibraryType;
import com.intellij.framework.library.FrameworkLibraryVersion;
import com.intellij.framework.library.FrameworkLibraryVersionFilter;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.util.frameworkSupport.OldCustomLibraryDescription;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.NewLibraryConfiguration;
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.NotNullComputable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SortedComboBoxModel;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.PathUtil;
import com.intellij.util.PlatformIcons;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.download.DownloadableFileSetVersions;
import com.intellij.util.ui.RadioButtonEnumModel;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Dmitry Avdeev
 */
public class LibraryOptionsPanel implements Disposable {
  private static final Logger LOG = Logger.getInstance("#com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel");

  private JBLabel myMessageLabel;
  private JPanel myPanel;
  private JButton myConfigureButton;
  private JComboBox<LibraryEditor> myExistingLibraryComboBox;
  private JRadioButton myDoNotCreateRadioButton;
  private JPanel myConfigurationPanel;
  private JButton myCreateButton;
  private JRadioButton myDownloadRadioButton;
  private JRadioButton myUseLibraryRadioButton;
  private JLabel myUseLibraryLabel;
  private JLabel myHiddenLabel;
  private JPanel myRootPanel;
  private JRadioButton myUseFromProviderRadioButton;
  private JPanel mySimplePanel;
  private ButtonGroup myButtonGroup;

  private LibraryCompositionSettings mySettings;
  private final CustomLibraryDescription myLibraryDescription;
  private final LibrariesContainer myLibrariesContainer;
  private SortedComboBoxModel<LibraryEditor> myLibraryComboBoxModel;
  private FrameworkLibraryProvider myLibraryProvider;
  private boolean myDisposed;

  private enum Choice {
    USE_LIBRARY,
    DOWNLOAD,
    SETUP_LIBRARY_LATER,
    USE_FROM_PROVIDER
  }

  private RadioButtonEnumModel<Choice> myButtonEnumModel;

  public LibraryOptionsPanel(@NotNull final CustomLibraryDescription libraryDescription,
                             @NotNull final String path,
                             @NotNull final FrameworkLibraryVersionFilter versionFilter,
                             @NotNull final LibrariesContainer librariesContainer,
                             final boolean showDoNotCreateOption) {

    this(libraryDescription, () -> path, versionFilter, librariesContainer, showDoNotCreateOption);
  }

  public LibraryOptionsPanel(@NotNull final CustomLibraryDescription libraryDescription,
                             @NotNull final NotNullComputable<String> pathProvider,
                             @NotNull final FrameworkLibraryVersionFilter versionFilter,
                             @NotNull final LibrariesContainer librariesContainer,
                             final boolean showDoNotCreateOption) {
    myLibraryDescription = libraryDescription;
    myLibrariesContainer = librariesContainer;
    final DownloadableLibraryDescription description = getDownloadableDescription(libraryDescription);
    if (description != null) {
      showCard("loading");
      description.fetchVersions(new DownloadableFileSetVersions.FileSetVersionsCallback<FrameworkLibraryVersion>() {
        @Override
        public void onSuccess(@NotNull final List<? extends FrameworkLibraryVersion> versions) {
          //noinspection SSBasedInspection
          SwingUtilities.invokeLater(() -> {
            if (!myDisposed) {
              showSettingsPanel(libraryDescription, pathProvider, versionFilter, showDoNotCreateOption, versions);
              onVersionChanged(getPresentableVersion());
            }
          });
        }
      });
    }
    else {
      showSettingsPanel(libraryDescription, pathProvider, versionFilter, showDoNotCreateOption,
                        new ArrayList<>());
    }
  }

  @Nullable
  private String getPresentableVersion() {
    switch (myButtonEnumModel.getSelected()) {
      case DOWNLOAD:
        LibraryDownloadSettings settings = mySettings.getDownloadSettings();
        if (settings != null) {
          return settings.getVersion().getVersionNumber();
        }
        break;
      case USE_LIBRARY:
        LibraryEditor item = myLibraryComboBoxModel.getSelectedItem();
        if (item instanceof ExistingLibraryEditor) {
          return item.getName();
        }
        break;
      default:
        return null;
    }
    return null;
  }

  protected void onVersionChanged(@Nullable String version) {
  }

  public JPanel getSimplePanel() {
    return mySimplePanel;
  }

  @Nullable
  private static DownloadableLibraryDescription getDownloadableDescription(CustomLibraryDescription libraryDescription) {
    final DownloadableLibraryType type = libraryDescription.getDownloadableLibraryType();
    if (type != null) return type.getLibraryDescription();
    if (libraryDescription instanceof OldCustomLibraryDescription) {
      return ((OldCustomLibraryDescription)libraryDescription).getDownloadableDescription();
    }
    return null;
  }

  private void showCard(final String editing) {
    ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, editing);
  }

  private void showSettingsPanel(CustomLibraryDescription libraryDescription,
                                 NotNullComputable<String> pathProvider,
                                 FrameworkLibraryVersionFilter versionFilter,
                                 boolean showDoNotCreateOption, final List<? extends FrameworkLibraryVersion> versions) {
    //todo[nik] create mySettings only in apply() method
    mySettings = new LibraryCompositionSettings(libraryDescription, pathProvider, versionFilter, versions);
    Disposer.register(this, mySettings);
    List<Library> libraries = calculateSuitableLibraries();

    myButtonEnumModel = RadioButtonEnumModel.bindEnum(Choice.class, myButtonGroup);
    myButtonEnumModel.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        updateState();
        onVersionChanged(getPresentableVersion());
      }
    });

    myDoNotCreateRadioButton.setVisible(showDoNotCreateOption);
    myLibraryComboBoxModel = new SortedComboBoxModel<>((o1, o2) -> {
      final String name1 = o1.getName();
      final String name2 = o2.getName();
      return -StringUtil.notNullize(name1).compareToIgnoreCase(StringUtil.notNullize(name2));
    });

    for (Library library : libraries) {
      ExistingLibraryEditor libraryEditor = myLibrariesContainer.getLibraryEditor(library);
      if (libraryEditor == null) {
        libraryEditor = mySettings.getOrCreateEditor(library);
      }
      myLibraryComboBoxModel.add(libraryEditor);
    }
    myExistingLibraryComboBox.setModel(myLibraryComboBoxModel);
    if (libraries.isEmpty()) {
      myLibraryComboBoxModel.add(null);
    }
    myExistingLibraryComboBox.setSelectedIndex(0);
    myExistingLibraryComboBox.addItemListener(new ItemListener() {
      @Override
      public void itemStateChanged(ItemEvent e) {
        if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() != null) {
          myButtonEnumModel.setSelected(Choice.USE_LIBRARY);
        }
        updateState();
        onVersionChanged(getPresentableVersion());
      }
    });
    myExistingLibraryComboBox.setRenderer(new ColoredListCellRenderer<LibraryEditor>(myExistingLibraryComboBox) {
      @Override
      protected void customizeCellRenderer(@NotNull JList<? extends LibraryEditor> list, LibraryEditor value, int index, boolean selected,
                                           boolean hasFocus) {
        if (value == null) {
          append("[No library selected]");
        }
        else if (value instanceof ExistingLibraryEditor) {
          final Library library = ((ExistingLibraryEditor)value).getLibrary();
          final boolean invalid = !((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES).isEmpty();
          OrderEntryAppearanceService.getInstance().forLibrary(getProject(), library, invalid).customize(this);
        }
        else if (value instanceof NewLibraryEditor) {
          setIcon(PlatformIcons.LIBRARY_ICON);
          final String name = value.getName();
          append(name != null ? name : "<unnamed>");
        }
      }
    });

    boolean canDownload = mySettings.getDownloadSettings() != null;
    boolean canUseFromProvider = myLibraryProvider != null;
    myDownloadRadioButton.setVisible(canDownload);
    myUseFromProviderRadioButton.setVisible(canUseFromProvider);
    Choice selectedOption;
    if (canUseFromProvider) {
      selectedOption = Choice.USE_FROM_PROVIDER;
    }
    else if (libraries.isEmpty() && canDownload) {
      selectedOption = Choice.DOWNLOAD;
    }
    else {
      selectedOption = Choice.USE_LIBRARY;
      doCreate(true);
    }
    myButtonEnumModel.setSelected(selectedOption);

    if (!canDownload && !canUseFromProvider && !showDoNotCreateOption) {
      myUseLibraryRadioButton.setVisible(false);
      myUseLibraryLabel.setVisible(true);
    }
    else {
      myUseLibraryLabel.setVisible(false);
    }

    final Dimension minimumSize = new Dimension(-1, myMessageLabel.getFontMetrics(myMessageLabel.getFont()).getHeight() * 2);
    myHiddenLabel.setMinimumSize(minimumSize);

    myCreateButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        doCreate(false);
      }
    });
    myConfigureButton.addActionListener(new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        doConfigure();
      }
    });
    updateState();
    showCard("editing");
  }

  private Project getProject() {
    Project project = myLibrariesContainer.getProject();
    if (project == null) {
      project = ProjectManager.getInstance().getDefaultProject();
    }
    return project;
  }

  private void doConfigure() {
    switch (myButtonEnumModel.getSelected()) {
      case DOWNLOAD:
        final LibraryDownloadSettings oldDownloadSettings = mySettings.getDownloadSettings();
        LOG.assertTrue(oldDownloadSettings != null);
        final LibraryDownloadSettings newDownloadSettings = DownloadingOptionsDialog.showDialog(myPanel, oldDownloadSettings,
                                                                                mySettings.getCompatibleVersions(), true);
        if (newDownloadSettings != null) {
          mySettings.setDownloadSettings(newDownloadSettings);
        }
        break;

      case USE_LIBRARY:
        final Object item = myExistingLibraryComboBox.getSelectedItem();
        if (item instanceof LibraryEditor) {
          EditLibraryDialog dialog = new EditLibraryDialog(myPanel, mySettings, (LibraryEditor)item);
          dialog.show();
          if (item instanceof ExistingLibraryEditor) {
            new WriteAction() {
              protected void run(@NotNull final Result result) {
                ((ExistingLibraryEditor)item).commit();
              }
            }.execute();
          }
        }
        break;

      case USE_FROM_PROVIDER:
      case SETUP_LIBRARY_LATER:
        break;
    }
    updateState();
  }

  public void setLibraryProvider(@Nullable FrameworkLibraryProvider provider) {
    if (provider != null && !ContainerUtil.intersects(provider.getAvailableLibraryKinds(), myLibraryDescription.getSuitableLibraryKinds())) {
      provider = null;
    }

    if (!Comparing.equal(myLibraryProvider, provider)) {
      myLibraryProvider = provider;

      if (mySettings != null) {
        if (provider != null && !myUseFromProviderRadioButton.isVisible()) {
          myUseFromProviderRadioButton.setSelected(true);
        }
        myUseFromProviderRadioButton.setVisible(provider != null);
        updateState();
      }
    }
  }

  public void setVersionFilter(@NotNull FrameworkLibraryVersionFilter versionFilter) {
    if (mySettings != null) {
      mySettings.setVersionFilter(versionFilter);
      updateState();
    }
  }

  private void doCreate(boolean useDefaultSettings) {
    final NewLibraryConfiguration libraryConfiguration = useDefaultSettings
                                                         ? myLibraryDescription.createNewLibraryWithDefaultSettings(getBaseDirectory())
                                                         : myLibraryDescription.createNewLibrary(myCreateButton, getBaseDirectory());
    if (libraryConfiguration != null) {
      final NewLibraryEditor libraryEditor = new NewLibraryEditor(libraryConfiguration.getLibraryType(), libraryConfiguration.getProperties());
      libraryEditor.setName(myLibrariesContainer.suggestUniqueLibraryName(libraryConfiguration.getDefaultLibraryName()));
      libraryConfiguration.addRoots(libraryEditor);
      if (myLibraryComboBoxModel.get(0) == null) {
        myLibraryComboBoxModel.remove(0);
      }
      myLibraryComboBoxModel.add(libraryEditor);
      myLibraryComboBoxModel.setSelectedItem(libraryEditor);
      myButtonEnumModel.setSelected(Choice.USE_LIBRARY);
    }
  }

  private List<Library> calculateSuitableLibraries() {
    List<Library> suitableLibraries = new ArrayList<>();
    for (Library library : myLibrariesContainer.getAllLibraries()) {
      if (myLibraryDescription instanceof OldCustomLibraryDescription &&
          ((OldCustomLibraryDescription)myLibraryDescription).isSuitableLibrary(library, myLibrariesContainer)
          || LibraryPresentationManager.getInstance().isLibraryOfKind(library, myLibrariesContainer, myLibraryDescription.getSuitableLibraryKinds())) {
        suitableLibraries.add(library);
      }
    }
    return suitableLibraries;
  }

  @Nullable
  private VirtualFile getBaseDirectory() {
    String path = mySettings.getBaseDirectoryPath();
    VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(path);
    if (dir == null) {
      path = path.substring(0, path.lastIndexOf('/'));
      dir = LocalFileSystem.getInstance().findFileByPath(path);
    }
    return dir;
  }

  private void updateState() {
    myMessageLabel.setIcon(null);
    myConfigureButton.setVisible(true);
    final LibraryDownloadSettings settings = mySettings.getDownloadSettings();
    myDownloadRadioButton.setVisible(settings != null);
    myUseFromProviderRadioButton.setVisible(myLibraryProvider != null);
    if (!myUseFromProviderRadioButton.isVisible() && myUseFromProviderRadioButton.isSelected()) {
      if (myDownloadRadioButton.isVisible()) {
        myDownloadRadioButton.setSelected(true);
      }
      else {
        myUseLibraryRadioButton.setSelected(true);
      }
    }
    if (!myDownloadRadioButton.isVisible() && myDownloadRadioButton.isSelected() && myUseLibraryRadioButton.isVisible()) {
      myUseLibraryRadioButton.setSelected(true);
    }
    String message = "";
    boolean showConfigurePanel = true;
    switch (myButtonEnumModel.getSelected()) {
      case DOWNLOAD:
        message = getDownloadFilesMessage();
        break;
      case USE_FROM_PROVIDER:
        if (myLibraryProvider != null) {
          message = "Library from " + myLibraryProvider.getPresentableName() + " will be used";
        }
        myConfigureButton.setVisible(false);
        break;
      case USE_LIBRARY:
        final Object item = myExistingLibraryComboBox.getSelectedItem();
        if (item == null) {
          myMessageLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
          message = "Error: library is not specified";
          myConfigureButton.setVisible(false);
        }
        else if (item instanceof NewLibraryEditor) {
          final LibraryEditor libraryEditor = (LibraryEditor)item;
          message = IdeBundle.message("label.library.will.be.created.description.text", mySettings.getNewLibraryLevel(),
                                      libraryEditor.getName(), libraryEditor.getFiles(OrderRootType.CLASSES).length);
        }
        else {
          message = MessageFormat.format("{0} library will be used", ((ExistingLibraryEditor)item).getName());
        }
        break;
      default:
        showConfigurePanel = false;
    }

    if (myLibraryProvider != null) {
      myUseFromProviderRadioButton.setText("Use library from " + myLibraryProvider.getPresentableName());
    }

    //show the longest message on the hidden card to ensure that dialog won't jump if user selects another option
    if (mySettings.getDownloadSettings() != null) {
      myHiddenLabel.setText(getDownloadFilesMessage());
    }
    else {
      myHiddenLabel.setText(IdeBundle.message("label.library.will.be.created.description.text", mySettings.getNewLibraryLevel(),
                                              "name", 10));
    }
    ((CardLayout)myConfigurationPanel.getLayout()).show(myConfigurationPanel, showConfigurePanel ? "configure" : "empty");
    myMessageLabel.setText(XmlStringUtil.wrapInHtml(message));
  }

  private String getDownloadFilesMessage() {
    final LibraryDownloadSettings downloadSettings = mySettings.getDownloadSettings();
    if (downloadSettings == null) return "";

    final String downloadPath = downloadSettings.getDirectoryForDownloadedLibrariesPath();
    final String basePath = mySettings.getBaseDirectoryPath();
    String path;
    if (!StringUtil.isEmpty(basePath) && FileUtil.startsWith(downloadPath, basePath)) {
      path = FileUtil.getRelativePath(basePath, downloadPath, '/');
    }
    else {
      path = PathUtil.getFileName(downloadPath);
    }
    return MessageFormat.format("{0} {0, choice, 1#JAR|2#JARs} will be downloaded into {1} directory
" +
                                   "{2} library {3} will be created",
                                   downloadSettings.getSelectedDownloads().size(),
                                   path,
                                   downloadSettings.getLibraryLevel(),
                                   downloadSettings.getLibraryName());
  }

  public LibraryCompositionSettings getSettings() {
    return mySettings;
  }

  @Nullable
  public LibraryCompositionSettings apply() {
    if (mySettings == null) return null;

    final Choice option = myButtonEnumModel.getSelected();
    mySettings.setDownloadLibraries(option == Choice.DOWNLOAD);

    final Object item = myExistingLibraryComboBox.getSelectedItem();
    if (option == Choice.USE_LIBRARY && item instanceof ExistingLibraryEditor) {
      mySettings.setSelectedExistingLibrary(((ExistingLibraryEditor)item).getLibrary());
    }
    else {
      mySettings.setSelectedExistingLibrary(null);
    }

    if (option == Choice.USE_LIBRARY && item instanceof NewLibraryEditor) {
      mySettings.setNewLibraryEditor((NewLibraryEditor)item);
    }
    else {
      mySettings.setNewLibraryEditor(null);
    }

    mySettings.setLibraryProvider(option == Choice.USE_FROM_PROVIDER ? myLibraryProvider : null);
    return mySettings;
  }

  public JComponent getMainPanel() {
    return myRootPanel;
  }

  @Override
  public void dispose() {
    myDisposed = true;
  }
}


text:
// Sphere geometry container.
// -----------------------------------------------------------------------------
// Copyright (C) 2012, See authors
//
// This program is open source and distributed under the New BSD License. See
// license for more detail.
// -----------------------------------------------------------------------------

#ifndef _GPU_DACRT_SPHERE_CONTAINER_H_
#define _GPU_DACRT_SPHERE_CONTAINER_H_

#include <Enums.h>
#include <Utils/Utils.h>

#include <thrust/device_vector.h>

class HyperCubes;
class SpheresGeometry;

class SphereContainer {
public:
    SpheresGeometry& spheres;

    thrust::device_vector<unsigned int> indices1;
    thrust::device_vector<unsigned int> indices2;

    thrust::device_vector<unsigned int>& currentIndices;
    thrust::device_vector<unsigned int>& nextIndices;

    thrust::device_vector<unsigned int> doneIndices;

public:
    SphereContainer(SpheresGeometry& spheres, thrust::device_vector<unsigned int>& indices);
    SphereContainer(HyperCubes& cubes, SpheresGeometry& spheres,
                    unsigned int* spherePartitionStart);

    inline SpheresGeometry& SphereGeometry() { return spheres; }

    inline UintIterator BeginCurrentIndices() { return currentIndices.begin(); }
    inline UintIterator EndCurrentIndices() { return currentIndices.end(); }
    inline size_t CurrentSize() const { return currentIndices.size(); }

    inline UintIterator BeginDoneIndices() { return doneIndices.begin(); }
    inline UintIterator EndDoneIndices() { return doneIndices.end(); }
    inline size_t DoneSize() const { return doneIndices.size(); }

    /**
     * Partitions the sphere and right by the indices given.
     */
    void Partition(thrust::device_vector<PartitionSide>& partitionSides,
                   thrust::device_vector<unsigned int>& leftIndices,
                   thrust::device_vector<unsigned int>& rightIndices);

    /**
     * Partitions the currently active spheres into leaf and non leaf nodes.
     */
    void PartitionLeafs(thrust::device_vector<bool>& isLeaf,
                        thrust::device_vector<unsigned int>& leafNodeIndices,
                        thrust::device_vector<uint2>& spherePartitions,
                        thrust::device_vector<unsigned int>& owners);

    std::string ToString() const;
};

#endif // _GPU_DACRT_SPHERE_CONTAINER_H_


text:
state: complete altinn
version: 1
---
Brukes i tilfeller der brukeren kan legge til noe, f.eks: en en person, virksomhet, etc.


text:
package org.ayo.fringe.ui;

import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

import com.facebook.drawee.view.SimpleDraweeView;

import org.ayo.animate.TweenAnimation;
import org.ayo.core.Async;
import org.ayo.fringe.utils.Initializer;
import org.ayo.fringe.R;
import org.ayo.notify.toaster.Toaster;
import org.ayo.fringe.utils.Permisstioner;
import org.ayo.fringe.App;
import org.ayo.fringe.initialize.StepOfAyoSdk;
import org.ayo.fringe.initialize.StepOfAyoView;
import org.ayo.fringe.initialize.StepOfCrash;
import org.ayo.fringe.initialize.StepOfHttp;
import org.ayo.fringe.initialize.StepOfImageLoader;
import org.ayo.fringe.ui.base.BaseFrgActivity;
import org.ayo.fringe.widget.BlackEmpireView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 闪屏页
 * @author Administrator
 *
 */
public class SplashActivity extends BaseFrgActivity {

	public static final int REQUEST_PERMISSION_STORAGE = 0x01;
	public static final int REQUEST_PERMISSION_CAMERA = 0x02;

	@BindView(R.id.iv_logo)
	SimpleDraweeView iv_logo;

	@Override
	protected int getLayoutId() {
		return R.layout.wb_ac_splash;
	}

	@Override
	protected void onCreate2(View contentView, @Nullable Bundle savedInstanceState) {
		UI.systembar(this, true);

		ButterKnife.bind(this);

		final BlackEmpireView bev = (BlackEmpireView) findViewById(R.id.bev);

		String uri = "http://7xicvb.com1.z0.glb.clouddn.com/girl_b_img-05ff9a30822bbd211590a8146903363f.jpg";
		//Flesco.setGalleryImageUri(iv_logo, uri, "file:///android_asset//splash_placeholder.jpg");
	}

	@Override
	protected void onDestroy2() {

	}

	@Override
	protected void onPageVisibleChanged(boolean visible, boolean isFirstTimeVisible, @Nullable Bundle savedInstanceState) {

	}

	private boolean isFirstCome = true;

	@Override
	protected void onStart() {
		super.onStart();
		if(isFirstCome && !App.isInitialed){
			initPermission();
			isFirstCome = false;
		}else{
			onLoadFinish();
		}
	}

	private void initPermission(){

		Permisstioner.newInstance()
				.with(this)
				.forPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
				.withSpeech("为了能正常运行,强烈建议您打开sd授权")
				.ask(new Permisstioner.Callback() {
					@Override
					public void onGranted(int i, String permission, boolean hasBeenGranted) {
						if(hasBeenGranted){
							initApp();
						}else{
							Permisstioner.openSettingActivity(getActivity(), "如果不授权,将无法继续运行");
						}
					}
				});

//		if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
//			if (checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) && checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION)) {
//				initApp();
//			} else {
//				ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_COARSE_LOCATION}, REQUEST_PERMISSION_STORAGE);
//			}
//		}else{
//			initApp();
//		}

	}

	@Override
	public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
		super.onRequestPermissionsResult(requestCode, permissions, grantResults);
		if (requestCode == REQUEST_PERMISSION_STORAGE) {
			if(grantResults != null && grantResults.length > 0){
				if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
					///权限给了
					initApp();
				} else {
					Toaster.toastShort("权限被禁止,无法继续");
				}
			}

		}
	}

	private void initApp(){

		Initializer.initailizer()
				.addStep(new StepOfCrash())
				.addStep(new StepOfAyoView())
				.addStep(new StepOfAyoSdk())
				.addStep(new StepOfHttp())
				.addStep(new StepOfImageLoader())
				.setStepListener(new Initializer.StepListner() {
					@Override
					public boolean onSuffering(Initializer.Step step, boolean isSuccess, int currentStep, int total) {

						//统一判断
						if (!isSuccess && !step.acceptFail()) {
							//退出,提示错误
							Toaster.toastShort(step.getNotify());
							//finish();
							return false;
						}

						//单步逻辑
						if (step.getName().equals("UI Framework")) {
							//UI库加载完,才可以使用AyoViewLib
//							GifDrawable gif = null;
//							try {
//								gif = new GifDrawable(getResources(), R.drawable.gif_loading_fire);
//								iv_logo.setImageDrawable(gif);
//								gif.start();
//							} catch (IOException e) {
//								e.printStackTrace();
//							}
						}

						if(currentStep == total){
							App.isInitialed = true;
							onLoadFinish();
						}

						return true;
					}
				})
				.suffer();
	}

	private void onLoadFinish(){
		Async.post(new Runnable() {
			@Override
			public void run() {
//				GuideActivity.start(getAgent().getActivity());

				MainActivity.start(getActivity());
				TweenAnimation.apply(getActivity(), TweenAnimation.fade_in, TweenAnimation.fade_out);

				finish();
				TweenAnimation.apply(getAgent().getActivity(), TweenAnimation.fade_in, TweenAnimation.scale_out);

				//AyoWebViewFragment.start(getActivity(), "http://720yun.com/t/59e29qOgulg?pano_id=893339");
			}
		}, 3000);
	}
}


text:
/**
 * Built-in Log Configuration
 * (sails.config.log)
 *
 * Configure the log level for your app, as well as the transport
 * (Underneath the covers, Sails uses Winston for logging, which
 * allows for some pretty neat custom transports/adapters for log messages)
 *
 * For more information on the Sails logger, check out:
 * http://sailsjs.org/#!/documentation/concepts/Logging
 */

// FIE: as sails doesn't support the log file, we use winston logger. (cf: http://sailsjs.com/documentation/reference/configuration/sails-config-log)
// doc for winston transport: https://github.com/winstonjs/winston/blob/master/docs/transports.md
const winston = require('winston');
const fs = require('fs');
const FIELogger = new winston.Logger();
const LOGDIR = 'logs';
const LOGNAME = 'app.log';

//create log directory if not exist
if(!fs.existsSync(LOGDIR)) {
    fs.mkdirSync(LOGDIR);
}

// log to file
FIELogger.add(winston.transports.File, {
    filename: LOGDIR + '/' + LOGNAME, // FIE/logs/app.log
    json: false,
    exitOnError: false,
    colorize: false,
    timestamp: true,
    maximize: 1000,
    maxFile: 1,
    level: 'info'
});

// log to console
FIELogger.add(winston.transports.Console, {
    level: 'info',
    exitOnError: false,
    timestamp: false,
    colorize: true
});

module.exports.log = {

  /***************************************************************************
  *                                                                          *
  * Valid `level` configs: i.e. the minimum log level to capture with        *
  * sails.log.*()                                                            *
  *                                                                          *
  * The order of precedence for log levels from lowest to highest is:        *
  * silly, verbose, info, debug, warn, error                                 *
  *                                                                          *
  * You may also set the level to "silent" to suppress all logs.             *
  *                                                                          *
  ***************************************************************************/

    custom: FIELogger,  // pass our custom logger
    level: 'silly',
    inspect: false      // captain's log so it doesn't prefix or stringify our meta data
};


text:
package com.atreceno.it.javanese.attic;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * Converter from decimal to Roman numeral.
 *
 * @author atreceno
 *
 */
public class RomanConverter {

	/**
	 * Declare and then initialize a map.
	 */
	private static final Map<String, Integer> ROMAN_DEC = new LinkedHashMap<String, Integer>();
	static {
		ROMAN_DEC.put("M", 1000);
		ROMAN_DEC.put("CM", 900);
		ROMAN_DEC.put("D", 500);
		ROMAN_DEC.put("CD", 400);
		ROMAN_DEC.put("C", 100);
		ROMAN_DEC.put("XC", 90);
		ROMAN_DEC.put("L", 50);
		ROMAN_DEC.put("XL", 40);
		ROMAN_DEC.put("X", 10);
		ROMAN_DEC.put("IX", 9);
		ROMAN_DEC.put("V", 5);
		ROMAN_DEC.put("IV", 4);
		ROMAN_DEC.put("I", 1);
	}

	/**
	 * A different way of initializing a map.
	 */
	private final static TreeMap<Integer, String> DEC_ROMAN = new TreeMap<Integer, String>() {
		private static final long serialVersionUID = 1L;
		{
			put(1000, "M");
			put(900, "CM");
			put(500, "D");
			put(400, "CD");
			put(100, "C");
			put(90, "XC");
			put(50, "L");
			put(40, "XL");
			put(10, "X");
			put(9, "IX");
			put(5, "V");
			put(4, "IV");
			put(1, "I");
		}
	};

	/**
	 * Iterating the map with for-each loop.
	 *
	 * @param num
	 *            number to convert.
	 * @return the number converted to Roman numeral.
	 */
	public String solution(int num) {
		StringBuffer result = new StringBuffer();
		for (Map.Entry<String, Integer> e : ROMAN_DEC.entrySet()) {
			while (num / e.getValue() > 0) {
				result.append(e.getKey());
				num -= e.getValue();
			}
		}
		return result.toString();
	}

	/**
	 * Iterating over a collection of Map.Entry<K,V> (using iterator).
	 *
	 * @param num
	 *            number to convert.
	 * @return the number converted to Roman numeral.
	 */
	public String solution2(int num) {
		StringBuffer result = new StringBuffer();
		for (Iterator<Map.Entry<String, Integer>> entries = ROMAN_DEC
				.entrySet().iterator(); entries.hasNext();) {
			Map.Entry<String, Integer> e = entries.next();
			while (num / e.getValue() > 0) {
				result.append(e.getKey());
				num -= e.getValue();
			}
		}
		return result.toString();
	}

	/**
	 * Iterating over a collection of K (using iterator).
	 *
	 * @param num
	 *            number to convert.
	 * @return the number converted to Roman numeral.
	 */
	public String solution3(int num) {
		StringBuffer result = new StringBuffer();
		for (Iterator<String> keys = ROMAN_DEC.keySet().iterator(); keys
				.hasNext();) {
			String key = keys.next();
			Integer value = ROMAN_DEC.get(key);
			while (num / value > 0) {
				result.append(key);
				num -= value;
			}
		}
		return result.toString();
	}

	/**
	 * Using recursive solution.
	 *
	 * @param num
	 *            number to convert.
	 * @return the number converted to Roman numeral.
	 */
	public String solution4(int num) {
		Integer k = DEC_ROMAN.floorKey(num);
		return k == num ? DEC_ROMAN.get(k) : DEC_ROMAN.get(k)
				+ solution4(num - k);
	}

}


text:
cd examples/ssd

$PYTHON demo.py --model ssd300 $SAMPLE_IMAGE
$PYTHON demo.py --model ssd300 --gpu 0 $SAMPLE_IMAGE
$PYTHON demo.py --model ssd512 $SAMPLE_IMAGE
$PYTHON demo.py --model ssd512 --gpu 0 $SAMPLE_IMAGE


text:
package org.sagebionetworks.repo.web.controller;

import static org.sagebionetworks.repo.model.oauth.OAuthScope.modify;
import static org.sagebionetworks.repo.model.oauth.OAuthScope.view;
import static org.sagebionetworks.repo.web.UrlHelpers.ID_PATH_VARIABLE;

import org.sagebionetworks.reflection.model.PaginatedResults;
import org.sagebionetworks.repo.model.AuthorizationConstants;
import org.sagebionetworks.repo.model.ServiceConstants;
import org.sagebionetworks.repo.model.quiz.PassingRecord;
import org.sagebionetworks.repo.model.quiz.Quiz;
import org.sagebionetworks.repo.model.quiz.QuizResponse;
import org.sagebionetworks.repo.web.NotFoundException;
import org.sagebionetworks.repo.web.RequiredScope;
import org.sagebionetworks.repo.web.UrlHelpers;
import org.sagebionetworks.repo.web.rest.doc.ControllerInfo;
import org.sagebionetworks.repo.web.service.ServiceProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * To become a Synapse Certified User you must pass a test.  The Synapse APIs include
 * a service to provide the test and a service to submit a test result.  There are also
 * administrative services to retrieve the history of test submissions.
 *
 */
@ControllerInfo(displayName="Certified User Services", path="repo/v1")
@Controller
@RequestMapping(UrlHelpers.REPO_PATH)
public class CertifiedUserController {
	@Autowired
	ServiceProvider serviceProvider;

	/**
	 * Get the test to become a Certified User.
	 * @param userId
	 * @return
	 */
	@RequiredScope({view})
	@ResponseStatus(HttpStatus.OK)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_TEST, method = RequestMethod.GET)
	public @ResponseBody
	Quiz getCertificationQuiz(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId) {
		return serviceProvider.getCertifiedUserService().getCertificationQuiz(userId);
	}

	/**
	 * Submit a response to the Certified User test.
	 *
	 * @param userId
	 * @param response
	 * @return
	 * @throws NotFoundException
	 */
	@RequiredScope({view,modify})
	@ResponseStatus(HttpStatus.CREATED)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_TEST_RESPONSE, method = RequestMethod.POST)
	public @ResponseBody
	PassingRecord submitCertificationQuizResponse(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@RequestBody QuizResponse response
			) throws NotFoundException {
		return serviceProvider.getCertifiedUserService().
				submitCertificationQuizResponse(userId, response);
	}

	@RequiredScope({view})
	@Deprecated
	@ResponseStatus(HttpStatus.GONE)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_TEST_RESPONSE, method = RequestMethod.GET)
	public @ResponseBody String getQuizResponses() throws NotFoundException {
		return "This endpoint has been removed. The service has been moved to " + UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_TEST_RESPONSE + " and is only accessible to Synapse administrators";
	}

	/**
	 * Get the Certified User test responses in the system, optionally filtered by the one who took the test.
	 * Note:  This service is available to Synapse administrators only.
	 * @param userId
	 * @param principalId If specified, only retrieve the quiz for this user, if it exists.
	 * @param limit Limits the size of the page returned. For example, a page size of 10 requires limit = 10.
	 * @param offset The index of the pagination offset. For a page size of 10, the first page would be at offset = 0, and the second page would be at offset = 10.
	 * @return
	 * @throws NotFoundException
	 */
	@RequiredScope({view})
	@ResponseStatus(HttpStatus.OK)
	@RequestMapping(value = UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_TEST_RESPONSE, method = RequestMethod.GET)
	public @ResponseBody
	PaginatedResults<QuizResponse> getQuizResponses(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@RequestParam(value = ServiceConstants.PRINCIPAL_ID, required = false) Long principalId,
			@RequestParam(value = ServiceConstants.PAGINATION_LIMIT_PARAM, required = false, defaultValue = ServiceConstants.DEFAULT_PAGINATION_LIMIT_PARAM) Integer limit,
			@RequestParam(value = ServiceConstants.PAGINATION_OFFSET_PARAM, required = false, defaultValue = ServiceConstants.DEFAULT_PAGINATION_OFFSET_PARAM) Integer offset
			) throws NotFoundException {
		return serviceProvider.getCertifiedUserService().getQuizResponses(userId, principalId, limit, offset);
	}

	@Deprecated
	@RequiredScope({modify})
	@ResponseStatus(HttpStatus.GONE)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_TEST_RESPONSE_WITH_ID, method = RequestMethod.DELETE)
	public @ResponseBody String deleteQuizResponse() throws NotFoundException {
		return "This endpoint has been removed. The service has been moved to " + UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_TEST_RESPONSE_WITH_ID + " and is only accessible to Synapse administrators";
	}

	/**
	 * Delete a test response.  Note:  This service is available to Synapse administrators only.
	 * @param userId
	 * @param responseId
	 * @throws NotFoundException
	 */
	@RequiredScope({modify})
	@ResponseStatus(HttpStatus.OK)
	@RequestMapping(value = UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_TEST_RESPONSE_WITH_ID, method = RequestMethod.DELETE)
	public void deleteQuizResponse(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@PathVariable(value = ID_PATH_VARIABLE) Long responseId
			) throws NotFoundException {
		serviceProvider.getCertifiedUserService().deleteQuizResponse(userId, responseId);
	}

	/**
	 * Retrieve the Passing Record on the User Certification test for the given user.
	 * @param userId
	 * @param id
	 * @return
	 * @throws NotFoundException
	 */
	@RequiredScope({view})
	@ResponseStatus(HttpStatus.OK)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_PASSING_RECORD_WITH_ID, method = RequestMethod.GET)
	public  @ResponseBody PassingRecord getPassingRecord(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@PathVariable(value = ID_PATH_VARIABLE) Long id
			) throws NotFoundException {
		return serviceProvider.getCertifiedUserService().getPassingRecord(userId, id);
	}

	@RequiredScope({view})
	@Deprecated
	@ResponseStatus(HttpStatus.GONE)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_PASSING_RECORDS_WITH_ID, method = RequestMethod.GET)
	public @ResponseBody String getPassingRecords() throws NotFoundException {
		return "This endpoint has been removed. The service has been moved to " + UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_PASSING_RECORDS_WITH_ID + " and is only accessible to Synapse administrators";
	}

	/**
	 * Retrieve all the Passing Record on the User Certification test for the given user.
	 * Note:  This service is available to Synapse administrators only.
	 */
	@RequiredScope({view})
	@ResponseStatus(HttpStatus.OK)
	@RequestMapping(value = UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_PASSING_RECORDS_WITH_ID, method = RequestMethod.GET)
	public  @ResponseBody PaginatedResults<PassingRecord> getPassingRecords(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@PathVariable(value = ID_PATH_VARIABLE) Long id,
			@RequestParam(value = ServiceConstants.PAGINATION_LIMIT_PARAM, required = false, defaultValue = ServiceConstants.DEFAULT_PAGINATION_LIMIT_PARAM) Integer limit,
			@RequestParam(value = ServiceConstants.PAGINATION_OFFSET_PARAM, required = false, defaultValue = ServiceConstants.DEFAULT_PAGINATION_OFFSET_PARAM) Integer offset
			) throws NotFoundException {
		return serviceProvider.getCertifiedUserService().getPassingRecords(userId, id, limit, offset);
	}

	@RequiredScope({view,modify})
	@ResponseStatus(HttpStatus.GONE)
	@RequestMapping(value = UrlHelpers.CERTIFIED_USER_STATUS, method = RequestMethod.PUT)
	public @ResponseBody String setUserCertificationStatus()  {
		return "This endpoint has been removed. The service has been moved to " + UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_STATUS + " and is only accessible to Synapse administrators";
	}

	@RequiredScope({modify})
	@ResponseStatus(HttpStatus.NO_CONTENT)
	@RequestMapping(value = UrlHelpers.ADMIN + UrlHelpers.CERTIFIED_USER_STATUS, method = RequestMethod.PUT)
	public void setUserCertificationStatus(
			@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
			@PathVariable(value = ID_PATH_VARIABLE) Long principalId,
			@RequestParam(value = AuthorizationConstants.IS_CERTIFIED) Boolean isCertified
	) throws NotFoundException {
		serviceProvider.getCertifiedUserService().setUserCertificationStatus(userId, principalId, isCertified);
	}

}


text:
<?php namespace Frostbite\Validators;

class PostValidator extends AbstractValidator {

    /**
     * @var array
     */
    protected $rules = [
        'id'           => 'integer',
        'title'        => 'required|string',
        'contents'     => 'required|string',
        'is_important' => 'required|boolean',
        'category_id'  => 'required|integer',
    ];
}


text:
<?php

namespace Eloquent\Typhoon\ClassMapper\Exception;

use Eloquent\Cosmos\ClassName;
use Eloquent\Typhoon\TestCase\MultiGenerationTestCase;
use Phake;

class UndefinedPropertyExceptionTest extends MultiGenerationTestCase
{
    public function testException()
    {
        $className = ClassName::fromString('foo');
        $previous = Phake::mock('Exception');
        $exception = new UndefinedPropertyException(
            $className,
            'bar',
            $previous
        );

        $this->assertSame("Undefined property 'foo::\$bar'.", $exception->getMessage());
        $this->assertSame($className, $exception->className());
        $this->assertSame('bar', $exception->propertyName());
        $this->assertSame(0, $exception->getCode());
        $this->assertSame($previous, $exception->getPrevious());
    }
}


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

<TITLE>
UCMPlayer
</TITLE>

<META NAME="date" CONTENT="2013-11-05">

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

      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

teams.ucmTeam

Class UCMPlayer

java.lang.Object
  EDU.gatech.cc.is.abstractrobot.ControlSystemS
      EDU.gatech.cc.is.abstractrobot.ControlSystemSS
          teams.ucmTeam.UCMPlayer

public abstract class UCMPlayer
extends EDU.gatech.cc.is.abstractrobot.ControlSystemSS

UCMPlayer is a Control System that represents a robot based on predefined behaviours.
 All team players share a team manager.

UCMPlayer is an abstract class. To use it you must extend this class and implement the getTeamManager method.

See Also:
Behaviour,
TeamManager

Field Summary

protected  java.util.Queue<Message>
pendingMessages

Fields inherited from class EDU.gatech.cc.is.abstractrobot.ControlSystemSS

abstract_robot

Fields inherited from class EDU.gatech.cc.is.abstractrobot.ControlSystemS

CSSTAT_DONE, CSSTAT_ERROR, CSSTAT_OK, seed

Constructor Summary

UCMPlayer()

          Default constructor

Method Summary

 void
Configure()

          Configures the team and the robot.

 Behaviour
getBehaviour()

          Gets a reference to the behaviour that controls this robot

 java.util.Queue<Message>
getPendingMessages()

          Gets the queue of pending messages for this robot

 RobotAPI
getRobotAPI()

          Gets a reference to the robotAPI employed to execute actions on this robot

protected abstract  TeamManager
getTeamManager()

          Obtains a reference to the TeamManager.

 void
quit()

 void
setBehaviour(Behaviour b)

          Changes the behaviour on this robot

 int
TakeStep()

          TakeStep delegates in the behaviour of the corresponding robot

Methods inherited from class EDU.gatech.cc.is.abstractrobot.ControlSystemSS

init, loadResourceFile, showAdditionalRuntimeStats, showRuntimeStats

Methods inherited from class EDU.gatech.cc.is.abstractrobot.ControlSystemS

configure, getAbstractRobot, Init, takeStep, trialEnd, TrialEnd, trialInit, TrialInit

Methods inherited from class java.lang.Object

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

Field Detail

pendingMessages

protected java.util.Queue<Message> pendingMessages

Constructor Detail

UCMPlayer

public UCMPlayer()

Default constructor

Method Detail

Configure

public final void Configure()

Configures the team and the robot. The first time it is invoked it creates and configure the team manager.
 The team manager is obtained with the getTeamManager(). Then it configures each robot using the default
 behaviours provided by the team manager.

Overrides:
Configure in class EDU.gatech.cc.is.abstractrobot.ControlSystemS

getTeamManager

protected abstract TeamManager getTeamManager()

Obtains a reference to the TeamManager. This method must be implemented by subclasses

Returns:
the team manager that will control the team.

TakeStep

public final int TakeStep()

TakeStep delegates in the behaviour of the corresponding robot

Overrides:
TakeStep in class EDU.gatech.cc.is.abstractrobot.ControlSystemS

Returns:
WorldAPI.ROBOT_OK or WorldAPI.ROBOT_ERROR (when the role is not correctly defined)

quit

public final void quit()

Overrides:
quit in class EDU.gatech.cc.is.abstractrobot.ControlSystemS

setBehaviour

public final void setBehaviour(Behaviour b)

Changes the behaviour on this robot

Parameters:
b - the new behaviour

getBehaviour

public final Behaviour getBehaviour()

Gets a reference to the behaviour that controls this robot

Returns:
the behaviour that controls this robot

getRobotAPI

public final RobotAPI getRobotAPI()

Gets a reference to the robotAPI employed to execute actions on this robot

Returns:
the robotAPI

getPendingMessages

public final java.util.Queue<Message> getPendingMessages()

Gets the queue of pending messages for this robot

Returns:
the pending messages

      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
package org.springframework.jdbc.core.simple;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.sql.DataSource;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.springframework.jdbc.core.SqlParameterValue;
import org.springframework.jdbc.core.metadata.TableMetaDataContext;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

/**
 * Mock object based tests for TableMetaDataContext.
 *
 * @author Thomas Risberg
 */
public class TableMetaDataContextTests  {

	private Connection connection;

	private DataSource dataSource;

	private DatabaseMetaData databaseMetaData;

	private TableMetaDataContext context = new TableMetaDataContext();

	@BeforeEach
	public void setUp() throws Exception {
		connection = mock(Connection.class);
		dataSource = mock(DataSource.class);
		databaseMetaData = mock(DatabaseMetaData.class);
		given(connection.getMetaData()).willReturn(databaseMetaData);
		given(dataSource.getConnection()).willReturn(connection);
	}

	@Test
	public void testMatchInParametersAndSqlTypeInfoWrapping() throws Exception {
		final String TABLE = "customers";
		final String USER = "me";

		ResultSet metaDataResultSet = mock(ResultSet.class);
		given(metaDataResultSet.next()).willReturn(true, false);
		given(metaDataResultSet.getString("TABLE_SCHEM")).willReturn(USER);
		given(metaDataResultSet.getString("TABLE_NAME")).willReturn(TABLE);
		given(metaDataResultSet.getString("TABLE_TYPE")).willReturn("TABLE");

		ResultSet columnsResultSet = mock(ResultSet.class);
		given(columnsResultSet.next()).willReturn(
				true, true, true, true, false);
		given(columnsResultSet.getString("COLUMN_NAME")).willReturn(
				"id", "name", "customersince", "version");
		given(columnsResultSet.getInt("DATA_TYPE")).willReturn(
				Types.INTEGER, Types.VARCHAR, Types.DATE, Types.NUMERIC);
		given(columnsResultSet.getBoolean("NULLABLE")).willReturn(
				false, true, true, false);

		given(databaseMetaData.getDatabaseProductName()).willReturn("MyDB");
		given(databaseMetaData.getDatabaseProductName()).willReturn("1.0");
		given(databaseMetaData.getUserName()).willReturn(USER);
		given(databaseMetaData.storesLowerCaseIdentifiers()).willReturn(true);
		given(databaseMetaData.getTables(null, null, TABLE, null)).willReturn(metaDataResultSet);
		given(databaseMetaData.getColumns(null, USER, TABLE, null)).willReturn(columnsResultSet);

		MapSqlParameterSource map = new MapSqlParameterSource();
		map.addValue("id", 1);
		map.addValue("name", "Sven");
		map.addValue("customersince", new Date());
		map.addValue("version", 0);
		map.registerSqlType("customersince", Types.DATE);
		map.registerSqlType("version", Types.NUMERIC);

		context.setTableName(TABLE);
		context.processMetaData(dataSource, new ArrayList<>(), new String[] {});

		List<Object> values = context.matchInParameterValuesWithInsertColumns(map);

		assertThat(values.size()).as("wrong number of parameters: ").isEqualTo(4);
		boolean condition3 = values.get(0) instanceof Number;
		assertThat(condition3).as("id not wrapped with type info").isTrue();
		boolean condition2 = values.get(1) instanceof String;
		assertThat(condition2).as("name not wrapped with type info").isTrue();
		boolean condition1 = values.get(2) instanceof SqlParameterValue;
		assertThat(condition1).as("date wrapped with type info").isTrue();
		boolean condition = values.get(3) instanceof SqlParameterValue;
		assertThat(condition).as("version wrapped with type info").isTrue();
		verify(metaDataResultSet, atLeastOnce()).next();
		verify(columnsResultSet, atLeastOnce()).next();
		verify(metaDataResultSet).close();
		verify(columnsResultSet).close();
	}

	@Test
	public void testTableWithSingleColumnGeneratedKey() throws Exception {
		final String TABLE = "customers";
		final String USER = "me";

		ResultSet metaDataResultSet = mock(ResultSet.class);
		given(metaDataResultSet.next()).willReturn(true, false);
		given(metaDataResultSet.getString("TABLE_SCHEM")).willReturn(USER);
		given(metaDataResultSet.getString("TABLE_NAME")).willReturn(TABLE);
		given(metaDataResultSet.getString("TABLE_TYPE")).willReturn("TABLE");

		ResultSet columnsResultSet = mock(ResultSet.class);
		given(columnsResultSet.next()).willReturn(true, false);
		given(columnsResultSet.getString("COLUMN_NAME")).willReturn("id");
		given(columnsResultSet.getInt("DATA_TYPE")).willReturn(Types.INTEGER);
		given(columnsResultSet.getBoolean("NULLABLE")).willReturn(false);

		given(databaseMetaData.getDatabaseProductName()).willReturn("MyDB");
		given(databaseMetaData.getDatabaseProductName()).willReturn("1.0");
		given(databaseMetaData.getUserName()).willReturn(USER);
		given(databaseMetaData.storesLowerCaseIdentifiers()).willReturn(true);
		given(databaseMetaData.getTables(null, null, TABLE, null)).willReturn(metaDataResultSet);
		given(databaseMetaData.getColumns(null, USER, TABLE, null)).willReturn(columnsResultSet);

		MapSqlParameterSource map = new MapSqlParameterSource();
		String[] keyCols = new String[] { "id" };
		context.setTableName(TABLE);
		context.processMetaData(dataSource, new ArrayList<>(), keyCols);
		List<Object> values = context.matchInParameterValuesWithInsertColumns(map);
		String insertString = context.createInsertString(keyCols);

		assertThat(values.size()).as("wrong number of parameters: ").isEqualTo(0);
		assertThat(insertString).as("empty insert not generated correctly").isEqualTo("INSERT INTO customers () VALUES()");
		verify(metaDataResultSet, atLeastOnce()).next();
		verify(columnsResultSet, atLeastOnce()).next();
		verify(metaDataResultSet).close();
		verify(columnsResultSet).close();
	}

}


text:
import h from 'virtual-dom/h';

import { secondsToPixels } from './utils/conversions';
import TimeScaleHook from './render/TimeScaleHook';

class TimeScale {
  constructor(duration, offset, samplesPerPixel, sampleRate, marginLeft = 0) {
    this.duration = duration;
    this.offset = offset;
    this.samplesPerPixel = samplesPerPixel;
    this.sampleRate = sampleRate;
    this.marginLeft = marginLeft;

    this.timeinfo = {
      20000: {
        marker: 30000,
        bigStep: 10000,
        smallStep: 5000,
        secondStep: 5,
      },
      12000: {
        marker: 15000,
        bigStep: 5000,
        smallStep: 1000,
        secondStep: 1,
      },
      10000: {
        marker: 10000,
        bigStep: 5000,
        smallStep: 1000,
        secondStep: 1,
      },
      5000: {
        marker: 5000,
        bigStep: 1000,
        smallStep: 500,
        secondStep: 1 / 2,
      },
      2500: {
        marker: 2000,
        bigStep: 1000,
        smallStep: 500,
        secondStep: 1 / 2,
      },
      1500: {
        marker: 2000,
        bigStep: 1000,
        smallStep: 200,
        secondStep: 1 / 5,
      },
      700: {
        marker: 1000,
        bigStep: 500,
        smallStep: 100,
        secondStep: 1 / 10,
      },
    };
  }

  getScaleInfo(resolution) {
    let keys = Object.keys(this.timeinfo).map(item => parseInt(item, 10));

    // make sure keys are numerically sorted.
    keys = keys.sort((a, b) => a - b);

    for (let i = 0; i < keys.length; i += 1) {
      if (resolution <= keys[i]) {
        return this.timeinfo[keys[i]];
      }
    }

    return this.timeinfo[keys[0]];
  }

  /*
    Return time in format mm:ss
  */
  static formatTime(milliseconds) {
    const seconds = milliseconds / 1000;
    let s = seconds % 60;
    const m = (seconds - s) / 60;

    if (s < 10) {
      s = `0${s}`;
    }

    return `${m}:${s}`;
  }

  render() {
    const widthX = secondsToPixels(this.duration, this.samplesPerPixel, this.sampleRate);
    const pixPerSec = this.sampleRate / this.samplesPerPixel;
    const pixOffset = secondsToPixels(this.offset, this.samplesPerPixel, this.sampleRate);
    const scaleInfo = this.getScaleInfo(this.samplesPerPixel);
    const canvasInfo = {};
    const timeMarkers = [];
    const end = widthX + pixOffset;
    let counter = 0;

    for (let i = 0; i < end; i += (pixPerSec * scaleInfo.secondStep)) {
      const pixIndex = Math.floor(i);
      const pix = pixIndex - pixOffset;

      if (pixIndex >= pixOffset) {
        // put a timestamp every 30 seconds.
        if (scaleInfo.marker && (counter % scaleInfo.marker === 0)) {
          timeMarkers.push(h('div.time',
            {
              attributes: {
                style: `position: absolute; left: ${pix}px;`,
              },
            },
            [TimeScale.formatTime(counter)],
          ));

          canvasInfo[pix] = 10;
        } else if (scaleInfo.bigStep && (counter % scaleInfo.bigStep === 0)) {
          canvasInfo[pix] = 5;
        } else if (scaleInfo.smallStep && (counter % scaleInfo.smallStep === 0)) {
          canvasInfo[pix] = 2;
        }
      }

      counter += (1000 * scaleInfo.secondStep);
    }

    return h('div.playlist-time-scale',
      {
        attributes: {
          style: `position: relative; left: 0; right: 0; margin-left: ${this.marginLeft}px;`,
        },
      },
      [
        timeMarkers,
        h('canvas',
          {
            attributes: {
              width: widthX,
              height: 30,
              style: 'position: absolute; left: 0; right: 0; top: 0; bottom: 0;',
            },
            hook: new TimeScaleHook(canvasInfo, this.offset, this.samplesPerPixel, this.duration),
          },
        ),
      ],
    );
  }
}

export default TimeScale;