text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>rot.js</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					rot.js

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

 rot.js

Index

External modules

"<wbr>Min<wbr>Heap"

"color"

"constants"

"display/backend"

"display/canvas"

"display/display"

"display/hex"

"display/rect"

"display/term"

"display/tile"

"display/tile-<wbr>gl"

"display/types"

"engine"

"eventqueue"

"fov/discrete-<wbr>shadowcasting"

"fov/fov"

"fov/index"

"fov/precise-<wbr>shadowcasting"

"fov/recursive-<wbr>shadowcasting"

"index"

"lighting"

"map/arena"

"map/cellular"

"map/digger"

"map/dividedmaze"

"map/dungeon"

"map/ellermaze"

"map/features"

"map/iceymaze"

"map/index"

"map/map"

"map/rogue"

"map/uniform"

"noise/index"

"noise/noise"

"noise/simplex"

"path/astar"

"path/dijkstra"

"path/index"

"path/path"

"rng"

"scheduler/action"

"scheduler/index"

"scheduler/scheduler"

"scheduler/simple"

"scheduler/speed"

"stringgenerator"

"text"

"util"

						Globals

						"<wbr>Min<wbr>Heap"

						"color"

						"constants"

						"display/backend"

						"display/canvas"

						"display/display"

						"display/hex"

						"display/rect"

						"display/term"

						"display/tile"

						"display/tile-<wbr>gl"

						"display/types"

						"engine"

						"eventqueue"

						"fov/discrete-<wbr>shadowcasting"

						"fov/fov"

						"fov/index"

						"fov/precise-<wbr>shadowcasting"

						"fov/recursive-<wbr>shadowcasting"

						"index"

						"lighting"

						"map/arena"

						"map/cellular"

						"map/digger"

						"map/dividedmaze"

						"map/dungeon"

						"map/ellermaze"

						"map/features"

						"map/iceymaze"

						"map/index"

						"map/map"

						"map/rogue"

						"map/uniform"

						"noise/index"

						"noise/noise"

						"noise/simplex"

						"path/astar"

						"path/dijkstra"

						"path/index"

						"path/path"

						"rng"

						"scheduler/action"

						"scheduler/index"

						"scheduler/scheduler"

						"scheduler/simple"

						"scheduler/speed"

						"stringgenerator"

						"text"

						"util"

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Type alias with type parameter

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
// This file is part of the :(){ :|:& };:'s project
// Licensing information can be found in the LICENSE file
// (C) 2014 :(){ :|:& };:. All rights reserved.
#ifndef __ENGINE_QUADTREE_H__
#define __ENGINE_QUADTREE_H__

template <class T>
class QuadTree
{
public:
  /**
   * Creates a new empty quadtree
   */
   QuadTree();

   /**
    * Builds the quadtree from another tree
    */
   QuadTree(const QuadTree& rhs);

   /**
    * Copies a quadtree into this tree
    */
   QuadTree& operator = (const QuadTree& rhs);

public:
  /**
   * Internal node
   */
  class Node
  {
  public:
    /**
     * Creates a new node
     */
    Node();

    /**
     * Destroys the node, freeing children
     */
    ~Node();

  private:
    // Quadtree needs access to internal,
    // but outside world doesn't
    friend class QuadTree<T>;

    /// List of children
    Node *child[4];
    /// Pointer to parent
    Node *parent;
    /// Stored value
    T *value;
    /// Index in the parent's child array
    unsigned index;
  };

private:

};

#endif /*__ENGINE_QUADTREE_H__*/

redpajama_set_name: RedPajamaGithub


text:
<?php
declare(strict_types=1);

namespace TileLand\Direction;

interface Directions
{
    const EAST = 'east';

    const NORTH = 'north';

    const NORTHEAST = 'northeast';

    const NORTHWEST  = 'northwest';

    const SOUTH = 'south';

    const SOUTHEAST = 'southeast';

    const SOUTHWEST = 'southwest';

    const WEST = 'west';
}


text: See [foss-credits](https://github.com/andrewschaaf/foss-credits)


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="GBK">
    <file url="PROJECT" charset="GBK" />
  </component>
</project>


text:
<?xml version="1.0" encoding="UTF-8"?>
<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">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>nl.koders.voltstreet.service</groupId>
		<artifactId>voltstreet-edison-project</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>

	<artifactId>voltstreet-edison-app</artifactId>

	<dependencies>
		<dependency>
			<groupId>nl.koders.voltstreet.service</groupId>
			<artifactId>voltstreet-edison-web</artifactId>
		</dependency>
		<dependency>
			<groupId>nl.koders.voltstreet.service</groupId>
			<artifactId>voltstreet-edison-business</artifactId>
		</dependency>
		<dependency>
			<groupId>nl.koders.voltstreet.service</groupId>
			<artifactId>voltstreet-edison-data</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-eureka</artifactId>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-client</artifactId>
			<version>${project.versions.spring-boot-admin}</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${project.versions.spring-boot}</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>build-info</goal>
							<goal>repackage</goal>
						</goals>
						<configuration>
							<classifier>boot</classifier>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>


text:
alef-utils is a private utility package for Alef and should only be used interally.

## License
Alef is licensed under the [MIT License](http://opensource.org/licenses/MIT).

Documentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).

Created with ♥ by [@rofrischmann](http://rofrischmann.de) and all the great contributors.


text:
package bogus

//go:generate reform

// Bogus2 is used for testing. reform:bogus
type Bogus2 struct {
	bogusType `reform:"bogus"` // anonymous field with "reform:" tag should generate error
}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.flowable.cmmn.rest.service.api.runtime;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import org.flowable.cmmn.api.runtime.CaseInstance;
import org.flowable.cmmn.api.runtime.PlanItemDefinitionType;
import org.flowable.cmmn.api.runtime.PlanItemInstance;
import org.flowable.cmmn.engine.test.CmmnDeployment;
import org.flowable.cmmn.rest.service.BaseSpringRestTestCase;
import org.flowable.cmmn.rest.service.api.CmmnRestUrls;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * Test for all REST-operations related to the plan item instance query resource.
 *
 * @author Tijs Rademakers
 * @author Joram Barrez
 */
public class PlanItemInstanceQueryResourceTest extends BaseSpringRestTestCase {

    @CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/runtime/PlanItemInstanceQueryResourceTest.testQueryPlanItemInstances.cmmn" })
    public void testQueryPlanItemInstances() throws Exception {
        CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("testPlanItemInstanceQuery").start();

        // Type
        List<PlanItemInstance> planItemInstanceList = runtimeService.createPlanItemInstanceQuery()
                .caseInstanceId(caseInstance.getId())
                .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK)
                .list();
        assertThat(planItemInstanceList).hasSize(2);

        String url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE_QUERY);
        ObjectNode requestNode = objectMapper.createObjectNode();
        requestNode.put("caseInstanceId", caseInstance.getId());
        requestNode.put("planItemDefinitionType", "humantask");
        assertResultsPresentInPostDataResponse(url, requestNode, planItemInstanceList.get(0).getId(), planItemInstanceList.get(1).getId());

        // Multiple types
        planItemInstanceList = runtimeService.createPlanItemInstanceQuery()
                .caseInstanceId(caseInstance.getId())
                .planItemDefinitionTypes(Arrays.asList(PlanItemDefinitionType.HUMAN_TASK, PlanItemDefinitionType.STAGE))
                .list();
        assertThat(planItemInstanceList).hasSize(4);

        url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE_QUERY);
        requestNode = objectMapper.createObjectNode();
        requestNode.put("caseInstanceId", caseInstance.getId());
        requestNode.putArray("planItemDefinitionTypes").add("humantask").add("stage");
        assertResultsPresentInPostDataResponse(url, requestNode,
                planItemInstanceList.get(0).getId(),
                planItemInstanceList.get(1).getId(),
                planItemInstanceList.get(2).getId(),
                planItemInstanceList.get(3).getId());
    }

    /**
     * Test querying plan item instance based on variables. POST query/case-instances
     */
    @CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/oneHumanTaskCase.cmmn" })
    public void testQueryPlanItemInstancesWithVariables() throws Exception {
        HashMap<String, Object> caseVariables = new HashMap<>();
        caseVariables.put("stringVar", "Azerty");
        caseVariables.put("intVar", 67890);
        caseVariables.put("booleanVar", false);

        CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("oneHumanTaskCase").variables(caseVariables).start();

        PlanItemInstance planItem = runtimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstance.getId()).singleResult();

        String url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE_QUERY);

        // Process variables
        ObjectNode requestNode = objectMapper.createObjectNode();
        ArrayNode variableArray = objectMapper.createArrayNode();
        ObjectNode variableNode = objectMapper.createObjectNode();
        variableArray.add(variableNode);
        requestNode.set("caseInstanceVariables", variableArray);

        // String equals
        variableNode.put("name", "stringVar");
        variableNode.put("value", "Azerty");
        variableNode.put("operation", "equals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // Integer equals
        variableNode.removeAll();
        variableNode.put("name", "intVar");
        variableNode.put("value", 67890);
        variableNode.put("operation", "equals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // Boolean equals
        variableNode.removeAll();
        variableNode.put("name", "booleanVar");
        variableNode.put("value", false);
        variableNode.put("operation", "equals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // String not equals
        variableNode.removeAll();
        variableNode.put("name", "stringVar");
        variableNode.put("value", "ghijkl");
        variableNode.put("operation", "notEquals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // Integer not equals
        variableNode.removeAll();
        variableNode.put("name", "intVar");
        variableNode.put("value", 45678);
        variableNode.put("operation", "notEquals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // Boolean not equals
        variableNode.removeAll();
        variableNode.put("name", "booleanVar");
        variableNode.put("value", true);
        variableNode.put("operation", "notEquals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // String equals ignore case
        variableNode.removeAll();
        variableNode.put("name", "stringVar");
        variableNode.put("value", "azeRTY");
        variableNode.put("operation", "equalsIgnoreCase");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // String not equals ignore case
        variableNode.removeAll();
        variableNode.put("name", "stringVar");
        variableNode.put("value", "HIJKLm");
        variableNode.put("operation", "notEqualsIgnoreCase");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // String equals without value
        variableNode.removeAll();
        variableNode.put("value", "Azerty");
        variableNode.put("operation", "equals");
        assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

        // String equals with non existing value
        variableNode.removeAll();
        variableNode.put("value", "Azerty2");
        variableNode.put("operation", "equals");
        assertResultsPresentInPostDataResponse(url, requestNode);
    }

}


text:
layout: doc_page
---
# Query Filters
A filter is a JSON object indicating which rows of data should be included in the computation for a query. It's essentially the equivalent of the WHERE clause in SQL. Druid supports the following types of filters.

### Selector filter

The simplest filter is a selector filter. The selector filter will match a specific dimension with a specific value. Selector filters can be used as the base filters for more complex Boolean expressions of filters.

The grammar for a SELECTOR filter is as follows:

``` json
"filter": { "type": "selector", "dimension": <dimension_string>, "value": <dimension_value_string> }
```

This is the equivalent of `WHERE <dimension_string> = '<dimension_value_string>'`.

The selector filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

### Regular expression filter

The regular expression filter is similar to the selector filter, but using regular expressions. It matches the specified dimension with the given pattern. The pattern can be any standard [Java regular expression](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html).

``` json
"filter": { "type": "regex", "dimension": <dimension_string>, "pattern": <pattern_string> }
```

The regex filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

### Logical expression filters

#### AND

The grammar for an AND filter is as follows:

``` json
"filter": { "type": "and", "fields": [<filter>, <filter>, ...] }
```

The filters in fields can be any other filter defined on this page.

#### OR

The grammar for an OR filter is as follows:

``` json
"filter": { "type": "or", "fields": [<filter>, <filter>, ...] }
```

The filters in fields can be any other filter defined on this page.

#### NOT

The grammar for a NOT filter is as follows:

```json
"filter": { "type": "not", "field": <filter> }
```

The filter specified at field can be any other filter defined on this page.

### JavaScript filter

The JavaScript filter matches a dimension against the specified JavaScript function predicate. The filter matches values for which the function returns true.

The function takes a single argument, the dimension value, and returns either true or false.

```json
{
  "type" : "javascript",
  "dimension" : <dimension_string>,
  "function" : "function(value) { <...> }"
}
```

**Example**
The following matches any dimension values for the dimension `name` between `'bar'` and `'foo'`

```json
{
  "type" : "javascript",
  "dimension" : "name",
  "function" : "function(x) { return(x >= 'bar' && x <= 'foo') }"
}
```

The JavaScript filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

JavaScript-based functionality is disabled by default. Please refer to the Druid JavaScript programming guide for guidelines about using Druid's JavaScript functionality, including instructions on how to enable it.

### Extraction filter

The extraction filter is now deprecated. The selector filter with an extraction function specified
provides identical functionality and should be used instead.

Extraction filter matches a dimension using some specific [Extraction function](./dimensionspecs.html#extraction-functions).
The following filter matches the values for which the extraction function has transformation entry `input_key=output_value` where
`output_value` is equal to the filter `value` and `input_key` is present as dimension.

**Example**
The following matches dimension values in `[product_1, product_3, product_5]` for the column `product`

```json
{
    "filter": {
        "type": "extraction",
        "dimension": "product",
        "value": "bar_1",
        "extractionFn": {
            "type": "lookup",
            "lookup": {
                "type": "map",
                "map": {
                    "product_1": "bar_1",
                    "product_5": "bar_1",
                    "product_3": "bar_1"
                }
            }
        }
    }
}
```

### Search filter

Search filters can be used to filter on partial string matches.

```json
{
    "filter": {
        "type": "search",
        "dimension": "product",
        "query": {
          "type": "insensitive_contains",
          "value": "foo"
        }
    }
}
```

|property|description|required?|
|--------|-----------|---------|
|type|This String should always be "search".|yes|
|dimension|The dimension to perform the search over.|yes|
|query|A JSON object for the type of search. See below for more information.|yes|
|extractionFn|[Extraction function](#filtering-with-extraction-functions) to apply to the dimension|no|

The search filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

#### Search Query Spec

##### Contains

|property|description|required?|
|--------|-----------|---------|
|type|This String should always be "contains".|yes|
|value|A String value to run the search over.|yes|
|caseSensitive|Whether two string should be compared as case sensitive or not|no (default == false)|

##### Insensitive Contains

|property|description|required?|
|--------|-----------|---------|
|type|This String should always be "insensitive_contains".|yes|
|value|A String value to run the search over.|yes|

Note that an "insensitive_contains" search is equivalent to a "contains" search with "caseSensitive": false (or not
provided).

##### Fragment

|property|description|required?|
|--------|-----------|---------|
|type|This String should always be "fragment".|yes|
|values|A JSON array of String values to run the search over.|yes|
|caseSensitive|Whether strings should be compared as case sensitive or not. Default: false(insensitive)|no|

### In filter

In filter can be used to express the following SQL query:

```sql
 SELECT COUNT(*) AS 'Count' FROM `table` WHERE `outlaw` IN ('Good', 'Bad', 'Ugly')
```

The grammar for a IN filter is as follows:

```json
{
    "type": "in",
    "dimension": "outlaw",
    "values": ["Good", "Bad", "Ugly"]
}
```

The IN filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

### Like filter

Like filters can be used for basic wildcard searches. They are equivalent to the SQL LIKE operator. Special characters
supported are "%" (matches any number of characters) and "\_" (matches any one character).

|property|type|description|required?|
|--------|-----------|---------|---------|
|type|String|This should always be "like".|yes|
|dimension|String|The dimension to filter on|yes|
|pattern|String|LIKE pattern, such as "foo%" or "___bar".|yes|
|escape|String|An escape character that can be used to escape special characters.|no|
|extractionFn|[Extraction function](#filtering-with-extraction-functions)| Extraction function to apply to the dimension|no|

Like filters support the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

This Like filter expresses the condition `last_name LIKE "D%"` (i.e. last_name starts with "D").

```json
{
    "type": "like",
    "dimension": "last_name",
    "pattern": "D%"
}
```

### Bound filter

Bound filters can be used to filter on ranges of dimension values. It can be used for comparison filtering like
greater than, less than, greater than or equal to, less than or equal to, and "between" (if both "lower" and
"upper" are set).

|property|type|description|required?|
|--------|-----------|---------|---------|
|type|String|This should always be "bound".|yes|
|dimension|String|The dimension to filter on|yes|
|lower|String|The lower bound for the filter|no|
|upper|String|The upper bound for the filter|no|
|lowerStrict|Boolean|Perform strict comparison on the lower bound ("<" instead of "<=")|no, default: false|
|upperStrict|Boolean|Perform strict comparison on the upper bound (">" instead of ">=")|no, default: false|
|ordering|String|Specifies the sorting order to use when comparing values against the bound. Can be one of the following values: "lexicographic", "alphanumeric", "numeric", "strlen". See [Sorting Orders](./sorting-orders.html) for more details.|no, default: "lexicographic"|
|extractionFn|[Extraction function](#filtering-with-extraction-functions)| Extraction function to apply to the dimension|no|

Bound filters support the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

The following bound filter expresses the condition `21 <= age <= 31`:
```json
{
    "type": "bound",
    "dimension": "age",
    "lower": "21",
    "upper": "31" ,
    "ordering": "numeric"
}
```

This filter expresses the condition `foo <= name <= hoo`, using the default lexicographic sorting order.
```json
{
    "type": "bound",
    "dimension": "name",
    "lower": "foo",
    "upper": "hoo"
}
```

Using strict bounds, this filter expresses the condition `21 < age < 31`
```json
{
    "type": "bound",
    "dimension": "age",
    "lower": "21",
    "lowerStrict": true,
    "upper": "31" ,
    "upperStrict": true,
    "ordering": "numeric"
}
```

The user can also specify a one-sided bound by omitting "upper" or "lower". This filter expresses `age < 31`.
```json
{
    "type": "bound",
    "dimension": "age",
    "upper": "31" ,
    "upperStrict": true,
    "ordering": "numeric"
}
```

Likewise, this filter expresses `age >= 18`
```json
{
    "type": "bound",
    "dimension": "age",
    "lower": "18" ,
    "ordering": "numeric"
}
```

### Interval Filter

The Interval filter enables range filtering on columns that contain long millisecond values, with the boundaries specified as ISO 8601 time intervals. It is suitable for the `__time` column, long metric columns, and dimensions with values that can be parsed as long milliseconds.

This filter converts the ISO 8601 intervals to long millisecond start/end ranges and translates to an OR of Bound filters on those millisecond ranges, with numeric comparison. The Bound filters will have left-closed and right-open matching (i.e., start <= time < end).

|property|type|description|required?|
|--------|-----------|---------|---------|
|type|String|This should always be "interval".|yes|
|dimension|String|The dimension to filter on|yes|
|intervals|Array|A JSON array containing ISO-8601 interval strings. This defines the time ranges to filter on.|yes|
|extractionFn|[Extraction function](#filtering-with-extraction-functions)| Extraction function to apply to the dimension|no|

The interval filter supports the use of extraction functions, see [Filtering with Extraction Functions](#filtering-with-extraction-functions) for details.

If an extraction function is used with this filter, the extraction function should output values that are parseable as long milliseconds.

The following example filters on the time ranges of October 1-7, 2014 and November 15-16, 2014.
```json
{
    "type" : "interval",
    "dimension" : "__time",
    "intervals" : [
      "2014-10-01T00:00:00.000Z/2014-10-07T00:00:00.000Z",
      "2014-11-15T00:00:00.000Z/2014-11-16T00:00:00.000Z"
    ]
}
```

The filter above is equivalent to the following OR of Bound filters:

```json
{
    "type": "or",
    "fields": [
      {
        "type": "bound",
        "dimension": "__time",
        "lower": "1412121600000",
        "lowerStrict": false,
        "upper": "1412640000000" ,
        "upperStrict": true,
        "ordering": "numeric"
      },
      {
         "type": "bound",
         "dimension": "__time",
         "lower": "1416009600000",
         "lowerStrict": false,
         "upper": "1416096000000" ,
         "upperStrict": true,
         "ordering": "numeric"
      }
    ]
}
```

### Filtering with Extraction Functions
All filters except the "spatial" filter support extraction functions.
An extraction function is defined by setting the "extractionFn" field on a filter.
See [Extraction function](./dimensionspecs.html#extraction-functions) for more details on extraction functions.

If specified, the extraction function will be used to transform input values before the filter is applied.
The example below shows a selector filter combined with an extraction function. This filter will transform input values
according to the values defined in the lookup map; transformed values will then be matched with the string "bar_1".

**Example**
The following matches dimension values in `[product_1, product_3, product_5]` for the column `product`

```json
{
    "filter": {
        "type": "selector",
        "dimension": "product",
        "value": "bar_1",
        "extractionFn": {
            "type": "lookup",
            "lookup": {
                "type": "map",
                "map": {
                    "product_1": "bar_1",
                    "product_5": "bar_1",
                    "product_3": "bar_1"
                }
            }
        }
    }
}
```

### Filtering on the Timestamp Column
Filters can also be applied to the timestamp column. The timestamp column has long millisecond values.

To refer to the timestamp column, use the string `__time` as the dimension name.

The filter parameters (e.g., the selector value for the SelectorFilter) should be provided as Strings.

If the user wishes to interpret the timestamp with a specific format, timezone, or locale, the [Time Format Extraction Function](./dimensionspecs.html#time-format-extraction-function) is useful.

Note that the timestamp column does not have a bitmap index. Thus, filtering on timestamp in a query requires a scan of the column, and performance will be affected accordingly. If possible, excluding time ranges by specifying the query interval will be faster.

**Example**

Filtering on a long timestamp value:
```json
"filter": {
  "type": "selector",
  "dimension": "__time",
  "value": "124457387532"
}
```

Filtering on day of week:
```json
"filter": {
  "type": "selector",
  "dimension": "__time",
  "value": "Friday",
  "extractionFn": {
    "type": "timeFormat",
    "format": "EEEE",
    "timeZone": "America/New_York",
    "locale": "en"
  }
}
```

Filtering on a set of ISO 8601 intervals:
```json
{
    "type" : "interval",
    "dimension" : "__time",
    "intervals" : [
      "2014-10-01T00:00:00.000Z/2014-10-07T00:00:00.000Z",
      "2014-11-15T00:00:00.000Z/2014-11-16T00:00:00.000Z"
    ]
}
```


text:
class BacktraceSymbolTable;

class SymbolsListModel : public QAbstractListModel
{
public:
    enum
    {
        ROLE_SYMBOL_POINTER = Qt::UserRole + 1
    };

public:
    SymbolsListModel(const BacktraceSymbolTable& symbolTable, QObject* parent = nullptr);
    virtual ~SymbolsListModel();

    // QAbstractListModel
    int rowCount(const QModelIndex& parent) const override;
    QVariant data(const QModelIndex& index, int role) const override;

private:
    void PrepareSymbols();

private:
    const BacktraceSymbolTable& symbolTable;
    DAVA::Vector<const DAVA::String*> allSymbols;
};

//////////////////////////////////////////////////////////////////////////
class SymbolsFilterModel : public QSortFilterProxyModel
{
    Q_OBJECT

public:
    SymbolsFilterModel(SymbolsListModel* model, QObject* parent = nullptr);
    virtual ~SymbolsFilterModel() = default;

public slots:
    void SetFilterString(const QString& filterString);
    void ToggleHideStdAndUnresolved();

protected:
    bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
    bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const override;
    bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;

private:
    QString filter;
    bool hideStdAndUnresolved = true; // If flag is set then filter out unresolved names and names beginning from std::
};


text:
quickConnectsSkynet
======================

A script for quickly connecting to skynet.im.


text:
using namespace std;

template <typename Type>
class CUDA_array : public CUDA_object<Type>
{
    public:
        // Constructor/Destructor
        CUDA_array(){}
        CUDA_array(const int& l);
        CUDA_array(Type* input, const int& l);
        CUDA_array(vector<Type>& input);
        CUDA_array(const CUDA_array<Type>& other);
        virtual ~CUDA_array();

        // Set/Get
        virtual int size() const { return _len; }
        virtual void resize(const int& l);
        virtual void setValue(Type* input);
        virtual void setValue(const vector<Type>& input);
        virtual Type &operator[](const size_t idx){ return this->_val[idx]; }

        // Operations
        virtual void add(CUDA_array<Type> const&);
        virtual Type inner_prod(CUDA_array<Type> const&);
        virtual Type sum();
        virtual Type min();
        virtual Type max();
        virtual void cumulate();
        //virtual void convolve(const Type* mask, const int& m_len);

    protected:
        // Template method for all reduce operations (sum, min, max et. al.)
        virtual Type reduce(void (*f)(Type*, Type*, int));

    private:
        int _len;
};

template <typename Type>
CUDA_array<Type>::CUDA_array(const int& l) : _len(l)
{
    this->_val = new Type[_len];
    cudaMalloc((void**) &(this->cuda_val), _len*sizeof(Type));
}

template <typename Type>
CUDA_array<Type>::CUDA_array(Type* input, const int& l) : _len(l)
{
    this->_val = new Type[_len];
    setValue(input);
    cudaMalloc((void**) &(this->cuda_val), _len*sizeof(Type));
}

template <typename Type>
CUDA_array<Type>::CUDA_array(vector<Type>& input) : _len(input.size())
{
    this->_val = new Type[_len];
    setValue(input);
    cudaMalloc((void**) &(this->cuda_val), _len*sizeof(Type));
}

template <typename Type>
CUDA_array<Type>::CUDA_array(const CUDA_array<Type>& other)
{
    _len = other.size();
    this->_val = new Type[_len];
    setValue(other.getValue());
    cudaMalloc((void**) &(this->cuda_val), _len*sizeof(Type));
}

template <typename Type>
CUDA_array<Type>::~CUDA_array()
{
    if (this->_val!=NULL)
    {
        delete [] this->_val;
        cudaFree(this->cuda_val);
    }
}

template <typename Type>
void CUDA_array<Type>::resize(const int& l)
{
    _len = l;
    this->reset();
}

template <typename Type>
void CUDA_array<Type>::setValue(Type* input)
{
    for (int i=0; i<_len; ++i)
        this->_val[i] = input[i];
}

template <typename Type>
void CUDA_array<Type>::setValue(const vector<Type>& input)
{
    for (int i=0; i<_len; ++i)
        this->_val[i] = input[i];
}

template <typename Type>
void CUDA_array<Type>::add(CUDA_array<Type> const &input)
{
    if (input.size()!=_len)
    {
        cerr<<"ERROR: can't add arrays with different length"<<endl;
        return;
    }

    Type *d_out;

    cudaMalloc((void**) &d_out, _len*sizeof(Type));
    cudaMemset(d_out, 0, _len*sizeof(Type));
    cudaCheckErrors("cudaMalloc @ CUDA_array<Type>::add");

    this->cudaMemcpyToDevice();
    input.cudaMemcpyToDevice();
    cudaCheckErrors("cudaMemcpyHostToDevice @ CUDA_array<Type>::add");

    dim3 grid((_len-1)/BLKSIZE_1D+1, 1, 1);
    dim3 block(BLKSIZE_1D, 1, 1);

    vecAdd<Type><<<grid, block>>>(this->cuda_val, input.getCUDAValue(), d_out, _len);
    cudaDeviceSynchronize();

    cudaMemcpy(this->_val, d_out, _len*sizeof(Type), cudaMemcpyDeviceToHost);
    cudaCheckErrors("cudaMemcpyDeviceToHost @ CUDA_array<Type>::add");

    cudaFree(d_out);
}

template <typename Type>
Type CUDA_array<Type>::inner_prod(CUDA_array<Type> const &input)
{
    if (input.size()!=_len)
    {
        cerr<<"ERROR: can't inner product arrays with different length"<<endl;
        return Type();
    }

    Type *d_out;
    Type *h_out = new Type[_len];

    cudaMalloc((void**) &d_out, _len*sizeof(Type));
    cudaMemset(d_out, 0, _len*sizeof(Type));
    cudaCheckErrors("cudaMalloc @ CUDA_array<Type>::inner_prod");

    this->cudaMemcpyToDevice();
    input.cudaMemcpyToDevice();
    cudaCheckErrors("cudaMemcpyHostToDevice @ CUDA_array<Type>::inner_prod");

    dim3 grid((_len-1)/BLKSIZE_1D+1, 1, 1);
    dim3 block(BLKSIZE_1D, 1, 1);

    vecProd<Type><<<grid, block>>>(this->cuda_val, input.getCUDAValue(), d_out, _len);
    cudaDeviceSynchronize();

    cudaMemcpy(h_out, d_out, _len*sizeof(Type), cudaMemcpyDeviceToHost);
    cudaCheckErrors("cudaMemcpyDeviceToHost @ CUDA_array<Type>::inner_prod");

    Type ans = CUDA_array<Type>(h_out, _len).sum();

    cudaFree(d_out);
    delete [] h_out;

    return ans;
}

template <typename Type>
Type CUDA_array<Type>::sum()
{
    CUDA_array<Type>::reduce(total);
}

template <typename Type>
Type CUDA_array<Type>::min()
{
    CUDA_array<Type>::reduce(getMin);
}

template <typename Type>
Type CUDA_array<Type>::max()
{
    CUDA_array<Type>::reduce(getMax);
}

template <typename Type>
Type CUDA_array<Type>::reduce(void (*reducer)(Type*, Type*, int))
{
    Type *d_tmp1, *d_tmp2;
    int reduced_len = _len / (BLKSIZE_1D<<1);
    if (_len % (BLKSIZE_1D<<1))
        reduced_len+=1;

    cudaMalloc((void **) &d_tmp1, _len*sizeof(Type));
    cudaMemset(d_tmp1, 0, _len*sizeof(Type));
    cudaMalloc((void **) &d_tmp2, _len*sizeof(Type));
    cudaMemset(d_tmp2, 0, _len*sizeof(Type));
    cudaCheckErrors("cudaMalloc @ CUDA_array<Type>::sum");

    dim3 block(BLKSIZE_1D, 1, 1);
    dim3 grid(reduced_len, 1, 1);

    // 1st reduce
    cudaMemcpy(this->cuda_val, this->_val, _len*sizeof(Type), cudaMemcpyHostToDevice);
    cudaCheckErrors("cudaMemcpyHostToDevice @ CUDA_array<Type>::sum");
    reducer<<<grid, block>>>(this->cuda_val, d_tmp1, _len);
    cudaDeviceSynchronize();

    // iteratively reduce until length=1
    while (reduced_len>1)
    {
        reducer<<<grid, block>>>(d_tmp1, d_tmp2, reduced_len);
        cudaDeviceSynchronize();
        if (reduced_len==1)
        {
            d_tmp1 = d_tmp2;
            break;
        }
        reduced_len /= (BLKSIZE_1D<<1);
        if (_len % (BLKSIZE_1D<<1))
            reduced_len+=1;
        reducer<<<grid, block>>>(d_tmp2, d_tmp1, reduced_len);
        cudaDeviceSynchronize();
        reduced_len /= (BLKSIZE_1D<<1);
        if (_len % (BLKSIZE_1D<<1))
            reduced_len+=1;
    }

    Type *_ans = new Type[1];
    cudaMemcpy(_ans, d_tmp1, sizeof(Type), cudaMemcpyDeviceToHost);
    cudaCheckErrors("cudaMemcpyDeviceToHost @ CUDA_array<Type>::sum");
    Type ans = _ans[0];

    cudaFree(d_tmp1);
    cudaFree(d_tmp2);
    delete [] _ans;

    return ans;
}

template <typename Type>
void CUDA_array<Type>::cumulate()
{
    Type *d_tmp;

    cudaMalloc((void**)&d_tmp, _len*sizeof(Type));
    cudaMemcpy(this->cuda_val, this->_val, _len*sizeof(Type), cudaMemcpyHostToDevice);

    dim3 block(BLKSIZE_1D, 1, 1);
    dim3 grid((_len-1)/(BLKSIZE_1D*2)+1, 1, 1);

    cudaMemset(d_tmp, 0, _len*sizeof(Type));
    scan<<<grid, block>>>(this->cuda_val, d_tmp, _len);
    cudaDeviceSynchronize();

    cudaMemset(this->cuda_val, 0, _len*sizeof(Type));
    offset<<<grid, block>>>(d_tmp, this->cuda_val, _len);
    cudaDeviceSynchronize();

    cudaMemcpy(this->_val, this->cuda_val, _len*sizeof(Type), cudaMemcpyDeviceToHost);

    cudaFree(d_tmp);
}

#endif


text:
<address style="align: right;">
Generated on $datetime for $projectname by Doxygen $doxygenversion

Copyright &copy 2002-2003 GBDI-ICMC-USP
</address>


text:
package main

import (
	"reflect"
	"testing"

	log "github.com/nerdalert/gopher-net-ctl/Godeps/_workspace/src/github.com/Sirupsen/logrus"
)

func TestAsStringTo32(t *testing.T) {
	var n uint32
	var as string = "650001"
	ustr := StrToUin32(as)
	us := reflect.ValueOf(ustr).Kind()
	u := reflect.ValueOf(n).Kind()
	assertEqual(us, u)
}

func TestPrefixParsing(t *testing.T) {
	ip := "172.16.203.1"
	ipCidr := "172.16.203.1/32"
	hostname := "google-public-dns-a.google.com."
	gipCidr := "8.8.8.8/32"
	// test cidr input parse
	addr, _ := GetCidr(ip)
	assertEqual(addr.String(), ipCidr)
	// test host ip only input to host route parse
	addr, _ = GetCidr(ipCidr)
	assertEqual(addr.String(), ipCidr)
	// test hostname input to host route parse
	addr, _ = GetCidr(hostname)
	assertEqual(addr.String(), gipCidr)
}

func assertEqual(v interface{}, v1 interface{}) bool {
	if v != v1 {
		log.Errorf("the values %v and %v are not equal.", v1, v)
		return false
	}
	return true
}


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>WebShare Test: Share with URL without a scheme</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="resources/manual-helper.js"></script>
  </head>
  <body>
    <script>
        setup({explicit_timeout: true});

        const url = '//www.example.com/some/path?some_query#some_fragment';
        setupManualShareTest({title: '', text: '', url: getAbsoluteUrl(url)});
        callWhenButtonClicked(() => navigator.share({url}));
    </script>
  </body>
</html>


text:
class Role < ActiveRecord::Base

  attr_protected :id, :created_at, :updated_at

  ###
  ###   Relationships
  ###

  has_many :users, :through => :assignments
  has_many :assignments, :dependent => :destroy

  scope :order_by_index, -> { order(:order_index) }
end

# == Schema Information
#
# Table name: roles
#
#  id         :integer          not null, primary key
#  name       :string(255)      not null
#  created_at :datetime         not null
#  updated_at :datetime         not null
#


text:
package edu.uci.ics.asterix.lexergenerator;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import edu.uci.ics.asterix.lexergenerator.rules.Rule;
import edu.uci.ics.asterix.lexergenerator.rules.RuleChar;
import edu.uci.ics.asterix.lexergenerator.rules.RuleEpsilon;
import edu.uci.ics.asterix.lexergenerator.rules.RulePartial;

public class LexerNode {
    private static String TOKEN_PREFIX = "TOKEN_";
    private LinkedHashMap<Rule, LexerNode> actions = new LinkedHashMap<Rule, LexerNode>();
    private String finalTokenName;
    private List<String> ongoingParsing = new ArrayList<String>();

    public LexerNode clone() {
        LexerNode node = new LexerNode();
        node.finalTokenName = this.finalTokenName;
        for (Map.Entry<Rule, LexerNode> entry : this.actions.entrySet()) {
            node.actions.put(entry.getKey().clone(), entry.getValue().clone());
        }
        for (String ongoing : this.ongoingParsing) {
            node.ongoingParsing.add(ongoing);
        }
        return node;
    }

    public void add(Rule newRule) {
        if (actions.get(newRule) == null) {
            actions.put(newRule, new LexerNode());
        }
    }

    public void append(Rule newRule) {
        if (actions.size() == 0) {
            add(newRule);
        } else {
            for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
                action.getValue().append(newRule);
            }
            if (actions.containsKey(new RuleEpsilon())) {
                actions.remove(new RuleEpsilon());
                add(newRule);
            }
        }
    }

    public void merge(LexerNode newNode) throws Exception {
        for (Map.Entry<Rule, LexerNode> action : newNode.actions.entrySet()) {
            if (this.actions.get(action.getKey()) == null) {
                this.actions.put(action.getKey(), action.getValue());
            } else {
                this.actions.get(action.getKey()).merge(action.getValue());
            }
        }
        if (newNode.finalTokenName != null) {
            if (this.finalTokenName == null) {
                this.finalTokenName = newNode.finalTokenName;
            } else {
                throw new Exception("Rule conflict between: " + this.finalTokenName + " and " + newNode.finalTokenName);
            }
        }
        for (String ongoing : newNode.ongoingParsing) {
            this.ongoingParsing.add(ongoing);
        }
    }

    public void append(LexerNode node) throws Exception {
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            if (action.getKey() instanceof RuleEpsilon)
                continue;
            action.getValue().append(node);
        }
        if (actions.containsKey(new RuleEpsilon())) {
            actions.remove(new RuleEpsilon());
            merge(node.clone());
        }
        if (actions.size() == 0 || finalTokenName != null) {
            finalTokenName = null;
            merge(node.clone());
        }
    }

    public void appendTokenName(String name) {
        if (actions.size() == 0) {
            this.finalTokenName = name;
        } else {
            ongoingParsing.add(TOKEN_PREFIX + name);
            for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
                action.getValue().appendTokenName(name);
            }
        }
    }

    public LexerNode removeTokensName() {
        this.finalTokenName = null;
        this.ongoingParsing.clear();
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            action.getValue().removeTokensName();
        }
        return this;
    }

    public String toString() {
        StringBuilder result = new StringBuilder();
        if (finalTokenName != null)
            result.append("! ");
        if (actions.size() == 1)
            result.append(actions.keySet().toArray()[0].toString() + actions.values().toArray()[0].toString());
        if (actions.size() > 1) {
            result.append(" ( ");
            for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
                if (result.length() != 3) {
                    result.append(" || ");
                }
                result.append(action.getKey().toString());
                result.append(action.getValue().toString());
            }
            result.append(" ) ");
        }
        return result.toString();
    }

    public String toJava() {
        StringBuffer result = new StringBuffer();
        if (numberOfRuleChar() > 2) {
            result.append(toJavaSingleCharRules());
            result.append(toJavaComplexRules(false));
        } else {
            result.append(toJavaComplexRules(true));
        }
        if (this.finalTokenName != null) {
            result.append("return " + TOKEN_PREFIX + finalTokenName + ";\n");
        } else if (ongoingParsing != null) {
            String ongoingParsingArgs = collectionJoin(ongoingParsing, ',');
            result.append("return parseError(" + ongoingParsingArgs + ");\n");
        }
        return result.toString();
    }

    private int numberOfRuleChar() {
        int singleCharRules = 0;
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            if (action.getKey() instanceof RuleChar)
                singleCharRules++;
        }
        return singleCharRules;
    }

    private String toJavaSingleCharRules() {
        StringBuffer result = new StringBuffer();
        result.append("switch(currentChar){\n");
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            if (action.getKey() instanceof RuleChar) {
                RuleChar rule = (RuleChar) action.getKey();
                result.append("case '" + rule.expectedChar() + "':\n");
                result.append(rule.javaAction()).append("\n");
                result.append(action.getValue().toJava());
            }
        }
        result.append("}\n");
        return result.toString();
    }

    private String toJavaComplexRules(boolean all) {
        StringBuffer result = new StringBuffer();
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            if (!all && action.getKey() instanceof RuleChar)
                continue;
            if (action.getKey() instanceof RuleEpsilon)
                continue;
            String act = action.getKey().javaAction();
            if (act.length() > 0) {
                act = "\n" + act;
            }
            result.append(action.getKey().javaMatch(act + "\n" + action.getValue().toJava()));
        }
        return result.toString();
    }

    public void expandFirstAction(LinkedHashMap<String, Token> tokens) throws Exception {
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            Rule first = action.getKey();
            if (first instanceof RulePartial) {
                if (tokens.get(((RulePartial) first).getPartial()) == null) {
                    throw new Exception("Cannot find a token used as part of another definition, missing token: "
                            + ((RulePartial) first).getPartial());
                }
                actions.remove(first);
                LexerNode node = tokens.get(((RulePartial) first).getPartial()).getNode().clone();
                merge(node);
            }
        }
    }

    public Set<String> neededAuxFunctions() {
        HashSet<String> partials = new HashSet<String>();
        for (Map.Entry<Rule, LexerNode> action : actions.entrySet()) {
            Rule rule = action.getKey();
            if (rule instanceof RulePartial) {
                partials.add(((RulePartial) rule).getPartial());
            }
            partials.addAll(action.getValue().neededAuxFunctions());
        }
        return partials;
    }

    public String toJavaAuxFunction() {
        String oldFinalTokenName = finalTokenName;
        if (oldFinalTokenName == null)
            finalTokenName = "AUX_NOT_FOUND";
        String result = toJava();
        finalTokenName = oldFinalTokenName;
        return result;
    }

    private String collectionJoin(Collection<String> collection, char c) {
        StringBuilder ongoingParsingArgs = new StringBuilder();
        for (String token : collection) {
            ongoingParsingArgs.append(token);
            ongoingParsingArgs.append(c);
        }
        if (ongoingParsing.size() > 0) {
            ongoingParsingArgs.deleteCharAt(ongoingParsingArgs.length() - 1);
        }
        return ongoingParsingArgs.toString();
    }
}


text:
package ndp

import (
	"fmt"
	"github.com/crvv/p2pFileSystem/logger"
	"github.com/crvv/p2pFileSystem/settings"
)

type Message struct {
	MessageType string
	Target      string
}

func (m *Message) Type() string {
	return m.MessageType
}
func (m *Message) Destination() string {
	var addr string

	if m.Target == settings.BroadcastAddress {
		return fmt.Sprintf("%s:%d", m.Target, settings.GetSettings().GetCommunicationPort())
	}
	var err error
	addr, err = GetPeerAddr(m.Target)
	logger.Error(err)
	return addr
}
func (m *Message) Payload() []byte {
	payload, err := peer2Json(Myself)
	if err != nil {
		logger.Warning(err)
		return nil
	}
	return payload
}


text:
package mime

func init() {
	typeFiles = append(typeFiles, "/usr/local/etc/mime.types")
}


text:
<!DOCTYPE html>

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

    <title>Flight Delay Visulization</title>
    <meta name="description" content="A simple, whitespace, helvetica based portfolio theme.
">

  <link href='https://fonts.googleapis.com/css?family=Lato:300,400,100' rel='stylesheet' type='text/css'>
  <link href='https://fonts.googleapis.com/css?family=Roboto:300,400,100' rel='stylesheet' type='text/css'>
  <link href='https://fonts.googleapis.com/css?family=Belleza:300,400,100' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="/css/main.css">
    <link rel="canonical" href="/projects/1_project/">

    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

Cheng Wang

        About
                ·

          Projects

Flight Delay Visulization

  This site was built using Jekyll. Cheng Wang © 2017


text:
#ifndef _SHA256_ALT_H_
#define _SHA256_ALT_H_

#if defined(MBEDTLS_SHA256_ALT)

#include "hal/sha_types.h"
#include "soc/soc_caps.h"

#ifdef __cplusplus
extern "C" {
#endif

#if SOC_SHA_SUPPORT_PARALLEL_ENG
typedef enum {
    ESP_MBEDTLS_SHA256_UNUSED, /* first block hasn't been processed yet */
    ESP_MBEDTLS_SHA256_HARDWARE, /* using hardware SHA engine */
    ESP_MBEDTLS_SHA256_SOFTWARE, /* using software SHA */
} esp_mbedtls_sha256_mode;

/**
 * \brief          SHA-256 context structure
 */
typedef struct {
    uint32_t total[2];          /*!< number of bytes processed  */
    uint32_t state[8];          /*!< intermediate digest state  */
    unsigned char buffer[64];   /*!< data block being processed */
    int is224;                  /*!< 0 => SHA-256, else SHA-224 */
    esp_mbedtls_sha256_mode mode;
} mbedtls_sha256_context;

#elif SOC_SHA_SUPPORT_DMA || SOC_SHA_SUPPORT_RESUME
typedef enum {
    ESP_SHA256_STATE_INIT,
    ESP_SHA256_STATE_IN_PROCESS
} esp_sha256_state;

/**
 * \brief          SHA-256 context structure
 */
typedef struct {
    uint32_t total[2];          /*!< number of bytes processed  */
    uint32_t state[8];          /*!< intermediate digest state  */
    unsigned char buffer[64];   /*!< data block being processed */
    int first_block;           /*!< if first then true, else false */
    esp_sha_type mode;
    esp_sha256_state sha_state;
} mbedtls_sha256_context;

#endif

#endif

#ifdef __cplusplus
}
#endif

#endif


text:
/**
* The shell for the <%= pluralize(name) %> section of the application.
*/
export class <%= _.capitalize(pluralize(name)) %>Section {
  configureRouter(config, router) {
    config.map([
      { route: '',    moduleId: './<%= name %>-list', nav: false, title: '' },
      { route: ':id', moduleId: './<%= name %>',      nav: false, title: '' },
    ]);
  }
}


text:
var gcloud = require('gcloud')({
  // We're using the API from the same project as the Cloud Function.
  projectId: process.env.GCP_PROJECT
});

// Use our logging utilty just as a convenience to skip
// console logs during tests
var logger = require('./logger');

// Keep a reference to the datastore client
// This is OK because the function is stateless
var datastore = null;

var self = {

  /**
   * Creates and/or updates a record
   */
  set: function(context, data) {

    // The value contains a JSON document representing the entity we want to save
    var value = data['value'];

    if (!value) {
      context.failure(
        'Value not provided. Make sure you have a \'value\' property ' +
        'in your request');
      return;
    }

    self._getKeyFromData(data, function(err, k) {
      if (err) {
        logger.error(err);
        context.failure(err);
        return;
      }

      self._saveEntity(k, value, function(err) {
        if (err) {
          logger.error(err);
          context.failure(err);
        } else {
          context.success('Entity saved');
        }
      });
    });
  },

  /**
   * Retrieves a record
   */
  get: function(context, data) {

    self._getEntity(data, function(err, dsKey, entity) {
      if (err) {
        logger.error(err);
        context.failure(err);
        return;
      }

      // The get operation will not fail for a non-existent entity, it just returns null.
      if (!entity) {
        context.failure('No entity found for key ' + dsKey['path']);
      } else {
        context.success(entity);
      }
    });
  },

  /**
   * Deletes a record
   */
  del: function(context, data) {
    self._getKeyFromData(data, function(err, k) {
      if (err) {
        logger.error(err);
        context.failure(err);
        return;
      }

      var ds = self._getDSClient();

      ds.delete(k, function(err, apiResp) {
        if (err) {
          logger.error(err);
          context.failure(err);
        } else {
          context.success('Entity deleted');
        }
      });
    });
  },

  // Gets a Datastore key from the kind/key pair in the request
  _getKeyFromData: function(data, callback) {

    var key = data['key'];
    var kind = data['kind'];

    if (!key) {
      callback(
        'Key not provided. Make sure you have a \'key\' property in ' +
        'your request');
      return;
    }

    if (!kind) {
      callback(
        'Kind not provided. Make sure you have a \'kind\' property in ' +
        'your request');
      return;
    }

    var ds = self._getDSClient();

    callback(null, ds.key([kind, key]));
  },

  // Gets a Datastore entity based on the key information in the request and
  // returns null if the entity does not exist
  _getEntity: function(data, callback) {

    self._getKeyFromData(data, function(err, k) {
      if (err) {
        callback(err);
        return;
      }

      var ds = self._getDSClient();

      ds.get(k, function(err, entity) {
        if (entity) {
          callback(null, k, entity);
        } else if (err) {
          callback(err);
        } else {
          callback(null, k);
        }
      });
    });
  },

  // Gets or creates a Datastore client
  _getDSClient: function() {
    if (datastore === null) {
      datastore = gcloud.datastore();
    }
    return datastore;
  },

  // Saves (creates or inserts) an entity with the given key
  _saveEntity: function(dsKey, value, callback) {
    var ds = self._getDSClient();
    ds.save({
      key: dsKey,
      data: value
    }, callback);
  }
};
module.exports = self;


text:
var Action = require('./Action');

function Sync(game, duration, lanes) {
    Action.call(this, game, duration, true, lanes);
}

Sync.prototype = Object.create(Action.prototype);
Sync.prototype.constructor = Sync;
module.exports = Sync;

Sync.prototype.update = function () {
    if (this.parent && this.parent.actions[0] === this) {
        this.finished = true;
    }
};


text:
package android.util;

public class Size
{
    protected Size() {}
    public Size(int p0, int p1){}
    public String toString(){ return null; }
    public boolean equals(Object p0){ return false; }
    public int getHeight(){ return 0; }
    public int getWidth(){ return 0; }
    public int hashCode(){ return 0; }
    public static Size parseSize(String p0){ return null; }
}


text:
package nk.hiroshi.plusle.script.cmd;

import nk.hiroshi.plusle.script.data.Numeral;
import nk.hiroshi.plusle.script.data.Variable;

/**
 * @author Ryan Kerr
 * @since January 03, 2015
 */
public class Script implements Commander
{
	private String name; // Contains the name of the script (denoted by "::")

	private String[] script,		// Contains the "main method" of the script
					 numeralNames,  // Contains the names of all numerals
					 functionNames, // Contains all the Function Names of the script
					 variableNames; // Contains all the Variable Names of the script

	private Function[] 	  functions; // Functions owned by script
	private Variable[] 	  variables; // Variables owned by script
	private Numeral[]     numerals;  // Numerals owned by script
	private Conditional[] condition; // Conditional Statements

	/**
	 * Creates Scipt
	 * @param n The name of the script (denoted as "::Script Name" in the script)
	 * @param sc The main method of the script (any commands prior to a function)
	 * @param fn The names of all the functions
	 * @param f All functions declared in the script
	 * @param vn The names of all the variables from the script
	 * @param v All variables declared in the script
	 */
	public void makeScript(String name, String[] sc, String[] fn, Function[] f, String[] vn, Variable[] v, String[] nn, Numeral[] n, Conditional[] c)
	{
		this.name = name;
		script = sc;
		functionNames = fn;
		variableNames = vn;
		numeralNames = nn;
		condition = c;
		functions = f;
		variables = v;
		numerals  = n;
	}

	/** @returns The script name */
	public String getName(){return name;}

	/** @returns The main method */
	public String[] getRunnable(){return script;}

	/** @returns The Variable name array */
	public String[] getVariableNames(){return variableNames;}

	/** @returns The Function name array*/
	public String[] getFunctionNames(){return functionNames;}

	/** @returns The Numeral name array*/
	public String[] getNumeralNames(){return numeralNames;}

	/** @returns All the variables */
	public Variable[] getVariables(){return variables;}

	/** @returns All the function owned by the script */
	public Function[] getFunctions(){return functions;}

	/** @returns All the numerals owned by the script */
	public Numeral[] getNumerals(){return numerals;}

	/**
	 * Goes through every element in an array and sees if the given value exists in the array
	 *
	 * @param v The String to find in the String array
	 * @param arr The String array to find the matching value in
	 * @return true if the value is matched to a value in the array;

	 * 	       false if the value is not matched
	 */
	private boolean isValueIn(String v, String[] arr)
	{
		for(String s : arr) if(s.equals(v)) return true;
		return false;
	}

	/**
	 * Goes through every element in an array and matches it to the given value
	 *
	 * @param v The value to find in the array
	 * @param arr The array to find the matching value in
	 * @return value equal or greater than 0 The index of the matching value in the array
	 *
	   -1 The value did not exist in the given array
	 */
	private int getIndexOf(String v, String[] arr)
	{
		for(int i = 0; i != arr.length; i++) if(v.equals(arr[i])) return i;
		return -1;
	}

	/**
	 * Gives the Object in the specified index in the given array
	 * as long as the given index is between 0 and the array length
	 *
	 * @param index The index of the Object
	 * @param t The array to get the Object from
	 * @return The Object at t[index] When the index is in a valid range

	 * 		   null When the index is outside the valid range
	 */
	private <Type> Type getValueOf(int index, Type[] t)
	{
		if(0 <= index && index < t.length) return t[index];
		return null;
	}

	/* The following lines of code check if values exist in their respective Name Arrays */
	public boolean isFunction(String fName){return isValueIn(fName, functionNames);}
	public boolean isVariable(String vName){return isValueIn(vName, variableNames);}
	public boolean isNumeral(String nName){return isValueIn(nName, numeralNames);}

	/* get Type Index gets the position of the desired element */
	public int getFunctionIndex(String fName){return getIndexOf(fName, functionNames);}
	public int getVariableIndex(String vName){return getIndexOf(vName, variableNames);}
	public int getNumeralIndex(String nName){return getIndexOf(nName, numeralNames);}

	/* Gets the element from the specified index */
	public Function getFunction(int index){return getValueOf(index, functions);}
	public Variable getVariable(int index){return getValueOf(index, variables);}
	public Numeral getNumeral(int index){return getValueOf(index, numerals);}

	public Conditional getCondition(int index){return getValueOf(index, condition);}

	/* Gets the element from the name (potential arrayOutOfBounds) */
	public Function getFunction(String fName){return getFunction(getFunctionIndex(fName));}
	public Variable getVariable(String vName){return getVariable(getVariableIndex(vName));}
	public Numeral getNumeral(String nName){return getNumeral(getNumeralIndex(nName));}

	/** Searches if the dataType exists under that name */
	public boolean isStorageData(String name)
	{
		for(String n : variableNames) if(n.equals(name)) return true;
		for(String n : numeralNames)   if(n.equals(name)) return true;
		return false;
	}

	// These have no use in Scripts
	public String getValue(){return null;}
	public Script getParent(){return null;}
	public void setValue(String value){}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Pseudographis buxicola Pass.

### Remarks
null


text:
{% extends 'rango/base.html' %}
{% load staticfiles %}

{% block title_block %}
    {{ category.name }}
{% endblock %}

{% block body_block %}
    {% if category %}

{{ category.name }}

        {% if pages %}

            {% for page in pages %}

{{ page.title }}

                {% endfor %}

        {% else %}
            No pages currently in category.
        {% endif %}

        {% if user.is_authenticated %}
        Add Page
        {% endif %}
    {% else %}
        The specified category does not exist!
    {% endif %}
{% endblock %}


text:
<?php

/*
|--------------------------------------------------------------------------
| Doctrine2l5 :: Doctrine Configuration
|--------------------------------------------------------------------------
|
| See: https://github.com/jeanbelhache/doctrine2-l5
|
| NB: Database configuration taken from Laravel5's own config/database.php
| settings. Implemented databases are: MySQL, Postgres and SQLite.
*/

return [

    // connection parameters are set in Laravael's own database config file.

    // Paths for models, proxies, repositories, etc.
    'paths' => [
        'entities'     => app()->databasePath() . '/Entities',
        'proxies'      => app()->databasePath() . '/Proxies',
        'repositories' => app()->databasePath() . '/Repositories',
        'yml'          => app()->databasePath() . '/Yml'
    ],

    // set to true to have Doctrine2 generate proxies on the fly. Not recommended in a production system.
    'autogen_proxies'       => FALSE,

    // Namespaces for entities, proxies and repositories.
    'namespaces' => [
        'entities'          => 'Entities',
        'proxies'           => 'Proxies',
        'repositories'      => 'Repositories'
    ],

    // Doctrine2 includes an implementation of Doctrine\DBAL\Logging\SQLLogger which
    // just calls the Laravel Log facade. If you wish to log your SQL queries (and execution
    // time), just set enabled in the following to true.
    'sqllogger' => [
        'enabled' => env('APP_DEBUG'),
        'level'   => 'debug'   // one of debug, info, notice, warning, error, critical, alert
    ],

    // use Doctrine2 with Laravel's authentication menchanism
    'auth' => [
        'enabled' => FALSE,
        'entity'  => '\Entities\User'   // the Doctrine2 entity representing the user
    ]
];


text:
package apple.carplay.protocol;

import apple.carplay.CPPointOfInterest;
import apple.carplay.CPPointOfInterestTemplate;
import apple.mapkit.struct.MKCoordinateRegion;
import org.moe.natj.general.ann.ByValue;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.ann.IsOptional;
import org.moe.natj.objc.ann.ObjCProtocolName;
import org.moe.natj.objc.ann.Selector;

@Generated
@Library("CarPlay")
@Runtime(ObjCRuntime.class)
@ObjCProtocolName("CPPointOfInterestTemplateDelegate")
public interface CPPointOfInterestTemplateDelegate {
    /**
     * The user has changed the map region on the @c CPPointOfInterestTemplate. Your application
     * should respond by updating @c pointsOfInterest to show new points of interest for the new region.
     */
    @Generated
    @Selector("pointOfInterestTemplate:didChangeMapRegion:")
    void pointOfInterestTemplateDidChangeMapRegion(CPPointOfInterestTemplate pointOfInterestTemplate,
            @ByValue MKCoordinateRegion region);

    /**
     * The user has selected the @c pointOfInterest and the details are being shown.
     */
    @Generated
    @IsOptional
    @Selector("pointOfInterestTemplate:didSelectPointOfInterest:")
    default void pointOfInterestTemplateDidSelectPointOfInterest(CPPointOfInterestTemplate pointOfInterestTemplate,
            CPPointOfInterest pointOfInterest) {
        throw new java.lang.UnsupportedOperationException();
    }
}


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

<title>Uses of Class hu.szabot.transloadit.exceptions.FileNotOpenableException</title>
<meta name="date" content="2014-02-07">
<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 Class
hu.szabot.transloadit.exceptions.FileNotOpenableException

Packages that use FileNotOpenableException

Package
Description

hu.szabot.transloadit.assembly

Uses of FileNotOpenableException in hu.szabot.transloadit.assembly

Methods in hu.szabot.transloadit.assembly that throw FileNotOpenableException

Modifier and Type
Method and Description

void
IAssemblyBuilder.addFile(java.io.File file)

Adds file to the current assembly

void
AssemblyBuilder.addFile(java.io.File file)

void
IAssemblyBuilder.addFile(java.lang.String key,
       java.io.File file)

Adds file to the current assembly with specific key

void
AssemblyBuilder.addFile(java.lang.String key,
       java.io.File file)

protected void
AssemblyBuilder.fileCheck(java.io.File file)

Validates the passed key

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
package rpc

import (
	"fmt"
	"github.com/golang/glog"
	"github.com/nebulaim/telegramd/baselib/grpc_util"
	"github.com/nebulaim/telegramd/baselib/logger"
	"github.com/nebulaim/telegramd/proto/mtproto"
	"golang.org/x/net/context"
)

// messages.setEncryptedTyping#791451ed peer:InputEncryptedChat typing:Bool = Bool;
func (s *MessagesServiceImpl) MessagesSetEncryptedTyping(ctx context.Context, request *mtproto.TLMessagesSetEncryptedTyping) (*mtproto.Bool, error) {
	md := grpc_util.RpcMetadataFromIncoming(ctx)
	glog.Infof("MessagesSetEncryptedTyping - metadata: %s, request: %s", logger.JsonDebugData(md), logger.JsonDebugData(request))

	// TODO(@benqi): Impl MessagesSetEncryptedTyping logic

	return nil, fmt.Errorf("Not impl MessagesSetEncryptedTyping")
}


text:
package com.google.template.soy.jssrc.dsl;

import com.google.common.collect.ImmutableList;
import java.util.function.Consumer;

/** Represents a TS generic type, for use with eg `new` statements. */
public class GenericType extends AbstractType {

  private final Expression className;
  private final ImmutableList<Expression> generics;

  GenericType(Expression className, ImmutableList<Expression> generics) {
    this.className = className;
    this.generics = generics;
  }

  @Override
  void doFormatOutputExpr(FormattingContext ctx) {
    ctx.appendOutputExpression(className);
    ctx.append("<");
    for (int i = 0; i < generics.size(); i++) {
      ctx.appendOutputExpression(generics.get(i));
      if (i < generics.size() - 1) {
        ctx.append(", ");
      }
    }
    ctx.append(">");
  }

  @Override
  public void collectRequires(Consumer<GoogRequire> collector) {
    className.collectRequires(collector);
    for (Expression generic : generics) {
      generic.collectRequires(collector);
    }
  }
}


text:
<!DOCTYPE html>

<meta charset="utf-8">

  Committer Name
  <input type="text" name="name" value="" />

  Committer Email
  <input type="email" name="email" value="" />

  Username
  <input type="text" name="username" value="" />

  Password
  <input type="password" name="password" value="" />

  Database Repo
  <input type="text" name="repo" value="" />

  Database Branch
  <input type="text" name="branch" value="" />

  <button onClick="updateConfig('#config');">Config</button>

<button onClick="execute(store, '#db');">execute</button>


text:
package sun.nio.ch;

import java.io.*;

class FileDispatcherImpl extends FileDispatcher
{

    static {
        IOUtil.load();
        init();
    }

    FileDispatcherImpl(boolean append) {
        /* append is ignored */
    }

    FileDispatcherImpl() {
    }

    int read(FileDescriptor fd, long address, int len) throws IOException {
        return read0(fd, address, len);
    }

    int pread(FileDescriptor fd, long address, int len, long position)
        throws IOException
    {
        return pread0(fd, address, len, position);
    }

    long readv(FileDescriptor fd, long address, int len) throws IOException {
        return readv0(fd, address, len);
    }

    int write(FileDescriptor fd, long address, int len) throws IOException {
        return write0(fd, address, len);
    }

    int pwrite(FileDescriptor fd, long address, int len, long position)
        throws IOException
    {
        return pwrite0(fd, address, len, position);
    }

    long writev(FileDescriptor fd, long address, int len)
        throws IOException
    {
        return writev0(fd, address, len);
    }

    int force(FileDescriptor fd, boolean metaData) throws IOException {
        return force0(fd, metaData);
    }

    int truncate(FileDescriptor fd, long size) throws IOException {
        return truncate0(fd, size);
    }

    long size(FileDescriptor fd) throws IOException {
        return size0(fd);
    }

    int lock(FileDescriptor fd, boolean blocking, long pos, long size,
             boolean shared) throws IOException
    {
        return lock0(fd, blocking, pos, size, shared);
    }

    void release(FileDescriptor fd, long pos, long size) throws IOException {
        release0(fd, pos, size);
    }

    void close(FileDescriptor fd) throws IOException {
        close0(fd);
    }

    void preClose(FileDescriptor fd) throws IOException {
        preClose0(fd);
    }

    FileDescriptor duplicateForMapping(FileDescriptor fd) {
        // file descriptor not required for mapping operations; okay
        // to return invalid file descriptor.
        return new FileDescriptor();
    }

    // -- Native methods --

    static native int read0(FileDescriptor fd, long address, int len)
        throws IOException;

    static native int pread0(FileDescriptor fd, long address, int len,
                             long position) throws IOException;

    static native long readv0(FileDescriptor fd, long address, int len)
        throws IOException;

    static native int write0(FileDescriptor fd, long address, int len)
        throws IOException;

    static native int pwrite0(FileDescriptor fd, long address, int len,
                             long position) throws IOException;

    static native long writev0(FileDescriptor fd, long address, int len)
        throws IOException;

    static native int force0(FileDescriptor fd, boolean metaData)
        throws IOException;

    static native int truncate0(FileDescriptor fd, long size)
        throws IOException;

    static native long size0(FileDescriptor fd) throws IOException;

    static native int lock0(FileDescriptor fd, boolean blocking, long pos,
                            long size, boolean shared) throws IOException;

    static native void release0(FileDescriptor fd, long pos, long size)
        throws IOException;

    static native void close0(FileDescriptor fd) throws IOException;

    static native void preClose0(FileDescriptor fd) throws IOException;

    static native void closeIntFD(int fd) throws IOException;

    static native void init();

}


text:
package themes_test

import (
	"errors"
	"net/http"
	"net/http/httptest"
	"os"
	"path"

	"github.com/aubm/postmanerator/configuration"
	. "github.com/aubm/postmanerator/themes"
	"github.com/aubm/postmanerator/utils"
	. "github.com/aubm/postmanerator/utils/mocks"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	uuid "github.com/satori/go.uuid"
	"github.com/stretchr/testify/mock"
)

const any = mock.Anything

var _ = Describe("Manager", func() {

	var (
		themesRepositoryServer            *httptest.Server
		themesRepositoryGeneratedRequests []*http.Request
		nbFailedRequests                  int
		nbRequests                        int
		createdTmpThemesDirectory         string
		usedConfig                        *configuration.Configuration
		mockCloner                        *MockGitAgent
		manager                           *Manager
	)

	BeforeEach(func() {
		nbFailedRequests = 0
		nbRequests = 0
		themesRepositoryGeneratedRequests = nil
		themesRepositoryServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			nbRequests++
			themesRepositoryGeneratedRequests = append(themesRepositoryGeneratedRequests, r)
			if nbRequests > nbFailedRequests {
				http.ServeFile(w, r, "tests_data/themes_list.txt")
			} else {
				w.WriteHeader(http.StatusInternalServerError)
			}
		}))
	})

	BeforeEach(func() {
		usedConfig = &configuration.Configuration{ThemesRepository: themesRepositoryServer.URL}
		mockCloner = &MockGitAgent{}
		manager = &Manager{
			Config: usedConfig,
			Cloner: mockCloner,
		}
	})

	BeforeEach(func() {
		createdTmpThemesDirectory = path.Join(os.TempDir(), uuid.NewV4().String())
		usedConfig.ThemesDirectory = createdTmpThemesDirectory
		must(os.Mkdir(createdTmpThemesDirectory, 0777))
	})

	AfterEach(func() {
		must(os.RemoveAll(createdTmpThemesDirectory))
	})

	Describe("Delete", func() {

		var (
			themeToDelete = "my-theme"
			themePath     string
			returnedError error
		)

		JustBeforeEach(func() {
			returnedError = manager.Delete(themeToDelete)
		})

		BeforeEach(func() {
			themePath = path.Join(usedConfig.ThemesDirectory, themeToDelete)
		})

		Context("when everything is ok", func() {

			BeforeEach(func() {
				must(os.Mkdir(themePath, 0777))
			})

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

			It("should delete the theme directory", func() {
				Expect(themePath).NotTo(BeADirectory())
			})

		})

		Context("when the theme directory does not exist", func() {

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

		})

	})

	Describe("List", func() {

		var (
			returnedThemeList []string
			returnedError     error
		)

		JustBeforeEach(func() {
			returnedThemeList, returnedError = manager.List()
		})

		Context("when everything is ok", func() {

			var expectedThemeList = []string{"bar", "default", "foo"}

			BeforeEach(func() {
				for _, themeName := range expectedThemeList {
					themePathToCreate := path.Join(usedConfig.ThemesDirectory, themeName)
					must(os.Mkdir(themePathToCreate, 0777))
				}
			})

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

			It("should return the right theme list", func() {
				Expect(returnedThemeList).To(Equal(expectedThemeList))
			})

		})

		Context("when the themes directory does not exist", func() {

			BeforeEach(func() {
				usedConfig.ThemesDirectory = path.Join(usedConfig.ThemesDirectory, "non_existing_dir")
			})

			It("should return an error", func() {
				Expect(returnedError).NotTo(BeNil())
				Expect(returnedError.Error()).To(ContainSubstring("There was an error while reading the themes directory:"))
			})

			It("should not return a list of themes", func() {
				Expect(returnedThemeList).To(BeZero())
			})

		})

	})

	Describe("Download", func() {

		var (
			themeToDownload    string
			returnedError      error
			cloneErrorToReturn error
		)

		JustBeforeEach(func() {
			mockCloner.On("Clone", any, any).Return(cloneErrorToReturn)
			returnedError = manager.Download(themeToDownload)
		})

		BeforeEach(func() {
			themeToDownload = ""
			cloneErrorToReturn = nil
		})

		Context("when the theme is a valid http git url", func() {

			BeforeEach(func() {
				themeToDownload = "http://foo.git/bar.git"
			})

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

			It("should clone with the right parameters", func() {
				Expect(len(mockCloner.Calls)).To(Equal(1))
				args := mockCloner.Calls[0].Arguments
				Expect(args.Get(0)).To(Equal([]string{"http://foo.git/bar.git"}))
				Expect(args.Get(1)).To(Equal(utils.CloneOptions{TargetDirectory: usedConfig.ThemesDirectory}))
			})

		})

		Context("when the theme is a valid git url", func() {

			BeforeEach(func() {
				themeToDownload = "git@foo.git/bar"
			})

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

			It("should clone with the right parameters", func() {
				Expect(len(mockCloner.Calls)).To(Equal(1))
				args := mockCloner.Calls[0].Arguments
				Expect(args.Get(0)).To(Equal([]string{"git@foo.git/bar"}))
				Expect(args.Get(1)).To(Equal(utils.CloneOptions{TargetDirectory: usedConfig.ThemesDirectory}))
			})

		})

		Context("when the user provides a custom local name for the name", func() {

			BeforeEach(func() {
				themeToDownload = "git@foo.git/bar"
				manager.Config.ThemeLocalName = "my-custom-name"
			})

			It("should not return an error", func() {
				Expect(returnedError).To(BeNil())
			})

			It("should clone with the right parameters", func() {
				Expect(len(mockCloner.Calls)).To(Equal(1))
				args := mockCloner.Calls[0].Arguments
				Expect(args.Get(0)).To(Equal([]string{"git@foo.git/bar", "my-custom-name"}))
				Expect(args.Get(1)).To(Equal(utils.CloneOptions{TargetDirectory: usedConfig.ThemesDirectory}))
			})

		})

		Context("when the clone fails", func() {

			BeforeEach(func() {
				themeToDownload = "git@foo.git/bar"
				cloneErrorToReturn = errors.New("something bad happened!")
			})

			It("should return an error", func() {
				Expect(returnedError).NotTo(BeNil())
				Expect(returnedError.Error()).To(Equal("something bad happened!"))
			})

		})

		Context("when the theme is not a git url", func() {

			BeforeEach(func() {
				themeToDownload = "default"
			})

			Context("and everything is ok", func() {

				It("should not return an error", func() {
					Expect(returnedError).To(BeNil())
				})

				It("should generate one request to themes repository", func() {
					Expect(len(themesRepositoryGeneratedRequests)).To(Equal(1))
					Expect(themesRepositoryGeneratedRequests[0].Method).To(Equal(http.MethodGet))
				})

				It("should clone the repository with the default local name", func() {
					Expect(len(mockCloner.Calls)).To(Equal(1))
					args := mockCloner.Calls[0].Arguments
					Expect(args.Get(0)).To(Equal([]string{"https://github.com/aubm/postmanerator-default-theme.git", "default"}))
					Expect(args.Get(1)).To(Equal(utils.CloneOptions{TargetDirectory: usedConfig.ThemesDirectory}))
				})

			})

			Context("and the themes repository request fails two times and finally succeeds on third attempt", func() {

				BeforeEach(func() {
					nbFailedRequests = 2
				})

				It("should not return an error", func() {
					Expect(returnedError).To(BeNil())
				})

				It("should generate three request to themes repository", func() {
					Expect(len(themesRepositoryGeneratedRequests)).To(Equal(3))
				})

				It("should clone the repository with the default local name", func() {
					Expect(len(mockCloner.Calls)).To(Equal(1))
					args := mockCloner.Calls[0].Arguments
					Expect(args.Get(0)).To(Equal([]string{"https://github.com/aubm/postmanerator-default-theme.git", "default"}))
					Expect(args.Get(1)).To(Equal(utils.CloneOptions{TargetDirectory: usedConfig.ThemesDirectory}))
				})

			})

			Context("and the themes repository keeps responding with 500", func() {

				BeforeEach(func() {
					nbFailedRequests = 3
				})

				It("should return an error", func() {
					Expect(returnedError).NotTo(BeNil())
					Expect(returnedError.Error()).To(Equal("failed to download the theme list: themes repository responded with status 500"))
				})

				It("should generate three request to themes repository", func() {
					Expect(len(themesRepositoryGeneratedRequests)).To(Equal(3))
				})

				It("should not clone anything", func() {
					Expect(len(mockCloner.Calls)).To(Equal(0))
				})

			})

			Context("when the themes repository is down", func() {

				BeforeEach(func() {
					themesRepositoryServer.Close()
				})

				It("should return an error", func() {
					Expect(returnedError).NotTo(BeNil())
					Expect(returnedError.Error()).To(ContainSubstring("failed to download the theme list:"))
				})

				It("should not clone anything", func() {
					Expect(len(mockCloner.Calls)).To(Equal(0))
				})

			})

			Context("when the theme is not referenced", func() {

				BeforeEach(func() {
					themeToDownload = "some-unreferenced-theme"
				})

				It("should return an error", func() {
					Expect(returnedError).NotTo(BeNil())
					Expect(returnedError.Error()).To(Equal("Theme not found"))
				})

				It("should generate one request to themes repository", func() {
					Expect(len(themesRepositoryGeneratedRequests)).To(Equal(1))
				})

				It("should not clone anything", func() {
					Expect(len(mockCloner.Calls)).To(Equal(0))
				})

			})

		})

	})

	Describe("Open", func() {

		var (
			themeToOpen   string
			returnedTheme *Theme
			returnedError error
		)

		JustBeforeEach(func() {
			returnedTheme, returnedError = manager.Open(themeToOpen)
		})

		BeforeEach(func() {
			themeToOpen = ""
			returnedTheme = nil
			returnedError = nil
		})

		BeforeEach(func() {
			must(os.Mkdir(path.Join(createdTmpThemesDirectory, "default"), 0777))
			must(os.Create(path.Join(createdTmpThemesDirectory, "default", "index.tpl")))
			must(os.Create(path.Join(createdTmpThemesDirectory, "default", "menu.tpl")))
			must(os.Create(path.Join(createdTmpThemesDirectory, "default", "theme.css")))
			must(os.Create(path.Join(createdTmpThemesDirectory, "invalid-theme")))
		})

		Context("when the theme exist", func() {

			AfterEach(func() {
				Expect(returnedError).To(BeNil())
			})

			Context("given just the theme name", func() {

				BeforeEach(func() {
					themeToOpen = "default"
				})

				It("should return the right theme", func() {
					Expect(returnedTheme).To(Equal(&Theme{
						Name: "default",
						Path: path.Join(createdTmpThemesDirectory, "default"),
						Files: []string{
							path.Join(createdTmpThemesDirectory, "default", "index.tpl"),
							path.Join(createdTmpThemesDirectory, "default", "menu.tpl"),
							path.Join(createdTmpThemesDirectory, "default", "theme.css"),
						},
					}))
				})

			})

			Context("given the full theme path", func() {

				BeforeEach(func() {
					themeToOpen = path.Join(createdTmpThemesDirectory, "default")
				})

				It("should return the right theme", func() {
					Expect(returnedTheme).To(Equal(&Theme{
						Name: path.Join(createdTmpThemesDirectory, "default"),
						Path: path.Join(createdTmpThemesDirectory, "default"),
						Files: []string{
							path.Join(createdTmpThemesDirectory, "default", "index.tpl"),
							path.Join(createdTmpThemesDirectory, "default", "menu.tpl"),
							path.Join(createdTmpThemesDirectory, "default", "theme.css"),
						},
					}))
				})

			})

		})

		Context("when the theme does not exist", func() {

			BeforeEach(func() {
				themeToOpen = "theme-that-does-not-exist"
			})

			It("should return an error", func() {
				Expect(returnedError).NotTo(BeNil())
				Expect(returnedError.Error()).To(Equal("Theme not found"))
			})

			It("should not return a theme", func() {
				Expect(returnedTheme).To(BeNil())
			})

		})

		Context("when listing the theme files fails", func() {

			BeforeEach(func() {
				themeToOpen = "invalid-theme"
			})

			It("should return an error", func() {
				Expect(returnedError).NotTo(BeNil())
				Expect(returnedError.Error()).To(ContainSubstring("Failed to read theme directory:"))
			})

			It("should not return a theme", func() {
				Expect(returnedTheme).To(BeNil())
			})

		})

	})

})