text:
# express-generator

This is a generator for express.js applications. It generates a project that out of the box uses the ***MVC pattern with service layer***, ***dependency injection***, ***Mongoose*** and ***BSON*** for data transfer between the client and the server.

* ***Project Initiation***
To generate the project and install the dependencies run ```node ./generator/generator.js init```

* ***Running commands the after initiation*** ``` npm run generate [INSERT COMMAND HERE] ```

* ***Command list***
The list of available commands can be obtained by running the ***help*** command(``` npm run generate help```).

* ***Dependency injection*** for services
The generator provides you with the ***inject middleware***. You can inject services like so:
    ```JavaScript
        //a random controller file
        const controller = require('express').Router();
        const inject = require('./middleware/injectMiddleware');

        //All the services are injected in the request object.
        controller.use(inject([
            'someService' //this is the actual file name in the /services folder
        ]));

        //Use the injected service
        controller.post('/',(req,res)=>req.someService.someMethod());

    ```
* ***BSON***
    The use of ***BSON*** for data transfer is optional. The ***BSON*** objects are automatically parsed(see ***app.js*** file) by a middleware. The middleware expects a compressed(with ***zlib***) ***BSON*** object. You can use [pako](https://github.com/nodeca/pako) to compress the ***BSON*** objects in the browser.

* ***Templating engine, authentication and sessions***
    The generator does not provide any default templating system, authentication or session management. You are free to use whatever you like

repository: callyall/express-generator

gha_language: JavaScript

repo_name: callyall/express-generator


text:
# crawler base

## Requirements

- python 3.X
- docker-ce
- docker-compose
- vnc client(ex. vinagre)

## Installation

```
$ pip install -r requirements.txt
```

## Usage

```
$ docker-compose up -d
```

For reddit login feed crawl.

```
$ echo '{"username": "YOUR_USERNAME", "password": "YOUR_PASSWORD"}' > auth.json
$ python crawl.py -d
```

at the host machine: open vnc client and connect to `localhost:5900` with password `secret`.

## Example
- RedditCrawler: get item links from user's feed of reddit.com
- InstagramCrawler: get feed photos and captions from user's feed of instagram.com. May not work anymore.

license: MIT

repository: Drunkar/crawler-base

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: Drunkar/crawler-base


text:
---
title: Other Features
redirect_from: /payments/vipps/other-features
estimated_read: 60
menu_order: 1100
---

{% include payment-resource.md show_status_operations=true %}

{% include payment-transaction-states.md %}

{% include payment-state.md %}

{% include payments-operations.md %}

### Create Payment

To create a Vipps payment, you perform an HTTP `POST` against the
`/psp/vipps/payments` resource.

An example of a payment creation request is provided below.
Each individual field of the JSON document is described in the following
section.
Use the [expand][technical-reference-expansion] request parameter to get a
response that includes one or more expanded sub-resources inlined.

{:.code-view-header}
**Request**

```http
POST /psp/vipps/payments HTTP/1.1
Host: {{ page.api_host }}
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "payment": {
        "operation": "Purchase",
        "intent": "Authorization",
        "currency": "NOK",
        "prices": [
            {
                "type": "Vipps",
                "amount": 1500,
                "vatAmount": 0
            }
        ],
        "description": "Vipps Test",
        "userAgent": "Mozilla/5.0",
        "language": "nb-NO",
        "urls": {
            "hostUrls": [ "https://example.com", "https://example.net" ],
            "completeUrl": "https://example.com/payment-completed",
            "cancelUrl": "https://example.com/payment-canceled",
            "paymentUrl": "https://example.com/perform-payment",
            "callbackUrl": "{{ page.api_url }}/psp/payment-callback",
            "logoUrl": "https://example.com/path/to/logo.png",
            "termsOfServiceUrl": "https://example.com/terms.pdf"
        },
        "payeeInfo": {
            "payeeId": "{{ page.merchant_id }}",
            "payeeReference": "Postmantimestamp",
            "payeeName": "Merchant1",
            "productCategory": "A123",
            "orderReference": "or-12456",
            "subsite": "MySubsite"
        },
        "payer": {
            "payerReference": "AB1234",
        },
        "prefillInfo": {
            "msisdn": "+4793000001"
        }
    }
}
```

{:.table .table-striped}
|     Required     | Field                        | Type         | Description                                                                                |
| :--------------: | :--------------------------- | :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| {% icon check %} | `payment`                    | `object`     | The `payment` object.                                                                                |
| {% icon check %} | └➔ `operation`          | `string`     | `Purchase`                                                                                |
| {% icon check %} | └➔ `intent`             | `string`     | `Authorization`                                                                                |
| {% icon check %} | └➔ `currency`           | `string`     | NOK                                                                                |
| {% icon check %} | └➔ `prices`             | `object`     | The [`prices`][prices] object.                                                                                |
| {% icon check %} | └─➔ `type`              | `string`     | `vipps`                                                                                |
| {% icon check %} | └─➔ `amount`            | `integer`    | {% include field-description-amount.md currency="NOK" %}                                                                                |
| {% icon check %} | └─➔ `vatAmount`         | `integer`    | {% include field-description-vatamount.md currency="NOK" %}                                                                                |
| {% icon check %} | └➔ `description`        | `string(40)` | {% include field-description-description.md %}                                                                                |
| {% icon check %} | └➔ `userAgent`          | `string`     | The user agent reference of the payer's browser - [see user agent][user-agent]]                                                                                |
| {% icon check %} | └➔ `language`           | `string`     | {% include field-description-language.md %}                                                                                |
| {% icon check %} | └➔ `urls`               | `object`     | The object containing URLs relevant for the `payment`.                                                                                |
| {% icon check %} | └─➔ `hostUrls`          | `array`      | The array of URIs valid for embedding of Swedbank Pay Hosted Views.                                                                                |
| {% icon check %} | └─➔ `completeUrl`       | `string`     | The URI that Swedbank Pay will redirect back to when the payment page is completed. This does not indicate a successful payment, only that it has reached a completion state. A `GET` request needs to be performed on the payment to inspect it further. See [`completeUrl`](#completeurl) for details. |
|                  | └─➔ `cancelUrl`         | `string`     | The URI to redirect the payer to if the payment is canceled, either by the payer or by the merchant trough an `abort` request of the `payment`.                                                                                |
|                  | └─➔ `paymentUrl`        | `string`     | The URI that Swedbank Pay will redirect back to when the payment menu needs to be loaded, to inspect and act on the current status of the `payment`. See [`paymentUrl`](#paymenturl) for details.                                                                                |
|                  | └─➔ `callbackUrl`       | `string`     | The URI that Swedbank Pay will perform an HTTP `POST` request against every time a transaction is created on the payment. See [callback][callbackreference] for details.                                                                                |
|                  | └─➔ `logoUrl`           | `string`     | {% include field-description-logourl.md %}                                                                                |
|                  | └─➔ `termsOfServiceUrl` | `string`     | {% include field-description-termsofserviceurl.md %}                                                                                |
| {% icon check %} | └➔ `payeeInfo`          | `object`     | {% include field-description-payeeinfo.md %}                                                                                |
| {% icon check %} | └─➔ `payeeId`           | `string`     | This is the unique id that identifies this payee (like merchant) set by Swedbank Pay.                                                                                |
| {% icon check %} | └─➔ `payeeReference`    | `string(30)` | {% include field-description-payee-reference.md %}                                                                                |
|                  | └─➔ `payeeName`         | `string`     | The payee name (like merchant name) that will be displayed when redirected to Swedbank Pay.                                                                                |
|                  | └─➔ `productCategory`   | `strin`      | A product category or number sent in from the payee/merchant. This is not validated by Swedbank Pay, but will be passed through the payment process and may be used in the settlement process.                                                            |
|                  | └─➔ `orderReference`    | `string(50)` | The order reference should reflect the order reference found in the merchant's systems.                                                                                |
|                  | └─➔ `subsite`           | `string(40)` | The `subsite` field can be used to perform split settlement on the payment. The `subsites` must be resolved with Swedbank Pay reconciliation before being used.                                                                                |
|                  | └➔ `payer`              | `string`     | The `payer` object, containing information about the payer.                                                                                |
|                  | └─➔ `payerReference`    | `string`     | {% include field-description-payer-reference.md %}                                                                                |
|                  | └➔ `prefillInfo`             | `object`      | An object that holds prefill information that can be inserted on the payment page.                                                                                |
|                  | └─➔ `msisdn`                 | `string`      | Number will be prefilled on payment page, if valid. Only Norwegian phone numbers are supported. The country code prefix is +47                                                                                |

{:.code-view-header}
**Response**

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": {
        "id": "/psp/vipps/payments/{{ page.payment_id }}",
        "number":<PHONE_NUMBER>9,
        "created": "2018-09-05T14:18:44.4259255Z",
        "instrument": "Vipps",
        "operation": "Purchase",
        "intent": "Authorization",
        "state": "Ready",
        "currency": "NOK",
        "prices": {
            "id": "/psp/vipps/payments/{{ page.payment_id }}/prices"
        },
        "amount": 0,
        "description": "Vipps Test",
        "initiatingSystemUserAgent": "PostmanRuntime/7.2.0",
        "userAgent": "Mozilla/5.0 weeeeee",
        "language": "nb-NO",
        "urls": {
            "id": "/psp/vipps/payments/{{ page.payment_id }}/urls"
        },
        "payeeInfo": {
            "id": "/psp/vipps/payments/{{ page.payment_id }}/payeeinfo"
        },
        "payers": {
           "id": "/psp/vipps/payments/{{ page.payment_id }}/payers"
        },
        "metadata": {
            "id": "/psp/vipps/payments/{{ page.payment_id }}/metadata"
        }
    },
    "operations": [
        {
            "method": "PATCH",
            "href": "{{ page.api_url }}/psp/vipps/payments/{{ page.payment_id }}",
            "rel": "update-payment-abort"
        },
        {
            "method": "GET",
            "href": "{{ page.front_end_url }}/vipps/payments/authorize/afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065",
            "rel": "redirect-authorization"
        }
    ]
}
```

### Purchase

Posting a payment (operation `Purchase`) returns the options of aborting the
payment altogether or creating an authorization transaction through the
`redirect-authorization` hyperlink.

{:.code-view-header}
**Request**

```json
{
    "payment": {
        "operation": "Purchase"
    }
}
```

{% include complete-url.md %}

{% include payment-url.md full_reference=true %}

{% include prices.md %}

{% include description.md %}

{% include payee-info.md %}

{% include payee-reference.md %}

{% include transactions.md %}

{% include callback-reference.md %}

{% include payment-link.md %}

{% include metadata.md %}

{% include problems/problems.md %}

{% include seamless-view-events.md %}

{% include settlement-reconciliation.md %}

{% include iterator.html prev_href="after-payment"
        prev_title="After Payment" %}

[callbackreference]: #callback
[prices]: #prices
[technical-reference-expansion]: /introduction#expansion
[user-agent]: https://en.wikipedia.org/wiki/User_agent


text:
# in-stock-notifier - Get notified when a product is back in stock

Get an email notification when a product is back in stock in your online store of choice.

![in-stock-notifier demo notification](./assets/demo.png)

## Table of Contents

- [Getting Started](#getting-started)
  - [Prerequisites](#prerequisites)
  - [Basic Usage](#basic-usage)
  - [Supported Stores](#supported-stores)
  - [SES Setup](#ses-setup)
  - [Tracking New Product](#tracking-new-product)
  - [Creating New Store Interface](#creating-new-store-interface)
- [Architecture](#architecture)
- [Local Development](#local-development)
	- [Local DynamoDB](#local-dynamodb)
	- [Testing](#testing)
	- [Cleanup](#cleanup)
- [Limitations](#limitations)
- [License](#license)

## Getting Started

This project uses several AWS services ([DynamoDB](https://aws.amazon.com/dynamodb/), [Lambda](https://aws.amazon.com/lambda/), [SES](https://aws.amazon.com/ses/)), therefore you need an AWS account to use it.

AWS free tier should be sufficient for this project. Here you can review free tier conditions for [DynamoDB](https://aws.amazon.com/dynamodb/pricing/on-demand/), [https://aws.amazon.com/lambda/pricing/](https://aws.amazon.com/lambda/pricing/) and [SES](https://aws.amazon.com/ses/pricing/).

### Prerequisites

* Python 3.7 or higher
* [Pipenv](https://github.com/pypa/pipenv)
* [AWS CLI](https://aws.amazon.com/cli/)
* [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)

### Basic Usage

If the product that you want to track is from a store that is listed in [Supported Stores](#supported-stores), you will need to go through the following steps: [SES Setup](#ses-setup) and [Tracking New Product](#tracking-new-product). If the store is not supported, you will need to [create a new store interface first](#creating-new-store-interface), and then go through the above steps.

### Supported Stores

* [well.ca](https://well.ca)

### SES Setup

in-stock-notifier uses Amazon Simple Email Service ([SES](https://aws.amazon.com/ses/)) to send email notifications. To use it, you need to create a new SES template, verify your email address(es) that are used for To and From fields and confirm those email addresses.

1. Create new SES template: `aws ses create-template --cli-input-json "$(<./misc/sns_template.json)"`
2. Verify email address(es) (used in To/From fields) `aws ses verify-email-identity --email-address $EMAIL`
3. Confirm email address(es).

You need to setup SES only once.

_If you use the same email in To and From fields, it is possible that you will see a spoofing notice or even get the notification marked as spam, depending on SPF settings of the DNS server handling emails addressed to you._

### Tracking New Product

Create a new line in [products.csv](./in_stock_notifier/products.csv). There are only two columns per file that need to be created: first the Product Name (used in the email notification), and second the product URL.

After the product is added to the CSV, deploy the Lambda function with: `make deploy` (if you don't have `make`, just use the `sam deploy` command from the [Makefile](./Makefile)).

You need to set `EMAIL_FROM` and `EMAIL_TO` environment variables before deploying using email addresses that were verified during [SES Setup](#ses-setup). So, the final command will look like this:

```
<EMAIL_ADDRESS><EMAIL_ADDRESS>make deploy
```

To add another product, simply add it to [products.csv](./in_stock_notifier/products.csv) and re-deploy.

### Creating New Store Interface

The best way to create a new store interface is to first view this store's product pages from the point of view of this service.

1. Find two product pages in this online store. One with a product in stock (`in_stock_url`), another one with a product out of stock (`out_of_stock_url`).
2. Use `misc/visual_test.py in_stock_url out_of_stock_url` to save HTTP GET response HTML files in the current directory.
3. Open these files in your web browser and check if you can visually determine whether one page has the product in stock and the other doesn't. This is basically how this service "sees" web pages.
4. If you can determine that one product is in stock and the other is not by looking at these pages, then see the next step. If not, see [Limitations](#limitations).
5. Create a new class inheriting from StoreInterface in `in_stock_notifier/store_interface.py`. In short, you need to create a `fqdn` class property and implement `_is_in_stock` method. See the file's docstrings for more details.

## Architecture

![in-stock-notifier architecture](./assets/arch.png)

in-stock-notifier is an AWS Lambda function that functions as a cron job that gets invoked every 10 minutes. A DynamoDB table is used to track whether a notification has already been sent for a product. If the product appears to be in stock and a notification has not been already sent, SES is used to send it; then the the table is updated to reflect that.

The table gets populated only when a product appears to be in stock.

## Local Development

A local lambda function (inside a Docker container) can be used for development.

* `make invoke-dev` - invoke the local lambda function and use local instance of DynamoDB (see [Local DynamoDB](#local-dynamodb)). SES is not used but you will see in the logs if an email would have been sent.
* `make invoke-prod` - invoke the local lambda function and use the production instance of DynamoDB. SES will be used to send an actual email notification.
* `make deploy` - deploy the lambda function. The end result is identical to what you would see with `make invoke-prod` but the function will be executed by AWS, not local machine, every 10 minutes.

### Local DynamoDB

You can use a local version of DynamoDB for development. I use [dynalite](https://github.com/mhart/dynalite), but there exist [other alternatives](https://hub.docker.com/r/amazon/dynamodb-local).

```
npm install -g dynalite
dynalite --port 8000
```

### Testing

Use `make test` to run unit tests for store interface.

It's a good idea to add two tests for each new store interface to [test_store_interface](./in_stock_interface/test_store_interface.py). One for a HTML page where a product is in stock ( and another where a product is out of stock. See examples in `in_stock_notifier/test_html`.

### Cleanup

Use `make cleanup` to remove the Cloudformation stack for this project.

## Limitations

Current implementation of StoreInterface assumes that it is possible to determine whether the product is in stock just from the HTTP GET response text of the product page. If an online store loads information about product availability dynamically (e.g. Walmart), a completely different method needs to be used.

One option would be to use some headless browser (with [Selenium](https://selenium-python.readthedocs.io/)), but this would require changing a good chunk of the project code.

## License

in-stock-notifier is made available under the [MIT License](./LICENSE).

repository: danielcht/in-stock-notifier

repo_name: danielcht/in-stock-notifier


text:
# Patchr

Patches Steve's Carts 2 so that the Tile Entity for the Cart Assembler is registered as sc2assembler. Relevant code can be found [here](https://github.com/kimfy/Patchr/blob/master/src/main/java/net/kimfy/patchr/asm/Transformer.java#L24).

This patch was written for the www.dirthuts.com community

repository: kimfy/Patchr

repo_name: kimfy/Patchr


text:
# Renovate Me

> Hey you, yes you, you are at the right place :) <br>
> You want to keep track of your dependencies?

This build task is helping you to use [renovate](https://github.com/renovatebot/renovate) directly with your Azure DevOps Services **git** repo. (Check their nice [Doc](https://docs.renovatebot.com/) if you want to know more)

## Task Setup

- Select a linux Agent queue
- Check that your `Project collection build service` as the right to
  - **Create branch**
  - **Contribute to Pull Request**
  - **Force Push** _(if you want renovate to delete branchs when closing outdated renovations)_
- Make sure you are on a node >= 10.13.0
- _Optional_: install yarn

## Use a yaml file

Microsoft recommends to use multi-staging-pipelines and not the class build / release pipelines. Below you see an example

```yaml
  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
    displayName: 'Use yarn'

  - task: NodeTool@0
    displayName: 'Use node'
    inputs:
    versionSpec: <your node version>

  - task: jyc.vsts-extensions-renovate-me.default-build-task.RenovateMe@0
    input:
      renovateOptionsVersion: 10.3.0 # optional | semantic version of the renovate version to use
      renovateOptionsArgs: '--ignore-unstable=false' # optional | see the folowing for all options https://docs.renovatebot.com/self-hosted-configuration/
    displayName: Run renovate
```

### _Optional_ Add a Github token so RenovateBot can pull release notes

- In Github, head to your account -> Settings -> Developer settings -> Personal access tokens -> Generate new token -> Generate new token (no need to tick any boxes - this token just needs to be able to read public github data). Copy the new PAT
- In your pipeline, add a new Pipeline Variable, `GITHUB_COM_TOKEN`, and paste your new PAT as the value. Tick the box to tell Azure Devops this is a secret.
- In your Renovate task, add the following in Options -> Additional args:

```
--host-rules="[{\"domainName\":\"github.com\",\"token\":\"$(GITHUB_COM_TOKEN)\"}]"
```

The PRs that get created should now include release notes about the new updates.

## In action

![gif](https://raw.githubusercontent.com/jycouet/VSTSExtensions/master/renovateMe/images/renovate_me.gif)

## Basic build definition

**Important**: it is not recommended to use classic build / release definitions anymore.

### tasks

![tasks](https://raw.githubusercontent.com/jycouet/VSTSExtensions/master/renovateMe/images/build_tasks.png)

### OAuth Token should be able to create a branch

![version_control](https://raw.githubusercontent.com/jycouet/VSTSExtensions/master/renovateMe/images/build_versioncontrol.png)

repository: jycouet/VSTSExtensions

gha_language: TypeScript

gha_license_id: MIT

repo_name: jycouet/VSTSExtensions


text:
# Validata

Type safe data validation and sanitization.

See also

- [validata-koa](https://www.npmjs.com/package/validata-koa) for more usage in [Koa](https://www.npmjs.com/package/koa)
- [validata-express](https://www.npmjs.com/package/validata-express) for more usage in [Express](https://www.npmjs.com/package/express)

## Getting started

```bash
npm i validata
```

## Basic usage

```typescript
import { asString, isObject, isString, maybeString } from 'validata';

interface Sample {
  maybeString: string | undefined;
  myString: string;
  numericString: string;
}

const sample = isObject<Sample>({
  maybeString: maybeString(), // will allow string data type or sanitize to undefined
  myString: isString(), // will allow only string data type
  numericString: asString(), // will allow string or attempt to convert to string
});

console.log(
  JSON.stringify(
    sample.process({
      maybeString: 123,
      myString: 123,
      numericString: 123,
    })
  )
);

/*
FAIL: Outputs:
{"issues":[{"path":["maybeString"],"value":123,"reason":"incorrect-type","info":{"expectedType":"string"}},{"path":["myString"],"value":123,"reason":"incorrect-type","info":{"expectedType":"string"}}]}
*/

console.log(
  JSON.stringify(
    sample.process({
      myString: '123',
      numericString: 123,
    })
  )
);

/*
SUCCESS: Outputs:
{"value":{"myString":"123","numericString":"123"}}
*/
```

## API

Checks:

- isAny
- Array
  - isArray
  - maybeArray
  - asArray
  - maybeAsArray
- Boolean
  - isBoolean
  - maybeBoolean
  - asBoolean
  - maybeAsBoolean
- Date
  - isDate
  - maybeDate
  - asDate
  - maybeAsDate
- Enum
  - isEnum
  - maybeEnum
  - asEnum
  - maybeAsEnum
- Number
  - isNumber
  - maybeNumber
  - asNumber
  - maybeAsNumber
- Object
  - isObject
  - maybeObject
  - asObject
  - maybeAsObject
- Record
  - isRecord
  - maybeRecord
  - asRecord
  - maybeAsRecord
- String
  - isString
  - maybeString
  - asString
  - maybeAsString
- Tuple
  - isTuple
  - maybeTuple
- Url
  - isUrl
  - maybeUrl
  - asUrl
  - maybeAsUrl
- isNullable
- asNullable

Types

- TypeOf

Work is done by a typed `ValueProcessor`, as returned by`isObject<T>()` or `asNumber()`.

```typescript
interface ValueProcessor<T> {
  process(value: unknown): Result<T>;
}
```

The `process()` method returns a `Result<T>`.The `Result` is either a list of issues
(meaning validation failures) or the accepted value (it may be coerced/altered from the original).

```typescript
type Result<T> = ValueResult<T> | IssueResult;

interface ValueResult<T> {
  value: T;
}

interface IssueResult {
  issues: Issue[];
}
```

## Naming conventions

### `is...` e.g. `isNumber`

- if the value is of the type it will be accepted
- `null` or `undefined` cause an issue
- otherwise it will cause an issue

### `maybe...` e.g. `maybeNumber`

- if the value is of the type it will be accepted
- `null` or `undefined` it will sanitized to undefined
- otherwise it will cause an issue

### `as...` e.g. `asNumber`

- if the value is of the type it will be accepted
- `null` or `undefined` converted to default, if provided, or cause an issue
- if the value can be converted to the type, it will be converted and used
- if the value is cannot be converted the default will be used if provided
- otherwise it will cause an issue

### `maybeAs...` e.g. `maybeAsNumber`

- if the value is of the type it will be accepted
- `null` or `undefined` converted to default, if provided, or sanitized to undefined
- if the value can be converted to the type it will be converted and used
- if the value is cannot be converted the default will be used if provided
- otherwise it will cause an issue
  // \* otherwise it will be sanitized to undefined

## Checks

### `isArray`, `maybeArray`, `asArray`, `maybeAsArray`

Usage:

```typescript
isArray(itemProcessor, options);
maybeArray(itemProcessor, options);
asArray(itemProcessor, options);
maybeAsArray(itemProcessor, options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `coerceMaxLength? number` - if there are more items than this, some will be removed
- `maxLength?: number` - if there are more items than this, it's an error `max-length`
- `minLength?: number` - if there are less items than this, it's an error `min-length`
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

Example:

```typescript
isArray<number>(isNumber({ max: 20, min: 10 }), { coerceMaxLength: 7 });
```

### `isBoolean`, `maybeBoolean`, `asBoolean`, `maybeAsBoolean`

Usage:

```typescript
isBoolean(options);
maybeBoolean(options);
asBoolean(options);
maybeAsBoolean(options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

### `isDate`, `maybeDate`, `asDate`, `maybeAsDate`

Usage:

```typescript
isDate(options);
maybeDate(options);
asDate(options);
maybeAsDate(options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `format` - custom date format used in conversion from `string` to `Date` see [Luxon formatting](https://moment.github.io/luxon/docs/manual/formatting)
- `maxFuture?: Duration` - if the value is after this duration into the future, it's an error `max-future`
- `maxPast?: Duration` - if the value is before this duration into the past, it's an error `max-past`
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

### `isEnum`, `maybeEnum`, `asEnum`, `maybeAsEnum`

Usage:

```typescript
isEnum(Enum);
maybeNumber(Enum);
asNumber(Enum);
maybeAsNumber(Enum);
```

Example:

```typescript
// String based Enum
enum EnumOne {
  A = 'A',
  B = 'B',
  C = 'C',
}
isEnum(EnumOne); // Allows "A", "B", "C"

// Number based Enum
enum EnumTwo {
  A,
  B,
  C,
}
isEnum(EnumTwo); // Allows 0, 1, 2

// Converting to an Enum using it's key or value
asEnum(EnumTwo); // Allows 1, 2, 3, "A", "B", "C"
asEnum(EnumTwo).process('A'));       // { value: 0 }
asEnum(EnumTwo).process(0));         // { value: 0 }
asEnum(EnumTwo).process(EnumOne.A)); // { value: 0 }
```

### `isNumber`, `maybeNumber`, `asNumber`, `maybeAsNumber`

Usage:

```typescript
isNumber(options);
maybeNumber(options);
asNumber(options);
maybeAsNumber(options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `coerceMin?: number` - if the value is less than this, it will be set to this value
- `coerceMax?: number` - if the value is more than this, it will be set to this value
- `max?: number` - if the value is than this, it's an error `max`
- `min?: number` - if the value is than this, it's an error `min`
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

### `isObject`, `maybeObject`, `asObject`, `maybeAsObject`

Usage:

```typescript
isObject(contract, options);
maybeObject(contract, options);
asObject(contract, options); // will parse string JSON as object
maybeAsObject(contract, options); // will parse string JSON as object
// where `contract` is Record<string, ValueProcessor>
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

Example:

```typescript
interface Sample {
  myString: string;
  maybeString: string | undefined;
  numericString: string;
}

const check = isObject<Sample>({
  maybeString: maybeString(), // if these don't match the interface TypeScript will error
  myString: isString(),
  numericString: asString(),
});
```

### `isRecord`, `maybeRecord`, `asRecord`, `maybeAsRecord`

Usage:

```typescript
isRecord<V>(check, options);
maybeRecord<V>(check, options);
asRecord<V>(check, options);
maybeAsRecord<V>(check, options);
// where `check` is ValueProcessor<V>, and Record<string, V> is the type to be processed
```

Options:

- `keyRegex?: RegExp` - regular expression to check each key name, or it's an error `key-regex`
- `maxKeys?: number` - if the number of keys in the object is more than this, it's an error `max-keys`
- `minKeys?: number` - if the number of keys in the object is more than this, it's an error `max-keys`
- `validator?: (value: Record<string, V>, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

Example:

```typescript
const check = isRecord(isString());
check.process({ foo: 'bar' });
```

### `isString`, `maybeString`, `asString`, `maybeAsString`

Usage:

```typescript
isString(options);
maybeString(options);
asString(options);
maybeAsString(options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `limitLength?: number` - if the length of the string is more than this, it will be truncated to this length
- `padStart?: StringPadding` - pad the start of the string up to given value
- `padEnd?: StringPadding` - pad the end of the string up to given value
- `trim?: 'start' | 'end' | 'both' | 'none'` - removes the leading and/or trailing white space and line terminator characters from the string
- `regex?: RegExp` - regular expression that must be matched, or it's an error `regex`
- `maxLength?: number` - if the length of the string is more than this, it's an error `max-length`
- `minLength?: number` - if the length of the string is less than this, it's an error `min-length`
- `format:? StringFormatCheck` - extension point for string format checking, if check fails it's an issue `format` with `info.expectedFormat` set
- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

StringPadding:

- `length: number` - will pad up until this length
- `padWith: string` - the value to pad with

StringFormat:

- `StringFormat.ULID()` - https://github.com/ulid/spec
- `StringFormat.UUID()` - https://www.ietf.org/rfc/rfc4122.txt
- `StringFormat.password(requirements: PasswordRequirements)` - Password format with minimum requirements

Example:

```typescript
const check = isString({
  limitLength: 6,
  padStart: { length: 6, padWith: '-' },
});
```

```typescript
const check = isString({
  format: StringFormat.ULID(),
});
```

```typescript
const check = isString({
  format: StringFormat.password({
    minLength: 10, // default=8
    numberChars: 2, // default=1
    lowerCaseChars: 2, // default=1
    upperCaseChars: 2, // default=1
    specialChars: 0, // default=1
  }),
});
```

```typescript
// change case
import { pascalCase } from 'change-case';

const check = isString({
  transform: pascalCase,
});
```

```typescript
const check = isString({
  maxLength: 10,
  minLength: 8,
  regex: /^[A-Z]+$/,
});
```

```typescript
import validator from 'validator';

const check = isString({
  validator: validator.isEmail,
  validatorOptions: { allow_display_name: true },
});
```

### `isTuple`, `maybeTuple`

Usage:

```typescript
isTuple(options);
maybeTuple(options);
```

Options:

- `validator?: (value: T, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

Example:

```typescript
type MyTuple = [number, string];
const check = isTuple([isNumber({ max: 9, min: 3 }), isString({ regex: /^\w+$/ })]);
```

### `isUrl`, `maybeUrl`, `asUrl`, `maybeAsUrl`

Working with Node's URL object

Usage:

```typescript
isUrl(options);
maybeUrl(options);
asUrl(options);
maybeAsUrl(options);
```

Options:

- `converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
- `convertOptions` - options to pass to the _converter_
- `setProtocol?: string` - will coerce the protocol to the given value, if present
- `protocol?: string` - given URL must have this protocol, or it's an error `invalid-protocol`
- `validator?: (value: URL, options?: any) => boolean` - custom validation function; if false is returned it's an error
- `validatorOptions?: any` - options to pass to the _validator_

Example:

```typescript
const check = asUrl({
  protocol: 'https',
});
```

### `isNullable`

Any other check can be wrapped into `isNullable` to accept `null`.

Example:

```typescript
const check = isNullable(isString({ min: 3 }));
```

### `asNullable`

Any other check can be wrapped into `asNullable` to accept `null`.

Options:

- `default` - can be `null` or return type or a function with return type of the wrapped check

Example:

```typescript
const check = asNullable(isString({ min: 3 }));
const check = asNullable(isString({ min: 3 }), { default: null });
const check = asNullable(isString({ min: 3 }), { default: 'text' });
const check = asNullable(isString({ min: 3 }), { default: () => 'text' });
```

## Types

Types can be extracted from a `ValueProcessor` or a `Contract`-like pure object.

```typescript
const sampleContract = {
  maybeString: maybeString(),
  myString: isString(),
  numericString: asString(),
};
const sample = isObject(sampleContract);

// both are same as
export type SampleContract = TypeOf<typeof sample>;
export type Sample = TypeOf<typeof sample>;
// interface Sample {
//   myString: string;
//   maybeString: string | undefined;
//   numericString: string;
// }
```

repository: gregbacchus/validata

repo_name: gregbacchus/validata


text:
---
layout: default
---

# 1997-10-09 - Re: computationally infeasible jobs for MITMs (Re: Secure phone)

## Header Data

From: John Deters<EMAIL_ADDRESS>To: Adam Back<EMAIL_ADDRESS>Message Hash: d0a2dca74e6d860c32dfe6a9f2605c3a0b10642a497e3adf9f264fd508173a61

Message ID: \<<IP_ADDRESS>.19971008202940.0099f800@labg30\>

Reply To: \<<IP_ADDRESS>.19971008132417.00b0c6d0@labg30\>

UTC Datetime: 1997-10-09 03:08:36 UTC

Raw Date: Thu, 9 Oct 1997 11:08:36 +0800

## Raw message

```
{% raw  %}From: John Deters<EMAIL_ADDRESS>Date: Thu, 9 Oct 1997 11:08:36 +0800
To: Adam Back<EMAIL_ADDRESS>Subject: Re: computationally infeasible jobs for MITMs (Re: Secure phone)
In-Reply-To: <<IP_ADDRESS>.19971008132417.00b0c6d0@labg30>
Message-ID: <<IP_ADDRESS>.19971008202940.0099f800@labg30>
MIME-Version: 1.0
Content-Type: text/plain

At 11:48 PM 10/8/97 +0100, Adam Back wrote:
>I wonder if we can come up with a way to formalise this technique and
>automate it.  I think it was James voiced something similar earlier in
>the thread.

I think that's the problem:  once it's formalized and automated, it's
spoofable by a MITM.  The informal, "Hi Adam, my first digit's the third
digit of your phone number today, how's your end?" type of query, perhaps
made before or after the entire "I've got 78F, what's yours?" sequence, is
going to remain secure.  If we assume the MITM can spoof your digits, he
can also spoof a whole query without weird digit splicing in the middle.
It's like the cartoon cat looking the cartoon dog image in the mirror,
waving and trying to trick the image.  You can attempt to outmaneuver a
MITM with trick questions which will almost certainly expose him, but if
the stakes are high enough...where there's a will, there was a dead body.

Without some external reference, be it the knowledge of the public key of
the other participant, or using a trusted arbitrator, keyserver or
whatever, I don't think you *can* mathematically authenticate the other
end.  The MITM with full knowledge will always be able to reconstruct the
proper replies.  Your best defenses will be:
    1) External (out-of-band) authentication, as in a PGP key
       signing party, or even just having Bob's key fingerprint
       from a piece of e-mail posted to cypherpunks a year ago.
    2) Wetware outclevering the MITM.

Re:  your noise introduction protocol.  Cute idea, but what if Mallory
simply audio-couples his two phones together along with a noise compander
circuit a la Dolby?  That kind of noise is precisely what the simple
electronic filters can remove, and the digital portion is passed via the
coupling computer system (the one that spoofs the voices.)

"Hey, Bob, I think we've got a MITM!  This connection is too clear!"  :-)

I think the hardest to defeat will be the case where Mallory hires Alicia
and Bobby to impersonate Alice and Bob to each other.
Alice <---------------------------> Bob  (what they think is happening)
Alice <---> Bobby______Alicia <---> Bob  (what actually is happening)
           /                 \
          under Mallory's control

where Bobby and Alicia have the translator's gift of speaking while
listening.  They could fill in the cracks with idle chatter, have their own
personalities, and basically run both shows.  They could even run offline
from each other, being intelligent humans.  As long as Alice and Bob only
communicate through Mallory's intermediaries (i.e. never meet in real life,
out-of-band), Mallory owns the show.  (Tell me you've never seen something
like that on a rerun of _Mission_Impossible_!  :-)

Would you know if you were talking to the REAL John Deters?  All I could
assume about you is that if my phone rang and a voice claimed to be Adam
Back, I'd expect to hear it in a British accent, and with just a bit of
time delay so I'd know it was coming across the Atlantic.  About 50 million
people could pass themselves off as you today, and I'd never know the
difference.  I can't even tell a Liverpool accent from a London accent!
And if I had a voice recognition system, well, then I'd hope if I was
taking a voice sample from you that I'd be smart enough to exchange public
keys so we could do our authentication the right way.

Again, my position is:
  o  internal authentication is *not* information-theoretically possible;
  o  out-of-band authentication *can be* theoretically secure;
  o  MITM attacks are *almost* infeasible, and *always* expensive; and
  o  if you still suspect a MITM after trying to outwit one, you're just
     being paranoid.  Stop it.

John

P.S.  Even if I exchanged PGP keys with you face-to-face, compared picture
ID's, checked your fingerprints, read a signed letter from your Mom (moms
don't lie,) and *knowing* that you are indeed Adam Back, I still won't know
if you work for MI-5 or not!  Nothing's perfect, so lets take what we can
get.
--
J. Deters "Don't think of Windows programs as spaghetti code.  Think
          of them as 'Long sticky pasta objects in OLE sauce'."
+--------------------------------------------------------------------+
| NET<EMAIL_ADDRESS>(work<EMAIL_ADDRESS>(home) |
| PSTN:  1<PHONE_NUMBER> (work)          1<PHONE_NUMBER> (home)        |
| ICBM:  44^58'36"N by 93^16'27"W Elev. ~=290m (work)                |
| For my public key, send mail with the exact subject line of:       |
| Subject: get pgp key                                               |
+--------------------------------------------------------------------+

{% endraw %}
```

## Thread

+ Return to [October 1997](/archive/1997/10)

+ Return to "[Adam Back <aba@dcs.ex.ac.uk>](/authors/adam_back_aba_at_dcs_ex_ac_uk_)"
+ Return to "[Bill Frantz <frantz@netcom.com>](/authors/bill_frantz_frantz_at_netcom_com_)"
+ Return to "[Bill Stewart <stewarts@ix.netcom.com>](/authors/bill_stewart_stewarts_at_ix_netcom_com_)"
+ Return to "["Carl M. Ellison" <cme@acm.org>](/authors/carl_m_ellison_cme_at_acm_org_)"
+ Return to "[Eric Blossom <eb@comsec.com>](/authors/eric_blossom_eb_at_comsec_com_)"
+ Return to "[John Deters <jad@dsddhc.com>](/authors/john_deters_jad_at_dsddhc_com_)"
+ Return to "[The Spook <ts@dev.null>](/authors/the_spook_ts_at_dev_null_)"

+ _Unknown thread root_
  + 1997-10-02 (Fri, 3 Oct 1997 05:20:26 +0800) - [Re: Secure phone](/archive/1997/10/febd3a18a0c7ccffd039e7161f3d355372d649c5fdfb6295137f2e3f97c29260) - _John Deters<EMAIL_ADDRESS>    + 1997-10-03 (Sat, 4 Oct 1997 07:52:34 +0800) - [Re: Secure phone](/archive/1997/10/c8ea20e0cd284651f208ac7e9b6550ae6610a6b9a1a751111755964b4ed2ce6c) - _Eric Blossom<EMAIL_ADDRESS>      + 1997-10-06 (Mon, 6 Oct 1997 16:08:02 +0800) - [Re: Secure phone](/archive/1997/10/a674c705dd64dbac028b3759b1f234c881b05954e3ba7cc480ae822783aed30e) - _Adam Back<EMAIL_ADDRESS>        + 1997-10-06 (Tue, 7 Oct 1997 04:02:19 +0800) - [Re: Secure phone](/archive/1997/10/9015d984f25c41eb1a2b5233d717caff1a96079379242bee4eebc430795c5875) - _Eric Blossom<EMAIL_ADDRESS>          + 1997-10-06 (Tue, 7 Oct 1997 05:55:29 +0800) - [using PGP email to authenticate Eric's Secure phone](/archive/1997/10/a72466ad8aa7dc187ca65ffb8015a89673172c08867d996856010e2dc9008df6) - _Adam Back<EMAIL_ADDRESS>        + 1997-10-07 (Tue, 7 Oct 1997 23:36:21 +0800) - [Re: Secure phone](/archive/1997/10/107e548bce37605f753bf29684ea23827a9c821361775e2765e00d92a7b0b9b4) - _John Deters<EMAIL_ADDRESS>          + 1997-10-07 (Wed, 8 Oct 1997 04:06:54 +0800) - [Re: Secure phone](/archive/1997/10/e9d3b7fa7e73503136efae97a0a55b34dc02c6e55b57c6270005a99e0a2466b6) - _Eric Blossom<EMAIL_ADDRESS>          + 1997-10-08 (Thu, 9 Oct 1997 02:34:10 +0800) - [Re: Secure phone](/archive/1997/10/0514096848cc7f0a2f19c88ea53222a8bc5336278c861195190004b84149b5c8) - _John Deters<EMAIL_ADDRESS>            + 1997-10-08 (Thu, 9 Oct 1997 06:55:21 +0800) - [computationally infeasible jobs for MITMs (Re: Secure phone)](/archive/1997/10/a6993c3bfb4c93cd062f87e01d77c055c8725b2b18186f5bbcc405368da6f15a) - _Adam Back<EMAIL_ADDRESS>            + 1997-10-09 (Thu, 9 Oct 1997 11:08:36 +0800) - Re: computationally infeasible jobs for MITMs (Re: Secure phone) - _John Deters<EMAIL_ADDRESS>            + 1997-10-10 (Fri, 10 Oct 1997 15:14:29 +0800) - [Re: computationally infeasible jobs for MITMs (Re: Secure phone)](/archive/1997/10/d19bf550e264464ab59ffdfd41e7f5d75ada464712a2ff4fe917320224f02863) - _Bill Stewart<EMAIL_ADDRESS>              + 1997-10-10 (Fri, 10 Oct 1997 20:24:57 +0800) - [authentication suggestion for secure phone (Re: computationally infeasible jobs for MITMs)](/archive/1997/10/1eeed8ae4bbf2c5b9011b700fc3f3add73b61879ea974d9101ebdc48df7a08e4) - _Adam Back<EMAIL_ADDRESS>              + 1997-10-10 (Fri, 10 Oct 1997 23:12:56 +0800) - [Re: authentication suggestion for secure phone (Re: computationally infeasible jobs for MITMs)](/archive/1997/10/8f5b6c97d0b84a99773da16297d03e0f9f3aecd3be8e413273530518bd5b4f64) - _John Deters<EMAIL_ADDRESS>                + 1997-10-10 (Sat, 11 Oct 1997 01:21:13 +0800) - [secure phone on a PCI card? (Re: authentication suggestion for secure phone) computationally infeasible jobs for MITMs)](/archive/1997/10/2b4b44a95bee0f618641a83fd5e45fe402b84cf22c2fbbb622b7d2b17fc3ff3e) - _Adam Back<EMAIL_ADDRESS>                  + 1997-10-10 (Sat, 11 Oct 1997 05:25:51 +0800) - [Re: secure phone on a PCI card? (Re: authentication suggestion for secure phone) computationally infeasible jobs for MITMs)](/archive/1997/10/e21cd7808c6e8ad5ab735e915068aabeb4cbf45bf6a928f229259b65436eb7be) - _Eric Blossom<EMAIL_ADDRESS>                    + 1997-10-10 (Sat, 11 Oct 1997 07:40:56 +0800) - [Re: secure phone on a PCI card? (Re: authentication suggestion for secure phone) computationally infeasible jobs for MITMs)](/archive/1997/10/0357d66e4c0f13324bb56893b349e6d2059013e7e9725e9596afa7874290eae6) - _Adam Back<EMAIL_ADDRESS>              + 1997-10-10 (Sat, 11 Oct 1997 00:02:15 +0800) - [Re: authentication suggestion for secure phone (Re: computationally infeasible jobs for MITMs)](/archive/1997/10/a840e0b7a36bcae6ee844c7d449b55f840f72bfb98bc8417f4630ea06095f3ed) - _The Spook<EMAIL_ADDRESS>          + 1997-10-09 (Thu, 9 Oct 1997 12:10:47 +0800) - [Re: Secure phone](/archive/1997/10/9969f23aaacc20349e8a17442b8112c4c1fa818d49de336b96a28b3cf16697b1) - _"Carl M. Ellison"<EMAIL_ADDRESS>      + 1997-10-06 (Tue, 7 Oct 1997 00:40:13 +0800) - [Re: Secure phone](/archive/1997/10/8c4d4863a3b8fb6df9b856045cd6eedc50e31aaaf0197dc5d2cbf9dc8f7f1a07) - _Bill Frantz<EMAIL_ADDRESS>        + 1997-10-06 (Tue, 7 Oct 1997 02:23:45 +0800) - [Re: Secure phone](/archive/1997/10/8d5137a749bde85b927af815356d90efc792a472210c1cc9c815925bc333db06) - _Adam Back<EMAIL_ADDRESS>          + 1997-10-06 (Tue, 7 Oct 1997 03:57:55 +0800) - [Re: Secure phone](/archive/1997/10/d3deb0b2eeb521ff7c62d97155015fa4398cf04180b0c13468e20ca252ffcd71) - _Eric Blossom<EMAIL_ADDRESS>          + 1997-10-06 (Tue, 7 Oct 1997 04:02:35 +0800) - [Re: Secure phone](/archive/1997/10/287dbf6250e6a0fb41c0aca476505b2855e205d9691105e5060fe211d9901fa4) - _Eric Blossom<EMAIL_ADDRESS>        + 1997-10-07 (Tue, 7 Oct 1997 14:52:45 +0800) - [Re: Secure phone](/archive/1997/10/63658b22df124ad23255f02a446a52446633f208da754241e090a4432a1e94d5) - _Bill Frantz<EMAIL_ADDRESS>


text:
---
author:
comments: true
date: 2009-12-11 10:26:18
layout: post
slug: whats-wrong-with-this-picture
title: What's wrong with this picture?
wordpress_id: 1856
categories:
- General
---

![Cashmere.png](http://agro.biodiver.se/wp-content/uploads/2009/12/Cashmere.png)

Snapped on a bus this morning. See the animal there on the left? Does it look like a sheep to you? [Does cashmere come from sheep](http://en.wikipedia.org/wiki/Cashmere_wool)? Would you buy "cashmere" from a manufacturer that doesn't know what animal produces cashmere? Not even at a 50% discount?

I've [bleated about this before](http://jeremycherfas.net/2007/01/25/nit-pickers-needed/), in relation to the strawberries in the BBC's Sense and Sensibility and the wheat in Gladiator. Listen, people, I'm available at a very reasonable fee to check your stuff. Of course, most people don't realize that their stuff even needs checking, and I know that, so I'll just continue to point the finger and poke fun, knowing full well that these efforts probably rebound on me.

repository: jeremycherfas/myocto

extension: markdown

repo_name: jeremycherfas/myocto


text:
### [CVE-2014-5238](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-5238)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

XML external entity (XXE) vulnerability in Open-Xchange (OX) AppSuite before 7.4.2-rev11 and 7.6.x before 7.6.0-rev9 allows remote attackers to read arbitrary files and possibly other unspecified impact via a crafted OpenDocument Text document.

### POC

#### Reference
- http://packetstormsecurity.com/files/128257/Open-Xchange-7.6.0-XSS-SSRF-Traversal.html

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
# a.sign seal qualified

**a.sign seal qualified** is a qualified electonic seal in accordance with the eIDAS regulation (https://eur-lex.europa.eu/eli/reg/2014/910/oj, Section 5, Article 38, Qualified certificates for electronic seals)

**a.sign seal qualified** is a remote signature, therefore the seal private key is stored in a hardware security module in the A-Trust data center.

User Manual: [User_Manual_a.sign_Seal_qualified](User_Manual_a.sign_Seal_qualified.pdf)

repository: A-Trust/ASignSealQualified

gha_language: C#

repo_name: A-Trust/ASignSealQualified


text:
# markdown-it-obsidian
Convert obsidian wiki links to markdown links

This is a modified version of markdown-it-wikilinks, modified to work with Obsidian style links.

This enables you to maintain your blog/digital garden in obsidian and publish via 11ty with github pages.

Some sites that use this:
- https://www.switchless.io/ (repo - https://github.com/switchless-io/docs)
- https://www.echoalex.com/ (repo - https://github.com/alexjv89/echoalex_com)

repository: nsonnad/markdown-it-obsidian

repo_name: nsonnad/markdown-it-obsidian


text:
# EE-298-Project
Three models trained on SVHN core using Pytorch Image Models (timm)
1. [ResNet34](https://github.com/evcaburnay/EE-298-Project/blob/main/ResNet34.ipynb)
2. [DenseNet201](https://github.com/evcaburnay/EE-298-Project/blob/main/DenseNet201.ipynb)
3. [ResNeXt101](https://github.com/evcaburnay/EE-298-Project/blob/main/ResNeXt101.ipynb)


text:
-----------
# FCVolumeSource v1

Group        | Version     | Kind
------------ | ---------- | -----------
Core | v1 | FCVolumeSource

Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.

Appears In PersistentVolumeSpec Volume

Field        | Description
------------ | -----------
fsType
 *string*  | Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
lun
 *integer*  | Required: FC target lun number
readOnly
 *boolean*  | Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.
targetWWNs
 *string array*  | Required: FC target worldwide names (WWNs)

repository: blademainer/kubernetes-book

repo_name: blademainer/kubernetes-book


text:
# E-commerce-Application(Back-End)

Finished homework assignment for week 13: E-Commerce Application (Back-End).

The objective of this week's assignment was to modify starting code to create the back end of an E-commerce retail site.

The application will allow a user to interact with the command-line and add a schema and seed the information into the MySQL database. The user can invoke the application by running the npm run start command in the terminal which will start the server and allow the Sequelize models to sync to the MySQL database.

The user can then use API GET routes to receive the data in the categories, products, or tags tables in the database. You can also use the API POST, PUT, or DELETE routes to create, update, or delete data from the database.

Technologies used: - Javascript - Dotenv - Node - Inquirer - Express - My SQL - My SQL Workbench - Sequelize

Github URL:

https://github.com/trevorwiegand92/Ecommerce-Application-Back-End-

Video URL:

https://drive.google.com/file/d/1lsGGLoAre5Ix3MRmiKVWIUdbuRDDuatG/view

Screenshots:

![Here's a screenshot of the finished index page.](./images/GET_Route_screenshot.png)

![Here's a screenshot of the finished index page.](./images/POST_Route_screenshot.png)

![Here's a screenshot of the finished index page.](./images/DELETE_Route_screenshot.png)


text:
---
layout: post
title: Make for repeated commands
categories: [make]
---

I often find myself repeat the same commands in a project,
for example in Openstack/Kubernetes, but also when I need to interface with Docker (build/push image).

Instead of relying on bash history or writing a few bash scripts, it is just easier
to write a `Makefile`, even if you do not use the Make dependencies and you just use
it as a collection of useful commands.

Here is a template to start from, which supports `make list` to show available targets
and shows how to pass arguments to a command:

* <https://gist.github.com/zonca/fd1980c1aeac394bfc854fce24b9b0df>

repository: zonca/zonca-blog

gha_language: Jupyter Notebook

repo_name: zonca/zonca-blog


text:
---
comment: false
date: 2022-07-07T12:00:00
title: "The Real Problem to Fix"
permalink: /blog/2022/7/7/:slug
tags:
- agile
- softwaredevelopment
- work
---

My experiences over the last 20+ years have helped define my perspective on what successful product development means and I often think about how these are relevant today.

I worked with an organisation who struggled to make an impact with their product. They had difficulties in shipping updates and believed that their teams could deliver ‘faster’. They decided to adopt an Agile framework in an attempt to solve these (and other problems). Implementing this Prescriptive Agile framework — i.e. a method followed ‘by the book’ — became paramount. Instead of trying to solve their actual problems, their decisions and actions became counterproductive. For example, they decided to:

* enforce the same ways of working across all teams
* try to measure and track developer efficiency as a percentage
* make assessments on the relative performance for their product teams

They became fixated by the idea that the process was the problem rather than what mattered: their customers.

Organisations today risk falling into the same trap of trying to solve systemic issues by ‘fixing’ their process in isolation. If you are thinking about adopting a Prescriptive Agile method ‘by the book’, please stop for a moment. You risk wasting valuable time & money because you are focusing on the wrong problem. Instead, spend time helping your organisation experiment with ideas such as:

* releasing smaller, more measurable increments to help improve understanding on difficult problems
* using modular patterns that work at the individual and team-level
* focusing on creating outcomes rather than churning out features

And if you can't do this? Well, good news: you've just discovered a real problem to fix.


text:
# Thumbprint Font Face

Provides the `@font-face` CSS needed to render Thumbtack fonts.

## SCSS usage

```scss
$thumbprint-font-url: '[SERVER URL HERE]';
@import '@thumbtack/thumbprint-font-face/_index';
```

The `$thumbprint-font-url` is a variable required to complete the URL that points to the Thumbtack’s font files. If you need assistance contact the Design Systems team.

repository: senseiurata/thumbprint

repo_name: senseiurata/thumbprint


text:
# Classy Naming
> Provides suggestions for field and parameter names for C#

## What is it for?
Just look at that code:
```csharp
public class BandDataProcessor
{
	private readonly IBandDataProvier _dataProvider;
	private readonly IBandFromatter _formatter;
	private readonly BandParser _bandParser;

	public BandDataProcessor(IBandDataProvier dataProvider,
		IBandFromatter formatter,
		BandParser bandParser)
	{
		...
	}
}
```

Looks familiar, right? We all tend to stick to pretty much same naming
conventions and tend to name parameters or fields after the types they
represent. While your IDE (and VS Code does it for sure) will suggest
you the type name after a few keystrokes, you normally have to type in
the name from the begining to the end. How fun can that be? No fun at all.

*ClassyNaming* is there to save you from dying of boredom when naming your fields.
Just start typing a variable name or activate an IntellySense by a keyboard shortcut and it will suggest you the most obvious options
to chose from!

## See how it works
![](https://github.com/reflectiondm/vscode-classyNaming/raw/master/assets/preview.gif)

---------------
## License
MIT © [Andrei Zubov](https://github.com/reflectiondm)

repository: fabriciohod/vscode-classyNaming

repo_name: fabriciohod/vscode-classyNaming


text:
# Technical Manual - CORA

### Client:

![POW/MIA Logo](img/Logo.JPG)

Reference: http://media.defense.gov/2016/Feb/02/2001339699/-1/-1/0/151116-N-ZZ666-001.JPG

### Table of Contents

[Introduction](Introduction.md)

[Application Features](Application_Features.md)

[Application Architecture](Application_Architecture.md)

[System Requirements](System_Requirements.md)

[Database Design](Database_Design.md)

[Cora Project Installation](CoraInstall.md)

[Infrastructure Setup and Configuration](Infrastructure_Setup_and_Configuration.md)

[Setup of Local Environment for Testing](Setup_of_Local_Enviroment_for_Testing.md)

[Security Design and Configuration](Security_Design_and_Configuration.md)

[System Migration and Configuration](System_Migration_and_Configuration.md)

[Glossary](Glossary.md)

[Appendix I](AppendixI.md)

[Appendix II](AppendixII.md)

[Bibliography](Bibliography.md)

repository: venkatasampath/testci

repo_name: venkatasampath/testci


text:
# Effects operators

As part of the `Effects` library, NgRx provides some useful operators that are frequently
used.

## `ofType`

The `ofType` operator filters the stream of actions based on either string
values (that represent `type`s of actions) or Action Creators.

The generic for the `Actions<TypeUnion>` must be provided in order for type
inference to work properly with string values. Action Creators that are based on
`createAction` function do not have the same limitation.

The `ofType` operator takes up to 5 arguments with proper type inference. It can
take even more, however the type would be inferred as an `Action` interface.

<code-example header="auth.effects.ts">
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map } from 'rxjs/operators';
import {
  LoginPageActions,
  AuthApiActions,
} from '../actions';
import { Credentials } from '../models/user';
import { AuthService } from '../services/auth.service';

@Injectable()
export class AuthEffects {
  login$ = createEffect(() =>
    this.actions$.pipe(
      // Filters by Action Creator 'login'
      ofType(LoginPageActions.login),
      exhaustMap(action =>
        this.authService.login(action.credentials).pipe(
          map(user => AuthApiActions.loginSuccess({ user })),
          catchError(error => of(AuthApiActions.loginFailure({ error })))
        )
      )
    )
  );

  constructor(
    private actions$: Actions,
    private authService: AuthService
  ) {}
}
</code-example>

## `concatLatestFrom`

The `concatLatestFrom` operator functions similarly to `withLatestFrom` with one important difference-
it lazily evaluates the provided Observable factory.

This allows you to utilize the source value when selecting additional sources to concat.

Additionally, because the factory is not executed until it is needed, it also mitigates the performance impact of creating some kinds of Observables.

For example, when selecting data from the store with `store.select`, `concatLatestFrom` will prevent the
selector from being evaluated until the source emits a value.

The `concatLatestFrom` operator takes an Observable factory function that returns an array of Observables, or a single Observable.

<code-example header="router.effects.ts">
import { Injectable } from '@angular/core';
import { Title } from '@angular/platform-browser';

import { map, tap } from 'rxjs/operators';

import {Actions, concatLatestFrom, createEffect, ofType} from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { routerNavigatedAction } from '@ngrx/router-store';

import * as fromRoot from '@example-app/reducers';

@Injectable()
export class RouterEffects {
  updateTitle$ = createEffect(() =>
    this.actions$.pipe(
      ofType(routerNavigatedAction),
      concatLatestFrom(() => this.store.select(fromRoot.selectRouteData)),
      map(([, data]) => `Book Collection - ${data['title']}`),
      tap((title) => this.titleService.setTitle(title))
    ),
    {
      dispatch: false,
    }
  );

  constructor(
    private actions$: Actions,
    private store: Store<fromRoot.State>,
    private titleService: Title
  ) {}
}
</code-example>


text:
---
title: Understanding a BOSH Package
---

A BOSH package is a collection of source code along with a script that describes how to compile the code to binary format and install the package, with optional dependencies on other prerequisite packages.

##  Package Compilation ##

Packages are compiled on demand during deployment. The [Director](/bosh/terminology.html#director) first checks whether a compiled version of the package already exists for the stemcell version to which the package will be deployed. If a compiled version doesn't already exist, the Director instantiates a compile VM using the same stemcell version to which the package will be deployed. This action gets the package source from the blobstore, compiles it, packages the resulting binaries, and stores the package in the blobstore.

To turn source code into binaries, each package has a `packaging` script that is responsible for the compilation, and is run on the compile VM. The script gets two environment variables set from the BOSH agent:

`BOSH_INSTALL_TARGET`
: Where to install the files the package generates. It is set to `/var/vcap/data/packages/<package name>/<package version>`.

`BOSH_COMPILE_TARGET`
: Directory containing the source. It is the current directory when the `packaging` script is invoked.

When the package is installed a symlink is created from `/var/vcap/packages/<package name>` which points to the latest version of the package. This link should be used when referring to another package in the `packaging` script.

There is an optional `pre_packaging` script, which is run when the source of the package is assembled during the `bosh create release`. It can for instance be used to limit which parts of the source that get packages up and stored in the blobstore. It gets the environment variable `BUILD_DIR` set by the BOSH CLI which is the directory containing the source to be packaged.

### Pre-compiled Software Packaging ###

You may want to create a package that contains pre-compiled software. Because a pre-compiled binary runs only on a specific operating system, you must use a stemcell that contains that operating system during deployment.

To create a BOSH package that contains a pre-compiled binary:

1. Obtain a compressed file that contains the pre-compiled binary.

1. Create a packaging script that extracts the binary from the compressed file and copies it to the location you define with the `BOSH_INSTALL_TARGET` environment variable.

    Store this script in the `packages/<package name>/packaging` directory.

    Packaging script example:

    tar zxf myfile.tar.gz
    cp -a myfile ${BOSH_INSTALL_TARGET}

1. Continue [creating your release](./create-release.html).

Note: Record the operating system that the pre-compiled software requires. You will use this information to select a valid stemcell during deployment.

## Package Specs ##

The package contents are specified in the `spec` file, which has three sections:

`name`
: Name of the package.

`dependencies`
: Optional list of other packages this package depends on. See the next section, Dependencies.

`files`
: List of files this package contains, which can contain globs. A `*` matches any file and can be restricted by other values in the glob; for example, `*.rb` only matches files ending with `.rb`. A `**` matches directories recursively.

## Dependencies ##

The package `spec` file contains a section that lists other packages that the current package depends on. These dependencies are compile time dependencies, as opposed to the job dependencies, which are runtime dependencies.

When the [Director](/bosh/terminology.html#director) plans the compilation of a package during a deployment, it first makes sure all dependencies are compiled before it proceeds to compile the current package, and that prior to starting the compilation all dependent packages are installed on the compilation VM.

repository: GeekUnleashed/docs-bosh

repo_name: GeekUnleashed/docs-bosh


text:
---
title: About
icon: fas fa-info-circle
order: 4
---

## Introduce

Hi. I'm Sungsu Park.
I live in Korea.
I've been working as a software developer since 2014.
I mainly work as a backend developer.
But I'm also interested in front-end technology.
I started a blog to collect what I studied.

## Experience
### 2014.01 ~ 2015.06 : Naver Corporation.
- BAND Service data analytics.(based HDFS)
- BAND Service Web
- Web Application for back office

### 2015.06 ~ now : Naver Corporation -> Naver Webtoon Corporation(from 2018.06)
 - All Backend Systems in Global webtoon Service
 - Web( PC, Mobile ) - without markup
 - API Server for App
 - Batch System
 - Web Application for back office
 - Event Common Platform

#### 2021.2 ~ now Part Leader of Global webtoon Server Team
 - advertisement management system
 - System related business models
 - Event Common Platform

## Education
- Bachelor's degree in Dongguk university.

## Skills
### Back-end
 - Java / Kotlin
 - Spring Framework(spring-mvc, spring-batch, spring-data, etc.)
 - Apache httpd, Nginx
 - Tomcat

### Front-end
 - Javascript
 - vue.js,
 - webpack, babel
 - semantic-ui, bootstrap

### Infrastructure
- Redis cluster
- MySQL
- Kafka
- Linux - CentOS( minor )
- Hadoop cluster - hdfs, hive, impala, hue, zeppelin ( minor )
- Docker ( minor )
- Kubernetes


text:
---
date: 2019-07-15T00:00:00+00:00
title: Improving the model
tags:
- javascript
- vuejs
github: https://github.com/sorskoot/ultraviolentjunglist
---
This stream we spend pretty much the whole time on improving the model. This, so we can get the filters and other effects to work.

{{< youtube 4kCA5vkYhbU >}}

<!--more-->
## Segments

| Timestamp | Topic             |
| ---       | ---               |
| 00:00:00 | Hello World |
| 00:04:18 | Demo of the current state of the app |
| 00:05:36 | Get working on the filter |
| 03:28:44 | Goodbye |

---

## Announcements

- [X] !blame, timed notes and !followage to Bot
- [X] Shout out to {{< twitch gaellevel >}} He did a review of our channel.
- [X] !discord
- [X] !git
- [ ] clip

---

## Project working on today

Ultraviolent Junglist:

- [ ] Improve design on Pattern Editor
- [ ] Colors in Segment selection
- [ ] Add more FX

## Next Steps

- [ ] Fix timed events in Rosie. After X messages, wait random minutes than post
- [ ] Fix duplicate messages after follow

---

## Things we learned

{{< twitch proevilz >}} FireFox Developer still has the extion for debugging the web audio API

---

## Todays stream brought to you by

### Raids

| Name | Raiders |
| --- | --- |
| {{< twitch codebasealpha >}} | 5 |

repository: sorskoot/sorskoot-website

gha_language: SCSS

repo_name: sorskoot/sorskoot-website


text:
# Example 3: World War 3 Bombings
The next example concerns a data set containing the locations of World War 2 bombings.
The data was taken from Kaggle [[1]](#1) and split into the years 1943, 1944, and 1945 — collectively these years contain 155175 bombing events in the data.
The output visualization depicts the total mass of bombs dropped in each of these years.

The description of each file provided for this tutorial are listed below:

| File Name                                 | Description                                                                              |
|-------------------------------------------|------------------------------------------------------------------------------------------|
| data-(1943/1944/1945).csv                 | Resource file for tutorial (1943 / 1944 / 1945)                                          |
| json_structure.json                       | JSON file providing the property structure for GeoHexSimple users (all years)            |
| json_walkthrough.md                       | Markdown file providing a walkthrough for users of GeoHexSimple (building the JSON file) |
| output_visualization-(1943/1944/1945).pdf | Output visualization in PDF format (1943 / 1944 / 1945)                                  |
| python_walkthrough.ipynb                  | Jupyter Notebook providing the tutorial for Python (GeoHexViz) users (all years)         |
| python_walkthrough.py                     | Python code providing the tutorial for Python (GeoHexViz) users (all years)              |

## References
[1]
Larion, A. (2016), Aerial Bombing Operations in World War II (online), Kaggle, https://www.kaggle.com/usaf/world-war-ii?select=operations.csv (Access Date: September 2021)

repository: mrempel/geohexviz

gha_language: Python

repo_name: mrempel/geohexviz


text:
# Stochastic Shared Embeddings: Data-driven Regularization of Embedding Layers
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](LICENSE)
This paper has been accepted to this year's (2019) NeurIPS.
Please cite the paper:
```
@article{wu2019stochastic,
  title={Stochastic Shared Embeddings: Data-driven Regularization of Embedding Layers},
  author={Wu, Liwei and Li, Shuqing and Hsieh, Cho-Jui and Sharpnack, James},
  journal={arXiv preprint arXiv:1905.10630},
  year={2019}
}
```

## Description:
This repo consists of 3 folders:
1. SSE-MF for Explicit Feedback
2. SSE-BPR for Implicit Feedback
3. SSE-PT for Sequential Recommendation

Note that:
- SSE stands for Stochastic Shared Embeddings
- MF stands for Matrix Factorization
- BPR stands for Bayseian Personalized Ranking
- PT stands for Personalized Transformer

## Instructions on how to run the code:
1. For explicit feedback setting, `cd SSE-MF` and follow README file there
2. For implicit feedback setting, `cd SSE-BPR` and follow README file there
3. For sequential recommendation setting, `cd SSE-PT` and follow README file there

## System Requirements:
- We assume everyone uses a linux machine/server. We don't consider the Windows/Mac usage case.
- For SSE-MF, Julia 0.6 is needed. Julia 0.7 may be okay but the codes won't work in Julia 1.0 without proper modifications.
- For SSE-BPR, gcc 5.0+, CMake 2.8+ and glog, gflags and lapack libraries are needed for training. Julia 0.6 is needed for evaluation.
- For SSE-PT, tensorflow 1.11.0+, Python 2.7/3.5 and Nvdia GPUs are needed for training and evaluation at a reasonable amount of time.


text:
---
layout: post
title: "IntelliJ Rust Changelog #130"
date: 2020-09-07 11:00:00 +0300
---

## New Features

* Provide `Inline` refactoring for local variables (`Refactor | Inline` or Ctrl + Alt + N) (by [@Kobzol])

    {% include gif-img.html path="/assets/posts/changelog-130/inline" w="700px" %}

* Provide `Generate Getters` and `Generate Setters` actions for struct fields.
Actions can be invoked from `Generate` menu (`Code | Generate` or Alt + Insert) (by [@Kobzol])

    {% include gif-img.html path="/assets/posts/changelog-130/generate_getter_setter" w="700px" %}

* Improvements of `Move` refactoring for top-level items (`Refactor | Move` or F6):

    * Move related `impl`s together with moved items

    * Handle editor selection to choose initial items in refactoring dialog

        {% include gif-img.html path="/assets/posts/changelog-130/move" w="700px" %}

    * Support reexports

    * Check visibility conflicts

* Provide intention to create a function from an unresolved function call (by [@Kobzol])

    {% include gif-img.html path="/assets/posts/changelog-130/create_function" w="700px" %}

* Add project template for procedural macro. [Recently](/2020/08/10/changelog-128.html) we
improved `New project` dialog to support `cargo-generate` templates. In this release we add
[@eupn's template](https://github.com/eupn/rust-procmacro-quickstart-template) that makes it
easy to create a procedural macro project.

* Provide command completion for `wasm-pack` Run Configurations (that was added in the [previous release](/2020/08/24/changelog-129.html))
and `Run Anything` (double Ctrl)

## Performance Improvements

* Don't expand macros disabled by `#[cfg]` attributes. This reduces overall macro expansion time

## Fixes

* Don't unescape backslashes in Rust test output. Fixes many issues with incorrect test output

* Properly resolve re-exports of `crate`-relative paths
(see the corresponding [bug](https://github.com/intellij-rust/intellij-rust/issues/5961))

* Fix macro name resolution: macros from local import should shadow macros from crate root

* Don't check name conventions for `static`s in `extern` blocks

* Exclude `build` directory of [rustc](https://github.com/rust-lang/rust) project from IDE index

* Don't annotate format-like macros where format string is generated by macro
to avoid [false positives](https://github.com/intellij-rust/intellij-rust/issues/5994) (by [@Kobzol])

* Show `No Rust toolchain configured` notification in `Cargo.toml`.
Previously this notification was shown only for Rust files

* Attach `stdarch` and `backtrace` stdlib parts as project dependencies properly.
It fixes search inside them. Also, this improves analysis performance for code that uses `stdarch`

* Fix name resolution of nested modules in modules linked to a project with a `#[path = ""]`
attributes from other directories

* Fix [false positive](https://github.com/intellij-rust/intellij-rust/issues/5965) unresolved reference error
if you call trait method via UFCS and trait is not in the scope

* Fix [exceptions](https://github.com/intellij-rust/intellij-rust/issues/5984) while documentation rendering

* Fix [exception](https://github.com/intellij-rust/intellij-rust/pull/5945) on build cancel
with new `Build` tool window.
You can enable it via `org.rust.cargo.build.tool.window` option in `Experimental Features` panel

* Disable `Substitute associated type` intention for type aliases (by [@Kobzol])

* Fix project creation via `cargo-generate` template when project name contains underscores `_`

* Use project name instead of directory name as default package name while new project creation
(see [the issue](https://github.com/intellij-rust/intellij-rust/issues/5922))

* Display `Cargo` package name instead of project directory name in `Cargo` tool window and run configurations

Full set of changes can be found [here](https://github.com/intellij-rust/intellij-rust/milestone/38?closed=1)

[@Kobzol]: https://github.com/Kobzol


text:
Hangup.js - A Google Hangouts API Emulator
=====================

#What is this?
An emulator for the Google+ Hangouts API to speed up the development process of writing Hangout apps.

This package allows you to use many parts of the Google+ Hangouts API offline to dramatically speed up the Hangout app development workflow.

Note: Not all API features are not supported yet. In the event that unsupported API functionality is used an exception will be thrown. This will not prevent your app from using these features in a real Google Hangout that uses the real Google Hangouts API.

#Features
- Partial implmentation of the Hangouts API
- Ability to emulate multiple participants with one machine via multiple browser windows.

#Usage
To test code changes during development **use the buttons on the developer bar instead of the browser refresh button**.
- Pressing "Reload App" will, as far as your app is concerned, act just like the "Reload App" button in a real Google Hangout. That windows participant will be unchanged, and the Shared state of the app will remain in tact.
- Pressing "Reset app status" will clear the app status and reload the app. This behaviour differs from the button of the same name in a real Google Hangout, which only clears the shared state and does not reload the app.

As far as workflow is concerned, usually the steps are:

1. Make your code changes in your code editor
2. Switch to your browser
3. Press "Reset app status" in the first browser window you have the app running in
4. If you have other windows open with the app also loaded in, then press the "Reload app" button in each of these remaining windows.

#Browser Support
Since Hangup.js uses HTML5 features such as LocalStorage and SessionStorage IE is unsupported. The only tested browser is Google Chrome. Better browser support will hopefully happen in the future.

#Hangout API Version Support
API Version | Hangup.js Status
----------- | -----------
1.1 | Supported
1.2 | Untested

#Currently supported API Features

## Supported Events
###gapi.hangout
API Feature  | Supported
:----------- | :-----------
onApiReady | **Yes**
onAppVisible | **Yes**
onEnabledParticipantsChanged | No
onParticipantsAdded | No
onParticipantsChanged | No
onParticipantsDisabled | No
onParticipantsEnabled | No
onParticipantsRemoved | No
onPreferredLocaleChanged | No
onPublicChanged | No
onTopicChanged | No

###gapi.hangout.av
No support yet

###gapi.hangout.av.effects
No support yet

###gapi.hangout.data
API Feature  | Supported
:----------- | :-----------
onMessageReceived | **Yes**
onStateChanged | **Yes**

###gapi.hangout.layout
API Feature  | Supported
:----------- | :-----------
onChatPaneVisible | No
onHasNotice | No

###gapi.hangout.onair
No support yet

## Supported Functions
###gapi.hangout
API Feature  | Supported
:----------- | :-----------
getEnabledParticipants | No
getHangoutUrl | No
getHangoutId | No
getLocale | No
getLocalParticipantLocale | No
getPreferredLocale | No
getStartData | No
getParticipantById | **Yes**
getParticipantId | **Yes**
getLocalParticipant | No
getLocalParticipantId | No
getParticipants | **Yes**
getTopic | No
hideApp | **Yes**
isApiReady | No
isAppVisible | **Yes**
isPublic | No

###gapi.hangout.av
No support yet

###gapi.hangout.av.effects
No support yet

###gapi.hangout.data
API Feature  | Supported
:----------- | :-----------
clearValue | **Yes**
getKeys | **Yes**
getValue | **Yes**
getState | **Yes**
getStateMetadata | No
setValue | **Yes**
submitDelta | **Yes**
sendMessage | **Yes**

###gapi.hangout.layout
API Feature  | Supported
:----------- | :-----------
createParticipantVideoFeed | No
dismissNotice | **Yes**
displayNotice | **Yes**
getDefaultVideoFeed | No
getVideoCanvas | No
hasNotice | **Yes**
isChatPaneVisible | No
setChatPaneVisible | No

###gapi.hangout.data
No support yet

###gapi.hangout.onair
No support yet

#Bugs
If you believe you have found a bug in Hangup.js then please create an issue on the projects [GitHub issues page](https://github.com/WillsB3/Hangouts-API-Emulator/issues).

#Contributing
If you find an API feature which is not yet implemented in Hangup.js and are able to provide an implementation, then please feel free to file a pull request.

We need help with:

- Improving the API coverage
- Improving browser support
- Implementing unit tests
- Bugfixes

repository: swiperthefox/Hangouts-API-Emulator

repo_name: swiperthefox/Hangouts-API-Emulator


text:
---
elm:
  dependencies:
    gicentre/elm-vegalite: latest

narrative-schemas:
  - newIdiom
---

```elm {l=hidden}
import VegaLite exposing (..)
```

# A new way of visualizing contingency tables

{(aim|}

To create a compact way of showing a 2x2 contingency table that allows magnitudes of rows and of columns to be quickly compared.

{|aim)}

{(desc|}

Each of the 4 values in a 2x2 contingency table should be represented by a square with a size proportional to the magnitude. All four squares should share a common origin in the centre of the chart (i.e. top-left square has origin in bottom right, top-right square has origin in bottom-left etc.).

Something like this:

![cross-quad chart](images/crossQuad1.png)

{|desc)}

{(architypes|}

This will have to wait until I've coded up some examples.

{|architypes)}

{(limitations|}

These only work for 2x2 tables. What if I wanted to show a 3x3 table? Success depends on our ability to compare areas accurately.

{|limitations)}

repository: gicentre/litvis

repo_name: gicentre/litvis


text:
+++
date = "2015-03-17T15:36:56Z"
draft = false
title = "Serialization"
[menu.main]
  parent = "BSON"
  identifier = "Serialization"
  weight = 30
  pre = "<i class='fa'></i>"
+++

## Serialization

[Reading and Writing BSON/JSON]({{< relref "reference\bson\bson.md" >}}) demonstrates how to manually read and write BSON and JSON. However, using the serialization classes make this process much easier.

Serialization is the process of mapping an object to and from a BSON document. The architecture is extensible with numerous hooks to allow you to take more control of the process when necessary.

## Serializer Registry

The serializer registry contains all the [`IBsonSerializers`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializer" >}}) that have been registered. It can be accessed via the [`SerializerRegistry`]({{< apiref "P_MongoDB_Bson_Serialization_BsonSerializer_SerializerRegistry" >}}) property of the static class [`BsonSerializer`]({{< apiref "T_MongoDB_Bson_Serialization_BsonSerializer" >}}).

{{% note %}}This is a global registry. Currently, you cannot use multiple registries in a single application.{{% /note %}}

## Serialization Provider

The [serializer registry]({{< relref "#serializer-registry" >}}) is powered by a list of [`IBsonSerializationProvider`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializationProvider" >}}). A serialization provider allows you to provide serializers on demand. The provider should be registered as soon as possible to ensure that the serializers provided are used. You can delegate handling of any types your custom provider isn't prepared to handle by returning null from [`GetSerializer`]({{< apiref "M_MongoDB_Bson_Serialization_IBsonSerializationProvider_GetSerializer" >}}).

### Implementation

To implement an [`IBsonSerializationProvider`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializationProvider" >}}), create a class that implements the interface and register it using the [`RegisterSerializationProvider`]({{< apiref "M_MongoDB_Bson_Serialization_BsonSerializer_RegisterSerializationProvider" >}}) method.

```csharp
class MyProvider : IBsonSerializationProvider
{
    public IBsonSerializer GetSerializer(Type type)
    {
        if (type == typeof(int))
        {
            return new MyInt32Serializer();
        }

        return null;
    }
}
```

Above, we have a custom implemention of a serializer for an [`Int32`]({{< msdnref "system.int32" >}}). If the type being requested is for an [`Int32`]({{< msdnref "system.int32" >}}), we return our serializer. Otherwise, we return null to let the next [`IBsonSerializationProvider`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializationProvider" >}}) in line handle the request.

## Serializers

[`IBsonSerializer`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializer" >}}) is the main interface that is used to handle translating complex types. There are many serializers already built for handling primitive types, collection types, and [custom classes]({{< relref "reference\bson\mapping\index.md" >}}).

For example, to read a file containing the JSON `{ a: 1, b: [{ c: 1 }] }` into a [`BsonDocument`]({{< apiref "T_MongoDB_Bson_BsonDocument" >}}), use the [`BsonDocumentSerializer`]({{< apiref "T_MongoDB_Bson_Serialization_Serializers_BsonDocumentSerializer" >}}):

```csharp
var jsonString = "{ a: 1, b: [{ c: 1 }] }";
using (var reader = new JsonReader(jsonString))
{
	var context = BsonDeserializationContext.CreateRoot(reader);
	BsonDocument doc = BsonDocumentSerializer.Instance.Deserialize(context);
}
```

### Implementation

{{% note class="warning" %}}Writing custom serializers to handle both normal cases and edge cases can be very tricky.{{% /note %}}

To implement a custom [`IBsonSerializer`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonSerializer" >}}), it is best to inherit from [`SerializerBase<T>`]({{< apiref "T_MongoDB_Bson_Serialization_Serializers_SerializerBase_1" >}}) and override the [`Deserialize`]({{< apiref "M_MongoDB_Bson_Serialization_Serializers_SerializerBase_1_Deserialize" >}}) and [`Serialize`]({{< apiref "M_MongoDB_Bson_Serialization_Serializers_SerializerBase_1_Serialize" >}}) methods.

For example, it implement a serializer that reads an [`Int32`]({{< msdnref "system.int32" >}}):

```csharp
class MyInt32Serializer : SerializerBase<int>
{
    public override int Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
    {
        return context.Reader.ReadInt32();
    }

    public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, int value)
    {
        context.Writer.WriteInt32(value);
    }
}
```

This is overly simplistic. There are other factors that would need to be taken into account such as what happens when the actual BSON type is an [`Int64`]({{< msdnref "system.int64" >}}). In this case, the below implementation is much better:

```csharp
class MyInt32Serializer : SerializerBase<int>
{
    public override int Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
    {
        var type = context.Reader.GetCurrentBsonType();
        switch (type)
        {
            case BsonType.Int32:
                return context.Reader.ReadInt32();
            case BsonType.Int64:
                return Convert.ToInt32(context.Reader.ReadInt64());
            case BsonType.Double:
                return Convert.ToInt32(context.Reader.ReadDouble());
            case BsonType.String:
                return int.Parse(context.Reader.ReadString());
            default:
                var message = string.Format("Cannot convert a {0} to an Int32.", type);
                throw new NotSupportedException(message);
        }
    }

    public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, int value)
    {
        context.Writer.WriteInt32(value);
    }
}
```

Notice that we are testing the current BsonType while reading and making decisions. Since some of these conversions could result in an overflow or truncation, exceptions may still be thrown.

{{% note %}}The built-in [`Int32Serializer`]({{< apiref "T_MongoDB_Bson_Serialization_Serializers_Int32Serializer" >}}) accounts for this as well as other such items.{{% /note %}}

You can register your serializer using the [`RegisterSerializer`]({{< apiref "M_MongoDB_Bson_Serialization_BsonSerializer_RegisterSerializer" >}}) or implement a [serialization provider]({{< relref "#serialization-provider" >}}).

### Opt-in Interfaces

There are some opt-in interfaces that allow the driver to utilize your custom serializer in special ways. You should evaluate these interfaces and decide whether your serializer should implement them.

#### IBsonIdProvider

If your class is used as a root document, you should implement the IBsonIdProvider interface in order for "Inserting" the document to function best, especially if the class your serializer is for uses an Id type other than [`ObjectId`]({{< apiref "T_MongoDB_Bson_ObjectId" >}}).

#### IBsonDocumentSerializer

In order to enable the driver to properly construct type-safe queries using a custom serializer, it needs access to member information. If your custom serializer is for a class, then you should implement [`IBsonDocumentSerializer`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonDocumentSerializer" >}}).

```csharp
class MyClass
{
    public ObjectId Id { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }
}

class MyClassSerializer : SerializerBase<MyClass>, IBsonDocumentSerializer
{
    // implement Serialize and Deserialize

    public bool TryGetMemberSerializationInfo(string memberName, out BsonSerializationInfo serializationInfo)
    {
        switch (memberName)
        {
            case "Id":
                serializationInfo = new BsonSerializationInfo("_id", new ObjectIdSerializer(), typeof(ObjectId));
                return true;
            case "FirstName":
                serializationInfo = new BsonSerializationInfo("fn", new StringSerializer(), typeof(string));
                return true;
            case "LastName":
                serializationInfo = new BsonSerializationInfo("ln", new StringSerializer(), typeof(string));
                return true;
            default:
                serializationInfo = null;
                return false;
        }
    }
}
```

Above, we are providing information about the members of our class based on the member name. This enables the driver to, for instance, translate the below lambda expression into `{ fn: 'Jack' }`.

```csharp
Find(x => x.FirstName == "Jack")
```

#### IBsonArraySerializer

In the same way, if you have written a custom collection serializer, you should implement [`IBsonArraySerializer`]({{< apiref "T_MongoDB_Bson_Serialization_IBsonArraySerializer" >}}).

repository: mongodb/mongo-csharp-driver

repo_name: mongodb/mongo-csharp-driver


text:
# Caesar Cipher

Implement the `encrypt` function in `caesar_cipher.py`
It should encrypt a message that is passed to it.
See [Caesar Cipher](https://en.wikipedia.org/wiki/Caesar_cipher) and [ASCII](https://en.wikipedia.org/wiki/ASCII)

## Run the tests

```
python caesar_cipher_test.py
```

It should output a positive result:

```
....
----------------------------------------------------------------------
Ran 7 tests in 0.000s

OK
```

repository: n-pochet/python-training-exercises

repo_name: n-pochet/python-training-exercises


text:
# JPA/CDI Command Line Application Example

This example shows how to use Context and Dependency Injection in a JavaFX-Application.

Database
===

To start the database open a terminal in the docker subfolder and run the following:
```bash
docker-compose up --build
```

To reset the project and clean the database run
```bash
make clean
```

Running
===

You must start the application with the Main class at.ac.htl.util.ApplicationLauncher to get dependency Injection working

license: Unlicense


text:
## Changes

### 1.0.10
- Updated dependencies

### 1.0.8
- Updated rcc-core dependency

### 1.0.7
- Added dummy implementations for missing `info` and `exec` functions to `redis-mock` client prototype
- Minor code cleanups

### 1.0.5
- Moved all fixing of RedisClient functions and adaptation of the RedisClient prototype to happen at module load time
  in order to fix sequencing bugs where promise-returning "Async" functions installed later by `redis-client-cache` were
  NOT seeing the fixed `ping` function

### 1.0.4
- Added workaround for `redis-mock` module's `ping` function ONLY accepting a callback function as the first argument -
  instead of also handling an optional ping response as a first argument
- Added unit tests to verify overridden `ping` function survives a ping response in its first argument

### 1.0.3
- Replaced `getDefaultHost` function with `defaultHost` property
- Replaced `getDefaultPort` function with `defaultPort` property

### 1.0.2
- Added `.npmignore`
- Renamed `release_notes.md` to `CHANGES.md`
- Updated dependencies

### 1.0.1
- Added better mocked support for `getOptions` and `resolveHostAndPort`

### 1.0.0
- Initial version

repository: byron-dupreez/rcc-redis-mock-adapter

repo_name: byron-dupreez/rcc-redis-mock-adapter