text:
# midictl

A terminal-based MIDI control panel meant to be simple and fast in use.

## Using midictl
Basic use is very straightforward: `midictl <config file> -d <client ID> -p <port> -c <MIDI channel>`.
You can determine client ID and port number of the device you want by executing `aconnect -o`.
Configuration file format is described in the next section.

_Please keep in mind that `midictl` is in very early stage of its life. I literally just wrote it in the two past days. You may stumble upon weird bugs (if you do, please [open an issue](https://github.com/Jacajack/midictl/issues/new)). Some things may change in future releases, including key bindings and config file format._

Key bindings:
|Key|Action|
|:---:|:---|
|Q|Quit|
|K, ↑|Move up|
|J, ↓|Move down|
|PgUp|Move one page up|
|PgDn|Move one page down|
|Home|Jump to the beginning|
|End|Jump to the end|
|H, ←|Value -= 1|
|L, →|Value += 1|
|G, Shift + H, Shift + Z|Value -= 10|
|;, Shift + L, Shift + C|Value += 10|
|I, Enter|Enter value for the controller|
|Z|Min value|
|X|Center value|
|C| Max value|
|T|Transmit value to the MIDI device|
|R|Default value|
|Shift + T|Transmit all current values to the MIDI device|
|Shift + R|Reset all controllers to their defaults|
|Shift + D|Dump all controller values to file|
|Shift + O|Load controller values from a dump file|
|/|Search for controller by name (leave empty to repeat search)|
|[|Move split to the left|
|]|Move split to the right|
|=|Hide/show left column|

## Config file format
The config file format is meant to be as simple and friendly as possible. Each line in the file represents one MIDI controller, a heading or a horizontal rule.
 - Empty lines, preceding whitespace and comments are ignored
 - Comments start at `#` character and end at the end of the line
 - Lines starting with `---` (or more `-` characters) represent horizontal rules. If the `---` is followed by text, it is placed over the horizontal rule and serves as heading.
 - Lines starting with numbers or square brackets are MIDI controllers. The number is the MIDI controller number. The number can be followed by optional square bracket pair containing metadata. Any text following the number or metadata block is treated as name of the controller.

It sounds much more complicated than it is:
```
--- Oscillator 1  # A comment
10 [slider = 0] Waveform
11 [min = 32, max = 96] Detune
12 [def = 127] Volume

--- LFO
[cc = 13] Rate
14 Fade
```

Valid metadata parameters are:
 - `cc` - MIDI CC. Overrides the value specified outside the metadata block. As you can see, the controller number can be omitted as long as this parameter is set instead. In my opinion this syntax looks better actually.
 - `min` - Minimum value for the controller
 - `max` - Maximum value for the controller
 - `def` - Default value.
 - `chan` - MIDI channel (overrides default MIDI channel)
 - `slider` - The slider is not displayed if set to 0
 - `update` - If non-zero, controller's default value is automatically transmitted when `midictl` starts.

### Contributing / Roadmap
Development ideas and TODO list are [here](https://github.com/Jacajack/midictl/projects/1).

If you've found a bug, have a question or an idea, please [open an issue](https://github.com/Jacajack/midictl/issues). Pull requests are welcome too!

repository: mehmetcanbudak/midictl

repo_name: mehmetcanbudak/midictl


text:
# wordpress-installer

* The following script configure wordpress site on the host.
* First followin packages are installed(php,mysql-server,php-mysql,nginx,unzip).
* The user is prompted for hostname. After getting the hostname entry is made in /etc/hostname file.
* nginx configuration file is created for wordpress site.
* Contents for wordpress is downloaded and extracted in root directory.
* User is prompted for mysql root password and database name.
* After this wp-config.php file is created and set up is completed.
* Error Log file is created as /tmp/script.log
```
Configuration file : /etc/nginx/sites-enabled/hostname
Root Directory     : /usr/share/nginx/hostname
(Where hostname may be ubuntu.example.com, linux.example.com)

database-user      : root
database-password  : provided by user
database-name      : Provided by user
```
For root user
Usage:
```
bash wordpress.sh
./wordpress.sh
```
For normal user
Usage:
```
sudo bash wordpress.sh
sudo ./wordpress.sh
```
* Please make sure no other installations are running.
* Make sure Internet is up and running.
* Make sure apache2 service is not running. apache2 and nginx service may conflict.
* Choose a new database name for wordpress. Do not use existing one.

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
layout: post
title: "🇨🇦 Taxes"
date: 2020-03-16
---

# How to fill your taxes in Canada?

I've been surprised how many canadians were outsourcing their taxes by a professional. If you don't have a complex financial situation you will be surprised how easy it is.

Please **don't paid for it** and **learn how taxes work** so you will be in control of your financial life.

Do it by yourself and use an assistant software like [SimpleTax](https://help.simpletax.ca/questions/how-to-use).

## Work

Your employer will provide you a tax document called a [T4](https://www.canada.ca/en/revenue-agency/services/forms-publications/forms/t4.html). If you have multiple employers the same year you will then have multiple T4s.

> In Québec we have an additional tax document called an [R1](https://www.revenuquebec.ca/en/online-services/forms-and-publications/current-details/rl-1-t/).

### T4

Using **SimpleTax**, this is a straightforward task. Just follow what SimpleTax asks for and report the corresponding boxes from your T4 to SimpleTax.

### R1

If you live in Québec, you will get asked to report the data about your R1. Take your R1 provided by your employer and repeat the task as you did with your T4.

## Stock market

If you invest in the market you will need to let the government knows how much you invested/made during the fiscal year.

### T5008

This form is usually generated by your broker at the end of the fiscal year.

- **Adjust Cost Base (ACB):** This value is could be generated on your T5008. Otherwise, make sure you register somewhere how much you bought/sold, when and at which exchange rate (USD/CAD).

The Canadian government wants this value in CAD, so make sure you convert using the [annual exchange rate](https://help.simpletax.ca/questions/annual-exchange-rates) before submitting it.

> [How to report your T5008?](https://help.simpletax.ca/questions/t5008-slip)

### T5

This form is provided by your bank during the tax season for your RRSP and your savings accounts.

## Real estate

If you have a renting property, you can claim money to the government if you did major renovations. I will add more information about this next year.

### Tools

- [SimpleTax](https://simpletax.ca/)
- [Adjust Cost Base](https://www.adjustedcostbase.ca/)
- [Foreign income](https://help.simpletax.ca/questions/foreign-employment-income)

repository: goldenson/maximeorefice

extension: markdown

repo_name: goldenson/maximeorefice


text:
# chimera_pe
ChimeraPE demo: maps another executable into the target process and runs both.

This is an alternative method to the classic RunPE (process hollowing) - can be used in case if we want to run the original exe also.

See also a template for a payload, that can be injected using this techique:
https://github.com/hasherezade/demos/tree/master/chimera_pe_payload_template

WARNING: This is a 32-bit version for demo purpose. See the extended version here:

https://github.com/hasherezade/chimera_pe

repository: security-geeks/demos

gha_language: C

repo_name: security-geeks/demos


text:
# Spring Cloud Service Connector for RiakCS S3 Services

This project provides a [Spring Cloud](https://github.com/spring-projects/spring-cloud) service connector for RiakCS S3 services brokered by the Cloud Foundry [p-riakcs] (adapted from https://github.com/davidehringer/s3-cf-service-broker).

## Example Usage

Add the library to your project:

```
<dependency>
	<groupId>org.cloudfoundry.community</groupId>
	<artifactId>spring-cloud-riakcs-service-connector</artifactId>
	<version>1.0.0</version>
</dependency>
```

Bind an S3 RiakCs service to your Cloud Foundry application.

Use Spring Cloud to get an `RiakcsServiceInfo` instance.

```
CloudFactory cloudFactory = new CloudFactory();
Cloud cloud = cloudFactory.getCloud();

RiakcsServiceInfo serviceInfo = (RiakcsServiceInfo) cloud.getServiceInfo("my-riak-service");
...  serviceInfo.getAccessKeyId();
...  serviceInfo.getSecretAccessKey();
...  serviceInfo.getBucket();
...  serviceInfo.getURI();

```

gha_language: Java


text:
---
title: Adding outgoing webhooks
menu:
  webhooks:
    weight: 10

---
You can configure Bitrise to send build event notifications to any service you would like. A build event is:

- when a build is started
- when a build ends.

You can use this notification to share build statuses with your git provider if we don’t support it yet, notify only the right team about build success or failure, or use it to automate your in-house release pipeline.

You can add, remove and edit your webhooks easily on the website interface.

## Adding an outgoing webhook

You can set up and configure the webhooks sent by Bitrise on the web UI. Let's see how!

1. Go to your app's page on [bitrise.io](https://www.bitrise.io) and open the `Code` tab.

1. Click `+ Add webhook`.

    ![Adding outgoing webhook](/img/webhooks/adding-outgoing.png)

1. Enter the URL of the service where you wish to send the notification in the `URL` field.

1. Select either the `Send me everything` or the `Select individual events` option.

    - `Send me everything`: every supported event type will trigger the webhook. Currently, only build events are supported but there will be other options in the future!
    - `Select individual events`: you can specify the individual events that should trigger the webhook.

1. Click `Create Webhook`.

And you're done! You can modify your webhook at any time by clicking `Edit` next to the webhook URL displayed.

### Adding custom headers to outgoing webhooks

You can add extra headers to your outgoing webhooks via the `Code` tab of the web interface. For example, if you have an API listening to the webhook, you can track the requests with API keys set as a custom header.

You can add custom headers either when:

- [creating a new outgoing webhook](/webhooks/adding-outgoing-webhooks#adding-an-outgoing-webhook).
- modifying an existing outgoing webhook by clicking the `Edit` button next to the URL.

Add the header:

1. Find the `WEBHOOK HEADERS` section.

    ![Webhook headers](/img/webhooks/webhook-headers.png)

1. Add a key and a value to the header. You need both to be able to save the header.

1. Click `Add header`.

1. Click `Create webhook`/`Update webhook`.

## Checking and resending webhook deliveries

You can check if the notifications were successfully sent or not, and you can check both the payload and the response. The deliveries are marked with appropriate status code, depending on whether the delivery was successful. If it was, you will see a green check mark; if it failed, you will see an orange triangle.

1. Go to the `Recent deliveries` section of the `Outgoing Webhooks` menu.

1. Click an outgoing webhook.

    ![Outgoing webhook](/img/webhooks/outgoing-webhook.jpeg)

1. Select the `REQUEST` tab to see and, if you wish, modify the payload that was sent to the specified URL.

    An example payload:

        {
          "build_slug":"1234abcd",
          "build_number":3,
          "app_slug":"abcd1234",
          "git": {
            "provider":"github",
            "src_branch":"feature/branch",
            "dst_branch":master, # If the build was triggered by a pull request
            "pull_request_id":32 # If the build was triggered by a pull request
          }
        }

1. Select the `RESPONSE` tab to see the response from the service you sent the notification to.

1. You can redeliver any delivery. Open the delivery you need and click `Redeliver`.

    ![Redeliver](/img/webhooks/redeliver-payload.jpeg)

repository: kubode/devcenter

gha_license_id: MIT

repo_name: kubode/devcenter


text:
# Node directive with additionalLabels

Additional labels using @node.

Schema:

```graphql
type Actor @node(additionalLabels: ["Person"]) {
    name: String
    movies: [Movie] @relationship(type: "ACTED_IN", direction: OUT)
}

type Movie @node(label: "Film", additionalLabels: ["Multimedia"]) {
    id: ID
    title: String
    actors: [Actor]! @relationship(type: "ACTED_IN", direction: IN)
}
```

---

## Select Movie with additional labels

### GraphQL Input

```graphql
{
    movies {
        title
    }
}
```

### Expected Cypher Output

```cypher
MATCH (this:Film:Multimedia)
RETURN this { .title } as this
```

### Expected Cypher Params

```json
{}
```

---

## Select movie and actor with additional labels

### GraphQL Input

```graphql
{
    movies {
        title
        actors {
            name
        }
    }
}
```

### Expected Cypher Output

```cypher
MATCH (this:Film:Multimedia)
RETURN this { .title, actors: [ (this)<-[:ACTED_IN]-(this_actors:Actor:Person) | this_actors { .name } ] } as this
```

### Expected Cypher Params

```json
{}
```

---

## Create Movie and relation with additional labels

### GraphQL Input

```graphql
mutation {
    createMovies(
        input: [
            { id: 1, actors: { create: [{ node: { name: "actor 1" } }] } }
            { id: 2, actors: { create: [{ node: { name: "actor 2" } }] } }
        ]
    ) {
        movies {
            id
        }
    }
}
```

### Expected Cypher Output

```cypher
CALL {
  CREATE (this0:Film:Multimedia)
  SET this0.id = $this0_id

    WITH this0
    CREATE (this0_actors0_node:Actor:Person)
    SET this0_actors0_node.name = $this0_actors0_node_name
    MERGE (this0)<-[:ACTED_IN]-(this0_actors0_node)

  RETURN this0
}

CALL {
  CREATE (this1:Film:Multimedia)
  SET this1.id = $this1_id

    WITH this1
    CREATE (this1_actors0_node:Actor:Person)
    SET this1_actors0_node.name = $this1_actors0_node_name
    MERGE (this1)<-[:ACTED_IN]-(this1_actors0_node)

  RETURN this1
}

RETURN this0 { .id } AS this0, this1 { .id } AS this1
```

### Expected Cypher Params

```json
{
    "this0_id": "1",
    "this0_actors0_node_name": "actor 1",
    "this1_id": "2",
    "this1_actors0_node_name": "actor 2"
}
```

---

## Delete Movie with additional additionalLabels

### GraphQL Input

```graphql
mutation {
    deleteMovies(where: { id: "123" }) {
        nodesDeleted
    }
}
```

### Expected Cypher Output

```cypher
MATCH (this:Film:Multimedia)
WHERE this.id = $this_id
DETACH DELETE this
```

### Expected Cypher Params

```json
{
    "this_id": "123"
}
```

---

## Update Movie with additional labels

### GraphQL Input

```graphql
mutation {
    updateMovies(where: { id: "1" }, update: { id: "2" }) {
        movies {
            id
        }
    }
}
```

### Expected Cypher Output

```cypher
MATCH (this:Film:Multimedia)
WHERE this.id = $this_id
SET this.id = $this_update_id

RETURN this { .id } AS this
```

### Expected Cypher Params

```json
{
    "this_id": "1",
    "this_update_id": "2"
}
```

---

## Count movies with additional labels

### GraphQL Input

```graphql
{
    moviesCount
}
```

### Expected Cypher Output

```cypher
MATCH (this:Film:Multimedia)
RETURN count(this)
```

### Expected Cypher Params

```json
{}
```

---

repository: SeanKilleen/graphql

repo_name: SeanKilleen/graphql


text:
# cpr_orchard_gazebo

Outdoor orchard simulation world for Gazebo

## Supported Platrofms

### Husky

[![Launch Stack](launch-stack.png)](
https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?region=us-east-2&templateURL=https://cpr-gazebo-public.s3.us-east-2.amazonaws.com/CPR-Kinetic-Simulation-Stack.yaml&stackName=cpr-orchard-gazebo&param_SimWorld=cpr_orchard_gazebo&param_SimLaunch=orchard_world.launch&param_RoboticPlatform=husky)

### Jackal

[![Launch Stack](launch-stack.png)](
https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?region=us-east-2&templateURL=https://cpr-gazebo-public.s3.us-east-2.amazonaws.com/CPR-Kinetic-Simulation-Stack.yaml&stackName=cpr-orchard-gazebo&param_SimWorld=cpr_orchard_gazebo&param_SimLaunch=orchard_world.launch&param_RoboticPlatform=jackal)

### Warthog

[![Launch Stack](launch-stack.png)](
https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?region=us-east-2&templateURL=https://cpr-gazebo-public.s3.us-east-2.amazonaws.com/CPR-Kinetic-Simulation-Stack.yaml&stackName=cpr-orchard-gazebo&param_SimWorld=cpr_orchard_gazebo&param_SimLaunch=orchard_world.launch&param_RoboticPlatform=warthog)

## Launching

```roslaunch cpr_orchard_gazebo orchard_world.launch```

Optionally, you can specify a platform using the platform variable:

```roslaunch cpr_orchard_gazebo orchard_world.launch platform:=jackal```

Supported values for the platform variable are:
* husky (default)
* jackal
* warthog

The spawn location for the robot can be specified by setting the `x`, `y`, `z`, and `yaw` variables.  The Z value should be set
to be above ground-level; otherwise the robot may fall through the ground plane as the environment renders.

## Features

This is a large, open, outdoor world for Gazebo that has:

Many rows of trees separated by dirt paths

There are a few wider, flat areas at each end of the orchard.  The terrain has small bumps, but overall is very flat.


text:
# Unstated With Containers

Higher-Order Component for subscribing to containers.

Simplifies your components, removing the need to constantly use the `Subscribe` component.

## Install

```shell
$ npm install --save unstated-with-containers
```

## Usage

```tsx
import * as React from 'react';
import {Container} from 'unstated';
import withContainers from 'unstated-with-containers';

class CounterContainer extends Container {
  state = { value: 0 };
  increment = () => {
    this.setState({ value: this.state.value + 1 });
  }
  decrement = () => {
    this.setState({ value: this.state.value - 1 });
  }
}

const App = withContainers ( CounterContainer )(
  ({ containers: [counter] }) => ( // props.containers[0] === props.container
    <>
      <p>{counter.state.value}</p>
      <button onClick={counter.increment.bind ( counter )}>Increment</button>
      <button onClick={counter.decrement.bind ( counter )}>Decrement</button>
    </>
  )
);
```

## Related

- **[unstated-connect2](https://github.com/fabiospampinato/unstated-connect2)**: Connect containers to components, without sacrificing performance.
- **[unstated-hmr](https://github.com/fabiospampinato/unstated-hmr)**: Preserve containers' states across Hot-Module-Replacements.
- **[unstated-compose](https://github.com/fabiospampinato/unstated-compose)**: Compose multiple containers into one.
- **[unstated-compose-suspense](https://github.com/fabiospampinato/unstated-compose-suspense)**: Add suspend/unsuspend support to `unstated-compose`.
- **[unstated-compose-suspense-middleware](https://github.com/fabiospampinato/unstated-compose-suspense-middleware)**: Add middlewares support to `unstated-compose-suspense`.
- **[unstated-suspense](https://github.com/fabiospampinato/unstated-suspense)**: Suspend/unsuspend updates propagation from your containers.
- **[unstated-suspense-middleware](https://github.com/fabiospampinato/unstated-suspense-middleware)**: Add middlewares support to `unstated-suspense`.

## License

MIT © Fabio Spampinato


text:
# Notifications

[Github Link](html/notifications_github.html "include")

The Notifications widget provides real-time growl-like messages inside your
application.  Easy to extend with custom notification types, namespaces,
foundational styles, and sane defaults.

[Notifications](html/notifications_demo_iframe.html "include")

## Table of Contents

1. [Code Example](#code-example)
1. [HTML](#html)
1. [CSS](#css)
1. [Constructor](#constructor)
1. [Notifications#subscribe](#notifications#subscribe)
1. [Notifications#unsubscribe](#notifications#unsubscribe)
1. [Notifications#publish](#notifications#publish)
1. [Notifications#destroy](#notifications#destroy)

## Code Example

### 1. Include our CDN assets:

#### Note on Versioning

Specific version of widgets can be found on our [CDN](https://cdn.goinstant.net/).

```html
<script type="text/javascript" src="https://cdn.goinstant.net/v1/platform.min.js"></script>
<script type="text/javascript" src="https://cdn.goinstant.net/widgets/notifications/latest/notifications.min.js"></script>
<!-- CSS is optional -->
<link rel="stylesheet" href="https://cdn.goinstant.net/widgets/notifications/latest/notifications.css" />
```

### 2. Create and initialize the widget:

```js
// Connect URL
var url = 'https://goinstant.net/YOURACCOUNT/YOURAPP';

// Connect to GoInstant
goinstant.connect(url, function(err, platformObj, roomObj) {
  if (err) {
    throw err;
  }

  // Create a new instance of the Notifications widget
  var notifications = new goinstant.widgets.Notifications();

  // Get all notifications
  notifications.subscribe(roomObj, function(err) {
    if (err) {
      throw err;
    }
    // We're now receiving notifications
  });

  // Set options for the notification we're about to publish
  var options = {
    room: roomObj,
    type: 'success',
    message: 'Success: Message delivered',
    displayToSelf: true
  };

  // Send a single notification
  notifications.publish(options, function(err) {
    if (err) {
      throw err;
    }
    // Notification has been sent
  });
});
```

## HTML

### Notification Container

The notifications are rendered to a `div` that is appended to page body once the first notification is received.

```html
<div class="gi-override">
  <!--  Your notifications go here -->
</div>
```

### Notification Element

Each notification is prepended to the notification container.  The notification `type` specified when you publish a notification is used in the image path and the type class `gi-notify-[YOURTYPE]`

```html
<div class="gi-notify gi-notify-[YOURTYPE]">
  <div class="gi-notify-icon">
    <span><!-- Image icon set via css --></span>
  </div>
  <span class="gi-notify-body"><!-- Your message here --></span>
  <a href="#" class="gi-notify-close">
    <span><!-- Close icon set via css --></span>
  </a>
</div>
```
## CSS

### Customizing the default CSS

Each class is prefixed with `gi` to avoid conflicts.  The top-level container
also has a `.gi-override` class. Our goal is to make each widget as easy as
possible to customize.

If you have not included our CSS file, you do not need to use the `gi-override`
class when styling the widget.

![](static/images/css-diagrams/notifications.png)

This stylesheet provides a good starting point for customizing the notification:

```css
.gi-notify-container.gi-override {
  /* Notification container position customizations */
}

.gi-override .gi-notify {
  /* Base notification style customizations */
}

.gi-override .gi-notify-YOURTYPE {
  /* Add custom type styles */
}

.gi-override .gi-notify-YOURTYPE .gi-notify-icon {
  /* Add an icon for your custom type */
}
```

## Constructor

Creates a new instance of the `Notifications` widget, this instance is primarily
used to publish, subscribe, and configure notifications.

### Methods

- ###### **new Notifications()**
- ###### **new Notifications(optionsObject)**

### Parameters
| optionsObject |
|:---|
| Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| An object with the following options: |
| - `maxDisplayed` [**default: 3**] is an integer which dictates the maximum number of notifications that will be displayed at any one time. |
| - `displayTimer` [**default: 3000 (3 seconds)**] is an integer which dictates the duration a notification is displayed. The display timer will be suspended while a user hovers over a notification.
| - `container` [**default: element with class '.gi-notify-container'**] is the [element](https://developer.mozilla.org/en-US/docs/DOM/element) to which notifications will be prepended. |
| - `position` [**default: 'top'**] is a string, used to determine the position of the notifications container, must be one of the following: 'top-left', 'top, top-right', 'bottom-left', 'bottom', 'bottom-right' |

### Example

```js
var customContainer = document.querySelector('.gi-notify-container');

var notifications = new Notifications({
  maxDisplayed: 3,
  displayTimer: 3000,
  container: customContainer,
  position: 'top'
});
```

## Notifications#subscribe

Subscribe to notifications published to the specified Room.

### Methods

- ###### **notifications.subscribe(room, callback(errorObject))**

### Parameters

| room |
|:---|
| Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| `room` is a [GoInstant Room](https://developers.goinstant.net/v1/rooms/index.html), or an array of rooms that you have previously joined. |

| callback(errorObject) |
|:---|
| Type: [Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
| Called if an issue was encountered attempting to subscribe to the room. |
| - `errorObject` will be `null` unless an error has occured. |

### Example

```js
var exampleRoom = platform.room('exampleRoom');

exampleRoom.join(function(err) {

  notifications.subscribe(exampleRoom, function(err) {
    // We're receiving notifications from exampleRoom!
  });

});
```

## Notifications#unsubscribe

Unsubscribe from all notifications associated with this instance.

### Methods

- ###### **notifications.unsubscribe(callback(errorObject))**

### Parameters

| callback(errorObject) |
|:---|
| Type: [Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
| Called if an issue was encountered attempting to unsubscribe from rooms associated with this instance. |
| - `errorObject` will be `null` unless an error has occured. |

### Example

```js
var exampleRoom = platform.room('exampleRoom');

exampleRoom.join(function(err) {

  notifications.subscribe(exampleRoom, function(err) {
    // We're receiving notifications from exampleRoom!
  });

  notifications.unsubscribe(exampleRoom, function(err) {
    // Not anymore!
  });

});
```

## Notifications#publish

Publish a new notification to the `room` or `rooms` specified with the given `message` and (optional) message `type`.  Users subscribed to this room will receive this notification.

### Methods

- ###### **notifications.publish(optionsObject)**
- ###### **notifications.publish(optionsObject, callback(errorObject))**

### Parameters

| optionsObject |
|:---|
| Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| An object containing the `room`, `message` and message `type` |
| - `room` is a [GoInstant Room](https://developers.goinstant.net/v1/rooms/index.html) or an array of rooms that you have previously joined. |
| - `message` is the message that will be inserted into the body of the notification. |
| - `type` [**default: info**] is the type of message, which can be 'info', 'warning', 'error', or 'success'. |
| - `displayToSelf` [**default: false**] when true and the notification is published succesfully it will be displayed locally too. |

| callback(errorObject) |
|:---|
| Type: [Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
| Called once the notification has been sent or when an error has occured . |
| - `errorObject` will be `null` unless an error has occured. |

### Example

```js
notifications.publish({
  room: exampleRoom,
  type: 'success',
  message: 'Success: Message delivered!'
}, function(err) {
  if (err) {
    // Uh oh: the message wasn't delivered
    console.log(err);
  }
});
```

## Notifications#destroy

Stop listening to notifications & remove the notifications container from the DOM.

### Methods

- ###### **notifications.destroy()**
- ###### **notifications.destroy(callback(errorObject))**

### Parameters

| callback(errorObject) |
|:---|
| Type: [Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) |
| Called upon the completion of `Notifications.destroy`. |
| - `errorObject` will be `null` unless an error has occured. |

### Example

```js
notifications.destroy(function(errorObject) {
  // Your now unsubscribed & notification indicators have been removed
});
```

repository: goinstant/notifications

repo_name: goinstant/notifications


text:
# NBB.SQLStreamStore.Migrations

Generates the database objects as required by [`NBB.SQLStreamStore`](../NBB.SQLStreamStore#readme)

## NuGet install
```
dotnet add package NBB.SQLStreamStore.Migrations
```

repository: osstotalsoft/nbb

gha_language: C#

repo_name: osstotalsoft/nbb


text:
+++
# Slider widget.
widget = "slider"  # See https://sourcethemes.com/academic/docs/page-builder/
headless = true  # This file represents a page section.
active = true  # Activate this widget? true/false
weight = 30  # Order that this section will appear.

# Slide interval.
# Use `false` to disable animation or enter a time in ms, e.g. `5000` (5s).
interval = 5000

# Slide height (optional).
# E.g. `500px` for 500 pixels or `calc(100vh - 70px)` for full screen.
height = ""

# Slides.
# Duplicate an `[[item]]` block to add more slides.
[[item]]
  title = "Proofpoint on OpenShift Container Platform"
  content = "Running MongoDB and Node.js on Red Hat OpenShift Container Platform"
  align = "center"  # Choose `center`, `left`, or `right`.

  # Overlay a color or image (optional).
  #   Deactivate an option by commenting out the line, prefixing it with `#`.
  overlay_color = "#666"  # An HTML color value.
  overlay_img = "node_mongo.jpg"  # Image path relative to your `static/img/` folder.
  overlay_filter = 0.6  # Darken the image. Value in range 0-1.

  # Call to action button (optional).
  #   Activate the button by specifying a URL and button label below.
  #   Deactivate by commenting out parameters, prefixing lines with `#`.
  cta_label = "IBM Developer"
  cta_url = "https://developer.ibm.com/tutorials/mongodb-nodejs-on-openshift/"
  cta_icon_pack = "fas"
  cta_icon = "graduation-cap"

[[item]]
  title = "Advantages of Running Openshift on IBM Power Systems"
  content = "Pack-em or Stack-em: Advantages of Running OpenShift on Power"
  align = "center"  # Choose `center`, `left`, or `right`.

  # Overlay a color or image (optional).
  #   Deactivate an option by commenting out the line, prefixing it with `#`.
  overlay_color = "#111"  # An HTML color value.
  overlay_img = "openpower.jpg"  # Image path relative to your `static/img/` folder.
  overlay_filter = 0.6 # Darken the image. Value in range 0-1.

  # Call to action button (optional).
  #   Activate the button by specifying a URL and button label below.
  #   Deactivate by commenting out parameters, prefixing lines with `#`.
  cta_label = "Pack-em or Stack-em"
  cta_url = "https://youtu.be/4fJkiUR1JQo"
  cta_icon_pack = "fas"
  cta_icon = "graduation-cap"

+++


text:
# Static Data Importer Bundle

A Symfony CLI Bundle for importing json, csv and/or xml directly into a database via an entity object.

**Install**:
```bash
composer require kerrialn/static-data-importer-bundle
```

**Configure**: add json, xml or csv files to `./data` (name this anything you want) root directory in your project
   1. File naming convention `{order number}_{entity name}.{format}` Eg... `10_Blog.json`, `20_category.csv` or `30_User.xml` (entity name is case-insensitive)
   2. Change the import order, with the order number in the file name.
   3. Add `_SKIP` (case-sensitive) to the filename to skip the file.

**Run**:

```bash
bin/console import data/
```

Please note: id fields will be ignored and will generate id as per your entity annotation/attribute definition.

repository: Kerrialn/static-data-importer-bundle

branch_name: refs/heads/main

gha_language: PHP

repo_name: Kerrialn/static-data-importer-bundle


text:
# Blockchain Demo
A web-based demonstration of blockchain concepts.

This is a very basic visual introduction to the concepts behind a blockchain. We introduce
the idea of an immutable ledger using an interactive web demo that is available here:

## Setup
Get the code:

```
git clone https://github.com/viralpatel380/Blockchain-Demo.git
```

Install dependencies:

```
cd blockchain-demo
npm install
```
Run the server:

```
npm start
```

OR

```
./bin/www
```
#For windows: if the above command didn't work, use this (make sure you have Node.js installed in your system):
```
node ./bin/www
```

Point a web browser at the demo:

```
http://localhost:3000
```

## Setup using Docker

Run the Docker setup:

```
cd blockchain-demo
docker-compose up -d
```

Point a web browser at the demo:

```
http://localhost:3000
```


text:
# Hello World iOS app

* Open Xcode project
```
open hello_swift.xcodeproj/
```
* In Xcode hello_swift project settings -> General -> Signing you must choose a development team to sign the app.
* Press Run

hello.framework appears missing at first, but the project will generate hello.framework by invoking the build script as the first build step.

repository: Dschoordsch/gluecodium

repo_name: Dschoordsch/gluecodium


text:
# **Model Predictive Control**
[![Udacity - Self-Driving Car NanoDegree](https://s3.amazonaws.com/udacity-sdc/github/shield-carnd.svg)](http://www.udacity.com/drive)

Compiling
---
The project is compiled in Ubunutu 18.04.
To compile,
```
    mkdir build
    cd build
    cmake ..
    make
    ./mpc
 ```

Implementation
---
### Model
Model includes 6 states and 2 actuators along with the cost.
6 state vectors are: `[x, y, psi, v, cte, epsi]`
2 actuators are: `[delta, a]` (steering angle and throttle).

Update equations:
```
    x[t+1] = x[t] + v[t] * cos(psi[t]) * dt
    y[t+1] = y[t] + v[t] * sin(psi[t]) * dt
    psi[t+1] = psi[t] + v[t] * delta[t] / Lf * dt
    v[t+1] = v[t] + a[t] * dt
    cte[t+1] = cte[t] + f(x[t]) - y[t] + v[t] * sin(epsi[t]) * dt
    espi[t+1] = psi[t] - psides[t] + v[t] * delta[t] / Lf * dt
 ```
With the update equations fed to the `ipopt solver`, it solves for the actuators, `delta` and `a`.
The initializations, upper bound and lower bound for the variables and constraints are taken from the classroom lesson code.

### Timestep length and Elapsed duration
| N | dt | Result |
|---------------:|:----------:|:-------------:|
| 5 | 0.1 | The timestep length isn't enough for the car to make predictions and to turn. |
| 10 | 0.1 | This seemed very smooth and was able to complete the track successfully. |
| 15 | 0.1 | Initially was smooth but lost some stability in turns, although it corrected in next timestep. |
| 10 | 0.2 | With increased dt car became slow during turns and at times the difference between the actual waypoints and predicted way points is more and car touches the line during turns |

I am finally stuck with `N = 10` and `dt = 0.1` as it produced good performance.

### Polynomial fitting
The points `ptsx` and `ptsy` are first transformed from global coordinates to car coordinates. These transformed points are used in a `third degree polyfit` to fit a cubic curve along which car is beleived to traverse.
Since the fitting results are in car coordinates, the state vector x, y, psi becomes 0 and `cte = coeffs[0]` and `epsi = -arctan(coeffs[1])`

### Latency
There is a 100ms (0.1s) latency with car responding to the actuators. To account for this latency the state vector given to the model is predicted with dt = 0.1 (the 100ms latency). Instead of car responding to the previous actuation now with the predicted state car responds to the current actuation.

repository: chetansadhu/Model-Predictive-Control

repo_name: chetansadhu/Model-Predictive-Control


text:
# Apple2FA
Dumps the dspPrsID:mmeAuthToken for Apple accounts with 2FA enabled.

## How to use
Running this script should be easy. Simply Download all files, cd in the directory, and issue the following command:
```
php 2FA.php
```

## Example
```
MBP-2:~ User$ php 2FA.php
Apple ID<EMAIL_ADDRESS>Password: Password123
Sending 2FA Request...
2FA Code: 445887
6435619887:AQAAAABXKyTtYo3cKch4OAN2vVUf9iZ2C0qRPJZ=
```

## Requirements
* PHP 5 or above


text:
**Name: **Anuj Pahuja

**IRC handle: **alasin

**Email -** [kamikazeanuj<EMAIL_ADDRESS>
**Location: **Gurgaon, India (GMT + 0530 hrs)

**Project Title: **Cloud removal from Satellite Imagery in GeoTrellis

**Motivation for the proposal:**

Having worked on multiple Image processing and Computer Vision projects like object tracking, image retrieval and video stabilization, the idea of combining computer vision with a functional language is still new to me and hence, all the more interesting. The eagerness to learn and work on something as cool as this, coupled with my interest in Computer Vision encouraged me to work on this project and contribute to GeoTrellis. Even after the project gets over, I plan to implement other CV algorithms like image segmentation for satellite imagery in GeoTrellis.

**Abstract:**

Clouds and cloud shadows often obscure parts of images acquired by satellites or other space-borne sensors. However, useful image data could be extracted from other relatively non-cloudy images of the same geographical location that can be used to ‘fill’ these obscure parts. Multiple images can be captured of an area of interest over time, such as Landsat images. When combined together with the right algorithms, these images can offer a cloud-free (or nearly cloud-free) view of that area. GeoTrellis is already great at distributed raster processing on a cluster. If it were enabled with the power to remove clouds from a large set of imagery, it would enable users to run that process over any amount of imagery, in a scalable way.

**Implementation Details:**

This project will assume that the imagery to be operated on is already stored inside a GeoTrellis system, and can be retrieved by GeoTrellis as a RasterRDD. The retrieval of imagery will be handled by the GeoTrellis system, and while some functionality might be required to correctly produce a set of overlapping imagery to be processed, this project will focus on the cloud removal processing of imagery that is provided by this method.

The cloud removal functionality will be implemented in broadly three steps:

Cloud detection using Fmask[1]:

Fmask algorithm developed by Zhu et al.[1] will be implemented to detect clouds and cloud shadows in the input images and generate corresponding cloud masks for further processing. The algorithm would take in the Top of Atmosphere (TOA) reflectances for Bands 1, 2, 3, 4, 5, 7  and Band 6 Brightness Temperature (BT) of the Landsat images as the inputs. Then, rules based on cloud and cloud shadow physical properties would be used to extract a potential cloud layer and a potential cloud shadow layer. This would mainly involve spectral tests on the images to identify Potential Cloud PIxels (PCPs). Some of these tests are:

* Spectral tests on the images to identify Potential Cloud Pixels (PCPs).

* Setting thresholds for NDSI (Normalized Difference Snow Index) and NDVI (Normalized Difference Vegetation Index).

* Performing a Whiteness test for cloud pixel identification.

* Performing a Haze Optimization Transformation (HOT) test.

* Performing a ‘Water Test’ to separate water and land pixels.

Based on these tests, cloud probability for all pixels will be calculated and a potential cloud layer and cloud shadow layer would be extracted. Finally, the segmented potential cloud layer and the geometric relationships would be used to match it with the potential cloud shadow layer, leading to the production of the final cloud and

cloud shadow mask which will be saved as another image.

Processing the cloud masks and base images:

The image containing the cloud mask would be binarized so as to separate the actual cloud and cloud shadow from other pixels. The mask image would further be processed depending upon the absence of data in the original image. Depending on the position of cloud regions in the *fill *images, or the less cloudy images, a composite labeled cloud mask would be formed labeling pixels as background pixels, clouded pixels in base image and clouded pixels in *fill* images.

Filling Cloudy regions:

For filling the cloudy regions, an NSPI cloud fill algorithm by Zhu et al.[2] will be implemented. The algorithm uses a weighted linear model to predict the spectral value of a target pixel from its neighbouring similar pixels. Here is the flowchart describing this approach[2]:

![image alt text](media/image_0.png)

It’s important to note that the Fmask algorithm described above is limited to Landsat/ETM+ images and thus, restricts the scope of this algorithm. However, the project is in service of implementing cloud removal algorithms for multiband imagery in general, and to make improvements in the framework that allow general algorithms to run over imagery data. Implementation of the Fmask algorithm will be an initial step towards those broader framework improvements. The project aims to be an initial step towards cloud removal for satellite imagery in general.

[1] Zhu, Z. and Woodcock, C. E., Object-based cloud and cloud shadow detection in Landsat imagery, Remote Sensing of Environment (2012).

[2] Zhu, X., Gao, F., Liu, D., Chen, J., 2012. A modified neighborhood similar pixel interpolator approach for removing thick clouds in Landsat images. Geoscience and Remote Sensing Letters, IEEE 9, 521–525.

**Tentative Timeline:**

28 April - 24 May (Community Bonding Period):

* Setting up the development environment.

* Getting familiar with GeoTrellis codebase and its API use.

* Learning more about Scala and its properties.

* Getting the test dataset and software ready for the project.

* Discussing the flow of action and finalizing a workplan with the mentor.

25 May - 8 June (2 weeks):

* Implementing the first pass of extracting potential cloud layer which comprises of doing a Cloud Test, Snow Test and Water Test for pixels.

9 June - 16 June (1 week):

* Implementing the second pass of extracting potential cloud layer by computing cloud probability for all the pixels.

17 June - 24 June (1 week):

* Extracting cloud shadow layer from the image.

25 June - 9 July (2 weeks):

* Matching the extracted cloud with its corresponding shadow layer and generating the final mask file.

10 July - 24 July (2 weeks):

* Processing base images and the mask files, labeling them accordingly and generating final mask for the cloud fill algorithm.

25 July - 8 August (2 weeks):

* Implementing the modified NSPI algorithm for filling cloudy regions using the mask obtained above.

9 August - 21 August (Pencils Down):

* Integrating everything with the main software.

* Testing code for other datasets and solving bugs.

* Cleaning up code and writing instructions for use.

**Other Commitments:**

I have no other commitments during the coding period and will be able to work for 40-45 hours per week. Having successfully completed GSoC last year, I am confident that I will be able to manage my time efficiently and devote as much time as required to complete the project.

**About me:**

I am a final year undergraduate student pursuing my Bachelors in Computer Science from BITS Pilani. Apart from having lots of interest in computing in general, I have been an open source enthusiast from past 3 years and have participated in GSoC 2014 with KDE and have also mentored students in Season of KDE and Google Code-In.

I have a keen interest in Image Processing and Computer Vision, having worked on Motion based object tracking, video stabilization, image analysis methods, content-based image retrieval and image deconvolution. Working on Computer Vision with Scala will be a first for me and I hope the experience will keep getting better.

My Github profile [here](https://github.com/alasin/).

My LinkedIn profile [here](http://in.linkedin.com/in/anujpahuja).

repository: saketkc/fos-proposals

gha_language: Python

repo_name: saketkc/fos-proposals


text:
---
hrs_structure:
  division: '2'
  volume: '11'
  title: '26'
  chapter: 482D
  section: 482D-11
type: hrs_section
tags:
  - Business
menu:
  hrs:
    identifier: HRS_0482D-0011
    parent: HRS0482D
    name: 482D-11 Jurisdiction of civil actions
weight: 42055
title: Jurisdiction of civil actions
full_title: 482D-11 Jurisdiction of civil actions
---
**[§482D-11] Jurisdiction of civil actions.** The circuit courts shall have exclusive original jurisdiction of any civil action arising under the provisions of this chapter. [L 1990, c 343, pt of §2]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Mutagen Architecture

In `mutagen`, there is a difference between of `mutators` and `mutations`.

1. Mutators are inserted at compile-time by the attribute `#[mutate]`
2. Mutations are introduced at run-time by activating mutators

## Mutators

Mutators are hooks inside the source code can be activated to change the behavior, they do not change the behavior of the code, unless activated. Each mutator is responsible for a single piece in the original code and can be activated for possibly multiple mutations.

### Procedural Macro `#[mutate]`

The attribute `#[mutate]` is a procedural macro that inserts into the program by transforming the source code on the AST-level.

Known patterns of code (e.g. arithmetic operations, boolean logic, loops, ...) get replaced by mutators. The code that describes the transformations to insert each mutator is implemented in the same file with the logic of that mutator.

Each mutator only has access to the plain AST without inferred types or global information. The transformed code must successfully compile regardless of other global information. Unfortunately, the possibilities for performing type-analysis of the code under test is limited since the macro has no access to the code outside the annotated region.

The test suite is compiled once and contains all mutators.

## Mutations

A mutation occurs when a mutator is activated for a single run of the test suite. By default no mutator is active and calling `cargo test` should run all tests successfully.

A mutator can be activated by setting the environment variable `MUTATION_ID` to a positive number for a single test suite run (e.g. `MUTATION_ID=1 cargo test`). Note that the test suite is not recompiled for each call of `cargo test` if the source code was not changed.

If all tests pass despite the mutation, the mutant "survives". Otherwise, the mutant is "killed". The mutation coverage is the number of mutants that survived.

### Runtime Configuration

The library `mutagen` defines a type `MutagenRuntimeConfig`, which contains the information about which mutation is activated for the current execution of the test suite by querying the `MUTATION_ID` environment variable. The global default config is fetched using the function `MutagenRuntimeConfig::get_default()`, which is already inserted into the source code by the `#[mutate]` attribute.

## Optimistic Mutations

A standard mutation represents a change in the source code such that the changed source code still successfully compiles. A mutation is *optimistic* if the corresponding changed code does not compile when some type-level restrictions are not met.

Since `mutagen` only compiles the test code only once and the procedural macro has no information for the types, mutators with optimistic mutations have to be inserted without the possibility to check if type-level assumptions hold.

If the assumptions on the type are not fulfilled, the mutator panics in order to fail the test suite, since it is not desirable to count such mutants as survivors since they do not represent a valid alteration of the source code. To implement this behavior, the unstable feature `specialization` is used.

Below, there are some examples of optimistic mutators and their type-level assumptions.

### Mutations on arithmetic

Rust's type system allows to write a custom implementation for the operators `+` and `-` independently from each other. In general, if one operator is implemented, the other might not be implemented or the required types differ. However in many contexts, both operators are indeed defined and replacing one by the other would lead to a bug without producing compiler errors.

### Removing negation

Most types that have a implementation for `Not` have `Output = Self`. This is true for the logic and numerical types. Removing the negation will be a valid mutation in most cases.

repository: llogiq/mutagen

gha_language: Rust

repo_name: llogiq/mutagen


text:
# ReadMe Generator
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Last Commit](https://img.shields.io/github/last-commit/tsgrewing/ReadMe-Generator) ![Repo Size](https://img.shields.io/github/repo-size/tsgrewing/ReadMe-Generator)

  ## Description
  A CLI program to generate a good ReadMe for projects. The generated ReadMe should include a title, description, clickable table of contents, and sections for usage, contributing, testing, and licensing info. There will also be instructions for contacting the project creator with questions, and the option to add badges to the bottom of the readme.

  ## Table of Contents
  [Installation](#Installation)

  [Demo](#Demo)

  [Usage](#Usage)

  [License](#License)

  [Contributing](#Contributing)

  [Tests](#Tests)

  [Questions](#Questions)

  ## Installation
  Clone the repo, then run npm install from the command line

  ## Demo
  ![Demo](/assets/demo.gif)

  ## Usage
   After installation run index.js and answer the questions. After all the questions have been answered "ReadMe.md" will be created and poplulated with their answers.

  ## License
  This project is covered under the MIT License, more information can be found [here](https://opensource.org/licenses/MIT).

  ## Contributing
  Please contact before contributing

  ## Tests
  Run the program from the command line.

  ## Questions
  GitHub Profile: [tsgrewing](http://github.com/tsgrewing)
  Please email me at<EMAIL_ADDRESS>with additional questions.

repository: tsgrewing/ReadMe-Generator

gha_language: JavaScript

repo_name: tsgrewing/ReadMe-Generator


text:
# apache-log-slow-query
This small tool helps to list and identify slow queries from an apache log file with time information.

## Prerequisites

```bash
  sudo gem install --no-ri --no-rdoc apachelogregex
```

### Usage

```bash
```

repository: Coren/apache-log-slow-query

repo_name: Coren/apache-log-slow-query


text:
# postgres

---
**NOTE:**

**This repository has been archived. The docker library now provides multi-arch images so please use the equivalent image from [here](https://github.com/docker-library/official-images).**

---

[![Docker Repository on Quay](https://quay.io/repository/armswarm/postgres/status "Docker Repository on Quay")](https://quay.io/repository/armswarm/postgres)

This repository builds the postgres image for ARM.

The `docker-entrypoint.sh` is a slightly modified version of the script found upstream in https://github.com/docker-library/postgres/.

repository: armswarm/postgres

repo_name: armswarm/postgres


text:
## Young-Hyun Oh

Client Technical Lead (CTL) for IBM Quantum Hub at NC state
Dates EmployedFeb 2019 – Present
Employment Duration1 yr 6 mos
* Quantum computing research on solving quantum optimization problems using QAOA and VQE.
- published "Solving Multi-Coloring Combinatorial Optimization Problems Using Hybrid Quantum Algorithms" in arXiv (https://arxiv.org/abs/1911.00595).
- published "An Improved Implementation Approach for Quantum Phase Estimation on Quantum Computers" in IEEE ICRC 2019 (https://ieeexplore.ieee.org/abstract/document/8914702).
* Developed QISKIT Development environment based on Kubernetes cluster environment.
* Designed and developed QISKIT teaching materials for NC Q Hub.


text:
# Installation
> `npm install --save @types/shell-quote`

# Summary
This package contains type definitions for shell-quote (https://github.com/substack/node-shell-quote).

# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/shell-quote

Additional Details
 * Last updated: Fri, 14 Jul 2017 14:18:49 GMT
 * Dependencies: none
 * Global values: none

# Credits
These definitions were written by Jason Cheatham <https://github.com/jason0x43>.

repository: Maxguojiaqi/AAFCTemp

repo_name: Maxguojiaqi/AAFCTemp


text:
# Changelog

## 0.19.0

Several of the Kefir method wrappers were optimized to only create new
observables when necessary.  This can reduce memory usage significantly.  For
example, previously `U.toProperty` created an observable when given a constant
value.  Now it only creates a new observable when it is given a Kefir stream.

Removed previously deprecated
* `combines`,
* `seq`,
* `seqPartial`,
* `Context`, and
* `withContext`.

## 0.18.23

`getProps` and `actions` now perform their actions while `holding` change
propagation.

## 0.18.10

Fixed `show` to also work with Kefir streams.

## 0.18.6

Marked `combines` as obsolete.  It uses the old Kefir Combines library and has
an unnecessarily complex signature, because it uses variadic arguments and the
combiner function is optional.

## 0.18.3

Obsoleted `seq` and `seqPartial`.  The motivation here is to reduce the library
API surface.  `thru` can basically always replace `seq` and `seqPartial` is
fairly rarely needed.

## 0.18.1

Migrated the context implementation to use the React Context API and also marked
it obsolete.  Just use the React Context API.

## 0.18.0

Major reorganization of the library on the road towards v1.0.0.

Removed all lifted Ramda combinators from Karet Util.  Use the [Kefir
Ramda](https://github.com/calmm-js/kefir.ramda) library instead.

Removed

* the default export `K`,
* `U.lift`,
* `U.lift1`,
* `U.lift1Shallow`, and
* `U.staged`.

with the (experimental) idea that all lifting is done via `U.combines` and the
new `U.liftRec`.  The idea here is to make lifting easier especially for
newcomers and to avoid using default exports.

Removed `U.iftes` and renamed `U.cases` to `U.cond`:

```diff
-U.iftes(c1, t1,  ...,  e1)
+U.cond([c1, t1], ..., [e1]])
```

Also renamed `U.ifte` to `U.ifElse`:

```diff
-U.ifte(c, t, e)
+U.ifElse(c, t, e)
```

and `U.ift` to `U.when`:

```diff
-U.ift(c, t)
+U.when(c, t)
```

and added `U.unless`:

```diff
-U.ift(U.not(c), e)
+U.unless(c, e)
```

These renamings became possible due to the removal of lifted Ramda.  The
previous names were compromises to avoid name clashes with Ramda.

Removed broken `U.skipFirstErrors` (Kefir currently doesn't have such a method)
and `U.thruPartial` (the implementation was broken and it would require a much
more complex implementation).

Removed `U.bind`:

```diff
-<input {...U.bind({value}) />
+<input value={value} onChange={U.getProps({value})} />
```

and `U.bindProps`:

```diff
-<div {...U.bindProps({ref: 'onScroll', scrollTop}) />
+<div ref={U.setProps({scrollTop})}
+     onScroll={U.getProps({scrollTop})} />
```

and `U.classes`:

```diff
-<div {...U.classes(...)} />
+<div className={U.cns(...)} />
```

The reason behind these is to avoid "attribute templates" that make it harder to
see which attributes are being defined.

Removed `U.mapCached`, `U.mapIndexed`, and `U.indices`.  The (experimental) idea
is to try and do the same things using lenses with `U.mapElems` and
`U.mapElemsWithIds`, and also using e.g. lifted `R.map` and lifted
`L.collectAs`.

The Standard `Math`, `JSON`, and `String` functions are now lifted using
`U.liftRec`.  This means that the functions are no longer curried and behave
more like their unlifted versions.  For example, `U.stringify(json)` returns the
stringified result and `U.hypot` can be called with any number of arguments.
Also added `U.max` and `U.min` (previously they came from Ramda).

Removed the (rarely used) `U.WithContext` component.  Just use `U.withContext`.

## 0.11.3

This library now explicitly depends only on
the [stable subset](https://github.com/calmm-js/partial.lenses/#stable-subset)
of partial lenses.

## 0.11.2

Kefir was changed from a dependency to a peer dependency to avoid the
possibility of having multiple versions of Kefir in a project.

## 0.10.0

Most of the previously unsupported Ramda functions are now also provided.  The
lifting / staging of a number of Ramda functions has been adjusted.  In
particular, `U.is`, `U.where`, and `U.whereEq` now takes one and one arguments
and `U.ascend`, `U.descend`, `U.eqBy` and `U.eqProps` take one and two
arguments.  This was done to make their typical uses cases notationally more
convenient.

## 0.9.0

Updated dependencies with major versions.

## 0.7.0

* Changed semantics of `ift` and `ifte` again so that they return properties
  rather than streams.

* Now using `infestines` where possible.  Note that there is no intention at
  this point to drop the Ramda dependency from this library.

## 0.6.0

The semantics of `ift` and `ifte` have been changed.  Previously they were a
kind of `lift`ed conditionals:

```js
const invoke = thunk => typeof thunk === "function" ? thunk() : thunk

export const ifte = lift((b, t, e) => invoke(b ? t : e))
export const ift = lift((b, fn) => b ? invoke(fn) : null)
```

The `invoke` mechanism was introduced to allow one to have VDOM in the `t` and
`e` clauses, because, without it, `lift` would eliminate observables from the
VDOM template.  However, this makes the signatures of `ifte` and `ift` a bit
complex and I managed to get tripped by the lifting behavior more than once
(forgetting to wrap VDOM with `() => ...`).  The return value `null` of `ift` is
also a bit surprising.

The new versions use `flatMapLatest` instead of `lift`:

```js
export const ifte = R.curry((b, t, e) => flatMapLatest(b => b ? t : e, b))
export const ift = R.curry((b, t) => flatMapLatest(b => b ? t : undefined, b))
```

This means that none of the parameters `b`, `t` and `e` is implicitly lifted as
a template and it is safe to have VDOM as a `t` or `e`.  There is also no
`invoke` and the result of `ift(false, _)` is now `undefined`, which is arguably
less surprising.  One special consideration with the use of `flatMapLatest` is
that the `t` and `e` clauses get subscribed and unsubscribed to based on the
value of `b`.  This can be either useful or surprising, because subscribing to
an observable may or may not cause side-effects.

Note that `ift` and `ifte` now work in a kind of lazy manner similar to what
core language conditionals do.  This is also different from what combinators
like `and` and `or` do that are just lifted versions of Ramda's functions.

The new semantics of `ift` and `ifte` seem to better match the use cases where
I've used them, resulting in small simplifications of application code.

## 0.3.0

* Removed `pipe`.  This is because the way it worked was simply not very useful.
  It was like Ramda's `pipe`, but with all the given functions lifted before
  composition.  The problem here is that this often results in lifting functions
  multiple times, which leads to wasted performance.

* Renamed `when` as `ift`, which is short for `if-then`.  This rename was made
  so that a lifted version Ramda's `when` can now be provided.

* Added a large number of functions lifted from Ramda and from the built-in
  `Math` module.  This allows one to write logic in direct-style even when using
  properties.

* Added a number of functions from Kefir as curried and unlifted versions.
  **_These are highly experimental at this point._** The idea is that you can
  then use those conveniently in pipelines, i.e. within a `seq`, and that they
  also work when the piped data is not a Kefir property.  This way components
  can be written that can work with both time-varying (properties) and constant
  data.


text:
# review-host

Host multiple [reviews](https://github.com/juliangruber/review) in one app server.

![preview](http://f.cl.ly/items/3O1w3Y0X2i0s1F1M273x/Screen%20Shot%202013-01-24%20at%2012.50.38%20PM.png)

## Usage

First install `review-host`.

```bash
$ npm install -g review-host
```

Then create a directory for your host to live in.

```bash
$ mkdir review && cd review
```

Now create the reviews you wish to host. Check [example/](https://github.com/juliangruber/review-host/tree/master/example) for
a complete example.

Each site (e.g. `sites/bootstrap/index.js`) needs to export a function that returns an express request handler that came
from `review()`.

Example:

```js
module.exports = function (cacheDir) {
  return review()
    .sites({ google : 'http://google.com' })
    .cache({
      dir : cacheDir,
      expires : 60
    })
}
```

```bash
$ mkdir -p sites/bootstrap
$ vim sites/bootstrap/index.js
$ # ...
```

Finally start the server from your `review`-directory. It will now start serving all reviews in `sites/`.

```bash
$ review-host
review-host listening on port 8899
```

## API

### CLI

Issue `review-host --help`

### host(opts)

Returns an `express` request handler. `opts` can be:

* `sites` : The directory your sites are in. Defaults to `./sites`
* `cache` : The directory to write cache files to. Defaults to `./cache`

## Installation

There is no need to have phantomjs installed, it will be fetched automatically together with `review`.

```bash
$ npm install -g review-host # for cli
$ npm install review-host    # for library
```

## License

(MIT)

Copyright (c) 2012 Julian Gruber<EMAIL_ADDRESS>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: todoubled/review-host

repo_name: todoubled/review-host


text:
# listrandom
A combination of **HTML**, **CSS** and **Javascript** that enables the user to define a list of strings and randomize the selection of a single item.

The user also have the option to change background colour of the presentation area and specify an approximate time of "shuffling" the list items before the chosen item is displayed.


text:
# Requirements Document

Authors: Marco Bellavia (s280130), Gabriel Ganzer (s271961), Gianluca Morabito (s277943), Francesco Xia (s277509)

Date:    02/06/2020

Version: 1.1

Changelog: v1.1:
* change the context diagram
    * from simple line to an arrow
* change the deployment diagram
    * add cardinality to the relation  "server -- phone"

# Contents

- [Abstract](#abstract)
- [Stakeholders](#stakeholders)
- [Context Diagram and interfaces](#context-diagram-and-interfaces)
    + [Context Diagram](#context-diagram)
    + [Interfaces](#interfaces)
- [Stories and personas](#stories-and-personas)
- [Functional and non functional requirements](#functional-and-non-functional-requirements)
    + [Functional Requirements](#functional-requirements)
    + [Non functional requirements](#non-functional-requirements)
- [Use case diagram and use cases](#use-case-diagram-and-use-cases)
    + [Use case diagram](#use-case-diagram)
    + [Use cases](#use-cases)
    + [Relevant scenarios](#relevant-scenarios)
- [Glossary](#glossary)
- [System design](#system-design)
- [Deployment diagram](#deployment-diagram)

# Abstract

People driving a car, a truck or a motorbike, whether they have a gasoline, diesel or gas engine, need to get fuel from gas stations. The choice of a gas station is made considering mainly two factors: closeness to the pump and price of the fuel.
A team of developers decides to make this process easier by developing an application that retrieves data from the people contribution (crowdsourcing). Who downloads the app can use it either to locate the closest gas stations in the area along with their fuel prices or to contribute by updating the fuel price in an existing gas station. The application is able to show the gas stations both through a list view or a map view, while the fuel prices, specified for a gas station, are computed considering the average value of the 10 most recent fuel price updates from the last 3 days.
The users have different ways to interact with the system, besides searching, such as: ask for new gas stations to be added into the system, send reviews of gas stations and price updates, thus the app can always be kept up to date.

# Stakeholders

| Stakeholder name | Description |
| ---------------- |:-----------:|
| End User | person who ultimately uses the application. The EZgas system differentiates 3 types of users: 1. unregistered user. 2. registered user 2.1. moderator (a registered user with additional privileges) |
| Developer | person responsible for building and writing the web application |
| Google Maps | system responsible for locating geographically the gas stations|

# Context Diagram and interfaces

## Context Diagram

```plantuml
@startuml
usecase (Ezgas System) as es

actor "End User" as eu
actor :Registered User: as ru
actor :Unregistered User: as ur
actor :Google Maps: as gm
actor :Moderator: as mod

eu <|-- ru
eu <|-- ur
ru <|-- mod

eu --> es
gm <-- es
@enduml
```

## Interfaces

| Actor | Logical Interface | Physical Interface |
| ----- |:-----------------:|:------------------:|
| End User | GUI | touch screen |
| Google Maps | API | internet connection |

# Stories and personas

Eleanor is a young regional volleyball referee that cares about a smart management of her outgoings. She owns a car with a diesel engine and because of her job she often needs to drive it around the region she lives in to reach all the sports hall where volley matches are held.
During her job trips, Eleanor always takes the smartphone and uses the navigator application to get oriented in highways and cities she has never visited before. Frequently happens that she runs low on fuel so that she needs to find a gas station as soon as possible, preferably one from her favorite oil company where she can gain fidelity points for every liter of purchased fuel. Otherwise, she tends to choose the closest gas station that has the lowest fuel price.

 Every morning, before going to work, she brings them to primary school following always the same street path that includes passing by two gas stations from two different oil companies. Barbara wants to be an example for her children and so, when she arrives at work, she always tells her colleagues about the fuel prices she has read while driving the car, in order to let them choose the cheapest option if they need to fill up the tank.

Max is a 26 years old boy owning a motorbike that he uses a lot for traveling around the country. He likes sharing with other people his driving experiences and, in order to do this, he always gives reviews and comments about the places he goes to during his travels. He would certainly give a powerful boost to a crowdsourcing application and become soon a moderator, able to analyze requests from users just like Max’s friends usually do with him.

Patrick is a gas station owner really inclined to new technologies and everyday-use applications. He always does his best to let his customers satisfied with the services and quality offered by his own gas station. He would be really interested in a way to allow everybody to know he has one of the best gas stations, with the best possible rating and, almost always, the lower fuel prices in the area.

# Functional and non-functional requirements

## Functional Requirements

| ID | DESCRIPTION |
| -- |:-----------:|
| FR1 | **Authenticate an user** |
| FR1.1 | log in to the system |
| FR1.2 | log out from the system |
| FR2    | **Manage the price list of a gas station** |
| FR2.1 | update the price list of a gas station |
| FR2.2 | show the price list of a gas station |
| FR3    | **Perform a search** |
| FR3.1 | perform a search using a set of filters |
| FR3.2a | show on screen a list of gas stations |
| FR3.2b | show on a map a list of gas stations  |
| FR3.3 | locate the current position of a device |
| FR4    | **Manage new and existing accounts** |
| FR4.1 | create an account |
| FR4.2 | modify the personal information (i.e. name, surname, password, phone number...) associated with an account |
| FR4.3 | delete an existing account from the system |
| FR4.4 | apply to become moderator |
| FR5    | **Manage new and existing gas stations** |
| FR5.1 | send a request to add a new gas station |
| FR5.2 | send a request to delete a gas station from the system |
| FR5.3 | view and validate a request made by a registered user |
| FR5.4 | add a new gas station to the system |
| FR5.5 | delete a gas station from the system |
| FR5.6 | update the generalities (e.g. name, phone number, opening hours, brand) associated to a gas station |
| FR5.7 | give a rating to a gas station |

## Non Functional Requirements

| ID | TYPE | DESCRIPTION |
| -- |:----:|:------------|
|NFR1 | Efficiency | the system must respond within 1 second for each request made by the user |
|NFR2 | Portability | the app should be available and compatible with the following mobile operating systems: iOS ver.13 and up, Android ver.10 and up |
|NFR3 | Localization | the prices are shown in euro/liter |
|NFR4 | Localization | the web application is available in the following languages: English, Italian |
|NFR5 | Privacy | the web application is compliant with the Regulation (EU) 2016/679 (GDPR) |

# Use case diagram and use cases

```plantuml
@startuml
' USE CASES involving both registered user and moderator

left to right direction
actor "registered user" as ru
actor "moderator" as mod

ru -- (request to add a gas station)
ru -- (request to delete a gas station)
ru -- (update gas station's generalities)

mod -- (validate a request)
mod -- (update gas station's generalities)

(request to add a gas station) --> mod
(request to delete a gas station) --> mod

(validate a request) ..> (add a gas station) : extends
(validate a request) ..> (delete a gas station) : extends

(validate a request) ..> (authenticate user) : include
(update gas station's generalities) .> (authenticate user) : include

(request to add a gas station) ..> (authenticate user) : include

(request to delete a gas station) ..> (authenticate user) : include
@enduml
```

```plantuml
@startuml
'USE CASES involving only registered and unregistered users

left to right direction
actor "unregistered user" as uu
actor "registered user" as ru

uu - (perform a search)
uu - (create an account)

ru - (perform a search)
ru -- (update price list of a gas station)
ru -- (update account's personal information)
ru -- (delete an account)
ru -- (rate a gas station)
ru -- (apply to be a moderator)

(update price list of a gas station) ..> (authenticate user) : include

(update account's personal information) ..> (authenticate user) : include
(delete an account) ..> (authenticate user) : include
(rate a gas station) ..> (authenticate user) : include
(apply to be a moderator) ..> (authenticate user) : include
(perform a search) .> (show a list of gas stations) : include
(perform a search) .> (locate current position) : extends
(show a list of gas stations) ..> (display it on a map) : extends
@enduml
```

### USE CASE 1 "user sends a price update" (ref. FR2.1)

| Actors Involved | A registered user |
| --------------- |:-----------------:|
| Precondition | 1. user must be authenticated; 2. user must have selected a gas station from the results of a search|
| Postcondition | 1. the price list of the corresponding gas station has been updated |
| Nominal Scenario | 1. user fills the form with the required fields, i.e. fuel type and price; 2. system confirms the operation has been successful |
| Variants | 2a. systems sends back an error message to the user because the price suggested is out of boundary |

### USE CASE 2 "generic user performs a conditional search using a set of filters" (ref. FR3)

| Actors Involved | A generic user (registered, unregistered) |
| --------------- |:-----------------------------------------:|
| Precondition | |
| Postcondition | |
| Nominal Scenario | 1. user fills in the address information (i.e. street, city, zip code, country) and optionally applies a set of filters; 2. system shows a list of gas stations that meet the criteria |
| Variants | 1a. user sets the address with his current position (*ref. FR3.3*). Follow either *step 2* or *step 2.a*; 2a. system shows the list of gas stations on a map |

### USE CASE 3 "unregistered user sign up for a new account" (ref. FR4.1)

| Actors Involved | An unregistered user |
| --------------- |:--------------------:|
| Precondition | |
| Postcondition | 1. the information about the newly created account has been successfully stored in the system |
| Nominal Scenario | 1. user fills in the minimum required information. (i.e. username, password, email); 2. system sends to the user an email containing the activation link; 3. user completes the registration by clicking the link |
| Variants | 2a. system denies the request. A request can be denied for one or more of the following reasons: username is already taken, password is too weak, and email address is invalid/already taken. User may retry, return to nominal scenario at step 1; 1a. user signs up using an existing Google account |

### USE CASE 4 "user updates his/her personal information associated to his/her account" (ref. FR4.2)

| Actors Involved | A registered user |
| --------------- |:-----------------:|
| Precondition | 1. user must be authenticated |
| Postcondition | 1. the information related to the account has been updated in the system |
| Nominal Scenario | 1. user updates his/her personal information (e.g. name, surname, password, phone number); 2. system confirms the operation has been successful |
| Variants | 2a. system denies the request because the new password chosen by the user is not compliant with the minimum requirements. User may retry, return to the nominal scenario at step 1 |

### USE CASE 5 "user deletes his/her account" (ref. FR4.3)

| Actors Involved | A registered user |
| --------------- |:-----------------:|
| Precondition | 1. user must be authenticated |
| Postcondition | 1. the account has been deleted from the system |
| Nominal Scenario | 1. user sends a request to delete his/her account; 2. system confirms the operation has been successful |
| Variants | |

### USE CASE 6 "user applies to become a moderator " (ref. FR4.4)

| Actors Involved | A registered user |
| --------------- |:-----------------:|
| Precondition | 1. the registered user must have sent at least 200 price updates and 50 reviews |
| Postcondition | |
| Nominal Scenario | 1. user applies to become a moderator; 2. system confirms the operation has been successful |
| Variants | |

### USE CASE 7 "user sends a request to add a new gas station into the system" (ref. FR5.1, FR5.3, FR5.4)

| Actors Involved | A registered user, a moderator |
| --------------- |:------------------------------:|
| Precondition | 1. user must be authenticated |
| Postcondition | 1. the information about the new gas station has been successfully stored in the system|
| Nominal Scenario | 1. a registered user fills in the minimum information required for adding a new gas station (i.e. gas station name, street, city, zip code and country); 2. a moderator verifies and validates the information (e.g. checks if the gas station is already in the system, checks if the inserted information are syntactically correct); 3. the moderator adds the gas station into the system |
| Variants | 3a. the moderator denies the request for one or more of the following reasons: the gas station is already available in the system, the information presented in the request are syntactically incorrect |

### USE CASE 8 "user sends a request to delete a gas station from the system" (ref. FR5.2, FR5.3, FR5.5)

| Actors Involved | A registered user, a moderator|
| --------------- |:-----------------------------:|
| Precondition | 1. user must have selected a gas station from the results of a search |
| Postcondition | 1. the gas station has been deleted from the system |
| Nominal Scenario | 1. a registered sends a request to delete that particular gas station; 2. a moderator verifies and validates the request (e.g. checks if the gas station still exists in the real world, for example, by calling/sending an email to the involved gas station); 3. the moderator deletes the gas station from the system |
| Variants | 3a. the moderator denies the request since the gas station still exists in the real world |

### USE CASE 9 "user updates the generalities of a gas station" (ref. FR5.6)

| Actors Involved | A registered user |
| --------------- |:---------------:|
| Precondition | 1. user must be authenticated; 2. user must have selected a gas station from the results of a search |
| Postcondition | 1. the information related to the gas station has been updated in the system|
| Nominal Scenario | 1. a registered user sends a request containing updated information associated to a gas station (e.g. gas station name, opening-hours, phone number, email); 2. system confirms the operation has been successful |
| Variants | 2a. system denies the request since the information inserted are syntactically incorrect. User may retry, return to the nominal scenario at step 1 |

### USE CASE 10 "a user rates a gas station" (ref. FR5.7)

| Actors Involved | A registered user |
| --------------- |:-----------------:|
| Precondition | 1. user must be authenticated; 2. user must have selected a gas station from the results of a search |
| Postcondition | 1. the rating corresponding to that particular gas station has been updated |
| Nominal Scenario | 1. user sends a review with a rating (0-5) for that particular gas station; 2. system confirms the operation has been successful |
| Variants | 2a. system denies the request made by the user since it is not the first review made by the user to this particular gas station |

# Relevant scenarios

## Scenario 1

| Scenario ID: SC1 | Corresponds to UC1 |
| ---------------- |:------------------:|
| Description | User uses the application to update the fuel price |
| Precondition | User must be authenticated |
| Post Condition | Fuel price has been updated |
| Step # | Step Description |
| 1 | User finds and selects a specific gas station using the search functionality of the application |
| 2 | User selects the type of fuel to be updated and defines the cost |
| 3 | Application confirms the pricing update with a pop-up message |

## Scenario 2

| Scenario ID: SC2 | Corresponds to UC2 |
| ---------------- |:------------------:|
| Description | Unregistered user wants to find a gas station |
| Precondition | |
| Post Condition | |
| Step # | Step Description |
| 1 | User searches for the gas station by entering a specific address and applying a set of filters |
| 2 | Application shows the results as a list of gas stations |

## Scenario 3

| Scenario ID: SC3 | Corresponds to UC3 |
| ---------------- |:------------------:|
| Description | Unregistered user wants to create a new account |
| Precondition | |
| Post Condition | Account has been created |
| Step # | Step Description |
| 1 | User selects the registration page |
| 2 | User fills out the form by entering the personal data (username, email, password) and confirms |
| 3 | System sends a confirmation email to the email address entered |
| 4 | User confirms the email address by opening the link received in the email |
| 5 | System creates the account and sends a welcoming email to the new user |

## Scenario 4

| Scenario ID: SC4 | Corresponds to UC5 |
| ---------------- |:------------------:|
| Description | User deletes his account |
| Precondition | User must be authenticated |
| Post Condition | Account has been deleted |
| Step # | Step Description |
| 1 | User selects his/her profile |
| 2 | User sends a request to delete his/her account |
| 3 | System deletes the account and shows a pop-up message to inform the user |

## Scenario 5

| Scenario ID: SC5 | Corresponds to UC7 |
| ---------------- |:------------------:|
| Description | User wants to add a new gas station into the system |
| Precondition | User must be authenticated |
| Post Condition | New gas station has been added into the system |
| Step # | Step Description |
| 1 | User selects the page for adding a new gas station|
| 2 | The user fills out the request for the new station by entering the information like gas station name, street, city, zip code and country and confirms |
| 3 | Moderator checks and validates the request |
| 4 | Moderator adds the gas station into the system |
| 5 | System sends an email to the user about the outcome of the request |

## Scenario 6

| Scenario ID: SC6 | Corresponds to UC10 |
| ---------------- |:-------------------:|
| Description | User sends a review of a gas station |
| Precondition | User must be authenticated |
| Post Condition | Review has been included in the description of the gas station |
| Step # | Step Description |
| 1 | User performs a search (see SC2) |
| 2 | User selects the profile page of a gas station |
| 3 | User inserts his/her comment and a rating that varies from 0 to 5 stars |
| 4 | User sends the review and receives a pop-up message |

# Glossary

```plantuml
@startuml
left to right direction

class Account {
+ id
+ username
+ password
+ email
+ name (optional)
+ surname (optional)
+ full address (optional)
+ phone number (optional)
}

class "Gas Station" {
+ id
+ business name
+ full address
+ oil company (optional)
+ email (optional)
+ opening hours (optional)
+ phone number (optional)
+ self service (optional)
+ rating (optional)
}

class Price {
+ value
+ date
}

class "Price Update" {
+ id
+ fuel type
+ price
+ date
}

class "Fuel Type" {
+ type: {gasoline, diesel, gas}
}

class Search {
+ id
+ date
+ full address
+ distance (optional)
+ price range (optional)
+ fuel type (optional)
+ oil company (optional)
+ rating (optional)
+ self service (optional)
+ user id (optional)
}

class Review {
+ id
+ user id
+ gas station id
+ rating: {1 - 5}
+ description (optional)
}

class "Moderator Account"

class "EZGas System"

class Request{
+ id
+ type: {add, delete}
+ gas station name
+ street
+ city
+ zip code
+ country
}

"Moderator Account" -|> Account

User "1" --- "0..1" Account : has >
User "1" -- "0..*" Search : performs >
"Gas Station" "1" - "0..*" Price
Price "0..*" - "1" "Fuel Type"
Account "1" -- "0..*" "Price Update" : sends >
"Price Update" "0..*" -- "1" "Gas Station"
Search "0..*" --  "0..*" "Gas Station" : returns >
"EZGas System" "1" -- "0..*" Account
"EZGas System" "1" -- "0..*" "Gas Station"
Request "0..*" -- "1" "Moderator Account": validates <
Request "0..*" -- "1" Account: sends <
Account "1" -- "0..*" Review: sends >
Review "0..*" -- "1" "Gas Station"

'NOTES

note top of "Moderator Account": a type of account able to receive and\nvalidate requests from the users.\nThe user can apply to become a moderator\nafter he/she has sent at least 200 price updates\nand given 50 ratings

note left of Search: a search into the system to find all the gas stations\nthat satisfy a specified criteria. User can limit the\nsearch by specifying one or more of the following\nparameters: distance, price range, fuel type,\noil company, rating, self-service

note bottom of Account: a set of credentials that allows\na user to authenticate himself/herself\nto the system

note top of "Price Update": a price update sent by\na registered user of the system

note left of Price: an element of the price list of a gas station,\ne.g. (gasoline, 1,2 euro/liter, dd/mm/yy)\nFinal price is computed as the average of\nthe 10 most recent price updates from\nthe last 3 days for that specific fuel type\n and gas station

note top of Request: a request sent by a registered user\nin order to ask to add or delete\na gas station from the system

note top of Review: a review sent by a registered user\nabout a gas station, including\na description and a rating
@enduml
```

An optional attribute is a property of a class that can be left unchecked, e.g. the telephone number associated with a gas station can be empty.

# System Design

It is not meaningful in our case since the EZGas system is just a web application
```plantuml
@startuml

class "EZGas Server"

@enduml
```

# Deployment Diagram

```plantuml
@startuml

artifact "EZGas mobile app" as app
artifact "EZGas application logic" as ezLogic
node "Smartphone Client" as phone
node "EZGas Server" as server
app -- phone
server -- "*" phone : internet
server -- ezLogic

@enduml
```


text:
# AWS Organizations Master Account
This folder contains a set of AWS Organizations Service Control Policies (SCP) to be imported into the AWS Organization and can be attached to member accounts or Organization Units (OU) in the Organization.

## Service Control Policies (SCP)
SCP's allow you to lock down the services that are allowed to be used within an account. SCP’s can be associated with an Organizational Unit (OU) and accounts can be grouped in OU’s. The following example SCP’s are provided by AWS Professional Services:

*organizations-policy-scp-root.json*
This SCP is to be attached to the root of the Organization making it applicable to all accounts in the organization. Only add denies here that need to applied across all accounts including the master account.

*organizations-policy-scp-security.json*
A SCP specifically designed for the security account with a couple of deny statements to make sure no one is able to delete the S3 buckets or any content in it.

*organizations-policy-scp-vanilla.json*
A ‘vanilla’ template allowing the most commonly used AWS services.

## CLI Commands
Using the SCP's consists of three steps, first you need to create the SCP's in your AWS Organization based of the templates provided. The next step is to attach the policies to the right accounts or OU's. The last step consists of removing the default policy from your account if applicable.

### Creating the SCP's
Run the commands below to have the SCP's created in your organization. We specified the profile master to do this with credentials from the master account which should be configured in your ~/.aws/config

*aws organizations create-policy --profile master --type SERVICE_CONTROL_POLICY --description "SCP for the root of the Organization denying services that can not be used anywhere with the AWS Organization" --name Policy-SCP-Root --content file://organizations-policy-scp-root.json*
*aws organizations create-policy --profile master --type SERVICE_CONTROL_POLICY --description "SCP for the Security account limiting the services that can be used and denying certain actions to protect logging data" --name Policy-SCP-Security --content file://organizations-policy-scp-security.json*
*aws organizations create-policy --profile master --type SERVICE_CONTROL_POLICY --description "SCP for other accounts allowing the most commonly used AWS services" --name Policy-SCP-Vanilla --content file://organizations-policy-scp-vanilla.json*

### Attaching SCP's
The next step is to attach the newly created SCP's to the accounts in the organization. Use the output of the previous commands to grab the policy id and use the *aws organizations list-roots --profile master*, *aws organizations list-organizational-units-for-parent --profile master* and *aws organizations list-accounts --profile master* command to get the target-id of the target accounts, root and OU's.

Use the following command to attach the policies:

*aws organizations attach-policy --profile master --policy-id <value> --target-id <value>*

### Detaching default SCP
By default the *p-FullAWSAccess* AWS managed SCP is attached to all accounts, repeat the following command for all target id's you want the default (allow all) policy to be detached:

*aws organizations detach-policy --profile master --policy-id p-FullAWSAccess --target-id <value>*

## Documentation
[AWS Organizations Documentation](http://docs.aws.amazon.com/cli/latest/reference/organizations/index.html)
[AWS Organizations Create Policy Documentation](http://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)
[AWS Organizations Attach Policy Documentation](http://docs.aws.amazon.com/cli/latest/reference/organizations/attach-policy.html)


text:
BC Stats Capstone project 2020
-----------------------------
*Text Analytics: Quantifying the Repsonses to Open-Ended Survey Questions*

[![License:
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Authors**: Carlina Kim, Karanpal Singh, Sukriti Trehan, Victor Cuspinera
**Mentor**: Varada Kolhatkar
**Partner**: [BC Stats](https://www2.gov.bc.ca/gov/content/data/about-data-management/bc-stats)

## About
BC Stats conducts the Work Environment Survey (WES) on BC Public Service’s ministries with the goal of identifying areas for improvement and understanding employee’s experiences in the working environment. Currently, the comments to the open-ended questions have been manually encoded. Given a large number of employees across their 26 ministries, hand-labelling comments is expensive and time-consuming. In this project we propose using natural language processing and machine learning classification techniques to automate the labelling of text responses with the goals of build an useful model to automate multi-label text classification and gather insight on trends by themes across Ministries.

## Report
The final report is available [here](https://github.com/UBC-MDS/591_capstone_2020_bc-stats-mds/blob/master/reports/Final_Report.pdf).

## Dependencies

|Python packages|R packages|
|--------|--------|
|altair|shiny|
|altair-transform|shinydashboard|
|docopt|RColorBrewer|
|Keras|shinyBS|
|Keras-Applications|tidyverse|
|Keras-Preprocessing|wordcloud|
|Markdown|SnowballC|
|matplotlib|tm|
|nltk|readxl|
|numpy|tidytext|
|numpydoc|textdata|
|pandas|tidyr|
|pyLDAvis|tokenizers|
|requests|igraph|
|scikit-learn|ggraph|
|spacy|magrittr|
|tensorflow|stringr|
|tensorflow-estimator|data.table|
|tensorflow-hub|Hmisc|
|textblob|sentimentr|
|tokenizers|rlang|
||shinycssloaders|

## **Usage**

### **Running recipe (recommended)**
To replicate the analysis, clone this GitHub repository, and follow the next steps:

1. Install the [dependencies](#dependencies) listed above. You can do so by running the following command from your terminal with this cloned project repository set as the root.
```
make requirements
```

2. Add a copy of the sensitive data in the `data/raw` folder, and [download the Fasttext pre-trained embeddings](https://fasttext.cc/docs/en/english-vectors.html) file `crawl-300d-2M.vec.zip`. Save the extracted embeddings file in `data/fasttext`.

3. Run the following command at the command line/terminal from the root directory of this project to prepare data for the models.
```
make ready_model
```

4. Upload the embedding matrix and padded datasets with termination `.npy` saved in `data/interim/question1_models/advance` ([link](https://github.com/UBC-MDS/591_capstone_2020_bc-stats-mds/tree/report_visualizations/data/interim/question1_models/advance)) to [Google Drive](https://www.google.ca/drive/). These files contain a vectorial representation of the words from the preprocesed comments, so they don't show any sensitive information.

⚠**Warning:** don't upload any other file, it may contain sensitive information.

5. Open and run the models in [Google Colab](https://colab.research.google.com/). You can upload [this](https://github.com/UBC-MDS/591_capstone_2020_bc-stats-mds/blob/master/notebooks/final_model.ipynb) notebook to Colab for training the main theme model and [this](https://github.com/UBC-MDS/591_capstone_2020_bc-stats-mds/blob/master/notebooks/Subtheme_Models.ipynb) notebook to train the subtheme models.

6. Follow the instructions in the notebooks specified in previous step to run and save the models. Make sure to download the saved model(s) from your Google Drive and replace the trained models in `models/Theme_Model/` and `models/Subtheme_Models` directories.

7. Run the following command at the command line/terminal from the root directory of this project to make predictions on the validation and test set and render the final report.
```
make advance_evaluation
```

This entire process could take a couple of hours.

### **Running all model from one command (not recommended)**

An alternative for the previous steps is to run the following command at the command line/terminal from the root directory of this project.

⚠**Warning:** This process would run the models on your local system instead of the cloud, will take several hours, and your computer may crash in the process:
```
make all
```

### **Running Rshiny App**

To only run the RShiny App, clone this GitHub repository, and run the following steps at the command line/terminal from the root directory of this project:

1. Install the [dependencies](#dependencies) by running
```
make requirements
```

2. Run the following to prepare the data for the dashboard
```
make ready_dashboard
```

3. Run the following to launch the dashboard
```
make dashboard
```

**Note**: In case the raw data and model remain unchanged, executing `make ready_dashboard` once is enough. In order to launch the dashboard again, only running `make dashboard` will suffice.

### **Predicting themes and subthemes for new comments**

In order to predict the themes and subthemes for new comments, clone this GitHub repository, and run the following steps at the command line/terminal from the root directory of this project:

1. Install the [dependencies](#dependencies) by running
```
make requirements
```
2. Run the following command to prepare the required data:
```
make ready_model
```

3. In the directory `data/new_data`, save an excel (.xlsx) file by the name `new_comments.xlsx` with the following format:

| Comment |
|----------|
|*comment_1*|
|*comment_2*|
|*comment_3*|
|*comment_4*|
|*comment_5*|

4. Run the following command from the root of the project repository:
```
make new_prediction
```
The predicted themes and subthemes will be saved in *data/new_data/predictions.xlsx*

### **Cleaning the repository**

To reset the repository to a clean state, with no intermediate or results files, run the following command at the command line/terminal from the root directory of this project:
```
make clean
```

To delete all sensitive data and pre-trained embeddings, run the following command at the command line/terminal from the root directory of this project:
```
make clean_confidential
```

### **Expected Run Times**

We have run the previous commands and following are the approximate expected run time:

|Command|Expected time|
|:----------|:--------------|
|`make ready_model` | 45-60 min. |
|`make advance_evaluation`| 10-20 min. |
|`make ready_dashboard`| 20-30 min.|
|`make dashboard`| 10 sec.|
|`make baseline_model`| 7 min. |
|`make new_prediction`|10-15 min for 10,000 comments|
|`make clean`|1 sec. |
|`make clean_confidential`|1 sec.|
|`make advance_model` |⚠ Did not execute|
|`make all`|⚠ Did not execute|

## Project Organization

    ├── LICENSE
    ├── Makefile           <- Makefile with make commands make like `make dashboard`.
    ├── README.md          <- The top-level README for developers using this project.
    ├── data
    │   ├── fasttext       <- Data from third party sources.
    │   ├── glove          <- Data from third party sources.
    │   ├── interim        <- Intermediate data that has been formed from raw data.
    │   ├── raw            <- The original, immutable data dump.
    │   ├── new_data       <- New data for theme and subtheme predictions.
    │   └── output         <- Theme predictions for test set, Question 2 comments saved.
    │
    ├── docs               <- A default Sphinx project; see sphinx-doc.org for details.
    │
    ├── models
    │   ├── Subtheme_Models <- Trained and serialized subtheme models.
    │   └── Theme_Model    <- Trained and serialized theme model.
    │
    ├── notebooks          <- Jupyter notebooks.
    │
    ├── references         <- Data dictionaries, manuals, and all other explanatory materials.
    │
    ├── reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
    │   ├── figures        <- Generated graphics and figures to be used in reporting.
    │   └── tables         <- General .csv files used for the report and presentation.
    │
    ├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
    │                         generated with `pip freeze > requirements.txt`.
    │
    ├── setup.py           <- makes project pip installable (pip install -e .) so src can be imported.
    │
    ├── Makefile           <- Makes project reproducible.
    │
    ├── src                <- Source code for use in this project.
    │   ├── __init__.py    <- Makes src a Python module.
    │   │
    │   ├── data           <- Scripts to generate training, validation and test data for models and
    │   |   |                 App (More details in directory's README).
    │   │   ├── merge_split_data.py
    │   │   ├── subset_subtheme_data.py
    │   │   ├── preprocess.py
    │   │   ├── embeddings.py
    │   │   ├── subtheme.py
    │   │   ├── ministries_data.py
    │   │   └── merge_ministry_pred.py
    │   │
    │   ├── features       <- Scripts to turn raw data into features for modeling (more details
    │   |   │                 in directory's README).
    │   │   └── tf-idf_vectorizer.py
    │   │
    │   ├── models         <- Scripts to train models and then use trained models to make
    │   │   │                 predictions (more details in directory's README).
    │   │   ├── baseline_model.py
    │   │   ├── theme_train.py
    │   │   ├── subtheme_models.py
    │   │   ├── model_evaluate.py
    │   │   ├── predict_theme.py
    │   │   ├── predict_subtheme.py
    │   │   └── predict_new_comments.py
    │   │
    │   └── visualization  <- Scripts to create exploratory and results oriented visualizations
    │       │                 for the RShiny App.
    │       ├── custom_functions.R
    │       ├── eda_plots.Rmd
    │       ├── eda_wordcloud.Rmd
    │       ├── server.R
    │       ├── ui.R
    │       ├── data_dictionary.md
    │       └── dummy.html
    │
    └── tox.ini            <- tox file with settings for running tox; see tox.readthedocs.io

--------

Project based on the cookiecutter data science project template. #cookiecutterdatascience