text:
package com.sduwh.match.controller.admin;

import com.sduwh.match.enums.MatchStage;
import com.sduwh.match.controller.base.BaseController;
import com.sduwh.match.common.ResponseResult;
import com.sduwh.match.enums.SupplyStatus;
import com.sduwh.match.model.entity.MatchInfo;
import com.sduwh.match.model.entity.MatchType;
import com.sduwh.match.model.entity.MatchType2;
import com.sduwh.match.model.to.MatchInfoTO;
import com.sduwh.match.model.wrapper.MatchInfoWrapper;
import com.sduwh.match.model.wrapper.MatchType2Wrapper;
import com.sduwh.match.model.wrapper.StageWrapper;
import com.sduwh.match.service.matchinfo.MatchInfoService;
import com.sduwh.match.service.matchitem.MatchItemService;
import com.sduwh.match.service.matchtype.MatchTypeService;
import com.sduwh.match.service.matchtype2.MatchType2Service;
import com.sduwh.match.service.stage.StageService;
import com.sduwh.match.util.TimestampFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * Created by qxg on 17-6-29.
 * 超级管理员的界面,控制比赛的阶段等数据的产生,查看所有数据,控制SRTP进度安排,生成校级评委,发布通知等功能
 */
@Controller
@RequestMapping("/admin")
public class AdminController extends BaseController{

    private static final String INDEX = "/admin/index";
    private static final String MATCHS = "/admin/matchs";
    private static final String MATCH_CREATE = "/admin/matchCreate";
    private static final String MATCH_TYPES = "/admin/matchtypes";
    private static final String MATCH_TYPES2 = "/admin/matchtypes2";

    @Autowired
    MatchInfoService matchInfoService;
    @Autowired
    StageService stageService;
    @Autowired
    MatchTypeService matchTypeService;
    @Autowired
    MatchType2Service matchType2Service;
    @Autowired
    MatchItemService matchItemService;

    /**
     * 访问主页,此处不需要任何判断,注意的是,需要在shiro过滤规则中添加只能admin访问
     */
    @GetMapping(value = {"/index", "/"})
    public String index() {
        return INDEX;
    }

    /** ====================================比赛管理start================================== **/
    /**
     * 比赛管理
     */
    @GetMapping("/matchs")
    public String matchs(Map<String, List<MatchInfo>> map) {
        //首先要获取所有比赛
        List<MatchInfo> matchInfoList = matchInfoService.selectAll();
        map.put("matchInfos", matchInfoList);
        return MATCHS;
    }

    /**
     * 获取MatchInfo的详细信息
     */
    @GetMapping("/match/{id}")
    @ResponseBody
    public MatchInfoWrapper getMatch(@PathVariable("id") Integer id) {
        MatchInfo matchInfo = matchInfoService.selectByPrimaryKey(id);
        MatchInfoWrapper wrapper = new MatchInfoWrapper();
        wrapper.setMatchInfo(matchInfo);
        wrapper.setAllStage(stageService.selectAllByString(matchInfo.getAllStage()));
        wrapper.setMatchType(matchTypeService.selectByPrimaryKey(matchInfo.getType1()));
        wrapper.setMatchType2(matchType2Service.selectByPrimaryKey(matchInfo.getType2()));
        return wrapper;
    }

    /**
     * 创建比赛
     */
    @GetMapping("/match/create")
    public String createMatch(Map<String, Object> map) {
        //首先要获取所有的阶段
        ArrayList<StageWrapper> list = new ArrayList<>();
        Arrays.stream(MatchStage.values())
                .map(e -> new StageWrapper(e.getDes(), e.getId(), false))
                .forEach(list::add);
        map.put("stages", list);
        return MATCH_CREATE;
    }

    /**
     * 创建比赛
     */
    @PostMapping("/match/create")
    @ResponseBody
    public ResponseResult startCreateMatch(ServletRequest servletRequest) {
        MatchInfoTO matchInfoTO = getMatchInfoTO(servletRequest);
        //检查比赛名是否已经被占用
        List<MatchInfo> list = matchInfoService.selectByName(matchInfoTO.getName());
        if(list != null && list.size()>=1){
            return fail(false,"该名字已被占用!");
        }
        matchInfoTO.setSupply(SupplyStatus.CLOSE_SUPPLY.getCode());
        //获得的类型是这样的
        //MatchInfoTO{name='2014-2015创青春创业大赛', type1=1, type2=1, level=1, leaderNum=2, leaderInNum=3, memberNum=4, memberInNum=5, teacherNum=6, teacherInNum=7, isChoose=[10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], type=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], startTime=[2017-01-01T01:01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], endTime=[2018-01-01T01:01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}
        System.out.println(matchInfoTO);
        //创建matchInfo
        if (matchInfoService.createMatchInfoByTO(matchInfoTO) == 1) {
            //创建成功
            return success(true);
        }
        return fail(false,"创建失败");
    }

    /** 更新比赛*/
    @PostMapping("/match/update")
    @ResponseBody
    public ResponseResult updateMatchInfo(ServletRequest servletRequest) {
        MatchInfoTO matchInfoTO = getMatchInfoTO(servletRequest);
        //更新matchInfo
        if (matchInfoService.updateMatchInfoByTO(matchInfoTO) == 1) {
            //更新成功
            return success(true);
        }
        return fail(false,"更新失败");
    }

    /** 删除比赛*/
    @GetMapping("/match/delete/{id}")
    @ResponseBody
    public ResponseResult deleteMatchInfo(@PathVariable("id") Integer id) {
        //删除该比赛对应的所有的比赛
        return success(matchInfoService.deleteAllOtherByMatchInfoId(id));
    }

    public MatchInfoTO getMatchInfoTO(ServletRequest servletRequest) {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        MatchInfoTO matchInfoTO = new MatchInfoTO();
        String id = request.getParameter("id");
        if (id != null) {
            matchInfoTO.setId(Integer.parseInt(id));
        }
        matchInfoTO.setInfoStartTime(TimestampFormatUtils.getTimestampFromString("yyyy-MM-dd hh:mm",request.getParameter("infoStartTime")));
        matchInfoTO.setInfoEndTime(TimestampFormatUtils.getTimestampFromString("yyyy-MM-dd hh:mm",request.getParameter("infoEndTime")));
        matchInfoTO.setName(request.getParameter("name"));
        matchInfoTO.setIsChoose(Arrays.stream(request.getParameterValues("isChoose[]")).map(Integer::parseInt).collect(Collectors.toList()));
        matchInfoTO.setLeaderInNum(Integer.parseInt(request.getParameter("leaderInNum")));
        matchInfoTO.setLevel(Integer.parseInt(request.getParameter("level")));
        matchInfoTO.setMemberInNum(Integer.parseInt(request.getParameter("memberInNum")));
        matchInfoTO.setLeaderNum(Integer.parseInt(request.getParameter("leaderNum")));
        matchInfoTO.setMemberNum(Integer.parseInt(request.getParameter("memberNum")));
        matchInfoTO.setTeacherNum(Integer.parseInt(request.getParameter("teacherNum")));
        matchInfoTO.setTeacherInNum(Integer.parseInt(request.getParameter("teacherInNum")));
        matchInfoTO.setStageName(Arrays.stream(request.getParameterValues("stageName[]")).collect(Collectors.toList()));
        matchInfoTO.setType1(Integer.parseInt(request.getParameter("type1")));
        if(request.getParameterMap().containsKey("supply")){
            matchInfoTO.setSupply(Integer.parseInt(request.getParameter("supply")));
        }else{
            matchInfoTO.setSupply(SupplyStatus.CLOSE_SUPPLY.getCode());
        }
        if(!"".equals(request.getParameter("type2")))
            matchInfoTO.setType2(Integer.parseInt(request.getParameter("type2")));

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm");
        matchInfoTO.setEndTime(Arrays.stream(request.getParameterValues("endTime[]")).map(e -> {
            if ("0".equals(e)) return null;
            try {
                return new Timestamp(sdf.parse(e).getTime());
            } catch (ParseException e1) {
                e1.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList()));

        matchInfoTO.setStartTime(Arrays.stream(request.getParameterValues("startTime[]")).map(e -> {
            if ("0".equals(e)) return null;
            try {
                return new Timestamp(sdf.parse(e).getTime());
            } catch (ParseException e1) {
                e1.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList()));
        System.out.println(matchInfoTO);
        return matchInfoTO;
    }
    /** ====================================比赛管理end================================== **/

    /** ===================================比赛类别管理start============================== **/
    /** 获取比赛类别信息*/
    @GetMapping("/matchtype")
    public String getMatchType(Map<String,List<MatchType>> map){
        map.put("types",matchTypeService.selectAll());
        return MATCH_TYPES;
    }

    /** 删除比赛类型*/
    @GetMapping("/matchtype/delete/{id}")
    @ResponseBody
    public ResponseResult deleteType1(@PathVariable("id") Integer id){
        //TODO 在删除类别的时候,首先要判断一下是否有其他比赛依赖这个比赛项目,如果依赖,前端判断是否要删除
        if(matchTypeService.deleteByPrimaryKey(id) == 1){
            return success(true);
        }

        return fail(false,"未知错误");
    }

    /** 创建比赛类型*/
    @GetMapping("/matchtype/create/{name}")
    @ResponseBody
    public ResponseResult createType1(@PathVariable("name") String name){
        System.out.println(name);
        if (matchTypeService.selectByName(name) == null){
            MatchType matchType = new MatchType();
            matchType.setName(name);
            System.out.println(matchTypeService.insert(matchType));
            return success(true);
        }else{
            return fail(false,"该名称已经存在");
        }
    }

    /** 查看二级比赛类型*/
    @GetMapping("/matchtype2")
    public String getMatchType2(Map<String,List<MatchType2Wrapper>> map){
        map.put("types",matchType2Service.selectALlType2Wrapper());
        return MATCH_TYPES2;
    }

    /** 删除二级比赛类型*/
    @GetMapping("/matchtype2/delete/{id}")
    @ResponseBody
    public ResponseResult deleteType2(@PathVariable("id") Integer id){
        //TODO 在删除类别的时候,首先要判断一下是否有其他比赛依赖这个比赛项目,如果依赖,前端判断是否要删除
        if(matchType2Service.deleteByPrimaryKey(id) == 1){
            return success(true);
        }
        return fail(false,"未知错误");
    }

    /** 创建二级比赛类型*/
    @GetMapping("/matchtype2/create/{name}/{type1}")
    @ResponseBody
    public ResponseResult createType2(@PathVariable("name")String name,@PathVariable("type1")Integer type1){
        MatchType2 matchType2 = new MatchType2();
        matchType2.setMatchTypeId(type1);
        matchType2.setName(name);
        if(matchType2Service.insert(matchType2) == 1)return success(true);
        else return fail(false,"插入失败");
    }

    /** ===================================比赛类别管理end============================== **/

}


text:
virtualenv ../docs_env
../docs_env/bin/pip install sphinx
../docs_env/bin/pip install sphinx-rtd-theme
rm -r ./html_docs/
../docs_env/bin/sphinx-build -b html ./docs/ ./html_docs/

redpajama_set_name: RedPajamaGithub


text:
========
Usage
========

To withdraw funds from an account with :func:`Yo.withdraw_funds`.

    from yo_payments import Yo

    yo_client = Yo(username,password)

    yo_client.withdraw_funds(amount, account , narrative)


text:
package org.apache.flink.table.planner.plan.nodes.calcite

import org.apache.flink.table.catalog.{ContextResolvedTable, ObjectIdentifier, ResolvedCatalogTable}
import org.apache.flink.table.connector.sink.DynamicTableSink
import org.apache.flink.table.planner.plan.utils.RelExplainUtil

import org.apache.calcite.plan.{RelOptCluster, RelTraitSet}
import org.apache.calcite.rel.`type`.RelDataType
import org.apache.calcite.rel.hint.RelHint
import org.apache.calcite.rel.{RelNode, RelWriter, SingleRel}

import java.util

import scala.collection.JavaConversions._

/**
 * Relational expression that writes out data of input node into a [[DynamicTableSink]].
 *
 * @param cluster  cluster that this relational expression belongs to
 * @param traitSet the traits of this rel
 * @param hints    the hints
 * @param input    input relational expression
 * @param contextResolvedTable the table definition.
 * @param catalogTable Resolved catalog table where this table source table comes from
 * @param tableSink the [[DynamicTableSink]] for which to write into
 */
abstract class Sink(
    cluster: RelOptCluster,
    traitSet: RelTraitSet,
    input: RelNode,
    val hints: util.List[RelHint],
    val contextResolvedTable: ContextResolvedTable,
    val tableSink: DynamicTableSink)
  extends SingleRel(cluster, traitSet, input) {

  override def deriveRowType(): RelDataType = {
    input.getRowType
  }

  override def explainTerms(pw: RelWriter): RelWriter = {
    super.explainTerms(pw)
      .item("table", contextResolvedTable.getIdentifier.asSummaryString())
      .item("fields", getRowType.getFieldNames.mkString(", "))
      .itemIf("hints", RelExplainUtil.hintsToString(hints), !hints.isEmpty)
  }
}


text:
This is the official Neo4j driver for JavaScript.

Starting with 5.0, the Neo4j Drivers will be moving to a monthly release cadence. A minor version will be released on the last Friday of each month so as to maintain versioning consistency with the core product (Neo4j DBMS) which has also moved to a monthly cadence.

As a policy, patch versions will not be released except on rare occasions. Bug fixes and updates will go into the latest minor version and users should upgrade to that. Driver upgrades within a major version will never contain breaking API changes.

See also: https://neo4j.com/developer/kb/neo4j-supported-versions/

Resources to get you started:

- [API Documentation](https://neo4j.com/docs/api/javascript-driver/current/)
- [Neo4j Manual](https://neo4j.com/docs/)
- [Neo4j Refcard](https://neo4j.com/docs/cypher-refcard/current/)

## What's New in 5.x

- [Changelog](https://github.com/neo4j/neo4j-javascript-driver/wiki/5.0-changelog)

## Including the Driver

### In Node.js application

Stable channel:

```shell
npm install neo4j-driver
```

Pre-release channel:

```shell
npm install neo4j-driver@next
```

Please note that `@next` only points to pre-releases that are not suitable for production use.
To get the latest stable release omit `@next` part altogether or use `@latest` instead.

```javascript
var neo4j = require('neo4j-driver')
```

Driver instance should be closed when Node.js application exits:

```javascript
driver.close() // returns a Promise
```

otherwise application shutdown might hang or it might exit with a non-zero exit code.

### In web browser

We build a special browser version of the driver, which supports connecting to Neo4j over WebSockets.
It can be included in an HTML page using one of the following tags:

```html
<!-- Direct reference -->
<script src="lib/browser/neo4j-web.min.js"></script>

<!-- unpkg CDN non-minified -->
<script src="https://unpkg.com/neo4j-driver"></script>
<!-- unpkg CDN minified for production use, version X.Y.Z -->
<script src="https://unpkg.com/neo4j-driver@X.Y.Z/lib/browser/neo4j-web.min.js"></script>

<!-- jsDelivr CDN non-minified -->
<script src="https://cdn.jsdelivr.net/npm/neo4j-driver"></script>
<!-- jsDelivr CDN minified for production use, version X.Y.Z -->
<script src="https://cdn.jsdelivr.net/npm/neo4j-driver@X.Y.Z/lib/browser/neo4j-web.min.js"></script>
```

This will make a global `neo4j` object available, where you can create a driver instance with `neo4j.driver`:

```javascript
var driver = neo4j.driver(
  'neo4j://localhost',
  neo4j.auth.basic('neo4j', 'password')
)
```

It is not required to explicitly close the driver on a web page. Web browser should gracefully close all open
WebSockets when the page is unloaded. However, driver instance should be explicitly closed when it's lifetime
is not the same as the lifetime of the web page:

```javascript
driver.close() // returns a Promise
```

## Usage examples

### Constructing a Driver

```javascript
// Create a driver instance, for the user `neo4j` with password `password`.
// It should be enough to have a single driver per database per application.
var driver = neo4j.driver(
  'neo4j://localhost',
  neo4j.auth.basic('neo4j', 'password')
)

// Close the driver when application exits.
// This closes all used network connections.
await driver.close()
```

### Acquiring a Session

#### Regular Session

```javascript
// Create a session to run Cypher statements in.
// Note: Always make sure to close sessions when you are done using them!
var session = driver.session()
```

##### with a Default Access Mode of `READ`

```javascript
var session = driver.session({ defaultAccessMode: neo4j.session.READ })
```

##### with Bookmarks

```javascript
var session = driver.session({
  bookmarks: [bookmark1FromPreviousSession, bookmark2FromPreviousSession]
})
```

##### against a Database

```javascript
var session = driver.session({
  database: 'foo',
  defaultAccessMode: neo4j.session.WRITE
})
```

#### Reactive Session

```javascript
// Create a reactive session to run Cypher statements in.
// Note: Always make sure to close sessions when you are done using them!
var rxSession = driver.rxSession()
```

##### with a Default Access Mode of `READ`

```javascript
var rxSession = driver.rxSession({ defaultAccessMode: neo4j.session.READ })
```

##### with Bookmarks

```javascript
var rxSession = driver.rxSession({
  bookmarks: [bookmark1FromPreviousSession, bookmark2FromPreviousSession]
})
```

##### against a Database

```javascript
var rxSession = driver.rxSession({
  database: 'foo',
  defaultAccessMode: neo4j.session.WRITE
})
```

### Executing Queries

#### Consuming Records with Streaming API

```javascript
// Run a Cypher statement, reading the result in a streaming manner as records arrive:
session
  .run('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', {
    nameParam: 'Alice'
  })
  .subscribe({
    onKeys: keys => {
      console.log(keys)
    },
    onNext: record => {
      console.log(record.get('name'))
    },
    onCompleted: () => {
      session.close() // returns a Promise
    },
    onError: error => {
      console.log(error)
    }
  })
```

Subscriber API allows following combinations of `onKeys`, `onNext`, `onCompleted` and `onError` callback invocations:

- zero or one `onKeys`,
- zero or more `onNext` followed by `onCompleted` when operation was successful. `onError` will not be invoked in this case
- zero or more `onNext` followed by `onError` when operation failed. Callback `onError` might be invoked after couple `onNext` invocations because records are streamed lazily by the database. `onCompleted` will not be invoked in this case.

#### Consuming Records with Promise API

```javascript
// the Promise way, where the complete result is collected before we act on it:
session
  .run('MERGE (james:Person {name : $nameParam}) RETURN james.name AS name', {
    nameParam: 'James'
  })
  .then(result => {
    result.records.forEach(record => {
      console.log(record.get('name'))
    })
  })
  .catch(error => {
    console.log(error)
  })
  .then(() => session.close())
```

#### Consuming Records with Reactive API

```javascript
rxSession
  .run('MERGE (james:Person {name: $nameParam}) RETURN james.name AS name', {
    nameParam: 'Bob'
  })
  .records()
  .pipe(
    map(record => record.get('name')),
    concatWith(rxSession.close())
  )
  .subscribe({
    next: data => console.log(data),
    complete: () => console.log('completed'),
    error: err => console.log(err)
  })
```

### Transaction functions

```javascript
// Transaction functions provide a convenient API with minimal boilerplate and
// retries on network fluctuations and transient errors. Maximum retry time is
// configured on the driver level and is 30 seconds by default:
// Applies both to standard and reactive sessions.
neo4j.driver('neo4j://localhost', neo4j.auth.basic('neo4j', 'password'), {
  maxTransactionRetryTime: 30000
})
```

#### Reading with Async Session

```javascript
// It is possible to execute read transactions that will benefit from automatic
// retries on both single instance ('bolt' URI scheme) and Causal Cluster
// ('neo4j' URI scheme) and will get automatic load balancing in cluster deployments
var readTxResultPromise = session.readTransaction(txc => {
  // used transaction will be committed automatically, no need for explicit commit/rollback

  var result = txc.run('MATCH (person:Person) RETURN person.name AS name')
  // at this point it is possible to either return the result or process it and return the
  // result of processing it is also possible to run more statements in the same transaction
  return result
})

// returned Promise can be later consumed like this:
readTxResultPromise
  .then(result => {
    console.log(result.records)
  })
  .catch(error => {
    console.log(error)
  })
  .then(() => session.close())
```

#### Reading with Reactive Session

```javascript
rxSession
  .readTransaction(txc =>
    txc
      .run('MATCH (person:Person) RETURN person.name AS name')
      .records()
      .pipe(map(record => record.get('name')))
  )
  .subscribe({
    next: data => console.log(data),
    complete: () => console.log('completed'),
    error: err => console.log(error)
  })
```

#### Writing with Async Session

```javascript
// It is possible to execute write transactions that will benefit from automatic retries
// on both single instance ('bolt' URI scheme) and Causal Cluster ('neo4j' URI scheme)
var writeTxResultPromise = session.writeTransaction(async txc => {
  // used transaction will be committed automatically, no need for explicit commit/rollback

  var result = await txc.run(
    "MERGE (alice:Person {name : 'Alice'}) RETURN alice.name AS name"
  )
  // at this point it is possible to either return the result or process it and return the
  // result of processing it is also possible to run more statements in the same transaction
  return result.records.map(record => record.get('name'))
})

// returned Promise can be later consumed like this:
writeTxResultPromise
  .then(namesArray => {
    console.log(namesArray)
  })
  .catch(error => {
    console.log(error)
  })
  .then(() => session.close())
```

#### Writing with Reactive Session

```javascript
rxSession
  .writeTransaction(txc =>
    txc
      .run("MERGE (alice:Person {name: 'James'}) RETURN alice.name AS name")
      .records()
      .pipe(map(record => record.get('name')))
  )
  .subscribe({
    next: data => console.log(data),
    complete: () => console.log('completed'),
    error: error => console.log(error)
  })
```

### Explicit Transactions

#### With Async Session

```javascript
// run statement in a transaction
const txc = session.beginTransaction()
try {
  const result1 = await txc.run(
    'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
    {
      nameParam: 'Bob'
    }
  )
  result1.records.forEach(r => console.log(r.get('name')))
  console.log('First query completed')

  const result2 = await txc.run(
    'MERGE (adam:Person {name: $nameParam}) RETURN adam.name AS name',
    {
      nameParam: 'Adam'
    }
  )
  result2.records.forEach(r => console.log(r.get('name')))
  console.log('Second query completed')

  await txc.commit()
  console.log('committed')
} catch (error) {
  console.log(error)
  await txc.rollback()
  console.log('rolled back')
} finally {
  await session.close()
}
```

#### With Reactive Session

```javascript
rxSession
  .beginTransaction()
  .pipe(
    mergeMap(txc =>
      concatWith(
        txc
          .run(
            'MERGE (bob:Person {name: $nameParam}) RETURN bob.name AS name',
            {
              nameParam: 'Bob'
            }
          )
          .records()
          .pipe(map(r => r.get('name'))),
        of('First query completed'),
        txc
          .run(
            'MERGE (adam:Person {name: $nameParam}) RETURN adam.name AS name',
            {
              nameParam: 'Adam'
            }
          )
          .records()
          .pipe(map(r => r.get('name'))),
        of('Second query completed'),
        txc.commit(),
        of('committed')
      ).pipe(catchError(err => txc.rollback().pipe(throwError(() => err))))
    )
  )
  .subscribe({
    next: data => console.log(data),
    complete: () => console.log('completed'),
    error: error => console.log(error)
  })
```

### Numbers and the Integer type

The Neo4j type system uses 64-bit signed integer values. The range of values is between `-(2`<sup>`64`</sup>`- 1)` and `(2`<sup>`63`</sup>`- 1)`.

However, JavaScript can only safely represent integers between `Number.MIN_SAFE_INTEGER` `-(2`<sup>`53`</sup>`- 1)` and `Number.MAX_SAFE_INTEGER` `(2`<sup>`53`</sup>`- 1)`.

In order to support the full Neo4j type system, the driver will not automatically convert to javascript integers.
Any time the driver receives an integer value from Neo4j, it will be represented with an internal integer type by the driver.

_**Any javascript number value passed as a parameter will be recognized as `Float` type.**_

#### Writing integers

Numbers written directly e.g. `session.run("CREATE (n:Node {age: $age})", {age: 22})` will be of type `Float` in Neo4j.

To write the `age` as an integer the `neo4j.int` method should be used:

```javascript
var neo4j = require('neo4j-driver')

session.run('CREATE (n {age: $myIntParam})', { myIntParam: neo4j.int(22) })
```

To write an integer value that are not within the range of `Number.MIN_SAFE_INTEGER` `-(2`<sup>`53`</sup>`- 1)` and `Number.MAX_SAFE_INTEGER` `(2`<sup>`53`</sup>`- 1)`, use a string argument to `neo4j.int`:

```javascript
session.run('CREATE (n {age: $myIntParam})', {
  myIntParam: neo4j.int('9223372036854775807')
})
```

#### Reading integers

In Neo4j, the type Integer can be larger what can be represented safely as an integer with JavaScript Number.

It is only safe to convert to a JavaScript Number if you know that the number will be in the range `Number.MIN_SAFE_INTEGER` `-(2`<sup>`53`</sup>`- 1)` and `Number.MAX_SAFE_INTEGER` `(2`<sup>`53`</sup>`- 1)`.

In order to facilitate working with integers the driver include `neo4j.isInt`, `neo4j.integer.inSafeRange`, `neo4j.integer.toNumber`, and `neo4j.integer.toString`.

```javascript
var smallInteger = neo4j.int(123)
if (neo4j.integer.inSafeRange(smallInteger)) {
  var aNumber = smallInteger.toNumber()
}
```

If you will be handling integers that is not within the JavaScript safe range of integers, you should convert the value to a string:

```javascript
var largeInteger = neo4j.int('9223372036854775807')
if (!neo4j.integer.inSafeRange(largeInteger)) {
  var integerAsString = largeInteger.toString()
}
```

#### Enabling native numbers

Starting from 1.6 version of the driver it is possible to configure it to only return native numbers instead of custom `Integer` objects.
The configuration option affects all integers returned by the driver. **Enabling this option can result in a loss of precision and incorrect numeric
values being returned if the database contains integer numbers outside of the range** `[Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]`.
To enable potentially lossy integer values use the driver's configuration object:

```javascript
var driver = neo4j.driver(
  'neo4j://localhost',
  neo4j.auth.basic('neo4j', 'password'),
  { disableLosslessIntegers: true }
)
```

## Building

```
npm ci
npm run build
```

This produces browser-compatible standalone files under `lib/browser` and a Node.js module version under `lib/`.
See files under `examples/` on how to use.

## Testing

Tests **require** latest [Testkit 4.3](https://github.com/neo4j-drivers/testkit/tree/4.3), Python3 and Docker.

Testkit is needed to be cloned and configured to run against the Javascript Lite Driver. Use the following steps to configure Testkit.

1. Clone the Testkit repository

```
git clone https://github.com/neo4j-drivers/testkit.git
```

2. Under the Testkit folder, install the requirements.

```
pip3 install -r requirements.txt
```

3. Define some enviroment variables to configure Testkit

```
export TEST_DRIVER_NAME=javascript
export TEST_DRIVER_REPO=<path for the root folder of driver repository>
unset TEST_DRIVER_LITE
```

To run test against against some Neo4j version:

```
python3 main.py
```

More details about how to use Teskit could be found on [its repository](https://github.com/neo4j-drivers/testkit/tree/4.3)

## Testing (Legacy)

Tests **require** latest [Boltkit](https://github.com/neo4j-contrib/boltkit) and [Firefox](https://www.mozilla.org/firefox/) to be installed in the system.

Boltkit is needed to start, stop and configure local test database. Boltkit can be installed with the following command:

```
pip3 install --upgrade boltkit
```

To run tests against "default" Neo4j version:

```
./runTests.sh
```

To run tests against specified Neo4j version:

```
./runTests.sh '-e 4.2.0'
```

Simple `npm test` can also be used if you already have a running version of a compatible Neo4j server.

For development, you can have the build tool rerun the tests each time you change
the source code:

```
gulp watch-n-test
```

If the `gulp` command line tool is not available, you might need to install this globally:

```
npm install -g gulp-cli
```

### Testing on windows

To run the same test suite, run `.\runTest.ps1` instead in powershell with admin right.
The admin right is required to start/stop Neo4j properly as a system service.
While there is no need to grab admin right if you are running tests against an existing Neo4j server using `npm test`.


text:
require 'rubygems'
require 'net/http'
require 'nokogiri'
require 'twitter'
require 'yaml'

wtth_path = File.join(File.expand_path(File.dirname(__FILE__)), 'wtth')
require File.join(wtth_path, 'config')
require File.join(wtth_path, 'twitter')

module WTTH
  VERSION = '1.2.1'

  def self.init
    load_config
    twitter_init
  end

  def self.update
    load_config

    unless twitter_is_authorized?
      puts 'You have not yet authorized WTTH to access Twitter.'
      puts 'Please run `wtth init` first'
      exit 1
    end

    # get new zombies and zombies that weren't reported last time
    to_welcome = CONFIG[:backlog]
    if to_welcome == nil
      to_welcome = get_new_zombies
    elsif to_welcome.join(', ').length < 140
      to_welcome = get_new_zombies + to_welcome
    end

    if to_welcome != []
      this_batch = []
      recovery = []
      size = 0

      # get the least recent kills, no more than 140 characters worth
      until size > 140 or to_welcome.empty?
        zombie = to_welcome.last
        size += zombie.length
        size += 2 if this_batch.length > 0
        if size <= 140
          this_batch << zombie
          recovery << to_welcome.pop
        end
      end

      # remember who we haven't reported
      CONFIG[:backlog] = to_welcome

      # welcome with the most recent first so things are in order on twitter
      this_batch.reverse!

      begin
        tweet(this_batch.join(', '))
      rescue Twitter::TwitterUnavailable
        puts "TwitterUnavailable #{$!}"
        # throw the message onto the backlog so we can try again next time
        CONFIG[:backlog] = to_welcome + recovery.reverse
      rescue Twitter::TwitterError
        puts "TwitterError #{$!}"
        # throw the message onto the backlog so we can try again next time
        CONFIG[:backlog] = to_welcome + recovery.reverse
      end
    end

    save_config
  end
end


text:
#include "./ShapeSphere.hpp"
#include "math/misc.hpp"
#include "math/Sphere.hpp"
#include "math/sampling.hpp"
#include <cmath>

#include "Rng.hpp"

using namespace yks;

Optional<float> ShapeSphere::hasIntersection(const Ray& r) const {
	const Ray local_ray = transform.localFromParent * r;
	return intersect_with_sphere(vec3_0, radius, local_ray);
}

Optional<Intersection> ShapeSphere::intersect(const Ray& r) const {
	const Ray local_ray = transform.localFromParent * r;
	const Optional<float> intersection = intersect_with_sphere(vec3_0, radius, local_ray);

	if (!intersection) {
		return Optional<Intersection>();
	}
	const float t = *intersection;

	Intersection i;
	i.t = t;
	i.position = r(t);
	vec3 local_pos = local_ray(t);
	i.uv = mvec2(std::atan2(local_pos[2], local_pos[0]) / (2*pi) + 0.5f, std::acos(local_pos[1]) / pi);
	i.normal = normalized(mvec3(transpose(transform.localFromParent) * mvec4(local_ray(t), 0.0f)));
	return make_optional<Intersection>(i);
}

ShapeSample ShapeSphere::sampleArea(Rng& rng) const {
	const float a = rng.canonical();
	const float b = rng.canonical();
	return ShapeSample{
		mvec3(transform.parentFromLocal * mvec4(uniform_point_on_sphere(a, b) * radius, 1.0f)),
		1.0f / (4.0f * pi * sqr(radius)),
	};
}

//! Samples a random point on the surface of the sphere that is visible from \a source.
ShapeSample ShapeSphere::sampleArea(Rng& rng, const yks::vec3& source) const {
	const vec3 origin = mvec3(transform.parentFromLocal * mvec4(vec3_0, 1.0f));
	const float distance = length(source - origin);

	//! If the source point is inside the sphere, we fall back to sampling the
	//! entire sphere area by calling to \c sampleArea.
	if (distance <= radius) {
		return sampleArea(rng);
	}

	const float a = rng.canonical();
	const float b = rng.canonical();

	//! ![Sampling the visible cone on a sphere.](sphere_sampleAreaFromPoint.svg)
	//!
	//! Otherwise, we have to sample a cone of directions that are visible from
	//! the given source point. Notice that the highlighted red cone viewing
	//! from inside the sphere subtends the same points that would be visible
	//! from a cone starting from P and looking at the sphere.
	//!
	//! We need to find the angle \f$\theta\f$ of the cone (highlighted in red)
	//! which subtends the area visible from outside the sphere. The center of
	//! the sampled circle (\f$C\f$), the tangent point and the source point
	//! (\f$P\f$) form a right triangle and thus we can use trigonometry to find
	//! \f$\theta\f$: The sphere radius \f$r\f$ is the adjacent length of the
	//! triangle, while the distance \f$d\f$ between \f$P\f$ and \f$C\f$ is the
	//! hypotenuse. Thus, \f$\cos \theta = \frac{r}{d}\f$.
	const float cos_theta = radius / distance;

	//! The function \c uniform_vector_in_cone is used to sample the cone.
	const vec3 local_vec = uniform_vector_in_cone(a, b, cos_theta) * radius;
	//! Since \c uniform_vector_in_cone returns a vector around the cone
	//! pointing towards the y-axis, the vector is reoriented to point correctly
	//! towards the source point.
	const vec3 world_vec = reorient_vector(local_vec, source - origin) + origin;

	return ShapeSample{
		world_vec,
		//! The pdf is constant across the cone and can be calculated by
		//! integrating the area of its cap:
		/*! \f[
			\int_0^{2\pi} \int_0^{\theta} r^2 \sin \theta' d\theta' d\phi
			= 2\pi r^2 (1 - \cos \theta)
		\f] */
		1.0f / (two_pi * sqr(radius) * (1.0f - cos_theta))
	};
}

float ShapeSphere::areaPdf(const yks::vec3& /* dir */) const {
	return 1.0f / (4.0f * pi * sqr(radius));
}

float ShapeSphere::areaPdf(const yks::vec3& source, const yks::vec3& dir) const {
	const vec3 origin = mvec3(transform.parentFromLocal * mvec4(vec3_0, 1.0f));
	const float distance = length(source - origin);

	if (distance <= radius) {
		return areaPdf(dir);
	}

	const float cos_theta = radius / distance;
	return 1.0f / (two_pi * sqr(radius) * (1.0f - cos_theta));
}


text:
package wikokit.base.wikt.sql.quote;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

/** Year of quotation and
 * operations with the table 'quot_year' in MySQL Wiktionary parsed database. */
public class TQuotYear {

    /** Inique identifier of the year(s). */
    private int id;

    /** Start date of a writing book with the quote. */
    private int from;

    /** End date of a writing book with the quote,
     * if quote contains only one date, then to = from. */
    private int to;

    public TQuotYear(int _id,int _from,int _to)
    {
        id      = _id;
        from    = _from;
        to      = _to;
    }

    public TQuotYear(int _id,int _from)
    {
        id      = _id;
        from    = _from;
        to      = _from;
    }

    /** Gets unique ID from database */
    public int getID() {
        return id;
    }

    /** Gets start date of a writing book with the quote. */
    public int getFrom() {
        return from;
    }

    /** Gets finish date of a writing book with the quote. */
    public int getTo() {
        return to;
    }

    /** Inserts record into the table 'quot_year'.

     * INSERT INTO quot_year (`from`,`to`) VALUES (1956,1956);
     *
     * @param _from start date of a writing book with the quote
     * @param _to finish date of a writing book with the quote
     * @return inserted record, or null if the insertion failed
     */
    /*public static TQuotYear insert (Connect connect,int _from) {
        return insert(connect, _from, _from);
    }*/

    /** Inserts record into the table 'quot_year'.

     * INSERT INTO quot_year (`from`,`to`) VALUES (1956,1988);
     *
     * @param _from start date of a writing book with the quote
     * @param _to finish date of a writing book with the quote
     * @return inserted record, or null if the insertion failed
     */
    /*public static TQuotYear insert (Connect connect,int _from,int _to) {

        if(-1 == _from || -1 == _to) // it means that there is no info about years
            return null;

        if(_from < 0 || _to < 0 || _from > _to) {
            System.out.println("Warning (TQuotYear.insert()):: invalid years: from='"+_from+"', to='"+_to+"'.");
            return null;
        }
        StringBuilder str_sql = new StringBuilder();
        str_sql.append("INSERT INTO quot_year (`from`,`to`) VALUES (");
        str_sql.append(_from);
        str_sql.append(",");
        str_sql.append(_to);
        str_sql.append(")");
        TQuotYear result = null;
        try
        {
            Statement s = connect.conn.createStatement ();
            try {
                s.executeUpdate (str_sql.toString());
            } finally {
                s.close();
            }

            s = connect.conn.createStatement ();
            try {
                ResultSet rs = s.executeQuery ("SELECT LAST_INSERT_ID() as id");
                try {
                    if (rs.next ())
                        result = new TQuotYear(rs.getInt("id"), _from, _to);
                } finally {
                    rs.close();
                }
            } finally {
                s.close();
            }
        }catch(SQLException ex) {
            System.err.println("SQLException (TQuotYear.insert):: _from="+_from+"; _to="+_to+"; sql='" + str_sql.toString() + "' error=" + ex.getMessage());
        }
        return result;
    }*/

    /** Selects row from the table 'quot_year' by ID.

     *
     * SELECT `from`,`to` FROM quot_year WHERE id=1
     *
     * @return null if data is absent
     */
    public static TQuotYear getByID (SQLiteDatabase db,int _id) {

        TQuotYear quot_year = null;

        if(_id <= 0)
            return null;

        // SELECT `from`,`to` FROM quot_year WHERE id=1
        Cursor c = db.query("quot_year",
                new String[] { "`from`", "`to`" }, // attention: + apostrophes for SQL keywords
                "id=" + _id,
                null, null, null, null);

        if (c.moveToFirst()) {
            int i_from = c.getColumnIndexOrThrow("from");
            int i_to   = c.getColumnIndexOrThrow("to");
            int _from = c.getInt(i_from);
            int _to   = c.getInt(i_to);

            quot_year = new TQuotYear(_id, _from, _to);
        }
        if (c != null && !c.isClosed()) {
           c.close();
        }
        return quot_year;
    }

    /** Get's a record from the table 'quot_year' by a date of a book with a quote.

     * SELECT id FROM quot_year WHERE `from`=1956 AND `to`=1956;
     *
     * @param _text name of the source
     * @return NULL if data is absent
     */
    public static TQuotYear get (SQLiteDatabase db,int _from, String page_title) {
        return get(db, _from, _from, page_title);
    }

    /** Get's a record from the table 'quot_year' by a date of a book with a quote.

     * SELECT id FROM quot_year WHERE `from`=1956 AND `to`=1988;
     *
     * @param page_title word which are described in this article
     * @return NULL if data is absent
     */
    public static TQuotYear get (SQLiteDatabase db,int _from,int _to, String page_title) {

        TQuotYear result = null;

        if(_from < 0 || _to < 0 || _from > _to) {
            System.out.println("Warning (TQuotYear.get()):: entry '" + page_title + "', invalid years: from='"+_from+"', to='"+_to+"'.");
            return null;
        }

        // SELECT id FROM quot_year WHERE `from`=1970 AND `to`=1977;
        Cursor c = db.query("quot_year",
                new String[] { "id" },
                "`from`=" + _from+ " AND `to`=" + _to,
                null, null, null, null);

        if (c.moveToFirst()) {
            int i_id = c.getColumnIndexOrThrow("id");
            int _id = c.getInt(i_id);

            result = new TQuotYear(_id, _from, _to);
        }
        if (c != null && !c.isClosed()) {
            c.close();
        }
        return result;
    }

    /** Gets ID of a record or inserts record (if it is absent)
     * into the table 'quot_year'.
     *
     * @param _from start date of a writing book with the quote
     * @param _to finish date of a writing book with the quote
     * @param page_title word which are described in this article
     */
    /*public static TQuotYear getOrInsert (Connect connect,int _from,int _to, String page_title) {

        if(-1 == _from || -1 == _to) // it means that there is no info about years
            return null;

        if(_from < 0 || _to < 0 || _from > _to) {
            System.out.println("Warning (TQuotYear.getOrInsert()):: invalid years: from='"+_from+"', to='"+_to+"', for the word '" + page_title + "'.");
            return null;
        }

        TQuotYear y = TQuotYear.get(connect, _from, _to, page_title);
        if(null == y)
            y = TQuotYear.insert(connect, _from, _to);
        return y;
    }*/

    /** Deletes row from the table 'quot_year' by a value of ID.

     * DELETE FROM quot_year WHERE id=4;
     */
    /*public void delete (Connect connect) {

        StringBuilder str_sql = new StringBuilder();
        str_sql.append("DELETE FROM quot_year WHERE id=");
        str_sql.append( id );
        try {
            Statement s = connect.conn.createStatement ();
            try {
                s.execute (str_sql.toString());
            } finally {
                s.close();
            }
        } catch(SQLException ex) {
            System.err.println("SQLException (TQuotYear.delete()):: sql='" + str_sql.toString() + "' " + ex.getMessage());
        }
    }*/
}


text:
package org.jetbrains.plugins.groovy.codeInspection.confusing;

import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrReassignedLocalVarsChecker;
import org.jetbrains.plugins.groovy.codeInspection.BaseInspection;
import org.jetbrains.plugins.groovy.codeInspection.BaseInspectionVisitor;
import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils;
import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner;
import org.jetbrains.plugins.groovy.lang.psi.GrNamedElement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;

/**
 * @author Max Medvedev
 */
public class GrReassignedInClosureLocalVarInspection extends BaseInspection {

  @Override
  @Nls
  @NotNull
  public String getGroupDisplayName() {
    return CONFUSING_CODE_CONSTRUCTS;
  }

  @Override
  @Nls
  @NotNull
  public String getDisplayName() {
    return "Local variable is reassigned in closure or anonymous class";
  }

  @Override
  public boolean isEnabledByDefault() {
    return true;
  }

  @NotNull
  @Override
  protected BaseInspectionVisitor buildVisitor() {
    return new BaseInspectionVisitor() {
      @Override
      public void visitReferenceExpression(GrReferenceExpression referenceExpression) {
        super.visitReferenceExpression(referenceExpression);

        if (!PsiUtil.isLValue(referenceExpression)) return;
        final PsiElement resolved = referenceExpression.resolve();
        if (!PsiUtil.isLocalVariable(resolved)) return;

        final PsiType checked = GrReassignedLocalVarsChecker.getReassignedVarType(referenceExpression, false);
        if (checked == null) return;

        final GrControlFlowOwner varFlowOwner = ControlFlowUtils.findControlFlowOwner(resolved);
        final GrControlFlowOwner refFlorOwner = ControlFlowUtils.findControlFlowOwner(referenceExpression);
        if (isOtherScopeAndType(referenceExpression, checked, varFlowOwner, refFlorOwner)) {
          String flowDescription = getFlowDescription(refFlorOwner);
          final String message = GroovyInspectionBundle
            .message("local.var.0.is.reassigned", ((GrNamedElement)resolved).getName(), flowDescription);
          registerError(referenceExpression, message, LocalQuickFix.EMPTY_ARRAY, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
        }
      }
    };
  }

  private static boolean isOtherScopeAndType(GrReferenceExpression referenceExpression,
                                             PsiType checked,
                                             GrControlFlowOwner varFlowOwner,
                                             GrControlFlowOwner refFlorOwner) {
    return varFlowOwner != refFlorOwner && !TypesUtil.isAssignable(referenceExpression.getType(), checked, referenceExpression);
  }

  private static String getFlowDescription(GrControlFlowOwner refFlorOwner) {
    String flowDescription;
    if (refFlorOwner instanceof GrClosableBlock) {
      flowDescription = GroovyInspectionBundle.message("closure");
    }
    else if (refFlorOwner instanceof GrAnonymousClassDefinition) {
      flowDescription = GroovyInspectionBundle.message("anonymous.class");
    }
    else {
      flowDescription = GroovyInspectionBundle.message("other.scope");
    }
    return flowDescription;
  }
}


text:
import logging

class Singleton:
  """
  A non-thread-safe helper class to ease implementing singletons.
  This should be used as a decorator -- not a metaclass -- to the
  class that should be a singleton.

  The decorated class can define one `__init__` function that
  takes only the `self` argument. Other than that, there are
  no restrictions that apply to the decorated class.

  To get the singleton instance, use the `Instance` method. Trying
  to use `__call__` will result in a `TypeError` being raised.

  Limitations: The decorated class cannot be inherited from.

  """

  def __init__(self, decorated):
    self._decorated = decorated

  def instance(self):
    """
    Returns the singleton instance. Upon its first call, it creates a
    new instance of the decorated class and calls its `__init__` method.
    On all subsequent calls, the already created instance is returned.

    """
    try:
      return self._instance
    except AttributeError:
      self._instance = self._decorated()
      return self._instance

  def __call__(self):
    logging.error('Singletons must be accessed through `Instance()`.')
    raise TypeError('Singletons must be accessed through `Instance()`.')

  def __instancecheck__(self, inst):
    return isinstance(inst, self._decorated)


text:
categories:
- tumblr
- archive
- video
date: 2008-01-26T04:07:14Z
title: Video 20080126
url: /2008/01/26/video-20080126/
---

<iframe width="500" height="375"  id="youtube_iframe" src="https://www.youtube.com/embed/mZ3k9xCSqnA?feature=oembed&enablejsapi=1&origin=https://safe.txmblr.com&wmode=opaque" frameborder="0" allowfullscreen></iframe>

Triosk Live @ Firlej (Wrocław, Poland)


text:
module RubyShift

  class API < Request
    attr_accessor(*Configuration::VALID_OPTIONS_KEYS)

    # Creates a new API.
    # @raise [Error:MissingCredentials]
    def initialize(options={})
      options = RubyShift.options.merge(options)
      (Configuration::VALID_OPTIONS_KEYS + [:access_token]).each do |key|
        send("#{key}=", options[key]) if options[key]
      end
      set_request_defaults
    end
  end
end


text:
/** Automatically generated file. DO NOT MODIFY */
package edu.cs4730.webView;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="Content-Language" content="en-us" />
  <meta http-equiv="imagetoolbar" content="false" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <title>One more week before the "Add team member" API breaking change | GitHub Developer Guide</title>

  <link rel="alternate" type="application/atom+xml" title="API Changes" href="/changes.atom" />

  <link href="/assets/stylesheets/application.css" rel="stylesheet" type="text/css" />

      EEme:Developer

  One more week before the "Add team member" API breaking change

    September 23, 2014

      jakeboxer

UPDATE (2014-09-30): In response to feedback from developers, we're delaying the breaking change to the "Add team member" API until Monday, October 6, 2014. The change will go into effect for all requests on that date.

Starting October 6, if you use the "Add team member" API to add a user to a team and that user isn't already on another team in your organization, the request will fail. To avoid this, be sure to use the "Add team membership" API.

The Organization and Team Membership APIs are now official

As promised in our blog post earlier this month, the Organization Membership and Team Membership APIs are now an official part of the GitHub API! The preview media type is no longer required to access them.

If you have any questions or feedback, please get in touch with us!

Recent Posts

API changes for Repository Invitations
June 14, 2016

Reactions API Preview now includes user information
June 7, 2016

API changes for Multiple Issue Assignees
May 27, 2016

Preview the Timeline API
May 23, 2016

Preview support for Reactions API
May 12, 2016

Source Import API enhancements for working with Git LFS
May 3, 2016

Preview support for OAuth authorizations grants API
April 21, 2016

New webhook event actions are now live
April 18, 2016

Subscribe to the RSS feed


text:
<!DOCTYPE html>

  <title>angular-component-demo</title>

  <link rel="stylesheet" href="/bundle.css">

Atomic Angular Demo

  <demo-component list="people"></demo-component>


text:
package io.crate.executor.transport;

import com.google.common.collect.ImmutableList;
import io.crate.analyze.QuerySpec;
import io.crate.analyze.WhereClause;
import io.crate.analyze.where.DocKeys;
import io.crate.integrationtests.SQLTransportIntegrationTest;
import io.crate.integrationtests.Setup;
import io.crate.metadata.ColumnIdent;
import io.crate.metadata.ReferenceIdent;
import io.crate.metadata.ReferenceInfo;
import io.crate.metadata.TableIdent;
import io.crate.metadata.doc.DocSchemaInfo;
import io.crate.metadata.doc.DocTableInfo;
import io.crate.planner.Planner;
import io.crate.planner.RowGranularity;
import io.crate.planner.node.dql.ESGetNode;
import io.crate.planner.symbol.Literal;
import io.crate.planner.symbol.Reference;
import io.crate.planner.symbol.Symbol;
import io.crate.testing.TestingHelpers;
import io.crate.types.DataTypes;
import org.junit.After;
import org.junit.Before;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

public class BaseTransportExecutorTest extends SQLTransportIntegrationTest {

    Setup setup = new Setup(sqlExecutor);

    static {
        ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
    }

    TransportExecutor executor;
    DocSchemaInfo docSchemaInfo;

    TableIdent charactersIdent = new TableIdent(null, "characters");
    TableIdent booksIdent = new TableIdent(null, "books");

    Reference idRef = new Reference(new ReferenceInfo(
            new ReferenceIdent(charactersIdent, "id"), RowGranularity.DOC, DataTypes.INTEGER));
    Reference nameRef = new Reference(new ReferenceInfo(
            new ReferenceIdent(charactersIdent, "name"), RowGranularity.DOC, DataTypes.STRING));
    Reference femaleRef = TestingHelpers.createReference(charactersIdent.name(), new ColumnIdent("female"), DataTypes.BOOLEAN);

    TableIdent partedTable = new TableIdent("doc", "parted");
    Reference partedIdRef = new Reference(new ReferenceInfo(
            new ReferenceIdent(partedTable, "id"), RowGranularity.DOC, DataTypes.INTEGER));
    Reference partedNameRef = new Reference(new ReferenceInfo(
            new ReferenceIdent(partedTable, "name"), RowGranularity.DOC, DataTypes.STRING));
    Reference partedDateRef = new Reference(new ReferenceInfo(
            new ReferenceIdent(partedTable, "date"), RowGranularity.PARTITION, DataTypes.TIMESTAMP));

    public static ESGetNode newGetNode(DocTableInfo tableInfo, List<Symbol> outputs, List<String> singleStringKeys, int executionNodeId) {
        QuerySpec querySpec = new QuerySpec();
        querySpec.outputs(outputs);
        List<List<Symbol>> keys = new ArrayList<>(singleStringKeys.size());
        for (String v : singleStringKeys) {
            keys.add(ImmutableList.<Symbol>of(Literal.newLiteral(v)));
        }
        WhereClause whereClause = new WhereClause(null, new DocKeys(keys, false, -1, null), null);
        querySpec.where(whereClause);
        return new ESGetNode(executionNodeId, tableInfo, querySpec, UUID.randomUUID());
    }

    @Before
    public void transportSetUp() {
        executor = internalCluster().getInstance(TransportExecutor.class);
        docSchemaInfo = internalCluster().getInstance(DocSchemaInfo.class);
    }

    @After
    public void transportTearDown() {
        executor = null;
        docSchemaInfo = null;
    }

    protected ESGetNode newGetNode(String tableName, List<Symbol> outputs, String singleStringKey, int executionNodeId) {
        return newGetNode(tableName, outputs, Collections.singletonList(singleStringKey), executionNodeId);
    }

    protected ESGetNode newGetNode(String tableName, List<Symbol> outputs, List<String> singleStringKeys, int executionNodeId) {
        return newGetNode(docSchemaInfo.getTableInfo(tableName), outputs, singleStringKeys, executionNodeId);
    }

    protected Planner.Context newPlannerContext() {
        return new Planner.Context(clusterService(), UUID.randomUUID(), null);
    }
}


text:
void neopInit();
void neopSetBrightness();
void neopSetColor(color_t color);
void neopOff();
void neopBlink();
long neopGetLongColor(byte red, byte green, byte blue);
long increaseColor(long color);
long increaseColor(long color, basecolor_t rgb);
byte increaseBaseColor(byte color);
long decreaseColor(long color);
long decreaseColor(long color, basecolor_t rgb);
byte decreaseBaseColor(byte color);
void setColorDefault();

#endif


text:
package job

import (
	"fmt"
)

// Stmt represents a job options statement.
type Stmt struct {
	Type StmtType // type of the statement
	Data C        // the configuration data associated with that statement
}

// StmtType represents the type of a job-options statement.
type StmtType int

// String returns the string representation of a StmtType
func (stmt StmtType) String() string {
	switch stmt {
	case StmtNewApp:
		return "NewApp"
	case StmtCreate:
		return "Create"
	case StmtSetProp:
		return "SetProp"
	}
	panic(fmt.Errorf("fwk: invalid StmtType value (%d)", int(stmt)))
}

const (
	StmtNewApp StmtType = iota
	StmtCreate
	StmtSetProp
)