text:
# Description of RSMTool feature file

This file contains information about what features and transformations should be used for scoring model building. No feature file is necessary for models with automatic feature selection.

The file must be in `.json` format and have the following structure:

```json
    {
        "features": [{
                         Information about Feature 1
                     },
                     {
                         Information about Feature 2
                     }]
    }
```

## Fields required for each feature

`feature`: the name of the feature. This must match the feature name in the data file exactly, including capitalization. Feature names should not contain hyphens. The following features names are not permitted: `spkitemid`, `spkitemlab`, `itemType`, `r1`, `r2`, `score`, `sc`, `sc1`, and `adj`.

`transform` - transformation that should be applied to the feature values.

Possible values are:

    * raw - no transformation, use original feature value

    * org - same as raw

    * inv - 1/x

    * sqrt - square root

    * addOneInv - 1/(x+1)

    * addOneLn - ln(x+1)

Note that `rsmtool` will return an error if the values in the data do not allow the supplied transformation (for example, `inv` is applied to feature which contains 0 values). If you really want to use the tranformation, you need to pre-process your data files to remove the problematic cases.

`sign` - after transformation, each feature value will be multiplied by this number. This field is usually set to `1` or `-1` depending on the expected sign of the correlation between transformed feature and human score to ensure that all features in the final models have positive correlation with the score.
When determining the sign, you should take into account both the original correlation between the feature and the score and the applied transformation.  For example, if you use feature which is has negative correlation with human score and apply `sqrt` transformation, `sign` should be set to `-1`. However, if you use the same feature but apply `inv` transformation, `sign` should be set to `1`.

You can check the sign of correlations for both raw and processed features in the final report.

repository: WeilamChung/rsmtool

repo_name: WeilamChung/rsmtool


text:
# Js_of_ocaml Hello, world example

> Js_of_ocaml (abbreviated jsoo) is a compiler from OCaml bytecode to Javascript.

## Resources

