text:
# Stack Package UI configuration metadata

* Owner: Steven Rathbauer ([@rathpc](https://github.com/rathpc)), Marques Johansson ([@displague](https://github.com/displague))
* Reviewers: Crossplane Maintainers
* Status: Draft, revision 1.1

## Revisions

* 1.1 - Dan Mangum (@hasheddan)
  * Removed references to `version` field in `ui-schema.yaml` required fields.

## Terms

* **Stack**: A Stack is a Crossplane stack-manager managed package. These packages may bundle one or many Crossplane
applications or infrastructure provider controllers.
* **Stacks**: Stacks could refer to more than one Crossplane stack-manager packages or the Stack-Manager system as a whole.

See the [Stacks Design Doc](design-doc-packages.md) for more details about Crossplane Stacks.

## Objective

This document aims to provide details on the necessary metadata that will drive the UI on a configuration page with
respect to Crossplane Stacks and the user configurable custom-resource fields exposed with a Stack. This is meant to be
a dynamic spec that will not attempt to accommodate all potential UI elements. This spec does not intend to be as
complete as [XForms](https://en.wikipedia.org/wiki/XForms) or [HTML Forms](https://www.w3.org/TR/html52/sec-forms.html),
for example.

Users may choose to annotate Stack bundled CRD today with UI hints. This proposal suggests a means for the stack
manager to apply CRD annotations at install and upgrade time. This separation provides a better developer experience
preventing the need for modifying escaped, nested, quoted, YAML or JSON annotations within a CRD document while
iterating over UI design.

A YAML file named `ui-schema.yaml` is proposed for inclusion in Stacks. This will standardize the approach Stack
creators use to offer UI context to their package and offer a more engaging user experience.

Tools that deliver a user-interface based on this proposal may include:

* CLI help output
* CLI auto-completion for arguments
* Advanced validation (beyond what Kubernetes' OAS3 support delivers)
* ncurses-style installers
* web-based package managers (out-of-cluster and in-cluster)
* web-based configuration panels

This spec is not concerned with a specific UI implementation but serves to provide a foundation for supporting Stack
developers and users through basic form input.

## Proposed File format

The `ui-schema.yaml` content will not be dictated in this design doc. Rather, the [formal specification](#formal-specification)
is a simple guideline for the type and size of the document. The contents are otherwise left open to interpretation by
Stack tools with the expectation that these tools will promote interoperable standards. Specifications suggested
through examples and supporting text in this design document should not be considered doctrine.

## Proposed UI Elements

The following are proposed UI elements for Stack tool authors to consider supporting.

* Sections
* Title
* Subtitle
* Input: Text, Number, Password, Hidden, Readonly
* Textarea
* Select Dropdown: Single, Multiple
* Checkbox: Single, Group
* Radio Button Group
* Code Snippet

Support for all of these UI types is not mandated or required. Other UI elements, not listed here, may also be offered.

## Stack Implementation

The optional addition of a `ui-schema.yaml` file within the package tree will be used to drive the UI.

The primary purpose of the `ui-schema.yaml` format is to allow for easy authoring of the definition of UI markup,
validation, and errors for a more complete UI and UX. The `ui-schema.yaml` file will be parsed and validated as part of
package validation and ultimately serialized as a `YAML` annotation on the respective CRD at install time.

A root `ui-schema.yaml` file may be used to set global UI metadata. This may be useful for describing required fields
that appear across resources and versions. Resource specific UI metadata should take priority over global UI metadata.

### Example addition of `ui-schema.yaml` in a package tree

```text
.registry/
├── icon.png
├── app.yaml # Application metadata.
├── ui-schema.yaml # Optional UI spec for configuration metadata
├── install.yaml # Optional install metadata.
├── rbac.yaml # Optional RBAC permissions.
└── resources
      └── databases.foocompany.io # Group directory
            ├── group.yaml # Optional Group metadata
            ├── icon.png # Optional Group icon
            └── mysql # Kind directory by convention
                └── v1alpha1
                    ├── mysql.v1alpha1.crd.yaml # Required CRD
                    ├── ui-schema.yaml # Optional UI spec for configuration metadata
                    ├── icon.png # Optional resource icon
                    ├── resource.yaml # Resource level metadata.
```

### Example `ui-schema.yaml`

This file contains multiple sections and a variety of different input types with validation overrides, extended
validation and custom error messages.

```yaml
configSections:
- title: Configuration
  description: Enter information specific to the configuration you wish to create.
  items:
  - name: dbReplicas
    controlType: singleInput
    type: integer
    path: .spec.dbReplicas
    title: DB Replicas
    description: The number of DB Replicas
    default: 1
    validation:
    - minimum: 1
    - maximum: 3
  - name: masterPassword
    controlType: singleInput
    type: password
    path: .spec.masterPassword
    title: DB Master Password
    description: The master DB password. Must be between 8-32 characters long
  - name: subdomain
    controlType: singleInput
    type: string
    path: .spec.subdomain
    title: Subdomain
    description: Enter a value for your subdomain. It cannot start or end with a dash and must be between 2-62 characters long
    validation:
    - minLength: 2
    - maxLength: 62
    - pattern: ^([A-Za-z0-9](?:(?:[-A-Za-z0-9]){0,61}[A-Za-z0-9])?){2,62}$
  - name: instanceSize
    controlType: singleSelect
    path: .spec.instanceSize
    title: Instance Size
    enum:
    - 'Option-1'
    - 'Option-2'
    - 'Option-3'
    validation:
    - required: true
      customError: You must select an instance size for your configuration!
```

### CRD Annotation Example

An example injection of the `ui-schema.yaml` as a CRD annotation follows. Keep in mind that Kubernetes annotations are
limited to 256kb (less in older versions).

```yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: rdsinstances.database.aws.crossplane.io
  annotations:
    stacks.crossplane.io/ui-schema: |-
      ---
      configSections:
      - title: Configuration
        description: Enter information specific to the configuration you wish to create.
        items:
        - name: dbReplicas
          controlType: singleInput
          type: integer
          path: ".spec.dbReplicas"
          title: DB Replicas
          description: The number of DB Replicas
          default: 1
          validation:
          - minimum: 1
          - maximum: 3
        - name: masterPassword
          controlType: singleInput
          type: password
          path: ".spec.masterPassword"
          title: DB Master Password
          description: The master DB password. Must be between 8-32 characters long
        - name: subdomain
          controlType: singleInput
          type: string
          path: ".spec.subdomain"
          title: Subdomain
          description: Enter a value for your subdomain. It cannot start or end with a dash
            and must be between 2-62 characters long
          validation:
          - minLength: 2
          - maxLength: 62
          - pattern: "^([A-Za-z0-9](?:(?:[-A-Za-z0-9]){0,61}[A-Za-z0-9])?){2,62}$"
        - name: instanceSize
          controlType: singleSelect
          path: ".spec.instanceSize"
          title: Instance Size
          enum:
          - Option-1
          - Option-2
          - Option-3
          validation:
          - required: true
            customError: You must select an instance size for your configuration!
      ---
      configSections:
      - title: Supplementary
        description: A supplementary UI annotation
  labels:
    controller-tools.k8s.io: "1.0"
```

## Formal Specification

The current design calls for unbiased processing of the UI YAML to annotations, regardless of content.

Because the YAML will be concatenated as a multiple document YAML in the annotation:

* the file must contain a valid YAML document
* the fully transcribed YAML must be less than 256kb

These are the only requirements.

While this document is meant to be an abstract and un-prescriptive design around inclusion of a `ui-schema.yaml` file,
[Upbound](https://upbound.io/) has authored one specific implementation ([Upbound UI Spec](design-doc-upbound-ui-spec.md))
that is meant to serve as a helpful reference to other potential implementors in the future. This can be used as the
ground work for further UI development around this file.

## Open Questions

* How should multiple document YAML annotations signify priority?
* Should dependent and co-dependent fields be supported? (Not relevant if Crossplane remains unopinionated about the
file contents)

repository: hasheddan/crossplane

repo_name: hasheddan/crossplane


text:
## Initial Setup
Hope you have successfully set up the project in your local system and install all dependencies

## About the LinksList Component
This is a resuasble component for displaying the list of links in bullet points. This Component is highly reusable and customizable via props

## How to use the component
Import the component to `pages/index.js`
`import {LinksList} from "../components/LinksList";`

## How to handle props to the component
```
<LinksList links={[{"name": "Sample1", "url": "https://google.com"},
                        {"name": "Sample2", "url": "https://google.com"},
                        {"name": "Sample3", "url": "https://google.com"},]} isIcon={true} iconName="faLink" />
```

`links` prop is the array of links you want to render
`isIcon` prop is a boolean to decide if you will render icons or not
`iconName` is the name of icon you want to render

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
title: Get in touch
subtitle: Support forums, chat rooms
weight: 70
---

If you need help using Cucumber Open, you have several options.
Wherever you interact with the Cucumber Open community, always remember to respect and uphold our [code of conduct](https://github.com/cucumber/cucumber/blob/master/CODE_OF_CONDUCT.md).

# Slack

To access our lively Slack community, you'll need to [register for an account](https://communityinviter.com/apps/cucumberbdd/docs-page).

Once you've received your invite, head over to [#welcome](https://cucumberbdd.slack.com/messages/C5WD8SA21) to introduce yourself to the rest of the community, or [#help](https://cucumberbdd.slack.com/messages/C60TKS3SL/) if you need help using Cucumber.

If you're interested in becoming an [open-source contributor](https://cucumber.io/docs/community/new-contributors/), come and hang out in the [#new-contributors ](https://cucumberbdd.slack.com/archives/C028E2TBDJQ) channel.

Or just wander around and make yourself at home!

# Stack Overflow

Many people use the [`cucumber`](https://stackoverflow.com/questions/tagged/cucumber) and [`bdd`](https://stackoverflow.com/questions/tagged/bdd) tags on Stack Overflow to ask or answer questions about Cucumber.

repository: cucumber/docs

branch_name: refs/heads/main

gha_language: CSS

gha_license_id: MIT

repo_name: cucumber/docs


text:
---

title: The Best Way to Hide

categories: en issues
old: true
date: 2013-10-31

layout: post

---
There is a well-known front-end pattern which is to have hidden elements in DOM
and make them visible when necessary. As with any good pattern, it can be
compromised by wrong implementation.
<excerpt/>

Most times, **hidden** means that the DOM element gets a `display: none` property.
This approach has become even more widespread thanks to `.hide()` and `.show()` jQuery helpers.

Whenever you need to hide a visible block you use the `.hide()` helper which in
charge of assigning an inline `display: none` style property, making the block
invisible. When it has to become visible again, the `.show()` helper changes the
inline CSS `display` property.

I believe this is a very nice example of wrong implementation.

The solution unifies all the elements around the world and assumes all of them
can be hidden in the same way. But this assumption is far from reality.

Let us say we have an element in a visible state. Guess what will happen when we
use `.hide()` and `.show()`?
Yes, an inline style with a `display` property will be added.
In other words, the element will not return back to its original visible state.

```js
$('.my-block');

// <span class="my-block">..</span>

$('.my-block').hide()

// <span class="my-block" style="display: none;">..</span>

$('.my-block').show()

// <span class="my-block" style="display: block;">..</span>

```

jQuery is clever enough to detect inline elements. By applying `.hide()` and
`.show()`, you get something like this:

```js
$('.my-block');

// <span class="my-block">...</span>

$('.my-block').hide();

// <span class="my-block" style="display: none;">...</span>

$('.my-block').show();

// <span class="my-block" style="display: inline;">...</span>

```

Again, the block did not **return** to its original state after being shown. For
sure, it became visible, but this state is not equivalent to the original one.
Any new CSS class appended to the element with an intention to change its
`display` property will not work as the inline style rule prevails.

The other problem is that setting `display` property to `none` doesn't always
work for making an element invisible. Maybe for some reason it has to be hidden
from a user with `left: -9999px`?

It's only the interface block implementation that should know about all the
block states, including the hidden one.

Modifiers (no matter if you prefer [SMACCS](http://smacss.com/),
[OOCSS](http://oocss.org/) or [BEM](http://bem.info/)) are designed to express
states of interface components. The same goes for the hidden state.

Every block you would like to hide and show should be equipped with a proper
modifier:

```css
.my-block_hidden {
    display: none;
}
```

Then, by applying this modifier and removing it from a block you can be sure it
transitions into one of its predefined states:

```js
$('.my-block');

// <span class="my-block">...</span>

$('.my-block').addClass('my-block_hidden');

// <span class="my-block my-block_hidden">...</span>

$('.my-block').removeClass('my-block_hidden');

// <span class="my-block">...</span>
```

This enables you to provide any type of hiding, not necessarily `display: none`,
and ensures the block returns to its original visible state when shown again.

If you prefer not to mess with all those `.addClass()` and `.removeClass()`
helpers, you can teach your JavaScript to work with modifiers (e.g. [as
BEM does
it](https://github.com/varya/bem-js-tutorial/blob/master/02-Modifiers.md)) which
will make your code even better:

```js
$.block('my-block');

// <span class="my-block">...</span>

$.block('my-block').setMod('hidden');

// <span class="my-block my-block_hidden">...</span>

$.block('my-block').delMod('hidden');

// <span class="my-block">...</span>
```

That's all. From now on you are not allowed to use `.hide()` and `.show()`.
Even for prototyping :-)

repository: varya/gatsby-webiste-with-mdx

gha_language: JavaScript

repo_name: varya/gatsby-webiste-with-mdx


text:
# Passenger

[![CI Status](http://img.shields.io/travis/Kellan Cummings/Passenger.svg?style=flat)](https://travis-ci.org/Kellan Cummings/Passenger)
[![Version](https://img.shields.io/cocoapods/v/Passenger.svg?style=flat)](http://cocoapods.org/pods/Passenger)
[![License](https://img.shields.io/cocoapods/l/Passenger.svg?style=flat)](http://cocoapods.org/pods/Passenger)
[![Platform](https://img.shields.io/cocoapods/p/Passenger.svg?style=flat)](http://cocoapods.org/pods/Passenger)

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Installation

Passenger is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "Passenger"
```

## Set Up

Passenger is a Swift API Mapper that takes the pain of writing JSON-parsing Methods and HTTP requests out of building apps with API support. Instead, Passenger defines the classes `Model` and `Entity`, which cab be used to consume JSON APIs in much the same way as an ORM relates to a database.

To create a new API. Run the utility `passenger` inside the pod's `bin` folder to autogenerate two new plist templates:

	- api.plist
	- endpoints.plist

Add them to your project and add API config and endpoints to get started using Passenger.

## API
Set your API settings in a file called 'api.plist' or '<api>.api.plist' if you're using several apis with different namespaces.

	- namespace:	your app's namespace
	- version:	the version of the API you're accessing, used to construct the version part of your path
	- consumer_key:	your personal consumer key, provided by the authenticating api
	- authorization:	a dictionary of authorization credentials

		- OAuth1

			- consumer_secret: consumer_secret provided by authenticating API
			- signature_method:	currently only HMAC-SHA1 is supported
			- request_token_url:	request token url provided by authenticating API
			- access_token_url:	 access token url provided by authenticating API
			- request_token_callback:	your app's personal callback url; this can be set in Targets > [Your_Project] > Info > URL Types; for instance, if you create a new url with the identifier 'com.fkcomp.passenger' and a url scheme 'passenger', you would write 'passenger://com.fkcomp.passenger' here.
			- authorize_url:	authorize url provided by authenticating API

		- BasicAuth

			- personal_key:	personal key provided by authenticating API

	- options:	a dictionary of options with boolean values

		- use_file_extensions:	set to YES to use content-type extensions to identify your path; e.g., the path 'posts/:id/comments' will be processed as 'posts/:id/comments.json'
		- use_accept_headers:	set to YES to set the Http Accept header with the desired type
		- show_version_in_path:	set to YES to include the version in the API path

	- url:	base API url

### Endpoints
Set your endpoint settings in a file called 'endpoints.plist' or '<api>.endpoints.plist' if you're using several apis with different namespaces.

	- <Endpoint>:	a `Model` class

		- path:	the relative path to the route
		- routes:	a dictionary of routes

			- <Route>:	a `Model` class method: the built in routes are list, create, show, find, destroy, save, upload

				- path:	the relative path to the route
				- method:	the HTTP method, defaults to GET o
				- node:	the relative json node; set if the endpoint name does not match the json node; for the endpoint "ProjectStatus", for instance, Passenger will expect to use either the root json node, or if found the json node "project_status"/"project_statuses" (in case you are fetching an array)
				- auth: the authorization method; OAuth1 and BasicAuth are the only authorization methods currently supported

		- endpoints:	a dictionary of endpoints

			- <Endpoint>

To set path variables in endpoint paths use the following notation

	- "posts/:id"	given the endpoint "posts", ":id" will be replaced by the Post's "id" property
	- "users/:user.name/posts/:id"	given the endpoint "posts", which is a child of "users", ":user.name" will replaced by the User's "name" property and ":id" will be replaced by the Post's "id" property

The following routes, while having characteristic behavior defined by the base `Model` class, must still be defined in endpoints.plist for all accessible endpoints

	- list:	GET
	- find:	GET
	- search:	GET
	- show:	GET
	- save:	PUT
	- create:	POST
	- destroy:	DELETE
	- upload:	POST

## About

Passenger is currently looking for collaborators who are interested in expanding API support and generally and improving the codebase.

## Author

Kellan Cummings<EMAIL_ADDRESS>
## License

Passenger is available under the MIT license. See the LICENSE file for more info.

repository: kellanburket/Passenger

repo_name: kellanburket/Passenger


text:
Mailchimp
=================

A Statamic V2 add-on for Mailchimp that subscribes a user to a specific mailing list when they register.

## Installing
1. Copy the "addons" folder contents to your Statamic `site` directory;
2. Configure the addon by visiting CP > Addons > Mailchimp and add:
  * Mailchimp key - from Account - Extras - API Keys
  * If you're going to add folks when they register, turn on Add New Users
  * Not recommended, but you can disable the Double Opt In
  * Whether or not you want to check permission before add them to a list (this is the first opt in)
  * If so, which user field is the check? The value must be truthy (true, on) when selected
  * Mailchimp list id - from your list - Settings - List name and defaults
  * A row for each form submission you'd like to add to a list
	* Mailchimp list id - from your list - Settings - List name and defaults
	* Not recommended, but you can disable the Double Opt In
  	* Form - formsets to watch for if you're using a standard form instead of user registration
  	* Whether or not you want to check permission before add them to a list (this is the first opt in)
  	* If so, which form field is the check? The value must be truthy (true, on) when selected
3. Run `php please addons:refresh` to load the addon's dependencies.

## Usage

When a user is registered, they will be automatically subscribed to your mailing list.

When a form is submitted (that is in `formsets`), the `email` field will be used to subscribe to your mailing list.

## LICENSE

[MIT License](http://emd.mit-license.org)

repository: aryehraber/mailchimp

repo_name: aryehraber/mailchimp


text:
---
layout: post
title: Replicating GMT's blockmedian/blockmean in R
categories: R
tags: R
---

I have frequently used [GMT](https://www.soest.hawaii.edu/gmt/)'s [blockmean](http://gmt.soest.hawaii.edu/doc/latest/blockmean.html) and [blockmedian](http://gmt.soest.hawaii.edu/doc/5.3.2/blockmedian.html) functions with great success. These method essentially *quasi-grid* your points which is a particularly useful technique when trying to reduce irregularly spaced data such as for onward point sampling or data reduction. One case I have employed this is where the points were to be used as an input to kriging.

Sometimes I need to make use of these blockmean/blockmedian functions within R when system commands cannot be executed. Consequently, I've looked for a way to mimic the GMT functions within R - below is my current effort. This could be improved but provides a useful start if you've been looking for something similar... data with columns other than x and y are not handled in the below example.

The below code:

1. reads in points
2. creates a grid over which the points lie of a given dimension
3. assigns unique ID to each cell (in this case, the cell number)
4. extracts raster cell value to all points within a cell
5. calculates new point positions for all points within a specific cell
6. output new point list - blockmean or blockmedian filtered :)

```R
library(sp)
library(raster)

# Create some points
xs=sample(seq(from=1, to=20, by=0.2), size=500, replace=TRUE)
ys=sample(seq(from=1, to=20, by=0.2), size=500, replace=TRUE)
plot(xs,ys)

pnts=SpatialPoints(cbind(xs,ys))
ext=extent(pnts)

# Create grid
nrows=ext[4]-ext[3]
ncols=ext[2]-ext[1]
r = raster(nrows = nrows, ncols = ncols, xmn = ext[1], xmx = ext[2], ymn = ext[3], ymx = ext[4])

# Assign cell number to each cell
vals=1:ncell(r)
r[]=vals

# Extract cell value to points
pnts$cell=extract(r, pnts)

# Calculate median point position
# Assumes dataframe with columns x,y,cell (<<< cell number)
# method - median or mean - otherwise fail
block_xy <-function(df, method='median'){

	cells=unique(df$cell)
	xys=data.frame()
	for (cell_inst in cells){
		grp=subset(df, cell==cell_inst)

		if (method=='median'){
			xs=median(grp$x)
			ys=median(grp$y)
		} else if (method=='mean'){
			xs=mean(grp$x)
			ys=mean(grp$y)
		}

		xys=rbind(xys,c(xs, ys, cell_inst))
	}

	colnames(xys)<-c('x','y','cell')
	return(xys)
}

# Run the filtering
pnts=as.data.frame(pnts) # cell, xs, ys
colnames(pnts)=c('cell','x','y')
med_xys=block_xy(pnts, method='median')
mean_xys=block_xy(pnts, method='mean')

# Quick plot
plot(r)
plot(rasterToPolygons(r), add=TRUE, border='black', lwd=0.5)
points(pnts$x, pnts$y, pch=20, col='blue')
points(med_xys, pch=4, col='green')
points(mean_xys, pch=4, col='red')
```

!["Concave hull" boundary - not ideal]({{ site.baseurl }}/images/blockmean/blockmean_blockmedian.png "Quasi-gridded points. Raster is coloured by cell number, original points are in blue, blockmedian points are in green and blockmean points are in red.")
*Quasi-gridded points. Raster is coloured by cell number, original points are in blue, blockmedian points are in green and blockmean points are in red.*


text:
# Coniochaeta malacotricha (Auersw. ex Niessl) Traverso, 1907 SPECIES

#### Status
ACCEPTED

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

#### Published in
Fl. ital. crypt. 1(2): 473 (1907)

#### Original name
Rosellinia malacotricha Auersw. ex Niessl, 1872

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Database

The `database` directory contains the migration scripts.

You should have a php script for each schema you want to build. The name of the file must reflect the database configuration file.

To run the migration on the `example` schema, run `schema.php` from terminal with one of the following arguments:

```shell
> php database/example.php [migrate|drop|reset]
```

- `migrate` to run migration: new tables are created, modified tables are changed (where possible), removed tables are preserved
- `drop` all tables are dropped
- `reset` first drop, than migrate

repository: snoophp/snoophp

repo_name: snoophp/snoophp


text:
project_path: /web/_project.yaml
book_path: /web/shows/_book.yaml
description: We've analyzed tens of thousands of mobile websites to figure out what works and what doesn't when it comes to performance and user experience on mobile devices. Here's our list of best practices and dos and don'ts, with insight from engineers into the algorithms we use to determine what is a 'good' mobile website.

{# wf_updated_on: 2015-03-29 #}
{# wf_published_on: 2015-03-29 #}
{# wf_youtube_id: UEfZ3aeCjoY #}

# Mobile web lessons learned from analyzing websites at scale {: .page-title }

<div class="video-wrapper">
  <iframe class="devsite-embedded-youtube-video" data-video-id="UEfZ3aeCjoY"
          data-autohide="1" data-showinfo="0" frameborder="0" allowfullscreen>
  </iframe>
</div>

We've analyzed tens of thousands of mobile websites to figure out what works
and what doesn't when it comes to performance and user experience on mobile
devices. Here's our list of best practices and dos and don'ts, with insight
from engineers into the algorithms we use to determine what is a "good"
mobile website.

repository: shanselman/WebFundamentals

repo_name: shanselman/WebFundamentals


text:
This article describes the**Visitor design pattern**. This is a [behavioral design pattern](http://social.technet.microsoft.com/wiki/contents/articles/13209.behavioural-design-pattern.aspx), a category of [design pattern](http://social.technet.microsoft.com/wiki/contents/articles/13207.software-design-pattern.aspx) used by software engineers, when writing computer programs.

## Table of Contents

-
- [Introduction](#Introduction)
- [Benefits](#Benefits)
- [Examples of the pattern](#Examples_of_the_pattern)
- [See Also](#See_Also)
- [Community Resources](#Community_Resources)
- [References section](#References_section)

##

# Introduction

The Visitor pattern is a [design pattern](http://social.technet.microsoft.com/wiki/contents/articles/13207.software-design-pattern.aspx), used in software engineering to add new virtual functions to a class without needing to change the class itself. The class is passed into the visitor to be acted upon, effectively giving the actor extra
 functionality.

It is defined as a [behavioral design pattern](http://social.technet.microsoft.com/wiki/contents/articles/13209.behavioural-design-pattern.aspx), because it enables extra functionality to be performed.

# Benefits

Existing classes or closed classes can be re-used to perform new tasks, like save to a new file format.

↑ [
Return to Top](http://social.technet.microsoft.com/wiki/contents/articles/13233.visitor-design-pattern/edit.aspx#Top)

* * *

# Examples of the pattern

[please contribute]

↑ [
Return to Top](http://social.technet.microsoft.com/wiki/contents/articles/13233.visitor-design-pattern/edit.aspx#Top)

* * *

# See Also
Link to domain parent articles and related articles in TechNet Wiki.
- [Software Design Pattern](http://social.technet.microsoft.com/wiki/contents/articles/13207.software-design-pattern.aspx)
- [Behavioral Design Pattern](http://social.technet.microsoft.com/wiki/contents/articles/13209.behavioral-design-pattern.aspx)

↑ [
Return to Top](http://social.technet.microsoft.com/wiki/contents/articles/13233.visitor-design-pattern/edit.aspx#Top)

* * *

# Community Resources
These are the external links, including links to Microsoft and TechNet sites that are non-Wiki
- [Please contribute]

↑ [
Return to Top](http://social.technet.microsoft.com/wiki/contents/articles/13233.visitor-design-pattern/edit.aspx#Top)

* * *

# References section
Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.
- [Please contribute]

↑ [
Return to Top](http://social.technet.microsoft.com/wiki/contents/articles/13233.visitor-design-pattern/edit.aspx#Top)

* * *
![ ](http://c.statcounter.com/8278708/0/13fc676e/1/)


text:
#![logo](assets/icon128.png) grease-slack-direct

GreaseMonkey script to disable slow and faulty trip to `slack-redir.net` when clicking on links in [slack](https://slack.com/).

Based on [Chrome extension](https://github.com/jdanyow/slack-direct) by @jdanyow.

You can install this script either from here or [GreasyFork](https://greasyfork.org/en/scripts/14899-slack-direct).

repository: AlexCzar/grease-slack-direct

repo_name: AlexCzar/grease-slack-direct


text:
# Thesis Project

#### Table of Contents
- [Overview](#overview)
- [Bare Minimum Requirements](#bare-minimum-requirements)
  - [Group Formation](#group-formation)
  - [Role Assignment](#role-assignment)
  - [Project Organization](#project-organization)
  - [Product Design](#product-design)
  - [Project Infrastructure](#project-infrastructure)
    - [Project Backlog](#project-backlog)
    - [Contribution Guide](#contribution-guide)
    - [Style Guide](#style-guide)
    - [Project Readme](#project-readme)
  - [Continuous Deployment](#continuous-deployment)
  - [Team Communication](#team-communication)
    - [New Code](#new-code)
    - [Speaking to each other](#speaking-to-each-other)
  - [Product Development](#product-development)
  - [Test Driven Development](#test-driven-development)

## Overview

The Hack Reactor Thesis Project is your final and largest project as a student. It'll probably be the largest code base you share with potential employers. The project will last four weeks and will be the last step before you focus on hiring and job search.

You'll begin by working with your team to define a solid infrastructure to support your project.

Use the lessons you learned during the greenfield-project and the legacy-project to help inform the decisions you make now.

Refer to thesis-project repo (referenced repeatedly below) that you'll need to refer to as a guide regarding how to successfully document and structure your project on github.

## Bare Minumum Requirements

#### Group Formation

- [ ] Get into your assigned groups (link via Syllabus)

- Each member should spend five minutes (no talking) answering the following questions:
  - [ ] What are my 2 greatest technical strengths?
  - [ ] What are my 2 greatest technical challenges?
  - [ ] What are my personal goals for this project?

- Group Discussion
  - [ ] Discuss your individual answers with your group. Get to know each other.

### Role Assignment
As a group, decide which team members will fulfill each of the three core scrum roles.
  - [ ] [Product Owner][2]
  - [ ] [Scrum Master][3]
  - [ ] [Development Team][4]
  - [ ] Fill out the Team section in the readme with this info.

### Project Organization
Don't worry too much about choosing a name at this point. You'll likely refactor it several times anyway.
  - [ ] The Scrum Master must [Create a new GitHub Organization account](https://help.github.com/articles/creating-a-new-organization-account) for your team. This ensures that all members share equally in the glory of the project.
  - [ ] Add all your team-mates as members to the new org.
  - [ ] Create a repo within your new org for your project.

### Product Design
Create product vision by drafting a 'Project Summary'
  - [ ] Copy `_PRESS-RELEASE.md` into the root directory of your own project repo and complete the exercise described therein. Note that the actual instructions are hidden in a comment block. You'll need to view the raw file, not the rendered markdown version to see them.
  - [ ] Use github issues

### Project Infrastructure
In order to support your current team _and_ future contributors to your project, you'll need to document your project as you build it. It should be the case that, without any intervention or additional explanation from you, the next team of collaborators  (or yourself in six months) can dive in and figure out how to start hacking easily.

Document your project and codebase to the point that if you decide to push it to hacker-news, anyone with a solid understanding of JavaScript can (after reviewing your documentation and comments) start submitting pull requests. Plan on not having any face-to-face interaction with the next team of collaborators. The most effective and efficient way to accomplish this is to do it right from the very start. Don't wait till the last minute. That will never work.
  - [ ] Heavily comment all aspects of your code.

#### Project Backlog

Be sure keep your project backlog (using github issues) up to date. There should be clear
documentation of tasks completed (github provides this functionality automatically) and
next steps/features in your project backlog so that your collaborators can just dive right in.

You should use github issues to track both your project's backlog of tasks and
fixes and to provide a way to track future goals. You can use labels to
organize issues and milestones to group issues together and to visualize your
progress.

You may want to take advantage of a tool like [waffle.io](https://waffle.io) to manage github
issues with a more powerful interface and can provide a kanban-board-like place to manage your
project and workflow.

#### Contribution Guide

- [ ] Document your team's git workflow by copying `_CONTRIBUTING.md` into the root directory of your repo and editing it suite your needs. It follows a [forking workflow](https://www.atlassian.com/git/workflows#!workflow-forking).

The provided `_CONTRIBUTING.md` advocates for a `git rebase` based workflow
instead of a `git merge` based workflow. The advantage of a `rebase` based
workflow over `merge` is that a rebase, even one which fixes conflicts, does
not introduce a new commit into your history. If you use `merge` and there are
any conflicts, then you will get a new "merge commit" in your history. Over
time, you can accrue hundreds of merge commits which can make your history
significantly harder to read and introduce a much lower signal to noise ratio
in your history. `rebase` avoids these problems by changing existing commits
instead of creating a new one.

Because `rebase` changes commits, you will have to push with the `-f` or
`--force` flag to your branch after rebasing, as the history has changed in a
way that git cannot resolve. You should _never_ rebase or push with force to
the `master` branch of your repository, as that will invalidate everyone elses
clones and checkouts of the repository.

Though it advocates for a slightly different version of the rebase workflow, the article, [A romance of a single dimension: linear git history in practice](http://www.thumbtack.com/engineering/linear-git-history/) does an excelent job of justifying the practice. I strongly recomend reading it, even if you choose a different option.

##### `CONTRIBUTING.md` Workflow Diagram

![](http://i.imgur.com/p0e4tQK.png)

Remember, you're welcome to use which ever git workflow you want, `_CONTRIBUTING.md` is provided here as a suggestion (with the intention of you editing it). But whichever workflow you choose, you must document it well, you __must__ be consistent, and you should always have someone other than the person who wrote the code review it before it's merged into the central repository.

#### Style Guide
- [ ] Document your team's style guide by copying `_STYLE-GUIDE.md` into the root directory of your repo. `_STYLE-GUIDE.md` is provided as a template, you should edit it to reflect your agreed upon setup.
  - [AirBnB's](https://github.com/airbnb/javascript) and [The Google JS Style Guide](https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml) are also excellent examples.

#### Project Readme
Your project readme is the very first thing that users will see when they view your github project. It's the portal that must link to the other content files in the root of your repo.
- [ ] Use `_README.md` as a template to create a thorough readme.
  - It must link to the documentation you've created (as described by the items above).

### Continuous Deployment
You must have a deployed website setup.
- [ ] Configure automatic deployment of your master branch using Azure

### Team Communication

#### New Code

Your team should communicate new ideas for features or report important bugs
through github issues or whatever tool you use to manage github issues, that
way everyone on your project can see what important things are happening and
there is always a repository of further work to be done.

To introduce new code into your project, your team should _always_ make pull
requests - never make commits and push directly to master. After you make a
pull request, at least one other member of your team should do a thorough code
review of the changes and you should have a good back and forth where the code
is refactored and improved before being merged in. This will guarantee a higher
degree of code quality and will prevent careless errors from being merged into
your application.
- [ ] Read this excellent (and brief) [article about pull requests](https://github.com/blog/1124-how-we-use-pull-requests-to-build-github)

With continuous integration, you will benefit even more from a
pull request based workflow because you will always know that you are never
merging breaking code into your master branch.

#### Speaking to each other

You may want to use a persistent chat service like [hipchat](5), [slack](6), or irc to
communicate as a team so that you can have efficient asynchronous
communication. This will make your team more accountable and efficient, so you
don't have to stop everyone else's work to discuss small issues or request code
review.

### Product Development
- [ ] Create a simple home page for your project.
  - If you're not sure where to start, checkout using GitHub pages. It's free, robust, and can easily be personalized to your own domain.
  - [ ] Make the landing page a salesman's dream (clear, flashy, cool design, etc)! Templates are your friends!
  - [ ] If your application requires users to create an account, create a 'demo' account so that when you link to your project on your resume, you can provide login credentials for this demo account, making it easy for the potential employer / recruiter to see your awesome work.

### Test Driven Development

During your Thesis Project, you'll be using TDD.

Test driven development is not valuable because it catches errors, but because it changes the way you think about interfaces between modules. Writing tests before you write code influences how you think about the process. It provides a safety net for performing refactoring and it documents the expected behavior of the system.

Refer to the the solution branch of the [testify](/curriculum/testify) for some solid examples

You must implement _all_ of the following:
  - [ ] Include testing when defining your project scope
  - [ ] Continuous integration to run all tests on commit
    - You can use any CI system you like, TravisCI (easy) or Circle-CI (med) or Jenkins (hard) are all options
  - [ ] Make testing part of daily standups
  - [ ] Discuss testing during mentor check-ins

You must implement 2-3 of the following:
  - [ ] Unit testing on the client
  - [ ] Unit testing on the server side
  - [ ] Integration testing for your API and database
  - [ ] End-to-end testing for your main workflows
  - [ ] Code coverage reports for unit tests
  - [ ] Visual testing for your app’s look and feel

### Project Timeline
- Plan your work in two-day sprints.
  - Sprint 1: Ideation
  - Sprint 2: Research
  - Sprint 3: Refinement
  - Sprint 4: Begin MVP
  - Sprint 5: Continue toward MVP
  - Sprint 6: Complete MVP
  - Sprint 7: Refactor and New Features
  - Sprint 8: Refactor and New Features
  - Sprint 9: Feature Freeze - after the conclusion of this sprint, no new features should be added
  - Sprint 10: Feature Complete - at the conclusion of this sprint, all work on existing features should be finished
  - Sprint 11: Polish
  - Sprint 12: Presentations

<!--
### Code Reviews
- __Start in late week 10__
- Who gets one?: Student projects receive code reviews from Hack Reactor mentors. Hosted projects receive them from mentor engineers at the host company.
- Format: Code reviews are 1-hour and have a dedicated Mentor and room. All team members are expected to join and are expected to provide the mentor with a focused set of questions or features/classess to examine and take feedback on in that time. Please do not expect to review 100% of your codebase.
- [ ] Locate you calendar invite from the Instruction Team in your email
  -  If you have difficulty finding it, reference this [schedule](https://docs.google.com/spreadsheets/d/1XXEWnBChT3oWxOWZX6tICwvwqkiE1wZbQX8dnxxIRig/edit#gid=220699446)
- [ ] Maximize effectiveness by eliminating low level feedback by adhering to these guidlines for ["every code review ever"](https://github.com/hackreactor/curriculum/wiki/Projects:-Every-Code-Review-Ever)
- [ ] Implement Code Review feedback by the end of thesis project completion.
- Extra Credit: Review [Getting and Giving Good Code Reviews](https://github.com/hackreactor/curriculum/wiki/Projects:-getting-and-giving-good-code-reviews)

### Project Summaries

Fill out a project summary for your group [here](https://drive.google.com/drive/#folders/0B1sN34rdEL70MXZSUlRXTlVXaUE)
-->

<!-- LINKS -->

[1]:http://en.wikipedia.org/wiki/Scrum_(software_development)#Roles
[2]:http://en.wikipedia.org/wiki/Scrum_(software_development)#Product_Owner
[3]:http://en.wikipedia.org/wiki/Scrum_(software_development)#Scrum_Master
[4]:http://en.wikipedia.org/wiki/Scrum_(software_development)#Development_Team
[5]:https://www.hipchat.com/
[6]:https://slack.com/

repository: real-DEAL/Breadcrumb

repo_name: real-DEAL/Breadcrumb


text:
# FEZ Cobra II Eco and Wi-Fi
---
![FEZ Cobra II Eco](images/fez-cobra-ii.jpg) ![FEZ Cobra II WiFi](images/fez-cobra-ii-wifi.jpg) ![FEZ Cobra II](images/fez-cobra-ii-net.jpg)

FEZ Cobra II is a .NET Gadgeteer product that utilizes .NET Micro Frameworks (NETMF). The core of FEZ Cobra II is the G120 System on Module (SoM).

Follow the instructions on the [G120 page](../scm/g120.md) to learn how to use FEZ Cobra with NETMF and TinyCLR OS.

## Resources
* Eco and WiFi [Schematic](http://files.ghielectronics.com/downloads/Schematics/FEZ/FEZ%20Cobra%20II%20Schematic.pdf)
* Net [Schematic](http://files.ghielectronics.com/downloads/Schematics/FEZ/FEZ%20Cobra%20II%20Net%20Schematic.pdf)
* Cobra II Extender [schematic](http://files.ghielectronics.com/downloads/Schematics/FEZ/FEZ%20Cobra%20II%20Extender%20Schematic.pdf)

> [!Tip]
> To activate bootloader v2, press and hold the LDR0 button while resetting the board.

repository: ghi-electronics/Docs

branch_name: refs/heads/dev

gha_language: Makefile

repo_name: ghi-electronics/Docs


text:
---
title: Filter Menu
page_title: Grid - Filter Menu
description: Enable and configure Filter Menu in Grid for Blazor.
slug: grid-filter-menu
tags: telerik,blazor,grid,filtering,filter,menu
published: True
position: 10
---

# Grid Filter Menu

One of the [filter modes of the grid]({%slug components/grid/filtering%}) is a popup menu with filter options that you can open from the column headers.

In this article:

* [Basics](#basics)
* [Filter From Code](#filter-from-code)
* [Customization](#customization)

## Basics

To enable the filter menu, set the `FilterMode` property of the grid to `Telerik.Blazor.GridFilterMode.FilterMenu`.

The grid will render a button in the column header that you click to get a popup with filtering options. The popup lets you choose filter operator, filter criteria, to apply and clear the filter.

The filter is applied only upon a button click, not upon input change. This may improve performance if you use [manual CRUD operations]({%slug components/grid/manual-operations%}) by reducing the number of requests compared to using the [Filter Row]({%slug grid-filter-row%}).

>caption Filter Menu in Telerik Grid

````CSHTML
@* Filter menu in the column header *@

<TelerikGrid Data=@GridData FilterMode="Telerik.Blazor.GridFilterMode.FilterMenu"
			 Pageable="true" Height="400px">
	<GridColumns>
		<GridColumn Field=@nameof(Employee.Name) />
		<GridColumn Field=@nameof(Employee.AgeInYears) Title="Age" />
		<GridColumn Field=@nameof(Employee.HireDate) Title="Hire Date" />
		<GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
	</GridColumns>
</TelerikGrid>

@code {
	public List<Employee> GridData { get; set; }

	protected override void OnInitialized()
	{
		GridData = new List<Employee>();
		var rand = new Random();
		for (int i = 0; i < 100; i++)
		{
			GridData.Add(new Employee()
			{
				EmployeeId = i,
				Name = "Employee " + i.ToString(),
				AgeInYears = rand.Next(10, 80),
				HireDate = DateTime.Now.Date.AddDays(rand.Next(-20, 20)),
				IsOnLeave = i % 3 == 0
			});
		}
	}

	public class Employee
	{
		public int? EmployeeId { get; set; }
		public string Name { get; set; }
		public int? AgeInYears { get; set; }
		public DateTime HireDate { get; set; }
		public bool IsOnLeave { get; set; }
	}
}
````

>caption The result from the code snippet above, after the "Age" column has been filtered with <= 30 operator.

![Blazor Grid Filter Menu](images/filter-menu-1.png)

## Filter From Code

You can set the grid filters from your code through the grid [state]({%slug grid-state%}).

@[template](/_contentTemplates/grid/state.md#initial-state)

>caption Set filtering programmatically

````CSHTML
@[template](/_contentTemplates/grid/state.md#filter-menu-from-code)
````

@[template](/_contentTemplates/grid/state.md#filter-menu-default-filters)

## Customization

The Grid allows you to customize the default behavior of the Filter Menu in a couple ways:

### Configuring the Filter Menu

You can override the default Filter Row behavior for each column through the following property the `GridColumn` exposes:

@[template](/_contentTemplates/common/filtering.md#filter-menu-customization-properties)

>caption Configure the Filter Menu

````CSHTML
@*Customize the Filter Menu*@

@using Telerik.DataSource

<TelerikGrid Data="@MyData"
             Height="400px"
             Pageable="true"
<EMAIL_ADDRESS>    <GridColumns>
        <GridColumn DefaultFilterOperator="FilterOperator.IsEqualTo"
                    Field="@(nameof(SampleData.Id))" Width="120px" />
        <GridColumn DefaultFilterOperator="FilterOperator.StartsWith"
                    Field="@(nameof(SampleData.Name))" Title="Employee Name" />
        <GridColumn DefaultFilterOperator="FilterOperator.Contains"
                    Field="@(nameof(SampleData.Team))" Title="Team" />
        <GridColumn DefaultFilterOperator="FilterOperator.IsGreaterThanOrEqualTo"
                    Field="@(nameof(SampleData.HireDate))" Title="Hire Date" />
    </GridColumns>
</TelerikGrid>

@code {
    public IEnumerable<SampleData> MyData = Enumerable.Range(1, 30).Select(x => new SampleData
        {
            Id = x,
            Name = "name " + x,
            Team = "team " + x % 5,
            HireDate = DateTime.Now.AddDays(-x).Date
        });

    public class SampleData
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
        public DateTime HireDate { get; set; }
    }
}
````

### Filter Menu Template

The template will let you have full control over the Filter Row rendering and behavior. See how you can implement it and explore the example in the [Filter Menu Template]({%slug grid-templates-filter%}#filter-menu-template) article.

## See Also

  * [Grid Filtering Overview]({%slug components/grid/filtering%})
  * [Live Demo: Grid Filter Menu](https://demos.telerik.com/blazor-ui/grid/filter-menu)

repository: telerik/blazor-docs

repo_name: telerik/blazor-docs


text:
Ansible role: ufw-port-forward
=========

An ansible role that enables port forwarding with ufw

Requirements
------------

ufw installed on the server

Role Variables
--------------

The list of ports forward settings
It is required

    ufw_port_forward_settings

An example is available in the example playbook below
All fields are required because used

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: all
      roles:
        - role: ekougs.ufw-port-forward
      vars:
        - ufw_port_forward_settings:
            - src_interface: enp0s3
              src_ip: <IP_ADDRESS>
              src_port: 80
              dest_ip: <IP_ADDRESS>
              dest_port: 8080

License
-------

MIT / BSD

Author Information
------------------

[Pascal Ekouaghe](https://www.linkedin.com/in/pascal-ekouaghe-93972028/)


text:
# RingsOnMap
Draw Ring shapes on top of Google Maps

Rings-on-Map is a example project for using Google-Maps-API.
The application build with WebPack v3, developed with AngularJS in TypeScript language.

### Version
0.0.1

### Tech

Rings-on-Map uses a number of open source projects to work properly:

AngularJS - is a structural framework for dynamic web apps.
WebPack - is a module bundler. WebPack takes modules with dependencies and generates static assets representing those modules. WebPack provide development server and compile your code for production (minify, uglify etc).

## Installation
RingsOnMap requires [Node.js](https://nodejs.org/) to run.

Once Node.JS was insalled and this project was downloaded. Open the command-line and navigate to the /App directory.
```sh
$ cd App
```

Install the dependencies and devDependencies.

```sh
$ npm i
```

## Execution
You can run this project in two ways: development (loading the application from the memory) or production (loading the application from the disk)

### Devlopment mode
To run this project in development mode run webpack-dev-server by executing the script

```sh
$ npm run dev
```

Once webpack-dev-server loaded, open you browser and navigate to
```sh
http://localhost:9000
```

### Production mode
To run this project in production mode run webpack by executing the script

```sh
$ npm run prod
```

Once webpack build the application a dist folder will be created. Copy the index.html file to the /dist folder and open the index.html file.

repository: Gil-Epshtain/RingsOnMap

repo_name: Gil-Epshtain/RingsOnMap


text:
+++
title = "Least Squares Estimation"

# date = {{ .Date }}
lastmod = 2020-07-14

draft = false  # Is this a draft? true/false
toc = true  # Show table of contents? true/false
type = "docs"  # Do not modify.

# Responsible teacher (email)
responsibleteacher =<EMAIL_ADDRESS>
# Add menu entry to sidebar.
[menu.5cta0]
name = "2.4 Least Squares Estimation"
weight = 240

+++
## Introduction
The application of the least-squares estimation dates back until Gauss, who used it to study planetary motions. The popularity of the least-squares estimation has not decreased ever since and it remains a widely applied estimator. The least-squares estimator (LSE) does not make any probabilistic assumptions on the observed data. Thus, it is suitable in situations where the precise statics is not known. However, due to the lack of statics of the observed data, no assertion about optimality of the estimator can be made.

The concept of the least-squares estimation can be described as follows. A signal is generated by a deterministic signal model $s[n;\theta]$ that is parametrized by a parameter $\theta$. Due to noise or model inaccuracies, the observed data $x[n]$ deviates from the signal model. As the name suggest, the least-squares approach aims to minimize the squared difference between the observed data and the signal model. Thus, the least-squares error criterion is defined as
\begin{equation}
	J(\theta) = \sum_{n=0}^{N-1}(x[n]-s[n;\theta])^2.
  \label{eq:ls_criterion}
\end{equation}

The least-squares estimate $\hat{\theta}\_{\text{LSE}}$ is the value of the parameter $\theta$ that minimizes \eqref{eq:ls_criterion}, i.e.,
\begin{equation}
	\hat{\theta}_{\text{LSE}} = \underset{\theta}{\operatorname{arg\\,min}}J(\theta).
\end{equation}
From this perspective, the least-squares estimator can be considered as an optimization problem of fitting a model to some available data.

---

Example:

Suppose we want to estimate the energy consumption per km of an electric car. For this pupose, we record at each recharge of the car the amount of energy charged $E$ and the distance travelled $D$. Visualizing the recordings give following picture.

	      Recorded energy consumption vs. distance travelled.

From the figure we can see that the energy consumption increases almost linearly with the distance travelled. Thus, we can assume a linear relation between the energy consumption and the distance travelled:
\begin{equation}
 s[n;\theta] = \theta D[n].
 \label{eq:model}
\end{equation}
In this model, the parameter $\theta$ represents the slope of the line. From the figure, however, we can also see that the data points do not exactly lie on a line. The discrepancy between the model and data comes from the model inaccuracy: the energy consumption depends on more parameters than just the distance. Nonetheless, the suggest model serves our purpose. The least-square error  criterion becomes
\begin{equation}
 J(\theta) = \sum_{n=0}^{N-1} (x[n]-\theta D[n])^2.
\end{equation}
Taking the derivative with respect to $\theta$ and equating it to zero yields
\begin{equation}
		\hat{\theta}\_{\text{LSE}} = \frac{\sum_{n=0}^{N-1}x[n]D[n]}{\sum_{n=0}^{N-1}D^2[n]}.
		\label{eq:electric_car}
\end{equation}

	      Line fitted to the data.

---
In the example above, we were only interested in estimating a single parameter $\theta$. In general, the signal model can be dependent on several parameters. Consider for example, the signal model
\begin{equation}
	s[n; A, f_0] = A\cos(2\pi f_0 n)
\end{equation}
where $A$ and $f_0$ are the amplitude and the frequency of the signal, respectively. This signal model is parametrized by two parameters $A$ and $f_0$, which can be expressed in a vector $\boldsymbol\theta = [A, f_0]^T$. In this case we write $s[n;\boldsymbol\theta]$. In the following, we will consider vector parameters since the scalar case arise as a special case of the vector parameters.

Depending on the signal model, we can distinguish between linear and nonlinear least-squares estimators. The electric car example was a linear estimation problem, whereas the signal model
\begin{equation}
s[n,f_0] = A \cos(2\pi f_0 n)
\end{equation}
is nonlinear in the parameter $f_0$. The focus of this module is the linear LSE. Nonlinear LSE rely on numerical methods which are treated separately in the module Numerical Methods. However, for some particular nonlinear problems it is possible tor convert them either into a linear problem or to separate them into a linear and a nonlinear part. These two special cases are covered at the end of this module.

## Linear Least Squares Estimator
A linear signal model, as shown in the module on MVUE for linear signal models, is any model of the form
\begin{equation}
  s[n;\boldsymbol\theta] = \sum_{k=0}^{K-1} h_k[n]\theta_k.
\end{equation}
Typically, more than one observation is available. In this case, the linear least-squares estimator can be expressed as
\begin{equation}
  \mathbf{s} = \mathbf{H}\boldsymbol\theta
  \label{eq:ls_linear}
\end{equation}
where $\mathbf{s}$ is the signal vector, $\mathbf{H}$ is the so called observation matrix, and $\boldsymbol\theta$ is the parameter vector.

---

Using the matrix notation in \eqref{eq:ls_linear}, the least-squares error criterion in \eqref{eq:ls_criterion} can be expressed as
\begin{align}
  J(\boldsymbol\theta)&= \\|\mathbf{x}-\mathbf{H}\boldsymbol\theta\\|^2\nonumber\newline
											&=(\mathbf{x}-\mathbf{H}\boldsymbol\theta)^T(\mathbf{x}-\mathbf{H}\boldsymbol\theta)\nonumber\newline
                      &= (\mathbf{x}^T-\boldsymbol\theta^T\mathbf{H^T})(\mathbf{x}-\mathbf{H}\boldsymbol\theta) \nonumber \newline
                      &= \mathbf{x}\mathbf{x}^T - 2 \mathbf{x}^T \mathbf{H}\boldsymbol\theta +\boldsymbol\theta^T\mathbf{H}^T \mathbf{H}\boldsymbol\theta.
\end{align}
The corresponding gradient is
\begin{equation}
    \frac{\partial J(\boldsymbol\theta)}{\partial \boldsymbol\theta}  = -2\mathbf{H}^T\mathbf{x}+2\mathbf{H}^T\mathbf{H}\boldsymbol\theta.
\end{equation}
The minimum can be found by setting the gradient to zeros and solving for $\boldsymbol\theta$. The linear least-squares estimator is then
\begin{equation}
    \hat{\boldsymbol\theta}\_{\text{LSE}} = (\mathbf{H}^T\mathbf{H})^{-1}  \mathbf{H}^T \mathbf{x},
		\label{eq:LSE}
\end{equation}
which is referred to as normal equation. Returning to the electric car example, we have the special case of a single parameter $\theta$. In this case, the observation matrix becomes a vector with the distances $D[n]$ as its entries. The expression $\mathbf{H}^T\mathbf{H} = \sum_{n=0}^{N-1}D^2[n]$. Note that $\sum_{n=0}^{N-1}D^2[n]$ is a scalar and its inverse is $1/(\sum_{n=0}^{N-1}D^2[n])$. On the other hand, the expression $\mathbf{H}^T\mathbf{x}$ is $\sum_{n=0}^{N-1}x[n]D[n]$. Combining these two expressions we obtain the least-squares estimate in \eqref{eq:electric_car}.

### Geometric Interpretation
The previous derivation is based on minimizing the squared error term in \eqref{eq:ls_criterion}. The least-square estimation can also be derived based on geometrical interpretations. To obtain this geometrical interpretation, we assume that more observations than parameters to be estimated are available, i.e., $N>K$. With this assumption, we can interpret \eqref{eq:ls_linear} from a geometric point of view. The vector $\mathbf{s}$ and the column space of $\mathbf{H}$ have dimension $N$. However, since $N>K$, the linear combination
\begin{equation}
\mathbf{s} = 	\mathbf{H}\boldsymbol\theta = \sum_{k=0}^{K-1} \theta_k \mathbf{h}_k,
\end{equation}
where $\mathbf{h}_k$ is the $k$th column of $\mathbf{H}$, spans only a $K$ dimensional subspace of the $N$-dimensional space. This is examplified in the next figure for the case $N=3$ and $K=2$.

	      The data vector $\mathbf{x}$ does not lie in the subspace spanned by the columns of $\mathbf{H}$, which is indicated by the red plane.

From the geometric point of view, the least-squares error criterion in \eqref{eq:ls_linear} describes the length of the error vector, i.e., the vector between data vector $\mathbf{x}$ and the $\mathbf{s}$ which is in the subspace. The length of the error vector becomes a minimum if it is orthogonal to the subspace, which is known as the orthogonality principle. An example of an orthogonal error vector is illustrated below.

	      The length of the error vector becomes a minimum if it is orthogonal to the subspace spanned by the columns of $\mathbf{H}$.

The error vector is orthogonal to the subspace if it is orthogonal to all vectors which span the space, i.e.,
\begin{align}
\mathbf{H}^T \mathbf{e} = \mathbf{H}^T (\mathbf{x-H}\boldsymbol\theta) = \mathbf{0}
\end{align}
with $\mathbf{0}$ denoting the zero vector.

\begin{equation}
\hat{\boldsymbol\theta}_{\text{LSE}} = (\mathbf{H}^T\mathbf{H})^{-1}\mathbf{H}^T\mathbf{x}
\end{equation}

### Weighted Least Squares Estimation

For some estimation problems, we might want to reduce the influence of a portion of the data on our final estimate. For example, the data of the can be provided by different sensors. Moreover, some sensors may have a higher accuracy than others, and thus, we have more confidence in their measurement result. However, even though the other sensor measurement results are less accurate, they still provide some information. The different confidence in the measurement result can be incooperated in least-squares estimator by assigning them different weights, which leads to the weighted least-squares estimator (WLSE). In general, we can express the weighted least-squares error criterion as
\begin{equation}
J(\boldsymbol\theta) = (\mathbf{x}-\mathbf{H}\boldsymbol\theta)^T\mathbf{W}(\mathbf{x}-\mathbf{H}\boldsymbol\theta)
\end{equation}
where $\mathbf{W}$ is a positive definite matrix. For the particular case that $\mathbf{W}$ is diagonal, we obtain
\begin{equation}
J(\boldsymbol\theta) = \sum_{n=0}^{N-1} w_n (x[n]-s[n;\boldsymbol\theta])^2,
\end{equation}
where $w_n$ is the $n$th diagonal element of $\mathbf{W}$.

The weighted LSE is obtained by setting the gradient to zero, which yields
\begin{equation}
\hat{\boldsymbol\theta}_{\text{LSE}}=(\mathbf{H}^T\mathbf{W}\mathbf{H})^{-1}\mathbf{H}^T\mathbf{W}\mathbf{x}.
\end{equation}

### Gauss-Markov Theorem
The Gauss-Markov theorem states that if the signal model is linear with additive noise, i.e.,
\begin{equation}
	\mathbf{x} = \mathbf{H}\boldsymbol\theta + \mathbf{w},
\end{equation}
where $\mathbf{w}$ has zero mean and covariance matrix $\mathbf{C}$, then the WLSE with weights $\mathbf{W} = \mathbf{C}^{-1}$ is the BLUE. The BLUE is then
\begin{equation}
\hat{\boldsymbol\theta}_{\text{LSE}}=(\mathbf{H}^T\mathbf{C}^{-1}\mathbf{H})^{-1}\mathbf{H}^T\mathbf{C}^{-1}\mathbf{x},
\label{eq:GM}
\end{equation}
and the covariance matrix is
\begin{equation}
	\mathbf{C}\_{\hat{\boldsymbol\theta}} = \\left( \mathbf{H}^T\mathbf{C}^{-1}  \mathbf{H} \\right) ^{-1}.
\end{equation}
The variance of the individual estimates is given by the diagonal elements of the covariance matrix. Note that the theorem does not specify the actually distribution of the noise. Furthermore, if $\mathbf{C} = \sigma^2\mathbf{I}$, i.e., the noise is uncorrelated and has variance $\sigma^2$, then \eqref{eq:GM} simply is the LSE in \eqref{eq:LSE}

## Nonlinear Least Squares Estimator

Until now, we dealt with linear signal models, i.e., functions that are linear in the parameter vector $\boldsymbol\theta$. For this particular case, we were able to derive a closed form expression for the least-squares estimate based on the observation matrix $\mathbf{H}$. In general, the signal model can also be nonlinear in the parameter vector $\boldsymbol\theta$. Thus, it cannot be expressed as in \eqref{eq:ls_linear}. Instead, we express the least-squares error criterion as
\begin{equation}
		J(\boldsymbol\theta) = (\mathbf{x}-\mathbf{s}(\boldsymbol\theta))^T(\mathbf{x}-\mathbf{s}(\boldsymbol\theta))
\end{equation}
Minimizing the cost function $J(\boldsymbol\theta)$ is more difficult and typically relies on numerical optimization methods. However, for some problems it is possible to transform them into linear problems or separate them in a linear and a nonlinear part. Separating the problem allows to reduce the complexity of the optimization since for the linear part, close forms solution are available. In the following, we examine these specific cases.

### Transformation of Parameters

Optimization problems have the property that they can be carried out in a transformed space that is obtained by a one-to-one mapping. Once the minimum is found in the transformed space, it can be transformed back to the original space. This property can be used to produce a linear signal model. Therefore, let
\begin{equation}
\boldsymbol\alpha = g(\boldsymbol\theta)
\end{equation}
be a functions whose inverse exists. If we can find a function $g(\boldsymbol\theta)$ such that
\begin{equation}
\mathbf{s}(\boldsymbol\theta(\boldsymbol{\alpha}))=\mathbf{s}(g^{-1}(\boldsymbol{\alpha}))=\mathbf{H}\boldsymbol\alpha
\end{equation}
then the signal model will be linear in $\boldsymbol{\alpha}$. We can use the linear LS formulations we derived so far and find the parameter $\theta$ through the inverse transform by
\begin{equation}
\hat{\boldsymbol\theta} = g^{-1}(\hat{\boldsymbol{\alpha}}),
\end{equation}
where
\begin{equation}
\boldsymbol\alpha = (\mathbf{H}^T\mathbf{H})^{-1}\mathbf{H}^T\mathbf{x}.
\end{equation}

---
Example:

The relation between the phase of a sinusoidal signal and the data samples from that signal is nonlinear:
\begin{equation}
s[n,\theta] = \sin(2\pi fn + \theta).
\end{equation}
It is possible to transform the signal such that the signal model is in a linear relation with a function of the phase term $\theta$. Consider the trigonometric identity:
\begin{equation}
\sin(A+B)=\sin(A)\cos(B)+\cos(A)\sin(B).
\end{equation}
Then the signal model can be rewritten as
\begin{equation}
s[n,\theta]=\sin(2\pi fn)\cos(\theta) + cos(2\pi fn)\sin(\theta).
\end{equation}
To implement least squares estimation, we substitute the phase $\theta$ with two other parameters, $\alpha_1=\cos(\theta)$ and $\alpha_2=\sin(\theta)$. The signal model in vector form becomes
\begin{equation}
\mathbf{s}(\theta) = \mathbf{s}(f^{-1}(\alpha))=\mathbf{H}\alpha
\end{equation}
where $\mathbf{H}=[\mathbf{s}\mathbf{c}]$ is the observation matrix consisting of two columns,
\begin{equation}
\mathbf{s}=\big[0 ~ \sin(2\pi f) ~ \sin(2\pi 2f) ~ ... ~ \sin(2\pi Nf)\big]^T,
\end{equation}
\begin{equation}
\mathbf{c}=\big[1 ~ \cos(2\pi f) ~ \cos(2\pi 2f) ~ ... ~ \cos(2\pi Nf)\big]^T,
\end{equation}
and the parameter vector is $\alpha=[\alpha_1 ~~ \alpha_2]^T$

---

### Separating the Nonlinear and Linear Parts of a Problem

The second method of dealing with nonlinear problems consist of dividing the problem into linear and non-linear parts. The parameters to be estimated are divided into two sets such that $\boldsymbol\theta=\begin{bmatrix}\boldsymbol\theta_a&\boldsymbol\theta_b\end{bmatrix}^T$, where
\begin{equation}
\mathbf{s}(\boldsymbol\theta)=\mathbf{H}(\boldsymbol\theta_a)\boldsymbol\theta_b.
\end{equation}
In other words, we write the signal model such that some of the parameters to be estimated, $\boldsymbol\theta_a$, are left inside the observation matrix, which is in a linear relation with the remaining parameters $\boldsymbol\theta_b$. We can still use the linear LSE for estimating the parameters $\boldsymbol\theta_b$, after finding the parameters $\boldsymbol\theta_a$.

---
Example:

Consider a capacitor-resistor circuit where the capacitor is charged up to a voltage level $V_b$ and then left to discharge over the resistor. The measured voltage over the resistor is given by
\begin{equation}
x[n]=V_b \exp\\left(-\frac{nT_s}{RC}\\right),
\end{equation}
where $T_s$ is the sampling period, $R$ is the resistance, and $C$ is the capacitance. To estimate the value of $RC$ and $V_b$ from a set of $N$ samples, we separate the problem into a non-linear and a linear part:
\begin{equation}
\mathbf{x}=\mathbf{h}(RC)V_b,
\end{equation}
where
\begin{equation}
\mathbf{h}(RC)=\begin{bmatrix}h& h^2& \dots& h^N\end{bmatrix}^T
\end{equation}
is the observation matrix and
\begin{equation}
h=\exp\\left(-\frac{T_s}{RC}\\right).
\end{equation}
The solution to $V_b$ can be found by
\begin{equation}
\hat{V}_b=\\left(\mathbf{h}^T(RC)\mathbf{h}(RC)\\right)^{-1}\mathbf{h}^T(RC)\mathbf{x},
\end{equation}
if the value for RC can be found by another method.

---

repository: bartvanerp/SPSsite

gha_language: HTML

repo_name: bartvanerp/SPSsite


text:
# Spring Demo Grocery POS*
#### *Point Of Sale System

## An executable, opinionated example of why, where, and how to write tests in a way that supports XP/Agile engineering practices.

This application is written in Spring Boot demonstrating best testing practices focused
on responsibilities of components by layers with an emphasis on highly performant unit testing.
This is a work in progress, but is responsibly broken down to focus on a simple classic MVC design
and testing with emphasis on component "unit" responsibilities.  Not testing in the UI what can be tested
at the service level, not testing at the service level what can be tested at the unit level.

Here's the main thing to understand about testing if don't want to create legacy code:

Do this:

![Martin Fowler's Test Pyramid](https://martinfowler.com/bliki/images/testPyramid/test-pyramid.png)

Not this:

![Ice cream code testing Anti-Pattern](https://images.contentful.com/3cttzl4i3k1h/6Qc0lWQ4IE4KeisAgyeUAC/365239996e6c8e83afc5fd8fbce69831/automation-pyramid-2.png)

Why?  Simple:

![Computer vs. Human Scale](https://formulusblack.com/wp-content/uploads/2019/02/Screen-Shot-2019-02-01-at-12.16.39-PM.png)

Unit Tests should each run in 10s of milliseconds of real time (RAM/CPU activity), days in comparison to human scale.

Integration tests typically hit network and/or disk IO, think years or decades in human comparison.

UI tests are closer to centuries in human scale.

If you think in that comparison, where do you want to focus your time testing as a system
continues to grow and change?

## Sounds easy, but it's hard.  Let's start with some definitions:

![I do not think it means...](./doc/image/UnitTestingAsTestersTyping.jpg)

## Some Testing Definitions
### Unit Test
A test that executes rapidly, using only CPU and RAM.  Can easily be run concurrently on multiple
CPU threads if configured properly.  The IDEAL location for business logic.

### Integration/Service Test
Some levels of work have to be done to provide service outside of pure RAM and CPU of course.  This typically
falls to the realm of external web services, databases and the like.  These typically involve using a stubbed service
and exercising more of the application stack (e.g. database layer testing, restful client testing).

### UI Tests
UI Tests simulate the full activity of a user using the system.  In the case of many web based applications, that
means starting up a web browser and directing it to simulate user activity.

## The 'Hello, POS system!'
### The example
This example system is a [Java 11](https://openjdk.java.net/projects/jdk/11/)
[Spring Boot](https://spring.io/projects/spring-boot)
[WebMVC](https://spring.io/guides/gs/serving-web-content/)
application using [PostgreSQL](https://www.postgresql.org/) database,
[JDBI](https://jdbi.org) declarative relational database library,
[Flyway](https://flywaydb.org/) database migration system, and
[Freemarker](https://freemarker.apache.org/) view templates.

### The opinions
Here's a few of the opinions that drove my selection of the various technologies to demo:
1. Java 11 - It's Java, a good solid OO language and version 11 is a LTS versions (I'm using OpenJDK
   for my own political satisfaction)
1. Spring Boot - I've been a fan of Spring since before 'Boot' was around.  It's an expandable
set of tools to build network based applications on.
1. Spring WebMVC - The frontend world is the same old hot mess today as it's always been.  In
   order to get a good feel for learning testing strategies, I wanted to keep this example simple.
1. PostgreSQL - I wanted open source SQL and I just like it better than MySQL.  Sue me.
1. JDBI 3 - After all my years fighting ORM systems you will *NOT* convince me to use one
   of my own free will.  Do yourself a favor and read [this](https://blog.codinghorror.com/object-relational-mapping-is-the-vietnam-of-computer-science/).
1. Flyway - I've used Liquibase, I just like Flyway better.  Don't do SQL based projects w/o a DB migration tool.
1.   Freemarker is dumb in a good way,
making it easy to push what might be UI edge cases down to faster running integration tests.

### The Tests

This demonstration has focused on Unit Testing in the following way:
1. Object level responsibilities for Spring Controllers & Services using:
   1. JUnit 5 tests with concurrent test execution enabled
   1. Fake objects for readability as opposed to mocking frameworks
1. Integration level responsibilities for Spring Repositories and View Templates using:
    1. SpringBootTest for Templates - using the same template engine to validate view
    behavior without the overhead of full UI tests
    1. Docker [Testcontainers](https://www.testcontainers.org/) for Database Integration - a full PostgreSQL database
       container for tests used exactly as would be for development and production.
1. UI level responsibilities for End to End testing using:
    1. Docker Testcontainers as above for database
    1. Docker Testcontainers for isolated Selenium Web Driver w/ Chromium web browser

## Setup and use notes
Development/build requires a local PostgreSQL database configured and running.

## This is still a bit of a work in progress
I'm putting this out there to show and tell.  I may or may not put some upgrades into it.

## Future goals (if I get around to them)
1. Full build on GitHub Actions, just to be cool
1. Clean up the TestSuites and/or isolate unit from integration/service & UI better
1. Pin down the various dependency versions in build.gradle (it's a bit TOO casual right now)
1. Put some dorky CSS coloring and imaging on it
1. Better documentation
1. I'm usually not a fan of comments, but since the purpose is to demonstrate XP testing
   and design concepts, I should probably "speak up" a bit inline.
1. Clean it up enough to use it as a base for an XP Lab with a set of customer stories
to drive functionality.

## Current setup
1. JDK 11
1. You'll need to have Docker installed and working
1. PostgreSQL configured as indicated (or changed) here:

```shell
src/main/resources/config/application-local.yml
```

## Warnings
I've only tested/run this on MacOS.  It should work with properly configured Linux or
Windows.  If you have any success/failures with it, feel free to drop me a note.

## Some credits:
1. https://martinfowler.com/bliki/TestPyramid.html
1. https://willowtreeapps.com/ideas/test-early-test-often-automation-testing-with-the-test-pyramid
1. https://formulusblack.com/blog/compute-performance-distance-of-data-as-a-measure-of-latency/
1. https://rieckpil.de/spring-boot-functional-tests-with-selenium-and-testcontainers/


text:
# Diplodia spurca (Wallr.) Sacc. SPECIES

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 3: 338 (1884)

#### Original name
Sphaeria spurca Wallr.

### Remarks
null


text:
---
title: Whiteside's Outline Method
draft: false
date: 2019-11-25

categories:
- Random
tags:
- Tips
- Book
---

Prof. George M. Whitesides is a top-level researcher on chemistry and also known as one of the highest h-index researchers in the world. He explains his unique writing techniques called Outline Method in the article, "Whitesides' Group: Writing a Paper". I've translated that into Japanese and publish it here.

## Original paper

<object data="https://www.tulane.edu/~lamp/whiteside.pdf" type="application/pdf" width="100%" height="800px">
    <embed src="https://www.tulane.edu/~lamp/whiteside.pdf">

This browser does not support PDFs. Please download the PDF to view it: Download PDF.

    </embed>
</object>

## Japanese  translation

<object data="{{ site.baseurl }}/assets/pdf/whiteside_outline_method_jp.pdf" type="application/pdf" width="100%" height="800px">
    <embed src="{{ site.baseurl }}/assets/pdf/whiteside_outline_method_jp.pdf">

This browser does not support PDFs. Please download the PDF to view it: Download PDF.

    </embed>
</object>


text:
Ether Sneak Peek
==================

Google Chrome extension that allows you to quickly see the Ether balance of Ethereum addresses mentioned on web pages.

Chrome Store link: [https://chrome.google.com/webstore/detail/ether-sneak-peek/achbehnmipmphllfekbgjjdmhehbgoce](https://chrome.google.com/webstore/detail/ether-sneak-peek/achbehnmipmphllfekbgjjdmhehbgoce)

How to use
----------

1. Install the extension in Google Chrome
2. Go to a website that mentions an Ethereum address.
3. You'll see a small info icon next to the Ethereum address. Click it.

Try it on our address: 0x4757c6439D859986BFd3FCd82Bb9921e8B9Ddf13

License
-------

This source code is released under the MIT License.


text:
---
parent: Internals
nav_order: 1
permalink: /internals/startup.html
---

# Startup

1. Locate the native device factory (command line / env property, ServiceLoader, default)
1. Start the native device factory
1. If using the new GPIO character device, inspect all GPIO chips and lines to auto-populate GPIO information [this should be skipped if there is an existing board definition file]
1. Initialise the board info
1. Detect the local board by inspecting /proc/cpuinfo (fallback to /proc/device-tree/model for Arm64)
1. Instantiate all board info providers (ServiceLoader) to see if they recognise this device
1. Populate pin info using the BoardInfoProvider initialisePins method
    1. This can be in Java code
    1. Or via reading a boarddefs text file; attempt look-up using combinations of values from /proc/device-tree/compatible
1. LibraryLoader will probably get triggered
1. Load libdiozero-system-utils.so via LIBRARY_PATH and CLASSPATH

repository: mattjlewis/diozero

gha_language: Java

repo_name: mattjlewis/diozero


text:
###########################################
# HEAD
###########################################

config:
  layout: standardpage-docs
  file: /docs/advanced/creating-a-plugin.html

page:
  jumbotron: Creating A Plugin

###########################################
# BODY
###########################################
=====

# What is a plugin

A plugin is responsible for generating web pages by using various imports (3rd party libs) and the frameworks service providers injected into the methods. Plugins can not access other plugins.

## Example plugins

- `StandardPage` - parses the .md files within the `/data/standarpage` directory and generates static web pages from them

## Plugin structure

**WARNING: It is possible to register new services from a plugin. DO NOT do this. In future updates this capability will no longer be available.**

Here is a template for a new plugin. You must export a class called `Plugin` and an interface called `iPluginConfig`.
```
import {iPlugin} from "../libs/plugins";
import {Services} from "../libs/services";

/**
 * Plugin
 */
export class Plugin implements iPlugin {

    /**
     * Update the model, check config, etc
     * @param services
     * @param config
     */
    initialise(services:Services, config:iPluginConfig) {

      // Usual action here is to get the "globalmodel" service provider and update the global model.
      // This global model can then be used by the generate method and other plugins/themes.

    }

    /**
     * Generate pages
     * @param services
     * @param config
     */
    generate(services:Services, config:iPluginConfig) {

      // Usual action here is to create and send pages to the "pagewriter" service provider and upon
      // an error generating a page, use the "report" service provider.

    }

}

/**
* Configuration of your plugin
*/
interface iPluginConfig {

}

## Registering & configuring the plugin

Open `/config.ts`.

Locate the plugins key within the config. It should look something similar to this.

```
plugins: {
        "../plugins/standardpage": <iPluginStandardPageConfig>{

        }
    },
```

Add you plugin and it's config like this;

```
plugins: {
        "../plugins/standardpage": <iPluginStandardPageConfig>{

        },
        "../plugins/yourpluginfile": <iPluginYourPluginConfig>{
          // config here if any
        }
    },
```

You're done. Run StaticGenie and your plugin should run.

repository: StaticGenie/StaticGenie

repo_name: StaticGenie/StaticGenie


text:
# InstrUndo

Undo last instruction stepped. This command is only valid if some instructions are stepped in. Stepping over, running or tracing will clear the history context.

## arguments

This command has no arguments.

## results

This command does not set any result variables.

gha_language: Python


text:
# redux-generic

Dumb, hence generic, action creators and reducers. You provide them with a payload, they update the state accordingly without additional thoughts. This makes sense assuming that the business intelligence is implemented in middlewares, e.g. thunks.

`redux-generic` provides you with utilities for updating three kinds of states: states made of one single value, states made of one single object and states made of a collection of objects (more specifically a set of objects indexed by an identifier).

## Installation

```
npm i -S redux-generic
```

## Usage: single value

The basic approach with Redux would be to implement the business logic in the reducer. Here, we'll assume it is implemented elsewhere, so that the updated value is provided as an argument of the action creator:

```javascript
import { createStore } from "redux";
import { createSingleValueDomain } from "redux-generic";

const counterDomain = createSingleValueDomain(0, "COUNTER");
const store = createStore(counterDomain.reducer);
const incrementCounter = counterDomain.actionCreator(1, "COUNTER_INCREMENTED");
store.dispatch(incrementCounter);
```

## Usage: single object

Same thing, but the state is now an object, and the reducers knows how to update it partially.

```javascript
import { createStore } from "redux";
import { createSingleObjectDomain } from "redux-generic";

const counterDomain = createSingleObjectDomain({}, "NAME");
const store = createStore(counterDomain.reducer);
const updateFirstName = counterDomain.actionCreators.createUpdateAction({ firstName: "First" }, "FIRST_NAME_UPDATED");
store.dispatch(updateFirstName);
```

## Usage: collections

Managing collections is a major concern when working with a normalized state. This approach is very well described in the following articles:

- https://redux.js.org/recipes/structuring-reducers/normalizing-state-shape
- https://hackernoon.com/shape-your-redux-store-like-your-database-98faa4754fd5

```javascript
import { createStore } from "redux";
import { createCollectionDomain } from "redux-generic";

const userDomain = createCollectionDomain("USER");
const store = createStore(userDomain.reducer);
const insertUserAction = userDomain.actionCreators.createInsertAction(
  "03ba44f",
  { firstName: "John", lastName: "Doe" },
  "NEW_USER_INSERTED"
);
store.dispatch(insertUserAction);
```

[`redux-crud`](https://www.npmjs.com/package/redux-crud) is an interesting concurrent implementation, though `redux-generic` probably covers a wider range of use cases. `redux-generic` is an implementation of dumb reducers, while `redux-crud` is a solution for the sub-problem of state normalization.

repository: mathieueveillard/redux-generic

gha_language: TypeScript

repo_name: mathieueveillard/redux-generic


text:
# Scala.js typings for express-graphql

Typings are for version 0.11.0

## Library description:
Production ready GraphQL HTTP middleware.

|                    |                 |
| ------------------ | :-------------: |
| Full name          | express-graphql |
| Keywords           | express, restify, connect, http, graphql, middleware, api |
| # releases         | 6 |
| # dependents       | 281 |
| # downloads        | 13387279 |
| # stars            | 42 |

## Links
- [Homepage](https://github.com/graphql/express-graphql)
- [Bugs](https://github.com/graphql/express-graphql/issues)
- [Repository](https://github.com/graphql/express-graphql)
- [Npm](https://www.npmjs.com/package/express-graphql)

## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.

repository: ScalablyTyped/Distribution

repo_name: ScalablyTyped/Distribution


text:
---
title:  "Paper Accepted at MOCR'17!"
categories: paper
---

# 29th Aug 2017

A paper I co-authored, "Benchmarking Scene Text Recognition in Devanagari, Telugu and Malayalam" with [Minesh Mathew](https://mineshmathew.github.io/) and [Prof. C.V. Jawahar](http://cvit.iiit.ac.in/people/faculty/people/faculty/cvit-faculty/jawahar) has been accepted for an oral presentation at the 6th International Workshop on Multilingual OCR - MOCR 2017 in Kyoto, Japan. Minesh would be presenting the work at ICDAR'17.


text:
---
layout: page
title: ModUni4 @ Amsterdam
order: 5
---

In March 2021, we will hold the fourth and final workshop of the ModUni
project. This workshop invites presentations of research investigating the
*explanations* of lexical semantic unviersals in the modal/attitudinal and
other logical vocabularies.

## Practical details

* **Date**: March, 2021
* **Call for papers**: Winter 2020
* **Venue**: Institute of Logic, Language and Computation, University of Amsterdam

## Scheduled participants

to be determined

repository: wuegaki/modal-universals

repo_name: wuegaki/modal-universals


text:
# Cluster

Manage clusters from the d2k8 cli.

## Create a cluster

Create a cluster to be managed by d2k8.

`d2k8 cluster create name -skip-consul -skip-weave -weave-pwd pwd -skip-cleanup`

| Argument    | Meaning       |
| ----------- | ------------- |
| name        | name of the cluster to be identified in d2k8 cli commands |
| skip-consul | 'true' to skip 'consult' installation for DNS in this cluster |
| skip-weave  | 'true' to skip 'weave' installation for SDN in this cluster |
| weave-pwd   | weave router password for traffic encryption. "" for non-encrypted traffic |
| skip-cleanup | 'true' to skip 'cleanup' service installation (cleans unused volumes and images) |

## Inspect a cluster

Retrieve cluster information.

`d2k8 cluster inspect name`

| Argument    | Meaning       |
| ----------- | ------------- |
| name        | name of the cluster to be retrieved |

## List clusters

Retrieve all clusters information.

`d2k8 cluster list`

## Delete a cluster

Remove a cluster from d2k8. Nodes created in this cluster are also deleted.

`d2k8 cluster remove name`

| Argument    | Meaning       |
| ----------- | ------------- |
| name        | name of the cluster to be deleted |


text:
# Custom command to set the wallpaper

On Linux the option `Set command` accepts a user defined one-liner to set the wallpaper if your system is not supported out of the box.
As a special case, one can tell Superpaper to use `feh` with a tested and built-in command by setting:
```
set_command=feh
```
In the custom command, replace '/path/to/img.jpg' by '{image}', i.e. for example with the Gnome command:
```
gsettings set org.gnome.desktop.background picture-uri file://{image}
```

repository: hhannine/superpaper

repo_name: hhannine/superpaper


text:
# API = Application Programming Interface

- control access to hardware and software resources
- specifies how software components should interact
- defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow etc.
- APIs enable modular programming (using independently of implementation)
- request -> HTTP -> response

APIs are used when programming graphical user interface (GUI) components. A good application programming interface makes it easier to develop a program by providing all the building blocks.

REST-ful API is an application programming interface that works on the representational state transfer technology.
Rest-ful API - architectural style of building API

REST API (Representational state transfer) is an API that uses HTTP requests for communication.

REST APIs must follow certain constraints:
a) Client-server architecture - the client handles the user interface and the server handles the backend and data storage. Client and server are independent and each of them can be replaced separately.
b) Stateless - no data from the client is stored on the server-side. The session state is stored on the client-side.
c) Cacheable - clients can cache server responses to improve performance

CRUD = Create + Read + Update + Delete - basic actions that can be performed on the data

POST = create action; adds new data to the server
GET = read action; retrieve information
PUT = update action; changes existing information
DELETE = delete action; deletes existing information

> All communications between server/server, server/browser, browser/browser are done in text (usually in JSON)

**Resource-Method chart**

- summarizes what your API does

Resource -> method -> path -> used for -> param -> status codes
`+ -> POST -> /add -> add_2_nums -> x: int, y: int -> 200 OK, 301 missing`

**Requests**
GET, POST
browser -> REQUEST -> server -> response

**Status codes**
1xx informational response - the request was received, continuing process
2xx successful - the request was successfully received, understood, and accepted
3xx redirection - further action needs to be taken in order to complete the request
4xx client error - the request contains bad syntax or cannot be fulfilled
5xx server error - the server failed to fulfil an apparently valid request

For more detailed information check out wikipedia on [HTTP status codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)

## Postman

- IDE for building an API; collaboration platform for API development
- API Client, Automated testing, design & mock, documentation, monitors, wokspaces
- test GET and POST messages on your server

# Apache HTTP Server

- open-source HTTP server
- provide HTTP services in sync with the current HTTP standards

# Apache Spark

- unified analytics engine for large-scale data processing
- open-source distributed general-purpose cluster-computing framework
- interface for programming entire clusters with implicit data parallelism and fault tolerance

# SDK

- software development kit = collection of software development tools in one installable package
- provides a set of tools, libraries, relevant documentation, code samples, processes or guides that allow developers to create software applications on a specific platform

## Choosing the language for the APIs

Factors to consider:

1. How confident is the team with each language? What is the preference across the entire company?
2. Does the language come with plenty of different options for libraries or frameworks that aid in the developing of APIs?
   Multiple options within a single language is better than one in case some of your use cases gets stuck on a specific limitation within a particular language where the options are limited.
3. Are the frameworks and libraries for this programming language still being supported? How active is the community of developers? Are there plenty of resources for you to learn from? How clear and available is the documentation?

Some of the most important aspects of an API framework are - its architecture and features such as support for customization, flexibility, extensibility, security, compatibility with other libraries etc.

### Python and APIs

- fast scripting language
- well-defined, easy to understand and extensible syntax
- highly scalable APIs

[Comparison of Django and Flask](https://hackr.io/blog/flask-vs-django)
As Flask is easier to learn for beginners, we will prepare the tutorial APIs in Flask to demonstrate API creation in Python.

[Django](https://www.djangoproject.com/)

- web development framework for Python
  Django REST framework

#### Flask

[Flask](https://flask.palletsprojects.com/en/1.1.x/)

- lightweight web application framework
- start quick and easy, scale up fast
- Flask-Restful works with all the existing libraries

Install the libraries
`pip install flask`
`pip install flask_restful`

Code example

```
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
    def get(self):
        return {'Protorix'}
api.add_resource(HelloWorld, '/')
if __name__ == '__main__':
    app.run(debug=True)
```

Another example can be accessed within the repository in the file `test_ai_api.py` or `test_flask_hello.py` or `test_flask_restful_app.py`

To run the API locally using Windows Powershell use the following:
`$env:FLASK_APP="test_flask_hello"`
`flask run`

Flask already has a web server built within itself. This means it will create it on your local host. (simulating the code as if it was on the internet, used for development locally)

Web services usually return JSON.
Web applications usually return a page e.g. HTML.

### Validating JSON schema of the request/response

Use the [jsonschema][1] package.

### NodeJS and APIs

Node JS + Express

- powerful collection of features for web and mobile application development
- routing libraries providing fundamental web application features adding to the existing features of NodeJS
- high performance and support of robust routing
- HTTP helpers such as rendering, setting headers etc.

A simple implementation of a Node JS + Express API that returns a JSON response with names when a request is sent to the route /url.

```
var express = require("express");
var app = express();app.listen(3000, () => {
 console.log("Server runs on port 3000");
});
app.get(“/url”, (req, res, next) => {
 res.json([“Kevin”,”Neil”,”Antony”,”Jonas”,”Lambert”]);
});
```

[1]: https://python-jsonschema.readthedocs.io/en/latest/

repository: mmlynarik/data-lovers

repo_name: mmlynarik/data-lovers


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

Kafka Mesos Framework
======================

Install gradle http://gradle.org/installation

    git clone https://github.com/mesos/kafka
    cd kafka
    ./gradlew jar
    wget https://archive.apache.org/dist/kafka/<IP_ADDRESS>/kafka_2.9.2-<IP_ADDRESS>.tgz
    MESOS_NATIVE_JAVA_LIBRARY=/usr/local/lib/libmesos.so java -jar kafka-mesos-sandbox-0.1.jar scheduler

This is an *ALPHA* version. More features will be continued to be added until we cut a stable beta build to release candidate against.

* smart broker.id assignment.

* preservation of broker placement (through constraints and/or new features).

* ability to-do configuration changes.

* rolling restarts (for things like configuration changes).

* scaling up/down utilizing new re-balance decommission.

* smart partition assignmnet via constraints visa vi roles, resources and attributes.


text:
---
title: SHCrossPowerSpectrumDensity (Fortran)
keywords: spherical harmonics software package, spherical harmonic transform, legendre functions, multitaper spectral analysis, fortran, Python, gravity, magnetic field
sidebar: fortran_sidebar
permalink: shcrosspowerspectrumdensity.html
summary:
tags: [fortran]
toc: false
editdoc: fdoc
---

Compute the cross-power spectral density of two real functions.

## Usage

call SHCrossPowerSpectrumDensity (`cilm1`, `cilm2`, `lmax`, `cspectrum`, `exitstatus`)

## Parameters

`cilm1` : input, real(dp), dimension (2, `lmaxin1`+1, `lmaxin1`+1)
:   The first function expressed in real spherical harmonics.

`cilm2` : input, real(dp), dimension (2, `lmaxin2`+1, `lmaxin2`+1)
:   The second function expressed in real spherical harmonics.

`lmax` : input, integer(int32)
:   The maximum spherical harmonic degree to calculate the cross-power spectral density. This must be less than or equal to the minimum of `lmaxin1` and `lmaxin2`.

`cspectrum` : output, real(dp), dimension (`lmax`+1)
:   The cross-power spectral density of the two functions.

`exitstatus` : output, optional, integer(int32)
:   If present, instead of executing a STOP when an error is encountered, the variable exitstatus will be returned describing the error. 0 = No errors; 1 = Improper dimensions of input array; 2 = Improper bounds for input variable; 3 = Error allocating memory; 4 = File IO error.

## Description

`SHCrossPowerSpectrumDensity` will calculate the cross-power spectral density of two functions expressed in real 4-pi normalized spherical harmonics. For a given spherical harmonic degree `l`, this is explicitly calculated as:

`cspectrum(l) = Sum_{i=1}^2 Sum_{m=0}^l cilm1(i, l+1, m+1) * cilm2(i, l+1, m+1) / (2l + 1)`.

## See also

[shpowerl](shpowerl.html), [shpowerdensityl](shpowerdensityl.html), [shcrosspowerl](shcrosspowerl.html), [shcrosspowerdensityl](shcrosspowerdensityl.html), [shpowerspectrum](shpowerspectrum.html), [shpowerspectrumdensity](shpowerspectrumdensity.html), [shcrosspowerspectrum](shcrosspowerspectrum.html), [shadmitcorr](shadmitcorr.html)

repository: SHTOOLS/SHTOOLS

repo_name: SHTOOLS/SHTOOLS


text:
# Stephanogonia mutabilis G.D. Hanna & A.L. Brigger SPECIES

#### Status
ACCEPTED

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

#### Published in
null

#### Original name
null

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone