text:
---
id: baseline-branch
title: Baseline Branching and Merging
sidebar_label: Baseline Branching and Merging
---

import useBaseUrl from '@docusaurus/useBaseUrl';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

In this section, you'll learn how to pull baseline when branching and auto-accept when merging.

<img src={useBaseUrl('img/visual/e2e-branching-merging.png')} alt="E2E Baseline Branching and Merging" />

When working with feature branches, Screener can save you time and optimize your workflow by automating the following:

1. **Automatically Accept updates when merging to or from the base branch**: When merging an accepted base branch into a feature branch, Screener auto-accepts UI states that match the latest base branch test. And when merging into the base branch, Screener auto-accepts UI states that match the latest accepted feature branch test.
2. **Automatically pull initial baseline from the base branch**: This is useful for having a set of UI states to initially compare a new branch against. For example, if you create a new feature branch based off of the main branch, and you have a set of UI states on the main branch, you can then compare the new branch's visual changes to the main branch's UI states.

What this means:

* **Accept Once**: no need to accept again when merging accepted updates from your base branch into a feature branch.
* **Faster Workflow**: no need to re-review UI states or re-run builds to pass again.

Follow the steps below to enable in your Visual E2E project:

## Setup Steps

1. [Integrate your Visual E2E tests into your CI process](/visual/e2e-testing/integrations/continuous-integration) so that visual tests are automatically run when branching or merging.

2. Set the `branch` and `baseBranch` options in your [`sauce:visual` WebDriver capabilities](/visual/e2e-testing/commands-options/#saucevisual-capability-options) to set the name of your current branch and the name of your base branch respectively.

Below are examples of branch environment variables for various CI tools:

<Tabs
  defaultValue="Jenkins"
  values={[
    {label: 'Jenkins', value: 'Jenkins'},
    {label: 'CircleCI', value: 'CircleCI'},
    {label: 'TravisCI', value: 'TravisCI'},
    {label: 'GitLab', value: 'GitLab'},
  ]}>

<TabItem value="Jenkins">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.GIT_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
<TabItem value="CircleCI">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.CIRCLE_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
<TabItem value="TravisCI">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.TRAVIS_PULL_REQUEST_BRANCH || process.env.TRAVIS_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
<TabItem value="GitLab">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.CI_COMMIT_REF_NAME,
    baseBranch: 'main'
  }
}
```

</TabItem>
</Tabs>

<Tabs
  defaultValue="Codeship"
  values={[
    {label: 'Codeship', value: 'Codeship'},
    {label: 'Buildkite', value: 'Buildkite'},
    {label: 'Drone', value: 'Drone'},
  ]}>

<TabItem value="Codeship">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.CI_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
<TabItem value="Buildkite">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.BUILDKITE_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
<TabItem value="Drone">

```js
capabilities: {
  ...
  'sauce:visual': {
    branch: process.env.DRONE_BRANCH,
    baseBranch: 'main'
  }
}
```

</TabItem>
</Tabs>

## Additional Resources

* [Visual E2E Testing Commands and `sauce:visual` Options](/visual/e2e-testing/commands-options)

repository: leftxs/sauce-docs

repo_name: leftxs/sauce-docs


text:
---
canonical: https://grafana.com/docs/agent/latest/flow/reference/components/prometheus.exporter.snmp/
title: prometheus.exporter.snmp
---

# prometheus.exporter.snmp
The `prometheus.exporter.snmp` component embeds
[`snmp_exporter`](https://github.com/prometheus/snmp_exporter). `snmp_exporter` lets you collect SNMP data and expose them as Prometheus metrics.

## Usage

```river
prometheus.exporter.snmp "LABEL" {
  config_file = SNMP_CONFIG_FILE_PATH

  target "TARGET_NAME" {
    address = TARGET_ADDRESS
  }
}
```

## Arguments
The following arguments can be used to configure the exporter's behavior.
Omitted fields take their default values.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`config_file` | `string`       | SNMP configuration file defining custom modules. | | no
`config` | `string` or `secret`       | SNMP configuration as inline string.  | |no

The `config_file` argument points to a YAML file defining which snmp_exporter modules to use. See [snmp_exporter](https://github.com/prometheus/snmp_exporter#generating-configuration) for details on how to generate a config file.

The `config` argument must be a YAML document as string defining which SNMP modules and auths to use.
`config` is typically loaded by using the exports of another component. For example,

- `local.file.LABEL.content`
- `remote.http.LABEL.content`
- `remote.s3.LABEL.content`

## Blocks

The following blocks are supported inside the definition of
`prometheus.exporter.snmp` to configure collector-specific options:

Hierarchy | Name | Description | Required
--------- | ---- | ----------- | --------
target | [target][] | Configures an SNMP target. | yes
walk_param | [walk_param][] | SNMP connection profiles to override default SNMP settings. | no

[target]: #target-block
[walk_param]: #walk_param-block

### target block

The `target` block defines an individual SNMP target.
The `target` block may be specified multiple times to define multiple targets.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`name` | `string` | Name of a snmp_target. | | yes
`address` | `string` | The address of SNMP device. | | yes
`module`| `string` | SNMP module to use for polling. | `""` | no
`auth` | `string` | SNMP authentication profile to use. | `""` | no
`walk_params`| `string` | Config to use for this target. | `""` | no

### walk_param block

The `walk_param` block defines an individual SNMP connection profile that can be used to override default SNMP settings.
The `walk_param` block may be specified multiple times to define multiple SNMP connection profiles.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`name` | `string` | Name of the module to override. | | no
`max_repetitions`| `int` | How many objects to request with GET/GETBULK. | `25` | no
`retries`| `int` | How many times to retry a failed request. | `3` | no
`timeout`| `duration` | Timeout for each individual SNMP request. |  | no

## Exported fields

{{< docs/shared lookup="flow/reference/components/exporters-component-exports.md" source="agent" version="<AGENT VERSION>" >}}

## Component health

`prometheus.exporter.snmp` is only reported as unhealthy if given
an invalid configuration. In those cases, exported fields retain their last
healthy values.

## Debug information

`prometheus.exporter.snmp` does not expose any component-specific
debug information.

## Debug metrics

`prometheus.exporter.snmp` does not expose any component-specific
debug metrics.

## Example

This example uses a [`prometheus.scrape` component][scrape] to collect metrics
from `prometheus.exporter.snmp`:

```river
prometheus.exporter.snmp "example" {
    config_file = "snmp_modules.yml"

    target "network_switch_1" {
        address     = "<IP_ADDRESS>"
        module      = "if_mib"
        walk_params = "public"
    }

    target "network_router_2" {
        address     = "<IP_ADDRESS>"
        module      = "mikrotik"
        walk_params = "private"
    }

    walk_param "private" {
        retries = "2"
    }

    walk_param "public" {
        retries = "2"
    }
}
// Configure a prometheus.scrape component to collect SNMP metrics.
prometheus.scrape "demo" {
    targets    = prometheus.exporter.snmp.example.targets
    forward_to = [ /* ... */ ]
}
```

This example is the same above with using an embedded configuration (with secrets):

```river
local.file "snmp_config" {
    path      = "snmp_modules.yml"
    is_secret = true
}

prometheus.exporter.snmp "example" {
    config = local.file.snmp_config.content

    target "network_switch_1" {
        address     = "<IP_ADDRESS>"
        module      = "if_mib"
        walk_params = "public"
    }

    target "network_router_2" {
        address     = "<IP_ADDRESS>"
        module      = "mikrotik"
        walk_params = "private"
    }

    walk_param "private" {
        retries = "2"
    }

    walk_param "public" {
        retries = "2"
    }
}
// Configure a prometheus.scrape component to collect SNMP metrics.
prometheus.scrape "demo" {
    targets    = prometheus.exporter.snmp.example.targets
    forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
    endpoint {
        url = PROMETHEUS_REMOTE_WRITE_URL

        basic_auth {
            username = USERNAME
            password = PASSWORD
        }
    }
}
```
Replace the following:
  - `PROMETHEUS_REMOTE_WRITE_URL`: The URL of the Prometheus remote_write-compatible server to send metrics to.
  - `USERNAME`: The username to use for authentication to the remote_write API.
  - `PASSWORD`: The password to use for authentication to the remote_write API.

[scrape]: {{< relref "./prometheus.scrape.md" >}}

repository: grafana/agent

branch_name: refs/heads/main

extension: md

gha_language: Go

license_type: permissive

repo_name: grafana/agent


text:
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/postput/api)
![Docker Pulls](https://img.shields.io/docker/pulls/postput/api)
![GitHub package.json version](https://img.shields.io/github/package-json/v/postput/api)
![GitHub top language](https://img.shields.io/github/languages/top/postput/api)
![GitHub language count](https://img.shields.io/github/languages/count/postput/api)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/postput/api)
![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability-percentage/postput/api)
![Code Climate coverage](https://img.shields.io/codeclimate/coverage/postput/api)
![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/postput/api)
![GitHub](https://img.shields.io/github/license/postput/postput)
![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/postput/api)
![GitHub search hit counter](https://img.shields.io/github/search/postput/api/class)
![GitHub issues](https://img.shields.io/github/issues/postput/api)
![GitHub pull requests](https://img.shields.io/github/issues-pr/postput/api)
![GitHub last commit](https://img.shields.io/github/last-commit/postput/api)
![Maintenance](https://img.shields.io/maintenance/yes/2021)

 # Postput: An object storage to rule them all!

>Postput is a simple webserver that can serve any kind of files, wherever they are.
It abstracts the complexity of [storage providers](#supported-storage-provider) to help you upload, download and [operate](#operations-available) on your files.

# Demo
![Recordit GIF](https://cdn-storage.speaky.com/image2/5e8e5b0d-e92c-4243-bc4f-1ce62fd1c4d1.gif)

# TL;DR

### 1. Launch the API:
```shell
docker run -p 2000:3000 postput/api:latest
```

### 2. Upload any image by providing its URL

```shell
curl -X POST http://localhost:2000/my_memory_files/\?url=https://i2-prod.mirror.co.uk/incoming/article14334083.ece/ALTERNATES/s810/3_Beautiful-girl-with-a-gentle-smile.jpg\&name-override=my-image.jpg
```

### 3. Resize, blur, rotate, round and optimize this image on the fly. Operations are applied in the order they appear in the request.

Copy/paste this URL in your favourite webbrowser:
http://localhost:2000/my_memory_files/my-image.jpg?resize=300,300&blur=5&rotate=90&mask=elipse&format=webp

# Why this project?

This project is the result of some observations:

* It is difficult to choose what storage provider to use for your assets and user-generated files like profile pictures.
> S3 bucket? GCS? Backblaze? Scaleway? Openstack? Nowadays a lot of solutions exists to host your files. What if you don't want to take your decision now and just want to code what matters to you now?

* It is difficult to switch from one storage provider to another.
>When dealing with large amount of requests, object storage can rapidly become very costly on some providers.
Unfortunately, switching from one provider to another includes rewriting some code and effort to match the new API.

* Applying operations on files are too expensive.
>[Lambda functions](https://aws.amazon.com/fr/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/), [Imagekit](https://imagekit.io), [Imgx](https://www.imgix.com/), [Cloudinary](https://cloudinary.com/)... All these options works well but are too expensive and some of them only support hosting images.
Even if they use performant GPU technologies and out of the box CDN support, pricing is still hard to swallow when you know that more than 95% of your asset traffic can be cached by a free CDN (like cloudflare).
You may want to spend your money on a wiser solution instead.

Postput simplify object storage by providing a unified API tu upload, download and operate functions on files. It is a free product that you can install on your own computer for development and on production later on when you're ready!

# Use cases

- You already have an S3 bucket where you store a lot of profile pictures/Avatars. You want to resize and optimize the format of those profile pictures to reduce your bandwith usage and accelerate download speed.
> [Integrate your bucket with postput](doc/s3) and apply the [resize](#resize) and [webp format](#format) filter on the query.

- You know about serverless solutions like Lambda but these solutions turn out to be too costly.
> Postput can integrate with a lot of storage providers and will only cost you the price of the server lease.

- You have a lot amount a data in a FTP server that you suddenly have to expose via an API.
> Postput can integrate with an [FTP server](doc/ftp) and serve its files smoothly.
>
- You start a new project and don't want to waste time building your own HTTP server for storing your profile pictures. You're still not sure if you're going to use [s3](doc/s3), [GCS](doc/gcs), [backblaze](doc/backblaze) or your own [filesystem](doc/filesystem) as a storage provider.

> When still in development, create a [filesystem storage](doc/filesystem) storage. Later on, when you'll know what storage provider to use, integrate it with postput. Your code won't change because all storage providers follow the same API.
> You can keep those 2 storage providers active at the same time. You can actually create as many storage providers as you like with Postput.

- You're happy with the storage provider that you use. You're not confident about storing your super secret credentials with this (amazing) third party solution but you still want to find a quick solution for resizing and optimizing your files.
> Create a [proxy](doc/proxy) or [webfolder](doc/webfolder) storage with postput. No credentials are needed for those kind of storage but your files need to be publicly available.

# Table of Contents

- [Operations Available](#operations-available)
- [Supported Storage Provider](#supported-storage-provider)
- [Install](#install)
- [Configuration](#configuration)
- [Add your own provider](#add-your-own-provider)
- [Roadmap](#roadmap)
- [Credits](#credits)
 ---

# Operations Available

- [Blur image](#blur)
- [Brighten image](#brightness)
- [Saturate image](#saturation)
- [Hue shift image](#hue)
- [Greyscale](#greyscale)
- [Tint](#tint)
- [ColorSpace](#colorspace)
- [Flip-x image](#flip-x)
- [Flip-y image](#flip-y)
- [Negate image](#negative)
- [Resize image](#resize)
- [Crop image](#crop)
- [Rotate image](#rotate)
- [Mask image](#mask)
- [Format image](#format)
- [Extract audio/video](#extract)
- [Resize video](#resize-video)
- [Crop video](#crop-video)
- [Face detection](#face-detection)

Operations are applied one after another. Keep in mind that **order may matters** depending on which operations you do!

            Query parameter
            Description
            Example

            blur
             Perform a Gaussian blur on the image
            ?blur=5

            brightness
             Brighten the image by specified value. Must be between 0 and 1.
            ?brightness=0.6

            saturation
             Apply a saturation on the image. Value must be between 0 and 1.
            ?saturation=0.6

            hue
             Perform a hue shift on the image. Value must be an angle between 0 and 360
            ?hue=180

            greyscale
             Transform the image into a white/black
            ?greyscale=true

            tint
             Apply an rgba color mask on top of the image.
            ?tint=210,205,15,0.2

            colorspace
             Set the output colourspace. Possible values: srgb, rgb, cmyk, lab, b-w ...
            ?colorspace=cmyk

            flip-x
             Flip the image around the X axis.
            ?flip-x=true

            flip-y
             Flip the image around the Y axis.
            ?flip-y=true

            negate
             Produce the negative of the image.
            ?negate=true

            resize
            Resize the image accoring to specified value
            ?resize=200
?resize=10,20

            crop
            Take a portion of an image. Must be used in combination with crop-left(optional), crop-top(optional), crop-width(required) and crop-height(required). Extracted area must strictly be within the original image.
            ?crop=true&crop-left=30&crop-top=30&crop-width=200&crop-height=200
?crop=true&crop-width=200&crop-height=200

A

            Rotate
            Rotate the image to the degree specified
            ?rotate=90

            mask
            Apply a mask on the image. Currently, only `elipse` and `corner` mask are supported.
            ?mask=elipse
?mask=corner&corner-radius=10

            format
            Change the format of the image. supported values: jpeg, jpg, png, gif, webp, tiff, raw.
            ?format=webp

            Extract audio/video
            Extract a portion of an audio/video file format. You'll have to provide a start time and a duration. Both values are expressed in second.
            ?extract=5,10 // this will extract a 10 seconds length portion starting at the 5th second.

            resize-video
            Resize a video to specified width/height.
            ?resize-video=900x600

            crop-video
            Crop a video to a certain portion. Format of value follow the FFMPEG specification: width:height:offset-width:offset-height
            ?crop-video=300:200:50:30 // Will extract a 300x200 rectangle from the video starting a the 50 width offset and 30 height offset.

            face
            Crop the image to fit the most relevant face. Use it with 'face-pad' to zoom out off the face.
            ?face=true&face-pad=1.5

# Supported Storage Provider
 ### See [provider reference](https://github.com/postput/api/blob/master/data/provider/custom/custom.json.dist)

- [Amazon S3 + All compliant storages](doc/s3)
- [Minio](doc/minio)
- [Google cloud storage (GCS)](doc/gcs)
- [Spaces (DigitalOcean)](doc/spaces)
- [Openstack](/doc/openstack)
- [Azure](doc/azure)
- [Backblaze](doc/backblaze)
- [Scaleway](doc/scaleway)
- [IBM](doc/ibm)
- [Alibaba](doc/alibaba)
- [FTP](doc/ftp)
- [In memory](doc/memory)
- [Filesystem](doc/filesystem)
- [Webfolder](doc/webfolder)
- [Proxy](doc/proxy)

# Install
Before running and using Postput, you'll have to tell it what provider(s) to use. It is very easy to do so.

Postput is designed to sync every json file it finds in the [data/provider/custom](https://github.com/postput/api/blob/master/data/provider/custom) directory with the in-memory sqlite database every time it starts.

You'll have to create a json file that looks like [this one](https://github.com/postput/api/blob/master/data/provider/custom/custom.json.dist) in the [data/provider/custom](https://github.com/postput/api/blob/master/data/provider/custom) directory

## Locally

### Clone this git repo with its dependencies.
```shell
git clone --recursive git@github.com:postput/api.git
git clone --recursive https://github.com/postput/api.git
```

### Start the service
```shell
cd api
docker-compose up
```

By default, a memory provider and a filesystem provider are created for you.

## On production

### With docker
You can create a docker image based on the [api image]([https://hub.docker.com/repository/docker/postput/api](https://hub.docker.com/repository/docker/postput/api)) (Image built with [this docker file]([https://github.com/postput/api/blob/master/Dockerfile](https://github.com/postput/api/blob/master/Dockerfile)))
Don't forget to include your own provider info and to delete those you don't want anymore:
```docker
FROM postput/api
COPY my-provider.json ./data/provider/custom
RUN rm ./data/provider/default.json
```

### With Kubernetes: Helm
A Helm chart will soon be available in the [incubator](https://github.com/helm/charts/tree/master/incubator). Have a look at the [pull request](https://github.com/helm/charts/pull/19158)
Unfortunately, the process to get it integrated may be quite long so, until then, I will integrate charts directly into github repositories under the [`chart`](https://github.com/postput/api/tree/master/chart) directory.
Read the [Chart config](https://github.com/postput/api/tree/master/chart) for more info
```shell
git clone git@github.com:postput/api.git
cd chart
helm install . --name=my-release
```

# Configuration

The API can be easily configured using environment variables and provider specific config.

### Global configuration

            Environment variable
            Description
            Example

            Environment variable
            Description
            Example

            ENV
            set the ENV for your nodejs
            development | production

            LISTEN_PORT
            The port listened
            2000

            URLS
             List of urls that will be appended at the end of each provider configuration.
            ["http://localhost:2000/", "https://www.my-other-url.com"]

            ALLOW_UPLOAD
            Specify if upload is allowed to every providers. This config can be overridden by provider specify configuration.
            ["http://localhost:2000/", "https://www.my-other-url.com"]

            SEQUELIZE_FORCE_SYNC
             Force deletion of table if they exists before creating them. You want to disable that on production.
            true

### Storage specific configuration

   All parameters listed below are config keys that must be put at the root of your storage configuration.
   See [Storage reference]([https://raw.githubusercontent.com/postput/api/master/storage-reference.json](https://raw.githubusercontent.com/postput/api/master/docker-compose.yaml))

            Config key
            Description
            Example

            Config key
            Description
            Example

            allowUpload
            Specify if upload is allowed for that provider. It takes precedence over the global configuration
            true

            urls
            Provider specific urls.
            ["http://localhost:3000/"]

            custom
            Provider specific config, see Supported Storage Provider
            {}

# Add your own provider

You can add your own provider very easily.
All you have to do is to add your own specific [Provider](https://github.com/postput/api/blob/master/src/provider/interface.ts) implementation by creating a class [here](https://github.com/postput/api/tree/master/src/provider/implementation).
The system is designed to load every file in that directory and to consider each of them as Provider implementation.
Your class will have to implement the [Provider interface](https://github.com/postput/api/blob/master/src/provider/interface.ts). If you don't know what to do, just get inspired by other implementations like [this one](https://github.com/postput/api/blob/master/src/provider/implementation/s3.ts), [this one](https://github.com/postput/api/blob/master/src/provider/implementation/filesystem.ts) or [this one](https://github.com/postput/api/blob/master/src/provider/implementation/ftp.ts)

# Add your own operation

You can add your own operation very easily.
All you have to do is to add your own specific [Operation](https://github.com/postput/api/blob/master/src/operation/interface.ts) implementation by creating a class [here](https://github.com/postput/api/tree/master/src/operation/implementation).
The system is designed to load every file in that directory and to consider each of them as Operation implementation.
Your class will have to implement the [Operation interface](https://github.com/postput/api/blob/master/src/operation/interface.ts). If you don't know what to do, just get inspired by other implementations like [this one](https://github.com/postput/api/blob/master/src/operation/implementation/resize.ts), [this one](https://github.com/postput/api/blob/master/src/operation/implementation/crop-video.ts) or [this one](https://github.com/postput/api/blob/master/src/operation/implementation/format.ts)

# Debug

You may want to run the API service in your computer to be able to see what's happening under the hood.

### Preriquisites:
* [node.js](#[https://nodejs.org/en/](https://nodejs.org/en/)) >= 10

## Launch the API
Start the API.

### Start the API:

```shell
cd api
npm i
npm start
```

# Roadmap

By end of November 2019:

* Implement Helm chart for Kubernetes cluster: Have a look at [the pull request](https://github.com/helm/charts/pull/19158)

By end of December 2019:
*   Increase test coverage
*   Face detection ( [face-api?]([https://github.com/justadudewhohacks/face-api.js/](https://github.com/justadudewhohacks/face-api.js/))  [opencv?](#[https://github.com/peterbraden/node-opencv](https://github.com/peterbraden/node-opencv)))

# Credits

Most operations ([resize](#resize), [rotate](#rotate), [blur](#blur), [mask](#mask)...) are done by the [sharp library]([https://github.com/lovell/sharp](https://github.com/lovell/sharp)).

Cloud storage integration is done with the help of [pkgcloud]([https://github.com/pkgcloud/pkgcloud] (https://github.com/pkgcloud/pkgcloud)), [aws-s3]([https://github.com/aws/aws-sdk-js](https://github.com/aws/aws-sdk-js)) and [backblaze-b2](https://www.npmjs.com/package/backblaze-b2).

For the specific memory storage, I use [memfs](#[https://github.com/streamich/memfs](https://github.com/streamich/memfs))

[Sequelize](#[https://github.com/sequelize/sequelize](https://github.com/sequelize/sequelize)) helps me with database communication

license: MIT

repository: postput/postput

branch_name: refs/heads/master

gha_license_id: MIT

repo_name: postput/postput


text:
# Week 3 Class Activity

## Assessing bias in the Wikipedia Talk Corpus

The objective of this code is to analyse bias in the Toxicity data annotated from the Wikimedia Talk Corpus. The main document with the analysis can be found [here](https://docs.google.com/document/d/1ILZgf6DjLGt0C3EwsSzOzrNcNV-FV85AwECKLFR5dfA/edit?usp=sharing).

## Data Source

Wulczyn, Ellery; Thain, Nithum; Dixon, Lucas (2016): Wikipedia Detox. figshare. [doi.org/10.6084/m9.figshare.4054689](doi.org/10.6084/m9.figshare.4054689)

The data set contains comments from 2001-2016 that were scored on their level of toxicity by approximately 10 different crowdworkers.

The toxicity score is defined as:
| toxicity_score | Description                                                                                |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| -2             | Very Toxic (A very hateful, aggressive, or disrespectful comment that is very likely to make you leave a discussion)                         |
| -1             | Toxic (A rude, disrespectful, or unreasonable comment that is somewhat likely to make you leave a discussion                                 |
| 0              | Neither                                                                                |
| 1              | Healthy Contribution (A reasonable, civil, or polite contribution that is somewhat likely to make you want to continue a discussion)         |
| 2              | Very Healthy Contribution (A very polite, thoughtful, or helpful contribution that is very likely to make you want to continue a discussion) |

In addition, the dataset contains information about the worker's demographics.

The Toxicity dataset can be downloaded from [The Personal Attacks Figshare dataset](https://figshare.com/articles/Wikipedia_Talk_Labels_Personal_Attacks/4054689), and the schema can be found in the [dataset docummentation page](https://meta.wikimedia.org/wiki/Research:Detox/Data_Release#Toxicity).

## Analysis Files
 * data_statement_exploration.ipynb: Has the code necessary to obtain the distribution of toxicity_score, as well as range of dates, and number of comments and workers.
 * analysis_of_worker_demographics.ipynb: Has the code with analysis for demographics of the crowdworkers who annotated the comments

## License

Plese refer to the project [MIT license](LICENSE) for more details.


text:
Admin Permissions
====================

In order to set permissions for an API-Gateway or a custom Route you can add those informations into the `getMenu()` method function of the corresponding module and run the `import` command. LUYA admin will then create those permissiosn and you can allocate those in the groups and users settings.

Custom Menu-Route
-------------

```php
public function getMenu()
{
    return $this
    ->node("My Admin Module", "materialize-css-icon")
        ->group("Verwalten")
            ->itemRoute("Stats", "myadminmodule/stats/index", "materialize-css-icon")
            ->itemRoute("Export)", "myadminmodule/stats/export", "materialize-css-icon")
    ->menu();
}
```

Menu-Api
-------

```php
public function getMenu()
{
    return $this
    ->node('Administration', 'mdi-navigation-apps')
        ->group('Zugriff')
            ->itemApi('Benutzer', 'admin-user-index', 'mdi-action-account-circle', 'api-admin-user')
            ->itemApi('Gruppen', 'admin-group-index', 'mdi-action-account-child', 'api-admin-group')
        ->group('System')
            ->itemApi('Sprachen', 'admin-lang-index', 'mdi-action-language', 'api-admin-lang')
    ->menu();
}
```

Disable controller permission
-----------------------------

Inside of each `luya\web\Controller` abstracted class you can disable the permission check be enabling(overriding) the property `public $disablePermissionCheck = true;`. This means all **logged in users** can access this controller, but guest (nog logged in users) are still not allowed to see this controller.

```php
class MyTestController extends \admin\base\Controller
{
    public $disablePermissionCheck = true;

    public function actionIndex()
    {
        // This action can be performed by all logged in admin users, but not guest users.
    }
}
```

Route and Api permssions without Menu
------------------------------------

You can also setup permissions which are not regulated trough `getMenu()`, to do so you open the Module class and override the following methods:

```php
public function extendPermissionApis()
{
    return [
        ['api' => 'api-cms-moveblock', 'alias' => 'Move blocks'],
    ];
}
```

The above api `api-cms-moveblock` is now protected by the administration authorization system and you can allocate who is able to edit,create and delete performing.

```php
public function extendPermissionRoutes()
{
    return [
        ['route' => 'cmsadmin/page/create', 'alias' => 'Page Create'],
        ['route' => 'cmsadmin/page/update', 'alias' => 'Page Edit'],
    ];
}
```

The above *module/controller/action* route is now protected by administration authorization.

Internal permission calculation
--------------------------------

There are 3 state of permssions who got their assign values:

| Name          | Value
| ------        | ----
| crud_create   | 1
| crud_update   | 3
| crud_delete   | 5

In order to combine thos values you will get those values:

| create    | update    | delete    | Value          | Description
| ---       | ---       | ---       | ---           | ----
| ☐         | ☐         | ☐         | 0             | No permission
| ☑         | ☐         | ☐         | 1             | create
| ☐         | ☑         | ☐         | 3             | update
| ☑         | ☑         | ☐         | 4             | create, update
| ☐         | ☐         | ☑         | 5             | delete
| ☑         | ☐         | ☑         | 6             | create, delete
| ☐         | ☑         | ☑         | 8             | update, delete
| ☑         | ☑         | ☑         | 9             | create, update, delete


text:
Actix Web

    Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust

[![crates.io](https://img.shields.io/crates/v/actix-web?label=latest)](https://crates.io/crates/actix-web)
[![Documentation](https://docs.rs/actix-web/badge.svg?version=4.0.0-beta.11)](https://docs.rs/actix-web/4.0.0-beta.11)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg)
[![Dependency Status](https://deps.rs/crate/actix-web/4.0.0-beta.11/status.svg)](https://deps.rs/crate/actix-web/4.0.0-beta.11)

[![build status](https://github.com/actix/actix-web/workflows/CI%20%28Linux%29/badge.svg?branch=master&event=push)](https://github.com/actix/actix-web/actions)
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
![downloads](https://img.shields.io/crates/d/actix-web.svg)
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)

## Features

* Supports *HTTP/1.x* and *HTTP/2*
* Streaming and pipelining
* Keep-alive and slow requests handling
* Client/server [WebSockets](https://actix.rs/docs/websockets/) support
* Transparent content compression/decompression (br, gzip, deflate, zstd)
* Powerful [request routing](https://actix.rs/docs/url-dispatch/)
* Multipart streams
* Static assets
* SSL support using OpenSSL or Rustls
* Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
* Includes an async [HTTP client](https://docs.rs/awc/)
* Runs on stable Rust 1.52+

## Documentation

* [Website & User Guide](https://actix.rs)
* [Examples Repository](https://github.com/actix/examples)
* [API Documentation](https://docs.rs/actix-web)
* [API Documentation (master branch)](https://actix.rs/actix-web/actix_web)

## Example

Dependencies:

```toml
[dependencies]
actix-web = "3"
```

Code:

```rust
use actix_web::{get, web, App, HttpServer, Responder};

