text:
[![Build Status](https://travis-ci.org/godaddy/node-priam.png?branch=master)](https://travis-ci.org/godaddy/node-priam)
[![Coverage Status](https://coveralls.io/repos/godaddy/node-priam/badge.png?branch=master)](https://coveralls.io/r/godaddy/node-priam)
[![Dependency Status](https://gemnasium.com/godaddy/node-priam.png?branch=master)](https://gemnasium.com/godaddy/node-priam)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/godaddy/node-priam/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[![NPM](https://nodei.co/npm/priam.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.org/package/priam)

priam
=====

A simple [Cassandra](http://cassandra.apache.org/) driver for [NodeJS](http://nodejs.org). It wraps the
[cassandra-driver](https://github.com/datastax/nodejs-driver) modules with additional error/retry handling, external
`.cql` file support, connection option resolution from an external source, and query composition, among other improvements.

The driver uses [cassandra-driver](https://github.com/datastax/nodejs-driver) over a binary-protocol connection.
If a Thrift connection is desired, please use [the latest 1.X release](https://github.com/godaddy/node-priam/releases/tag/1.2.1)
and simply specify the [helenus](https://github.com/simplereach/helenus) driver option in config.

[Priam](https://github.com/godaddy/node-priam) is designed to be used as a single instance in order to preserve the
connection pools. As an example, in an [Express](http://expressjs.com/) application,
[priam](https://github.com/godaddy/node-priam) should be initialized at server startup and attached to the `request`
object so that your controllers can access it.

[Priam](https://github.com/godaddy/node-priam) is actively developed and used by
[Go Daddy Website Builder](http://www.godaddy.com/hosting/website-builder.aspx?ci=87223) to provide a high-availability
and high-performance hosting platform based on the [Cassandra](http://cassandra.apache.org/) database.

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

Check the `example` folder for a more complete example. Start by running: `npm start` followed by `curl http://localhost:8080/` or `curl http://localhost:8080/stream=true`.

### Using Known Connection Information ###

```javascript
const path = require('path');
const db = require('priam')({
  config: {
    /* See https://docs.datastax.com/en/developer/nodejs-driver/4.3/api/type.ClientOptions/

       for full list of config options
    */
    cqlVersion: '3.0.0', /* optional, defaults to '3.1.0' */
    socketOptions: {  /* optional, defaults as below */
      connectTimeout: 5000 /* optional, defaults to 4000 */
    },
    pooling: {  /* optional */
      coreConnectionsPerHost: {
        local: 2,
        remote: 1
      }
    },
    consistencyLevel: 'one', /* optional, defaults to one. Will throw if not a valid Cassandra consistency level*/
    numRetries: 3, /* optional, defaults to 0. Retries occur on connection failures. Deprecated, use retryOptions instead. */
    retryDelay: 100, /* optional, defaults to 100ms. Used on consistency fallback retry */
    retryOptions: { retries: 0 }, /* optional. See https://www.npmjs.com/package/retry for options */
    enableConsistencyFailover: true, /* optional, defaults to true */
    coerceDataStaxTypes: false, /* optional, defaults to true */
    queryDirectory: path.join(__dirname, 'path/to/your/cql/files'), /* optional, required to use #namedQuery() */
    credentials: {
      username: '<your_username>',
      password: '<your_password>'
    },
    keyspace: '<your_keyspace>', /* Default keyspace. Can be overwritten via options passed into #cql(), etc. */
    contactPoints: [ /* Ports are optional */
      '123.456.789.010:9042',
      '123.456.789.011:9042',
      '123.456.789.012:9042',
      '123.456.789.013:9042'
    ],
    localDataCenter: 'some_dc' /* required; used for selecting preferred nodes during load balancing */
  }
});
```

### Executing CQL ###
The driver provides the `#cql()` method for executing CQL statements against [Cassandra](http://cassandra.apache.org/).
It provides the following arguments:

 - `cql`: The CQL statement to execute. Parameters should be replaced with `?` characters

 - `dataParams`: The parameters array. Should match the order of `?` characters in the `cql` parameter

 - `options`: Optional. Additional options for the CQL call. See [Query Options](#query-options) for the list of supported properties.

 - `callback(err, data)` or `stream`: Optional. See [Query Return Options](#query-return-options) below.

`dataParams` will be normalized as necessary in order to be passed to Cassandra. In addition to primitives
(`Number`/`String`), the driver supports JSON objects, Array and Buffer types. `Object` and `Array` types will be
stringified prior to being sent to [Cassandra](http://cassandra.apache.org/), whereas `Buffer` types will be encoded.

[hinted parameters](http://www.datastax.com/drivers/nodejs/1.0/types.js.html#line28) are supported.
Instead of the driver inferring the data type, it can be explicitly specified by using a
[specially formatted object](http://www.datastax.com/documentation/developer/nodejs-driver/1.0/nodejs-driver/reference/nodejs2Cql3Datatypes.html).
Similar to consistencies, data types are exposed via the `<instance>.dataType` object.

There is also a `param(value [object], type [string])` helper method for creating hinted parameters, as shown below:

#### Example ####
```javascript
const db = require('priam')({
  config: { /* ... options ... */ }
});
db.cql(
  'SELECT "myCol1", "myCol2" FROM "myColumnFamily" WHERE "keyCol1" = ? AND "keyCol2" = ?',
  [db.param('value_of_keyCol1', 'ascii'), db.param('value_of_keyCol2', 'ascii')],
  { consistency: db.consistencyLevel.one, queryName: 'myQuery', executeAsPrepared: true },
  function (err, data) {
    if (err) {
      console.log(`ERROR: ${err}`);
      return;
    }
    console.log('Returned data: ', data);
  }
);
```

### Named Queries ###
The driver supports using named queries by calling the `namedQuery` method. This method behaves just like the `cql` method, only instead of passing the CQL as the first argument, you pass the name of a query. The query name must correspond to a file name preceding the `.cql` extension. For example, file `myObjectSelect.cql` would have a query name of `myObjectSelect`.

In order to use named queries, the `queryDirectory` option must be passed into the driver constructor.

Queries are loaded *synchronously* and cached when the driver is constructed.

Named queries will automatically provide the `queryName` and `executeAsPrepared` options when executing the CQL,
though the caller can override these options by providing them in the `options` object.

#### Example ####
```javascript
const db = require('priam')({
    config: { queryDirectory: path.join(__dirName, 'cql') }
}); /* 'cql' folder will be scanned and all .cql files loaded into memory synchronously */
db.namedQuery(
  'myColumnFamilySelect', /* name of .cql file with contents: 'SELECT "myCol1", "myCol2" FROM "myColumnFamily" WHERE "keyCol1" = ? AND "keyCol2" = ?' */
  ['value_of_keyCol1', 'value_of_keyCol2'],
  { consistency: db.consistencyLevel.ONE },
  function (err, data) {
    if (err) {
      console.log('ERROR: ', err);
      return;
    }
    console.log('Returned data: ', data);
  }
);
```

### Query Return Options ###

For the `cql` and `namedQuery` methods, there are four ways to get back your data:

* As a `Promise` - To get back a `Promise`, do not pass a callback argument. The `Promise` will resolve to an `Array` of rows.
* Via a callback - If you supply a callback function as your last argument, it will be called with an `error` and `data` argument. If there was no error, `data` will be an `Array`.
* Written to a `Stream` - If you pass a writable stream instead of a callback, the resulting rows will be written to this stream. Your stream will emit `error` events if an error occurs while executing the query.
* As an async iterable - If you set the `iterable` option to `true`, then an async iterable is returned.

### Fluent Syntax ###
The driver provides a fluent syntax that can be used to construct queries.

Calling `#beginQuery()` returns a `Query` object with the following chainable functions:

 - `#query(cql [string])`: Sets the cql for the query to execute.

 - `#namedQuery(queryName [string])`: Specifies the named query for the query to execute.

 - `#param(value [object], hint [optional, string], isRoutingKey [optional, bool])`: Adds a parameter to the query. *Note: They are applied in the order added*.

 If `isRoutingKey` is provided and true, the given parameter will be used to determine the coordinator node to execute a query against, when using the `datastax` driver and a prepared statement.

 - `#params(parameters [Array])`: Adds the array of parameters to the query. Parameters should be created using `db.param()`

 - `#options(optionsDictionary [object])`: Extends the query options. See [Query Options](#query-options) for the list of supported properties.

 - `#consistency(consistencyLevelName [string])`: Sets consistency level for the query. Alias for `#options({ consistency: db.consistencyLevel[consistencyLevelName] })`.

 - `#all()`: Default functionality. After calling execute will return array of any results found.

 - `#first()`: After calling execute will return first, if any of the results found.

 - `#single()`: Similar to first, will return first result however will yield an error if more than one record found.

 - `#execute(callback [optional, function])`: Executes the query. If a callback is not supplied, this will return a Promise.

 - `#stream()`: Executes the query and returns a readable `Stream` object.

 - `#iterate()`: Executes the query and returns an async iterable.

#### Fluent Syntax Examples ####

```javascript
db
  .beginQuery()
  .query('SELECT "myCol1", "myCol2" FROM "myColumnFamily" WHERE "keyCol1" = ? AND "keyCol2" = ?')
  .param('value_of_keyCol1', 'ascii')
  .param('value_of_keyCol2', 'ascii')
  .consistency("one")
  .options({ queryName: 'myColumnFamilySelect' })
  .options({ executeAsPrepared: true })
  .execute(function (err, data) {
    if (err) {
      console.log('ERROR: ', err);
      return;
    }
    console.log('Returned data: ', data);
  });
```

Similarly, fluent syntax can be used for named queries.
```javascript
db
  .beginQuery()
  .namedQuery('myColumnFamilySelect') /* name of .cql file with contents: 'SELECT "myCol1", "myCol2" FROM "myColumnFamily" WHERE "keyCol1" = ? AND "keyCol2" = ?' */
  .param('value_of_keyCol1', 'ascii')
  .param('value_of_keyCol2', 'ascii')
  .consistency('one')
  .execute(function (err, data) {
    if (err) {
      console.log('ERROR: ', err);
      return;
    }
    console.log('Returned data: ', data);
  });
```

The fluent syntax also supports promises, if a callback is not supplied to the `#execute()` function.
```javascript
db
  .beginQuery()
  .namedQuery('myColumnFamilySelect') /* name of .cql file with contents: 'SELECT "myCol1", "myCol2" FROM "myColumnFamily" WHERE "keyCol1" = ? AND "keyCol2" = ?' */
  .param('value_of_keyCol1', 'ascii')
  .param('value_of_keyCol2', 'ascii')
  .consistency('one')
  .execute()
  .fail(function (err) {
    console.error('ERROR: ', err);
  })
  .done(function (data) {
    console.log('Returned data: ', JSON.stringify(data));
  });
```

For expected large data sets in a web application, it is a good idea to stream the data back.
```javascript
const { Transform } = require('stream');
/* ... */
function (req, res, next) {
  db
    .beginQuery()
    .query('SELECT "myCol1", "myCol2" FROM "myColumnFamily" limit 1000000')
    .consistency("one")
    .options({ queryName: 'myColumnFamilySelect' })
    .options({ executeAsPrepared: true })
    .stream()
    .on('error', function (err) {
      res.statusCode(500).end(err.message);
    })
    .pipe(new Transform({
      writableObjectMode: true,
      readableObjectMode: false,
      transform(data, enc, next) {
        next(null, JSON.stringify(data)+'\n');
      }
    }))
    .pipe(res);
}
```

### Batching Queries ###
Queries can be batched by using the fluent syntax to create a batch of queries. Standard CQL and named queries can be
combined. If a consistency level for the batch is not supplied, the strictest consistency from the batched queries will
be applied, if given. Similarly, if debug logs for one of the batched queries are suppressed, debug logs for the entire
batch will be suppressed. `queryName` and `executeAsPrepared` for individual queries will be ignored.

*Note: Batching prepared statements is currently not supported. If prepared statements are used in a batch, the entire
CQL query will be sent over the wire.*

**IMPORTANT:** Batching is only supported with `INSERT`, `UPDATE` and `DELETE` commands. If `SELECT` statements are
added, the query will yield a runtime error.

For more information on batching, see the
[CQL 3.0 reference](http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/batch_r.html).

If using [CQL 3.1](http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/batch_r.html), batches can be nested
and timestamps will be applied at the query level instead of the batch level. If using
[CQL 3.0](http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/batch_r.html), only timestamps at the outermost
batch level will be applied. Any others will be ignored.

Calling `#beginBatch()` returns a `Query` object with the following chainable functions:

 - `#addQuery(query [Query])`: Adds a query to the batch to execute. The query should be created by `db.beginQuery()`.

 - `#addBatch(batch [Batch])`: Adds the queries contained within the `batch` parameter to the current batch.. The batch
    should be created by `db.beginBatch()`.

 - `#add(batchOrQuery [Batch or Query])`: Allows `null`, `Query`, or `Batch` objects. See `#addQuery()` and `#addBatch()`
    above.

 - `#options(optionsDictionary [object])`: Extends the batch. See [Query Options](#query-options) for the list of supported properties.

 - `#timestamp(clientTimestamp [optional, long])`: Specifies that `USING TIMESTAMP <value>` will be sent as part of the
    batch CQL. If `clientTimestamp` is not specified, the current time will be used.

 - `#type(batchTypeName [string])`: Specifies the type of batch that will be used. Available types are `'standard'`,
    `'counter'` and `'unlogged'`. Defaults to `'standard'`. See
    [CQL 3.1 reference](http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/batch_r.html) for more details
    on batch types.

 - `#consistency(consistencyLevelName [string])`: Sets consistency level for the batch. Alias for
   `#options({ consistency: db.consistencyLevel[consistencyLevelName] })`.

 - `#execute(callback [optional, function])`: Executes the query. If a callback is not supplied, this will return a Promise.

#### Batch Syntax Example ####

```javascript
db
  .beginBatch()
  .add(db.beginQuery(
    .query('UPDATE "myColumnFamily" SET "myCol1" = ?, "myCol2" = ? WHERE "keyCol1" = ? AND "keyCol2" = ?')
    .param('value_of_myCol1', 'ascii')
    .param('value_of_myCol2', 'ascii')
    .param('value_of_keyCol1', 'ascii')
    .param('value_of_keyCol2', 'ascii')
  )
  .add(db.beginQuery(
    .query('UPDATE "myOtherColumnFamily" SET "myCol" = ? WHERE "keyCol" = ?')
    .param('value_of_myCol', 'ascii')
    .param('value_of_keyCol', 'ascii')
  )
  .consistency('quorum')
  .type('counter')
  .timestamp()
  .execute()
  .fail(function (err) {
    console.log('ERROR: ', err);
  })
  .done(function (data) {
    console.log('Returned data: ', data);
  });
```

### Query Options ###

All techniques for a query share the following set of options:

* `iterable` - causes an async iterable to be returned
* `executeAsPrepared` - informs the [node-cassandra-cql](https://github.com/jorgebay/node-cassandra-cql) driver to execute the given CQL as a prepared statement, which will boost performance if the query is executed multiple times.
* `queryName` - allows metrics to be captured for the given query, assuming a `metrics` object was passed into the constructor. See the [Monitoring / Instrumentation](#monitoring--instrumentation) section for more information.
* `consistency` - allows you to override any default consistency level that was specified in the driver's constructor.
* `resultHint` - allows you to control how objects being returned by the underlying provider are treated. For example, a data type of `objectAscii` will result in `JSON.parse()` being called on the resulting value. Special data types of `objectAscii` and `objectText` are available for this purpose. If these data types are used in a parameter's `hint` field, they will be automatically mapped to the corresponding data type (e.g. `ascii` or `text) prior to executing the cql statement.
* `deserializeJsonStrings` - informs [Priam](https://github.com/godaddy/node-priam) to inspect any string results coming back from the driver and calls `JSON.parse()` before returning the value back to you. This works similar to providing `resultHint` options for specific columns, but instead it applies to the entire set of columns. *This was the default behavior prior to the 0.7.0 release.*
* `coerceDataStaxTypes` - informs [Priam](https://github.com/godaddy/node-priam) to convert any of the custom [DataStax data types](http://docs.datastax.com/en/developer/nodejs-driver/2.1/nodejs-driver/reference/nodejs2Cql3Datatypes.html) to standard JavaScript types (`string`, `number`). This is recommended if you are upgrading from a previous version of [Priam](https://github.com/godaddy/node-priam) and need to keep backwards-compatibility in your codebase with the previous version of the [DataStax cassandra-driver module](https://github.com/datastax/nodejs-driver).
* `keyspace` - allows you to specify another keyspace to execute a query against. This will override the default keyspace set in the connection information.
* `suppressDebugLog` - allows you to disable debug logging of CQL for an individual query. This is useful for queries that may contain sensitive data that you do not wish to show up in debug logs.

### Helper Functions ###
The driver also provides the following functions that wrap `#cql()`. They should be used in place of `#cql()` where
possible, when not using named queries, as it will allow you to both use default consistency levels for different types
of queries, and easily find references in your application to each query type.

- `select`: calls `#cql()` with `db.consistencyLevel.one`

- `insert`: calls `#cql()` with `db.consistencyLevel.localQuorum`

- `update`: calls `#cql()` with `db.consistencyLevel.localQuorum`

- `delete`: calls `#cql()` with `db.consistencyLevel.localQuorum`

### Connection Management ###
Connection pools are automatically instantiated when the first query is run and kept alive for the lifetime of the driver.
To manually initiate and/or close connections, you can use the following functions:

 - `#connect(keyspace [string, optional], callback [Function])`: Calls `callback` parameter after connection pool is initialized, or existing pool is retrieved. Can be used at application startup to immediately start the connection pool. You may also omit the callback parameter to receive a Promise instead.

 - `#close(callback [Function])`: Calls `callback` after all connection pools are closed. Returns a Promise if callback is not supplied. Useful for testing purposes.

### Error Retries ###
The driver will automatically retry on network-related errors. In addition, other errors will be retried in the following
conditions:

- `db.consistencyLevel.all` will be retried at `db.consistencyLevel.eachQuorum`

- `db.consistencyLevel.quorum` and `db.consistencyLevel.eachQuorum` will be retried at `db.consistencyLevel.localQuorum`

The following retry options are supported in the driver constructor:

- `enableConsistencyFailover`: Optional. Defaults to `true`. If `false`, the failover described above will not take place.

- `numRetries`: (Deprecated) Optional. Defaults to 0 (no retry). The number of retries to execute on network failure.

- `retryOptions`: Optional. Defaults to `{ retries: 0 }` (no retries). Retry logic in the event that a network failure happens. See the [retry](https://www.npmjs.com/package/retry) package for options. *Note:
                this will also affect the number of retries executed during consistency level fallback. For example,
                if the number of retries is 2 and a CQL query with `db.consistencyLevel.all` is submitted, it will be executed
                3 times at `db.consistencyLevel.all`, 3 times at `db.constistencyLevel.eachQuorum` and 3 times at
                `db.consistencyLevel.localQuorum` before yielding an error back to the caller.

- `retryDelay`: Optional. Defaults to 100. The number of milliseconds used for consistency level fallback.

### Logging ###
The driver supports passing a [winston](https://github.com/flatiron/winston) logger inside of the options.

```javascript
require('priam')({
  config: { /* connection information */ },
  logger: new (require('winston')).Logger({ /* logger options */ })
});
```
Debug logging of CQL can be turned off for an individual query by passing the `suppressDebugLog = true` option in the
query options dictionary. This is useful for queries that may contain sensitive data that you do not wish to show up
in debug logs.

### Monitoring / Instrumentation ###
Instrumentation is supported via an optional `metrics` object passed into the driver constructor. The `metrics` object
should have a method `#measurement(queryName [string], duration [number], unit [string])`.

```javascript
const logger = new (require('winston')).Logger({ /* logger options */ })
const metrics = new MetricsClient();
require('priam')({
  config: { /* connection information */ },
  logger: logger,
  metrics: metrics
});
```

### Events ###
Each `priam` instance is an `EventEmitter`. The following events are emitted:

| Event | Params | Description |
|-------|--------|-------------|
| connectionRequested | connectionRequestId | A pooled connection has been requested.Expect a `connectionAvailable` event when this request has been fulfilled. |
| connectionResolving | connectionResolutionId | If a connection resolver is being used, emitted when the connection resolver is about to be invoked |
| connectionResolved | connectionResolutionId | If a connection resolver is being used, emitted when the connection resolver succeeds. |
| connectionResolvedError | connectionResolutionId, err | If a connection resolver is being used, emitted when the connection resolver fails.|
| connectionOpening | connectionOpenRequestId | Emitted when opening a new connection. |
| connectionOpened | connectionOpenRequestId, client | Emitted when the opening of a new connection has succeeded. The `client` object is a [`cassandra-driver`][cassandra-driver] client instance. |
| connectionFailed | connectionOpenRequestId, err | Emitted when the opening of a new connection has failed. |
| connectionAvailable | connectionRequestId | Emitted if a new or existing connection is ready to be used to execute a query. |
| connectionLogged | logLevel, message, details | Emitted when the underlying driver outputs log events. |
| connectionClosed | client | Emitted when a connection closes. The `client` object is a [`cassandra-driver`][cassandra-driver] client instance. |
| queryStarted | requestId | Emitted when a query is about to be executed. |
| queryRetried | requestId | Emitted when a query is about to be retried. |
| queryCompleted | requestId | Emitted when a query has succeeded. |
| queryFailed| requestId, err | Emitted when a query has failed after exhausting any retries. |

### Using a Connection Resolver ###

If you are required to pull database credentials from a credential store (e.g. to support database failover or expiring
old credentials), you should use the `connectionResolver` or `connectionResolverPath` options.

If used, the supplied connection resolver will be called before *every* CQL query is issued. It is up to the supplied
connection resolver to follow whatever caching strategies are required for the environment.

The `connectionResolver` option allows you to pass in a `connectionResolver` object that has already been constructed.

```javascript
const resolver = new MyConnectionResolver();
const db = require('priam')({
  config: {
    /* ... connection options ... */
  },
  connectionResolver: resolver
});
```

The `connectionResolverPath` will be loaded via a `#require()` call. *Note: it is required from `/lib/drivers/`, so
it is recommended to supply a resolver this way via a node module, as paths to source files should be relative to the
internal path.*

```javascript
const db = require('priam')({
  config: {
    /* ... other connection options ... */
    connectionResolverPath: 'myResolverModule'
  }
});
```

#### Sample Connection Resolver Implementation ####

The supplied connection resolver should have the following method: `#resolveConnection(config, callback)`.

`config` will be the [priam](https://github.com/godaddy/node-priam) configuration that was supplied to the constructor, so
connection resolvers can access any custom configuration information specified when the driver was initialized.

`callback(error, connectionInformation)` should be called with the results from the connection resolver. If `error` is
supplied, an error log message will be sent to the supplied logger. `connectionInformation` should always be supplied
if known. If it is not supplied when an error is thrown, the error will be supplied to the `#cql()` callback.

`connectionInformation` should contain the following properties: `username`, `password`, `contactPoints`.

Your connection resolver may optionally be an `EventEmitter`. `priam` will listen to `fetch` and `lazyfetch` events and emit & log its own events in response to these. These events should emit two arguments, an `Error` for any fetch errors as the first and the resolved connection information as the second.

See example application for a concrete example using a connection resolver.

#### Port Mapping Options ####
If your `connectionResolver` connection information includes port, and is returning the port for a protocol you do not
wish to use, (e.g. You want to use binary port 9042, but resolver is returning Thrift port 9160), you can use the
`connectionResolverPortMap` option to perform the mapping.

```javascript
const db = require('priam')({
  config: {
    /* ... other connection options, including Nimitz ... */
    connectionResolverPortMap = {
      from: '9160',
      to: '9042'
    }
  }
});
```

Release Notes
-------------
See the [change log](./CHANGELOG.md)

[cassandra-driver]: https://docs.datastax.com/en/developer/nodejs-driver/4.6/

repository: godaddy/node-priam

repo_name: godaddy/node-priam


text:
# OpenBCI EMG Game Controller
Control various games using EMG signals from OpenBCI Boards!

## Goals
- Create an easy-to-use app to allow OpenBCI users to control games in the web browser or other desktop PC applications.
- First version of the app should be able to control [PeacePong](https://peacepong.com). View PeacePong GitHub Repo [here](https://github.com/retiutut/PeacePong).
- Have a version of this as a standalone app for Mac, Windows, and Linux.
- Create CI/CD pipeline using GitHub Actions.
- Implement a simple GUI to connect to various OpenBCI Boards.
- Gain experience working with Python desktop applications.
- Create a resource that can serve as an educational tool.

license: MIT

branch_name: refs/heads/main

extension: md

license_type: permissive


text:
# elasticache-cluster-v0.2.0
[rameshganne] - Updating module to support Terraform v12 or higher and including multi_az_enabled attribute.
# elasticache-cluster-v0.1.3
[rameshganne] - Updated module to support Elasticache clsuter-enabled & clsuter-disabled.
# elasticache-cluster-v0.1.2
[rameshganne] - Updated module by removing snapshot_arn. It(snapshot_arn) can import db from s3 based rdb file but not working as we expecting ref: https://github.com/hashicorp/terraform-provider-aws/issues/5510.
# elasticache-cluster-v0.1.1
[rameshganne] - Updated module with snapshot_arn. It can import db from s3 based rdb file Example: arn:aws:s3:::my_bucket/snapshot1.rdb.
# elasticache-cluster-v0.1.0
[rameshganne] - Initial commit to create elasticache cluster with replication - Multi-AZ is not covering it.

repository: dimagi/commcare-cloud

branch_name: refs/heads/master

gha_language: Python

repo_name: dimagi/commcare-cloud


text:
---
'@backstage/create-app': patch
---

**BREAKING CHANGE**

The Scaffolder and Catalog plugins have been migrated to partially require use of the [new composability API](https://backstage.io/docs/plugins/composability). The Scaffolder used to register its pages using the deprecated route registration plugin API, but those registrations have been removed. This means you now need to add the Scaffolder plugin page to the app directly.

The Catalog plugin has also been migrated to use an [external route reference](https://backstage.io/docs/plugins/composability#binding-external-routes-in-the-app) to dynamically link to the create component page. This means you need to migrate the catalog plugin to use the new extension components, as well as bind the external route.

Apply the following changes to `packages/app/src/App.tsx`:

```diff
-import { Router as CatalogRouter } from '@backstage/plugin-catalog';
+import {
+  catalogPlugin,
+  CatalogIndexPage,
+  CatalogEntityPage,
+} from '@backstage/plugin-catalog';
+import { scaffolderPlugin, ScaffolderPage } from '@backstage/plugin-scaffolder';

# The following addition to the app config allows the catalog plugin to link to the
# component creation page, i.e. the scaffolder. You can chose a different target if you want to.
 const app = createApp({
   apis,
   plugins: Object.values(plugins),
+  bindRoutes({ bind }) {
+    bind(catalogPlugin.externalRoutes, {
+      createComponent: scaffolderPlugin.routes.root,
+    });
+  }
 });

# Apply these changes within FlatRoutes. It is important to have migrated to using FlatRoutes
# for this to work, if you haven't done that yet, see the previous entries in this changelog.
-  <Route
-    path="/catalog"
-    element={<CatalogRouter EntityPage={EntityPage} />}
-  />
+  <Route path="/catalog" element={<CatalogIndexPage />} />
+  <Route
+    path="/catalog/:namespace/:kind/:name"
+    element={<CatalogEntityPage />}
+  >
+    <EntityPage />
+  </Route>
   <Route path="/docs" element={<DocsRouter />} />
+  <Route path="/create" element={<ScaffolderPage />} />
```

The scaffolder has been redesigned to be horizontally scalable and to persistently store task state and execution logs in the database. Component registration has moved from the frontend into a separate registration step executed by the `TaskWorker`. This requires that a `CatalogClient` is passed to the scaffolder backend instead of the old `CatalogEntityClient`.

The default catalog client comes from the `@backstage/catalog-client`, which you need to add as a dependency in `packages/backend/package.json`.

Once the dependency has been added, apply the following changes to`packages/backend/src/plugins/scaffolder.ts`:

```diff
 import {
   CookieCutter,
   createRouter,
   Preparers,
   Publishers,
   CreateReactAppTemplater,
   Templaters,
-  CatalogEntityClient,
 } from '@backstage/plugin-scaffolder-backend';
+import { CatalogClient } from '@backstage/catalog-client';

 const discovery = SingleHostDiscovery.fromConfig(config);
-const entityClient = new CatalogEntityClient({ discovery });
+const catalogClient = new CatalogClient({ discoveryApi: discovery })

 return await createRouter({
   preparers,
   templaters,
   publishers,
   logger,
   config,
   dockerClient,
-  entityClient,
   database,
+  catalogClient,
 });
```

See the `@backstage/scaffolder-backend` changelog for more information about this change.

repository: Manish-Giri/backstage

repo_name: Manish-Giri/backstage


text:
---
path:	"/blog/is-my-dev-team-slacking"
date:	"2017-03-08"
title:	"“Is My Dev Team Slacking?”"
image:	"../images/1*cEQmXTo8DetpCGjm-3UmXg.png"
---

![](../images/1*cEQmXTo8DetpCGjm-3UmXg.png)

If you can’t tell … you have no business asking.

If you can’t tell … no amount of story-point estimation, rigorous sprint planning, measuring velocity, comparing team velocities, or daily check-ins will give you the answer.

Skilled developers know if their teammates are slacking. It’s there in the code, in the tests, and in the code reviews. Whether they share that information openly is another question.

If you are *not* a skilled developer, don’t bother trying to figure out if your team is slacking. Your data will be inconclusive. Work to create an environment where teammates 1) have a reason to be motivated, and 2) have the requisite safety to hold each other accountable for doing right by their fellow teammates.

Ask “what is holding us back from doing our best work” and pay attention. There’s often a story there. Build trust.

And/or learn to be a software developer.

The End

repository: johnpcutler/cutlefishblog

gha_language: JavaScript

gha_license_id: MIT

repo_name: johnpcutler/cutlefishblog


text:
Statechart implementation in JavaScript.
========================================

[![Build Status](https://travis-ci.org/DavidDurman/statechart.png?branch=master)](http://travis-ci.org/DavidDurman/statechart)

Features
--------

 * Hierarchical states
 * Can be mixined with an arbitrary object
 * JSON-like description of the machine
 * Fast
 * Lightweight (4.6KB minified using jsmin)
 * JavaScript engine independent (browsers, nodejs, narwhal, ...)

Related work
------------

This hierarchical state machine implementation has been inspired
by the QP active object framework, see http://www.state-machine.com/.

Defining a basic state machine
-------------------------------

State machine is defined as an object with `initialState` and `states` properties. The former defines
the first state we want our machine to enter. The latter is an object with states, events and actions:

States can have the following attributes:
* `states` (object) an associative array of states to whom this state is the parent state or "superstate".
* any other attributes of the object are assumed to be events with the object key being the event's name. Events are detailed below.

[![Light switch statechart](http://oi61.tinypic.com/24m6qo9.jpg)](http://oi61.tinypic.com/24m6qo9.jpg)

    var lightSwitch = _.extend({

        initialState: "Out",
        states: {
            'Out': {
                'on':  { target: 'On'   },
                'out': { target: 'Out'  }
            },
            'On': {
                'on':  { target: 'On'  },
                'out': { target: 'Out' }
            }
        }

    }, Statechart);

    // Initialize the state machine and make the initial transition (to the `Out` state).
    lightSwitch.run();

    // Dispatch the `on` event to the machine which causes it to transit to the `On` state.
    lightSwitch.dispatch('on');

Reserved events
---------------

An event is a stimulus upon which you might want to react. An event can have the following attributes:

* optional `target` (string, state name) which indicates this event should trigger a transition to another state.
* optional `action` (function or array of events) which indicates which action should be taken when this event is triggered and its guard has returned true.
* optional `guard` (function, takes the second argument to `fsm.dispatch()`, return true or false) which provides the condition that determines whether the state machine should transition to the `target` state.

The state machine dispatches three reserved events: `init`, `entry` and `exit`. These are special
events that you might react on when an initial transition to a state takes place, when a state is entered or exited.
They default to empty for every state and run on every transition whether defined in that particular state or not.

Assume we use the same machine as defined in the above example and run it like this:

    lightSwtich.run();
    lightSwitch.dispatch('out');
    lightSwitch.dispatch('on');

The resulting order of transitions would then be:

* [Out] entry
* [Out] init

State machine is in the `Out` state and is stable, waiting for input. Something external to the state machine, like your computer program, dispatches the `out` event.

* [Out] exit
* [Out] entry
* [Out] init

State machine is in the `On` state. The `on` event is dispatched

* [Out] exit
* [On] entry
* [On] init

### init

The `init` event can be set in only one way.

* <string> stateName - execution of the `init` event will cause immediate transition to this state.

If you would like to transition immediately upon initializing a state, set it's `init` attribute to the name of the
state to which the state machine should transition.  Note: setting the `init` attribute to the name of an event
that you would like to dispatch is NOT valid and will cause errors to be thrown.

    myState: {
        init: "someOtherState"
    }

### entry

The `entry` event can be set in the following ways:

* <object> eventObject - with `guard` and/or `action` only. It's not possible to transition on `entry`.
* <Array <object>> eventArray - array of event objects, again, without `target`.
* <Function> action - function to be run directly as an action.

### exit

The `exit` event can be set in the following ways:

* <object> eventObject - with `target`, `guard`, and/or `action`.
* <Array <object>> eventArray - array of event objects.
* <Function> action - function to be run directly as an action.

Custom events
-------------

Custom events are named events that we dispatch to the machine (like the `on` and `out` events in the above example).
As a reaction on these events, we might want to either transit to another state, execute an action while doing that or
guard the transition if there is a certain condition that must be met in order for the transition to take place.

    'MyState': {
        'myEvent': {
            guard: function() { return this.mySlot === true; },
            action: function() { console.log('Hooray, transition takes place.'),
            target: 'AnotherState'
        }
    },
    'AnotherState': {
    }

Custom events can be defined in the following ways:

* <object> eventObject - with `target`, `guard`, and/or `action`.
* <Array <object>> eventArray - array of event objects.
* <Function> action - function to be run directly as an action.

Event Actions
-------------

If the event is specified as an array of events, each event's `guard` will be used to determine if that event should be triggered.  All events in the array whose `guard` returns true will be triggered.

Transitioning from any state to itself will cause the `exit`, `init`, and `enter` events to be triggered again.

If an event is triggered from a state to which it does not belong, it will not be handled. It will be ignored.

Hierarchical states
-------------------

States can be nested to an arbitrary level. State nesting leads to **behavioral inheritance** [Samek+ 00, 02].
This allows new states to be specified **by difference** rather then created from scratch each time.

[![Hierarchical states](http://oi58.tinypic.com/2mi0nz9.jpg)](http://oi58.tinypic.com/2mi0nz9.jpg)

State nesting can simply be done by nesting objects.

    'MyState': {
        'init': 'MyChildState',
        'eventA': { ... },
        'MyChildState': {
            'entry': function() { console.log('MyChildState being entered.'); },
            'eventB': { ... }
        }
    }

See https://github.com/DavidDurman/statechart/blob/master/test/samek.js for a complete example of a non-trivial
state machine.

Copyright and license
---------------------

Copyright (c) 2010 David Durman

Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://opensource.org/licenses/MIT.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/DavidDurman/statechart/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

repository: DavidDurman/statechart

repo_name: DavidDurman/statechart


text:
# Competency - Product Backlog Management

The backlog is the system where all near term / future parts of the product are recorded and prioritized.  We manage ours in asasa.

## How do you prove it?

Your working backlog has less than 100 items in it.  These are high level features/ideas that may break out into many user stories.

You have a system that separates out raw ideas and away from the backlog while still making sure everyone who had an idea feels heard.

The tickets capture who will use the feature and how they will be used.

Every ticket in the backlog has a high level estimate of value.

Every ticket in the backlog has a high level estimate of effort.

Each item in the top 25% is so well described (some people attach videos) that any ticket can be picked up by development and with no interaction with the product manager they can accurately assess the scope of work and every stakeholder that it benefits.

Every item in the top 25% has a set of acceptance criteria that lists off of the ways the product owner will enforce quality and completeness after development work is complete.

You hold client product roadmap meetings once a quarter that talk about the direction of the product.

You hold client roundtables once a quarter that gather feedback and generate new product ideas.  You use these sessions to get a feeling for relative importance of stories for clients.

## How do you improve it?

Read about the many ways to manage a backlog: [https://www.agilealliance.org/product-backlog-management-tips-from-a-seasoned-product-owner/](https://www.agilealliance.org/product-backlog-management-tips-from-a-seasoned-product-owner/) / [http://bit.ly/2vJ6qYz](http://bit.ly/2vJ6qYz)

Learn about acceptance criteria: [https://www.seguetech.com/what-characteristics-make-good-agile-acceptance-criteria/](https://www.seguetech.com/what-characteristics-make-good-agile-acceptance-criteria/)

Read agile estimation: [https://www.amazon.com/Agile-Estimating-Planning-Mike-Cohn/dp/0131479415](https://www.amazon.com/Agile-Estimating-Planning-Mike-Cohn/dp/0131479415)

Techniques to break up stories in sprint planning: [http://agileforall.com/resources/how-to-split-a-user-story/](http://agileforall.com/resources/how-to-split-a-user-story/)

Read about the product owner role:

[https://www.romanpichler.com/romans-books/agile-product-management-with-scrum/](https://www.romanpichler.com/romans-books/agile-product-management-with-scrum/)


text:
# CODESYS-MQTT
MQTT client for CODESYS

# Dependencies

all needed Libraries can be found at

  https://github.com/stefandreyer

# Features
- all QoS Levels for publish and subscribe
- will topic
- retain option for publish and will topic
- unlimited publish FBs(by library)
- unlimited subscribe FBs(by library)
- TLS support(without certificates)
- FBs for easy transmit of values and states

# New value FB

created an new FB for easy publishing Values to broker

# New Stats FB

created new FB for easy publishing stats(on/off, true/false) to broker

# Will topic

will topic is now build with client id

# Examples

nice example projets for Windows and RaspberryPi with and without TLS using test.mosquitto.org, so no own broker needed

repository: sunnyhd/CODESYS-MQTT

repo_name: sunnyhd/CODESYS-MQTT


text:
TAG Teleconference
27- Jan - 2016

Agenda: https://github.com/w3ctag/meetings/blob/gh-pages/2016/telecons/01-27-agenda.md

		* Automotive (Travis) - https://github.com/w3ctag/spec-reviews/issues/81 [punted]
		* "With Credentials" flag - https://github.com/w3ctag/spec-reviews/issues/76
		* Changing the call time? (Mark) (see potential times) - https://github.com/w3ctag/meetings/wiki/Potential-teleconference-times [punted]

Present: DKA, Andrew, dbaron, (special guest star) Brian Kardell, Travis, Yves, Alex
Regrets: Peter, Hadley
Scribe: DKA

---

Automotive: punted until next week.

Topic: With Credentials

Dan: I'm worried about this with credentials issue.

[what jonas said]

Yves - it seems that the documentatiuon for the average web developer is lacking.

Travis: I spoke to Anne on Monday. I brought up the issue of redirects - they're failure. Anne says he may have fixed that in fetch. The way he wrote the fetch spec prose indicates that when a redirect
would happen the system resets and starts a new preflight request connecting to the redirected server. He (anne) doesn't see security problems with it - it's a full restart. His intention is to leave it
this way. In theory if implementations impleemnt it this way then it would be fixed.

Alex: What's the fix?

Travis: previoulsly a redirect would error out. You were unable to make a CORS request if there was a redirect. the change is (in the prose) is that a new CORS request to the redirected resource is
started from scratch.

Andrew: This applies to requests that require preflighting?

Alex: the change here would be - the thing we're looking for is that you don't have to know ahead of time if the request would need CORS or an explicit with-credential flag set

Travis: that aspect is unchanged - you have to manually retry if the CORS request fails - you still have to know if you need credentials. I'm parsing Jonas's response to know if it's still necessary - pro
tecting the server or the client?

Alex: in terms of ddos?

Travis: in terms of info disclosure.

Brian: I don't think it's protecting the sevrer - it's about not sending your information.

Alex:

Dan: Issues are:
      (1)
      (2) webarch issue that TimBL brought up
      (3)

Brian: what is the aim? XHR exposes this to the developer. Fetch is supposed to explain what's down there past XHR. If XHR has with-credentials flag then Fetch needs to explain it. It seems
inescable to me that that's the case.

Travis: it boils down to the same origin policy. that policy si there to protect users and CORS was built to work around that.

Brian: First issue is : does TAG take issue with Fetch explaining what's down there.

Travis: answer to that is no the TAG does not take issue.

[consensus exists on this point]

Brian: TAG can take up the separate issues of is CORS under-documented or should we be searching for a new solution

Dan: it's not a debate (on fetch explaing XHR) - that's the extensible web.

Travis: the 2nd issue is Tim's case.

Travis: tim's case is about why can't he get the resource he wants by just using the URL

Dan: his comment is not about fetch specifically but to do with with credentials....

Brian: but that ship sailed a long time ago.  We could come up with an alternative but it's out there and been shipping for a long time.

Travis: tim is saying (I think?) - doesn't it seem like a failure that you as a Web developer have to retry your request with the with-credentials flag...

Yves: and because you don't know what errror you get back?

Brian: only if you're ok ...

Andrew: feels not dissimilar to having to try if your credentuals are correct. I'm concerned about the redirect issue.

Traviis: you can request data from site A knowingly sending credentials and then unknowingly have your credentials sent to side B.

Andrew: your request might randomly fail AND your credentials might go somewhere you don't intend.

Dan: doesn't Anne's solutuon address that?

Travis: sounds like it.

Brian: Does it only effect things requring preflight?

Andrew: shouldn't - because with credentials would be set for other (non-preflight) requests...

Brian: would the change Anne made - if there's not an options call...

Andrew: are the 3 issues (1) potential mismatch with webarch (2) redirects (3) dev's requirement for prior knowledge whether they need CORS or not?

David: whether they need CORS or whether they need with-credentials?

Alex: there's something happening here (what it is ain't exactly clear) part of the reason  - there's nothing simple you can do that will just work.  There isn't a bucket of configuration options that just works.   I have to know the configuration options out of band for any particular URL.

Dan: could we decompose this into 3 separate issues which could be resolved separately?

Travis: when you have a URL you generate all kind of requests e.g. client certs which are lower level than the URL and the with credentials knowledge is happening above the level...

Alex: can't distungish CORS failures from other network failures...

Brian: is that per spec?

Alex: Yes, to prevent things like internal IP (...)? ...

Brian: I don't think this is consistent in XHR, IIRC in chrome it looks like an HTTP error status, in FF not... IIRC.

Five :) new issues:

    1. With-credentials means you have to know information out of band about the URL which goes against web arch (long term question - potential protocol redesign)  ***
    2. Should fetch include with-credentials flag, given the current state of the world? [general agreement that yes it should] ***
    3. Redirects potentially exposing credentials where they're not meant to go  ***
    4. I can't distinguish CORS failures from regular network failures?
    5. incomplete documentation around CORS and with-credentials [Alex: they all interact in subtle ways]

Brian: do you think fetch should include with_credentials?

Travis: process of spec'ing fetch is great; question is whether with-credentials is the right long-term thing

Brian: agree

Brian: i don't know that the documentation is poor it's just for implementers not developers.

Travis: I had success when I searched Google - nicely written articles on CORS - they exist.

Brian: question for Alex - were you saying it's not cut and dried that fetch should expose with-credentials?

Alex:

Brian: Currenty it takes a with-credentials flag -

Alex: Default is not to send credentials by default.

Brian: as currently written it takes a with-credentials flag - when you set the flag on xhr it passes it down to fetch. This explains reality and probably needs to be there.

Alex: is the debate that the default should be the other way or that it shouldn't be exposed. I think it should be exposed.

Yves; I agree. I don't think Tim is agains tthe fact that we have with-credentials - it's that you don't know in which state you are. It could be fixed with an error exposed saying you need with-credentials or "do the right thing."

Alex: We should circle back with tim.

Dan: Right granularity of issues describe above?

PROPOSAL : Close issue 76, open 3 new issues, the *** stared issues above.

Travis: tim says the protocol should be redesigned. [some wordsmithing of above] (paraphrase from: https://github.com/w3ctag/spec-reviews/issues/76#issuecomment-140483668)

[general consensus on above as good]

Dan: Any news from TC39 Alex?

Alex: yexterday shared array buffers (threading for javascript) got to stage 2 - people will try out implementations - bunch of questions about how this works with existing structures in the DOM - and data arrays with eg. web audio.
Just a "coming attractions".

Travis: shared access to these data arrays would only achieve true parallelism when accessed from environments in different threads (e.g., Workers vs. UI thread script right?)

Alex: right.

/adjourn

branch_name: refs/heads/gh-pages

gha_language: HTML


text:
# Infant-Habituation-in-Matlab
A very simple habituation routine for infancy research.

This code implments a standard experimenter controlled habituation script
used to test if babies are fast or slow habituators

It makes use of PsychToolBox http://psychtoolbox.org/
Please install that first

Caspar Addyman, Centre for Brain and Cognitive Development
<EMAIL_ADDRESS>
Version 1 - same checkerboard or circular target stimulus shown each trial.

To cite click this link:
[![DOI](https://zenodo.org/badge/3891/YourBrain/Infant-Habituation-in-Matlab.svg)](http://dx.doi.org/10.5281/zenodo.16627)

repository: InfantLab/Infant-Habituation-in-Matlab

repo_name: InfantLab/Infant-Habituation-in-Matlab


text:
# Locust Docker Image

This image supports to run Locust distributed across multiple processes/machines.

#### Simple Usage
```bash
docker run -d ljishen/locust \
    --host=<HOST>
```

Output help message if you don't supply any options
```bash
docker run --rm ljishen/locust
```

Read the [official Quick start documentation](http://docs.locust.io/en/latest/quickstart.html#quick-start) for more details.


text:
---
title:  "Welcome to my new blog!"
date:   2017-03-29 15:04:23
---
I've been blogging for while but never really on a blog of my own. I though it would be a good time to change this and figured since everyone is so happy about GitHub pages, why not start looking into this. I'll start gattering all my old blog posts here and after that will start writing new content.

Expect a lot of PowerShell, DSC, Azure, Azure Stack, my first steps in the dev world, tinkering with all sorts of DevOps / CM tooling, etc. It's a good time to be in IT!

```powershell
$Contact = [ordered]@{
    Name      = 'Ben Gelens'
    Job       = 'Consultant'
    MVP       = 'CDM (PowerShell)'
    Company   = 'InSpark'
    EMail     =<EMAIL_ADDRESS>    Twitter   = '@bgelens'
    GitHub    = 'https://github.com/bgelens/'
}
New-Object -TypeName PSObject -ArgumentList $Contact
```

extension: markdown


text:
---
layout: page
title: Lab 1 - Data Preparation, Linear Classification
---

In this exercise we are going to learn about simple data curation practices, write vectorized code using numpy,
build and visualize a simple logistic regression model.

### Run online

**Recommended approach**: the lab excercise is available as a notebook in [Google Colab](https://colab.research.google.com/drive/1y5I-7pZylXr4V1qY5JDHuIWhCZ6YcfhC?usp=sharing). Open the link and click on `Copy to Drive`. After that you can start editing and running your code.

### Run locally

Download the notebook from [Google Colab](https://colab.research.google.com/drive/1y5I-7pZylXr4V1qY5JDHuIWhCZ6YcfhC?usp=sharing) by clicking on `File -> Download .ipynb`. After this you need to have Jupyter ready in order to run the notebook. requirements.txt is currently not available for this excercise so you are on your own to resolve the dependencies which are used.

**Installing Python 3.5+:**
To use python3, make sure to install version 3.5 or 3.6 on your local machine. If you are on Mac OS X, you can do this using [Homebrew](https://brew.sh) with `brew install python3`. You can find instructions for Ubuntu [here](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04).

**Virtual environment:**
If you decide to work locally, we recommend using [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/) for the project. If you choose not to use a virtual environment, it is up to you to make sure that all dependencies for the code are installed globally on your machine. To set up a virtual environment, run the following:

**Version Managers:** During this course you will work on various different assignments and labs. To organize your python versions and virtualenvs take a look at the following version and package managers for python:
- [Pyenv](https://github.com/pyenv/pyenv)
- [Anaconda](https://www.anaconda.com/distribution/)

**Jupyter Notebooks:**
To use jupyter notebooks in the created virtual environment, follow
these [instructions](https://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs/)

gha_language: Jupyter Notebook


text:
# Gymnopilus macrosporus (Singer) Singer, 1986 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Agaric. mod. Tax. (Koenigstein), Edn 4 661 (1986)

#### Original name
Pyrrhoglossum macrosporum Singer, 1973

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Cortinariaceae/Pyrrhoglossum/Pyrrhoglossum macrosporum/ Syn. Gymnopilus macrosporus/README.md

repo_name: mdoering/backbone


text:
# youtrain

Showcase Vue.js + Vuetify.

This SPA communicates with the youtrain-server, a Spring Boot application providing a REST API.

The app is build by webpack and served on port 8090 (unless you change it).
Since the Spring Boot backend (youtrain-server) runs on port 8080 a proxy is
set up wich handles the forwarding/rewriting (see vue.config.js).

By Mark Vz

## Project setup

```
npm install
```

### Compiles and hot-reloads for development

```
npm run serve
```

### Compiles and minifies for production

```
npm run build
```

### Lints and fixes files

```
npm run lint
```

### Run your unit tests

```
npm run test:unit
```

### Run your end-to-end tests

(not yet available)

```
npm run test:e2e
```

### Customize configuration

See [Configuration Reference](https://cli.vuejs.org/config/).

## Docker

### Build image

    docker build -t registry.gitlab.com/tarent/youtrain:latest .

### Run as container
Requires that a docker image was built (see above) and that a youtrain-server instance is running on port 8080

    $(bin/set_host_ip.sh) # once for each new shell / after each network change
    docker-compose up -d

You can view logs this way:

    docker-compose logs -f

gha_language: Vue


text:
# php-cli-spinners

Simple PHP library for displaying spinners in the terminal while running a callback function.

You will need to have the [pcntl](https://www.php.net/manual/en/book.pcntl.php) extension installed.

The library uses this [collection of spinners](https://github.com/sindresorhus/cli-spinners):

The spinners can be seen [in action here](https://jsfiddle.net/sindresorhus/2eLtsbey/embedded/result/)

If you don't have the `pcntl` extension installed, you can still use the library, but you will not see the spinner.

On windows use WSL. There may be some trouble using UTF-8 characters in the terminal on WSL.

In this case you can use the `simpleDots` or `simpleDotsScrolling` spinner.

## How it works

The library will run a callback function in a separate process which displays the spinner.
The main process will run the callback function and return the result.

## Installation

```bash
composer require diversen/php-cli-spinners
```

## Usage

```php
<?php

require_once "vendor/autoload.php";

use Diversen\Spinner;

$spinner = new Spinner(spinner: 'dots');
$res = $spinner->callback(function () {
    // Do something important
    sleep(2);
    return 42;
});

echo $res . "\n";

```

## Examples

Clone:

    git clone https://github.com/diversen/php-cli-spinners.git

See [examples](examples) folder. E.g. run `php examples/simple.php`

## License

MIT © [Dennis Iversen](https://github.com/diversen)

repository: diversen/php-cli-spinners

gha_language: PHP

repo_name: diversen/php-cli-spinners


text:
## Overview

[![AUR license](https://img.shields.io/aur/license/pac.svg)](https://github.com/soumyadip1995/Alice---Building-an-AI-startup-using-POSENET/blob/master/LICENSE)
[![Made with flutter](https://img.shields.io/badge/Made%20with-flutter-blue.svg)](https://flutter.dev/docs/get-started/install)

![alt_text](https://miro.medium.com/max/1016/1*2Uw46_A3mLOp21eLruhQuA.png)

In this Repository, We look at how one can build  an automated workout instructor. I have built a workout start up called Alice using flutter and the POSENET model as its base functionality that charges 10 US dollars and can be used by you to build a profitable start up. I I have used posenet model on top of Siraj Raval's Code. Download the tensorflow posenet model as a tflite file from [here](https://www.tensorflow.org/lite/models/pose_estimation/overview). It has also been included in the assets as well(Multi-person tflite file).

- Read my [Blog post](https://soumyadip1995.blogspot.com/2019/07/alice-building-ai-start-up-using.html) to know more about how to build the app and the theory behind the scenes.

## Credits

- Siraj Raval for the video. Healthcare startup
- Shaqian GitHub for the base App [here](https://github.com/shaqian/flutter_realtime_detection)
- Smellslikeml for the Yoganet- GitHub [here](https://github.com/smellslikeml/YogAI)

## Dependencies

All of these can be downloaded in a single command, see below.

- PoseNet Model
- Tensorflow Lite
- Stripe
- RazorPay
- Flutter Text to Speech

## Instructions

First install [Flutter](https://flutter.dev/docs/get-started/install).

After download, from command line run this to install the dependencies
```
flutter packages get
```
Then run this command to run the app

```
flutter run
```
Alternatively you can open the app as a new flutter project in Android Studio after installing the Flutter plugin.

## Demo
![alt_text](https://github.com/soumyadip1995/Alice---Building-an-AI-startup-using-POSENET/blob/master/figures/Screenshot%20(225).png)

**Note:- This is no way fully complete. This is done, just to show you an idea of how you can get started with flutter and integrate  ML models and create a valuable service with it.**

## How to Improve the app

- Generative Model for 3D Yoga Pose Generation (Adversarial Network)

- More interactive dialogue (Dialogflow)

- More personalization & poses (add more poses, personalize them using recommender system/matrix factorization)

- Other features for well-being (meditation, diet, other forms of exercise)

- More analytics (blood pressure, posture, etc.)


text:
<!--
1. Every major folder, for example, Frontend Web Development, Backend Web Development, Data Structures and Algorithm, etc, will have an index page.
2. Every index page should have a title, index with a link to all the language/topic folders, and a Learning path.
3. The learning path should act as a roadmap to the learners. The learners should not be clueless after coming to the repository.
    -->

# Title (name of the field)

## Index
- [GitHub](./Git_And_GitHub)
- [Installing software for python](./Installing_Software)
- [Brief History of Python](./History_Of_Python)
- [What_Is_Programming_Language](./What_Is_Programming_Language)
- [What is type conversion ?](./Type_Conversion)
- [Use_Cases](./Use_Cases)
- [Virtual Environment](./Virtual_Environment)
- [Operators](./Operators)
- [Loops](./Loops)
- [List_&_Matrix](./List_&_Matrix)
- [What_is_an_object_in_Python](./What_is_an_object_in_Python)
- [Stack_and_Queue](./Stack_and_Queue)
- [Loop Break](./Loops_Break)
- [Decorators](./Decorators)
- [What_is_Filter_in_python](./What_is_Filter_in_python)
- [OOP-Class](./OOP-Class)
- [Advanced_function_reduce()](./Advanced_function_reduce())
- [Advanced_Funciton_Zip/Documentation](./Advanced_Funciton_Zip/Documentation)

## Learning path
1. Git & GitHub
2. Installing development and debugging software for python
3. Brief history of python
4. What is a programming language?
5. What is type conversion ?
6. Use cases of Python
7. Virtual Environment
8. Operators
9. List_&_Matrix
10. Objects in Python
11. Stack and Queue
12. Loop Break
13. Decorators
14. What_is_Filter_in_python
15. OOP-Class
16. Advanced function-reduce()
17. Advanced Function - Zip

repository: Aayushmaan-Rawat/winter-of-contributing

repo_name: Aayushmaan-Rawat/winter-of-contributing


text:
# Getting Started
---
Please refer to [Installation](install_en.md) to setup environment at first, and prepare flower102 dataset by following the instruction mentioned in the [Quick Start](quick_start_en.md).

## 1. Training and Evaluation on CPU or Single GPU

If training and evaluation are performed on CPU or single GPU, it is recommended to use the `tools/train.py` and `tools/eval.py`.
For training and evaluation in multi-GPU environment on Linux, please refer to [2. Training and evaluation on Linux+GPU](#2-training-and-evaluation-on-linuxgpu).

## 1.1 Model training

After preparing the configuration file, The training process can be started in the following way.

```
python tools/train.py \
    -c configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
    -o pretrained_model="" \
    -o use_gpu=False
```

Among them, `-c` is used to specify the path of the configuration file, `-o` is used to specify the parameters needed to be modified or added, `-o pretrained_model=""` means to not using pre-trained models.
`-o use_gpu=True` means to use GPU for training. If you want to use the CPU for training, you need to set `use_gpu` to `False`.

Of course, you can also directly modify the configuration file to update the configuration. For specific configuration parameters, please refer to [Configuration Document](config_en.md).

* The output log examples are as follows:
    * If mixup or cutmix is used in training, top-1 and top-k (default by 5) will not be printed in the log:

    ```
    ...
    epoch:0  , train step:20   , loss: 4.53660, lr: 0.003750, batch_cost: 1.23101 s, reader_cost: 0.74311 s, ips: 25.99489 images/sec, eta: 0:12:43
    ...
    END epoch:1   valid top1: 0.01569, top5: 0.06863, loss: 4.61747,  batch_cost: 0.26155 s, reader_cost: 0.16952 s, batch_cost_sum: 10.72348 s, ips: 76.46772 images/sec.
    ...
    ```

    * If mixup or cutmix is not used during training, in addition to the above information, top-1 and top-k (The default is 5) will also be printed in the log:

    ```
    ...
    epoch:0  , train step:30  , top1: 0.06250, top5: 0.09375, loss: 4.62766, lr: 0.003728, batch_cost: 0.64089 s, reader_cost: 0.18857 s, ips: 49.93080 images/sec, eta: 0:06:18
    ...
    END epoch:0   train top1: 0.01310, top5: 0.04738, loss: 4.65124,  batch_cost: 0.64089 s, reader_cost: 0.18857 s, batch_cost_sum: 13.45863 s, ips: 49.93080 images/sec.
    ...
    ```

During training, you can view loss changes in real time through `VisualDL`,  see [VisualDL](../extension/VisualDL_en.md) for details.

### 1.2 Model finetuning

After configuring the configuration file, you can finetune it by loading the pretrained weights, The command is as shown below.

```
python tools/train.py \
    -c configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
    -o pretrained_model="./pretrained/MobileNetV3_large_x1_0_pretrained" \
    -o use_gpu=True
```

Among them, `-o pretrained_model` is used to set the address to load the pretrained weights. When using it, you need to replace it with your own pretrained weights' path, or you can modify the path directly in the configuration file.

We also provide a lot of pre-trained models trained on the ImageNet-1k dataset. For the model list and download address, please refer to the [model library overview](../models/models_intro_en.md).

### 1.3 Resume Training

If the training process is terminated for some reasons, you can also load the checkpoints to continue training.

```
python tools/train.py \
    -c configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
    -o checkpoints="./output/MobileNetV3_large_x1_0/5/ppcls" \
    -o last_epoch=5 \
    -o use_gpu=True
```

The configuration file does not need to be modified. You only need to add the `checkpoints` parameter during training, which represents the path of the checkpoints. The parameter weights, learning rate, optimizer and other information will be loaded using this parameter.

**Note**:
* The parameter `-o last_epoch=5` means to record the number of the last training epoch as `5`, that is, the number of this training epoch starts from `6`, , and the parameter defaults to `-1`, which means the number of this training epoch starts from `0`.

* The `-o checkpoints` parameter does not need to include the suffix of the checkpoints. The above training command will generate the checkpoints as shown below during the training process. If you want to continue training from the epoch `5`, Just set the `checkpoints` to `./output/MobileNetV3_large_x1_0_gpupaddle/5/ppcls`, PaddleClas will automatically fill in the `pdopt` and `pdparams` suffixes.

    ```shell
    output/
    └── MobileNetV3_large_x1_0
        ├── 0
        │   ├── ppcls.pdopt
        │   └── ppcls.pdparams
        ├── 1
        │   ├── ppcls.pdopt
        │   └── ppcls.pdparams
        .
        .
        .
    ```

### 1.4 Model evaluation

The model evaluation process can be started as follows.

```bash
python tools/eval.py \
    -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
    -o pretrained_model="./output/MobileNetV3_large_x1_0/best_model/ppcls"\
    -o load_static_weights=False
```

The above command will use `./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml` as the configuration file to evaluate the model `./output/MobileNetV3_large_x1_0/best_model/ppcls`. You can also set the evaluation by changing the parameters in the configuration file, or you can update the configuration with the `-o` parameter, as shown above.

Some of the configurable evaluation parameters are described as follows:
* `ARCHITECTURE.name`: Model name
* `pretrained_model`: The path of the model file to be evaluated
* `load_static_weights`: Whether the model to be evaluated is a static graph model

**Note:** If the model is a dygraph type, you only need to specify the prefix of the model file when loading the model, instead of specifying the suffix, such as [1.3 Resume Training](#13-resume-training).

### 2. Training and evaluation on Linux+GPU

If you want to run PaddleClas on Linux with GPU, it is highly recommended to use `paddle.distributed.launch` to start the model training script(`tools/train.py`) and evaluation script(`tools/eval.py`), which can start on multi-GPU environment more conveniently.

### 2.1 Model training

After preparing the configuration file, The training process can be started in the following way. `paddle.distributed.launch` specifies the GPU running card number by setting `selected_gpus`:

```bash
export CUDA_VISIBLE_DEVICES=0,1,2,3

python -m paddle.distributed.launch \
    --selected_gpus="0,1,2,3" \
    tools/train.py \
        -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml
```

The configuration can be updated by adding the `-o` parameter.

```bash
python -m paddle.distributed.launch \
    --selected_gpus="0,1,2,3" \
    tools/train.py \
        -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
        -o pretrained_model="" \
        -o use_gpu=True
```

The format of output log information is the same as above, see [1.1 Model training](#11-model-training) for details.

### 2.2 Model finetuning

After configuring the configuration file, you can finetune it by loading the pretrained weights, The command is as shown below.

```
export CUDA_VISIBLE_DEVICES=0,1,2,3

python -m paddle.distributed.launch \
    --selected_gpus="0,1,2,3" \
    tools/train.py \
        -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
        -o pretrained_model="./pretrained/MobileNetV3_large_x1_0_pretrained"
```

Among them, `pretrained_model` is used to set the address to load the pretrained weights. When using it, you need to replace it with your own pretrained weights' path, or you can modify the path directly in the configuration file.

There contains a lot of examples of model finetuning in [Quick Start](./quick_start_en.md). You can refer to this tutorial to finetune the model on a specific dataset.

### 2.3 Resume Training

If the training process is terminated for some reasons, you can also load the checkpoints to continue training.

```
export CUDA_VISIBLE_DEVICES=0,1,2,3

python -m paddle.distributed.launch \
    --selected_gpus="0,1,2,3" \
    tools/train.py \
        -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
        -o checkpoints="./output/MobileNetV3_large_x1_0/5/ppcls" \
        -o last_epoch=5 \
        -o use_gpu=True
```

The configuration file does not need to be modified. You only need to add the `checkpoints` parameter during training, which represents the path of the checkpoints. The parameter weights, learning rate, optimizer and other information will be loaded using this parameter. About `last_epoch` parameter, please refer [1.3 Resume training](#13-resume-training) for details.

### 2.4 Model evaluation

The model evaluation process can be started as follows.

```bash
python tools/eval.py \
    -c ./configs/quick_start/MobileNetV3_large_x1_0_finetune.yaml \
    -o pretrained_model="./output/MobileNetV3_large_x1_0/best_model/ppcls"\
    -o load_static_weights=False
```

About parameter description, see [1.4 Model evaluation](#14-model-evaluation) for details.

## 3. Use the pre-trained model to predict
After the training is completed, you can predict by using the pre-trained model obtained by the training, as follows:

```python
python tools/infer/infer.py \
    -i image path \
    --model MobileNetV3_large_x1_0 \
    --pretrained_model "./output/MobileNetV3_large_x1_0/best_model/ppcls" \
    --use_gpu True \
    --load_static_weights False
```

Among them:
+ `image_file`(i): The path of the image file to be predicted, such as `./test.jpeg`;
+ `model`: Model name, such as `MobileNetV3_large_x1_0`;
+ `pretrained_model`: Weight file path, such as `./pretrained/MobileNetV3_large_x1_0_pretrained/`;
+ `use_gpu`: Whether to use the GPU, default by `True`;
+ `load_static_weights`: Whether to load the pre-trained model obtained from static image training, default by `False`;
+ `resize_short`: The length of the shortest side of the image that be scaled proportionally, default by `256`;
+ `resize`: The side length of the image that be center cropped from resize_shorted image, default by `224`;
+ `pre_label_image`: Whether to pre-label the image data, default value: `False`;
+ `pre_label_out_idr`: The output path of pre-labeled image data. When `pre_label_image=True`, a lot of subfolders will be generated under the path, each subfolder represent a category, which stores all the images predicted by the model to belong to the category.

**Note**: If you want to use `Transformer series models`, such as `DeiT_***_384`, `ViT_***_384`, etc., please pay attention to the input size of model, and need to set `resize_short=384`, `resize=384`.

About more detailed infomation, you can refer to [infer.py](../../../tools/infer/infer.py).

## 4. Use the inference model to predict

PaddlePaddle supports inference using prediction engines, which will be introduced next.

Firstly, you should export inference model using `tools/export_model.py`.

```bash
python tools/export_model.py \
    --model MobileNetV3_large_x1_0 \
    --pretrained_model ./output/MobileNetV3_large_x1_0/best_model/ppcls \
    --output_path ./inference \
    --class_dim 1000
```

Among them, the `--model` parameter is used to specify the model name, `--pretrained_model` parameter is used to specify the model file path, the path does not need to include the model file suffix name, and `--output_path` is used to specify the storage path of the converted model, class_dim means number of class for the model, default as 1000.

**Note**:
1. If `--output_path=./inference`, then three files will be generated in the folder `inference`, they are `inference.pdiparams`, `inference.pdmodel` and `inference.pdiparams.info`.
2. You can specify the `shape` of the model input image by setting the parameter `--img_size`, the default is `224`, which means the shape of input image is `224*224`. If you want to use `Transformer series models`, such as `DeiT_***_384`, `ViT_***_384`, you need to set `--img_size=384`.

The above command will generate the model structure file (`inference.pdmodel`) and the model weight file (`inference.pdiparams`), and then the inference engine can be used for inference:

```bash
python tools/infer/predict.py \
    --image_file image path \
    --model_file "./inference/inference.pdmodel" \
    --params_file "./inference/inference.pdiparams" \
    --use_gpu=True \
    --use_tensorrt=False
```
Among them:
+ `image_file`: The path of the image file to be predicted, such as `./test.jpeg`;
+ `model_file`: Model file path, such as `./MobileNetV3_large_x1_0/inference.pdmodel`;
+ `params_file`: Weight file path, such as `./MobileNetV3_large_x1_0/inference.pdiparams`;
+ `use_tensorrt`: Whether to use the TesorRT, default by `True`;
+ `use_gpu`: Whether to use the GPU, default by `True`
+ `enable_mkldnn`: Wheter to use `MKL-DNN`, default by `False`. When both `use_gpu` and `enable_mkldnn` are set to `True`, GPU is used to run and `enable_mkldnn` will be ignored.
+ `resize_short`: The length of the shortest side of the image that be scaled proportionally, default by `256`;
+ `resize`: The side length of the image that be center cropped from resize_shorted image, default by `224`;
+ `enable_calc_topk`: Whether to calculate top-k accuracy of the predction, default by `False`. Top-k accuracy will be printed out when set as `True`.
+ `gt_label_path`: Image name and label file, used when `enable_calc_topk` is `True` to get image list and labels.

**Note**: If you want to use `Transformer series models`, such as `DeiT_***_384`, `ViT_***_384`, etc., please pay attention to the input size of model, and need to set `resize_short=384`, `resize=384`.

If you want to evaluate the speed of the model, it is recommended to use [predict.py](../../../tools/infer/predict.py), and enable TensorRT to accelerate.

repository: chenyeren/PaddleClas

repo_name: chenyeren/PaddleClas


text:
# Github action: jenkins-build-by-token

[![Travis][travis-image]][travis-url]
![License][license-image]
![Issues][issues-image]

## USAGE

```bash
name: trigger jenkins job
on: [push]
jobs:
  curl:
    runs-on: ubuntu-latest
    steps:
    - name: jenkins-build-by-token-action
      uses: notonthehighstreet/jenkins-build-by-token-action@master
      with:
        webhook_host: "..."
        webhook_secret: "..."
        job_path: "..."
        job_token: "..."

```

[travis-image]: https://travis-ci.com/notonthehighstreet/jenkins-build-by-token-action.svg?branch=master
[travis-url]: https://travis-ci.com/notonthehighstreet/jenkins-build-by-token-action
[license-image]: https://img.shields.io/static/v1?label=licence&message=MIT&color=Green
[issues-image]: https://img.shields.io/github/issues/notonthehighstreet/jenkins-build-by-token-action


text:
# Development

```@meta
CurrentModule = Evolutionary
```

If you are contributing a new algorithm to this package, you need to know an internal API which allows to add a new algorithm without considerable changes to overall structure of the package.

## Adding an algorithm

If you're contributing a new algorithm, you shouldn't need to touch any of the code in src/api/optimize.jl. You should rather add a file named (solver is the name of the solver) `algo.jl` in src, and make sure that you define an optimizer **parameters** and **state** types, `initial_population` that initializes a population of `individual` objects, a state type that holds all variables that are (re)used throughout the iterative procedure, an `initial_state` that initializes such a state, and an `update_state!` method that does the actual work.

### Algorithm

Every optimization algorithm have to implement an algorithm parameters type derived from
 `AbstractOptimizer` type,  e.g. `struct Algo <: AbstractOptimizer end`, with appropriate fields, a default constructor with a keyword for each field.

Function `initial_state` returns an initial state for the algorithm, see [State](#state) section.
Function `update_state!` returns a `Bool` value. If the state update is *successfully* completed then the function returns `false`, otherwise `true`.

```@docs
AbstractOptimizer
initial_state
```

### State

Every optimization algorithm have to implement a state type derived from `AbstractOptimizerState` type, e.g. `struct AlgoState <: AbstractOptimizerState end`. All derived types should implement `value` and `minimizer` functions

```@docs
AbstractOptimizerState
value(::AbstractOptimizerState)
minimizer(::AbstractOptimizerState)
terminate(::AbstractOptimizerState)
```

### Population

The evolutionary algorithms require a collection of individuals, **population**, which the algorithm constantly modifies. The population collection type must be derived from the `AbstractVector` type. Function `initial_population` is used for implementing a strategy of population collection initialization.

The `initial_population` must accept two parameters:
- `method`, an algorithm object derived from `AbstractOptimizer` type
- `individual`, a description of an individual template used to create the population

Following population initialization strategies are available:

```@docs
initial_population
```

### Constraints

All constraints derived from the `AbstractConstraints` abstract type.
Usually the derived type wraps a `ConstraintBounds` object, so the

Following methods can be overridden for the derived types:

```@docs
value(::AbstractConstraints, x)
```

Following auxiliary functions are available for every derived type of `AbstractConstraints`.

```@docs
isfeasible(::AbstractConstraints, x)
```

Package provides following additional constrains implementations.

```@docs
Evolutionary.NoConstraints
MixedTypePenaltyConstraints
```

### Parallelization

For additional modes of parallelization of the objective function evaluation, add overrides of the `value!` function.
By default, the fitness of the population is calculated by the following function:

```julia
function value!(::Val{:serial}, fitness, objfun, population::AbstractVector{IT}) where {IT}
    for i in 1:length(population)
        fitness[i] = value(objfun, population[i])
    end
end
```

The first symbolic value type parameter, `:serial`, corresponds to the default value of the `parallelization` of the [`Options`](@ref) object.
Any additional overrides with different value type parameters will be triggered by specifying
a corresponded value type symbol in the `Options.parallelization` field.
A multi-threaded override of the above evaluation is provided.


text:
# Auto Populate Text Column
AutoPopulateTextColumn PCF (PowerApps Component framework) Control that auto populate a PowerApps text column with Regarding Lookup details. The text format is configurable for each table type and can be provided as input property while setting up the control.

Auto populate the activity subject with Regarding details. The format is configurable and can be setup for each table type.

### Features
---
* Auto populate activity subject on create of activities from timeline.
* User can add additional text in the subject before save.
* On change of Regarding value the control re-populates with new formatted details.

### Configure the control
---
Control Property | Description | Required
------------ | ------------- | -------------
Bound Column for Auto Populate | Text column to attach the control | Yes |
Regarding Value | Bind to a value on a Lookup.Regarging column | Yes |
Configurations Value | Provide the configurations related to regarding table type, select columns and text format(tableType1;column1,column2;column1 - column2^tableType2;column1,column2;column1 - column2) | Yes |

### Screenshots
---

![Add Control](assets/addcontrol.PNG)

![Configure Property](assets/configureproperty.PNG)

```bash
incident;ticketnumber,title;title - Case Number:ticketnumber^account;name;Account Name:name
```
![Auto Populate](assets/autopopulate.gif)

# Get required tools
---

Be sure to update your Microsoft PowerApps CLI to the latest version:
```bash
pac install latest
```
# Build the control
---

* Clone the repo/ download the zip file.
* Navigate to ./AutoPopulateTextColumn/ folder.
* Copy the folder path and open it in visual studio code.
* Open the terminal, and run the following command to install the project dependencies:
```bash
npm install
```
* After npm installation, navigate to  node_modules -> pcf-scripts -> Open the 'featureflags.json' file. Update 'pcfAllowLookup' attributes to 'on' ("pcfAllowLookup": "on").

Then run the command:
```bash
npm run start
```
### Build the solution
---

```bash
msbuild /t:restore
```

```bash
msbuild
```
* You will have the solution file in SolutionFolder/bin/debug folder!

If you want to change the solution type you have to edit the .cdsproj file:
```bash
Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
  <PropertyGroup>
    <SolutionPackageType>Managed</SolutionPackageType>
  </PropertyGroup>

  ```

repository: dburgesser/PCF-Controls

repo_name: dburgesser/PCF-Controls


text:
---
layout: post
title: Data mining - Introduction
---

The current technological trends lead to data flood. Every day more and more data is generated from banking, telecom, scientific experiments, biology, world wide web, business transactions etc. The data amounts grow very fast and very little of it will ever be looked at by a human. Data mining is therefore used to make sense and use of that data.
Data mining is an interdisciplinary subfield of computer science. It is the computational process of discovering patterns in data sets involving methods at the intersection of artificial intelligence, machine learning, statistics, and database systems. Simply put it means that data mining is a process of uncovering hidden patterns in the data that previously have not been discovered.

Data mining is used to predict future trends and behaviors, allowing people to make proactive, knowledge-driven decisions.
The manual extraction of patterns from data by statisticians has occurred for centuries. Advances in computer technology has dramatically increased ability to collect, store, and manipulate data.
While it seems almost obvious, but there are two things that must exist in order to run successful data mining project, data and patterns inside of the data.  Usually, sample of data is taken from the whole dataset. Then this sampled data is prepared and feed into the data mining algorithm which uses mathematical, statistical etc. techniques to find patterns in the data. After that, this new knowledge is applied to the rest of the data.

## Real life application

DM can be used in wide variety of fields such as:
- Medicine
- Finance
- Healthcare
- Bioinformatics
- Retail Industry
- Telecoms etc.

In medicine data mining is used to improve accuracy in disease diagnostic, predict outcome for given treatment, recommend best treatment, predict possibility for cancer etc.
Data mining tools can answer business questions that traditionally were too time consuming to resolve. Because of that it is also used in almost every aspect of modern businesses such as advertising, customer modeling and CRM (Customer Relationship management), e-Commerce, investments, manufacturing and many other.
Interest in data mining techniques comes also from government where it can be used, among other things, for anti-terrorism efforts, profiling tax cheaters or prevent money laundering.
It’s most intensively used in CRM where organizations can build models based on historical data to predict who will respond to the new marketing campaigns such as direct mail, online marketing campaign. Also, financial institutions are most common users of DM where banks can by building a model from historical customer’s data, determine between good and bad loans.

## Disadvantages and limitations

There are three main potential issues with DM:
- Privacy issues
- Misuse of information
- Data Accuracy

Since data mining requires large amounts of data to be useful, collecting and storing those data can raise serious privacy issues. Privacy is an issue that is debated in the last 10-15 years, and it is likely that it will continue to be debated in the future. These days information is currency, and in the information age, it sometimes seems as if everyone wants to know everything their customers.

One of the key issues raised by data mining technology is not a business or technological one, but an issue of individual privacy. Technologies such as data mining will make it possible for businesses, governments etc. to track all our movements and purchasing habits.
Another concern is misuse of information. Information is collected through data mining intended for the ethical purposes can be misused. The problem can arise if organizations or governments decide that this data can be used in ways that users didn't approved or businesses to take benefits of vulnerable people or discriminate against a group of people.

Also, there is the issue of how correct data mining methods are. If data mining is used in decision process for e.g. loan application,  people could be written off as undesirable, whether the depiction is correct or not. It can happen very easily for customer credit report to have errors, and those errors can lead to difficulty getting a loan or other type of credit. Without any way to look at our consumer profiles, people have no idea what bankers and other interested parties make their decisions.

## Trends in development

In last few years this technology is rapidly developing. It established itself as one of the major disciplines in computer science with growing impact. Undoubtedly, research in data mining will continue and even increase over coming decades
Application of DM in more areas is expected in the future, and some of them are:
- Hypertext And Hypermedia Data Mining
- Distributed/Collective Data Mining
- Spatial And Geographic Data Mining
- Graph mining
- Image Mining
- Text mining etc.

Developments in distributed computing will allow future data miners to use grater amounts of data faster and with more precision.
These days, biggest improvement is in the fields of multimedia mining (image, video etc.). Also, with improvements in graph mining (graph theory) search engines are getting better in personalized searches, social services such as Facebook, Twitter, LinkedIn are better in linking people.

## Conclusion

Data mining brings a lot of benefits to businesses, society, governments. Practical applications are almost limitless and can be used virtually everywhere where there is some value in predicting outcome. New techniques and tools are reducing complexity in application and maintenance of DM.
 On the other hand, it will require proper handling of the mentioned issues for it to be fully useful in the future.

## References

[https://en.wikipedia.org/wiki/Data_mining](https://en.wikipedia.org/wiki/Data_mining)
[http://www.kdnuggets.com/data_mining_course/x1-intro-to-data-mining-notes.html](http://www.kdnuggets.com/data_mining_course/x1-intro-to-data-mining-notes.html)
[http://business.time.com/2012/07/31/big-data-knows-what-youre-doing-right-now/](http://business.time.com/2012/07/31/big-data-knows-what-youre-doing-right-now/)
[http://www.theatlantic.com/technology/archive/2012/04/everything-you-wanted-to-know-about-data-mining-but-were-afraid-to-ask/255388/](http://www.theatlantic.com/technology/archive/2012/04/everything-you-wanted-to-know-about-data-mining-but-were-afraid-to-ask/255388/)


text:
## Work in progress.
More code about regional analysis will be uploaded later.

### Python scripts...
STP_mouselight_searcher.py
This python script will find all the neurons in the given directory, which have soma location in the injection site.
```
File paths are hard-coded, plz change accordingly.
```

Projector.py
This python script will create a image stack from a swc file. Usage:
```
python Projector.py $swc_file_path $z $x $y
```
It will automatically create a folder using the swc filename, and output $z images (sections) into that folder.

### Workflow...
![Image of overlapping workflow](https://raw.githubusercontent.com/wangdingkang/DiscreteMorse/master/Code/Mouselight_Atlas_Space_Analysis/Workflow_images/Mouselight_Overlapping_Workflow.png)

### In MouseLight directory...
MouseLightMOinfo.txt: The list containing ids of all the candidate mouselight neurons.

Injection atlas: The injection site of the STP 180830 brain in atlas space.

jsons: The json files for all mouselight neuron, basically it is point cloud file, but also contains other meta info about each neuron.
There are multiple json files, each contains the information of several mouselight neurons.

repository: wangdingkang/DiscreteMorse

repo_name: wangdingkang/DiscreteMorse


text:
# react-classset

`classSet()` is a neat utility for easily manipulating the DOM `class` string. This previously resided inside [React](https://github.com/facebook/react) as a utility, but is now pulled out and library-agnostic.

Here's a common scenario

```javascript
var classString = 'message';
if (isImportant) {
  classString += ' message-important';
}
if (isRead) {
  classString += ' message-read';
}
```

This can quickly get tedious, as assigning class name strings can be hard to read and error-prone. `classSet()` solves this problem:

```javascript
var classString = classSet({
  'message': true,
  'message-important': isImportant,
  'message-read': isRead
});
```

When using `classSet()`, pass an object with keys of the CSS class names you might or might not need. Truthy values will result in the key being a part of the resulting string.

Alternatively, you can also use it this way:

```javascript
cx('a', 0, null, undefined, 'b'); // 'a 0 b', discards null values
```

No more hacky string concatenations!

repository: lfergon/react

repo_name: lfergon/react