text:
# query

query has been created in order to make easier to retrieve values from a [toml document](https://toml.io) like [jq](https://stedolan.github.io/jq/) does with JSON document.

In some extend, query can also be used to search for values in JSON documents - but it is not its primary objective.

### Syntax

query has a little syntax based on the toml specification but also extended in order to test for the presence of an option and/or its expected values.

It is also inspired by the syntax of the CSS selectors in order to select elements of array or to check the type of a value (array, table,...).

There are other influences such as the notation of regular expression in Javascript, the way to specified the kind of variable in Perl.

The general form of a query is as follows:

```
[level][type]element[:selector][[predicate]][subquery],[query]...
```

##### level

The level part of the query specifies where the query should try to find the requested element.

There are two levels defined:

1. Level **One**: the query will only try to find the given element in the current level - most of the time the current table. If it can not find it, it will not try to go deeper in the document and returns a null result.
2. Level **Any**: the query will try to find the given element in the current level first. If it can not find it, it will start to check the sub tables until it can find the specified element. That also means that as soon as the query find a match, even if other match are possible deeper in the document, they will be ignored.

The level **One** is written with the single dot operator: ```.```

The level **Any** is written with the double dot operator: ```..```

Note: the level operator is optional in the query. If not specified, the query will considered that level **Any** has been specified.

##### type

The type part of the query allows to specify the type of elements that the query should search for. By default, the query will search for any types of element. When a list of elements (see below) is given, all elements in this list will have to be of the same type.

There are three types that are defined and that match (more or less) the three types of elements found in toml document:

* Value: the query will only look for simple values. Simple values are string, integer, float, boolean and date and time values.
* Regular: the query will only look for tables in the document. It does not matter if table are defined inline or as member of an array or regular table.
* Array: the query will only look for array whatever the kind of elements they contain.

The type **Value** is written with the percent operator: ```%```

The type **Regular** is written with the dollar operator: ```$```

The type **Array** is written with the arobase operator: ```@```

As described above, if none of these operators appears in the query, the query will look for any type of elements.

##### element

The element part of the query specify the **key** of an element to look for in the document. The key can be the name of a table or the name of an option.

This part of the query is the only mandatory part that should be given.

The rules to specify the name of key in the document are more or less identical at the one described in the toml specification:

* Bare key(s) allow only alphanumeric, dash and underscore characters. Notes that the first character should be a letter.
* Integer key allow only digit characters.
* Quoted key(s) follow the same rules as basic strings (surrounded by quotation mark ```"```) or literal strings (surrounded by single quote ```'```). Into a quoted key, all the special characters are escaped and loses their special meaning

query introduce also the possibility to find an element using a simple pattern similar to the one used to glob files in Linux shell. Into a pattern, all the special characters are escaped and loses their special meaning

To specify a pattern in the query (instead of a "regular" key), the pattern should be surrounded by slash ```/```.

The syntax of a pattern is made of the following elements:

* ```*```: match zeros or any sequence of characters in the input
* ```?```: match any single character in the input
* ```[]```: list and/or range of character to match a character in the input
* ```!, ^```: negate the match of the list/range characters
* ```\```: used to escape the special meaning of the ```*```, ```?```, ```[```, ```\``` characters

Moroever, query does not limit to select one element per query. Indeed, it is also possible to specify a list of elements that the query should match.

Some examples:

```
# a bare key
key

# a integer key
1234

# a quoted key
"key"
'key'

# a pattern
<EMAIL_ADDRESS>
# a list of elements (mix between bare key, integer and pattern)
(key, "key", 1234, /???*/)
```

##### :selector

Selectors are inspired by CSS selector and are a way to select some specific elements of an array or to select values that are of a specific type.

The syntax of selector is identical to the one of CSS. A selector is introduced with the colon operator ```:```, then follows by the name of the selector and, optionally, a list of arguments surrounded by parenthesis ```()``` and separated by comma ```,```.

Existing selectors are:

* **:first**: select the first element of an array
* **:last**: select the last element of an array
* **:at(index)**: select the element at given index of an array
* **:range([start], [end])**: select all element of an array between [start] and [end]. If start is not specified, the selector select all elements from the beginning of an array up to [end]. If end is not specified, the selector select all elements from [start] to the end of the array
* **:int**: select a value only if its type is integer
* **:float**: select a value only if its type is float
* **:number**: select a value only if its type is integer or float
* **:bool**: select a value only if its type is boolean
* **:string**: select a value only if its type is string
* **:truthy**: select a value only if its value can be considered as truthy. For integer and float, a value is different of 0. For booleans, a value equal to true. For strings, any string with length greater than 0. For array, any array with length greater than 0. For table, any table with at least one key.
* **:falsy**: the opposite of the truthy selector.

##### [predicate]

To only keep elements of interest, query allows to specify expression that values should match in order to keep the element being checked.

There are two of predicate available with query:

* comparing value of an option with a given value
* checking presence of an option in a table

To check for the presence of an option, only the name of the option should be given in the predicate, eg:

```
.element[key]
```

The rules to specify the name of a key is identical to the one of the toml specification and summarize in the element section.

To compare the value of an option with a specific value, the following operators are available:

* **equal**: ```key == value```
* **not equal**: ```key != value```
* **lesser than**: ```key < value```
* **less or equal**: ```key <= value```
* **greater than**: ```key > value```
* **greater or equal**: ```key >= value```
* **starts with**: ```key ^= value```
* **ends with**: ```key $= value```
* **contains**: ```key *= value```
* **match**: ```key ~= pattern```

The value of the key under test and the value to compare with should be a simple type:

* integer
* float
* boolean
* string
* datetime/date/time

In some circumstances, it can be helpful to compare the value of key with multiple values. query allow it by surrounding the list of values to compare with in parenthesis ```()```.

The match operator can only be used with a pattern. The same rule of "pattern in element" apply to write a pattern in a predicate.

Both types of predicate can be combined with each other with relational operators. Two are available:

* and: ```&&```
* or: ```||```

Predicate can also be grouped together to specify the order of evaluation of the expressions.

##### subquery and alternative query

The previous section describe what can be found in a single query. However a query can have a subquery in order to select an element deeper in a document and/or select another part of the same document.

A subquery allow you to select an element found below the matched element of the main query. A subquery can contain exactly the same elements as a regular query can.

eg:
```
.parent.child
```

An alternative query is a query that will select another element in the same document that is already under test. Alternative query are written one after each other and separated by a comma. Alternative queries can contains exactly the same elements as a query alone - even subquery.

eg:
```
.element1,.element2,.element3.subelement4
```

##### Examples

with this sample document:

```toml
package    = "query"
repository = "https://github.com/midbel/query"
language   = "go"

[maintainer]
name = "midbel"
email =<EMAIL_ADDRESS>
[[changelog]]
date = 2020-10-13 21:35:10+02:00
desc = "edit README with query examples"

[[changelog]]
date = 2020-10-12 09:00:00+02:00
desc = "write tests"

[[changelog]]
date = 2020-10-05 09:00:00+02:00
desc = "write scanner and parser of query language"

[[changelog]]
date = 2020-10-03 16:30:00+02:00
desc = "first draft of query language"

[[changelog]]
date = 2020-09-01 09:00:00+02:00
desc = "bash script using grep and sed to retrieve value from toml document"

[[dependency]]
package = "toml"
repository = "https://github.com/midbel/toml"
version    = "0.1.0"
optional   = false
```

1. getting the repository of the project. We specify that the repository value should be an option with a simple value (not an array nor a table):
```
.%repository
```

2. getting all the changelog that happens after septembre 2020:
```
.changelog[date >= 2020-10-01]
```

3. getting the date of all the changelog that happens after septembre 2020:
```
.changelog[date >= 2020-10-01].date
```

4. getting the first dependency of the project. We specify that the dependency table should be an array:
```
..@dependency:first
```

5. getting the first dependency of the project with the "at" selector and that table has the "version" option present and the optional option is equal to false:
```
..@dependency:at(0)[version && optional == false]
```

6. getting the repository and all the dependencies:
```
.(repository, dependency)
```

7. last example can also be expressed in the following way. The previous version does not allow to set specific type of the targeted elements and/or selectors and/or predicates:
```
.repository,.@dependency:range(,5)[optional == true]
```

### Possible improvements - things to do:

* support for functions
* comparing value of an option with value of another option somewhere in the same document
* specify the root element (table, array) from where the query will be executed
* greedy query
* specifiy variable in the query with values defined outside of the document and/or the query itself

repository: midbel/tomlq

repo_name: midbel/tomlq


text:
Overview
========

Offers makes the implementation and management of offers in our games an predictable and scalable task.

Used to sell special packs of the game's items. Offers helps doing A/B testing, remote configurations of offers, scheduling and monitoring.

## Features

* **Create Offers** - Create a template with information about a game's offer: what it gives to the player, when it is enabled, how many times a player can see and buy it;
* **Get Available Offers** - Given a player and a game, returns the available offers for each placement in the UI;
* **New Relic Support** - Natively support new relic with segments in each API route for easy detection of bottlenecks;

## Architecture

Offers is composed of an API responsible for creation of games and templates, and retrieval of offers for each player.

## The Stack

Our code is in Golang, with:

* Database - Postgres >= 9.5;

## Who's Using it

Well, right now, only us at TFG Co, are using it, but it would be great to get a community around the project. Hope to hear from you guys soon!

## How To Contribute?

Just the usual: Fork, Hack, Pull Request. Rinse and Repeat. Also don't forget to include tests and docs (we are very fond of both).

license: MIT

repository: GoArale/offers

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: GoArale/offers


text:
ORM persistence support
=======================

Master: [![Build Status](https://travis-ci.com/rindow/rindow-persistence-orm.png?branch=master)](https://travis-ci.com/rindow/rindow-persistence-orm)

This module defines a Java Persistence API (JPA) -like ORM interface and aims to be a vendor-independent ORM. The goal is to register interfaces defined here in interop-phpobjects in the future.

The ORM implementation is not included.

The following functions are defined.

- Entitiy-Manager running on transaction manager.
- Query criteria builder.
- ORM under the DAO Repository

Currently annotations are not implemented.

repository: rindow/rindow-persistence-orm

repo_name: rindow/rindow-persistence-orm


text:
# Custom Settings (`OrchardCore.CustomSettings`)

Custom Settings allow a site administrator to create a customized set of properties that are global to the web sites.
These settings are edited in the standard Settings section and can be protected with specific permissions.

## Creating Custom Settings

Custom Settings are organized in sections. Each section is represented by a Content Type with the `CustomSettings` stereotype.
When creating such a section, remember to disable `Creatable`, `Listable`, `Draftable` and `Securable` metadata as they don't apply.

!!! warning
    Don't mark any existing Content Type with this `CustomSettings` stereotype, as this will break existing content items of this type.

Custom Settings are then comprised of parts and fields like any other content type.
Once created, open the Setting menu item and each of these sections should appear alongside the module-provided ones.

### Permissions

Each Custom Settings section gets a dedicated permission to allow specific users to edit it.

To edit this permission open the Roles editor and go to the `OrchardCore.CustomSettings` Feature group.

## Usage

### Liquid

The Custom Settings (like other settings) are available in the `{{ Site.Properties }}` object.
Each section is made available using its name.

For instance the `HtmlBodyPart` of a custom settings section named `BlogSettings` would be accessible using `{{ Site.Properties.BlogSettings.HtmlBodyPart }}`.

### Code

Custom Settings are a ContentItem, and by accessing it as a `ContentItem` you can access its parts and metadata.

!!! note
    You will need to register your `ContentPart` with Dependency Injection as demonstrated in the [ContentTypes documentation](../ContentTypes/README.md).

Here is an example of getting the `HtmlBodyPart` of a custom settings section named `BlogSettings`:

!!! warning
    These types may be modified in the CMS. It's important to make sure these types will not be modified outside of the development cycle when consuming them in code.

```csharp
public class MyController : Controller
{
    private readonly ISiteService _siteService;
    public MyController(ISiteService siteService)
    {
        _siteService = siteService;
    }
    public async Task<IActionResult> Index()
    {
        var siteSettings = await _siteService.GetSiteSettingsAsync();
        var blogSettings = siteSettings.As<ContentItem>("BlogSettings");
        var blogHtml = blogSettings.As<HtmlBodyPart>();

        return View();
    }
}
```

## Video

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/RuDsBx4wdT0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

repository: OrchardCMS/OrchardCore

branch_name: refs/heads/main

gha_language: C#

repo_name: OrchardCMS/OrchardCore


text:
# Java Design Pattern: Command

###### Command design pattern takes an operation and its arguments and wraps them up in an object to be executed, logged, etc. In the example below, Command is an operation, its argument is a Computer, and they are wrapped in Switch.

###### In another perspective, Command pattern has 4 parts: command, receiver, invoker and client. In this example, Switch is the invoker, and Computer is the receiver. A concrete Command has a receiver object and invoke the receiver's method. Invoker can use different concrete command. The client determines which command to use for the receiver.

> "Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations."

[![Command-pattern](../../../../resources/img/command.png)]

### Output
```sh
computer is shut down
```

source:
- [simple-java](https://www.programcreek.com/2013/02/java-design-pattern-factory/)
- [w3sdesign](http://www.w3sdesign.com/index0100.php)

repository: jorgecodelia/java-design-patterns

repo_name: jorgecodelia/java-design-patterns


text:
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Frame](./puppeteer.frame.md) > [addScriptTag](./puppeteer.frame.addscripttag.md)

## Frame.addScriptTag() method

Adds a `<script>` tag into the page with the desired url or content.

Signature:

```typescript
addScriptTag(options: FrameAddScriptTagOptions): Promise<ElementHandle>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  options | [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | configure the script to add to the page. |

Returns:

Promise<[ElementHandle](./puppeteer.elementhandle.md)>

a promise that resolves to the added tag when the script's `onload` event fires or when the script content was injected into the frame.

repository: yujiosaka/puppeteer

gha_language: TypeScript

repo_name: yujiosaka/puppeteer


text:
---
title: "Distribution Agreements and App Stores"
author<EMAIL_ADDRESS>tags: ["Indemnity","Distribution Agreement","Commercial Activities","Rajah"]
date: 2015-08-20 00:00:00
description: "Distributing an app in the Google or Apple app stores? It would be wise to carefully review distribution agreements that come along with these two stores."
---

### Distributing an app in the Google or Apple app stores?
It would be wise to carefully review the **distribution agreements** that come along with these two stores. Google and Apple both include their default end user licensing agreement (“**EULA**”) into the application before sending it out to the market. This includes a **limitation of liability** provision which protects the developer, but it does not appear to include an **indemnity provision** that operates in favour of the supplier.

However, it states that if you have your own EULA, you can replace their default one. Often, after signing their distribution agreements, you have granted the app store a perpetual, royalty-free licence to use your application... so be careful to read the agreement before you sign away your hard work!

[Read the article here.](https://www.techinasia.com/talk/developing-mobile-app-southeast-asia-legal-tips/)

### Takeaway:
- If you are planning to market an app through Apple or Google, read the licensing agreement to understand your options.

repository: clausehound/clausehound-blog

gha_license_id: MIT

repo_name: clausehound/clausehound-blog


text:
# Dynamic Rational Inattention Problems (DRIPs)

`DRIPs.jl` is a Julia software package that provides a fast and robust method for solving LQG Dynamic Rational Inattention models using the methods developed by [Afrouzi and Yang (2020)](http://www.afrouzi.com/dynamic_inattention.pdf).
## Installation
To add the package, execute the following in Julia REPL:

```@julia
using Pkg; Pkg.add("DRIPs");
```
To import and use the package, execute:

```julia
using DRIPs;
```

## Overview
```@contents
Pages = ["overview.md"]
Depth = 2
```
## Syntax
```@contents
Pages = ["syntax.md",]
Depth = 3
```
## Examples and Replications
```@contents
Pages = [
"examples/ex1_pricing_nofeedback/ex1_pricing_pe_nofeedback.md",
"examples/ex2_pricing_wfeedback/ex2_pricing_pe_with_feedback.md",
"examples/ex3_mw2009/ex3_Mackowiak_Wiederholt_2009.md",
"examples/ex4_sims2010/ex4_Sims_2010.md",
"examples/ex5_mmw2018/ex5_Mackowiak_Matejka_Wiederholt_2018.md",
"examples/ex6_ay2020/ex6_Afrouzi_Yang_2020.md"]
Depth = 1
```


text:
# next_pixijs
Testing next_pixijs and planckjs physics engine

# Pixi.js example

 This example shows how to use Next.js with [Pixi.js](https://www.pixijs.com/) and the [PlanckJS](https://piqnt.com/planck.js) physics engine.

 Oringal NextJS code from andersonleite@ from [PR#28087](https://github.com/vercel/next.js/pull/28087)

 ## Deploy your own

 Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

 [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-pixi-js&project-name=with-with-pixi-js&repository-name=with-pixi-js)

 ## How to use

 Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

 ```bash
 npx create-next-app --example with-pixi-js with-pixi-js-app
 # or
 yarn create next-app --example with-pixi-js with-pixi-js-app
 ```

 Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

## Useful Links

 - [Pixi.js documentation](https://pixijs.download/release/docs/index.html)
 - [react-pixi](https://github.com/inlet/react-pixi)
 - [planckjs](https://piqnt.com/planck.js)
 - [Pixi+Planck Example](https://github.com/kalanadis/helloPlankByPixi/blob/master/js/main.js)


text:
# Data Pre-processing

## Requirement

`StanfordCoreNLP` is required to obtain the dependency trees for all dataset. Please download version [3.9.2](https://stanfordnlp.github.io/CoreNLP/history.html) and put the folder `stanford-corenlp-full-2018-10-05` under the current directory.

## Obtain the data

Download the dataset from official website and do the pre-processing in the format of sample_data.

Follow the script `data_processes.sh` to obtain the dependency trees for dataset.


text:
Since: PMD 3.4

Uncommented Empty Method Body finds instances where a method body does not contain
statements, but there is no comment. By explicitly commenting empty method bodies
it is easier to distinguish between intentional (commented) and unintentional
empty methods.

Example(s):
```
public void doSomething() {
}
```

[Source](https://pmd.github.io/pmd-5.6.1/pmd-java/rules/java/design.html#UncommentedEmptyMethodBody)

repository: denisZhe/codacy-pmdjava

repo_name: denisZhe/codacy-pmdjava


text:
# instance-segmentation-security-0010

## Use Case and High-Level Description

This model is an instance segmentation network for 80 classes of objects.
It is a Mask R-CNN with ResNeXt101-32x8 backbone, PANet feature refiner with
GroupNorm and DeformableConv operations and Adaptive Feature Pooling
in all ROI-wise heads.

## Example

![](./instance-segmentation-security-0010.png)

## Specification

| Metric                          | Value                                     |
|---------------------------------|-------------------------------------------|
| MS COCO val2017 box AP (max short side 800, max long side 1333)   | 45.36%  |
| MS COCO val2017 mask AP (max short side 800, max long side 1333)  | 40.00%  |
| MS COCO val2017 box AP (max height 800, max width 1333)           | 45.11%  |
| MS COCO val2017 mask AP (max height 800, max width 1333)          | 39.84%  |
| Max objects to detect           | 100                                       |
| GFlops                          | 899.568                                   |
| MParams                         | 174.568                                   |
| Source framework                | PyTorch\*                                 |

Average Precision (AP) is defined and measured according to standard
[MS COCO evaluation procedure](https://cocodataset.org/#detection-eval).

## Inputs

1.	name: `im_data` , shape: [1x3x800x1344] - An input image in the format
    [1xCxHxW]. The expected channel order is BGR.
1.	name: `im_info`, shape: [1x3] - Image information: processed image height,
    processed image width and processed image scale
    w.r.t. the original image resolution.

## Outputs

1.	name: `classes`, shape: [100, ] - Contiguous integer class ID for every
    detected object, '0' for background, i.e. no object.
1.	name: `scores`: shape: [100, ] - Detection confidence scores in range [0, 1]
    for every object.
1.	name: `boxes`, shape: [100, 4] - Bounding boxes around every detected objects
    in (top_left_x, top_left_y, bottom_right_x, bottom_right_y) format.
1.	name: `raw_masks`, shape: [100, 81, 28, 28] - Segmentation heatmaps for all
    classes for every output bounding box.

## Legal Information
[*] Other names and brands may be claimed as the property of others.

gha_language: Python


text:
# fbi-task-serve
Static server with directory listings.

> This is a fbi task. If you haven't installed [fbi](https://github.com/AlloyTeam/fbi) yet, use the following command to install.
>
> `$ npm i -g fbi` or `yarn global add fbi`

## Requirements
- `fbi v3.0+`
- `node v7.6+`

## Features

- serve static files
- directory listings

## Usage

**Install**

```bash
$ fbi add https://github.com/fbi-templates/fbi-task-serve.git
```

**Run**

```bash
$ cd path/to/any/directory
$ fbi serve
```

**Run with params**

```bash
$ fbi serve -p=9999
$ fbi serve -port=9999
```

## More
- [Official templates](https://github.com/fbi-templates)
- [`fbi` documentation](https://neikvon.gitbooks.io/fbi/content/)

## License
[MIT](https://opensource.org/licenses/MIT)

## [Changelog](./CHANGELOG.md)

repository: fbi-templates/fbi-task-serve

repo_name: fbi-templates/fbi-task-serve


text:
manilla-downloader
==================

Download all Manilla documents to your local machine.

## Usage

```
$ ruby manilla.rb
```
The script will prompt you for the following:
- The directory where you want to save your downloaded documents.
- The email address you use to login to Manilla.
- The password you use to log into Manilla.
- The answer to your first security question.

If all of your authentication information is correct, the script will print the names of the files as it downloads them.

repository: tylercal/manilla-downloader

repo_name: tylercal/manilla-downloader


text:
# Upload Example

View this page on the UpscalerJS website

Demonstrates how to incorporate an upload mechanism with UpscalerJS.

Open in Codesandbox.

repository: thekevinscott/UpscalerJS

repo_name: thekevinscott/UpscalerJS


text:
![.NET Core](https://github.com/marcingolenia/spotify-cli-linux/workflows/.NET%20Core/badge.svg?branch=master) ![F#](https://img.shields.io/badge/Made%20with-F%23-blue)

F# spotify-cli-linux
A command line interface to Spotify on Linux.
This project is inspired by the similar project called [spotify-cli-linux](https://github.com/pwittchen/spotify-cli-linux), which does similar things but it is written in Python.

# Building
You will need dotnet core 3.1 SDK to build and run the project. You can download it from here: https://dotnet.microsoft.com/download/dotnet-core/3.1. Then just use standard dotnet commands to build, test and run.

# Publishing the app
dotnet publish -c Release -r linux-x64

# Usage
```
USAGE: dotnet [--help] [--play] [--pause] [--prev] [--next] [--status] [--lyrics]

OPTIONS:

    --play                Spotify play
    --pause               Spotify pause
    --prev                Previous song
    --next                Next song
    --status              Shows song name and artist
    --lyrics              Prints the song lyrics
    --help                display this list of options.
```

Examples:
* `dotnet Spotify.Console.dll --help`
* `dotnet Spotify.Console.dll --lyrics`

# Hint: Add command alias
You can easily set command alias in Unix, for example:

`alias spot='dotnet ~/projects/spotify-linux-published/Spotify.Console.dll'`

From now on you can just type `spot --help`.
Note that this is temporal alias (will be lost on reboot). To create permament alias follow simple 5-steps tutorial:
https://www.cyberciti.biz/faq/create-permanent-bash-alias-linux-unix/

repository: marcingolenia/spotify-cli-linux

repo_name: marcingolenia/spotify-cli-linux


text:
# Branches, versions and releases — complete guideline

## Branches

The project has two main branches: `master` and `next`.

Branch `master` contains the latest stable version of the editor.
The latest version published to NPM available by default or by the tag `latest`.

Branch `next` used for development the next (release candidate) version of the editor.
It may contain bug fixes, improvements or features. This version is available in NPM by `next` tag.

## Versions

We use [semantic versioning](https://semver.org) as a main guide for naming updates.

`<major>.<minor>.<patch>`

You need to bump the part of version according the changes:

- `patch` — for bug fixes, docs updates, code style fixes and other changes which do not affect the result project bundle
- `minor` — for new features with no backward compatibility problems.
- `major` — for breaking changes without backward compatibility with the api of the previous version of the project.

Pre-release versions may contain additional `-rc.*` suffix.

## Release publishing

Drafts for new releases are created automatically via [create-a-release-draft.yml](.github/workflows/create-a-release-draft.yml)
workflow when pull request to `next` branch was merged with an updated version in the package.json file.

There is a [workflow](.github/workflows/publish-package-to-npm.yml) that fired on a new release publishing on GitHub.

Use target version changelog as a description.

![](https://capella.pics/57267bab-f2f0-411b-a9d1-69abee6abab5.jpg)

Then you can publish the release and wait for package publishing via action.

This package version will be published to NPM with default `latest` tag.

### Release candidate publishing

If you want to publish release candidate version, use suffix `-rc.*` for package
version in package.json file and in tag on releases page. Workflow will detect it and mark a release as "pre-release".

![](https://capella.pics/796de9eb-bbe0-485c-bc8f-9a4cb76641b7.jpg)

This package version will be published to NPM with `next` tag.

Stable version: `2.19.0`
Release candidate: `2.19.1-rc.0`, `2.19.1-rc.1`, ...
Next version: `2.19.1`

## Example pipeline

Let's imagine that package version is `2.19.0` and you want to add some bug fixes and publish an update as `2.19.1`.

1. Merge a single update or a few pulls with fixes to the default branch `next`
and bump the version up to `2.19.1-rc.0` in the package.json.
For the rest rc updates you should bump version number in suffix (to `2.19.1-rc.1` etc).
2. Workflow [create-a-release-draft.yml](.github/workflows/create-a-release-draft.yml)
will automatically create a draft release on GitHub.
3. Check this new draft release on the releases page. Check tag `v2.19.1-rc.0` and notice "This is pre-release" checkbox
if it should be for a release candidate versions. Then publish that release.
4. [Workflow](.github/workflows/publish-package-to-npm.yml) will automatically push the package to NPM with tag `next`.
5. When you ready to publish a release, remove suffix from version name in package.json (`2.19.1-rc.0` -> `v2.19.1`)
and push changes. Follow steps 2-4 with workflows and publish a new version as `latest` update.
6. Merge branch `next` to `master` and save sources for history.

branch_name: refs/heads/next


text:
# 💡 Project Title: Mongoose_Fitness

## 🕹 Demo:

![Demo of application](public/assets/Mongoose_Fitness_DEMO.gif)

Video of demo: [Mongoose_Fitness_DEMO](https://drive.google.com/file/d/1dsGeX-0vbTGw9xXjmaHc0E1kBhA8HLr2/view)

![License](https://img.shields.io/badge/License-MIT-yellow)
## 👤 Author: Joseph Jepson

  ## 📜 Table of Contents:

  * [Description](#Description)

  * [Installation](#Installation)

  * [Usage](#Usage)

  * [Contributors](#Contributors)

  * [Testing](#Testing)

  * [Contact](#Contact)

  * [License](#License)

  ## Description:
 Fitness tracker that lets users create a workout and add exercises to it. Users can add exercises to a previous workout plan, and also view their progress/stats!

This application utilizes MongoDB, MongoDB Atlas, Mongoose, and Node.js.

![Image of DEMO application](public/assets/DEMO_image.png)

[View Deployment](https://shrouded-reaches-87956.herokuapp.com/?id=5fd560de238e940017352d6d)

## Installation:
Clone the repo, and run 'npm install', and 'npm run seed'.

## Usage:
Run 'npm run start' to start application.

  ## Contact:

  * 💌  Email<EMAIL_ADDRESS>
  * 👤  GitHub Username: [alligatormonday](https://github.com/alligatormonday)

  ## License:

    MIT License

Copyright (c) 2020 Joseph Jepson

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

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

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


text:
---
layout: post
title: Colour Matching - Part 2
date: '2014-03-10 15:48:00'
---

_This post is the second part in a two part series. You can find the first post [here](http://chris.banes.me/2014/02/18/colour-matching/)._

---

Carrying on from the previous post, we now have the palette of colours which make up our chosen image. The palette can be retrieved by calling `getQuantizedColors()` on our `MedianCutQuantizer`. We could just sort this array based on the count and job done, use the colours in descending order. Unfortunately it turns out that most images use a lot of two colours: white and black (or close shades), hardly the colours to make your app stand out. This means that we need to think a bit more about which colours to pick out.

For my app I set out wanting the following sub-palette:

 * A main accent colour, ideally colourful.
 * A secondary accent colour, which is different to the primary.
 * A tertiary accent colour, which has enough contrast from both the primary & secondary.
 * A main text colour which has enough contrast from the main accent colour to be readable.
 * A secondary text colour which is either black/white. Which depends on the brightness of the main accent colour so that it's readable.

This post is all about how to select these colours.

## Accent Colours

For my requirements above, I decided to sort them using an average (mean) of the following characteristics:

 * Colorfulness
 * Count (population)

### Colourfulness

This turned out to pretty easy actually. First I converted the colour's RGB value to HSV using the built-in Android method [Color.RGBToHSV()](https://developer.android.com/reference/android/graphics/Color.html#RGBToHSV(int, int, int, float[])). If you do not know about HSV then you can read up on it [here](http://en.wikipedia.org/wiki/HSL_and_HSV).

In simple terms, it's a cylindrical representation of the RGB colour space which represents colour via three axis: **H**ue, **S**aturation and **V**alue (brightness).

<caption>
  <img src="/content/images/2014/3/HSV_color_solid_cylinder_alpha_lowgamma.png" />
  <figcaption>
      The HSV colour space. Taken from [Wikipedia](http://en.wikipedia.org/wiki/File:HSV_color_solid_cylinder_alpha_lowgamma.png)
  </figcaption>
</caption>

To calculate colourfulness I used a simple product of the saturation and value. To my eyes the most colourful values are when both of these values are high.

```
public float[] getHsv() {
    float[] hsv = new float[3];
    Color.RGBToHSV(r, g, b, hsv);
    return hsv;
}

public float calculateColorfulness() {
    float[] hsv = getHsv();
    return hsv[1] * hsv[2];
}
```

This resulted in a colorfulness value in the range 0.0 - 1.0.

### Count

Remember that each colour has a count attached to it? We can use that to determine how populous that colour is in the palette, making sure that it is in the range 0.0 - 1.0.

Say we have the following very simple palette:

|  Color   |  Count  |
|----------|---------|
|  White   |   200   |
|  Purple  |   175   |
|  Black   |   150   |
|  Red     |   125   |
|  Orange  |   100   |
|  Blue    |    50   |
|----------|---------|
|  Total   |   800   |

We could calculate the colour's percentage as it’s ratio within the whole picture. In the example above there are 800 pixels so using purple as an example, the colour's percentage would `175 / 800 = ~0.22`. Unfortunately this generated values which are too small, a colour would only be reach 1.0 if it was the only colour in the picture.

Instead we can calculate the ratio based on the most populous colour within the palette. Using the example palette above, white is the most populous colour so purple’s percentage is `175 / 200 = 0.87`. Much more indicative of a colour's relative population.

### Final value

Using these values we can combine them into one final value. A simple mean works OK but it turns out that monochrome colours feature highly because they tend to be highly populous. To combat this we can weight the characteristic(s) we desire so that they feature with greater importance, in this case we boost colourfulness:

```
static float weightedAverage(float... values) {
    assert values.length % 2 == 0;

    float sum = 0;
    float sumWeight = 0;

    for (int i = 0; i < values.length; i += 2) {
        float value = values[i];
        float weight = values[i + 1];
        sum += (value * weight);
        sumWeight += weight;
    }
    return sum / sumWeight;
}

static float calculateColorWeight(ColorNode node, final float maxCount) {
    return weightedAverage(
            // Colorfulness has a weight of 2
            ColorUtils.calculateColorfulness(node), 2f,
            // Count has a weight of 1
            (node.getCount() / maxCount), 1f
    );
}
```

The final thing was to sort the colors using this calculated weight, in descending order. We now have our weighted palette.

## Primary Accent Colour

This is simple, use the first colour from our sorted weighted palette.

## Secondary Accent Colour

From my requirements above, this needs to be different from the primary accent chosen above, ideally with a sufficiently different hue. Again we will use the **HSV** value, finding the first colour which has a sufficiently different hue value.

```
// Hue is calculate in degrees (0-360)
private static final int SECONDARY_MIN_DIFF_HUE_PRIMARY = 120;

...

final float primaryHue = primary.getHsv()[0];

// Find the first color which has sufficient different hue from the primary
for (ColorNode candidate : mWeightedPalette) {
    final float candidateHue = candidate.getHsv()[0];

    // Calculate the difference in hue, if it's over the threshold return it
    if (Math.abs(primaryHue - candidateHue) >= SECONDARY_MIN_DIFF_HUE_PRIMARY) {
        return candidate;
    }
}

// If we get here, just return the second weighted color
return mWeightedPalette[1];
```

## Tertiary Accent Colour

This is very similar to the secondary accent colour above, but instead of checking the hue we check the difference in contrast in both of it's preceding colours (primary & secondary).

```
// Contrast values are in the range 0-255.
private static final int TERTIARY_MIN_CONTRAST_PRIMARY = 20;
private static final int TERTIARY_MIN_CONTRAST_SECONDARY = 90;

...

// Find the first color which has sufficient contrast from both the primary & secondary
for (ColorNode color : mWeightedPalette) {
    if (ColorUtils.calculateContrast(color, primary)
                >= TERTIARY_MIN_CONTRAST_PRIMARY
            && ColorUtils.calculateContrast(color, secondary)
                >= TERTIARY_MIN_CONTRAST_SECONDARY) {
        return color.getRgb();
    }
}

// We couldn't find a colour. In that case use the primary colour, modifying it's
// brightness by 45%
return ColorUtils.changeBrightness(secondary.getRgb(), 0.45f);
```

But wait, where has this `calculateContrast()` method come from? This one actually took me a while to work out how to get right and mainly comes from this great article on [color contrast](http://optional.is/required/2011/01/12/maximum-color-contrast).

In the end I converted each RGB colour into the YIQ colour space, only caring about the **Y** (luma) value. You can then compare two colour's luma to get the difference in brightness and apply a threshold.

```
/**
 * @return difference in luma. Possible values are 0 (no difference) to
 *         255 (max difference).
 */
private static final int calculateContrast(int rgbColor1, int rgbColor2) {
    return Math.abs(calculateYiqLuma(rgbColor1) - calculateYiqLuma(rgbColor2));
}

/**
 * @return luma value. Values are in the range 0-255.
 */
public static final int calculateYiqLuma(int color) {
    return (299 * Color.red(color) + 587 * Color.green(color) + 114 * Color.blue(color)) / 1000;
}
```

## Finally, the code

Remember in the last post when I said that I would include some code? Well here you go:
https://gist.github.com/chrisbanes/ba8e7b9ec0e40f6949c6

It probably won't run as it is, you'll need to make modifications to include it in your app. This is in on purpose to make you think about how to integrate the functionality.

Have fun!

extension: markdown


text:
# helgoland-toolbox

> tools for a sensor observation service based client

[![npm version](https://badge.fury.io/js/%40helgoland%2Fcore.svg)](https://badge.fury.io/js/%40helgoland%2Fcore)
<!-- [![dependencies Status](https://david-dm.org/52north/helgoland-toolbox/status.svg)](https://david-dm.org/52north/helgoland-toolbox)
[![devDependencies Status](https://david-dm.org/52north/helgoland-toolbox/dev-status.svg)](https://david-dm.org/52north/helgoland-toolbox?type=dev) -->

This project contains [Angular](https://angular.io/) based Modules, Components, Injectables to build a sensor observation service based client.

## Getting Started

### Dependencies

#### Node/NPM

Install latest Node and NPM following the [instructions](https://nodejs.org/en/download/). Make sure you have Node version ≥ 7.0 and NPM ≥ 4.

- `brew install node` for Mac.

### Installing

- `fork` this repository.
- `clone` your fork to your local environment.
- `npm install` to install required dependencies.

### Build the libraries

- `npm run build:libs` for building the library once

### Other commands

#### Lint the complete code

- `ng lint` for performing static code analysis.

#### Generate documentation

- `npm run compodoc` for generating documentation locally
- `npm run gh-pages` for generating documentation and uploading it to GitHub Pages

##### Bump library version

- `npm version ***` to increase library version. [More on bumping](https://docs.npmjs.com/cli/version).

<!-- `preversion` script in this case will automatically run project testing and linting in prior in order to check that the library is ready for publishing. -->

##### Publish library to NPM

- `yarn lib:publish` to publish your library sources on [npmjs.com](https://www.npmjs.com/). Once the library is published it will be available for usage in npm packages.

<!-- `prepublishOnly` script in this case will automatically run project testing and linting in prior in order to check that the library is ready for publishing. -->

### Using demo applications

 - just start the demo with `ng serve` and the demo is published

<!-- #### Using `yarn link`

In you library root folder:

```bash
# Create symbolic link
yarn link

# Build library in watch mode
yarn build:watch
```

In you project folder that should consume the library:

```bash
# Link you library to the project
yarn link "angular-library-seed"

# Build your project. In case of Angular-CLI use the following command.
ng serve --aot
```

Then you need to import your library into your project's source code.

Now, once you update your library source code it will automatically be re-compiled and your project will be re-built so you may see library changes instantly.

[More information](https://yarnpkg.com/en/docs/cli/link) about `yarn link` command.

> At the moment of publishing this project there is a [bug](https://github.com/angular/angular-cli/issues/3854) exists when using `yarn link` in combination with Angular CLI. The issue is caused by having `node_modules` folder inside linked library. There is a [workaround](https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771) has been provided that suggests to add a `paths` property with all Angular dependencies to the `tsconfig.json` file of the Angular CLI project like it is shown below:

```
{
  "compilerOptions": {
    "paths": { "@angular/*": ["../node_modules/@angular/*"] }
  }
}
``` -->

## Supported series API versions mapping

| helgoland-toolbox version | [series rest API](https://github.com/52North/series-rest-api) version |
|:-------------------------:|:---------------------------------------------------------------------:|
| v0.0.1-alpha.53           | v1.10.2                                                               |

## Troubleshooting while using this library

- add `allowSyntheticDefaultImports: true` to your tsconfig.json to avoid error messages like `... has no default export`
- don't forget to add styles of nested dependencies

repository: TeKraft/helgoland-toolbox

repo_name: TeKraft/helgoland-toolbox


text:
## Last Week's Accomplishments

> In this section, you can write about what you accomplished in the previous week.

I've finished communicating with back end and pushing my front end to master after it started working with the backend on the repo.

## This Week's Plan

> In this section, you can write about what you have planned for next week.

ALl errors are fixed so now I just have to make the website look like the mock up/wireframe

## Anything Blocking?

> In this section, you can write about any blockers that you are having trouble in the project.

No blockers, I'm just not the biggest fan of front-end

## Notes

> This is an optional section for any sort of information that does not fall under any of the other categories.

Let's have class outside


text:
(NJ转载)Background Location Update Programming for iOS 7 and iOS 8
==============

Most of the solutions before iOS 7 work well because during that time the system does not
have multitasking and the system does not automatically move the app from background mode
to suspended mode.

So, if your app needs consistent location update from the device, you will have to
implement a solution that constantly refresh the app when it is in background mode so that
it has a short period of time in executing the code and send the location to your server.

I have personally used a few weeks of time in testing various solutions that I found from
StackOverFlow and also Apple Developer Forum but I didn't have much luck.

I only managed to get the consistent location update on the background in iOS 7 by
combining a few solutions together with my own tweaks.

The solution that I am provided might not be elegant but it is able to do what I need to
do. I am constantly looking for a better solution when I have time.

I am glad that this solution helps some other iOS developers who are developing location
based application. So far, this is the most popular post on my blog. If you have any question, you may join us for a discussion here: [Background Location Update Programming for iOS 7 and 8](http://mobileoop.com/background-location-update-programming-for-ios-7 "Background Location Update Programming for iOS 7 and 8").

Update on 26 September 2014: I have updated the solution to work on iOS 8.

Update on 14 October 2014: I have Moved the delay10Seconds timer to become a share property.

Personal Note
==============
I have used a lot of my personal time in experimenting/learning the Core Location APIs and share the solution for FREE. If my article and solution on Github helps you, please consider to donate. Donation will motivate myself to work harder in sharing more and helping more people. You may find the donation box on my website: http://mobileoop.com/

Thanks.
Ricky

repository: zhuzhiyongai/SystemLocation

repo_name: zhuzhiyongai/SystemLocation


text:
---
layout: archive
title: "AOT Inbound"
permalink: /aot-inbound/
sidebar:
  nav: "ops"
---

Established in 1987, AOT Inbound is the largest inbound tour operator in Australia / New Zealand.

With the Head Office located in Melbourne, AOT Inbound also has offices in Sydney and Auckland.

Operating a seven day a week reservations centre and one of the most sophisticated travel trade booking engines in the world - www.aotonline.net - at AOT Inbound we provide our global trade partners access to the largest range of Australian, New Zealand and South Pacific travel products - from accommodation and tours to car hire, events, attractions and activities - and we have the ability to both package and tailor make holidays to suit all travellers' needs.

Recognising that people come to Australia and New Zealand for different experiences, we cater for a wide range of international visitors' needs, whether they are independent travellers, travelling in a group, arriving by ship or visiting for a conference or incentive.

Our knowledge of Australian and New Zealand tourism product is first-rate and we offer products and services to more than 500 destinations throughout the region.

Renowned among our worldwide partners for our attentive customer service, efficiency and an extensive product range at the most competitive prices, AOT Inbound is operated by a team of more than 100 dedicated travel professionals.

Led by Managing Director, Cinzia Burnes, who is both a co-owner and a director of the company, AOT Inbound provides world-class services through the following divisions:

* The FIT reservations team in both Australia and New Zealand provide a seven day a week booking service with same day turnaround and a 24 hour customer service “on the ground” assistance available in several foreign languages.
* The Groups Department handles all groups enquiries whether for a group series, ad-hoc, incentive or shipping shore excursions. This dynamic team is responsible for all the logistics of total management of our groups, from quoting to delivering the full service delivery.
* The Product and Content department in Australia and New Zealand is a team dedicated to product development. It is solely responsible for the production and update of the on-line Confidential Tariff. This tool, the most advanced of its kind, is essential to provide our worldwide partners with the most up-to-date rates and product information. The department is also responsible for the data loading of over 4000 product suppliers in our system, as well as the management of the inventory, including regular top-up requests to our supplier partners to avoid sell-out situations. Packages, such as city modules and our Fly-Drive range of itineraries as well as Bonus Offers, are also handled by this area. The Product and Content team produces a weekly newsletter which provides our worldwide partners with a summary of important news on Australia and New Zealand products.
* The Contracting team in Australia and New Zealand is responsible for the negotiation of the most competitive rates and the largest possible allocation at over 2,000 properties across Australia, New Zealand and the South Pacific. This area also sources ad-hoc special offers for campaigns or promotions over the year, on behalf of our worldwide partners.
* The Sales and Marketing team co-ordinates AOT Inbound's attendance to the major trade shows both in Australia and overseas including World Travel Market, ITB, ATE, Trenz and Bula while at the same time acting as the main link between our worldwide partners and the various AOT divisions.

At AOT Inbound we have also developed our own XML links, allowing our global partners access to real time information and pricing of our products through their own system in a seamless way. This facility allows partners to enquire on availability, make bookings and receive instant confirmations.

Our reputation for excellence in customer service has been recognised with the following awards:

* 2006/2007/2008/2009/2010/2011/2012 - AOT named number one supplier by Voyages Hotels and Resorts
* 2004 - Winner Governor of Victoria Export Awards
* 2003 - Winner Australian Export Awards
* 2003 - Winner Governor of Victoria Export Awards
* 2000 - Business Review Weekly The Top 500 Private Companies
* 2000 - Business Review Weekly The Top 100 Fastest Growing Private Companies
* 1999 - Winner Governor of Victoria Export Awards
* 1999 - Winner Australian Export Awards
* 1999 - Business Review Weekly, awarded 413th in The Top 500 Private Companies
* 1998 - Business Review Weekly, awarded 19th fastest growing private company during the review period (1993-1997), achieving a 637% increase in turnover growth since 1993.
* 1997 - Business Review Weekly, awarded 13th fastest growing private company during the review period (1992-1996) achieving a 775% increase in turnover growth since 1992.
* 1994 - Winner Queensland Tourism Awards Inbound Tourism (The final year this category was offered)
* 1993 - Winner Queensland Tourism Awards Inbound Tourism

Our product range

AOT Inbound offers more than 4,000 products in Australia, New Zealand and the South Pacific located in more than 500 destinations.

We offer a full product selection including:

* Accommodation - from 3 star to 5 star, B&Bs, boutique hotels, farm stays, lodges, and spa resorts. Our accommodation offers include extensive bonus offers including meal inclusions, pay stays and upgrade deals.
* Transfers - limo & SIC. AOT operates it's own transfer services in Sydney, the Gold Coast and Cairns
* Meet & greet services
* Cars, 4WD's and campervans
* Day & extended tours
* Day & extended cruises
* Event packages
* City packages
* Honeymoon specials
* Wedding packages
* The most comprehensive selection of exclusive Fly Drive packages throughout Australia and New Zealand with comprehensive "Co-Pilots" in a range of languages including English, French, German, Italian and Mandarin.


text:
# EditorConfig Collection

This is a collection of language specific [EditorConfig](http://editorconfig.org) settings. This collection is used for [EditorConfig.me](https://github.com/vbrandl/editorconfig.me).

If you are missing some languages or think the configuration should be changed just create a pull request or open a new issue.

repository: vbrandl/editorconfig-collection

repo_name: vbrandl/editorconfig-collection


text:
# Blockchain

A blockchain simulator written in Swift. It simulates full nodes in a virtual network. The nodes mine blocks for about every 10 seconds and verify randomly created transactions.

⚠ This project is not an actual blockchain implementation. I am very new to the blockchain and the purpose of this repository is to share what I've learned. Note that there might be a lot of wrong implementations.

## Getting Started

```console
$ git clone https://github.com/devxoul/Blockchain.git
$ cd Blockchain
$ swift run
```

Then you'll see:

```
Run server: Blockchain.Node on address <IP_ADDRESS>
Run server: Blockchain.Node on address <IP_ADDRESS>
Run server: Blockchain.Node on address <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Connect node <IP_ADDRESS>
<EMAIL_ADDRESS>Create transaction: <Transaction (89.0) 7695f853dccd7c29 -> ed99e0099751256d>
<EMAIL_ADDRESS>Create transaction: <Transaction (89.0) 7695f853dccd7c29 -> ed99e0099751256d>
<EMAIL_ADDRESS>Create transaction: <Transaction (89.0) 7695f853dccd7c29 -> ed99e0099751256d>
<EMAIL_ADDRESS>Create transaction: <Transaction (5.0) 7695f853dccd7c29 -> 715e3b2f5d0dea50>
<EMAIL_ADDRESS>Create transaction: <Transaction (5.0) 7695f853dccd7c29 -> 715e3b2f5d0dea50>
<EMAIL_ADDRESS>Create transaction: <Transaction (5.0) 7695f853dccd7c29 -> 715e3b2f5d0dea50>
<EMAIL_ADDRESS>Submit block: <Block height=1 bits=E600FFFF nonce=1159 transactions=2>
<EMAIL_ADDRESS>Submit block: <Block height=1 bits=E600FFFF nonce=1159 transactions=2>
<EMAIL_ADDRESS>Submit block: <Block height=1 bits=E600FFFF nonce=1159 transactions=2>
<EMAIL_ADDRESS>Submit block: <Block height=1 bits=E600FFFF nonce=1159 transactions=2>
<EMAIL_ADDRESS>Create transaction: <Transaction (2.0) 8a7b4aa02b4169d3 -> e341e6db66aff49d>
<EMAIL_ADDRESS>Create transaction: <Transaction (2.0) 8a7b4aa02b4169d3 -> e341e6db66aff49d>
<EMAIL_ADDRESS>Create transaction: <Transaction (2.0) 8a7b4aa02b4169d3 -> e341e6db66aff49d>
<EMAIL_ADDRESS>Submit block: <Block height=2 bits=E600FFFF nonce=162 transactions=1>
<EMAIL_ADDRESS>Submit block: <Block height=2 bits=E600FFFF nonce=162 transactions=1>
<EMAIL_ADDRESS>Submit block: <Block height=2 bits=E600FFFF nonce=162 transactions=1>
<EMAIL_ADDRESS>Submit block: <Block height=2 bits=E600FFFF nonce=162 transactions=1>
```

## Development

```console
$ swift package generate-xcodeproj
```

## License

Blockchain is under MIT license. See the [LICENSE](LICENSE) file for more info.


text:
# Working with Multiple Pieces of State in a Hook-based Components

There is a more elegant way to work with multiple pieces of `state`. And that is when we invoke the `useState` Hook multiple times. We are free to use any `React Hook` as many times as we like in the body of the `functional component`. Let's call our `useState` twice.

```jsx
import React, {useState} from 'react';

const App = () => {

const [city, setCity] = useState('')
const [country, setCountry] = useState('')

const handleCityChange = (event) =>{
  setCity(event.target.value)
  }

const handleCountryChange = (event) => {
  setCountry(event.target.value)
  }

  return (
    <div>
      <h1>Welcome to the app</h1>

      <form>
        <div>
          <input type="text"
          placeholder="City"
          value={city}  //here we can get just city
          name="city"
          onChange={handleCityChange}
          />
        </div>

        <div>
          <input type="text"
          placeholder="Country"
          value={country}  //here we can get just country
          name="country"
          onChange={handleCountryChange}
          />
        </div>
      </form>
      <div>
         You live in {`${city}, ${country}`}
      </div>
      <br/>
    </div>
  );
}

export default App;
```

repository: anmud/learntocode

repo_name: anmud/learntocode


text:
# isolation-runner
Proof-of-concept JS test runner.

## Features

- **Automatic test isolation** - If all state is initialized and mutated within the test runner, test will run as if their sibling tests are all commented out.
- **Type inferred context variables** - By declaring the variables in your test setup in the same place where you assign them, flow can determine the types of your context variables without any annotations.
- **Minimal syntax** - Never write `beforeEach` or `afterEach` again! Code before is simply run before *each* test. Code after is run after *each* test.

## Examples:

The following file passes *both* tests. Most test runners would fail on the second test.

```js
import { test } from 'isolation-runner';

test("Foo", function* () {

  let x = 0;

  yield test("inner 1", () => {
    expect(x).toBe(0);
    x == x + 1;
  });

  yield test("inner 2", () => {
    expect(x).toBe(0);
  });

});
```

repository: sleexyz/isolation-runner

repo_name: sleexyz/isolation-runner


text:
---
id: tweaking-stateful-email-notifications
title: "Email Notification Adjustments (Environments, Thresholds, Disable)"
sidebar_label: Email Notification Adjustments
keywords:
    - api-testing
    - how-to
    - stateful-email-notifications
---

import useBaseUrl from '@docusaurus/useBaseUrl';

## Preamble

With the introduction of stateful email notifications (version=2) the API Fortress mailer will notify you when a test starts failing, and notify you again when the test is back in full working order. The identifier of the incident that allows the system to track the events is the ID of the test itself.

However, in a multi-environment testing strategy, the ID of the test may not be sufficient anymore, as an incident may relate to different environments. Therefore, the test needs to inform the mailer which environment the execution relates too, so that the incident signature will carry the environment as well.

## The FACT Component

The Fact component can be added to any test, and is meant to add some extra information (facts) about the nature of the execution, and can contain static or dynamic data.

A FACT has an ID (which should be unique within the test), a label (to help the understanding of the fact), and a value (that is a string supporting the template language ${...}).

A specific FACT can be used to control the incident behavior previously discussed.

:::note
The FACT component should be set as high up in the test as possible, as if the test reaches its fail limit before the FACT then it will not be set.
:::

## Use a FACT to Set Alert Environments

Assume that in the variable scope of your test you have a variable called _env_ that contains your environment string (_production, staging, qa_ etc.).

By configuring a FACT in the following way, you can add the environment value to the incident signature:

```yaml
FACT id: environment
label: The current environment
value: ${env}
```

From this moment on, the signature of the incident will be `id_of_the_test` + `value_of_environment`.

For example, you will receive start/end incidents for `test123` in the production environment, and start/end incidents for `test123` in the staging environment, as separate flow of events.

You can use anything as value of the environment, such as domain names, IDs etc.

## Use a FACT to Disable Emails Alerts

A second use-case is disabling email notifications for the test from within the test:

```yaml
FACT id: disable_alerts
label: whatever you want here
value: true
```

You can use logic within the test to set the FACT component and use that to alter the email notification.

As an example, you could say "IF the env is development, then disable emails for this test":

## Use a FACT to Set Email Alert Thresholds

Another use-case of the fact component is set an email alert threshold. If you want a test to fail more than once before an email is sent, a FACT called `mail_threshold` can be set in the test:

This means the test will need to fail twice in a row before an email alert is sent.

Given that this can be configured within the test, it offers all the flexibility provided by conditional statements, such as an IF condition on the environment the test is running upon:

repository: leftxs/sauce-docs

repo_name: leftxs/sauce-docs


text:
# GraphQL
tutorials and toy project using GraphQl with python

## Tutorial
[Go to Tutorial right now](https://github.com/kangjunseo/GraphQL/tree/main/tutorial).

repository: kangjunseo/GraphQL

repo_name: kangjunseo/GraphQL


text:
# Vue-Github-Explorer

[![License](https://img.shields.io/github/license/mazipan/explore-github.svg?maxAge=3600)](https://github.com/mazipan/explore-github) [![Travis](https://img.shields.io/travis/mazipan/explore-github.svg)](https://travis-ci.org/mazipan/explore-github) [![codecov](https://codecov.io/gh/mazipan/explore-github/branch/master/graph/badge.svg)](https://codecov.io/gh/mazipan/explore-github)

[![Vue-Github-Explorer](https://raw.githubusercontent.com/mazipan/explore-github/master/screenshoot.png)](https://mazipan.github.io/explore-github/)

### Technology Used
+ API by Github v3 [https://developer.github.com/v3/](https://developer.github.com/v3/)
+ Vue.js
+ Vue-Router
+ Axios
+ Webpack

### Development
+ Checkout Code : `git checkout https://github.com/mazipan/explore-github.git`
+ Install dependency : `npm install` or `yarn install`
+ Run in local : `npm run dev`

## Contributing

If you'd like to contribute, head to the [contributing guidelines](/CONTRIBUTING.md). Inside you'll find directions for opening issues, coding standards, and notes on development.

## Support me

- Via [trakteer](https://trakteer.id/mazipan)
- Direct support, [send me an<EMAIL_ADDRESS>

repository: mazipan/explore-github

gha_language: Vue

repo_name: mazipan/explore-github


text:
# cricker_data_extracter
A set of python scripts to extract cricket data from https://cricbuzz.com.

## Getting Started
Here I will explain how to run the script to extract data.

### Prerequisites
You will need Python 3.X.X with some packages which you can install direclty using requirements.txt.
> pip install -r requirements.txt

### Extracting the data
1. Use app.py to run the app which requires following flags '--year' Year for data, '--dir' Directory where to save all data
>  python app.py --year 2019 --dir data

![sample](images/sample.png)

## Built Using
1. BeautifulSoup
2. Urllib3
3. Pandas

## Authors
* Aditya Jain : [Portfolio](https://adityajain.me)

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


text:
### User Story for BusMall

- As a consumer I want to see an explanation of what the task is asking of me.
- As a consumer I want to be able to see 3 separate, random selection of products to choose from.
- As a consumer I want to be alerted when I have finished the survey.
- As a developer I want to show the consumer a display of 3 random products from the provided list.
- As a developer I want to ensure that the products are displayed randomly and never duplicated.
- As a developer I want to track all consumer clicks, to be exported as data to be displayed later.  Tracking # of times shown and # of times clicked.
- As a developer I want to restrict the consumer to 25 clicks through the survey, which will stop counting at that point.
- As a developer I want to keep all code DRY and concise, with good workflow and readability throughout code.

repository: jdolbeer/BusMall

gha_language: JavaScript

repo_name: jdolbeer/BusMall


text:
Network Interface
=================

Network interface information plugin for Cordova/PhoneGap that supports Android, Blackberry 10, iOS, and Windows Phone 8.

## PhoneGap Build

To include the Network Interface plugin in your PhoneGap Build application, add this to your config.xml:

    <gap:plugin name="cordova-plugin-networkinterface" source="npm" />

## Command Line Install

    cordova plugin add cordova-plugin-networkinterface

## Usage (iOS, Android)

The plugin creates the object `networkinterface` with the method `getIPAddress(onSuccess, onError)`.

Example:

	networkinterface.getIPAddress(function (ips) { alert(ips); });

The result contains a JSON Array of IPs.

iOS:

```js
[
  {
    adapter: "en0", // wifi
    ip: "<IP_ADDRESS>"
  },
  {
    adapter: "pdp_ip0", // cellular
    ip: "<IP_ADDRESS>"
  },
  ...
]
```

Android:

```js
[
  {
    adapter: "wlan0", // wifi
    ip: "<IP_ADDRESS>"
  },
  {
    adapter: "rmnet0", // cellular
    ip: "<IP_ADDRESS>"
  },
  ...
]
```

## License

The MIT License (MIT)

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

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

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


text:
---
title: Managing Google Analytics
desc: (@quasar/app-vite) How to use analytics in a Quasar hybrid mobile app with Capacitor.
---
Getting to know your users and measuring user behavior is an important step in App Development. Unfortunately, it takes a bit of non-standard work to get Google Analytics to work after wrapping your mobile app with Capacitor. Setting up Google Analytics in a pure web application is quite easy, but Capacitor somehow prevents pageviews and events from being sent to Google Analytics.

Follow this guide to implement Google Analytics into your Capacitor powered Quasar App.

You may also want to read this great tutorial: [Google Tag Manager and Analytics Setup for an SPA Website](https://jannerantala.com/tutorials/quasar-framework-google-tag-manager-and-analytics-setup-for-an-spa-website/)

::: warning
You'll need to include a `<script>` tag provided by Google in `/index.html`, which will make your App depend on an Internet connection!
:::

## Prerequisites
* Make sure all your routes have a name and path parameter specified. Otherwise, they cannot be posted to the `ga.logPage` function. Please refer to [Routing](/quasar-cli-vite/routing) for more info on routing.
* Have Basic knowledge of Google Analytics

## Preparation
Before we can start implementing Google Analytics into your application, you'll need an account for [Google Analytics](https://analytics.google.com) and [Google Tagmanager](https://tagmanager.google.com/). So let's do that first. When you have these accounts, it's time to configure Tag manager. Follow the steps in this [Multiminds article](https://www.multiminds.eu/blog/2016/12/google-analytics-and-tag-manager-with-ionic-and-cordova-apps/) to do so.

## Implementing this into application
> For this guide, we'll assume you have a fixed sessionId that you send to Google Analytics. Google Analytics uses a sessionId to distinguish different users from each other. If you want to create an anonymous sessionId, see [Analytics Documentation on user id](https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id).

Place the Tag Manager snippet into head of your `index.html` file (if you've followed the [Multiminds article](http://www.multiminds.eu/2016/12/06/google-analytics-tag-manager-ionic-cordova/), you already have this.) Create a new file in your codebase called `analytics.js` with the following contents:

```javascript
export default {
  logEvent(category, action, label, sessionId = null) {
    window.dataLayer.push({
      appEventCategory: category,
      appEventAction: action,
      appEventLabel: label,
      sessionId: sessionId
    })
    window.dataLayer.push({ 'event': 'appEvent' })
  },

  logPage(path, name, sessionId = null) {
    window.dataLayer.push({
      screenPath: path,
      screenName: name,
      sessionId: sessionId
    })
    window.dataLayer.push({ 'event': 'appScreenView' })
  }
}
```

To make sure all the pages in your application are automatically posted to Google Analytics, we create an app boot file:

```bash
$ quasar new boot google-analytics [--format ts]
```

Then we edit the newly created file: `/src/boot/google-analytics.js`:

```js
import ga from 'analytics.js'

export default ({ router }) => {
  router.afterEach((to, from) => {
    ga.logPage(to.path, to.name, sessionId)
  })
}
```

Finally we register the app boot file in the `/quasar.config` file. We can do so only for Capacitor wrapped apps if we want:

```js
boot: [
  ctx.mode.capacitor ? 'google-analytics' : ''
]
```

More information about events can be found in the [Analytics documentation on events](https://developers.google.com/analytics/devguides/collection/analyticsjs/events).

You'll see the events and pageviews coming in when you run your app. It usually takes around 5 to 10 seconds for a pageview to be registered in the realtime view.

repository: quasarframework/quasar

branch_name: refs/heads/dev

repo_name: quasarframework/quasar


text:
[![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)

# Description

This component is responsible for creating the HTML necessary for a common Encore layout. It builds out the main navigation, plus breadcrumbs and page titles.

# Usage

For apps that want to use the default Encore navigation, usage is pretty simple. In your index.html file, add the `rx-app` directive inside your app:

        <rx-app>
            <ng-view></ng-view>
        </rx-app>

By including `ng-view`, your view content will be added inside the directive. This makes setting up views for each page much simpler, since you don't have to include `rx-app` in each view.

Inside your view, you'll likely want to use `rx-page` to wrap your content. See the `rx-page` docs for more information on this.

# rxApp Navigation

By default, the EncoreUI left-hand navigation is loaded at runtime from a separate resource. This source can be changed, and there are many options to control the navigation from an app level.

## Accessing route information

Sometimes it's helpful to have the current route information available for menu items. For example, re-using the current params for path building.

To help with this, $route is exposed on the scope of all menu items. [`$route` provides many details on the current view](http://devdocs.io/angular/ngroute.$route), including the ability to access the current controller and scope for the view.

To see this in action, check out the 'childVisibility' property for Account-level Tool in `encoreNav`.

## Accessing properties on $rootScope

If you have a property available on the `$rootScope` of your app that the menu data needs to access, [you can reference `$rootScope` via `$root`](http://stackoverflow.com/questions/22216441/what-is-the-difference-between-scope-root-and-rootscope-angular-js). See the demo for an example of this.

## Dynamically updating the menu

By default, rxApp will create the navigation menu based on the routes defined in the 'encoreNav' value. This menu is built using the rxAppRoutes service.

To update a route, use the `setRouteByKey` function on the rxAppRoutes service:

    rxAppRoutes.setRouteByKey('myKey', {
        linkText: 'myUpdatedRoute'
    })

You would normally either set this in your app's `.run` function, or in a specific controller.

## Custom Menus

If you'd like to create an entirely custom menu, you can pass that data in to the `rx-app` directive via the `menu` attribute. View the demo for an example of this.

# Sub-directives

## rx-page

You'll likely want to use `rx-page` inside your template view. For example, inside a 'myView.html' file:

    <rx-page title="'Example Page'">
        Here is my content
    </rx-page>

`rx-page` is used to create a common wrapper for specific page views. It automatically adds the breadcrumbs and page title/subtitle (if specified), along with the correct styling.

Both the `title` and `subtitle` attributes accept an Angular expression, which can be a string (shown in the previous example) or a scope property. This string/property can accept other expressions, enabling you to build custom titles. The demo has an example of this usage.

If you wish to use arbitrary HTML in your title, you can use the `unsafe-html-title` attribute instead of `title`. This is considered "unsafe" because it is
capable of executing arbitrary Javascript, so you must ensure that you trust the source of the title. The "Customized Page Title" in the demo shows the use of HTML tags.

In either case (`title` or `unsafe-html-title`), the document title (i.e. visible in the browser tab) will be set to your chosen title. If you use `unsafe-html-title`, all HTML tags will be stripped before setting the document title.

### Account Info below Breadcrumbs

`rxPage` integrates the [rxAccountInfo](#/components/rxAccountInfo) component, to draw the Account Info box directly underneath the `rxBreadcrumbs`. This is opt-in. By default, it will not appear. To enable it, pass the `account-number="..."` attribute to `<rx-page>` in your template, i.e

    <rx-page account-number="{{ accountNumber }}">

As noted on the [rxAccountInfo](#/components/rxAccountInfo) demo page, this directive requires that `SupportAccount`, `Encore` and `Teams` services are available to the Angular Dependency Injection system. These are *not* provided by EncoreUI, but are available in an internal Rackspace repository.

### Status tags

A final attribute that `rx-page` accepts is `status`. This takes a string, and has the effect of drawing a status "tag" beside the page title. The "Customized rxApp" demo shows the use of this with the `"alpha"` tag.

The framework currently provides `"alpha"` and `"beta"` tags, but any product can specify their own custom tags using the `rxStatusTagsProvider`. It currently
has one method, `addStatus`, which takes an unique `key` for the new tag, the `class` it should use in the HTML, and the `text` that will be drawn. All custom
tags are drawn inside of a `<span>`, essentially as:

    {{ text }}

To use this, do the following in your application's `.config()` method:

    rxStatusTagsProvider.addStatus({ key: 'gamma', class: 'alpha-status', text: 'Hello World!' });

This will create a new status tag called `"gamma"`, which you can pass to `rx-page` as:

    <rx-page title="'Some Title'" status="gamma">

And the title will appear with a `Hello World!` tag beside it, styled the same way as our `"alpha"` status tag is styled. You can also define your own CSS style in your application and use those instead, passing it as the `class` value to `addStatus()`.

All the tags are accessible inside of [rxBreadcrumbs](#/components/rxBreadcrumbs) as well. Any breadcrumb that was created with `useStatusTag: true` will automatically receive the same status tag as you passed to `<rx-page>`.

### .page-actions

A `page-actions` class is provided by rx-app to easily add custom page actions to the top right of a page. For example:

    <rx-page title="'Servers Overview'">

            Create New Server

        <img src="http://cdn.memegenerator.net/instances/500x/48669250.jpg" alt="Look at all these servers there are so many"
    </rx-page>

## rx-app-nav and rx-app-nav-item

These two directives are responsible for creating the menu in the left sidebar. They're not intended for use outside of the rx-app template code.

# Common Styling

The rxApp common.less file defines many base CSS rules and classes for app use. Included in this is [normalize.css](http://necolas.github.io/normalize.css/). This helps create a consistent starting point for styles across all browsers.

## Fonts

The EncoreUI default font is Roboto. This is used for all text on the page and is loaded via Google Fonts. Be sure your app includes the following line:

```
<link href="https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,700,700italic" rel="stylesheet" type="text/css" />
```

# Navigation Menu JSON Structure
EncoreUI applications, by default, load the navigation menu from JSON defined in the [encore-ui-nav project](https://github.com/rackerlabs/encore-ui-nav). You can specify that a different JSON file be used (see the demo below), but a certain structure is expected for the JSON.

## Outer structure/Sections
The JSON consists of an array of objects, with each object representing a "section" in the nav. The two demos at the bottom of this page each only have one section, `"All Tools"` and `"Example Menu"`, respectively. As such, the JSON for each of them is an array with one object in it. The default EncoreUI nav menu only has one section `"All Tools"`, and individual products should not be expecting to add their own sections.

The application that this documentation lives in has three sections, which you can see if you look at the current left nav menu. They are `EncoreUI`, `Design Styleguide` and `All Components`.

### `title` (required)

Each section specified in this array is required to have a `title` attribute, i.e.

```
navJSON = [
    {
        "title": "Section 1"
    }, {
        "title": "Section 2"
    }
]
```

### `type` (optional)
Each section can optionally have a `type` attribute. If present, a class with the value `nav-section-TYPE` will be applied in the nav, otherwise `nav-section-all` will be applied.

```
navJSON = [
    {
        "title": "Section 1",
        "type": "highlight"
    }, {
        "title": "Section 2"
    }
]
```

In this example, `Section 1` will have a `nav-section-highlight` class applied to it, while `Section 2` will receive the default `nav-section-all` class.

The default Encore nav menu does not currently use the `type` property, and products being added to Encore should avoid it. This attribute is reserved for future use by the EncoreUI designers.

### `children` (optional)

A section's `children` attribute details the first level of navigation items that live within the section. This is defined as an array of objects, where each object represents an "item" to be displayed in the nav (and the structure of the objects/items themselves will be defined in the Navigation Items section below). As an example, this could look like:

```
navJSON = [
    {
        "title": "Section 1",
        "type": "highlight",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about",
                "key": "about",
                "linkText": "About"
            },
        ]
    }, {
        "title": "Section 2",
        "children": [
            {
                "href": "/overview2",
                "linkText": "Section 2 Overview"
            }
        ]
    }
]
```

These `children` will be able to have further `children` nested inside them, accessible via an expand/collapse chevron, but it is important to note that the top level `children` in each section will _always_ be displayed.

## Navigation Items
A Navigation Item is an object that exists in a `children` array, and represents a clickable item. These items have many optional attributes, and can themselves contain `children` attributes.

Their only required attribute is `linkText`. The object will also need _one_ of the `href` or `children` attributes, but these two should be mutually exclusive.

### `linkText` (required)

The `linkText` attribute defines what text will be shown for the item in the nav menu. This was shown in the example above,

```
    {
        "title": "Section 1",
        "type": "highlight",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about",
                "key": "about",
                "linkText": "About"
            },
        ]
```

These items will be displayed in the nav with `Overview` and `About` text.

### `key` (required for top-level items)
The `key` attribute is used to provide an unique identifier for individual navigation items. If you are introducing a new top-level item into the nav menu, then the `key` is required. It is optional for any nested items. There are two possible reasons you would want to provide this for nested items:

 1. A nav item with a `key` will have the class `rx-app-key-{{ item.key }}` applied to it
 2. `rxAppRoutes` exposes a few methods for working with the key, including `isActiveByKey()` and `setRouteByKey()`

In general, you should not need to provide a `key` attribute for any nested children. We try to avoid custom styling inside the nav, so the automatic class application shouldn't be necessary. And the `rxAppRoutes` methods are _generally_ only used internally by EncoreUI.

### `href` (optional)

The `href` attribute is used to assign a URL to the item, which will be navigated to when clicked. If the item has a `children` attribute, you normally would not include `href`, because you want the children to expand/collapse when this item is clicked, rather than navigating away to somewhere else.

For Encore products within Rackspace, we keep the products on the same domain (encore.rackspace.com), but give each product its own top-level path, i.e. `encore.rackspace.com/foo`, `encore.rackspace.com/bar`. By doing this, the `href` values can simply be entered as `/foo` and `/bar`. And more importantly, `/foo` and `/bar` can be _completely separate Angular applications_. Both applications are available in the nav, but clicking on `/foo` will load a new Angular application, while clicking on `/bar` loads a brand new Angular application.

This allows applications to be developed and deployed independently from each other. The nav is aware of all the applications, but they do not have to be aware of each other.

An extra feature of `href` is that you can put variables into it, that will be interpolated with the current `$route.current.pathParams`. Thus, you can do something like:

```
    {
        "title": "Section 1",
        "type": "highlight",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about/{{foobar}}",
                "key": "about",
                "linkText": "About"
            },
        ]
```
If `foobar` is currently in `$route.current.pathParams`, then its value will automatically be inserted into the final URL.

### `children` (optional)
If an item doesn't have an `href` attribute, it's probably because it has child items via the `children` attribute.

```
    {
        "title": "Section 1",
        "type": "highlight",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about",
                "key": "about",
                "linkText": "About"
            }, {
                "linkText": "People",
                "children": [
                    {
                        "href": "/people/bob",
                        "linkText": "Bob",
                    }, {
                        "href": "/people/sue",
                        "linkText": "Sue"
                    }

                ]
            }
        ]
```

This example shows a new item `People`, which has no `href` of its own, but does have `children`, which contains two new items, each with their own unique `href`.

By default, the `Bob` and `Sue` items will not be visible, and in the nav, `People` will automatically have a chevron attached. When clicked, it will expand to show the `children` items.

As an aside, in this example, there will likely be one Angular application at `/people`, which is resonsible for routing `/people/bob` and `/people/sue`, while `/overview` and `/about` would probably be two different Angular applications.

### `visibility` and `childVisibility` (optional)
The `visibility` attribute is used to control whether or not an individual nav item is visible to the user. If `visibility` is not specified, then by default the item is always visible. The `childVisibility` attribute takes all the same possible values as `visibility`, but is used to determine whether the items in `children` should be visible.

`visibility` can take a few types of values. The original form used in EncoreUI was to pass an expression, filtering values with `rxEnvironmentMatch`, i.e.

```
"visibility": "('unified-preprod' | rxEnvironmentMatch) || ('local' | rxEnvironmentMatch)",
```

This expression would be evaluated, checking if the user is currently viewing the app in the `unified-preprod` environment or the `local` environment, and only display the item if one of those was true. (See [rxEnvironment](#/rxEnvironment) for more details on environemnts). This was used to prevent items from being displayed in a production environment if they were only currently available in staging.

 We now have different JSON files for each environment, so checking the current environment is not necessary.

Another technique for visibility is to use a predefined set of visibility functions that exist in the framework. These include `rxPathParams` and `rxHideIfUkAccount`.

To use these, you pass an array to `visibility`, with the first argument being the name of the function to use (as a string), and the second argument as an optional object describing the parameters to pass to the function.

For instance, `rxPathParams` is used to check if a particular parameter is present in the current route. The syntax is as follows:

```
"visibility": ["rxPathParams", { "param": "accountNumber" }],
```

This means "only show this item if `accountNumber` is present in the current route.

`rxPathParams` is typically used with `childVisibility`, not `visibility`. For instance, the `Account` section in Encore will by default show a search directive (discussed later), and none of its children are visible. After entering a search term, an account number is found, and inserted into the route. At that point, all of the children under `Account` will be visible, as they all require an `accountNumber` to correctly operate.

### `childHeader` (optional)

The `childHeader` attribute is used to specify an HTML header to be placed above the `children` in an expanded area (and thus having a `childHeader` attribute requires having a `children` attribute).

`childHeader` receives HTML content as a string, and uses [rxCompile](#/components/rxCompile) to compile and insert the content above the `children` items. The compiled content will be linked against the current scope, allowing you to do things like:

```
    {
        "title": "Section 1",
        "type": "highlight",
        "childHeader": "<strong>Current Account:</strong><span class='current-result'>#{{route.current.pathParams.accountNumber}}</span>",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about",
                "key": "about",
                "linkText": "About"
            }, {
                "linkText": "People",
                "children": [
                    {
                        "href": "/people/bob",
                        "linkText": "Bob"
                    }, {
                        "href": "/people/sue",
                        "linkText": "Sue"
                    }

                ]
            }
        ]
```

This example will pull the `accountNumber` from the `pathParams`, and insert `Current Account: 1234` above the children.

### `roles` (optional)

*Note*: Support for `roles` requires at least version 1.19.0 of EncoreUI.

In addition to the `visibility` criteria described above, you can also restrict which items are shown to a user based on the LDAP roles of that user. This is done via the `roles` attribute, which takes a single object as its value. This object can be used to specify that a user requires _all_ roles from a certain set, or _any_ role from a certain set, to see an item. For example:

```
    {
        "title": "Section 1",
        "type": "highlight",
        "childHeader": "<strong>Current Account:</strong><span class='current-result'>#{{route.current.pathParams.accountNumber}}</span>",
        "children": [
            {
                "href": "/overview",
                "key": "overview",
                "linkText": "Overview"
            }, {
                "href": "/about",
                "key": "about",
                "linkText": "About"
            }, {
                "linkText": "People",
                "children": [
                    {
                        "href": "/people/bob",
                        "linkText": "Bob",
                        "roles": { "all": ["role1", "role2"] }
                    }, {
                        "href": "/people/sue",
                        "linkText": "Sue",
                        "roles": { "any": ["role1", "role2", "role3"] }
                    }

                ]
            }
        ]
```

In this example, the `Bob` item can only be seen by users who have _both_ `role1` and `role2` in their LDAP roles, while the `Sue` item can only be seen by users who have _at least one_ of `role1`, `role2`, or `role3`. Please keep in mind that you [can't do real security in front-end JavaScript](https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/august/javascript-cryptography-considered-harmful/). Do not rely on `roles` as a security feature. `roles` is purely to enhance user experience, to prevent them from seeing items that they won't have permissions to access anyway. All the data is still sent to the browser. A user who knows how to use the dev tools will be able to see the full list. LDAP role-based security must still happen on the server-side.

### `directive` (optional)
The optional `directive` attribute receives the name of a directive in its dash-delimited format (i.e. uses `"rx-account-search"` instead of `"rxAccountSearch"`). If this directive is available, then the navigation menu will have that directive inserted and rendered directly under the `linkText` for the nav item.

The most important line in the previous paragraph is `If this directive is available...`. Let's say we add a new `Support` item to the nav, where each of its children are supposed to render its own custom search directive:

```
   }, {
        "linkText": "Support",
        "children": [
            {
                "linkText": "People Support",
                "directive": "people-search"
            }, {
                "linkText": "Machine Support",
                "directive": "machine-search"
            }
        ]
    }
```

The _intent_ is that when the user clicks on "Support", the menu will expand to show "People Support" and "Machine Support" child items, and each will contain a search box, defined by the `people-search` and `machine-search` directives, respectively.

But where do those directives come from? `rxApp` provides some legacy directives that are available to the nav, including `rxAppSearch`, `rxAccountUsers`, etc. But `people-search` does not come from `rxApp`. And recall from the `href` section that the nav might be defining multiple different Angular applications. What if "Support" is defined in your application, ad that's where `people-search` comes from, but the user is currently in a different application? That different application won't have `people-search` defined anywhere, so when the user clicks on "Support", the directives won't be available.

The solution to this is to ensure that these elements with directives _also_ have an `href`, and those URLs belong to Angular applications that define those directives. i.e.

```
   }, {
        "linkText": "Support",
        "key": "support",
        "children": [
            {
                "linkText": "People Support",
                "directive": "people-search",
                "href": "/support/people-support",
            }, {
                "linkText": "Machine Support",
                "directive": "machine-search",
                "href": "/support/machine-support",
            }
        ]
    }
```

In fact, recall that we said all items _must_ have one of `href` or `children`, so the `href` is necessary anyway. But they key here is that by having an `href`, the browser will navigate to `/support/people-support` / `/support/machine-support`, which should be defined in Angular apps that have `people-search` and `machine-search` available as directives.

With this configuration, clicking on `Support` will expand the `children`, and the user will see `People Support` and `Machine Support`, but they will not see the directives. But if they then click on one of `People Support` or `Machine Support`, then the `/support` Angular application will be loaded, the and the directives will become available.


text:
### [CVE-2006-1681](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1681)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

Cross-site scripting (XSS) vulnerability in Cherokee HTTPD 0.5 and earlier allows remote attackers to inject arbitrary web script or HTML via a malformed request that generates an HTTP 400 error, which is not properly handled when the error message is generated.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/kenzer-templates

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve