text:
# Apache Tajo 0.2.0-incubating Release Documentation
* Last Updated Date: 2013.11.21

## Table of Contents
* [What is Apache Tajo?](#WhatIsApacheTajo)
* [Tutorial - Getting Started](#GettingStarted)
    * [Prerequisite](#Prerequisite)
    * [Download](#Download)
          * [Binary Download](#BinaryDownload)
          * [Source Download](#SourceDownload)
    * [Installation](#Installation)
        * [Unpack tarball](#UnpackTarball)
        * [Setup a Tajo Cluster](#SetupATajoCluster)
        * [Launch a Tajo Cluster](#LaunchATajoCluster)
    * [First Query Execution](#FirstQueryExecution)
    * [Distributed mode on HDFS cluster](#DistributedMode)
* [Configuration](#Configuration)
    * [Preliminary](#Preliminary)
        * [catalog-site.xml and tajo-site.xml](#catalog-site_and_tajo-site)
    * [TajoMaster Configuration](#TajoMasterConfiguration)
        * [Tajo Rootdir Setting](#TajoRootDir)
        * [TajoMaster Heap Memory Size](#TajoMasterHeap)
    * [Tajo Worker Configuration](#TajoWorkerConfiguration)
        * [TajoMaster Heap Memory Size](#TajoMasterHeap)
        * [Temporary Data Directory](#TemporaryDataDir)
        * [Maximum number of parallel running tasks for each worker](#MaximumParallelRunningTasks)
    * [Catalog Configuration](#CatalogConfiguration)
    * [RPC/Http Service Configuration and Default Addresses](#DefaultPorts)
        * [Tajo Master](#TajoMasterDefaultPorts)
        * [Worker](#TajoWorkerDefaultPorts)
* [Command Line Interface (tsql)](#CommandLineInterface)
    * [Entering tsql shell](#EnteringTsql)
    * [Meta Commands](#MetaCommands)
    * [Examples](#CLI_Examples)
* [Data Model](#DataModel)
    * [Data Types](#DataTypes)
        * [Using real number value](#UsingRealNumberValue)
* [SQL Language](#SQLLanguage)
    * [Data Definition Language (DDL)](#DDL)
        * [CREATE TABLE](#CreateTable)
        * [Compression](#DDLCompression)
    * [Data Manipulation Language (DML)](#DML)
        * [SQL Expressions](#SQLExpressions)
            * [Arithmetic Expressions](#ArithmeticExpressions)
            * [Type Casts](#TypeCasts)
            * [String Expressions](#StringExpressions)
            * [Function Call](#FunctionCall)
        * [SELECT](#Select)
        * [WHERE](#Where)
            * [IN Predicate](#InPredicate)
            * [String Pattern Matching Predicates](#StringPatternMatching) (LIKE, ILIKE, SIMILAR TO, REGULAR EXPRESSIONS)
        * [INSERT (OVERWRITE) INTO](#InsertOverwrite)
    * [Functions](#Functions)
        * [Standard Functions](#StandardFunctions)
        * [String Functions](#StringFunctions)
* [Administration](#Administration)
    * [Catalog Backup](#CatalogBackup)
        * [SQL dump](#SQLDump)
        * [Database-level Backup](#DatabaseLevelBackup)

#  What is Apache Tajo?
Tajo is _**a big daga warehouse system on Hadoop**_ that provides low-latency and scalable ad-hoc queries and ETL on large-data sets stored on HDFS and other data sources.

# Tutorial - Getting Started

## Prerequisite

 * Hadoop 2.0.3-alpha or 2.0.5-alpha
 * Java 1.6 or higher
 * Protocol buffer 2.4.1

## Download

### Binary Download

Download the source code from http://tajo.apache.org/downloads.html.

### Source Download

Download the source code and build Tajo as follows:

```
$ git clone https://git-wip-us.apache.org/repos/asf/tajo.git tajo
```

## Build Source Code

You can compile source code and get a binary archive as follows:

```
$ cd tajo
$ mvn clean package -DskipTests -Pdist -Dtar
$ ls tajo-dist/target/tajo-x.y.z-SNAPSHOT.tar.gz
```

## Installation

### Unpack tarball
You should unpack the tarball (refer to build instruction).

```
$ tar xzvf tajo-0.2.0-SNAPSHOT.tar.gz
```

This will result in the creation of subdirectory named tajo-x.y.z-SNAPSHOT. You MUST copy this directory into the same directory on all cluster nodes.

### Setup a Tajo cluster
First of all, you need to add the environment variables to conf/tajo-env.sh.

```sh
# Hadoop home. Required
export HADOOP_HOME= ...

# The java implementation to use.  Required.
export JAVA_HOME= ...
```

## Launch a Tajo cluster
To launch the tajo master, execute start-tajo.sh.

```
$ $TAJO_HOME/bin/start-tajo.sh
```

After then, you can use tajo-cli to access the command line interface of Tajo. If you want to how to use tsql, read Tajo Interactive Shell document.

```
$ $TAJO_HOME/bin/tsql
```

If you type \? on tsql, you can see help documentation.

## First Query Execution
First of all, we need to prepare some data for query execution. For example, you can make a simple text-based table as follows:

```
$ mkdir /home/x/table1
$ cd /home/x/table1
$ cat > data.csv
1|abc|1.1|a
2|def|2.3|b
3|ghi|3.4|c
4|jkl|4.5|d
5|mno|5.6|e
<CTRL + D>
```

This schema of this table is (int, text, float, text).

```
$ $TAJO_HOME/bin/tsql

tajo> create external table table1 (id int, name text, score float, type text) using csv with ('csvfile.delimiter'='|') location 'file:/home/x/table1';
```

In order to load an external table, you need to use 'create external table' statement.  If the table resides in HDFS, you should use 'hdfs' instead of 'file'.

If you want to know DDL statements in more detail, please see Query Language.

```
tajo> \d
table1
```

'\d' command shows the list of tables.

```
tajo> \d table1

table name: table1
table path: file:/home/x/table1
store type: CSV
number of rows: 0
volume (bytes): 78 B
schema:
id      INT
name    TEXT
score   FLOAT
type    TEXT
```
'\d [table name]' command shows the description of a given table.

Also, you can execute SQL queries as follows:

```
tajo> select * from table1 where id > 2;
final state: QUERY_SUCCEEDED, init time: 0.069 sec, response time: 0.397 sec
result: file:/tmp/tajo-hadoop/staging/q_1363768615503_0001_000001/RESULT, 3 rows ( 35B)

id,  name,  score,  type
- - - - - - - - - -  - - -
3,  ghi,  3.4,  c
4,  jkl,  4.5,  d
5,  mno,  5.6,  e

tajo>
```

## Distributed mode on HDFS cluster
Add the following configs to tajo-site.xml file.

```
  <property>
    <name>tajo.rootdir</name>
    <value>hdfs://hostname:port/tajo</value>
  </property>

  <property>
    <name>tajo.master.umbilical-rpc.address</name>
    <value>hostname:26001</value>
  </property>

  <property>
    <name>tajo.catalog.client-rpc.address</name>
    <value>hostname:26005</value>
  </property>
```

If you want to know Tajo's configuration in more detail, see Configuration page.

Before launching the tajo, you should create the tajo root dir and set the permission as follows:

```
$ $HADOOP_HOME/bin/hadoop fs -mkdir       /tajo
$ $HADOOP_HOME/bin/hadoop fs -chmod g+w   /tajo
```

Then, execute start-tajo.sh

```
$ $TAJO_HOME/bin/start-tajo.sh
```

Enjoy Apache Tajo!

# Configuration
## Preliminary
### catalog-site.xml and tajo-site.xml
Tajo's configuration is based on Hadoop's configuration system. Tajo uses two config files:

* catalog-site.xml - configuration for the catalog server.
* tajo-site.xml - configuration for other tajo modules.

Each config consists of a pair of a name and a value. If you want to set the config name a.b.c with the value 123, add the following element to an appropriate file.

```xml
  <property>
    <name>a.b.c</name>
    <value>123</value>
  </property>
```

Tajo has a variety of internal configs. If you don't set some config explicitly, the default config will be used for for that config. Tajo is designed to use only a few of configs in usual cases. You may not be concerned with the configuration.

In default, there is no tajo-site.xml in ${TAJO}/conf directory. If you set some configs, first copy $TAJO_HOME/conf/tajo-site.xml.templete to tajo-site.xml. Then, add the configs to your tajo-site.

### tajo-env.sh

tajo-env.sh is a shell script file. The main purpose of this file is to set shell environment variables for TajoMaster and TajoWorker java program. So, you can set some variable as follows:

```
VARIABLE=value
```

If a value is a literal string, type this as follows:

```
VARIABLE='value'
```

### TajoMaster Configuration

#### Tajo Rootdir Setting

Tajo uses HDFS as a primary storage layer. So, one Tajo cluster instance should have one tajo rootdir. A user is allowed to specific your tajo rootdir as follows:

```
  <property>
    <name>tajo.rootdir</name>
    <value>hdfs://namenode_hostname:port/path</value>
  </property>
```

Tajo rootdir must be a url form like ```scheme://hostname:port/path```. The current implementaion only supports ```hdfs://``` and ```file://``` schemes. The default value is ```file:///tmp/tajo-${user.name}/```.

#### TajoMaster Heap Memory Size

The environment variable TAJO_MASTER_HEAPSIZE in conf/tajo-env.sh allow Tajo Master to use the specified heap memory size.

If you want to adjust heap memory size, set TAJO_MASTER_HEAPSIZE variable in conf/tajo-env.sh with a proper size as follows:

```
TAJO_MASTER_HEAPSIZE=2000
```

The default size is 1000 (1GB).

## Tajo Worker Configuration

### Worker Heap Memory Size
The environment variable TAJO_WORKER_HEAPSIZE in conf/tajo-env.sh allow Tajo Worker to use the specified heap memory size.

If you want to adjust heap memory size, set TAJO_WORKER_HEAPSIZE variable in conf/tajo-env.sh with a proper size as follows:

```
TAJO_WORKER_HEAPSIZE=8000
```

The default size is 1000 (1GB).

### Temporary Data Directory

TajoWorker stores temporary data on local file system due to out-of-core algorithms. It is possible to specify one or more temporary data directories where temporary data will be stored.

*tajo-site.xml*

```
  <property>
    <name>tajo.worker.tmpdir.locations</name>
    <value>/disk1/tmpdir,/disk2/tmpdir,/disk3/tmpdir</value>
  </property>
```

### Maximum number of parallel running tasks for each worker

Each worker can execute multiple tasks at a time. Tajo allows users to specify the maximum number of parallel running tasks for each worker.

*tajo-site.xml*

```
  <property>
    <name>tajo.worker.parallel-execution.max-num</name>
    <value>12</value>
  </property>
```

## Catalog Configuration
If you want to customize the catalog service, copy $TAJO_HOME/conf/catalog-site.xml.templete to catalog-site.xml. Then, add the following configs to catalog-site.xml. Note that the default configs are enough to launch Tajo cluster in most cases.

* tajo.catalog.master.addr - If you want to launch a Tajo cluster in distributed mode, you must specify this address. For more detail information, see [Default Ports](#DefaultPorts).
* tajo.catalog.store.class - If you want to change the persistent storage of the catalog server, specify the class name. Its default value is tajo.catalog.store.DerbyStore. In the current version, Tajo provides three persistent storage classes as follows:
    * tajo.catalog.store.DerbyStore - this storage class uses Apache Derby.
    * tajo.catalog.store.MySQLStore - this storage class uses MySQL.
    * tajo.catalog.store.MemStore - this is the in-memory storage. It is only used in unit tests to shorten the duration of unit tests.

## RPC/Http Service Configuration and Default Addresses

### Tajo Master

| Service Name              | Config Property Name                                         |  Description | default address |
| ------------------------- | -------------------------------------------------------------| ------------ | --------------- |
| Tajo Master Umbilical Rpc | tajo.master.umbilical-rpc.address                            |              | localhost:26001 |
| Tajo Master Client Rpc    | tajo.master.client-rpc.address                               |              | localhost:26002 |
| Tajo Master Info Http     | tajo.master.info-http.address                                |              | <IP_ADDRESS>:26080   |
| Tajo Catalog Client Rpc   | tajo.catalog.client-rpc.address                              |              | localhost:26005 |

### Worker

| Service Name              | Config Property Name                                         |  Description | default address |
| ------------------------- | -------------------------------------------------------------| ------------ | --------------- |
| Tajo Worker Peer Rpc      | tajo.worker.peer-rpc.address                                 |              | <IP_ADDRESS>:28091   |
| Tajo Worker Client Rpc    | tajo.worker.client-rpc.address                               |              | <IP_ADDRESS>:28092   |
| Tajo Worker Info Http     | tajo.worker.info-http.address                                |              | <IP_ADDRESS>:28080   |

# Command Line Interface (tsql)

*Synopsis*

```
bin/tsql [options]
```

Options

 * ```-c "quoted sql"``` : Execute quoted sql statements, and then the shell will exist.

 * ```-f filename (--file filename)``` : Use the file named filename as the source of commands instead of interactive shell.

 * ```-h hostname (--host hostname)``` : Specifies the host name of the machine on which the Tajo master is running.

 * ```-p port (--port port)``` : Specifies the TCP port. If it is not set, the port will be 26002 in default.

## Entering tsql shell

If the hostname and the port num are not given, tsql will try to connect the Tajo master specified in ${TAJO_HOME}/conf/tajo-site.xml.

```
bin/tsql

tajo>
```

If you want to connect a specified TajoMaster, you should use '-h' and (or) 'p' options as follows:

```
bin/tsql -h localhost -p 9004

tajo>
```

## Meta Commands
In tsql, anything command that begins with an unquoted backslash ('\') is a tsql meta-command that is processed by tsql itself.

In the current implementation, there are meta commands as follows:

```
tajo> \?

General
  \copyright  show Apache License 2.0
  \version    show Tajo version
  \?          show help
  \q          quit tsql

Informational
  \d         list tables
  \d  NAME   describe table

Documentations
  tsql guide        http://wiki.apache.org/tajo/tsql
  Query language    http://wiki.apache.org/tajo/QueryLanguage
  Functions         http://wiki.apache.org/tajo/Functions
  Backup & restore  http://wiki.apache.org/tajo/BackupAndRestore
  Configuration     http://wiki.apache.org/tajo/Configuration
```

## Examples

If you want to list all table names, use '\d' meta command as follows:

```
tajo> \d
customer
lineitem
nation
orders
part
partsupp
region
supplier
```

Now look at the table description:

```
tajo> \d orders

table name: orders
table path: hdfs:/xxx/xxx/tpch/orders
store type: CSV
number of rows: 0
volume (bytes): 172.0 MB
schema:
o_orderkey      INT8
o_custkey       INT8
o_orderstatus   TEXT
o_totalprice    FLOAT8
o_orderdate     TEXT
o_orderpriority TEXT
o_clerk TEXT
o_shippriority  INT4
o_comment       TEXT
```

# Data Model

## Data Types

| Supported  | SQL Type Name | Alias                    | Size (byte) | Description                                    | Range                                                                    |
| ---------- | ------------- | ------------------------ | ----------- | ---------------------------------------------- | ------------------------------------------------------------------------ |
| O          | boolean       | bool                     | 1           |                                                | true/false                                                               |
|            | bit           |                          | 1           |                                                | 1/0                                                                      |
|            | varbit        | bit varying              |             |                                                |                                                                          |
| O          | smallint      | tinyint, int2            | 2           | small-range integer value                      | -2^15 (-32,768) to 2^15 (32,767)                                         |
| O          | integer       | int, int4                | 4           | integer value                                  | -2^31 (-2,147,483,648) to 2^31 - 1 (2,147,483,647)                       |
| O          | bigint        | bit varying              | 8           | larger range integer value                     | -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) |
| O          | real          | int8                     | 4           | variable-precision, inexact, real number value | -3.4028235E+38 to 3.4028235E+38 (6 decimal digits precision)             |
| O          | float[(n)]    | float4                   | 4 or 8      | variable-precision, inexact, real number value |                                                                          |
| O          | double        | float8, double precision | 8           | variable-precision, inexact, real number value | 1 .7E–308 to 1.7E+308 (15 decimal digits precision)                      |
|            | number        | decimal                  |             |                                                |                                                                          |
|            | char[(n)]     | character                |             |                                                |                                                                          |
|            | varchar[(n)]  | character varying        |             |                                                |                                                                          |
| O          | text          | text                     |             | variable-length unicode text                   |                                                                          |
|            | binary        | binary                   |             |                                                |               |
|            | varbinary[(n)]| binary varying           |             |                                                |               |
| O          | blob          | bytea                    |             | variable-length binary string                  |               |
|            | date          |                          |             |                                                |               |
|            | time          |                          |             |                                                |               |
|            | timetz        | time with time zone      |             |                                                |               |
|            | timestamp     |                          |             |                                                |               |
|            | timestamptz   |                          |             |                                                |               |
| O          | inet4         |                          | 4           | IPv4 address                                   |               |

### Using real number value (real and double)

The real and double data types are mapped to float and double of java primitives respectively. Java primitives float and double follows the IEEE 754 specification. So, these types are correctly matched to SQL standard data types.

 + float[( n )] is mapped to either float or double according to a given length n. If n is specified, it must be bewtween 1 and 53. The default value of n is 53.
  + If 1 <= n <= 24, a value is mapped to float (6 decimal digits precision).
  + If 25 <= n <= 53, a value is mapped to double (15 decimal digits precision).
 + Do not use approximate real number columns in WHERE clause in order to compare some exact matches, especially the = and <> operators. The > or < comparisons work well.

# The SQL Language

## Data Definition Language

### CREATE TABLE

*Synopsis*

```SQL
CREATE TABLE <table_name> [(<column_name> <data_type>, ... )]
  [using <storage_type> [with (<key> = <value>, ...)]] [AS <select_statement>]

CREATE EXTERNAL TABLE

CREATE EXTERNAL TABLE <table_name> (<column_name> <data_type>, ... )
  using <storage_type> [with (<key> = <value>, ...)] LOCATION '<path>'
```

#### Compression

If you want to add an external table that contains compressed data, you should give 'compression.code' parameter to CREATE TABLE statement.

```
create EXTERNAL table lineitem (
  L_ORDERKEY bigint,
  L_PARTKEY bigint,
  ...
  L_COMMENT text)

USING csv WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec')
LOCATION 'hdfs://localhost:9010/tajo/warehouse/lineitem_100_snappy';
```

'compression.codec' parameter can have one of the following compression codecs:
 * org.apache.hadoop.io.compress.BZip2Codec
 * org.apache.hadoop.io.compress.DeflateCodec
 * org.apache.hadoop.io.compress.GzipCodec
 * org.apache.hadoop.io.compress.SnappyCodec

### DROP TABLE

```
DROP TABLE <table_name>
```

## Data Manipulation Language (DML)

### SQL Expressions

#### Arithmetic Expressions

##### Type Casts
A type cast converts a specified-typed data to another-typed data. Tajo has two type cast syntax:

```
CAST ( expression AS type )
expression::type
```

##### String Expressions

(TODO)

##### Function Call

```
function_name ([expression [, expression ... ]] )
```

### SELECT

*Synopsis*

```
SELECT [distinct [all]] * | <expression> [[AS] <alias>] [, ...]
  [FROM <table name> [[AS] <table alias name>] [, ...]]
  [WHERE <condition>]
  [GROUP BY <expression> [, ...]]
  [HAVING <condition>]
  [ORDER BY <expression> [ASC|DESC] [NULL FIRST|NULL LAST] [, ...]]
```

### WHERE

#### IN Predicate

IN predicate provides row and array comparison.

*Synopsis*

```
column_reference IN (val1, val2, ..., valN)
column_reference NOT IN (val1, val2, ..., valN)
```

Examples are as follows:

```
-- this statement filters lists down all the records where col1 value is 1, 2 or 3:
SELECT col1, col2 FROM table1 WHERE col1 IN (1, 2, 3);

-- this statement filters lists down all the records where col1 value is neither 1, 2 nor 3:
SELECT col1, col2 FROM table1 WHERE col1 NOT IN (1, 2, 3);
```

You can use 'IN clause' on text data domain as follows:

```
SELECT col1, col2 FROM table1 WHERE col2 IN ('tajo', 'hadoop');

SELECT col1, col2 FROM table1 WHERE col2 NOT IN ('tajo', 'hadoop');
```

#### String Pattern Matching Predicates

##### LIKE

LIKE operator returns true or false depending on whether its pattern matches the given string. An underscore (_) in pattern matches any single character. A percent sign (%) matches any sequence of zero or more characters.

*Synopsis*

```
string LIKE pattern
string NOT LIKE pattern
```

##### ILIKE

ILIKE is the same to LIKE, but it is a case insensitive operator. It is not in the SQL standard. We borrow this operator from PostgreSQL.

*Synopsis*

```
string ILIKE pattern
string NOT ILIKE pattern
```

##### SIMILAR TO

*Synopsis*

```
string SIMILAR TO pattern
string NOT SIMILAR TO pattern
```

It returns true or false depending on whether its pattern matches the given string. Also like LIKE, 'SIMILAR TO' uses '_' and '%' as metacharacters denoting any single character and any string, respectively.

In addition to these metacharacters borrowed from LIKE, 'SIMILAR TO' supports more powerful pattern-matching metacharacters borrowed from regular expressions:

| metacharacter          | description                                                 |
| ---------------------- | ----------------------------------------------------------- |
| |                 | denotes alternation (either of two alternatives).           |
| *                      | denotes repetition of the previous item zero or more times. |
| +                      | denotes repetition of the previous item one or more times.  |
| ?                      | denotes repetition of the previous item zero or one time.   |
| {m}                    | denotes repetition of the previous item exactly m times.    |
| {m,}                   | denotes repetition of the previous item m or more times.    |
| {m,n}                  | denotes repetition of the previous item at least m and not more than n times. |
| []                     | A bracket expression specifies a character class, just as in POSIX regular expressions. |
| ()                     | Parentheses can be used to group items into a single logical item. |

Note that '.' is not used as a metacharacter in 'SIMILAR TO' operator.

##### Regular expressions

Regular expressions provide a very powerful means for string pattern matching. In the current Tajo, regular expressions are based on Java-style regular expressions instead of POSIX regular expression. The main difference between java-style one and POSIX's one is character class.

*Synopsis*

```
string ~ pattern
string !~ pattern

string ~* pattern
string !~* pattern
```

| operator | Description                                                 |
| ---------| ----------------------------------------------------------- |
| ~        | It returns true if a given regular expression is matched to string. Otherwise, it returns false. |
| !~       | It returns false if a given regular expression is matched to string. Otherwise, it returns true. |
| ~*       | It is the same to '~', but it is case insensitive.  |
| !~*      | It is the same to '!~', but it is case insensitive. |

Here are examples:

```
'abc'   ~   '.*c'               true
'abc'   ~   'c'                 false
'aaabc' ~   '([a-z]){3}bc       true
'abc'   ~*  '.*C'               true
'abc'   !~* 'B.*'               true
```

Regular expressions operator is not in the SQL standard. We borrow this operator from PostgreSQL.

*Synopsis for REGEXP and RLIKE operators*

```
string REGEXP pattern
string NOT REGEXP pattern

string RLIKE pattern
string NOT RLIKE pattern
```

But, they do not support case-insensitive operators.

### INSERT (OVERWRITE) INTO

INSERT OVERWRITE statement overwrites a table data of an existing table or a data in a given directory. Tajo's INSERT OVERWRITE statement follows 'INSERT INTO SELECT' statement of SQL. The examples are as follows:

```
create table t1 (col1 int8, col2 int4, col3 float8);

-- when a target table schema and output schema are equivalent to each other
INSERT OVERWRITE INTO t1 SELECT l_orderkey, l_partkey, l_quantity FROM lineitem;
-- or
INSERT OVERWRITE INTO t1 SELECT * FROM lineitem;

-- when the output schema are smaller than the target table schema
INSERT OVERWRITE INTO t1 SELECT l_orderkey FROM lineitem;

-- when you want to specify certain target columns
INSERT OVERWRITE INTO t1 (col1, col3) SELECT l_orderkey, l_quantity FROM lineitem;
```

In addition, INSERT OVERWRITE statement overwrites table data as well as a specific directory.

```
INSERT OVERWRITE INTO LOCATION '/dir/subdir' SELECT l_orderkey, l_quantity FROM lineitem;
```

## Functions

### Standard Functions

| function definition         | return type       | description         | example                 | result        |
| --------------------------- | ----------------- | ------------------- | ----------------------- | ------------- |
| count(*)                    | int8              |                     |                         |               |
| count(expr)                 | int8              |                     |                         |               |
| avg(expr)                   | depending on expr |                     |                         |               |
| sum(expr)                   | depending on expr |                     |                         |               |
| min(expr)                   | depending on expr |                     |                         |               |
| max(expr)                   | depending on expr |                     |                         |               |

### String Operator and Functions

| function definition         | return type   | description         | example                 | result        |
| --------------------------- | ------------- | ------------------- | ----------------------- | ------------- |
| string || string  | text          | string concatenate  | 'Ta' || 'jo'  | Tajo          |
| char_length(string text) or character_length(string text) | int | Number of characters in string | char_length('Tajo') | 4 |
| trim([leading | trailing | both] [characters] from string)| text | Remove the characters (a space by default) from the start/end/both ends of the string| trim(both 'x' from 'xTajoxx') | Tajo |
| btrim(string text [, characters text]) | text | Remove the characters (a space by default) from the both ends of the string | trim('xTajoxx', 'x') | Tajo |
| ltrim(string text [, characters text]) | text | Remove the characters (a space by default) from the start ends of the string | ltrim('xxTajo', 'x') | Tajo |
| rtrim(string text [, characters text]) | text | Remove the characters (a space by default) from the end ends of the string | rtrim('Tajoxx', 'x') | Tajo |
| split_part(string text, delimiter text, field int) | text | Split a string on delimiter and return the given field (counting from one) |  split_part('ab_bc_cd','_',2) | bc |
| regexp_replace(string text, pattern text, replacement text) | text | Replace substrings matched to a given regular expression pattern |regexp_replace('abcdef', '(ˆab|ef$)', '--') | --cd-- |
| upper(string text) | text | makes an input text to be upper case | upper('tajo') | TAJO |
| lower(string text) | text | makes an input text to be lower case | lower('TAJO') | tajo |

# Administration

## Catalog Backup and Restore

Now, Tajo supports a two backup methods for

* SQL dump
* Database-level backup

### SQL dump

SQL dump is an easy and strong way. If you use this approach, you don't need to concern database-level compatibilities. If you want to backup your catalog, just use bin/tajo_dump command. The basic usage of this command is:

```
$ tajo_dump table_name > outfile
```

For example, if you want to backup a table customer, you should type a command as follows:

```
$ bin/tajo_dump customer > table_backup.sql
$
$ cat table_backup.sql
-- Tajo database dump
-- Dump date: 10/04/2013 16:28:03
--

--
-- Name: customer; Type: TABLE; Storage: CSV
-- Path: file:/home/hyunsik/tpch/customer
--
CREATE EXTERNAL TABLE customer (c_custkey INT8, c_name TEXT, c_address TEXT, c_nationkey INT8, c_phone TEXT, c_acctbal FLOAT8, c_mktsegment TEXT, c_comment TEXT) USING CSV LOCATION 'file:/home/hyunsik/tpch/customer';
```

If you want to restore the catalog from the SQL dump file, please type the below command:

```
$ bin/tsql -f table_backup.sql
```

If you use an option '-a', tajo_dump will dump all table DDLs.

```
$ bin/tajo_dump -a > all_backup.sql
```

### Database-level backup

(TODO)

repository: gruter/tajo-elasticsearch

gha_language: Java

repo_name: gruter/tajo-elasticsearch


text:
# ImageProcessMFC
A sample program for image processing in Visual Studio 2017

Scrennshot1: Open a color image file.

![Screenshot:Open a color image](assets/S1.OpenImg.png)

Screenshot2: Convert the color image into gray level image.

![Screenshot:Convert to gray image](assets/S2.ConvertGray.png)

Screenshot3: Detect the edges on the image.

![Screenshot:Detect the edage](assets/S3.EdgeDetect.png)

license: MIT

repository: Mirochiu/ImageProcessMFC

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: Mirochiu/ImageProcessMFC


text:
# Coding

## Tools

* [Etsy Hound](https://github.com/etsy/hound) Lightning fast code searching made easy
* [Google CodeSearch](https://github.com/google/codesearch)
* [sharkdp/fd](https://github.com/sharkdp/fd) A simple, fast and user-friendly alternative to 'find'
* [ruben2020/codequery]() A code-understanding, code-browsing or code-search tool.

## IDEs

- eclipse CDT
- source insight
- vs community
- qt creator
- xcode

## Refs

- [Going Beyond grep for Searching Source Code](https://blog.newrelic.com/2015/01/28/grep-ack-ag/)
- [Regular Expression Matching with a Trigram Index or How Google Code Search Worked](https://swtch.com/~rsc/regexp/regexp4.html)

license: Unlicense

repository: LatGeek/toolstory

gha_license_id: Unlicense

repo_name: LatGeek/toolstory


text:
This is the project repo for the final project of the Udacity Self-Driving Car Nanodegree: Programming a Real Self-Driving Car. For more information about the project, see the project introduction [here](https://classroom.udacity.com/nanodegrees/nd013/parts/6047fe34-d93c-4f50-8336-b70ef10cb4b2/modules/e1a23b06-329a-4684-a717-ad476f0d8dff/lessons/462c933d-9f24-42d3-8bdc-a08a5fc866e4/concepts/5ab4b122-83e6-436d-850f-9f4d26627fd9).

Please use **one** of the two installation options, either native **or** docker installation.

### Native Installation

* Be sure that your workstation is running Ubuntu 16.04 Xenial Xerus or Ubuntu 14.04 Trusty Tahir. [Ubuntu downloads can be found here](https://www.ubuntu.com/download/desktop).
* If using a Virtual Machine to install Ubuntu, use the following configuration as minimum:
  * 2 CPU
  * 2 GB system memory
  * 25 GB of free hard drive space

  The Udacity provided virtual machine has ROS and Dataspeed DBW already installed, so you can skip the next two steps if you are using this.

* Follow these instructions to install ROS
  * [ROS Kinetic](http://wiki.ros.org/kinetic/Installation/Ubuntu) if you have Ubuntu 16.04.
  * [ROS Indigo](http://wiki.ros.org/indigo/Installation/Ubuntu) if you have Ubuntu 14.04.
* [Dataspeed DBW](https://bitbucket.org/DataspeedInc/dbw_mkz_ros)
  * Use this option to install the SDK on a workstation that already has ROS installed: [One Line SDK Install (binary)](https://bitbucket.org/DataspeedInc/dbw_mkz_ros/src/81e63fcc335d7b64139d7482017d6a97b405e250/ROS_SETUP.md?fileviewer=file-view-default)
* Download the [Udacity Simulator](https://github.com/udacity/CarND-Capstone/releases).

### Docker Installation
[Install Docker](https://docs.docker.com/engine/installation/)

Build the docker container
```bash
docker build . -t capstone
```

Run the docker file
```bash
docker run -p 4567:4567 -v $PWD:/capstone -v /tmp/log:/root/.ros/ --rm -it capstone
```

### Port Forwarding
To set up port forwarding, please refer to the [instructions from term 2](https://classroom.udacity.com/nanodegrees/nd013/parts/40f38239-66b6-46ec-ae68-03afd8a601c8/modules/0949fca6-b379-42af-a919-ee50aa304e6a/lessons/f758c44c-5e40-4e01-93b5-1a82aa4e044f/concepts/16cf4a78-4fc7-49e1-8621-3450ca938b77)

### Usage

1. Clone the project repository
```bash
git clone https://github.com/udacity/CarND-Capstone.git
```

2. Install python dependencies
```bash
cd CarND-Capstone
pip install -r requirements.txt
```
3. Make and run styx
```bash
cd ros
catkin_make
source devel/setup.sh
roslaunch launch/styx.launch
```
4. Run the simulator

### Real world testing
1. Download [training bag](https://s3-us-west-1.amazonaws.com/udacity-selfdrivingcar/traffic_light_bag_file.zip) that was recorded on the Udacity self-driving car.
2. Unzip the file
```bash
unzip traffic_light_bag_file.zip
```
3. Play the bag file
```bash
rosbag play -l traffic_light_bag_file/traffic_light_training.bag
```
4. Launch your project in site mode
```bash
cd CarND-Capstone/ros
roslaunch launch/site.launch
```
5. Confirm that traffic light detection works on real life images

# WORK FLOW
## WHAT WE DO
	1. I selected native installation
	   Install ROS Kinetic in Ubuntu 16.04
	   Install Dataspeed DBW
	   Install Udacity Simulator
	2. Clone the project and copy to my github site
	   Install the python dependencies
	3. Run the ros server and the simulator
	   in the directory CarND-Capstone/Ros,
	   source devel/setup.sh
	   roslaunch launch/styx.launch
	   then run the simulator
	4. overview the prject,and write the core code
	5. real world testing

## CORE CODE
There are some main steps

### 1.  Waypoint Updater Node
#### Edit waypoint_updater.py

	1. we get waypoints from /base_waypoints ,Msg Type is Lane

	2. get current position from /current_pose,Msg Type is PoseStamped

	3. create a KDTree used to get the closest waypoint from current position

	4. create a loop, publish the final waypoint

	Now we can see the green waypoints from simulator

### 2. DBW Node

#### Edit twist_controller/dbw_node.py

	1. get dbw_enabled param from /vehicle/dbw_enabled node,Msg Type is Bool.
	init the Controller

	2. if dbw is enabled, call controller.control,and get throttle,brake,steer

#### Edit twist_controller/twist_controller.py

	1.  in control function,we care about these params:

	* dbw_enabled
	* goal_linear_v
	* goal_angular_v
	* brake_control
	* current_linear_v
	* dt

	use pid controller get throttle
	use yaw_controller get steer angle
	use brake controller get the brake

### 3. Traffic Light Detection Node

#### Edit tl_detector/tl_detector.py
	1. there are two conditions: simulater light and real traffic light.
	we set a Bool param use_ground_truth to check the condition.

	* In simulater condition.
	we get light position and light state from /vehicle/traffic_lights node
	* In real light condition

	we get light position from /vehicle/traffic_light node

	**we get light state from /image_color node ,and called process_traffic_light function.**

	2.
	we set a Int32 param last_ligth_wp,it is the traffic light's index position.
	and publish it by /traffic_waypoint node.

### 4. light_classification
This part is a core function.
we referenced the link https://github.com/alex-lechner/Traffic-Light-Classification
run ros/launch/install_detector_lib.sh to install the tensorflow models.
	1. Datasets
	    1. Extract images from a ROSbag file
	start roscore server
	rosbag play -l ./just_traffic_light.bag
	here we create simulator/real two light conditions's image files
	    2. Data labeling
	    3. Create a TFRecord file
	2. Training
	    1. Choosing a model
	here we use SSD Inception V2
	    2. Configure the .config file of the model
	    4. Training the model
	    5. Freezing the graph
	3. Testing
- result display
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/RED.jpg "redlight")
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/GREEN.jpg "greenlight")

### 5. Full Waypoint Walkthrough

#### Edit wapoint_updater.py

	1. combin the closest traffic light's position and state into the logic

	2. add a int param stopline_wp_idx,get from /traffic_waypoint node
In the generate_lane function, if  stopline_wp_idx > 0 means the read traffic light
is in sight. if stopline_wp_idx < 0 mean no read light in sight.

## Project RUN
### 1. In the Highway scene

    1. we uncheck the Manual, uncheck the camera,use the simulate traffic light info.
    2. run the roslaunch launch/styx.launch,start the simulate client
    3. the car followed the waypoints
    4. car's speed is limited to 40KPH
    5. car stoped at the traffic light when it is red sign
    6. at this scene,uncheck the camera,the throttle,steering,and brake info can be published at 50HZ
- result display
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/highway_1.jpg "redlight")
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/highway_2.jpg "maxspeed")

### 2. In the Testlot scene

    1. we uncheck the Manual,**run the rosbag**,scene will use the real traffic light info MSG.
    2. run the roslaunch launch/site.launch,start the simulate client
    3. the car followed the waypoints
    4. car's speed is limited to 10KPH
    5. car stoped at the traffic light when it is red sign
    6. at this scene, we drop the waypoint_update's loop rate
- result display
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/testlot_1.jpg "follow")
![result display](https://github.com/helloxms/Udacity_CarND_Capstone/tree/master/CarND-Capstone/imgs/testlot_2.jpg "redlight")

## Troubleshooting

1. In WorkSpace ,Perhaps will meet some ros env error.
	1. /home/workspace/Udacity_CarND_Capston/CarND-Capstone/ros

	- run command: source devel/setup.sh  (make all ros command available)
	- run command: sudo apt-get install ros-kinetic-dbw-mkz  (install required lib)
	- run command: pip uninstall catkin_pkg  (maybe this bag is too new)
	- run command: pip install catkin_pkg
	- run command: catkin_make
	- run command: roslaunch launch/styx.launch or roslaunch launch/site.launch

	the last command will start the server.
2. In the Highway scene, do not check on the camera function
	1. do not check on the camera function in this scene,it is no use.
	2. tl_detector/tl_detector.py
	TLDetector's init function will set self.use_ground_truth = False.

3. In the Testlot scene, we will use real traffic light msg.
	1. tl_detector/tl_detector.py
	- TLDetector's init function will set self.use_ground_truth = True.
	- tl_detector/light_classification/tl_classifier.py
	TLClassifier's model graph path is set to "models/ssd_udacity/frozen_inference_graph.pb"
	- install tensorflow's model lib

	https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

	git clone https://github.com/tensorflow/models.git

	git checkout f7e99c0

	install details are written in ros/launch/install_detector_lib.sh

	2. twist_controller/twist_controller.py
	Controller's control funtion will increase car's steer angle for the camera msg dropped the update rate ?

	3. waypoint_updater/waypoint_updater.py
	WaypointUpdater's loop function ,drop down the loop rate.

	All these modifies will be done by check the launch script param.


text:
## Description of your problem

**What steps will reproduce the problem?**

1.
2.
3.

**What is the expected output? What do you see instead?**

**Please provide any additional information below**

## Versions and main components

* Terminal Version:
* Spyder Version:
* Python Version:
* Operating system:

gha_license_id: MIT


text:
Cliprz\Filesystem
=================
A more options to handle your files and directories with PHP.

Download and install
--------------------
This package written under PHP 5.4 or newer. its simple to install only [Download](https://github.com/Cliprz/Filesystem/archive/master.zip) it and use it.
Don't forget to include ``` Cliprz\Filesystem\MimeTypes\MimeTypesGuesser ``` class before use ``` Cliprz\Filesystem\Filesystem ``` class see :

``` php
include ('Path/To/Cliprz/Filesystem/MimeTypes/MimeTypesGuesser.php');
include ('Path/To/Cliprz/Filesystem/Filesystem.php');
use Cliprz\Filesystem\Filesystem as Filesystem;

// Create instance
$Filesystem = new Filesystem();
```

Or just let Composer do that for you, Call Cliprz\Filesystem from Composer

```json
{
    "require": {
        "php": ">=5.4",
		"cliprz/filesystem": "1.0.*"
    }
}
```

How to use it
-------------
You can read [Wiki](https://github.com/Cliprz/Filesystem/wiki) , And you can test Cliprz\Filesystem from [Tests](https://github.com/Cliprz/Filesystem/tree/master/Tests) directory require PHPUnit.

## Author
* [Yousef Ismaeil](https://github.com/Cliprz/)

## Copyright and license
Part of Cliprz framework, Copyright 2013 Cliprz, under [MIT License](LICENSE).

repository: Cliprz/Filesystem

repo_name: Cliprz/Filesystem


text:
<!--
# nf-core/modules pull request

Many thanks for contributing to nf-core/modules!

Please fill in the appropriate checklist below (delete whatever is not relevant).
These are the most common things requested on pull requests (PRs).

Remember that PRs should be made against the master branch.

Learn more about contributing: [CONTRIBUTING.md](https://github.com/nf-core/modules/tree/master/.github/CONTRIBUTING.md)
-->

## PR checklist

Closes #XXX <!-- If this PR fixes an issue, please link it here! -->

- [ ] This comment contains a description of changes (with reason).
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] If you've added a new tool - have you followed the module conventions in the [contribution docs](https://github.com/nf-core/modules/tree/master/.github/CONTRIBUTING.md)
- [ ] If necessary, include test data in your PR.
- [ ] Remove all TODO statements.
- [ ] Emit the `versions.yml` file.
- [ ] Follow the naming conventions.
- [ ] Follow the parameters requirements.
- [ ] Follow the input/output options guidelines.
- [ ] Add a resource `label`
- [ ] Use BioConda and BioContainers if possible to fulfil software requirements.
- Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
  - [ ] `PROFILE=docker pytest --tag <MODULE> --symlink --keep-workflow-wd --git-aware`
  - [ ] `PROFILE=singularity pytest --tag <MODULE> --symlink --keep-workflow-wd --git-aware`
  - [ ] `PROFILE=conda pytest --tag <MODULE> --symlink --keep-workflow-wd --git-aware`

repository: nf-core/modules

gha_language: Nextflow

repo_name: nf-core/modules


text:
# Roshambo
![repo-size](https://img.shields.io/github/repo-size/harshitbansal373/roshambo?style=flat-square)

This is online game of Rock-Paper-scissors. This is based on javascript and bootstrap. In This You can play with Computer.

# Some Preview

## Contribution
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.

gha_language: JavaScript


text:
Shortcut to search DuckDuckGo.

When triggered, this macro will show a prompt for a search term, and will search that term on DuckDuckGo.com

![Screenshot](Screenshot%202018-12-21%20at%2013.49.35.png?raw=true)

repository: CDRussell/KeyboardMaestroShared

path: /DuckDuckGo/duck it/readme.md

repo_name: CDRussell/KeyboardMaestroShared


text:
parallel-programming-design
===========================

Backup port for Parallel Programming design -- Fibonacci array and the
Akari / Light-Up problem.

Result
------

A maximum speed-up of 3.5+, on a 4C8T processor, achieved on the Light-Up
problem.

Raw benchmark results and some data visualizations of both questions can be
found at `doc/figures.xlsx`.

Algorithm
---------

Brief introduction of algorithms can be found in corresponding
`doc/*实验报告.pdf` documentations, and analysis in `doc/*思考题.pdf`.

Reference
---------

- [the Light-Up problem](https://www.puzzle-light-up.com/)

repository: smdsbz/parallel-programming-design

repo_name: smdsbz/parallel-programming-design


text:
title: Create Windows KVM VM from Command Line
summary: Creating a Windows KVM VM without OpenStack using the command line on Ubuntu 18.04
slug: windows-kvm-command-line
category: systems administration
tags: Ubuntu, KVM
date: 2020-06-05
modified: 2020-06-05
status: published
image: ubuntu.png
thumbnail: ubuntu-thumb.png

# Install KVM

Install the packages

```bash
apt-get install -y qemu-kvm libvirt-bin bridge-utils
```

Package notes from [ubuntu.com](https://help.ubuntu.com/community/KVM/Installation):

- libvirt-bin provides libvirtd which you need to administer qemu and kvm instances using libvirt
- qemu-kvm (kvm in Karmic and earlier) is the backend
- ubuntu-vm-builder powerful command line tool for building virtual machines
- bridge-utils provides a bridge from your network to the virtual machines

Add users to groups

```bash
adduser `id -un` libvirt
adduser `id -un` kvm
```

Verify install

```bash
virsh list --all
```

---

# Networking

## Configure network bridge

Your network interfaces should be configured with NetPlan right now.
Since bridge-utils is installed, you can use NetPlan to do the rest.

Before doing this, it's a good idea to double-check your IPMI/IDRAC/ILO is working.

```yaml
# Example netplan config defining bridge
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
  bridges:
    br0:
      interfaces: [eno2]
      addresses: ["<IP_ADDRESS>/24"]
      gateway4: <IP_ADDRESS>
      mtu: 1500
      nameservers:
        addresses: ["<IP_ADDRESS>"]
      parameters:
        stp: true
        forward-delay: 4
      dhcp4: no
      dhcp6: no
```

---

# Defining the VM using virt-install

Install virt-install - it's kind of big, about 160MB

```bash
apt-get install -y virtinst
```

## Optional - list os-variant options

```bash
apt-get install -y libosinfo-bin

osinfo-query os
```

## Create the VM

- `--disk bus=`: 'ide', 'scsi', 'usb', 'virtio' or 'xen'.

### Booting from an existing qcow2 image

```bash
virt-install \
  --name MyImportedVM \
  --description "Imported virtual machine" \
  --graphics vnc,listen=<IP_ADDRESS> \
  --noautoconsole \
  --os-type=linux \
  --memory 8192 \
  --vcpus=4 \
  --disk path=/var/lib/libvirt/images/importedVM.qcow2,bus=virtio\
  --boot hd \
  --network bridge:br0,model=virtio
```

### Building a new Windows VM

Windows can be difficult on KVM because it doesn't ship with Virtio drivers. Using the non-virtio
disk and network emulation is comparatively slow. Things are made harder because `virt-install`
doesn't let you use --cdrom twice. To mount two iso files at once (so virtio drivers can be installed),
use the --disk argument with device=cdrom. Also be sure to use bus=ide so Windows can read it before
installing the virtio drivers.

- Click the "Load Driver" button, and browse to the virtio iso that was mounted.
- Expand the `viostor` folder and choose your OS. Click the `amd64` subdirectory. Click OK.
- RedHat VirtIO SCSI Controller should show up, click Next
- Finish the install

Once the install finishes the server will turn off.

Edit the server using `virsh edit` to remove the disk:

```bash
virsh edit Server2019
```

Choose your editor of choice (vim, obviously), and remove the boot `cdrom` disk.
Leave the virtio one, you stil need it. It looks like this:

```xml
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/isos/WindowsServer2019StandardCore_1909.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
```

Turn it back on using `virsh start`:

```bash
virsh start Server2019
```

#### Fix the other drivers

The storage driver is now installed, but the network driver isn't there.
Since the VM was launched with `--network bridge=br0,model=virtio`, the VirtIO
driver is required. Not using the virtio NIC leads to some pretty terrible performance.

Log into the server and open up the device manager.
Navigate to "other devices". Right click the question marked network driver
and update the driver. Select your virtio disk and allow searching subdirectories,
it should find the driver and install it for you.

Do the same for the unidentified PCI device, that will install the VirtIO Baloon driver.

The server is now ready to use, or be made into a template. If you intend to use this server
with OpenStack later, consider installing cloud-init from [cloudbase-init](https://cloudbase.it/cloudbase-init/).

---

# Accessing the VM through the console

When defining the VM, `--graphics vnc,listen=<IP_ADDRESS>` was used. This enabled a VNC server underneath the
VM which can be used to connect in. To find the connection details, run `virsh vncdisplay`, which will show
the port offset of that VM's VNC console.

```bash
virsh vncdisplay Server2019
```

The output will be something like `:0` or `:1`. Add 5900 to that, and that's your listen port.
If you needed to use a different port, `--graphics` supports a `,port=` argument.

---

# Exporting to Glance

If you want to use this file in OpenStack Glance next, you need to convert it. It's not intuitive, but the file looks like it's basically a thick-provisioned qcow2 (somehow). Use qemu-img:

```bash
# thin provision the volume
qemu-img convert -f qcow2 -O qcow2 <boot-vol> <new-file.qcow2>
# upload it as an image
openstack image create --container-format bare --disk-format qcow2 --public --file <new-file.qcow2> "<image name>"
```


text:
# auto-oncall
auto-oncall application is a webhook handler, responsible for creating new Opsgenie routing rules on every deployment event.

# configuration
Configuration requires next data to be configured in `values.yaml` of the helm chart:

```
# github token with private repositories read access
githubToken:
# opsgenie api token
opsgenieToken:

# user mapping between github login and Opsgenie login
users:
  github_user<EMAIL_ADDRESS>
# organization github webhook secret
githubWebhookSecret:
```

repository: giantswarm/auto-oncall

gha_language: Go

repo_name: giantswarm/auto-oncall


text:
---
title: Plesk Database Schematic
author: Major Hayden
type: post
date: 2007-04-07T15:00:03+00:00
url: /2007/04/07/plesk-database-schematic/
dsq_thread_id:
  -<PHONE_NUMBER>
categories:
  - Blog Posts
tags:
  - plesk

---
I've heard a lot of people are interested in something like this, so I decided to create it. I didn't try to make it look confusing, it just came out that way.

[<img src="http://cdn.cloudfiles.mosso.com/c8031/plesk-db-diagram.jpg" alt="Plesk Database Schematic" style="width: 200px;" />
plesk-db-diagram.pdf [99KB]][1]

 [1]: http://cdn.cloudfiles.mosso.com/c8031/plesk-db-diagram.pdf

branch_name: refs/heads/main


text:
---
title: Contributor Guide
---

Thank you for your interest in improving this project. This project is
open-source under the [MIT license](https://opensource.org/licenses/MIT)
and welcomes contributions in the form of bug reports, feature requests,
and pull requests.

Here is a list of important resources for contributors:

- [Source Code](https://github.com/vahaah/django-sftp)
- [Documentation](https://django-sftp.readthedocs.io/)
- [Issue Tracker](https://github.com/vahaah/django-sftp/issues)
- [Code of Conduct](CODE_OF_CONDUCT.rst)

# How to report a bug

Report bugs on the [Issue
Tracker](https://github.com/vahaah/django-sftp/issues).

When filing an issue, make sure to answer these questions:

- Which operating system and Python version are you using?
- Which version of this project are you using?
- What did you do?
- What did you expect to see?
- What did you see instead?

The best way to get your bug fixed is to provide a test case, and/or
steps to reproduce the issue.

# How to request a feature

Request features on the [Issue
Tracker](https://github.com/vahaah/django-sftp/issues).

# How to set up your development environment

You need Python 3.6+ and the following tools:

- [Poetry](https://python-poetry.org/)
- [Nox](https://nox.thea.codes/)

Install the package with development requirements:

```{.console}
$ poetry install
```

You can now run an interactive Python session, or the command-line
interface:

```{.console}
$ poetry run python
$ poetry run django-sftp
```

# How to test the project

Run the full test suite:

```{.console}
$ nox
```

List the available Nox sessions:

```{.console}
$ nox --list-sessions
```

You can also run a specific Nox session. For example, invoke the unit
test suite like this:

```{.console}
$ nox --session=tests
```

Unit tests are located in the `tests` directory, and are written using
the [pytest](https://pytest.readthedocs.io/) testing framework.

# How to submit changes

Open a [pull request](https://github.com/vahaah/django-sftp/pulls) to
submit changes to this project.

Your pull request needs to meet the following guidelines for acceptance:

- The Nox test suite must pass without errors and warnings.
- Include unit tests. This project maintains 100% code coverage.
- If your changes add functionality, update the documentation
  accordingly.

Feel free to submit early, though---we can always iterate on this.

You can ensure that your changes adhere to the code style by
reformatting with [Black](https://black.readthedocs.io/):

```{.console}
$ nox --session=black
```

It is recommended to open an issue before starting work on anything.
This will allow a chance to talk it over with the owners and validate
your approach.

repository: vahaah/django-sftp

gha_language: Python

repo_name: vahaah/django-sftp


text:
# Quantum chemistry with quantum computation

This repository contains a series of programs where I try to reproduce the results of published
papers in quantum chemistry using quantum computations.

Feedback, corrections and questions welcome!

## Contact

You can reach me at <a href="mailto:nbashige<EMAIL_ADDRESS>
## License

This code is licensed under the MIT license. Please see the LICENSE file for the terms.

## Acknowledgement

Thanks to Timothy Hirzel and Peter Johnson of [Zapata Computing](http://zapatacomputing.com/) for suggesting working on VQE
and sharing the necessary materials to get started with quantum chemistry.

## Copyright

Copyright (c) 2019 Ntwali Bashige Toussaint

repository: ntwalibas/quantum-chem

repo_name: ntwalibas/quantum-chem


text:
# Model

To make your model graphql-firendly, you need to inlcude `GraphqlRails::Model`. Your model can be any ruby class (PORO, ActiveRecord::Base or anything else)

Also you need to define which attributes can be exposed via graphql. To do so, use `graphql` method inside your model body. Example:

```ruby
class User # works with any class including ActiveRecord
  include GraphqlRails::Model

  graphql do |c|
    c.attribute :id
    c.full_name, type: :string
  end
end
```

## graphql

This method must be called inside your model body. `graphql` is used for making your model convertible to graphql type.

## attribute

Most commonly you will use `attribute` to make your model methods and attributes visible via graphql endpoint.

### attribute.type

Some types can be determined by attribute name, so you can skip this attribute:

* attributes which ends with name `*_id` has `ID!` type
* attributes which ends with `?` has `Boolean!` type
* all other attributes without type are considered to be `String`

Usage example:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute :shop_id # ID! type
    c.attribute :full_name # String type
    c.attribute :admin? # Boolean! type
    c.attribute :level, type: 'integer'
    c.attribute :money, type: 'float'
  end
end
```

You can also use some build in aliases for types, such as:

* `'id'` is alias for `GraphQL::Types::ID`
* `'integer'`, `'int'` are aliases for `GraphQL::Types::Int`
* `'bigint'`, `'big_int'` are aliases for `GraphQL::Types::BigInt`
* 'float', 'double', 'decimal' are aliases for `GraphQL::Types::Float`
* `'bool'`, `'boolean'` are aliases for GraphQL::Types::Boolean
* String: `'string'`, `'str'`, `'text'`
* 'date' is alias for `GraphQL::Types::ISO8601Date`
* 'time', 'datetime', 'date_time' are aliases for `GraphQL::Types::ISO8601DateTime`
* 'json' is alias for `GraphQL::Types::JSON`

Usage example:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:about_me).type(:text)
    c.attribute(:active).type('bool!')
    c.attribute(:created_at).type(:datetime!)
    c.attribute(:data).type(:json!)
    c.attribute(:login_dates).type('[date!]!')
  end
end
```

#### attribute.type: using graphql-ruby objects

You can also use raw graphql-ruby objects as attribute types. Here is an example:

```ruby
# raw graphql-ruby type:
class AddressType < GraphQL::Schema::Object
  graphql_name 'Address'

  field :city, String, null: false
  field :street_name, String, null: false
  field :street_number, Integer
end

# GraphqlRails model:
class User
  include GraphqlRails::Model

  graphql.attribute :address, type: 'AddressType!', required: true
end
```

Check [graphql-ruby documentation](https://graphql-ruby.org) for more details about graphql-ruby types.

### attribute.property

By default graphql attribute names are expected to be same as model methods/attributes, but if you want to use different name on graphql side, you can use `property` option:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute :shop_id, property: :department_id
  end

  def department_id
    456
  end
end
```

### attribute.description

You can also describe each attribute and make graphql documentation even more readable. To do so, add `description` option:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute :shop_id, description: 'references to shop'
  end
end
```

### attribute.deprecated

Attribute can be marked as deprecated with `deprecated` method:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:legacy_name).deprecated
    c.attribute(:legacy_id).deprecated('This is my custom deprecation reason')
  end
end
```

### attribute.groups

Groups are handy feature when you want to have multiple schemas. For example, you want to have public graphql endpoint and internal graphql endpoint where each group has some unique nodes. If attribute has `groups` set, then this attribute will be visible only in appropriate group schemas.

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    # visible in all schemas (default):
    c.attribute(:email)

    # visible in "internal" and "beta" schemas only:
    c.attribute(:admin_id).groups(%i[internal beta])

    # visible in "external" schema only:
    c.attribute(:nickname).groups(%i[external])
  end
end
```

### attribute.group

Alias for Attribute#groups.

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    # visible in all schemas (default):
    c.attribute(:email)

    # visible in "external" schema only:
    c.attribute(:nickname).group(:external)
  end
end
```

### attribute.hidden_in_groups

Opposite for Attribute#groups. It hides attribute in given groups

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    # visible in all schemas (default):
    c.attribute(:email)

    # visible in all schemas except "external":
    c.attribute(:nickname).hidden_in_groups(:external)
  end
end
```

### attribute.options

Allows passing options to attribute definition. Available options:

* `attribute_name_format` - if `:original` value is passed, it will not camelCase attribute name.

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute :first_name # will be accessible as firstName from client side
    c.attribute :first_name, options: { attribute_name_format: :original } # will be accessible as first_name from client side
  end
end
```

### attribute.extras

Allows passing extras to enable [graphql-ruby field extensions](https://graphql-ruby.org/type_definitions/field_extensions.html#using-extras)

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:items).extras([:lookahead])
  end
end
```

### attribute.permit

To define attributes which are accepted by each model method, you need to call `permit` method, like this:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:avatar_url).permit(size: :int!)
  end

  def avatar_url(size:)
    # some code here
  end
end
```

### attribute.permit_input

Allows to permit single input field. It allows to set additional options for each field.

#### attribute.permit_input.type

#### attribute.permit_input: required type

There are few ways how to mark field as required.

1. Adding exclamation mark at the end of type name:

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:avatar_url).permit_input(:size, type: :int!)
end
```

2. Adding `required: true` options

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:avatar_url).permit_input(:size, type: :int, required: true)
end
```

#### attribute.permit_input.description

You can describe each input by adding `description` keyword argument:

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:avatar_url).permit_input(:size, description: 'max size of avatar')
end
```

#### *subtype*

`subtype` allows to specify which named input should be used. Here is an example:

```ruby
class Image
  graphql.input(:size_options) do |c|
    c.attribute :width
    c.attribute :height
  end
end

class User
  graphql.attribute(:avatar_url).permit_input(:size, type: Image, subtype: :size_options)
end
```

#### *deprecated*

You can mark input input as deprecated with `deprecated` option:

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:avatar_url)
         .permit_input(:size, type: :int!, deprecated: true)

  graphql.attribute(:logo_url)
         .permit_input(:size, type: :int!, deprecated: 'custom image size is deprecated')
end
```

### attribute.paginated

You can mark collection method as `paginated`. In this case method will return relay connection type and it will be possible to return only partial results. No need to do anything on method side (you should always return full list of items)

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute :items, type: '[Item]', paginated: true

  def items
    Item.all
  end
end
```

### attribute.required

You can mark attribute as required using `required` method:

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:item).type('Item').required
end
```

### attribute.optional

You can mark attribute as optional using `optional` method:

```ruby
class User
  include GraphqlRails::Model

  graphql.attribute(:item).type('Item').optional
end
```

### attribute.same_as

When you want to have identical attributes, you can use `Attribute#same_as` to make sure that attribute params will stay in sync:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:user_id).type('ID').description('User ID')
    c.attribute(:person_id).same_as(c.attribute(:user_id))
  end
end
```

### attribute.with

When you want to define some options dynamically, it's quite handy to use "Attribute#with" method:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:shop_id).with(type: 'ID', description: 'references to shop')
    # same as:
    # c.attribute(:shop_id, type: 'ID', description: 'references to shop')
    # also same as:
    # c.attribute(:shop_id).type('ID').description('references to shop')
  end
end
```

### "attribute" configuration with chainable methods

If your attribute definition is complex, you can define attribute in more eye-friendly chainable way with:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:shop_id)
      .type('ID!')
      .description('references to shop')
  end
end
```

### "attribute" configuration with a block

You can also use block in order to specify attribute configuration:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.attribute(:shop_id) do |attr|
      attr.type 'ID!'
      attr.description 'references to shop'
    end
  end
end
```

## name

By default graphql type name will be same as model name, but you can change it via `name` method

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.name 'Employee'
  end
end
```

## description

To improve graphql documentation, you can description for your graphql type:

```ruby
class User
  include GraphqlRails::Model

  graphql do |c|
    c.description 'Users are awesome!'
  end
end
```

## graphql_type

Sometimes it's handy to get raw graphql type. To do so you can call:

```ruby
YourModel.graphql.graphql_type
```

## input

You can define input types:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :name
  end
end
```

Also you can have multiple input types:

```ruby
class User
  include GraphqlRails::Model

  graphql.input(:create) do |c|
    c.attribute :name
  end

  graphql.input(:update) do |c|
    c.attribute :id
    c.attribute :name
  end
end
```

### input attribute

Most commonly you will use `attribute` to define what kind of values your endpoint accepts

#### input type

You can specify your input attribute type. If type is not provided then type is set to `:string`.

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :friends_count, type: :integer!
  end
end
```

### "input.attribute" configuration with chainable methods

If your input attribute definition is complex, you can define attribute in more eye-friendly chainable way with:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute(:friends_count)
      .type(:integer!)
      .description('Can not be zero or less')
  end
end
```

#### required type

There are few ways how to mark field as required.

1. Adding exclamation mark at the end of type name:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :friends_count, type: :integer!
  end
end
```

2. Adding `required: true` value

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :friends_count, type: :integer, required: true
  end
end
```

#### input enum type

You can specify your input attribute as enum:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :favorite_fruit, enum: %i[apple orange]
  end
end
```

By default enum type is not required. To make it required add `required: true`:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :favorite_fruit, required: true, enum: %i[apple orange]
  end
end
```

#### input attribute description

To improve graphql endpoint documentation, you can add description for each input attribute:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute :name, description: "User's first name"
  end
end
```

#### input attribute deprecation

You can mark input attribute as deprecated with `deprecated` method:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute(:full_name).deprecated('Use firstName and lastName instead')
    c.attribute(:surname).deprecated
  end
end
```

#### input attribute default value

You can set default value for input attribute:

```ruby
class User
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute(:is_admin).type('Boolean').default_value(false)
  end
end
```

#### input attribute config copy

You can copy existing config from other attribute using `Attribute#same_as` method:

```ruby
class User
  include GraphqlRails::Model

  graphql.input(:create) do |c|
    c.attribute(:first_name).type('String!')
    c.attribute(:last_name).type('String!')
  end

  graphql.input(:update) do |c|
    c.attribute(:id).type('ID!')
    graphql.input(:contract).attributes.each_value do |attr|
      c.attribute(attr.name).same_as(attr)
    end
  end
end
```

#### input attribute property

Sometimes it's handy to have different input attribute on graphql level and different on controller. That's when `Attribute#property` comes to the rescue:

```ruby
class Post
  include GraphqlRails::Model

  graphql.input do |c|
    c.attribute(:author_id).type('ID').property(:user_id)
  end
end
```

Then mutation such as:

```gql
mutation createPost(input: { authorId: 123 }) {
  author
}
```

Will pass `user_id` instead of `authorId` in controller:

```ruby
# posts_controller.rb
def create
  Post.create!(user_id: params[:input][:user_id])
end
```

## graphql_context

It's possible to access graphql_context in your model using method `graphql_context`:

```ruby
class User
  include GraphqlRails::Model

  def method_with_context
    graphql_context[:some_data]
  end
end
```

Keep in mind that this value will be set only during graphql execution, but in tests this value will be `nil`. To avoid this, you need to set `show_graphql_context` manually like this:

```ruby
class User
  include GraphqlRails::Model

  def show_graphql_context
    graphql_context[:data]
  end
end

user = User.new(...)
user.show_graphql_context #=> NoMethodError: undefined method `[]' for nil:NilClass
user.graphql_context =  { data: 'goes to context' }
user.show_graphql_context #=> { data: 'goes to context' }
```

gha_language: Ruby


text:
# 1.7.x API Reference

- [`Jingle`](#jinglejingle)
  - [`new Jingle(config)`](#new-jingleconfig)
    - [`prepareSession(opts, [req])`](#preparesessionopts-req)
    - [`performTieBreak(existingSession, req)`](#performtiebreakexistingsession-req)
  - [`Jingle` Methods](#jingle-methods)
    - [`jingle.addICEServer(info)`](#jingleaddiceserverinfo)
    - [`jingle.addSession(session)`](#jingleaddsessionsession)
    - [`jingle.endAllSessions([reason], [silent])`](#jingleendallsessionsreason-silent)
    - [`jingle.endPeerSessions(peer, [reason], [silent])`](#jingleendpeersessionspeer-reason-silent)
    - [`jingle.process(packet)`](#jingleprocesspacket)
  - [`Jingle` Events](#jingle-events)
    - [`send`](#send)
    - [`incoming`](#incoming)
    - [`outgoing`](#outgoing)
    - [`terminated`](#terminated)
    - [`log:[error|debug|info]`](#logerrordebuginfo)

- See also:
  - [`Base Session`](https://github.com/otalk/jingle-session/blob/master/docs/Reference.md)
  - [`Media Session`](https://github.com/otalk/jingle-media-session/blob/master/docs/Reference.md)
  - [`File Transfer Session`](https://github.com/otalk/jingle-filetransfer-session/blob/master/docs/Reference.md)

## `Jingle.Jingle`
### `new Jingle(config)`

Creates a new Jingle session jingle with the following configuration options:

- `jid` - The JID for the entity running the session jingle. May be either a `{String}` or [`{JID}`](https://github.com/otalk/xmpp-jid).
- `selfID` - An optional alternative to `jid`, which MUST be a `{String}`. By default, this is derived from `jid`, if `jid` was provided.
- `iceServers` - An array of known ICE servers. See [`addICEServer()`](#jingleaddiceserverinfo) for the required format of each item.
- `prepareSession` - [See below for how `prepareSession` works](#preparesessionopts-req)
- `performTieBreak` - [See below for how `performTieBreak` works](#performtiebreakexistingsession-req)

```js
var Jingle = require('jingle');
var BaseSession = require('jingle-session');

var jingle = new Jingle({
    jid<EMAIL_ADDRESS>    iceServers: [
        {url: 'stun:stun.mydomain.example'}
    ],
    prepareSession: function (opts) {
        return new Session(opts);
    }
});
```

#### `prepareSession(opts, [req])`

- `opts` - An object summarizing the information in the session initiate request, suitable for passing directly to a session class constructor:
    - `sid` - The ID for the session, as provided by the initiating peer.
    - `peer` - The JID for the initiating peer (may be either a `{String}` or [`{JID}`](https://github.com/otalk/xmpp-jid)).
    - `peerID` - An alternative to `peer`, which MUST be a `{String}` (derived from `peer`).
    - `initiator` - This will always be `false`, as we are the one receiving the initiation request.
    - `applicationTypes` - An array of content application names.
    - `transportTypes` - An array of content transport names.
- `req` - The original session initiation request, in case you need more information than provided in `opts` for selecting a session type.

Returns a `Session` instance of your choosing or a `falsy` value if you wish to fallback to a `BaseSession` instance (the `jingle-session` module).

The `prepareSession()` function allows you to control what type of session is created for a given
incoming session request. If `prepareSession()` is not included when creating the session jingle, or
if your `prepareSession()` function does not return a session, a `BaseSession` will be created for you.

```js
new Jingle.Jingle({
    ...,
    prepareSession: function (opts) {
        // Check if the session request includes "stub" content, and if so
        // create a custom StubSession.
        if (opts.applicationTypes.indexOf('stub') >= 0) {
            return new StubSession(opts);
        }
    }
});
```

#### `performTieBreak(existingSession, req)`

- `existingSession` - A Session object.
- `req` - The incoming session initiation request that triggered the tie break check.

A tie break check is performed when receiving a `session-initiate` if:

- A session in the `pending` state already exists for the peer.
- The existing pending session ID is greater than the one used by the incoming session request

The `performTieBreak()` method allows you to control whether or not the session request is declined to resolve the tie. In some applications, you may wish to allow two simultaneous sessions (e.g., multiple uni-directional video sessions). In others you may wish to allow the tie break to force the use of a single session (e.g., a bidirectional video session).

Returning `true` will trigger the tie break and deny the request; returning `false` will allow the session request to proceed.

### `Jingle` Methods
#### `jingle.addICEServer(info)`

- `info` - Either a `{String}` of the URI of the ICE server, or an object:
    - `url` - The URI of the ICE server
    - `username` - The username for accessing the ICE server
    - `credential` - The password or other shared secret to authenticate the `username` with the ICE server

Saves the URI and any required credentials for an ICE STUN/TURN server for use by *future* sessions.

```js
jingle.addICEServer('stun:stun.l.google.com:19302');
jingle.addICEServer({
    url: 'stun:stun.mydomain.example',
    username: 'ad24lwra',
    credential: '234lamvnerl13k40au35oahfadad'
});
```

#### `jingle.addSession(session)`

- `session` - A `{BaseSession}` (or ideally, a subclass of `BaseSession`) instance

Calling this method allows the Jingle instance to begin tracking the session and route actions to it.

For incoming sessions, this step is already handled for you. Using this method is only necessary for when you are initiating a session yourself.

Relevant events generated by `session` will now be proxied through the Jingle instance.

```js
var session = new MyCustomJingleSession({
    sid: 'sid123',
    peer<EMAIL_ADDRESS>    initiator: true
});

jingle.addSession(session);
```

#### `jingle.endAllSessions([reason], [silent])`

- `reason` - Why the sessions are being ended (see [`session.end()`](#sessionend) for the list of available reasons).
- `silent` - If `true`, then session terminating messages will not be generated to be sent to the peers. This is only intended for cases where you've lost network connection and would not be able to send those messages anyway.

```js
// End all sessions because we're about to go offline
jingle.endAllSessions('gone');
```

#### `jingle.endPeerSessions(peer, [reason], [silent])`

- `peer` - Either the `{JID}` or `{String}` value of the peer's ID.
- `reason` - Why the session is being ended (see [`session.end()`](#sessionend) for the list of available reasons).
- `reason` - Why the session is being ended. This may be either a `{String}` or an object:
    - `condition` - The name of the reason
    - `text` - A freeform description of the reason
    - `alternativeSession` - If the condition is `alternative-session`, this is the `sid` value for that session.
- `silent` - If `true`, the session terminate message will not be generated to be sent to the peer.

```js
// End sessions with a peer because we've successfully finished them.
<EMAIL_ADDRESS>'success');
```

#### `jingle.process(packet)`

- `packet` - An object representing an action to process & apply to a session.
    - `from` - The ID for the peer which sent the packet
    - `to` - Optional, this should be the ID for the session jingle
    - `id` - ID of the packet
    - `type` - One of: `set`, `result`, or `error`
    - `jingle` - This is the data that will be forwarded to the matching session
        - `sid` - The session ID
        - `action` - The action for the session to perform, using the data in `jingle`
    - `error` - Optional error object with a condition:
        - `condition` - The type of error
        - `jingleCondition` - A Jingle specific error condition, if applicable

The `.process()` method is the heart of how the Jingle module works. It verifies that the incoming packet is valid (e.g. preventing session hijacking or handling tie-breaking conditions), and then routes the packet to the matching session for further, session-type specific processing.

```js
jingle.process({
    to<EMAIL_ADDRESS>    from<EMAIL_ADDRESS>    id: '123',
    type: 'set',
    jingle: {
        sid: 'sidABC',
        action: 'session-initiate',
        contents: [
            {
                application: {applicationType: 'stub'},
                transport: {transportType: 'stub'}
            }
        ]
    }
});
```

### `Jingle` Events
#### `incoming`

The `incoming` event is triggered when a session initiation request is received from a peer.

```js
jingle.on('incoming', function (session) {
    // Auto-accept sessions
    session.accept();
});
```

#### `outgoing`

The `outgoing` event is triggered when a tracked session has its [`.start()`](#sessionstart) method called.

```js
jingle.on('outgoing', function (session) {
    renderOutgoingSessionUI(session);
});
```

#### `send`

The `send` event provides a Jingle packet suitable for sending to the peer. Each packet includes some routing information, an optional Jingle payload, and an optional error payload.

```js
jingle.on('send', function (data) {
    realtimeConnection.send(data, function (err, result) {
        // We want to process both successful acks, and errors
        var resp = err || result;

        // Ensure that we have the sid included in the ack so
        // that it routes properly to the correct session.
        resp.jingle = resp.jingle || {};
        resp.jingle.sid = data.jingle.sid;

        // Process the ack response
        jingle.process(resp);
    });
});
```

#### `terminated`

The `terminated` event is triggered when a session has been ended, either locally via the session's [`.end()`](#sessionendreason-silent) method, or from a session terminate action from the peer.

```js
jingle.on('terminated', function (session) {
    closeSessionUI();
});
```

#### `log:[error|debug|info]`

Log messages can be listened for with the `log:error`, `log:debug`, and `log:info` events.

```js
jingle.on('log:*', function (logLevel, msg) {
    console.log(logLevel, msg);
});
```


text:
# Introduction
Slides for Blue Green Deployment Live Coded Demo

[Launch the deck!](https://rp4fx12.github.io/blue-green/)

# About this deck
This deck was built using [deck.js](http://imakewebthings.github.com/deck.js)


text:
Humhub
======
![humhub](https://d9tready.com/_media/template-image/humhub3.png)

This application launches [HumHub](https://www.humhub.org/), an open-source social media platform.

How to Run
----------

1. Deploy the Backbone file:

```
spine deploy
```

2. Visit ```http://humhub-<your subdomain>.spi.ne```

repository: getspine/spine-examples

repo_name: getspine/spine-examples


text:
# Python 3 GCloud Docker image

This image is based on Alpine Linux 3.10 image. It contains Python 3, Python 2 and several GCloud components installed:

|     Status    |                         Name                         |            ID            |   Size   |
|---------------|------------------------------------------------------|--------------------------|----------|
| Installed     | BigQuery Command Line Tool                           | bq                       |  < 1 MiB |
| Installed     | Cloud Datastore Emulator                             | cloud-datastore-emulator | 18.4 MiB |
| Installed     | Cloud SDK Core Libraries                             | core                     | 12.5 MiB |
| Installed     | Cloud Storage Command Line Tool                      | gsutil                   |  3.6 MiB |
| Installed     | gcloud app Python Extensions                         | app-engine-python        |  6.0 MiB |
| Not Installed | App Engine Go Extensions                             | app-engine-go            |  4.9 MiB |
| Not Installed | Appctl                                               | appctl                   | 21.0 MiB |
| Not Installed | Cloud Bigtable Command Line Tool                     | cbt                      |  7.5 MiB |
| Not Installed | Cloud Bigtable Emulator                              | bigtable                 |  6.6 MiB |
| Not Installed | Cloud Datalab Command Line Tool                      | datalab                  |  < 1 MiB |
| Not Installed | Cloud Firestore Emulator                             | cloud-firestore-emulator | 40.0 MiB |
| Not Installed | Cloud Pub/Sub Emulator                               | pubsub-emulator          | 34.9 MiB |
| Not Installed | Cloud SQL Proxy                                      | cloud_sql_proxy          |  3.8 MiB |
| Not Installed | Emulator Reverse Proxy                               | emulator-reverse-proxy   | 14.5 MiB |
| Not Installed | Google Cloud Build Local Builder                     | cloud-build-local        |  6.0 MiB |
| Not Installed | Google Container Registry's Docker credential helper | docker-credential-gcr    |  1.8 MiB |
| Not Installed | Skaffold                                             | skaffold                 | 22.1 MiB |
| Not Installed | gcloud Alpha Commands                                | alpha                    |  < 1 MiB |
| Not Installed | gcloud Beta Commands                                 | beta                     |  < 1 MiB |
| Not Installed | gcloud app Java Extensions                           | app-engine-java          | 62.0 MiB |
| Not Installed | gcloud app PHP Extensions                            | app-engine-php           |          |
| Not Installed | gcloud app Python Extensions (Extra Libraries)       | app-engine-python-extras | 27.1 MiB |
| Not Installed | kubectl                                              | kubectl                  |  < 1 MiB |

Usage Example
-------------

```bash
$ docker run --rm vihos/gcloud gcloud components list
```

Once you have run this command you will get printed full list of components installed to GCloud SDK! Or use it interactivelly:

```bash
$ docker run -it --rm vihos/gcloud /bin/sh
```

repository: Vihos/gcloud

repo_name: Vihos/gcloud


text:
# Presentation - Alexa Building Blocks

These blocks allow you to generate a response to the user during runtime.

## `ax.ask()`

This block allows you to ask question to the user.

```ts
ax.ask("what is your name?").build();

// or
ax.ask("what is your name?")
  .reprompt("your name please")
  .build();

// or with SSML
ax.ask(
  ax
    .ssml("what is your name?")
    .effect(ssml.Effect.Whispered)
    .build()
)
  .reprompt("your name please")
  .build();
```

For SSML documentation, check [SSML](/additional-blocks).

## `ax.say()`

This block allows you to say something back to the user and then close the session.

```ts
ax.say("Hello!");

// or with SSML
ax.say(
  ax
    .ssml("Hello!")
    .effect(ssml.Effect.Whispered)
    .build()
);
```

For SSML documentation, check [SSML](/additional-blocks).

::: tip Tip
Notice that there is no `.build()` at the end of this block. Some simple blocks don't have `.build()`.
:::

## `ax.directive()`

This block allows you to return a raw directive back.

```ts
ax.directive({
  /** directive object */
});
```

## `ax.end()`

Similar to `ax.start()`, this block handles the `SessionEndedRequest` gracefully. Hence, it is important to add this block in your skill's terminal states.

## `ax.empty()`

Sometimes, you may not want to render any response back. This is useful when you want to handle the `SessionEndedRequest` using your own code. You can return this block after implementing your custom code.

## `ax.ssml()`

You can use `ax.ssml()` building block to build SSML (Speech Synthesis Markup Language) output speech. Learn about [SSML primitives here](https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html).

### `.voice()`

```ts
ax.ssml("hello")
  .voice(ssml.Voice.Brian)
  .build();
```

### `.domain()`

```ts
ax.ssml("Latest news: The conversational and news styles are now available!")
  .domain(ssml.Domain.news)
  .build();
```

### `.effect()`

```ts
ax.ssml("I am not a real human.")
  .effect(ssml.Effect.whispered)
  .build();
```

### `.emotion()`

```ts
ax.ssml("Christina wins this round!")
  .emotion(ssml.Emotion.excited, ssml.Intensity.medium)
  .build();
```

### `.appendAudio()`

```ts
ax.ssml("Welcome to Ride Hailer")
  .appendAudio("soundbank://soundlibrary/transportation/amzn_sfx_car_accelerate_01")
  .build();
```

### `.appendBreak()`

```ts
ax.ssml("There is a three second pause here")
  .appendBreak(3000) // 3 seconds break
  .append(ax.ssml("then the speech continues.").build())
  .build();
```

### `.emphasis()`

```ts
ax.ssml("I already told you I ")
  .append(
    ax
      .ssml("really like")
      .emphasis(ssml.EmphasisLevel.strong)
      .build()
  )
  .append(ax.ssml("that person.").build())
  .build();
```

### `.lang()`

```ts
ax.ssml("Paris")
  .lang(Locale.fr_FR)
  .build();
```

### `.paragraph()`

```ts
ax.ssml("This is a paragraph")
  .paragraph()
  .build();
```

### `.phoneme()`

```ts
ax.ssml("pecan")
  .phoneme(ssml.PhoneticAlphabet.ipa, "pɪˈkɑːn")
  .build();
```

### `.volume()`

```ts
ax.ssml("Hello!")
  .volume(ssml.Volume.loud)
  .build();
```

### `.pitch()`

```ts
ax.ssml("Hello!")
  .pitch(ssml.Pitch.medium)
  .build();
```

### `.rate()`

```ts
ax.ssml("Hello")
  .rate(ssml.Rate.medium)
  .build();
```

### `.sentence()`

```ts
ax.ssml("Hello")
  .sentence()
  .build();
```

### `.sayAs()`

```ts
ax.ssml("12345")
  .sayAs(ssml.Interpreters.digits)
  .build();
```

### `.sub()`

```ts
ax.ssml("al")
  .sub("aluminum")
  .build();
```

### `.wordRole()`

```ts
ax.ssml("read")
  .wordRole(ssml.WordRole.vbd)
  .build();
```

repository: chitchatjs/chitchatjs-docs

repo_name: chitchatjs/chitchatjs-docs


text:
# Trying out Reactive Extensions for a webapp server-side.

RXJS has changed how I write javascript user interfaces. This code was created to "kick the tyres"
and explore what I can do when using Reactive Extensions on the server side.

The talk i developed from this code was presented at DDD Sydney 2018 and can be viewed here:

https://www.youtube.com/watch?v=jE65d8b3w_M

repository: penleychan/rxdemo

repo_name: penleychan/rxdemo


text:
# trezor-crypto

Heavily optimized cryptography algorithms for embedded devices, modifiedd to function as an ESP32 component

These include:
- AES/Rijndael encryption/decryption
- Big Number (256 bit) Arithmetics
- BIP32 Hierarchical Deterministic Wallets
- BIP39 Mnemonic code
- ECDSA signing/verifying (supports secp256k1 and nist256p1 curves,
  uses RFC6979 for deterministic signatures)
- ECDSA public key derivation
- Base32 (RFC4648 and custom alphabets)
- Base58 address representation
- Ed25519 signing/verifying (also SHA3 and Keccak variants)
- ECDH using secp256k1, nist256p1 and Curve25519
- HMAC-SHA256 and HMAC-SHA512
- PBKDF2
- RIPEMD-160
- SHA1
- SHA2-256/SHA2-512
- SHA3/Keccak
- BLAKE2s/BLAKE2b
- Chacha20-Poly1305

Distibuted under MIT License.

## Some parts of the library come from external sources:

- Most of the library: https://github.com/trezor/trezor-crypto
- AES: https://github.com/BrianGladman/aes
- Base58: https://github.com/luke-jr/libbase58
- BLAKE2s/BLAKE2b: https://github.com/BLAKE2/BLAKE2
- RIPEMD-160: https://github.com/ARMmbed/mbedtls
- SHA1/SHA2: http://www.aarongifford.com/computers/sha.html
- SHA3: https://github.com/rhash/RHash
- Curve25519: https://github.com/agl/curve25519-donna
- Ed25519: https://github.com/floodyberry/ed25519-donna
- Chacha20: https://github.com/wg/c20p1305
- Poly1305: https://github.com/floodyberry/poly1305-donna

repository: arskanov/trezor-crypto

repo_name: arskanov/trezor-crypto


text:
# captcha-canvas

[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)

This is an npm package [captcha-canvas](https://npmjs.com/package/captcha-canvas) helps you to make custom captcha of all types. The package uses `skia-canvas` to create captcha imagas. See installation section to know how to install.

> Install skia-canvas before captcha-canvas installation. As skia-canvas is the peer dependencies.

[![captcha-canvas](https://nodei.co/npm/captcha-canvas.png)](https://npmjs.com/package/captcha-canvas)

#### Captcha Image:

![captcha](https://github.com/Shashank3736/captcha-canvas/raw/master/assets/captcha/default.png)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FShashank3736%2Fcaptcha-canvas.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FShashank3736%2Fcaptcha-canvas?ref=badge_shield)

### Features

* Highly customisable you can customise every single value use to make this package.
* 95% OCR fails to read this captcha image and throw Error.
* Use class constructor method so you can generate as many frames as many you want by using same values.
* No bundled dependencies. You need to install them to use the package.
* Support of background images is also possible.
* Captcha adapt all the external options very easily.

## How to use?
* **v2:** If you are using v2 [click here](https://captcha-canvas.js.org/v2/index.html) for documentation and examples.
* **v3:** If you are using v3 [click here](https://captcha-canvas.js.org) for documentation and examples.

> Note: v3 also contain alot of functions to create instant captcha like [`createCaptcha`](https://captcha-canvas.js.org/global.html#createCaptcha).

## Need Help:
Open an [issue](https://github.com/Shashank3736/captcha-canvas/issues) if you need help regarding this module or want to report any bug.

## Wanna support developer?

* Star the [github repo](https://github.com/Shashank3736/captcha-canvas) of the project. More stars motivate me to work on this project.

* Open an [issue](https://github.com/Shashank3736/captcha-canvas/issues) to recommend some new features or report bug regarding this module.

* For now, you don't have anyway to fund this project but maybe in future I update this.

## Supported versions
We always recommend you to use the most latest version for more methods and better performance.

If you are at v1.x.y and I launched a new version 2.0.0 do not update it. Because it is major change which may (basically always) break your present code or the output is not as expected.

If you are at same major change version but a new patch/minor changed version is available install without any fear. Usually minor change comes with some new methods, and patch release comes with bug fixes/updated readme.

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Shashank
📆

TheDeadCraftPT
🐛

IchiiDev
🐛

Ikramullah
📖 💻

ryanhex53
💻

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FShashank3736%2Fcaptcha-canvas.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FShashank3736%2Fcaptcha-canvas?ref=badge_large)

repository: cedececa/captcha-canvas

repo_name: cedececa/captcha-canvas