text:
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
'''
import os
import sys
import logging
import json
import time
from coilmq.util import frames
from coilmq.util.frames import Frame

from BaseStompServerTestCase import BaseStompServerTestCase

from ambari_agent import HeartbeatThread
from ambari_agent.InitializerModule import InitializerModule
from ambari_agent.ComponentStatusExecutor import ComponentStatusExecutor
from ambari_agent.CommandStatusReporter import CommandStatusReporter
from ambari_agent.HostStatusReporter import HostStatusReporter
from ambari_agent.CustomServiceOrchestrator import CustomServiceOrchestrator
from ambari_agent.Utils import Utils

from mock.mock import MagicMock, patch

@patch("socket.gethostbyname", new=MagicMock(return_value="192.168.64.101"))
@patch("ambari_agent.hostname.hostname", new=MagicMock(return_value="c6401.ambari.apache.org"))
class TestAgentStompResponses:#(BaseStompServerTestCase):
  def setUp(self):
    self.maxDiff = None
    self.initializer_module = None

    self.remove_files(['/tmp/cluster_cache/configurations.json', '/tmp/cluster_cache/metadata.json', '/tmp/cluster_cache/topology.json', '/tmp/host_level_params.json', '/tmp/cluster_cache/alert_definitions.json'])

    if not os.path.exists("/tmp/ambari-agent"):
      os.mkdir("/tmp/ambari-agent")

    with open("/tmp/ambari-agent/version", "w") as fp:
      fp.write("2.5.0.0")

    return super(TestAgentStompResponses, self).setUp()

  def tearDown(self):
    if self.initializer_module:
      self.initializer_module.stop_event.set()

    return super(TestAgentStompResponses, self).tearDown()

  @patch.object(CustomServiceOrchestrator, "runCommand")
  def test_mock_server_can_start(self, runCommand_mock):
    runCommand_mock.return_value = {'stdout':'...', 'stderr':'...', 'structuredOut' : '{}', 'exitcode':1}

    self.initializer_module = InitializerModule()
    self.initializer_module.init()

    heartbeat_thread = HeartbeatThread.HeartbeatThread(self.initializer_module)
    heartbeat_thread.start()

    action_queue = self.initializer_module.action_queue
    action_queue.start()
    self.initializer_module.alert_scheduler_handler.start()

    component_status_executor = ComponentStatusExecutor(self.initializer_module)
    component_status_executor.start()

    connect_frame = self.server.frames_queue.get()
    users_subscribe_frame = self.server.frames_queue.get()
    registration_frame = self.server.frames_queue.get()

    # server sends registration response
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '0'}, body=self.get_json("registration_response.json"))
    self.server.topic_manager.send(f)

    # response to /initial_topology
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '1'}, body=self.get_json("topology_create.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '2'}, body=self.get_json("metadata_after_registration.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '3'}, body=self.get_json("configurations_update.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '4'}, body=self.get_json("host_level_params.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '5'}, body=self.get_json("alert_definitions.json"))
    self.server.topic_manager.send(f)

    initial_topology_request = self.server.frames_queue.get()
    initial_metadata_request = self.server.frames_queue.get()
    initial_configs_request = self.server.frames_queue.get()
    initial_host_level_params_request = self.server.frames_queue.get()
    initial_alert_definitions_request = self.server.frames_queue.get()

    while not self.initializer_module.is_registered:
      time.sleep(0.1)

    command_status_reporter = CommandStatusReporter(self.initializer_module)
    command_status_reporter.start()

    host_status_reporter = HostStatusReporter(self.initializer_module)
    host_status_reporter.start()

    f = Frame(frames.MESSAGE, headers={'destination': '/user/commands'}, body=self.get_json("execution_commands.json"))
    self.server.topic_manager.send(f)

    commands_subscribe_frame = self.server.frames_queue.get()
    configurations_subscribe_frame = self.server.frames_queue.get()
    metadata_subscribe_frame = self.server.frames_queue.get()
    topologies_subscribe_frame = self.server.frames_queue.get()
    host_level_params_subscribe_frame = self.server.frames_queue.get()
    alert_definitions_subscribe_frame = self.server.frames_queue.get()
    heartbeat_frame = self.server.frames_queue.get()
    dn_install_in_progress_frame = json.loads(self.server.frames_queue.get().body)
    dn_install_failed_frame = json.loads(self.server.frames_queue.get().body)
    zk_install_in_progress_frame = json.loads(self.server.frames_queue.get().body)
    zk_install_failed_frame = json.loads(self.server.frames_queue.get().body)
    action_status_in_progress_frame = json.loads(self.server.frames_queue.get().body)
    action_status_failed_frame = json.loads(self.server.frames_queue.get().body)
    dn_recovery_in_progress_frame = json.loads(self.server.frames_queue.get().body)
    dn_recovery_failed_frame = json.loads(self.server.frames_queue.get().body)
    host_status_report = json.loads(self.server.frames_queue.get().body)

    self.initializer_module.stop_event.set()

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '6'}, body=json.dumps({'id':'1'}))
    self.server.topic_manager.send(f)

    command_status_reporter.join()
    heartbeat_thread.join()
    component_status_executor.join()
    host_status_reporter.join()
    action_queue.join()

    self.assertTrue('mounts' in host_status_report)
    self.assertEquals(self.initializer_module.topology_cache['0']['hosts'][0]['hostName'], 'c6401.ambari.apache.org')
    self.assertEquals(self.initializer_module.metadata_cache['0']['status_commands_to_run'], ('STATUS',))
    self.assertEquals(self.initializer_module.configurations_cache['0']['configurations']['zoo.cfg']['clientPort'], '2181')
    self.assertEquals(dn_install_in_progress_frame['clusters']['0'][0]['roleCommand'], 'INSTALL')
    self.assertEquals(dn_install_in_progress_frame['clusters']['0'][0]['role'], 'DATANODE')
    self.assertEquals(dn_install_in_progress_frame['clusters']['0'][0]['status'], 'IN_PROGRESS')
    self.assertEquals(dn_install_failed_frame['clusters']['0'][0]['status'], 'FAILED')
    self.assertEquals(dn_recovery_in_progress_frame['clusters']['0'][0]['roleCommand'], 'INSTALL')
    self.assertEquals(dn_recovery_in_progress_frame['clusters']['0'][0]['role'], 'DATANODE')
    self.assertEquals(dn_recovery_in_progress_frame['clusters']['0'][0]['status'], 'IN_PROGRESS')

    #============================================================================================
    #============================================================================================

    self.initializer_module = InitializerModule()
    self.initializer_module.init()

    self.server.frames_queue.queue.clear()

    heartbeat_thread = HeartbeatThread.HeartbeatThread(self.initializer_module)
    heartbeat_thread.start()

    action_queue = self.initializer_module.action_queue
    action_queue.start()
    self.initializer_module.alert_scheduler_handler.start()

    component_status_executor = ComponentStatusExecutor(self.initializer_module)
    component_status_executor.start()

    command_status_reporter = CommandStatusReporter(self.initializer_module)
    command_status_reporter.start()

    host_status_reporter = HostStatusReporter(self.initializer_module)
    host_status_reporter.start()

    connect_frame = self.server.frames_queue.get()
    users_subscribe_frame = self.server.frames_queue.get()
    registration_frame = self.server.frames_queue.get()

    # server sends registration response
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '0'}, body=self.get_json("registration_response.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '1'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '2'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '3'}, body='{"timestamp":1510577217}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '4'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '5'}, body='{}')
    self.server.topic_manager.send(f)

    commands_subscribe_frame = self.server.frames_queue.get()
    configurations_subscribe_frame = self.server.frames_queue.get()
    metadata_subscribe_frame = self.server.frames_queue.get()
    topologies_subscribe_frame = self.server.frames_queue.get()
    heartbeat_frame = self.server.frames_queue.get()
    status_reports_frame = self.server.frames_queue.get()

    self.initializer_module.stop_event.set()

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '6'}, body=json.dumps({'id':'1'}))
    self.server.topic_manager.send(f)

    heartbeat_thread.join()
    component_status_executor.join()
    command_status_reporter.join()
    host_status_reporter.join()
    action_queue.join()

  def test_topology_update_and_delete(self):
    self.initializer_module = InitializerModule()
    self.initializer_module.init()

    heartbeat_thread = HeartbeatThread.HeartbeatThread(self.initializer_module)
    heartbeat_thread.start()

    connect_frame = self.server.frames_queue.get()
    users_subscribe_frame = self.server.frames_queue.get()
    registration_frame = self.server.frames_queue.get()

    # server sends registration response
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '0'}, body=self.get_json("registration_response.json"))
    self.server.topic_manager.send(f)

    # response to /initial_topology
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '1'}, body=self.get_json("topology_create.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '2'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '3'}, body='{"timestamp":1510577217}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '4'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '5'}, body='{}')
    self.server.topic_manager.send(f)

    initial_topology_request = self.server.frames_queue.get()
    initial_metadata_request = self.server.frames_queue.get()
    initial_configs_request = self.server.frames_queue.get()
    initial_host_level_params_request = self.server.frames_queue.get()
    initial_alert_definitions_request = self.server.frames_queue.get()

    while not self.initializer_module.is_registered:
      time.sleep(0.1)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_add_component.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_add_component_host.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_add_host.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_delete_host.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_delete_component.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_delete_component_host.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_delete_cluster.json"))
    self.server.topic_manager.send(f)

    def is_json_equal():
      #json_topology = json.dumps(self.initializer_module.topology_cache, indent=2, sort_keys=True)
      #json_excepted_lopology = json.dumps(self.get_dict_from_file("topology_cache_expected.json"), indent=2, sort_keys=True)
      #print json_topology
      #print json_excepted_lopology
      self.assertDictEqual(Utils.get_mutable_copy(self.initializer_module.topology_cache), self.get_dict_from_file("topology_cache_expected.json"))

    self.assert_with_retries(is_json_equal, tries=160, try_sleep=0.1)

    self.initializer_module.stop_event.set()

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '6'}, body=json.dumps({'id':'1'}))
    self.server.topic_manager.send(f)

    heartbeat_thread.join()

  def test_alert_definitions_update_and_delete(self):
    self.initializer_module = InitializerModule()
    self.initializer_module.init()

    heartbeat_thread = HeartbeatThread.HeartbeatThread(self.initializer_module)
    heartbeat_thread.start()

    connect_frame = self.server.frames_queue.get()
    users_subscribe_frame = self.server.frames_queue.get()
    registration_frame = self.server.frames_queue.get()

    # server sends registration response
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '0'}, body=self.get_json("registration_response.json"))
    self.server.topic_manager.send(f)

    # response to /initial_topology
    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '1'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '2'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '3'}, body='{"timestamp":1510577217}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '4'}, body='{}')
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '5'}, body=self.get_json("alert_definitions_small.json"))
    self.server.topic_manager.send(f)

    initial_topology_request = self.server.frames_queue.get()
    initial_metadata_request = self.server.frames_queue.get()
    initial_configs_request = self.server.frames_queue.get()
    initial_host_level_params_request = self.server.frames_queue.get()
    initial_alert_definitions_request = self.server.frames_queue.get()

    while not self.initializer_module.is_registered:
      time.sleep(0.1)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/alert_definitions'}, body=self.get_json("alert_definitions_add.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/alert_definitions'}, body=self.get_json("alert_definitions_edit.json"))
    self.server.topic_manager.send(f)

    f = Frame(frames.MESSAGE, headers={'destination': '/user/alert_definitions'}, body=self.get_json("alert_definitions_delete.json"))
    self.server.topic_manager.send(f)

    def is_json_equal():
      #json_alert_definitions = json.dumps(self.initializer_module.alert_definitions_cache, indent=2, sort_keys=True)
      #json_excepted_definitions = json.dumps(self.get_dict_from_file("alert_definition_expected.json"), indent=2, sort_keys=True)
      #print json_definitions
      #print json_excepted_definitions
      self.assertDictEqual(Utils.get_mutable_copy(self.initializer_module.alert_definitions_cache), self.get_dict_from_file("alert_definition_expected.json"))

    self.assert_with_retries(is_json_equal, tries=160, try_sleep=0.1)

    self.initializer_module.stop_event.set()

    f = Frame(frames.MESSAGE, headers={'destination': '/user/', 'correlationId': '6'}, body=json.dumps({'id':'1'}))
    self.server.topic_manager.send(f)

    heartbeat_thread.join()


text:
module WorldFlags
  module Generators
    class InitGenerator < ::Rails::Generators::Base
      desc "Creates world flags initializer"

      source_root File.dirname(__FILE__) + '/templates'

      def main_flow
        template "world_flags.erb", "config/initializers/world_flags.rb"
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package Template::Plugin::GD::Graph::lines3d;

use strict;
use warnings;
use base qw( GD::Graph::lines3d Template::Plugin );

our $VERSION = sprintf("%d.%02d", q$Revision: 1.58 $ =~ /(\d+)\.(\d+)/);

sub new {
    my $class   = shift;
    my $context = shift;
    return $class->SUPER::new(@_);
}

sub set {
    my $self = shift;
    push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
    $self->SUPER::set(@_);
}

sub set_legend {
    my $self = shift;
    $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_);
}

1;

__END__

=head1 NAME

Template::Plugin::GD::Graph::lines3d - Create 3D line graphs with axes and legends

=head1 SYNOPSIS

    [% USE g = GD.Graph.lines3d(x_size, y_size); %]

=head1 EXAMPLES

    [% FILTER null;
        data = [
            ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
                                         "Sep", "Oct", "Nov", "Dec", ],
            [-5, -4, -3, -3, -1,  0,  2,  1,  3,  4,  6,  7],
            [4,   3,  5,  6,  3,1.5, -1, -3, -4, -6, -7, -8],
            [1,   2,  2,  3,  4,  3,  1, -1,  0,  2,  3,  2],
        ];

        USE my_graph = GD.Graph.lines3d();

        my_graph.set(
                x_label => 'Month',
                y_label => 'Measure of success',
                title => 'A 3d Line Graph',

                y_max_value => 8,
                y_min_value => -8,
                y_tick_number => 16,
                y_label_skip => 2,
                box_axis => 0,
                line_width => 3,
                zero_axis_only => 1,
                x_label_position => 1,
                y_label_position => 1,

                x_label_skip => 3,
                x_tick_offset => 2,

                transparent => 0,
        );
        my_graph.set_legend("Us", "Them", "Others");
        my_graph.plot(data).png | stdout(1);
       END;
    -%]

=head1 DESCRIPTION

The GD.Graph.lines3d plugin provides an interface to the GD::Graph::lines3d
class defined by the GD::Graph3d module. It allows one or more (x,y) data
sets to be plotted as y versus x lines with a 3-dimensional appearance,
together with axes and legends.

See L<GD::Graph3d> for more details.

=head1 AUTHOR

Thomas Boutell wrote the GD graphics library.

Lincoln D. Stein wrote the Perl GD modules that interface to it.

Martien Verbruggen wrote the GD::Graph module.

Craig Barratt E<lt>craig@arraycomm.comE<gt> wrote the original GD
plugins for the Template Toolkit (2001).

Andy Wardley E<lt>abw@cpan.orgE<gt> extracted them from the TT core
into a separate distribution for TT version 2.15.

=head1 COPYRIGHT

Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>,
2006 Andy Wardley E<lt>abw@cpan.orgE<gt>.

GD::Graph3d is copyright (C) 1999,2000 Wadsack-Allen. All Rights Reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

L<Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d>, L<GD>

=cut

# Local Variables:
# mode: perl
# perl-indent-level: 4
# indent-tabs-mode: nil
# End:
#
# vim: expandtab shiftwidth=4:


text:
<?php

namespace Lug\Bundle\TranslationBundle\EventSubscriber;

use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Lug\Bundle\ResourceBundle\Util\ClassUtils;
use Lug\Component\Registry\Model\RegistryInterface;
use Lug\Component\Resource\Factory\FactoryInterface;
use Lug\Component\Resource\Model\ResourceInterface;
use Lug\Component\Translation\Context\LocaleContextInterface;
use Lug\Component\Translation\Model\TranslatableInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * @author GeLo <geloen.eric@gmail.com>
 */
class TranslatableResourceSubscriber implements EventSubscriber
{
    /**
     * @var ContainerInterface
     */
    private $container;

    /**
     * @param ContainerInterface $container
     */
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    /**
     * @param LifecycleEventArgs $event
     */
    public function postLoad(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if (!$entity instanceof TranslatableInterface) {
            return;
        }

        $localeContext = $this->getLocaleContext();
        $resource = $this->getResource(ClassUtils::getClass($entity));
        $translationFactory = $this->getTranslationFactory($resource->getRelation('translation')->getName());

        $entity->setLocales($localeContext->getLocales());
        $entity->setFallbackLocale($localeContext->getFallbackLocale());
        $entity->setTranslationFactory($translationFactory);
    }

    /**
     * {@inheritdoc}
     */
    public function getSubscribedEvents()
    {
        return [Events::postLoad];
    }

    /**
     * @param string $class
     *
     * @return ResourceInterface|null
     */
    private function getResource($class)
    {
        foreach ($this->getResourceRegistry() as $resource) {
            if ($resource->getModel() === $class) {
                return $resource;
            }
        }
    }

    /**
     * @param string $resource
     *
     * @return FactoryInterface
     */
    private function getTranslationFactory($resource)
    {
        $factoryRegistry = $this->container->get('lug.resource.registry.factory');

        return $factoryRegistry[$resource];
    }

    /**
     * @return LocaleContextInterface
     */
    private function getLocaleContext()
    {
        return $this->container->get('lug.translation.context.locale');
    }

    /**
     * @return RegistryInterface
     */
    private function getResourceRegistry()
    {
        return $this->container->get('lug.resource.registry');
    }
}


text:
namespace Microsoft.Azure.Management.EventHub.Models
{
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// The Application Group object
    /// </summary>
    [Rest.Serialization.JsonTransformation]
    public partial class ApplicationGroup : ProxyResource
    {
        /// <summary>
        /// Initializes a new instance of the ApplicationGroup class.
        /// </summary>
        public ApplicationGroup()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the ApplicationGroup class.
        /// </summary>
        /// <param name="clientAppGroupIdentifier">The Unique identifier for
        /// application group.Supports SAS(SASKeyName=KeyName) or
        /// AAD(AADAppID=Guid)</param>
        /// <param name="id">Fully qualified resource ID for the resource. Ex -
        /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}</param>
        /// <param name="name">The name of the resource</param>
        /// <param name="type">The type of the resource. E.g.
        /// "Microsoft.EventHub/Namespaces" or
        /// "Microsoft.EventHub/Namespaces/EventHubs"</param>
        /// <param name="location">The geo-location where the resource
        /// lives</param>
        /// <param name="isEnabled">Determines if Application Group is allowed
        /// to create connection with namespace or not. Once the isEnabled is
        /// set to false, all the existing connections of application group
        /// gets dropped and no new connections will be allowed</param>
        /// <param name="policies">List of group policies that define the
        /// behavior of application group. The policies can support resource
        /// governance scenarios such as limiting ingress or egress
        /// traffic.</param>
        /// <param name="systemData">The system meta data relating to this
        /// resource.</param>
        public ApplicationGroup(string clientAppGroupIdentifier, string id = default(string), string name = default(string), string type = default(string), string location = default(string), bool? isEnabled = default(bool?), IList<ApplicationGroupPolicy> policies = default(IList<ApplicationGroupPolicy>), SystemData systemData = default(SystemData))
            : base(id, name, type, location)
        {
            IsEnabled = isEnabled;
            ClientAppGroupIdentifier = clientAppGroupIdentifier;
            Policies = policies;
            SystemData = systemData;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets determines if Application Group is allowed to create
        /// connection with namespace or not. Once the isEnabled is set to
        /// false, all the existing connections of application group gets
        /// dropped and no new connections will be allowed
        /// </summary>
        [JsonProperty(PropertyName = "properties.isEnabled")]
        public bool? IsEnabled { get; set; }

        /// <summary>
        /// Gets or sets the Unique identifier for application group.Supports
        /// SAS(SASKeyName=KeyName) or AAD(AADAppID=Guid)
        /// </summary>
        [JsonProperty(PropertyName = "properties.clientAppGroupIdentifier")]
        public string ClientAppGroupIdentifier { get; set; }

        /// <summary>
        /// Gets or sets list of group policies that define the behavior of
        /// application group. The policies can support resource governance
        /// scenarios such as limiting ingress or egress traffic.
        /// </summary>
        [JsonProperty(PropertyName = "properties.policies")]
        public IList<ApplicationGroupPolicy> Policies { get; set; }

        /// <summary>
        /// Gets the system meta data relating to this resource.
        /// </summary>
        [JsonProperty(PropertyName = "systemData")]
        public SystemData SystemData { get; private set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (ClientAppGroupIdentifier == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "ClientAppGroupIdentifier");
            }
            if (Policies != null)
            {
                foreach (var element in Policies)
                {
                    if (element != null)
                    {
                        element.Validate();
                    }
                }
            }
        }
    }
}


text:
<!DOCTYPE html>

		<meta charset="UTF-8">
		<title>Champlain Coffee Shop - Menu</title>
		<link rel="stylesheet" href="./main.css" />

Champlain Coffee House

			Home
			Menu
			Music

Just Java

					  Regular house blend, decaffeinated coffee, or flavour of the day.

					  Endless Cup $2.00

Cafe au lait

					  House blended coffee infused into a smooth, steamed milk.

					  Single $2.00 Double $4.00

Iced cappuccino

					  Sweetened espresso blended with icy-cold milk served in chilled glass.

					  $4.75

© Copyright 2016, Champlain Coffee House

			artem@batutin.com


text:
Jeopardy Game with a Mobile and HTML Front-end for the animator

## Projects breakdown

 - Web Service : This will handle all the game data, so you will call this service to ask a question, attribute points... etc

 - Jeopardy Interface : Here, we need to do a simple interface to show on a projector or a big screen for the crowd.

      - Show the question board, with question and categories

      - Show the current asked question with the team, maybe implement a little timer and play the classic jeopardy song

      - Show each teams score

 - Mobile (Android apps)

      - Show the current game information by fetching data from the web service

      - Can ask a question to a team, and show the answer

      - Choose if the answer was valid (and add points) or ask to another team

 - Web Interface

      - Javascript mostly

      - I'm using this interface to this the web service at the moment, this will does the same things as the Mobile Apps

### To Do

  - Ask to another team (web interface and web service)
  - Ask a question from the web interface (choose category and points value)
  - Add points to a team (by drinking beers mostly)
  - Better game file, game1.txt is only for test purpose at the moment
  - Current Game State saving, in case of a fatal crash
  - Game Interface (PyGame maybe, because GUI Interface with widget will not be revelant)
  - Game Status (Web service funcs and web interface controls)


text:
{% assign chars_per_minute = page.chars_per_minute | default: site.chars_per_minute | default: 600 %}
{%- assign min_read = site.data.text[site.locale].min_read | default: 'min read' -%}

{% if entry %}
  {% assign chars = entry.content | strip_html | size %}
{% else %}
  {% assign chars = page.content | strip_html | size %}
{% endif %}

<span class="read-time">
  {%- if chars < chars_per_minute -%}
    ~1 {{ min_read }}
  {%- else -%}
    {{ chars | divided_by:chars_per_minute }} {{ min_read }}
  {%- endif -%}
</span>


text:
require 'spec_helper'

describe Behave::Lockable do
  class Document
    include Behave
  end

  class LockableDocument < Document
    lockable
  end

  class Locker
    include Behave
  end

  def mock_locker(stubs = {})
    @mock_locker ||= mock(Locker, stubs)
  end

  it "should be included with Behave mixin" do
    Document.respond_to?(:lockable?, true).should be true
  end

  it "should not include the lockable behavior" do
    Document.send(:lockable?).should be false
  end

  describe "#lockable" do
    it "should include the lockable behavior" do
      LockableDocument.send(:lockable?).should be true
    end

    it "should define #locked class method" do
      LockableDocument.should respond_to :locked
    end

    it "should define #locked_by class method" do
      LockableDocument.should respond_to :locked_by
    end

    it "should define #locked instance method" do
      LockableDocument.new.should respond_to :locked
      LockableDocument.new.should respond_to :locked=
    end

    it "should define #locked_at instance method" do
      LockableDocument.new.should respond_to :locked_at
      LockableDocument.new.should respond_to :locked_at=
    end

    it "should define #locked_by instance method" do
      LockableDocument.new.should respond_to :locked_by
      LockableDocument.new.should respond_to :locked_by=
    end
  end

  describe "#locked" do
    it "should return a criteria for selecting locked documents" do
      LockableDocument.locked.selector[:locked].should be true
    end
  end

  describe "#locked_by" do
    before :each do
      mock_locker.stub(:class).and_return(Locker)
      mock_locker.stub(:id).and_return(42)
    end

    it "should return a criteria for selecting locked documents locked by a specific locker" do
      selector = LockableDocument.locked_by(mock_locker).selector

      selector[:locked].should be true
      selector['locked_by._type'].should == 'Locker'
      selector['locked_by._id'].should be 42
    end
  end

  describe "locking a document" do
    before :each do
      @document = LockableDocument.create

      mock_locker.stub(:class).and_return(Locker)
      mock_locker.stub(:id).and_return(42)
    end

    after :each do
      @document.destroy
    end

    describe "when unlocked" do
      it "should mark the document as locked" do
        lambda do
          @document.lock(mock_locker)
        end.should change(@document, :locked).from(false).to(true)
      end

      it "should record the time at which the document was locked" do
        time_now = Time.now

        Time.stub!(:now).and_return(time_now)

        @document.lock(mock_locker)
        @document.locked_at.to_s.should == time_now.utc.to_s
      end

      it "should record the locker of the document" do
        Locker.stub!(:find).with(42).and_return(mock_locker)

        @document.lock(mock_locker)
        @document.locked_by.should be mock_locker
      end

      it "should succeed" do
        @document.lock(mock_locker).should be true
      end
    end

    describe "when locked by the locker" do
      before :each do
        @document.lock(mock_locker)
      end

      it "should update the time at which the document was locked" do
        time_now = Time.now

        Time.stub!(:now).and_return(time_now)

        @document.lock(mock_locker)
        @document.locked_at.to_s.should == time_now.utc.to_s
      end

      it "should succeed" do
        @document.lock(mock_locker).should be true
      end
    end

    describe "when locked" do
      before :each do
        @document.lock(mock(Locker, :class => Locker, :id => 37))
      end

      it "should fail" do
        @document.lock(mock_locker).should be false
      end
    end
  end

  describe "unlocking a document" do
    before :each do
      @document = LockableDocument.create

      mock_locker.stub(:class).and_return(Locker)
      mock_locker.stub(:id).and_return(42)
    end

    after :each do
      @document.destroy
    end

    describe "when locked by locker" do
      before :each do
        @document.lock(mock_locker)
      end

      it "should mark the document as unlocked" do
        lambda do
          @document.unlock(mock_locker)
        end.should change(@document, :locked).from(true).to(false)
      end

      it "should succeed" do
        @document.unlock(mock_locker).should be true
      end
    end

    describe "when not locked by locker" do
      before :each do
        @document.lock(mock(Locker, :class => Locker, :id => 37))
      end

      it "should fail" do
        @document.unlock(mock_locker).should be false
      end
    end

    describe "when not locked" do
      it "should succeed" do
        @document.unlock(mock_locker).should be true
      end
    end
  end
end


text:
using System;
namespace Enigma.Binary.Converters
{
    public class BinaryConverterByte : IBinaryConverter<Byte>
    {
        public Byte Convert(byte[] value)
        {
            if (value == null) throw new ArgumentNullException("value");
            return Convert(value, 0, value.Length);
        }

        public Byte Convert(byte[] value, int startIndex)
        {
            if (value == null) throw new ArgumentNullException("value");
            return value[startIndex];
        }

        public Byte Convert(byte[] value, int startIndex, int length)
        {
            return Convert(value, startIndex);
        }

        public byte[] Convert(Byte value)
        {
            return new byte[] { value };
        }

        object IBinaryConverter.Convert(byte[] value)
        {
            if (value == null) throw new ArgumentNullException("value");
            return Convert(value, 0, value.Length);
        }

        object IBinaryConverter.Convert(byte[] value, int startIndex)
        {
            if (value == null) throw new ArgumentNullException("value");
            return Convert(value, startIndex, value.Length - startIndex);
        }

        object IBinaryConverter.Convert(byte[] value, int startIndex, int length)
        {
            return Convert(value, startIndex, length);
        }

        byte[] IBinaryConverter.Convert(object value)
        {
            return Convert((byte)value);
        }

        public void Convert(Byte value, byte[] buffer)
        {
            Convert(value, buffer, 0);
        }

        public void Convert(Byte value, byte[] buffer, int offset)
        {
            if (buffer == null) throw new ArgumentNullException("buffer");
            if (buffer.Length < offset + 1)
                throw new BufferOverflowException("The buffer can not contain the value");
            buffer[offset] = value;
        }

        public void Convert(object value, byte[] buffer)
        {
            Convert((Byte)value, buffer, 0);
        }

        public void Convert(object value, byte[] buffer, int offset)
        {
            Convert((Byte)value, buffer, offset);
        }

    }
}


text:
package org.apache.spark.sql

import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.plans.logical.{UnaryNode, _}
import org.apache.spark.sql.hive.{HiveContext, HiveSessionCatalog}
import org.apache.spark.sql.optimizer.CarbonDecoderRelation
import org.apache.spark.sql.types.{StringType, TimestampType}

import org.apache.carbondata.spark.CarbonAliasDecoderRelation

case class CarbonDictionaryCatalystDecoder(
    relations: Seq[CarbonDecoderRelation],
    profile: CarbonProfile,
    aliasMap: CarbonAliasDecoderRelation,
    isOuter: Boolean,
    child: LogicalPlan) extends UnaryNode {
  // the output should be updated with converted datatype, it is need for limit+sort plan.
  override val output: Seq[Attribute] =
    CarbonDictionaryDecoder.convertOutput(child.output, relations, profile, aliasMap)
}

abstract class CarbonProfile(attributes: Seq[Attribute]) extends Serializable {
  def isEmpty: Boolean = attributes.isEmpty
}

case class IncludeProfile(attributes: Seq[Attribute]) extends CarbonProfile(attributes)

case class ExcludeProfile(attributes: Seq[Attribute]) extends CarbonProfile(attributes)

object getDB {

  def getDatabaseName(dbName: Option[String], sparkSession: SparkSession): String = {
    dbName.getOrElse(
      sparkSession.sessionState.catalog.asInstanceOf[HiveSessionCatalog].getCurrentDatabase)
  }
}

/**
 * Shows Loads in a table
 */
case class ShowLoadsCommand(databaseNameOp: Option[String], table: String, limit: Option[String])
  extends Command {

  override def output: Seq[Attribute] = {
    Seq(AttributeReference("SegmentSequenceId", StringType, nullable = false)(),
      AttributeReference("Status", StringType, nullable = false)(),
      AttributeReference("Load Start Time", TimestampType, nullable = false)(),
      AttributeReference("Load End Time", TimestampType, nullable = false)())
  }
}

/**
 * Describe formatted for hive table
 */
case class DescribeFormattedCommand(sql: String, tblIdentifier: TableIdentifier) extends Command {

  override def output: Seq[AttributeReference] =
    Seq(AttributeReference("result", StringType, nullable = false)())
}


text:
import React from 'react';
import Dropdown from 'antd/lib/dropdown';
import Menu from 'antd/lib/menu';
import Tooltip from 'antd/lib/tooltip';
import './styles.css';

const MoreOptions = ({commentId, activeUserId, authorId, handleCommentOptionsClick}) =>{

  const options = () =>{
    if(activeUserId === authorId) return (
        <Menu.Item key="delete" commentId={commentId}>Delete</Menu.Item>
    );
    else return (
        <Menu.Item key="flag" commentId={commentId}>Flag</Menu.Item>
    )
  };

  const menu = (
      <Menu onClick={(e) => handleCommentOptionsClick(e)}>
        {options()}
      </Menu>
  );
  return (
      <Tooltip title="More options" placement="topRight" arrowPointAtCenter>
        <Dropdown overlay={menu} placement="bottomCenter" trigger={['click']}>

        </Dropdown>
      </Tooltip>
  )
};

export default MoreOptions;


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="images/favicon.ico">

    <title>GSC Brasil - Educação Corporativa</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/carousel.css" rel="stylesheet">
    <link href="css/gsc.css" rel="stylesheet">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                Toggle navigation

              </button>

Home

Empresa

Consultores

Clientes

Parcerias

Imprensa

                  Inscreva-se

Inscrição Online

Cursos in-company

Contato

Agenda

            1º semestre
            2º semestre

Cursos

            Recursos Humanos8
            Logística & Transportes12
            Gestão de Negócios2
            Marketing & Vendas4
            Administrativo5
            Financeiro16
            Setor Público8
            Gestão Empresarial7
            Infra-estrutura7
            Tecnologia da Informação6
            Gestão Ambiental3
            Secretariado4

Reformar ou Substituir Veículos

                   Consultor Responsável: Mario Ievenes

                   Carga horária: 8 horas

Objetivo

                  Capacitar os participantes com instrumental técnico para a busca da excelência na gestão de frotas, especificamente quanto a decisão sobre reformar ou substituir a frota, sob os aspectos operacionais, polêticos e financeiros que estão envolvidos nesta decisão.

Introdução

A decisão de reformar ou substituir

Vida útil operacional

Vida útil econômica

Controles operacionais e financeiros

Despesas e custos operacionais

Despesas X Receitas

O apoio da engenharia econômica

O apoio da análise gráfica

Depreciação

Conceito contábil

Conceito operacional

Análise numérica

Análise gráfica

Remuneração de Capital

Análise numérica

Análise gráfica

Manutenção

Manutenção preventiva, corretiva, acidentes, reformas

Execução com recursos próprios ou contratados

Indicadores de desempenho

Análise numérica

Análise gráfica

Custo médio de manutenção

Índice de imobilização em oficina

Perda de produção

Qualidade

Custos da imobilização

Análise numérica

Análise gráfica

Outros fatores

Fatores políticos

Fatores de marketing

Fatores operacionais

Custos da ociosidade da frota

Controle sobre o uso dos veículos

Custo médio

Método custo médio unitário

Método custo médio mínimo

Modelos matemáticos

Ponto econômico de substituição

Modelos matemáticos

Avaliação gráfica

Avaliação económica

Modelos matemáticos

Avaliação gráfica

Política de renovação

Plano de substituição

Operacionalização dos planos e políticas

© 2014 GSC Brasil LTDA · Sobre · Contato


text:
import json

from pyethapp.jsonrpc import address_decoder

from raiden.channel import (
    BalanceProof,
    Channel,
    ChannelEndState,
    ChannelExternalState,
)
from raiden.api.objects import ChannelList
from raiden.api.v1.encoding import (
    ChannelSchema,
    ChannelListSchema
)
from raiden.transfer.state import (
    CHANNEL_STATE_OPENED,
    CHANNEL_STATE_CLOSED,
    CHANNEL_STATE_SETTLED,
)
from raiden.utils import pex, isaddress
from raiden.exceptions import InvalidAddress, InvalidSettleTimeout
from raiden.constants import NETTINGCHANNEL_SETTLE_TIMEOUT_MIN
from raiden.tests.utils.factories import make_address

class NettingChannelMock(object):

    def __init__(self, channel_address):
        self.address = channel_address
        self.state = CHANNEL_STATE_OPENED

    # pylint: disable=no-self-use
    def opened(self):
        return self.state == CHANNEL_STATE_OPENED

    def closed(self):
        return self.state == CHANNEL_STATE_CLOSED or self.state == CHANNEL_STATE_SETTLED

class ConnectionManagerMock(object):
    def __init__(self, token_address, funds):
        self.token_address = token_address
        self.funds = funds
        self.sum_deposits = funds
        self.open_channels = []

class ApiTestContext():

    def __init__(self, reveal_timeout):
        self.events = list()
        self.channels = []
        self.tokens = set()
        self.channel_schema = ChannelSchema()
        self.channel_list_schema = ChannelListSchema()
        self.reveal_timeout = reveal_timeout
        self.tokens_to_manager_address = dict()
        self.connection_managers = []

    def add_events(self, events):
        self.events += events

    def specify_token_for_channelnew(self, token_address):
        """Since it's not part of the event but part of the querying and we
        mock the interface we should check that the token address properly makes
        it through the REST api"""
        self.token_for_channelnew = address_decoder(token_address)

    def specify_channel_for_events(self, channel_address):
        """Since it's not part of the event but part of the querying and we
        mock the interface we should check that the channel address properly
        makes it through the REST api"""
        self.channel_for_events = address_decoder(channel_address)

    def specify_tokenswap_input(self, tokenswap_input, target_address, identifier):
        """We don't test the actual tokenswap but only that the input makes it
        to the backend in the expected format"""
        self.tokenswap_input = dict(tokenswap_input)
        self.tokenswap_input['sending_token'] = address_decoder(
            self.tokenswap_input['sending_token']
        )
        self.tokenswap_input['receiving_token'] = address_decoder(
            self.tokenswap_input['receiving_token']
        )
        self.tokenswap_input['identifier'] = identifier
        self.tokenswap_input['target_address'] = address_decoder(target_address)

    def get_network_events(self, from_block, to_block):
        return_list = list()
        for event in self.events:
            expected_event_type = event['_event_type'] == 'TokenAdded'
            in_block_range = (
                event['block_number'] >= from_block and
                event['block_number'] <= to_block
            )
            if expected_event_type and in_block_range:
                return_list.append(event)

        return return_list

    def get_token_network_events(self, token_address, from_block, to_block):
        return_list = list()
        if token_address != self.token_for_channelnew:
            raise ValueError(
                'Unexpected token address: "{}"  during channelnew '
                'query'.format(pex(token_address))
            )
        for event in self.events:
            expected_event_type = event['_event_type'] == 'ChannelNew'
            in_block_range = (
                event['block_number'] >= from_block and
                event['block_number'] <= to_block
            )
            if expected_event_type and in_block_range:
                return_list.append(event)

        return return_list

    def get_channel_events(self, channel_address, from_block, to_block):
        return_list = list()
        if channel_address != self.channel_for_events:
            raise ValueError(
                'Unexpected channel address: "{}"  during channel events '
                'query'.format(pex(channel_address))
            )

        for event in self.events:
            is_channel_event = (
                event['_event_type'] == 'ChannelNewBalance' or
                event['_event_type'] == 'ChannelClosed' or
                event['_event_type'] == 'TransferUpdated' or
                event['_event_type'] == 'ChannelSettled' or
                event['_event_type'] == 'ChannelSecretRevealed'
            )
            in_block_range = (
                event['block_number'] >= from_block and
                event['block_number'] <= to_block
            )
            if is_channel_event and in_block_range:
                return_list.append(event)

        return return_list

    def make_channel(
            self,
            token_address=make_address(),
            partner_address=make_address(),
            reveal_timeout=20,
            settle_timeout=800,
            balance=0,
            block_number=1):

        our_address = make_address()
        our_balance = balance
        partner_balance = balance
        our_state = ChannelEndState(
            our_address,
            our_balance,
            BalanceProof(None),
        )
        partner_state = ChannelEndState(
            partner_address,
            partner_balance,
            BalanceProof(None),
        )

        channel_for_hashlock = list()
        netting_channel = NettingChannelMock(make_address())
        external_state = ChannelExternalState(
            lambda *args: channel_for_hashlock.append(args),
            netting_channel,
        )
        self.tokens.add(token_address)
        return Channel(
            our_state,
            partner_state,
            external_state,
            token_address,
            reveal_timeout,
            settle_timeout,
        )

    def register_token(self, token_address):
        self.tokens.add(token_address)
        manager_address = make_address()
        self.tokens_to_manager_address[token_address] = manager_address
        return manager_address

    def manager_address_if_token_registered(self, token_address):
        if token_address not in self.tokens:
            return None

        return self.tokens_to_manager_address[token_address]

    def make_channel_and_add(self):
        channel = self.make_channel()
        self.channels.append(channel)

    def find_channel(self, token_address, partner_address):
        for channel in self.channels:
            if (channel.token_address == token_address and
                    channel.partner_state.address == partner_address):
                return channel

        raise ValueError("Could not find channel")

    def find_channel_by_address(self, channel_address):
        for channel in self.channels:
            if channel.channel_address == channel_address:
                return channel

        raise ValueError("Could not find channel")

    def query_channels(self, token_address=None, partner_address=None):
        if not token_address:
            return self.channels

        new_list = []
        for channel in self.channels:
            if channel.token_address == token_address:
                new_list.append(channel)

        return new_list

    def query_tokens(self):
        return list(self.tokens)

    def expect_channels(self):
        channel_list = ChannelList(self.channels)
        return json.loads(self.channel_list_schema.dumps(channel_list).data)

    def open_channel(
            self,
            token_address,
            partner_address,
            settle_timeout=None,
            reveal_timeout=None):

        if settle_timeout < NETTINGCHANNEL_SETTLE_TIMEOUT_MIN:
            raise InvalidSettleTimeout('Configured minimum `settle_timeout` is {} blocks.'.format(
                NETTINGCHANNEL_SETTLE_TIMEOUT_MIN
            ))

        if not isaddress(token_address):
            raise InvalidAddress('Expected binary address format for token in channel open')

        if not isaddress(partner_address):
            raise InvalidAddress('Expected binary address format for partner in channel open')

        reveal_value = reveal_timeout if reveal_timeout is not None else self.reveal_timeout
        channel = self.make_channel(
            token_address=token_address,
            partner_address=partner_address,
            settle_timeout=settle_timeout,
            reveal_timeout=reveal_value
        )
        self.channels.append(channel)
        return channel

    def deposit(self, token_address, partner_address, amount):
        channel = self.find_channel(token_address, partner_address)
        channel.our_state.contract_balance += amount
        return channel

    def close(self, token_address, partner_address):
        channel = self.find_channel(token_address, partner_address)
        channel.external_state.netting_channel.state = CHANNEL_STATE_CLOSED
        channel.external_state._closed_block = 1
        return channel

    def settle(self, token_address, partner_address):
        channel = self.find_channel(token_address, partner_address)
        channel.external_state.netting_channel.state = CHANNEL_STATE_SETTLED
        channel.external_state._settled_block = 1
        return channel

    def get_channel(self, channel_address):
        return self.find_channel_by_address(channel_address)

    def _check_tokenswap_input(self, argname, input_argname, kwargs):
        if kwargs[argname] != self.tokenswap_input[input_argname]:
            raise ValueError(
                'Expected "{}" for {} but got "{}"'.format(
                    self.tokenswap_input[input_argname],
                    input_argname,
                    kwargs[argname])
            )

    def token_swap(self, **kwargs):
        self._check_tokenswap_input('maker_token', 'sending_token', kwargs)
        self._check_tokenswap_input('maker_amount', 'sending_amount', kwargs)
        self._check_tokenswap_input('taker_token', 'receiving_token', kwargs)
        self._check_tokenswap_input('taker_amount', 'receiving_amount', kwargs)

    def expect_token_swap(self, **kwargs):
        self._check_tokenswap_input('identifier', 'identifier', kwargs)
        self._check_tokenswap_input('maker_token', 'receiving_token', kwargs)
        self._check_tokenswap_input('maker_amount', 'receiving_amount', kwargs)
        self._check_tokenswap_input('taker_token', 'sending_token', kwargs)
        self._check_tokenswap_input('taker_amount', 'sending_amount', kwargs)

    def transfer(self, token_address, amount, target, identifier):
        # Do nothing. These tests only test the api endpoints, so nothing to do here
        pass

    def connect(
            self,
            token_address,
            funds,
            initial_channel_target,
            joinable_funds_target):

        if not isaddress(token_address):
            raise InvalidAddress('not an address %s' % pex(token_address))

        funding = int((funds * joinable_funds_target) / initial_channel_target)
        for i in range(0, initial_channel_target):
            channel = self.make_channel(token_address=token_address, balance=funding)
            self.channels.append(channel)

        connection_manager = ConnectionManagerMock(token_address, funds)
        self.connection_managers.append(connection_manager)

    def leave(self, token_address, only_receiving):
        if not isaddress(token_address):
            raise InvalidAddress('not an address %s' % pex(token_address))

        # for the mocking purposes let's just ignore only_receiving_ but keep its
        # value in the mock context for checking
        self.last_only_receiving = only_receiving

        channels = self.get_all_channels_for_token(token_address)
        for channel in channels:
            channel.external_state.netting_channel.state = CHANNEL_STATE_SETTLED
            channel.external_state._settled_block = 1

        return channels

    def get_connection_managers_info(self):
        token_addresses = {}

        for connection_manager in self.connection_managers:
            token_addresses[connection_manager.token_address] = {
                "funds": connection_manager.funds,
                "sum_deposits": connection_manager.sum_deposits,
                "channels": len(connection_manager.open_channels)
            }

        return token_addresses

    def get_all_channels_for_token(self, token_address):
        channels = [channel for channel in self.channels if channel.token_address == token_address]

        if len(channels) > 0:
            return channels
        else:
            raise ValueError("Could not find channel")


text:
import { Component } from '@angular/core';
import { AF } from "../../providers/af";
import { Router } from "@angular/router";
import { NgForm } from '@angular/forms';

@Component({
  selector: 'app-netid-login',
  templateUrl: './netid-login.component.html',
  styleUrls: ['./netid-login.component.css']
})
export class NetIdLoginComponent {
  constructor(public afService: AF, private router: Router) {}
  // professional form handling
  onSubmit(f: NgForm) {
    this.router.navigate(['/home']);
    this.afService.getSchedule(f.value.Username, f.value.Password);
  }
  skipLine() {
    this.router.navigate(['/home']);
    this.afService.getCachedSchedule();
  }
}


text:
import { h, Component } from 'skatejs';
import styles from './KeyboardKeys.scss';
import { css } from '../_helpers/css';

// public
interface KeyboardKeysProps {
}

export class KeyboardKeys extends Component<KeyboardKeysProps> {
  static get is() { return 'bl-keyboard-keys'; }

  renderCallback() {
    const className = css(
      'c-kbd'
    );
    return [
      <style>{styles}</style>,
      <kbd className={className}>
        <slot />
      </kbd>
    ];
  }
}

customElements.define( KeyboardKeys.is, KeyboardKeys );


text:
/*
 * @author: zhifu.wang@renren-inc.com
 */
@unit-test-expecteds {
    0: can not set font-family for ".set-font-family"
    0: can not set font-family for ".set-by-font"
    0: can not set font-family for ".set-by-font-but-no-comma"
    0: can not set font-family for ".set-by-font-but-no-comma-another"
}

.set-font-family {
    font-family: 'arial,sans-serif';
}

.set-by-font {
    font: italic bold 12px/30px Georgia, serif;
}

.set-by-font-but-no-comma {
    font: italic bold 12px/30px Georgia;
}

.set-by-font-but-no-comma-another {
    font: italic bold Georgia;
}


text:
'''
Manage etcd Keys
================

