text:
using System;
using System.Threading.Tasks;
using JustSaying.Messaging.MessageHandling;
using JustSaying.TestingFramework;
using NSubstitute;
using NUnit.Framework;

namespace JustSaying.Messaging.UnitTests.MessageHandling
{
    public class WhenEnsuringMessageIsOnlyHandledExactlyOnce
    {
        [Test]
        public async Task WhenMessageIsLockedByAnotherHandler_MessageWillBeLeftInTheQueue()
        {
            var messageLock = Substitute.For<IMessageLock>();
            messageLock.TryAquireLock(Arg.Any<string>(), Arg.Any<TimeSpan>()).Returns(new MessageLockResponse {DoIHaveExclusiveLock = false});
            var sut = new ExactlyOnceHandler<OrderAccepted>(Substitute.For<IHandlerAsync<OrderAccepted>>(), messageLock, 1, "handlerName");

            var result = await sut.Handle(new OrderAccepted());

            Assert.IsFalse(result);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * \file
 *
 * @author Rafael B. Januzi (rjanuzi@gmail.com)
 * @date 09/11/2016
 *
 */

#ifndef UTIL_IMGS_H_
#define UTIL_IMGS_H_

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>

#define UTIL_IMGS_MEMO_BLOCK_SIZE	65536 /* Bytes */

#define UTIL_IMGS_IMG_MOCKED_1_PATH	"imgs/1.jpg"
#define UTIL_IMGS_IMG_MOCKED_2_PATH	"imgs/2.jpg"
#define UTIL_IMGS_IMG_MOCKED_3_PATH	"imgs/3.jpg"
#define UTIL_IMGS_IMG_MOCKED_4_PATH	"imgs/4.jpg"
#define UTIL_IMGS_IMG_MOCKED_5_PATH	"imgs/5.jpg"
#define UTIL_IMGS_IMG_MOCKED_6_PATH	"imgs/droneMockedImg.jpg"

/**
 * @date 09/11/2016
 * @autho Rafael B. Januzi (rjanuzi@gmail.com)
 *
 * Recupera os bytes (em hexadecimais) de uma imagem salva em arquivo para um array.
 *
 * @param imgFilePath: String contendo o caminho ateh o arquivo de imagem.
 * @param [out] strOut: String de hexadecimais recuperados do arquivo (AABBCC, onde AA & BB & CC sao caracteres em hex)
 *
 * @return true caso a recuperacao tenha ocorrido com sucesso e false caso contrario.
 */
bool utilImgs_getHexString(const char* imgFilePath, char* strOut);

/**
 * @date 014/11/2016
 * @autho Rafael B. Januzi (rjanuzi@gmail.com)
 *
 * Recupera os bytes de uma imagem salva em arquivo para um array.
 *
 * @param imgFilePath: String contendo o caminho ateh o arquivo de imagem.
 * @param [out] outArray: Array de bytes com os valores obtidos do arquivo de imagem.
 *
 * @return Numero de bytes recuperados do arquivo.
 */
uint32_t utilImgs_getImgBin(const char* imgFilePath, uint8_t* outArray);

/**
 * @date 14/11/2016
 * @autho Rafael B. Januzi (rjanuzi@gmail.com)
 *
 * Salva um arquivo binario utilizando uma String de hexadecimais como entrada.
 *
 * @param hexString: String de hexadecimais para para criacao do arquivo em binario.
 * @param filePath: String com o caminho ateh o arquivo a ser criado.
 *
 * @return true caso o salvamento tenha acontecido corretamente e false caso contrario.
 */
bool utilImgs_hexToFile(const char* hexString, char* filePath);

/**
 * @date 14/11/2016
 * @autho Rafael B. Januzi (rjanuzi@gmail.com)
 *
 * Converte uma String em hexadecimal (1 Byte) para o seu valor real.
 *
 * @param hexByteString: String hexadecimal contendo 1 Byte.
 *
 * @return Valor do byte em hexadecimal passado por parametro.
 */
uint8_t utilImgs_hexToByte(const char* hexByteString);

/**
 * @date 14/11/2016
 * @autho Rafael B. Januzi (rjanuzi@gmail.com)
 *
 * Converte um caracter hexadecimal (4 bits) para seu valor real.
 *
 * @param hexChar: Caracter representando 4 bits em hexadecimal.
 *
 * @return Valor dos 4 bits convertidos de um caracter hexadecimal.
 */
uint8_t utilImg_getHexCharVal(char hexChar);

#endif /* UTIL_IMGS_H_ */


text:
A C++ parser/lexer for instances of TSPLIB and GTSPLIB.

## Description
The [Traveling Salesman Problem library (TSPLIB)](http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/) is a collection of example problem data for the [Traveling Salesman Problem](http://en.wikipedia.org/wiki/Travelling_salesman_problem), for which a particular file format has been devised. The [Generalized Traveling Salesman Problem library (GTSPLIB)](http://www.cs.nott.ac.uk/~dxk/gtsp.html) adds a few pieces of information to that.

Many file reader variants can be found, each implementing a subset of the file specification. This repository is aimed to combine effort and eventually create a parser that can read all kinds of TSPLIB and GTSPLIB instances.

Bison/Flex parser for TSPLIB and GTSPLIB instances

## Issues

Please report any issues or feature requests on GitHub. If you have a contribution, you are welcome to send a Pull Request!

## Development

If you want to develop this parser, simply clone this Git and install Bison and Flex. For Windows users, see [WinFlexBison](http://sourceforge.net/projects/winflexbison/).

Run `git submodule update --recursive` to download the dependencies to other Git modules.

The project compiles with MinGW 4.9.1 and the Qt Make system under Windows. It uses [Google Test](https://github.com/google/googletest/tree/master/googletest) for some integration and unit-testing facilities.

Before compiling, you will need to point to the `flex++` and `bison++` executables, so that qmake can generate the lexer and parser components. This is typically done through the environment variables of your shell, or the build system (e.g. Qt Creator).
To use the Qt makefiles, run `qmake` followed by `make` in the root directory. Under Windows, you can use the [winflexbison](https://sourceforge.net/projects/winflexbison/) binaries.


text:
export const ADD_TODO = 'ADD_TODO';
export const TOGGLE_TODO = 'TOGGLE_TODO';
export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER';
export const REQUEST_TODOS = 'REQUEST_TODOS';
export const RECEIVE_TODOS = 'RECEIVE_TODOS';
export const FETCHING = 'FETCHING';
export const FETCH_SUCCESSFUL = 'FETCH_SUCCESSFUL';
export const FETCH_FAILED = 'FETCH_FAILED';


text:
<?php

namespace Test\Skybot\Plugin;

use Skybot\Driver\Dummy;
use Skybot\Config;
use Skybot\User;
use Monolog\Logger;
use Monolog\Handler\NullHandler;

class PingTest extends \PHPUnit_Framework_TestCase
{
	private $skybot;

	protected function setUp()
	{
		$log = new Logger('test');
		$log->pushHandler(new NullHandler());

		$this->skybot = new \Skybot\Main(new Dummy($log), new Config(), $log);
	}

	public function testPing()
	{
		$plugin = new \Skybot\Plugin\Ping($this->skybot);

		$message = new \Skybot\Message\Chat();

		$message->setBody("ping");
		$message->setUser(new User("myskypename", $this->skybot));

		$response = $plugin->run($message);

		$this->assertEquals($response, "Hi, myskypename. Pong!");
		$this->assertFalse($message->isDM());
	}

	public function testPingDM()
	{
		$plugin = new \Skybot\Plugin\Ping($this->skybot);

		$message = new \Skybot\Message\Chat();

		$message->setBody("ping me");
		$message->setUser(new User("myskypename", $this->skybot));

		$response = $plugin->run($message);

		$this->assertEquals($response, "Hi, myskypename. Pong!");
		$this->assertTrue($message->isDM());
	}

	public function testFailedPing()
	{
		$plugin = new \Skybot\Plugin\Ping($this->skybot);

		$message = new \Skybot\Message\Chat();

		$message->setBody("pinga");
		$message->setUser(new User("myskypename", $this->skybot));

		$response = $plugin->run($message);

		$this->assertFalse($response);
	}

}


text:
require 'card_nine/cards/playing_card'
require 'card_nine/dealer'
require 'card_nine/table'

module CardNine
  module Dealers
    # implements a CardNine::Dealer for the game of Texas Holdem.  This is only
    #   the card movement, the betting, UI, and hand evaluation are out of the
    #   scope of this library
    # @example
    # card_eval = PretendCardEval.new
    # ui = PretendUI.new
    # wagering = PretendTexasHoldemBettingService.new
    # players = %w|Bruce Barbera Dick|
    # dealer = CardNine::Dealers::TexasHoldem.new(players: players)
    # hand = dealer.new_hand
    # ui.update(hand)
    # wagering(:ante, hand)
    # [:deal_hole_cards, :flop, :turn, :river].each do |stage|
    #   ui.update(hand.deal_stage(stage))
    #   wagering(:round, hand)
    # end
    # wager(:resolve, hand)
    class TexasHoldem < CardNine::Dealer

      # A hash of stages
      # @return [Hash<Symbol => Proc>]
      STAGES = {
          deal_hole_cards: ->(t) { t.deal_players(2) },
          flop:            ->(t) { t.discard; t.deal(3, to: :community) },
          turn:            ->(t) { t.discard; t.deal(to: :community) },
          river:           ->(t) { t.discard; t.deal(to: :community) },
          fold:            ->(t, p) { t.remove_player(p) }
      }

      # create a new dealer using a PlayingCard Deck
      def initialize
        super CardNine::Cards::PlayingCard.deck, [:community], STAGES
      end
    end
  end
end


text:
<?php

namespace Dynamic\DynamicBlocks\Test;

use Dynamic\DynamicBlocks\Block\PhotoGalleryBlock;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList;

class PhotoGalleryBlockTest extends SapphireTest
{
    /**
     * @var string
     */
    protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml';

    /**
     *
     */
    public function testPluralName()
    {
        $object = singleton(PhotoGalleryBlock::class);
        $this->assertEquals('Photo Gallery Blocks', $object->plural_name());
    }

    /**
     *
     */
    public function testGetCMSFields()
    {
        $object = singleton(PhotoGalleryBlock::class);
        $fields = $object->getCMSFields();
        $this->assertInstanceOf(FieldList::class, $fields);
        $this->assertNull($fields->dataFieldByName('Images'));

        $object = $this->objFromFixture(PhotoGalleryBlock::class, 'one');
        $fields = $object->getCMSFields();
        $this->assertInstanceOf(FieldList::class, $fields);
        $this->assertNotNull($fields->dataFieldByName('Images'));
    }
}


text:
#pragma once
#include "device/cpu/api_internal/nn_device_interface_0_internal.h"
#include "device/api/nn_primitives_api_0.h"

namespace layer {
class softmax_f32 : public nn_primitive_t {
  public:
    softmax_f32(size_t num_features, size_t batch_size, nn_device_internal *device);

    virtual ~softmax_f32() {}

    virtual void forward(const std::vector<const nn_workload_data_t *> &inputs, const std::vector<const nn_workload_data_t *> &parameters, const std::vector<nn_workload_data_t *> &outputs) override;

    //TODO remove
    virtual void backward(
        const nn::workload_data<float> *forward_output,
        const nn::workload_data<float> *backward_input,
        nn::workload_data<float> *backward_output);

    virtual void backward(const std::vector<nn_workload_data_t *> &inputs,
                          const std::vector<const nn_workload_data_t *> &parameters,
                          const std::vector<const nn_workload_data_t *> &outputs) override;

    virtual std::vector<nn_workload_data_t *> create_inputs(bool allocate_delta = false) override;

    virtual std::vector<nn_workload_data_t *> create_outputs(bool allocate_delta = false) override;

    virtual bool validate_input(size_t index, nn_workload_data_t *data) override;

private:
    void run_softmax_work_item_batch8(const nn::workload_data<float> *input_view,
                                      nn::workload_data<float> *output_view);
    void run_softmax_work_item_latency(const nn::workload_data<float> *input_view,
                                       nn::workload_data<float> *output_view);
    void run_softmax_work_item_batch48(const nn::workload_data<float> *input_view,
                                       nn::workload_data<float> *output_view);

    void forward(const nn::workload_data<float> *input, nn::workload_data<float> *output);

protected:
    const size_t num_features, batch_size;
    nn_device_internal *const device;

    const nn_workload_data_layout_t in_out_layout;
};

void wrapper_softmax_work_item_backward(nn_workload_item *const work_item);
}


text:
'use strict';

/**
 * An asynchronous bootstrap function that runs before
 * your application gets lifted.
 *
 * This gives you an opportunity to set up your data model,
 * run jobs, or perform some special logic.
 */

module.exports = cb => {
  cb();
};


text:
<?xml version="1.0" encoding="utf-8"?>
<params>

		<param name="time_reference" type="text" default="GMT" label="time_reference" tip="tip_time_reference" />

		<param name="time_zone" type="select" default="UTC" label="time_zone" tip="tip_time_zone">

			<option value="UM12">UM12</option>
			<option value="UM11">UM11</option>
			<option value="UM10">UM10</option>
			<option value="UM95">UM95</option>
			<option value="UM9">UM9</option>
			<option value="UM8">UM8</option>
			<option value="UM7">UM7</option>
			<option value="UM6">UM6</option>
			<option value="UM5">UM5</option>
			<option value="UM45">UM45</option>
			<option value="UM4">UM4</option>
			<option value="UM35">UM35</option>
			<option value="UM3">UM3</option>
			<option value="UM2">UM2</option>
			<option value="UM1">UM1</option>

			<option value="UTC">UTC</option>

			<option value="UP1">UP1</option>
			<option value="UP2">UP2</option>
			<option value="UP3">UP3</option>
			<option value="UP35">UP35</option>
			<option value="UP4">UP4</option>
			<option value="UP45">UP45</option>
			<option value="UP5">UP5</option>
			<option value="UP55">UP55</option>
			<option value="UP575">UP575</option>
			<option value="UP6">UP6</option>
			<option value="UP65">UP65</option>
			<option value="UP7">UP7</option>
			<option value="UP8">UP8</option>
			<option value="UP875">UP875</option>
			<option value="UP9">UP9</option>
			<option value="UP95">UP95</option>
			<option value="UP10">UP10</option>
			<option value="UP105">UP105</option>
			<option value="UP11">UP11</option>
			<option value="UP115">UP115</option>
			<option value="UP12">UP12</option>
			<option value="UP1275">UP1275</option>
			<option value="UP13">UP13</option>
			<option value="UP14">UP14</option>

		</param>

		<param name="js_text_editor" type="select" default="no_editor" label="text_editor" tip="tip_text_editor">

			<option value="no_editor">no_editor</option>

		</param>

		<param name="minify_output" type="select" default="1" label="minify_output" tip="tip_minify_output">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="cache_path" type="text" default="application/cache/" label="cache_path" tip="tip_cache_path" />

		<param type="spacer" label="log_files" />

		<param name="log_threshold" type="select" default="0" label="log_threshold" tip="tip_log_threshold">

			<option value="0">Off</option>
			<option value="1">Error Messages</option>
			<option value="2">Debug Messages</option>
			<option value="3">Informational Messages</option>
			<option value="4">All Messages</option>

		</param>

		<param name="log_path" type="text" default="application/logs/" label="log_path" tip="tip_log_path" />

		<param name="log_date_format" type="text" default="Y-m-d H:i:s" label="log_date_format" tip="tip_log_date_format" />

		<param type="spacer" label="sessions" />

		<param name="sess_expiration" type="number" default="7200" label="sess_expiration" tip="tip_sess_expiration" />

		<param name="sess_expire_on_close" type="select" default="0" label="sess_expire_on_close" tip="tip_sess_expire_on_close">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="sess_encrypt_cookie" type="select" default="1" label="sess_encrypt_cookie" tip="tip_sess_encrypt_cookie">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="sess_use_database" type="select" default="0" label="sess_use_database" tip="tip_sess_use_database">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="sess_table_name" type="text" default="tb_sessions" label="sess_table_name" tip="tip_sess_table_name" />

		<param name="sess_match_ip" type="select" default="0" label="sess_match_ip" tip="tip_sess_match_ip">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="sess_match_useragent" type="select" default="1" label="sess_match_useragent" tip="tip_sess_match_useragent">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="sess_time_to_update" type="number" default="300" label="sess_time_to_update" tip="tip_sess_time_to_update" />

		<param name="global_xss_filtering" type="select" default="0" label="global_xss_filtering" tip="tip_global_xss_filtering">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="email_config_enabled" type="select" default="0" label="email_config_enabled" tip="tip_email_config_enabled">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="email_config_protocol" type="select" default="" label="email_config_protocol" tip="tip_email_config_protocol">

			<option value="smtp">smtp</option>

		</param>

		<param name="email_config_smtp_crypto" type="select" default="tls" label="email_config_smtp_crypto" tip="tip_email_config_smtp_crypto">

			<option value="ssl">ssl</option>
			<option value="tls">tls</option>

		</param>

		<param name="email_config_smtp_host" type="text" default="" label="email_config_smtp_host" tip="tip_email_config_smtp_host" />

		<param name="email_config_smtp_port" type="text" default="" label="email_config_smtp_port" tip="tip_email_config_smtp_port" />

		<param name="email_config_smtp_user" type="text" default="" label="email_config_smtp_user" tip="tip_email_config_smtp_user" />

		<param name="email_config_smtp_pass" type="password" default="" label="email_config_smtp_pass" tip="tip_email_config_smtp_pass" />

		<param name="email_config_mailtype" type="select" default="html" label="email_config_mailtype" tip="tip_email_config_mailtype">

			<option value="html">html</option>
			<option value="text">text</option>

		</param>

		<param name="email_config_charset" type="text" default="utf-8" label="email_config_charset" tip="tip_email_config_charset" />

		<param name="email_config_wordwrap" type="select" default="1" label="email_config_wordwrap" tip="tip_email_config_wordwrap">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="email_config_newline" type="text" default="\r\n" label="email_config_newline" tip="tip_email_config_newline" />

		<param name="email_config_useragent" type="text" default="ViaCMS" label="email_config_useragent" tip="tip_email_config_useragent" />

		<param name="admin_name" type="text" default="Via CMS - Administração" label="admin_name" tip="tip_admin_name" />

		<param name="admin_theme" type="select" default="default" label="admin_theme" tip="tip_admin_theme">

		</param>

		<param name="admin_language" type="select" default="" label="admin_language" tip="tip_admin_language">

		</param>

		<param name="admin_items_per_page" type="select" default="10" label="default_items_per_page" tip="tip_default_items_per_page">

			<option value="-1">custom</option>
			<option value="4">4</option>
			<option value="5">5</option>
			<option value="6">6</option>
			<option value="8">8</option>
			<option value="9">9</option>
			<option value="10">10</option>
			<option value="12">10</option>
			<option value="15">15</option>
			<option value="20">20</option>
			<option value="25">25</option>
			<option value="30">30</option>
			<option value="35">35</option>
			<option value="40">40</option>
			<option value="45">45</option>
			<option value="50">50</option>
			<option value="100">100</option>
			<option value="0">all</option>

		</param>

		<param name="admin_custom_items_per_page" type="number" default="10" label="default_custom_items_per_page" tip="tip_default_custom_items_per_page" />

		<param name="admin_hide_pagination_when_only_one_page" type="select" default="1" label="hide_pagination_when_only_one_page" tip="tip_hide_pagination_when_only_one_page">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="site_name" type="text" default="Via CMS" label="site_name" tip="tip_site_name" />

		<param name="author_name" type="text" default="Via CMS" label="author_name" tip="tip_author_name" />

		<param name="site_copyright" type="text" default="© Via CMS" label="site_copyright" tip="tip_site_copyright" />

		<param name="site_theme" type="select" default="default" label="site_theme" tip="tip_site_theme">

		</param>

		<param name="site_language" type="select" default="" label="site_language" tip="tip_site_language">

		</param>

		<param name="site_items_per_page" type="select" default="10" label="default_items_per_page" tip="tip_default_items_per_page">

			<option value="-1">custom</option>
			<option value="5">5</option>
			<option value="10">10</option>
			<option value="15">15</option>
			<option value="20">20</option>
			<option value="25">25</option>
			<option value="30">30</option>
			<option value="35">35</option>
			<option value="40">40</option>
			<option value="45">45</option>
			<option value="50">50</option>
			<option value="100">100</option>
			<option value="0">all</option>

		</param>

		<param name="site_custom_items_per_page" type="number" default="10" label="default_custom_items_per_page" tip="tip_default_custom_items_per_page" />

		<param name="site_hide_pagination_when_only_one_page" type="select" default="1" label="hide_pagination_when_only_one_page" tip="tip_hide_pagination_when_only_one_page">
			<option value="1">yes</option>
			<option value="0">no</option>
		</param>

		<param name="friendly_urls" type="select" default="1" label="friendly_urls" tip="tip_friendly_urls">

			<option value="1">yes</option>
			<option value="0">no</option>

		</param>

		<param name="seo_title_prefix" type="text" default="" label="seo_title_prefix" tip="tip_seo_title_prefix"/>

		<param name="seo_title_suffix" type="text" default="" label="seo_title_suffix" tip="tip_seo_title_suffix"/>

		<param name="seo_title_separator" type="text" default=" | " label="seo_title_separator" tip="tip_seo_title_separator"/>

		<param name="meta_keywords" type="textarea" default="" label="default_meta_keywords" tip="tip_default_meta_keywords"/>

		<param name="meta_description" type="textarea" default="" label="default_meta_description" tip="tip_default_meta_description"/>

		<param name="meta_custom" type="textarea" default="" label="meta_custom" tip="tip_meta_custom"/>

		<param name="meta_scripts_declaration_custom" type="textarea" default="" label="meta_scripts_declaration_custom" tip="tip_meta_scripts_declaration_custom"/>

		<param type="spacer" label="google" />

		<param name="google_site_verification" type="text" default="" label="google_site_verification" tip="tip_google_site_verification" />

		<param type="spacer" label="google_api" />

		<param name="google_base_app_name" type="text" default="" label="google_base_app_name" tip="tip_google_base_app_name_config" />

		<param name="google_client_id" type="text" default="" label="google_client_id" tip="tip_google_client_id_config" />

		<param name="google_developer_key" type="text" default="" label="google_developer_key" tip="tip_google_developer_key_config" />

		<param name="google_client_secret" type="text" default="" label="google_client_secret" tip="tip_google_client_secret_config" />

		<param name="google_email_address" type="text" default="" label="google_email_address" tip="tip_google_email_address_config" />

		<param name="google_service_client_id" type="text" default="" label="google_service_client_id" tip="tip_google_service_client_id_config" />

		<param name="google_service_email_address" type="text" default="" label="google_service_email_address" tip="tip_google_service_email_address_config" />

</params>


text:
'use strict';

describe('Settings E2E Tests:', function() {
	describe('Test Settings page', function() {
		it('Should not include new Settings', function() {
			browser.get('http://localhost:3000/#!/settings');
			expect(element.all(by.repeater('setting in settings')).count()).toEqual(0);
		});
	});
});


text:
package models

//현재 페이지
//total
//offset => 몇개씩
//items ---> query Join Result
case class Page[A](items: Seq[A], page: Int, offset: Long, total: Long) {
  lazy val prev = Option(page - 1).filter(_ >= 0)
  lazy val next = Option(page + 1).filter(_ => (offset + items.size) < total)
}


text:
package com.saasovation.identityaccess.infrastructure.messaging;

/**
 * @author : huanghy
 * @create : 2016/4/28 0028 ÉÏÎç 10:33
 * @since : ${VERSION}
 */
public class Exchanges {
    public static final String IDENTITY_ACCESS_EXCHANGE_NAME = "identity.access.exchange";
}


text:
require File.expand_path("../../test_helper", __FILE__)
require File.expand_path("../../factory", __FILE__)

class ExportControllerTest < ActionController::TestCase

	def setup
		@user = Factory.user!
		@contact = Factory.contact!
	end

	#
	# all
	#

	test "on GET to :all without user_id in the session should redirect to sign_in" do
		get :all
		assert_redirected_to sign_in_path
	end

	test "on GET to :all should show data" do
		get :all, nil, {:user_id => @user.id}
		assert_response :success
		assert_template :all
		assert_not_nil assigns(:contacts)
		assert_equal 1, assigns(:contacts).length
	end

end


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MessageBusEventTraceWriter.cs" company="Microsoft Corporation">
//   Copyright 2015 Microsoft Corporation. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Microsoft.MessageBridge.Monitoring.EventTracing
{
    using Microsoft.Diagnostics.Tracing;

    /// <summary>
    ///     The message bus event trace writer.
    /// </summary>
    [EventSource(Name = "MessageBridge-Messaging-Bus", Guid = "E6F2F53B-D24C-4AEC-A387-EFAECAFD767D")]
    public sealed class MessageBusEventTraceWriter : EventSource
    {
        #region Constants

        /// <summary>
        ///     The base event code
        /// </summary>
        private const int BaseEventCode = 20000;

        /// <summary>
        ///     The closed event code
        /// </summary>
        private const int ClosedEventCode = BaseEventCode + 6;

        /// <summary>
        ///     The closing event code
        /// </summary>
        private const int ClosingEventCode = BaseEventCode + 5;

        /// <summary>
        ///     The exception event code
        /// </summary>
        private const int ExceptionEventCode = BaseEventCode + 0;

        /// <summary>
        ///     The registered event code
        /// </summary>
        private const int RegisteredEventCode = BaseEventCode + 2;

        /// <summary>
        ///     The registering event code
        /// </summary>
        private const int RegisteringEventCode = BaseEventCode + 1;

        /// <summary>
        ///     The sending event code
        /// </summary>
        private const int SendingEventCode = BaseEventCode + 3;

        /// <summary>
        ///     The sent event code
        /// </summary>
        private const int SentEventCode = BaseEventCode + 4;

        /// <summary>
        ///     The warning event code
        /// </summary>
        private const int WarningEventCode = BaseEventCode + 10;

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// Writes the bus closed event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="seconds">
        /// The elapsed seconds.
        /// </param>
        [Event(ClosedEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Closed ({5} seconds).")]
        public void Closed(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string name,
            string seconds)
        {
            this.WriteEvent(ClosedEventCode, machineName, deploymentId, roleInstanceName, roleInstanceId, name, seconds);
        }

        /// <summary>
        /// Writes the bus closing event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        [Event(ClosingEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Closing.")]
        public void Closing(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string name)
        {
            this.WriteEvent(ClosingEventCode, machineName, deploymentId, roleInstanceName, roleInstanceId, name);
        }

        /// <summary>
        /// Writes the bus error event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="exception">
        /// The exception.
        /// </param>
        [Event(ExceptionEventCode, Level = EventLevel.Critical,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4} Exception: {5}")
        ]
        public void Error(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string name,
            string exception)
        {
            this.WriteEvent(
                ExceptionEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                name,
                exception);
        }

        /// <summary>
        /// Writes the message sending event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="busName">
        /// Name of the bus.
        /// </param>
        /// <param name="messageKey">
        /// The message key.
        /// </param>
        /// <param name="entity">
        /// The entity.
        /// </param>
        [Event(SendingEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Sending message {5} to {6}.")]
        public void MessageSending(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string busName,
            string messageKey,
            string entity)
        {
            this.WriteEvent(
                SendingEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                busName,
                messageKey,
                entity);
        }

        /// <summary>
        /// Messages the sent.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="busName">
        /// Name of the bus.
        /// </param>
        /// <param name="messageKey">
        /// The message key.
        /// </param>
        /// <param name="entity">
        /// The entity.
        /// </param>
        /// <param name="seconds">
        /// The seconds.
        /// </param>
        [Event(SentEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Sent message {5} to {6} ({7} seconds).")]
        public void MessageSent(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string busName,
            string messageKey,
            string entity,
            string seconds)
        {
            this.WriteEvent(
                SentEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                busName,
                messageKey,
                entity,
                seconds);
        }

        /// <summary>
        /// Writes the bus handler registered event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="busName">
        /// The name.
        /// </param>
        /// <param name="handlerName">
        /// Name of the bus.
        /// </param>
        /// <param name="busEntity">
        /// The bus entity.
        /// </param>
        /// <param name="seconds">
        /// The seconds.
        /// </param>
        [Event(RegisteredEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Registered handler {5} for {6} ({7}).")]
        public void Registered(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string busName,
            string handlerName,
            string busEntity,
            string seconds)
        {
            this.WriteEvent(
                RegisteredEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                busName,
                handlerName,
                busEntity,
                seconds);
        }

        /// <summary>
        /// Writes the bus handler registering event message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="busName">
        /// Name of the bus.
        /// </param>
        /// <param name="handlerName">
        /// Name of the handler.
        /// </param>
        /// <param name="busEntity">
        /// The bus entity.
        /// </param>
        [Event(RegisteringEventCode, Level = EventLevel.Informational,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Registering handler {5} for {6}.")]
        public void Registering(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string busName,
            string handlerName,
            string busEntity)
        {
            this.WriteEvent(
                RegisteringEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                busName,
                handlerName,
                busEntity);
        }

        /// <summary>
        /// Writes the bus error warning message.
        /// </summary>
        /// <param name="machineName">
        /// The machine Name.
        /// </param>
        /// <param name="deploymentId">
        /// The deployment Id.
        /// </param>
        /// <param name="roleInstanceName">
        /// The role Instance Name.
        /// </param>
        /// <param name="roleInstanceId">
        /// The role Instance Id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="exception">
        /// The exception.
        /// </param>
        [Event(WarningEventCode, Level = EventLevel.Warning,
            Message = "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Bus {4}] Exception: {5}")]
        public void Warning(
            string machineName,
            string deploymentId,
            string roleInstanceName,
            string roleInstanceId,
            string name,
            string exception)
        {
            this.WriteEvent(
                WarningEventCode,
                machineName,
                deploymentId,
                roleInstanceName,
                roleInstanceId,
                name,
                exception);
        }

        #endregion
    }
}


text:
export class Address {
	constructor (
		public type:				string,
		public address:				string,
		public additional_info: 	string,
		public zip_code:			string,
		public city:				string,
		public floor:				number,
		public elevator:			boolean
	) { }
}


text:
/*****************************************************************************
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   See NOTICE file for details.
 *****************************************************************************/
#include "jpype.h"
#include "pyjp.h"
#include "jp_array.h"
#include "jp_arrayclass.h"

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * Create a new object.
 *
 * This is only called from the Python side.
 *
 * @param type
 * @param args
 * @param kwargs
 * @return
 */
static PyObject *PyJPArray_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	JP_PY_TRY("PyJPArray_new");
	PyJPArray* self = (PyJPArray*) type->tp_alloc(type, 0);
	JP_PY_CHECK();
	self->m_Array = NULL;
	self->m_View = NULL;
	return (PyObject*) self;
	JP_PY_CATCH(NULL);
}

static int PyJPArray_init(PyObject *self, PyObject *args, PyObject *kwargs)
{
	JP_PY_TRY("PyJPArray_init");
	JPContext *context = PyJPModule_getContext();
	JPJavaFrame frame = JPJavaFrame::outer(context);

	// Cases here.
	//  -  We got here with a JPValue
	//  -  We get an integer. Just create a new array with desired size.
	//  -  We get a sequence. Allocate with desired size and call setItems.
	//  -  We get something else.... ???

	PyObject* v;
	if (!PyArg_ParseTuple(args, "O", &v))
		return -1;

	JPClass *cls = PyJPClass_getJPClass((PyObject*) Py_TYPE(self));
	JPArrayClass* arrayClass = dynamic_cast<JPArrayClass*> (cls);
	if (arrayClass == NULL)
		JP_RAISE(PyExc_TypeError, "Class must be array type");

	JPValue *value = PyJPValue_getJavaSlot(v);
	if (value != NULL)
	{
		JPArrayClass* arrayClass2 = dynamic_cast<JPArrayClass*> (value->getClass());
		if (arrayClass2 == NULL)
			JP_RAISE(PyExc_TypeError, "Class must be array type");
		if (arrayClass2 != arrayClass)
			JP_RAISE(PyExc_TypeError, "Array class mismatch");
		((PyJPArray*) self)->m_Array = new JPArray(*value);
		PyJPValue_assignJavaSlot(frame, self, *value);
		return 0;
	}

	if (PySequence_Check(v))
	{
		JP_TRACE("Sequence");
		jlong length =  PySequence_Size(v);
		if (length < 0 || length > 2147483647)
			JP_RAISE(PyExc_ValueError, "Array size invalid");
		JPValue newArray = arrayClass->newArray(frame, (int) length);
		((PyJPArray*) self)->m_Array = new JPArray(newArray);
		((PyJPArray*) self)->m_Array->setRange(0, (jsize) length, 1, v);
		PyJPValue_assignJavaSlot(frame, self, newArray);
		return 0;
	}

	if (PyIndex_Check(v))
	{
		JP_TRACE("Index");
		long long length = PyLong_AsLongLong(v);
		if (length < 0 || length > 2147483647)
			JP_RAISE(PyExc_ValueError, "Array size invalid");
		JPValue newArray = arrayClass->newArray(frame, (int) length);
		((PyJPArray*) self)->m_Array = new JPArray(newArray);
		PyJPValue_assignJavaSlot(frame, self, newArray);
		return 0;
	}

	JP_FAULT_RETURN("PyJPArray_init.null", 0);
	JP_RAISE(PyExc_TypeError, "Invalid type");
	JP_PY_CATCH(-1);
}

static void PyJPArray_dealloc(PyJPArray *self)
{
	JP_PY_TRY("PyJPArray_dealloc");
	delete self->m_Array;
	Py_TYPE(self)->tp_free(self);
	JP_PY_CATCH(); // GCOVR_EXCL_LINE
}

static PyObject *PyJPArray_repr(PyJPArray *self)
{
	JP_PY_TRY("PyJPArray_repr");
	return PyUnicode_FromFormat("<java array '%s'>", Py_TYPE(self)->tp_name);
	JP_PY_CATCH(0);
}

static Py_ssize_t PyJPArray_len(PyJPArray *self)
{
	JP_PY_TRY("PyJPArray_len");
	PyJPModule_getContext();
	if (self->m_Array == NULL)
		JP_RAISE(PyExc_ValueError, "Null array"); // GCOVR_EXCL_LINE
	return self->m_Array->getLength();
	JP_PY_CATCH(-1);
}

static PyObject* PyJPArray_length(PyJPArray *self, PyObject *closure)
{
	return PyLong_FromSsize_t(PyJPArray_len(self));
}

static PyObject *PyJPArray_getItem(PyJPArray *self, PyObject *item)
{
	JP_PY_TRY("PyJPArray_getArrayItem");
	JPContext *context = PyJPModule_getContext();
	JPJavaFrame frame = JPJavaFrame::outer(context);
	if (self->m_Array == NULL)
		JP_RAISE(PyExc_ValueError, "Null array");

	if (PyIndex_Check(item))
	{
		Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
		if (i == -1 && PyErr_Occurred())
			return NULL;  // GCOVR_EXCL_LINE
		return self->m_Array->getItem((jsize) i).keep();
	}

	if (PySlice_Check(item))
	{
		Py_ssize_t start, stop, step, slicelength;
		Py_ssize_t length = (Py_ssize_t) self->m_Array->getLength();

#if PY_VERSION_HEX<0x03060100
		if (PySlice_GetIndicesEx(item, length, &start, &stop, &step, &slicelength) < 0)
			return NULL;
#else
		if (PySlice_Unpack(item, &start, &stop, &step) < 0)
			return NULL;

		slicelength = PySlice_AdjustIndices(length, &start, &stop, step);
#endif
		if (slicelength <= 0)
		{
			// This should point to a null array so we don't hold worthless
			// memory, but this is a low priority
			start = stop = 0;
			step = 1;
		}

		JPPyObject tuple = JPPyObject::call(PyTuple_New(0));

		JPPyObject newArray = JPPyObject::claim(Py_TYPE(self)->tp_new(Py_TYPE(self), tuple.get(), NULL));

		// Copy over the JPValue
		PyJPValue_assignJavaSlot(frame, newArray.get(),
				*PyJPValue_getJavaSlot((PyObject*) self));

		// Set up JPArray as slice
		JPArray *array = ((PyJPArray*) self)->m_Array;
		((PyJPArray*) newArray.get())->m_Array = new JPArray(array,
				(jsize) start, (jsize) stop, (jsize) step);
		return newArray.keep();
	}

	JP_RAISE(PyExc_TypeError, "Unsupported getItem type");
	JP_PY_CATCH(NULL);
}

static int PyJPArray_assignSubscript(PyJPArray *self, PyObject *item, PyObject *value)
{
	JP_PY_TRY("PyJPArray_assignSubscript");
	JPContext *context = PyJPModule_getContext();
	JPJavaFrame frame = JPJavaFrame::outer(context);
	// Verified with numpy that item deletion on immutable should
	// be ValueError
	if ( value == NULL)
		JP_RAISE(PyExc_ValueError, "item deletion not supported");
	if (self->m_Array == NULL)
		JP_RAISE(PyExc_ValueError, "Null array");

	// Watch out for self assignment
	if (PyObject_IsInstance(value, (PyObject*) PyJPArray_Type))
	{
		JPValue *v1 = PyJPValue_getJavaSlot((PyObject*) self);
		JPValue *v2 = PyJPValue_getJavaSlot((PyObject*) value);
		if (frame.equals(v1->getJavaObject(), v2->getJavaObject()))
			JP_RAISE(PyExc_ValueError, "self assignment not support currently");
	}

	if (PyIndex_Check(item))
	{
		Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
		if (i == -1 && PyErr_Occurred())
			return -1;  // GCOVR_EXCL_LINE
		self->m_Array->setItem((jsize) i, value);
		return 0;
	}

	if (PySlice_Check(item))
	{
		Py_ssize_t start, stop, step, slicelength;
		Py_ssize_t length = (Py_ssize_t) self->m_Array->getLength();

#if PY_VERSION_HEX<0x03060100
		if (PySlice_GetIndicesEx(item, length, &start, &stop, &step, &slicelength) < 0)
			return -1;
#else
		if (PySlice_Unpack(item, &start, &stop, &step) < 0)
			return -1;

		slicelength = PySlice_AdjustIndices(length, &start, &stop, step);
#endif
		if (slicelength <= 0)
			return 0;

		self->m_Array->setRange((jsize) start, (jsize) slicelength, (jsize) step,  value);
		return 0;
	}
	PyErr_Format(PyExc_TypeError,
			"Java array indices must be integers or slices, not '%s'",
			Py_TYPE(item)->tp_name);
	JP_PY_CATCH(-1);
}

static void PyJPArray_releaseBuffer(PyJPArray *self, Py_buffer *view)
{
	JP_PY_TRY("PyJPArrayPrimitive_releaseBuffer");
	JPContext* context = JPContext_global;
	if (!context->isRunning())
	{
		delete self->m_View;
		self->m_View = NULL;
		return;
	}
	JPJavaFrame frame = JPJavaFrame::outer(context);
	if (self->m_View == NULL || !self->m_View->unreference())
		return;
	delete self->m_View;
	self->m_View = NULL;
	JP_PY_CATCH(); // GCOVR_EXCL_LINE
}

int PyJPArray_getBuffer(PyJPArray *self, Py_buffer *view, int flags)
{
	JP_PY_TRY("PyJPArray_getBuffer");
	JPContext *context = PyJPModule_getContext();
	JPJavaFrame frame = JPJavaFrame::outer(context);
	if (self->m_Array == NULL)
		JP_RAISE(PyExc_ValueError, "Null array");

	if (!self->m_Array->getClass()->isPrimitiveArray())
	{
		PyErr_SetString(PyExc_BufferError, "Java array is not primitive array");
		return -1;
	}

	if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE)
	{
		PyErr_SetString(PyExc_BufferError, "Java array buffer is not writable");
		return -1;
	}

	//Check to see if we are a slice and clone it if necessary
	jarray obj = self->m_Array->getJava();
	if (self->m_Array->isSlice())
		obj = self->m_Array->clone(frame, (PyObject*) self);

	jobject result;
	try
	{
		// Collect the members into a rectangular array if possible.
		result = frame.collectRectangular(obj);
	} catch (JPypeException &ex)
	{
		// No matter what happens we are only allowed to throw BufferError
		PyErr_SetString(PyExc_BufferError, "Problem in Java buffer extraction");
		return -1;
	}

	if (result == NULL)
	{
		PyErr_SetString(PyExc_BufferError, "Java array buffer is not rectangular primitives");
		return -1;
	}

	// If it is rectangular so try to create a view
	try
	{
		if (self->m_View == NULL)
			self->m_View = new JPArrayView(self->m_Array, result);
		JP_PY_CHECK();
		self->m_View->reference();
		*view = self->m_View->m_Buffer;

		// If strides are not requested and this is a slice then fail
		if ((flags & PyBUF_STRIDES) != PyBUF_STRIDES)
			view->strides = NULL;

		// If shape is not requested
		if ((flags & PyBUF_ND) != PyBUF_ND)
			view->shape = NULL;

		// If format is not requested
		if ((flags & PyBUF_FORMAT) != PyBUF_FORMAT)
			view->format = NULL;

		// Okay all successful so reference the parent object
		view->obj = (PyObject*) self;
		Py_INCREF(view->obj);
		return 0;
	} catch (JPypeException &ex) // GCOVR_EXCL_LINE
	{
		// GCOVR_EXCL_START
		// Release the partial buffer so we don't leak
		PyJPArray_releaseBuffer(self, view);

		// We are only allowed to raise BufferError
		PyErr_SetString(PyExc_BufferError, "Java array view failed");
		return -1;
		// GCOVR_EXCL_STOP
	}
	JP_PY_CATCH(-1); // GCOVR_EXCL_LINE
}

int PyJPArrayPrimitive_getBuffer(PyJPArray *self, Py_buffer *view, int flags)
{
	JP_PY_TRY("PyJPArrayPrimitive_getBuffer");
	JPContext *context = PyJPModule_getContext();
	JPJavaFrame frame = JPJavaFrame::outer(context);
	if (self->m_Array == NULL)
		JP_RAISE(PyExc_ValueError, "Null array");
	try
	{
		if ((flags & PyBUF_WRITEABLE) == PyBUF_WRITEABLE)
		{
			PyErr_SetString(PyExc_BufferError, "Java array buffer is not writable");
			return -1;
		}

		if (self->m_View == NULL)
		{
			self->m_View = new JPArrayView(self->m_Array);
		}
		self->m_View->reference();
		*view = self->m_View->m_Buffer;

		// We are always contiguous so no need to check that here.
		view->readonly = 1;

		// If strides are not requested and this is a slice then fail
		if ((flags & PyBUF_STRIDES) != PyBUF_STRIDES)
		{
			if (view->strides[0] != view->itemsize)
				JP_RAISE(PyExc_BufferError, "slices required strides");
			view->strides = NULL;
		}

		// If shape is not requested
		if ((flags & PyBUF_ND) != PyBUF_ND)
		{
			view->shape = NULL;
		}

		// If format is not requested
		if ((flags & PyBUF_FORMAT) != PyBUF_FORMAT)
			view->format = NULL;

		// Okay all successful so reference the parent object
		view->obj = (PyObject*) self;
		Py_INCREF(view->obj);
		return 0;
	} catch (JPypeException &ex)
	{
		PyJPArray_releaseBuffer(self, view);

		// We are only allowed to raise BufferError
		PyErr_SetString(PyExc_BufferError, "Java array view failed");
		return -1;
	}
	JP_PY_CATCH(-1);
}

static const char *length_doc =
		"Get the length of a Java array\n"
		"\n"
		"This method is provided for compatibility with Java syntax.\n"
		"Generally, the Python style ``len(array)`` should be preferred.\n";

static PyMethodDef arrayMethods[] = {
	{"__getitem__", (PyCFunction) (&PyJPArray_getItem), METH_O | METH_COEXIST, ""},
	{NULL},
};

static PyGetSetDef arrayGetSets[] = {
	{"length", (getter) (&PyJPArray_length), NULL, const_cast<char*> (length_doc)},
	{0}
};

static PyType_Slot arraySlots[] = {
	{ Py_tp_new,      (void*) PyJPArray_new},
	{ Py_tp_init,     (void*) PyJPArray_init},
	{ Py_tp_dealloc,  (void*) PyJPArray_dealloc},
	{ Py_tp_repr,     (void*) PyJPArray_repr},
	{ Py_tp_methods,  (void*) &arrayMethods},
	{ Py_mp_subscript, (void*) &PyJPArray_getItem},
	{ Py_sq_length,   (void*) &PyJPArray_len},
	{ Py_tp_getset,   (void*) &arrayGetSets},
	{ Py_mp_ass_subscript, (void*) &PyJPArray_assignSubscript},
	{0}
};

static PyBufferProcs arrayBuffer = {
	(getbufferproc) & PyJPArray_getBuffer,
	(releasebufferproc) & PyJPArray_releaseBuffer
};

PyTypeObject *PyJPArray_Type = NULL;
static PyType_Spec arraySpec = {
	"_jpype._JArray",
	sizeof (PyJPArray),
	0,
	Py_TPFLAGS_DEFAULT  | Py_TPFLAGS_BASETYPE,
	arraySlots
};

static PyBufferProcs arrayPrimBuffer = {
	(getbufferproc) & PyJPArrayPrimitive_getBuffer,
	(releasebufferproc) & PyJPArray_releaseBuffer
};

static PyType_Slot arrayPrimSlots[] = {
	{0}
};

PyTypeObject *PyJPArrayPrimitive_Type = NULL;
static PyType_Spec arrayPrimSpec = {
	"_jpype._JArrayPrimitive",
	0,
	0,
	Py_TPFLAGS_DEFAULT  | Py_TPFLAGS_BASETYPE,
	arrayPrimSlots
};

#ifdef __cplusplus
}
#endif

void PyJPArray_initType(PyObject * module)
{
	JPPyObject tuple = JPPyObject::call(PyTuple_Pack(1, PyJPObject_Type));
	PyJPArray_Type = (PyTypeObject*) PyJPClass_FromSpecWithBases(&arraySpec, tuple.get());
	JP_PY_CHECK();
	PyJPArray_Type->tp_as_buffer = &arrayBuffer;
	PyModule_AddObject(module, "_JArray", (PyObject*) PyJPArray_Type);
	JP_PY_CHECK();

	tuple = JPPyObject::call(PyTuple_Pack(1, PyJPArray_Type));
	PyJPArrayPrimitive_Type = (PyTypeObject*)
			PyJPClass_FromSpecWithBases(&arrayPrimSpec, tuple.get());
	PyJPArrayPrimitive_Type->tp_as_buffer = &arrayPrimBuffer;
	JP_PY_CHECK();
	PyModule_AddObject(module, "_JArrayPrimitive",
			(PyObject*) PyJPArrayPrimitive_Type);
	JP_PY_CHECK();
}

JPPyObject PyJPArray_create(JPJavaFrame &frame, PyTypeObject *type, const JPValue & value)
{
	PyObject *obj = type->tp_alloc(type, 0);
	JP_PY_CHECK();
	((PyJPArray*) obj)->m_Array = new JPArray(value);
	PyJPValue_assignJavaSlot(frame, obj, value);
	return JPPyObject::claim(obj);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Anal. Soc. cient. argent. 12(3): 98 [no. 111?] (1881)

#### Original name
Apiosporium fimicola Speg.

### Remarks
null


text:
package org.apache.flume.sink.hdfs;

import java.io.IOException;
import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.SequenceFile.CompressionType;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HDFSSequenceFile extends AbstractHDFSWriter {

  private static final Logger logger =
      LoggerFactory.getLogger(HDFSSequenceFile.class);
  private SequenceFile.Writer writer;
  private String writeFormat;
  private Context serializerContext;
  private SequenceFileSerializer serializer;
  private boolean useRawLocalFileSystem;
  private FSDataOutputStream outStream = null;

  public HDFSSequenceFile() {
    writer = null;
  }

  @Override
  public void configure(Context context) {
    super.configure(context);

    // use binary writable serialize by default
    writeFormat = context.getString("hdfs.writeFormat",
      SequenceFileSerializerType.Writable.name());
    useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem",
        false);
    serializerContext = new Context(
            context.getSubProperties(SequenceFileSerializerFactory.CTX_PREFIX));
    serializer = SequenceFileSerializerFactory
            .getSerializer(writeFormat, serializerContext);
    logger.info("writeFormat = " + writeFormat + ", UseRawLocalFileSystem = "
        + useRawLocalFileSystem);
  }

  @Override
  public void open(String filePath) throws IOException {
    open(filePath, null, CompressionType.NONE);
  }

  @Override
  public void open(String filePath, CompressionCodec codeC,
      CompressionType compType) throws IOException {
    Configuration conf = new Configuration();
    Path dstPath = new Path(filePath);
    FileSystem hdfs = dstPath.getFileSystem(conf);
    open(dstPath, codeC, compType, conf, hdfs);
  }

  protected void open(Path dstPath, CompressionCodec codeC,
      CompressionType compType, Configuration conf, FileSystem hdfs)
          throws IOException {
    if (useRawLocalFileSystem) {
      if (hdfs instanceof LocalFileSystem) {
        hdfs = ((LocalFileSystem)hdfs).getRaw();
      } else {
        logger.warn("useRawLocalFileSystem is set to true but file system " +
            "is not of type LocalFileSystem: " + hdfs.getClass().getName());
      }
    }
    if (conf.getBoolean("hdfs.append.support", false) == true && hdfs.isFile(dstPath)) {
      outStream = hdfs.append(dstPath);
    } else {
      outStream = hdfs.create(dstPath);
    }
    writer = SequenceFile.createWriter(conf, outStream,
        serializer.getKeyClass(), serializer.getValueClass(), compType, codeC);

    registerCurrentStream(outStream, hdfs, dstPath);
  }

  @Override
  public void append(Event e) throws IOException {
    for (SequenceFileSerializer.Record record : serializer.serialize(e)) {
      writer.append(record.getKey(), record.getValue());
    }
  }

  @Override
  public void sync() throws IOException {
    writer.sync();
    hflushOrSync(outStream);
  }

  @Override
  public void close() throws IOException {
    writer.close();
    outStream.close();
    unregisterCurrentStream();
  }
}


text:
package kr.ac.kaist.jsaf.nodes;

import java.lang.Double;
import java.lang.String;
import java.math.BigInteger;
import java.io.Writer;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.LinkedList;
import kr.ac.kaist.jsaf.nodes_util.*;
import kr.ac.kaist.jsaf.useful.*;
import edu.rice.cs.plt.tuple.Option;

/**
 * Class FunApp, a component of the ASTGen-generated composite hierarchy.
 * Note: null is not allowed as a value for any field.
 * @version  Generated automatically by ASTGen at Mon Nov 21 18:10:55 CET 2016
 */
@SuppressWarnings("unused")
public class FunApp extends LHS {
    private final LHS _fun;
    private final List<Expr> _args;

    /**
     * Constructs a FunApp.
     * @throws java.lang.IllegalArgumentException  If any parameter to the constructor is null.
     */
    public FunApp(ASTSpanInfo in_info, LHS in_fun, List<Expr> in_args) {
        super(in_info);
        if (in_fun == null) {
            throw new java.lang.IllegalArgumentException("Parameter 'fun' to the FunApp constructor was null");
        }
        _fun = in_fun;
        if (in_args == null) {
            throw new java.lang.IllegalArgumentException("Parameter 'args' to the FunApp constructor was null");
        }
        _args = in_args;
    }

    final public LHS getFun() { return _fun; }
    final public List<Expr> getArgs() { return _args; }

    public <RetType> RetType accept(AbstractNodeVisitor<RetType> visitor) {
        return visitor.forFunApp(this);
    }

    public <RetType> RetType accept(NodeVisitor<RetType> visitor) {
        return visitor.forFunApp(this);
    }

    public void accept(AbstractNodeVisitor_void visitor) {
        visitor.forFunApp(this);
    }

    public void accept(NodeVisitor_void visitor) {
        visitor.forFunApp(this);
    }

    /**
     * Implementation of equals that is based on the values of the fields of the
     * object. Thus, two objects created with identical parameters will be equal.
     */
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
            return false;
        }
        else {
            FunApp casted = (FunApp) obj;
            ASTSpanInfo temp_info = getInfo();
            ASTSpanInfo casted_info = casted.getInfo();
            if (!(temp_info == casted_info || temp_info.equals(casted_info))) return false;
            LHS temp_fun = getFun();
            LHS casted_fun = casted.getFun();
            if (!(temp_fun == casted_fun || temp_fun.equals(casted_fun))) return false;
            List<Expr> temp_args = getArgs();
            List<Expr> casted_args = casted.getArgs();
            if (!(temp_args == casted_args || temp_args.equals(casted_args))) return false;
            return true;
        }
    }

    /**
     * Implementation of hashCode that is consistent with equals.  The value of
     * the hashCode is formed by XORing the hashcode of the class object with
     * the hashcodes of all the fields of the object.
     */
    public int generateHashCode() {
        int code = getClass().hashCode();
        ASTSpanInfo temp_info = getInfo();
        code ^= temp_info.hashCode();
        LHS temp_fun = getFun();
        code ^= temp_fun.hashCode();
        List<Expr> temp_args = getArgs();
        code ^= temp_args.hashCode();
        return code;
    }

    /**
     * Empty constructor, for reflective access.  Clients are
     * responsible for manually instantiating each field.
     */
    protected FunApp() {
        _fun = null;
        _args = null;
    }

    public void walk(TreeWalker w) {
        if (w.visitNode(this, "FunApp", 3)) {
            ASTSpanInfo temp_info = getInfo();
            if (w.visitNodeField("info", temp_info)) {
                temp_info.walk(w);
                w.endNodeField("info", temp_info);
            }
            LHS temp_fun = getFun();
            if (w.visitNodeField("fun", temp_fun)) {
                temp_fun.walk(w);
                w.endNodeField("fun", temp_fun);
            }
            List<Expr> temp_args = getArgs();
            if (w.visitNodeField("args", temp_args)) {
                if (w.visitIterated(temp_args)) {
                    int i_temp_args = 0;
                    for (Expr elt_temp_args : temp_args) {
                        if (w.visitIteratedElement(i_temp_args, elt_temp_args)) {
                            if (elt_temp_args == null) w.visitNull();
                            else {
                                elt_temp_args.walk(w);
                            }
                        }
                        i_temp_args++;
                    }
                    w.endIterated(temp_args, i_temp_args);
                }
                w.endNodeField("args", temp_args);
            }
            w.endNode(this, "FunApp", 3);
        }
    }

}


text:
using namespace demo;

GLuint Plane::_globalVAO = 0;
GLuint Plane::_globalVBO = 0;

Plane::Plane() {
  // do nothing
}

Plane::~Plane() {
  // do nothing
}

void Plane::draw() {
  glBindVertexArray(Plane::_globalVAO);
  glBindBuffer(GL_ARRAY_BUFFER, Plane::_globalVBO);
  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void Plane::setup(GLuint* vao, GLuint* vbo, const Canvas& canvas) {
  if (Plane::_globalVAO != 0 ||
      Plane::_globalVBO != 0) {
    printf("[DEMO]  Allocated too many VAO for class Sphere");
  }
  Plane::_globalVAO = vao[0];
  Plane::_globalVBO = vbo[0];

  const float vertPos[] = {
     1,  1,  0,
    -1,  1,  0,
     1, -1,  0,
    -1, -1,  0
  };

  const float vertNorm[] = {
    0, 0, 1,
    0, 0, 1,
    0, 0, 1,
    0, 0, 1
  };

  // bind buffers
  glBindVertexArray(vao[0]);
  glBindBuffer(GL_ARRAY_BUFFER, vao[0]);

  // write data
  glBufferData(GL_ARRAY_BUFFER, sizeof(vertPos) + sizeof(vertNorm), nullptr, GL_STATIC_DRAW);

  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertPos), &vertPos[0]);
  glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertPos), sizeof(vertNorm), &vertNorm[0]);

  // vertex positions attribute
  glVertexAttribPointer(canvas.attrs().vertPos(), 3, GL_FLOAT, GL_FALSE, 0, 0);
  // vertex norms attribute
  glVertexAttribPointer(canvas.attrs().vertNorm(), 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)sizeof(vertPos));

  // ensure required attributes are enabled
  glEnableVertexAttribArray(canvas.attrs().vertPos());
  glEnableVertexAttribArray(canvas.attrs().vertNorm());
}

void Plane::Instance::draw(Canvas& canvas) {
  canvas.push();
  canvas.translate(-center[0], -center[1], -center[2]);
  canvas.scale(breath, width, 1.0);
  canvas.push();
  canvas.loadMatrix(re::demo::facing(normal, side));
  canvas.setMaterial(material);
  canvas.drawUnitPlane();
  canvas.pop();
  canvas.pop();
}


text:
module Top4R

  # TaobaokeItem Model
  class TaobaokeItem
    include ModelMixin
    @@ATTRIBUTES = [:id, :iid, :num_iid, :title, :nick, :pic_url, :price, :click_url, :commission, :commission_rate,
      :commission_num, :commission_volume, :shop_click_url, :seller_credit_score, :item_location, :volume]
    attr_accessor *@@ATTRIBUTES

    class << self
      def attributes; @@ATTRIBUTES; end

      def default_public_fields
        ["iid", "num_iid", "title", "pic_url", "price", "nick", "click_url"]
      end
    end

    def unmarshal_other_attrs
      @id = @iid

      self
    end
  end

end


text:
namespace ash {
namespace shell {

class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver {
 public:
  explicit WorkspaceWindowWatcher(WindowWatcher* watcher) : watcher_(watcher) {}

  ~WorkspaceWindowWatcher() override {}

  void OnWindowAdded(aura::Window* new_window) override {
    new_window->AddObserver(watcher_);
  }

  void OnWillRemoveWindow(aura::Window* window) override {
    DCHECK(window->children().empty());
    window->RemoveObserver(watcher_);
  }

  void RootWindowAdded(aura::Window* root) {
    aura::Window* panel_container =
        ash::Shell::GetContainer(root, kShellWindowId_PanelContainer);
    panel_container->AddObserver(watcher_);

    aura::Window* container =
        ash::Shell::GetContainer(root, kShellWindowId_ShelfContainer);
    container->AddObserver(this);
    for (size_t i = 0; i < container->children().size(); ++i)
      container->children()[i]->AddObserver(watcher_);
  }

  void RootWindowRemoved(aura::Window* root) {
    aura::Window* panel_container =
        ash::Shell::GetContainer(root, kShellWindowId_PanelContainer);
    panel_container->RemoveObserver(watcher_);

    aura::Window* container =
        ash::Shell::GetContainer(root, kShellWindowId_ShelfContainer);
    container->RemoveObserver(this);
    for (size_t i = 0; i < container->children().size(); ++i)
      container->children()[i]->RemoveObserver(watcher_);
  }

 private:
  WindowWatcher* watcher_;

  DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowWatcher);
};

WindowWatcher::WindowWatcher() {
  workspace_window_watcher_.reset(new WorkspaceWindowWatcher(this));
  aura::Window::Windows root_windows = Shell::GetAllRootWindows();
  for (aura::Window::Windows::iterator iter = root_windows.begin();
       iter != root_windows.end(); ++iter) {
    workspace_window_watcher_->RootWindowAdded(*iter);
  }
}

WindowWatcher::~WindowWatcher() {
  aura::Window::Windows root_windows = Shell::GetAllRootWindows();
  for (aura::Window::Windows::iterator iter = root_windows.begin();
       iter != root_windows.end(); ++iter) {
    workspace_window_watcher_->RootWindowRemoved(*iter);
  }
}

aura::Window* WindowWatcher::GetWindowByID(ash::ShelfID id) {
  IDToWindow::const_iterator i = id_to_window_.find(id);
  return i != id_to_window_.end() ? i->second : NULL;
}

// aura::WindowObserver overrides:
void WindowWatcher::OnWindowAdded(aura::Window* new_window) {
  if (!wm::IsWindowUserPositionable(new_window))
    return;

  static int image_count = 0;
  ShelfModel* model = WmShell::Get()->shelf_model();
  ShelfItem item;
  item.type = new_window->type() == ui::wm::WINDOW_TYPE_PANEL
                  ? ash::TYPE_APP_PANEL
                  : ash::TYPE_PLATFORM_APP;
  ash::ShelfID id = model->next_id();
  id_to_window_[id] = new_window;

  SkBitmap icon_bitmap;
  icon_bitmap.allocN32Pixels(16, 16);
  icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0,
                        image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0);
  image_count = (image_count + 1) % 3;
  item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f));

  model->Add(item);

  std::unique_ptr<ShelfItemDelegate> delegate(
      new WindowWatcherShelfItemDelegate(id, this));
  model->SetShelfItemDelegate(id, std::move(delegate));
  WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id);
}

void WindowWatcher::OnWillRemoveWindow(aura::Window* window) {
  for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end();
       ++i) {
    if (i->second == window) {
      ShelfModel* model = WmShell::Get()->shelf_model();
      int index = model->ItemIndexByID(i->first);
      DCHECK_NE(-1, index);
      model->RemoveItemAt(index);
      id_to_window_.erase(i);
      break;
    }
  }
}

void WindowWatcher::OnDisplayAdded(const display::Display& new_display) {
  aura::Window* root = Shell::GetInstance()
                           ->window_tree_host_manager()
                           ->GetRootWindowForDisplayId(new_display.id());
  workspace_window_watcher_->RootWindowAdded(root);
}

void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) {
  // All windows in the display has already been removed, so no need to
  // remove observers.
}

void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) {
}

}  // namespace shell
}  // namespace ash


text:
/**
 * @file
 * Just a placeholder file for the test.
 * @see ViewsCacheTest::testHeaderStorage
 */


text:
from ari.common import base
from ari import exception

ADD_ATTRIBUTES = [
    'channel',
    'role',
]

CREATE_ATTRIBUTES = [
    'type',
]

MUSIC_ATTRIBUTES = [
    'mohClass',
]

REMOVE_ATTRIBUTES = [
    'channel',
]

PLAY_ATTRIBUTES = [
    'media',
    'lang',
    'offsetms',
    'skipms',
]

class Bridge(base.Resource):
    def __repr__(self):
        return '<Bridge %s>' % self._info

class BridgeManager(base.Manager):

    resource_class = Bridge

    def __create(self, attributes, path, callback, **kwargs):
        keys = {}
        for (key, value) in kwargs.items():
            if key in attributes:
                keys[key] = value
            else:
                raise exception.InvalidAttribute()

        return self._create(path, keys, callback=callback)

    @staticmethod
    def _path(uuid=None):
        return '/bridges/%s' % uuid if uuid else '/bridges'

    def add_audio(self, uuid, callback=None, **kwargs):
        path = '%s/%s' % (self._path(uuid), 'play')

        return self.__create(
            attributes=PLAY_ATTRIBUTES, path=path, callback=callback, **kwargs)

    def add(self, uuid, callback=None, **kwargs):
        path = '%s/%s' % (self._path(uuid), 'addChannel')

        return self.__create(
            attributes=ADD_ATTRIBUTES, path=path, callback=callback, **kwargs)

    def create(self, uuid=None, callback=None, **kwargs):
        path = self._path(uuid)

        return self.__create(
            attributes=CREATE_ATTRIBUTES, path=path, callback=callback,
            **kwargs)

    def delete(self, uuid, callback=None):
        return self._delete(self._path(uuid), callback=callback)

    def get(self, uuid, callback=None):
        try:
            return self._list(self._path(uuid), callback=callback)
        except IndexError:
            return None

    def add_music(self, uuid, callback=None, **kwargs):
        path = '%s/%s' % (self._path(uuid), 'moh')

        return self.__create(
            attributes=MUSIC_ATTRIBUTES, path=path, callback=callback,
            **kwargs)

    def list(self, callback=None):
        return self._list(self._path(), callback=callback)

    def remove(self, uuid, callback=None, **kwargs):
        path = '%s/%s' % (self._path(uuid), 'removeChannel')

        return self.__create(
            attributes=ADD_ATTRIBUTES, path=path, callback=callback, **kwargs)

    def remove_music(self, uuid, callback=None):
        path = '%s/%s' % (self._path(uuid), 'moh')

        return self._delete(path, callback=callback)


text:
<?php

/**
 *
 * @author:  Gabriel BONDAZ <gabriel.bondaz@idci-consulting.fr>
 * @license: GPL
 *
 */

namespace IDCI\Bundle\SimpleMediaBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Media
 *
 * @ORM\Table(name="idci_media_tag")
 * @ORM\Entity(repositoryClass="IDCI\Bundle\SimpleMediaBundle\Repository\TagRepository")
 */
class Tag
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", unique=true, type="string", length=64)
     */
    private $name;

    /**
     * @ORM\ManyToMany(targetEntity="IDCI\Bundle\SimpleMediaBundle\Entity\AssociatedMedia", mappedBy="tags")
     */
    private $associatedMedias;

    /**
     * toString
     *
     * @return string
     */
    public function __toString()
    {
        return $this->getName();
    }

    /**
     * Constructor
     */
    public function __construct($tagName = null)
    {
        $this->associatedMedias = new \Doctrine\Common\Collections\ArrayCollection();
        $this->setName($tagName);
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Tag
     */
    public function setName($name)
    {
        $this->name = trim($name);

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Add associatedMedias
     *
     * @param \IDCI\Bundle\SimpleMediaBundle\Entity\AssociatedMedia $associatedMedias
     * @return Tag
     */
    public function addAssociatedMedia(\IDCI\Bundle\SimpleMediaBundle\Entity\AssociatedMedia $associatedMedias)
    {
        $this->associatedMedias[] = $associatedMedias;

        return $this;
    }

    /**
     * Remove associatedMedias
     *
     * @param \IDCI\Bundle\SimpleMediaBundle\Entity\AssociatedMedia $associatedMedias
     */
    public function removeAssociatedMedia(\IDCI\Bundle\SimpleMediaBundle\Entity\AssociatedMedia $associatedMedias)
    {
        $this->associatedMedias->removeElement($associatedMedias);
    }

    /**
     * Get associatedMedias
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAssociatedMedias()
    {
        return $this->associatedMedias;
    }
}


text:
@interface UIImage (SimpleEdit)

#pragma mark - 做純色圖
+(UIImage *)makePureColorImage:(CGSize)size
                         Color:(UIColor *)color;

#pragma mark - 做漸層圖
+(UIImage *)makeGradientImage:(CGSize)size
                   StartPoint:(CGPoint)startPoint
                     EndPoint:(CGPoint)endPoint
                       Colors:(NSArray *)colorArray
                     Location:(NSArray *)locationArray;

#pragma mark - 貼圖
-(UIImage *)addImage:(UIImage *)image
             atPoint:(CGPoint)point;

-(UIImage *)addImageCenter:(UIImage *)image;

#pragma mark - 貼字
-(UIImage *)addString:(NSString *)string
             withfont:(NSDictionary *)fontDictionary
              atPoint:(CGPoint)point;

#pragma mark - 混合
-(UIImage *)makeTexture:(UIImage *)textureImage;

+(UIImage *)makeTexture:(UIImage *)iconImage
                Texture:(UIImage *)textureImage;

+(UIImage *)makeTexture:(UIImage *)iconImage
                Texture:(UIImage *)textureImage
                   mode:(CGBlendMode)mode;

#pragma mark - 做圓角
-(id)createRoundedRadius:(NSInteger)radius;
-(id)createRoundedAtCorners:(UIRectCorner)corners
                     Radius:(NSInteger)radius;

+(id)createRoundedRectImage:(UIImage*)image
                       size:(CGSize)size
                     radius:(NSInteger)radius;

#pragma mark - 改大小
+(UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize;

#pragma mark - 切圖
-(UIImage *)subImageInRect:(CGRect)rect;
+(UIImage *)changeColor:(UIImage *)image color:(UIColor *)color;

//#pragma mark - 存圖片

@end


text:
      <input type="text" id="title" name="title" class="form-control" placeholder="Enter title here..." required [(ngModel)]="post.title"/>

      <angular-editor [(ngModel)]="post.body" [config]="editorConfig"></angular-editor>

    <button class="btn btn-primary" (click)="onSave()">Save</button>


text:
package org.kie.workbench.common.stunner.client.widgets.presenters.session.impl;

import java.util.Optional;

import javax.enterprise.event.Event;

import org.kie.workbench.common.stunner.client.widgets.event.SessionDiagramOpenedEvent;
import org.kie.workbench.common.stunner.client.widgets.notification.NotificationsObserver;
import org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionDiagramPresenter;
import org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionDiagramViewer;
import org.kie.workbench.common.stunner.client.widgets.presenters.session.SessionViewer;
import org.kie.workbench.common.stunner.client.widgets.toolbar.ToolbarFactory;
import org.kie.workbench.common.stunner.client.widgets.toolbar.impl.ViewerToolbarFactory;
import org.kie.workbench.common.stunner.client.widgets.views.WidgetWrapperView;
import org.kie.workbench.common.stunner.core.client.api.SessionManager;
import org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler;
import org.kie.workbench.common.stunner.core.client.command.CanvasCommandManager;
import org.kie.workbench.common.stunner.core.client.session.impl.AbstractClientReadOnlySession;
import org.kie.workbench.common.stunner.core.diagram.Diagram;

/**
 * A generic session's presenter instance for read-only purposes.
 *

 * It provides a viewer Toolbar instance type, but does not provide a Palette to ensure view only mode.
 *

 * It aggregates a custom session viewer type which provides binds the editors's diagram instance and the
 * different editors' controls with the diagram and controls for the given session.
 * @see org.kie.workbench.common.stunner.client.widgets.presenters.session.impl.SessionViewerImpl
 */
public class SessionViewerPresenter<S extends AbstractClientReadOnlySession, H extends AbstractCanvasHandler>
        extends AbstractSessionPresenter<Diagram, H, S, SessionViewer<S, H, Diagram>>
        implements SessionDiagramPresenter<S, H> {

    private final Event<SessionDiagramOpenedEvent> sessionDiagramOpenedEvent;
    private final SessionDiagramViewer<S, H> viewer;

    @SuppressWarnings("unchecked")
    SessionViewerPresenter(final SessionManager sessionManager,
                           final CanvasCommandManager<H> commandManager,
                           final ViewerToolbarFactory toolbarFactory,
                           final Event<SessionDiagramOpenedEvent> sessionDiagramOpenedEvent,
                           final WidgetWrapperView diagramViewerView,
                           final NotificationsObserver notificationsObserver,
                           final View view) {
        super(sessionManager,
              view,
              Optional.of((ToolbarFactory<S>) toolbarFactory),
              Optional.empty(),
              notificationsObserver);
        this.viewer = new CustomSessionViewer(commandManager,
                                              diagramViewerView);
        this.sessionDiagramOpenedEvent = sessionDiagramOpenedEvent;
    }

    public SessionViewer<S, H, Diagram> getViewer() {
        return viewer;
    }

    /**
     * A session viewer which diagram is the instance to be presented.
     * Consider the default session editor (SessionEditorImpl) works for already loaded sessions,
     * it expects the diagram instance to be loaded and available from the canvas handler.
     * This is not the same case for the session presenter, which just presents a diagram instance, either
     * loaded from backend or recently created, and it loads the given diagram into the given session.
     */
    private class CustomSessionViewer extends SessionViewerImpl<S, H> {

        private CustomSessionViewer(final CanvasCommandManager<H> canvasCommandManager,
                                    final WidgetWrapperView view) {
            super(canvasCommandManager,
                  view);
        }

        @Override
        protected Diagram getDiagram() {
            return SessionViewerPresenter.this.getDiagram();
        }
    }

    @Override
    public SessionViewer<S, H, Diagram> getDisplayer() {
        return viewer;
    }

    @Override
    protected void onSessionOpened(final S session) {
        super.onSessionOpened(session);
        sessionDiagramOpenedEvent.fire(new SessionDiagramOpenedEvent(session));
    }
}


text:
package scaladelray.ui.model

import javax.swing.table.TableModel
import scaladelray.texture.{InterpolatedImageTexture, Texture}
import javax.swing.event.{TableModelEvent, TableModelListener}
import java.io.File
import scala.collection.mutable

class InterpolatedImageTextureProvider( tml : TableModelListener ) extends TextureProvider with TableModel {

  var fileName = ""

  var listener = mutable.Set[TableModelListener]()

  listener += tml

  override def createTexture( l : () => Unit ) : Texture = {
    l()
    InterpolatedImageTexture( fileName )
  }

  override def getRowCount: Int = 1

  override def getColumnCount: Int = 2

  override def getColumnName(column: Int): String = column match {
    case 0 => "Property"
    case 1 => "Value"
  }

  override def getColumnClass(p1: Int): Class[_] = classOf[String]

  override def isCellEditable(row: Int, column: Int): Boolean = column == 1

  override def getValueAt(row: Int, column: Int): AnyRef = column match {
    case 0 => row match {
      case 0 => "file"
    }
    case 1 => row match {
      case 0 => fileName
    }
  }

  override def setValueAt( obj : Any, row: Int, column: Int) {

    row match {
      case 0 =>
        fileName = obj.asInstanceOf[String]
        for( l <- listener ) l.tableChanged( new TableModelEvent( this ) )
    }

  }

  override def addTableModelListener( l : TableModelListener) {
    listener += l
  }

  override def removeTableModelListener( l : TableModelListener) {
    listener -= l
  }

  override def isReady: Boolean = (new File( fileName )).exists()

  override def toString: String = "Interpolated image texture"

  override def count = 1

}


text:
#pragma once

#include <qrgui/plugins/toolPluginInterface/usedInterfaces/mainWindowInterpretersInterface.h>
#include "blocksFactoryManager.h"

namespace interpreterCore {

/// Updates palette when selected robot model is changed: hides blocks from other kits and disables blocks from current
/// kit that are not supported by selected model.
class PaletteUpdateManager : public QObject
{
	Q_OBJECT

public:
	/// Constructor.
	/// @param paletteProvider - contains methods for working with the palette.
	/// @param factoryManager - provides information about currently enabled blocks.
	/// @param parent - parent of this object in terms of Qt memory management system.
	PaletteUpdateManager(qReal::gui::MainWindowInterpretersInterface &paletteProvider
			, const BlocksFactoryManagerInterface &factoryManager
			, QObject *parent = 0);

public slots:
	/// Called when selected robot model is changed, updates palette.
	void updatePalette(kitBase::robotModel::RobotModelInterface &currentModel);

	/// Disables all elements in robots palette.
	void disableAll();

private:
	qReal::gui::MainWindowInterpretersInterface &mPaletteProvider;
	const BlocksFactoryManagerInterface &mFactoryManager;
};

}


text:
package org.apache.flink.kubernetes.kubeclient.decorators;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.JobManagerOptions;
import org.apache.flink.kubernetes.kubeclient.FlinkPod;
import org.apache.flink.kubernetes.kubeclient.parameters.KubernetesJobManagerParameters;
import org.apache.flink.kubernetes.utils.KubernetesUtils;
import org.apache.flink.runtime.jobmanager.JobManagerProcessSpec;
import org.apache.flink.runtime.jobmanager.JobManagerProcessUtils;

import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.ContainerBuilder;

import java.util.List;

import static org.apache.flink.util.Preconditions.checkNotNull;

/** Attach the jvm command and args to the main container for running the JobManager code. */
public class JavaCmdJobManagerDecorator extends AbstractKubernetesStepDecorator {

    private final KubernetesJobManagerParameters kubernetesJobManagerParameters;

    public JavaCmdJobManagerDecorator(
            KubernetesJobManagerParameters kubernetesJobManagerParameters) {
        this.kubernetesJobManagerParameters = checkNotNull(kubernetesJobManagerParameters);
    }

    @Override
    public FlinkPod decorateFlinkPod(FlinkPod flinkPod) {
        final JobManagerProcessSpec processSpec =
                JobManagerProcessUtils.processSpecFromConfigWithNewOptionToInterpretLegacyHeap(
                        kubernetesJobManagerParameters.getFlinkConfiguration(),
                        JobManagerOptions.TOTAL_PROCESS_MEMORY);
        final List<String> startCommand =
                getJobManagerStartCommand(
                        kubernetesJobManagerParameters.getFlinkConfiguration(),
                        processSpec,
                        kubernetesJobManagerParameters.getFlinkConfDirInPod(),
                        kubernetesJobManagerParameters.getFlinkLogDirInPod(),
                        kubernetesJobManagerParameters.hasLogback(),
                        kubernetesJobManagerParameters.hasLog4j(),
                        kubernetesJobManagerParameters.getEntrypointClass());

        final Container mainContainerWithStartCmd =
                new ContainerBuilder(flinkPod.getMainContainer())
                        .withCommand(kubernetesJobManagerParameters.getContainerEntrypoint())
                        .withArgs(startCommand)
                        .build();

        return new FlinkPod.Builder(flinkPod).withMainContainer(mainContainerWithStartCmd).build();
    }

    /**
     * Generates the shell command to start a jobmanager for kubernetes.
     *
     * @param flinkConfig The Flink configuration.
     * @param jobManagerProcessSpec JobManager process memory spec.
     * @param configDirectory The configuration directory for the flink-conf.yaml
     * @param logDirectory The log directory.
     * @param hasLogback Uses logback?
     * @param hasLog4j Uses log4j?
     * @param mainClass The main class to start with.
     * @return A String containing the job manager startup command.
     */
    private static List<String> getJobManagerStartCommand(
            Configuration flinkConfig,
            JobManagerProcessSpec jobManagerProcessSpec,
            String configDirectory,
            String logDirectory,
            boolean hasLogback,
            boolean hasLog4j,
            String mainClass) {
        final String jvmMemOpts =
                JobManagerProcessUtils.generateJvmParametersStr(jobManagerProcessSpec, flinkConfig);
        final String dynamicParameters =
                JobManagerProcessUtils.generateDynamicConfigsStr(jobManagerProcessSpec);
        final String javaCommand =
                KubernetesUtils.getCommonStartCommand(
                        flinkConfig,
                        KubernetesUtils.ClusterComponent.JOB_MANAGER,
                        jvmMemOpts,
                        configDirectory,
                        logDirectory,
                        hasLogback,
                        hasLog4j,
                        mainClass,
                        dynamicParameters);
        return KubernetesUtils.getStartCommandWithBashWrapper(javaCommand);
    }
}


text:
package software.sitb.dswrs.core.rpc;

/**
 * RPC响应结果
 *
 * @author Sean sean.snow@live.com
 */
public class RpcResponse implements java.io.Serializable {
    private static final long serialVersionUID = -6248397742873424100L;

    private String requestId;

    private Throwable error;

    private Object result;

    /**
     * 请求是否成功
     *
     * @return 成功状态
     */
    public boolean success() {
        return this.error == null;
    }

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public Throwable getError() {
        return error;
    }

    public void setError(Throwable error) {
        this.error = error;
    }

    @SuppressWarnings("unchecked")
    public <T> T getResult() {
        return (T) result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    @Override
    public String toString() {
        return "RpcResponse{" +
                "requestId='" + requestId + '\'' +
                ", error=" + error +
                ", result=" + result +
                '}';
    }
}


text:
namespace Microsoft.Xbox.Services.Leaderboard
{
    using global::System;
    using global::System.Collections.Generic;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;

    internal class LeaderboardInfo
    {
        [JsonProperty("columnDefinition")]
        public LeaderboardColumn Column { get; set; }

        [JsonProperty("totalCount")]
        public uint TotalCount { get; set; }
    }

    internal class PagingInfo
    {
        [JsonProperty("continuationToken")]
        public string ContinuationToken { get; set; }
    }

    internal class LeaderboardRowResponse
    {
        public IList<string> Values
        {
            get;
            set;
        }

        public string Value
        {
            get;
            set;
        }

        public int Rank
        {
            get;
            set;
        }

        public double Percentile
        {
            get;
            set;
        }

        [JsonProperty("xuid")]
        public string XboxUserId
        {
            get;
            set;
        }

        public string Gamertag
        {
            get;
            set;
        }
    }

    internal class LeaderboardResponse
    {
        [JsonProperty ("leaderboardInfo")]
        public LeaderboardInfo LeaderboardInfo { get;  set; }

        [JsonProperty ("pagingInfo")]
        public PagingInfo PagingInfo { get; set; }

        [JsonProperty("userList")]
        public IList<LeaderboardRowResponse> Rows { get; set; }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package q4;

import java.util.Scanner;

/**
 *
 * @author Jatin
 */
public class Q4 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        System.out.print("Enter the number            : ");
        Scanner ob = new Scanner(System.in);
        int value = ob.nextInt();
        System.out.println("Decimal Representation is   : " + Integer.toBinaryString(value));
        int num;
        do {
            System.out.print("\nEnter the bit to be flipped ( 0 to 31 ): ");
            num = ob.nextInt();
        } while (num >= 32 || num <= 0);
        System.out.println("");

        int mask = 1;
        int timeShift = num - 1;
        mask = mask << timeShift;

        value ^= mask;

        System.out.println("The result is               : " + value);
        System.out.println("Decimal Representation is   : " + Integer.toBinaryString(value));
    }
}