- [Website](http://ocsigen.org/js_of_ocaml/)
- [GitHub](https://github.com/ocsigen/js_of_ocaml)
- [Try Js_of_ocaml](http://try.ocamlpro.com/js_of_ocaml/)

## Support

Js_of_ocaml is part of the [Ocsigen project](http://ocsigen.org/).

- [Mailing list](https://sympa.inria.fr/sympa/subscribe/ocsigen)
- IRC : #ocsigen on irc.freenode.net

## Installing js_of_ocaml and tyxml

An easy way is to use [opam](https://opam.ocaml.org/). After having installed `opam`, follow these steps:

  - If you are using `opam` for the first time, you have to initialize it:

    ```sh
    > opam init
    > eval `opam config env`
    ```

    This will create a `.opam` directory in your home.

  - You need a recent version of the OCaml compiler. First check the current version used by `opam`:

    ```sh
    > opam switch
    --     -- 3.11.2  Official 3.11.2 release
    --     -- 3.12.1  Official 3.12.1 release
    --     -- 4.00.0  Official 4.00.0 release
    --     -- 4.00.1  Official 4.00.1 release
    --     -- 4.01.0  Official 4.01.0 release
    --     -- 4.02.0  Official 4.02.0 release
    --     -- 4.02.1  Official 4.02.1 release
    --     -- 4.02.2  Official 4.02.2 release
    system  C system  System compiler (4.02.1)
    ```

    The `C` marks the current compiler. Here version 4.02.1 is installed. We can see that a more recent version is available (4.02.2). So we will install it with `opam switch 4.02.2`. This won't remove the system compiler as `opam` will install the files in your `.opam` directory.

    The following command switches out the current compiler with the newly installed one and sets up your path to use it permanently.

    ```sh
    > opam switch 4.02.2
    > eval `opam config env`
    ```

  - We can now install Js_of_ocaml and tyxml, including optional dependencies.

    ```sh
    > opam install js_of_ocaml tyxml deriving ppx_deriving reactiveData
    ```

  - To make sure you have the latest version, ask `opam` to upgrade the packages if needed:

    ```sh
    > opam update
    > opam upgrade
    ````

  Congratulations, you now have all the required packages! We can now build the application.

## Compilation

You can execute build.sh to compile hello.ml.

```sh
> /bin/sh build.sh
```

It consists of two steps:

1. Compile the `hello.ml` file to OCaml bytecode with the `ocamlbuild` command:

  ```sh
  > ocamlbuild -use-ocamlfind \
      -pkg js_of_ocaml \
      -pkg tyxml \
      -pkg js_of_ocaml.tyxml \
      hello.byte
  ```

2. Build the Javascript file from the `hello.byte` file with the `js_of_ocaml` command:

  ```sh
  > js_of_ocaml +weak.js -o hello.js hello.byte
  ```

  The command options are:
  - `+weak.js` to include the necessary `weak` package.
  - `-o hello.js` to set output file name.

  You can add `--opt 3` to optimize more heavily.

## Results
You can now open hello.html in a browser to see it working.

## Credit

Based on the readme.md file for the [TodoMVC example](https://github.com/slegrand45/examples_ocsigen/tree/master/jsoo/todomvc-react) by [Stéphane Legrand](https://github.com/slegrand45).

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: OCaml

license_type: permissive


text:
# resumer

## Introduction

This python script parses a metadata JSON file from a previous failed workflow and generates a new input JSON file to start a pipeline from where it left off.

## How to use it

Before running this script, you should have a metadata JSON file for a previous failed workflow. You can get it by adding a parameter `-m metadata.json` to the cromwell Java command line. If you stop a workflow (CTRL+C or kill) metadata then JSON file will not be generated.
```bash
$ java -jar ... cromwell-34.jar run chip.wdl -i original_input.json ... -m metadata.json
```

Unfortunately your workflow failed for some reasons but you can fix the problem and want to resume it from where it left off.
```bash
$ python resumer.py metadata.json
```

You will get a new input JSON file `resume.FAILED_WORKFLOW_ID.json` and run cromwell with it instead of the original one `original_input.json`.
```bash
$ java -jar ... cromwell-34.jar run chip.wdl -i resume.FAILED_WORKFLOW_ID.json ...
```

## Usage

```bash
usage: Resumer for ENCODE ATAC/Chip-Seq pipelines [-h]
                                                  [--output-def-json-file OUTPUT_DEF_JSON_FILE]
                                                  metadata_json_file

Parse cromwell's metadata JSON file and generate a new input JSON file to
resume a pipeline from where it left off.

positional arguments:
  metadata_json_file    Cromwell metadata JSON file from a previous failed
                        run.

optional arguments:
  -h, --help            show this help message and exit
  --output-def-json-file OUTPUT_DEF_JSON_FILE
                        Output definition JSON file for your pipeline. If not
                        specified, it will look for a valid JSON file on
                        script's directory. You can use your own JSON file for
                        your pipeline. Entries in "Array[Object]" is for
                        Array[Object] in an input JSON. This is useful to take
                        outputs from a scatter block. For example, the 1st
                        entry of "Array[Object]" in chip.json is "chip.bwa" :
                        {"bam" : "chip.bams", "flagstat_qc" :
                        "chip.flagstat_qcs"}. chip.flagstat_qcs : [...(taken
                        from an output of chip.bwa.flagstat_qc)...] will be
                        added to your new input JSON. For example, the 1st
                        entry of "Object" in chip.json is "chip.pool_ta" :
                        {"ta_pooled" : "chip.ta_pooled"}. chip.ta_pooled :
                        "(taken from an output of chip.pool_ta.ta_pooled)"
                        will be added to your new input JSON.
```

## Examples

```bash
$ python resumer.py metadata.json
```

## How it works (for developers)

In order to use this script, your pipeline should be able to start from any type of inputs (e.g. FASTQ, BAM, ...) and inputs to the previous task (e.g. map_fastq) should be ignored if next step (e.g. filter_bam)'s input is already given in the input JSON file.

```
# example toy_chip workflow that processes through FASTQ->BAM->FILT_BAM->PEAK->REPORT
# this pipeline can start from any types of input FASTQ, BAM, FILT_BAM, PEAK
# key idea of resuming workflow is to skip previous step
# if next step's input is already given in the input JSON file
# this is controlled by `Boolean` variables (`need_to_process_XXX`).

workflow toy_chip {
	# input definition
	Array[File] fastqs = [] # per replicate
	Array[File] bams = [] # per replicate
	Array[File] filt_bams = [] # per replicate
	Array[File] peaks = [] # per replicate

	Boolean need_to_process_peak = true # trivial
	Boolean need_to_process_filt_bam = need_to_process_peak && length(peaks)==0
	Boolean need_to_process_bam = need_to_process_filt_bam && length(filt_bams)==0
	Boolean need_to_process_fastq = need_to_process_bam && length(bams)==0

	scatter(fastq in if need_to_process_fastq then fastqs else []) {
		call map_fastq { input: fastq = fastq }
	}

	# temporary array to deal with outputs from either previous step or from an input JSON file
	Array[File] bams_ = flatten([map_fastq.bam, bams])
	scatter(bam in if need_to_process_bam then bams_ else []) {
		call filter_bam { input: bam = bam }
	}

	Array[File] filt_bams_ = flatten([filter_bam.filt_bam, filt_bams]) # temporary array again
	scatter(filt_bam in if need_to_process_filt_bam then filt_bams_ else []) {
		call call_peak { input: filt_bam = filt_bam }
	}

	Array[File] peaks_ = flatten([call_peak.peak, peaks]) # temporary array again
	if (need_to_process_peak) {
		call generate_report { input: peaks = peaks_ }
	}
}
```

Output definition JSON file `toy_chip.json` for the above example workflow should look like:
```javascript
{
    "Array[Object]" : {
        "toy_chip.map_fastq" : {
        	"bam" : "toy_chip.bams"
    	},
        "toy_chip.filter_bam" : {
        	"filt_bam" : "toy_chip.filt_bams"
    	}
        "toy_chip.call_peak" : {
        	"peak" : "toy_chip.peaks"
    	}
    }
}
```

An original input JSON file to start from fastqs.
```javscript
{
	"toy_chip.fastqs" : ["rep1.fastq.gz", "rep1.fastq.gz"]
}
```

Run a pipeline with this original input JSON.
```bash
$ java -jar cromwell-34.jar run toy_chip.wdl -i org_input.json -m metadata.json
```

Pipeline fails due to some errors in `call_peak` task. Run `resumer.py` to make a new input JSON file to resume.
```bash
$ python resumer.py metadata.json --output-def-json-file toy_chip.json
```

Then `result.WORKFLOW_ID.json` will be generated.
```javscript
{
	"toy_chip.fastqs" : ["rep1.fastq.gz", "rep1.fastq.gz"]
	"toy_chip.bams" : ["rep1.bam", "rep1.bam"]
	"toy_chip.filt_bams" : ["rep1.filt.bam", "rep1.filt.bam"]
}
```

You feed it to the cromwell java command line after fixing the problem. Then pipeline will start from ``scatter` block for `call_peak` tasks.
```bash
$ java -jar cromwell-34.jar run toy_chip.wdl -i resume.WORKFLOW_ID.json
```

## Output definition JSON file (for developers)

An output definition JSON file must have at least one object from `"Array[Object]"` and `"Object"`. It can have both. The following JSON is a simplified version of an output definition JSON file for ChIP-Seq pipeline (`chip.json`).
```javascript
{
    "Array[Object]" : {
        "chip.bwa" : {
            "bam" : "chip.bams",
            "flagstat_qc" : "chip.flagstat_qcs"
        }
    },

    "Object" : {
        "chip.pool_ta" : {
            "ta_pooled" : "chip.ta_pooled"
        }
    }
}
```

`"Array[Object]"` is useful to take an array of outputs from a `scatter` block and `"Object"` is good for taking a single value from any tasks.

Using this JSON file for `resumer.py` will add the following extra input data definitions to the original input JSON file.
```javascript
{
	"chip.bams" : [...(an array of values taken from chip.bwa.bam)...],
	"chip.flagstat_qcs" : [...(an array of values taken from chip.bwa.flagstat_qc)...],
	"chip.ta_pooled" : "...(a value taken from chip.pool_ta.ta_pooled)..."
}

repository: kundajelab/chip-nexus-pipeline

gha_language: Python

gha_license_id: MIT

repo_name: kundajelab/chip-nexus-pipeline


text:
---
author: srt
comments: true
date: 2007-10-12 23:06:00+00:00
layout: post
permalink: users-qless-476/
slug: users-qless
title: 'Users: QLess'
wordpress_id: 476
tags:
- asterisk-java
- users
---

![]({{ site.url }}/assets/2011/12/qless.gif)
QLess is a virtual queue management system for restaurants, theme parks, casinos, doctor's offices -- basically anywhere people are standing around waiting for a service. It holds the user's spot in line and lets them know how the line is moving along and when they reach the front by calling their cell phone. Then the user is free to wander off and make better use of his time.

You can check out their web site at [http://qless.com](http://qless.com) and try out the voice interface at 877-4-0-LINES.

The entire app is written in Java, and they are using Asterisk and Asterisk-Java for all of the voice communication pieces. "It was unbelievably easy to get up and running with both technologies, and they have both been rock-solid reliable. Thanks so much for all of the great work, and keep it coming!" says Tim McCune, their Chief Technical Architect & Cofounder.


text:
# GRAMMABLE

![Grammable](https://i.imgur.com/WNTXCb2.png)

This web application is a simple social media type platform where you can create an account, upload a photo with a description, and comment on other photos that have been posted. You also have the ability to delete your posts. Feel free to fork this project and make it your own!

## Installation

Made with `Ruby 2.5.3` and `Rails ~> 5.2.3`<br />
Dependencies managed with `Bundler version 2.0.2`

Run:
```bash
bundle install
```
..to install dependencies.

Then run the following commands to build the database:

```ruby
rake db:create
rake db:schema:load
```

That's it! Make it your own.

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

repository: shanesfast/grammable

gha_language: Ruby

repo_name: shanesfast/grammable


text:
Pattern: Use of public egress for DigitalOcean Compute

Issue: -

## Description

Opening up ports to the public internet is generally to be avoided. You should restrict access to IP addresses or ranges that explicitly require it where possible.

**Resolution**: Set a more restrictive cidr range.

## Examples

Example of **incorrect** code:

```terraform
resource "digitalocean_firewall" "bad_example" {
	name = "only-22-80-and-443"

	droplet_ids = [digitalocean_droplet.web.id]

	outbound_rule {
	  protocol         = "tcp"
	  port_range       = "22"
	  destination_addresses = ["<IP_ADDRESS>/0", "::/0"]
	}
}
```

Example of **correct** code:

```terraform
resource "digitalocean_firewall" "good_example" {
	name = "only-22-80-and-443"

	droplet_ids = [digitalocean_droplet.web.id]

	outbound_rule {
	  protocol         = "tcp"
	  port_range       = "22"
	  destination_addresses = ["<IP_ADDRESS>/24", "2002:1:2::/48"]
	}
}
```

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
# buffer_zlib

This small extension wraps [zlib](http://zlib.net/) to add several functions for data compression/decompression to GameMaker: Studio (1, 2).

Since the extension is freeware and I'm not particularly familiar with zlib, this repository is intended as a "do it yourself" kind of thing for anyone desiring additional features/platforms. Feel free to send back a pull request if you do something nice.

## Setting up

* Clone/download the repository.
* Download [zlib](http://zlib.net/). I've been using v1.2.11 as of writing this.

## Windows

* Copy all `.h` / `.c` files (`zlib.h`, `inflate.c`, etc) from zlib directory into `buffer_zlib` directory of the repository.
* Open `buffer_zlib.sln` in Visual Studio. I've been using Community Edition 2015 as of writing this.
* If all was done correctly, the project should now produce a valid DLL when in x86 release mode.
* If you want the extension function list to be automatically updated post-compile, download [gmxgen](https://bitbucket.org/yal_cc/gmxgen) and tuck it's executable files at some `PATH` environment variable location.

## Android

* Copy all `.h` / `.c` files (`zlib.h`, `inflate.c`, etc) from zlib directory into `buffer_zlib.java\jni` directory of the repository.
* Run `_javaclass` BAT to compile java class from `BufferZlib.java`. `BufferZlib.class` shall appear in the `buffer_zlib.java\bin\com\gamemaker\bufferzlib` directory.
* Run `_jniheader` BAT. It should produce `com_gamemaker_bufferzlib_BufferZlib.h` header based on the java class. You need to place this file into `buffer_zlib.java\jni`.
* Header is the link between `.java` and `.cpp` sources. Methods in `buffer_zlib.cpp` should match the methods from `com_gamemaker_bufferzlib_BufferZlib.h` which are generated based on the methods from `BufferZlib.java`.
* Run `_libs.bat` to build NDK Shared Library. If all was done correctly, you will see two newly created directories, `obj` and `libs`. Copy `libs` folder and name it `lib`.
 Currently **supported** architecures are: `armeabi`, `armeabi-v7a`, `mips` and `x86`, which should stay. If you build your games without supporting some of architecures (see Android Settings of your project) you can delete it too.
* Add `lib` directory to a zip file. Path of directory should be saved, so it shall be `lib.zip\lib\*`.
* Rename `lib.zip` into `lib.jar` and copy it into `AndroidSource\libs` directory of GameMaker extension.
* Copy `BufferZlib.java` and `BufferZlibExt.java` into `AndroidSource\Java` directory of GameMaker extension. `BufferZlibExt.java` is the main file, so Class Name in Android extension settings should be `BufferZlibExt`.
* Tested SDKs: jdk/jre `1.8.0`, Target SDK `25`, Min SDK `9`, Compile SDK `25`, Build Tools `26`, Support Lib `25.3.1`, NDK `r14b`.

## License

See [zlib license](http://zlib.net/zlib_license.html).

license: Zlib


text:
---
uid: crmscript_ref_NSMarketingAgent_DeleteFormSubmissionEntity
title: DeleteFormSubmissionEntity(Integer formSubmissionEntity);
intellisense: NSMarketingAgent.DeleteFormSubmissionEntity
keywords: NSMarketingAgent, DeleteFormSubmissionEntity
so.topic: reference
---

# DeleteFormSubmissionEntity(Integer formSubmissionEntity);

Deletes the NSFormSubmissionEntity

**Parameters:**
 - **formSubmissionEntityId** The identity of the FormSubmissionEntity to delete.

```crmscript
NSMarketingAgent agent;
agent.DeleteFormSubmissionEntity(123);
```

repository: stianol/crmscript

branch_name: refs/heads/main

repo_name: stianol/crmscript


text:
# Extension UI

## Using The Go Status Bar

The Go status bar appears in the lower left of the extension window. Clicking the Go status bar brings up a menu that provides easy access to see and update important information about your Go project. This includes information about the Go environment, the current Go version, the `gopls` trace, and about the current module.

### Go Environment

The `Go Locate Configured Go Tools` command will display the configured GOPATH, GOROOT, tool locations and the results of `go env` in the output window.

### Managing Your Go Version

You can view the current Go version by looking at the status bar item in the bottom left corner of VS Code. Clicking this button and selecting `Choose Go Environment` will present you with a menu from which you can select any version of Go that exists in your $HOME/sdk directory or on <https://golang.org/dl>. This command is also available through the command pallette using `Go: Choose Go Environment`.

Previously, the `go.goroot` and `go.alternateTools` settings controlled the Go version used by VS Code Go. If you have configured these settings, they are no longer needed and should be deleted.

The "Clear Selection" option resets your Go version to the one found first in either `go.alternateTools`, `go.goroot` or your PATH.

### Installing a New Go Version

After selecting any Go version that has not yet been installed (such as Go 1.14.6 in the screenshot above), the binary will be automatically installed in $HOME/sdk and put to use in your environment.

Once the download completes, VS Code Go will make use of this new Go version.

### Language Server Status

`gopls` is the official Go [language server](https://langserver.org/) developed by the Go team. It was developed in response to the release of Go modules, and it is the recommended approach when working with Go modules in VS Code.

When `gopls` is enabled, :zap: is displayed next to the Go version in the status bar and the `gopls` version is displayed in the menu.

Selecting `Open 'gopls' trace` will open the trace of the `gopls` server in the output window. Please include this trace when filing an issue related to the extension and `gopls` is enabled.

### Modules Status

When modules are enabled for the file you have open, you can navigate to the `go.mod` file for the project using the menu. If you do not see the `Open go.mod` item, then the extension does not think the file you have open belongs to a module.

More information about [using Go modules](https://go.dev/blog/using-go-modules ) is available on the Go blog.

## Go Explorer View

The view displays the go environment variables (`go env`) that are applied to the file open in the editor. You can customize the list by "Go: Edit Workspace" command (pencil icon), and update modifiable environment variables through this view.

It displays required [tools](tools.md) and their location/version info, too.

repository: golang/vscode-go

gha_language: TypeScript

gha_license_id: NOASSERTION

repo_name: golang/vscode-go


text:
Free Payment - Payment Suite
=====

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/f7e00e6f-1e43-46f8-9161-64c000a421d9/mini.png)](https://insight.sensiolabs.com/projects/f7e00e6f-1e43-46f8-9161-64c000a421d9)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PaymentSuite/FreePaymentBundle/badges/quality-score.png?s=962c277666ad58ac942c8180fc72ffee76b45d6c)](https://scrutinizer-ci.com/g/PaymentSuite/FreePaymentBundle/)
[![Latest Stable Version](https://poser.pugx.org/paymentsuite/free-payment-bundle/v/stable.png)](https://packagist.org/packages/paymentsuite/free-payment-bundle)
[![Latest Unstable Version](https://poser.pugx.org/paymentsuite/free-payment-bundle/v/unstable.png)](https://packagist.org/packages/paymentsuite/free-payment-bundle)
[![Total Downloads](https://poser.pugx.org/paymentsuite/free-payment-bundle/downloads.png)](https://packagist.org/packages/paymentsuite/free-payment-bundle)

Table of contents
-----

1. [Install Payment Environment](https://github.com/PaymentSuite/PaymentCoreBundle/wiki/Configure-Payment-Environment)
1. [Creating PlatformBundle](https://github.com/PaymentSuite/PaymentCoreBundle/wiki/Crating-payment-Platforms)
1. [Contribute](https://github.com/PaymentSuite/PaymentCoreBundle/wiki/Contribute)
1. [Configuration](#configuration)
1. [Router](#router)

Configuration
-----

Configure the FreePaymentBundle configuration in your `config.yml`

``` yml
free_payment:

    # By default, controller route is /payment/freepayment/execute
    controller_route: /my/custom/route

    # Configuration for payment success redirection
    #
    # Route defines which route will redirect if payment successes
    # If order_append is true, Bundle will append card identifier into route
    #    taking order_append_field value as parameter name and
    #    PaymentOrderWrapper->getOrderId() value
    payment_success:
        route: card_thanks
        order_append: true
        order_append_field: order_id
```

Router
-----

FreePaymentBundle allows developer to specify the route of controller where freepayment payment is processed.
By default, this value is `/payment/freepayment/execute` but this value can be changed in configuration file.
Anyway, the bundle routes must be parsed by the framework, so these lines must be included into routing.yml file

``` yml
freepayment_payment_routes:
    resource: .
    type: freepayment
```

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

repository: mascoteroscom/paymentsuite

gha_language: PHP

repo_name: mascoteroscom/paymentsuite


text:
<!-- DO NOT EDIT THIS FILE DIRECTLY - it is generated from source file tests/demo.pks -->
<!-- markdownlint-disable MD003 MD012 MD024 MD033 -->

Your Leading Level One Header
=============================

- [Package demo](#package-demo)
- [Function demo_function](#function-demo_function)
- [Procedure demo_procedure](#procedure-demo_procedure)

## Package demo

You can use standard markdown here to describe your package, functions and procedures.

- This is a list entry
- A second one

[A link to Markdown basics](https://daringfireball.net/projects/markdown/basics).

SIGNATURE

```sql
PACKAGE demo AUTHID current_user IS
c_demo_name CONSTANT VARCHAR2(30 CHAR) := 'A demo package for PLOC';
```

## Function demo_function

Description of the function.

EXAMPLE

```sql
DECLARE
  l_result VARCHAR2(100);
BEGIN
  l_result := demo_function(
    p_num_param => 100,
    p_vc2_param => 'some text'));
  -- do something with the result...
END;
/
```

SIGNATURE

```sql
FUNCTION demo_function (
  p_num_param IN NUMBER,   -- Some short parameter description.
  p_vc2_param IN VARCHAR2) -- Another parameter description.
RETURN BLOB;
```

## Procedure demo_procedure

Only a small description.

SIGNATURE

```sql
PROCEDURE demo_procedure;
```

repository: ogobrecht/ploc

gha_language: JavaScript

repo_name: ogobrecht/ploc


text:
# Render React Components in Express with a Redux Like State Container

An Express style middleware for creating a "Redux style" state container and rendering
a React component with it.  This module pairs nicely (like a fine wine) with
[`react-express-middleware`](https://github.com/wesleytodd/react-express-middleware),
[`@wesleytodd/state-container`](https://github.com/wesleytodd/state-container) and,
[`nighthawk`](https://github.com/wesleytodd/nighthawk).

## Usage

```
$ npm i --save @wesleytodd/react-state-container-middleware
```

```javascript
const React = require('react');
const nighthawk = require('nighthawk');
const createStore = require('@wesleytodd/state-container');
const { render } = require('react-express-middleware');
const renderContainer = require('@wesleytodd/react-state-container-middleware');

// Nighthawk is just the express router setup for the browser with history.pushState routing
const app = nighthawk()

// A simple react counter component
class Counter extends React.Component {
  constructor (props) {
    super(props)
    this.props.$dispatch({
      type: 'setCountTo',
      // This is an example of accessing the express route params inside a component
      // This is a feature provided by `react-express-middleware` >v4.0.0`
      value: this.props.$params.countTo
    })
  }

  render () {
    return (
      <div className='counter'>
        <h1>Can you count to {this.props.countTo}?</h2>
        <h2>{this.props.count}</h2>
        <button onClick={this.increment}>Count</button>
      </div>
    )
  }

  // You can pass a reducer as a static property on
  // the react class and the middleware will use it to
  // create the state container/store.
  // Alternativly you can pass the reducer function
  // as an option when you create the middleware (below).
  static reducer (state, action) {
    state = state || {
      countTo: 3,
      count: 0
    }

    if (action.type === 'setCountTo') {
      state.countTo = action.value
    }
    if (action.type === 'increment') {
      state.count++
    }

    return state
  }

  increment = () => {
    // The prop `$dispatch` is the state container's
    // dispatch method.  Think of these props
    // in a similar way to how Redux connected
    // components work.
    this.props.$dispatch({ type: 'increment' })
  }
}

// Pass the component as the first argument to the middleware
app.get('/', renderContainer(Counter, {
  // The middleware makes no assumptions about your render method or store,
  // use Redux or another API compatible render method as you will
  renderMiddlewareFactory: render,
  createStore: createStore,
  initialState: {
    audience: 'World'
  }
}))
```

## Create a reusable middleware configuration with `createFactory`

```javascript
const { createFactory } = require('@wesleytodd/react-state-container-middleware')

const render = createFactory({
  renderMiddlewareFactory: render,
  createStore: createStore
})

// Will use the options from the shared render
app.get('/', render(Counter))

// Use the same render middlware to render on a different route
// This could be a different component but in this case reused Counter
app.get('/:countTo', render(Counter))
```

## Exposed Props

The middleware will pass a few props to your components:

- `$dispatch`: The store `dispatch` method bound to the store. Configurable via `opts.dispatchKey`
- `$subscribe`: The store `subscribe` method bound to the store. Configurable via `opts.subscribeKey`
- `$routeChange`: The name of the action to dispatch on a route change event. Configurable via `opts.routeChangeAction`
- `$renderError`: The name of the action to dispatch on a render error. Configurable via `opts.renderErrorAction`

The `$dispatch` prop is the one you will interact with most as it is how you change the application state.
Typically this would look like `this.props.$dispatch(action)` where `action` is something your store
recognizes as an action.  In Redux this is an object with a `type` property.  If you use
`@wesleytodd/state-container` this can be a `Promise`, `function`/thunk, or a plain action object.

The `$subscribe` function can be used to do custom things on all store actions, but remember that
by default the middleware will subscribe to updates and re-render the component, so you do not need
to do that on your own.

Route change and render errors simply dispatch an `action` with relevant state. If you want to
respond in your application state to these changes just do so in your reducer.

In an express application the standard method for handling an error is to use an error handling
middleware.  But because this middleware handles multiple renders it cannot make the decision to
call `next(err)` for you.  This is one thing with a `@TODO` before we `1.0.0` this.

license: ISC


text:
---
title: "Deep Generative Models(Part 2): Flow-based Models(include PixelCNN)"
tag:
- AutoRegressive
- Flow-based
- Review
redirect_from: /Deep-Generative-Models-Flow-based-Models-PixelCNN.html
---

This is the second part of Deep Generative Model([Part 1](https://arxivnote.ddlee.cn/Deep-Generative-Models-Taxonomy-VAE.html)) Series. We'll focus on Flow-based models in this post.

There are two types of flow: normalizing flow and autoregressive flow.

- fully-observed graphical models: PixelRNN & PixelCNN -> PixelCNN++, WaveNet(audio)
- latent-variable invertible models(Flow-based): NICE, Real NVP -> MAF, IAF, Glow

## Normalizing Flow: NICE, Real NVP, VAE-Flow, MAF, IAF and Glow

### Variational Inference with Normalizing Flows - Rezende - ICML 2015
- Title: **Variational Inference with Normalizing Flows**
- Task: **Image Generation**
- Author: D. J. Rezende and S. Mohamed
- Date:  May 2015
- Arxiv: [1505.05770](https://arxiv.org/abs/1505.05770)
- Published: ICML 2015

A normalizing flow transforms a simple distribution into a complex one by applying a sequence of invertible transformation functions. Flowing through a chain of transformations, we repeatedly substitute the variable for the new one according to the change of variables theorem and eventually obtain a probability distribution of the final target variable.
![Variational Inference with Normalizing Flows - Rezende - ICML 2015](https://i.imgur.com/SpNbE5o.jpg)
Illustration of a normalizing flow model, transforming a simple distribution $p_0(z_0)$ to a complex one $p_K(z_K)$ step by step.

### NICE: Non-linear Independent Components Estimation - Dinh - ICLR 2015
- Title: **NICE: Non-linear Independent Components Estimation**
- Task: **Image Generation**
- Author: L. Dinh, D. Krueger, and Y. Bengio
- Date:  Oct. 2014
- Arxiv: [1410.8516](https://arxiv.org/abs/1410.8516)
- Published: ICLR 2015

NICE defines additive coupling layer:
$$
\left\{\begin{array}{l}{\mathbf{y}_{1 : d}=\mathbf{x}_{1 : d}} \\ {\mathbf{y}_{d+1 : D}=\mathbf{x}_{d+1 : D}+m\left(\mathbf{x}_{1 : d}\right)}\end{array} \Leftrightarrow\left\{\begin{array}{l}{\mathbf{x}_{1 : d}=\mathbf{y}_{1 : d}} \\ {\mathbf{x}_{d+1 : D}=\mathbf{y}_{d+1 : D}-m\left(\mathbf{y}_{1 : d}\right)}\end{array}\right.\right.
$$

### Real NVP - Dinh - ICLR 2017
- Title: **Density estimation using Real NVP**
- Task: **Image Generation**
- Author: L. Dinh, J. Sohl-Dickstein, and S. Bengio
- Date:  May 2016
- Arxiv: [1605.08803](https://arxiv.org/abs/1605.08803)
- Published: ICLR 2017

![Density estimation using Real NVP - Dinh - ICLR 2017](https://i.imgur.com/Rtci5Hb.jpg)

Real NVP implements a normalizing flow by stacking a sequence of invertible bijective transformation functions. In each bijection $f:x↦y$, known as affine coupling layer, the input dimensions are split into two parts:

- The first $d$ dimensions stay same;
- The second part, $d+1$ to $D$ dimensions, undergo an affine transformation (“scale-and-shift”) and both the scale and shift parameters are functions of the first $d$ dimensions.

$$
\begin{aligned} \mathbf{y}_{1 : d} &=\mathbf{x}_{1 : d} \\ \mathbf{y}_{d+1 : D} &=\mathbf{x}_{d+1 : D} \odot \exp \left(s\left(\mathbf{x}_{1 : d}\right)\right)+t\left(\mathbf{x}_{1 : d}\right) \end{aligned}
$$

where $s(.)$ and $t(.)$ are scale and translation functions and both map $\mathbb{R}^{d} \mapsto \mathbb{R}^{D-d}$. The $⊙$ operation is the element-wise product.

![Density estimation using Real NVP - Dinh - ICLR 2017](https://i.imgur.com/4mIvZn1.png)

### (MAF)Masked Autoregressive Flow for Density Estimation - Papamakarios - NIPS 2017
- Title: **Masked Autoregressive Flow for Density Estimation**
- Task: **Image Generation**
- Author: G. Papamakarios, T. Pavlakou, and I. Murray
- Date:  May 2017
- Arxiv: [1705.07057](https://arxiv.org/abs/1705.07057)
- Published: NIPS 2017

Masked Autoregressive Flow is a type of normalizing flows, where the transformation layer is built as an autoregressive neural network. MAF is very similar to Inverse Autoregressive Flow (IAF) introduced later. See more discussion on the relationship between MAF and IAF in the next section.

Given two random variables, $z∼π(z)$ and $x∼p(x)$ and the probability density function $π(z)$ is known, MAF aims to learn $p(x)$. MAF generates each $x_i$ conditioned on the past dimensions $x_{1:i−1}$.

Precisely the conditional probability is an affine transformation of $z$, where the scale and shift terms are functions of the observed part of $x$.

Data generation, producing a new $x$:
$$
x_{i} \sim p\left(x_{i} | \mathbf{x}_{1 : i-1}\right)=z_{i} \odot \sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)+\mu_{i}\left(\mathbf{x}_{1 : i-1}\right), \text { where } \mathbf{z} \sim \pi(\mathbf{z})
$$
Density estimation, given a known $x$:
$$
p(\mathbf{x})=\prod_{i=1}^{D} p\left(x_{i} | \mathbf{x}_{1 : i-1}\right)
$$

The generation procedure is sequential, so it is slow by design. While density estimation only needs one pass the network using architecture like MADE. The transformation function is trivial to inverse and the Jacobian determinant is easy to compute too.

![ Masked Autoregressive Flow for Density Estimation - Papamakarios - NIPS 2017](https://i.imgur.com/6iGl1so.png)

The gray unit $x_i$ is the unit we are trying to compute, and the blue units are the values it depends on. αi and μi are scalars that are computed by passing $x_{1:i−1}$ through neural networks (magenta, orange circles). Even though the transformation is a mere scale-and-shift, the scale and shift can have complex dependencies on previous variables. For the first unit $x_1$, $μ$ and $α$ are usually set to learnable scalar variables that don’t depend on any $x$ or $u$.

The inverse pass:
![ Masked Autoregressive Flow for Density Estimation - Papamakarios - NIPS 2017](https://i.imgur.com/f0StdP1.png)

### (IAF)Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016
- Title: **Improving Variational Inference with Inverse Autoregressive Flow**
- Task: **Image Generation**
- Author: D. P. Kingma, T. Salimans, R. Jozefowicz, X. Chen, I. Sutskever, and M. Welling
- Date: Jun. 2016.
- Arxiv: [1606.04934](https://arxiv.org/abs/1606.04934)
- Published: NIPS 2016

Similar to MAF, Inverse autoregressive flow (IAF; Kingma et al., 2016) models the conditional probability of the target variable as an autoregressive model too, but with a reversed flow, thus achieving a much efficient sampling process.

First, let’s reverse the affine transformation in MAF:
$$
z_{i}=\frac{x_{i}-\mu_{i}\left(\mathbf{x}_{1 : i-1}\right)}{\sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)}=-\frac{\mu_{i}\left(\mathbf{x}_{1 : i-1}\right)}{\sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)}+x_{i} \odot \frac{1}{\sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)}
$$
if let:
$$
\begin{array}{l}{\mathbf{x}=\mathbf{z}, p( .)=\pi( .), \mathbf{x} \sim p(\mathbf{x})} \\ {\mathbf{z}=\mathbf{x}, \pi( .)=p( .), \mathbf{z} \sim \pi(\mathbf{z})}\end{array}\\
\begin{aligned} \mu_{i}\left(\mathbf{z}_{i : i-1}\right) &=\mu_{i}\left(\mathbf{x}_{1 : i-1}\right)=-\frac{\mu_{i}\left(\mathbf{x}_{1 : i-1}\right)}{\sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)} \\ \sigma\left(\mathbf{z}_{i : i-1}\right) &=\sigma\left(\mathbf{x}_{1 : i-1}\right)=\frac{1}{\sigma_{i}\left(\mathbf{x}_{1 : i-1}\right)} \end{aligned}
$$
Then we have:
![Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016](https://i.imgur.com/oXhXKRT.jpg)

IAF intends to estimate the probability density function of $x̃$ given that $π̃ (z̃ )$
 is already known. The inverse flow is an autoregressive affine transformation too, same as in MAF, but the scale and shift terms are autoregressive functions of observed variables from the known distribution $π̃ (z̃)$.

 ![Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016](https://i.imgur.com/QbbEmSy.jpg)

 Like other normalizing flows, drawing samples from an approximate posterior with Inverse AutoregressiveFlow(IAF) consists of an initial sample $z$ drawn from a simple distribution, such as a Gaussian with diagonal covariance, followed by a chain of nonlinear invertible transformations of z, each with a simple Jacobian determinants.

 ![Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016](https://i.imgur.com/yyg4OBS.png)

 ![Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016](https://i.imgur.com/ZNZbvUy.jpg)

Computations of the individual elements $x̃ i$ do not depend on each other, so they are easily parallelizable (only one pass using MADE). The density estimation for a known $x̃ $ is not efficient, because we have to recover the value of $z̃ i$ in a sequential order, $z̃ i=(x̃ i−μ̃ i(z̃ 1:i−1))/σ̃ i(z̃ 1:i−1)$ thus D times in total.

![Improving Variational Inference with Inverse Autoregressive Flow - Kingma - NIPS 2016](https://i.imgur.com/t9KYagm.jpg)

### Glow: Generative Flow with Invertible 1x1 Convolutions - Kingma & Dhariwal - NIPS 2018

- Title: **Glow: Generative Flow with Invertible 1x1 Convolutions**
- Task: **Image Generation**
- Author: D. P. Kingma and P. Dhariwal
- Date: Jul. 2018
- Arxiv: [1807.03039](https://arxiv.org/abs/1807.03039)
- Published: NIPS 2018

**The proposed flow**
![Glow: Generative Flow with Invertible 1x1 Convolutions - Kingma & Dhariwal - NIPS 2018](https://i.imgur.com/e65n6xN.jpg)

The authors propose a generative flow where each step (left) consists of an actnorm step, followed by an invertible 1 × 1 convolution, followed by an affine transformation (Dinh et al., 2014). This flow is combined with a multi-scale architecture (right).

There are three steps in one stage of flow in Glow.

Step 1:**Activation normalization** (short for “actnorm”)

It performs an affine transformation using a scale and bias parameter per channel, similar to batch normalization, but works for mini-batch size 1. The parameters are trainable but initialized so that the first minibatch of data have mean 0 and standard deviation 1 after actnorm.

Step 2: **Invertible 1x1 conv**

Between layers of the RealNVP flow, the ordering of channels is reversed so that all the data dimensions have a chance to be altered. A 1×1 convolution with equal number of input and output channels is a generalization of any permutation of the channel ordering.

Say, we have an invertible 1x1 convolution of an input $h×w×c$ tensor $h$ with a weight matrix $W$ of size $c×c$. The output is a $h×w×c$ tensor, labeled as $ f=𝚌𝚘𝚗𝚟𝟸𝚍(h;W)$. In order to apply the change of variable rule, we need to compute the Jacobian determinant $|det∂f/∂h|$.

Both the input and output of 1x1 convolution here can be viewed as a matrix of size $h×w$. Each entry $x_{ij}$($i=1,2...h, j=1,2,...,w$) in $h$ is a vector of $c$ channels and each entry is multiplied by the weight matrix $W$ to obtain the corresponding entry $y_{ij}$ in the output matrix respectively. The derivative of each entry is $\partial \mathbf{x}_{i j} \mathbf{W} / \partial \mathbf{x}_{i j}=\mathbf{w}$ and there are $h×w$ such entries in total:

The inverse 1x1 convolution depends on the inverse matrix $W^{−1}$
. Since the weight matrix is relatively small, the amount of computation for the matrix determinant (tf.linalg.det) and inversion (tf.linalg.inv) is still under control.

Step 3: Affine coupling layer

The design is same as in RealNVP.

![Glow: Generative Flow with Invertible 1x1 Convolutions - Kingma & Dhariwal - NIPS 2018](https://i.imgur.com/CjlvJLu.jpg)

The three main components of proposed flow, their reverses, and their log-determinants. Here, $x$ signifies the input of the layer, and $y$ signifies its output. Both $x$ and $y$ are tensors of shape $[h × w × c]$ with spatial dimensions (h, w) and channel dimension $c$. With $(i, j)$ we denote spatial indices into tensors $x$ and $y$. The function NN() is a nonlinear mapping, such as a (shallow) convolutional neural network like in ResNets (He et al., 2016) and RealNVP (Dinh et al., 2016).

## AutoRegressive Flow: PixelRNN, PixelCNN, Gated PixelCNN, WaveNet and PixelCNN++
### (PixelRNN & PixelCNN)Pixel Recurrent Neural Networks - van den Oord - ICML 2016

- Title: **Pixel Recurrent Neural Networks**
- Task: **Image Generation**
- Author: A. van den Oord, N. Kalchbrenner, and K. Kavukcuoglu
- Date:  Jan 2016
- Arxiv: [1601.06759](https://arxiv.org/abs/1601.06759)
- Published: ICML 2016(Best Paper Award)
- Affiliation: Google DeepMind

**Highlights**
- Fully tractable modeling of image distribution
- PixelRNN & PixelCNN

**Design**
To estimate the joint distribution $p(x)$ we write it as the product of the conditional distributions over the pixels:

$$
p(\mathbf{x})=\prod_{i=1}^{n^{2}} p\left(x_{i} | x_{1}, \ldots, x_{i-1}\right)
$$

Generating pixel-by-pixel with CNN, LSTM:
![Pixel Recurrent Neural Networks](https://i.imgur.com/Et9vL70.png)

### Conditional Image Generation with PixelCNN Decoders - van den Oord - NIPS 2016

- Title: **Conditional Image Generation with PixelCNN Decoders**
- Task: **Image Generation**
- Author: A. van den Oord, N. Kalchbrenner, O. Vinyals, L. Espeholt, A. Graves, and K. Kavukcuoglu
- Date:  Jun. 2016
- Arxiv: [1606.05328](https://arxiv.org/abs/1606.05328)
- Published: NIPS 2016
- Affiliation: Google DeepMind

**Highlights**
- Conditional with class labels or conv embeddings
- Can also serve as a powerful decoder

**Design**
Typically, to make sure the CNN can only use information about pixels above and to the left of the current pixel, the filters of the convolution in PixelCNN are masked. However, its computational cost rise rapidly when stacked.

The gated activation unit:
$$
\mathbf{y}=\tanh \left(W_{k, f} * \mathbf{x}\right) \odot \sigma\left(W_{k, g} * \mathbf{x}\right),
$$
where $σ$ is the sigmoid non-linearity, $k$ is the number of the layer, $⊙$ is the element-wise product and $∗$ is the convolution operator.

Add a high-level image description represented as a latent vector $h$:
$$
\mathbf{y}=\tanh \left(W_{k, f} * \mathbf{x}+V_{k, f}^{T} \mathbf{h}\right) \odot \sigma\left(W_{k, g} * \mathbf{x}+V_{k, g}^{T} \mathbf{h}\right)
$$

![Conditional Image Generation with PixelCNN Decoders](https://i.imgur.com/DTseuKt.png)

### WaveNet: A Generative Model for Raw Audio - van den Oord - SSW 2016
- Title: **WaveNet: A Generative Model for Raw Audio**
- Task: **Text to Speech**
- Author: A. van den Oord et al.
- Arxiv: [1609.03499](https://arxivnote.ddlee.cn/1609.03499)
- Date: Sep. 2016.
- Published: SSW 2016

WaveNet consists of a stack of causal convolution which is a convolution operation designed to respect the ordering: the prediction at a certain timestamp can only consume the data observed in the past, no dependency on the future. In PixelCNN, the causal convolution is implemented by masked convolution kernel. The causal convolution in WaveNet is simply to shift the output by a number of timestamps to the future so that the output is aligned with the last input element.

![](https://i.imgur.com/V10Et4B.png)

One big drawback of convolution layer is a very limited size of receptive field. The output can hardly depend on the input hundreds or thousands of timesteps ago, which can be a crucial requirement for modeling long sequences. WaveNet therefore adopts dilated convolution (animation), where the kernel is applied to an evenly-distributed subset of samples in a much larger receptive field of the input.

![CleanShot 2019-08-20 at 16.08.23@2x](https://i.imgur.com/uCOWLbN.jpg)

### PixelCNN++: Improving the PixelCNN with Discretized Logistic Mixture Likelihood and Other Modification - Salimans - ICLR 2017

- Title: **PixelCNN++: Improving the PixelCNN with Discretized Logistic Mixture Likelihood and Other Modifications**
- Task: **Image Generation**
- Author: T. Salimans, A. Karpathy, X. Chen, and D. P. Kingma
- Date:  Jan. 2017
- Arxiv: [1701.05517](https://arxiv.org/abs/1701.05517)
- Published: ICLR 2017
- Affiliation: OpenAI

**Highlights**
- A discretized logistic mixture likelihood on the pixels, rather than a 256-way softmax, which speeds up training.
- Condition on whole pixels, rather than R/G/B sub-pixels, simplifying the model structure.
- Downsampling to efficiently capture structure at multiple resolutions.
- Additional shortcut connections to further speed up optimization.
- Regularize the model using dropout

**Design**
By choosing a simple continuous distribution for modeling $ν$ we obtain a smooth and memory efficient predictive distribution for $x$. Here, we take this continuous univariate distribution to be a mixture of logistic distributions which allows us to easily calculate the probability on the observed discretized value $x$ For all sub-pixel values $x$ excepting the edge cases 0 and 255 we have:
$$
\nu \sim \sum_{i=1}^{K} \pi_{i} \operatorname{logistic}\left(\mu_{i}, s_{i}\right)
$$

$$
P(x | \pi, \mu, s)=\sum_{i=1}^{K} \pi_{i}\left[\sigma\left(\left(x+0.5-\mu_{i}\right) / s_{i}\right)-\sigma\left(\left(x-0.5-\mu_{i}\right) / s_{i}\right)\right]
$$

The output of our network is thus of much lower dimension, yielding much denser gradients of the loss with respect to our parameters.

![PixelCNN++: Improving the PixelCNN with Discretized Logistic Mixture Likelihood and Other Modification](https://i.imgur.com/MN4a9m1.png)

## References

- [Normalizing Flows](http://akosiorek.github.io/ml/2018/04/03/norm_flows.html)

## Related
- [Deep Generative Models(Part 1): Taxonomy and VAEs](https://arxivnote.ddlee.cn/Deep-Generative-Models-Taxonomy-VAE.html)
- [Deep Generative Models(Part 3): GANs](https://arxivnote.ddlee.cn/Deep-Generative-Models-GAN-WGAN-SAGAN-StyleGAN-BigGAN.html)
- [Image to Image Translation(1): pix2pix, S+U, CycleGAN, UNIT, BicycleGAN, and StarGAN](https://arxivnote.ddlee.cn/Image-to-image-Translation-pix2pix-CycleGAN-UNIT-BicycleGAN-StarGAN.html)
- [Image to Image Translation(2): pix2pixHD, MUNIT, DRIT, vid2vid, SPADE, INIT, and FUNIT](https://arxivnote.ddlee.cn/Image-to-image-Translation-pix2pixHD-MUNIT-DRIT-vid2vid-SPADE-INIT-FUNIT.html)
- VQ-VAE: [Neural Discrete Representation Learning - van den Oord - NIPS 2017](https://arxivnote.ddlee.cn/Neural-Discrete-Representation-Learning.html)
- VQ-VAE-2: [ Generating Diverse High-Fidelity Images with VQ-VAE-2 - Razavi - 2019](https://arxivnote.ddlee.cn/Generating-Diverse-High-Fidelity-Images-with-VQ-VAE-2.html)
- [Glow: Generative Flow with Invertible 1x1 Convolutions - Kingma & Dhariwal - NIPS 2018](https://arxivnote.ddlee.cn/Glow-Generative-Flow-with-Invertible-1x1-Convolutions-Kingma-Dhariwal-NIPS.html)
- [From Classification to Panoptic Segmentation: 7 years of Visual Understanding with Deep Learning](https://arxivnote.ddlee.cn/Classification-to-Panoptic-Segmentation-visual-understanding-CVPR.html)

repository: ddlee-cn/arxivnotes

repo_name: ddlee-cn/arxivnotes


text:
# keycloak-examples

With the exception of app-html5 and app-profile-html5, all examples are deployed as a WAR.  These examples assume that a Keycloak server is running on localhost:8180 and a WildFly server is running on localhost:8080.

If you want to change the address of the Keycloak server, edit the keycloak.json file in each example's WEB-INF directory.
If you want to change the address of the WildFly server, edit each example's client detail in the UI of the Keycloak server.

To install and run all the WAR-based examples:

1. Download this keycloak-examples repository.
2. [Download](http://keycloak.jboss.org/keycloak/downloads.html) and unzip the plain **keycloak** distribution.  Do not download the demo dist.
3. [Download](http://wildfly.org/downloads/) an unzip WildFly.
4. [Download](http://keycloak.jboss.org/keycloak/downloads.html?dir=0%3Dadapters/keycloak-oidc%3B) the Keycloak OIDC adapter for WildFly.  Unzip this adapter on top of WildFly.
5. [Download](http://keycloak.jboss.org/keycloak/downloads.html?dir=0%3Dadapters/saml%3B) the Keycloak SAML adapter for WildFly.  Unzip this adapter on top of WildFly.  It's OK to overwrite modules.
6. *cd <Keycloak Home>/bin*
7. *standalone(.bat or .sh) -Djboss.socket.binding.port-offset=100*
8. In your browser, go to <http://localhost:8180/auth/admin/index.html>
9. Login with admin/admin and change the password when prompted.
10. In the upper lefthand corner, click on Master->Add Realm
11. Click "Select File" and choose *examples-realm.json* from the root of the keycloak-examples repo from step 1.
12. *cd <WildFly Home>/bin*
13. *standalone(.bat or .sh)*
14. With WildFly running, open a new command prompt and *cd <WildFly Home>/bin* again.  Then execute the following three commands to finish adapter install.
15. *jboss-cli -c --file=adapter-install.cli*
16. *jboss-cli -c --file=adapter-install-saml.cli*
17. *jboss-cli -c --command=:reload*
18. At the root of the keycloak-examples repo, run *mvn wildfly:deploy*

The Examples realm you imported has two users, *secure-user* and *admin-user*.  Both use "password" as the password.

You can run each example with the following URLs:

* <http://localhost:8080/app-html5/>
* <http://localhost:8080/app-profile-html5/>
* <http://localhost:8080/app-jee/>
* <http://localhost:8080/app-profile-jee/>
* <http://localhost:8080/app-profile-jee-saml/>

repository: vramik/keycloak-examples

repo_name: vramik/keycloak-examples


text:
# hadoop-docker-cluster

Hadoop docker cluster for bigdata developer.

## Supported Version
Hadoop: 3.1.1
OpenJdk: 1.8.0_202

## Usage
### Step 1: Build images
```bash
./hadoop-docker-cluster.sh build
```
> It takes a lot of time, depends on your network

### Step 3: Cluster start
- Use `launch` to create and start containers
```bash
./hadoop-docker-cluster.sh launch
```
- Use `restart` to start exist containers
```
./hadoop-docker-cluster.sh restart
```

### Step 4: Cluster login

- login into hadoop master
```bash
docker exec -it hadoop-cluster-master bash
```

- login into hadoop slave 1
```bash
docker exec -it hadoop-cluster-slave1 bash
```

### Step 5: Cluster stop
- Use `destory` to remove the container
```bash
./hadoop-docker-cluster.sh destory
```
> Be careful: all data lose after destory

- Use `stop` to kill the container
```bash
./hadoop-docker-cluster.sh stop
```

## Urls
- Hadoop info of nodemaster.
http://<IP_ADDRESS>:8088/cluster

- DFS Health of nodemaster.
http://<IP_ADDRESS>:9870

## License
MIT

repository: idata-lab/hadoop-docker-cluster

repo_name: idata-lab/hadoop-docker-cluster


text:
## Interactive Environment For Probabilistic Programming for Probabilistic Data Analysis

[![Build Status](https://travis-ci.org/probcomp/iventure.svg?branch=master)](https://travis-ci.org/probcomp/iventure)

## About

iventure serves as a jupyter-based front-end for [BayesDB](https://github.com/probcomp/bayeslite).

## Installing

For access to iventure, please refer to the release webpage of the
[Probabilistic Computing Stack](http://probcomp.org/open-probabilistic-programming-stack/).

## Tutorial Notebooks

Please refer to the following tutorial notebooks for illustrative probabilistic
data analysis tasks on real-world datasets:

- [Exploratory analysis](https://probcomp-1.csail.mit.edu/20170720-darpa/gapminder-exploratory.html)
  on Gapminder, a dataset of global macroeconomic indicators of education,
  poverty, environment and health.

- [Predictive analysis](https://probcomp-1.csail.mit.edu/20170720-darpa/satellites-predictive.html)
  on a table of Earth satellites from the Union of Concerned Scientists.

## Magics Usage

The `magics.py` contains cell magics which allow for interactive probabilistic
programming in a Jupyter notebook.

In the first cell of a Jupyter notebook, load the extension.
```
%load_ext iventure.magics
```

#### Open a bdb file
```
%bayesdb foo.bdb
```

#### Write MML programs
```
%mml CREATE POPULATION ...
```
or, for multi-line schemas.
```
%%mml
DROP POPULATION xyz;
CREATE POPULATION xyz for t (...);
```

#### Write BQL programs
```
%bql ESTIMATE MUTUAL INFORMATION OF x WITH y WITHIN xyz;
```
or, for multi-line queries
```
%%bql
CREATE TEMP TABLE depprobs AS
    ESTIMATE DEPENDENCE PROBABILITY FROM PARIWSE VARIABLES OF xyz;
.plot SELECT * FROM depprobs
```

#### Use dot commands for BQL shorthands
```
%bql .nullify satellites_t NaN
%bql .population satellites_p
```

#### Use dot commands with BQL for plotting
```
%bql .scatter SELECT apogee_km, perigee_km FROM satellites_t LIMIT 100;
```

repository: probcomp/iventure

repo_name: probcomp/iventure


text:
---
title: Week 4
weight: 30
disableToc: true
---

## Date: 02/15/2021

## What we will cover

In this class we will talk about Randomized Controlled Trials and the power of randomization. We will discuss why this approach is often considered the gold standard of causal inference, but also look at its limitations.

{{% notice warning %}}
Class was suspended due to winter storm. You can find the videos for this class after the Code section on this page.
{{% /notice %}}

{{% notice tip %}}
Review the code that is posted with this class, and try to answer the questions there!
{{% /notice %}}

## Recommended readings/videos

- Angrist & Pischke. (2015). "Mastering Metrics". *Chapter 1: Randomized Trials*. Pg. 12-33.

- Marginal Revolution University. (2020). "Randomized Trials: The Ideal Weapon". *Video materials from Mastering Metrics*.

{{< youtube src="https://www.youtube.com/embed/eGRd8jBdNYg?controls=0" >}}

- Deaton, A. (2020). "The Problem with Randomized Controlled Trials". *CEPR & VideoVox*.

{{< youtube src="https://www.youtube.com/embed/UB1A62u9fBE?controls=0" >}}

- Athey, S. (2013). "The Dangers of Becoming Too Data-Driven". *Stanford Graduate School of Business*

{{< youtube src="https://www.youtube.com/embed/8XyRVcJz7RY?controls=0" >}}

## JITT

Complete before **Sunday Feb 14th (11:59 pm)**. You can find the JITT assignment [here](https://forms.gle/1SgszNv9Ny3HLFQq6).

## Slides

{{% button href="https://sta235sp2021.netlify.app/Classes/Week4/1_RCT/sp2021_sta235_6_RCT.html" icon="fas fa-external-link-alt" icon-position="right" %}}New window{{% /button %}} {{% button href="https://sta235sp2021.netlify.app/Classes/Week4/1_RCT/sp2021_sta235_6_RCT.pdf" icon="fas fa-file-pdf" icon-position="right" %}}Download{{% /button %}}

{{< slides src="https://sta235sp2021.netlify.app/Classes/Week4/1_RCT/sp2021_sta235_6_RCT.html" >}}

## Code

Here is the R code we will review in class, with some additional data and questions Download

## Class Videos

### Introduction to RCTs

{{< youtube src="https://www.youtube.com/embed/zENUZp38lJw?controls=0" >}}

### RCTs in practice

{{< youtube src="https://www.youtube.com/embed/YWh8yNZCYIs?controls=0" >}}

### Assumptions in RCTs

{{< youtube src="https://www.youtube.com/embed/RFQno3v3mEs?controls=0" >}}

### Statistical power and limitations

{{< youtube src="https://www.youtube.com/embed/NfXp2qluRN0?controls=0" >}}

### A/B testing

{{< youtube src="https://www.youtube.com/embed/cOHkIZ4UKWA?controls=0" >}}


text:
Welcome to UrlShorter 👋

> ShortURL is a open source URL shortening service (a.k.a URL redirection) allowing anyone to take any existing URL and shorten it.

### ✨ Demo: https://short.u2b.eu
### Webui: https://github.com/Gaojianli/UrlShorter-web
## Config

|Name|Type|Details|
|:-|:-|:-|
|SqlConnection|string|The [connection string](https://www.connectionstrings.com/) of the database|
|origin|string|The origin of the web ui, usually is just the URL of the web. If you set this uncorrectly, you may meet CORS error.|
|homePage|string|The URL of the web, if one short url is missing, the user will be redirected here.|
|prefix|string|The prefix of each short url.|

Here're the config running on https://short.u2b.eu:
```json
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "SqlConnection": "server=localhost;port=3306;database=shortUrl;uid=shorturl;pwd=<pwd>;CharSet=utf8"
  },
  "SiteSettings": {
    "origin": "https://short.u2b.eu",
    "homePage": "https://short.u2b.eu",
    "prefix": "https://u2b.eu"
  },
  "Kestrel": {
    "EndPoints": {
      "Http": {
        "Url": "http://<IP_ADDRESS>:5000"
      }
    }
  }
}
```

## Install
### Docker(Recommended)
1. Import the `init.sql` into your Mysql/Mariadb
1.  Import the `init.sql` into your Mysql/Mariadb
1. Edit your database config in `appsettings.json`, then run:

```sh
dotnet build
```

## Usage

```sh
dotnet run
```

## Author

👤 **Gaojianli**

* Website: https://blog.gaojianli.me
* Github: [@Gaojianli](https://github.com/Gaojianli)

## Show your support

Give a ⭐ if this project helped you!

## 📝 License

Copyright © 2020 [Gaojianli](https://github.com/Gaojianli).

This project is [MIT](https://github.com/Gaojianli/UrlShorter/blob/master/LICENSE) licensed.

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FGaojianli%2FUrlShorter.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FGaojianli%2FUrlShorter?ref=badge_large)

***
_This README was generated with ❤ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

repository: andmattia/UrlShorter

repo_name: andmattia/UrlShorter


text:
# Dyndns

This is a simple demo project to show how to work with HTTP requests with NodeJS' `request` module. The app will simple get your public IP address through a public service.

## Usage

Run with `node app.js` on your terminal.

repository: fdomig/dyndns

repo_name: fdomig/dyndns


text:
# Porting EC unit tests to Ztest

[TOC]

This HOWTO shows the process for porting the EC's `base32` unit test to
Zephyr's Ztest framework. All of the work is done in `src/platform/ec`.

See [Test Framework - Zephyr Project Documentation](https://docs.zephyrproject.org/1.12.0/subsystems/test/ztest.html#quick-start-unit-testing) for details about Zephyr's Ztest framework.

See [chromium:2492527](https://crrev.com/c/2492527) for an example of
porting an EC unit test to the Ztest API.

## Determine source files being tested

Determine which C files the unit test requires by finding the test in
`test/test_config.h`:
```
#ifdef TEST_BASE32
#define CONFIG_BASE32
#endif
```
Locate the `CONFIG` item(s) in `common/build.mk`:
```
common-$(CONFIG_BASE32)+=base32.o
```
So for the `base32` test, we only need to shim `common/base32.c`.

Add the C files to `zephyr/shim/CMakeLists.txt`, in the "Shimmed modules"
section:

```
# Shimmed modules
zephyr_sources_ifdef(CONFIG_PLATFORM_EC "${PLATFORM_EC}/common/base32.c")
```

Refer to [zephyr: shim in base32.c](https://crrev.com/c/2468631).

## Create test directory

Create a new directory for the unit test in `zephyr/test/base32`.

Create `zephyr/test/base32/prj.conf` with these contents:
```
CONFIG_ZTEST=y
CONFIG_PLATFORM_EC=y
```

Create `zephyr/test/base32/CMakeLists.txt` with these contents:
```
cmake_minimum_required(VERSION 3.13.1)
project(base32)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

target_sources(app PRIVATE ${PLATFORM_EC}/test/base32.c)
```

### Modify test source code

In the unit test, wrap `run_test` in the `#else` portion of an
`#ifdef CONFIG_ZEPHYR`. Create `test_main` in the `#ifdef` portion.

Copy the contents of `run_test` into `test_main`. You will need to keep the
list of test cases in sync between the two functions.

Change `RUN_TEST` to `ztest_unit_test` and add the `ztest_test_suite` wrapper
plus the call to `ztest_run_test_suite`.

```
/*
 * Define the test cases to run. We need to do this twice, once in the format
 * that Ztest uses, and again in the format the the EC test framework uses.
 * If you add a test to one of them, make sure to add it to the other.
 */
#ifdef CONFIG_ZEPHYR
void test_main(void)
{
	ztest_test_suite(test_base32_lib,
			 ztest_unit_test(test_crc5),
			 ztest_unit_test(test_encode),
			 ztest_unit_test(test_decode));
	ztest_run_test_suite(test_base32_lib);
}
#else
void run_test(int argc, char **argv)
{
	test_reset();

	RUN_TEST(test_crc5);
	RUN_TEST(test_encode);
	RUN_TEST(test_decode);

	test_print_result();
}
#endif /* CONFIG_ZEPHYR */
```

Each function that is called by `ztest_unit_test` needs to change its
return type to `EC_TEST_RETURN`. Keep the `return EC_SUCCESS;` at the end
of the test function. If there are any `return` statements that return
something other than `EC_SUCCESS`, you should use `ztest_test_fail` inside
another `ifdef CONFIG_ZEPHYR` block.

Change the `TEST_ASSERT` macros to `zassert` macros. There are plans to
automate this process, but for now, it's a manual process involving some
intelligent find-and-replace.

* `TEST_ASSERT(n)` to `zassert_true(n, NULL)`
* `TEST_EQ(a, b, fmt)` to `zassert_equal(a, b, fmt ## ", " ## fmt, a, b)`
  * e.g. `TEST_EQ(a, b, "%d")` becomes `zassert_equal(a, b, "%d, %d", a, b)`
* `TEST_NE(a, b, fmt)` to `zassert_not_equal(a, b, fmt ## ", " ## fmt, a, b)`
* `TEST_LT(a, b, fmt)` to `zassert_true(a < b, fmt ## ", " ## fmt, a, b)`
* `TEST_LE(a, b, fmt)` to `zassert_true(a <= b, fmt ## ", " ## fmt, a, b)`
* `TEST_GT(a, b, fmt)` to `zassert_true(a > b, fmt ## ", " ## fmt, a, b)`
* `TEST_GE(a, b, fmt)` tp `zassert_true(a >= b, fmt ## ", " ## fmt, a, b)`
* `TEST_BITS_SET(a, bits)` to `zassert_true(a & (int)bits == (int)bits, "%u, %u", a & (int)bits, (int)bits)`
* `TEST_BITS_CLEARED(a, bits)` to `zassert_true(a & (int)bits == 0, "%u, 0", a & (int)bits)`
* `TEST_ASSERT_ARRAY_EQ(s, d, n)` to `zassert_mem_equal(s, d, b, NULL)`
* `TEST_CHECK(n)` to `zassert_true(n, NULL)`
* `TEST_NEAR(a, b, epsilon, fmt)` to `zassert_true(fabs(a-b) < epsilon, "%f, %f, %f", a, b, epsilon)`
  * Currently, every usage of `TEST_NEAR` involves floating point values
* `TEST_ASSERT_ABS_LESS(n, t)` to `zassert_true(abs(n) < t, "%d, %d", n, t)`
  * Currently, every usage of `TEST_ASSERT_ANS_LESS` involves signed integers.

There isn't a good replacement for `TEST_ASSERT_MEMSET(d, c, n)`, but it is
only used in two tests, `printf.c` and `utils.c`. If you need this test,
you'll need to code up a loop over the `n` bytes starting at `d`, and
`zassert_equal` that each byte is equal to `c`.

Also note that some tests use constructs like `TEST_ASSERT(var == const)`,
which would have been better write as `TEST_EQ(var, const)`. These should be
rewritten to use `zassert_equal`.

Refer to
[test: Allow EC unit test to use Ztest API](https://crrev.com/c/2492527) for
the changes to the base32.c source code.

## Build and run

Use `cmake` and `ninja` to build the test:
```
(cr) $ export ZEPHYR_BASE=/mnt/host/source/src/third_party/zephyr/main/v2.4
(cr) $ cd /mnt/host/source/src/platform/ec
(cr) $ cmake -S zephyr/test/base32 -B build/base32 \
 -D ZEPHYR_MODULES=/mnt/host/source/src/platform/ec \
 -D ZEPHYR_TOOLCHAIN_VARIANT=host -D BOARD=native_posix -G Ninja
(cr) $ ninja -C build/base32
(cr) $ build/base32/zephyr/zephyr.exe
UART_0 connected to pseudotty: /dev/pts/1
*** Booting Zephyr OS build zephyr-v2.4.0-1-g63b2330a85cd  ***
Running test suite test_base32_lib
===================================================================
START - test_crc5
 PASS - test_crc5
===================================================================
START - test_encode
 PASS - test_encode
===================================================================
START - test_decode
 PASS - test_decode
===================================================================
Test suite test_base32_lib succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL
(cr) $
```

repository: woainimamababanainai/ec

repo_name: woainimamababanainai/ec


text:
*This is WIP.*

| Service | OCaml | Service |
| ------- | ----- | ------- |
| Circle  | 4.06  |[![Build Status](https://circleci.com/gh/phink/changeset/tree/develop.svg?style=svg)](https://circleci.com/gh/phink/changeset/tree/develop) |

# Changeset

**Data validation with first-class and first-order labels in OCaml.**

Homepage for the library is
[available here](https://phink.github.io/changeset/changeset_lib/index.html).

Changesets are tools to validate data while accumulating errors along the way.
They are composed of:

- **Changes**: an heterogeneous map whose keys are of type `'a label` and
values `'a`.
When deriving a changeset from a record type definition, the labels
correspond to the fields of this one.

- **Errors**: a list of strings associated with labels.

Labels are first-class, that means you can give them as argument to functions,
and first-order, so you can pattern match against them. The library
promotes the pipeline design approach.

There is a ppx deriving plugin so there is no need to write any
boilerplate code.

#### Install using opam
```
$ opam pin add changeset_lib https://github.com/phink/changeset.git
$ opam pin add ppx_changeset https://github.com/phink/changeset.git
```

#### Update the libraries and preprocess section in your jbuild file:

```
(libraries (... changeset))
(preprocess (pps (... ppx_changeset)))
```

### Minimal example

```ocaml
type t = {
  age: int;
  phone: string;
  password: string;
} [@@deriving changeset]

let validate cset =
  cset
  |> Changeset.validate_int Age [`greater_than_or_equal_to 0]
  |> Changeset.validate_string_length Password [`min 12]
  |> Changeset.validate_format Phone (Str.regexp "^\\+?[1-9][0-9]+$")

let create t =
  let cset = Changeset.from_record t in
  Changeset.apply (validate cset)

let data = {age = 12; password = "dolphin"; phone = "+14155552671"}

let () = match create data with
  | Ok t -> (* do what you want *)
  | Error cset ->
    Stdio.prerr_endline (Changeset.show_errors cset)
```

Execution

```json
{
  "errors":{
    "password":"should be at least 12 character(s)"
  }
}
```

### Limitations

Parameterized source types are not yet supported.

repository: phink/changeset

branch_name: refs/heads/develop

repo_name: phink/changeset


text:
# Progress Tracker Application
Courses progress tracker application

## Installation
To install all the application dependencies you must run

`npm install`

## Execution
To execute the application you have two pre-defined scripts:

`npm run server`, which will execute the Sails server.

`npm run ui`, which will execute the UI builder.

Have in mind you must have running the server in order to serve the bundled UI.

## Builder

### Tasks
Here is a full list of all static tasks we have:

- `browser-sync`, used to.
- `clean`, used to clean the `dist` folder containing all the bundled UI sources.
- `default`, also called with `gulp`, used to bundle the UI.
- `font-build`, used to bundle our fonts.
- `help`, used to list all available gulp tasks.
- `icons-build`, used to bundle our icons.
- `release`, used to bundle the entire UI and after run Sails server when deployed to the web host.
- `server`, used to execute Sails server.

Here is a list of dynamic tasks that might depend on the builder configuration:

- `[applicationId]-build`, used to trigger the application build.
- `[applicationId]-html-build`, used to trigger the application HTML build. Mainly copies the `index.html` into `dist` folder.
- `[applicationId]-html-watch`, starts watcher over `index.html` file.
- `[applicationId]-js-build`, used to trigger the application JS build.
- `[applicationId]-scss-build`, used to trigger the application SCSS build. Builds over required js files.
- `[applicationId]-scss-watch`, starts watcher over bundled scss files.

## Development process

### Branches
All branches must comply with the branches name pattern. They must have the following pattern

`I-(Issue number)_(branch desired name)`

As example a possible name for issue number 23

`I-23_some-feature-development`

### Commits
All commit messages must contain the prefix of the branch into its title, as also a little description of the work done.

### Documentation
All feature that is development and intended to be merged should have the related documentation in order to allow other
developers understand the purpose of the feature added.

### Code Review
All features that want to be merged to our code base should pass a code review process. The branch must be reflected
into a pull request. The repository has a hook to only allow pull requests with at least one approval to be merged.

All comments into the pull request must be addressed before merging the code. The features that are merged without all
comments addressed could be reverted.

### Unit testing
TBD

### Continuous integration
TBD

repository: globant-ui-rosario/progress-tracker

repo_name: globant-ui-rosario/progress-tracker


text:
# relude-fetch

[![GitHub CI](https://img.shields.io/github/workflow/status/reazen/relude-fetch/CI/master)](https://github.com/reazen/relude-fetch/actions)
[![npm](https://img.shields.io/npm/v/relude-fetch.svg)](https://www.npmjs.com/package/relude-fetch)

## Overview

[Relude](https://github.com/reazen/relude) interop library for the Browser
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
This can also be used in Node.js using a polyfill like
[isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch).

This library basically wraps the
[bs-fetch](https://github.com/reasonml-community/bs-fetch) Bucklescript library
to lift any publicly-exposed `Js.Promise.t('a)` values into `Relude.IO.t('a,
Js.Promise.error)` values.  Using `IO` rather than `Promise` makes error
handling 100% more explicit, allows for better composability with other
effect and error types, and unlocks the full power of monads!

## Examples

See the [tests](https://github.com/reazen/relude-fetch/blob/master/__tests__/ReludeFetch_test.re) for example usage.

Also see the [demo](https://github.com/reazen/relude-fetch/blob/master/examples/demo) for real-world usage, such as file uploads.

## Developer info

### Installation

Dependencies of this library are listed as `peerDepenencies` to avoid issues with multiple version
errors with npm's installation methodology combined with BuckleScript.

```
> npm install --save bs-bastet relude bs-fetch relude-fetch

# Add bs-bastet, relude, bs-fetch, and relude-fetch to your bsconfig.json
```

### Scripts

```
# Normal development scripts
> npm run clean
> npm run build
> npm run cleanbuild
> npm run test
> npm run cleantest
> npm run watch

# Run the demo project via parcel
> npm run demo
```

### Publishing to npm

```
> npm version major|minor|patch
> git push origin --follow-tags
> git push upstream --follow-tags
> npm publish
```

### NixOS

```
> nix-shell
%nix%> npm install
```

gha_language: Reason


text:
### Platform Support

The following shows module APIs available for each platform.

|  | Linux
(Ubuntu) | Raspbian
(Raspberry Pi) | NuttX
(STM32F4-Discovery) | TizenRT
(Artik053) |
| :---: | :---: | :---: | :---: | :---: |
| require | O | O | O | - |

# Module
The `require` function is always available there is no need to import `module` explicitly.

### require(id)
* `id` {string} Module name to be loaded.

Loads the module named `id`.

**Example**

```js
var assert = require('assert');

assert.equal(2, 2);
```

**Loading a module**

If a native module named `id` exists, load it and return.
(_Native module:_ which module came from the IoT.js itself)

`require` function searches for modules in the following order:

1. Current working directory.
2. `iotjs_modules` folder under current working directory.
3. `$HOME/iotjs_modules`
4. `$IOTJS_PATH/iotjs_modules`

For each directory in search paths above:

- If a file `id` exists, load it and return.
- If a file `id.js` exists, load it and retun.
- If a directory `id` exists, module system consider the directory as a package:
  - If `id/package.json` contains **main** property, load the file named **main** property.
  - If `id/package.json` exists, but neither the **main** property nor the file named **main** property exist, load `index.js`.

repository: Samsung/TizenRT

gha_language: C

repo_name: Samsung/TizenRT


text:
### Running
```bash
$ lavaory --help
Usage: lavatory [OPTIONS] COMMAND [ARGS]...

  Lavatory is a tool for managing Artifactory Retention Policies.

Options:
  -v, --verbose  Increases logging level.
  --help         Show this message and exit.

Commands:
  purge  Deletes artifacts based on retention policies.
  stats    Get statistics of a repo.
  version  Print version information.
```

### Purging Artifacts
```bash
$ lavatory purge --policies-path=/path/to/policies

To get help

$ lavatory purge --help
Usage: lavatory purge [OPTIONS]

  Deletes artifacts based on retention policies.

Options:
  --policies-path TEXT            Path to extra policies directory.
  --dryrun / --nodryrun           Dryrun does not delete any artifacts.
                                  [default: True]
  --default / --no-default        Applies default retention policy.  [default:
                                  True]
  --repo TEXT                     Name of specific repository to run against.
                                  Can use --repo multiple times. If not
                                  provided, uses all repos.
  --repo-type [local|virtual|cache|any]
                                  The types of repositories to search for.
                                  [default: local]
  --help                          Show this message and exit.
```
If you want to run Lavatory against a specific repository, you can use `--repo <repo_name>`. You can specify `--repo` as multiple times to run against multiple repos. If `--repo` is not provided, Lavatory will run against all repos in Artifactory.

repository: tonylixu/artifactory

gha_language: Shell

repo_name: tonylixu/artifactory


text:
# Klaxon: JSON for Kotlin

Klaxon is a lightweight library to parse JSON in Kotlin.

## Install

```
repositories {
    jcenter()
}

dependencies {
    compile 'com.beust:klaxon:0.14'
}
```

## API

Values parsed from a valid JSON file can be of the following type:

* Int
* Long
* BigInteger
* String
* Double
* Boolean
* JsonObject
* JsonArray

`JsonObject` behaves like a `Map` while `JsonArray` behaves like a `List`. Once you have parsed a file, you should cast it to the type that you expect. For example, consider this simple file called `object.json`:

```
{
    "firstName" : "Cedric",
    "lastName" : "Beust"
}
```

Since this is a JSON object, we parse it as follows:

```
fun parse(name: String) : Any {
    val cls = javaClass<Parser>()
    val inputStream = cls.getResourceAsStream(name)!!
    return Parser().parse(inputStream)!!
}

// ...

val obj = parse("/object.json") as JsonObject
```

You can also access the JSON content as a file, or any other resource you can get an `InputStream` from.

 This allows you to easily fetch collections of fields or even sub-objects. For example, consider the following:

```
[
    {
        "name" : "John",
        "age" : 20
    },
    {
        "name" : "Amy",
        "age" : 25
    },
    {
        "name" : "Jessica",
        "age" : 38
    }
]
```

We can easily collect all the ages as follows:

```
val array = parse("/e.json") as JsonArray<JsonObject>

val ages = array.long("age")
println("Ages: ${ages}")

// Prints: Ages: JsonArray(value=[20, 25, 38])
```

Since a `JsonArray` behaves like a `List`, we can apply closures on them, such as `filter`:

```
val oldPeople = array.filter {
    it.long("age")!! > 30
}
println("Old people: ${oldPeople}")

// Prints: Old people: [JsonObject(map={age=38, name=Jessica})]
```

Let's look at a more complex example:

```
[
    {
        "first": "Dale",
        "last": "Cooper",
        "schoolResults" : {
            "scores": [
                { "name": "math", "grade" : 90 },
                { "name": "physics", "grade" : 50 },
                { "name": "history", "grade" : 85 }
            ],
            "location" : "Berkeley"
        }
    },
    {
        "first": "Kara",
        "last": "Thrace",
        "schoolResults" : {
            "scores": [
                { "name": "math", "grade" : 75 },
                { "name": "physics", "grade" : 90 },
                { "name": "history", "grade" : 55 }
            ],
            "location" : "Stanford"
        }
    },
    {
        "first": "Jack",
        "last": "Harkness",
        "schoolResults" : {
            "scores": [
                { "name": "math", "grade" : 40 },
                { "name": "physics", "grade" : 82 },
                { "name": "history", "grade" : 60 }
            ],
            "location" : "Berkeley"
        }
    }
]
```

Let's chain a few operations, for example, finding the last names of all the people who studied in Berkeley:

```
println("=== Everyone who studied in Berkeley:")
val berkeley = array.filter {
    it.obj("schoolResults")?.string("location") == "Berkeley"
}.map {
    it.string("last")
}
println("${berkeley}")

// Prints:
// === Everyone who studied in Berkeley:
// [Cooper, Harkness]
```

All the grades over 75:

```
println("=== All grades bigger than 75")
val result = array.flatMap {
    it.obj("schoolResults")
            ?.array(JsonObject(), "scores")?.filter {
                it.long("grade")!! > 75
            }!!
}
println("Result: ${result}")

// Prints:
// === All grades bigger than 75
// Result: [JsonObject(map={name=math, grade=90}), JsonObject(map={name=history, grade=85}), JsonObject(map={name=physics, grade=90}), JsonObject(map={name=physics, grade=82})]

```

Note the use of `flatMap` which transforms an initial result of a list of lists into a single list. If you use `map`, you will get a list of three lists:

```
// Using map instead of flatMap
// Prints:
// Result: [[JsonObject(map={name=math, grade=90}), JsonObject(map={name=history, grade=85})], [JsonObject(map={name=physics, grade=90})], [JsonObject(    map={name=physics, grade=82})]]
```

## Pretty printing

You can convert any `JsonObject` to a valid JSON string by calling `toJsonString()` on it. If you want to get pretty-printed
version then you can call toJsonString(true)

## Advanced DSL

Creating a JSON object with the Klaxon DSL makes it possible to insert arbitrary pieces of Kotlin code anywhere you want. For example, the following creates an object that maps each number from 1 to 3 with its string key:

```
val logic = json {
    array(arrayListOf(1,2,3).map {
        obj(it.toString(), it)
    })
}
println("Result: ${logic.toJsonString()}")
```

will output:

```
Result: [ { "1" : 1 }, { "2" : 2 }, { "3" : 3 }  ]
```

## Flattening and path lookup

If we have the following JSON
```json
{
	"users" : [
	    {
	        "email"<EMAIL_ADDRESS>	    },
	    {
	    	"email"<EMAIL_ADDRESS>	    }
	]
}
```

We can find all emails by

```kotlin
parse('my.json').lookup("users.email")
```

## Implementation

The Parser is implemented as a mutable state machine supported by a simplistic `State` monad, making the main loop very simple:

```
val sm = StateMachine()
val lexer = Lexer(inputStream)
var world = World(Status.INIT)
do {
    val token = lexer.nextToken()
    world = sm.next(world, token)
} while (token.tokenType != Type.EOF)
```

## Limitations

* Currently reads the entire JSON content in memory. Streaming will be available soon for large files.
* Error handling is very primitive

gha_language: Kotlin


text:
ApiBird
=======

Basic utility lib to create api that consumes and produces different content-types using Phalcon PHP Framework

Now Working
------

* Set Extension Handler
* Consumes by Content-Type Header
* Produces by Accept Header
* Input and output is array

Roadmap
------

* Return JSend error responses
* Work with Route example $app->get('/',function(){})->consumes(['json'])->produces(['json']);
* Possibility of work with objects

repository: chameleonbr/apibird

repo_name: chameleonbr/apibird


text:
# facial-recognition-nn
Neural Network Facial Recognition

The project is set up with a Spring Boot back-end and an Angular 4 (via Angular CLI) front-end using the strategy from here: http://javasampleapproach.com/java-integration/integrate-angular-4-springboot-web-app-springtoolsuite

repository: thomas-kendall/facial-recognition-nn

repo_name: thomas-kendall/facial-recognition-nn


text:
# Developer guide

This is the front-end of the Photo Asset Manager (PAM) cross-service example. You can
run this in isolation, but it is meant to be deployed using the companion [AWS CDK script](../cdk/README.md).

## PAM Usage

When you build PAM, the CDK outputs the URL for the frontend. You can use this URL to access the frontend.

You will also receive two emails when you build the app. One email contains a temporary password, and the other will contains a link to confirm a subscription to an SNS topic. You must confirm the subscription to receive the link to the zipped files.

### Sign in

1. Click the sign in button in the top right corner.

2. Enter the email you provided when building PAM and the temporary password you received.

3. Upload a photo.

4. Click the refresh button until you see labels appear.
5. Select one or more labels and click on "download".

6. After a few minutes you'll receive another email with a link to download the zipped files. The link is broken up by some whitespace. SNS does this with long strings. Trim the whitespace and paste the link into your browser.

## Prerequisites

1. Install the latest Node.js LTS.
1. Install git.

## Get started

1. Copy and paste the `elros` directory to your workspace.
1. Rename your directory.
1. Initialize a new `git` repository with `git init`.

## Run

1. Run `npm i` from the same directory as this readme.
1. Run `npm run dev`.

## Build

1. Run `npm run build`.

repository: awsdocs/aws-doc-sdk-examples

gha_language: Java

repo_name: awsdocs/aws-doc-sdk-examples


text:
# VideoCropping
A simple video cropping script using openCV.

### Controls
- Click and drag to crop a region
- Press `e` to advance frame
- Press `q` to quit
- Press `u` to undo last cropped region
- Press `r` to reset cropped regions in current frame

### Example Use
```python
$ pip install -e .
$ video-crop-roi Umaru_ed.mkv
```

![use case](https://i.imgur.com/eVX4cjJ.jpg)

Results in:

![result1](https://i.imgur.com/e9QiEn0.png)
![result2](https://i.imgur.com/HuvW6eZ.png)

repository: HowDoIUseThis/VideoCropping

repo_name: HowDoIUseThis/VideoCropping


text:
---
path: "/build-web-scrapping-app-with-node-js-and-react-js"
date: "2018-11-17"
title: "Build web scrapping app with Node.js and React.js"
author: "Szymon Radosz"
tags:
  [
    { key: "javascript", value: "Javascript", identifier: 0 },
    { key: "react", value: "React.js", identifier: 1 },
    { key: "node", value: "Node.js", identifier: 2 },
  ]
postDir: "2018-11-17-build-web-scrapping-app-with-node-js-and-react-js"
image: ./PostImg1.jpg
---

Today I decided to make a tutorial about web scraping using Node.js and Cheerio.js.

We’ll scrap some website with flyies offers, save that in MySQL database and then using React we display results which we got from our db.

Firstly, I show you what the result of that tutorial looks like:

There are current offers with data scraped from website below. This app allows you to display interesting offers from the landing page of the page we’ve scrapped and when you find something interesting deals you can go to the provider page for all details. There’s the form of advertisement for a provider website. We don’t use that data for bad purposes to be clear buddy.

Provider website: https://www.fly4free.com/flights/flight-deals/usa/

Basic setup

I decided to use ready boilerplate for our app with Node.js, Express.js and React to speed up our development.

To start that tutorial you should write the post below:

https://hackernoon.com/full-stack-web-application-using-react-node-js-express-and-webpack-97dbd5b9d708

After successfully setting up our boilerplate your project structure should looks like:

src/client is where our frontend part(React) is located and src/server is where our backend(Node.js, Express.js. Cheerio.js) is landed.

Our Backend functionality

In src/server we need structure like that:

index.js – main Node.js file

index.js – main Node.js file

index.js – main Node.js file

DB setup

You have to create a database called flyscrapper in your phpmyadmin. If you use Windows oparating system, please install XAMPP, run Apache and MySQL and visit localhost/phpmyadmin.

Scrapper functionality

server/fly4freeScapper.js

const requestPromise = require('request-promise');

const cheerio = require('cheerio');

const url = 'https://www.fly4free.com/flights/flight-deals/usa/';

const mysql = require('mysql');

const con = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "",
  database: "flyscrapper"
});

var checkIfTableExists = "SHOW TABLES LIKE 'fly4free'";

console.log(checkIfTableExists);

con.query(checkIfTableExists, function (err, result) {

  if (err) throw err;

  console.log(result.length);

  if(result.length == 0){
    con.query("CREATE TABLE fly4free (id int NOT NULL AUTO_INCREMENT, title VARCHAR(255), description VARCHAR(255), page_url VARCHAR(255), img_url VARCHAR(255), PRIMARY KEY (id))", function (err, result) {

      if (err) throw err;

      console.log("Table created");
    });
  }else{
    console.log('table exists');
  }
});

requestPromise(url).then(function(entireWebsiteHtml){
  const result = cheerio('.entries-sub > .entry', entireWebsiteHtml);

  const flyResults = [];

  result.map(i => {

      let title = cheerio('.entries > .entry > .entry__title', entireWebsiteHtml).eq(i).text();

      let description = cheerio('.entries > .entry > .entry__content > p > strong', entireWebsiteHtml).eq(i).text();

      let articleUrl = cheerio('.entries > .entry > .media-photo > a', entireWebsiteHtml)[i].attribs.href;

      let imageUrl = cheerio('.entries > .entry > .media-photo > a > img', entireWebsiteHtml)[i].attribs.src;

      let offertObject = {
        offertTitle: title,
        offertDescription: description,
        offertUrl: articleUrl,
        offertImageUrl: imageUrl
      };

      flyResults.push(offertObject);
  });

  flyResults.map(singleFlyResult => {

      var checkIfRecordExists = "SELECT * FROM fly4free WHERE page_url = '" + singleFlyResult.offertUrl + "' LIMIT 1";

      con.query(checkIfRecordExists, function (err, result) {

        if (err) throw err;

        console.log(result.length);

        if (result.length == 0){

          var sql = "INSERT INTO fly4free (title, description, page_url, img_url) VALUES ('" + singleFlyResult.offertTitle + "', '" + singleFlyResult.offertDescription + "', '" + singleFlyResult.offertUrl + "', '" + singleFlyResult.offertImageUrl + "')";

          con.query(sql, function (err, result) {
            if (err) throw err;
            console.log("record added");
          });
        }

        else{
          console.log("record exists");
        }
  });
});
})
.catch(function(err){
  console.log(err);
});

First, we need to declare some additional packages.

Request-promise – used for HTTP request

cheerio – used for load website content

mysql – used for operation on our db

Then we have to check if db table called ‘fly4free’ exists. If that’s false then we need to create table with fields: id(autoincrement), title, description, page_url and img_url to store our results.

Then we need to inspect fly4free website and find in an html structure container of content we are interested.

We found our data in ‘.entries-sub > .entry’. There is single offer on the website. For every offer, we need to scrap title, offer url, image source, and description.

With cheerio we get the content of that html and store that in result const. Then we map every result(every offer container) and store interesting data. We add every offer object to flyResults array.

Then when we have array of all results that’s time to store that results in our db.

For every result in the array first we check if offer doesn’t exists in our database. If that’s true, then we insert that record in our database using SQL query.

Route for return record from database

routes/offertsList.js

const express = require('express');

const router = express.Router();

const mysql = require('mysql');

const con = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "",
  database: "flyscrapper"
});

router.get('/offers', function (req, res) {
  con.query("SELECT \* FROM fly4free", function (err, result, fields) {
      if (err) throw err;
      res.send(result);
  });
})

module.exports = router;

It’s similar for scrapper code. We connect with our db and for GET request in address /offers we return all records from fly4free table.

Main Node.js to link everything

const express = require('express');

const os = require('os');

const router = express.Router();

const app = express();

const fly4free = require('./fly4freeScrapper');

app.all('/\*', function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "\*");
  res.header("Access-Control-Allow-Headers", "X-Requested-With");
  next();
});

app.use(express.static('dist'));

app.listen(8080, () => console.log('Listening on port 8080!'));

const offertsList = require('./routes/offertsList');

app.use('/', offertsList);

We require to execute fly4freeScrapper.js file with our scrapper. We need also include code to allow CORS. Without that we’ll have troubles with load data from our GET request /offers in React component. At the end of that file we add our route.

Frontend part

We got react configured in our boilerplate. We need following files/directories structure for our frontend.

Bootstrap setup

We add bootstrap to make our app not so ugly.

Add bootstrap package for our package.json

npm install --save react-bootstrap

We also need to include bootstrap in our public/index.html before our closing body tag.

link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

client/App.js

import React, { Component } from 'react';

import './app.css';

import Main from './components/Main/Main';

export default class App extends Component {
  render() {
    return (

    );
  }
}

client/components/Main/Main.js

import React, { Component } from 'react';

import MainLandingPage from './../LandingList/MainLandingPage';

class Main extends Component{
  render(){
    return(
        <MainLandingPage />
    )
  }
}
export default Main;

client/components/LandingList/MainLandingPage.js

import React, { Component } from 'react';

import OffertsList from './SubComponents/OffertsList';

class MainLandingPage extends Component{
  render(){
    return(

          <OffertsList />

    )
  }
}
export default MainLandingPage;

client/components/LandingList/SubComponents.js

import React, { Component } from 'react';

import OffertListItem from './OffertListItem';

import axios from 'axios';

class OffertsList extends Component{
  constructor(props){
    super(props);
    this.state ={
        offersList: []
    }
  }

  async componentDidMount(){
    const allOffers = await axios.get(
        `http://localhost:8080/offers`
    );
    await this.setState({offersList: allOffers.data});
  }

  render(){
    return(

          {this.state.offersList.map((offer, i) => {
            return(<OffertListItem offer={offer} key={i}/>);
          })}

    )
  }
}
export default OffertsList;

In that component we load GET request /offers content using axios and store that in our state variable – offersList. Then we map through all offersList items and send data to OffertListItem with is component displayed single offer in our app.

To install axios run in terminal:

npm install axios --save

client/components/LandingList/OffertListItem.js

import React, { Component } from 'react';

class OffertListItem extends Component{
  constructor(props){
    super(props);
  }

  render(){
    return(
        div className="row">
          a href={this.props.offer.page_url}>
            div className="col-sm-4">
              img src={this.props.offer.img_url} />
            /div>
            div className="col-sm-8">
              h1>{this.props.offer.title}/h1>
              p>{this.props.offer.description}/p>
            /div>
          /a>
        /div>
    )
  }

}
export default OffertListItem;

In that component we display data for every offer which we got as props for the previous OffertList component.

And that’s everything. Now every time you run npm run dev, our scrapper check and save data to our database and results are displayed our frontend.

repository: szymon-radosz/tech-bulb

repo_name: szymon-radosz/tech-bulb


text:
# Corona Contact Tracing

Package for evaluating Corona traces from people's mobility data.

This package aims to do the following things

- Simulate realistic movement of agents and their health status using a SIR model.
- Effectively identify contact persons based on time stamped location histories
- Identify contact persons with many secondary contact persons to prioritize them during testing.

This should serve as an early detection of super spreading events.

It uses an existing stochastic SIR simulation to generate data sets.
This simulation has full access to all health states.
These data sets are presented in a csv table, its headers are described in the repo.
The health status is only partially observed through tests.
Next pairwise distances are evaluated and multiple informations derived from this information.
The first trivial information is the contact persons of infected persons.
The second information derived is the number of secondary contact persons of contact persons.
This is valuable to know, as some of the primary contact persons might by super spreaders and thus should get prioritized testing.

These informations should be utilized to slow down the pandemic.

This package was created within the #WirVsVirus Hackathon of the German government and is Work in Progress!

Find more Information here:

[![Our 2 Minute Pitch Video](http://img.youtube.com/vi/XJfh6adtw7g/0.jpg)](https://www.youtube.com/watch?v=XJfh6adtw7g)

## Install

- set up conda env with environment.yml

## License

- tbd