text:
# plugman

A command line tool to distribute and package plugins for use with Apache Cordova, nee PhoneGap.

This document defines tool usage and the plugin format specification.

## Design Goals

* Facilitate programmatic installation and manipulation of plugins
* Detail the dependencies and components of individual plugins
* Allow code reuse between different target platforms

## Usage

    plugman --fetch --plugin <directory|git-url|name> [--plugins_dir <directory>]
    plugman --install --platform <ios|android|bb10> --project <directory> --plugin <name> [--plugins_dir <directory>]
    plugman --uninstall --platform <ios|android|bb10> --project <directory> --plugin <name> [--plugins_dir <directory>]
    plugman --remove --plugin <name> [--plugins_dir <directory>]
    plugman --list [--plugins_dir <directory>]
    plugman --prepare --platform <ios|android|bb10> --project <directory> [--plugins_dir <directory>]

* `--fetch`: Retrieves and stores a plugin
* `--install`: Installs an already-`--fetch`'ed plugin into a cordova project
* `--uninstall`: Uninstalls an already-`--install`'ed plugin from a cordova project
* `--remove`: Removes a `--fetch`'ed plugin
* `--list`: Lists all `--fetch`'ed plugins
* `--prepare`: Based on all installed plugins, will set up properly injecting plugin JavaScript code and setting up permissions properly. Implicitly called after `--install` and `--uninstall` commands. See below for more details.

`--plugins_dir` defaults to `<project>/cordova/plugins`, but can be any directory containing a subdirectory for each fetched plugin

Note that `--fetch` and `--remove` deal with the local cache of the plugin's files and don't care about platforms, while `--install` and `--uninstall` require specifying the target platform and the location of the project, and actually do installation of plugin code and assets.

### Supported Platforms

* iOS
* Android
* BB10

### Example Plugins

The plugins found [https://github.com/MobileChromeApps/chrome-cordova/plugins](here) are maintained actively by a contributor to plugman, and should serve as good examples.

## Development

Basic installation:

    git clone https://git-wip-us.apache.org/repos/asf/cordova-plugman.git
    cd cordova-plugman
    npm install -g

Linking the global executable to the git repo:

    git clone https://git-wip-us.apache.org/repos/asf/cordova-plugman.git
    cd cordova-plugman
    npm install
    sudo npm link

## Plugin Directory Structure

A plugin is typically a combination of some web/www code, and some native code.
However, plugins may have only one of these things - a plugin could be a single
JavaScript file, or some native code with no corresponding JavaScript.

Here is a sample plugin named foo with android and ios platforms support, and 2 www assets.

```
foo-plugin/
|- plugin.xml     # xml-based manifest
|- src/           # native source for each platform
|  |- android/
|  |  `- Foo.java
|  `- ios/
|     |- CDVFoo.h
|     `- CDVFoo.m
|- README.md
`- www/
   |- foo.js
   `- foo.png
```

This structure is suggested, but not required.

## plugin.xml Manifest Format

Last edited April 17 2013.

The `plugin.xml` file is an XML document in the plugins namespace -
`http://apache.org/cordova/ns/plugins/1.0`. It contains a top-level `plugin`
element defining the plugin, and children that define the structure of the
plugin.

A sample plugin element:

	<?xml version="1.0" encoding="UTF-8"?>
    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="com.alunny.foo"
        version="1.0.2">

### <plugin> element

The `plugin` element is the top-level element of the plugin manifest. It has the
following attributes:

#### xmlns (required)

The plugin namespace - `http://apache.org/cordova/ns/plugins/1.0`. If the document
contains XML from other namespaces - for example, tags to be added to the
AndroidManifest.xml file - those namespaces should also be included in the
top-level element.

#### id (required)

A reverse-domain style identifier for the plugin - for example, `com.alunny.foo`

#### version (required)

A version number for the plugin, that matches the following major-minor-patch
style regular expression:

    ^\d+[.]\d+[.]\d+$

### <engines> and <engine> elements

The child elements of the `<engines>` element specify versions of
Apache Cordova-based frameworks that this plugin supports. An example:

    <engines>
        <engine name="cordova" version="1.7.0" />
        <engine name="cordova" version="1.8.1" />
        <engine name="worklight" version="1.0.0" />
    </engines>

Similarly to the `version` attribute for the `<plugin>` element,
the version string specified should match a major-minor-patch string
conforming to the regular expression:

    ^\d+[.]\d+[.]\d+$

Engine elements may also have fuzzy matches to avoid repetition, and reduce
maintenance when the underlying platform is updated. A minimum of `>`, `>=`,
`<` and `<=` should be supported by tools, such as:

    <engines>
        <engine name="cordova" version=">=1.7.0" />
        <engine name="cordova" version="<1.8.1" />
    </engines>

plugman will abort plugin installation if the target project does not meet the engine constraints, and exit with a non-zero code.

If no `<engine>` tags are specified, plugman will attempt to install into the specified cordova project directory blindly.

### <name> element

A human-readable name for the plugin. The text content of the element contains
the name of the plugin. An example:

    <name>Foo</name>

This element does not (yet) handle localization.

### <asset> element

One or more elements listing the files or directories to be copied into a
Cordova app's `www` directory. A couple of samples:

    <!-- a single file, to be copied in the root directory -->
    <asset src="www/foo.js" target="foo.js" />
    <!-- a directory, also to be copied in the root directory -->
    <asset src="www/foo" target="foo" />

All assets tags require both a `src` attribute and a `target` attribute.

Web-only plugins would contains mainly <asset> elements.

#### src (required)

Where the file or directory is located in the plugin package, relative to the
`plugin.xml` document.

If a file does not exist at the source location, plugman will stop/reverse the installation process and notify the user, and exit with a non-zero code.

#### target (required)

Where the file or directory should be located in the Cordova app, relative to
the `www` directory.

Assets can be targeted to subdirectories - for instance:

    <asset src="www/new-foo.js" target="js/experimental/foo.js" />

would create the `js/experimental` directory in the `www` directory, if not
present, and then copy the file `new-foo.js` as `foo.js` into that directory.

If a file exists at the target location, plugman will stop/reverse the installation process and notify the user of the conflict, and exit with a non-zero code.

### `<js-module>` element

A typical plugin includes one or more JavaScript files.

In contrast, `<js-module>` tags are much more sophisticated. They look like this:

    <js-module src="socket.js" name="Socket">
        <clobbers target="chrome.socket" />
    </js-module>

With the above example, a call to `plugman --prepare` will copy socket.js to `www/plugins/my.plugin.id/socket.js`. Further, it will add an entry for this plugin to `www/cordova_plugins.json`. At load time, code in `cordova.js` will use an XHR to read this file, inject a `<script>` tag for each Javascript file, and add a mapping to clobber or merge as appropriate (see below).

DO NOT wrap the file with `cordova.define`; this will be added automatically. Your module will be wrapped in a closure, and will have `module`, `exports` and `require` in scope, as normal for AMD modules.

Details for the `<js-module>` tag:

* The `src` points to a file in the plugin directory relative to the `plugin.xml` file.
* The `name` gives the last part of the module name. It can generally be whatever you like, and it only matters if you want to use `cordova.require` to import other parts of your plugins in your JavaScript code. The module name for a `<js-module>` is your plugin's `id` followed by the value of `name`. For the example above, with an `id` of `chrome.socket`, the module name is `chrome.socket.Socket`.
* Inside the `<js-module>` tag there are three legal sub-tags:
    * `<clobbers target="some.value" />` indicates that the `module.exports` will be inserted into the `window` object as `window.some.value`. You can have as many `<clobbers>` as you like. If the object(s) does not exist on `window`, they will be created.
    * `<merges target="some.value" />` indicates that your module should be merged with any existing value at `window.some.value`. If any key already exists, you module's version overrides the original. You can have as many `<merges>` as you like. If the object(s) does not exist on `window`, they will be created.
    * `<runs />` means that your code should be `cordova.require`d, but not installed on the `window` object anywhere. This is useful for initializing the module, attaching event handlers or otherwise. You can only have 0 or 1 `<runs />` tags. Note that including a `<runs />` with `<clobbers />` or `<merges />` is redundant, since they also `cordova.require` your module.
    * An empty `<js-module>` will still be loaded and can be `cordova.require`d in other modules.

If `src` does not resolve to a file that can be found, plugman will stop/reverse the installation, notify the user of the problem and exit with a non-zero code.

### <platform>

Platform tags identify platforms that have associated native code and/or require configuration file modifications. Tools using
this specification can identify supported platforms and install the code into
Cordova projects.

Plugins without `<platform>` tags are assumed to be JS-only, and therefore installable on any and all platforms.

A sample platform tag:

    <platform name="android">
    <!-- android specific elements -->
    </platform>
    <platform name="ios">
    <!-- ios specific elements -->
    </platform>

#### name (required)

The `name` attribute identifies a platform as supported - it also associates the
element's children with that platform.

Platform names should be all-lowercase. Platform names, as arbitrarily chosen,
are listed:

* android
* bb10
* ios
* wp7
* wp8
* windows8

### <source-file>

`source-file` elements identify executable source code that should be installed
into a project. A couple of examples:

    <!-- android -->
    <source-file src="src/android/Foo.java"
                    target-dir="src/com/alunny/foo" />
    <!-- ios -->
    <source-file src="src/ios/CDVFoo.m" />

#### src (required)

Where the file is located, relative to the `plugin.xml` file.

If `src` does not resolve to a file that can be found, plugman will stop/reverse the installation, notify the user of the problem and exit with a non-zero code.

#### target-dir

A directory where the files should be copied into, relative to the root of the
Cordova project.

In practice, this is most important for Java-based platforms, where a file in
the package `com.alunny.foo` has be located under the directory
`com/alunny/foo`. For platforms where the source directory is not important,
plugin authors should omit this attribute.

As with assets, if a `source-file`'s `target` would overwrite an existing file, plugman will stop/reverse the installation, notify the user and exit with a non-zero code.

### <config-file>

Identifies an XML-based configuration file to be modified, where in that
document the modification should take place, and what should be modified.

The `config-file` element only allows for appending
new children into an XML document. The children are XML literals that are the
to be inserted in the target document.

Example:

    <config-file target="AndroidManifest.xml" parent="/manifest/application">
        <activity android:name="com.foo.Foo"
                  android:label="@string/app_name">
                  <intent-filter>
                  </intent-filter>
        </activity>
    </config-file>

#### target

The file to be modified, and the path relative to the root of the Cordova
project.

If this file does not exist, the tool should stop/reverse the installation process, warn the user, and exit with a non-zero code.

#### parent

An absolute XPath selector pointing to the parent of the elements to be added to
the config file.

If the selector does not resolve to a child of the specified document, the tool should stop/reverse the installation process, warn the user, and exit with a non-zero code.

### <plugins-plist>

This is OUTDATED as it only applies to cordova-ios 2.2.0 and below. Use <config-file> tag (same as Android) for newer versions of Cordova.

Example:

    <config-file target="config.xml" parent="/cordova/plugins">
         <plugin name="ChildBrowser"
             value="ChildBrowserCommand"/>
    </config-file>

Specifies a key and value to append to the correct `AppInfo.plist` file in an
iOS Cordova project. Example:

    <plugins-plist key="Foo"
                   string="CDVFoo" />

### <resource-file> and <header-file>

Like source files, but specifically for platforms that distinguish between
source files, headers, and resources (iOS)

Examples:

    <resource-file src="CDVFoo.bundle" />
    <resource-file src="CDVFooViewController.xib" />
    <header-file src="CDVFoo.h" />

### <framework>

Identifies a framework (usually part of the OS/platform) that the plugin depends on.

Examples:

    <framework src="libsqlite3.dylib" />
    <framework src="social.framework" weak="true" />

plugman identifies the framework through the `src` attribute and attempts to add the framework to the Cordova project, in the correct fashion for a given platform.

The optional `weak` attribute is a boolean denoting whether the framework should be weakly-linked. Default is `false`.

### <dependencies> and <dependency>

Identifies dependency of the plugin on another plugin.

Example:

    <dependencies>
        <dependency name="com.facebook.plugin" url="http://plugins.cordova.io" />
        <dependency name="com.adobe.omniture" url="http://plugins.phonegap.com" version="1.0.0" />
    </dependencies>

Dependencies denote other plugins that must be installed in order for the current plugin to work properly.

Two different versions of the same plugin cannot be installed into the same application. If the user attempts to do so, the tooling should error out appropriately and exit with a non-zero code.

Dependent plugins should be fetched first and stored in the user's specified plugins directory (or the default enforced by the tool if none is specified). These plugins are then installed into the user's cordova project, one by one, in a recursive fashion.
If installation of any dependent plugin is not successful, the tool should not proceed with installation of the parent plugin and reverse all changes made to the cordova project by the installation.

#### name

A reverse-style domain identifier, as specified by a plugin in the top-level `plugin` element's `id` attribute.

#### url

URL pointing to a valid cordova plugin "universe."

The tooling should retrieve plugin contents based on a combination of this URL and the `name` attribute, i.e. `url` + '/' + `name`.

If the retrieval URL does not resolve or does not contain a valid plugin.xml file, the tool should error out and exit with a non-zero code.

#### version

Optionally you can specify a version requirement for the plugin dependency. Identical syntax for the `<engine>` element's `version` attribute above should be employed.

### <info>

The tool will provide additional information to users. This is useful when you require some extra steps that can't be easily automated or are out of the scope of plugman.

Examples:

<info>
You need to install **Google Play Services** from the `Android Extras` section using the Android SDK manager (run `android`).

You need to add the following line to your `local.properties`

android.library.reference.1=PATH_TO_ANDROID_SDK/sdk/extras/google/google_play_services/libproject/google-play-services_lib
</info>

## Variables

In certain cases, a plugin may need to make configuration changes dependent on
the target application. For example, to register for C2DM on Android, an app
with package id `com.alunny.message` would need a permission like:

    <uses-permission
    android:name="com.alunny.message.permission.C2D_MESSAGE"/>

In cases like this (where the content inserted from the `plugin.xml` file is
not known ahead of time), variables can be indicated by a dollar-sign and a
series of capital letters, digits and underscores. For the above example, the
`plugin.xml` file would include this tag:

    <uses-permission
    android:name="$PACKAGE_NAME.permission.C2D_MESSAGE"/>

plugman replaces variable references with the
correct value, if specified, or the empty string otherwise. The value of the
variable reference may be detected (in this case, from the `AndroidManifest.xml`
file), or specified by the user of the tool; the exact process is dependent on
the particular tool.

plugman can request users to specify variables required by a plugin. For example API keys for C2M and Google Maps can be specified as a command line argument like so:

    plugman --platform ios|android --project /path/to/project --plugin name|git-url|path --variable API_KEY="!@CFATGWE%^WGSFDGSDFW$%^#$%YTHGsdfhsfhyer56734"

A preference tag will need to be present inside the platform tag to make the variable mandatory like so:

    <preference name="API_KEY" />

plugman should check that these required preferences are passed in, and if not, should warn the user on how to pass the variable in and exit with a non-zero code.

Certain variable names should be reserved - these are listed below.

### $PACKAGE_NAME

The reverse-domain style unique identifier for the package - corresponding to
the `CFBundleIdentifier` on iOS or the `package` attribute of the top-level
`manifest` element in an `AndroidManifest.xml` file.

## Project Directory Structure

TODO: show how the foo plugin example from above will have its files placed in a cordova project after running plugman

## Authors

* Andrew Lunny
* Fil Maj
* Mike Reinstein
* Anis Kadri
* Braden Shepherdson
* Tim Kim

## Contributors

* Michael Brooks

## License

Apache

## TODO

These apply to plugman as well as cordova-cli. Keep the two in step, they both have `future` branches.

These are in rough order of priority, most urgent at the top.

* Fix all the tests, including the www-only tests, which expect the old `www` platform that has been removed. Note that most of the tests will need some rewiring because of the separation of `--fetch` and `--install`. [CB-2814](http://issues.cordova.io/2814). Assigned to Tim.
* Implement a `cordova watch` a la `grunt watch` that will re-run `cordova prepare` every time the installed plugins change (including those installed with `--link`). This is definitely a stretch goal, but it would be awesome. Not assigned but tracked at [CB-2819](http://issues.cordova.io/2819).

repository: ganinaleksei/cordova-plugman

repo_name: ganinaleksei/cordova-plugman


text:
## Steps

- Run `get_ending_pos.py` to generate a `junk.sh` shell script. Each line of
  this shell script will open, move, exit Vim, and record the position in
  `junk`.
- Open `junk` in Vim. Now do `:source generate_hl.vim`. This will convert
  `junk` into a valid highlighting file that Vim can use. Save `junk`.
- Go to `test.txt` (can by any file). Do `:source junk`. Now all of the
  positions are highlighted.

Here is an example limiting to 2 keystrokes:

![](example.png)

## License

CC0.

repository: riceissa/vim-location-highlight

branch_name: refs/heads/master

extension: markdown

license_type: permissive

repo_name: riceissa/vim-location-highlight


text:
**All datasets stored in this folder are downloaded from Outlier Detection DataSets (ODDS): http://odds.cs.stonybrook.edu/#table1**

***If you use any data here, please see ODDS' citation policy:***

_Shebuti Rayana (2016). ODDS Library [http://odds.cs.stonybrook.edu]. Stony Brook, NY: Stony Brook University, Department of Computer Science._

license: MIT

repository: BhuvaneshHingal/LetsUpgrade-AI-ML

path: /PROJECT DAY-1/MAT_Files/ReadMe.md

extension: md

repo_name: BhuvaneshHingal/LetsUpgrade-AI-ML


text:
---
id: 638
title: 'Maximum entropy: a primer and some recent applications'
date: 2014-01-15T03:14:36+00:00
author: Tiago Ramalho
layout: post
guid: http://www.nehalemlabs.net/prototype/?p=638
permalink: /blog/2014/01/15/maximum-entropy-a-primer-and-some-recent-applications/
categories:
  - Science
tags:
  - bayesian
  - information theory
  - physics
  - stochastic calculus
---
I'll let [Caticha](http://arxiv.org/abs/0808.0012) summarize the principle of maximum entropy:

> Among all possible probability distributions that agree with whatever we know select that particular distribution that reflects maximum ignorance about everything else.
Since ignorance is measured by entropy, the method is mathematically implemented by selecting the distribution that maximizes entropy subject to the constraints imposed by the available information.

It appears to have been introduced by Jaynes in 57, and has seen a resurgence in the past decade with people taking bayesian inference more seriously.
(As an aside, Jayne's posthumously published [book](http://www.amazon.com/Probability-Theory-The-Logic-Science/dp/0521592712) is well worth a read, in spite of some cringeworthy rants peppered throughout.) I won't dwell too much on the philosophy as the two previously mentioned sources have already gone into great detail to justify the method.

Usually we consider constraints which are linear in the probabilities, namely we constrain the probability distribution to have specific expectation values.
Consider that we know the expectation values of a certain set of functions $f^k$.
Then, $p(x)$ should be such that

$$\langle f^k \rangle = \int dx \; p(x) f^k(x)$$

 for all k.
Let's omit the notation $(x)$ for simplicity.
Then, we can use variational calculus to find p which minimizes the functional

$$S[p]\; - \alpha \int dx\; p\; - \sum_k \lambda_k \langle f^k \rangle$$

 The constraint with $\alpha$ is the normalization condition and $S$ is the [shannon entropy](https://en.wikipedia.org/wiki/Shannon_entropy).

The solution to this is

$$p = \frac{1}{Z}\exp\left(-\sum_k\lambda_k f^k \right) $$

 with

$$Z=\int dx \; \exp \left(-\sum_k\lambda_k f^k \right)$$

 the partition function (which is just the normalization constant).
Now, we can find the remaining [multipliers](http://en.wikipedia.org/wiki/Lagrange_multiplier) by solving the system of equations

$$-\frac{\partial \log Z}{\partial \lambda_k} = \langle f^k \rangle$$

 I'll let you confirm that if we fix the mean and variance we get a gaussian distribution.
Go on, I'll wait.

## Power law distributions with maxent

I read a [recent paper](http://www.pnas.org/content/110/51/20380.abstract) on PNAS which shows how to use this formalism to derive an intuition on why distributions with power law tails are so ubiquitous.
It is not very well written, but I think I successfully deduced what the authors meant.
Suppose you have a system with a given number of particles, where you 'pay' a fixed price for each particle to join.
If you consider the first one to already be there, the total paid cost is $f(k)=(k-1)\mu$, with mu the chemical potential (now we are talking about discrete states, now the k indexes each state, or rather the number of particles in the cluster).

By bundling every constant into a $\mu^{\circ}$ factor, its not necessary to specify the actual value of the expectation and determine the lagrange multiplier: whatever it is, the distribution will look like $p_k=\frac{\exp(-\mu^{\circ} k)}{Z}$ with this arbitrary $\mu'$ factor (remember Z is just a normalization constant).
This is an exponential distribution, which means events far away from the mean are comparatively very rare.
The authors now propose to look at economies of scale - what if it gets cheaper to add a new particle as the cluster grows? Then, the cost is $k_0\mu/(k+k_0)$, which is a hill type function and where $k_0$ describes how much the cost is spread out with each additional particle.
So the function f becomes $f(k)=\sum_{j=1}^{k-1} k_0\mu/(j+k_0)$ .

You can expand it for large $k$ and get $\Psi \sim \log(k+k_0-1/2)$.
Then the probability distribution is $p_k \sim \left(k+k_0-1/2\right)^{-\mu^{\circ} k_0}$.
Cool.
The authors tested this by fitting $\mu^{\circ}$ and $k_0$ to various datasets with power law distributions, which doesn't really show much more since we already know they are power laws, and the expression they fit is a power law.
The main message here is that you can get a power law from the maximum entropy principle, which suggests a sort of universality among systems brought about by this kind of cost amortization.

In the next post, I'll talk about a more complicated application of the maximum entropy principle to neural codes.


text:
# Paysage API

## Developpement

### Install

`npm install`

### Start the app in dev

`npm start`

### Run tests

- Run all tests

`npm test`

- Run only one tests file

`npm test my_file.test.js`

- Run test into a Docker container

`npm run docker:test`

### Docker

To run the full app in a Docker container :

`docker-compose up --build`

To stop the docker container :

`docker-compose down`

To run the app being sure that everythiing else is down :

`docker-compose down && docker system prune -f && docker-compose up --build`

This run a docker container, with a MongoDB inside and the paysage-api app.

To acces the MongoDB from inside, use host : `mongodb://mongo:27017`.

To acces the MongoDB from outside, use host : `mongodb://<IP_ADDRESS>:27017`.

To access the Elasticsearch from inside, use host : `http://elasticsearch:9200/`.

To access the Elasticsearch from outside, use host : `http://localhost:9200/`.

To access the paysage-api from inside, use host : `http://localhost:3000/`.

To access the paysage-api from outside, use host : `http://localhost:3003/`.

To see the API docs, see : http://localhost:3003/docs/api/.

## Documentation

https://dataesr.stoplight.io/docs/paysage-api-1/95201cd74824d-bienvenue-sur-la-documentation-paysage

## Deployment

To deploy in production, simply run this command from your staging branch :

```sh
npm run deploy --level=[patch|minor|major]
```

:warning: Obviously, only members of the [dataesr organization](https://github.com/dataesr/) have rights to push on the repo.

repository: dataesr/paysage-api

branch_name: refs/heads/main

gha_language: JavaScript

gha_license_id: MIT

repo_name: dataesr/paysage-api


text:
---
layout: page
title: About
permalink: /about/
---

## About Me

I'm Tyrone, I've been doing iOS development professionally since 2008, and
work as the Lead Engineer for cross-platform iOS + Web frontend at a leading
online "E-commerce" business based in Australia.

In my spare time I like to play with:

* Native macOS
* React Native
* TypeScript, Node.js
* RPG Maker / [EasyRPG](https://github.com/easyrpg)
* Rust

## Disclaimer

All opinions on this site are strictly my own and do not reflect the opinions
of my employer. The software powering this website is
[open source](https://github.com/tyrone-sudeium/sudeium_blog) and MIT
licensed. I reserve all copyrights on the post content itself.

gha_language: HTML

gha_license_id: NOASSERTION


text:
[![Maintainability](https://api.codeclimate.com/v1/badges/60ee3ffac2342ecad31a/maintainability)](https://codeclimate.com/github/ranjeet867/ClientOnboarding/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/60ee3ffac2342ecad31a/test_coverage)](https://codeclimate.com/github/ranjeet867/ClientOnboarding/test_coverage)
[![StyleCI](https://styleci.io/repos/109518217/shield?branch=master)](https://styleci.io/repos/109518217)
[![CircleCI](https://circleci.com/gh/ranjeet867/ClientOnboarding.svg?style=svg)](https://circleci.com/gh/ranjeet867/ClientOnboarding)

# ClientOnboarding
Save Client data into csv file

Live Demo : http://<IP_ADDRESS>/clients

## Server Requirements
    PHP >= 7.0.0
    OpenSSL PHP Extension
    PDO PHP Extension
    Mbstring PHP Extension
    Tokenizer PHP Extension
    XML PHP Extension

#### External Library Added

1. Used for laravel forms generation

    `"laravelcollective/html": "^5.5"`

2. Used for csv read and write. It has pagination feature to paginate csv data

    `"league/csv": "^9.0"`

3. Laravel Dusk

    `composer require --dev laravel/dusk`

    `php artisan dusk:install`

## Docker Public Image ranjeet867/laravel5.5-client

**Usage:**

    docker pull ranjeet867/laravel5.5-client
    docker run -p 8181:8181 Laravel5.5-client

#### Third party tools used

1. logentries.com to save logs in cloud
2. codeclimate is used to check code quality
3. Google Cloud Services is used for hosting
4. StyleCI integrations
5. CircleCI Integration
6. Docker

#### In progress

 1. Automated PHPUnit Test

gha_language: PHP


text:
REACT AIR QUALITY

## About

Multi-layer web application to retrieve air quality metrics of a certain region.
It gathers data from a third-party API in real-time, caching the retrieved values for future use.
The main goal of this application was to implement several quality and assurance practises like unit testing, integration testing, functional testing and static code analysis.

## Software architecture

The software architecture of this application is illustrated in the following diagram:

## Technologies

The stack of technologies used on this project is:

* **Frontend:** React
* **Backend:** SpringBoot
* **Database:** *in-memory database* H2
* **Unit and integration testing:** JUnit5 & Mockito
* **Functional testing:** Selenium for Firefox
* **Static-code analysis:** SonarQube
* **Pipeline:** GitHub Actions

## Features

The main features of this application are:

### Get the air quality details of client current location, based on IP address

### List all continents

### List all countries of a specifc continent

### Get the air quality details of a country

### Get the air quality details of a searched region

### Get cache details (number of requests, hits and misses)

## How to run

In order to setup and run this application, just execute the following commands:

```console
$ npm install
$ npm start
```

or

```console
$ npm install
$ npm run build
$ npm serve build
```

## Author

* **Tiago Mendes**: [tiagocmendes](https://github.com/tiagocmendes)

# License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/tiagocmendes/react-air-quality/blob/master/LICENSE.md) file for details.

repository: tiagocmendes/react-air-quality

repo_name: tiagocmendes/react-air-quality


text:
---
layout: post
date:	2015-05-05 04:53:00
title:  Forest Park and Randy Korotev, 300415
tags: [archived-posts]
categories: archives
permalink: /:categories/:year/:month/:day/:title/
---
Email to the MObirds egroup:

Being the Annual Summer Migrant, I did fly in like the others....

but I do wish I didn't need a visa, and could come without luggage! I do realize, though, that if I could fly in on my own wings.... instead of my going out to see the birds, a crowd of people would probably come to look at me.

<lj-cut text="read on if you wish to">

Though a Tour of Duty (with daughter's exams and grandchildren-care) has brought me here, I still did sneak off to attend a presentation on migratory birds by that past master (well, present master too!) Randy Korotev,

read about him

here

He's been watching and documenting birds in Forest Park from 1979. I do like how approachable the experienced birders of St.Louis are.

But prior to that, I walked to the suspension bridge area, where I've sighted so many birds, and of course, I was not disappointed.

First off," there was a Robin "feathering its nest" as Mary Poppins would have said:

I saw a Red-tailed Hawk being mobbed by a crowd of Grackles. Then, at the stream, got a Great Egret

and a Great Blue Heron,

with its lovely breeding plumage

both intent on fish or crawfish snacks. Then the Belted Kingfisher and a couple of Northern Flickers came by,

a pretty dull-looking American Goldfinch male following. An Eastern Phoebe couple

put in an appearance, too, and their typical flycatcher behaviour took me back to my homeland where I have one special patch of wooded road, where, over a period of time, I've sighted no less than 9 types of flycatchers!

The leaves make the wooded areas look beautiful, but it also means that sighting the warblers is a challenge. I did recognize the Yellow-rumped Warblers

but apart from the 3-part call of a Tennessee, I could not identify any of the others. I am not even sure whether they were Vireos or other woodland birds!

I walked over to the Visitors Center, looking at the Starlings nesting,

The "eee-trilllll!" songs of the Red-winged Blackbirds were everywhere.

I enjoyed the bright blue backs of the Tree Swallows.

Here are Red-eared Sliders quite literally practising one-upmanship!

Feeling like a hungry person after a many-course meal, I too dragged my wings as I took off.

At the Visitors Center

I was privileged, indeed, to meet Randy. The more knowledgeable people are, the more friendly and sharing they sometimes seem to be. Given the fact that it was 5pm on a working day, he got a full house, and Amy Witt

had to set more chairs for the audience.

I thoroughly enjoyed the presentation, where Randy talked about the various "dates" he's had, over the years, with short-distance, mid-distance and long-distance migrants.

Whether it was seeing the excellent visuals, finding a detailed printed report and a Forest Park bird checklist both ready to hand (organized by the ever-helpful Amy Witt and Jean Turney, who also set out some welcome coffee and snacks), or the leavening of humor that Randy used, the time just flew past.

I had Mark show me an Oriole nest that Randy passed around...the amount of fishing line used in it is amazing!

Though I wanted to see the Great Horned Owls with Mark, grandmotherly guilt made me walk at a fast pace, back to my daughter's home.

I've put up the list on eBird here:

here

and my usual SMS (Shamelessly Mediocre Shots) are on my FB album,

click here

On Saturday morning I was fortunate enough to go birding (the monthly SLAS/Forest Park Forever bird walk) with Randy and several other very experienced birders ....but that will be my next email, describing the three "lifers" that I got to see!

I'm glad I seem to have landed right at the beginning of the Spring Migration in St.Louis. The weather is gorgeous, and so are the birds!
Can we have the heat and humidity down for a little longer please?

A lovely afternoon in Forest Park, observing and learning...


text:
---
layout: post
title: Multi-Resolution Frontier-Based Planner
subtitle: The exploration algorithm for an autonomous exploration and mapping of the unknown environment.
categories: approach
tags: [github, approach]
---

Proposed multi-resolution frontier-based planner is a real-time capable exploration planner. The planner consists of the algorithm for detecting frontier points, followed by clustering of frontier points and selecting the best frontier point to be explored. Performance is achieved by not relying on data obtained directly from the 3D sensor, but on data obtained by a mapping algorithm. In order to cluster the frontier points, the properties of the Octree environment representation are used, which allows easy analysis with different resolutions.

![](https://www.youtube.com/watch?v=jiDi1lSX7EQ)

The repository for the implemented frontier-based strategy is available on [github](https://github.com/larics/uav_frontier_exploration_3d). If you use this code in a scholarly work, please cite our [journal paper](https://ieeexplore.ieee.org/document/9387089):

> **A Multi-Resolution Frontier-Based Planner for Autonomous 3D Exploration** \
> Ana Batinovic, Tamara Petrovic, Antun Ivanovic, Frano Petric and Stjepan Bogdan (IEEE Robotics and Automation Letters 2021)\

> @ARTICLE{Batinovic-RAL-2021,
  author={Batinovic, Ana and Petrovic, Tamara and Ivanovic, Antun and Petric, Frano and Bogdan, Stjepan},
  journal={IEEE Robotics and Automation Letters},
  title={A Multi-Resolution Frontier-Based Planner for Autonomous 3D Exploration},
  year={2021},
  volume={6},
  number={3},
  pages={4528-4535},
  doi={10.1109/LRA.2021.3068923}}

The frontier-based exploration planner is capable of autonomously exploring a previously unknown area, creating an occupancy grid map using Cartographer SLAM and generating an OctoMap. The planner does not require any prior knowledge of the environment, except for boundaries of the area to be explored. The planner may be applied to both indoor and outdoor environments.

It ensures frontiers detection, clustering and selection of the best frontier (a new target point). In each iteration, map and OctoMap are updated. Frontiers are clustered and a new target point is selected only when the prevoius target is reached.

The best frontier point to be visited is determined by estimating the benefit of the information gathered by visiting a candidate frontier point. The exploration loop is closed with an autonomous navigation to the selected frontier point, using the map generated through the exploration for trajectory planning and localization. Furthermore, the planner maintains a occupancy map of the environment. This guarantees that paths are only planned within free space, while giving a notion on exploration progress.

## Installation Instructions

### Prerequisites
* This package is tested on [Ubuntu 18.04](http://old-releases.ubuntu.com/releases/18.04.3/), it is assumed you have it installed.
* This package requires the installation of [ROS Melodic](http://wiki.ros.org/melodic/Installation/Ubuntu) (tested). Refer to the [ROS tutorials](http://wiki.ros.org/ROS/Tutorials) for further information.

### Installation

Detailed installation instructions to close the loop with the frontier-based exploration planner includes:
*  **Gazebo simulation of Ardupilot/PX4 UAV platform**
*  **Cartographer SLAM**
*  **Path planning and navigation**
*  **Frontier-based exploration planner**

Please refer to [Installation Instructions on Github Wiki](https://github.com/larics/uav_frontier_exploration_3d/wiki/Installation-Instructions) to install Gazebo simulation of Ardupilot/PX4 UAV platform, Cartographer SLAM, path planning and navigation module and frontier-based exploration planner.

## Exploration in progress
During an unknown area exploration, the frontier-based planner publishes data on a number of topics. The ROS package RViz is used in order to visualize map, voxels (free and occupied) and paths.

Frontier points are marked red, candidates (clustered points) are yellow while the best frontier voxel is marked pink. The UAV planned a path (green) to the best frontier voxel (target point). OctoMap of the environment is updated in each iteration.

The house environment in both Gazebo simulator and RViz:

## Results

## Credits

The exploration algorithm was developed by [Ana<EMAIL_ADDRESS>with the help and support of the members of the [LARICS](https://larics.fer.hr/).


text:
# GEMINI

[![DOI](https://zenodo.org/badge/146920930.svg)](https://zenodo.org/badge/latestdoi/146920930)
![gcc](https://github.com/gemini3d/gemini/workflows/ci/badge.svg)
[![intel-oneapi](https://github.com/gemini3d/gemini3d/actions/workflows/intel-oneapi.yml/badge.svg)](https://github.com/gemini3d/gemini3d/actions/workflows/intel-oneapi.yml)

The GEMINI model (*G*eospace *E*nvironment *M*odel of *I*on-*N*eutral *I*nteractions) is a three-dimensional ionospheric fluid-electrodynamic model written (mostly) in object-oriented fortran (2008+ standard).  GEMINI is used for various scientific studies including:

* effects of auroras on the terrestrial ionosphere
* natural hazard effects on the space environment
* effects of ionospheric fluid instabilities on radio propagation

The detailed mathematical formulation of GEMINI is included in
[GEMINI-docs](https://github.com/gemini3d/GEMINI-docs).
A subroutine-level set of
[inline generated](./docs/Readme_docs.md)
documentation describing functions of individual program units is given via source code comments which are
[rendered as webpages](https://gemini3d.github.io/GEMINI/).
GEMINI uses generalized orthogonal curvilinear coordinates and has been tested with dipole and Cartesian coordinates.
Please open a
[GitHub Issue](https://github.com/gemini3d/gemini/issues)
if you experience difficulty with GEMINI.

Generally, the Git `main` branch has the current development version and is the best place to start, while more thoroughly-tested releases happen regularly.
Specific releases corresponding to published results are generally noted in the corresponding journal article.

## Platform agnostic

Gemini is OS / CPU arch / platform / compiler agnostic.
Operating system support includes Linux, MacOS, and Windows.
CPU arch support includes Intel / AMD, ARM and IBM POWER.
GEMINI can run on hardware ranging from a Raspberry Pi to laptop to a high-performance computing (HPC) cluster.
One could run large 2D or very small 3D simulations (not exceeding a few million grid points) on a quad-core workstation, but may take quite a while to complete.

For large 3D simulations (more than 20M grid points), GEMINI should be run in a cluster environment or a "large" multi-core workstation (e.g. 12 or more cores).
Runtime depends heavily on the grid spacing used, which determines the time step needed to insure stability,
For example we have found that a 20M grid point simulations takes about  4 hours on 72 Xeon E5 cores.  200M grid point simulations can take up to a week on 256 cores.
It has generally been found that acceptable performance requires > 1GB memory per core; moreover, a large amount of storage (hundreds of GB to several TB) is needed to store results from large simulations.

## Quick start

To build Gemini and run self-tests takes about 10 minutes on a laptop.

Requirements:

* Fortran 2008 compiler. See [compiler help](./docs/Readme_compilers.md) if needed.
  * Gfortran / GCC ≥ 7
  * Intel oneAPI HPC Toolkit (free to use for all)
* [CMake](https://cmake.org/download/): if your CMake is too old, update by running `cmake -P scripts/install_cmake.cmake` or from Python `pip install cmake`
* Git: the Gemini3D software stack uses Git to version lock reproducible builds.

Recommended:

* MPI: any of OpenMPI, IntelMPI, MPICH, MS-MPI. See [MPI help](./docs/Readme_mpi.md) if needed. Without MPI, Gemini3D uses one CPU core only.
* [Ninja](https://ninja-build.org/) will build/rebuild much faster than GNU Make for any software project. `cmake -P scripts/install_ninja.cmake`

1. get the Gemini code

  ```sh
  git clone https://github.com/gemini3d/gemini3d.git

  cd gemini3d
  ```
2. Build Gemini and run self-test

  ```sh
  cmake -B build

  cmake --build build
  ```

Non-default [build options](./docs/Readme_cmake.md) may be used.

GEMINI has self tests that compare the output from a "known" test problem to a reference output.
To help ensure successful simulations, run the self-tests:

```sh
ctest --test-dir build
```

## How to setup a sim

1. make a [config.nml](./docs/Readme_input.md) with desired parameters for an equilibrium sim.
2. run the equilibrium sim:

    ```sh
    python -m gemini3d.run /path_to/config_eq.nml /path_to/sim_eq/
    ```
3. create a new config.nml for the actual simulation and run

    ```sh
    python -m gemini3d.run /path_to/config.nml /path_to/sim_out/
    ```

### Windows

Occasionally on Windows you may get a system error code `0xc0000005` when trying to run Gemini.
This typically requires rebooting the Windows computer.
If this is annoying, please let us know--it happens rarely enough that we're not sure if it's a Microsoft MPI bug or something else.

## Prerequisites

Gemini uses CMake build system to automatically build the entire software library stack,
checking for compatibility of pre-installed libraries such as Lapack, Scalapack and MUMPS.

### Libraries

Libraries are auto-built by Gemini when building gemini.bin.
These will generally yield faster Gemini runtime, since they were optimized for the CPU on your hardware.
If it's desired to use:

* system libraries: [PyGemini scripts/install_prereqs.py](https://github.com/gemini3d/pygemini)
* build/install libraries: `python -m gemini3d.prereqs`

## Known limitations and issues of GEMINI

1. Generating equilibrium conditions can be a bit tricky with curvilinear grids.  A low-res run can be done, but it will not necessary interpolate properly onto a finer grid due to some issue with the way the grids are made with ghost cells etc.  A workaround is to use a slightly narrower (x2) grid in the high-res run (quarter of a degree seems to work most of the time).
2. Magnetic field calculations on an open 2D grid do not appear completely consistent with model prototype results; although there are quite close.  This may have been related to sign errors in the FAC calculations - these tests should be retried at some point.
3. Occasionally MUMPS will throw an error because it underestimated the amount of memory needed for a solve.  If this happens a workaround is to add this line of code to the potential solver being used for your simulations.  If the problem persists try changing the number to 100.

    ```fortran
    mumps_par%ICNTL(14)=50
    ```
4. There are potentially some issues with the way the stability condition is evaluated, i.e. it is computed before the perp. drifts are solved so it is possible when using input data to overrun this especially if your target CFL number is > 0.8 or so.  Some code has been added as of 8/20/2018 to throttle how much dt is allowed to change between time steps and this seems to completely fix this issue, but theoretically it could still happen; however this is probably very unlikely.
5. Occasionally one will see edge artifacts in either the field -aligned currents or other parameters for non-periodic in x3 solves.  This may be related to the divergence calculations needed for the parallel current (under EFL formulation) and for compression calculations in the multifluid module, but this needs to be investigated further...  This do not appear to affect solutions in the interior of the grid domain and can probably be safely ignored if your region of interest is sufficiently far from the boundary (which is always good practice anyway).

## Command-line options

By default, only the current simulation time and a few other messages are shown to keep logs uncluttered.
gemini.bin command line options include:

`-d` | `-debug`
: print verbosely -- could be 100s of megabytes of text on long simulation for advanced debugging.

`-nooutput`
: do not write data to disk. This is for benchmarking file output time, as the simulation output is lost, so this option would rarely be used.

`-out_format`
: normally Gemini reads and writes data files in the same format (HDF5, NetCDF4). This option allow one to read in one format (say NetCDF4) while writing HDF5.

* `h5`: HDF5 output (most commonly used)
* `nc`: NetCDF4 output
* `dat`: raw binary output (not recommended, doesn't support newer features)

`-manual_grid <# x2 images> <# x3 images>`
: forces the code to adopt a specific domain decomposition in x2 and x3 by using the integers given.  If not specified the code will attempt to find its own x2,x3 decomposition.  The number of grid points in x2 and x3 must be evenly divisible by the number of user-specified images in each direction, respectively.

`-dryrun`
: only run the first time step, do not write any files. This can be useful to diagnose issues not seen in unit tests, particularly issues with gridding. It runs in a few seconds or less than a minute for larger sims, something that can be done before queuing an HPC job.

### Number of MPI processes

In general for MPI programs and associated simulations, there may be a minimum number of MPI processes and/or integer multiples that must be met.
The build system generation process automatically sets the maximum number of processes possible based on your CPU core count and grid size.

This can also be done via `python -m gemini3d.run -np` options.

```sh
mpiexec -np <number of processors>  build/gemini.bin <output directory>
```

for example:

```sh
mpiexec -np 4 build/gemini.bin ~/mysim3d/arecibo
```

## Input file format

See [Readme_input](./docs/Readme_input.md)

## Loading and plotting output

GEMINI uses Python for essential interfaces, plotting and analysis.
Matlab scripts relevant to Gemini to
[mat_gemini repo](https://github.com/gemini3d/mat_gemini).

Only the essential scripts needed to setup a simple example, and plot the results are included in the main GEMINI repository.
The [Gemini-scripts](https://github.com/gemini3d/GEMINI-scripts)
and
[Gemini-examples](https://github.com/gemini3d/GEMINI-examples)
contain scripts used for various published and ongoing analyses.

See [Readme_output](./docs/Readme_output.md) for a description of how to load the simulation output files and the different variable names, meanings, and units.

An auxiliary program, magcalc.f90, can be used to compute magnetic field perturbations from a complete disturbance simulation.  See [Readme_magcalc](./docs/Readme_magcalc.md) for a full description of how this program works.

## List of other associated Readmes

1. [Readme_output](./docs/Readme_output.md)
2. [Readme_input](./docs/Readme_input.md)
3. [Readme_compilers](./docs/Readme_compilers.md)
4. [Readme_cmake](./docs/Readme_cmake.md)
5. [Readme_docs](./docs/Readme_docs.md)
6. [Readme_mpi](./docs/Readme_mpi.md)
7. [Readme_magcalc](./docs/Readme_magcalc.md)
8. [Readme_VEGA](./docs/Readme_VEGA.md)


text:
# Block Operators

Operators can be composed together to form new higher-order block matrices. For example, consider the following block matrix.
$$
\mathbf{M} =
\begin{bmatrix}
\mathbf{A}^{(1)} \otimes \mathbf{A}^{(2)} & \mathbf{I} \\
\mathbf{I} & \mathbf{B}^{(1)} \oplus \mathbf{B}^{(2)}
\end{bmatrix}
$$
We can create a representation of this matrix using the [`KroneckerBlock`](../../api/kroneckerblock) class.

```python
import numpy as np
from pykronecker import KroneckerProduct, KroneckerSum, KroneckerIdentity, KroneckerBlock

Ns = (200, 300)

As = [np.random.normal(size=(N, N)) for N in Ns]
Bs = [np.random.normal(size=(N, N)) for N in Ns]

M11 = KroneckerProduct(As)
M12 = KroneckerIdentity(tensor_shape=Ns)
M21 = KroneckerIdentity(tensor_shape=Ns)
M22 = KroneckerSum(Bs)

M = KroneckerBlock([[M11, M12],
                    [M21, M22]])
```

This operator `M` can now act on vectors of shape `(200 * 300 * 2, )`

```python
x = np.random.normal(size=200 * 300 * 2)

print(M @ x)
```

Block operators can also be composed of a mixture of [`KroneckerOperator`](../../api/kroneckeroperator)s and NumPy arrays. Consider a the following block matrix
$$
\mathbf{L} =
\begin{bmatrix}
\mathbf{A}^{(1)} \otimes \mathbf{A}^{(2)} & \mathbf{C} \\
\mathbf{C}^\top & \mathbf{I}_{(5 \times 5)}
\end{bmatrix}
$$
This operator, which acts on vectors of shape `(200 * 300 + 5)`, can be constructed as follows.

```python
M11 = KroneckerProduct(As)
C = np.random.normal(size=(200 * 300, 5))
I = np.eye(5)

L = KroneckerBlock([[M11, C],
                    [C.T, I]])

y = np.random.normal(size=(200 * 300 * 5))

print(L @ y)
```

For convenience, there is also a [`KroneckerBlockDiag`](../../api/kroneckerblockdiag) class which creates block diagonal operators. For example, consider the following block diagonal matrix.
$$
\mathbf{P} =
\begin{bmatrix}
\mathbf{A}^{(1)} \otimes \mathbf{A}^{(2)} & \mathbf{0} \\
\mathbf{0}^\top & \mathbf{I}_{(5 \times 5)}
\end{bmatrix}
$$
This can be created as follows.

```python
from pykronecker import KroneckerBlockDiag

M11 = KroneckerProduct(As)
I = np.eye(5)

L = KroneckerBlockDiag([M11, I])

y = np.random.normal(size=(200 * 300 * 5))

print(L @ y)
```

gha_language: Python


text:
WARNING: THIS IS A DEPRECATED EXPERIMENT
========================================

Please consider using [Danslo_Aop](https://github.com/danslo/Danslo_Aop) instead!

Danslo_LibraryRewrite
=====================

Why?
----

Please read [this](http://magento.stackexchange.com/questions/38555/modern-way-of-rewriting-lib-files) StackExchange post. In short: How magento is currently set up, we cannot change libraries and/or abstract classes without copying them entirely to an earlier loaded codepool (basically, include path) and editing them there.

How does it work?
------------------

1. We register an autoloader.
2. While loading a class, the autoloader checks Magento configuration to see if you have any library rewrites configured.
3. When you do, it will:
    - Wrap the class in a namespace.
    - Replace extends for that class to use the global namespace (to prevent the Magento autoloader from choking).
    - Do the same for static property or class constant lookups (damn that Magento autoloader).
    - Stick this class in a temporary folder (currently ``var/tmp/library_rewrite``).
    - Include the (namespaced) class.
    - Include your (non-namespaced) class.
4. You can now extend from the namespaced class and only change *some* of the functionality.

Installing
----------

1. If composer is not already installed, [do so](https://getcomposer.org/download/).
2. Create a ``composer.json`` with the following (or similar) contents:

```json
{
    "require": {
        "danslo/libraryrewrite": "~1.0.0"
    },
    "extra": {
        "magento-root-dir": "htdocs/"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/danslo/LibraryRewrite.git"
        }
    ]
}
```

Finally, issue the ``composer install`` command.

Registering rewrites
--------------------

- Create an ordinary Magento module that depends on ``Danslo_LibraryRewrite``.
- In your ``config.xml``, add something like:

```xml
<?xml version="1.0"?>
<config>
    <global>
        <libraries>
            <rewrite>
                <The_Library_Class_To_Rewrite>YourNamespace_YourModule</The_Library_Class_To_Rewrite>
            </rewrite>
        </libraries>
    </global>
</config>
```

- Create a file in ``app/code/<YourCodePool>/<YourNamespace>/<YourModule>/lib/<PathToTheLibrary>``.
- The contents of the class should itself live in global namespace and extend from the Magento namespace:

```php
<?php

class The_Library_Class_To_Rewrite extends Magento\The_Library_Class_To_Rewrite
{
    // Rewrite any method in here.
}
```

License
-------

The MIT License (MIT)

Copyright (c) 2014 Daniel Sloof

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

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

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

repository: danslo/LibraryRewrite

repo_name: danslo/LibraryRewrite


text:
# Fibered Auto-Encoders

Paper can be found here: https://arxiv.org/abs/2005.07852

## Implementation of Fibered Auto-Encoders (FAEs)

FAE are Auto Encoders whose space of latent variables have a fiber bundle structure. This implementation acts as a proof of concept and aims at illustrating the concept.

This repository contains all code for creating and training FAEs.

  * Examples in the form of Jupyter notebooks are available in the the folder: **/demos**.
  * Model hyper-parameters can be found in a human readable format in: **/demos/configuration**.

Examples for representation, generation and denoising cover standard machine learning datasets: MNIST, Olivetti, Blobs. As well single-cell sequencing data, in that case we show how FAEs can be used to batch-correct data from several experiments.

## Installation

This package has only been tested on Ubuntu machines running python 3.7. We highly recommend installing the package in a fresh Anaconda environment.

To create the environment we used:

```conda create -n fae python=3.7```

Then to activate it:

```conda activate fae```

To install the package go inside the package folder and install it using:

```python setup.py develop```

If you are running miniconda and want to run the notebooks, you further need to install jupyter lab:

```conda install -c conda-forge jupyterlab```

You may also need to install ipywidgets for progress bars to work.

```conda install -c conda-forge ipywidgets```

repository: FZ-hajji/FiberedAE

repo_name: FZ-hajji/FiberedAE


text:
###Binary Files
Binary files are very similar to arrays of structures, except the structures are in a disk file rather than in an array in memory. Because the structures in a binary file are on disk, you can create very large collections of them (limited only by your available disk space). They are also permanent and always available. The only disadvantage is the slowness that comes from disk access time.
Binary files have two features that distinguish them from text files:
You can jump instantly to any structure in the file, which provides random access as in an array.
You can change the contents of a structure anywhere in the file at any time.
Binary files also usually have faster read and write times than text files, because a binary image of the record is stored directly from memory to disk (or vice versa). In a text file, everything has to be converted back and forth to text, and this takes time.
C supports the file-of-structures concept very cleanly. Once you open the file you can read a structure, write a structure, or seek to any structure in the file. This file concept supports the concept of a file pointer. When the file is opened, the pointer points to record 0 (the first record in the file). Any read operation reads the currently pointed-to structure and moves the pointer down one structure. Any write operation writes to the currently pointed-to structure and moves the pointer down one structure. Seek moves the pointer to the requested record.
Keep in mind that C thinks of everything in the disk file as blocks of bytes read from disk into memory or read from memory onto disk. C uses a file pointer, but it can point to any byte location in the file. You therefore have to keep track of things.
The following program illustrates these concepts:
#include <stdio.h>

/* random record description - could be anything */
struct rec
{
    int x,y,z;
};

/* writes and then reads 10 arbitrary records
   from the file "junk". */
int main()
{
    int i,j;
    FILE *f;
    struct rec r;

    /* create the file of 10 records */
    f=fopen("junk","w");
    if (!f)
        return 1;
    for (i=1;i<=10; i++)
    {
        r.x=i;
        fwrite(&r,sizeof(struct rec),1,f);
    }
    fclose(f);

    /* read the 10 records */
    f=fopen("junk","r");
    if (!f)
        return 1;
    for (i=1;i<=10; i++)
    {
        fread(&r,sizeof(struct rec),1,f);
        printf("%d\n",r.x);
    }
    fclose(f);
    printf("\n");

    /* use fseek to read the 10 records
       in reverse order */
    f=fopen("junk","r");
    if (!f)
        return 1;
    for (i=9; i>=0; i--)
    {
        fseek(f,sizeof(struct rec)*i,SEEK_SET);
        fread(&r,sizeof(struct rec),1,f);
        printf("%d\n",r.x);
    }
    fclose(f);
    printf("\n");

    /* use fseek to read every other record */
    f=fopen("junk","r");
    if (!f)
        return 1;
    fseek(f,0,SEEK_SET);
    for (i=0;i<5; i++)
    {
        fread(&r,sizeof(struct rec),1,f);
        printf("%d\n",r.x);
        fseek(f,sizeof(struct rec),SEEK_CUR);
    }
    fclose(f);
    printf("\n");

    /* use fseek to read 4th record,
       change it, and write it back */
    f=fopen("junk","r+");
    if (!f)
        return 1;
    fseek(f,sizeof(struct rec)*3,SEEK_SET);
    fread(&r,sizeof(struct rec),1,f);
    r.x=100;
    fseek(f,sizeof(struct rec)*3,SEEK_SET);
    fwrite(&r,sizeof(struct rec),1,f);
    fclose(f);
    printf("\n");

    /* read the 10 records to insure
       4th record was changed */
    f=fopen("junk","r");
    if (!f)
        return 1;
    for (i=1;i<=10; i++)
    {
        fread(&r,sizeof(struct rec),1,f);
        printf("%d\n",r.x);
    }
    fclose(f);
    return 0;
}
In this program, a structure description rec has been used, but you can use any structure description you want. You can see that fopen and fclose work exactly as they did for text files.
The new functions here are fread, fwrite and fseek. The fread function takes four parameters:
A memory address
The number of bytes to read per block
The number of blocks to read
The file variable
Thus, the line fread(&r,sizeof(struct rec),1,f); says to read 12 bytes (the size of rec) from the file f (from the current location of the file pointer) into memory address &r. One block of 12 bytes is requested. It would be just as easy to read 100 blocks from disk into an array in memory by changing 1 to 100.
The fwrite function works the same way, but moves the block of bytes from memory to the file. The fseek function moves the file pointer to a byte in the file. Generally, you move the pointer in sizeof(struct rec) increments to keep the pointer at record boundaries. You can use three options when seeking:
SEEK_SET
SEEK_CUR
SEEK_END
SEEK_SET moves the pointer x bytes down from the beginning of the file (from byte 0 in the file). SEEK_CUR moves the pointer x bytes down from the current pointer position. SEEK_END moves the pointer from the end of the file (so you must use negative offsets with this option).
Several different options appear in the code above. In particular, note the section where the file is opened with r+ mode. This opens the file for reading and writing, which allows records to be changed. The code seeks to a record, reads it, and changes a field; it then seeks back because the read displaced the pointer, and writes the change back.

repository: liudch/docker-tutorial-cn

repo_name: liudch/docker-tutorial-cn


text:
# Project 7 - WordPress Pentesting

Time spent: **7** hours spent in total

> Objective: Find, analyze, recreate, and document **five vulnerabilities** affecting an old version of WordPress

## Pentesting Report

1. (Required) User Enumeration in Login

- [x] Summary:
  - Vulnerability types: User Enumeration
  - Tested in version: 4.2
  - Fixed in version: N/A
- [x] GIF Walkthrough:

- [x] Steps to recreate:
  - Try to login with the username "user" and the password "1234"
  - Take notice to the 'Invalid User' error
  - Try to find a valid user by submitting "admin" as the username and "1234" as the password.
  - Note that the error is not the same, "admin" is a valid username.
  - Try to find the valid password by submitting "admin". You should now be logged into the wordpress admin console.
- [x] Affected source code:
  - [Login Source Code - V4.2](https://core.trac.wordpress.org/browser/branches/4.2/src/wp-login.php)

2. (Required) XSS Vulnerability - Media Page

- [x] Summary:
  - Vulnerability types: XSS
  - Tested in version: 4.2
  - Fixed in version: 4.2.4
- [x] GIF Walkthrough:

- [x] Steps to recreate:
  - Go to the Media tab in Wordpress
  - Select 'Create New'
  - Upload a Picture
  - Click on the newly uploaded Picture
  - In the title field, insert the following: `filename<img src=a onerror=alert('123')>.png`
  - Now select the "View attachment page" button at the bottom of the form
  - When you are redirected to the attachment page, this should trigger the onerror in the image.
- [x] Affected source code:
  - [Media Source Code - V4.2](https://core.trac.wordpress.org/browser/branches/4.2/src/wp-admin/includes/media.php)

3. (Required) XSS Vulnerability - Comment Section

- [x] Summary:
  - Vulnerability types: XSS
  - Tested in version: 4.2
  - Fixed in version: 4.2.4
- [x] GIF Walkthrough:

- [x] Steps to recreate:
  - Go to the Comment Section on one of the posts
  - Post: `I can do a lot of bad things here <img src=a onerror=alert('malicious intent')>.png`
  - Select the "Post Comment" button
  - This should trigger the onerror in the image and alert you of "malicious intent"
- [x] Affected source code:
  - [Comments in Themes - V4.2](https://core.trac.wordpress.org/browser/branches/4.2/src/wp-includes/theme.php)

## Assets

List any additional assets, such as scripts or files

## Resources

- [WordPress Source Browser](https://core.trac.wordpress.org/browser/)
- [WordPress Developer Reference](https://developer.wordpress.org/reference/)

GIFs created with [LiceCap](http://www.cockos.com/licecap/).

## Notes

Describe any challenges encountered while doing the work

## License

    Copyright [2018] [Khristian Brooks]

    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:
# How to build
  1. Download and build libcurl from https://github.com/curl/curl or https://curl.haxx.se/
  2. Place place curl headers and libcurl.lib in curl/
  3. Open MLTDAssetDownloader.pro in Qt Creator.
  4. Run qmake and build.


text:
# Aplanochytrium minuta (S.W. Watson & Raper) C.A. Leander & D. Porter, 2000 SPECIES

#### Status
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycotaxon 76: 442 (2000)

#### Original name
Labyrinthula minuta S.W. Watson & Raper, 1957

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Attribution

* Font glyphs are taken from [Ionicons](http://ionicons.com/) project and licensed under [MIT license](http://opensource.org/licenses/MIT). Ionicons on Github: [driftyco/ionicons](https://github.com/driftyco/ionicons).


text:
PLink
=====

Distributed messaging system
1, distributed, highly concurrent, messaging systems.
2, synchronous / asynchronous communication, support notification subscriptions.
3, the message channel management, automatic maintenance of network connections.
4, C language. Cross-platform (already supports Windows / Android).
5, the client provides a complete SDK.
6, based on BSD license.

PLink server
1, completely free to use.
2, server software application procedure
   1, please fill in the following format:
   Software: PLinkCenter
   2, send an email to<EMAIL_ADDRESS>
3, authorization application procedure
   1, to obtain authorization application documents:
   key.req
   2, please fill in the following format:
   Country: USA
   Name: Luc Besson
   Tel : 001-646-642-8269
   Reasons for applying: XXXXXXXXX
   Using industry: xxxxxxxxxxx
   Software parameters
   Maximum number of channels: 128
   Maximum authorized limit: 6 months
   3, send messages (including key.req) to<EMAIL_ADDRESS>

Note: All applications will be sent to<EMAIL_ADDRESS>within 30 days after we get back to you.

repository: zskylark/PLink

repo_name: zskylark/PLink


text:
# PSParseHTML

**PSParseHTML** is PowerShell module that's main purpose is to be a helper module for [PSWriteHTML](https://github.com/EvotecIT/PSWriteHTML). However it's functionality can be utilized in other projects, not related to **PSWriteHTML**, therefore it's available as a separate module. Basic how-to usage is described [on this blog post](https://evotec.xyz/formatting-and-minifying-resources-html-css-javascript-with-powershell/).

**PSParseHTML** has 9 functions:

- Convert-HTMLToText
- ConvertFrom-HtmlTable
- ConvertFrom-HTMLTag
- Format-CSS
- Format-HTML
- Format-JavaScript
- Optimize-CSS
- Optimize-HTML
- Optimize-JavaScript

The expected input is a string or from a file. The expected output to string or to file.

## Table of contents

- [PSParseHTML](#psparsehtml)
  - [Table of contents](#table-of-contents)
  - [ChangeLog](#changelog)
  - [Installation](#installation)
    - [Install from PSGallery](#install-from-psgallery)
    - [Update from PSGallery](#update-from-psgallery)
  - [3rd party references](#3rd-party-references)

## ChangeLog

- 0.0.19 - 2021.03.14
  - Update NUglify to 1.13.6
- 0.0.18 - 2021.02.02
  - Update NUglify to 1.13.2
  - Update HtmlAgilityPack to v1.11.30
  - Better formatting HTML (including JS/CSS)
  - Better minimizing HTML (including JS/CSS)
  - Fixes `ConvertFrom-HtmlTable` for some use cases
- 0.0.17 - 2020.10.21
  - Update NUglify to 1.9.9
- 0.0.16 - 2020.08.21
  - Improvements to ConvertFrom-HTMLAttributes
- 0.0.14 - 2020.02.12
  - Added ConvertFrom-HTMLAttributes. Can search for Tags/Classes
  - Removed ConvertFrom-HTMLTag and added it as an alias to ConvertFromHTMLAttributes
- 0.0.13 - 2020.01.04
  - Fix for Optimize-HTML - it wasn't working at all
- 0.0.9 - 10.10.2019
  - Updated ConvertFrom-HTMLTable fixing problem with the header being part of the table (fix by Anthony Howell!)
- 0.0.8 - 8.10.2019
  - Updated ConvertFrom-HTMLTable to support more tables
  - Added ConvertFrom-HTMLTag
- 0.0.6 - 6.10.2019
  - Added ConvertFrom-HTMLTable (Thank you - Anthony Howell!)
- 0.0.5 - 11.08.2019 - [Blog post for the release](https://evotec.xyz/formatting-and-minifying-resources-html-css-javascript-with-powershell/)
  - First public release

## Installation

### Install from PSGallery

```powershell
Install-Module -Name PSParseHTML -AllowClobber -Force
```

Force and AllowClobber aren't necessary but they do skip errors in case some appear.

### Update from PSGallery

```powershell
Update-Module -Name PSParseHTML
```

That's it. Whenever there's a new version you simply run the command and you can enjoy it. Remember, that you may need to close, reopen **PowerShell** session if you have already used module before updating it.

**The important thing** is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update will break your code. For example, small rename to a parameter and your code stops working! Be responsible!

## 3rd party references

This module uses several external libraries to do its work. The authors of those libraries made a fantastic job. I've just added some PowerShell to the mix.

- [AngleSharp](https://github.com/AngleSharp/AngleSharp) - MIT License
- [Jsbeautifier](https://github.com/denis-ivanov/Jsbeautifier) - MIT License
- [NUglify](https://github.com/trullock/NUglify) - BSD-Clause 2 license
- [Html Agility Pack](https://github.com/zzzprojects/html-agility-pack) - MIT License

repository: DrasticSolutions/PSParseHTML

repo_name: DrasticSolutions/PSParseHTML


text:
# init.d-template
Linux init.d file template for creating a init.d file for your program

## Usage

Just replace following variables to what you want.

| Variables | Description |
| --------- | ---------
| <PROGRAM_NAME> | program name |
| <RUN_AS_USER> | the user you want to run your program |
| <PROGRAM_DESCRIPTION> | description |
| <PROGRAM_PID_FILENAME> | process id filename |
| <PROGRAM_LOG_FILENAME> | log filename |


text:
---
layout: post
title: Tweak The Environment
tags: product book-review
---

I recently started reading [Switch: How to Change Things When Change is Hard](https://www.amazon.com/Switch-Change-Things-When-Hard/dp/0385528752) by Chip Heath and Dan Heath. On the first chapter, the authors described 3 surprises about change. One that stuck to me was:

```
What looks like a people problem is often a situation problem.
```

The authors talked about a study where moviegoers were all given a bucket (large or small) of stale popcorn. The study showed that moviegoers with larger buckets tend to eat more popcorn than those that had smaller buckets. If we want people to eat more popcorn, then provide larger buckets! Conversely, smaller buckets made for healthier moviegoers.

It’s super easy to over-complicate the problem and give suggestions to the gluttons on how to curb their appetites, when in fact it could be solved by giving them smaller buckets. Likewise, it’s very easy to point out issues with a person (or group of people) than to point out the environment/context of the issue.

We need to have a closer look at our systems and organisations, and see how we can stimulate change.

gha_language: CSS


text:
# Debian
 Debian Repository for V2Ray

## Usage

```bash
# Install some prerequisites needed by adding GPG public keys
$ sudo apt-get install gnupg ca-certificates curl

# Import our GPG key. Notice the hyphen at the end of line.
$ curl -sSL https://apt.v2fly.org/pubkey.gpg | sudo apt-key add -

# Add the our official APT repository:
$ echo "deb [arch=amd64] https://apt.v2fly.org/ stable main" | sudo tee /etc/apt/sources.list.d/v2ray.list

# To update the APT index:
$ sudo apt-get update

# You can install V2Ray from APT now:
$ sudo apt-get install v2ray
```

repository: cslily/debian

repo_name: cslily/debian


text:
# Event Bus for Android

I developed this app to demo the benefits of using [Retrofit](http://square.github.io/retrofit/) (combined with [Gson](https://code.google.com/p/google-gson/)) and the [Otto](http://square.github.io/otto/) event bus for the upcoming Cincinnati Tech Talk at Cardinal Solutions.  In doing so, I figured I'd share it with everyone.  During my research I found several examples of the best way to pull this off, but not a one stop shop that covered everything.  I found a great article on [A smart way to use Retrofit](http://blog.robinchutaux.com/blog/a-smart-way-to-use-retrofit/), as well as a great article on [Durable Android REST Clients](http://www.mdswanson.com/blog/2014/04/07/durable-android-rest-clients.html).  This app usess Otto as the event bus and Retrofit for all the REST implementation.  The added bonuses are the utilization of the new RecyclerView, SwipeRefreshLayout, and the Endless Scroll Listener.  Lets get started...

## Configuration

Your build.gradle needs the following dependencies for the features outlined below:

* Android backwards compatability
 * compile 'com.android.support:appcompat-v7:21.0.3'
 * compile 'com.google.android.gms:play-services:6.5.87'
 * compile 'com.android.support:support-v4:21.0.3'
* Material Design
 * compile 'com.android.support:cardview-v7:21.0.3'
 * compile 'com.android.support:recyclerview-v7:21.0.3'
* JSON
 * compile 'com.google.code.gson:gson:2.2.3'
* Image injection
 * compile 'com.squareup.picasso:picasso:2.4.0'
* Event Bus
 * compile 'com.squareup:otto:1.3.5'
 * compile 'com.squareup.retrofit:retrofit:1.7.1'

## Otto

Otto is an event bus designed to decouple different parts of your application while still allowing them to communicate efficiently.  Forked from Guava, Otto adds unique functionality to an already refined event bus as well as specializing it to the Android platform.  The bus provider is a pretty straight forward singleton object:

```Java
public class BusProvider {

	private static Bus mInstance;

	public static Bus getInstance() {
		if (mInstance == null) {
			mInstance = new Bus();
		}
		return mInstance;
	}
}
```

In order to receive events, a class instance needs to register with the bus. I do this in the onCreate for the fragment.  I know what you're thinking... Why would you do that in onCreate?  Won't it fire every time the fragement starts?  Yes, yes it will.  For this app that's a good thing, we're looking at a live picture feed.  But, for other apps I've stored a shared preference boolean after the initial fetch runs.  Subsequent requests are only sent when the user does a pull to refresh.  At any rate, here we go:

```Java
BusProvider.getInstance().register(this);
```

Don't forget to unregister during lifecycle shutdown:

```Java
@Override
public void onDetach() {
	super.onDetach();
	BusProvider.getInstance().unregister(this);
}
```

NOTE: Registering will only find methods on the immediate class type.  Otto will not traverse the class hierarchy and add methods from base classes or interfaces that are annotated!!

Once you have your bus set up and registered, you simply publish your events for the subscribers of that type.  For the purposes of this app, we're publishing an event of type GetInstagramResultsEvent() and passing in a custom hashtag string to the API (more on that in the Retrofit section):

```Java
BusProvider.getInstance().post(new GetInstagramResultsEvent(mHashtag));
```

Now that we've published our event, we need to subscribe to the response event so we can "do stuff" with the response when the event is finished.  To do that, we simply annotate a method with @Subscribe.  To listen for the GetInstagramResultsEvent, we add the following @Subscribe method:

```Java
@Subscribe
	public void instagramResultsLoadedEvent(InstagramResultsLoadedEvent event) {
       // update UI with event object...
}
```

That's all there is to it!!  Well, sort of...  That's all that's requred to publish events and recieve responses, but there's a little more that goes on behind the scenes.  This is where Retrofit will start to show up.  Lets take a look at the GetInstagramResultsEvent object that we published:

```Java
public class GetInstagramResultsEvent {
	public GetInstagramResultsEvent(String hashtag) { InstagramClient.getInstagramDataApi(hashtag); }

    public GetInstagramResultsEvent(String hashtag, String nextMaxID) { InstagramClient.getInstagramDataApi(hashtag, nextMaxID);}
}
```

It's simple, fairly straight forward, but what is that InstagramClient object??  What does it do?  Where did it come from?  Allow me to explain...

## Retrofit

Retrofit is a type-safe REST client for Android and Java.  With this library you can request the webservices of a REST api with POST, GET and more. This library is great, but we need a good architecture to do it correctly.  I'll dig deeper into each object, but for starters we'll need to set up the following:

* REST Adapter
* REST Client
* API Service with Parameters
 * GET, POST, DELETE... for this app I'm only using GET
* POJOs

### Rest Adapter

The rest adapter is a singleton that returns an instance of the Retrofit RestAdapter, using the base URL endpoint that you pass in:

```Java
public class InstagramRestAdapter {

	private static RestAdapter mInstance;

	public static RestAdapter getInstance() {
		if (mInstance == null) {

			mInstance = new RestAdapter.Builder().setEndpoint(AppConstants.INSTAGRAM_API_URL)
		                                         .build();
		}
		return mInstance;
	}
}
```

There are many other arguments you can set in your rest adapter, which at that point we'd want to call it a Rest Client, but I digress.  For example, if your POJOs will contain a date object, you can create a Gson object with a given date format, add that to your rest client, and the pattern will be used to parse the date field in all your POJOs.  This app doesn't use any dates so I didn't add the Gson object, but if it did our Rest Client would look something like this:

```Java
public class InstagramRestClient {

	private static RestAdapter mInstance;

	public static RestAdapter getInstance() {
		if (mInstance == null) {

			Gson gson = new GsonBuilder()
                .setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'")
                .create();

			mInstance = new RestAdapter.Builder().setEndpoint(AppConstants.INSTAGRAM_API_URL)
                                                 .setConverter(new GsonConverter(gson))
		                                         .build();
		}
		return mInstance;
	}
}
```
moving on...

### REST Client

The REST client is the proverbial workhorse.  It generates in implementation of our API, and contains the methods and callbacks to get data and return it to the subscriber (detalis coming...).  So, our client generates our API implementation:

```Java
private static InstagramApi service = InstagramRestAdapter.getInstance().create(InstagramApi.class);
```

and it contains the methods and callbacks to handled the data:

```Java
public static void getInstagramDataApi(String hashtag) {
    service.getInstagramImages(hashtag, new Callback<GetInstagramResult>() {
        @Override
        public void success(GetInstagramResult getInstagramResult, Response response) {
            Logger.d(TAG, "Success grabbing Instagram data!!");
            BusProvider.getInstance().post(new InstagramResultsLoadedEvent(true, getInstagramResult));
        }

        @Override
        public void failure(RetrofitError error) {
            Logger.e(TAG, "Error trying to get Instagram Images!!", error);
            BusProvider.getInstance().post(new InstagramResultsLoadedEvent(false, null));
        }
    });
}
```

While I did not take advantage of it in this app, we do have the ability to create custom error handling by implementing the ErrorHandler interface.

### API Service with Parameters

For this app, I'm only using the GET parameter, but syntactically there's no difference between GET, POST, etc.  We're making two web service calls in this app.  For both calls we're utilizing the @Path annotation to replace the hashtag piece of our URI.  For the second call, we're adding a @Query parameter of "max_tag_id" to our request (there's several more annotations you can add to your request, check out [Retrofit](http://square.github.io/retrofit/) for more details):

```Java
public interface InstagramApi {

	@GET("/tags/{hashtag}/media/recent/?client_id=8a62cfd0ccc14a4b8a2b40da3467dc8e")
	void getInstagramImages(@Path("hashtag") String hashtag, Callback<GetInstagramResult> callback);

    @GET("/tags/{hashtag}/media/recent/?client_id=8a62cfd0ccc14a4b8a2b40da3467dc8e")
    void getInstagramImages(@Path("hashtag") String hashtag, @Query("max_tag_id") String maxId, Callback<GetInstagramResult> callback);

}
```

But wait...there's more!!  What's that Callback of type GetInstagramResult?  I'm glad you asked...

If you don't add the Callback then your request is synchronized and your execution will block until the request is finished. If you want to create an asynchronous request you have to add a Callback to your methods and return void.  More details on the Callback to follow...

### POJOs

In my opinion, this little secret I'm going to tell you about is worth the cost of admission...  If you're using an existing API, in our case Instagram, you can save yourself a TON of time generating your POJOs by taking advantage of one of the (several) FREE JSON to POJO generators.  A couple of good ones are [jsonschema2pojo](http://www.jsonschema2pojo.org) and [JSON To Java](http://jsontojava.appspot.com).  They will generate the POJOs, add all the Gson (or others) annotations, and they'll even make the objects Parcelalbe for Android.  I know... nice right??  For this app I used [jsonschema2pojo](http://www.jsonschema2pojo.org).

Once you've taken advantage of the awesome sauce I mentioned in the previous paragraph, you can drop your newly created (and annotaded...and maybe Parcelable) POJOs into your project.  Now, back to the callback in the previous section.  This is where the proverbial magic happens...

The GetInstagramResult object is where the serialization occurs.  When the service call is made, the Callback fires and the JSON reponse is deserialized into the GetInstagramResult object, which is returned to the overridden "success" or "failure" method in our client (see above).  Our client then publishes the event of type InstagramResultsLoaded, which is the event subscribed to by our fragment.  Remember at the top of the README, when I said "we need to subscribe to the response event so we can "do stuff" with the response when the event is finished."?  Well, now it's finished.  We've come full circle and have an object to update our UI with, which brings us to our next and final section that I so eloquently referred to as "Added Bonuses".  Man, I'm giving lots of free stuff out here.

## Added Bonuses

 For this app, I'm taking advantage of the RecyclerView, SwipeRefreshLayout, and the Endless Scroll Listener.  I won't go too deep into these objects, as it's not really the topic of this README, but I feel they deserve a little attention.

### RecyclerView

 RecyclerView came out with the Android L preview release and is part of the support library, if you're not using it yet you need to be.  The big take away is it's much (much) smoother and faster than the old ListView.  Using it is pretty straight forward, there's tons of good examples for it at this point.  What I really wanted to point out was the use of endless scrolling in this app, not something that comes out of the box with RecyclerView (or any Android ListView).

In our fragment, we apply the scroll listener to the recycler view:

```Java
private void updateScrollListener() {

        mRecyclerView.setOnScrollListener(new EndlessRecyclerOnScrollListener(mLayoutManager) {
            @Override
            public void onLoadMore(int current_page) {
                BusProvider.getInstance().post(new GetInstagramResultsEvent(mHashtag, mNextMaxID));
            }
        });
    }
```

And here is our class that extends the RecyclerView.OnScrollListener:

```Java
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
    public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();

    private int previousTotal = 0; // The total number of items in the dataset after the last load
    private boolean loading = true; // True if we are still waiting for the last set of data to load.
    private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
    int firstVisibleItem, visibleItemCount, totalItemCount;

    private int current_page = 1;

    private LinearLayoutManager mLinearLayoutManager;

    public EndlessRecyclerOnScrollListener(LinearLayoutManager linearLayoutManager) {
        this.mLinearLayoutManager = linearLayoutManager;
    }

    @Override
    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
        super.onScrolled(recyclerView, dx, dy);

        visibleItemCount = recyclerView.getChildCount();
        totalItemCount = mLinearLayoutManager.getItemCount();
        firstVisibleItem = mLinearLayoutManager.findFirstVisibleItemPosition();

        if (loading) {
            if (totalItemCount > previousTotal) {
                loading = false;
                previousTotal = totalItemCount;
            }
        }
        if (!loading && (totalItemCount - visibleItemCount)
                <= (firstVisibleItem + visibleThreshold)) {
            // End has been reached

            // Do something
            current_page++;

            onLoadMore(current_page);

            loading = true;
        }
    }

    public abstract void onLoadMore(int current_page);

}
```

Pay close attention to the onScrolled overridden method.  We're calculating total items, visible items, and the first viewable item, and scrolling infinitely (or until we reach the end of our data list).  I know, it's a thing of beauty, and very simple.  You're welcome.

### SwipeRefreshLayout

Finally, a little bit about the SwipeRefreshLayout.  This handy little gem came out in the last support library update.  It's's a standard way to implement the common Pull to Refresh pattern in Android.  Hooking it up is pretty easy, and here's how we do it.

All you have to do is add a scrollable view to the layout.  For this app I'm using the RecyclerView:

```XML
<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/instagram_swipe_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    tools:context="com.cardinalsolutions.macys.mocandroid.view.instagram.InstagramFragment">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:scrollbars="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.v4.widget.SwipeRefreshLayout>
```

And in your Fragment (or Activity) get the layout, and assign the listener. The refreshing listener is a post delayed handler:

```Java
	mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.instagram_swipe_container);
 	mSwipeLayout.setOnRefreshListener(this);
```

Lastly we need to implement the SwipeRefreshLayout.OnRefreshListener, and override the onRefresh() method.  In our case, when the user swipes to refresh we make another API call to get the most recent results:

```Java
@Override
public void onRefresh() {
    reloadingData = true;
    BusProvider.getInstance().post(new GetInstagramResultsEvent(mHashtag));
}
```

That's all there is to it!!  Feel free to check out the project and dig in.  Happy Coding!!

## Author / License

Copyright Cardinal Solutions 2013. Licensed under the MIT license.
<img src="https://raw.github.com/CardinalNow/NSURLConnection-Debug/master/logo_footer.png"/>

repository: kingws/EventBusForAndroid

repo_name: kingws/EventBusForAndroid


text:
# Link to CommonDataModel

- [OBSERVATION_PERIOD](https://github.com/OHDSI/CommonDataModel/wiki/OBSERVATION_PERIOD)

# Source Tables (mimic)

## [admissions](https://mimic.physionet.org/mimictables/admissions/)

- `period_type_concept_id` is equal to  44814724 (Period covering healthcare encounters)

# Mapping used

# Examples

repository: MIT-LCP/mimic-omop

gha_language: PLpgSQL

repo_name: MIT-LCP/mimic-omop


text:
# Office Add-in that converts directly between Word and Markdown formats

Use the Word.js APIs to convert a Markdown document to Word for editing and then convert the Word document back to Markdown format, using the Paragraph, Table, List, and Range objects.

![Convert between Word and Markdown](readme_art/ReadMeScreenshot.PNG)

## Table of Contents
* [Change history](#change-history)
* [Prerequisites](#prerequisites)
* [Test the add-in](#test-the-add-in)
* [Known issues](#known-issues)
* [Questions and comments](#questions-and-comments)
* [Additional resources](#additional-resources)

## Change history

December 16, 2016:

* Initial version.

## Prerequisites

* Visual Studio 2015 or later.
* Word 2016 for Windows, build 16.0.6727.1000 or later.

## Test the add-in

1. Clone or download the project to your desktop.
2. Open the Word-Add-in-JavaScript-MDConversion.sln file in Visual Studio.
2. Press F5.
3. After Word launches, press the **Open Converter** button on the **Home** ribbon.
4. When the application has loaded, press the button **Insert test Markdown document**.
5. After the sample Markdown text has loaded, press the button **Convert MD text to Word**.
6. After the document has been converted to Word, edit it.
7. Press the button **Convert document to Markdown**.
8. After the document has converted, copy and paste its contents into a Markdown previewer, such as Visual Studio Code.
9. Alternatively, you can start with the button **Insert test Word document** and convert the sample Word document that is created to Markdown.
10. Optionally, start with your own Markdown text or Word content and test the add-in.

## Known issues

- Due to a bug in the way that programmatically-created Word lists are created, the Markdown-to-Word will only correctly convert the first list (or sometimes the first two lists) in a document. (Any number of Markdown lists will convert correctly to Word.)
- If you convert the same document repeatedly between Word and Markdown back and forth, all of the rows in tables will take on the formatting of the header row, which usually includes bold text.
- The add-in uses some Office APIs that are not yet supported in Word Online (as of 2017/2/15). You should test it in desktop Word (which opens automatically when you press F5.

## Questions and comments

We'd love to get your feedback about this sample. You can send your feedback to us in the *Issues* section of this repository.

Questions about Microsoft Office 365 development in general should be posted to [Stack Overflow](http://stackoverflow.com/questions/tagged/office-js+API). If your question is about the Office JavaScript APIs, make sure that your questions are tagged with [office-js] and [API].

## Additional resources

* [Office add-in documentation](https://msdn.microsoft.com/en-us/library/office/jj220060.aspx)
* [Office Dev Center](http://dev.office.com/)
* More Office Add-in samples at [OfficeDev on Github](https://github.com/officedev)

## Copyright
Copyright (c) 2016 Microsoft Corporation. All rights reserved.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode<EMAIL_ADDRESS>with any additional questions or comments.


text:
# More than 2 million pounds of chicken products recalled in eight states

Published at: **2019-11-07T07:05:25+00:00**

Author: **CNN**

Original: [Fox 4](https://www.fox4now.com/news/national/more-than-2-million-pounds-of-chicken-products-recalled-in-eight-states)

More than 2 million pounds of poultry products have been recalled in eight states over fears of contamination with foreign matter such as metal, federal health officials said.
Arkansas-based Simmons Prepared Foods, Inc. recalled the items produced from October 21 through November 4 this year. They are 2,071,397 pounds of poultry products, including ready to cook chicken whole legs, boneless skinless chicken, halal chicken leg quarters and chicken tenderloins, the US Department of Agriculture's Food Safety and Inspection Service said Wednesday.
The products subject to recall have an establishment number "P-1949," "P- 486" or "P-5837" inside the USDA mark of inspection, and were shipped to Alabama, Arizona, Arkansas, California, Georgia, Minnesota, Oklahoma and Pennsylvania.
Those who've purchased the products are urged to throw them away or return them to the store.

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported