text:
  > **api restful** mrc (model-route-controller) foi desenhada para gerir 'receitas de culinária' e os seus utilizadores; nesta primeira versão podemos consumir receitas sem estar autenticado, para as restantes funcionalidades será mesmo necessário fazer o registo

  > entre as funcionalidades podemos criar, visualizar, visualizar por id, editar, eliminar tanto **receitas** como **usuários**

# algumas das 'framesworks' | bibliotecas utilizadas

  | nome   | principais funcionalidades |
  | ------ | ------ |
  | [babel](https://babeljs.io/) babel-cli babel-preset-es2015 |  transforma (transpilador) o código ES6 (ECMScript6) para ES5 (versão que a maioria dos browsers dá suporte hoje) |
  | [bcrypt](https://www.npmjs.com/package/bcrypt) | encripta a senha |
  | [body-parser](https://www.npmjs.com/package/body-parser) | converte os dados da entrada/saída em json |
  | [express](http://expressjs.com/) | organiza o código da api para ser executado em nodejs |
  | [express-validator](https://www.npmjs.com/package/express-validator) | valida a entrada de dados na api - ao inserir ou editar dados |
  | [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken) | implementa o processo de autenticação na api |
  | [mongoose](http://mongoosejs.com/index.html) | fornece um conjunto de recursos para que express possa trabalhar com o mongodb |

# requisitos e instalação

#### requisitos
  - nodeJS v4+
    https://nodejs.org/en/

  - mongoDB (com a base de dados **db-culinary-recipes** criada)
    https://www.mongodb.com/

#### instalação

  linha de comandos (windows):
  ```sh
  $ git clone https://github.com/jreimao/api-culinary-recipes.git [Enter]
  $ cd api-culinary-recipes [Enter]
  $ npm install [Enter]
  $ node index.js [Enter]
  ```

  browser:
  ( domínio/nome-api/versão-api/recurso-api/ )
  http://localhost:3000/api-culinary-recipes/v1/

# acessos

  | métodos    | endereços | breve descrição |
  | ------     | ------    | ------          |
  | get        | .../api-culinary-recipes/v1/recipe/       | lista receitas |
  | get        | .../api-culinary-recipes/v1/recipe/:id    | receita com id |
  | **post**   | **.../api-culinary-recipes/v1/recipe/**   | **inserir receita** |
  | **put**    | **.../api-culinary-recipes/v1/recipe/**   | **editar receita** |
  | **delete** | **.../api-culinary-recipes/v1/recipe/**   | **eliminar receita** |
  | **get**    | **.../api-culinary-recipes/v1/user/:id**  | **usuário com id** |
  | post       | .../api-culinary-recipes/v1/user/         | inserir usuário |
  | **post**   | **.../api-culinary-recipes/v1/user/auth** | **autenticar usuário** |
  | **put**    | **.../api-culinary-recipes/v1/user/**     | **editar usuário** |
  | **delete** | **.../api-culinary-recipes/v1/user/**     | **eliminar usuário** |

  **a negrito todos os acessos que necessitam de autenticação**

  **exemplos de respostas da api**:

  http://localhost:3000/api-culinary-recipes/v1
    Bem-vindo a API api-culinary-recipes versao 1

  http://localhost:3000/api-culinary-recipes/v1/recipe
    [
        {
            "_id": "58f782f4e5073921d43eb5b5",
            "title": "creme cenoura",
            "subtitle": "cremoso, fresco e saboraso",
            "cost": "",
            "duration": "20",
            "preparation": "",
            "difficulty": "fácil",
            "__v": 0,
            "video": [ "{'name': 'video1.avi'}",
                "{'name': 'video1.mpeg'}",
                ... ],
            "image": [ "{'name': 'cenouras.png'}",
                "{'name': 'pronto-para-saboriar.jpg'}",
                ... ],
            "ingredients": [ "{'name': 'cenoura'}",
                "{'name': 'gengibre'}",
                ... ]
        }
    ]

  http://localhost:3000/api-culinary-recipes/v1/user/:58f780b994c5261624812cf5
    [
        {
            "_id": "58f780b994c5261624812cf5",
            "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImpvYW8gcmVpbWFvIiwicGFzc3dvcmQiOiIxMjM0NTYiLCJpYXQiOjE0OTI2MTUzNTN9.A4xVEVeg3sREWQp4GD4c8Faiw_JO4zx_hSVYYPEYdBY",
            "password": "$2a$09$dslbnOI.CQ0C/JRoAKGN/.sgKrgbUO4lx98cdBbNyKQjFkN7.o78S",
            "email": "joaoreimao@mail.com",
            "name": "joao reimao",
            "__v": 0
        }
    ]

  # licença
  MIT
  **aplicação gratuita**

  # autor

  ![foto joão reimão](https://avatars2.githubusercontent.com/u/15116081?v=3&s=75 "joão reimão")
  joão reimão | web and mobile programmer | email: jreimao@yahoo.com

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Rgs\CatalogModule\Middleware;

use Novice\Event\GetResponseEvent;
use Novice\Events;

use Symfony\Component\EventDispatcher\EventSubscriberInterface,
	Symfony\Component\EventDispatcher\EventDispatcherInterface,
	Symfony\Component\HttpFoundation\RedirectResponse,
	Symfony\Component\Security\Core\Util\StringUtils;

class UserPortalMiddleware implements EventSubscriberInterface
{

	public function onRequest(GetResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher){
		//do something to control authentication

		$container = $dispatcher->getContainer();

		if(!$container->get('session')->isAuthenticated()){
			$request = $event->getRequest();
			if( $request->headers->has('referer') && !StringUtils::equals($request->headers->get('referer'), $request->getUri())){
				$login_redirect = $request->headers->get('referer');
			}
			else{
				$login_redirect = $request->getRequestUri();
			}

			$event->setResponse(new RedirectResponse($container->get('router')->generate('user_security_login',
								array("redirect" =>  $login_redirect))));
			$container->get('session')->set('security_login_redirect', $login_redirect);
		}

	}

	public static function getSubscribedEvents()
    {
        return array(
            Events::REQUEST => array(array('onRequest', 0, '^/user')),
        );
    }
}


text:
package org.gradle.internal.component.external.model.ivy;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.artifacts.component.ModuleComponentSelector;
import org.gradle.api.capabilities.CapabilitiesMetadata;
import org.gradle.api.internal.artifacts.ivyservice.NamespaceId;
import org.gradle.api.internal.attributes.ImmutableAttributes;
import org.gradle.internal.component.external.descriptor.Artifact;
import org.gradle.internal.component.external.descriptor.Configuration;
import org.gradle.internal.component.external.model.AbstractRealisedModuleComponentResolveMetadata;
import org.gradle.internal.component.external.model.ComponentVariant;
import org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata;
import org.gradle.internal.component.external.model.DefaultModuleComponentSelector;
import org.gradle.internal.component.external.model.ImmutableCapabilities;
import org.gradle.internal.component.external.model.LazyToRealisedModuleComponentResolveMetadataHelper;
import org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata;
import org.gradle.internal.component.external.model.ModuleDependencyMetadata;
import org.gradle.internal.component.external.model.RealisedConfigurationMetadata;
import org.gradle.internal.component.external.model.VariantMetadataRules;
import org.gradle.internal.component.model.ConfigurationMetadata;
import org.gradle.internal.component.model.DependencyMetadata;
import org.gradle.internal.component.model.Exclude;
import org.gradle.internal.component.model.ExcludeMetadata;
import org.gradle.internal.component.model.ModuleSource;

import javax.annotation.Nullable;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * {@link AbstractRealisedModuleComponentResolveMetadata Realised version} of a {@link IvyModuleResolveMetadata}.
 *
 * @see DefaultIvyModuleResolveMetadata
 */
public class RealisedIvyModuleResolveMetadata extends AbstractRealisedModuleComponentResolveMetadata implements IvyModuleResolveMetadata {

    public static RealisedIvyModuleResolveMetadata transform(DefaultIvyModuleResolveMetadata metadata) {
        VariantMetadataRules variantMetadataRules = metadata.getVariantMetadataRules();

        ImmutableList<ImmutableRealisedVariantImpl> variants = LazyToRealisedModuleComponentResolveMetadataHelper.realiseVariants(metadata, variantMetadataRules, metadata.getVariants());

        Map<String, ConfigurationMetadata> configurations = realiseConfigurations(metadata, variantMetadataRules);

        return new RealisedIvyModuleResolveMetadata(metadata, variants, configurations);
    }

    private static Map<String, ConfigurationMetadata> realiseConfigurations(DefaultIvyModuleResolveMetadata metadata, VariantMetadataRules variantMetadataRules) {
        Map<Artifact, ModuleComponentArtifactMetadata> artifacts = new IdentityHashMap<Artifact, ModuleComponentArtifactMetadata>();
        IvyConfigurationHelper configurationHelper = new IvyConfigurationHelper(metadata.getArtifactDefinitions(), artifacts, metadata.getExcludes(), metadata.getDependencies(), metadata.getId());

        Map<String, ConfigurationMetadata> configurations = Maps.newHashMapWithExpectedSize(metadata.getConfigurationNames().size());
        ImmutableMap<String, Configuration> configurationDefinitions = metadata.getConfigurationDefinitions();
        for (String configurationName: metadata.getConfigurationNames()) {
            Configuration configuration = configurationDefinitions.get(configurationName);
            ImmutableSet<String> hierarchy = LazyToRealisedModuleComponentResolveMetadataHelper.constructHierarchy(configuration, configurationDefinitions);

            NameOnlyVariantResolveMetadata variant = new NameOnlyVariantResolveMetadata(configurationName);
            ImmutableAttributes variantAttributes = variantMetadataRules.applyVariantAttributeRules(variant, metadata.getAttributes());

            CapabilitiesMetadata capabilitiesMetadata = variantMetadataRules.applyCapabilitiesRules(variant, ImmutableCapabilities.EMPTY);

            configurations.put(configurationName, createConfiguration(configurationHelper, variantMetadataRules, metadata.getId(), configurationName, configuration.isTransitive(), configuration.isVisible(), hierarchy,
                configurationHelper.filterArtifacts(configurationName, hierarchy), configurationHelper.filterExcludes(hierarchy), variantAttributes, ImmutableCapabilities.of(capabilitiesMetadata.getCapabilities())));
        }
        return configurations;
    }

    private final ImmutableMap<String, Configuration> configurationDefinitions;
    private final ImmutableList<IvyDependencyDescriptor> dependencies;
    private final ImmutableList<Artifact> artifactDefinitions;
    private final ImmutableList<Exclude> excludes;
    private final ImmutableMap<NamespaceId, String> extraAttributes;
    private final DefaultIvyModuleResolveMetadata metadata;
    private final String branch;

    private RealisedIvyModuleResolveMetadata(RealisedIvyModuleResolveMetadata metadata, List<IvyDependencyDescriptor> dependencies, Map<String, ConfigurationMetadata> transformedConfigurations) {
        super(metadata, metadata.getVariants(), transformedConfigurations);
        this.configurationDefinitions = metadata.getConfigurationDefinitions();
        this.branch = metadata.getBranch();
        this.artifactDefinitions = metadata.getArtifactDefinitions();
        this.dependencies = ImmutableList.copyOf(dependencies);
        this.excludes = metadata.getExcludes();
        this.extraAttributes = metadata.getExtraAttributes();
        this.metadata = metadata.metadata;
    }

    private RealisedIvyModuleResolveMetadata(RealisedIvyModuleResolveMetadata metadata, ModuleSource source) {
        super(metadata, source);
        this.configurationDefinitions = metadata.configurationDefinitions;
        this.branch = metadata.branch;
        this.artifactDefinitions = metadata.artifactDefinitions;
        this.dependencies = metadata.dependencies;
        this.excludes = metadata.excludes;
        this.extraAttributes = metadata.extraAttributes;
        this.metadata = metadata.metadata.withSource(source);
    }

    RealisedIvyModuleResolveMetadata(DefaultIvyModuleResolveMetadata metadata,
                                     ImmutableList<? extends ComponentVariant> variants,
                                     Map<String, ConfigurationMetadata> configurations) {
        super(metadata, variants, configurations);
        this.configurationDefinitions = metadata.getConfigurationDefinitions();
        this.branch = metadata.getBranch();
        this.artifactDefinitions = metadata.getArtifactDefinitions();
        this.dependencies = metadata.getDependencies();
        this.excludes = metadata.getExcludes();
        this.extraAttributes = metadata.getExtraAttributes();
        this.metadata = metadata;
    }

    private static RealisedConfigurationMetadata createConfiguration(IvyConfigurationHelper configurationHelper, VariantMetadataRules variantMetadataRules, ModuleComponentIdentifier componentId, String name, boolean transitive, boolean visible, ImmutableSet<String> hierarchy, ImmutableList<ModuleComponentArtifactMetadata> artifacts, ImmutableList<ExcludeMetadata> excludes, ImmutableAttributes componentLevelAttributes, ImmutableCapabilities capabilities) {
        RealisedConfigurationMetadata configuration = new RealisedConfigurationMetadata(componentId, name, transitive, visible, hierarchy, artifacts, excludes, componentLevelAttributes, capabilities);
        ImmutableList<ModuleDependencyMetadata> dependencyMetadata = configurationHelper.filterDependencies(configuration);
        dependencyMetadata = ImmutableList.copyOf(variantMetadataRules.applyDependencyMetadataRules(new NameOnlyVariantResolveMetadata(name), dependencyMetadata));
        configuration.setDependencies(dependencyMetadata);
        return configuration;
    }

    @Override
    public MutableIvyModuleResolveMetadata asMutable() {
        return metadata.asMutable();
    }

    @Override
    public IvyModuleResolveMetadata withSource(ModuleSource source) {
        return new RealisedIvyModuleResolveMetadata(this, source);
    }

    @Nullable
    @Override
    public String getBranch() {
        return branch;
    }

    @Override
    public ImmutableMap<String, Configuration> getConfigurationDefinitions() {
        return configurationDefinitions;
    }

    @Override
    public ImmutableList<Artifact> getArtifactDefinitions() {
        return artifactDefinitions;
    }

    @Override
    public ImmutableList<Exclude> getExcludes() {
        return excludes;
    }

    @Override
    public ImmutableMap<NamespaceId, String> getExtraAttributes() {
        return extraAttributes;
    }

    @Override
    public IvyModuleResolveMetadata withDynamicConstraintVersions() {
        ImmutableList<IvyDependencyDescriptor> descriptors = getDependencies();
        if (descriptors.isEmpty()) {
            return this;
        }
        Map<IvyDependencyDescriptor, IvyDependencyDescriptor> transformedDescriptors = Maps.newHashMapWithExpectedSize(descriptors.size());
        for (IvyDependencyDescriptor dependency : descriptors) {
            ModuleComponentSelector selector = dependency.getSelector();
            String dynamicConstraintVersion = dependency.getDynamicConstraintVersion();
            ModuleComponentSelector newSelector = DefaultModuleComponentSelector.newSelector(selector.getModuleIdentifier(), dynamicConstraintVersion);
            transformedDescriptors.put(dependency, dependency.withRequested(newSelector));
        }
        return this.withDependencies(transformedDescriptors);
    }

    @Override
    public ImmutableList<IvyDependencyDescriptor> getDependencies() {
        return dependencies;
    }

    private IvyModuleResolveMetadata withDependencies(Map<IvyDependencyDescriptor, IvyDependencyDescriptor> transformed) {
        ImmutableList<IvyDependencyDescriptor> transformedDescriptors = ImmutableList.copyOf(transformed.values());
        Set<String> configurationNames = getConfigurationNames();
        Map<String, ConfigurationMetadata> transformedConfigurations = Maps.newHashMapWithExpectedSize(configurationNames.size());
        for (String name : configurationNames) {
            RealisedConfigurationMetadata configuration = (RealisedConfigurationMetadata) getConfiguration(name);
            List<? extends DependencyMetadata> dependencies = configuration.getDependencies();
            ImmutableList.Builder<ModuleDependencyMetadata> transformedConfigurationDependencies = ImmutableList.builder();
            for (DependencyMetadata dependency : dependencies) {
                if (dependency instanceof ConfigurationBoundExternalDependencyMetadata) {
                    transformedConfigurationDependencies.add(((ConfigurationBoundExternalDependencyMetadata) dependency).withDescriptor(transformed.get(((ConfigurationBoundExternalDependencyMetadata) dependency).getDependencyDescriptor())));
                } else {
                    transformedConfigurationDependencies.add((ModuleDependencyMetadata) dependency);
                }
            }
            transformedConfigurations.put(name, configuration.withDependencies(transformedConfigurationDependencies.build()));
        }
        return new RealisedIvyModuleResolveMetadata(this, transformedDescriptors, transformedConfigurations);
    }

}


text:
<?php

namespace PHPMinds\Factory;

use PHPMinds\Model\Email;
use PHPMinds\Model\Event\Entity\Speaker;
use PHPMinds\Model\Event\Entity\Supporter;
use PHPMinds\Model\Event\Entity\Talk;
use PHPMinds\Model\Event\Entity\Venue;
use PHPMinds\Model\Event\EventModel;
use PHPMinds\Model\Event\NullSpeaker;
use PHPMinds\Model\Event\NullSupporter;
use PHPMinds\Model\Event\NullTalk;
use PHPMinds\Model\Event\NullVenue;
use PHPMinds\Model\Twitter;
use Slim\Http\Request;

class EventFactory
{
    public static function getEvent($talkTitle, $talkDescription, $date, $speaker, $venue, $supporter, $title, $description)
    {
        $talk =  new Talk(
            strip_tags($talkTitle, '

'),
            strip_tags($talkDescription, '

'),
            $speaker
        );

        $event = new EventModel(
            $talk,
            $date,
            $venue,
            $supporter
        );

        $event->setName($title);
        $event->setDescription($description);

        return $event;
    }

    public static function getMergedFromArrays(array $meetupEvent = [], array $dbEvent = null)
    {
        if (empty($meetupEvent)) {

            $supporter  = new NullSupporter();
            $date       = new \DateTime();
            $talk       = new NullTalk();
            $venue      = new NullVenue();

            $model = new EventModel(
                $talk,
                $date,
                $venue,
                $supporter
            );

            return $model;

        }
        if (!is_null($dbEvent)) {

            $speaker = new Speaker(
                $dbEvent['first_name'], $dbEvent['last_name'],
                new Email($dbEvent['email']),
                new Twitter($dbEvent['twitter']),
                $dbEvent['avatar']
            );

            $speaker->setId($dbEvent['speaker_id']);

            $supporter = new Supporter(
                $dbEvent['supporter_name'], $dbEvent['supporter_url'],
                new Twitter($dbEvent['supporter_twitter']),
                new Email($dbEvent['supporter_email']),
                $dbEvent['supporter_logo']
            );

            $supporter->setId($dbEvent['supporter_id']);

        } else {
            $speaker    = new NullSpeaker();
            $supporter  = new NullSupporter();
        }

        $talk = new Talk($meetupEvent['subject'], $meetupEvent['description'], $speaker);
        $venue = new Venue($meetupEvent['venue_name'], $meetupEvent['venue_address']);
        $venue->setId($meetupEvent['venue_id']);

        $date = \DateTime::createFromFormat('F jS Y g:ia', $meetupEvent['date'] . ' ' . $meetupEvent['time']);

        $event = new EventModel(
            $talk,
            $date,
            $venue,
            $supporter
        );

        $event->setName($meetupEvent['group']);
        $event->setMindsUrl($meetupEvent['minds_url']);
        $event->setMeetupID($meetupEvent['id']);
        $event->setMeetupURL($meetupEvent['event_url']);

        return $event;
    }
}


text:
package org.apache.commons.jcs3.utils.discovery;

import java.io.IOException;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.jcs3.engine.behavior.IElementSerializer;
import org.apache.commons.jcs3.engine.behavior.IRequireScheduler;
import org.apache.commons.jcs3.engine.behavior.IShutdownObserver;
import org.apache.commons.jcs3.log.Log;
import org.apache.commons.jcs3.log.LogManager;
import org.apache.commons.jcs3.utils.discovery.behavior.IDiscoveryListener;
import org.apache.commons.jcs3.utils.net.HostNameUtil;
import org.apache.commons.jcs3.utils.serialization.StandardSerializer;

/**
 * This service creates a listener that can create lateral caches and add them to the no wait list.
 *

 * It also creates a sender that periodically broadcasts its availability.
 *

 *

 * The sender also broadcasts a request for other caches to broadcast their addresses.
 *

 */
public class UDPDiscoveryService
    implements IShutdownObserver, IRequireScheduler
{
    /** The logger */
    private static final Log log = LogManager.getLog( UDPDiscoveryService.class );

    /** thread that listens for messages */
    private Thread udpReceiverThread;

    /** the runnable that the receiver thread runs */
    private UDPDiscoveryReceiver receiver;

    /** attributes */
    private UDPDiscoveryAttributes udpDiscoveryAttributes;

    /** Used to serialize messages */
    private final IElementSerializer serializer;

    /** is this shut down? */
    private final AtomicBoolean shutdown = new AtomicBoolean(false);

    /** This is a set of services that have been discovered. */
    private final ConcurrentMap<Integer, DiscoveredService> discoveredServices =
            new ConcurrentHashMap<>();

    /** This a list of regions that are configured to use discovery. */
    private final Set<String> cacheNames = new CopyOnWriteArraySet<>();

    /** Set of listeners. */
    private final Set<IDiscoveryListener> discoveryListeners = new CopyOnWriteArraySet<>();

    /** Handle to cancel the scheduled broadcast task */
    private ScheduledFuture<?> broadcastTaskFuture;

    /** Handle to cancel the scheduled cleanup task */
    private ScheduledFuture<?> cleanupTaskFuture;

    /**
     * Constructor
     *
     * @param attributes settings of the service
     * @deprecated Specify serializer implementation explicitly
     */
    @Deprecated
    public UDPDiscoveryService(final UDPDiscoveryAttributes attributes)
    {
        this(attributes, new StandardSerializer());
    }

    /**
     * Constructor
     *
     * @param attributes settings of service
     * @param serializer the serializer to use to send and receive messages
     * @since 3.1
     */
    public UDPDiscoveryService(final UDPDiscoveryAttributes attributes, IElementSerializer serializer)
    {
        this.udpDiscoveryAttributes = attributes.clone();
        this.serializer = serializer;

        try
        {
            InetAddress multicastAddress = InetAddress.getByName(
                    getUdpDiscoveryAttributes().getUdpDiscoveryAddr());

            // Set service address if still empty
            if (getUdpDiscoveryAttributes().getServiceAddress() == null ||
                    getUdpDiscoveryAttributes().getServiceAddress().isEmpty())
            {
                // Use same interface as for multicast
                NetworkInterface serviceInterface = null;
                if (getUdpDiscoveryAttributes().getUdpDiscoveryInterface() != null)
                {
                    serviceInterface = NetworkInterface.getByName(
                            getUdpDiscoveryAttributes().getUdpDiscoveryInterface());
                }
                else
                {
                    serviceInterface = HostNameUtil.getMulticastNetworkInterface();
                }

                try
                {
                    InetAddress serviceAddress = null;

                    for (Enumeration<InetAddress> addresses = serviceInterface.getInetAddresses();
                            addresses.hasMoreElements();)
                    {
                        serviceAddress = addresses.nextElement();

                        if (multicastAddress instanceof Inet6Address)
                        {
                            if (serviceAddress instanceof Inet6Address &&
                                !serviceAddress.isLoopbackAddress() &&
                                !serviceAddress.isMulticastAddress() &&
                                serviceAddress.isLinkLocalAddress())
                            {
                                // if Multicast uses IPv6, try to publish our IPv6 address
                                break;
                            }
                        }
                        else
                        {
                            if (serviceAddress instanceof Inet4Address &&
                                !serviceAddress.isLoopbackAddress() &&
                                !serviceAddress.isMulticastAddress() &&
                                serviceAddress.isSiteLocalAddress())
                            {
                                // if Multicast uses IPv4, try to publish our IPv4 address
                                break;
                            }
                        }
                    }

                    if (serviceAddress == null)
                    {
                        // Nothing found for given interface, fall back
                        serviceAddress = HostNameUtil.getLocalHostLANAddress();
                    }

                    getUdpDiscoveryAttributes().setServiceAddress(serviceAddress.getHostAddress());
                }
                catch ( final UnknownHostException e )
                {
                    log.error( "Couldn't get local host address", e );
                }
            }

            // todo need some kind of recovery here.
            receiver = new UDPDiscoveryReceiver( this,
                    getUdpDiscoveryAttributes().getUdpDiscoveryInterface(),
                    multicastAddress,
                    getUdpDiscoveryAttributes().getUdpDiscoveryPort() );
        }
        catch ( final IOException e )
        {
            log.error( "Problem creating UDPDiscoveryReceiver, address [{0}] "
                    + "port [{1}] we won't be able to find any other caches",
                    getUdpDiscoveryAttributes().getUdpDiscoveryAddr(),
                    getUdpDiscoveryAttributes().getUdpDiscoveryPort(), e );
        }

        // initiate sender broadcast
        initiateBroadcast();
    }

    /**
     * @see org.apache.commons.jcs3.engine.behavior.IRequireScheduler#setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)
     */
    @Override
    public void setScheduledExecutorService(final ScheduledExecutorService scheduledExecutor)
    {
        this.broadcastTaskFuture = scheduledExecutor.scheduleAtFixedRate(
                this::serviceRequestBroadcast, 0, 15, TimeUnit.SECONDS);

        /** removes things that have been idle for too long */
        // I'm going to use this as both, but it could happen
        // that something could hang around twice the time using this as the
        // delay and the idle time.
        this.cleanupTaskFuture = scheduledExecutor.scheduleAtFixedRate(
                this::cleanup, 0,
                getUdpDiscoveryAttributes().getMaxIdleTimeSec(), TimeUnit.SECONDS);
    }

    /**
     * This goes through the list of services and removes those that we haven't heard from in longer
     * than the max idle time.
     *
     * @since 3.1
     */
    protected void cleanup()
    {
        final long now = System.currentTimeMillis();

        // the listeners need to be notified.
        getDiscoveredServices().stream()
            .filter(service -> {
                if (now - service.getLastHearFromTime() > getUdpDiscoveryAttributes().getMaxIdleTimeSec() * 1000)
                {
                    log.info( "Removing service, since we haven't heard from it in "
                            + "{0} seconds. service = {1}",
                            getUdpDiscoveryAttributes().getMaxIdleTimeSec(), service );
                    return true;
                }

                return false;
            })
            // remove the bad ones
            // call this so the listeners get notified
            .forEach(this::removeDiscoveredService);
    }

    /**
     * Initial request that the other caches let it know their addresses.
     *
     * @since 3.1
     */
    public void initiateBroadcast()
    {
        log.debug( "Creating sender for discoveryAddress = [{0}] and "
                + "discoveryPort = [{1}] myHostName = [{2}] and port = [{3}]",
                () -> getUdpDiscoveryAttributes().getUdpDiscoveryAddr(),
                () -> getUdpDiscoveryAttributes().getUdpDiscoveryPort(),
                () -> getUdpDiscoveryAttributes().getServiceAddress(),
                () -> getUdpDiscoveryAttributes().getServicePort() );

        try (UDPDiscoverySender sender = new UDPDiscoverySender(
                getUdpDiscoveryAttributes(), getSerializer()))
        {
            sender.requestBroadcast();

            log.debug( "Sent a request broadcast to the group" );
        }
        catch ( final IOException e )
        {
            log.error( "Problem sending a Request Broadcast", e );
        }
    }

    /**
     * Send a passive broadcast in response to a request broadcast. Never send a request for a
     * request. We can respond to our own requests, since a request broadcast is not intended as a
     * connection request. We might want to only send messages, so we would send a request, but
     * never a passive broadcast.
     */
    protected void serviceRequestBroadcast()
    {
        // create this connection each time.
        // more robust
        try (UDPDiscoverySender sender = new UDPDiscoverySender(
                getUdpDiscoveryAttributes(), getSerializer()))
        {
            sender.passiveBroadcast(
                    getUdpDiscoveryAttributes().getServiceAddress(),
                    getUdpDiscoveryAttributes().getServicePort(),
                    this.getCacheNames() );

            log.debug( "Called sender to issue a passive broadcast" );
        }
        catch ( final IOException e )
        {
            log.error( "Problem calling the UDP Discovery Sender, address [{0}] "
                    + "port [{1}]",
                    getUdpDiscoveryAttributes().getUdpDiscoveryAddr(),
                    getUdpDiscoveryAttributes().getUdpDiscoveryPort(), e );
        }
    }

    /**
     * Issues a remove broadcast to the others.
     *
     * @since 3.1
     */
    protected void shutdownBroadcast()
    {
        // create this connection each time.
        // more robust
        try (UDPDiscoverySender sender = new UDPDiscoverySender(
                getUdpDiscoveryAttributes(), getSerializer()))
        {
            sender.removeBroadcast(
                    getUdpDiscoveryAttributes().getServiceAddress(),
                    getUdpDiscoveryAttributes().getServicePort(),
                    this.getCacheNames() );

            log.debug( "Called sender to issue a remove broadcast in shutdown." );
        }
        catch ( final IOException e )
        {
            log.error( "Problem calling the UDP Discovery Sender", e );
        }
    }

    /**
     * Adds a region to the list that is participating in discovery.
     *

     * @param cacheName
     */
    public void addParticipatingCacheName( final String cacheName )
    {
        cacheNames.add( cacheName );
    }

    /**
     * Removes the discovered service from the list and calls the discovery listener.
     *

     * @param service
     */
    public void removeDiscoveredService( final DiscoveredService service )
    {
        if (discoveredServices.remove(service.hashCode()) != null)
        {
            log.info( "Removing {0}", service );
        }

        getDiscoveryListeners().forEach(listener -> listener.removeDiscoveredService(service));
    }

    /**
     * Add a service to the list. Update the held copy if we already know about it.
     *

     * @param discoveredService discovered service
     */
    protected void addOrUpdateService( final DiscoveredService discoveredService )
    {
        // We want to replace the old one, since we may add info that is not part of the equals.
        // The equals method on the object being added is intentionally restricted.
        discoveredServices.merge(discoveredService.hashCode(), discoveredService, (oldService, newService) -> {
            log.debug( "Set contains service." );
            log.debug( "Updating service in the set {0}", newService );

            // Update the list of cache names if it has changed.
            // need to update the time this sucks. add has no effect convert to a map
            if (!oldService.getCacheNames().equals(newService.getCacheNames()))
            {
                log.info( "List of cache names changed for service: {0}", newService );

                // replace it, we want to reset the payload and the last heard from time.
                return newService;
            }

            if (oldService.getLastHearFromTime() != newService.getLastHearFromTime())
            {
                return newService;
            }

            return oldService;
        });

        // Always Notify the listeners
        // If we don't do this, then if a region using the default config is initialized after notification,
        // it will never get the service in it's no wait list.
        // Leave it to the listeners to decide what to do.
        getDiscoveryListeners().forEach(listener -> listener.addDiscoveredService(discoveredService));
    }

    /**
     * Get all the cache names we have facades for.
     *

     * @return ArrayList
     */
    protected ArrayList<String> getCacheNames()
    {
        return new ArrayList<>(cacheNames);
    }

    /**
     * @param attr The UDPDiscoveryAttributes to set.
     */
    public void setUdpDiscoveryAttributes( final UDPDiscoveryAttributes attr )
    {
        this.udpDiscoveryAttributes = attr;
    }

    /**
     * @return Returns the lca.
     */
    public UDPDiscoveryAttributes getUdpDiscoveryAttributes()
    {
        return this.udpDiscoveryAttributes;
    }

    /**
     * Return the serializer implementation
     *
     * @return the serializer
     * @since 3.1
     */
    public IElementSerializer getSerializer()
    {
        return serializer;
    }

    /**
     * Start necessary receiver thread
     */
    public void startup()
    {
        udpReceiverThread = new Thread(receiver);
        udpReceiverThread.setDaemon(true);
        // udpReceiverThread.setName( t.getName() + "--UDPReceiver" );
        udpReceiverThread.start();
    }

    /**
     * Shuts down the receiver.
     */
    @Override
    public void shutdown()
    {
        if (shutdown.compareAndSet(false, true))
        {
            // Stop the scheduled tasks
            if (broadcastTaskFuture != null)
            {
                broadcastTaskFuture.cancel(false);
            }
            if (cleanupTaskFuture != null)
            {
                cleanupTaskFuture.cancel(false);
            }

            if (receiver != null)
            {
                log.info( "Shutting down UDP discovery service receiver." );
                receiver.shutdown();
            }

            log.info( "Shutting down UDP discovery service sender." );
            // also call the shutdown on the sender thread itself, which
            // will result in a remove command.
            shutdownBroadcast();
        }
        else
        {
            log.debug( "Shutdown already called." );
        }
    }

    /**
     * @return Returns the discoveredServices.
     */
    public Set<DiscoveredService> getDiscoveredServices()
    {
        return new HashSet<>(discoveredServices.values());
    }

    /**
     * @return the discoveryListeners
     */
    private Set<IDiscoveryListener> getDiscoveryListeners()
    {
        return discoveryListeners;
    }

    /**
     * @return the discoveryListeners
     */
    public Set<IDiscoveryListener> getCopyOfDiscoveryListeners()
    {
        return new HashSet<>(getDiscoveryListeners());
    }

    /**
     * Adds a listener.
     *

     * @param listener
     * @return true if it wasn't already in the set
     */
    public boolean addDiscoveryListener( final IDiscoveryListener listener )
    {
        return getDiscoveryListeners().add( listener );
    }

    /**
     * Removes a listener.
     *

     * @param listener
     * @return true if it was in the set
     */
    public boolean removeDiscoveryListener( final IDiscoveryListener listener )
    {
        return getDiscoveryListeners().remove( listener );
    }
}


text:
.xdsoft_range2dslider,.xdsoft_range2dslider *{
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing:border-box;
}
.xdsoft_noselect{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.xdsoft_range2dslider{
	position:relative;
}

.xdsoft_range2dslider.xdsoft_range2dslider_disabled{
opacity:0.7;
}

.xdsoft_range2dslider_box{
	border:1px solid #ccc;
	height:100px;
	width:auto;
	position:relative;
	cursor:pointer;
}

.xdsoft_range2dslider_runner{
	width:16px;
	height:16px;
	position:absolute;
	cursor:pointer;
	z-index:5;
	background:#fff;
	background:rgba(255,255,255,0.9);
	border:1px solid #ccc;
	border-radius:50%;
}
.xdsoft_range2dslider_runner input{
	color:transparent !important;
	background:transparent !important;
	border:0px solid transparent !important;
	outline:0px transparent !important;
	width:1px !important;
	height:1px !important;
	-webkit-box-shadow:none !important;
	-moz-box-shadow:none !important;
	box-shadow:none !important;
}
.xdsoft_range2dslider_runner:hover{
	z-index:6;
}

.xdsoft_range2dslider_box.xdsoft_range2dslider_box_top .xdsoft_range2dslider_runner{
	margin-top:-8px;
}
.xdsoft_range2dslider_box.xdsoft_range2dslider_box_left .xdsoft_range2dslider_runner{
	margin-left:-8px;
}
.xdsoft_range2dslider_box.xdsoft_range2dslider_box_bottom .xdsoft_range2dslider_runner{
	margin-bottom:-8px;
}
.xdsoft_range2dslider_box.xdsoft_range2dslider_box_right .xdsoft_range2dslider_runner{
	margin-right:-8px;
}

.xdsoft_legend{
	position:absolute;
	display:block;
	text-align:center;
	font-weight:700;
	font-family:Tahoma;
	vertical-align:middle;
	font-size:12px;
	z-index:3;
}

.xdsoft_range2dslider_grid{
position:absolute !important;
cursor: inherit;
}

.xdsoft_projection{
position:absolute;
border:1px dotted rgba(127,127,127,0.4);
border-width:1px 0px 0px 1px;
z-index:4;
}
.xdsoft_projection.axisx{
	left:0px; right:0px;
	height:1px;
}
.xdsoft_projection.axisy{
	bottom:0px; top:0px;
	width:1px;
}

.xdsoft_range2dslider_range{
background:rgba(127,127,0,0.3);
position:absolute;
z-index:4;
}

span.xdsoft_slider_label{
  position: absolute;
  min-width:50px;
  color: #fff;
  background: #000;
  text-align: center;
  visibility: hidden;
  border-radius: 6px;
  font-size:11px;
  padding:3px;
  opacity: 0.8;
  z-index: 999;
}
span.xdsoft_slider_label.xdsoft_slider_label_visible{
	visibility:visible;
}

.xdsoft_range2dslider_runner:hover span.xdsoft_slider_label.xdsoft_slider_label_hidden{
	visibility:visible;
}

span.xdsoft_slider_label:after {
  content: '';
  position: absolute;
  width: 0; height: 0;
  border:8px solid transparent;
}
span.xdsoft_slider_label.xdsoft_slider_label_top:after{
	top: 100%;
	left: 50%;
	margin-left: -8px;
	width: 0; height: 0;
	border-top-color:#000;
	border-bottom-width: 0px;
}
span.xdsoft_slider_label.xdsoft_slider_label_top{
	bottom: 15px;
	left: 50%;
	margin-left: -25px;
}

span.xdsoft_slider_label.xdsoft_slider_label_bottom:after{
	bottom: 100%;
	left: 50%;
	margin-left: -8px;
	border-bottom-color:#000;
	border-top-width: 0px;
}
span.xdsoft_slider_label.xdsoft_slider_label_bottom{
	top: 15px;
	left: 50%;
	margin-left: -25px;
}

span.xdsoft_slider_label.xdsoft_slider_label_left:after{
	top: 50%;
	left: 100%;
	margin-top: -8px;
	border-left-color:#000;
	border-right-width: 0px;
}
span.xdsoft_slider_label.xdsoft_slider_label_left{
	right: 100%;
	top: 50%;
	margin-top: -10px;
	margin-right: 10px;
}

span.xdsoft_slider_label.xdsoft_slider_label_right:after{
	top: 50%;
	right: 100%;
	margin-top: -8px;
	border-right-color:#000;
	border-left-width: 0px;
}
span.xdsoft_slider_label.xdsoft_slider_label_right{
	left: 100%;
	top: 50%;
	margin-top: -4px;
	margin-left: 8px;
}

.xdsoft_horizontal .xdsoft_range2dslider_runner{
	/*margin:0px 0px -5px -5px !important;*/
}
.xdsoft_horizontal .xdsoft_range2dslider_box.xdsoft_range2dslider_box_top .xdsoft_range2dslider_runner{
	margin-top:-5px;
}
.xdsoft_horizontal .xdsoft_range2dslider_box.xdsoft_range2dslider_box_left .xdsoft_range2dslider_runner{
	margin-left:-5px;
}
.xdsoft_horizontal .xdsoft_range2dslider_box.xdsoft_range2dslider_box_bottom .xdsoft_range2dslider_runner{
	margin-bottom:-5px;
}
.xdsoft_horizontal .xdsoft_range2dslider_box.xdsoft_range2dslider_box_right .xdsoft_range2dslider_runner{
	margin-right:-5px;
}

.xdsoft_horizontal .xdsoft_range2dslider_box{
	min-height:8px;
	border-radius:3px;
	border-style:solid;
}

.xdsoft_horizontal .xdsoft_range2dslider_range{
	min-height:7px;
}

.xdsoft_vertical .xdsoft_range2dslider_runner{
	/*margin:0px 0px -8px -5px !important;*/
}

.xdsoft_vertical .xdsoft_range2dslider_box.xdsoft_range2dslider_box_top .xdsoft_range2dslider_runner{
	margin-top:-5px;
}
.xdsoft_vertical .xdsoft_range2dslider_box.xdsoft_range2dslider_box_left .xdsoft_range2dslider_runner{
	margin-left:-5px;
}
.xdsoft_vertical .xdsoft_range2dslider_box.xdsoft_range2dslider_box_bottom .xdsoft_range2dslider_runner{
	margin-bottom:-8px;
}
.xdsoft_vertical .xdsoft_range2dslider_box.xdsoft_range2dslider_box_right .xdsoft_range2dslider_runner{
	margin-right:-5px;
}

.xdsoft_vertical .xdsoft_range2dslider_box{
	min-width:8px;
	border-radius:3px;
	border-style:solid;
}
.xdsoft_vertical .xdsoft_range2dslider_range{
	min-width:7px;
}

.xdsoft_horizontal .xdsoft_slider_label{

}

.xdsoft_horizontal span.xdsoft_slider_label.xdsoft_slider_label_right{
	/*margin-top: -10px !important;*/
}

/******************************************************************************************/

.xdsoft_range2dslider_skin1 .xdsoft_range2dslider_runner{
	border:5px solid rgba(127,127,127,0.9);
	background:rgba(255,255,255,0.9);
	border-radius:50%;
	box-shadow: 0px 1px 7px -2px #999;
}
.xdsoft_range2dslider_skin1 .xdsoft_range2dslider_runner:hover{
	border-color:rgba(127,127,127,0.7);
}
.xdsoft_range2dslider_skin1 .xdsoft_range2dslider_runner.xdsoft_range2dslider_active{
	background:rgba(200,200,200,0.9);
}
.xdsoft_range2dslider_skin1 .xdsoft_range2dslider_box{
	background: rgba(255,255,255,1);
	background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(249,249,249,1) 33%, rgba(237,237,237,1) 100%);
	background: -webkit-gradient(left top, right top, color-stop(0%, rgba(255,255,255,1)), color-stop(33%, rgba(249,249,249,1)), color-stop(100%, rgba(237,237,237,1)));
	background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(249,249,249,1) 33%, rgba(237,237,237,1) 100%);
	background: -o-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(249,249,249,1) 33%, rgba(237,237,237,1) 100%);
	background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(249,249,249,1) 33%, rgba(237,237,237,1) 100%);
	background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(249,249,249,1) 33%, rgba(237,237,237,1) 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=1 );
}

.xdsoft_range2dslider_skin1 .xdsoft_range2dslider_range{
background: rgba(164,179,87,0.58);
background: -moz-linear-gradient(left, rgba(164,179,87,0.58) 0%, rgba(117,137,12,0.77) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(164,179,87,0.58)), color-stop(100%, rgba(117,137,12,0.77)));
background: -webkit-linear-gradient(left, rgba(164,179,87,0.58) 0%, rgba(117,137,12,0.77) 100%);
background: -o-linear-gradient(left, rgba(164,179,87,0.58) 0%, rgba(117,137,12,0.77) 100%);
background: -ms-linear-gradient(left, rgba(164,179,87,0.58) 0%, rgba(117,137,12,0.77) 100%);
background: linear-gradient(to right, rgba(164,179,87,0.58) 0%, rgba(117,137,12,0.77) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a4b357', endColorstr='#75890c', GradientType=1 );
opacity:0.3;
}

.xdsoft_range2dslider_skin1 .xdsoft_projection_value_x,
.xdsoft_range2dslider_skin1  .xdsoft_projection_value_y{
position:absolute;
font-size:0.6em;
line-height:1.1em;
}
.xdsoft_projection_value_x{
	left:2px;
	top:0px;
}
.xdsoft_projection_value_y{
	left:2px;
	bottom:0px;
}


text:
using System;
using System.Web.ModelBinding;
using WebFormsMvp;

namespace LibrarySystemLiveDemo.MVP.EditCategories
{
    public interface IEditCategoriesView : IView<EditCategoriesViewModel>
    {
        event EventHandler OnGetData;
        event EventHandler OnInsertItem;
        event EventHandler<IdEventArgs> OnDeleteItem;
        event EventHandler<IdEventArgs> OnUpdateItem;

        ModelStateDictionary ModelState { get; }

        bool TryUpdateModel<TModel>(TModel model) where TModel : class;
    }
}


text:
namespace AutoTest.ArgNullEx.Filter
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
    using global::Xunit;

    public class NotNullableValueTypeShould
    {
        private static void SomeNullableParametersMethod(
            int intInput,
            string stringInput,
            Guid guidInput,
            int? intNullable,
            Guid? guidNullable)
        {
        }

        public static IEnumerable<object[]> SomeOutParameters => GetSomeOutParameters();

        internal static IEnumerable<object[]> GetSomeOutParameters()
        {
            Type type = typeof(NotNullableValueTypeShould);

            MethodInfo method = type.GetMethod(
                nameof(SomeNullableParametersMethod),
                BindingFlags.NonPublic | BindingFlags.Static);
            ParameterInfo[] someOutParameters = method.GetParameters();

            return someOutParameters.Select(
                parameter => new object[] { type, method, parameter, parameter.Name.Contains("Nullable") });
        }

        [Theory, AutoMock]
        public void ReturnName(NotNullableValueType sut)
        {
            Assert.Equal(nameof(NotNullableValueType), sut.Name);
        }

        [Theory, MemberData(nameof(SomeOutParameters))]
        public void ExcludeNullableValueTypeParameter(
            Type type,
            MethodInfo method,
            ParameterInfo parameter,
            bool expected)
        {
            // Arrange
            IParameterFilter sut = new NotNullableValueType();

            // Act
            bool actual = sut.ExcludeParameter(type, method, parameter);

            // Assert
            Assert.Equal(expected, actual);
        }
    }
}


text:
package org.wso2.test.http.netty.proxy.config.yaml;

import junit.framework.TestCase;

import java.io.FileInputStream;
import java.io.InputStream;

public class ReaderTest extends TestCase {

    public void testRead() throws Exception {
        InputStream inputStream = ReaderTest.class.getResourceAsStream("/test-proxy-conf.yaml");

        Reader reader = new Reader();

        ConfigFile configFile = reader.read(inputStream);
        System.out.println(configFile);
        System.out.println(configFile.getProxiesConfig());
        assertNotNull(configFile);
        assertNotNull(configFile.getProxiesConfig());
        assertNotNull(configFile.getProxiesConfig().getProxies().get(0));
        assertNotNull(configFile.getProxiesConfig().getProxies().get(0).getType());
    }
}


text:
from oslo_log import log
import retrying

from ironic.common.i18n import _
from ironic.common.i18n import _LI
from ironic.common.i18n import _LW
from ironic.common import states
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules import agent
from ironic.drivers.modules import deploy_utils

LOG = log.getLogger(__name__)
CONF = agent.CONF

# NOTE (thiagop): We overwrite this interface because we cannot change the boot
# device of OneView managed blades while they are still powered on. We moved
# the call of node_set_boot_device from reboot_to_instance to
# reboot_and_finish_deploy and changed the behavior to shutdown the node before
# doing it.
# TODO(thiagop): remove this interface once bug/1503855 is fixed
class AgentVendorInterface(agent.AgentVendorInterface):

    def reboot_to_instance(self, task, **kwargs):
        task.process_event('resume')
        node = task.node
        error = self.check_deploy_success(node)
        if error is not None:
            # TODO(jimrollenhagen) power off if using neutron dhcp to
            #                      align with pxe driver?
            msg = (_('node %(node)s command status errored: %(error)s') %
                   {'node': node.uuid, 'error': error})
            LOG.error(msg)
            deploy_utils.set_failed_state(task, msg)
            return

        LOG.info(_LI('Image successfully written to node %s'), node.uuid)
        LOG.debug('Rebooting node %s to instance', node.uuid)

        self.reboot_and_finish_deploy(task)

        # NOTE(TheJulia): If we deployed a whole disk image, we
        # should expect a whole disk image and clean-up the tftp files
        # on-disk incase the node is disregarding the boot preference.
        # TODO(rameshg87): Not all in-tree drivers using reboot_to_instance
        # have a boot interface. So include a check for now. Remove this
        # check once all in-tree drivers have a boot interface.
        if task.driver.boot:
            task.driver.boot.clean_up_ramdisk(task)

    def reboot_and_finish_deploy(self, task):
        """Helper method to trigger reboot on the node and finish deploy.

        This method initiates a reboot on the node. On success, it
        marks the deploy as complete. On failure, it logs the error
        and marks deploy as failure.

        :param task: a TaskManager object containing the node
        :raises: InstanceDeployFailure, if node reboot failed.
        """
        wait = CONF.agent.post_deploy_get_power_state_retry_interval * 1000
        attempts = CONF.agent.post_deploy_get_power_state_retries + 1

        @retrying.retry(
            stop_max_attempt_number=attempts,
            retry_on_result=lambda state: state != states.POWER_OFF,
            wait_fixed=wait
        )
        def _wait_until_powered_off(task):
            return task.driver.power.get_power_state(task)

        node = task.node

        try:
            try:
                self._client.power_off(node)
                _wait_until_powered_off(task)
            except Exception as e:
                LOG.warning(
                    _LW('Failed to soft power off node %(node_uuid)s '
                        'in at least %(timeout)d seconds. Error: %(error)s'),
                    {'node_uuid': node.uuid,
                     'timeout': (wait * (attempts - 1)) / 1000,
                     'error': e})
                manager_utils.node_power_action(task, states.POWER_OFF)

            manager_utils.node_set_boot_device(task, 'disk',
                                               persistent=True)
            manager_utils.node_power_action(task, states.POWER_ON)
        except Exception as e:
            msg = (_('Error rebooting node %(node)s after deploy. '
                     'Error: %(error)s') %
                   {'node': node.uuid, 'error': e})
            self._log_and_raise_deployment_error(task, msg)

        task.process_event('done')
        LOG.info(_LI('Deployment to node %s done'), task.node.uuid)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sydowia 11(1-6): 65 (1958)

#### Original name
Aphanostigme vanderystii Hansf.

### Remarks
null


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;

namespace HolographicPhotoProject.Utilities
{
    /// <summary>
    /// Makes the scale of the object constant even when the parent is scaled.
    /// </summary>
    public class FixedScale : MonoBehaviour
    {
        /// <summary>
        /// Whether the initial scale has already been saved or not.
        /// </summary>
        private bool isFixedScaleSet = false;

        private Vector3 localFixedScale;
        /// <summary>
        /// The local scale at which the object's transform is fixed.
        /// </summary>
        public Vector3 LocalFixedScale
        {
            get { return localFixedScale; }

            private set
            {
                localFixedScale = value;
                isFixedScaleSet = true;
            }
        }

        /// <summary>
        /// Initializes the component by saving the initial local scale of the object.
        /// </summary>
        private void Start()
        {
            if (!isFixedScaleSet)
            {
                SaveInitialScale();
            }
        }

        /// <summary>
        /// Updates the object by resetting the scale to it's initial value, keeping it fixed.
        /// </summary>
        private void Update()
        {
            // Dissociate the object from it's parent so that it's world scale is not affected by it's parent's.
            Transform parent = transform.parent;
            transform.parent = null;

            // Set the object's scale to the saved scale.
            transform.localScale = LocalFixedScale;

            // Reset the object's parent.
            transform.parent = parent;
        }

        public void SaveInitialScale()
        {
            // Save the initial world scale of the object.
            LocalFixedScale = transform.lossyScale;
        }
    }
}


text:
{% assign publications = site.data.data.publications %} {% if publications %}

     {{ publications.title }}

    {% if publications.intro %}

        {{ publications.intro | markdownify }}

    {% endif %} {% for publication in publications.papers %}

        {% if publication.link %}

{{ publication.title }}

        {% else %}

{{ publication.title }}

        {% endif %}

{{ publication.authors }}

{{ publication.conference }}

    {% endfor %}

{% assign short_papers = site.data.data.short_papers %} {% if short_papers %}

     {{ short_papers.title }}

    {% if short_papers.intro %}

        {{ short_papers.intro | markdownify }}

    {% endif %} {% for publication in short_papers.papers %}

        {% if publication.link %}

{{ publication.title }}

        {% else %}

{{ publication.title }}

        {% endif %}
        {% if publication.demo %}
            Working Demo
        {% endif %}

{{ publication.authors }}

{{ publication.conference }}

    {% endfor %}

{% endif %}

{% endif %} {% assign experiences = site.data.data.presentations %} {% if experiences %}

     Presentations

    {% for experience in experiences %}

{{ experience.role }}

{{ experience.time }}

{{ experience.company }}  {{experience.advisor}}

        {% if experience.details %}

            {{ experience.details | markdownify }}

        {% endif %}

    {% endfor %}

{% endif %}


text:
package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * @author awturner@google.com (Andy Turner)
 */
@RunWith(JUnit4.class)
public class InvalidTimeZoneIDTest {

  private final CompilationTestHelper compilationHelper =
      CompilationTestHelper.newInstance(InvalidTimeZoneID.class, getClass());

  @Test
  public void testPositiveCase() {
    compilationHelper
        .addSourceLines(
            "a/A.java",
            "package a;",
            "import java.util.TimeZone;",
            "class A {",
            "  private static final String TIMEZONE_ID = \"unknown\";",
            "  public static void test() {",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"unknown\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(TIMEZONE_ID);",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"America/Los_Angele\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"KST\");",
            "  }",
            "  public static void invalidCustomIDs() {",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"UTC+0\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"GMT+24\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"GMT1\");",
            "    // BUG: Diagnostic contains:",
            "    TimeZone.getTimeZone(\"GMT/0\");",
            "  }",
            "  public static void underscoreSuggestion() {",
            "    // BUG: Diagnostic contains: America/Los_Angeles",
            "    TimeZone.getTimeZone(\"America/Los Angeles\");",
            "  }",
            "}")
        .doTest();
  }

  @Test
  public void testNegativeCase() {
    compilationHelper
        .addSourceLines(
            "a/A.java",
            "package a;",
            "import java.util.TimeZone;",
            "class A {",
            "  private static final String TIMEZONE_ID = \"America/New_York\";",
            "  public static void ianaIDs() {",
            "    TimeZone.getTimeZone(\"America/Los_Angeles\");",
            "    TimeZone.getTimeZone(TIMEZONE_ID);",
            "    TimeZone.getTimeZone(\"Europe/London\");",
            "  }",
            "  public static void customIDs() {",
            "    // Custom IDs",
            "    TimeZone.getTimeZone(\"GMT+0\");",
            "    TimeZone.getTimeZone(\"GMT+00\");",
            "    TimeZone.getTimeZone(\"GMT+00:00\");",
            "  }",
            "  public static void threeLetterIDs() {",
            "    TimeZone.getTimeZone(\"GMT\");",
            "    TimeZone.getTimeZone(\"UTC\");",
            "    // Some 3-letter IDs are deprecated, but are still recognized.",
            "    TimeZone.getTimeZone(\"PST\");",
            "  }",
            "}")
        .doTest();
  }
}


text:
package org.zalando.nakadi.validation;

import com.google.common.collect.ImmutableList;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
import org.zalando.nakadi.domain.CleanupPolicy;
import org.zalando.nakadi.domain.CompatibilityMode;
import org.zalando.nakadi.domain.EventTypeBase;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

@Component
public class JsonSchemaEnrichment {

    private static final String ADDITIONAL_PROPERTIES = "additionalProperties";
    private static final String ADDITIONAL_ITEMS = "additionalItems";
    private static final List<String> NESTED_SCHEMA_KEYWORDS = ImmutableList.of("definitions", "dependencies",
            "properties");
    private static final List<String> OBJECT_SCHEMA_KEYWORDS = ImmutableList.of("properties", "required",
            "minProperties", "maxProperties");
    private static final List<String> ARRAY_SCHEMA_KEYWORDS = ImmutableList.of("minItems", "maxItems", "uniqueItems",
            "items");
    private static final List<String> COMPOSED_SCHEMA_KEYWORDS = ImmutableList.of("anyOf", "allOf", "oneOf");
    private final Map<CleanupPolicy, JSONObject> metadataSchemas = new HashMap<>();

    @Autowired
    public JsonSchemaEnrichment(
            final ResourceLoader resourceLoader,
            @Value("${nakadi.schema.metadata:classpath:schema_metadata.json}") final String metadataSchemaResource)
            throws IOException {
        final Resource resource = resourceLoader.getResource(metadataSchemaResource);
        try (InputStream in = resource.getInputStream()) {
            final JSONObject schemas = new JSONObject(new JSONTokener(new InputStreamReader(in)));
            for (final CleanupPolicy cp : CleanupPolicy.values()) {
                metadataSchemas.put(cp, schemas.getJSONObject(cp.name().toLowerCase()));
            }
        }
    }

    public JSONObject effectiveSchema(final EventTypeBase eventType, final String schemaString) {
        final JSONObject schema = new JSONObject(schemaString);
        if (eventType.getCompatibilityMode().equals(CompatibilityMode.COMPATIBLE)) {
            this.enforceStrictValidation(schema);
        }

        switch (eventType.getCategory()) {
            case BUSINESS:
                return addMetadata(schema, eventType);
            case DATA:
                return wrapSchemaInData(schema, eventType);
            default:
                return schema;
        }
    }

    private void enforceStrictValidation(final JSONObject schema) {
        enforceNoAdditionalProperties(schema);
        enforceNoAdditionalItems(schema);

        COMPOSED_SCHEMA_KEYWORDS.forEach(keyword -> {
            if (schema.has(keyword)) {
                schema.getJSONArray(keyword)
                        .forEach(object -> enforceStrictValidation((JSONObject) object));
            }
        });
    }

    private void enforceNoAdditionalItems(final JSONObject schema) {
        Optional.ofNullable(schema.optString("type")).map(type -> type.equals("array")).filter(b -> b)
                .ifPresent(b -> schema.put(ADDITIONAL_ITEMS, false));

        Optional.ofNullable(schema.optJSONArray("type")).map(array -> array.toList().contains("array"))
                .filter(b -> b).ifPresent(b -> schema.put(ADDITIONAL_ITEMS, false));

        Optional.ofNullable(schema.opt("items")).ifPresent(items -> schema.put(ADDITIONAL_ITEMS, false));

        Optional.ofNullable(schema.optJSONArray("items"))
                .ifPresent(items -> items.forEach(item -> enforceStrictValidation((JSONObject) item)));

        Optional.ofNullable(schema.optJSONObject("items")).ifPresent(this::enforceStrictValidation);

        ARRAY_SCHEMA_KEYWORDS.forEach(keyword -> {
            if (schema.has(keyword)) {
                schema.put(ADDITIONAL_ITEMS, false);
            }
        });
    }

    private void enforceNoAdditionalProperties(final JSONObject schema) {
        if (isEmptySchema(schema)) {
            schema.put(ADDITIONAL_PROPERTIES, false);
        }

        Optional.ofNullable(schema.optString("type")).map(type -> type.equals("object")).filter(b -> b)
                .ifPresent(b -> schema.put(ADDITIONAL_PROPERTIES, false));

        Optional.ofNullable(schema.optJSONArray("type")).map(array -> array.toList().contains("object"))
                .filter(b -> b).ifPresent(b -> schema.put(ADDITIONAL_PROPERTIES, false));

        OBJECT_SCHEMA_KEYWORDS.forEach(keyword -> {
            if (schema.has(keyword)) {
                schema.put(ADDITIONAL_PROPERTIES, false);
            }
        });

        NESTED_SCHEMA_KEYWORDS.forEach(keyword -> {
            Optional.ofNullable(schema.optJSONObject(keyword))
                    .ifPresent(object ->
                            object.keySet().forEach(key -> enforceStrictValidation(object.getJSONObject(key)))
                    );
        });
    }

    private boolean isEmptySchema(final JSONObject schema) {
        return !(
                OBJECT_SCHEMA_KEYWORDS.stream().anyMatch(schema::has) ||
                        ARRAY_SCHEMA_KEYWORDS.stream().anyMatch(schema::has) ||
                        COMPOSED_SCHEMA_KEYWORDS.stream().anyMatch(schema::has) ||
                        schema.has("$ref") ||
                        schema.has("type")
        );
    }

    private JSONObject wrapSchemaInData(final JSONObject schema, final EventTypeBase eventType) {
        final JSONObject wrapper = new JSONObject();

        normalizeSchema(wrapper);

        addMetadata(wrapper, eventType);

        moveDefinitionsToRoot(wrapper, schema);

        final JSONObject properties = wrapper.getJSONObject("properties");

        properties.put("data_type", new JSONObject().put("type", "string"));
        properties.put("data_op", new JSONObject().put("type", "string")
                .put("enum", Arrays.asList("C", "U", "D", "S")));
        properties.put(EventTypeBase.DATA_CHANGE_WRAP_FIELD, schema);

        wrapper.put(ADDITIONAL_PROPERTIES, false);

        addToRequired(wrapper, new String[]{"data_type", "data_op", "data"});

        return wrapper;
    }

    private static void moveDefinitionsToRoot(final JSONObject wrapper, final JSONObject schema) {
        final Object definitions = schema.remove("definitions");

        if (definitions != null) {
            wrapper.put("definitions", definitions);
        }
    }

    private JSONObject addMetadata(final JSONObject schema, final EventTypeBase eventType) {
        normalizeSchema(schema);
        final JSONObject metadata = createMetadata(eventType.getName(), eventType.getCleanupPolicy());

        schema.getJSONObject("properties").put("metadata", metadata);
        addToRequired(schema, new String[]{"metadata"});
        return schema;
    }

    public JSONObject createMetadata(final String eventTypeName, final CleanupPolicy cleanupPolicy) {
        // We are creating a copy of metadata object, as we are modifying it afterwards.
        final JSONObject metadataSchema = new JSONObject(metadataSchemas.get(cleanupPolicy).toString());

        metadataSchema
                .getJSONObject("properties")
                .getJSONObject("event_type")
                .put("enum", new JSONArray(Collections.singleton(eventTypeName)));
        return metadataSchema;
    }

    private static void addToRequired(final JSONObject schema, final String[] toBeRequired) {
        final Set<String> required = new HashSet<>(Arrays.asList(toBeRequired));

        final JSONArray currentRequired = schema.getJSONArray("required");

        for (int i = 0; i < currentRequired.length(); i++) {
            required.add(currentRequired.getString(i));
        }

        schema.put("required", required);
    }

    private static void normalizeSchema(final JSONObject schema) {
        schema.put("type", "object");

        if (!schema.has("properties")) {
            schema.put("properties", new JSONObject());
        }

        if (!schema.has("required")) {
            schema.put("required", new JSONArray());
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <property name="acs-oauth-secret-production" type="string">19aHAYxpcc27D9ZyuwUxXTbqthoJuTyK</property>
    <property name="acs-oauth-key-production" type="string">9ElE0cIjwG2RBur85n3QwNbplZuYQPsP</property>
    <property name="acs-api-key-production" type="string">RNtYTHO4bf7b4GC8lzEovXr1s43fPweU</property>
    <property name="acs-oauth-secret-development" type="string">t7e7ZzcdAHTCb43pq7xpQLQgpUKtgp2P</property>
    <property name="acs-oauth-key-development" type="string">s0My1xUvu2QUWxtU5eX4WNsZYwPg1Qzf</property>
    <property name="acs-api-key-development" type="string">KhYPGpISvdWirl3LjzWj1i4HP8nTelQ1</property>
    <deployment-targets>
        <target device="mobileweb">true</target>
        <target device="iphone">true</target>
        <target device="ipad">false</target>
        <target device="android">false</target>
        <target device="blackberry">false</target>
    </deployment-targets>
    <sdk-version>2.1.3.GA</sdk-version>
    <id>com.monkeymachin</id>
    <name>EventsAndProperties</name>
    <version>1.0</version>
    <publisher>julioahuactzin</publisher>
    <url>http://monkeymachin.com</url>
    <description>not specified</description>
    <copyright>2013 by julioahuactzin</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>false</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>true</analytics>
    <guid>33c05304-7dad-4d72-9367-8bf1d98c016d</guid>
    <property name="ti.ui.defaultunit">system</property>
    <iphone>
        <orientations device="iphone">
            <orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        <orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
    </iphone>
    <android xmlns:android="http://schemas.android.com/apk/res/android"/>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="commonjs" version="2.3.0">ti.cloud</module>
    </modules>
</ti:app>


text:
title: Getting started
anchor: getting-started
---

###Include Chart.js

First we need to include the Chart.js library on the page. The library occupies a global variable of `Chart`.

```html
<script src="Chart.js"></script>
```

Alternatively, if you're using an AMD loader for JavaScript modules, that is also supported in the Chart.js core. Please note: the library will still occupy a global variable of `Chart`, even if it detects `define` and `define.amd`. If this is a problem, you can call `noConflict` to restore the global Chart variable to it's previous owner.

```javascript
// Using requirejs
require(['path/to/Chartjs'], function(Chart){
	// Use Chart.js as normal here.

	// Chart.noConflict restores the Chart global variable to it's previous owner
	// The function returns what was previously Chart, allowing you to reassign.
	var Chartjs = Chart.noConflict();

});
```

You can also grab Chart.js using bower, npm, or CDN:

```bash
bower install Chart.js --save
```
```bash
npm install Chart.js --save
```

https://cdnjs.com/libraries/chart.js

###Creating a chart

To create a chart, we need to instantiate the `Chart` class. To do this, we need to pass in the node, jQuery instance, or 2d context of the canvas of where we want to draw the chart. Here's an example.

```html
<canvas id="myChart" width="400" height="400"></canvas>
```

```javascript
// Any of the following formats may be used
var ctx = document.getElementById("myChart");
var ctx = document.getElementById("myChart").getContext("2d");
var ctx = $("#myChart");
```

Once you have the element or context, you're ready to instantiate a pre-defined chart-type or create your own!

The following example instantiates a the pre-defined Polar Area chart type with a config object of data and options.
```javascript
var myNewChart = Chart.PolarArea(ctx, {
    data: data,
    options: options
});
```

To create a scatter chart, which is a special configuration of a line chart, we use the following.
```javascript
var myScatterChart = Chart.Scatter(ctx, {
    data: data,
    options: options
});
```

Alternatively, we can use the more advanced API to create simple or advanced chart types. In the example below, we are creating a line chart.
```javascript
var myChart = new Chart(ctx, {
    type: 'line', // built in types are 'line', 'bar', 'radar', 'polarArea', 'doughnut', 'scatter'
    data: data,
    options: options
});
```

###Global chart configuration

This concept was introduced in Chart.js 1.0 to keep configuration DRY, and allow for changing options globally across chart types, avoiding the need to specify options for each instance, or the default for a particular chart type.

Chart.js merges configurations and options in a few places with the global defaults using chart type defaults and scales defaults. This way you can be as specific as you want in your individual chart configs, or change the defaults for Chart.js as a whole.

```javascript
Chart.defaults.global = {
    responsive: true,
    responsiveAnimationDuration: 0,
    maintainAspectRatio: true,
    events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"],
    hover: {
        onHover: null,
        mode: 'single',
        animationDuration: 400,
    },
    onClick: null,
    defaultColor: 'rgba(0,0,0,0.1)',

    // Element defaults defined in element extensions
    elements: {},

    // Legend callback function.
    // @param {Chart} chart : the chart object to generate a legend for
    legendCallback: function(chart) {
        var text = [];
        text.push('<ul class="' + chart.id + '-legend">');
        for (var i = 0; i < chart.data.datasets.length; i++) {
            text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '">');
            if (chart.data.datasets[i].label) {
                text.push(chart.data.datasets[i].label);
            }
            text.push('</span></li>');
        }
        text.push('</ul>');

        return text.join("");
    },

    animation: {
        duration: 1000,
        easing: "easeOutQuart",
        onProgress: function() {},
        onComplete: function() {},
    },

    tooltips:{
        enabled: true,
        custom: null,
        backgroundColor: "rgba(0,0,0,0.8)",
        fontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
        fontSize: 10,
        fontStyle: "normal",
        fontColor: "#fff",
        titleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
        titleFontSize: 12,
        titleFontStyle: "bold",
        titleFontColor: "#fff",
        yPadding: 6,
        xPadding: 6,
        caretSize: 8,
        cornerRadius: 6,
        xOffset: 10,
        // V2.0 introduces callback functions as a replacement for the template engine in v1. The tooltip
        // has the following callbacks for providing text. For all functions, 'this' will be the tooltip object
        // create from the Chart.Tooltip constructor
        //
        // All functions are called with the same arguments
        // - xLabel : string or array of strings. This is the xDataValue for each item to be displayed in the tooltip
        // - yLabel : string or array of strings. This is the yDataValue for each item to be displayed in the tooltip
        // - index : number. Data index
        // - datasetIndex : number. Dataset index
        // - data : object. Data object passed to chart
        callbacks: {
            beforeTitle: helpers.noop,
            title: function(xLabel, yLabel, index, datasetIndex, data) {
                // If there are multiple items, use the xLabel of the
                return helpers.isArray(xLabel) ? xLabel[0] : xLabel;
            },
            afterTitle: helpers.noop,

            beforeBody: helpers.noop,

            beforeLabel: helpers.noop,
            label: function(xLabel, yLabel, index, datasetIndex, data) {
                return this._data.datasets[datasetIndex].label + ': ' + yLabel;
            },
            afterLabel: helpers.noop,

            afterBody: helpers.noop,

            beforeFooter: helpers.noop,
            footer: helpers.noop,
            afterFooter: helpers.noop,
        },
        multiKeyBackground: '#fff',
    },

    elements: {
        arc: {
            backgroundColor: Chart.defaults.global.defaultColor,
            borderColor: "#fff",
            borderWidth: 2
        },
        line: {
            tension: 0.4,
            backgroundColor: Chart.defaults.global.defaultColor,
            borderWidth: 3,
            borderColor: Chart.defaults.global.defaultColor,
            borderCapStyle: 'butt',
            borderDash: [],
            borderDashOffset: 0.0,
            borderJoinStyle: 'miter',
            fill: true, // do we fill in the area between the line and its base axis
            skipNull: true,
            drawNull: false,
        },
        point: {
            radius: 3,
            backgroundColor: Chart.defaults.global.defaultColor,
            borderWidth: 1,
            borderColor: Chart.defaults.global.defaultColor,
            // Hover
            hitRadius: 1,
            hoverRadius: 4,
            hoverBorderWidth: 1,
        },
        rectangle: {
            backgroundColor: Chart.defaults.global.defaultColor,
            borderWidth: 0,
            borderColor: Chart.defaults.global.defaultColor,
        }

    }
}
```

If for example, you wanted all charts created to be responsive, and resize when the browser window does, the following setting can be changed:

```javascript
Chart.defaults.global.responsive = true;
```

Now, every time we create a chart, `options.responsive` will be `true`.


text:
package net.sf.mmm.client.ui.base.widget.window.adapter;

/**
 * This is the interface for a {@link net.sf.mmm.client.ui.base.widget.adapter.UiWidgetAdapter} adapting
 * {@link net.sf.mmm.client.ui.api.widget.window.UiWidgetWindow}.
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public interface UiWidgetAdapterWindow extends UiWidgetAdapterAbstractDialogWindow {

  // nothing to add

}


text:
package be.acrosoft.gaia.shared.rich.readers.rtf;

/**
 * Destination.
 */
public interface Destination
{
  /**
   * Write raw string on the Destination.
   * @param s string to write.
   * @param context current context.
   * @param global global information.
   */
  public void write(String s,Context context,Global global);

  /**
   * Write one control code to the destination.
   * @param code control code.
   * @param parameter control parameter, or null if no parameter is supplied.
   * @param context current context.
   * @param global global information.
   */
  public void control(String code,String parameter,Context context,Global global);

  /**
   * Enter the destination.
   * @param context current context.
   * @param global global information.
   */
  public void enter(Context context,Global global);

  /**
   * Leave the destination.
   * @param context current context.
   * @param global global information.
   */
  public void leave(Context context,Global global);

  /**
   * Check whether the destination supports the given extended control code.
   * @param code control code.
   * @param context current context.
   * @param global global information.
   * @return true if destination supports control code, false otherwise.
   */
  public boolean supportsExtended(String code,Context context,Global global);
}


text:
namespace std {

  namespace {

    template<class Value, class Hash> class hash_traits {
      Hash hash_value;
      std::less<Value> comp;
    public:
      enum {
        bucket_size = 4,
        min_buckets = 8
      };
      // hash _Keyval to size_t value
      size_t operator()(const Value& v) const {
        return ((size_t)hash_value(v));
      }
      // test if _Keyval1 ordered before _Keyval2
      bool operator()(const Value& v1, const Value& v2) const {
        return (comp(v1, v2));
      }
    };

  }

  template <typename Key, typename T, typename Hash = stdext::hash_compare<Key, less<Key> >, typename Pred = std::equal_to<Key> >
  class unordered_map
    : public stdext::hash_map<Key, T, hash_traits<Key, Hash> > {
    typedef stdext::hash_map<Key, T, hash_traits<Key, Hash> > super;
  public:
    unordered_map() : super() {}
  };

  template <typename Value, typename Hash = stdext::hash_compare<Key, less<Key> >, typename Pred = std::equal_to<Value> >
  class unordered_set
    : public stdext::hash_set<Value, hash_traits<Value, Hash> > {
    typedef stdext::hash_set<Value, hash_traits<Value, Hash> > super;
  public:
    unordered_set() : super() {}
  };

}

#undef UNORDERED_COLLECTIONS_SUPPORT_RESIZE


text:
package com.amazonaws.services.rds.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.rds.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * DescribeDBInstancesRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeDBInstancesRequestMarshaller implements Marshaller<Request<DescribeDBInstancesRequest>, DescribeDBInstancesRequest> {

    public Request<DescribeDBInstancesRequest> marshall(DescribeDBInstancesRequest describeDBInstancesRequest) {

        if (describeDBInstancesRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<DescribeDBInstancesRequest> request = new DefaultRequest<DescribeDBInstancesRequest>(describeDBInstancesRequest, "AmazonRDS");
        request.addParameter("Action", "DescribeDBInstances");
        request.addParameter("Version", "2014-10-31");
        request.setHttpMethod(HttpMethodName.POST);

        if (describeDBInstancesRequest.getDBInstanceIdentifier() != null) {
            request.addParameter("DBInstanceIdentifier", StringUtils.fromString(describeDBInstancesRequest.getDBInstanceIdentifier()));
        }

        if (!describeDBInstancesRequest.getFilters().isEmpty()
                || !((com.amazonaws.internal.SdkInternalList<Filter>) describeDBInstancesRequest.getFilters()).isAutoConstruct()) {
            com.amazonaws.internal.SdkInternalList<Filter> filtersList = (com.amazonaws.internal.SdkInternalList<Filter>) describeDBInstancesRequest
                    .getFilters();
            int filtersListIndex = 1;

            for (Filter filtersListValue : filtersList) {

                if (filtersListValue.getName() != null) {
                    request.addParameter("Filters.Filter." + filtersListIndex + ".Name", StringUtils.fromString(filtersListValue.getName()));
                }

                if (!filtersListValue.getValues().isEmpty()
                        || !((com.amazonaws.internal.SdkInternalList<String>) filtersListValue.getValues()).isAutoConstruct()) {
                    com.amazonaws.internal.SdkInternalList<String> valuesList = (com.amazonaws.internal.SdkInternalList<String>) filtersListValue.getValues();
                    int valuesListIndex = 1;

                    for (String valuesListValue : valuesList) {
                        if (valuesListValue != null) {
                            request.addParameter("Filters.Filter." + filtersListIndex + ".Values.Value." + valuesListIndex,
                                    StringUtils.fromString(valuesListValue));
                        }
                        valuesListIndex++;
                    }
                }
                filtersListIndex++;
            }
        }

        if (describeDBInstancesRequest.getMaxRecords() != null) {
            request.addParameter("MaxRecords", StringUtils.fromInteger(describeDBInstancesRequest.getMaxRecords()));
        }

        if (describeDBInstancesRequest.getMarker() != null) {
            request.addParameter("Marker", StringUtils.fromString(describeDBInstancesRequest.getMarker()));
        }

        return request;
    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace ODataValidator.RuleEngine
{
    #region Namespace.
    using System.ComponentModel.DataAnnotations;
    #endregion

    /// <summary>
    /// The Service Implemantation Category Name enum class.
    /// </summary>
    public enum ServiceImplCategoryName : byte
    {
        [Display(Name = "None")]
        None = 0x00,

        #region Level 1
        [Display(Name = "Asynchronous Requests")]
        AsynchronousRequests,

        [Display(Name = "Batch Requests")]
        BatchRequests,

        [Display(Name = "Data Modification")]
        DataModification,

        [Display(Name = "Metadata Requests")]
        MetadataRequests,

        [Display(Name = "Operations")]
        Operations,

        [Display(Name = "Requesting Changes")]
        RequestingChanges,

        [Display(Name = "Requesting Data")]
        RequestingData,

        [Display(Name = "Response Headers")]
        ResponseHeaders,
        #endregion

        #region Level 2
        [Display(Name = "Managing Media Entities")]
        ManagingMediaEntities,

        [Display(Name = "Managing Stream Properties")]
        ManagingStreamProperties,

        [Display(Name = "Managing Values and Properties Directly")]
        ManagingValues_Properties,

        [Display(Name = "Modifying Relationships between Entities")]
        ModifyingRelationships,

        [Display(Name = "System Query Option")]
        SystemQueryOption,
        #endregion

        #region Level 3
        [Display(Name = "Arithmetic Operators")]
        ArithmeticOperators,

        [Display(Name = "Canonical Functions")]
        CanonicalFunctions,

        [Display(Name = "Lambda Operators")]
        LambdaOperators,

        [Display(Name = "Logical Operators")]
        LogicalOperators,

        [Display(Name = "Operators")]
        Operators
        #endregion
    }
}


text:
package org.apache.accumulo.test.functional;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.Random;
import java.util.TreeSet;

import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
import org.apache.accumulo.tserver.compaction.CompactionPlan;
import org.apache.accumulo.tserver.compaction.CompactionStrategy;
import org.apache.accumulo.tserver.compaction.MajorCompactionRequest;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;

import com.google.common.collect.Iterators;

public class ConfigurableCompactionIT extends ConfigurableMacBase {

  @Override
  public int defaultTimeoutSeconds() {
    return 2 * 60;
  }

  @Override
  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
  }

  public static class SimpleCompactionStrategy extends CompactionStrategy {

    @Override
    public void init(Map<String,String> options) {
      String countString = options.get("count");
      if (countString != null)
        count = Integer.parseInt(countString);
    }

    int count = 3;

    @Override
    public boolean shouldCompact(MajorCompactionRequest request) throws IOException {
      return request.getFiles().size() == count;

    }

    @Override
    public CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws IOException {
      CompactionPlan result = new CompactionPlan();
      result.inputFiles.addAll(request.getFiles().keySet());
      return result;
    }

  }

  @Test
  public void test() throws Exception {
    final Connector c = getConnector();
    final String tableName = getUniqueNames(1)[0];
    c.tableOperations().create(tableName);
    c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(), SimpleCompactionStrategy.class.getName());
    runTest(c, tableName, 3);
    c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey() + "count", "" + 5);
    runTest(c, tableName, 5);
  }

  @Test
  public void testPerTableClasspath() throws Exception {
    final Connector c = getConnector();
    final String tableName = getUniqueNames(1)[0];
    File destFile = installJar(getCluster().getConfig().getAccumuloDir(), "/TestCompactionStrat.jar");
    c.tableOperations().create(tableName);
    c.instanceOperations().setProperty(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", destFile.toString());
    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
    c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
    // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No other tablets are compacted.
    c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(), "org.apache.accumulo.test.EfgCompactionStrat");

    c.tableOperations().addSplits(tableName, new TreeSet<Text>(Arrays.asList(new Text("efg"))));

    for (char ch = 'a'; ch < 'l'; ch++)
      writeFlush(c, tableName, ch + "");

    while (countFiles(c, tableName) != 7) {
      UtilWaitThread.sleep(200);
    }
  }

  private static File installJar(File destDir, String jarFile) throws IOException {
    File destName = new File(destDir, new File(jarFile).getName());
    FileUtils.copyInputStreamToFile(ConfigurableCompactionIT.class.getResourceAsStream(jarFile), destName);
    return destName;
  }

  private void writeFlush(Connector conn, String tablename, String row) throws Exception {
    BatchWriter bw = conn.createBatchWriter(tablename, new BatchWriterConfig());
    Mutation m = new Mutation(row);
    m.put("", "", "");
    bw.addMutation(m);
    bw.close();
    conn.tableOperations().flush(tablename, null, null, true);
  }

  final static Random r = new Random();

  private void makeFile(Connector conn, String tablename) throws Exception {
    BatchWriter bw = conn.createBatchWriter(tablename, new BatchWriterConfig());
    byte[] empty = {};
    byte[] row = new byte[10];
    r.nextBytes(row);
    Mutation m = new Mutation(row, 0, 10);
    m.put(empty, empty, empty);
    bw.addMutation(m);
    bw.flush();
    bw.close();
    conn.tableOperations().flush(tablename, null, null, true);
  }

  private void runTest(final Connector c, final String tableName, final int n) throws Exception {
    for (int i = countFiles(c, tableName); i < n - 1; i++)
      makeFile(c, tableName);
    Assert.assertEquals(n - 1, countFiles(c, tableName));
    makeFile(c, tableName);
    for (int i = 0; i < 10; i++) {
      int count = countFiles(c, tableName);
      assertTrue(count == 1 || count == n);
      if (count == 1)
        break;
      UtilWaitThread.sleep(1000);
    }
  }

  private int countFiles(Connector c, String tableName) throws Exception {
    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
    return Iterators.size(s.iterator());
  }

}


text:
from time import time
import marshal
t0=time()
total = 0
with open('test_1m.marshal','rb') as f:
	while True:
		try:
			rec = marshal.load(f)
		except EOFError: break
		for x in rec:
			total += x
print(total)
print(time()-t0)