text:
# Notifications

## Phase 1: Encedo login

Before Encedo HEM performs any push notification enquiry first it needs to gather unique session key (a.k.a. login first). This session key (technically curve25519 public key) is valid 24h and is required to validate enquiry from mantated HEM.

```shell
curl -X POST "https://notify.encedo.com/hello"
     -H "Content-Type: application/json"
     -d '{"eid": "jnLU9Bk2XW/J7ExvfID+xq89rIGyONQgO9bpXvCYKhs="}
```

> The above command returns JSON structured like this:

```json
{
	"emp": "i+7QJDUbmmQ2Ek2Xmgq2lXrAQvCL1BGuA1ChfgMGnU4=",
	"eat": "1513780489"
}
```

### HTTP Request
`POST https://notify.encedo.com/hello`

### POST Parameters
Parameter | Description
--------- | -----------
eid | Base64 Encedo public key

### Response
Parameter | Description
--------- | -----------
emp | Ephemeral session key (curve25519) valid 24h
eat | Expiration timestamp of this ephemeral session key

### Status codes
Code | Meaning
---------- | -------
200 | OK
400 | Bad Request -- Missing arguments.
404 | Not Found -- The specified item could not be found.

Parameters to send as POST data need to be retrieved from Encedo HEM.

This Encedo HEM endpoint provides necessery data:

```shell
curl "https://encedokey.com/api/2FA/subscriptions"
```

> The above command returns JSON structured like this:

```json
{
	"eid": "jnLU9Bk2XW/J7ExvfID+xq89rIGyONQgO9bpXvCYKhs=",
	"lbl": "John Doe (john@example.pl)",
}
```

## Phase 2: Encedo notify request

Every request from Encedo HEM that requires Mobile App action needs to be routed to them. By calling this endpoint all registered apps will get a notification about pending enquiry. If <aid> is provided only that one mobile app will get notification, otherwise all registered.

```shell
curl -X POST "https://notify.encedo.com/notify"
     -H "Content-Type: application/json"
     -d '{"emp": "i+7QJDUbmmQ2Ek2Xmgq2lXrAQvCL1BGuA1ChfgMGnU4=",
          "sig": "2ivAugFoMOyAShnurRsgIVvBWHNzuwbzB/iKJnnxmuM=",
          "data": "eyIyRkEiOn...lVTIn19",
          "eat": "1513780490"}
```

> The above command returns JSON structured like this:

```json
{
	"eventid": "xdA70t7sYLl6ZeMN71FCvJVL2K...O6jtLh7m70C"
}
```

### HTTP Request
`POST https://notify.encedo.com/notify`

### POST Parameters
Parameter | Description
--------- | -----------
emp | Ephemeral session key
data | Payload send by HEM
sig | Signature
eat | Expiration timestamp of the data
aid | (optional) Base64 encoded public key of the paired mobile app

### Response
Parameter | Description
--------- | -----------
eventid | Unique eventid generated by service (will be sent to mobile app via FCM)

### Status codes
Code | Meaning
---------- | -------
200 | OK
400 | Bad Request -- Missing arguments.
401 | Unauthorized -- Validation failed.
404 | Not Found -- The specified item could not be found.

All registered mobile app to that <eid> will received FCM push notification. Notification is generated by sending this structure:

```json
{
	"data": {
		"event": {
			"pid": "<pid>",
			"eventid": "<eventid>"
		}
	},
	"to": "<fid>",
	"time_to_live": 60
}
```

Parameter | Description
--------- | -----------
eventid | Unique eventid generated by the service
pid | Pair id (link between eid and aid established during registation process)

Parameters to send as POST data needs to be retrieved from Encedo HEM. Below is an example usecase: Unlock of storage Flash drive

Encedo HEM request looks like this"

```shell
curl -X POST "https://encedokey.com/api/storage/unlock"
     -H "Content-Type: application/json"
     -d '{"eid": "jnLU9Bk2XW/J7ExvfID+xq89rIGyONQgO9bpXvCYKhs=",
          "emp": "i+7QJDUbmmQ2Ek2Xmgq2lXrAQvCL1BGuA1ChfgMGnU4="}'
```

> The above command returns JSON structured like this:

```json
{
	"eat": "1393632408",
	"data": "eyIyRkEiOnsic2VzIjoiWENRUlUwblVuZDYxemlyUkR1ZjVkRTZrSm5BUFBTenJyUjA3a1FYb3JGci9ZRk5OIiwiYWN0IjoiUlVTIn19",
	"sig": "pYszCuBK/iUqhR9VR7ApWamHWoM3dwukWgAFkMt8O58="
}
```

> In the above command JSON object 'data' is a base64 encode JSON embedded command for Mobile App to interpret. For this example will get:

```json
{
	"2FA": {
		"ses": "XCQRU0nUnd61zirRDuf5dE6kJnAPPSzrrR07kQXorFr/YFNN",
		"act": "RUS"
	}
}
```

## Phase 3: Mobile app enquiry

Mobile app via FCM will received unique <eventid>. By calling this endpoint details can be disclosed.

```shell
curl "https://notify.encedo.com/event/98Me6Zf5i...OTYBqFmaLeHZjs/xdA70t7sYLl6ZeMN71FCvJVL2K...O6jtLh7m70C"
```

> The above command returns JSON structured like this:

```json
{
	"emp": "i+7QJDUbmmQ2Ek2Xmgq2lXrAQvCL1BGuA1ChfgMGnU4=",
	"sig": "2ivAugFoMOyAShnurRsgIVvBWHNzuwbzB/iKJnnxmuM=",
	"data": "eyIyRkEiOn...lVTIn19",
	"eat": "1513780490"
}
```

### HTTP Request
`GET https://notify.encedo.com/event/<pid>/<eventid>`

### URL Parameters
Parameter | Description
--------- | -----------
eventid | The ID retrive by FCM push notification
pid | Pair id

### Response
Parameter | Description
--------- | -----------
emp | Ephemeral session key
data | Payload send by HEM
sig | Signature
eat | Expiration timestamp of the data

### Status codes
Code | Meaning
---------- | -------
200 | OK
404 | Not Found -- The specified item could not be found.

### How to validate data <sig>?

Signature <sig> is generated by Notification Service and have to be verify by mobile app. It is used to validate <data> integrity. Generated is by following formula:

`key = ECDH( Base64Decode(aid_prv), Base64Decode(emp))`

`res = Base64Encode( HMAC(key, data) )`

If parameter <eventid> is omitted (or empty) mobile app will receive PING notification. This is usefull to simulate a.k.a. logon proccess by mobile app after launch.

```shell
curl "https://notify.encedo.com/event/98Me6Zf5i...OTYBqFmaLeHZjs"
```

> The above command returns JSON structured like this:

```json
{
	"pingid": "OyAShnurRsgIVvBWHNzuwbzB/iKJnnxmuM"
}
```

### HTTP Request
`GET https://notify.encedo.com/event/<pid>`

### URL Parameters
Parameter | Description
--------- | -----------
pid | Pair id

### Response
Parameter | Description
--------- | -----------
pingid | Random ping id that will be sent via FCM as well (to verify if FCM is working properly)

### Status codes
Code | Meaning
---------- | -------
200 | OK
404 | Not Found -- The specified item could not be found.

FCM PING notification is generated by sending this structure:

```json
{
	"data": {
		"ping": {
			"pingid": "<pid>"
		}
	},
	"to": "<fid>",
	"time_to_live": 60
}
```

Action performed by Mobile App depends on embedded data in object <data>.

### How to process <data>?

Example HEM requests to unlock storage drive looks like this:

```json
{
        "2FA": {
                "ses": "XCQRU0nUnd61zirRDuf5dE6kJnAPPSzrrR07kQXorFr/YFNN",
                "act": "USA+"
        }
}
```

Object <act> contain action to perform. Object <ses> is unique session id.

Possible <act> objects (and possible reply):
"RUS" - (Request Storage Unlock) is a request to unlock storage. Possible reply: "USA" (YES, read-only), "USA+" (Yes, writable) or "USD" (NO).

Mobile app based on user chosen replace object <act> by appropriate reply (e.g. "RUS" -> "USA" if user chosed "Yes, read-only). Encdode structre back to base64 and digitally sign (procedure described above).

## Phase 4: Mobile app confirmation

Based on <data> if reply data needs to be returned do HEM, this endpoint can be used. This phase is optional.

```shell
curl -X POST "https://notify.encedo.com/event/98Me6Zf5i...OTYBqFmaLeHZjs/xdA70t7sYLl6ZeMN71FCvJVL2K...O6jtLh7m70C"
     -H "Content-Type: application/json"
     -d '{"sig": "TDP+tvqJIaXYEGoJzETuLIIxAE8O9iv+KbfL0RAkAiE=",
          "data": "eyIyRkEiOnsic2VzIjoid3lNUl...rIn19"}'
```

> The above command returns JSON structured like this:

```json
{
	"status": "posted"
}
```

### HTTP Request
`POST https://notify.encedo.com/event/<pid>/<eventid>`

### URL Parameters
Parameter | Description
--------- | -----------
eventid | The ID retrived by FCM push notification
pid | Pair id

### POST Parameters
Parameter | Description
--------- | -----------
data | Data sent by mobile app to HEM
sig | Signature of the data

### Response
Parameter | Description
--------- | -----------
status | Status of the enquiry

### Status codes
Code | Meaning
---------- | -------
200 | OK
400 | Bad Request -- Missing arguments.
404 | Not Found -- The specified item could not be found.
410 | Gone -- event already handled

### How to generate response <sig>?

Signature <sig> is generated by mobile app and verified by HEM. It is used to validate return <data>. It is generated by the following formula:

`key = ECDH( Base64Decode(aid_prv), Base64Decode(eid))`

`res = Base64Encode( HMAC(key, data) )`

Required <eid> is stored in mobile app available via mapping <pid>. Mobile App after verifying <sig> can begin processing request. Object  <data> after base64 decoding returns embedded JSON structure encoding request type.

## Phase 5: Encedo notify reply gathering

Data returned by mobile app can be gathered by calling this endpoint and reroutig to HEM. This phase is optional.

```shell
curl "https://notify.encedo.com/notify/xdA70t7sYLl6ZeMN71FCvJVL2K...O6jtLh7m70C"
```

> The above command returns JSON structured like this:

```json
{
	"eid": "jnLU9Bk2XW/J7ExvfID+xq89rIGyONQgO9bpXvCYKhs=",
	"aid": "n3StbWfb2YVVFmcDxzGek1RBXE9JS5eZVDVoRc77TFQ=",
	"sig": "uQnEanxiUyNvx6F9eM5gBnG43G8p77bqm\/ANnftDgxI=",
	"data": "eyIyRkEiOn...VU0ErIn19"
}
```

### HTTP Request
`GET https://notify.encedo.com/notify/<eventid>`

### URL Parameters
Parameter | Description
--------- | -----------
eventid | The ID retrive during enquiry of the request

### Response
Parameter | Description
--------- | -----------
eid | Base64 Encedo public key
aid | Base64 encoded Mobile App public key
data | Data sent by mobile app to HEM
sig | Signature of the data

### Status codes
Code | Meaning
---------- | -------
200 | OK
202 | Accepted
404 | Not Found -- The specified item could not be found.

Parameters to be sent as POST data need to be retrieved from Encedo HEM. Below is an example usecase: Unlock of storage Flash drive

Encedo HEM request looks like this"

```shell
curl -X POST "https://encedokey.com/api/storage/unlock"
     -H "Content-Type: application/json"
     -d '{"eid": "jnLU9Bk2XW/J7ExvfID+xq89rIGyONQgO9bpXvCYKhs=",
          "aid": "n3StbWfb2YVVFmcDxzGek1RBXE9JS5eZVDVoRc77TFQ=",
          "data": "eyIyRkEiOnsic2VzIjoid3lNUlV4ZytiYjUxMDhPclBkMGVcL204K3BcLzJBZURCbWFrZlB5blUyMjU5T0ppUzciLCJhY3QiOiJVU0ErIn19",
          "sig": "uQnEanxiUyNvx6F9eM5gBnG43G8p77bqm\/ANnftDgxI="}'
```

> In the above command JSON object 'data' is a base64 encode JSON embedded command for Mobile App to interpret. For this example will get:

```json
{
	"2FA": {
		"ses": "wyMRUxg+bb5108OrPd0e\/m8+p\/2AeDBmakfPynU2259OJiS7",
		"act": "USA+"
	}
}
```

repository: encedo/notify-service

repo_name: encedo/notify-service


text:
# Huntsville-Craft-Beer-Wine-Trail
This project was developed as part of the Udacity Nanodegree in Frontend Development.

## Description

The objective of the project was to develop a single page application that would utilize Google Maps, the Knockoutjs framework and an additional 3rd party API. For my project, I utilized Google Maps with my API key, Foursquare with my API key, Knockoutjs. For inspiration, I drew upon the local brewery and wine bar scene in the Tennessee Valley, where it has recently exploded. The application allows the user to filter the map and list by typing in either Beer or Wine which triggers a knockout observable to filter by category. Selected markers bounce and once selected, an info window opens, providing more information such as name, address and foursquare web link. The application also resizes depending on the screen type.

## How to use
Click here to try it out: ➡ https://culer5.github.io/Huntsville-Craft-Beer-Wine-Trail/

Alternatively, you can click on the green DOWNLOAD button.
Once the zip file is downloaded to your local drive, unzip all the contents of the zipped folder. Use one of the below methods for Windows machines:
 Option 1: Select the file, then select the File command in the windows menu, then Extract All then follow the instructions.
 Option 2: right-click the folder, select Extract All, and then follow the instructions.

 Once the files are extracted, launch the index file by double-clicking. Once the file is open in your browser, click on any of the places on the map / sidebar for more information. Type in the search bar if you only want to see a few of the places listed on the map to make it easier to spot.

## Authors

Scott Dickinson
<EMAIL_ADDRESS>
## Version History

* 0.1
    * Initial Release
* 1.0
   * Updates as Required by Udacity

## License

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

## Acknowledgments

Inspiration, code snippets, etc.
* [awesome-readme](https://github.com/matiassingers/awesome-readme)
* [w3Schools] (https://www.w3schools.com/bootstrap/default.asp)
* KnockoutJS by Example by Book by Adnan Jaswal
* A Smarter Way to Learn Javascript Book by Mark Myers.
* A Smarter Way to Learn JQuery Book by Mark Myers.
* A Smarter Way to Learn HTML/CSS Book by Mark Myers.
* Learning Web Design Book by Jennifer Niederst Robbins
* Lynda.com/web development (https://www.lynda.com/)

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
chihaya
=======

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

Due to the many inconsistencies AB has with Gazelle, Chihaya is not ready for
general use. Currently the way Chihaya finds out about new and deleted data is
by polling the database server, which is highly inefficent and introduces a
race condition when data is deleted from the source
(due to `INSERT INTO x ON DUPLICATE KEY UPDATE` being used). A pub/sub
architecture is being developed now that will mitigate this.

Installing
----------

    $ go get github.com/kotoko/chihaya

Configuration
-------------

Configuration is done in `config.json`, which you'll need to create by copying
`config.json.example`. See [config/config.go](https://github.com/kotoko/chihaya/blob/master/config/config.go)
for a description of each configuration value.

Running
-------

`./chihaya` to run normally, `./chihaya -profile` to generate pprof data for analysis.

Contributing
------------

Style guide: `go fmt`.

If you want to make a smaller change, just go ahead and do it, and when you're
done send a pull request through GitHub. If there's a larger change you want to
make, it would be preferable to discuss it first via a GitHub issue or by
getting in touch on IRC.

repository: georgizk/chihaya

repo_name: georgizk/chihaya


text:
{{{
"title": "Cloud Application Manager Data Center Edition Overview",
"date": "05-24-2019",
"author": "Diego Sanjuan",
"keywords": ["cam", "cloud application manager", "Data Center edition", "appliance", "overview", "platforms"],
"sticky": true,
"attachments": [],
"contentIsHTML": false
}}}

**In this article:**

* [Overview](#overview)
* [Audience](#audience)
* [Prerequisites](#prerequisites)
* [Supported Platforms](#supported-platforms)
* [Steps](#steps)
* [Next Steps](#next-steps)
* [Contacting Cloud Application Manager Support](#contacting-cloud-application-manager-support)

### Overview

This article explains how to run Cloud Application Manager on-premise as a virtual appliance in your vCenter Data Center or OpenStack cloud. After you install and [set up Cloud Application Manager Data Center Edition](camdce-initialsetup.md) for use, you’re ready to automate deployments to any cloud and platform.

**Try the Appliance for Free**
The appliance is available as a free download.

**Download the Cloud Application Manager Virtual Appliance**
Request a download link from [support](mailto:incident@CenturyLink.com).

Experience all the same functionality as SaaS version, except for advanced features like managed services anyware or cloud optimization, and use Cloud Application Manager Data Center Edition to deploy to private clouds.

### Audience

All Cloud Application Manager Data Center Edition users who wants to deploy/install Cloud Application Manager Data Center Edition (appliance).

### Prerequisites

* You should have a Data Center or AWS account to be able to deploy appliance in your preffered platform.

### Supported Platforms

Appliance is supported when deployed on these platforms:
* [Installing Cloud Application Manager Data Center Edition in vCenter](camdce-vsphere.md)
* [Installing Cloud Application Manager Data Center Edition in Openstack](camdce-openstack.md)
* [Installing Cloud Application Manager Data Center Edition in AWS](camdce-with-aws-master-account.md)

### Next Steps

* [Setting Up Cloud Application Manager Data Center Edition](camdce-initialsetup.md)
* [Configuring Network Settings of Cloud Application Manager Data Center Edition](camdce-networking.md)
* [Upgrading Cloud Application Manager Data Center Edition](camdce-upgrading.md)
* [Cloud Application Manager Data Center Edition Migration](camdce-migration.md)

### Contacting Cloud Application Manager Support

We’re sorry you’re having an issue in [Cloud Application Manager](https://www.ctl.io/cloud-application-manager/). Please review the [troubleshooting tips](../Troubleshooting/troubleshooting-tips.md), or contact [Cloud Application Manager<EMAIL_ADDRESS>with details and screenshots where possible.

For issues related to API calls, send the request body along with details related to the issue.

In the case of a box error, share the box in the workspace that your organization and Cloud Application Manager can access and attach the logs.
* Linux: SSH and locate the log at /var/log/elasticbox/elasticbox-agent.log
* Windows: RDP into the instance to locate the log at C:\ProgramData\ElasticBox\Logs\elasticbox-agent.log

url: https://raw.githubusercontent.com/jgerger/PublicKB/dd536c62eceb5dade07201ba173760f1b4f269c6/Cloud Application Manager/Data Center Edition/camdce-overview.md

repository: jgerger/PublicKB

gha_language: Shell

gha_license_id: NOASSERTION

repo_name: jgerger/PublicKB


text:
---
title: Render Children Markup from in Parent Components in React
author: DavidWells
date: 2016-04-09 09:25:13
layout: post
category: dev
tags:
  - react
  - frontend
---

A couple weeks ago I saw [Michael Jackson](https://twitter.com/mjackson) present his new library [http-client](https://github.com/mjackson/http-client) at the ReactJS meetup in SF.

During his live demo, He showed an interesting component rendering pattern where the parent is handling the markup for the child component.

The child component manages it's state and passes that back up to the parent via the `this.props.children` as a function call.

# whatchu talkin bout willis? Watch this

https://www.youtube.com/watch?v=sVHYWZoQ6g8

This pattern comes with pros and cons.

**Pro:** You can easily see exactly what markup your parent component will render.

**Con:** It couples children and parent together.

Is it good or bad? You decide!

I wanted to share because it's definitely an interesting idea and I love seeing experimentation happening in the React community.

```js
// ParentComponent handles the markup rendering of Child via this.props.children
class ParentComponent extends React.Component {
  render () {
    return (
      <div>
        <h1>Render child markup w/ state in parent</h1>
        <Child start={Date.now()}>
          {(elapsed) => {
            <h1>{elapsed}</h1>
          }}
        </Child>
      </div>
    )
  }
}

// Child 'renders' this.props.children as a function call
class Child extends React.Component {
  constructor (props, context) {
    super(props, context)
    this.state = { elapsed: 0 }
    this.tick = this.tick.bind(this)
  }
  componentDidMount () {
    this.timer = setInterval(this.tick, 1000)
  }
  tick () {
    this.setState({
      elapsed: new Date() - this.props.start
    })
  }
  render () {
    const time = Math.round(this.state.elapsed / 1000)
    // use children as a function call
    return this.props.children(time)
  }
}
```

# Live Demo

See the Pen Render Children State from Parent Component by DavidWells (@DavidWells) on CodePen.

gha_language: JavaScript

gha_license_id: MIT


text:
# Introduction

In this repository, I collect some (embarrassingly simplistic) tools I use to make my [OCR4all](https://github.com/OCR4all) workflow a bit more efficient.

# PageXML Editor

Jupyter notebook to speed up targeted GT generation. Selects lines that match a certain regex pattern for correction/transcription.

# Best practices

Some regex that have proved useful for my (early modern, Latin) use cases:

* `(fſ|ſf)`
* `[qQ][^u]`
* `(.)\1{3,}`

# Tesseract on PageXML

`tess_page` contains a simple function that applies Tesseract ([`pytesseract`](https://pypi.org/project/pytesseract/)) to PageXML files. Requires a functioning `pytesseract` configuration and `PIL`.

`tess_pagexml` takes the OCR4all project directory (containing the `processing` subfolder with binarized png files and pagexml) as an argument and substitutes existing OCR with tesseract OCR or writes new OCR if there is none.

The original pagexml is stored as a backup in a directory `old_processing`.

The function `mask` could be useful as well: It takes a list of vertices and optionally a named argument (`img` = "string") and returns a line snippet. As a default, it expects that the `img` variable has already been defined.

## Cyrillic

The `cyrillic` model was trained on 64k lines of synthetically created GT, using about 8 different fonts. Its performance on historical prints is still very poor, but maybe it can serve as a point of departure.

# Requirements

Installing calamari 1.0.5 that is compatible with CR4all can be a bit confusing. `requirements.txt` contains the configuration that works in a Python 3.7 environment.

Installation of calamari 1.0.5 works as follows (thanks for [hints and instructions](https://github.com/Calamari-OCR/calamari/issues/246) to the developers!):

## Prepare virtual environment

```bash

mkdir ~/path/to/virutalenv

python3.7 -m venv ~/path/to/virtualenv

source ~/path/to/virtualenv/bin/activate

pip install<EMAIL_ADDRESS>
pip install tensorflow==2.1
```

Another way to install everything necessary: Download the requirements.txt file and do:

```bash

pip install -r requirements.txt

```

# Training models

To train a model that is compatible with OCR4all:

First, make sure you have a folder for temporary files and for your best models:

```bash

mkdir tmp
mkdir best_models

```

Then run

```bash

calamari-cross-fold-train --files path/to/project/processing/*.bin.png path/to/other_project/processing/*.bin.png --dataset PAGEXML --best_models_dir best_models --display 100 --batch_size 5 --temporary_dir tmp --text_regularization spaces --n_augmentation 5

```

If you want to train an already existing model, just add at the end

```
--weights path/to/model/your_model.ckpt.h5
```

branch_name: refs/heads/main


text:
---
layout: default
title: 牛津
---
# 牛津词典

<!-- The [Oxford  Dictionary](http://www.oxforddictionaries.com) is an online service with high-quality pronunciations of most  common English words. -->

[牛津词典](http://www.oxforddictionaries.com)是一个在线生成英语单词发音的网站。

<!-- Please note that this service generally supports single words only and  **cannot be used to speak arbitrary sentences or phrases**.  Because of this, you may want to use Oxford as [part  of a **in-order** service group](/usage/groups.html) so that you can fallback to  [another service](/services) when the Oxford  Dictionary does not have audio for your input. -->

请注意牛津词典只支持单个单词发音，**所以不要用它来试图获取句子的发音**。如果你想获取句子的发音请参考[其他语音服务](/services.html) :point_right:

<!-- ## Requirements -->

## 要求

<!-- An Internet connection is required to use Oxford from AwesomeTTS, but no  special software needs to be installed and it can be used from any operating  system. -->

只需要有网就行啦:clap:不需要安装其他软件。

<!-- Because Oxford is a public Internet service, mass generation of MP3s using  the [tool in the Card Browser](/usage/browser.html) is rate-limited.  In addition, the Oxford Dictionary is rate-limited by **twice the  amount** of other Internet-based services because Oxford requires two  requests for every word searched. If you would like to tweak this behavior  for your installation of AwesomeTTS, go to the [MP3s  configuration tab](/config/mp3s.html) and look for the “Download Throttling”  settings. -->

因为牛津词典是一个公共网络服务，[在浏览器中用AwesomeTTS工具](/usage/browser.html)批量生成音频有频率限制，如果你想改变这个限制请移步[音频配置标签](/config/mp3s.html)，然后你会看到“下载限制”这个设置。

repository: ecator/anki-awesome-web-zh

repo_name: ecator/anki-awesome-web-zh


text:
# Crowd Sentiment Moving Average

## Crowd Sentiment Moving Average

```shell
curl -u "sk_live_w3Q4bCJVB8xgyeIKJmTC4DS5:" "https://open.marketprophit.com/real-time/crowd-sentiment-moving-average?ticker=AAPL"
```

> Returns response headers such as:

```bash
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json; charset=utf-8
Content-Length: 886
ETag: W/"376-2319470232"
set-cookie: igloo=s%3A1TGFMRI-veVh8EH8SAmUumjSzzbsUTH9.Kxrk1iAfh6gKw3W1S2phFxXLv9BWJ%2BcCWC1zPjs9MoU; Path=/; Expires=Wed, 13 Aug 2014 21:37:30 GMT; HttpOnly
X-Response-Time: 114.22398ms
Date: Tue, 12 Aug 2014 21:37:30 GMT
Connection: keep-alive

```

> Returns response such as (limited `results` for brevity):

```json
[
  {
    "ts": "2014-08-12T20:38:00.000Z",
    "ticker": "AAPL",
    "moving_average": "-0.0207969133106709"
  },
  {
    "ts": "2014-08-12T20:40:00.000Z",
    "ticker": "AAPL",
    "moving_average": "-0.0065589103823894"
  },
  {
    "ts": "2014-08-12T20:42:00.000Z",
    "ticker": "AAPL",
    "moving_average": "-0.0203041829188076"
  }
]
```

Realtime moving average intraday data

### HTTP Request

`GET https://open.marketprophit.com/real-time/crowd-sentiment-moving-average`

### Query Parameters

Parameter | Description | Required | Default
--------- | ----------- | -------- | -------
ticker | 3-4 character long alphanumeric stock ticker symbol | yes | none

## Historical Crowd Sentiment

```shell
curl -u "sk_live_w3Q4bCJVB8xgyeIKJmTC4DS5:" "https://open.marketprophit.com/historical/crowd-sentiment-moving-average?ticker=AAPL"
```

> Returns response headers such as:

```bash
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json; charset=utf-8
Content-Length: 881
ETag: W/"371-2214411452"
set-cookie: igloo=s%3AFHr5hXCWnF86Jzn5JwTpbGtp4u_tdUjl.qB6eUNwNM%2BZrjLRv0rBX1AX923rU2mTuLNSD02GiWWQ; Path=/; Expires=Wed, 13 Aug 2014 21:38:34 GMT; HttpOnly
X-Response-Time: 63746.49997ms
Date: Tue, 12 Aug 2014 21:38:30 GMT
Connection: keep-alive

```

> Returns response such as (limited `results` for brevity):

```json
[
  {
    "ts": "2013-08-11T00:02:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.3139140224709963"
  },
  {
    "ts": "2013-08-11T00:04:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.2752892821760515"
  },
  {
    "ts": "2013-08-11T00:06:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.2099071082431231"
  }
]
```

Historical moving average intraday data

### HTTP Request

`GET https://open.marketprophit.com/historical/crowd-sentiment-moving-average`

### Query Parameters

Parameter | Description | Required | Default
--------- | ----------- | -------- | -------
ticker | 3-4 character long alphanumeric stock ticker symbol | yes | none
start_ts | ISO-8601 timestamp | no | last year from previous biz day
end_ts | ISO-8601 timestamp | no | yesterday

## Daily Crowd Sentiment

```shell
curl -u "sk_live_w3Q4bCJVB8xgyeIKJmTC4DS5:" "https://open.marketprophit.com/historical/daily-crowd-sentiment-moving-average?ticker=AAPL"
```

> Returns response headers such as:

```bash
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json; charset=utf-8
Content-Length: 881
ETag: W/"371-546909383"
set-cookie: igloo=s%3A1OYT-fh0mBZxd55KLa39h37JbMLsmW94.96%2FqONIOZKznN6EwRKZ689pdTfgtS0f5ZgIQCIxamY0; Path=/; Expires=Wed, 13 Aug 2014 21:37:38 GMT; HttpOnly
X-Response-Time: 7491.25694ms
Date: Tue, 12 Aug 2014 21:37:38 GMT
Connection: keep-alive

```

> Returns response such as (limited `results` for brevity):

```json
[
  {
    "ts": "2013-11-26T05:00:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.0352639338098013"
  },
  {
    "ts": "2013-11-27T05:00:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.0393013576390539"
  },
  {
    "ts": "2013-11-29T05:00:00.000Z",
    "ticker": "AAPL",
    "moving_average": "0.0469789239912700"
  }
]
```

Daily crowd sentiment moving average historical data

### HTTP Request

`GET https://open.marketprophit.com/historical/daily-crowd-sentiment-moving-average`

### Query Parameters

Parameter | Description | Required | Default
--------- | ----------- | -------- | -------
ticker | 3-4 character long alphanumeric stock ticker symbol | yes | none
start_date | Start date range (MM-DD-YYYY) | no | last year from previous biz day
end_date | End date range (MM-DD-YYYY) | no | previous business day

repository: marketprophit/marketprophit-api

repo_name: marketprophit/marketprophit-api


text:
![TryCode logo](http://ileet.ru/public/assets/img/trycode_logo.svg)
=========
Is an open-source realtime collaborative code editor with syntax highlighting. Perfect for: remote coding interviews and learning code for friends.

The server part is developed on NodeJS and using Socket.io libraries under the hood to support websockets for realtime collaboration. The client side use AngularJS v1.4.8, [ACE](https://ace.c9.io/) and [dollardom.js](https://github.com/julienw/dollardom).

Join to [Gitter TryCode](https://gitter.im/trycode-gitter/chat) if you have any questions. [![Join the chat at https://gitter.im/trycode-gitter/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/trycode-gitter/chat)

## Demo

Try out for yourself on the demo site here in Heroku: [http://trycode.herokuapp.com/](http://trycode.herokuapp.com/)

![TryCode in Safari](https://archakov.im/uploads/trycode_window_1.png)

## Installation

Clone the repository from Github

```
$ git clone https://github.com/Archakov06/trycode.git
```

To get your own TryCode running on Heroku, click the button below:

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Archakov06/trycode)

## Configuration
Before you run the application, you need to configure access to the database by writing setting in ```src/server/config.js``` and set ```OPTIONS.DEV``` (true / false. Developer mode is not finished.)

```
db = require('knex')({
	client: 'mysql',
	connection: {
		host       : options.DEV ? 'localhost' : 'eu-cdbr-west-01.cleardb.com',
		user       : options.DEV ? 'root' : 'cleardb_user',
		password   : options.DEV ? 'password' : 'cleardb_pass',
		database   : options.DEV ? 'trycode_db' : 'cleardb_dbname',
		socketPath : options.DEV ? '/Applications/MAMP/tmp/mysql/mysql.sock' : '', // I have OSX and need mysql.sock
		charset    : 'utf8',
	}
});
```

## NPM Scripts
```
"scripts": {
    "start": "node ./dist/run.js",
    "build": "babel ./src/server -d ./dist",
    "run": "node ./dist/run.js",
    "build-run": "babel ./src/server -d ./dist && node ./dist/run.js",
    "sprite": "svg-sprite-generate -d public/img/svg -o public/img/sprites.svg"
  }
```

## How to report bugs
Bugs should be files as issues on the github issue tracker at
<https://github.com/Archakov06/trycode/issues>. Contact me via GitHub if you have issues, suggestions or need any help regarding this app. Note that the code is beta quality.

## What for?
With the passage of the interview in one of the companies, I was offered to write code in collabedit.com. After using this online editor, I noticed that it works very badly and has a very sucks editor (it's uses "long polling" :facepalm:). Then I got the idea to realize a simple and convenient at the same time online code editor on the WebSockets.

P.S: Sorry for my lousy English :)

## License

MIT License

Copyright (c) 2017 Archakov Dennis

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

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

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

## Contributing

Comming soon...

repository: addyh/trycode

repo_name: addyh/trycode


text:
# Change Log

## [v2.9.1](https://github.com/zooniverse/modal-form/tree/v2.9.1) (2020-03-30)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.9.0...v2.9.1)

**Merged pull requests:**

- Remove babel-core, react and react-dom [\#48](https://github.com/zooniverse/modal-form/pull/48) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.9.0](https://github.com/zooniverse/modal-form/tree/v2.9.0) (2019-06-26)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.8.0...v2.9.0)

**Closed issues:**

- Account for SVG viewport [\#17](https://github.com/zooniverse/modal-form/issues/17)

**Merged pull requests:**

- Prepare package for deprecation [\#46](https://github.com/zooniverse/modal-form/pull/46) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.8.0](https://github.com/zooniverse/modal-form/tree/v2.8.0) (2019-02-27)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.7.0...v2.8.0)

**Merged pull requests:**

- \[Security\] Bump stringstream from 0.0.5 to 0.0.6 [\#44](https://github.com/zooniverse/modal-form/pull/44) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
- \[Security\] Bump extend from 3.0.1 to 3.0.2 [\#42](https://github.com/zooniverse/modal-form/pull/42) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
- \[Security\] Bump adm-zip from 0.4.7 to 0.4.13 [\#41](https://github.com/zooniverse/modal-form/pull/41) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))

## [v2.7.0](https://github.com/zooniverse/modal-form/tree/v2.7.0) (2018-09-13)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.6.1...v2.7.0)

**Merged pull requests:**

- Update to React 16.5 [\#40](https://github.com/zooniverse/modal-form/pull/40) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.6.1](https://github.com/zooniverse/modal-form/tree/v2.6.1) (2018-07-27)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.6.1-0...v2.6.1)

**Merged pull requests:**

- Add anchored forms to DOM before rendering [\#39](https://github.com/zooniverse/modal-form/pull/39) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.6.1-0](https://github.com/zooniverse/modal-form/tree/v2.6.1-0) (2018-07-27)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.6.0...v2.6.1-0)

**Closed issues:**

- SyntaxError: Unexpected token: punc [\#27](https://github.com/zooniverse/modal-form/issues/27)

## [v2.6.0](https://github.com/zooniverse/modal-form/tree/v2.6.0) (2018-05-11)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.5.3...v2.6.0)

**Merged pull requests:**

- Upgrade to React 16 [\#35](https://github.com/zooniverse/modal-form/pull/35) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.5.3](https://github.com/zooniverse/modal-form/tree/v2.5.3) (2018-05-09)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.5.2...v2.5.3)

**Merged pull requests:**

- Fix the example page [\#37](https://github.com/zooniverse/modal-form/pull/37) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.5.2](https://github.com/zooniverse/modal-form/tree/v2.5.2) (2018-05-09)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.5.1...v2.5.2)

**Closed issues:**

- `Context` is not passed to children [\#32](https://github.com/zooniverse/modal-form/issues/32)

**Merged pull requests:**

- Replace named refs with callbacks [\#36](https://github.com/zooniverse/modal-form/pull/36) ([eatyourgreens](https://github.com/eatyourgreens))

## [v2.5.1](https://github.com/zooniverse/modal-form/tree/v2.5.1) (2018-01-29)
[Full Changelog](https://github.com/zooniverse/modal-form/compare/v2.5.0...v2.5.1)

**Merged pull requests:**

- Update to use PropTypes in dialog [\#34](https://github.com/zooniverse/modal-form/pull/34) ([srallen](https://github.com/srallen))

## [v2.5.0](https://github.com/zooniverse/modal-form/tree/v2.5.0) (2018-01-29)
**Closed issues:**

- Boundary Overflow on Mobile [\#30](https://github.com/zooniverse/modal-form/issues/30)
- Can't scroll to end of modal longer than the page [\#9](https://github.com/zooniverse/modal-form/issues/9)
- IE10: Position not set with parent SVG elements [\#8](https://github.com/zooniverse/modal-form/issues/8)

**Merged pull requests:**

- Remove createClass. Add prop-types and react-creact-class [\#33](https://github.com/zooniverse/modal-form/pull/33) ([srallen](https://github.com/srallen))
- Check for Modal Width Overflow [\#31](https://github.com/zooniverse/modal-form/pull/31) ([wgranger](https://github.com/wgranger))
- Use requestAnimationFrame to delay reposition [\#28](https://github.com/zooniverse/modal-form/pull/28) ([eatyourgreens](https://github.com/eatyourgreens))
- Only call reposition [\#26](https://github.com/zooniverse/modal-form/pull/26) ([srallen](https://github.com/srallen))
- Use function syntax [\#24](https://github.com/zooniverse/modal-form/pull/24) ([srallen](https://github.com/srallen))
- Use requestAnimationFrame to Delay Reposition [\#23](https://github.com/zooniverse/modal-form/pull/23) ([wgranger](https://github.com/wgranger))
- Allow Modal to Close with Navigation Change [\#22](https://github.com/zooniverse/modal-form/pull/22) ([wgranger](https://github.com/wgranger))
- Method, not action [\#21](https://github.com/zooniverse/modal-form/pull/21) ([brian-c](https://github.com/brian-c))
- more inclusive event detection [\#20](https://github.com/zooniverse/modal-form/pull/20) ([simensta](https://github.com/simensta))
- Fix tests [\#19](https://github.com/zooniverse/modal-form/pull/19) ([brian-c](https://github.com/brian-c))
- svg viewport awareness when positioning form [\#18](https://github.com/zooniverse/modal-form/pull/18) ([simensta](https://github.com/simensta))
- Don't count vertical scrollbar in underlay dimensions [\#16](https://github.com/zooniverse/modal-form/pull/16) ([brian-c](https://github.com/brian-c))
- Allow for non-form instances \(I know...\) [\#15](https://github.com/zooniverse/modal-form/pull/15) ([brian-c](https://github.com/brian-c))
- Positioning improvements [\#14](https://github.com/zooniverse/modal-form/pull/14) ([brian-c](https://github.com/brian-c))
- Add a close button to dialogs [\#13](https://github.com/zooniverse/modal-form/pull/13) ([brian-c](https://github.com/brian-c))
- Update to React 14 [\#12](https://github.com/zooniverse/modal-form/pull/12) ([aweiksnar](https://github.com/aweiksnar))
- Allow scrolling [\#11](https://github.com/zooniverse/modal-form/pull/11) ([brian-c](https://github.com/brian-c))
- Fix ie11 positioning [\#10](https://github.com/zooniverse/modal-form/pull/10) ([brian-c](https://github.com/brian-c))
- Remove hook into history-events, make location change event customizable [\#7](https://github.com/zooniverse/modal-form/pull/7) ([brian-c](https://github.com/brian-c))
- Watch history events state [\#6](https://github.com/zooniverse/modal-form/pull/6) ([brian-c](https://github.com/brian-c))
- Basically a rewrite [\#5](https://github.com/zooniverse/modal-form/pull/5) ([brian-c](https://github.com/brian-c))
- Close on navigate [\#3](https://github.com/zooniverse/modal-form/pull/3) ([brian-c](https://github.com/brian-c))
- TriggeredModalForm [\#2](https://github.com/zooniverse/modal-form/pull/2) ([brian-c](https://github.com/brian-c))
- AnchoredModalForm [\#1](https://github.com/zooniverse/modal-form/pull/1) ([brian-c](https://github.com/brian-c))

\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

repository: zooniverse/modal-form

repo_name: zooniverse/modal-form


text:
# The Effect of Particulate Matter on Water Temperature

## Introduction

Water temperature is an important metric to biological life and overall ecosystem health. Small deviations in water temperature can have numerous effects:

* Distortion of metabolic and photosynthetic rates.
* A change in the levels of both natural and harmful compounds.
* Altered salinity, conductivity, acidity, and water density.

Water turbidity is a key test of water quality. The measurement tracks the cloudiness of a body of water caused by the presence of microscopic particulate matter. The standard unit for turbidity is Nephelometric Turbidity Units (NTU), which is a function of the amount of refracted light detected by a sensor called a Nephelometer. The more particulate matter present, the more light refracted.

![](./images/nephelometer.png)

Turbidity standards are shown below in NTU:

![](./images/turb-standards.png)

Drinking water turbidity standards for various governments and organizations are enumerated here for context:

| Organization | Turbidity Standard |
:--:|:--:
World Health Organization | 5 NTU
European Union | 4 NTU
United States | 1 NTU

Several states have promulgated ambient water turbidity standards to adjudicate the cleanliness of publicly accessible bodies of water based on size, location, and purpose:

| State | Turbidity Standard |
:--:|:--:
Louisiana | 25, 50, or 150 NTU
Vermont | 10 or 25 NTU
[Washington](../../chart-of-the-day/wa-wqi/README.md) | 5 NTU

## Dataset

The City of Chicago makes use of several such detectors during the summer months to track water turbidity and temperature. The dataset is stored in [Socrata](https://axibase.com/use-cases/integrations/socrata/python/) format and available in the Axibase Dataset Catalog.

Alternatively, download the [CSV file](./resources/water-turbidity-and-temperature.csv) from the `/resources` directory.

Sample records from this dataset are shown here:

| Beach Name | Measurement Timestamp | Water Temperature | Turbidity | Transducer Depth | Wave Height | Wave Period | Battery Life | Measurement Timestamp Label | Measurement ID |
|------------|-----------------------|-------------------|-----------|------------------|-------------|-------------|--------------|-----------------------------|----------------|
| Ohio Street Beach | 07/02/2018 05:00:00 PM | 21.6 | 1.39 |       | 0.158 | 4    | 11.9                | 07/02/2018 5:00 PM          | `OhioStreetBeach201807021700` |
| Ohio Street Beach | 07/02/2018 06:00:00 PM | 21.1 | 0.91 |       | 0.189 | 2    | 11.9                | 07/02/2018 6:00 PM          | `OhioStreetBeach201807021800` |
| Ohio Street Beach | 07/02/2018 07:00:00 PM | 20.5 | 1.07 |       | 0.154 | 4    | 11.9                | 07/02/2018 7:00 PM          | `OhioStreetBeach201807021900` |
| Ohio Street Beach | 07/02/2018 08:00:00 PM | 19.9 | 1.11 |       | 0.161 | 3    | 11.7                | 07/02/2018 8:00 PM          | `OhioStreetBeach201807022000` |
| Ohio Street Beach | 07/02/2018 09:00:00 PM | 19.6 | 1.1  |       | 0.19  | 3    | 11.9                | 07/02/2018 9:00 PM          | `OhioStreetBeach201807022100` |
| Ohio Street Beach | 07/02/2018 10:00:00 PM | 19.3 | 1.02 |       | 0.176 | 3    | 11.9                | 07/02/2018 10:00 PM         | `OhioStreetBeach201807022200` |
| Ohio Street Beach | 07/02/2018 11:00:00 PM | 19   | 1.04 |       | 0.117 | 2    | 11.9                | 07/02/2018 11:00 PM         | `OhioStreetBeach201807022300` |
| Ohio Street Beach | 07/03/2018 12:00:00 AM | 18.9 | 1.01 || 0.123 | 3     | 11.9 | 07/03/2018 12:00 AM | `OhioStreetBeach201807032400` |                             |
| Ohio Street Beach | 07/03/2018 01:00:00 AM | 18.8 | 1.02 | |0.102 | 3     | 11.9 | 07/03/2018 1:00 AM  | `OhioStreetBeach201807030100` |                             |
| Ohio Street Beach | 07/03/2018 02:00:00 AM | 18.7 | 1    |       | 0.103 | 3    | 11.9                | 07/03/2018 2:00 AM          | `OhioStreetBeach201807030200` |

The four relevant columns for this research are `Water Temperature` and `Turbidity`, the associated `Measurement Timestamp`, and the `Beach Name` detector location.

The location of each detector is described on [`data.cityofchicago.org`](https://data.cityofchicago.org/Parks-Recreation/Beach-Water-and-Weather-Sensor-Locations/g3ip-u8rb) by geographic longitude and latitude. Their position is plotted on the map below and specified by name in the associated table:

![](./images/detector-locations.png)

Location ID | `Beach Name` | Geographic Coordinates
--|--|--
1 | Calumet Beach | `(41.714739°, -87.527356°)`
2 | 63rd Street Beach | `(41.784561°, -87.571453°)`
3 | Montrose Beach | `(41.969094°, -87.638003°)`
4 | Osterman Beach | `(41.987675°, -87.651008°)`
5 | Ohio Street Beach | `(41.894328°, -87.613083°)`
6 | Rainbow Beach | `(41.760147°, -87.550081°)`

## Visualization

The dataset is inconsistent. Some years lack data for certain locations, and others contain only intermittent data. Open the **ChartLab** portal below to view 2016 data.

![](./images/temp-turb-portal.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/77067e32#fullscreen)

View data from other years by modifying the `start-time` setting or isolate a series by clicking the `Beach Name` tag icons above the visualization to toggle the presence of the detector from that location.

```ls
[configuration]
  start-time = May 2016
```

The `Ohio Street Beach` dataset is the most consistent, and the only data tracked for the entire observed period. To maintain consistency, other data is henceforth excluded.

This portal tracks the four most recent years of `Ohio Street Beach` data for metrics `Turbidity` and `Water Temperature` with data as recent as July 2, 2018.

![](./images/ohio-street-beach-portal.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/8d79f2ce#fullscreen)

The data is hourly and erratic. This is due to the nature of the device which is unable to discard erroneous readings or the presence of an object, such as a person or thing, near the detector.

According to [Snell's law](https://en.wikipedia.org/wiki/Snell%27s_law), the angle of incidence and thus wavelength of refracted light is a function of the speed of light divided by the frequency, which changes when the light particle is refracted. Particles refracted by particulate matter of different indices of refraction create different readings.

![](./images/snells-law.png)

The formula associated with Snell's law `n1/n2 =  sin(θ1)/sin(θ2)` states that the difference between two mediums affects the angle and velocity at which a light particle is refracted.

Aggregating temperature and turbidity data by the day is a reasonable resolution to the problem of volatile samples considering the observed period is less than six months for each year.

```ls
[widget]
  group-period = 1 day
  group-statistic = avg
```

![](./images/aggregated-portal.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/eae1eb1c#fullscreen)

**ChartLab** supports [user-defined functions](https://axibase.com/docs/charts/syntax/udf.html#user-defined-functions) which aid further analysis. Define JavaScript functions and store them in the [appropriate location](https://axibase.com/docs/charts/syntax/udf.html#deploying-function-files). The publicly accessible **ChartLab** application already supports the `fred.js` library. Alternatively, deploy the library locally with the [downloadable resource](https://raw.githubusercontent.com/axibase/charts/master/resources/fred.js).

The `PercentChangeByOffset` function is used below to handle the difference in magnitude of the two metrics and compare relative changes. The `PercentChangeByOffset` function requires two arguments: the `alias` of the series to transform, and the `interval` of the offset.

```ls
[series]
  value = local.PercentChangeByOffset('raw-turb', '1 day')
[series]
  value = local.PercentChangeByOffset('raw-temp', '1 day')
```

The resultant visualization highlights the analogous changes for each metric.

![](./images/percent-change-offset.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/7ef7c546#fullscreen)

The converse relationship of turbidity and water temperature is visualized above: larger than normal increases in turbidity and therefore particulate matter, correlate to larger than normal decreases in water temperature. This phenomena occurs because of the energy transfer between solar photons and the media through which they refract. Generally this is treated as either 0% or 100% energy transfer for mathematical purposes. The presence of more absorbing bodies decreases the amount energy transferred to heat the body of water.

[Consecutive sample comparison](../../tutorials/subtract-subsequent-values/README.md) is another way to solve the magnitude problem.

![](./images/value-previousvalue.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/a420c8de#fullscreen)

The pattern is similar when comparing absolute daily average change but the `PercentChangeByOffset` is preferable since absolute turbidity changes are greater than absolute temperature changes. Converting the Celsius temperature values to Fahrenheit is one solution to increase variance.

```ls
[series]
  replace-value =  ((value - previousValue) * 9/5 + 32)
```

Modifying the derived `value` expression in the visualization created using the `PercentChangeByOffset` function to reflect the `Water Temperature` line about the `x` axis and reducing the observed `timespan` generates a more coherent visualization of the relationship.

```ls
[configuration]
  timespan = 20 day

[series]
  value = -1 * local.PercentChangeByOffset('raw-temp', '1 day')
```

![](./images/x-axis-reflection.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/1f2b1be5#fullscreen)

> For additional information and syntax, refer to [Charts Documentation](https://axibase.com/docs/charts/).

## Outlier Data

![](./images/outlier-portal.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/c18e05f0#fullscreen)

The portal above shows two datasets that contain significant outlier data which does not conform to correlation established through visualization.

The `2015` dataset shows a significant decrease in water temperature without a proportionate increase in turbidity. The `2016` dataset shows a significant increase in turbidity paired with an analogous increase in water temperature as well as a significant increase in turbidity without an analogous increase in water temperature.

![](./images/august-water-temp.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/cb2996e1#fullscreen)

[Historical weather reports](https://www.timeanddate.com/weather/usa/chicago/historic?month=8&year=2015) show that during the trend, the recorded high temperature fell from 32° Celsius on August 17 to 24° on August 20 and the recorded low temperature fell from 22° to 16° during the same period. Several days of thunderstorms and a 30% drop in humidity are also recorded. The addition of rainwater and overall drop in atmospheric temperature likely contributed to the decrease in water temperature without an analogous increase in water turbidity. No other rainfall is recorded in the month of August in Chicago.

The `2016` dataset has two irregular incidents. Of the two noted above, the latter is likely the result of erroneous data input as mentioned in the introduction but the former requires a better explanation. The inclusion of the `Battery Life` metric showed that the surge in both metrics aligned perfectly with a sharp drop in battery life, perhaps indicating a temporary loss of power which flooded the recording device upon restart.

![](./images/battery-life.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/5e4d1b0a#fullscreen)

No other substantial fluctuation of battery life is recorded during the observation period, that is likely the cause of the erroneous data.

## Validation

Repeat this procedure using the attached dataset and ATSD.

1. Refer to the [Installation](https://axibase.com/docs/atsd/installation/) instructions or launch the ATSD [Docker image](https://axibase.com/docs/atsd/installation/docker.html).
1. Load data into ATSD using the provided CSV [parser configuration](./resources/turbidity-temperature-parser.xml). Follow the [configuration upload](../../tutorials/shared/import-csv-parser.md) instructions.
1. Review the [**ChartLab** tutorial](../../tutorials/shared/chartlab.md) and documentation for additional syntax options.

## Conclusion

Ohio Street Beach is one of the most popular beaches in the country and is located in the heart of Downtown Chicago.

![](./images/ohio-street-beach.png)

To maintain such consistently clean water in the heart of a major metropolitan area is no easy feat.

Average annual turbidity is shown here.

![](./images/annual-average.png)

[![](../images/new-button.png)](https://apps.axibase.com/chartlab/c046b3ba)

Only one year recorded an annual average turbidity greater than 10 NTU.

repository: nmoiseykin/atsd-use-cases

repo_name: nmoiseykin/atsd-use-cases


text:
+++
type = "post"
title = "Decentralized trust graph for online value exchange without a blockchain"
description = "Introductory post about Settle, and how it is particulary fitted for machine to machine transations."
date = "2017-01-17T08:30:00-07:00"
+++

# Settle

I'm happy to share Settle, a personal research project I've been working on
over the past 8 months.

Settle's goal is to explore a new financial trust primitive, and doing so,
construct a decentralized trust graph enabling (totally) free exchange of value
without relying on a blockchain.

*Value-exchange for humans and machines*

There are still barriers to enabling at scale and fluid transactions between
machines (and humans).

These transactions would have to come at very little or no fee which rules out
fiat currencies (also why would a machine trust a nation-state backing?) but
also most cryptocurrencies backed by a blockchain, as maintaining the
blockchain generally costs quite a lot on a per transaction basis (if only to
prevent spam).

Lightning networks resolve that issue at the transaction level, but users still
have to get their hands on the underlying currency to set up channels, which
creates a real barrier to entry as well for machines.

Also, and this is more likely a hunch[0], machine to machine transactions at
scale won't happen on "globally shared currencies". They'll transact in **KWH**
of energy, **KB** of bandwidth and storage, **FLOPSH** of computing power,
**APICALL**, or **KM** of drone delivery directly, in a decentralized way,
without jumping through a shared, centrally trusted and therefore expensive
currency (expensive in transaction fee, or expensive to setup, or expensive in
regulation burden).

*Currencies operate on a centralized trust graph.*

This sentence is almost tautological but let's consider both fiat and
cryptocurrencies:

Fiat currencies value is by definition backed by the government that issued it.
Hence, by construction, the trust graph powering exchanges based on fiat
currencies is centralized (it's no surprise that we generally call the issuer
of a fiat currency a central bank). Two individuals transacting in **USD** must
both trust the US government backing of dollars.

Conversely, cryptocurrencies such as Bitcoin or Ethereum have decentralized the
process of issuing and managing a currency. But while the operations of such
currencies, based on blockchains, have been fully decentralized, the trust
graph of these cryptocurrencies have remained entirely centralized. Everyone
need to trust Bitcoin to transact in Bitcoin, and everyone needs to trust
Ethereum to transact in Ethereum or assets issued on the Ethereum blockchain.
The centralized nature of the trust involved in these cryptocurrencies being
actually at the core of how these currencies operate, as the only viable way to
properly incentivize a proof-of-work system.

*Explore decentralized trust based value exchange*

Settle was motivated by the exploration of whether it would be possible to
create a decentralized trust graph between user-issued IOUs ("I owe you") and
leverage it to safely exchange value without a central authority or shared
blockchain to maintain, getting in exchange free transactions and free
onboarding, specifically important for machine to machine transactions.

Rephrased in researchy terms, Settle demonstrates that it is possible to
operate a safe credit network (a currency system without double-spend) without
requiring global consensus (a shared global state machine, or blockchain) if
you accept the following constraints:

- nodes have to be online
- trust between nodes has to be expressed explicitly
- when trusting a malicious node, users can lose up to the amount of trust
  they placed in it.

It's still a work in progress, but more information can be found on these
claims in the documentation[1][2].

Even more importantly, the engineering contribution of Settle, is a simple
HTTPS API to operate such network and an even simpler command-line to
interact with it.

*The Settle network is operated by mints.*

Since there is no shared blockchain, the nodes of the network have to be
online. So, very much like email, users register on "mints", a server of their
choice (possibly their own), that manage the assets they issue as well as the
trust they express towards other assets in the network.

You can freely register with the `settle` command-line on the mint I opened
publicly at `m.settle.network` (no need to be human, you just need to be able
to receive email):
```
settle register
```

And you can also directly log in the mint of your choice with:
```
settle login
```

More precisely, mints are in charge of maintaining the following for their
users:

- the list of assets issued by its users
- balances associated with these assets
- an authoritative list of offers put on the network by its users
- an indicative list of offers involving the assets it is authoritative for
  (order book)

One nice property of this, is that users don't have to manage a public/private
key pair, they just have credentials with their mint that can be rolled or
retrieved easily. But they do have to trust their mint.

*Value is exchanged by crossing offers across mints*

Users of Settle issue assets (or IOUs) of the form
<EMAIL_ADDRESS>an IOU from Kurt on a mint operated by
Princetown, for **USD** dollars expressed as cents. Each users can freely issue
their own assets. As a user's mint is authoritative for the assets they issue,
it maintains and manages balances (of other users) for these assets. Hence,
issuing or transferring IOUs to others simply involves posting instruction to
one's own mint. As an example<EMAIL_ADDRESS>can simply issue a
certain amount of<EMAIL_ADDRESS>to<EMAIL_ADDRESS>by
posting an instruction to the mint at **princetown.edu**. Since the mint is
authoritative for that asset, no synchronization is required with the mint at
**npl.co.uk**.

Let's assume that both<EMAIL_ADDRESS>and
<EMAIL_ADDRESS>were activated by their respective users on
their respective mints.
```
settle mint USD.2    # activates USD.2
```

At the mint level, users express trust in the network by posting offers on
their mints to issue and exchange assets they control in exchange for assets
controlled by other users they trust. Maybe Alan trusts Kurt for up to $200.
Alan will represent that trust by posting on his mint an offer on pair
**alan<EMAIL_ADDRESS>for **20000** at price
**1/1**.

```
settle trust<EMAIL_ADDRESS>USD.2 20000    # alan runs this
```

Similarly, let's assume that Kurt trusts John up to $100 and has an outstanding
offer on pair **kurt<EMAIL_ADDRESS>for **10000**
at price **1/1**. These two offers will allow John to transact with Alan
without requiring Alan to trust John directly. If Alan sells a machine part for
$10, by crossing the two offers, John can buy that part from Alan. He first
issues and exchanges<EMAIL_ADDRESS>1000** for
<EMAIL_ADDRESS>1000** using the offer from Kurt, and then
exchange the acquired<EMAIL_ADDRESS>1000** for
<EMAIL_ADDRESS>1000** using Alan's offer that he can finally credit
back to Alan in exchange for the part.

```
settle pay<EMAIL_ADDRESS>USD.2 1000    # john runs this
```

After this operation is complete, Alan holds an IOU from Kurt for $10, i.e. he
will have a balance of<EMAIL_ADDRESS>1000** on the mint at
**princetown.edu**, and Kurt holds an IOU from John for $10, i.e.  he will have
a balance of<EMAIL_ADDRESS>1000**. Alan's offer will be valid for a
remaining **19000** and Kurt's offer for a remaining **9000**.

The mint protocol provides a mechanism called transactions (backing the `pay`
command above) to cross a chain of offers atomically and safely[1][2]. A
transaction involves reserving funds along that chain and committing the
balance operations on each mint that participate once the offers are secured.
Transactions, if successful, are instantaneously confirmed and fee-less.

Of course users can also specify trust with a discount (because of a possible
risk) or an exchange rate, as an example:

```
settle trust<EMAIL_ADDRESS>GBP.2 1000 with USD.2 at 122/100
```
/The m.settle.network mint/

Available  open-source is a Go implementation for mints, as well as a
command-line tool `settle`, that you can install locally with:
```
curl -L https://settle.network/install | sh && export PATH=$PATH:~/.settle
```

I'm also maintaining a mint at `m.settle.network` to let people issue and
exchange assets as well as a guide to setup your own mint:

- [Source code](https://github.com/spolu/settle)
- [Documentation](/documentation)
- [Guide: Setting up a mint](/posts/guide-setting-up-a-mint/)

/Getting involved/

At the end of the day, Settle's motivation is to make currency issuance and
exchange easy and available to everyone (including machines). I think that
Settle can be particularly useful in situations where currency issuance is
implicit and therefore often lacks liquidity.

One perfect (though rather mundane) example where Settle could potentially
inject liquidity in an implicit network of IOUs, are the balances we maintain
with our friends and family. Settle could (at least with your technophile
friends until we have more than a command-line) let you use the balance you
have with one friend to pay another one, or even buy stuff, depending on the
topology of the trust graph. Even if mundane, powered by a mobile app, this
could be a pretty exciting application of Settle.

While I'm also excited by potential use-cases related to self-driving car
networks[3] or online commerce[4], I'm convinced that a any successful
use-case for Settle, is likely to come from somewhere unexpected.

With that in mind, if you wish to get involved here are a few things you can do
today:

- First and foremost, install `settle`, register, mint a few assets, ask your
friends, colleagues, drones, self-driving cars to do so, trust them and ask
(instruct?) them to trust you back and attempt to run a few transactions.
That's the best way to test the system and discover interesting use-cases.
- If you want to learn more about the underlying protocol, you can play with
setting up your own mint: that's definitely beneficial for the comunity and if
you do so, let's add it to the `register` command.
- If you think of, work in, or have heard of implicit networks of IOUs that are
lacking liquidity, let's try to apply Settle to it and see if it can solve a
pain point experienced in that market. (Another hunch: I'm quite convinced,
despite not being an expert at all, that online games artifacts could be a good
fit?)
- Finally, there are quite a few large-scale engineering projects that can be
built on top of Settle. Most obvious ones I can think of are: a trust path
discovery service, a mobile app (and probably service as well) that makes it
easy to use Settle for non-technical users, or a variety of gateways[5].

In any case, I hope that you'll enjoy learning more about Settle and the model
it proposes. Please don't hesitate to reach out directly or on the public
mailing list[6] if you have any question!

-stan

[0] That's what's great about personal projects, it's OK to invest time and
work on a hunch!

[1] See the [Mint documentation](/documentation). In particular, the protocol
is safe in the sense that there is no double-spend (but users can lose up to
the amount of trust they place in malicious users).

[2] Skipping a few steps and notions, but for reference, the exact commitment
(ensuring safety) that a mint is doing on behalf of its user when accepting to
participate in a transaction is the following:
```
Mint at hop h (position along the offer path), commits to:
  - settle (irrevocably issue/credit the funds) if:
    - it has not yet canceled the transaction.
    - it is presented with the lock secret.
    - node at h-1 has made the same commitment.
  - cancel the transaction if:
    - it has not yet settled the transaction.
    - node at h+1 has canceled.
```

[3] The main idea here would be to pay rides on the Tesla Network in **KWH.2**
instead of any specific currency. Teslas could be configured to trust the Tesla
Network solely **modelx_AX7GD<EMAIL_ADDRESS>1/1**
with the Tesla Network trusting the Superchargers Network with
**network<EMAIL_ADDRESS>11/10** such that
Tesla would get a cut of each transactions (10% here). Reciprocally the
Superchargers Network could trust the Tesla Network at a flat rate
**network<EMAIL_ADDRESS>1/1** to let Teslas
pay for their recharge as they earn **KWH.2**.  Car-owners would also trust
<EMAIL_ADDRESS>using it to "pay" at Supercharger stations
when they ride their own Tesla which would in turn enable Teslas to pay for
charges at home stations. From there Tesla could set prices for their
Supercharger in each currency by trusting local nodes at various rates, or even
local power plants for **KWH.2** directly.

[4] Online merchants could use Settle to issue store credit that is easily
usable at other places. This could potentially solve the problem of unlinked
refunds in e-commerce while ensuring merchants that these credits would, by
construction, be eventually used at their store.

[5] Lets users deposit currencies (fiat or cryptocurrencies) in exchange for
trust on the network, and get that currency deposited back to their account by
paying the gateway on the network: by depositing $20 at acme.com (using a card
payment or transfer), I would receive a trustline from<EMAIL_ADDRESS>to<EMAIL_ADDRESS>Conversely, when paying<EMAIL_ADDRESS>USD.2 100**, it would automatically deposit back the associated funds to my
bank account.

[6]
[settle-public@googlegroups.com](https://groups.google.com/d/forum/settle-public)

repository: spolu/settle

gha_language: Go

repo_name: spolu/settle


text:
# toDO

To Do is a personal project web development using Flask as the main tool. It is a "to do" web app to make quick notes and check when done. Want to try the app?? You can! It is running in Google Appspot :)  Follow the link ----->   https://todo-flask-xavier.appspot.com/

# Programing skills used in the project

  - Python
  - Flask
  - HTML
  - Jinja2
  - Git
  - NoSQL: Firebase

> The project is running in Google appspot using the noSQL database Firebase.

### Installation

Postgram requires [Flask](https://flask.palletsprojects.com/en/1.1.x/installation/#installation) v1+ to run.

More dependencies need to be installed.

For no virtual environments....
Install the dependencies and devDependencies and start the server.

```sh
$ cd todo
$ pip install -r requirements.txt
$ flask run
```

For virtual environments....
Start the virtual environments before intaling the dependencies and running the server.

```sh
$ cd todo
$ sudo apt-get venv
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ flask run

```

### Do you check how toDO works?

Actually you can try it: https://todo-flask-xavier.appspot.com/

License
----

MIT

**Free Software, Hell Yeah!**

[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)

   [dill]: <https://github.com/joemccann/dillinger>
   [git-repo-url]: <https://github.com/joemccann/dillinger.git>
   [john gruber]: <http://daringfireball.net>
   [df1]: <http://daringfireball.net/projects/markdown/>
   [markdown-it]: <https://github.com/markdown-it/markdown-it>
   [Ace Editor]: <http://ace.ajax.org>
   [node.js]: <http://nodejs.org>
   [Twitter Bootstrap]: <http://twitter.github.com/bootstrap/>
   [jQuery]: <http://jquery.com>
   [@tjholowaychuk]: <http://twitter.com/tjholowaychuk>
   [express]: <http://expressjs.com>
   [AngularJS]: <http://angularjs.org>
   [Gulp]: <http://gulpjs.com>

   [PlDb]: <https://github.com/joemccann/dillinger/tree/master/plugins/dropbox/README.md>
   [PlGh]: <https://github.com/joemccann/dillinger/tree/master/plugins/github/README.md>
   [PlGd]: <https://github.com/joemccann/dillinger/tree/master/plugins/googledrive/README.md>
   [PlOd]: <https://github.com/joemccann/dillinger/tree/master/plugins/onedrive/README.md>
   [PlMe]: <https://github.com/joemccann/dillinger/tree/master/plugins/medium/README.md>
   [PlGa]: <https://github.com/RahulHP/dillinger/blob/master/plugins/googleanalytics/README.md>

repository: xmedinavei/toDO-flask

repo_name: xmedinavei/toDO-flask