text:
# Cgroups in Aurae

We need a way to map `processes` to `cgroups` or in Aurae parlance `executables` to `cells`.

Given a cgroup `my-cell` and two nested processes:

 - `sleep 500` with the name `sleep-500`
 - `sleep 60` with the name `sleep-60`

How do we identify which PID to send signals to if the user intends to start/stop either the `sleep-500` or the `sleep-60` process within the cell?

### Research with Systemd

The way `systemd` manages this is by storing the Unit file contents in memory during the duration of the process. This is why `systemd daemon-reload` must be executed before changes to the current unit file are effective. The mapping of the configuration in the Unit file to the sub-processes is managed in memory.

### Differences from Systemd

We would like to be able to start and stop arbitrary processes within a given cell. We currently believe that systemd creates a cgroup for each service, and the only way to "add" nested processes to a cgroup is by restarting the service with a hook to launch the intended nested process.

### Option 1) The "/var/run/aurae/cells" Way

We create a new directory upon starting the daemon called `/var/run/aurae/cells` that we assume ownership of. We bake in the initialization setup in the same way we manage `/var/run/aurae.sock`.

For every cell that is allocated we also create a file:

```
/var/run/aurae/cells/my-cell
```

We use the [pre_exec](https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.pre_exec) function to create a file descriptor for each nested process that points back to the cell file.
The children will store the file descriptors and not the parent.

