text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2005-2014 Red Hat, Inc.

     Red Hat licenses this file to you under the Apache License, version
     2.0 (the "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at

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

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

-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fabric-project</artifactId>
        <groupId>io.fabric8</groupId>
        <version>1.2.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>fabric-docker-provider</artifactId>
    <name>Fabric8 :: Docker :: Container Provider</name>
    <packaging>bundle</packaging>

    <properties>
        <fuse.osgi.export>
            io.fabric8.docker.provider*;-noimport:=true,
            io.fabric8.docker.provider.commands;-noimport:=true,
        </fuse.osgi.export>
        <fuse.osgi.import>
          org.osgi.service.event*;resolution:=optional,
          io.fabric8.docker.api*,
          <!--
                CXF version
          javax.ws.rs;version="[2.0,3.0)",
          javax.ws.rs.core;version="[2.0,3.0)",
          javax.ws.rs.client;version="[2.0,3.0)",
          javax.ws.rs.container;version="[2.0,3.0)",
          javax.ws.rs.ext;version="[2.0,3.0)",
          -->
          <!-- resteasy version -->
          !javax.ws.rs*,

          <!-- avoid unnecessary stuff from plexus.archiver -->
          !org.codehaus.classworlds*,
          !junit.framework*,
          !org.apache.commons.compress.compressors.bzip2*,
          !hidden.org.codehaus.plexus*,
          !org.apache.velocity*,
          !org.apache.xbean*,

          *
        </fuse.osgi.import>
        <fuse.osgi.private.pkg>
          <!-- plexus.archiver for TarArchive -->
          org.codehaus.plexus.*;-split-package:=first,
          org.apache.commons.compress.*;-split-package:=first,
          org.tukaani.*;-split-package:=first,

          io.fabric8.utils.features;-split-package:=first,
          io.fabric8.utils;-split-package:=first,
          io.fabric8.utils.shell;-split-package:=first,
          org.apache.karaf.features.*;-split-package:=first,
          org.apache.karaf.util.collections.*;-split-package:=first,
          org.apache.karaf.util;-split-package:=first,
          org.apache.felix.utils.*;-split-package:=first,
          org.ops4j.pax.url.maven.commons.*;-split-package:=first,
          org.ops4j.util.collections.*;-split-package:=first,
          org.ops4j.util.xml.*;-split-package:=first,
        </fuse.osgi.private.pkg>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>common-util</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jgit</groupId>
            <artifactId>org.eclipse.jgit</artifactId>
            <version>${jgit-version}</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-api</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-docker-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-archiver</artifactId>
          <version>2.4.1</version>
        </dependency>

      <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-project-deployer</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-process-container</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-boot-commands</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-commands</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-utils</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-groups</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-zookeeper</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-agent</artifactId>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-git</artifactId>
        </dependency>

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.annotations</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>scr</goal>
                        </goals>
                        <configuration>
                            <specVersion>1.2</specVersion>
                            <strictMode>false</strictMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Package org.jboss.netty.channel.group (Netty API Reference (3.10.1.Final))</title>
<meta name="date" content="2015-03-23">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.jboss.netty.channel.group

Packages that use org.jboss.netty.channel.group

Package
Description

org.jboss.netty.channel.group

A channel registry which helps a user maintain the list of open
 Channels and perform bulk operations on them.

Classes in org.jboss.netty.channel.group used by org.jboss.netty.channel.group

Class and Description

ChannelGroup

A thread-safe Set that contains open Channels and provides
 various bulk operations on them.

ChannelGroupFuture

The result of an asynchronous ChannelGroup operation.

ChannelGroupFutureListener

Listens to the result of a ChannelGroupFuture.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2008-2015 The Netty Project. All Rights Reserved.

redpajama_set_name: RedPajamaGithub


text:
<?php

declare(strict_types=1);

namespace ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * Dummy with different serialization groups for item_query and collection_query.
 *
 * @author Mahmood Bazdar <mahmood@bazdar.me>
 *
 * @ApiResource(
 *     graphql={
 *         "item_query"={"normalization_context"={"groups"={"item_query"}}},
 *         "collection_query"={"normalization_context"={"groups"={"collection_query"}}}
 *     }
 * )
 * @ORM\Entity
 */
class DummyDifferentGraphQlSerializationGroup
{
    /**
     * @var int The id
     *
     * @ORM\Column(type="integer", nullable=true)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Groups({"item_query", "collection_query"})
     */
    private $id;

    /**
     * @var string The dummy name
     *
     * @ORM\Column
     * @Groups({"item_query", "collection_query"})
     */
    private $name;

    /**
     * @var string The dummy title
     *
     * @ORM\Column(nullable=true)
     * @Groups({"item_query"})
     */
    private $title;

    public function getId(): int
    {
        return $this->id;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getTitle(): string
    {
        return $this->title;
    }

    public function setTitle(string $title): self
    {
        $this->title = $title;

        return $this;
    }
}


text:
@interface VideoFeedNodeController ()<ASTableDelegate, ASTableDataSource>

@end

@implementation VideoFeedNodeController
{
  ASTableNode *_tableNode;
  NSMutableArray<VideoModel*> *_videoFeedData;
}

- (instancetype)init
{
  self.navigationItem.title = @"Home";
  _tableNode = [[ASTableNode alloc] init];
  _tableNode.delegate = self;
  _tableNode.dataSource = self;

  if (!(self = [super initWithNode:_tableNode])) {
    return nil;
  }

  return self;
}

- (void)loadView
{
  [super loadView];

  [self generateFeedData];

  [_tableNode.view reloadData];
}

- (void)generateFeedData
{
  _videoFeedData = [[NSMutableArray alloc] init];

  for (int i = 0; i < 30; i++) {
    [_videoFeedData addObject:[[VideoModel alloc] init]];
  }
}

#pragma mark - ASCollectionDelegate - ASCollectionDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  return _videoFeedData.count;
}

- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath
{
  VideoModel *videoObject = [_videoFeedData objectAtIndex:indexPath.row];
  VideoContentCell *cellNode = [[VideoContentCell alloc] initWithVideoObject:videoObject];
  return cellNode;
}
@end


text:
<?php

namespace Hyper\AdsBundle\Payment\Util;

use Hyper\AdsBundle\Payment\OrderInterface;

class HmacOrderHashGenerator implements OrderHashGeneratorInterface
{
    private $hashAlgorithm;
    private $hashKey;

    public function __construct($hashAlgorithm, $hashKey)
    {
        $this->hashAlgorithm = $hashAlgorithm;
        $this->hashKey = $hashKey;
    }

    public function hashOrder(OrderInterface $order)
    {
        return hash_hmac($this->hashAlgorithm, $this->getHash($order), $this->hashKey);
    }

    private function getHash(OrderInterface $order)
    {
        return $order->getId() . '_' . $order->getPaymentInstruction()->getId();
    }
}


text:
#pragma once

class LuaLinker
{
public:
    static bool Link(void);
};


text:
// Copyright 2017 Ryan Caille
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using FluentAssertions;
using Newtonsoft.Json;
using System.Threading.Tasks;
using TooManyRules.Engine.Evaluators;
using TooManyRules.Models;
using TooManyRules.Tests.TestObjects;
using Xunit;
using Numerical = TooManyRules.Engine.Evaluators.Numerical;

namespace TooManyRules.Tests
{
    public class EvaluationTests
    {
        [Fact]
        public void EvaulatingRulesThatDoNotExistShouldNotSucceed()
        {
            using (var factory = new ControllerFactory())
            {
                var engine = factory.CreateRuleEngine();

                var result = engine.EvaluateRule("sys", "NotARule", null);
                result.Should().NotBeNull();
                result.Success.Should().BeFalse();
            }
        }

        [Fact]
        public async Task RulesWithEmptyDefinitionShouldSucceed()
        {
            using (var factory = new ControllerFactory())
            {
                var service = factory.CreateRulesService();

                await service.Add(new Rule
                {
                    Name = "ThisIsARule",
                    Definition = JsonConvert.SerializeObject(new {})
                });

                var engine = factory.CreateRuleEngine();

                var result = engine.EvaluateRule("sys", "ThisIsARule", null);
                result.Should().NotBeNull();
                result.Success.Should().BeTrue();
            }
        }

        [Fact]
        public void EqualityEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.EqualityEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.EqualTo);

            evaluator.Evaluate(0, 0).Should().BeTrue();
            evaluator.Evaluate(-1, 0).Should().BeFalse();
            evaluator.Evaluate(1, 0).Should().BeFalse();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeTrue();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeFalse();
        }

        [Fact]
        public void InequalityEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.InequalityEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.NotEqualTo);

            evaluator.Evaluate(0, 0).Should().BeFalse();
            evaluator.Evaluate(-1, 0).Should().BeTrue();
            evaluator.Evaluate(1, 0).Should().BeTrue();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeFalse();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeTrue();
        }

        [Fact]
        public void GreaterThanEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.GreaterThanEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.GreaterThan);

            evaluator.Evaluate(0, 0).Should().BeFalse();
            evaluator.Evaluate(-1, 0).Should().BeFalse();
            evaluator.Evaluate(1, 0).Should().BeTrue();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeFalse();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeTrue();
        }

        [Fact]
        public void GreaterThanOrEqualToEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.GreaterThanOrEqualToEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.GreaterThanOrEqualTo);

            evaluator.Evaluate(0, 0).Should().BeTrue();
            evaluator.Evaluate(-1, 0).Should().BeFalse();
            evaluator.Evaluate(1, 0).Should().BeTrue();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeTrue();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeTrue();
        }

        [Fact]
        public void LessThanEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.LessThanEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.LessThan);

            evaluator.Evaluate(0, 0).Should().BeFalse();
            evaluator.Evaluate(-1, 0).Should().BeTrue();
            evaluator.Evaluate(1, 0).Should().BeFalse();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeFalse();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeFalse();
        }

        [Fact]
        public void LessThanOrEqualToEvaluatorShouldEvaluateNumbersCorrectly()
        {
            var evaluator = new Numerical.LessThanOrEqualToEvaluator();

            evaluator.Operator.Should().Be(BinaryOperators.LessThanOrEqualTo);

            evaluator.Evaluate(0, 0).Should().BeTrue();
            evaluator.Evaluate(-1, 0).Should().BeTrue();
            evaluator.Evaluate(1, 0).Should().BeFalse();
            evaluator.Evaluate(999999999999, 999999999999).Should().BeTrue();
            evaluator.Evaluate(99999.9999999m, 99999.9999999m).Should().BeTrue();
            evaluator.Evaluate(199999.9999999m, 99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(199999.9999999m, -99999.9999999m).Should().BeFalse();
            evaluator.Evaluate(0, -99999.9999999m).Should().BeFalse();
        }
    }
}


text:
<!DOCTYPE HTML>

  <title>Test for Bug 742376</title>

  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

Mozilla Bug 742376


text:
package org.ihtsdo.otf.query.integration.tests;

import java.io.IOException;
import org.ihtsdo.otf.tcc.api.coordinate.StandardViewCoordinates;
import org.ihtsdo.otf.tcc.api.metadata.binding.Snomed;
import org.ihtsdo.otf.tcc.api.nid.NativeIdSetBI;
import org.ihtsdo.otf.query.implementation.Clause;
import org.ihtsdo.otf.query.implementation.Query;
import org.ihtsdo.otf.tcc.api.nid.ConcurrentBitSet;
import org.ihtsdo.otf.tcc.api.nid.NativeIdSetItrBI;
import org.ihtsdo.otf.tcc.api.store.Ts;

/**
 * Creates a test for ChangedFromPreviousVersion clause.
 *
 * @author dylangrald
 */
public class ChangedFromPreviousVersionTest extends QueryClauseTest {

    NativeIdSetBI forSet;

    public ChangedFromPreviousVersionTest() throws IOException {
        this.q = new Query() {
            @Override
            protected NativeIdSetBI For() throws IOException {
                forSet = new ConcurrentBitSet();
                forSet.or(Ts.get().isChildOfSet(Snomed.CLINICAL_FINDING.getNid(), StandardViewCoordinates.getSnomedInferredLatest()));
                forSet.add(Snomed.CLINICAL_FINDING.getNid());
                return forSet;
            }

            @Override
            public void Let() throws IOException {
                SetViewCoordinate setViewCoordinate = new SetViewCoordinate(2010, 1, 31, 0, 0);
                let("v2", setViewCoordinate.getViewCoordinate());
            }

            @Override
            public Clause Where() {
                return Or(ChangedFromPreviousVersion("v2"));
            }
        };

    }
}


text:
extern crate fred;
extern crate tokio_core;
extern crate tokio_timer_patched as tokio_timer;
extern crate futures;

use fred::RedisClient;
use fred::owned::RedisClientOwned;

use fred::types::*;
use fred::error::*;

use tokio_core::reactor::Core;
use futures::Future;
use futures::stream::{
  self,
  Stream
};
use futures::future::{
  self,
  Either
};

use tokio_timer::Timer;
use std::time::Duration;

fn main() {
  let timer = Timer::default();

  let foo_config = RedisConfig::default();
  let bar_config = RedisConfig::default();
  let baz_config = RedisConfig::default();

  let mut core = Core::new().unwrap();
  let handle = core.handle();

  let foo_client = RedisClient::new(foo_config, Some(timer.clone()));
  let bar_client = RedisClient::new(bar_config, Some(timer.clone()));
  let baz_client = RedisClient::new(baz_config, Some(timer.clone()));

  let foo_connection = foo_client.connect(&handle);
  let bar_connection = bar_client.connect(&handle);
  let baz_connection = baz_client.connect(&handle);

  // join all the connection futures together
  let joined_connections = foo_connection
    .join(bar_connection)
    .join(baz_connection);

  // create error handlers for all the clients
  let foo_errors = foo_client.on_error().for_each(|err| {
    println!("Foo client error: {:?}", err);
    Ok(())
  });
  let bar_errors = bar_client.on_error().for_each(|err| {
    println!("Bar client error: {:?}", err);
    Ok(())
  });
  let baz_errors = baz_client.on_error().for_each(|err| {
    println!("Baz client error: {:?}", err);
    Ok(())
  });

  // join the error stream futures together into one future
  let joined_errors = foo_errors
    .join(bar_errors)
    .join(baz_errors);

  // next create futures representing the commands that each client should run...

  // read `foo`, wait 10 seconds, quit
  let foo_commands = foo_client.on_connect().and_then(|foo_client| {
    println!("Foo client connected.");

    foo_client.get("foo")
  })
  .and_then(|(foo_client, value)| {
    println!("Foo client got `foo`: {:?}. Sleeping for 10 seconds...", value);

    let timer = Timer::default();
    timer.sleep(Duration::from_millis(10 * 1000)).from_err::<RedisError>()
      .map(move |_| foo_client)
  })
  .and_then(|foo_client| {
    println!("Closing foo client...");

    foo_client.quit()
  });

  // increment `bar`, quit
  let bar_commands = bar_client.on_connect().and_then(|bar_client| {
    println!("Bar client connected.");

    bar_client.incr("bar")
  })
  .and_then(|(bar_client, value)| {
    println!("Bar client incremented `bar`: {:?}. Closing bar client...", value);

    bar_client.quit()
  });

  // set `foo` to `1`, decrement `bar`, quit
  let baz_commands = baz_client.on_connect().and_then(|baz_client| {
    println!("Baz client connected.");

    baz_client.set("foo", 1, None, None)
  })
  .and_then(|(baz_client, _)| {
    baz_client.decr("bar")
  })
  .and_then(|(baz_client, value)| {
    println!("Baz client decremented `bar` to {:?}. Closing baz client...", value);

    baz_client.quit()
  });

  // join the command futures from the clients together
  let joined_commands = foo_commands
    .join(bar_commands)
    .join(baz_commands);

  // join the connection futures, error handler futures, and command futures into one future, and run that
  let joined = joined_connections
    .join(joined_errors)
    .join(joined_commands);

  let _ = core.run(joined).unwrap();
}


text:
@echo off

cd %~dp0

if exist *.benchmark-lock del *.benchmark-lock
if exist .output del .output

node ../benchmark/index %1 --validate-method >> .output
if NOT %errorlevel% == 0 (
    echo.
    echo usage:
    echo        benchmark.cmd method
    echo.
    type .output
    echo.
    del .output
    pause
    exit errorlevel
)
del .output

echo low load (1k requests in 2s)
start /b cmd /c "node ../benchmark/index %1 2000 200 && type nul > 1.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 200 && type nul > 2.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 200 && type nul > 3.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 200 && type nul > 4.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 200 && type nul > 5.benchmark-lock"
:loop1
set cnt=0
for %%A in (*.benchmark-lock) do set /a cnt+=1
if %cnt% == 5 goto :next1
goto loop1
:next1
del *.benchmark-lock

echo normal load (10k requests in 2s)
start /b cmd /c "node ../benchmark/index %1 2000 2000 && type nul > 1.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 2000 && type nul > 2.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 2000 && type nul > 3.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 2000 && type nul > 4.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 2000 && type nul > 5.benchmark-lock"
:loop2
set cnt=0
for %%A in (*.benchmark-lock) do set /a cnt+=1
if %cnt% == 5 goto :next2
goto loop2
:next2
del *.benchmark-lock

echo high load (30k requests in 2s)
start /b cmd /c "node ../benchmark/index %1 2000 6000 && type nul > 1.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 6000 && type nul > 2.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 6000 && type nul > 3.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 6000 && type nul > 4.benchmark-lock"
start /b cmd /c "node ../benchmark/index %1 2000 6000 && type nul > 5.benchmark-lock"
:loop3
set cnt=0
for %%A in (*.benchmark-lock) do set /a cnt+=1
if %cnt% == 5 goto :next3
goto loop3
:next3
del *.benchmark-lock

pause
@echo on


text:
using System;
using System.Threading.Tasks;
using Crichton.Client.QuerySteps;
using Crichton.Representors;
using NUnit.Framework;
using Ploeh.AutoFixture;
using Rhino.Mocks;

namespace Crichton.Client.Tests.QuerySteps
{
    public class NavigateToRepresentorQueryStepTests : TestWithFixture
    {
        private NavigateToRepresentorQueryStep sut;
        private CrichtonRepresentor representor;
        private ITransitionRequestHandler requestor;

        [SetUp]
        public void Init()
        {
            Fixture = GetFixture();
            representor = Fixture.Create<CrichtonRepresentor>();
            sut = new NavigateToRepresentorQueryStep(representor);
            requestor = MockRepository.GenerateMock<ITransitionRequestHandler>();
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void CTOR_SetsNullUrl()
        {
            var step = new NavigateToRepresentorQueryStep(null);
        }

        [Test]
        public async Task ExecuteAsync_ReturnsConstructorSetRepresentor()
        {
            var result = await sut.ExecuteAsync(representor, requestor);

            Assert.AreEqual(result, representor);
        }
    }
}


text:
export LD_LIBRARY_PATH+="/usr/local/lib:..:"
./test


text:
// Karma configuration
// http://karma-runner.github.io/0.13/config/configuration-file.html

var sourcePreprocessors = ['coverage'];

function isDebug() {
    return process.argv.indexOf('--debug') >= 0;
}

if (isDebug()) {
    // Disable JS minification if Karma is run with debug option.
    sourcePreprocessors = [];
}

module.exports = function (config) {
    config.set({
        // base path, that will be used to resolve files and exclude
        basePath: 'src/test/javascript/'.replace(/[^/]+/g, '..'),

        // testing framework to use (jasmine/mocha/qunit/...)
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            // bower:js
            // endbower
            'src/main/webapp/app/app.module.js',
            'src/main/webapp/app/app.state.js',
            'src/main/webapp/app/app.constants.js',
            'src/main/webapp/app/**/*.+(js|html)',
            'src/test/javascript/spec/helpers/module.js',
            'src/test/javascript/spec/helpers/httpBackend.js',
            'src/test/javascript/**/!(karma.conf).js'
        ],

        // list of files / patterns to exclude
        exclude: ['**/*.template.js'],

        preprocessors: {
            './**/*.js': sourcePreprocessors
        },

        reporters: ['dots', 'junit', 'coverage', 'progress'],

        junitReporter: {
            outputFile: '../target/test-results/karma/TESTS-results.xml'
        },

        coverageReporter: {
            dir: 'target/test-results/coverage',
            reporters: [
                {type: 'lcov', subdir: 'report-lcov'}
            ]
        },

        // web server port
        port: 9876,

        // level of logging
        // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: false,

        // Start these browsers, currently available:
        // - Chrome
        // - ChromeCanary
        // - Firefox
        // - Opera
        // - Safari (only Mac)
        // - PhantomJS
        // - IE (only Windows)
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: false,

        // to avoid DISCONNECTED messages when connecting to slow virtual machines
        browserDisconnectTimeout: 10000, // default 2000
        browserDisconnectTolerance: 1, // default 0
        browserNoActivityTimeout: 4 * 60 * 1000 //default 10000
    });
};


text:
using System;
using System.Linq;
using NUnit.Framework;
using StructureMap.Configuration.DSL;
using StructureMap.Graph;
using StructureMap.Query;
using StructureMap.Testing.GenericWidgets;
using StructureMap.Testing.Graph;
using StructureMap.Testing.Widget;

namespace StructureMap.Testing
{
    [TestFixture]
    public class ModelQueryTester
    {
        #region Setup/Teardown

        [SetUp]
        public void SetUp()
        {
            var registry = new Registry();
            registry.ForRequestedType(typeof (IService<>))
                .AddConcreteType(typeof (Service<>))
                .AddConcreteType(typeof (Service2<>));

            registry.BuildInstancesOf<ISomething>()
                .TheDefaultIsConcreteType<SomethingOne>()
                .AddConcreteType<SomethingTwo>();

            registry.BuildInstancesOf<IServiceProvider>().AddConcreteType<MyDataSet>().AddConcreteType<MyDataView>();

            PluginGraph graph = registry.Build();
            var pipeline = new PipelineGraph(graph);

            _model = new Container(graph).Model;

            _container = new Container(graph);
        }

        #endregion

        public class MyDataSet : IServiceProvider
        {
            public object GetService(Type serviceType)
            {
                throw new NotImplementedException();
            }
        }

        public class MyDataView : IServiceProvider
        {
            public object GetService(Type serviceType)
            {
                throw new NotImplementedException();
            }
        }

        private IModel _model;
        private Container _container;

        [Test]
        public void HasImplementationFor()
        {
            _model.HasDefaultImplementationFor(typeof (ISomething)).ShouldBeTrue();
            _model.HasDefaultImplementationFor(GetType()).ShouldBeFalse();
            _model.HasDefaultImplementationFor(typeof (IServiceProvider)).ShouldBeFalse();
        }

        [Test]
        public void HasImplementationFor_w_container()
        {
            _container.Model.HasDefaultImplementationFor(typeof (ISomething)).ShouldBeTrue();
            _container.Model.HasDefaultImplementationFor(GetType()).ShouldBeFalse();
            _container.Model.HasDefaultImplementationFor(typeof (IServiceProvider)).ShouldBeFalse();
        }

        [Test]
        public void HasImplementationsFor()
        {
            _model.HasImplementationsFor(typeof (ISomething)).ShouldBeTrue();
            _model.HasImplementationsFor(GetType()).ShouldBeFalse();
            _model.HasImplementationsFor(typeof (IServiceProvider)).ShouldBeTrue();
        }

        [Test]
        public void HasImplementationsFor_w_container()
        {
            _container.Model.HasImplementationsFor(typeof (ISomething)).ShouldBeTrue();
            _container.Model.HasImplementationsFor(GetType()).ShouldBeFalse();
            _container.Model.HasImplementationsFor(typeof (IServiceProvider)).ShouldBeTrue();
        }

        [Test]
        public void iterate_over_instances_of_a_type()
        {
            _model.InstancesOf(typeof (IServiceProvider)).Count().ShouldEqual(2);
            _model.InstancesOf(typeof (IService<>)).Count().ShouldEqual(2);
            _model.InstancesOf<IServiceProvider>().Count().ShouldEqual(2);
        }

        [Test]
        public void iterate_over_instances_of_a_type_w_container()
        {
            _container.Model.InstancesOf(typeof (IServiceProvider)).Count().ShouldEqual(2);
            _container.Model.InstancesOf(typeof (IService<>)).Count().ShouldEqual(2);
            _container.Model.InstancesOf<IServiceProvider>().Count().ShouldEqual(2);
        }

        [Test]
        public void Iterate_over_pluginTypes()
        {
            // 3 registered plus the 4th is the IContainer itself + Func
            _model.PluginTypes.Count().ShouldEqual(5);
        }

        [Test]
        public void Iterate_over_pluginTypes_w_container()
        {
            // IContainer is always added to the Container + Func<>
            _container.Model.PluginTypes.Count().ShouldEqual(5);
        }

        [Test]
        public void the_default_type_for()
        {
            _model.DefaultTypeFor<ISomething>().ShouldEqual(typeof (SomethingOne));
            _model.DefaultTypeFor<IWidget>().ShouldBeNull();

            _model.DefaultTypeFor(typeof (IService<>)).ShouldBeNull();
            _model.DefaultTypeFor(typeof (ISomething)).ShouldEqual(typeof (SomethingOne));
        }
    }
}


text:
package com.example.rasputility;

public enum JsonParameters {
	 number, timestampFrom, timestampTo;
}


text:
#ifndef __INCLUDE_STDBOOL_H
#define __INCLUDE_STDBOOL_H

/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

/* If CONFIG_ARCH_STDBOOL_H is set, then the archecture will provide its own
 * stdbool.h file.  In this case, this header file will simply re-direct to
 * the architecture-specfiic stdbool.h header file.
 */

#ifdef CONFIG_ARCH_STDBOOL_H
#  include <arch/stdbool.h>

/* NuttX will insist that the sizeof(bool) is 8-bits.  The sizeof of _Bool
 * used by any specific compiler is implementation specific:  It can vary from
 * compiler-to-compiler and even vary between different versions of the same
 * compiler.  Compilers seems to be converging to sizeof(_Bool) == 1.  If that
 * is true for your compiler, you should define CONFIG_C99_BOOL8 in your NuttX
 * configuration for better standards compatibility.
 *
 * CONFIG_C99_BOOL8 - Means (1) your C++ compiler has sizeof(_Bool) == 8,
 * (2) your C compiler supports the C99 _Bool intrinsic type, and (2) that
 * the C99 _Bool type also has size 1.
 */

#else

 /* nuttx/compiler.h may also define or undefine CONFIG_C99_BOOL8 */

#  include <nuttx/compiler.h>

#if !defined(__cplusplus) || !defined(CONFIG_C99_BOOL8)
#  include <stdint.h>

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/* bool, true, and false must be provided as macros so that they can be
 * redefined by the application if necessary.
 *
 * NOTE: Under C99 'bool' is required to be defined to be the intrinsic type
 * _Bool.  However, in this NuttX context, we need backward compatibility
 * to pre-C99 standards where _Bool is not an intrinsic type.  Hence, we
 * use _Bool8 as the underlying type (unless CONFIG_C99_BOOL8 is defined)
 */

#ifdef CONFIG_C99_BOOL8
#  define bool _Bool
#else
#  define bool _Bool8
#endif

#define true  (bool)1
#define false (bool)0

#define __bool_true_false_are_defined 1

/****************************************************************************
 * Public Types
 ****************************************************************************/

/* A byte is the smallest address memory element (at least in architectures
 * that do not support bit banding).  The requirement is only that type _Bool
 * be large enough to hold the values 0 and 1.  We select uint8_t to minimize
 * the RAM footprint of the executable.
 *
 * NOTE: We can't actually define the type _Bool here.  Under C99 _Bool is
 * an intrinsic type and cannot be the target of a typedef.  However, in this
 * NuttX context, we also need backward compatibility to pre-C99 standards
 * where _Bool is not an intrinsic type.  We work around this by using _Bool8
 * as the underlying type.
 */

#ifndef CONFIG_C99_BOOL8
typedef uint8_t _Bool8;
#endif

#endif /* __cplusplus && CONFIG_C99_BOOL8 */
#endif /* CONFIG_ARCH_STDBOOL_H */
#endif /* __INCLUDE_STDBOOL_H */


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/specific-people/pioneers/clara-rosa" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/clara-rosa</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Clara, Rosa</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/clara-rosa</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/pioneers/clara-rosa</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
#include <stdbool.h>

#include "common.h"
#include "ec_commands.h"
#include "fpsensor_state.h"
#include "mock/fpsensor_state_mock.h"
#include "test_util.h"
#include "util.h"

test_static int test_fp_enc_status_valid_flags(void)
{
	/* Putting expected value here because test_static should take void */
	const uint32_t expected = FP_ENC_STATUS_SEED_SET;
	int rv;
	struct ec_response_fp_encryption_status resp = { 0 };

	rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp,
				    sizeof(resp));
	if (rv != EC_RES_SUCCESS) {
		ccprintf("%s:%s(): failed to get encryption status. rv = %d\n",
			 __FILE__, __func__, rv);
		return -1;
	}

	if (resp.valid_flags != expected) {
		ccprintf("%s:%s(): expected valid flags 0x%08x, got 0x%08x\n",
			 __FILE__, __func__, expected, resp.valid_flags);
		return -1;
	}

	return EC_RES_SUCCESS;
}

static int
check_seed_set_result(const int rv, const uint32_t expected,
		      const struct ec_response_fp_encryption_status *resp)
{
	const uint32_t actual = resp->status & FP_ENC_STATUS_SEED_SET;

	if (rv != EC_RES_SUCCESS || expected != actual) {
		ccprintf("%s:%s(): rv = %d, seed is set: %d\n", __FILE__,
			 __func__, rv, actual);
		return -1;
	}

	return EC_SUCCESS;
}

test_static int test_fp_tpm_seed_not_set(void)
{
	int rv;
	struct ec_response_fp_encryption_status resp = { 0 };

	/* Initially the seed should not have been set. */
	rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp,
				    sizeof(resp));

	return check_seed_set_result(rv, 0, &resp);
}

test_static int test_set_fp_tpm_seed(void)
{
	int rv;
	struct ec_params_fp_seed params;
	struct ec_response_fp_encryption_status resp = { 0 };

	params.struct_version = FP_TEMPLATE_FORMAT_VERSION;
	memcpy(params.seed, default_fake_tpm_seed,
	       sizeof(default_fake_tpm_seed));

	rv = test_send_host_command(EC_CMD_FP_SEED, 0, &params, sizeof(params),
				    NULL, 0);
	if (rv != EC_RES_SUCCESS) {
		ccprintf("%s:%s(): rv = %d, set seed failed\n", __FILE__,
			 __func__, rv);
		return -1;
	}

	/* Now seed should have been set. */
	rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp,
				    sizeof(resp));

	return check_seed_set_result(rv, FP_ENC_STATUS_SEED_SET, &resp);
}

test_static int test_set_fp_tpm_seed_again(void)
{
	int rv;
	struct ec_params_fp_seed params;
	struct ec_response_fp_encryption_status resp = { 0 };

	TEST_ASSERT(fp_tpm_seed_is_set());

	params.struct_version = FP_TEMPLATE_FORMAT_VERSION;
	memcpy(params.seed, default_fake_tpm_seed,
	       sizeof(default_fake_tpm_seed));

	rv = test_send_host_command(EC_CMD_FP_SEED, 0, &params, sizeof(params),
				    NULL, 0);
	if (rv != EC_RES_ACCESS_DENIED) {
		ccprintf("%s:%s(): rv = %d, setting seed the second time "
			 "should result in EC_RES_ACCESS_DENIED but did not.\n",
			 __FILE__, __func__, rv);
		return -1;
	}

	/* Now seed should still be set. */
	rv = test_send_host_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp,
				    sizeof(resp));

	return check_seed_set_result(rv, FP_ENC_STATUS_SEED_SET, &resp);
}

test_static int test_fp_set_sensor_mode(void)
{
	uint32_t requested_mode = 0;
	uint32_t output_mode = 0;

	/* Validate initial conditions */
	TEST_ASSERT(FP_MAX_FINGER_COUNT == 5);
	TEST_ASSERT(templ_valid == 0);
	TEST_ASSERT(sensor_mode == 0);

	/* GIVEN missing output parameter, THEN get error */
	TEST_ASSERT(fp_set_sensor_mode(0, NULL) == EC_RES_INVALID_PARAM);
	/* THEN sensor_mode is unchanged */
	TEST_ASSERT(sensor_mode == 0);

	/* GIVEN requested mode includes FP_MODE_DONT_CHANGE, THEN succeed */
	TEST_ASSERT(sensor_mode == 0);
	TEST_ASSERT(output_mode == 0);
	requested_mode = FP_MODE_DONT_CHANGE;
	TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) ==
		    EC_RES_SUCCESS);
	/* THEN sensor_mode is unchanged */
	TEST_ASSERT(sensor_mode == 0);
	/* THEN output_mode matches sensor_mode */
	TEST_ASSERT(output_mode == sensor_mode);

	/* GIVEN request to change to valid sensor mode */
	TEST_ASSERT(sensor_mode == 0);
	requested_mode = FP_MODE_ENROLL_SESSION;
	/* THEN succeed */
	TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) ==
		    EC_RES_SUCCESS);
	/* THEN requested mode is returned */
	TEST_ASSERT(requested_mode == output_mode);
	/* THEN sensor_mode is updated */
	TEST_ASSERT(sensor_mode == requested_mode);

	/* GIVEN max number of fingers already enrolled */
	sensor_mode = 0;
	output_mode = 0xdeadbeef;
	templ_valid = FP_MAX_FINGER_COUNT;
	requested_mode = FP_MODE_ENROLL_SESSION;
	/* THEN additional enroll attempt will fail */
	TEST_ASSERT(fp_set_sensor_mode(requested_mode, &output_mode) ==
		    EC_RES_INVALID_PARAM);
	/* THEN output parameters is unchanged */
	TEST_ASSERT(output_mode = 0xdeadbeef);
	/* THEN sensor_mode is unchanged */
	TEST_ASSERT(sensor_mode == 0);

	return EC_SUCCESS;
}

test_static int test_fp_set_maintenance_mode(void)
{
	uint32_t output_mode = 0;

	/* GIVEN request to change to maintenance sensor mode */
	TEST_ASSERT(sensor_mode == 0);
	/* THEN succeed */
	TEST_ASSERT(fp_set_sensor_mode(FP_MODE_SENSOR_MAINTENANCE,
				       &output_mode) == EC_RES_SUCCESS);
	/* THEN requested mode is returned */
	TEST_ASSERT(output_mode == FP_MODE_SENSOR_MAINTENANCE);
	/* THEN sensor_mode is updated */
	TEST_ASSERT(sensor_mode == FP_MODE_SENSOR_MAINTENANCE);

	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_fail_fgr_less_than_zero(void)
{
	/* Create invalid param with fgr < 0 */
	struct ec_params_fp_read_match_secret test_match_secret = {
		.fgr = -1,
	};

	TEST_ASSERT(test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0,
					   &test_match_secret,
					   sizeof(test_match_secret), NULL,
					   0) == EC_RES_INVALID_PARAM);

	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_fail_fgr_large_than_max(void)
{
	/* Create invalid param with fgr = FP_MAX_FINGER_COUNT */
	struct ec_params_fp_read_match_secret test_match_secret = {
		.fgr = FP_MAX_FINGER_COUNT,
	};

	TEST_ASSERT(test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0,
					   &test_match_secret,
					   sizeof(test_match_secret), NULL,
					   0) == EC_RES_INVALID_PARAM);
	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_fail_timeout(void)
{
	/* Create valid param with 0 <= fgr < 5 */
	struct ec_params_fp_read_match_secret test_match_secret_1 = {
		.fgr = 1,
	};

	/* Disable positive secret match to create 0 deadline val */
	fp_disable_positive_match_secret(&positive_match_secret_state);

	TEST_ASSERT(positive_match_secret_state.deadline.val == 0);

	TEST_ASSERT(test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0,
					   &test_match_secret_1,
					   sizeof(test_match_secret_1), NULL,
					   0) == EC_RES_TIMEOUT);

	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_unmatched_fgr(void)
{
	/* Create valid param with 0 <= fgr < 5 */
	uint16_t matched_fgr = 1;
	uint16_t unmatched_fgr = 2;
	struct ec_params_fp_read_match_secret test_match_secret_1 = {
		.fgr = matched_fgr,
	};
	/* Create positive secret match state with valid deadline value,
	 * readable state, and wrong template matched
	 */
	struct positive_match_secret_state test_state = {
		.deadline.val = 5000000,
		.readable = true,
		.template_matched = unmatched_fgr,
	};

	/* Test for the wrong matched finger state */
	positive_match_secret_state = test_state;

	TEST_ASSERT(test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0,
					   &test_match_secret_1,
					   sizeof(test_match_secret_1), NULL,
					   0) == EC_RES_ACCESS_DENIED);

	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_unreadable_state(void)
{
	/* Create valid param with 0 <= fgr < 5 */
	uint16_t matched_fgr = 1;
	struct ec_params_fp_read_match_secret test_match_secret_1 = {
		.fgr = matched_fgr,
	};
	/*
	 * Create positive secret match state with valid deadline value ,
	 * unreadable state, and correct matched template
	 */
	struct positive_match_secret_state test_state = {
		.deadline.val = 5000000,
		.readable = false,
		.template_matched = matched_fgr,
	};

	/* Test for the unreadable state */
	positive_match_secret_state = test_state;

	TEST_ASSERT(test_send_host_command(EC_CMD_FP_READ_MATCH_SECRET, 0,
					   &test_match_secret_1,
					   sizeof(test_match_secret_1), NULL,
					   0) == EC_RES_ACCESS_DENIED);

	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_derive_fail(void)
{
	struct ec_response_fp_read_match_secret response = { 0 };
	/* Create valid param with 0 <= fgr < 5 */
	uint16_t matched_fgr = 1;
	struct ec_params_fp_read_match_secret test_match_secret_1 = {
		.fgr = matched_fgr,
	};
	/* Create positive secret match state with valid deadline value,
	 * readable state, and correct template matched
	 */
	struct positive_match_secret_state test_state_1 = {
		.deadline.val = 5000000,
		.readable = true,
		.template_matched = matched_fgr,
	};
	positive_match_secret_state = test_state_1;
	/* Set fp_positive_match_salt to the trivial value */
	memcpy(fp_positive_match_salt, trivial_fp_positive_match_salt,
	       sizeof(trivial_fp_positive_match_salt));

	/* Test with the correct matched finger state and a trivial
	 * fp_positive_match_salt
	 */
	TEST_ASSERT(test_send_host_command(
			    EC_CMD_FP_READ_MATCH_SECRET, 0,
			    &test_match_secret_1, sizeof(test_match_secret_1),
			    &response, sizeof(response)) == EC_RES_ERROR);
	return EC_SUCCESS;
}

test_static int test_fp_command_read_match_secret_derive_succeed(void)
{
	struct ec_response_fp_read_match_secret response = { 0 };
	/* Create valid param with 0 <= fgr < 5 */
	uint16_t matched_fgr = 1;
	struct ec_params_fp_read_match_secret test_match_secret_1 = {
		.fgr = matched_fgr,
	};

	/* Expected positive_match_secret same as  in test/fpsensor_crypto.c*/
	static const uint8_t
		expected_positive_match_secret_for_empty_user_id[] = {
			0x8d, 0xc4, 0x5b, 0xdf, 0x55, 0x1e, 0xa8, 0x72,
			0xd6, 0xdd, 0xa1, 0x4c, 0xb8, 0xa1, 0x76, 0x2b,
			0xde, 0x38, 0xd5, 0x03, 0xce, 0xe4, 0x74, 0x51,
			0x63, 0x6c, 0x6a, 0x26, 0xa9, 0xb7, 0xfa, 0x68,
		};
	/* Create positive secret match state with valid deadline value,
	 * readable state, and correct template matched
	 */
	struct positive_match_secret_state test_state_1 = {
		.deadline.val = 5000000,
		.readable = true,
		.template_matched = matched_fgr,
	};
	positive_match_secret_state = test_state_1;
	/* Set fp_positive_match_salt to the trivial value */
	memcpy(fp_positive_match_salt, default_fake_fp_positive_match_salt,
	       sizeof(default_fake_fp_positive_match_salt));

	TEST_ASSERT_ARRAY_EQ(
		(uint8_t const *)fp_positive_match_salt,
		(uint8_t const *)default_fake_fp_positive_match_salt,
		sizeof(default_fake_fp_positive_match_salt));

	/* Initialize an empty user_id to compare positive_match_secret */
	memset(user_id, 0, sizeof(user_id));

	TEST_ASSERT(fp_tpm_seed_is_set());
	/* Test with the correct matched finger state and the default fake
	 * fp_positive_match_salt
	 */
	TEST_ASSERT(test_send_host_command(
			    EC_CMD_FP_READ_MATCH_SECRET, 0,
			    &test_match_secret_1, sizeof(test_match_secret_1),
			    &response, sizeof(response)) == EC_SUCCESS);

	TEST_ASSERT_ARRAY_EQ(
		response.positive_match_secret,
		expected_positive_match_secret_for_empty_user_id,
		sizeof(expected_positive_match_secret_for_empty_user_id));

	return EC_SUCCESS;
}

void run_test(int argc, const char **argv)
{
	RUN_TEST(test_fp_enc_status_valid_flags);
	RUN_TEST(test_fp_tpm_seed_not_set);
	RUN_TEST(test_set_fp_tpm_seed);
	RUN_TEST(test_set_fp_tpm_seed_again);
	RUN_TEST(test_fp_set_sensor_mode);
	RUN_TEST(test_fp_set_maintenance_mode);
	RUN_TEST(test_fp_command_read_match_secret_fail_fgr_less_than_zero);
	RUN_TEST(test_fp_command_read_match_secret_fail_fgr_large_than_max);
	RUN_TEST(test_fp_command_read_match_secret_fail_timeout);
	RUN_TEST(test_fp_command_read_match_secret_unmatched_fgr);
	RUN_TEST(test_fp_command_read_match_secret_unreadable_state);
	RUN_TEST(test_fp_command_read_match_secret_derive_fail);
	RUN_TEST(test_fp_command_read_match_secret_derive_succeed);
	test_print_result();
}


text:
import express from 'express';
import bodyParser from 'body-parser';
import morgan from 'morgan';
import exphbs from 'express-handlebars';

const app = express();
const Port = 8000;

app.engine('handlebars', exphbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');

app.use(express.static('dist/public'));
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));

//routes
app.get('/', function (req, res) {
    res.render('home');
});

app.listen(Port, () => {
  console.log(`Server is listening on port ${Port}`);
});


text:
/*************************************************************************/
/*  spatial_sound_2d_server.cpp                                          */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#include "spatial_sound_2d_server.h"

SpatialSound2DServer *SpatialSound2DServer::singleton = NULL;

SpatialSound2DServer *SpatialSound2DServer::get_singleton() {

	return singleton;
}

SpatialSound2DServer::SpatialSound2DServer() {

	ERR_FAIL_COND(singleton != NULL);
	singleton = this;
}


text:
Add Event

        <form class="form" role="form" id="addEventForm" ng-submit='addEventForm.$valid && eventCtl.submitForm(eventCtl.eventForm)' novalidate name="addEventForm">

                        Name
                        <input type="text" ng-model='eventCtl.eventForm.name' required class="form-control"  name="eventName" placeholder="Event name" ng-minlength='3' ng-maxlength='30'>

 The Event Name is required

Please enter an Event Name at least 3 chars long

The Event Name entered cannot be longer than 30 chars

                        Description
                        <input type="textarea"  required ng-model='eventCtl.eventForm.description' class="form-control" name="eventDescription" placeholder="Event Description">

                    Date
                    <input type="text" required ng-pattern='/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/' ng-model='eventCtl.eventForm.date' class="form-control" name="eventDate" placeholder="yyyy-MM-dd">

Please enter the date in the yyyy-mm-dd format

                        Location
                        <input type="text" required ng-model='eventCtl.eventForm.location' class="form-control" name="eventLocation" placeholder="Event Location">

                                Category
                                <select class="form-control" required ng-model='eventCtl.selectedOption' ng-options="category.name for category in eventCtl.categories track by category.id" data-width="100%" name="eventCategory">
                                </select>

                                Email
                                <input type="email" ng-model='eventCtl.eventForm.email'  class="form-control" name="eventEmailInfo" placeholder="Email Info">

The contact email

                                Price

                                <input type="text" required ng-model='eventCtl.eventForm.price' class="form-control" name="eventPrice" placeholder="Event Price">

                                <button  type="submit" ng-disabled="addEventForm.$invalid" class="btn btn-primary">Submit</button>
                                <button type="reset" class="btn btn-primary">Reset</button>

                </form>


text:
<!doctype html>

  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>TwoThumbSlider (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <meta charset="utf8">

      Closure Library API Documentation

        Go to class or file:
        <input type="text" id="ac">

        ui.TwoThumbSlider
        Extends

            goog.ui.SliderBase

    This creates a TwoThumbSlider object.

Useful links

Demo

Source Code

Inheritance

Object
     goog.Disposable
          goog.events.EventTarget
               goog.ui.Component
                    goog.ui.SliderBase
                         goog.ui.TwoThumbSlider

Constructor

    goog.ui.TwoThumbSlider(opt_domHelper)

Parameters

        opt_domHelper
        :
goog.dom.DomHelper

Optional DOM helper.

Instance Methods

        Public
        Protected
        Private

         Defined in

              goog.ui.TwoThumbSlider

        createThumb_(cs)

        ⇒
HTMLDivElement

       This creates a thumb element with the specified CSS class name.

    <! -- Method details -->

        Arguments:

        cs
        :
string

CSS class name of the thumb to be created.

        Returns:
HTMLDivElement

            The created thumb element.

     code »

        createThumbs()

       No description.

     code »

        getCssClass(orient)

        ⇒
string

       No description.

    <! -- Method details -->

        Arguments:

        orient
        :
goog.ui.SliderBase.Orientation

orientation of the slider.

        Returns:
string

            The CSS class applied to the twothumbslider element.

     code »

         Defined in

              goog.ui.SliderBase

        animatedSetValue_(v)

       Sets the value and starts animating the handle towards that position

    <! -- Method details -->

        Arguments:

        v
        :
number

Value to set and animate to.

     code »

        createDom()

       No description.

     code »

        createThumbs()

       Subclasses must implement this method and set the valueThumb and
extentThumb to non-null values.

     code »

        decorateInternal(element)

       No description.

    <! -- Method details -->

        Arguments:

        element
        :

No description.

     code »

        disposeInternal()

       No description.

     code »

        endAnimation_(e)

       Sets the isAnimating_ field to false once the animation is done

    <! -- Method details -->

        Arguments:

        e
        :
goog.fx.AnimationEvent

Event object passed by the animation object.

     code »

        enterDocument()

       No description.

     code »

        getBlockIncrement()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The amount to increment/decrement for page up/down as well as when holding down the mouse button on the background.

     code »

        getClosestThumb_(position)

        ⇒
HTMLDivElement

       No description.

    <! -- Method details -->

        Arguments:

        position
        :
number

The position to get the closest thumb to.

        Returns:
HTMLDivElement

            The thumb that is closest to the given position.

     code »

        getCssClass()

        ⇒
string

       Returns the CSS class applied to the slider element for the given
orientation. Subclasses must override this method.

    <! -- Method details -->

        Returns:
string

            The CSS class applied to slider elements.

     code »

        getExtent()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The value of the extent of the underlying range model.

     code »

        getExtentThumb()

        ⇒
HTMLDivElement

       No description.

    <! -- Method details -->

        Returns:
HTMLDivElement

            The extent thumb element.

     code »

        getMaximum()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The maximum value.

     code »

        getMinimum()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The minimum value.

     code »

        getMoveToPointEnabled()

        ⇒
boolean

       No description.

    <! -- Method details -->

        Returns:
boolean

            Whether clicking on the backgtround should move directly to that point.

     code »

        getOrientation()

        ⇒
goog.ui.SliderBase.Orientation

       No description.

    <! -- Method details -->

        Returns:
goog.ui.SliderBase.Orientation

            the orientation of the slider.

     code »

        getRelativeMousePos_(e)

        ⇒
number

       Returns the relative mouse position to the slider.

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The mouse event object.

        Returns:
number

            The relative mouse position to the slider.

     code »

        getStep()

        ⇒
?number

       No description.

    <! -- Method details -->

        Returns:
?number

            The step value used to determine how to round the value.

     code »

        getThumbCoordinateForValue_(val)

        ⇒
goog.math.Coordinate

       Returns the position to move the handle to for a given value

    <! -- Method details -->

        Arguments:

        val
        :
number

The value to get the coordinate for.

        Returns:
goog.math.Coordinate

            Coordinate with either x or y set.

     code »

        getThumbPosition_(thumb)

        ⇒
number

       No description.

    <! -- Method details -->

        Arguments:

        thumb
        :
HTMLDivElement

The thumb object.

        Returns:
number

            The position of the specified thumb.

     code »

        getUnitIncrement()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The amount to increment/decrement for up, down, left and right arrow keys.

     code »

        getValue()

        ⇒
number

       No description.

    <! -- Method details -->

        Returns:
number

            The value of the underlying range model.

     code »

        getValueFromMousePosition_(e)

        ⇒
number

       Returns the value to use for the current mouse position

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The mouse event object.

        Returns:
number

            The value that this mouse position represents.

     code »

        getValueThumb()

        ⇒
HTMLDivElement

       No description.

    <! -- Method details -->

        Returns:
HTMLDivElement

            The value thumb element.

     code »

        handleBeforeDrag_(e)

       Handler for the before drag event. We prevent the default action and use the
event properties to determine the new value

    <! -- Method details -->

        Arguments:

        e
        :
goog.fx.DragEvent

The drag event used to drag the thumb.

     code »

        handleKeyDown_(e)

       Event handler for the key down event. This is used to update the value
based on the key pressed

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.KeyEvent

The keyboard event object.

     code »

        handleMouseDown_(e)

       Handler for the mouse down event.

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The mouse event object.

     code »

        handleMouseUp_(e)

       Handler for the mouse up event.

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The event object.

     code »

        handleMouseWheel_(e)

       Handler for the mouse wheel event.

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.MouseWheelEvent

The mouse wheel event object.

     code »

        handleRangeModelChange(e)

       Call back when the internal range model changes. Sub-classes may override
and re-enter this method to update a11y state. Consider protected

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The event object.

     code »

        handleTimerTick_()

       Handler for the tick event dispatched by the timer used to update the value
in a block increment. This is also called directly from
startBlockIncrementing_.

     code »

        moveThumbs(delta)

       Moves the thumbs by the specified delta as follows
- as long as both thumbs stay within [min,max], both thumbs are moved
- once a thumb reaches or exceeds min (or max, respectively), it stays
- at min (or max, respectively).
In case both thumbs have reached min (or max), no change event will fire.

    <! -- Method details -->

        Arguments:

        delta
        :
number

The delta by which to move the selected range.

     code »

        setAriaRoles()

       Set a11y roles and state.

     code »

        setBlockIncrement(value)

       Sets the amount to increment/decrement for page up/down as well as when
holding down the mouse button on the background.

    <! -- Method details -->

        Arguments:

        value
        :
number

The value to set the block increment to.

     code »

        setExtent(extent)

       Sets the extent of the underlying range model. We enforce that
getMinExtent() <= extent <= getMaximum() - getValue()
If this is not satisifed for the given extent, the call is ignored and no
CHANGE event fires.

    <! -- Method details -->

        Arguments:

        extent
        :
number

The value to which to set the extent.

     code »

        setMaximum(max)

       Sets the maximum number

    <! -- Method details -->

        Arguments:

        max
        :
number

The maximum value.

     code »

        setMinExtent(value)

       Sets the minimal value that the extent may have.

    <! -- Method details -->

        Arguments:

        value
        :
number

The minimal value for the extent.

     code »

        setMinimum(min)

       Sets the minimum number

    <! -- Method details -->

        Arguments:

        min
        :
number

The minimum value.

     code »

        setMoveToPointEnabled(val)

       Sets whether clicking on the background should move directly to that point.

    <! -- Method details -->

        Arguments:

        val
        :
boolean

Whether clicking on the background should move directly to that point.

     code »

        setOrientation(orient)

       changes the orientation

    <! -- Method details -->

        Arguments:

        orient
        :
goog.ui.SliderBase.Orientation

The orientation.

     code »

        setStep(step)

       Sets the step value. The step value is used to determine how to round the
value.

    <! -- Method details -->

        Arguments:

        step
        :
?number

The step size.

     code »

        setThumbPosition_(thumb, position)

       Sets the position of the given thumb. The set is ignored and no CHANGE event
fires if it violates the constraint minimum <= value (valueThumb position) <=
value + extent (extentThumb position) <= maximum.

Note: To keep things simple, the setThumbPosition_ function does not have the
side-effect of "correcting" value or extent to fit the above constraint as it
is the case in the underlying range model. Instead, we simply ignore the
call. Callers must make these adjustements explicitly if they wish.

    <! -- Method details -->

        Arguments:

        thumb
        :
Element

The thumb whose position to set.

        position
        :
number

The position to move the thumb to.

     code »

        setUnitIncrement(value)

       Sets the amount to increment/decrement for up, down, left and right arrow
keys.

    <! -- Method details -->

        Arguments:

        value
        :
number

The value to set the unit increment to.

     code »

        setValue(value)

       Sets the value of the underlying range model. We enforce that
getMinimum() <= value <= getMaximum() - getExtent()
If this is not satisifed for the given value, the call is ignored and no
CHANGE event fires.

    <! -- Method details -->

        Arguments:

        value
        :
number

The value.

     code »

        setValueAndExtent(value, extent)

       Sets the value and extent of the underlying range model. We enforce that
getMinimum() <= value <= getMaximum() - extent and
getMinExtent <= extent <= getMaximum() - getValue()
If this is not satisifed for the given extent, the call is ignored and no
CHANGE event fires. This is a utility method to allow setting the thumbs
simultaneously and ensuring that only one event fires.

    <! -- Method details -->

        Arguments:

        value
        :
number

The value to which to set the value.

        extent
        :
number

The value to which to set the extent.

     code »

        setVisible(visible)

       Change the visibility of the slider.
You must call this if you had set the slider's value when it was invisible.

    <! -- Method details -->

        Arguments:

        visible
        :
boolean

Whether to show the slider.

     code »

        startBlockIncrementing_(e)

       Starts the animation that causes the thumb to increment/decrement by the
block increment when the user presses down on the background.

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The mouse event object.

     code »

        storeMousePos_(e)

       Stores the current mouse position so that it can be used in the timer

    <! -- Method details -->

        Arguments:

        e
        :
goog.events.Event

The mouse event object.

     code »

        updateAriaStates()

       Set a11y roles and state when values change.

     code »

        updateUi_()

       This is called when we need to update the size of the thumb. This happens
when first created as well as when the value and the orientation changes.

     code »

         Defined in

              goog.ui.Component

        addChild(child, opt_render)

       Adds the specified component as the last child of this component.  See
goog.ui.Component#addChildAt for detailed semantics.

    <! -- Method details -->

        Arguments:

        child
        :
goog.ui.Component

The new child component.

        opt_render
        :
boolean

If true, the child component will be rendered into the parent.

     code »

        addChildAt(child, index, opt_render)

       Adds the specified component as a child of this component at the given
0-based index.

Both addChild and addChildAt assume the following contract
between parent and child components:

the child component's element must be a descendant of the parent
component's element, and

the DOM state of the child component must be consistent with the DOM
state of the parent component (see isInDocument).

In particular, parent.addChild(child) will throw an error if the
child component is already in the document, but the parent isn't.

Clients of this API may call addChild and addChildAt with
opt_render set to true.  If opt_render is true, calling these
methods will automatically render the child component's element into the
parent component's element.  However, parent.addChild(child, true)
will throw an error if:

the parent component has no DOM (i.e. parent.getElement() is
null), or

the child component is already in the document, regardless of the
parent's DOM state.

Finally, this method also throws an error if the new child already has a
different parent, or the given index is out of bounds.

    <! -- Method details -->

        Arguments:

        child
        :
goog.ui.Component

The new child component.

        index
        :
number

0-based index at which the new child component is to be added; must be between 0 and the current child count (inclusive).

        opt_render
        :
boolean

If true, the child component will be rendered into the parent.

     code »

        canDecorate(element)

        ⇒
boolean

       Determines if a given element can be decorated by this type of component.
This method should be overridden by inheriting objects.

    <! -- Method details -->

        Arguments:

        element
        :
Element

Element to decorate.

        Returns:
boolean

            True if the element can be decorated, false otherwise.

     code »

        createDom()

       No description.

     code »

        decorate(element)

       Decorates the element for the UI component.

    <! -- Method details -->

        Arguments:

        element
        :
Element

Element to decorate.

     code »

        decorateInternal(element)

       Actually decorates the element. Should be overridden by inheriting objects.
This method can assume there are checks to ensure the component has not
already been rendered have occurred and that enter document will be called
afterwards. This method is considered protected.

    <! -- Method details -->

        Arguments:

        element
        :
Element

Element to decorate.

     code »

        disposeInternal()

       Disposes of the component.  Calls exitDocument, which is expected to
remove event handlers and clean up the component.  Propagates the call to
the component's children, if any. Removes the component's DOM from the
document unless it was decorated.

     code »

        enterDocument()

       No description.

     code »

        exitDocument()

       No description.

     code »

        forEachChild(f, opt_obj)

       Calls the given function on each of this component's children in order.  If
opt_obj is provided, it will be used as the 'this' object in the
function when called.  The function should take two arguments:  the child
component and its 0-based index.  The return value is ignored.

    <! -- Method details -->

        Arguments:

        f
        :
Function

The function to call for every child component; should take 2 arguments (the child and its index).

        opt_obj
        :
Object

Used as the 'this' object in f when called.

     code »

        getChild(id)

        ⇒
?goog.ui.Component

       Returns the child with the given ID, or null if no such child exists.

    <! -- Method details -->

        Arguments:

        id
        :
string

Child component ID.

        Returns:
?goog.ui.Component

            The child with the given ID; null if none.

     code »

        getChildAt(index)

        ⇒
?goog.ui.Component

       Returns the child at the given index, or null if the index is out of bounds.

    <! -- Method details -->

        Arguments:

        index
        :
number

0-based index.

        Returns:
?goog.ui.Component

            The child at the given index; null if none.

     code »

        getChildCount()

        ⇒
number

       Returns the number of children of this component.

    <! -- Method details -->

        Returns:
number

            The number of children.

     code »

        getChildIds()

        ⇒
Array.<string>

       Returns an array containing the IDs of the children of this component, or an
empty array if the component has no children.

    <! -- Method details -->

        Returns:
Array.<string>

            Child component IDs.

     code »

        getContentElement()

        ⇒
?Element

       Returns the DOM element into which child components are to be rendered,
or null if the component itself hasn't been rendered yet.  This default
implementation returns the component's root element.  Subclasses with
complex DOM structures must override this method.

    <! -- Method details -->

        Returns:
?Element

            Element to contain child elements (null if none).

     code »

        getDomHelper()

        ⇒
goog.dom.DomHelper

       Returns the dom helper that is being used on this component.

    <! -- Method details -->

        Returns:
goog.dom.DomHelper

            The dom helper used on this component.

     code »

        getElement()

        ⇒
?Element

       Gets the component's element.

    <! -- Method details -->

        Returns:
?Element

            The element for the component.

     code »

        getElementByFragment(idFragment)

        ⇒
?Element

       Helper function for returning an element in the document with a unique id
generated using makeId().

    <! -- Method details -->

        Arguments:

        idFragment
        :
string

The partial id.

        Returns:
?Element

            The element with the unique id, or null if it cannot be found.

     code »

        getFragmentFromId(id)

        ⇒
string

       Helper function for returning the fragment portion of an id generated using
makeId().

    <! -- Method details -->

        Arguments:

        id
        :
string

Id generated with makeId().

        Returns:
string

            Fragment.

     code »

        getHandler()

        ⇒
!goog.events.EventHandler

       Returns the event handler for this component, lazily created the first time
this method is called.

    <! -- Method details -->

        Returns:
!goog.events.EventHandler

            Event handler for this component.

     code »

        getId()

        ⇒
string

       Gets the unique ID for the instance of this component.  If the instance
doesn't already have an ID, generates one on the fly.

    <! -- Method details -->

        Returns:
string

            Unique component ID.

     code »

        getModel()

        ⇒
*

       Returns the model associated with the UI component.

    <! -- Method details -->

        Returns:
*

            The model.

     code »

        getParent()

        ⇒
?goog.ui.Component

       Returns the component's parent, if any.

    <! -- Method details -->

        Returns:
?goog.ui.Component

            The parent component.

     code »

        hasChildren()

        ⇒
boolean

       Returns true if the component has children.

    <! -- Method details -->

        Returns:
boolean

            True if the component has children.

     code »

        indexOfChild(child)

        ⇒
number

       Returns the 0-based index of the given child component, or -1 if no such
child is found.

    <! -- Method details -->

        Arguments:

        child
        :
?goog.ui.Component

The child component.

        Returns:
number

            0-based index of the child component; -1 if not found.

     code »

        isInDocument()

        ⇒
boolean

       Determines whether the component has been added to the document.

    <! -- Method details -->

        Returns:
boolean

            TRUE if rendered. Otherwise, FALSE.

     code »

        isRightToLeft()

        ⇒
boolean

       Returns true if the component is rendered right-to-left, false otherwise.
The first time this function is invoked, the right-to-left rendering property
is set if it has not been already.

    <! -- Method details -->

        Returns:
boolean

            Whether the control is rendered right-to-left.

     code »

        makeId(idFragment)

        ⇒
string

       Helper function for subclasses that gets a unique id for a given fragment,
this can be used by components to
generate unique string ids for DOM elements

    <! -- Method details -->

        Arguments:

        idFragment
        :
string

A partial id.

        Returns:
string

            Unique element id.

     code »

        removeChild(child, opt_unrender)

        ⇒
goog.ui.Component

       Removes the given child from this component, and returns it.  Throws an error
if the argument is invalid or if the specified child isn't found in the
parent component.  The argument can either be a string (interpreted as the
ID of the child component to remove) or the child component itself.

If opt_unrender is true, calls goog.ui.component#exitDocument
on the removed child, and subsequently detaches the child's DOM from the
document.  Otherwise it is the caller's responsibility to clean up the child
component's DOM.

    <! -- Method details -->

        Arguments:

        child
        :
string | goog.ui.Component | null

The ID of the child to remove, or the child component itself.

        opt_unrender
        :
boolean

If true, calls exitDocument on the removed child component, and detaches its DOM from the document.

        Returns:
goog.ui.Component

            The removed component, if any.

     code »

        removeChildAt(index, opt_unrender)

        ⇒
goog.ui.Component

       Removes the child at the given index from this component, and returns it.
Throws an error if the argument is out of bounds, or if the specified child
isn't found in the parent.  See goog.ui.Component#removeChild for
detailed semantics.

    <! -- Method details -->

        Arguments:

        index
        :
number

0-based index of the child to remove.

        opt_unrender
        :
boolean

If true, calls exitDocument on the removed child component, and detaches its DOM from the document.

        Returns:
goog.ui.Component

            The removed component, if any.

     code »

        removeChildren(opt_unrender)

       Removes every child component attached to this one.

    <! -- Method details -->

        Arguments:

        opt_unrender
        :
boolean

If true, calls #exitDocument on the removed child components, and detaches their DOM from the document.

     code »

        render(opt_parentElement)

       Renders the component.  If a parent element is supplied, it should already be
in the document and then the component's element will be appended to it.  If
there is no optional parent element and the element doesn't have a parentNode
then it will be appended to the document body.

Throws an Error if the component is already rendered.

    <! -- Method details -->

        Arguments:

        opt_parentElement
        :
Element

Optional parent element to render the component into.

     code »

        renderBefore(siblingElement)

       Renders the component before another element. The other element should be in
the document already.

Throws an Error if the component is already rendered.

    <! -- Method details -->

        Arguments:

        siblingElement
        :
Element

Element to render the component before.

     code »

        render_(opt_parentElement, opt_beforeElement)

       Renders the component.  If a parent element is supplied, it should already be
in the document and then the component's element will be appended to it.  If
there is no optional parent element and the element doesn't have a parentNode
then it will be appended to the document body.

Throws an Error if the component is already rendered.

    <! -- Method details -->

        Arguments:

        opt_parentElement
        :
Element

Optional parent element to render the component into.

        opt_beforeElement
        :
Element

Element before which the component is to be rendered.  If left out the node is appended to the parent element.

     code »

        setElementInternal(element)

       Sets the component's root element to the given element.  Considered
protected and final.

    <! -- Method details -->

        Arguments:

        element
        :
Element

Root element for the component.

     code »

        setId(id)

       Assigns an ID to this component instance.  It is the caller's responsibility
to guarantee that the ID is unique.  If the component is a child of a parent
component, then the parent component's child index is updated to reflect the
new ID; this may throw an error if the parent already has a child with an ID
that conflicts with the new ID.

    <! -- Method details -->

        Arguments:

        id
        :
string

Unique component ID.

     code »

        setModel(obj)

       Sets the model associated with the UI component.

    <! -- Method details -->

        Arguments:

        obj
        :
*

The model.

     code »

        setParent(parent)

       Sets the parent of this component to use for event bubbling.  Throws an error
if the component already has a parent or if an attempt is made to add a
component to itself as a child.  Callers must use removeChild
or removeChildAt to remove components from their containers before
calling this method.

    <! -- Method details -->

        Arguments:

        parent
        :
goog.ui.Component

The parent component.

     code »

        setParentEventTarget(parent)

       Overrides goog.events.EventTarget#setParentEventTarget to throw an
error if the parent component is set, and the argument is not the parent.

    <! -- Method details -->

        Arguments:

        parent
        :
goog.events.EventTarget

Parent EventTarget (null if none).

     code »

        setRightToLeft(rightToLeft)

       Set is right-to-left. This function should be used if the component needs
to know the rendering direction during dom creation (i.e. before
#enterDocument is called and is right-to-left is set).

    <! -- Method details -->

        Arguments:

        rightToLeft
        :
boolean

Whether the component is rendered right-to-left.

     code »

        wasDecorated()

        ⇒
boolean

       No description.

    <! -- Method details -->

        Returns:
boolean

            Whether the component was decorated.

     code »

         Defined in

              goog.events.EventTarget

        addEventListener(type, handler, opt_capture, opt_handlerScope)

       Adds an event listener to the event target. The same handler can only be
added once per the type. Even if you add the same handler multiple times
using the same type then it will only be called once when the event is
dispatched.

Supported for legacy but use goog.events.listen(src, type, handler) instead.

    <! -- Method details -->

        Arguments:

        type
        :
string

The type of the event to listen for.

        handler
        :
Function | Object

The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.

        opt_capture
        :
boolean

In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.

        opt_handlerScope
        :
Object

Object in whose scope to call the listener.

     code »

        dispatchEvent(e)

        ⇒
boolean

       Dispatches an event (or event like object) and calls all listeners
listening for events of this type. The type of the event is decided by the
type property on the event object.

If any of the listeners returns false OR calls preventDefault then this
function will return false.  If one of the capture listeners calls
stopPropagation, then the bubble listeners won't fire.

    <! -- Method details -->

        Arguments:

        e
        :
string | Object | goog.events.Event

Event object.

        Returns:
boolean

            If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.

     code »

        disposeInternal()

       Unattach listeners from this object.  Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners, it should be something like this:

MyClass.prototype.disposeInternal = function() {
MyClass.superClass_.disposeInternal.call(this);
// Dispose logic for MyClass
};

     code »

        getParentEventTarget()

        ⇒
goog.events.EventTarget

       Returns the parent of this event target to use for bubbling.

    <! -- Method details -->

        Returns:
goog.events.EventTarget

            The parent EventTarget or null if there is no parent.

     code »

        removeEventListener(type, handler, opt_capture, opt_handlerScope)

       Removes an event listener from the event target. The handler must be the
same object as the one added. If the handler has not been added then
nothing is done.

    <! -- Method details -->

        Arguments:

        type
        :
string

The type of the event to listen for.

        handler
        :
Function | Object

The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.

        opt_capture
        :
boolean

In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.

        opt_handlerScope
        :
Object

Object in whose scope to call the listener.

     code »

        setParentEventTarget(parent)

       Sets the parent of this event target to use for bubbling.

    <! -- Method details -->

        Arguments:

        parent
        :
?goog.events.EventTarget

Parent EventTarget (null if none).

     code »

         Defined in

              goog.Disposable

        dispose()

       No description.

     code »

        disposeInternal()

       Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend goog.Disposable should
override this method.  For example:

mypackage.MyClass = function() {
goog.Disposable.call(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);

mypackage.MyClass.prototype.disposeInternal = function() {
mypackage.MyClass.superClass_.disposeInternal.call(this);
// Dispose logic specific to MyClass.
...
};

     code »

        getDisposed()

        ⇒
boolean

       No description.

    <! -- Method details -->

        Returns:
boolean

            Whether the object has been disposed of.

     code »

        isDisposed()

        ⇒
boolean

       No description.

    <! -- Method details -->

        Returns:
boolean

            Whether the object has been disposed of.

     code »

Instance Properties

         Defined in

              goog.ui.SliderBase

        blockIncrement_
        :
number

       The amount to increment/decrement for page up/down as well as when holding
down the mouse button on the background.

     Code »

        isAnimating_
        :
boolean

       If we are currently animating the thumb

     Code »

        minExtent_
        :
number

       The minimal extent. The class will ensure that the extent cannot shrink
to a value smaller than minExtent.

     Code »

        moveToPointEnabled_
        :
boolean

       Whether clicking on the backgtround should move directly to that point

     Code »

        unitIncrement_
        :
number

       The amount to increment/decrement for up, down, left and right arrow keys.

     Code »

         Defined in

              goog.ui.Component

        childIndex_
        :
?Object

       Map of child component IDs to child components.  Used for constant-time
random access to child components by ID.  Lazily initialized on first use.
Must be kept in sync with children_.  This property is strictly
private and must not be accessed directly outside of this class!

We use a plain Object, not a goog.structs.Map, for simplicity.
This means components can't have children with IDs such as 'constructor' or
'valueOf', but this shouldn't really be an issue in practice, and if it is,
we can always fix it later without changing the API.

     Code »

        children_
        :
?Array.<goog.ui.Component>

       Array of child components.  Lazily initialized on first use.  Must be kept in
sync with childIndex_.  This property is strictly private and must
not be accessed directly outside of this class!

     Code »

        dom_
        :
?goog.dom.DomHelper

       DomHelper used to interact with the document, allowing components to be
created in a different window.

     Code »

        element_
        :
?Element

       The DOM element for the component.

     Code »

        idGenerator_
        :
goog.ui.IdGenerator

       Generator for unique IDs.

     Code »

        id_
        :
?string

       Unique ID of the component, lazily initialized in {@link
goog.ui.Component#getId} if needed.  This property is strictly private and
must not be accessed directly outside of this class!

     Code »

        inDocument_
        :
boolean

       Whether the component is in the document.

     Code »

        parent_
        :
?goog.ui.Component

       Parent component to which events will be propagated.  This property is
strictly private and must not be accessed directly outside of this class!

     Code »

        rightToLeft_
        :
?boolean

       Whether the component is rendered right-to-left.  Right-to-left is set
lazily when #isRightToLeft is called the first time, unless it has
been set by calling #setRightToLeft explicitly.

     Code »

        wasDecorated_
        :
boolean

       Flag used to keep track of whether a component decorated an already existing
element or whether it created the DOM itself.  If an element was decorated
dispose will remove the node from the document, it is left up to the app.

     Code »

         Defined in

              goog.events.EventTarget

        customEvent_
        :
boolean

       Used to tell if an event is a real event in goog.events.listen() so we don't
get listen() calling addEventListener() and vice-versa.

     Code »

        parentEventTarget_
        :
?goog.events.EventTarget

       Parent event target, used during event bubbling.

     Code »

         Defined in

              goog.Disposable

        disposed_
        :
boolean

       Whether the object has been disposed of.

     Code »

Static Properties

        goog.ui.TwoThumbSlider.CSS_CLASS_PREFIX
        :
string

       The prefix we use for the CSS class names for the slider and its elements.

     Code »

        goog.ui.TwoThumbSlider.EXTENT_THUMB_CSS_CLASS
        :
string

       CSS class name for the extent thumb element.

     Code »

        goog.ui.TwoThumbSlider.VALUE_THUMB_CSS_CLASS
        :
string

       CSS class name for the value thumb element.

     Code »

Package ui

Package Reference


text:
__author__ = 'rcj1492'
__created__ = '2016.11'
__license__ = 'MIT'

class twilioClient(object):

    def __init__(self, account_sid, auth_token, twilio_phone):

        self.account_sid = account_sid
        self.auth_token = auth_token
        self.twilio_phone = twilio_phone

        from sys import path as sys_path
        sys_path.append(sys_path.pop(0))
        from twilio.rest import TwilioRestClient
        sys_path.insert(0, sys_path.pop())

        self.client = TwilioRestClient(self.account_sid, self.auth_token)

    def send_message(self, phone_number, message_text):

        ''' send an SMS from the Twilio account to phone number

        :param phone_number: string with phone number with country and area code
        :param message_text: string with message text
        :return: dictionary with details of response

        {
            'direction': 'outbound-api',
            'to': '+18001234567',
            'status': 'queued',
            'dt': 1479603651.0,
            'body': 'good times',
            'error_code': None,
            'from': '+19001234567'
        }

        '''

        response = self.client.messages.save(
            to=phone_number,
            from_=self.twilio_phone,
            body=message_text
        )

        keys = ['body', 'status', 'error_code', 'direction', 'date_updated', 'to', 'from_']
        response_details = {}
        import re
        builtin_pattern = re.compile('^_')
        for method in dir(response):
            if not builtin_pattern.findall(method):
                if method == 'date_updated':
                    from labpack.records.time import labDT
                    python_dt = getattr(response, method)
                    from tzlocal import get_localzone
                    python_dt = python_dt.replace(tzinfo=get_localzone())
                    response_details[method] = labDT.fromPython(python_dt).epoch()
                elif method in keys:
                    response_details[method] = getattr(response, method)

        return response_details

if __name__ == '__main__':
    from labpack.records.settings import load_settings
    twilio_config = load_settings('../../../cred/twilio.yaml')
    account_sid = twilio_config['twilio_account_sid']
    auth_token = twilio_config['twilio_auth_token']
    twilio_phone = twilio_config['twilio_phone_number']
    twilio_client = twilioClient(account_sid, auth_token, twilio_phone)
    response_details = twilio_client.send_message('+13109361571', 'good times')
    print(response_details)