#[get("/{id}/{name}/index.html")]
async fn index(web::Path((id, name)): web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", name, id)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| App::new().service(index))
        .bind("<IP_ADDRESS>:8080")?
        .run()
        .await
}
```

### More examples

* [Basic Setup](https://github.com/actix/examples/tree/master/basics/basics/)
* [Application State](https://github.com/actix/examples/tree/master/basics/state/)
* [JSON Handling](https://github.com/actix/examples/tree/master/json/json/)
* [Multipart Streams](https://github.com/actix/examples/tree/master/forms/multipart/)
* [Diesel Integration](https://github.com/actix/examples/tree/master/database_interactions/diesel/)
* [r2d2 Integration](https://github.com/actix/examples/tree/master/database_interactions/r2d2/)
* [Simple WebSocket](https://github.com/actix/examples/tree/master/websockets/websocket/)
* [Tera Templates](https://github.com/actix/examples/tree/master/template_engines/tera/)
* [Askama Templates](https://github.com/actix/examples/tree/master/template_engines/askama/)
* [HTTPS using Rustls](https://github.com/actix/examples/tree/master/security/rustls/)
* [HTTPS using OpenSSL](https://github.com/actix/examples/tree/master/security/openssl/)
* [WebSocket Chat](https://github.com/actix/examples/tree/master/websockets/chat/)

You may consider checking out
[this directory](https://github.com/actix/examples/tree/master/) for more examples.

## Benchmarks

One of the fastest web frameworks available according to the
[TechEmpower Framework Benchmark](https://www.techempower.com/benchmarks/#section=data-r20&test=composite).

## License

This project is licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
  [http://www.apache.org/licenses/LICENSE-2.0])
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
  [http://opensource.org/licenses/MIT])

at your option.

## Code of Conduct

Contribution to the actix-web repo is organized under the terms of the Contributor Covenant.
The Actix team promises to intervene to uphold that code of conduct.

repository: robjtede/actix-web

gha_license_id: NOASSERTION

repo_name: robjtede/actix-web


text:
# Source-Engine

The Source Dedicated Server or SRCDS is a tool that runs the server component of a Source game without the client component. In other words, it simulates the game without drawing it.

This also covers games that are installed using the steamcmd utility.

## Server Ports

Many of these servers will require the steam query ports to be open for the server.
The default steam query port is 27015

## ARK Survival Evolved

### Port Requirements

The ARK server requires 4 ports minimum.

| Port    | default |
|---------|---------|
| Game    | 7777    |
| Game +1 | 7778    |
| Query   | 27015   |
| RCON    | 27020   |

Please note the server may not show up on steam game server lists due to this requirement if all ports are not set/added.

## Counter Strike: Global Offensive

Counter-Strike: Global Offensive (CS: GO) expands upon the team-based action gameplay that it pioneered when it was launched 19 years ago. CS: GO features new maps, characters, weapons, and game modes, and delivers updated versions of the classic CS content (de_dust2, etc.).

### Port Requirements

|   Port   | default |
|----------|---------|
|   Game   | 27015   |

## Custom Source Engine Game

This is a generic one size fit's all egg that supports srcds game servers.

This is not for games like Counter Strike 1.6 which is an HLDS title. See [HLDS server](game_eggs/steamcmd_servers/hlds_server)

### Port Requirements

|   Port   | default |
|----------|---------|
|   Game   | 27015   |

## Garry's Mod

Garry's Mod is a physics sandbox. There aren't any predefined aims or goals. We give you the tools and leave you to play.

### Port Requirements

|   Port   | default |
|----------|---------|
|   Game   | 27015   |

## Insurgency

Take to the streets for intense close quarters combat, where a team's survival depends upon securing crucial strongholds and destroying enemy supply in this multiplayer and cooperative Source Engine based experience.

### Port Requirements

|   Port   | default |
|----------|---------|
|   Game   | 27015   |

## Team Fortress 2

Nine distinct classes provide a broad range of tactical abilities and personalities. Constantly updated with new game modes, maps, equipment and, most importantly, hats!

### Port Requirements

|   Port   | default |
|----------|---------|
|   Game   | 27015   |

repository: WSG-ViViV/eggs

repo_name: WSG-ViViV/eggs


text:
# tensorflow-lite-demo
Object detection model for car detection using the [cars196 dataset](https://ai.stanford.edu/~jkrause/cars/car_dataset.html).

This repository contains the accompanying code for the blog post [Deep Learning for mobile devices with TensorFlow Lite: Custom Object Detector]() on the inovex blog.

## How to get started

I highly recommend reading the blog post, since it gives a concise overview of all the steps that are required to train an object detection model using the TensorFlow Object Detection API. However, if you are just interested in the code, you can start with the following steps.

### Prerequisites

  * Python>=3.7
  * TensorFlow >= 2.3.0
  * TensorFlow Datasets >= 2.1.0
  * ProtoBuf Compiler (protoc) >= 3.0

### Install the TensorFlow Object Detection API

The TF Object Detection API is integrated as a Git submodule in this repository. You can install it by issuing the following commands:

  1. Initialize the submodule: `git submodule init`
  2. Update the submodule: `git submodule update`
  3. Move to the object detection API: `cd od-api/model/research`
  4. Install the API:

    # Compile protos.
    protoc object_detection/protos/*.proto --python_out=.
    # Install TensorFlow Object Detection API.
    cp object_detection/packages/tf2/setup.py .
    python -m pip install --use-feature=2020-resolver .

You can test your installation via:

    python object_detection/builders/model_builder_tf2_test.py

### Prepare checkpoints

Training the model from a fine-tuning checkpoint requires you to download and extract a checkpoint matching the model architecture. You can do so by running the following script:

`./model/ssd_mobilenet_v2/pretrained/download_and_prepare_checkpoint.sh`

### Prepare input data

The TensorFlow Object Detection API requires the data to be stored in a specific structure. The following script downloads the cars196 dataset and transforms it into a structure that can be read by the object detection API.

`python data/cars196_to_pascal_voc_format.py --output_path=data --num_shards=10`

### Start model training

Issue the following command from `od-api/models/research`:

    PIPELINE_CONFIG_PATH=../../../model/ssd_mobilenet_v2/ssd_mobilenet_v2.config
    MODEL_DIR={Wherever/you/want/your/model/to/be/saved}
    python object_detection/model_main_tf2.py \
    --pipeline_config_path=${PIPELINE_CONFIG_PATH} \
    --model_dir=${MODEL_DIR} \
    --alsologtostderr

repository: inovex/tensorflow-lite-demo

repo_name: inovex/tensorflow-lite-demo


text:
# Product App

A simple fullstack application showing product page on an online store.

## Installation

Just clone the repo or download the zip file

## Usage

Would update as i build, run the command to start the server though

```bash

 npm run dev
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)

repository: Molyktech/Product-App

gha_language: JavaScript

repo_name: Molyktech/Product-App


text:
---
metaTitle: "C++ | Enumeration"
description: "Iteration over an enum, Basic Enumeration Declaration, Enumeration in switch statements, Scoped enums, Enum forward declaration in C++11"
---

# Enumeration

## Iteration over an enum

There is no built-in to iterate over enumeration.

But there are several ways

for `enum` with only consecutive values:

```cpp
enum E {
    Begin,
    E1 = Begin,
    E2,
    // ..
    En,
    End
};

for (E e = E::Begin; e != E::End; ++e) {
    // Do job with e
}

```

with `enum class`, `operator ++` has to be implemented:

```cpp
E& operator ++ (E& e)
{
    if (e == E::End) {
        throw std::out_of_range("for E& operator ++ (E&)");
    }
    e = E(static_cast<std::underlying_type<E>::type>(e) + 1);
    return e;
}

```

using a container as `std::vector`

```cpp
enum E {
    E1 = 4,
    E2 = 8,
    // ..
    En
};

std::vector<E> build_all_E()
{
    const E all[] = {E1, E2, /*..*/ En};

    return std::vector<E>(all, all + sizeof(all) / sizeof(E));
}

std::vector<E> all_E = build_all_E();

```

and then

```cpp
for (std::vector<E>::const_iterator it = all_E.begin(); it != all_E.end(); ++it) {
    E e = *it;
    // Do job with e;
}

```

or `std::initializer_list` and a simpler syntax:

```cpp
enum E {
    E1 = 4,
    E2 = 8,
    // ..
    En
};

constexpr std::initializer_list<E> all_E = {E1, E2, /*..*/ En};

```

and then

```cpp
for (auto e : all_E) {
    // Do job with e
}

```

## Basic Enumeration Declaration

Standard enumerations allow users to declare a useful name for a set of integers. The names are collectively referred to as enumerators. An enumeration and its associated enumerators are defined as follows:

```cpp
enum myEnum
{
    enumName1,
    enumName2,
};

```

An enumeration is a **type**, one which is distinct from all other types. In this case, the name of this type is `myEnum`. Objects of this type are expected to assume the value of an enumerator within the enumeration.

The enumerators declared within the enumeration are constant values of the type of the enumeration. Though the enumerators are declared within the type, the scope operator `::` is not needed to access the name. So the name of the first enumerator is `enumName1`.

The scope operator can be optionally used to access an enumerator within an enumeration. So `enumName1` can also be spelled `myEnum::enumName1`.

Enumerators are assigned integer values starting from 0 and increasing by 1 for each enumerator in an enumeration. So in the above case, `enumName1` has the value 0, while `enumName2` has the value 1.

Enumerators can also be assigned a specific value by the user; this value must be an integral constant expression. Enumerators who's values are not explicitly provided will have their value set to the value of the previous enumerator + 1.

```cpp
enum myEnum
{
    enumName1 = 1, // value will be 1
    enumName2 = 2, // value will be 2
    enumName3,     // value will be 3, previous value + 1
    enumName4 = 7, // value will be 7
    enumName5,     // value will be 8
    enumName6 = 5, // value will be 5, legal to go backwards
    enumName7 = 3, // value will be 3, legal to reuse numbers
    enumName8 = enumName4 + 2, // value will be 9, legal to take prior enums and adjust them
};

```

## Enumeration in switch statements

A common use for enumerators is for switch statements and so they commonly appear in state machines. In fact a useful feature of switch statements with enumerations is that if no default statement is included for the switch, and not all values of the enum have been utilized, the compiler will issue a warning.

```cpp
enum State {
    start,
    middle,
    end
};

...

switch(myState) {
    case start:
       ...
    case middle:
       ...
} // warning: enumeration value 'end' not handled in switch [-Wswitch]

```

## Scoped enums

C++11 introduces what are known as **scoped enums**. These are enumerations whose members must be qualified with `enumname::membername`. Scoped enums are declared using the `enum class` syntax. For example, to store the colors in a rainbow:

```cpp
enum class rainbow {
    RED,
    ORANGE,
    YELLOW,
    GREEN,
    BLUE,
    INDIGO,
    VIOLET
};

```

To access a specific color:

```cpp
rainbow r = rainbow::INDIGO;

```

`enum class`es cannot be implicitly converted to `int`s without a cast. So `int x = rainbow::RED` is invalid.

Scoped enums also allow you to specify the **underlying type**, which is the type used to represent a member. By default it is `int`. In a Tic-Tac-Toe game, you may store the piece as

```cpp
enum class piece : char {
    EMPTY = '\0',
    X = 'X',
    O = 'O',
};

```

As you may notice, `enum`s can have a trailing comma after the last member.

## Enum forward declaration in C++11

Scoped enumerations:

```cpp
...
enum class Status; // Forward declaration
Status doWork(); // Use the forward declaration
...
enum class Status { Invalid, Success, Fail };
Status doWork() // Full declaration required for implementation
{
    return Status::Success;
}

```

Unscoped enumerations:

```cpp
...
enum Status: int; // Forward declaration, explicit type required
Status doWork(); // Use the forward declaration
...
enum Status: int{ Invalid=0, Success, Fail }; // Must match forward declare type
static_assert( Success == 1 );

```

An in-depth multi-file example can be found here: [Blind fruit merchant example](http://stackoverflow.com/a/19074269/1873507)

repository: haifenghuang/generate

repo_name: haifenghuang/generate


text:
# Pytest API with examples

Jupyter notebook with pytest API examples. The blog should be checked out under
the `blog` directory. The command `make build` will running formatters and
generate output document.

## Makefile

- `up`: Starts the notebook.
- `build`: Creates the output document.
- `sync`: Synchronises the markdown and jupyter documents using jupytest.
- `preview`: Previews the output document in the terminal.
- `fmt`: Formats the code and markdown.
- `clean`: Removes the generated output document.

gha_language: Jupyter Notebook


text:
# Microsoft Word VBA notes and examples
Examples and notes for creating macros in VBA for Microsoft Word documents

Here we have kitties (test):

![Los Kitties](/assets/kitties_sm.jpg)

repository: mpope-tableau/word-vba

repo_name: mpope-tableau/word-vba


text:
# Pierre's Sweet and Savory Treats

### A C# website by David Sterry
Initialized on 01/15/21
Last updated on 01/15/21

## **Project Description**

This simple C# website is designed to help Pierre market his sweet and savory treats. Users will have to create an account, once they do they can log in and create, update and delete Treats and Flavors. If they click on a Treat or Flavor they will see all the Treats of Flavors assigned to it. This was a Friday independent project for epicodus, to showcase using Identity for Authentication, along with many to many relationship database managment.

## **User Stories**
* The application should have user authentication. A user should be able to log in and log out. Only logged in users should have create, update and delete functionality. All users should be able to have read functionality.
* There should be a many-to-many relationship between Treats and Flavors. A treat can have many flavors (such as sweet, savory, spicy, or creamy) and a flavor can have many treats. For instance, the "sweet" flavor could include chocolate croissants, cheesecake, and so on.
* A user should be able to navigate to a splash page that lists all treats and flavors. Users should be able to click on an individual treat or flavor to see all the treats/flavors that belong to it.

## **Required for Use**
* C# and .Net Core installed on your local machine. Download .Net Core [Here](https://dotnet.microsoft.com/download) Follow the instructions to install on your machine
* Console/Terminal access.
* Code Editor like VSCode download [Here](https://code.visualstudio.com/) Follow the instructions to install on your machine
* MySQL Community Server download [Here](https://dev.mysql.com/downloads/mysql/) Follow the instructions to install on your machine
* MySQL Workbench [Here](https://www.mysql.com/products/workbench/) Follow the instructions to install on your machine
* An internet browser of your choice; I prefer Chrome

## **How to get this project**

### Download from Github:
1. Use the browser navigate to my GitHub page [respository](https://github.com/Dave-Sterry/SweetSavory.Solution)
2. Click the Green **Code** button and select **Download Zip**

### Alternatively clone from Github via Gitbash:
1. In your terminal, navigate to the folder where you would like to clone the project too
2. Clone this repo to your chosen folder using "git clone https://github.com/Dave-Sterry/SweetSavory.Solution in terminal

## **Installation Instructions**
### **Setup Database Connection**

AppSettings
* This project requires an AppSettings file. Create your `appsettings.json` file in the main `Factory` directory.
* Format your `appsettings.json` file as follows including your unique password that was created at MySqlWorkbench installation:

```
{
  "ConnectionStrings": {
      "DefaultConnection": "Server=localhost;Port=3306;database=david_sterry1;uid=YourId;pwd=YourPassword;"
  }
}
```
* Update the Server, Port, and User ID as needed with your own

Import Database using Entity Framework Core
* Navigate to SweetSavory.Solution/SweetSavory and type `dotnet ef database update` into the terminal. This will update the existing migrations

## **Viewing the Project**
* Navitagate to SweetSavor.Solutions/SweetSavory in your terminal, and run the command `dotnet run` The program should launch using your default web browser. If it does not launch, navigate to the site at URL localhost:5000 in your favorite browser.

## **SQL Schema
```
CREATE DATABASE  IF NOT EXISTS `david_sterry1`
USE `david_sterry1`;

DROP TABLE IF EXISTS `__EFMigrationsHistory`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `__EFMigrationsHistory` (
  `MigrationId` varchar(95) NOT NULL,
  `ProductVersion` varchar(32) NOT NULL,
  PRIMARY KEY (`MigrationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetRoleClaims`;

 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetRoleClaims` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `RoleId` varchar(255) NOT NULL,
  `ClaimType` longtext,
  `ClaimValue` longtext,
  PRIMARY KEY (`Id`),
  KEY `IX_AspNetRoleClaims_RoleId` (`RoleId`),
  CONSTRAINT `FK_AspNetRoleClaims_AspNetRoles_RoleId` FOREIGN KEY (`RoleId`) REFERENCES `aspnetroles` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetRoles`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetRoles` (
  `Id` varchar(255) NOT NULL,
  `Name` varchar(256) DEFAULT NULL,
  `NormalizedName` varchar(256) DEFAULT NULL,
  `ConcurrencyStamp` longtext,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `RoleNameIndex` (`NormalizedName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetUserClaims`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetUserClaims` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `UserId` varchar(255) NOT NULL,
  `ClaimType` longtext,
  `ClaimValue` longtext,
  PRIMARY KEY (`Id`),
  KEY `IX_AspNetUserClaims_UserId` (`UserId`),
  CONSTRAINT `FK_AspNetUserClaims_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetUserLogins`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetUserLogins` (
  `LoginProvider` varchar(255) NOT NULL,
  `ProviderKey` varchar(255) NOT NULL,
  `ProviderDisplayName` longtext,
  `UserId` varchar(255) NOT NULL,
  PRIMARY KEY (`LoginProvider`,`ProviderKey`),
  KEY `IX_AspNetUserLogins_UserId` (`UserId`),
  CONSTRAINT `FK_AspNetUserLogins_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetUserRoles`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetUserRoles` (
  `UserId` varchar(255) NOT NULL,
  `RoleId` varchar(255) NOT NULL,
  PRIMARY KEY (`UserId`,`RoleId`),
  KEY `IX_AspNetUserRoles_RoleId` (`RoleId`),
  CONSTRAINT `FK_AspNetUserRoles_AspNetRoles_RoleId` FOREIGN KEY (`RoleId`) REFERENCES `aspnetroles` (`Id`) ON DELETE CASCADE,
  CONSTRAINT `FK_AspNetUserRoles_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetUsers`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetUsers` (
  `Id` varchar(255) NOT NULL,
  `UserName` varchar(256) DEFAULT NULL,
  `NormalizedUserName` varchar(256) DEFAULT NULL,
  `Email` varchar(256) DEFAULT NULL,
  `NormalizedEmail` varchar(256) DEFAULT NULL,
  `EmailConfirmed` bit(1) NOT NULL,
  `PasswordHash` longtext,
  `SecurityStamp` longtext,
  `ConcurrencyStamp` longtext,
  `PhoneNumber` longtext,
  `PhoneNumberConfirmed` bit(1) NOT NULL,
  `TwoFactorEnabled` bit(1) NOT NULL,
  `LockoutEnd` datetime(6) DEFAULT NULL,
  `LockoutEnabled` bit(1) NOT NULL,
  `AccessFailedCount` int(11) NOT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `UserNameIndex` (`NormalizedUserName`),
  KEY `EmailIndex` (`NormalizedEmail`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `AspNetUserTokens`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `AspNetUserTokens` (
  `UserId` varchar(255) NOT NULL,
  `LoginProvider` varchar(255) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Value` longtext,
  PRIMARY KEY (`UserId`,`LoginProvider`,`Name`),
  CONSTRAINT `FK_AspNetUserTokens_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `Flavors`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Flavors` (
  `FlavorId` int(11) NOT NULL AUTO_INCREMENT,
  `FlavorName` longtext,
  `UserId` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`FlavorId`),
  KEY `IX_Flavors_UserId` (`UserId`),
  CONSTRAINT `FK_Flavors_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `FlavorTreat`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `FlavorTreat` (
  `FlavorTreatId` int(11) NOT NULL AUTO_INCREMENT,
  `FlavorId` int(11) NOT NULL,
  `TreatId` int(11) NOT NULL,
  PRIMARY KEY (`FlavorTreatId`),
  KEY `IX_FlavorTreat_FlavorId` (`FlavorId`),
  KEY `IX_FlavorTreat_TreatId` (`TreatId`),
  CONSTRAINT `FK_FlavorTreat_Flavors_FlavorId` FOREIGN KEY (`FlavorId`) REFERENCES `flavors` (`FlavorId`) ON DELETE CASCADE,
  CONSTRAINT `FK_FlavorTreat_Treats_TreatId` FOREIGN KEY (`TreatId`) REFERENCES `treats` (`TreatId`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

DROP TABLE IF EXISTS `Treats`;
 SET character_set_client = utf8mb4 ;
CREATE TABLE `Treats` (
  `TreatId` int(11) NOT NULL AUTO_INCREMENT,
  `TreatName` longtext,
  `UserId` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`TreatId`),
  KEY `IX_Treats_UserId` (`UserId`),
  CONSTRAINT `FK_Treats_AspNetUsers_UserId` FOREIGN KEY (`UserId`) REFERENCES `aspnetusers` (`Id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
```

## **Known Bugs**
If an user who is not logged in views the details of a Flavor or Treat and attempst to edit or delete them. The site returns an error (1/17/21)

## **Technology Used**
* C# 7.3
* .NET Core 2.2
* Entity
* Git
* MySQL
* CSS
* HMTL
* Bootstrap
* Razor
* dotnet script, REPL
* Identity

## **Authors and Contributors**
Authored by: David Sterry

## **Contact**
If you have any issues during installation delete both the bin and obj folders and follow the set up instructions again. Please contact me at<EMAIL_ADDRESS>in regards to this project

## **License**

This project is licensed under **MIT 2.0**

Copyright © 2020 David Sterry


text:
# TruPay

## File description
The file index.js contains the code to retrieve and display the balance of the contract, seller, seller_broker, buyer_broker and buyer.
The named JS files contain the WEB3 code to interact with the corresponding contract function having the same name.
The TruPay contract can be found in the solidity file.

## Requirements
Node.js v8.x+.

## Package Requirements
After cloning the repository, run the commands
~~~
npm install
npm install web3
~~~

## Usage
* Since the contract is supposed to be deployed per static data, you might need to deploy the contract found in trupay.sol to Ropsten first.
* Update the CONTRACT_ADDRESS in keys.js inside the config directory
* You might also need to update the address of seller, seller_broker, buyer_broker and buyer in the keys.js file with 4 Ropsten accounts with sufficient balance.
* Also update the private keys for the corresponding accounts in all the JS files when you call the web3 method privateKeyToAccount.
* Now you can run the following command with each JS file in the same order as the corresponding function appears in the contract, since the functions are depedent on results of previous functions.
~~~
node XYZ.js
~~~

## Future works
All further works on TruPay can be found here: https://github.com/ANRGUSC

repository: thivyavignesh/TruPay

repo_name: thivyavignesh/TruPay


text:
# KapiLib (WIP)

[![Go Report Card](https://goreportcard.com/badge/github.com/TengLun/kapiLib)](https://goreportcard.com/report/github.com/TengLun/kapiLib)

This project contains clients for all of Kochava's public APIs. The four
APIs are explained in brief below:

## CampaignClient
The Campaign Management API Integration provides the programmatic tools to create
and maintain campaigns, segments and trackers.

## FraudClient
Fraud Console information access and programmatic additions and removals from
the account blacklist.

## S2SClient
A Sever to Server (S2S) Integration is a method of integrating an app with Kochava
without a SDK or any code change required in the app.

## ReportsClient
The Kochava platform provides extensive tools to track everything from impressions
thru post-install events for connected devices. The API reporting method provides
advertisers with the programmatic tools to gather performance data on an on-demand
or scheduled basis.

repository: TengLun/kapiLib

repo_name: TengLun/kapiLib


text:
# Install DCli

To get started with DCli you first need to install Dart and optionally the DCli tools.

{% hint style="info" %}
If you just want to use the DCli library then you don't need to install the [DCli tools](../dcli-tools-1/dcli-tools.md).
{% endhint %}

There are three methods for installing Dart and the DCli tools.

## Option 1\) Use DCli library from your project

If you only want to use the DCli library then you can add DCli to your pubspec.yaml as you would any other package.

```yaml
dependencies:
  dcli: 0.37.0
```

Check pub.dev for the latest version no.

[https://pub.dev/packages/dcli/install](https://pub.dev/packages/dcli/install)

## Option 2\) Install Dart/DCli

Start by installing Dart as per:

{% hint style="info" %}
Install Dart from : [https://dart.dev/get-dart](https://dart.dev/get-dart)
{% endhint %}

If you want to use the [DCli tools](../dcli-tools-1/dcli-tools.md), including Shebang \(\#!\) support you need to globally activate DCli.

Now activate the DCli tools:

```text
dart pub global activate dcli
dcli install
```

## Option 3\) Install Dart/DCli

This is still a work in progress but is intended to provide a three line script to install Dart and the DCli tools.

{% tabs %}
{% tab title="Linux" %}
```text
wget https://github.com/bsutton/dcli/releases/download/latest.linux/dcli_install
chmod +x dcli_install
./dcli_install
```
{% endtab %}

{% tab title="Windows" %}
```text
curl https://github.com/bsutton/dcli/releases/download/latest.windows/dcli_install.exe
dcli_install.exe
```
{% endtab %}

{% tab title="OSX" %}
```text
Coming soon:

curl https://github.com/bsutton/dcli/releases/download/latest.osx/dcli_install
dcli_install.exe
```
{% endtab %}
{% endtabs %}

## Install VSCode

You can use virtually any editor to create DCli scripts but we use and recommend Visual Studio Code \(vscode\) with the Dart-Code plugin.

{% hint style="info" %}
Install Visual Studio Code from: [https://code.visualstudio.com/download](https://code.visualstudio.com/download)
{% endhint %}

Now install the vscode extension for Dart - Dart Code:

{% hint style="info" %}
Install Dart-Code from: [dartcode.org](https://dartcode.org/#:~:text=You%20must%20have%20the%20VS,and%20debugger%20for%20VS%20Code.)
{% endhint %}

We use and recommend the following additional vscode extensions:

* Dart-Code.flutter
* dart-import
* pubspec-assist
* vscode-browser-preview
* bracket-pair-colorizer
* LogFileHighlighter


text:
# XenForms

XenForms is a Xamarin.Forms UI Designer. It allows you to open, visually manipulate, and save out XAML. There are two applications that collectively make up the product.

1. XenForms Toolbox

 The desktop application, containing the visual tree outline and property editors.
2. XenForms Designer

 The mobile application that plays the role of the design surface. The toolbox connects to the designer.

##Binaries
The official binary distribution can be found on the [XenForms web site](https://www.xenforms.com/). It currently runs on Microsoft Windows 7+ and Android 4.0.3 – 6.0.

##Solutions

The Toolbox and Designer each have their respective Visual Studio/Xamarin Studio ```.sln``` file. Compiling and deploying locally should be straight-forward, as there are no custom build events.

First, start by opening ```designer.sln```, then compile and deploy ```Droid.csproj``` to your Android emulator or device.
Second, open ```toolbox.windows.sln```. Ensure that ```Toolbox.Windows.csproj``` is set as the **start-up project**. Now, compile and execute. There are two methods to connect to the design surface. If the Android device is not immediately displayed, click **File -> Connect** and type in the IP Address displayed on the design surface (mobile app).

1. toolbox.windows.sln (all csprojs)
  * Core
  * Core.Platform
  * Toolbox.UI
  * Toolbox.Windows
2. designer.sln (all csprojs)
 * Core (save as above)
 * Core.Platform (same as above)
 * Designer.Test
 * Designer.UI
 * Droid
 * iOS (not set to compile)

## Libraries and Frameworks
The major libraries and frameworks used are listed below:

1. Toolbox

 * Desktop UI: [Eto.Forms](https://github.com/picoe/Eto).
 * Installer: [Squirrel.Windows](https://github.com/Squirrel/Squirrel.Windows)
 * Android Communication: [SharpAdbClient](https://github.com/quamotion/madb)
 * XAML Open/Save: [Portable.Xaml](https://github.com/michaeled/Portable.Xaml)
 * Various others...

2. Designer

 * [Xamarin.Forms](https://www.xamarin.com/)
 * Communication: [websocket-sharp](https://github.com/sta/websocket-sharp)
 * Various others...

##Networking

The toolbox and designer communicate over a websocket, hence [websocket-sharp](https://github.com/sta/websocket-sharp). All messages derive from ```XenForms.Core.Messages.XenMessage```. A set of factory methods, such as ```XenForms.Core.Messages.XenMessage.Create<>()``` exits and should be used to instantiate a message object. Messages are actions, such as *get the visual tree*, *open a XAML file*, *return object X's properties*, *set a property value on object x*, and others.

When a message is received by the designer, it scans a list of registered ***reactions***. A reaction is any class that derives from the ```XenForms.Core.Designer.Reaction``` abstract base class. However, most reactions will derive from ```XenForms.Designer.XamarinForms.UI.Reactions.XamarinFormsReaction``` as it provides useful properties and methods to visually manipulate the design surface.

Reactions must be registered before a message can be dispatched to it. This is done in ```XenForms.Designer.XamarinForms.UI.DesignerAppEvents```.

**Example**

```cs
XamarinFormsReaction.Register<GetVisualTreeRequest, GetVisualTreeReaction<VisualElement>>(page);
```

##Roadmap and Contributing
I have a [project board](https://trello.com/b/dAZJ4QkT/xenforms-beta-roadmap) on Trello that I use to maintain my backlog of work. Rewriting the XAML load & save features is crucial. The project started as a visual tree inspector, and saving XAML was *bolted* on in the last few cycles. You can see that by viewing the ```XamlPostProcessor`` type.

I happily accept pull requests. :P

repository: IWantMyApp/XenForms

branch_name: refs/heads/dev

repo_name: IWantMyApp/XenForms


text:
---
title: Ok, TDD sounds great, but...
description: Do you have to write all the tests first? Is it that different if you write them afterward?
date: "2020-05-04"
published: true
---

After reading my last post, [Yes, tdd does apply to your usecase](https://alexandrempsantos.com/yes-tdd-does-apply-to-your-usecase/), my friend [Ruskin](https://twitter.com/jonnyparris) gave me very interesting feedback.

He pointed out some existing flaws of my proposed solution. This was great. I don't believe in software as something individual and done once and forgotten forever. At least, that was never how it worked for me in the real world.

I got so intrigued about the feedback that I had the dilemma: _Should I edit the last post? Or write a new one?_

Instead of editing, which would mean losing the initial thoughts, I thought it would be great to explain how to improve, and the rationale behind it. Here we are.

# What feedback did I get?

It was essentially two things:

- Some myths about TDD were listed as wrong, but **missing the why**

- I referred to **interface first** software design, but didn't follow it as much as I should in some parts

# Debunking the myths

Before changing my mind in regards to TDD, I tried it a couple of times. I always ended up thinking that:

- I **can't** write all the tests upfront, that's impossible
- I **can** write the tests afterward and still **not be biased**, it is pretty much the same thing, right?

These are two very common misconceptions about TDD, and even though I listed them in my last post, I failed to explain **why they are wrong**.

That's what we're here for.

## I need to write all the tests upfront

This was always my thought since I first read about TDD. I've seen these people who used it as some kind of magician. They seemed to know **everything** about how they would code their features from the first moment. I couldn't do it.

After reading the [book](http://www.growing-object-oriented-software.com/), it was clear to me that those kinds of magicians **do not exist**, or at least they're very rare.

Again, quoting Kent Beck:

> I'm not a great programmer; I'm just a good programmer with great habits.

Those _magicians_ just had **better habits**, and they knew how to use them to design better and to produce easy to change software.

A few chapters in the book, and I was starting to feel the magic. The tools were helping me, being more specific, _the tests were helping me_ to design better and to test my ideas faster. I also didn't have to wait for the implementation to discover some design flaws as they were clear from the start. That blew my mind 🤯.

___

**TLDR:** No, you don't need to write all the tests upfront. You need to write the _simplest meaningful test_ for the feature you'll implement. Implement it, and come back to write the next test when this one is green.

You do _write tests before coding_, just not all of them. To me, the secret was to keep this short cycle of writing a test and the logic for it, multiple times until the feature is done.

## I can write the tests afterwards

You actually can, and that's what I did most of the time. I thought I wouldn't be biased, I wouldn't end up testing implementation details.

I'm sorry to say this, but **I was completely wrong**.

What happened (and still happens if I don't write the tests first) is that I know too much about the implementation for that not to influence me when testing.

It was a little like the following exercise:

![colors-words](./common-tdd-myths/colors-words.jpg)

Try to say the underlying colors and not the words.
___

Tough job, right? Your brain automatically reads the words while you're trying to say the color.

Quoting Daniel Kahneman on _Thinking fast and slow_:

> "System 1" is fast, instinctive, and emotional; "System 2" is slower, more deliberative, and more logical.

The instinctive part of the brain (System 1) is tricking you. You want to say the underlying colors, but your mind automatically reads the word, unconsciously. This is how **testing last** was to me.

It also felt like starting to do something without a clear goal in mind. Let me quote Seneca (yes, I like quotes) in a saying that is very common in my hometown, the fishing village Ericeira:

> There is no favorable wind for the sailor who doesn’t know where to go

By writing tests first I noticed I was putting the bar much higher before writing my logic, and my completion criteria were clear from the start.

___

**TLDR:** You can write tests last, yes. But do not expect most of the TDD advantages. It is the fact that you do it first that makes it so effective, **it's a matter of discipline** more than anything else.

# Going "interface first"

In the [last post](https://alexandrempsantos.com/yes-tdd-does-apply-to-your-usecase/#2-a-failing-acceptance-test), we wrote a failing acceptance test for the feature we were writing.

```js
// cypress/integration/stock.ts

import { Server } from "miragejs";
import { makeServer } from "../../makeServer";

let server: Server

beforeEach(() => {
  server = makeServer({ environment: "test " })
})

afterEach(() => {
  server.shutdown()
})

it("renders wine names", () => {
  cy.visit("/")

  server.get("/wines", () => [
    { name: "Pomares", year: 2018 },
    { name: "Grainha", year: 2017 },
  ])

  expect(cy.contains("Pomares 2018")).to.exist
  expect(cy.contains("Grainha 2017")).to.exist
})
```

After that, we went on the quest to write the logic to satisfy it. I mistakenly **jumped to conclusions**, skipping some intermediate steps, and stating that we would need an _API client_.

If I strictly followed the principle I advocated (going interface first), **I shouldn't have done it**. I should have first started by testing the component, and only get to the API client when it was _strictly needed_.

Doing a small recap:

The first thing after the acceptance test should be to write a failing **unit test** for the component.

```js
// pages/index.test.tsx
import { render } from "@testing-library/react"
import { Home } from "./index"

it("renders", () => {
  const  { getByText } = render(<Home />);

  expect(getByText('Wine Cellar')).toBeTruthy();
  expect(getByText('Available Stock')).toBeTruthy();
})

```

Then we would realize the need to connect to an API and thus the need for an _API client_.

```js
// pages/index.test.tsx
import { render } from "@testing-library/react"
import { Home } from "./index"
import * as Api from "../services/api"

it("tries to get wines", () => {
  const getWines = jest.fn()

  // @ts-ignore
  Api.getWines = getWines
  // ts-ignore is needed to be able to mutate the `readonly` property

  render(<Home />)

  expect(getWines).toHaveBeenCalled();
})

```

From here onwards, the whole flow would come up naturally. First by creating the API client tests, then the logic itself, and later use it on the component that needed to fetch the data. You can see the rest of the flow [here](https://alexandrempsantos.com/yes-tdd-does-apply-to-your-usecase#31-api-client).

With the proposed changes, the flow strictly follows the **interface first** principle, making it more intuitive to follow and improve the overall code design.

# Conclusion

I hope to have answered some questions that were left floating the last time I wrote. At the same time, I wanted to demonstrate that both _writing_ and _software_ are **iterative** and **feedback-driven** processes.

This post also writes down the precious knowledge that [Ruskin](https://twitter.com/jonnyparris) shared with me (many thanks for that 🙏). The noted problems and doubts were probably common in other people too, and I hope to have made them clear by now

Are you still not convinced by TDD? What problems do you have using it? [Doesn't it apply to your use case?](https://alexandrempsantos.com/yes-tdd-does-apply-to-your-usecase) 😉

Feel free to reach out to me, I'd love to hear from you


text:
# risd-harbor
Final project for Web Projects 2015 @ RISD: redesign of WebAdvisor and practice with AngularJS.

## Rough Timeline
1.	Remap current Webadvisor
2.	Map elements and restructure user flow
3.	Wireframes in Sketch
4.	High-fidelity designs
5.	Build static pages without Angular
6.	Create dummy data
7.	Convert static pages to necessary templates in Angular
8.	Add page transitions and interaction elements
9.	Browser compatibility and performance optimization

## Description
I've wanted to redesign WebAdvisor since Freshman year but never had the time to do it. UI is outdated and cumbersome and UX leaves a lot to be desired. WebAvisor was first created by Datatel in the 80's when web design was a game of how many tables can be nested within each other. Considered just writing a plugin that could inject my own stylesheet into WebAdvisor but I'd like to just build it from the ground up.

repository: danielchae/risd-harbor

repo_name: danielchae/risd-harbor


text:
# [Define the Head and Body of an HTML Document](https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document)

You can add another level of organization in your HTML document within the `html` tags with the `head` and `body` elements. Any markup with information about your page would go into the `head` tag. Then any markup with the content of the page (what displays for a user) would go into the `body` tag.

Metadata elements, such as `link`, `meta`, `title`, and `style`, typically go inside the `head` element.

Here's an example of a page's layout:

```html
<!DOCTYPE html>
<html>
  <head>
    <!-- metadata elements -->
  </head>
  <body>
    <!-- page contents -->
  </body>
</html>
```

---

Edit the markup so there's a `head` and a `body`. The `head` element should only include the `title`, and the `body` element should only include the `h1` and `p`.

## Solution

```html
<!DOCTYPE html>

  <title>The best page ever</title>

The best page ever

Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway.  Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper.  Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe.

repository: johnfelipe/progress

repo_name: johnfelipe/progress


text:
---
layout: post
title: "Launch of Saturday Night Salsa @ Cocoon"
date: 2013-12-31 11:25:54 +0800
comments: true
author:
  name: Bryan Wong
  twitter: bryanwongbh
  gplus:<PHONE_NUMBER>89409748192
  bio: Fellow Salsero
  image: bryan.png

categories:
- announcement
- social dance
---

With the coming of a new year 2014, this calls for a renewed thought on how we want to improve from where we are currently to be better next year. This also means, we will have a new place for Salsa!

(Picture Courtesy of Facebook event [here](http://www.facebook.com/events/190518374475192))

Special thanks [Jaxen](http://www.facebook.com/jaxen.tan) and [Gary](http://www.salsakl.com/#!/djs/dj-gary) for their effort, we now have [Cocoon Bar & Club](http://www.facebook.com/cocoonclub.my) in Sunway Giza, Kota Damansara as another new Saturday Night Salsa!

On 4-Jan-2014, it will be the launch of Saturday Night Salsa @ Cocoon, Sunway Giza, with Salsa and Bachata performances lined up. Not to forget, there will be a special guest DJ there too! So, do not miss it!

Details are below:

- Date: 4-Jan-2014 (Saturday)
- Time: 9:30pm until 1:00am
- Venue: Cocoon Bar & Club, Sunway Giza
- Cover Charge:
  - 1) RM 15 for 2 drinks (bottled drinking water 500ml and/or soft drinks)
  - 2) RM 25 for 2 drinks (1 mug of Beer and a choice of bottled drinking water 500ml or soft drinks)1) RM 15 for 2 drinks (bottled drinking water 500ml and/or soft drinks)
- Parking: Park in Sunway Giza, RM2 for 1st 3 hour after 6pm (every subsequent hour is RM 1)

For further information, kindly refer to the Facebook event page [here](http://www.facebook.com/events/190518374475192)

repository: bryanwongbh/salsakl-blog

extension: markdown

repo_name: bryanwongbh/salsakl-blog


text:
# real_elevators v1.0.0
![screenshot](https://user-images.githubusercontent.com/25750346/131409658-5a4be9cc-19b2-4b76-8922-a67887f8b64f.png)

Adds realistic elevators with smooth moving.

## Features:
* Flexible & dynamic floors net system.
* Cabin hangs on rope.
* Smooth moving of elevator cabin from one point to other.
* Smooth opening/closing doors (outer/inner).
* Allows to transport all entities (not only players).
* Support for basic_materials (also luxury_decor in next versions) for crafting.

## How to build elevator shaft?

Building steps (where '#' is optional):

1. Set platform from corner blocks (#).
2. Set corner blocks in back side of shaft, left side blocks in left side, right side blocks in right side correspondingly. Those blocks are intended to be set where doors are, in other cases it is recommended to use back side blocks.
###!!!Important!!!### All those shaft blocks should face to the inside of the shaft, otherwise the cabin just won't go.
3. Set outer walls with left/right side slots in the correspodning places as the screenshots show (#).
4. Set outer wall with trigger.
###!!!Important!!!### It should be set in left side and at one block above the marked floor position (on the screenshots it looks like simple outer wall, but with red luminant button), otherwise you can't just call the elevator.
5. When you built shaft with one floor, it is necessary to set a winch on top of that for cabin could move upside or downside. Connect with that more ropes if you need.
6. Hang up the elevator cabin on the rope (just set it one block below the rope, so it will connect with that).
7. Configure the elevator (create new floors net, add floor destinations). To define a position for that, there is a special marker tool 'Floor marker tool'. Right-click any block to save its position and use this position for setting floor. You can right-click other block to change target position.
8. The elevator is ready! Right-click trigger where you want the cabin to arrive and select necessary floor to transport yourself to by right-clicking the cabin.

## Craft recipes:
Use crafting guide mod or default one.

## Mod Dependencies:
default, farming, stairs, basic_materials.

## Mod License:
MIT (Code and media).

## Mod verison:
1.0.0.


text:
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]

<!-- TABLE OF CONTENTS -->
## Table of Contents

* [About the Project](#about-the-project)
  * [Built With](#built-with)
* [Getting Started](#getting-started)
* [Usage](#usage)
* [License](#license)
* [Contact](#contact)
* [Acknowledgements](#acknowledgements)

<!-- ABOUT THE PROJECT -->
## About The Project
Basic decimal and binary calculator.

### Built With
Basic HTML/CSS and javascript web app
* [HTML5](https://html.com)
* [CSS]
* [Javascript](https://www.javascript.com)

<!-- GETTING STARTED -->
## Getting Started
Download repo and open index.html with browser of choice

<!-- USAGE EXAMPLES -->
## Usage

Open index.html with browser of choice
https://gfortunecpt.github.io/calculators/

<!-- CONTRIBUTING -->
## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3.  Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

<!-- LICENSE -->
## License

Distributed under the MIT License. See `LICENSE` for more information.

<!-- CONTACT -->
## Contact

Project Link: [https://github.com/gfortune/calculators](https://github.com/your_username/repo_name)

<!-- ACKNOWLEDGEMENTS -->
## Acknowledgements
* [Choose an Open Source License](https://choosealicense.com)
* [GitHub Pages](https://pages.github.com)
* [Animate.css](https://daneden.github.io/animate.css)
* [Font Awesome](https://fontawesome.com)

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=flat-square
[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/grant-fortune-9593861ba/

repository: gfortuneCPT/calculators

repo_name: gfortuneCPT/calculators


text:
Gayelak Android App

About The App

Gayelak is AI, Location based mobile application app that connects nearby people with each other to sell and products easily.

Gayelak founded by me to help my university students to find cheap used products.

What makes Gayelak unique is the AI image detection feature so that with only one picture the user could post the item
without any description, where our system pick the most accurate tags to the product. We are also planing to add more AI features
like price prediction and category prediction.

Start Using The App

https://play.google.com/store/apps/details?id=com.gayelak.gayelakandroid

Technologies Used

Android Studio, Java for development

Firebae ML Kit

Firebase RealTime Database for the backend and the authentication.

Firebase Geofire for GPS and location based features.

Airbnb Lottie Animation for all the animations in the app.

Project Screenshots

Future Work

AI Price Prediction Feature.

AI Category Prediction Feature.

Support English Language.

Language

This app only available in Arabic right now because we are targeting Arab countries. We are planing to support the English language
very soon.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

repository: RadiBarq/GayelakAndroid

repo_name: RadiBarq/GayelakAndroid


text:
# Shlink

[![Build Status](https://img.shields.io/travis/shlinkio/shlink.svg?style=flat-square)](https://travis-ci.org/shlinkio/shlink)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/shlinkio/shlink.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink/?branch=master)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/shlinkio/shlink.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink/?branch=master)
[![Latest Stable Version](https://img.shields.io/github/release/shlinkio/shlink.svg?style=flat-square)](https://packagist.org/packages/shlinkio/shlink)
[![License](https://img.shields.io/github/license/shlinkio/shlink.svg?style=flat-square)](https://github.com/shlinkio/shlink/blob/master/LICENSE)
[![Paypal donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=aaaaaa)](https://acel.me/donate)

A PHP-based self-hosted URL shortener that can be used to serve shortened URLs under your own custom domain.

## Installation

First make sure the host where you are going to run shlink fulfills these requirements:

* PHP 7.1 or greater with JSON, APCu, intl, curl, PDO and gd extensions enabled.
* MySQL, PostgreSQL or SQLite.
* The web server of your choice with PHP integration (Apache or Nginx recommended).

Then, you will need a built version of the project. There are a few ways to get it.

* **Using a dist file**

    The easiest way to install shlink is by using one of the pre-bundled distributable packages.

    Just go to the [latest version](https://github.com/shlinkio/shlink/releases/latest) and download the `shlink_X.X.X_dist.zip` file you will find there.

    Finally, decompress the file in the location of your choice.

* **Building from sources**

    If for any reason you want to build the project yourself, follow these steps:

    * Clone the project with git (`git clone https://github.com/shlinkio/shlink.git`), or download it by clicking the **Clone or download** green button.
    * Download the [Composer](https://getcomposer.org/download/) PHP package manager inside the project folder.
    * Run `./build.sh 1.0.0`, replacing the version with the version number you are going to build (the version number is only used for the generated dist file).

    After that, you will have a `shlink_x.x.x_dist.zip` dist file inside the `build` directory.

    This is the process used when releasing new shlink versions. After tagging the new version with git, the Github release is automatically created by [travis](https://travis-ci.org/shlinkio/shlink), attaching generated dist file to it.

Despite how you built the project, you are going to need to install it now, by following these steps:

* If you are going to use MySQL or PostgreSQL, create an empty database with the name of your choice.
* Recursively grant write permissions to the `data` directory. Shlink uses it to cache some information.
* Setup the application by running the `bin/install` script. It is a command line tool that will guide you through the installation process. **Take into account that this tool has to be run directly on the server where you plan to host Shlink. Do not run it before uploading/moving it there.**
* Configure the web server of your choice to serve shlink using your short domain.

    For example, assuming your domain is doma.in and shlink is in the `/path/to/shlink` folder, this would be the basic configuration for Nginx and Apache.

    *Nginx:*

    ```nginx
    server {
        server_name doma.in;
        listen 80;
        root /path/to/shlink/public;
        index index.php;
        charset utf-8;

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
        }

        location ~ /\.ht {
            deny all;
        }
    }
    ```

    *Apache:*

    ```apache
    <VirtualHost *:80>
        ServerName doma.in
        DocumentRoot "/path/to/shlink/public"

        <Directory "/path/to/shlink/public">
            Options FollowSymLinks Includes ExecCGI
            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    ```

* Generate your first API key by running `bin/cli api-key:generate`. You will need the key in order to interact with shlink's API.
* Finally access to [https://app.shlink.io](https://app.shlink.io) and configure your server to start creating short URLs.

**Bonus**

There are a couple of time-consuming tasks that shlink expects you to do manually, or at least it is recommended, since it will improve runtime performance.

Those tasks can be performed using shlink's CLI, so it should be easy to schedule them to be run in the background (for example, using cron jobs):

* Resolve IP address locations: `/path/to/shlink/bin/cli visit:process`

    If you don't run this command regularly, the stats will say all visits come from *unknown* locations.

* Generate website previews: `/path/to/shlink/bin/cli short-url:process-previews`

    Running this will improve the performance of the `doma.in/abc123/preview` URLs, which return a preview of the site.

## Update to new version

When a new Shlink version is available, you don't need to repeat the entire process yourself. Instead, follow these steps:

1. Rename your existing Shlink directory to something else (ie. `shlink` ---> `shlink-old`)
2. Download and extract the new version of Shlink, and set the directories name to that of the old version. (ie. `shlink`)
3. Run the `bin/update` script in the new version's directory to migrate your configuration over.

The script will ask you for the location from previous shlink version, and use it in order to import the configuration. It will then update the database and generate some the assets neccessary for Shlink to function.

Right now, it does not import cached info (like website previews), but it will. For now you will need to regenerate them again.

**Important!** It is recommended that you don't skip any version when using this process. The update gets better on every version, but older versions might make assumptions.

## Using a docker image

Currently there's no official docker image, but there's a work in progress alpha version you can find [here](https://hub.docker.com/r/shlinkio/shlink/).

The idea will be that you can just generate a container using the image and provide predefined config files via volumes or CLI arguments, so that you get shlink up and running.

Currently the image does not expose an entry point which let's you interact with shlink's CLI interface, nor allows configuration to be passed.

## Using shlink

Once shlink is installed, there are two main ways to interact with it:

* **The command line**. Try running `bin/cli` and see all the available commands.

    All of those commands can be run with the `--help`/`-h` flag in order to see how to use them and all the available options.

    It is probably a good idea to symlink the CLI entry point (`bin/cli`) to somewhere in your path, so that you can run shlink from any directory.

* **The REST API**. The complete docs on how to use the API can be found [here](https://shlink.io/api-docs), and a sandbox which also documents every endpoint can be found [here](https://shlink.io/swagger-ui/index.html).

    However, you probably don't want to consume the raw API yourself. That's why a nice [web client](https://github.com/shlinkio/shlink-web-client) is provided that can be directly used from [https://app.shlink.io](https://app.shlink.io), or you can host it yourself too.

Both the API and CLI allow you to do the same operations, except for API key management, which can be done from the command line interface only.

### Shlink CLI Help

```
Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help                        Displays help for a command
  list                        Lists commands
 api-key
  api-key:disable             Disables an API key.
  api-key:generate            Generates a new valid API key.
  api-key:list                Lists all the available API keys.
 config
  config:generate-charset     Generates a character set sample just by shuffling the default one, "123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ". Then it can be set in the SHORTCODE_CHARS environment variable
  config:generate-secret      Generates a random secret string that can be used for JWT token encryption
 short-url
  short-url:delete            [short-code:delete] Deletes a short URL
  short-url:generate          [shortcode:generate|short-code:generate] Generates a short URL for provided long URL and returns it
  short-url:list              [shortcode:list|short-code:list] List all short URLs
  short-url:parse             [shortcode:parse|short-code:parse] Returns the long URL behind a short code
  short-url:process-previews  [shortcode:process-previews|short-code:process-previews] Processes and generates the previews for every URL, improving performance for later web requests.
  short-url:visits            [shortcode:visits|short-code:visits] Returns the detailed visits information for provided short code
 tag
  tag:create                  Creates one or more tags.
  tag:delete                  Deletes one or more tags.
  tag:list                    Lists existing tags.
  tag:rename                  Renames one existing tag.
 visit
  visit:process               Processes visits where location is not set yet
```

repository: OfficialMahler/shlink

repo_name: OfficialMahler/shlink


text:
---
layout: post
title: "What is the Binary search?"
description: Learn what is the Binary search
headline: What is the Binary search?
modified: 2019-12-20
category: Data-Structure
tags: [Algorithm, python]
imagefeature:
mathjax:
chart:
comments: true
---
**BinarySearch algorithm** is search algorithm in the sorted data set.

it can not apply to unsorted data set.

Let's take a look step by step. assume the data set is already ascending sorted.

First, Check the middle of data set.

![arr1](\images\arr1.png){: width="700" height="700"}

Compare middle to target number.
.

if the middle is larger than target, we don't need to take care about right side of middle.

![arr2](\images\arr2.png){: width="700" height="700"}

find the middle in the left part.

![arr3](\images\arr3.png){: width="700" height="700"}

repeat until find the target number.

![arr4](\images\arr4.png){: width="700" height="700"}

we can implement this by two way. using recursive function or while statement.

**resursive function**

```python
def binarySearch(arr, left, right, target):
    if right >= left: # if the data set is descending
        if right >= left:
            mid = left + (right - left)/2
            if arr[mid] == target:
                return mid
            elif arr[mid] > target:
                return binarySearch(arr, left, mid-1, target)
            else:
                return binarySearch(arr, mid+1, right, target)
    else:
        return -1

arr = [ 1, 2, 3, 4, 5, 6, 7, 8 ]
target = 1
result = binarySearch(arr, 0, len(arr)-1, target)

if result != -1:
    print "Element is present at index %d" % result
else:
    print "Element is not present in array"
```

**while statement**

```python
def binarySearch(arr, left, right, target):
    if right >= left:
        while right >= left:
            mid = left + (right - left)/2
            if arr[mid] == target:
                return mid
            elif arr[mid] > target:
                right = mid - 1
            else:
                left = mid + 1
    else:
        return -1

arr = [ 1, 2, 3, 4, 5, 6, 7, 8 ]
target = 1
result = binarySearch(arr, 0, len(arr)-1, target)

if result != -1:
    print "Element is present at index %d" % result
else:
    print "Element is not present in array"
```

you can see the result using the [IDEONE](https://ideone.com/ideone/Index/submit/)

next time, we will take a binary search tree.

Thank you.


text:
+++
title = "Rules management"
pagetitle = "Rules management"
description = "Manage princing rules, filters and blacklists"
icon = "fa-puzzle-piece"
weight = 3
alwaysopen = false
+++

You will find the following 4 sections in your "General Settings", both at ``Organization`` and ``Agency`` level:

* Configuration
* Selling Pricing Rules
* General Stop Sales
* Specific Stop Sales

You will also be able to identify if these rules are applied to your ``Organization`` (*General Settings*) or only to a specific ``Agency`` (*Agency name*) by checking the top menu.

{{%custom-children%}}

repository: travelgateX/documentation-site

repo_name: travelgateX/documentation-site