_Author: [Kris Nóva](https://github.com/krisnova)_

repository: aurae-runtime/aurae

gha_language: Rust

repo_name: aurae-runtime/aurae


text:
---
# This page was generated from the add-on.
title: Release 1.3.3
type: userguide
weight: 24
---

# Release 1.3.3

The following changes were made in this release:

## Bug fixes:

### Issue 156: ZAP active scanner freezes against DVWA

### Issue 157: Alert edit/save broken

### Issue 161: Reporting does not work when not specifying the extension in the report's name (on Linux)

## See also

|   |                                     |                                                           |
|---|-------------------------------------|-----------------------------------------------------------|
|   | [Introduction](/docs/desktop/)      | the introduction to ZAP                                   |
|   | [Releases](/docs/desktop/releases/) | the full set of releases                                  |
|   | [Credits](/docs/desktop/credits/)   | the people and groups who have made this release possible |

license: MIT

repository: zaproxy/zaproxy-website

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: zaproxy/zaproxy-website


text:
# react-responsive-hoc

[![Build Status](https://travis-ci.org/SamyPesse/react-responsive-hoc.svg?branch=master)](https://travis-ci.org/SamyPesse/react-responsive-hoc)
[![NPM version](https://badge.fury.io/js/react-responsive-hoc.svg)](http://badge.fury.io/js/react-responsive-hoc)

Wrapper around [react-responsive](https://github.com/contra/react-responsive) to work with SSR.

This module exports a provider for defining the default device (for SSR) and a modified `MediaQuery` from `react-responsive` to use the default device.

# Installation

```
$ yarn add react-responsive-hoc
```

# Usage

```js
import { MediaQueryProvider, MediaQuery } from 'react-responsive-hoc';

const Example = () => {
    return (
        <MediaQuery query="(min-device-width: 1224px)">
            On Desktop only
        </MediaQuery>
    )
};

const App = () => {
    return (
        <MediaQueryProvider width={1600} height={800}>
            <Example />
        </MediaQueryProvider>
    );
}
```

repository: saraphinaboe/react-responsive-hoc

repo_name: saraphinaboe/react-responsive-hoc


text:
# Elm list of stylish-elephants repos
Github repos having "stylish-elephants" in the project name or the project description.

# Demo
[github-stylish-elephants-search](https://jbrgfx.github.io/github-stylish-elephants-search/)

Originally Part 14 of [rtfeldman's workshop](https://github.com/rtfeldman/elm-workshop/tree/master/part14)
Refactored using stylish-elephants

=======

## Getting Started

You need Elm 0.18 installed

## Installation

clone this repo
and then from the project's root:

```bash
elm-package install
```

## Create a Github AuthN token
See Richard Feldman's [workshop README](https://github.com/rtfeldman/elm-workshop) for instructions
Do not commit the token to github or another version control system.

## Building will fail until you create Auth.elm as described above

```bash
elm-make Main.elm --output=elm.js
```

## Open the root folder's index.html file in a browser

You will see:

![screenshot of the default state](elm-se-list.png)

repository: jbrgfx/github-stylish-elephants-search

repo_name: jbrgfx/github-stylish-elephants-search


text:
#  Max Area of Island
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
Find the maximum area of an island in the given 2D array. (If there is no island, the maximum area is 0.)

# Solutions:

# Swift
```
O(n)

```
# Installation
Run `make` to build and run C++ files and run Swift files. Or you can run `.playground` file.

repository: Voley/Algorithmic-Problems

repo_name: Voley/Algorithmic-Problems


text:
---
layout: post
title: python 源码阅读 - generator and coroutine
category: 语言
tags: python asyncio
keywords: python
description:
---

# Python generator and coroutine

```python
# ./lib/python3.6/asyncio/tasks.py
"""
## PEP 342
## 1. Calling send(None) is exactly equivalent to calling a generator's
## next() method.
## 2. As with the next() method, the send() method returns the
## next value yielded by the generator-iterator, or raises
## StopIteration if the generator exits normally, or has already exited.
"""

class Task(futures.Future):
    """Coroutines will be wrapped in Tasks."""
    ...

    def _step(self, exc=None):
        ...
        coro = self._coro
        self._fut_waiter = None

        self.__class__._current_tasks[self._loop] = self
        # Call either coro.throw(exc) or coro.send(None).
        try:
            if exc is None:
                # We use the `send` method directly, because coroutines
                # don't have `__iter__` and `__next__` methods.
                ## PEP 342
                ## 1. Calling send(None) is exactly equivalent to calling a generator's
                ## next() method.
                ## 2. As with the next() method, the send() method returns the
                ## next value yielded by the generator-iterator, or raises
                ## StopIteration if the generator exits normally, or has already exited.
                result = coro.send(None)
            else:
                result = coro.throw(exc)
        except StopIteration as exc:
            if self._must_cancel:
                # Task is cancelled right before coro stops.
                self._must_cancel = False
                self.set_exception(futures.CancelledError())
            else:
                self.set_result(exc.value)
        except futures.CancelledError:
            # I.e., Future.cancel(self).
            super().cancel()
        except Exception as exc:
            self.set_exception(exc)
        except BaseException as exc:
            self.set_exception(exc)
            raise
        else:
            blocking = getattr(result, '_asyncio_future_blocking', None)
            if blocking is not None:
                # Yielded Future must come from Future.__iter__().
                if result._loop is not self._loop:
                    self._loop.call_soon(
                        self._step,
                        RuntimeError(
                            'Task {!r} got Future {!r} attached to a '
                            'different loop'.format(self, result)))
                elif blocking:
                    if result is self:
                        self._loop.call_soon(
                            self._step,
                            RuntimeError(
                                'Task cannot await on itself: {!r}'.format(
                                    self)))
                    else:
                        result._asyncio_future_blocking = False
                        result.add_done_callback(self._wakeup)
                        self._fut_waiter = result
                        if self._must_cancel:
                            if self._fut_waiter.cancel():
                                self._must_cancel = False
                else:
                    self._loop.call_soon(
                        self._step,
                        RuntimeError(
                            'yield was used instead of yield from '
                            'in task {!r} with {!r}'.format(self, result)))
            elif result is None:
                # Bare yield relinquishes control for one event loop iteration.
                self._loop.call_soon(self._step)
            elif inspect.isgenerator(result):
                # Yielding a generator is just wrong.
                self._loop.call_soon(
                    self._step,
                    RuntimeError(
                        'yield was used instead of yield from for '
                        'generator in task {!r} with {}'.format(
                            self, result)))
            else:
                # Yielding something else is an error.
                self._loop.call_soon(
                    self._step,
                    RuntimeError(
                        'Task got bad yield: {!r}'.format(result)))
        finally:
            self.__class__._current_tasks.pop(self._loop)
            self = None  # Needed to break cycles when an exception occurs.
     ...

```

### Coroutines

AKA: abstract of subroutines (can be entered, exited, and resumed at many different points)

Coroutines is a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be entered, exited, and resumed at many different points. They can be implemented with the [`async def`](https://docs.python.org/3/reference/compound_stmts.html#async-def) statement. See also [**PEP 492**](https://www.python.org/dev/peps/pep-0492).

### coroutine function

AKA: `async def` function

A function which returns a [coroutine](https://docs.python.org/3/glossary.html#term-coroutine) object. A coroutine function may be defined with the [`async def`](https://docs.python.org/3/reference/compound_stmts.html#async-def) statement, and may contain [`await`](https://docs.python.org/3/reference/expressions.html#await), [`asyncfor`](https://docs.python.org/3/reference/compound_stmts.html#async-for), and [`async with`](https://docs.python.org/3/reference/compound_stmts.html#async-with) keywords. These were introduced by [**PEP 492**](https://www.python.org/dev/peps/pep-0492).

### generator iterator

AKA: generator function call return generator iterator

An object created by a [generator](https://docs.python.org/3/glossary.html#term-generator) function.

Each [`yield`](https://docs.python.org/3/reference/simple_stmts.html#yield) temporarily suspends processing, remembering the location execution state (including local variables and pending try-statements). When the *generator iterator* resumes, it picks-up where it left-off (in contrast to functions which start fresh on every invocation).

### generator

AKA: function contains `yield` (which return `generator iterator`)

A function which returns a [generator iterator](https://docs.python.org/3/glossary.html#term-generator-iterator). It looks like a normal function except that it contains [`yield`](https://docs.python.org/3/reference/simple_stmts.html#yield) expressions for producing a series of values usable in a for-loop or that can be retrieved one at a time with the [`next()`](https://docs.python.org/3/library/functions.html#next) function.

Usually refers to a generator function, but may refer to a *generator iterator* in some contexts. In cases where the intended meaning isn’t clear, using the full terms avoids ambiguity.

```
# example
import inspect

def example():
    for i in range(10):
        yield i

inspect.isgeneratorfunction(example) # True
inspect.isgenerator(example())       # True
inspect.isgenerator(example)         # False
```


text:
Given two strings,  and , determine if they share a common substring.

Input Format

The first line contains a single integer, , denoting the number of  pairs you must check.
Each pair is defined over two lines:

The first line contains string .
The second line contains string .
Constraints

 and  consist of lowercase English letters only.
Output Format

For each  pair of strings, print YES on a new line if the two strings share a common substring; if no such common substring exists, print NO on a new line.

Sample Input

2
hello
world
hi
world
Sample Output

YES
NO
Explanation

We have  pairs to check:

, . The substrings  and  are common to both  and , so we print YES on a new line.
, . Because  and  have no common substrings, we print NO on a new line.
https://www.hackerrank.com/challenges/two-strings

repository: RAVURISREESAIHARIKRISHNA/Hackerrank

repo_name: RAVURISREESAIHARIKRISHNA/Hackerrank


text:
My vim dotfile notes! Below are options and commands I personally found useful through experience. Of course, this list is only getting started and will constantly be updated as time goes on.

In `~/.vimrc` file:
- use `set tabstop = 2` to set tabs to 2 spaces.
- use `set shiftwidth=2` to set shift width or indent amount to 2 spaces.

**To indent/un-indent code bock:** first select your desired code block using `Shift-V`. This activates visual mode and selects entire line(s). Use `Up` or `Down` arrow to make you selection and then type `Shift->` (that is `Shift` followed by `>`) to indent and `Shift-<` to unindent code block.

**To comment code block:** first type `Ctrl-V` to select area. Next, type `Shift-I` to insert character(s) and type `//` then hit `Esc`.

**To un-comment selection:** Type `Ctrl-V` to select area then type `d` to delete selected area.

`:retab` to retab tabs according to `tabstop` and `shiftwidth` rules.

`:nohl` to turn off highlight (usually after you are done searching for some pattern)

`/some_string` to search for some pattern (use `n` to go to next occurence)

Type `cw` to change current word.

# Linux commands

Linux `find` command looks for a file in some directory. For example: `find "." -name "callno.h"`: will look for file named `callno.h` in current directory and all subdirectories of current directory.

Linux `grep` command searches for string pattern in file(s). For example: `grep -rnw "." -name "thread_exit"` will recursively `-r` search for all occurences of pattern match in directory `.` (current directory). Because we passed the `-r` flag, the search space includes all subdirectories of this directory. Ultimately, running this command will search for the use of `"thread_exit"` and print line number(s) `-n` of said occurence(s). Importantly, it will make sure that entire pattern matches as given by the use of `-w`.

For more `grep` command information [read here](https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux).

____________________________________________________________

GNU `tar` is an archiving program designed to store multiple files in a single file (an archive) and to manipulate such files. File compression tools (like gzip and bzip2) compress single files (not groups of files). So, we use `tar` to group files into one monolithic file and then use a file compression tool like `gzip` to compress the file and save memory. In Windows, this is equivalent to `WinRAR` and `WinZip`. Read more [here](https://stackoverflow.com/questions/295860/why-do-people-use-tarballs).

To unpack a tarball (unpacks tar files compressed with gzip as denoted by `.tar.gz` file extension):

`tar -xvzf filename`

To make a new tarball `fred.tar.gz` from a directory `fred` (creates a `.tar.gz` file):

`tar -cvzf fred.tar.gz fred`

`tar` option parameter meanings:

- **c**	 create an archive
- **f**  filename	the name of the archive file
- **v**	 verbose: tell me what's going on
- **x**	 extract from an archive
- **z**	 put the archive through gzip

Read more [here](http://computing.help.inf.ed.ac.uk/FAQ/whats-tarball-or-how-do-i-unpack-or-create-tgz-or-targz-file) and [here](http://wiki.linuxquestions.org/wiki/Packing_and_Unpacking_Files).

____________________________________________________________

## Updating system `PATH` variable

### On MacOS

In `~/.zprofile` add additional paths you would like to be in your system `$PATH`. Example

```
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/usr/local/kafka_2.12-2.5.0/bin:$PATH"
```

### On Linux

Often I have issues setting up environment variables and/or updating path variables. As a general rule, when adding some directory to `$PATH` it's good idea not to overwrite previous value, just append desired directory (e.g., `$HOME/bin`), in your `~/.bashrc` add at the end line:

`export PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre"` (this path is just an example, use whatever you need)

This sets the `$PATH` permanently for all future bash sessions. To set it permanently, and system wide (all users, all processes) add set variable in `/etc/environment`:

`sudo vim -H /etc/environment`

This file only accepts variable assignments like:

`VARNAME="my value"` (do not use `export` here)

Read more [here](https://askubuntu.com/questions/58814/how-do-i-add-environment-variables) and [here](https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal).

____________________________________________________________

`~/.profile` vs. `~/.bashrc` vs. `~/.bash_profile`

When bash is invoked as an interactive login shell (e.g., connecting to machine via ssh) it first reads and executes commands from the file `/etc/profile`, if that file exists. After reading that file, it looks for `~/.bash_profile`, `~/.bash_login`, and `~/.profile`, in that order, and reads and executes commands from the **first** one that exists and is readable.

When an interactive shell that is not a login shell (e.g., terminal, xterm) is started, bash reads and executes commands from `~/.bashrc`, if that file exists (on MacOS with zsh this is `.zshrc`)

`~/.profile` is the place to put stuff that aplies to your whole session, such as programs you want to start when you log in and environmnent variable definitions.

`~/.bashrc` is the place to put stuff that applies only to bash itself, such as alias and function definitions, shell options, and prompt settings.

`~/.bash_profile` can be used instead of `~/.profile`, but it is read by bash only, not by any other shell (on MacOS with zsh this is `.zprofile`) ([1](https://superuser.com/questions/183870/difference-between-bashrc-and-bash-profile))

Most of the time you don’t want to maintain two separate config files for login and non-login shells — when you set a PATH, you want it to apply to both. A common practice is to source `~/.bashrc` from `~/.profile`. This way you can put `PATH` and common settings in `.bashrc` once and source them wherever you need ([1](http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html), [2](https://askubuntu.com/questions/432508/why-does-ubuntus-default-profile-source-bashrc), [3](https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal)).

Good [read](http://mywiki.wooledge.org/DotFiles) on configuring your login sessions with for file.

More on choosing between `.bashrc`, `.profile`, `.bash_profile` [here](https://superuser.com/questions/789448/choosing-between-bashrc-profile-bash-profile-etc).

To reload `~/.bashrc` without logging out and back in run `source ~/.bashrc` or `. ~/.bashrc`.

Sources:
- https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
- https://askubuntu.com/questions/60218/how-to-add-a-directory-to-the-path
- https://stackoverflow.com/questions/56784894/macos-catalina-10-15beta-why-is-bash-profile-not-sourced-by-my-shell

____________________________________________________________

Understanding the job control commands in Linux. A job is a process that the shell manages. Each job is assigned a seuqential id. Beacuse a job is a process, each job has an associarted process id (PID) which is given out by the OS. There are three type of job statuses:
1. **Foreground**: when you enter a command in the terminal the command blocks (i.e., occupies) that terminal window until it complestes.
2. **Background**: when you enter an ampersand (&) symbol at the end of a command line, the command runs without blocking the terminal window. The shell prompt is displayed immediately adter you press the return key.
3. **Stopped**: if you press`Ctrl+Z` for a foreground job, the job stops running. Note: it does not terminate, instead it pauses exectution.

Commands:

- `jobs`: lists all jobs

- `bg %n`: sends current or specified job to background where `n` is the job id (not PID!)

- `fg %n`: brings current or specified job to foreground where `n` is the job id

- `Ctrl+Z`: stops foreground job and places it in the background as a _stoped_ job.

To open a terminal session in vim type `:term`. To switch between the vim and terminal session press `Ctrl+W` ([see](https://stackoverflow.com/questions/1236563/how-do-i-run-a-terminal-inside-of-vim)).


text:
# Density/dielectric constant benchmarks

## Overview

As part of this study, we ran a benchmark on densities/dielectric constants of a set of molecules from NIST's ThermoML, as previously reported in this study from the Chodera lab.
Code for that study is available at [LiquidBenchmark](https://github.com/choderalab/LiquidBenchmark) on the Chodera Lab GitHub site; however, dependencies have gone out of date and the code needed cleanup, so author Kyle Beauchamp helped get the code working again and made it available at [https://github.com/kyleabeauchamp/SolutionFFBench](https://github.com/kyleabeauchamp/SolutionFFBench).
We also worked with him to extend it to be compatible with the SMIRNOFF format.
Here, we used versions 0.0.1 and 0.0.2 of this updated benchmark code to run and analyze our density and dielectric constant calculations for GAFF (v0.0.1) and SMIRNOFF (v0.0.2).
Those releases of Kyle Beauchamp's code are archived here.
Additionally, we provide run settings used when conducting the simulations.

## Manifest
- [`B2-0.0.1.tar.gz`](B2-0.0.1.tar.gz): Version 0.0.1 of benchmark code as used for GAFF benchmarks. Repo subsequently renamed to `SolutionFFBench`. Minor analysis tweaks were made here for the paper, e.g. a grid was added to the plots to better match the paper style. Additionally, statistics were computed (and overlaid on plots) following FreeSolv code.
- [`B2-0.0.2.tar.gz`](B2-0.0.2.tar.gz): Version 0.0.2 of benchmark code as used for SMIRNOFF benchmarks. Repo subsequently renamed to `SolutionFFBench`. Minor analysis tweaks were made here for the paper, e.g. a grid was added to the plots to better match the paper style. Additionally, statistics were computed (and overlaid on plots) following FreeSolv code.
- [`results_GAFF`](results_GAFF): Results of GAFF calculations (tables and plots)
- [`results_newSMIRNOFF`](results_newSMIRNOFF): Results of SMIRNOFF calculations (tables and plots, *see notes below*)

## Settings
Default settings deposited in the `B2-*.tar.gz` files are not those used for running production level simulations here.
Here, we used (in `density_simulation_parameters.py`):
- `N_STEPS = 1000000`
- `N_EQUIL_STEPS = 10000000`
- `OUTPUT_FREQUENCY_EQUIL = 100000`
- `OUTPUT_FREQUENCY = 5000`
- `OUTPUT_DATA_FREQUENCY = 250`
- `STD_ERROR_TOLERANCE = 0.0002` (g/mL)
The forcefield name was varied from GAFF to SMIRNOFF for output files and to deterermine the input forcefield.

## Additional Notes

- The tables and figures presented in the [`results_newSMIRNOFF`](results_newSMIRNOFF) folder are an updated set of
results of benchmarking the 1.0.8 version of the
[smirnoff99Frosst](https://github.com/openforcefield/smirnoff99Frosst/tree/v1.0.8) force field, which includes a
corrected set of [hydroxyl hydrogen vdW parameters](https://github.com/openforcefield/openforcefield/pull/179).

gha_language: Jupyter Notebook


text:
# Gain Calculator

![Example](https://github.com/islamaydogmus/Gain_Calculator/blob/main/Images/example.png)

Calculates the gain of your investment (just EUR/TRY for now) by sending a notification.

'setting.json' has 3 parameters:
• "PORTF": Your current savings in Euro.
• "EUR_BOUGH": Euro/TRY ratio when you bought it.
• "FEE": The amount received by the bank for transaction.
This values will be read by the program everytime you run it so it has to be in the same location with the 'main.py'

Output will be 4 values as form of;

    Euro Currently: {current_EUR} TL
    Net change in Euro is {rise}
    Your gain(loss) without fee : {gain} TL
    Your net gain(loss) is: {round(gain - FEE,4)} TL

branch_name: refs/heads/main


text:
---
title: SolveLinearSystem
category: moduledocs
module:
  category: Math
  package: SCIRun
tags: module
authors: Steven G. Parker
---

# {{ page.title }}

## Category

**{{ page.module.category }}**

## Description

### Summary

The SolveLinearSystem module is used to solve the linear system $$Ax=b$$, where the coefficient matrix $$A$$ may be dense or sparse, $$b$$ is a given right-hand-side vector, and the user wants to find the solution vector $$x$$.

**Detailed Description**

The SolveLinearSystem module takes two input matrices and returns three matrices.
The first input port takes the coefficient matrix $$A$$, which may be a dense $$n \times n$$ matrix or a sparse $$n \times n$$ matrix.
The second input port takes the right hand side vector $$b$$ as an $$n \times 1$$ dense matrix.
Here, the module is assuming that an $$n \times n$$ system is being solved.

The first of the three output ports returns the solution vector $$x$$ as an $$n \times 1$$ dense matrix.
The second output port returns the number of iterations required to reach convergence as a $$1 \times 1$$ dense matrix and the third output port returns the norm of the residual vector, again as a $$1 \times 1$$ dense matrix.

The GUI for this module is used to define the solution method for the module and monitor the convergence towards the solution.

![alt text]({{ site.github.url}}/SCIRun/assets/images/module_images/Sls.png)

#### Methods Tab

![alt text]({{ site.github.url}}/SCIRun/assets/images/module_images/Methods.png)

The Methods tab allows the user to select one of four solution algorithms for numerically solving sparse systems of linear equations:

1. Conjugate gradient
2. Biconjugate gradient
3. Jacobi
4. MINRES

Each solution method comes with the option of choosing a preconditioner for the numerical solution algorithm, which is set with the Preconditioners tab:

![alt text]({{ site.github.url}}/SCIRun/assets/images/module_images/Precond.png)

At present, only the Jacobi preconditioner is available.
However, there is the option of using no preconditioning.

#### Convergence Criteria

The next section of the GUI sets up the convergence criteria for the numerical
solution.

![alt text]({{ site.github.url}}/SCIRun/assets/images/module_images/Setup.png)

To achieve convergence of the numerical solution, the norm of the residual must be less than the target error as given in the slider.
The next slider sets the maximum number of iterations that are allowed to achieve solution.
This can take a value anywhere between 0 and 20000.

The module has the ability to write solutions at regular intervals and this flag is set by clicking on the **Emit partial solutions** check-box.
The frequency of writing the solutions is set with the next slider.

Finally, the option **Use the previous solution as initial guess**, which is set by clicking the check-box, allows the user to either continue a simulation run looking for better convergence, or run a second simulation for which it is expected that the second solution may be close to the first.

A useful strategy for solving simulation problems is to begin with a small number of iterations to check that the solution will converge and then use the **Use the previous solution as initial guess** option to continue the simulation.
Alternatively, to stop a diverging, or at least non-converging, simulation the Target error can be dynamically changed to a residual error level already obtained by the solver.

#### Iteration Progress

The bottom section of the GUI shows how the solution is progressing.

There is an iteration counter to show how many iterations have been completed, the value of the original error (this will be 1.0 unless the  **Use the previous solution as initial guess** option has been used) and thevalue of the current error.
These quantities are summarised graphically in the convergence plot.

Further reading: [http://www-users.cs.umn.edu/~saad/books.html Y. Saad, Iterative methods for sparse linear systems, second edition (2000)].

{% capture url %}{% include url.md %}{% endcapture %}
{{ url }}

repository: arnoxinglei/SCIRun

repo_name: arnoxinglei/SCIRun


text:
# Validator for YII2

Yii2 Extension - validador de PIS/Pasep para Brasil

* Pis

[![Yii2](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](http://www.yiiframework.com/)
[![Latest Stable Version](https://poser.pugx.org/jeffersoncarvalho/validator/v)](//packagist.org/packages/jeffersoncarvalho/validator)
[![Total Downloads](https://poser.pugx.org/jeffersoncarvalho/validator/downloads)](//packagist.org/packages/jeffersoncarvalho/validator)

## Installation with Composer
If you're using Composer to manage dependencies, you can use

    $ composer require jeffersoncarvalho/validator

or you can include the following in your composer.json file:

    {
        "require": {
            "jeffersoncarvalho/validator": "~1.0"
        }
    }

## Usage

Add the rules as the following example

	use Yii;
	use yii\base\Model;
	use jeffersoncarvalho\validator\PisPasepValidator

	class PessoaForm extends Model
	{
		public $pis;

		/**
		* @return array the validation rules.
		*/
		public function rules()
		{
			return [
				// PIS validator
				['pis', PisPasepValidator::className()],
			];
		}
	}


text:
Gradient Frequency Neural Networks in Python
============================================

 - Author  : Jorge Herrera<EMAIL_ADDRESS> - Date    : May, 2014

A python implementation of Gradient Frequency Neural Networks or GrFNNs (pronounced Griffins), introduced by [Large et. al.](http://www.ccs.fau.edu/~large/Publications/LargeAlmonteVelasco2010.pdf). Dr. Large released a Matlab toolbox with his implementation (see [here](https://github.com/MusicDynamicsLab/GrFNNToolbox)). pyGrFNN was developed in parallel but in close collaboration with Dr. Large, so while there are similarities, there are are some differences as well.

**NOTE** This package is in development, so things may or may not change in the future.

## Documentation

You can find the [documentation here](http://pygrfnn.readthedocs.org/en/latest/). It includes some examples.

Installation
------------

Clone the repo to a local directory. Inside the director run

    python setup.py develop

This will install the package in development mode, so every time you pull changes to the repo, they should be automatically reflected in the installed version.

Alternatively, you could run

    python setup.py install

which performs a normal installation.

In either case, if all goes well, all dependencies should be installed.

Dependencies
------------

This package has been developed and tested exclusively on Python 2.7. Other that that, you will need:

 * [`numpy`](http://www.numpy.org/)
 * [`scipy`](http://www.scipy.org/)
 * [`PyDispatcher`](https://pypi.python.org/pypi/PyDispatcher/)

Optional dependencies:

 * [`matplotlib`](http://matplotlib.org/) (to enable custom visualizations)
 * [`nose`](https://nose.readthedocs.org/en/latest/) (for testing)
 * [`sphinx`](http://sphinx-doc.org/) (to build docs)
 * [`sphinxcontrib-napoleon`](https://pypi.python.org/pypi/sphinxcontrib-napoleon) (to build docs)
 * [`sphinx_rtd_theme`](http://read-the-docs.readthedocs.org/en/latest/theme. html) (to build docs)

(all dependencies are available via `pip`)

Documentation
-------------

You can find the [documentation here](http://pygrfnn.readthedocs.org/en/latest/).

Documentation is generated with [Sphinx](http://sphinx-doc.org/) directly from the docstrings in the code. The theme is the *ReadTheDocs* theme, that can be found [here](https://github.com/snide/sphinx_rtd_theme) (it includes instructions on how to install and use it)

### Build docs

    cd <pygrfnn_dir>/docs
    make html
    open _build/html/index.html

The last line is an OS X way of opening a file on a browser from the command line. On other systems, simply open `file://<absolute_path_to_pygrfnn>/docs/_build/html/index.html`.

If something goes wrong, you can optionally run `make clean` to build from scratch.

Notes
-----
This repo was intended to use `virtualenv`, but for some reason, `virtualenv` and `matplotlib` decided to not like each other, so in the mean time I'm using the system-site-packages (at least for NumPy, SciPy and Matplotlib). That is on my local environment, but you are encouraged to use `virtualenv` if possible.

Testing
-------

Testing uses `nose` (`pip install nose`). To run all the tests, simply type:

    nosetests -v

in the root folder (where `pygfnn` and `test` folders are). The (optional) `-v` flag means verbose. To run only unit or functional test, use the `-w` option:

    nosetests -w ./ ./test/unit

repository: jorgehatccrma/pyGrFNN

repo_name: jorgehatccrma/pyGrFNN


text:
# DotNetHelper-HttpClient

#### DotNetHelper-HttpClient is a simple lightweight library for executing restful requests. Easy Integration with polly. Support both asynchronous and synchronous operation

|| [**Change Log**][Changelogs] • || [**View on Github**][Github]||

| Package  | Tests | Code Coverage |
| :-----:  | :---: | :------: |
| ![Build Status][nuget-downloads]  | ![Build Status][tests]  | [![codecov](https://codecov.io/gh/TheMofaDe/DotNetHelper-HttpClient/branch/master/graph/badge.svg)](https://codecov.io/gh/TheMofaDe/DotNetHelper-HttpClient) |

| Continous Integration | Windows | Linux | MacOS |
| :-----: | :-----: | :-----: | :-----: |
| **AppVeyor** | [![Build status](https://ci.appveyor.com/api/projects/status/9mog32m4mejqyd3i?svg=true)](https://ci.appveyor.com/project/TheMofaDe/DotNetHelper-HttpClient)  | | |
| **Azure Devops** | ![Build Status][azure-windows]  | ![Build Status][azure-linux]  | ![Build Status][azure-macOS] |

## Features

* All apis are available in both asynchronous and synchronous operation

#### Get string from rest api
~~~csharp
var client = new RestClient();
var json = client.GetString($"https://jsonplaceholder.typicode.com/todos/1",  Method.Get);
~~~

#### Get Stream from rest api
~~~csharp
var client = new RestClient();
var stream = client.GetStream($"https://jsonplaceholder.typicode.com/todos/1",  Method.Get);
~~~

#### Get bytes[] from rest api
~~~csharp
var client = new RestClient();
var bytes = client.GetBytes($"https://jsonplaceholder.typicode.com/todos/1",  Method.Get);
~~~

#### Get HttpResponseMessage from rest api
~~~csharp
var client = new RestClient();
var httpResponse = client.GetHttpResponse($"https://jsonplaceholder.typicode.com/todos/1",  Method.Get);
~~~

#### Get Generic Type from rest api
~~~csharp
var client = new RestClient();
// The first parameter takes a Func<string, T> this allows you to implement your own deserializer
// In doing so this will prevent the library from needing to depending on third party libraries for serialization
var employee = client.Get(JsonConvert.DeserializeObject<Employee>,$"https://jsonplaceholder.typicode.com/todos/1", Method.Get);
~~~

## Documentation
For more information, please refer to the [Officials Docs][Docs]

## Solution Template
[![badge](https://img.shields.io/badge/Built%20With-DotNet--Starter--Template-orange.svg)](https://github.com/TheMofaDe/DotNet-Starter-Template)

[Cake]: https://gist.github.com/davidfowl/ed7564297c61fe9ab814
[Azure DevOps]: https://gist.github.com/davidfowl/ed7564297c61fe9ab814
[AppVeyor]: https://gist.github.com/davidfowl/ed7564297c61fe9ab814
[GitVersion]: https://gitversion.readthedocs.io/en/latest/
[Nuget]: https://gist.github.com/davidfowl/ed7564297c61fe9ab814
[Chocolately]: https://gist.github.com/davidfowl/ed7564297c61fe9ab814
[WiX]: http://wixtoolset.org/
[DocFx]: https://dotnet.github.io/docfx/
[Github]: https://github.com/TheMofaDe/DotNetHelper-HttpClient

[Docs]: https://themofade.github.io/DotNetHelper-HttpClient/index.html
[Docs-API]: https://themofade.github.io/DotNetHelper-HttpClient/api/DotNetHelper-HttpClient.html
[Docs-Tutorials]: https://themofade.github.io/DotNetHelper-HttpClient/tutorials/index.html
[Docs-samples]: https://dotnet.github.io/docfx/
[Changelogs]: https://dotnet.github.io/docfx/

[nuget-downloads]: https://img.shields.io/nuget/dt/DotNetHelper-HttpClient.svg?style=flat-square
[tests]: https://img.shields.io/appveyor/tests/TheMofaDe/DotNetHelper-HttpClient.svg?style=flat-square
[coverage-status]: https://dev.azure.com/Josephmcnealjr0013/DotNetHelper-HttpClient/_apis/build/status/TheMofaDe.DotNetHelper-HttpClient?branchName=master&jobName=Windows
[azure-windows]: https://dev.azure.com/Josephmcnealjr0013/DotNetHelper.HttpClient/_apis/build/status/TheMofaDe.DotNetHelper-HttpClient?branchName=master&jobName=Windows
[azure-linux]: https://dev.azure.com/Josephmcnealjr0013/DotNetHelper.HttpClient/_apis/build/status/TheMofaDe.DotNetHelper-HttpClient?branchName=master&jobName=Linux
[azure-macOS]: https://dev.azure.com/Josephmcnealjr0013/DotNetHelper.HttpClient/_apis/build/status/TheMofaDe.DotNetHelper-HttpClient?branchName=master&jobName=macOS
[app-veyor]: https://ci.appveyor.com/project/TheMofaDe/DotNetHelper-HttpClient

repository: TheMofaDe/DotNetHelper-HttpClient

gha_language: C#

repo_name: TheMofaDe/DotNetHelper-HttpClient


text:
# Earth Heightmap
![Mixture.EarthHeightmap](../../images/Mixture.EarthHeightmap.png)

## Output
Port Name | Description
--- | ---
Max Height |
Min Height |
Heightmap |

## Description
Retrieves the heightmap data of earth. This node is using the mapzen dataset, to learn more about it check out this page: https://www.mapzen.com/blog/elevation/.
Hold the right click button of you mouse to move in the map and zoom with the scroll wheel.

repository: alelievr/Mixture

repo_name: alelievr/Mixture


text:
# react-myreads-app

This project is a bookshelf app which is built with [React](https://reactjs.org/) and [Create React App](https://reactjs.org/). This app allows you to select and categorize books you have read, are currently reading, or want to read.

## Getting Started

If editing or running locally:

##### 1. First, make sure the following is installed on your machine

##### 2. make sure you have npm installed - check link below for installation

https://nodejs.org/en/download/

###### then

#### Clone this repository: https://github.com/sunil28rana/react-myreads-app

```git clone https://github.com/sunil28rana/react-myreads-app```

#### OPEN project folder ('react-myreads-app') in Code Editor of choice

* Run following commands from command line
* ```npm install``` or ```yarn install```
* ```npm start``` or ```yarn start``` to start the project on a development server

### **Support and contact details**

For comments or questions, please email<EMAIL_ADDRESS>

## Author

* **[Sunil Rana](https://github.com/sunil28rana)**

See also the list of [contributors](https://github.com/sunil28rana/react-myreads-app/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


text:
# [Bar 137](http://alexa.amazon.com/#skills/amzn1.ask.skill.50efac8f-ddea-4c3d-bddc-c0e26692780f)
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Bar 137 skill, try saying...

* *Alexa, open bar one three seven*

* *My answer is one*

* *I don't know that one*

Do you think you know all about Bar 137 and it's history as an establishment?  Test your knowledge to find out!

Disclaimer:  This skill may not be suitable for all ages.  It is suitable for ages 21 and older.

***

### Skill Details

* **Invocation Name:** bar one three seven
* **Category:** null
* **ID:** amzn1.ask.skill.50efac8f-ddea-4c3d-bddc-c0e26692780f
* **ASIN:** B01M3TKEW6
* **Author:** Steve Sobotka
* **Release Date:** December 5, 2016 @ 00:35:57
* **In-App Purchasing:** No


text:
# Authorization

```toc

```

## Restricting an action to logged-in users

To restrict an action to a logged-in user, use [`ensureIsUser`](https://ihp.digitallyinduced.com/api-docs/IHP-LoginSupport-Helper-Controller.html#v:ensureIsUser):

```haskell
action PostsAction = do
    ensureIsUser
    posts <- query @Post |> fetch
    render IndexView { .. }
```

When someone is trying to access the `PostsAction` but is not logged-in, the browser will be redirected to the login page. After the login succeeded, the user will be redirected back to the `PostsAction`.

It's common to restrict all actions inside a controller to logged-in users only. Place the [`ensureIsUser`](https://ihp.digitallyinduced.com/api-docs/IHP-LoginSupport-Helper-Controller.html#v:ensureIsUser) inside the [`beforeAction`](https://ihp.digitallyinduced.com/api-docs/IHP-ControllerSupport.html#v:beforeAction) hook to automatically apply it to all actions:

```haskell
instance Controller PostsController where
    beforeAction = ensureIsUser

    action PostsAction = do
        posts <- query @Post |> fetch
        render IndexView { .. }

    action ShowPostAction { postId } = do
        post <- fetch postId
        render ShowView { .. }
```

In this case `PostsAction` and `ShowPostAction` are only accessible to logged-in users.

## Restricting an action to logged-in admins

To restrict an action to a logged-in admin, use [`ensureIsAdmin`](https://ihp.digitallyinduced.com/api-docs/IHP-ControllerSupport.html#v:beforeAction) instead of [`ensureIsUser`](https://ihp.digitallyinduced.com/api-docs/IHP-LoginSupport-Helper-Controller.html#v:ensureIsUser). If you get

```
error:
    * Could not deduce (HasNewSessionUrl admin0)
        arising from a use of `ensureIsAdmin'
[…]
      These potential instance exist:
        instance HasNewSessionUrl Admin -- Defined in `Admin.Types'
```

then you may have to annotate the type with `@Admin`. For example:

```haskell
instance Controller UserController where
    beforeAction =
        ensureIsAdmin @Admin
```

## Checking for Permissions

You can use [`accessDeniedUnless`](https://ihp.digitallyinduced.com/api-docs/IHP-AuthSupport-Authorization.html#v:accessDeniedUnless) to allow certain things only for specific users. For example, to restrict a `ShowPostAction` only to the user who a post belongs to, use this:

```haskell
    action ShowPostAction { postId } = do
        post <- fetch postId
        accessDeniedUnless (post.userId == currentUserId)

        render ShowView { .. }
```

repository: digitallyinduced/ihp

extension: markdown

gha_language: Haskell

repo_name: digitallyinduced/ihp


text:
---
title: Universal Framework
path: /universal-framework/
---

# Universal Framework

Previous sections have mentioned that Fusion.js runs through all code both on the server and on the client. This differs from traditional frameworks where there is a clear delineation between what code is for the server and what code is for the client.

For code that is just rendering components, that is ok. However, for libraries that deal with file system access or accessing browser API's, there needs to be a way to specify which code is environment specific and not universal. Fusion.js provides global constants for this purpose that are defined during build time. Let's take a look at an example:

```js
const app = new App();

// This plugin is universal and works across both environments
app.register(LoggingPlugin);

// These plugins ONLY work on the server
if (__NODE__) {
  app.register(FileSystemPlugin);
}

// These plugins ONLY work on the browser
if (__BROWSER__) {
  app.register(BrowserApiPlugin);
}
```

The above entrypoint file uses the `__NODE__` and `__BROWSER__` constants to delineate which logic runs in which environments. We call these **code fences**. When Fusion.js code is built, the compiler will remove all code from a bundle if it does not match the given environment. So the server bundle will not have code marked as `__BROWSER__` only and vice versa.

These constants can be used across all universal code and help to contain code that belongs in the same environment together. Along with [Webpack tree shaking](https://webpack.js.org/guides/tree-shaking/) configured out of the box, this process keeps your Javascript bundles optimized and lean for maximum performance.

## Encapsulation

One common theme with universal code is the need to scaffold the code on the server, serialize the current state onto the client, and then hydrate that state when the client loads. For example, serializing the current Redux store into a `<script>` tag and then reading from that tag to populate the client side store with the same state.

For example, here is the Redux code on the server for Express that renders and then writes the current state onto the page:

```js
function handleRender(req, res) {
  // Create a new Redux store instance
  const store = createStore(rootReducer)

  // Render the component to a string
  const html = renderToString(
    <Provider store={store}>
      <App />
    </Provider>
  );

  // Grab the initial state from our Redux store
  const preloadedState = store.getState();

  // Send the rendered page back to the client
  res.send(`
    <html><head>...</head><body>
      <div id='root'>${html}</div>
      <script id='redux-state'>JSON.stringify(preloadedState)</script>
    </body></html>
  `);
}
```

And here is the associated client code:

```js
const preloadedState = JSON.parse(document.getElementById('redux-state'));

const store = createStore(rootReducer, preloadedState);

const app = (
  <Provider store={store}>
    <App />
  </Provider>
);

render(app, document.getElementById('root'));
```

This pattern applies for other libraries as well and causes this initialization code to be spaghettied across your code base.

In Fusion.js, this logic can be encapsulated into a single plugin, resulting in far cleaner code and a clear abstraction between application code and plugin code:

```js
const app = new App(root);
// ReduxPlugin handles creating the <Provider> and store and wrapping your root element inside of it
app.register(ReduxToken, ReduxPlugin);
// ReducerToken allows for registering a root reducer into the plugin
app.register(ReducerToken, reducer);
```

## One code base

Working in Fusion.js can be different than other frameworks because the code that you are writing is **one** shared code base. We believe that working with only one code base simplifies overhead in figuring out how to structure your project to ensure which code is run where, how to set up your compiler configs to write out the right bundles, and making sure your web app is architected correctly. Using code fences helps to separate out your environmental specific logic when you it.

In the [next section](/docs/core-concepts/core-packages), we'll cover the different packages that make up the framework.

gha_language: JavaScript


text:
---
title: LEDs and Photosynthesis
date: 2016-02-09 08:17:15
tags: [biology, light, indoor]
---
Let's take a look at how plants convert light into energy today. Knowing a little bit about how plants work can help when you need to provide supplemental light indoors, so I'll also go over some different types of light sources and how good or bad they might be.

## Photosynthesis

At its most basic, a plant in its natural habitat requires water from the soil, carbon dioxide from the air, and light from the sun, along with a dozen or so other elements in increasingly small amounts. I'll save those lesser requirements for another post on fertilization, and will focus on light in this post.

Photosynthesis is the process by which plants use these compounds to create energy for growth and fruit production. Several compounds within the plant are involved, but the main one is called *chlorophyll* and comes in two flavors: *a* and *b*. You can think of them as little green bubbles inside of every plant cell.

{% asset_img chlorophyll.jpg Chlorophyll inside a plant cell %}

These react to specific wavelengths (we see them as colors) of light. Below you can see the exact wavelengths that chlorophyll and various other compounds present in some plants can absorb and use to create energy.

{% asset_img photosynthetic-pigment-spectrum.gif Pigments involved in photosynthesis and the light frequencies they absorb %}

As you can see above, *chlorophyll a & b* absorb mostly blue (400-500nm) and red (600-700nm) light, which explains why we see plants as green. Green light is not absorbed, and is instead reflected back off the leaf and into our eyes.

The other compounds in the chart are produced in some or all plants and help the plant to use more of the available light. For example lycopene, which is present in autumn olives, allows the plant to make better use of green light (500 - 550nm).

For the curious, here is a more [in-depth explanation of photosynthesis](http://plantphys.info/plant_physiology/light.shtml). For now, though, just remember that chlorophyll love red and particularly blue light frequencies.

While blue light is very important for plants, don't assume that they can do without red light after the seedling stage! Red light is essential for plants to tell time using a red-sensitive pigment called phytochrome. This means that red light is important for initiating new growth, flowering, fruit production and hardening off for the winter.

## Light Types and Spectrums

Society has come a long way since the days of candlelight. We now have dozens of options when choosing lights for our homes. There are light temperatures, energy use, heat production, and of course cost to think about when choosing light sources.

### Daylight

First, I want to look at the one true reference light for life on Earth: our sun. It produces a full range of colors with lots of blue and green light.

{% asset_img daylight.png Daylight spectrum %}

As you read about other sources of man-made light, keep the daylight spectrum and the chlorophyll ranges in mind.

### Incandescent

Incandescent lights have gotten a bad reputation for being inefficient. These days, a 60 watt incandescent can easily be replaced with a 9-14 watt alternative, saving you a lot of electricity. They also produce most of their light in the infra-red range, which is invisible to the human eye but can be felt as heat on your skin. Here is the light's spectrum:

{% asset_img incandescent.png Incandescent light spectrum %}

As you can see, it produces almost exclusively red light, which is okay but not great for photosynthesis. This combined with the excessive heat output and high energy use make incandescent lights a poor choice for plants.

Incandescent Bulb | Value
----------------- | -----
Electricity use (lower is better) | high
Heat output (lower is better) | high
Cost (lower is better) | low
Produces blue light | poorly
Produces red light | well

### Fluorescent

Fluorescent lights come in both long tube worklight bulbs and in more compact traditional sizes. Both produce about the same spectrum and use significantly less electricity than incandescent lights.

{% asset_img fluorescent.png Fluorescent light spectrum %}

A 60 watt equivalent fluorescent bulb will use about 13 watts. It will generate some heat, but not anywhere near as much as the incandescent. There is a good amount of blue spectrum, so overall fluorescent bulbs are a good choice for plants so long as you use a cool color temperature (e.g. 5000K).

Fluorescent Bulb | Value
---------------- | -----
Electricity use (lower is better) | medium
Heat output (lower is better) | low
Cost (lower is better) | medium
Produces blue light | well
Produces red light | okay

### Metal Halide (HID)

Metal halide is a type of high intensity discharge light source with inexpensive bulbs available.

{% asset_img metal-halide.jpg Metal halide spectrum %}

A 60 watt equivalent metal halide bulb will use about 12 watts. It will generate quite a bit of heat and not much light in the blue spectrum. Most of the light it generates is yellow and is not readily used by most plants, making this a poor choice.

Metal Halide Bulb | Value
----------------- | -----
Electricity use (lower is better) | medium
Heat output (lower is better) | medium
Cost (lower is better) | low
Produces blue light | poorly
Produces red light | okay

### High Pressure Sodium (HPS)

HPS is a popular type of grow light sold in many places. They are available in very high wattages which allow you to light a large area with few lights. The bulbs themselves aren't too expensive, but require special digital ballasts which can be expensive and require cooling.

{% asset_img hps.jpg HPS spectrum %}

A 60 watt equivalent HPS bulb (if it existed) would use about 13 watts. It will generate a lot of heat and not much light in the blue or red spectrum. Most of the light generated is wasted or poorly absorbed. Given enough power to generate a good amount of blue and red light these can be a decent choice, but because there are such better alternatives I think HPS lamps are a poor choice for plants today.

High Pressure Sodium (HPS) Bulb | Value
------------------------------- | -----
Electricity use (lower is better) | medium
Heat output (lower is better) | high
Cost (lower is better) | medium
Produces blue light | poorly
Produces red light | poorly

### Light Emitting Diodes (LEDs)

LEDs are the newest technology on the market and are rapidly both dropping in price and generating more light with fewer watts used every year. LEDs are special in that they can be built to generate specific wavelengths of light, so I'll first focus on the general household bulbs available and then take a look at specialized LEDs which focus on the plant's absorption spectrum.

#### Daylight Household Bulb

This is the type of bulb that fits a regular E26 socket or into a worklight fixture that would normally fit a tube fluorescent. You can buy these at home improvement stores and probably even your local supermarket.

{% asset_img daylight-led.png Daylight household LED spectrum %}

As you can see, other than the cyan valley it pretty closely matches daylight sun, with lots of usable light in the blue range and a good bit of red as well. Unfortunately a lot of the green and yellow is not really usable. A 60 watt equivalent daylight (5000K) LED bulb uses about 9 watts and produces very little heat. I can pick my bulb up in my bare hand after it has been on for 14 hours. These make for great general purpose lights for plants, but can be a bit expensive.

Household LED Bulb | Value
------------------ | -----
Electricity use (lower is better) | low
Heat output (lower is better) | low
Cost (lower is better) | medium to high
Produces blue light | well
Produces red light | okay

#### Specialized LED Fixtures

Specialized fixtures are available in various places online (Amazon, eBay, AliExpress) and locally at hydroponic grow shops. While the grow shops probably deal with a *lot* of marijuana growers, there are plenty of other reasons to get specialized lighting for plants: vegetable starts, berry propagation by cuttings, indoor overwintering in harsh climates, etc.

{% asset_img special-led.png Specialized LED for plant growing spectrum %}

As you can see, the LEDs are specially designed to output just the right frequencies for chlorophyll to do its magic, wasting very little light and heat in the process. The blue and red peaks will depend on just how many blue and red LEDs are in the light fixture (and recently manufacturers have been adding UV and IR LEDs as well). The household daylight LED included some wasted green and yellow light, so you can expect to get up to 30% more usable light for the same wattage with these specialized LEDs, which are extremely efficient.

The lights look purple and dimmer than a normal light, which is something to consider if you will be around them. Personally, I've built a box around mine to keep the lights from bothering me during the day and making my house glow purple at night. This is an example of how they look, to give you an idea:

{% asset_img special-led-color.jpg Specialized LED for plant growing looks dull purple to the human eye %}

They make an excellent source of light for plants, but they cost a bit more than household lights and can't be repurposed during the summer for other tasks.

Specialized LED Bulb | Value
-------------------- | -----
Electricity use (lower is better) | low
Heat output (lower is better) | low
Cost (lower is better) | high
Produces blue light | well
Produces red light | well

## Light Intensity

Another incredibly important aspect of growing plants indoors is the light intensity, which you typically see measured in lumens. Many bulbs today list the lumen output, and in fact that is how manufacturers determine what a 60 watt equivalent bulb is: their lumen values will be similar to a 60 watt incandescent light.

Lux, which is another important metric to know, is the measure of intensity over area. Specifically one lux is defined as one lumen per square meter.

Illuminance | Illuminated by
-----------:|:--------------
     1  lux | Full moon on a cloudless night
    50  lux | Family living room
   400  lux | Sunrise / sunset
 1,000  lux | Overcast day
10,000+ lux | Daylight (not direct sun)
32,000+ lux | Full sunlight (up to 100,000 lux!)

What does this mean? If you have an area of one meter by one meter and a 100 watt equivalent daylight LED bulb (14.5 watts, 1500 lumens) you would have the same light intensity for your plants as an overcast day. An LED tube light that uses 22 watts would give off around 2,200 lumens. With four of those you can get into the 10,000+ lux range and your plants will be much happier, but it will use more electricity.

If you want to cover an area that is two meters by one meter then you will now have a value of 4,400 lux (8,800 lumens spread over two square meters). Remember, the larger the area the more light you will need!

### The Problem with Lumens

The problem with lumens, however, is that it is a value [weighted to the human eye](https://en.wikipedia.org/wiki/Luminosity_function), which sees mostly green/yellow (that's why purple lights look dull). Remember, plants respond much better to blue and red light. Here is what the human eye sees best:

{% asset_img human-eye.jpg Human eye spectral efficiency %}

For comparison, here is the total plant response, within which is the active region for chlorophyll. Notice that it's almost the opposite of what the human eye sees:

{% asset_img plant-response.jpg Photosynthetic Active Radiation spectrum %}

Unfortunately most manufacturers only list lumens. If you do purchase specialized LED grow lights then some manufacturers may list information about the [photosynthetic active radiation](https://en.wikipedia.org/wiki/Photosynthetically_active_radiation) (PAR) intensity in watts or photosynthetic photon flux density (PPFD). That is a *much* better measure of usable intensity, but feels a lot like comparing apples to oranges when looking at household bulbs that only list lumens.

Keep in mind that a specialized LED that produces 1500 lumens of mostly red and blue is significantly better for plants than a household daylight LED that produces 1500 lumens with a lot of green light. The specialized light will be much brighter (to the plants) and produces almost no or very few wasted frequencies. You're better off comparing the wattages and assuming the specialized LED will be 30% better at the same watt usage.

You may see the household daylight LED has an efficiency of 103 lumens per watt while the specialized bulb has only 30-50 lumens per watt - just remember that's comparing it to the human eye and not to what plants need. Use what you know about the light's spectrum along with the wattage to determine what is best for your use case!

## Good luck!

My general rules for picking lights:

1. Plants love blue and red light, so choose a high color temperature (5000K) to produce lots of blue. These are mainly marketed as 'Daylight' bulbs or special LEDs which produce blue light.
2. Try to keep your heat production low and you won't need to worry about cooling.
3. Try to keep your energy use low because the lights will run long hours every day. Expect to run them 14+ hours a day.
4. Produce enough lux to approach daylight. If you can get PPFD values, shoot for around 400 to 500 µmol⁄m2·s photons (around 26 mol⁄m2·day).

Hopefully that has given you some insight into the different types of lights and why LEDs can be a great choice for providing supplemental or full light indoors for plants. Happy growing!

repository: danielgtaylor/berry-gardener

repo_name: danielgtaylor/berry-gardener


text:
---
author: Jens-Christian Fischer
categories: ["musings"]
comments: true
date: 2013-02-10 18:12:48+00:00
layout: post
link: https://invisible.ch/2013/02/10/87-guitar-stand/
slug: 87-guitar-stand
tags: ["blog"]
title: 87 - Guitar stand
type: post
wordpress_id: 12155
---

To all of you who wondered what the [day of woodcarving](/2013/02/09/88-woodcarving/) produced:

A guitar stand for my Telecaster and the Norman acoustic.

[![Untitled](https://farm9.staticflickr.com/8369/8462461296_85008a4609.jpg)](https://www.flickr.com/photos/jcfischer/8462461296/)

[![Untitled](https://farm9.staticflickr.com/8369/8461362795_5d9ebd18d6.jpg)](https://www.flickr.com/photos/jcfischer/8461362795/)

As you can see from the detail shot, I made a mistake in the geometry of the stand. The back is angled, so the lower support should have been angled too. There's also a cut visible, but this one I left in deliberately. It is my rendition of [Wabi Sabi](https://en.wikipedia.org/wiki/Wabi-sabi). This is my first piece of wood cutting and I'm more than happy to show that (both the roughness of the whole piece and the imperfections that are due to my clumsiness)


text:
# Javascript Unit Tests Playground

This is a playground so i can run some javascript unit tests fast with [Jest](https://facebook.github.io/jest/), [Mocha](https://mochajs.org/) or [Tape](https://github.com/substack/tape).

## Getting Started

Run following commands to get started:

```bash
git clone https://github.com/fakiolinho/javascript-unit-tests-playground.git
cd javascript-unit-tests-playground && npm i
```

## Jest Tests

Put the test file in `jest` folder and name it following `name.spec.js` pattern. Run your test:

```bash
npm run test:jest
```

## Mocha Tests

Put the test file in `mocha` folder and name it following `name.spec.js` pattern. [Chai](http://chaijs.com/) is used for assertions. Run your test:

```bash
npm run test:mocha
```

## Tape Tests

Put the test file in `tape` folder and name it following `name.spec.js` pattern. Run your test:

```bash
npm run test:tape
```

## License

This project is licensed under the MIT License

repository: yyzl/javascript-unit-tests-playground

repo_name: yyzl/javascript-unit-tests-playground


text:
---
title: "isOnPremise (Client API reference) in model-driven apps| MicrosoftDocs"
description: Includes description and supported parameters for the isOnPremises method.
ms.date: 04/21/2021
ms.service: powerapps
ms.topic: "reference"
applies_to: "Dynamics 365 (online)"
ms.assetid: 855767c5-c48f-47a2-8f99-52423221d974
author: "Nkrb"
ms.author: "nabuthuk"
manager: "kvivek"
search.audienceType:
  - developer
search.app:
  - PowerApps
  - D365CE
---
# isOnPremises (Client API reference)

Returns a boolean value indicating if the model-driven apps instance is hosted on-premises or online.

## Syntax

```JavaScript
var globalContext = Xrm.Utility.getGlobalContext();
globalContext.isOnPremises();
```

## Return Value

**Type**: Boolean

**Description**: **true** if the model-driven apps instance is on-premises; **false** otherwise.

### Related topics

[Xrm.Utility.getGlobalContext](../getGlobalContext.md)

[!INCLUDE[footer-include](../../../../../../includes/footer-banner.md)]

repository: phuocle/Dynamics-Crm-DevKit

repo_name: phuocle/Dynamics-Crm-DevKit


text:
# :notebook: Recetario-mongoDB

## :memo: Table of contents

- [Introduction](#Introduction)
- [Setup](#Setup)
- [Features](#features)
- [Built with](#Built-with)
- [License](#License)

## :fork_and_knife: Introduction

Recetario-mongoDB is a Node-JS app developed to manage recipes. It is possible to create authors, ingredients and recipes, as well as edit and delete them.

## :gear: Setup

1. Install NPM packages

```
npm install
```

2. Start the app

```
npm start
```

You can access the app at  ```<IP_ADDRESS>:4000```

## :sparkles: Features

### Mutations

- [addRecipe](./queriesTemplates.md#Add-Recipe)
- [addAuthor](./queriesTemplates.md#Add-Author)
- [addIngredient](./queriesTemplates.md#Add-Ingredient)
- [removeRecipe](./queriesTemplates.md#Remove-Recipe)
- [removeAuthor](./queriesTemplates.md#Remove-Author)
- [removeIngredient](./queriesTemplates.md#Remove-Ingredient)
- [updateAuthor](./queriesTemplates.md#Update-Author)
- [updateIngredient](./queriesTemplates.md#Update-Ingredient)
- [updateRecipe](./queriesTemplates.md#Update-Recipe)

### Queries

- [getAuthor](./queriesTemplates.md#Author)
- [getAuthors](./queriesTemplates.md#Show-Authors)
- [getRecipe](./queriesTemplates.md#Recipe)
- [getRecipes](./queriesTemplates.md#Show-Recipes)
- [getIngredient](./queriesTemplates.md#Ingredient)
- [getIngredients](./queriesTemplates.md#Show-ingredients)

The usage tempates can be found [here](./queriesTemplates.md) or clicking on each function.

## :wrench: Built with

- [graphql-yoga](https://www.npmjs.com/package/graphql-yoga)
- [Mongo DB](https://www.mongodb.com/cloud/atlas)

## :page_facing_up: License

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

**[Back to top](#Table-of-contents)**

repository: LauraRgz/Recetario-mongoDB

repo_name: LauraRgz/Recetario-mongoDB


text:
---
layout: default
---

# 1996-08-27 - Sen. Leahy's "impeccable cyberspace credentials"

## Header Data

From: Declan McCullagh<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 4e41dd7b48255c7ee4dc53f3e6c715a3b54c7f00edbdd9f5d1437b665ddf3238

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-08-27 01:45:22 UTC

Raw Date: Tue, 27 Aug 1996 09:45:22 +0800

## Raw message

```
{% raw  %}From: Declan McCullagh<EMAIL_ADDRESS>Date: Tue, 27 Aug 1996 09:45:22 +0800
To<EMAIL_ADDRESS>Subject: Sen. Leahy's "impeccable cyberspace credentials"
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

---------- Forwarded message ----------
Date: Mon, 26 Aug 1996 12:23:57 -0400
From: Jonah Seiger<EMAIL_ADDRESS>To: Declan McCullagh<EMAIL_ADDRESS>Cc<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: Re: INFO: Democratic convention chats online! Be there! (8/25/96)

Declan:

What are you thinking?!

In a world where we have very few real friends, I simply don't understand
what you are trying to accomplish. It's fine (and healthy) to raise
concerns about the particular positions a member of Congress takes (hell, I
don't agree with everything Leahy does), but to simply dismiss Leahy as a
'no friend of the Net'  is naive and counterproductive.

Look at the record. Leahy is hands down the strongest supporter of the Net
in Congress. Period. No other Member (including our small but growing
handful of other friends like Burns, White, Wyden, Cox, Eshoo, etc) has
been a more forceful or consistent advocate for your causes for as long as
Leahy has. What exactly do you want? Perhaps we should elect you to
Congress and see how well you can do.

Of course we are not going to agree with our friends on every issue. If
Leahy takes a position you don't like, I'd suggest you talk to his office.
I have found in my experience that Leahy's staff (and him personally) will
take the time to listen when presented with a well presented argument.

I'm also confused about another thing: which hat were you wearing when you
wrote this? If it is your "advocate" hat I think it must covering your
eyes. If it's your "journalist" hat, you need to do a bit better job of
checking your facts in the future.

 It's fashionable, sure, but
what does it really accomplish?  Some of them are dangerous. Others are
sympathetic. The fact is that short of armed rebellion they are going to be
here for a while.
I shudder to think of the wrath our opponents could wage if we all threw up
our hands packed up our bags and left town.

Face the facts. Members of Congress have a lot of constituencies to deal
with, and we are a small and relatively powerless faction. We can do a lot
to change the outcomes of policy debates (if I didn't believe that I
wouldn't be doing what I do everyday), but we have to be realistic,
recognize where we fit in to the process and who are friends are.  One
thing's for sure - we have A LOT more enemies than we have friends.

Most members of Congress don't really understand us or our issues.  Many
are willing to learn, and some have been real champions for our causes.
But none of them are gong to continue reaching out a hand to us if we bark
and bite when we don't get 100% of our way. Zealots rarely win (though it
sure is fun to throw bombs).

Sorry for the public thrashing, but this kind of attitude REALLY gets under
my skin.

Flames welcome (though response is not guaranteed <g>),

Jonah

At 6:45 PM 8/25/96, Declan McCullagh wrote:
>On Sun, 25 Aug 1996, Voters Telecommunications Watch wrote:
>> [Notably missing from this schedule are Senators Patrick J. Leahy (D-VT)
>>  and Russell Feingold (D-WI) and House member Jerrold Nadler (D-NY).  All
>>  three have impeccable cyberspace credentials and we look forward to seeing
>>  them online.]
>
>As Shabbir and Steve know, I'm a huge fan of VTW and congratulate them for
>their successful efforts to keep netizens up-to-date on what's happening
>in the meatspace body politic.
>
>But VTW's statement above is, unfortunately, untrue and misleading.
>
>Even though Sen. Leahy opposed the CDA, his stance on privacy illustrates
>that his "cyberspace credentials" are anything but impeccable. His crypto
>bill, introduced before Pro-CODE, would liberalize some export controls
>but impose new and unprecedented criminal penalties for the use of crypto
>associated with a crime. Worse yet, as recently as this month Leahy has
>been clamoring to fund the invasive wiretapping legislation ("Digital
>Telephony") he shepherded through Congress two years ago.
>
>Equally distressingly, Leahy demonstrated his "impeccable cyberspace
>credentials" by cosponsoring the Senate online copyright bill -- aka the
>Hollywood Media Mafia's wet dream. (Yes, these are the same rapacious
>folks who are demanding that the Boy Scouts and summer camps pay cash to
>sing "God Bless America" and "Puff the Magic Dragon.") Opposed by the
>American Library Association, EFF, and teachers' organizations, Leahy's
>bill would slam fair use rights online and could make it a crime to
>browse the Net without a license.
>
>When VTW heralds Leahy as a friend of the Net with "impeccable cyberspace
>credentials," they do the Net a disservice. Leahy is in no way a true
>friend of the Net; I don't know of any Beltway politican who is.
>
>-Declan
>
>
>//<EMAIL_ADDRESS>// I do not represent the EFF //<EMAIL_ADDRESS>/

  ** THE FIGHT FOR FREE SPEECH ONLINE CONTINUES TO THE SUPREME COURT **
      It's not too late to be a part of history -- Join the Lawsuit
         <http://www.cdt.org/ciec>   --<EMAIL_ADDRESS>
--
Jonah Seiger, Policy Analyst           Center for Democracy and Technology
<EMAIL_ADDRESS>                         1634 Eye Street NW, Suite 1100
                                                      Washington, DC 20006
PGP Key via finger                                     (v) +1.202.637.9800
http://www.cdt.org/                                    (f) +1.202.637.0968
http://www.cdt.org/homes/jseiger/

{% endraw %}
```

## Thread

+ Return to [August 1996](/archive/1996/08)

+ Return to "[Declan McCullagh <declan@eff.org>](/authors/declan_mccullagh_declan_at_eff_org_)"

+ 1996-08-27 (Tue, 27 Aug 1996 09:45:22 +0800) - Sen. Leahy's "impeccable cyberspace credentials" - _Declan McCullagh<EMAIL_ADDRESS>


text:
# Buildpack Samples

This repository contains sample implementations for learning and testing purposes.

Includes:
- Buildpacks
- Lifecycles
- Apps

# External Buildpacks
* [CloudFoundry Cloud Native Buildpacks](https://hub.docker.com/r/cloudfoundry/cnb)
* [Heroku Java Cloud Native Buildpack](https://github.com/heroku/java-buildpack)

repository: fdserr/samples

repo_name: fdserr/samples


text:
Role Name
=========

A developing role for deploying consul cluster to AWS.

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

Uses EC2 modules. Requires boto and AWS credentials.

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

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

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:

```yaml
---
- hosts: localhost
  become: false
  gather_facts: false
  connection: local
  vars:
    consul_encrypt_key: '{{ vault_consul_encrypt_key }}'
    consul_ssh_key: jdelaporte-vault-ansible
    consul_terminate: False
    consul_instance_type: t2.small
    consul_data: '/opt/consul'
    consul_user: 'consul'
    consul_group: '{{ consul_user }}'
    consul_home: '/etc/consul.d'
    consul_version: '1.7.1'
    consul_download_url: 'https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_linux_amd64.zip'
    consul_install_dir: '/usr/local/bin'
    consul_ami_owner: "amazon"
    consul_ami_name_filter: "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2"
    consul_cluster_name: primary
    consul_cluster_region: us-east-2
    consul_cluster_ami_id: ami-0e38b48473ea57778 #DONE: make this discoverable
    consul_cluster_count: 3
    consul_cluster_tags:
      deployment: green
      lifecycle: dev
      product: vault

  roles:
  - consul_cluster_aws
```

License
-------

BSD

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

An optional section for the role authors to include contact information, or a website (HTML is not allowed).


text:
## Book Store Application

- This is an application for storing,accessing and viewing your books.
- This works fine on your terminal itself.
- Beginner Level Project

### Tools used:
- Python(Backbone)
- csv (for storing the data)

### Features:

#### - STORE MY BOOK
- The code will ask information like Book Name,Author Name,Publisher Name, Genre of your book and Published Date of the book and it will store the details in the csv file.
- It allows the users to add new books to the collection

#### - FIND MY BOOK
- All your books are stored in the csv file.
- The application allows the users to find a book within their collection by any of its attributes.
- The users can tell the application what property they are looking for, is it name, genre, published date,etc.
- With the structure defined, users can , say, "find all books published in 2015" or "find all books that are biographies"
- The users can also see the no. of collections found based on any criteria.

#### - DISPLAY ALL MY BOOKS
-  The application allows users to view all the books in their collection.
- They can also see the total no. of collections

In the csv file, I have added one of my collections for reference.


text:
# Simple IdP provider
This is intended to be the simplest possible IdP provider.

The file ".well-known/idp-proxy/identity-provider.js" is the provider itself.
You can serve it from localhost by using the "generate-ssl-cert.sh" to generate a cert, and serve HTTPS by running "ssl-server.py" - this serves on port 8124.
The client code in "set-identity-provider.html" exercises the API (and shows nothing).

To access the local version:
pc.setIdentityProvider("localhost:8124", "identity-provider.js",
		      "hint-anonymous");

To acces a version off the Net:
pc.setIdentityProvider("www.alvestrand.no", "identity-provider.js",
		      "hint-anonymous");

repository: alvestrand/id-hackathon

repo_name: alvestrand/id-hackathon


text:
# @ksquareincmx/zanma-ui

## Install

```bash
npm install --save @ksquareincmx/zanma-ui
```

## Usage

> Note:
> For the UI library to work properly first you must
> add "Raleway" font family to your application

```tsx
import * as React from "react";

import { Text } from "@ksquareincmx/zanma-ui";

class Example extends React.Component {
  render() {
    return <Text>Hell world</Text>;
  }
}
```

## License

MIT © [KsquareIncMx](https://github.com/ksquareincmx)

repository: ksquareincmx/zanma-ui

gha_language: TypeScript

repo_name: ksquareincmx/zanma-ui


text:
### Description

...

### Environment information

```
OS: <your answer here>

$ pip freeze | grep trax
# your output here

$ pip freeze | grep tensor
# your output here

$ pip freeze | grep jax
# your output here

$ python -V
# your output here
```

### For bugs: reproduction and error logs

```
# Steps to reproduce:
...
```

```
# Error logs:
...
```

repository: google/trax

gha_language: Python

repo_name: google/trax


text:
image-resolver [![Build Status](https://travis-ci.org/shekhargulati/image-resolver.svg?branch=master)](https://travis-ci.org/shekhargulati/image-resolver) [![codecov.io](https://codecov.io/github/shekhargulati/image-resolver/coverage.svg?branch=master)](https://codecov.io/github/shekhargulati/image-resolver?branch=master) [![License](https://img.shields.io/:license-apache-blue.svg)](./LICENSE)
------

A Java 8 library to extract main image from a URL.
Getting Started
--------

To use image-resolver in your application, you have to add `image-resolver` in your classpath. image-resolver is available on [Maven Central](http://search.maven.org/) so you just need to add dependency to your favorite build tool as show below.

For Apache Maven users, please add following to your pom.xml.

```xml
<dependencies>
    <dependency>
        <groupId>com.shekhargulati</groupId>
        <artifactId>image-resolver</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>
```

Gradle users can add following to their build.gradle file.

```
compile(group: 'com.shekhargulati', name: 'image-resolver', version: '0.1.0')
```

## Using the API

It is very easy to use the API.

### Extracting image from URL.

```java
String url = "https://medium.com/the-mission/how-to-get-people-to-like-you-in-5-seconds-or-less-67e64cb91155#.tp52bdm6m";
Optional<String> mainImage = MainImageResolver.resolveMainImage(url);
// Return  Optional("https://cdn-images-1.medium.com/max/1200/1*-yql2CobEo8rGLCZv2gOyw.jpeg")
```

### Extracting image from HTML

```java
Optional<String> mainImage = MainImageResolver.resolveMainImageFromHtml(html)
```

### Extracting image using your HTML fetcher

If you want to use your own way to fetch HTML then you can use.

```java
Optional<String> mainImage = MainImageResolver.resolveMainImage(url, url -> fetchHtml(), ImageResolvers.webpageResolvers);
```

## Inspiration

This library is inspired by Maurice Svay [ImageResolver](https://github.com/mauricesvay/ImageResolver) JavaScript library.

repository: shekhargulati/image-resolver

repo_name: shekhargulati/image-resolver


text:
# prometheus role

Downloads [prometheus](https://prometheus.io/) from github and configures it
in ```/etc/prometheus.yml``` with datadir ```/var/lib/prometheus/```.

Simple config:

    - prometheus_scrapes:
        - name: prometheus
          targets: ['localhost:9090', ...]
        - name: ha_cluster
          ...

With non default config values:

    - prometheus_scrapes:
        - name: special
          interval: 120 # default was 60 seconds
          timeout: 15   # default was 10 seconds
	  metrics_path: '/hopglass-server/metrics' # default is '/metrics'
          targets: ['example.com:1337']

Another version:

    - prometheus_version: 1.4.1  # default

repository: freifunkh/ansible

gha_language: Jinja

repo_name: freifunkh/ansible


text:
# SOAP Microservices with Spring Boot and Spring web services (spring-ws)
*A docker container created with Spring Boot exposing a SOAP endpoint for a legacy client*

The tech stack for this POC is:
* Spring Boot 2.3.4
* Java 15
* Spring Webservices (spring-ws)
* REST Assured 4.3
* Docker

## Software requirements
Workstation must be properly configured with next tools:
* Java 15 JDK - https://jdk.java.net/15/
* Maven - https://maven.apache.org/download.cgi

Optional tools
* Docker - https://www.docker.com/products/docker-desktop
* Docker hub account with token access enabled

## WSDL and Domain Model
In our example, we are going to work in a fictitious Employee SOAP service with 2 operations:
* GetEmployeeById
* GetEmployeeByName

For the demo, I separated the XSD from the WSDL. In a real scenario, this will be the most followed pattern but expect to have more than one XSD in different folders. The [employee.xsd](/src/main/resources/wsdl/employee.xsd) has the full domain model for the service, next diagram shows the main response sent back to the client

![XSD Schema](/assets/xsd-employeesresponse.png?raw=true)

The WSDL is used for describing the functionality of the SOAP-based webservice. From all the sections in the WSDL file, the most important for us is the `wsdl:portType`. This section defines the interface for the service we want to implement: operations, input, and output parameters:

![portType diagram](https://github.com/jpontdia/ws-employee-soapcxf/blob/master/assets/porttype-diagram.png?raw=true)

Next is the WSDL section for `wsdl:portType`:
```xml
<!--This element defines the service operations and the combination of input and output elements to clients-->
<wsdl:portType name="EmployeeServicePortType">
    <wsdl:operation name="GetEmployeeById">
        <wsdl:input message="tns:EmployeeByIdRequest"/>
        <wsdl:output message="tns:EmployeeResponse"/>
    </wsdl:operation>
    <wsdl:operation name="GetEmployeesByName">
        <wsdl:input message="tns:EmployeeByNameRequest"/>
        <wsdl:output message="tns:EmployeesResponse"/>
    </wsdl:operation>
</wsdl:portType>
```
The complete WSDL file is here: [EmployeeServices.wsdl](/src/main/resources/wsdl/EmployeeServices.wsdl)

## Installation

Make sure your computer is properly configured with the tools described in the requirements section.

In order to run the project type in root folder:
```bash
mvn spring-boot:run
```

You will see in the log console:
```windows
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.4.RELEASE)

2020-10-02 22:23:49.563  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Starting MainApplication v1.0.1-SNAPSHOT on b6e50b2f461b with PID 1 (/app.jar started by root in /)
2020-10-02 22:23:49.572 DEBUG 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Running with Spring Boot v2.3.4.RELEASE, Spring v5.2.9.RELEASE
2020-10-02 22:23:49.573  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : The following profiles are active: local
2020-10-02 22:23:51.163  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2020-10-02 22:23:51.179  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-10-02 22:23:51.179  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-10-02 22:23:51.254  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-10-02 22:23:51.255  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1625 ms
2020-10-02 22:23:51.541  INFO 1 --- [           main] o.s.boot.web.servlet.RegistrationBean    : Servlet CXFServlet was not registered (possibly already registered?)
2020-10-02 22:23:51.885  INFO 1 --- [           main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {http://service.datajdbc.jpworks.com/}EmployeeEndpointService from class com.jpworks.employee.EmployeeService
2020-10-02 22:23:52.455  INFO 1 --- [           main] org.apache.cxf.endpoint.ServerImpl       : Setting the server's publish address to be /service/employee
2020-10-02 22:23:52.646  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-10-02 22:23:52.870  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2020-10-02 22:23:52.889  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Started MainApplication in 4.018 seconds (JVM running for 4.625)
```

## Usage

To get the wsdl of the service, write in the browser:
```html
http://localhost:8081/soap/service/EmployeeService.wsdl
```
![services](/assets/wsdl-generation.png)

We can test the application using an Http Client like PostMan or Jmeter using a POST call (the application uses for the test cases RestAssured library). But I am going to use the traditional SoapUI, the endpoint for the service is: `http://localhost:8081/soap/service/EmployeeService`

The payload for GetEmployeeById:
```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:emp="http://www.jpworks.com/employee">
   <soapenv:Header/>
   <soapenv:Body>
      <emp:EmployeeByIdRequest id="1"/>
   </soapenv:Body>
</soapenv:Envelope>
```

The payload for GetEmployeeById:
```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:emp="http://www.jpworks.com/employee">
   <soapenv:Header/>
   <soapenv:Body>
      <emp:EmployeeByNameRequest firstname="John" lastname="Miller"/>
   </soapenv:Body>
</soapenv:Envelope>
```

![services](/assets/soapui.png)

## Docker Image

A Docker Hub account is required to publish the docker image into the registry. We are going to use the next values for my personal Docker account:

* Account ($ACCOUNT): jpontdia
* Repository ($REPOSITORY): jpontdia/ws-employee-soapspringws

Create the jar file of the service with maven:
```bash
mvn install
```

Log in into your Docker Hub account using your access token,
[more information here](https://docs.docker.com/docker-hub/access-tokens/)

```bash
docker login --username=$ACCOUNT
```

Example:
```bash
C:\workspace\dev\datajdbc\ws-employee-soapspringws>docker login --username=jpontdia
Password:
Login Succeeded
```

Create docker image
```bash
docker build --build-arg JAR_FILE=target/*.jar --tag $REPOSITORY .
```

Example:
```bash
C:\workspace\dev\datajdbc\ws-employee-soapspringws>docker build --build-arg JAR_FILE=target/*.jar --tag jpontdia/ws-employee-soapspringws .

Sending build context to Docker daemon  29.24MB
Step 1/5 : FROM adoptopenjdk/openjdk15:x86_64-alpine-jre-15_36
x86_64-alpine-jre-15_36: Pulling from adoptopenjdk/openjdk15
df20fa9351a1: Pull complete
485bef740c7c: Pull complete
7b26ca94da60: Pull complete
Digest: sha256:a9b20bbb07ce018260effe2113bf2f3074739afde501df615e22745df3b48571
Status: Downloaded newer image for adoptopenjdk/openjdk15:x86_64-alpine-jre-15_36
 ---> edc28ff1032d
Step 2/5 : VOLUME /tmp
 ---> Running in c6ecbb27be28
Removing intermediate container c6ecbb27be28
 ---> b6c2c51f1532
Step 3/5 : ARG JAR_FILE
 ---> Running in 193ef5bb8a6a
Removing intermediate container 193ef5bb8a6a
 ---> c4e12e3e67b2
Step 4/5 : COPY ${JAR_FILE} app.jar
 ---> 7a799bce3230
Step 5/5 : ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
 ---> Running in ff3eb68c9c64
Removing intermediate container ff3eb68c9c64
 ---> c2b63024196e
Successfully built c2b63024196e
Successfully tagged jpontdia/ws-employee-soapspringws:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
```

Verify the image was created correctly by running:
```bash
C:\workspace\dev\datajdbc\ws-employee-soapspringws>docker images

REPOSITORY                     TAG                       IMAGE ID            CREATED             SIZE
jpontdia/ws-employee-soapspringws   latest                    c2b63024196e        19 minutes ago      221MB
adoptopenjdk/openjdk15         x86_64-alpine-jre-15_36   edc28ff1032d        9 days ago          192MB
```

Test image locally
```bash
docker run -p $EXPOSED_PORT:$INTERNAL_APPLICATION_PORT $REPOSITORY
```
Where:
* $EXPOSED_PORT is the port visible for other applications on your machine
* $INTERNAL_APPLICATION_PORT is the port configured in the [application.yml](/src/main/resources/application.yml)

Example:
```bash
C:\workspace\dev\datajdbc\ws-employee-soapspringws>docker run -p 8081:8081 jpontdia/ws-employee-soapspringws

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.4.RELEASE)

2020-10-02 22:23:49.563  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Starting MainApplication v1.0.1-SNAPSHOT on b6e50b2f461b with PID 1 (/app.jar started by root in /)
2020-10-02 22:23:49.572 DEBUG 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Running with Spring Boot v2.3.4.RELEASE, Spring v5.2.9.RELEASE
2020-10-02 22:23:49.573  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : The following profiles are active: local
2020-10-02 22:23:51.163  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2020-10-02 22:23:51.179  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-10-02 22:23:51.179  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-10-02 22:23:51.254  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-10-02 22:23:51.255  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1625 ms
2020-10-02 22:23:51.541  INFO 1 --- [           main] o.s.boot.web.servlet.RegistrationBean    : Servlet CXFServlet was not registered (possibly already registered?)
2020-10-02 22:23:51.885  INFO 1 --- [           main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {http://service.datajdbc.jpworks.com/}EmployeeEndpointService from class com.jpworks.employee.EmployeeService
2020-10-02 22:23:52.455  INFO 1 --- [           main] org.apache.cxf.endpoint.ServerImpl       : Setting the server's publish address to be /service/employee
2020-10-02 22:23:52.646  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-10-02 22:23:52.870  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2020-10-02 22:23:52.889  INFO 1 --- [           main] com.jpworks.datajdbc.MainApplication     : Started MainApplication in 4.018 seconds (JVM running for 4.625)
```

Push image to Docker Hub
```bash
docker push $REPOSITORY
```

Example:
```bash
docker push jpontdia/ws-employee-soapspringws

The push refers to repository [docker.io/jpontdia/ws-employee-soapcxf]
a5988eef4f17: Pushed
8ec501d69d1a: Mounted from adoptopenjdk/openjdk15
41eb7e916580: Mounted from adoptopenjdk/openjdk15
50644c29ef5a: Mounted from jpontdia/ws-employee-soapspringws
latest: digest: sha256:f414594938049532b74fff2bd3c63269c9322de5c83007d8b42a5f46f1b93ec6 size: 1163
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0)

repository: mijaresorlando/ws-employee-soapspringws

repo_name: mijaresorlando/ws-employee-soapspringws


text:
[//000000001]: # (page\_util\_quote \- Parser generator tools)
[//000000002]: # (Generated from file 'page\_util\_quote\.man' by tcllib/doctools with format 'markdown')
[//000000003]: # (Copyright © 2007 Andreas Kupries<EMAIL_ADDRESS>[//000000004]: # (page\_util\_quote\(n\) 1\.0 tcllib "Parser generator tools")

 [ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

# NAME

page\_util\_quote \- page character quoting utilities

# Table Of Contents

  - [Table Of Contents](#toc)

  - [Synopsis](#synopsis)

  - [Description](#section1)

  - [API](#section2)

  - [Bugs, Ideas, Feedback](#section3)

  - [Keywords](#keywords)

  - [Category](#category)

  - [Copyright](#copyright)

# SYNOPSIS

package require page::util::quote ?0\.1?
package require snit

[__::page::util::quote::unquote__ *char*](#1)
[__::page::util::quote::quote'tcl__ *char*](#2)
[__::page::util::quote::quote'tclstr__ *char*](#3)
[__::page::util::quote::quote'tclcom__ *char*](#4)

# DESCRIPTION

This package provides a few utility commands to convert characters into various
forms\.

# API

  - __::page::util::quote::unquote__ *char*

    A character, as stored in an abstract syntax tree by a PEG processor \(See
    the packages __grammar::peg::interpreter__, __grammar::me__, and
    their relations\), i\.e\. in some quoted form, is converted into the equivalent
    Tcl character\. The character is returned as the result of the command\.

  - __::page::util::quote::quote'tcl__ *char*

    This command takes a Tcl character \(internal representation\) and converts it
    into a string which is accepted by the Tcl parser, will regenerate the
    character in question and is 7bit ASCII\. The string is returned as the
    result of this command\.

  - __::page::util::quote::quote'tclstr__ *char*

    This command takes a Tcl character \(internal representation\) and converts it
    into a string which is accepted by the Tcl parser and will generate a human
    readable representation of the character in question\. The string is returned
    as the result of this command\.

    The string does not use any unprintable characters\. It may use
    backslash\-quoting\. High UTF characters are quoted to avoid problems with the
    still prevalent ascii terminals\. It is assumed that the string will be used
    in a double\-quoted environment\.

  - __::page::util::quote::quote'tclcom__ *char*

    This command takes a Tcl character \(internal representation\) and converts it
    into a string which is accepted by the Tcl parser when used within a Tcl
    comment\. The string is returned as the result of this command\.

# Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and
other problems\. Please report such in the category *page* of the [Tcllib
Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas
for enhancements you may have for either package and/or documentation\.

When proposing code changes, please provide *unified diffs*, i\.e the output of
__diff \-u__\.

Note further that *attachments* are strongly preferred over inlined patches\.
Attachments can be made by going to the __Edit__ form of the ticket
immediately after its creation, and then using the left\-most button in the
secondary navigation bar\.

# KEYWORDS

[page](\.\./\.\./\.\./\.\./index\.md\#page), [parser
generator](\.\./\.\./\.\./\.\./index\.md\#parser\_generator),
[quoting](\.\./\.\./\.\./\.\./index\.md\#quoting), [text
processing](\.\./\.\./\.\./\.\./index\.md\#text\_processing)

# CATEGORY

Page Parser Generator

# COPYRIGHT

Copyright © 2007 Andreas Kupries<EMAIL_ADDRESS>

repository: markemer/macports-base

gha_language: Tcl

repo_name: markemer/macports-base