text:
# Rubocop Config Updater

Rubocop requires a lot of changes to its config if you didn't update it for a long time.
That's why I wrote this gem, because I was tired of manually changing the configuration file.
There is already [mry gem](https://github.com/pocke/mry) that solves the same problem, but it's a bit outdated.

This gem handles rubocop's stderr output, therefore it won't shouldn't get outdated. More info about how this gem works and what kind of errors it deals with, can be found in the section [#how-it-works](#how-it-works)

## Installation

Install

Add this line to your application's Gemfile:

```ruby
gem 'rubocop_config_updater', require: false
```

And then execute:

```sh
bundle install
```

Or **preferred** install it yourself as:

```sh
gem install rubocop_config_updater
```

After usage you can uninstall with:

```sh
gem cleanup rubocop_config_updater
```

## Usage

```sh
Usage: rubocop_config_updater [options]
    -c, --config PATH                Rubocop config path, i.e. .rubocop.yml
        --rubocop COMMAND            Rubocop command, i.e. bundle exec rubocop
    -v, --version
```

## How it works

This gem runs a command against rubocop and collects errors from STDERR, which are used to update rubocop's configuration file.
If you are interested in Rubocop's code responsible for the above mentioned errors, here is a link to Rubocop's [config_obsoletion class](https://github.com/rubocop-hq/rubocop/blob/master/lib/rubocop/config_obsoletion.rb)

### Errors that are solved

- Renamed cops
  `Naming/UncommunicativeMethodParamName` will be changed to `Naming/MethodParameterName`
- Moved cops
  `Security/Eval` will be changed to `Lint/Eval`
- Renamed parameters
  `SafeMode` will be changed to `SafeAutoCorrect`
- Missing department
  `MethodLength` will be changed to `Metrics/MethodLength`

### Errors that you have to manually solve

- Removed cops
- Splitted cops
- Obsolete parameters

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at [https://github.com/adamzapasnik/rubocop_config_updater](https://github.com/adamzapasnik/rubocop_config_updater).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).


text:
# Flask Rest Paginate

A Pagination Extension for Flask RESTful.

## Installation

Install the extension using
```
pip install flask-rest-paginate
```

## Usage
In your app, add the extension as follows

```py
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_rest_paginate import Pagination

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///paginate-test.db"
db = SQLAlchemy(app)

pagination = Pagination(app, db)

```

Use in your project as
```py
pagination.paginate(AuthorModel, author_schema)
```

You can also pass the `sqlalchemy` query object as
```py
pagination.paginate(AuthorModel.query.filter_by(id=author_id), author_schema)
```

If you want to use marshmallow schemas then set the third param `True`
```py
pagination.paginate(AuthorModel, marshamllow_author_schema, True)
```

## Customize your pagination schema

If you want create a custom pagination schema. You should pass pagination_schema_hook and return a Dict with you custom schema
```
res = pagination.paginate(
                AuthorModel,
                schema,
                True,
                pagination_schema_hook=lambda current_page, page_obj: {
                    "next": page_obj.has_next,
                    "prev": page_obj.has_prev,
                    "current": current_page,
                    "pages": page_obj.pages,
                    "per_page": page_obj.per_page,
                    "total": page_obj.total,
                },
            )
```

You can also customize key names where data and pagination info are placed, setting the configuration variables:
```
app.config['PAGINATE_PAGINATION_OBJECT_KEY'] = "page_info"
app.config['PAGINATE_DATA_OBJECT_KEY'] = "results"

...

{
    "page_info": {
        "currentPage": 1,
        "hasNext": false,
        "hasPrev": false,
        "pages": 1,
        "size": 20,
        "totalElements": 2
    }
    "results": {
        ...
    }
}
```

Furthermore, pagination info can be moved directly to the root of the result object:
```
app.config['PAGINATE_PAGINATION_OBJECT_KEY'] = None
app.config['PAGINATE_DATA_OBJECT_KEY'] = "results"

...

{
    "currentPage": 1,
    "hasNext": false,
    "hasPrev": false,
    "pages": 1,
    "size": 20,
    "totalElements": 2
    "results": {
        ...
    }
}
```

## Example:

Check the [example](https://github.com/mtShaikh/flask-rest-paginate/tree/master/example) folder for an example of the extension.

## Contributing

We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.

You can report any bug you find or suggest new functionality with a new [issue](https://github.com/mtShaikh/flask-rest-paginate/issues).

If you want to add yourself some functionality to the extension:

- Open an [issue](https://github.com/mtShaikh/flask-rest-paginate/issues)
- Comment there you are working on a new functionality
- Fork the [repo](https://github.com/mtShaikh/flask-rest-paginate/)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Adds my new feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- mention the issue number in the PR description as `fixes #123, #321`

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
-----
# Data sets
---

This folder containds the preprocessed data set that was used during the project and A brief description is given below

      1. Impurities value for PM10, PM25, NO2, Ozone and CO in 4 diffrent regions from city of Skopje and each region comprise
      6 locations
      2. At each stage we predict the time series evolution for one of these impurities. e.g PM10
      3. We added other impurities for there is Correlation among impurities.
      4. The data contains 7 regions and each region has its own impurity readings
      5. The impurity readings for the 7 locations will be fed together into the LSTM since the impurity
      levels between the locations may affect each other since they are near.
      6. We also scrapped weather data to to see the correlation bwetween weather condition and impurity level.

      NB:This will also be updated


text:
---
title: "An Introduction to Statistical and Data Sciences via R"
author: "Chester Ismay and Albert Y. Kim"
date: "2018-07-21"
tags: [Data Science, Textbook, Statistics, Course, R Programming]
link: "https://moderndive.com/"
length_weight: "27.4%"
cover: "https://moderndive.com/images/logos/book_cover.png"
repo: "moderndive/moderndive_book"
pinned: true
---

An open-source and fully-reproducible electronic textbook bridging the gap between traditional introductory statistics and data science courses. [...] Help! I’m new to R and RStudio and I need to learn about them! However, I’m completely new to coding! What do I do? If you’re asking yourself this question, then you’ve come to the right place! Start with our Introduction for Students. This is version 0.4.0 of ModernDive published on July 21, 2018. For previous versions of ModernDive, see Section 1.5. This book assumes no prerequisites: no algebra, no calculus, and no prior programming/coding ...

gha_license_id: MIT


text:
# jsimplint

A simple linting tool using Jison and Typescript.

## How to run
1. Clone the repo

`git clone git@github.com:bmestanov/jsimplint.git`

2. `npm install`

3. To use existing rules: `npm start <file.js>`

## Adding your own rules

To add custom rules, append your rule to the file `rules.ts`. Each rule has the interface

```typescript
export interface Rule {
  name: string;
  description?: string;
  targetNodeType: NodeType;
  check(node: ASTNode, parseIndex: ParseIndex, context: NodeType[]): RuleError[];
};
```

For reference, check the existing rules.

repository: bmestanov/jsimplint

gha_language: TypeScript

repo_name: bmestanov/jsimplint


text:
# How To Run Locally

* Use [kyma-cli](https://github.com/kyma-incubator/kyma-cli), to install kyma.
* Run `make run`
    * Output should show the application running on port 8080:
        ```
        time="2020-01-21T19:51:39-08:00" level=info msg="🔓 Listening on <IP_ADDRESS>:8080"
        ```
    * A `config.yaml` is created in the directory where the binary is, if you don't specify a different path in the `CONFIG_DIR` environment variable.
* Open browser and connect to your local kyma cluster to create an application [https://console.kyma.local/home/cmf-apps](https://console.kyma.local/home/cmf-apps)
* Add a new application
* Click on connect application and copy the URL with the token
* In the browser browse to [http://localhost:8080/](http://localhost:8080/)
* Use the copied url from the created application on Kyma, put it in the text box and hit submit
    * This will connect the application in Kyma as well as registering API and Events with the application.
    * Double check in the Kyma application details, that after a refresh the application is listed as "Serving" and has APIs and Events listed in the *Provided Services & Events* section of the page.

# What's Currently Working

* Automatically generate certificates, public and private keys.
* Connect to Kyma and register API and Events automatically.

# Kyma and Kyma-integration on Minikube

* Install kyma, e.g. with [kyma-cli](https://github.com/kyma-incubator/kyma-cli)

> To use an image without uploading it to a docker registry, you can follow these steps:
>
> * Set the environment variables with eval $(minikube docker-env)
> * Build the image with the Docker daemon of Minikube (eg docker build -t my-image .)
> * Set the image in the pod spec like the build tag (eg my-image)
> * Set the imagePullPolicy to Never, otherwise Kubernetes will try to download the image.

# How To Run On k8s/kind

* Install Kyma on minikube or use a remote Kyma.
* Run `make setupkind` to initialize a kind cluster just for this application.
* Run `make docker` to create a docker binary
* Run `docker build -f build/package/Dockerfile -t kyma-integration:$(shell cat VERSION)` to create a docker container and tag it with the current version.
* Run `kind load docker-image kyma-integration:$(shell cat VERSION) --name "config-map"` to load the image into kind.
* Run `kubectl apply -f deploy-k8s.yaml` to deploy the service.
* Use `kubectl ...` to retrieve NodePort of application and access the service.

repository: tehcyx/kyma-integration

gha_language: Go

repo_name: tehcyx/kyma-integration


text:
# Shoper JSON API Client

## Requirements and dependencies

You need PHP 5.5 and later. Additionally, make sure that the following PHP extensions are installed on your server:
- [`curl`](https://secure.php.net/manual/en/book.curl.php),
- [`json`](https://secure.php.net/manual/en/book.json.php)

## Composer

You can install the client via [Composer](http://getcomposer.org/) by running the command:

```bash
composer require monetivo/shoper-json-api-php
```

Then use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading) mechanism:

```php
require_once('vendor/autoload.php');
```

## Manual Installation

If you do not wish to use Composer, you can download the [latest release](https://github.com/monetivo/shoper-json-api-php/releases). Then include the `autoload.php` file.

```php
require_once('/path/to/shoper-json-api-php/autoload.php');
```

## Getting Started

Basic usage looks like:

```php
<?php

try {
    // Shoper shop url
    $shopUrl = 'https://shop.url/';

    // webapi user login
    $login = 'webapi';

    // webapi user password
    $password = 's33m$d!FFicult';

    // init client
    $client = new \Monetivo\ShoperJsonApi($shopUrl);

    // try login, throws exception on fail
    $client->login($login, $password);

    //example - get order list
    $orderList = $client->orderList(true, false, null);

    $client->logout();
}
catch (\Monetivo\Exceptions\MonetivoException $e)
{
    // Shoper error message
    $e->getMessage();
    // Shoper error code
    $e->getCode();
}
```

## Documentation

See https://www.shoper.pl/api for information about acquiring webapi credentials and documentation of available methods.

## Issues

If you find any issues, please do not hesitate to file them via GitHub.

repository: monetivo/shoper-json-api-php

repo_name: monetivo/shoper-json-api-php


text:
# movieSwipe
Find suitable movies for some netflix and chill with this Tinder like movie matching website!
# Requirements

 - Node.js/npm
# Usage
To run the project locally, simply install/clone the repository, run `npm install` and run *server.js* with `node server.js`. Open the `localhost` at port 5500 and start using.

repository: Ocramoi/movieSwipe

repo_name: Ocramoi/movieSwipe


text:
# remove-duplicate

> Returns array after removing duplicates.

## Contributors ✨

Many thanks goes to these people for helping me maintain and upgrade the project:

    Abhishek Maurya

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save remove-duplicate
```

## Usage

Works with Array

```js
import removeDuplicate from 'remove-duplicate'; // web

OR;

const removeDuplicate = require('remove-duplicate'); // server

console.log(removeDuplicate([])); //=> []
console.log(removeDuplicate([1,1,1,1,1])); //=> [1]
console.log(removeDuplicate([1,2,3,4,5])); //=> [1,2,3,4,5]

```

## About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### License

Copyright © 2020, [Abhishek Maurya](https://github.com/xpressabhi).
Released under the [MIT License](https://github.com/xpressabhi/is-same/blob/master/LICENSE.md).

repository: xpressabhi/remove-duplicate

repo_name: xpressabhi/remove-duplicate


text:
# sl-console ![Rust](https://github.com/sl-sh-dev/sl-console/workflows/Rust/badge.svg?branch=master)

A Rust library offering readline-like functionality.
This is a fork of termion (https://gitlab.redox-os.org/redox-os/termion).
It adds window support (for 10 with new console ansi code support) based on
Jezza's MR (https://gitlab.redox-os.org/redox-os/termion/-/merge_requests/151).
It also attempts to fix some of the issues with the async stuff by treating the
console/tty as a singleton and controlling access that way.  It also uses
non-blocking io and select on unix to support async and a thread on windows
(similiar to termion's async but with gated access and only one thread ever
started).

Note on redox support: it is removed in this fork.  Without someone to maintain
it it is not viable.  If someone wants to readd and maintain it (should not be
hard- start with termion sys/redox and look at changes in sys/unix) that would
be cool.

**sl-console** is a pure Rust, bindless library for low-level handling, manipulating
and reading information about terminals.

Sl-console aims to be simple and yet expressive. It is bindless, meaning that it
is not a front-end to some other library (e.g., ncurses or termbox), but a
standalone library directly talking to the TTY.

Sl-console is quite convenient, due to its complete coverage of essential TTY
features, providing one consistent API. Sl-console is rather low-level containing
only abstraction aligned with what actually happens behind the scenes.

Sl-console generates escapes and API calls for the user. This makes it a whole lot
cleaner to use escapes.

Supports Mac OS X, BSD, Linux and Windows (or, in general, ANSI terminals).

## Notes on changes from termion
- Adds a console abstraction.  Use con_init() to setup and conin()/conout() to
access the in/read and out/write sides.  These work similiar to stdin()/stdout()
and use reentrant mutexes for locking.
- Raw mode can be entered with conout().raw_mode_on() (or raw_mode_off() to
exit) or with conout().raw_mode_guard().  If using the RAII guard it is not
currently an output object, it will restore normal mode (or whatever mode was
active when it was created) when it is dropped.  Note this requires something
with the ConsoleWrite trait not just Write.  Raw mode may be refined.
- The input console can be accessed non-blocking and can be polled for
readiness (with or without a timeout).
- The console abstraction should have fixed the issues termion had with it's
async input.
- Supports Windows (at least 10 or higher with a console that support ansi
escape codes- any version released in the last several years).

## Notes on threading
Sl-console is thread safe.  Conin/conout are singletons that are protected by
a mutex (a ReentrantMutex from parking lot specifically- why parking lot is a
dependency).  The unix version will not start any threads on it's own, it uses
non-blocking io and select for non-blocking conin.  The Windows version will
start a thread when conin is initialized (usually when con_init() is called but
possibly when conin()/conin_r() is called if that happens first).  This thread
should last for the life of the program and is reading the input console
(CONIN$).  Entering raw mode requires locks on both conin and conout.  It will
not deadlock (uses try_lock() not lock()) so may return a WouldBlock error if
it can not get both locks.  In general you probably want to access the console
from a single thread to avoid issues but it is thread safe.  It just may be
hard to keep input and output straight and entering raw mode once multiple
threads are accessing the console might be tricky (entering raw mode first
would be best).

## A note on stability

This forked crate is not yet stable (too many changes that need to settle).

## Cargo.toml

```toml
[dependencies]
sl-console = { git = "https://github.com/sl-sh-dev/sl-console.git" }
```

## Features

- Raw mode.
- TrueColor.
- 256-color mode.
- Cursor movement.
- Text formatting.
- Console size.
- TTY-only stream.
- Control sequences.
- Termios control.
- Password input.
- Windows 10 support (when console suports ansi escape codes).
- Safe `isatty` wrapper.
- Special keys events (modifiers, special keys, etc.).
- Asynchronous key events.
- Mouse input.
- Detailed documentation on every item.

and much more.

## Examples

### Style and colors.

```rust
use sl_console::*;
use sl_console::{color, style};

use std::io::{stdout, Write};

fn main() {
    // If stdout is the tty/console this will work.
    // Check to make sure stdout is a tty (skipping this will leave escape
    // codes in your output if not a tty/console).
    println!("Direct to stdout:");
    if is_tty(&stdout()) {
        println!("{}Red", color::Fg(color::Red));
        println!("{}Blue", color::Fg(color::Blue));
        println!("{}Blue'n'Bold{}", style::Bold, style::Reset);
        println!("{}Just plain italic", style::Italic);
    } else {
        println!("stdout not a tty!");
    }

    // Alternatively use the console directly.
    // This skips stdout and opens then tty/console directly.
    println!("\nDirect to console:");
    // If con_init() returns an error then there is no tty/console to attach
    // to.  DO NOT call conin()/conout() in this case, they will panic if there
    // is not console.
    con_init().unwrap();
    // The lock below is optional, works like lock() for stdout() and saves
    // each access to conout from needing to lock.  Note the locks in
    // conin/conout are reentrant so it is safe to lock multiple times in the
    // same thread (it won't deadlock).
    let mut conout = conout().lock();
    write!(conout, "{}Red\n", color::Fg(color::Red)).unwrap();
    write!(conout, "{}Blue\n", color::Fg(color::Blue)).unwrap();
    write!(conout, "{}Blue'n'Bold{}\n", style::Bold, style::Reset).unwrap();
    write!(conout, "{}Just plain italic\n", style::Italic).unwrap();
}
```

### Moving the cursor

```rust
use sl_console::*;

use std::io::{stdout, Write};

fn main() {
    // If stdout is the tty/console this will work.
    // Check to make sure stdout is a tty (skipping this will leave escape
    // codes in your output if not a tty/console) and wont clear or goto (1, 1).
    if is_tty(&stdout()) {
        print!("{}{}Stdout Stuff", sl_console::clear::All, sl_console::cursor::Goto(1, 1));
    }
    stdout().flush().unwrap();
    std::thread::sleep(std::time::Duration::from_millis(5000));

    // Alternatively use the console directly.
    // This skips stdout and opens then tty/console directly.
    con_init().unwrap();
    let mut conout = conout();
    write!(conout, "{}{}Console Stuff", sl_console::clear::All, sl_console::cursor::Goto(1, 1)).unwrap();
}
```

### Mouse

```rust
use sl_console::*;
use sl_console::event::{Key, Event, MouseEvent};
use sl_console::input::{TermRead, MouseTerminal};
use std::io::Write;

fn main() {
    con_init().unwrap();
    let mut conout = conout();
    let _raw = conout.raw_mode_guard().unwrap();
    let mut conout = MouseTerminal::from(conout);

    write!(conout, "{}{}q to exit. Click, click, click!", sl_console::clear::All, sl_console::cursor::Goto(1, 1)).unwrap();
    conout.flush().unwrap();

    for c in conin().events() {
        let evt = c.unwrap();
        match evt {
            Event::Key(Key::Char('q')) => break,
            Event::Mouse(me) => {
                match me {
                    MouseEvent::Press(_, x, y) => {
                        write!(conout, "{}x", sl_console::cursor::Goto(x, y)).unwrap();
                    },
                    _ => (),
                }
            }
            _ => {}
        }
        conout.flush().unwrap();
    }
}
```

### Read a password

```rust
use sl_console::*;
use sl_console::input::TermRead;
use std::io::Write;

fn main() {
    con_init().unwrap();
    let mut conout = conout().lock();
    let mut conin = conin().lock();
    // Raw mode so entered text is not echoed back.
    let _raw = conout.raw_mode_guard().unwrap();

    conout.write_all(b"password: ").unwrap();
    conout.flush().unwrap();

    let pass = conin.read_line();

    if let Ok(Some(pass)) = pass {
        conout.write_all(pass.as_bytes()).unwrap();
        conout.write_all(b"\n").unwrap();
    } else {
        conout.write_all(b"Error\n").unwrap();
    }
}
```

## Usage

See `examples/`, and the documentation, which can be rendered using `cargo doc`.

For a more complete example, see [a minesweeper implementation](https://github.com/sl-sh-dev/sl-console/blob/master/examples/minesweeper.rs).  This was ported from [redox games minesweeper](https://gitlab.redox-os.org/redox-os/games/-/tree/master/src/minesweeper).

<img src="image.png" width="200">

## License

MIT/X11.

repository: sl-sh-dev/sl-console

gha_language: Rust

repo_name: sl-sh-dev/sl-console


text:
# AdyenApiJs.Card

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**cvc** | **String** | the card security code which, depending on card brand, is referred to as CVV2/CVC2 (three digits) or CID (4 digits) | [optional]
**expiryMonth** | **String** | the month component of the expiry date (may be left padded with 0 for single digits) |
**expiryYear** | **String** | the year component of the expiry date |
**holderName** | **String** | the cardholder name as printed on the card |
**issueNumber** | **String** | for some UK debit cards only the issue number of the card | [optional]
**_number** | **String** | the card number (without separators) |
**startMonth** | **String** | for some UK debit cards only the month component of the start date | [optional]
**startYear** | **String** | for some UK debit cards only the year component of the start date | [optional]

repository: travelcar/adyen-api-js

gha_language: JavaScript

repo_name: travelcar/adyen-api-js


text:
# Dicoding Submission: Create Android Apps for beginer
 [![Platform](https://img.shields.io/badge/platform-Android-green.svg)](http://developer.android.com/index.html) [![Kotlin](https://img.shields.io/badge/kotlin-1.4.21-orange.svg)](http://kotlinlang.org) [![Gradle](https://img.shields.io/badge/gradle-4.1.1-%2366DCB8.svg)](https://developer.android.com/studio/releases/gradle-plugin)

 ## Apps Feature :
 - List Traditional Dance from Indonesia
 - Detail Traditional Dance with Specific image

 # Libraries Used
 * [Android Support Libraries](https://developer.android.com/topic/libraries/support-library/index.html)
 * [Glide](https://github.com/bumptech/glide)
 * [Material Design](https://material.io/develop/android/docs/getting-started)
 * [Lottie-Android](https://github.com/airbnb/lottie-android)

 # How to Support me ?
 > Just Follow my Github and **star** this repo

 # License
 ```

    Copyright © 2021 Aditiya Ihzar Eka Prayogo

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

 ```


text:
---
title: Known Issues
order: 43
group: Deployment & Configs
---

This guide looks at errors that can appear with {{ site.terms.rir }}. This address most of the common errors we have seen. [Please Contact Us](https://www.rhino3d.com/support) whether any of these options worked or did not work. We are working to minimize any of these messages.

## Unsupported openNURBS

### Problem

When {{ site.terms.rir }} attempts to load, the error below appears.

![]({{ "/static/images/reference/known-issues-unsupported-opennurbs.jpg" | prepend: site.baseurl }}){: class="small-image"}

This normally appears when there is a conflict when an older version of the Rhino file reader (openNURBS) has been loaded in Revit.  This normally happens because:

1. A Rhino 3DM file was inserted into Revit before {{ site.terms.rir }} was loaded. Revit is shipped with a different version of the openNURBS module, and loading a Rhino model into the Revit document before activating {{ site.terms.rir }}, cause the conflict
2. Other third-party Revit plugins that have loaded already, reference the Rhino file reader (openNURBS)

### Workaround

Please follow the instructions on [Submitting Debug Info]({{ site.baseurl }}{% link _en/beta/reference/toubleshooting.md %}#submitting-debug-info) to submit the error and debug information to {{ site.terms.rir }} development team.

Saving the project, then restarting Revit is usually the fastest workaround. If {{ site.terms.rir }} is loaded first, then everything should work with no issues.

Some plugins may need to be updated.  Common conflicts are seen with older versions of:
1. [Conveyer](https://provingground.io/tools/conveyor/)
2. [Avail](https://getavail.com/avail-adds-integration-with-mcneel-rhino-modeler/)
3. [{{ site.terms.pyrevit }} ](https://www.notion.so/pyRevit-bd907d6292ed4ce997c46e84b6ef67a0)

We continue to work with all our partners on this error. Information gathered from the Error Reporting enables us to actively target these conflicts.

## Initialization Error -200

### Problem

When {{ site.terms.rir }} loads, the error below appears.

![]({{ "/static/images/reference/known-issues-error-200.png" | prepend: site.baseurl }})

### Workaround

This normally appears when there is a conflict between Rhino.inside and one or more Revit plugins that have loaded already.

A common conflict is an older version of the {{ site.terms.pyrevit }} plugin.  While the newer versions to {{ site.terms.pyrevit }} do not cause a problem, an older version might.  Information on the {{ site.terms.pyrevit }} site can be found [{{ site.terms.pyrevit }} issue #628](https://github.com/eirannejad/pyRevit/issues/628). To update the older version of {{ site.terms.pyrevit }} use these steps:

  - Download [Microsoft.WindowsAPICodePack.Shell](https://www.nuget.org/packages/Microsoft.WindowsAPICodePack.Shell/) and place under `bin/` directory in pyRevit installation directory. This fix will be shipped with the next pyRevit version

  - DLL is also uploaded here for convenience if you don't know how to download NuGet packages. It's placed inside a ZIP archive for security. Unpack and place under `bin/` directory in pyRevit installation directory. [Microsoft.WindowsAPICodePack.Shell.dll.zip](https://github.com/eirannejad/pyRevit/files/3503717/Microsoft.WindowsAPICodePack.Shell.dll.zip)

If this does not solve the problem, then using the [Search for Conflicting Plugins]({{ site.baseurl }}{% link _en/beta/reference/toubleshooting.md %}#search-for-conflicting-plugins) section.

## JSON Error

### Problem

A Long JSON error shows up as shown below

![]({{ "/static/images/reference/known-issues-error-json.png" | prepend: site.baseurl }})

### Workaround

Like the previous -200 error, this is a conflict with another plugin. See the Error - 200 solution for this problem, and the [Search for Conflicting Plugins]({{ site.baseurl }}{% link _en/beta/reference/toubleshooting.md %}#search-for-conflicting-plugins) section below.


text:
---
title: Lisp in Your Language
layout: post
---

I'm a fan of Lisp programming languages, but there's an incredible conceptual elegance that struggles to materialise as readable elegance for many unfamiliar programmers. The underlying concepts are incredibly simple, but the learning curve can represent a disproportionate challenge.

![Conceptual Elegance](http://i.imgur.com/UZzlqUy.jpg)

## Brief History

Lisp is a derivation of the phrase **Lis**t **P**rocessing. The fundamental idea of the language is that you represent your ideas and constructs as data structures, rather than with structured syntax. Specifically you represent them as lists.

{% highlight clojure %}
(print "Hello world!")
{% endhighlight %}

* Use `(` and `)` to denote lists
* Arguments are space separated
* First item is a function
* Remaining items are the arguments

Constructs you may be used to seeing implemented with special syntax or keywords suddenly become similar to the example above above.

{% highlight clojure %}
(if (= 5 5)
  (print "Sanity!")
  (print "Insanity!"))
{% endhighlight %}

`if` is just a special function that evaluates a condition, if that condition is found to be true, it evaluates the second argument otherwise it evaluates the third argument.

These functions are often known as _special forms_. Core bits of syntax are often implemented as special forms, but there's nothing particularly special about them. You can implement them yourself using macros. [Clojure][1]---like many Lisps---implements many of the core constructs [with macros][2].

We've been writing code to manipulate data for a long time now. When your code is also data, you can write code to manipulate code just as easily.

The essence of this wonder isn't Clojure though. It's not Racket or Scheme either. These are all just different incarnations of the code-as-data idea. These languages certainly aren't the only ones with functions and lists!

What if we could write code-as-data in our language of choice?

## An Experiment
There's a Lisp hidden in many popular programming languages, although it may take a bit of work to uncover it. You may have to do things you won't be proud of, but if you can think of a programming language with lists and [higher-order functions][3], then it will be there. Take Javascript, for example.

{% highlight clojure %}
(print "Hello world!")
{% endhighlight %}

What is stopping us from simply translating the syntax from the above example into Javascript?

{% highlight javascript %}
[alert, 'Hello world!']
{% endhighlight %}

Nothing, except it doesn't do much. It returns an array that contains a function and a string. Just the way Lisp wants. But our Javascript runtimes aren't expecting us to be writing code this way. If it was possible to ask them to try and execute all arrays as though they were functions, there would be chaos.

We're going to have to do a little bit of work to make this happen. Let's define an eval function which will interpret an expression.

{% highlight javascript %}
function eval(expression) {
  // the first item is the function
  var fn = expression[0];

  // the remaining items are the arguments
  var args = expression.slice(1);

  // call the function with these arguments
  return fn.apply(null, args);
}
{% endhighlight %}

And to see it in action:

{% highlight javascript %}
eval([alert, 'Hello world!']);
// alerts 'Hello world!'
{% endhighlight %}

That's it, we've implemented a (very minimal) Lisp. We can try out some other built-in functions too. From now on, the call to `eval` will be omitted from examples for brevity.

{% highlight javascript %}
[parseInt, '4.41'] // 4
[isNaN, 103]       // false
[btoa, 42]         // 'NDI='
{% endhighlight %}

There's a [good reason][4] why our eval function won't work if you try it with `console.log` or `document.write`, so stick to `alert` for now.

## Expressions All The Way Down

![Turtles All The Way Down](http://i.imgur.com/7cx4nBz.jpg)

From here on, we'll refer to the lists in our code as [expressions][8]. This helps distinguish them from list data structures. What happens when we try and evaluate an expression that already contains another expression?

{% highlight javascript %}
[alert, [prompt, "What is your name?"]]
{% endhighlight %}

We get an alert that tries to alert the inner expression as though it was an array. We need to make our eval function understand that if it finds an expression as an argument, it should evaluate it as code, not data.

{% highlight javascript %}
function eval(expression) {
  // the first item is the function
  var fn = expression[0];

  // the remaining items are the arguments
  var args = expression
    .slice(1)
    .map(function(arg) {
      // if this argument is an expression, treat it as code
      if(arg instanceof Array) {
        return eval(arg);
      } else {
        return arg;
      }
    });

  // call the function with these arguments
  return fn.apply(null, args);
}
{% endhighlight %}

Now we've got some recursion in the mix, we're getting somewhere. This function will evaluate every array it finds, no matter how deep into the structure.

{% highlight javascript %}
[alert, [prompt, "What is your name?"]]
{% endhighlight %}

## Syntax & Names
So far, so good, but how would we do Maths?

{% highlight javascript %}
[+, 5, 5]
{% endhighlight %}

Like it or not, this is definitely going to give you a syntax error.

One of the genuine benefits of picking a language that already understands Lisp is that the simplicity of the syntax leaves an abundance of characters to use as identifier names. For instance, in Clojure `+` is just the name of a function that happens to be responsible for adding numbers.

When we want to borrow these transcendental concepts in our syntax heavy languages, we have to do some extra work.

{% highlight javascript %}
function add(a, b) {
  return a + b;
}

[add, 5, 5] // 10
{% endhighlight %}

This is elegant for sure, but there's scope for more mischief here. Try this instead.

{% highlight javascript %}
['+', 5, 5] // Error: '+' is not a function
{% endhighlight %}

Let's define some native functions.

{% highlight javascript %}
var native = {
  '+': function(a, b) {
    return a + b;
  },
  '-': function(a, b) {
    return a - b;
  }
};

[native['+'], 5, 5] // 10
{% endhighlight %}

This ends up feeling verbose, but some tweaks can alleviate it. Pass your native object to eval as a second argument.

{% highlight javascript %}
function eval(expression, native) {
  // the first item is the function or it's name
  var fnName = expression[0];

  // resolve the function from native if necessary
  var fn = typeof fnName === 'string' ? native[fnName] : fnName;

  // the remaining items are the arguments
  var args = expression
    .slice(1)
    .map(function(arg) {
      // if this argument is an expression, treat it as code
      if(arg instanceof Array) {
        return eval(arg, native);
      } else {
        return arg;
      }
    });

  // call the function with these arguments
  return fn.apply(null, args);
}

['+', 5, 5] // 10
{% endhighlight %}

Hopefully, you're wondering why this doesn't feel like the zen of simplicity that is associated with Lisps. And you're right. It's not. But if you wanted simple, then you should ask yourself what on earth are you doing reading about implementing a makeshift lisp in an already confused programming language?

![Makeshift Lisp + Confused Programming Language](http://i.imgur.com/23mGq6v.jpg)

This is a sandbox for us to do unreasonable things in. Missing out on these kinds of hacks would be a wasted opportunity. Go ahead and implement `+`, `-`, `*`, `/`, `=` and any other operators you think might be useful as native functions. We'll use them later on.

## Variables
A language without variables would be difficult, so we'll implement them.

{% highlight js %}
function def(name, value) {
  window[name] = value;
}

[def, a, 5]
{% endhighlight %}

Our `def` function takes a variable name and a value to assign to it, then it binds it onto the `window` object---which is the global scope in Javascript. However, there's a real elephant in the expression. We aren't responsible for resolving the values of variables within the expression. The Javascript implementation is going to do that for us.

It will try to resolve the value of `a`. We haven't declared it, so it will throw an error. Or even worse, if we have declared it, but not initialised it, we'll end up with `undefined` as our name argument. Of course Javascript has an _excellent_ way of dealing with this. Coerce `undefined` to a string, then use it as a key all the same (oh, Javascript...).

Ah well. The obvious solution is to pass the name as a string instead.

{% highlight js %}
[def, 'a', 5]
[alert, ['+', a, a]]
{% endhighlight %}

Great, except it still doesn't work. The second expression is evaluated by the runtime before we get a chance to interpret the first. How did we solve this last time? Use strings instead.

## Scope

{% highlight js %}
[def, 'a', 5]
[alert, ['+', 'a', 'a']]
{% endhighlight %}

Now we have to try and resolve every string argument as a variable. We're also going to have do the same with functions, so that we can use variables as the first item in lists.

Let's bite the bullet and introduce a simple scope, then have all strings refer to values within it. If a string doesn't refer to a value, then we'll just use it's raw value.

Instead of accepting the `native` object as a second argument, accept a `scope` object instead. This way, we can pass our native object in as the root scope object and nothing will break.

{% highlight javascript %}
function eval(rawExpr, scope) {

  // if the expression isn't a list, just return it
  if(!(rawExpr instanceof Array)) {
    return rawExpr;
  }

  // use existing local scope or create a new one
  scope = scope || {};

  // resolve all our new string names from our scope
  var expression = rawExpr.map(function(symbol) {
    if(symbol in scope) {
      return scope[symbol];
    } else {
      return symbol;
    }
  });

  // the first item is the function
  var fn = expression[0];

  // the remaining items are the arguments
  var args = expression
    .slice(1)
    .map(function(arg) {
      // if this argument is an expression, treat it as code
      if(arg instanceof Array) {
        return eval(arg, scope);
      } else {
        return arg;
      }
    });

  // call the function with these arguments
  // and expose scope as this
  return fn.apply(scope, args);
}
{% endhighlight %}

We used the first argument of [`.apply`][5] to expose the scope as `this` to each of our functions. We'll define a new, native version of `def` to show `this` in action (excuse the pun).

{% highlight javascript %}
var native = {
  def: function(name, value) {
    return this[name] = value;
  },
  print: console.log.bind(console)
};
{% endhighlight %}

We can also add a `print` method, just in case you were fed up of using alert. Let's test that out.

{% highlight javascript %}
['print', ['def', 'a', 5]]
{% endhighlight %}

It may not be the most beautiful code you've ever seen, but it works.

## Special Forms

We've got evaluable expressions, but we don't have any way to control them. There's no sense of a conditional statement, a function, or even a way to execute multiple expressions at once.

Our eval function currently tries to interpret every expression it sees. We'll have to denote that some functions are special forms that will handle the evaluation of their own arguments.

{% highlight javascript %}
function SpecialForm(fn) {
  fn.__isSpecialForm__ = true;
  return fn;
}
{% endhighlight %}

Then we'll tweak the eval function, to prevent it from evaluating expressions that are arguments to a special form.

{% highlight javascript %}
// ...
// the first item is the function
var fn = expression[0];

// the remaining items are the arguments
var args = expression
  .slice(1)
  .map(function(arg) {
    // don't evaluate the expression if it is a special form!
    if(arg instanceof Array && (!fn.__isSpecialForm__) {
      return eval(arg, scope);
    } else {
      return arg;
    }
  });
// ...
{% endhighlight %}

## Do

Let's test out our new special forms and implement `do`. It evaluates all of its arguments, which allows us to evaluate multiple expressions in series.

In traditional Lisp:

{% highlight clojure %}
(do
  (print "Hello")
  (print "World!"))
{% endhighlight %}

We'll add it as a new native function.

{% highlight javascript %}
var native = {
  'do': SpecialForm(function() {
    var exprs = [].slice.call(arguments);
    return exprs.reduce(function(_, expr) {
      return eval(expr, this);
    }.bind(this), null);
  }
};
{% endhighlight %}

We can also do a nice trick with [reduce][9] to make sure that the value of the last expression is returned.

Lets translate the example above to our new syntax and watch it run.

{% highlight javascript %}
['do',
  ['print', 'Hello'],
  ['print', 'World!']]

// Hello
// World!
{% endhighlight %}

## If/Else
What good is a programming language without conditionals? The next challenge is implementing if statements. However---with our new special forms---it should be trivial.

{% highlight javascript %}
var native = {
  if: SpecialForm(function(condition, success, failure) {
    var passed = eval(condition, native, this);
    return eval(passed ? success : failure, native, this);
  }
};
{% endhighlight %}

That's it. `if/else` in 3 lines of code.

{% highlight javascript %}
['if', ['=', 3, 3],
  ['print', 'true'],
  ['print', 'false']]

// true
{% endhighlight %}

If this is your first time implementing a Lisp, this should be a special moment. You have implemented conditional control flow as data.

## Functions
Functions are the last hurdle between here and having a language that can actually do things. However, it's quite a hurdle.

Here's what they look like in more conventional Lisps.

{% highlight clojure %}
(def shout
  (fn [name planet]
    (print planet name)))
{% endhighlight %}

This is actually an _anonymous function_ being bound to a local variable with `def`. We already have an implementation of `def` so all we need now is an implementation for `fn`.

Let's break down the arguments to `fn`.

The first one is an list of arguments and the second one is the expression (or function body).

{% highlight javascript %}
var native = {
  fn: SpecialForm(function(defArgs, expr) {
    return function() {
      var callArgs = arguments;

      // create a distinct new scope
      var childScope = Object.create(this);

      // use the arguments definition to bind each call arg
      // to the appropriate scope variable.
      defArgs.forEach(function(argName, index) {
        childScope[argName] = callArgs[index];
      });

      // evalue the function body
      return eval(expr, code, childScope);
    }
  })
};
{% endhighlight %}

There it is. Dynamic binding into a lexical scope. Can we just take a moment to agree that prototypal inheritance rocks, too?

{% highlight javascript %}
['do',
  ['def', 'shout',
    ['fn', ['planet', 'greeting'],
      ['print', 'greeting', 'planet']]],
  ['shout', 'hello', 'world']]

// hello world
{% endhighlight %}

This could definitely be less verbose, so we can take a hint from some other Lisps and create `defn` too.

{% highlight javascript %}
var native = {
  defn: SpecialForm(function(name, args, expr) {
    var fn = native.fn.call(this, args, expr);
    return native.def.call(this, name, fn);
  })
};
{% endhighlight %}

We simply tie together our existing implementation of `def` with `fn`.

{% highlight javascript %}
['do',
  ['defn', 'shout', ['planet', 'greeting'],
    ['print', 'greeting', 'planet']],
  ['shout', 'hello', 'world']]

// hello world
{% endhighlight %}

Much better.

Once a language has functions, [the sky is the limit][6].

{% highlight javascript %}
["defn", "fib", ["n"],
  ["if", [">", "n", 1],
    ["+",
      ["fib", ["-", "n", 1]],
      ["fib", ["-", "n", 2]]],
    1]]
{% endhighlight %}

No self-respecting functional programming demo comes without a horribly inefficient demo of a non-memoized recursive Fibonnaci implementation. This one is no exception.

{% highlight javascript %}
["print", ["fib", 8]]
// 34
{% endhighlight %}

## Considerations
You might have noticed that our code is completely JSON compliant. We use primitives and lists. This means we can actually use JSON as source files for our language.

What? You mean we can embed a language with first class functions _inside JSON_? Yeah, we can.

Our language is still very short on the ground in terms of a standard library. We haven't really considered data structures, namespaces, exceptions, debugging or macros either.

## Conclusion
I'm putting together an implementation of this Javascript Lisp, along with a REPL and a growing set of native functions [on Github][7]. Feel free to use it as a reference. It's important to remember is that this is a toy---a sandbox for learning. It's not meant to be taken seriously and it certainly shouldn't be used in any real systems. It's inefficient and insecure.

Here's a short video of the REPL in action.
<script type="text/javascript" src="https://asciinema.org/a/09hjbv3sudn2iff6gh2gldawx.js" id="asciicast-09hjbv3sudn2iff6gh2gldawx" async></script>

More than anything else, implementing a programming language---no matter how small or strange---is a great way to learn about the language you implement it in. Language design in general is a fairly eye-opening experience and hopefully this has also helped open your eyes to the simple, yet powerful nature of Lisps.

I'll revisit this language again in the future, to talk through the process of implementing macros, then we'll move as much native code as possible inside the language.

Now open your editor and do this again in another language, then [tweet me][10] when you're done!

[1]: http://clojure.org/ "Clojure's Website"
[2]: http://clojure.org/macros "Clojure Macros"
[3]: https://en.wikipedia.org/wiki/Higher-order_function "Wikipedia Higher Order Functions"
[4]: http://stackoverflow.com/questions/12944987/abbreviating-console-log-in-javascript "Abbreviating console.log"
[5]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply "MDN Function.prototype.apply"
[6]: http://www.inf.fu-berlin.de/lehre/WS03/alpi/lambda.pdf "Introduction to the Lambda Calculus"
[7]: https://github.com/danprince/ljsp "danprince/ljsp"
[8]: http://rosettacode.org/wiki/S-Expressions "S-Expressions"
[9]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce "MDN Function.prototype.reduce"
[10]: https://twitter.com/workshydev "Tweet Me"

branch_name: refs/heads/gh-pages


text:
# Porthole

Porthole allows you to configure and build simple automated reports.

## Features

* Easily connect to and query a database.
* Convert query results into Excel workbooks
* Send reports by email

## Getting Started

These instructions will allow you to install and configure your environment. You will be running your first reports after just a couple of steps:

1. Install Porthole.
2. Configure your database connection(s) and other important settings.
3. Run setup scripts (requires database write privileges).
4. Start creating reports.

#### Prerequisites

You must have first installed Python 3.5 or higher. It is recommended but not required to use an environment/package manager such as Anaconda. For more information, see the "Install Conda" section below. At the very least, if you are using a Mac, please do NOT use the "system" Python.

You must also have access to a compatible database (at time of writing, this includes MySQL, PostgreSQL and SQLite) and have CRUD privileges. See "Step 3 - Create database tables" below for more information.

### Step 1 - Install Porthole

Use pip to install Porthole from your command prompt or terminal window:

`pip install porthole`

Porthole will be installed, along with its dependencies, using your default Python or whichever virtual environment you have chosen.

### Step 2 - Configuration

From your terminal window, cd to your project directory. From the Python interpreter, execute the following:

```python
import porthole
porthole.new_config()
```

This function will create a new directory called "config" (if it does not already exist), with a file inside called `config.ini`. This is a blank configuration template containing the basic information necessary to get started. The values defined in this file will be used for any connections you'll make to databases, email servers, and to your file system. The values defined in this section are required for correct functionality.

##### Default

This section currently assumes that you are using OS X but will be updated with instructions for Windows, where relevant.

Required values:
* base_file_path - The default location for saving files. You must define the full, absolute path. On OS X, the path must include a trailing slash.
* query_path - The default location for reading .sql files. This path should be relative to your project directory. On OS X, the path must include a trailing slash.
* database - The name of the default database connection you'd like to use. This should be the section title from a database connection (defined in the next section below).

##### Database Connections

Since any database connection requires several parameters, database configs are defined as their own sections. The parameters required in a given section depend on which RDBMS is being defined. The full list of parameters is as follows:

* Section header - e.g. [Production] - This is a descriptive label which will identify a given connection.
* rdbms - The type of RDBMS. Currently supported options include mysql, postgresql, and sqlite.
* host - The connection string or endpoint. For sqlite, this is the database file name.
* port - Usually defaults to 3306 for mysql. Not used for sqlite but set to 0 by default.
* user - The account name for the database user.
* password - The user's password.
* database - This is for postgresql only. The name of the database to connect to (e.g. `public`).
* schema - The default schema or database name. You should have permissions to create and update tables in this schema.

##### Email

In order to send emails, you must have an email account from which to send messages.

* username - The email address you'd like to use.
* password - The password for that account.
* host - The smtp server associated with your account (e.g. smtp.gmail.com).
* send_from - Optional. If provided, this will override username in your message's metadata, changing the address the message is sent from. This is intended for use with services such as Amazon's Simple Email Service.

### Step 3 - Create database tables

Porthole uses several database tables for report definition and recipient management. To utilize Porthole's full functionality, it is necessary to create these tables before using the package. Note that you can create these tables in a dedicated reporting schema or database if you cannot or do not wish to create tables in the same schema or database as the data you are reporting on. Additionally, you can skip this section and use the lighter-weight `BasicReport` class, which does not require these dedicated tables.

Execute the following:

```python
import porthole
porthole.setup_tables()
```

This creates four tables in your database:

* automated_reports - Stores the reports you have defined. Reports must be uniquely identified by name and can be deactivated by setting the `active` attribute to 0.
* automated_report_contacts - Stores the names and email addresses of individuals who should receive reports.
* automated_report_recipients - This table facilitates the relationship between the previous two. It contains one record per report recipient. Recipients can be defined as 'to' or 'cc' recipients.
* report_logs - By default, reports will log their execution and results to this table (including error details).

### Step 4 - Create reports

Defining a new report involves adding records to the tables created in Step 3.

The following records are required:

| Table                       | Required Attributes                   | Optional Attributes   | Notes                                                                  |
|-----------------------------|---------------------------------------|-----------------------|------------------------------------------------------------------------|
| automated_reports           | report_name; active                   |                       |                                                                        |
| automated_report_contacts   | email_address                         | first_name; last_name |                                                                        |
| automated_report_recipients | report_id; contact_id; recipient_type |                       | Every report requires at least one record where recipient_type = 'to'. |

It's finally time to write an actual report! Here is a sample report script.

```python
from porthole import GenericReport

report = GenericReport(report_name='sample_report', report_title='Sample Report')
report.build_file()
report.create_worksheet_from_query( query={'filename': 'sample_query'},
                                    sheet_name='Sheet1'
                                )
report.subject = 'Sample Report'
report.message = 'Please see attached for the Sample Report.'
report.execute()

```

## Development

#### Setting up your development environment

The information in this section is not necessary for end users. Instead, it is intended to facilitate setup of a development environment for contribution to the Porthole project.

##### Install Conda

Anaconda (commonly shortened to "Conda") is a widely used environment and package manager for Python. Among other useful features, it makes it easy to setup and install prerequisite Python packages (that is, to setup and configure a development environment).

###### OS X Installation Instructions

"Miniconda", which installs only the required packages, is all that is necessary on OS X.

Full instructions can be found here: [https://conda.io](https://conda.io/docs/install/quick.html).

1. Open a terminal session (go to spotlight, type ‘terminal’ and hit enter).
2. Download the 64-bit bash installer for OS X. Make sure to select Python 3.6.
3. Either move the download to your login directory or cd into your Downloads folder.
  * If you don’t know what your login directory is, type the command `cd` followed by `pwd`.
  * If instead you want to cd into your Downloads folder, use the command `cd ~/Downloads`.
4. Enter the following command: `bash Miniconda3-latest-MacOSX-x86_64.sh`
5. Follow the on-screen instructions. Note that you will have to hold the Enter key in order to scroll through the EULA.
6. The installer will ask you where miniconda should be installed, defaulting to your home directory - type “yes” to confirm.
7. The installer will ask whether you’d like to add your selected directory to your bash profile PATH - type “yes” to confirm.

###### Windows Installation Instructions

For Windows users, the more full featured Anaconda may be a better option, as it is more user friendly.

1. Download the Windows installer.
2. Follow the instructions.
3. The installer does not recommend adding Conda to your PATH but doing so will probably make your life easier.

##### Create virtual environment

After Conda is installed, use it to create a virtual environment. The required packages (dependencies) are defined in the environment.yml file. Execute the following command from the terminal:

`conda env create -f environment.yml`

To activate your new environment, execute the following command:

`source activate porthole`

## Running the tests

Execute the command `python run_tests.py`.

## Authors

* **Billy McMonagle** - *Initial work* - [GitHub](https://github.com/speedyturkey)

repository: Chase-H/porthole

repo_name: Chase-H/porthole


text:
# Title

Slitherlink

# Difficulty

Intermediate

# Tags

ASCII art, game

# Description

Slitherlink is a logic puzzle that was first published by Nikoli in Japan. The puzzle consists of a grid of dots, with some clue cells containing numbers. You connect horizontally or vertically adjacent dots to form a meandering path that forms a single loop or "Slitherlink." The loop must not have any branches and must not cross itself. The clue numbers indicate how many lines surround the cell. Empty cells may be surrounded by any number of lines (from 0 to 3).

Remember, the three rules for Slitherlink are:

1. Connect dots with vertical / horizontal line and make one loop,
2. Numbers are the hints to know how many lines can be drawn around it. There may be any number of lines around cells without number,
3. Lines cannot be crossed or branch off.

A simple example would be like this:

    + + + +     +-+-+-+
     3 2 3  =>  |3 2 3|
    + + + +     +-+-+-+

Using dashes `-` and pipes `|` draw the lines to connect the dots.

# Input Description

You'll be given a square of numbers and nodes. The numbers indicate the square and the dots are represented by the `+` sign. Some squares may be blank, that's a wildcard. Example:

    + + + + +
     1 0   1
    + + + + +
     3 3
    + + + + +
         2 2
    + + + + +
     3   1 0
    + + + + +

# Output Description

You should link the dots with a dash `-` or a pipe `|` as needed to satisfy the puzzle. Example:

    + + + + +
     1 0   1
    +-+ +-+-+
    |3|3|   |
    + +-+ +-+
    |    2|2
    + +-+-+ +
    |3|  1 0
    +-+ + + +

# Challenge Input

    + + + + + + + + +
     0 2 3 3 3 2 2 3
    + + + + + + + + +
     2             3
    + + + + + + + + +
     2 2 3         3
    + + + + + + + + +
         1
    + + + + + + + + +
               3
    + + + + + + + + +
     0         0 2 2
    + + + + + + + + +
     2             1
    + + + + + + + + +
     3 1 1 3 2 2 3 1
    + + + + + + + + +

# Challenge Output

    + + +-+ +-+ +-+-+
     0 2|3|3|3|2|2 3|
    + +-+ +-+ + + +-+
     2|       | | |3
    +-+ +-+ + +-+ +-+
    |2 2|3|        3|
    + +-+ + +-+-+-+-+
    | |  1| |
    +-+ + + + +-+ +-+
          | | |3| | |
    + + +-+ +-+ +-+ +
     0  |      0 2 2|
    + +-+ +-+-+ +-+-+
     2|   |   | |  1
    +-+ + +-+ + +-+ +
    |3 1 1 3|2|2 3|1
    +-+-+-+-+ +-+-+ +

# Credit

This puzzle cam from the [New York Times magazine on May 24, 2015](http://krazydad.com/slitherlink/). You can find more slitherlink puzzles on [this website](http://www.kakuro-online.com/slitherlink/).

repository: paralax/ColossalOpera

gha_language: Python

repo_name: paralax/ColossalOpera


text:
analytics-exploration
=====================

Currently just a playground to start experimenting with how we might
build an analytics platform for things like sensor data. The basic
idea to explore is around the interfaces between the creation of
metrics and the ability for others to consume those metrics in real
time, contributing new metrics to the system.

View all metrics:
  http://localhost:11000/metrics

View one metric, including sample data:
  http://localhost:11000/metrics/ekg

Scripts to generate sample data:
  script/generate heartrate 60

Create a subscriber:
  script/subscribe

  The concept of a subscriber is that you provide a URL - we will post
  new events to this URL as they arrive. In practice, this would be
  implemented not with http but with a message queue (e.g. kafka).

Running Locally
===============

rackup consumer/consumer-server.ru -p 10000
rackup consumer/echo-server.ru -p 10001

rackup server/data-server.ru -p 11000

script/subscribe heartrate "http://localhost:10000/events"
script/subscribe ekg "http://localhost:10000/events"

script/subscribe heartattack "http://localhost:10001/events"

script/generate heartrate 60
script/generate ekg 10

Dependencies
============
gem install cuba
gem install json

TODO

Data Size
=========
10k users
1 years of data
160 MB / user /day
58 GB / year / user

ppg signal
  - rate: 500 hertz
  - normalized reading from 0.000 to 1.000

generate:
  - ppg_signal @ 1 / second
  - ppg_signal @ 1 / minute
  - generate heartrate
     --> some math (peak detection)
     --> publish this at 1 / second (trailing 3 seconds)
  - generate heartrate / minute
  - generate heartrate / hour
  - generate heartrate / day
  - generate heartrate / week
  - generate heartrate / month
  - generate heartrate / year

display heartrate for multiple users
  - live per second view
  - view last couple months

Then we invent a new algorithm to compute heartrate... think through
what happens

repository: mbryzek/analytics-exploration

repo_name: mbryzek/analytics-exploration


text:
# Explore.js

This is caching and prefetching middleware for large-scale time series visualization, written completely in JavaScript.

Full-featured aggregated time series data connector for JavaScript charting libraries.

This library makes every charting library able to visualize any amount of data.
It handles communication with server to get proper chunk of data in proper time.

Features:
---------
* loads as few data to the browser as is it required to show good visualization
* automatically picks best aggregation to show to the user
* supports any aggregation (for example raw data every 10s, then min(x), max(x), avg(x) for 30s, 1m, 10m, 30m, 1h, 8h, 12h, 1d, 7d, 30d, 90d, 1y)
* optimized communication with server
* prefetching data to prevent user from waiting
* data cache (every aggregation stored separately)
* fallback to higher aggregation if wanted data is not yet loaded to provide best visual experience (you will see lower resolution for for a while)
* easy integration with any charting library (see explorejs-adapters package)
* React bindings

Use case
-----
* you have 150.000.000 points in your database (50 years of data every 10s)
* you have adequate aggregations (as in the example above)
* you implement simple, but required, REST endpoint on the server (see explorejs-remote-server package)
* you have your charting library (flot, dygraphs, highcharts, jqplot, plotly, visjs, dygraphs, etc...)
* you use *explore.js* to enable unbounded exploration of given time series
* your chart displays few (ie 1000) points at a time, explore.js just tells you what to display
* your browser loads chunks at appriopriate levels

Working demo
---------
_(use mouse wheel and shift key to zoom/pan)_

_works best in Chrome_

http://explorejs.herokuapp.com/scenario/4

Video demonstration (older)
---------
* https://www.youtube.com/watch?v=l993l48-Njw
* https://www.youtube.com/watch?v=b_VRyhak5Xg

How to use it
-------------
First, look at explorejs-tester React application.
This library is under active development, so there is no official tutorial yet.

Questions???
----------
Contact me on twitter https://twitter.com/fl_borovsky or fl.borovsky(at)gmail or raise an issue.

repository: adamborowski/explorejs

repo_name: adamborowski/explorejs


text:
# Nginx config for the simpatico application (DEVELOPMENT)

# description

Essentally the nginx uses locations to direct traffic to the front ends. This means the whole application works off a single domain name with slugs like profile etc

thisdomainname.com/profile

You need to simply adapt this file for the domain name you wish to use and either use ngrok to point to it or se a real domain name with an ssl cert etc

IF YOU ARE LOOKING FOR A PRODUCTION CONFIGURATION PLEASE LOOK AT THE PRODUCTION DIRECTORY

# dev

To run in a dev mode, simply use nginx on the physical machine

```
brew install nginx
brew services start nginx or nginx -c /simpatico/devops/nginx/ngnix.conf
```

# production

The nginx is run as a docker image with a mount to the config profile. Please note, this much be used in conjunction with other docker images for the proxies and a docker compose - otherwise the nginx will not find 'localhost'

```
docker run --name simpatico-nginx -p8080:80 -v ../simpatico/devops/nginx/ngnix.conf:/etc/nginx/nginx.conf:ro -d nginx
```

repository: garydmcdowellperso/simpatico

repo_name: garydmcdowellperso/simpatico


text:
# javatoe
tictactoe in java, with an ai

this is not my best work by any mesure, its a learning project for robo

quite frankly, this code is *bad*

practicing encapsulation, so overkill encapsulation

for the record this is ai in the buzzword sense

## example game:

```
Would you like to be X(first) or O(second) or zero player? (1 or 2 or 0): 2
   |   |
-----------
   |   |
-----------
   |   |

 X |   |
-----------
   |   |
-----------
   |   |

Enter your move(1-9): 3
 X |   | O
-----------
   |   |
-----------
   |   |

 X |   | O
-----------
   |   |
-----------
   |   | X

Enter your move(1-9): 5
 X |   | O
-----------
   | O |
-----------
   |   | X

 X |   | O
-----------
   | O |
-----------
 X |   | X

Enter your move(1-9): 4
 X |   | O
-----------
 O | O |
-----------
 X |   | X

Game over! Ai won!
 X |   | O
-----------
 O | O |
-----------
 X | X | X
```

### kindly ignore

- [x] board object
- [x] print board
- [x] game logic
- [x] player object
- [x] game loop
- [x] ai object
- [ ] ~~minmax instead of random ai~~
- [x] basic state machine ai
- [ ] ~~ensure its unbeatable~~
- [x] choose who goes first

repository: isaec/javatoe

branch_name: refs/heads/main

repo_name: isaec/javatoe


text:
django-sssoon
=============

Django-sssoon is a simple Django app to add beautiful coming soon webpage to your django website. This template is
based on on Bootstrap 3 and designed by [Creative Tim](https://www.creative-tim.com/).

![Screenshot](./docs/images/screencapture.png "Screenshot")

Quick start
-----------
1. django-sssoon is available on the Python Package Index (PyPI), so it can be installed with standard Python tools like `pip` or `easy_install`:

```python
pip install django-sssoon
```

2. Add "sssoon" and "captcha" to your INSTALLED_APPS setting like this:

```python
INSTALLED_APPS = [
    ...
    'captcha',
    'sssoon',
]
```

3. [Sign up for reCAPTCHA](https://www.google.com/recaptcha/intro/index.html), then Add the Google reCAPTCHA keys
generated to your Django production settings with RECAPTCHA_PUBLIC_KEY and RECAPTCHA_PRIVATE_KEY

```python
# https://github.com/praekelt/django-recaptcha
RECAPTCHA_PUBLIC_KEY = "MyRecaptchaKey123"
RECAPTCHA_PRIVATE_KEY = "MyRecaptchaPrivateKey456"
RECAPTCHA_REQUIRED_SCORE = 0.3
```

4.  Collect static files

```python
python manage.py collectstatic
```

6. Start the development server and visit http://<IP_ADDRESS>:8000/

repository: Kingpin-Apps/django-sssoon

repo_name: Kingpin-Apps/django-sssoon


text:
# ServerCommunicator
Simple server communicator for RESTful data source

[ ![Download](https://api.bintray.com/packages/doodeec/maven/server-communicator/images/download.svg) ](https://bintray.com/doodeec/maven/server-communicator/_latestVersion)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.doodeec.utils/serverCommunicator/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.doodeec.utils/serverCommunicator)

[JavaDoc Documentation](http://doodeec.github.io/ServerCommunicator/)

### Description
Library module for communicating with your REST server.
The library provides classes for communicating with REST API, while requests are fully maintainable
(can be cloned to be executed repeatedly, can be cancelled while executing, can be used with custom headers
and custom interceptor) from your app.

### Basic Usage
Import library in your application. Either as a `.aar` file in your `libs` folder
or as a maven dependency.

    dependencies {
        ...
        compile 'com.doodeec.utils:serverCommunicator:1.3.5@aar'
    }

In your code, you can then use it via `ServerRequest` and `ImageServerRequest` classes.

    ServerRequest request = new ServerRequest(BaseServerRequest.RequestType.GET, new BaseRequestListener<MyObject>() {
        @Override
        public void onSuccess(MyObject object) {
            ...
        }

        @Override
        public void onError(RequestError requestError) {
            ...
        }

        @Override
        public void onCancelled() {
            ...
        }

        @Override
        public void onProgress(Integer progress) {
            ...
        }
    }, MyObject.class);
    request.executeInParallel(url);

Both ServerRequest and ImageServerRequest return `CancellableServerRequest` which is an interface
wrapper around AsyncTask `cancel(boolean)` method.

### Request Headers
You can also use custom request headers with `setHeaders` method.

**BEWARE** that this method will add map parameter to existing map. If you want to clear the map,
use `clearHeaders` method before setting your custom headers.

You can also specify response charset, which is **UTF-8** by default, but can be overridden to
any of these:

- ASCII
- US-ASCII
- utf-8
- utf-16
- utf-16be
- utf-16le
- cp1250
- cp852
- iso-8859-1
- iso-8859-2

### SSL
For custom SSL configuration, it is possible to retrieve SSL context defined for HTTPS connections.
You can use static method `getSSLContext` for this purpose.
Another SSL configuration might involve modifying the HostnameVerifier, you can easily set your
own via `setHostNameVerifier(HostnameVerifier)` method.

### GZIP
GZIP is supported by default.

### Response Interceptor
Interceptors can be used for i.e. middleware authentication (handling of expired tokens while preserving
the relative context of the original request)

    request.setInterceptor(new ResponseInterceptor() {
            @Override
            public boolean onProcessStatus(int i) {
                // status code 401
                if (i == HttpURLConnection.HTTP_UNAUTHORIZED) {
                    //authorize
                    return true;    // return true to intercept
                }
                return false;       // return false to continue
            }
        });

### Debugging
To enable debug logs, just use this method (typically in Application object when app is starting)

    ServerRequest.enableDebug(BuildConfig.DEBUG);

### Tips
When using with large data-stream, consider optimizing buffer size. The default size is 2kB

    ServerRequest.setBufferSize(4096);

### License
Released under Apache v2.0 License

### Author
Dusan Bartos

[doodeec@gmail.com](mailto:doodeec@gmail.com)

[doodeec.com](http://doodeec.com)

repository: doodeec/ServerCommunicator

repo_name: doodeec/ServerCommunicator


text:
---
layout: default
---

# 1996-03-15 - Re: Why escrow? (was Re: How would Leahy bill affect crypto

## Header Data

From: "Deranged Mutant"<EMAIL_ADDRESS>To: jim bell<EMAIL_ADDRESS>Message Hash: ea41efa94901e2edf70e8e25db83f8c765237d7d4b4f470c34d663943785a187

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-03-15 00:32:51 UTC

Raw Date: Thu, 14 Mar 1996 19:32:51 -0500

## Raw message

```
{% raw  %}From: "Deranged Mutant"<EMAIL_ADDRESS>Date: Thu, 14 Mar 1996 19:32:51 -0500
To: jim bell<EMAIL_ADDRESS>Subject: Re: Why escrow? (was Re: How would Leahy bill affect crypto
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

On 13 Mar 96 at 9:41, jim bell wrote:
> Notice, however, how the government seems to be assuming that "key escrow"
> (to the extent that it is implemented at all!) gets implemented in a way
> which is "friendly" to government agents.  They assume that there is one key

Since when is the government intentionally going to let any bill or
policy go through that isn't friendly to themselves??? (You don't
have to be an anarchist to figure that out!)

[..]
> Even the most limited planning could easily develop a system that achieves
> all the benefits of escrow for the user, but is essentially impossible for
> government agents (or for that matter, anyone else!) to use to the detriment
> of the user.

Nothing is safe from abuse, by the goverment or non-government fols
alike.  There's always more loopholes to clean up.   (Not that this
means we shouldn't clean them up... obviously bad policies should be
fixed...). Just as no crypto is 100% foolproof, no legal system is
100% abuse-proof.

Rob.

---
Send a blank message with the subject "send pgp-key" (not in
quotes) to<EMAIL_ADDRESS>for a copy of my PGP key.

{% endraw %}
```

## Thread

+ Return to [March 1996](/archive/1996/03)

+ Return to "["Deranged Mutant" <WlkngOwl@UNiX.asb.com>](/authors/deranged_mutant_wlkngowl_at_unix_asb_com_)"

+ 1996-03-15 (Thu, 14 Mar 1996 19:32:51 -0500) - Re: Why escrow? (was Re: How would Leahy bill affect crypto - _"Deranged Mutant"<EMAIL_ADDRESS>


text:
# Simulation of NBA Games

This project will simulate National Basketball Association (NBA) games for the purpose of
predicting the outcomes of real world games. Each game will be repeated 1000 times to
approximate the chance of a particular team winning a match. Predictions will be compared to
Las Vegas odds, FiveThirtyEight, and home court advantage results. Home court advantage
will be used as the baseline for our simulations since historically it predicts winners 60% of the
time. Simulations will use the latest data available, obtaining
real world updated data before each day’s simulation. As a secondary indicator of successful
approximations of game outcomes each game’s spread will be compared to the Las Vegas
spread and the FiveThirtyEight spread. The spread is the number of points a team is predicted
to win by. For example, if the home team is predicted to win by 2 points, then the spread is -2.

# Data Collection
Team and player data will be gathered from stats.nba.com. This is a freely accessible website hosted by the NBA. This site contains a rich set of information, such as the exact location of every shot for every game. Unfortunately, this site does not have a public API, so scripts will be devised for data scraping. Once that data is gathered it will be transformed into data that will allow us to easily calculate various probability distributions. Below is a list of collected data.

* Team Rosters: The team rosters for each of the 30 teams in the NBA. Of particular
importance is the player ID used to store each player’s statistics.
* Player Shooting Log: A record of every shot taken by each player during 2017-2018
regular season. This includes:
   * Made or missed shots.
   * Whether a shot is for 2 points or 3 points.
   * Location on the court.
* Team Per 100 Possession Averages: Contain the averages for the 2017-2018 regular
season. This includes turnovers, offensive rebounds, field goal attempts, and blocked
field goal attempts per 100 possessions.

Each record obtained is saved in comma-separated values (csv) files and stored to the local hard
drive.

# Data Selection
While there is a vast amount of information being tracked for each game in the NBA, only a few
factors where used for our simulations: 100 possessions per team, player shot selection, player
field goal percentages, team turnovers, team blocked shots, team offensive rebounds, and free
throws made. The reasoning behind this decision is that any given team can score an amount
of points that is limited by the number of field goals attempted for any particular game.
Furthermore, field goal attempts are limited by the number of possessions a team has per
game, which are increased with offensive rebounds and decreased with turnovers.

# Probability Distributions
Each team is composed of an official roster containing roughly 16 players.  The roster may fluctuate due to player injuries and may also include players in the G League .  For example, the Warriors current roster contains the following players:

Players | Players
-------|--------------------
Patrick McCaw |	David West
JaVale McGee  |	Quinn Cook
Jordan Bell |	Kevon Looney
Nick Young |	Klay Thompson
Andre Iguodala |	Damian Jones
Chris Boucher |	Omri Casspi
Zaza Pachulia |	Draymond Green
Stephen Curry |	Shaun Livingston
Kevin Durant |

Each player has a record of every shot taken for the current season.

SHOT |	PLAYER_NAME |	EVENT_TYPE |	SHOT_TYPE |	SHOT_ZONE_AREA |	SHOT_ZONE_RANGE
-----|--------------|--------------|--------------|--------------------|------------------------
0 |	Kevin Durant |	Missed Shot |	3PT Field Goal |	Right Side Center(RC) |	24+ ft.
1 |	Kevin Durant |	Missed Shot |	2PT Field Goal |	Center(C) |	8-16 ft.
2 |	Kevin Durant |	Made Shot |	2PT Field Goal | Right Side(R) |	8-16 ft.
3 |	Kevin Durant |	Missed Shot |	2PT Field Goal |	Right Side(R) |	8-16 ft.
4 |	Kevin Durant |	Made Shot |	3PT Field Goal |	Right Side Center(RC) |	24+ ft.
N |	…….. |	…….. |	……..	 |……..|	……...

Using the shooting records and rosters we will calculate each team’s and player’s shooting distributions.
To select which shooter will shoot the ball for any given possession, each player’s total shots are divided by the total shots taken by the entire roster for the current season.

Each player will have a shooting distribution that accounts for all shots taken by that player for the 2017-2018 season.  All shots will be grouped into 15 zones.  These zones will be used to calculate the player’s shooting distribution and accuracy from different locations on the court.  When selecting the shot a player will take, first sample from the player’s percent of total shots, then assigned the probability of making the shot with its respective accuracy.

Distance |	Location|	Percent of Total Shots|	Accuracy
---------|--------------|-----------------------------|----------
Less Than 8 ft.|	Center|	20.2%|	60.8%
8-16 ft.|	Center|	6.3%|	52.3%
8-16 ft.|	Left Side|	3.1%|	44.2%
8-16 ft.|	Right Side|	4.5%|	37.0%
16-24 ft.|	Center	|3.4%	|36.1%
16-24 ft.|	Left Side Center|	3.7%|	41.1%
16-24 ft.|	Left Side|	3.1%	|63.6%
16-24 ft.|	Right Side Center|	5.7%	|41.7%
16-24 ft.|	Right Side|	2.8%|	53.8%
24+ ft.|	Center	|5.8%|	33.8%
24+ ft.	|Left Side Center|	10.6%|	40.4%
24+ ft.	|Left Side|	4.9%|	48.5%
24+ ft.	|Right Side Center|	17.5%|	43.2%
24+ ft.	|Right Side|	8.1%	|40.2%
Back Court|	Back Court	|0.0%	|0.0%

The following is the list of other statistics that will be used that are gathered precomputed by the NBA.

Statistic | Purpose
--------------------|--------------------------------------------
Offensive Rebounding|	Offensive rebounds per 100 possessions
Offensive Blocked Shots	|Shots blocked will attempting a shot per 100 possessions.
Turnovers|	Turnovers per 100 possessions
Free throw|	Free throws per 100 possessions

# Events
The following are all the possible events used in the simulation:

* ****Possession****:  A team has taken possession of the ball.
* ****Pick a Shooter****:  A player is selected to take a shot.
* ****Shot****:  A player shoots the ball.
* ****Turnover****:  Possession is passed to the other team.
* ****Block shot****:  A shot is blocked.
* ****Offensive Rebound****:  A team adds a possession after a missed shot.

# System Initialization
1.	Each team loads its roster.
2.	Player statistics are calcualted and assigned.
3.	Team statistics are loaded.
4.	Set possesion count for each team at 100.
5.	Begin simulation.

# Flow of Events
The simulation will start with Team A possessing the ball.  Next, Team A will have a chance to commit a turnover by sampling from their turnover rate per 100 possessions.  If the ball is not turned over, then a player is selected to shot the ball.  Next, we check whether the shot is going to be blocked by sampling from the teams shots blocked rate per 100 possessions.  If the shot is not blocked, then the shot is taken.  If the shot is blocked, then both teams have a 50% chance of recovering the ball.  The player’s shot location and shooting percentages will be used to determine if the shot goes in.  If the shot goes in, then possession is passed to Team B.  If the shot misses, then we check if Team A recovers an offensive rebound using the per 100 possessions rate.  If Team A does not recover the offensive rebound, then Team B is assumed to recover the defensive rebound.  This process is repeated until all possessions are completed.

![](https://github.com/tony-mtz/nba-simulation/blob/master/doc/bball.png)

repository: iambeaker/nba-simulation

repo_name: iambeaker/nba-simulation


text:
Drizzle JDBC
============
A BSD Licensed JDBC driver for MySQL and Drizzle.

Maven
-----

    <dependency>
        <groupId>org.drizzle.jdbc</groupId>
        <artifactId>drizzle-jdbc</artifactId>
        <version>1.2</version>
    </dependency>

Driver class
------------
`org.drizzle.jdbc.DrizzleDriver`

Connection string
-----------------
`jdbc:drizzle://<user>@<host>:<port>/<database>`

or

`jdbc:mysql:thin://<user>@<host>:<port>/<database>`

Connection options
------------------
Connection options are appended to the connection string, like a http url.

Current supported options are;

* `useSSL=true` - use ssl to connect (you need to do some java ssl magic to get it to work, look at the mysql documentation)
* `serverCertificate=/path/to/certificate` - when using ssl to connect, allow to provide a reference to a certificate file for validating the server
* `allowMultiQueries=true` - allow sending several queries in one round trip to the server
* `connectTimeout=X` - have an X second connection timeout.
* `createDB=true` - create the given database if it does not exist when connecting.
* `enableBlobStreaming=true` - experimental support for PBMS blob streaming.
* `noPrepStmtCache=true` - Disable prepared statement cache.
* `stripQueryComments=false` - Disable prepared statement comments stripping.
* `serverPublicKey=/path/to/publickey` - If sha256 password is used, the public can either be provided in this file or will be fetched directly from the server.
* `enabledProtocols=protocol1,procotol2` - Force SSL protocol version list with a comma separated list with no space. Default is TLSv1,TLSv1.1,TLSv1.2
* `enabledCipherSuites=cipher1,cipher2` - Enable only the given list of ciphers suites for this connection. Default is to allow all cipher suites supported by the running JVM

As of v1.5.11, additional options allow for passing through proxy-protocol specific information:
* `proxyProtocol=false` - enable or disable proxy protocol functionality. Default is false, which disables the feature.
When enabled, the information bellow is passed through as a PROXY header upon connection establishment to the MySQL
server (which must have proxy protocol enabled) according to proxy-protocol v1 spec found here:
http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
Please refer to section 2.1 of this specification for details about individual the individual entries found below:
* `proxyProtocol.tcpVersion`
* `proxyProtocol.clientAddress`
* `proxyProtocol.connectedToIPAddress`
* `proxyProtocol.clientPort`
* `proxyProtocol.localPort`

Building and testing
--------------------
To test you need to have:
* a drizzle server running on localhost:3307
* a mysql server running on localhost:3306

each server also needs to have a database callet `test_units_jdbc` and for the mysql one, full read/write rights to an anonymous user.

To build it without running tests, simply do `mvn -Dmaven.test.skip=true package`


text:
<!--
Please note that issues should be used for bugs and feature
requests. Please post all questions and issues on
https://discuss.elastic.co/c/elasticsearch before opening a GitHub
issue. Your questions will reach a wider audience there, and if we
confirm that there is a bug, then you can open a new issue.

For security vulnerabilities please only send reports to
<EMAIL_ADDRESS>See https://www.elastic.co/community/security for
more information.

Please use **only one** of the following examples depending upon
whether you are reporting a bug or feature request.
-->

<!--
For confirmed bugs, please remove the Feature
Description block and provide responses for **all** of the below items.

* Docker image used
* Operating System
* `docker info` output
* `docker-compose --version`, if relevant
* Steps to reproduce
-->

## Bug Description

<!--
If you are filing a feature request, please remove the above bug
description block and describe the feature below the heading.
-->

## Feature Description

repository: fxdgear/elasticsearch-docker

repo_name: fxdgear/elasticsearch-docker


text:
---
title: Per-Browser Specific Control
taxonomy:
    category: docs
    tag: [gantry4]
---

The Gantry Framework has the ability to load different CSS files based upon which browser and operating system is viewing the template.

Every CSS file can be customized for different browser and operating system combinations with Gantry Framework. This is handy for targeting specific browser issues, such as IE6 compatibility. Each file is automatically loaded by the framework based on which browser/operating system is viewing the template.

How It Works
------------
Gantry looks for filenames based on the following mini-legend:

* __file__: basename of css
* __browser__: [firefox, chrome, safari, opera, iphone (works for both iphone/ipod), ipad, android, unknown]
* __engine__: [trident, gecko, webkit, presto, unknown]
* __longver__: the real long version of the browser (example, IE => 9.0, Safari 5 => 5.0.4, Firefox 5 => <IP_ADDRESS>)
* __shortver__: the major version of the browser (example, if i'm running Safari 5.0.4 would be 5, if i'm running IE 9.0, would be 9)
* __platform__: [iphone (worths for both iphone/ipod), ipad, android, mobile, win, mac, linux, unknown]

Possible Combinations
---------------------
* file.css
* file-**browser**.css
* file-**engine**.css
* file-**platform**.css
* file-**browser**-**platform**.css
* file-browser**shortver**.css [no space between the two]
* file-browser**longver**.css
* file-browser**shortver**-platform.css
* file-browser**longver**-platform.css

Real-World Usage
----------------
Browser-specific control works for **CSS files** only. For Gantry to lookup a specific file based on your browser, there must be a reference to the base CSS file using the Gantry `$gantry->addStyle();`, or the output CSS file of the `$gantry->addLess();` method. In pre-Gantry 4 templates, there was always a reference to load `template.css` so you could use `template-ie8.css` to target **IE8** or `template-chrome-win.css` if you needed to target **chrome on windows** file.

In Gantry 4 templates, there is a special case that enables a custom CSS file to be manually created: `[TEMPLATE]/css/[TEMPLATE]-custom.css`. This file, if found, will automatically be added. You can also use per-browser options on this file, for example `[TEMPLATE]/css/[TEMPLATE]-custom-trident.css`.

Real-World Example
------------------
In the **default gantry template** there is a `global.less` file that is compiled and out to a `master.css` file. If you were using Chrome v21 on a Mac, Gantry would automatically look for the following files in your `[TEMPLATE]/css/` folder:

* master.css
* master-chrome.css
* master-mac.css
* master-webkit.css
* master-chrome-mac.css
* master-chrome21.css
* master-chrome21.0.1180.82.css
* master-chrome21-mac.css
* master-chrome21.0.1180.82-mac.css

repository: gantry/docs

branch_name: refs/heads/develop

gha_language: Twig

repo_name: gantry/docs


text:
---
layout: default
---

# 1997-12-10 - Re: [Censored] Quote of the Day (fwd)

## Header Data

From: John Young<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: d1d080c505ebc98f1040ad3750700a44b6efa13943107ffba43515016505ba1c

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-12-10 01:29:27 UTC

Raw Date: Wed, 10 Dec 1997 09:29:27 +0800

## Raw message

```
{% raw  %}From: John Young<EMAIL_ADDRESS>Date: Wed, 10 Dec 1997 09:29:27 +0800
To<EMAIL_ADDRESS>Subject: Re: [Censored] Quote of the Day (fwd)
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Jim Choate wrote, strictly adhering to permissible topics here:

>You really should try to understand why you cow-tow to 'The Man'....

Where you heading son, what's the hurry, why you messing Texas
highways with this garbage? Not on my watch, Yankee, let me see
paper on this wreck, the vehicle, you. What's that smell?

Anyway, 24 later, I got the rig back, trashed more so, not so different,
the lining had been long gone, so searching it was easy. What was
new were ten bullet holes penetrating side to side, .30 caliber I guess,
and a shotgunned rear window, inside out.

No ticket, no fine, just a reminder of highway justice, on the orderly
property of the State of Texas, lawfully administered by cop, judge
and jury on the spot, for cost saving efficiency.

BTW, any chance your recent system troubles are related to your
threats to law and order? DPS got cooperative service interrupters?
Administering info highway justice.

{% endraw %}
```

## Thread

+ Return to [December 1997](/archive/1997/12)

+ Return to "[John Young <jya@pipeline.com>](/authors/john_young_jya_at_pipeline_com_)"

+ 1997-12-10 (Wed, 10 Dec 1997 09:29:27 +0800) - Re: [Censored] Quote of the Day (fwd) - _John Young<EMAIL_ADDRESS>


text:
# Stand-alone Spark Cluster with Kubernetes

## Set up

Encountered this [issue](https://medium.com/@varunreddydaaram/kubernetes-did-not-work-with-apache-spark-de923ae7ab5c).  This necessitated changing kubernetes service name from `spark-master` to `spark-master-kub`.

### Specify Location of `project` and `data` directories

For the location of Jupyter Notebooks, update the `path:` key with the host directory, in the following:
```
  hostPath:
    path: "/top_level_dir/subdirx/project_dir"
```

in this portion of the `k8s-spark-cluster.yaml` file

```
# Volume containing project source code
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: project-pv-volume
  labels:
    type: local
spec:
  storageClassName: project-dir
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/top_level_dir/subdirx/project_dir"
```

For the location of shared data, update the `path:` key with the host directory, in the following:
```
  hostPath:
    path: "/top_level_dir/subdirx/data_dir"
```

in this portion of the `k8s-spark-cluster.yaml` file

```
# Volume simulating distributed file system
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-pv-volume
  labels:
    type: local
spec:
  storageClassName: spark-data
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/top_level_dir/subdirx/data_dir"
```

## Starting Stand-alone Spark Cluster
Start kubernetes cluster:
```
cd spark-cluster/k8s
kubectl apply -f k8s-spark-cluster.yaml
```

To verify the cluster successfully started, run the `kubectl get all -o=wide` command.
The output should look similar to below.
```
NAME                                 READY     STATUS    RESTARTS   AGE       IP          NODE
pod/pyspnb-client-7fd5b77c56-zwl8p   1/1       Running   0          1m        <IP_ADDRESS>   docker-for-desktop
pod/spark-master-7b4ff7f484-hg9s6    1/1       Running   0          1m        <IP_ADDRESS>   docker-for-desktop
pod/spark-worker1-5468c78c4b-s6vj7   1/1       Running   0          1m        <IP_ADDRESS>   docker-for-desktop
pod/spark-worker2-7d8cb4b589-h22jj   1/1       Running   0          1m        <IP_ADDRESS>   docker-for-desktop

NAME                       TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE       SELECTOR
service/kubernetes         ClusterIP   <IP_ADDRESS>    <none>        443/TCP             10h       <none>
service/pyspnb-client      ClusterIP   None         <none>        8888/TCP,4040/TCP   1m        app=pyspnb-client
service/spark-master-kub   ClusterIP   None         <none>        8080/TCP            1m        app=spark-master
service/spark-worker1      ClusterIP   None         <none>        18081/TCP           1m        app=spark-worker1
service/spark-worker2      ClusterIP   None         <none>        28081/TCP           1m        app=spark-worker2

NAME                            DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE       CONTAINERS      IMAGES               SELECTOR
deployment.apps/pyspnb-client   1         1         1            1           1m        pyspnb-client   spark-pyspnb:2.4.1   app=pyspnb-client
deployment.apps/spark-master    1         1         1            1           1m        spark-master    spark-master:2.4.1   app=spark-master
deployment.apps/spark-worker1   1         1         1            1           1m        spark-worker1   spark-worker:2.4.1   app=spark-worker1
deployment.apps/spark-worker2   1         1         1            1           1m        spark-worker2   spark-worker:2.4.1   app=spark-worker2

NAME                                       DESIRED   CURRENT   READY     AGE       CONTAINERS      IMAGES               SELECTOR
replicaset.apps/pyspnb-client-7fd5b77c56   1         1         1         1m        pyspnb-client   spark-pyspnb:2.4.1   app=pyspnb-client,pod-template-hash=3981633712
replicaset.apps/spark-master-7b4ff7f484    1         1         1         1m        spark-master    spark-master:2.4.1   app=spark-master,pod-template-hash=3609939040
replicaset.apps/spark-worker1-5468c78c4b   1         1         1         1m        spark-worker1   spark-worker:2.4.1   app=spark-worker1,pod-template-hash=1024734706
replicaset.apps/spark-worker2-7d8cb4b589   1         1         1         1m        spark-worker2   spark-worker:2.4.1   app=spark-worker2,pod-template-hash=3847606145
Jim-MacBook-Pro:k8s jim$
```

## Shutdown Stand-alone Spark Cluster
Stop kubernetes cluster:
```
cd spark-cluster/k8s
kubectl delete -f k8s-spark-cluster.yaml
```

## Web Access to the Stand-alone Spark Cluster

Before using the web UIs, kubernetes port forwarding must be established by the following command.
```
cd spark-cluster/k8s
python port_forward_helper.py setup
```

Output from the above should be similar to this:
```
Jim-MacBook-Pro:k8s jim$ python port_forward_helper.py setup
invoke command kubectl port-forward pyspnb-client-69f57c5564-j9gv5 8888 4040
started pid: 4201
invoke command kubectl port-forward spark-master-57fbf6bc58-8qlmc 8080
started pid: 4202
invoke command kubectl port-forward spark-worker1-645bc4765d-bj2b8 18081
started pid: 4203
invoke command kubectl port-forward spark-worker2-767678476-l97g9 28081
started pid: 4204
```

To verify that port forwarding has been established execute this command `ps -ef | grep port-forward`.  Output from
this command should look similar to the following:
```
Jim-MacBook-Pro:k8s jim$ ps -ef | grep port-forward
  501  4201     1   0 10:16PM ttys001    0:00.13 kubectl port-forward pyspnb-client-69f57c5564-j9gv5 8888 4040
  501  4202     1   0 10:16PM ttys001    0:00.12 kubectl port-forward spark-master-57fbf6bc58-8qlmc 8080
  501  4203     1   0 10:16PM ttys001    0:00.13 kubectl port-forward spark-worker1-645bc4765d-bj2b8 18081
  501  4204     1   0 10:16PM ttys001    0:00.12 kubectl port-forward spark-worker2-767678476-l97g9 28081
  501  4216  1573   0 10:16PM ttys001    0:00.00 grep port-forward
```

After establishing port forwarding, the following web UI can be accessed.

|WEB UI|URL|
|------|---|
|PySpark Jupyter Notebook Server|`http://localhost:8888`|
|Spark Master Web UI|`http://localhost:8080`|

Execute the following command to shutdown port-forwarding.
```
cd spark-cluster/k8s
python port_forward_helper.py teardown
```

gha_language: Jupyter Notebook


text:
## iterative closest point (ICP)

[ICP （ Iterative Closest Point ）演算法實作（ C 語言）](http://ivory-cavern.blogspot.tw/2009/11/icp-iterative-closest-point-c.html)
[【3D】迭代最近點算法 Iterative Closest Points](https://blog.csdn.net/xiaowei_cqu/article/details/8470376)

[Iterative Closest Point algorithm for point clouds in Matlab](https://www.youtube.com/watch?v=VoAdXGMzirU)

[ICP(Iterative Closest Point)學習筆記](http://chrisyayu.me/2016/07/07/ICP%28Iterative-Closest-Point%29%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/)

## 其他類似
[Registration Technique for Aligning 3D Point Clouds](https://www.youtube.com/watch?v=Tn0JOVpFWzM)

-----------
[Iterative Closest Point (ICP) for 2D curves with OpenCV](https://www.youtube.com/watch?v=0eBpBxCaYpE)

surface_matching. Surface Matching
[Surface Matching](https://docs.opencv.org/3.0-beta/modules/surface_matching/doc/surface_matching.html)

[ICP 2d Ellipse](https://www.youtube.com/watch?v=tfckXoa-wRQ)
https://github.com/abreheret/icp-opencv

[ethz-asl/libpointmatcher](https://github.com/ethz-asl/libpointmatcher)
[adrelino/mv-lm-icp](https://github.com/adrelino/mv-lm-icp)
[Gregjksmith/Iterative-Closest-Point](https://github.com/Gregjksmith/Iterative-Closest-Point)
[symao/libicp](https://github.com/symao/libicp)
[yorsh87/nicp](https://github.com/yorsh87/nicp)
[michaelwillett/Iterative-Closest-Point](https://github.com/michaelwillett/Iterative-Closest-Point)