.. versionadded:: 2015.8.0

:depends:  - python-etcd

This state module supports setting and removing keys from etcd.

Configuration
-------------

To work with an etcd server you must configure an etcd profile. The etcd config
can be set in either the Salt Minion configuration file or in pillar:

.. code-block:: yaml

    my_etd_config:
      etcd.host: 127.0.0.1
      etcd.port: 4001

It is technically possible to configure etcd without using a profile, but this
is not considered to be a best practice, especially when multiple etcd servers
or clusters are available.

.. code-block:: yaml

    etcd.host: 127.0.0.1
    etcd.port: 4001

.. note::

    The etcd configuration can also be set in the Salt Master config file,
    but in order to use any etcd configurations defined in the Salt Master
    config, the :conf_master:`pillar_opts` must be set to ``True``.

    Be aware that setting ``pillar_opts`` to ``True`` has security implications
    as this makes all master configuration settings available in all minion's
    pillars.

Available Functions
-------------------

- ``set``

  This will set a value to a key in etcd. Changes will be returned if the key
  has been created or the value of the key has been updated. This
  means you can watch these states for changes.

  .. code-block:: yaml

      /foo/bar/baz:
        etcd.set:
          - value: foo
          - profile: my_etcd_config

- ``wait_set``

  Performs the same functionality as ``set`` but only if a watch requisite is ``True``.

  .. code-block:: yaml

      /some/file.txt:
        file.managed:
          - source: salt://file.txt

      /foo/bar/baz:
        etcd.wait_set:
          - value: foo
          - profile: my_etcd_config
          - watch:
            - file: /some/file.txt

- ``rm``

  This will delete a key from etcd. If the key exists then changes will be
  returned and thus you can watch for changes on the state, if the key does
  not exist then no changes will occur.

  .. code-block:: yaml

      /foo/bar/baz:
        etcd.rm:
          - profile: my_etcd_config

- ``wait_rm``

  Performs the same functionality as ``rm`` but only if a watch requisite is ``True``.

  .. code-block:: yaml

      /some/file.txt:
        file.managed:
          - source: salt://file.txt

      /foo/bar/baz:
        etcd.wait_rm:
          - profile: my_etcd_config
          - watch:
            - file: /some/file.txt
'''

# Import Python Libs
from __future__ import absolute_import

# Define the module's virtual name
__virtualname__ = 'etcd'

# Function aliases
__func_alias__ = {
    'set_': 'set',
    'rm_': 'rm'
}

# Import third party libs
try:
    import salt.utils.etcd_util  # pylint: disable=W0611
    HAS_ETCD = True
except ImportError:
    HAS_ETCD = False

def __virtual__():
    '''
    Only return if python-etcd is installed
    '''

    return __virtualname__ if HAS_ETCD else False

def set_(name, value, profile=None):
    '''
    Set a key in etcd and can be called as ``set``.

    name
        The etcd key name, for example: ``/foo/bar/baz``.
    value
        The value the key should contain.
    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.
    '''

    created = False

    rtn = {
        'name': name,
        'comment': 'Key contains correct value',
        'result': True,
        'changes': {}
    }

    current = __salt__['etcd.get'](name, profile=profile)
    if not current:
        created = True

    result = __salt__['etcd.set'](name, value, profile=profile)

    if result and result != current:
        if created:
            rtn['comment'] = 'New key created'
        else:
            rtn['comment'] = 'Key value updated'
        rtn['changes'] = {
            name: value
        }

    return rtn

def wait_set(name, value, profile=None):
    '''
    Set a key in etcd only if the watch statement calls it. This function is
    also aliased as ``wait_set``.

    name
        The etcd key name, for example: ``/foo/bar/baz``.
    value
        The value the key should contain.
    profile
        The etcd profile to use that has been configured on the Salt Master,
        this is optional and defaults to ``None``.
    '''

    return {
        'name': name,
        'changes': {},
        'result': True,
        'comment': ''
    }

def rm_(name, recurse=False, profile=None):
    '''
    Deletes a key from etcd. This function is also aliased as ``rm``.

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.
    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive delete.
    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.
    '''

    rtn = {
        'name': name,
        'result': True,
        'changes': {}
    }

    if not __salt__['etcd.get'](name, profile=profile):
        rtn['comment'] = 'Key does not exist'
        return rtn

    if __salt__['etcd.rm'](name, recurse=recurse, profile=profile):
        rtn['comment'] = 'Key removed'
        rtn['changes'] = {
            name: 'Deleted'
        }
    else:
        rtn['comment'] = 'Unable to remove key'

    return rtn

def wait_rm(name, recurse=False, profile=None):
    '''
    Deletes a key from etcd only if the watch statement calls it.
    This function is also aliased as ``wait_rm``.

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.
    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive
        delete, see: https://python-etcd.readthedocs.org/en/latest/#delete-a-key.
    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.
    '''

    return {
        'name': name,
        'changes': {},
        'result': True,
        'comment': ''
    }

def mod_watch(name, **kwargs):
    '''
    Execute a etcd function based on a watch call requisite.
    '''

    # Watch to set etcd key
    if kwargs.get('sfun') in ['wait_set_key', 'wait_set']:
        return set_(
            name,
            kwargs.get('value'),
            kwargs.get('profile'))

    # Watch to rm etcd key
    if kwargs.get('sfun') in ['wait_rm_key', 'wait_rm']:
        return rm_(
            name,
            kwargs.get('profile'))

    return {
        'name': name,
        'changes': {},
        'comment': 'etcd.{0[sfun]} does not work with the watch requisite, '
                   'please use etcd.wait_set or etcd.wait_rm'.format(kwargs),
        'result': False
    }


text:
Harmonia
========

[![Build status](https://travis-ci.org/kurisuwhyte/harmonia.png)](https://travis-ci.org/kurisuwhyte/harmonia)

Harmonia is an expressive statically typed language, for writing better and
safer web applications. It heavily borrows from Smalltalk, Scala, Haskell and
Scheme, and compiles down to plain JavaScript.

Do note that the language is not compatible with JavaScript, but we have an FFI
for that ;)

> Please note that the language is still in early alpha stages so PLEASE PLEASE
> PLEASE FOR THE LOVE OF GOD DON'T USE IT FOR PRODUCTION YET else Little Chris
> will get *really* upset at you. You're more than welcome to help hackin' on
> it, though :D

## Hacking on

Have [Leiningen][] ready, [fork the repository][] and bring your best flavour
of Clojure into the table. That's it.

[Leiningen]: http://leiningen.org/
[fork the repository]: https://github.com/kurisuwhyte/harmonia

## Support

  - Use the [Github tracker][] for reporting bugs/requesting features.
  - The [Google Group][] is up for general discussion.
  - Follow [@orphoundation][] on Twitter for quick updates.
  - Check the [Google+ community][] for major updates.

[Github tracker]: https://github.com/kurisuwhyte/harmonia/issues
[Google Group]: https://groups.google.com/group/orphoundation
[@orphoundation]: http://twitter.com/orphoundation
[Google+ community]: https://plus.google.com/communities/102026244049761348627

## Developers

  - Maintainers: [Christina Whyte][] & [Quildreen Motta][]
  - [Contributors](https://github.com/kurisuwhyte/harmonia/contributors)

[Christina Whyte]: https://github.com/kurisuwhyte
[Quildreen Motta]: https://github.com/killdream

## License

MIT/X11. ie.: enjoy it to your heart's and pocket's contents, sir.


text:
TT_TEST_BEGIN(is_nothrow_move_constructible)

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char const volatile>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long const volatile>::value, false);
#endif

#ifdef BOOST_HAS_LONG_LONG

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type const volatile>::value, false);
#endif
#endif

#ifdef BOOST_HAS_MS_INT64

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 const volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 const volatile>::value, false);
#endif
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double const>::value, true);
#ifndef TEST_STD
// unspecified behaviour:
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double volatile>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double const volatile>::value, false);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<void*>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int*const>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf1>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf2>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf3>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mp>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<enum_UDT>::value, true);

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&>::value, false);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&&>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<const int&>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[3][2]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2][4][5][6][3]>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<void>::value, false);
// cases we would like to succeed but can't implement in the language:
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_union_UDT>::value, true, false);
BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_copy_UDT>::value, true, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_assign_UDT>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_construct_UDT>::value, false);

#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_NOEXCEPT)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_move_UDT>::value, true);
#endif

BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<test_abc1>::value, false);

TT_TEST_END


text:
package ca.ulaval.ift6002.sputnik.interfaces.rest.resources.filters;

import ca.ulaval.ift6002.sputnik.applicationservice.shared.persistence.EntityManagerFactoryProvider;
import ca.ulaval.ift6002.sputnik.applicationservice.shared.persistence.EntityManagerProvider;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.servlet.*;
import java.io.IOException;

public class EntityManagerContextFilter implements Filter {

    private EntityManagerFactory entityManagerFactory;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        entityManagerFactory = EntityManagerFactoryProvider.getFactory();
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

        EntityManager entityManager = null;

        try {
            entityManager = entityManagerFactory.createEntityManager();
            EntityManagerProvider.setEntityManager(entityManager);
            chain.doFilter(request, response);
        } finally {
            if (entityManager != null) {
                entityManager.close();
            }
            EntityManagerProvider.clearEntityManager();
        }

    }

    @Override
    public void destroy() {
        entityManagerFactory.close();
    }

}


text:
package org.jretrofit.test.retrofit;

import java.lang.reflect.Method;

import junit.framework.TestCase;

import org.jretrofit.AllMethodsNotImplementedException;

/**
 * @author Ville Peurala
 */
public class AllMethodsNotImplementedExceptionTest extends TestCase {
    public void testToStringWithASingleUnimplementedMethod() throws Exception {
        Method[] methods = new Method[] { Object.class.getMethod("toString",
                (Class<?>[]) null) };
        AllMethodsNotImplementedException exception = new AllMethodsNotImplementedException(
                methods);
        assertEquals("Methods not implemented: toString.", exception.toString());
    }
    public void testToStringWithTwoUnimplementedMethods() throws Exception {
        Method[] methods = new Method[] {
                Object.class.getMethod("toString", (Class<?>[]) null),
                Object.class.getMethod("equals", new Class[] { Object.class }) };
        AllMethodsNotImplementedException exception = new AllMethodsNotImplementedException(
                methods);
        assertEquals("Methods not implemented: toString, equals.", exception
                .toString());
    }

    public void testToStringWithThreeUnimplementedMethods() throws Exception {
        Method[] methods = new Method[] {
                Object.class.getMethod("toString", (Class<?>[]) null),
                Object.class.getMethod("equals", new Class[] { Object.class }),
                Object.class.getMethod("hashCode", (Class<?>[]) null) };
        AllMethodsNotImplementedException exception = new AllMethodsNotImplementedException(
                methods);
        assertEquals("Methods not implemented: toString, equals, hashCode.",
                exception.toString());
    }
}


text:
user: jonas-helfer
name: Jonas Helfer
topicEN: From REST to GraphQL
topicCN: 从 REST 到 GraphQL
company: Meteor Development Group
link: https://github.com/helfer/js-conf-china
file: 10-rest-to-grahql-jonas-helfer.pdf
featured: true
type: presentspeaker
---


text:
static const float wnear_plane_dist = 0.6f;

struct Camera {
	//Perspective Projection matrix
	glm::mat4 screen_from_view;

	//Focal point position
	//@rename pos
	glm::vec3 pos;

	Angles_Rad rotation;
	float rad_max_cam_roll; // For head bob

	glm::vec2 wnear_plane_range;

	//Camera axis
	glm::vec3 axis(fuint iaxis) {
		return glm::row(view_from_world_rotation(), iaxis);
	}

	glm::vec3 get_cursor_dir(const glm::vec2& scr_cur_pos) {
		auto view_cur_pos = glm::vec3(scr_cur_pos * wnear_plane_range, wnear_plane_dist);
		auto view_cur_dir = glm::normalize(view_cur_pos);
		return world_from_view_rotation() * view_cur_dir;
	}

    // Returns the vector that moves extents * fly_speed
	glm::vec3 get_fly_vec(const glm::vec3& extents, float fly_speed, float dt) {
		glm::vec3 flyDir = (axis(0) * extents.x)
			             + (std_axis(1) * extents.y)
			             + (axis(2) * extents.z);
		auto flyLen = glm::length(flyDir);
		if (flyLen > 0.0000005f) {
			return flyDir / flyLen * fly_speed * dt * glm::length(extents);
		}
		return glm::vec3();
	}

	// Returns the vector on the XZ plane that the camera is facing
	glm::vec3 get_walk_dir(const glm::vec2 control_extents) {
		glm::vec2 axis_0_no_pitch(glm::cos(-rotation.y), glm::sin(-rotation.y));
		glm::vec2 axis_2_no_pitch(-glm::sin(-rotation.y), glm::cos(-rotation.y));
		auto walk2 = axis_0_no_pitch * control_extents[0] + axis_2_no_pitch * control_extents[1];
		return glm::normalize(glm::vec3(walk2[0], 0.0f, walk2[1]));
	}

	void rotate(glm::vec2 radRotOffset) {
		rotation.x += radRotOffset.x;
		rotation.y += radRotOffset.y;

		//Clamp X to stop camera looking so far down it becomes upside down
		if (rotation.x > pi * 0.5f) {
			rotation.x = pi * 0.5f;
		} else if (rotation.x < -pi * 0.5f) {
			rotation.x = -pi * 0.5f;
		}

		//Clamp Y to be between -pi and pi
		//don't actually change angular value just the representation
		if (rotation.y > pi) {
			rotation.y -= pi * 2.f;
		} else if (rotation.y < -pi) {
			rotation.y += pi * 2.f;
		}
	}

	// Currently just for camera head bob
	void bank(float rad_rot) {
	    rotation.bank += rad_rot;
		rotation.canonize();
	}

	glm::mat3 view_from_world_rotation() const {
		Angles_Rad negated = rotation;
		fox_for (idim, 3) {
			negated.data[idim] = -negated.data[idim];
		}
		return negated.to_mat3();
	}

	glm::mat3 world_from_view_rotation() const {
		return glm::transpose(view_from_world_rotation());
	}

	//Screen from world transformation matrix / view projection matrix / VP
	glm::mat4 screen_from_world() const {
		return screen_from_view * view_from_world();
	}

	glm::mat4 view_from_world() const {
		glm::mat4 view_from_world_trans;
		fox_for(dim, 3) {
			view_from_world_trans[3][dim] = -pos[dim];
		}
		return rot_mat4_from_mat3(view_from_world_rotation()) * view_from_world_trans;
	}

	//Set the screen_from_view perspective projection matrix
	//Using a given horizontal field of view and a y/x inverted aspect ratio of the screen
	void set_perspective_projection(float fov_x, float aspect_yx) {
		float halfRadFovX = fov_x * 0.5f;
		float tanFov = glm::tan(halfRadFovX);

		//near plane x/y range from -wnear_plane_range to +wnear_plane_range
		wnear_plane_range.x = tanFov * wnear_plane_dist;
		wnear_plane_range.y = wnear_plane_range.x * aspect_yx;

		//Where n = wnear_plane_range, x/yRange = wnear_plane_range.x/y
		//Before w division this results in vectors of
		//[n * x / xRange, n * y / yRange, -n, z]
		screen_from_view[0][0] = wnear_plane_dist / wnear_plane_range.x;
		screen_from_view[1][1] = wnear_plane_dist / wnear_plane_range.y;
		screen_from_view[2][2] = 0.0f; screen_from_view[3][2] = -wnear_plane_dist;
		screen_from_view[2][3] = 1.0f; screen_from_view[3][3] = 0.0f;
		//After w division this results in
		//[n * x / (xRange * z), n * y / (yRange * z), -n / z]

		//Z after clipping is -(wnear_plane_dist / z) which gives us values from -1 to 0
		//This gives better error than -1 to 1 and allows an infite far plane
		//see https://chaosinmotion.blog/2010/09/06/goodbye-far-clipping-plane/
	}
};


text:
module Rusql
  class TypeException < Exception
    def initialize(expected, actual)
      super("Expected: #{expected.name}. Got: #{actual.name}")
    end
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Modern Business - Start Bootstrap Template</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/modern-business.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                    CSE Club

                            Join CSE Club

                                    Member Application

                                    Newsletter Signup

                                    Join IEEE

                                    Join ACM

                            Services

                                    Job Postings

                                    Office Hours

                                    Peer Tutoring

                                    Projects

                                    Workshop Documents

                            Events

                                    Events and Announcements

                                    Events Calendar

                                    Meeting History

                                    Announcement Request

                            Affiliates

                                    IEEE Foothill Section

                                    IEEE

                                    ACM

                                    NSPE

                            About

                                    About CSE Club

                                    Contact Information

                                    History of the Club

Blog Post
                    by Start Bootstrap

Home

Blog Post

 Posted on August 24, 2013 at 9:00 PM

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus, vero, obcaecati, aut, error quam sapiente nemo saepe quibusdam sit excepturi nam quia corporis eligendi eos magni recusandae laborum minus inventore?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, tenetur natus doloremque laborum quos iste ipsum rerum obcaecati impedit odit illo dolorum ab tempora nihil dicta earum fugiat. Temporibus, voluptatibus.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eos, doloribus, dolorem iusto blanditiis unde eius illum consequuntur neque dicta incidunt ullam ea hic porro optio ratione repellat perspiciatis. Enim, iure!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error, nostrum, aliquid, animi, ut quas placeat totam sunt tempora commodi nihil ullam alias modi dicta saepe minima ab quo voluptatem obcaecati?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum, dolor quis. Sunt, ut, explicabo, aliquam tenetur ratione tempore quidem voluptates cupiditate voluptas illo saepe quaerat numquam recusandae? Qui, necessitatibus, est!

Leave a Comment:

                    <form role="form">

                            <textarea class="form-control" rows="3"></textarea>

                        <button type="submit" class="btn btn-primary">Submit</button>
                    </form>

Start Bootstrap
                            August 25, 2014 at 9:30 PM

                        Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

Start Bootstrap
                            August 25, 2014 at 9:30 PM

                        Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

Nested Start Bootstrap
                                    August 25, 2014 at 9:30 PM

                                Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

Blog Search

                        <input type="text" class="form-control">

                            <button class="btn btn-default" type="button"></button>

Blog Categories

Category Name

Category Name

Category Name

Category Name

Category Name

Category Name

Category Name

Category Name

Side Widget Well

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore, perspiciatis adipisci accusamus laudantium odit aliquam repellat tempore quos aspernatur vero.

Copyright © Your Website 2014


text: export*from"./ColorBlindCorrector";export*from"./PostProcessor";


text:
title: Array.prototype.forEach
localeTitle: Array.prototype.forEach
---
## Array.prototype.forEach

El método de matriz 'forEach' se utiliza para iterar a través de cada elemento en una matriz. El método se llama en el objeto de matriz y se pasa una función que se llama en cada elemento de la matriz.

```javascript
var arr = [1, 2, 3, 4, 5];

 arr.forEach(number => console.log(number * 2));

 // 2
 // 4
 // 6
 // 8
 // 10
```

La función de devolución de llamada también puede tomar un segundo parámetro de un índice en caso de que necesite hacer referencia al índice del elemento actual en la matriz.

```javascript
var arr = [1, 2, 3, 4, 5];

 arr.forEach((number, i) => console.log(`${number} is at index ${i}`));

 // '1 is at index 0'
 // '2 is at index 1'
 // '3 is at index 2'
 // '4 is at index 3'
 // '5 is at index 4'
```

#### Más información:

[Artículo de MDN en Array.prototype.forEach ()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)


text:
<!DOCTYPE html>

    <title>데이터 변경 요청 이력</title>

		<link rel="shortcut icon" th:href="@{/images/favicon.ico(cacheVersion=${contentCacheVersion})}">
		<link rel="stylesheet" th:href="@{/css/{lang}/font/font.css(lang=${lang},cacheVersion=${contentCacheVersion})}">
		<link rel="stylesheet" th:href="@{/images/{lang}/icon/glyph/glyphicon.css(lang=${lang},cacheVersion=${contentCacheVersion})}">
		<link rel="stylesheet" th:href="@{/externlib/normalize/normalize.min.css(cacheVersion=${contentCacheVersion})}">
		<link rel="stylesheet" th:href="@{/externlib/jquery-ui-1.12.1/jquery-ui.min.css(cacheVersion=${contentCacheVersion})}">
		<link rel="stylesheet" th:href="@{/css/{lang}/admin-style.css(lang=${lang},cacheVersion=${contentCacheVersion})}">

							<form id="searchForm" th:object="${dataInfoLog}" method="get" th:action="@{/data-log/list}" onsubmit="return searchCheck();">

									<select id="searchWord" name="searchWord" class="selectBoxClass">
										<option value="" th:text="#{select}"></option>
										<option value="data_name" th:text="데이터명"></option>
									</select>
									<select id="searchOption" name="searchOption" class="selectBoxClass">
										<option value="0" th:text="#{search.same}"></option>
										<option value="1" th:text="#{search.include}"></option>
									</select>
									<input type="search" id="searchValue" name="searchValue" class="m" style="float: right;" />

									<input type="text" id="startDate" name="startDate" class="s date" autocomplete="off" />
									~
									<input type="text" id="endDate" name="endDate" class="s date" autocomplete="off" />

									<select id="orderWord" name="orderWord" class="selectBoxClass">
										<option value="" th:text="#{search.basic}"></option>
										<option value="data_name" th:text="데이터명"></option>
										<option value="insert_date" th:text="#{search.insert.date}"></option>
									</select>
									<select id="orderValue" name="orderValue" class="selectBoxClass">
										<option value="" th:text="#{search.basic}"></option>
										<option value="ASC" th:text="#{search.ascending}"></option>
										<option value="DESC" th:text="#{search.descending.order}"></option>
									</select>
									<select id="listCounter" name="listCounter" class="selectBoxClass">
										<option value="10" th:text="#{search.ten.count}"></option>
										<option value="50" th:text="#{search.fifty.count}"></option>
										<option value="100" th:text="#{search.hundred.count}"></option>
									</select>

									<input type="submit" th:value="#{search}" />

							</form>

							<form id="listForm" th:object="${dataInfoLogList}" method="post">
								<input type="hidden" id="checkIds" name="checkIds" value="" />

데이터 변경 이력

									<colgroup>
										<col class="col-checkbox"></col>
										<col class="col-number"></col>
										<col class="col-name"></col>
										<col class="col-name"></col>
										<col class="col-type"></col>
										<col class="col-type"></col>
										<col class="col-type"></col>
										<col class="col-type"></col>
										<col class="col-type"></col>
										<col class="col-date"></col>
									</colgroup>

											<input type="checkbox" id="chkAll" name="chkAll" />

											그룹명
											데이터명
											요청자
											데이터타입
											공개유형
											매핑타입
											변경유형
											변경일

											데이터 변경 이력이 존재하지 않습니다.

												<input type="checkbox" id="dataInfoLogId_${dataInfoLog.dataLogId}" name="dataLogId" th:value="${dataInfoLog.dataLogId}" />

							</form>


text:
Casi clinici

Elenco dei casi clinici. Clicca sulla diagnosi per accedere alla sezione di gestione del singolo caso.

Casi chirurgo

                        Diagnosi
                        Paziente
                        Ultima modifica
                        Stato

                        {{ c.specific_diagnosis_name }}
                        {{ c.patient_obj.lastname }} {{ c.patient_obj.firstname }}
                        {{ c.last_edit_date | date: 'medium'}}
                        {{ c.get_status_display }}

Casi

                        Diagnosi
                        Paziente
                        Ultima modifica
                        Stato

                        {{ c.specific_diagnosis_name }}
                        {{ c.patient_obj.lastname }} {{ c.patient_obj.firstname }}
                        {{ c.last_edit_date | date: 'medium'}}
                        {{ c.get_status_display }}

Casi Osservatore

                        Diagnosi
                        Paziente
                        Ultima modifica
                        Stato

                        {{ c.specific_diagnosis_name }}
                        {{ c.patient_obj.lastname }} {{ c.patient_obj.firstname }}
                        {{ c.last_edit_date | date: 'medium'}}
                        {{ c.get_status_display }}