text:
# react-flag-svg

Simple react component with country or country state flag.
Now supporting all country flag, USA, Canada, Germany, Brazil, Australia state flag

### Usage

```bash
npm install react-flag-svg
```

```jsx
import React from 'react';
import Flag from 'react-flag-svg';

// Render image with flag
<Flag
  isoCode="us-tx"
  className="some-class"
  alt="alternative text for image"
/>;
```

### Props

| Prop        | Description                                                                                | Default      |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `isoCode`   | The code of te country or state, from [`List of ISO 3166 country codes`](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) alpha-2 code | Ukraine flag |
| `className` | class for component                                                                                |
| `alt`       | alternative text for image                                                                                |

## Status and contribution

The project is supported by Halo lab development team, we're not working on it regularly, but trying to invest in it when we have time between clients' project.

Though, feel free to open issues and you're very welcome to contribute.

repository: Tvorohov/react-flag-svg

repo_name: Tvorohov/react-flag-svg


text:
# HASS-BBC-envirobit
Stream button presses and BME280 sensor readings over the serial from the BBC micropython [envirobit](https://github.com/pimoroni/micropython-envirobit) to [Home-Assistant](https://www.home-assistant.io/).

## BBC-envirobit setup
`main.py` should be flashed to tbe BBC microbit. On pressing the `A` or `B` buttons the display will scroll the pressed button. The buttons are displayed as a binary sensor in Home-Assistant and can be used to trigger automations.
Data from the BME (temperature, pressure, humidity, but not altitude as these values were meaningless in my testing) are publihsed to Home-Assistant every second (the sleep time is a variable `sleep_sec` which you can optimise). The number of decimal places that data is reported to is 1dp by default, but can be varied with the `rounding_digits` variable. Plug the microbit into the USB port on your Home-Assistant computer.

## Home-Assistant Usage with HASSOS

On HASSOS, the microbit is on `/dev/ttyACM0`

We can now configure Home-Assistant to display the data feed. I add to my Home-Assistant config:
```yaml
sensor:
  - platform: serial
    serial_port: /dev/ttyACM0
    baudrate: 115200
```

We then use template sensors to break out the data fields. Under `sensor`:
```yaml
  - platform: template
    sensors:
      temperature:
        friendly_name: Temperature_microbit
        unit_of_measurement: "°C"
        value_template: "{{ states.sensor.serial_sensor.attributes.T }}"
```

The final config for all sensors is:
```yaml
sensor:
  - platform: serial
    serial_port: /dev/ttyACM0
    baudrate: 115200
  - platform: template
    sensors:
      temperature:
        friendly_name: Temperature_microbit
        unit_of_measurement: "°C"
        value_template: "{{ states.sensor.serial_sensor.attributes.T }}"
      pressure:
        friendly_name: Pressure_microbit
        unit_of_measurement: "hPa"
        value_template: "{{ states.sensor.serial_sensor.attributes.P }}"
      humidity:
        friendly_name: Humidity_microbit
        unit_of_measurement: "%"
        value_template: "{{ states.sensor.serial_sensor.attributes.H }}"

binary_sensor:
  - platform: template
    sensors:
      button_a:
        friendly_name: Button_A_microbit
        value_template: "{{ states.sensor.serial_sensor.attributes.ba |float > 0}}"
      button_b:
        friendly_name: Button_B_microbit
        value_template: "{{ states.sensor.serial_sensor.attributes.bb |float > 0}}"

history_graph:
  microbit:
    entities:
      - sensor.temperature
      - sensor.pressure
      - sensor.humidity
```
## Mac usage
To check which port the microbit is on I run (on Mac/unix):
```
ls /dev/cu.*
```
In my case the microbit is connected on **/dev/cu.usbmodem14342**. I now use [screen](https://geekinc.ca/using-screen-as-a-serial-terminal-on-mac-os-x/) to check the data transmitted over the serial. In the terminal I launch screen with:
```
screen /dev/cu.usbmodem14342 115200
```
Note that if you get any funny errors when connecting, check that there is not already a screen session open using the Activity monitor, and kill any existing processes. You can also kill a screen session using **ctrl + a + k**.

## Notes
I discovered that you can't mix numerical and text data in the payload string. If you try Home-Assistant displays no data.

license: MIT

repository: robmarkcole/HASS-BBC-envirobit

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: robmarkcole/HASS-BBC-envirobit


text:
```go
// One may write either
	if glog.V(2) { glog.Info("log this") }
// or
	glog.V(2).Info("log this")
```

### How is above even possible?
- Can you think of how to implement similar stuff?

### Solution
- Refer - https://github.com/golang/glog/blob/master/glog.go

```go
type Verbose bool
```
```go
// The second form is shorter but the first is cheaper if logging is off because it does
// not evaluate its arguments.
//
// Whether an individual call to V generates a log record depends on the setting of
// the -v and --vmodule flags; both are off by default. If the level in the call to
// V is at least the value of -v, or of -vmodule for the source file containing the
// call, the V call will log.
func V(level Level) Verbose {
	// This function tries hard to be cheap unless there's work to do.
	// The fast path is two atomic loads and compares.

	// Here is a cheap but safe test to see if V logging is enabled globally.
	if logging.verbosity.get() >= level {
		return Verbose(true)
	}

	// It's off globally but it vmodule may still be set.
	// Here is another cheap but safe test to see if vmodule is enabled.
	if atomic.LoadInt32(&logging.filterLength) > 0 {
		// Now we need a proper lock to use the logging structure. The pcs field
		// is shared so we must lock before accessing it. This is fairly expensive,
		// but if V logging is enabled we're slow anyway.
		logging.mu.Lock()
		defer logging.mu.Unlock()
		if runtime.Callers(2, logging.pcs[:]) == 0 {
			return Verbose(false)
		}
		v, ok := logging.vmap[logging.pcs[0]]
		if !ok {
			v = logging.setV(logging.pcs[0])
		}
		return Verbose(v >= level)
	}
	return Verbose(false)
}

// Info is equivalent to the global Info function, guarded by the value of v.
// See the documentation of V for usage.
func (v Verbose) Info(args ...interface{}) {
	if v {
		logging.print(infoLog, args...)
	}
}
```

repository: AmitKumarDas/Decisions

repo_name: AmitKumarDas/Decisions


text:
# Cabal Online API Client
Example web client for Cabal Online API https://github.com/cyberinferno/cabal-online-api

## Running the project

* Clone or download the project to a directory in your web server like Apache.
* Start API server.
* Open the client project in your browser.

repository: rcdevgames/cabal-online-api-client

repo_name: rcdevgames/cabal-online-api-client


text:
**Shivani kulkarni**
# machine learning
**Introduction of machine learning**:-

 Basically, ml is a machine which is a branch of AI.also it already has its own program which is then modified and put forward to make a real model.basically it's a pattern based language in which pattern is consists of clusters(collection of similar things)
Key terminologies involved are:
•	converting data into information
•	solving problem
•	implementing the problem.

Now, let's have a look on different types of ML through one tree diagram

There are three types of machine learning
1.	Supervised learning
2.	Unsupervised learning
3.	Reinforcement learning

So now our main agenda is to learn about unsupervised machine learning

 # unsupervised machine learning
What is unsupervised machine learning?
1. Labels/targets are unknown

2. Finding hidden pattern in unlabeled data

3. Problem itself is ambiguous

>In unsupervised algorithm we kind of don't know what we are looking for so problem itself is ambiguous

Let's have a look on following diagram for understanding  unsupervised ML in simple way

So basically unsupervised learning can be taught of as self learning where there is no teacher and the algorithm confined previously unknown pattern in dataset that does not have any sort of labels
Let's take one real life example

Suppose you and your friends want to watch the cricket match but you don't know what cricket is but for your friend you say yes then you reach home and start watching the match you don't really have an idea what's happening but looking at your friends you analyze the screen and come to some conclusion like
•	There are two teams India and Australia
•	Different kinds of players such as ballers,batters
•	Ball hits wicket or is caught batsman is out
•	Cheer when India score a 4 or 6
From knowing nothing to knowing everything about cricket you can enjoy the match now
So basically you have materials and you learn everything by yourself so these is the principal that exactly unsupervised algorithm follows

Now we will see why unsupervised learning is important for real world solving problem ?

1. They find pattern which are previously unknown

2. Patterns help in categorization or finding association

3. They can detect anomalies & detects in the data

4. They work on unlabeled data which makes our work easier

Application of unsupervised learning :-

1. Dimension reduction

2. Image compression

3. Anomaly detection

Let's discuss third example in detail,so let's say if you have enterprise you know and you are a company & you are trying to make sense of the data which is going through your company so now you want to know that if there is an anomaly you know is trying to hack your system or something like that you want to make sure that you flag it so how do you go about doing that there is no as such data set that you have so you could make an system which continuously adapts itself as well and to detect any anomalies in the data set.

Let's give ans to following question to get to know how much you understand till now
**Quiz:- In which of the following scenario you would most likely use an unsupervised ML algorithm?**
1.  a set of images are given to you in which you are interested in grouping the ones which are similar

2. Given training data about user preferences you are interested in knowing whether they would like/dislike a movie

3. Given a set of 1000 features you are interested in finding features that captures max variance in data

***So ans could be 1&3 because in 2nd the training data is already provided.
Let's see how clustering works on unsupervised ML algorithm***

# clustering
 What is Clustering ?

We group similar items together,if our data is unlabeled we need to calculate similarity measures.

 >Similarity measures are directly proportional to features.

In these case over here we are not given any information about fruits. Now unsupervised learning algorithm trying to find hidden patterns in these data and then it will trying to classify things into different buckets without any prior information So in the above image we all can see how clustering works and set a group of fruits in a way that fruits having same color,shapes falls into one group having same pattern(clusters)
Now let's understand clustering in detailed

#   Clusturing approach
how you would approach clustering problem let's have a look:-

Now we have data sets like everything is black now our job is to color some of these as red and some of these as green
And to do that initially you can obviously look at the things and color some of them as red and some as green and cluster those two things so what do you need for clustering let's have a look

# Proximity measure
So 1st we need to do is to calculate proximity measure, it is the vector distance between two clusters,
One of the method used for proximity is euclidean distance it is calculated as,
D=√((x1-x2)^2+(y1-y2)^2)

# Evaluation criteria

2)second thing you also need is now once yow create cluster you also need to see what a good cluster looks like and so there are some measures called evaluation criteria these will tell us how far two clusters are or how close points of one cluster are.
So that's how you would approach cluster problem.
# k-means

To decide whether we get good results of clusters k-means plays an important role
# k-means algorithm:-
Now we are going to study one such approach to clustering which is called as k-means it's one of the famous algorithm for clustering

Now,  these points are not labeled eventually they look separate afterwards it performs many iteration on dataset and eventually come up with good ans,

Let's have a look on steps involved in implementation of k-means algorithm

**Initializing the k value**

So k-means is nothing but it comes with k centroids of the clusters so by looking the above example we assume that there are two clusters so let's say k=2 so we have two controllers of cluster.so there may be one question arises in everyone's mind,thats how we'll selects that two centroids, so initially we selects it randomly

**Assignment step**

so what k-means gonna do next it will find distance of all data points from the centroid and then which points are closest to say(red cluster) it marked itself as red & these step is called as assignment step as each point is assigned itself to a particular cluster

**Equidistant case**

Now there is also one case arrived as what about that points which are equidistant from say (red cluster) as well from centroid indeed in that case the pseudo code is applied as follows,
  `If
        {
          (I am closest to red) || (no)
         }
     Else if{
           ( distance from red>=something ) ||(no)
      print(one cluster)
    Else if{
          (distance<something)
            print(another cluster)
      }
   Else
      {
        (assign point to blue)
      }`

So in these that "no" catches all in the Equality Case so machine will randomly assign itself to one cluster in case if they are equidistant

**Move Centroid Step**

In this step, we will calculating the mean of all data points in a particular cluster and move the centroid of that cluster to that mean position.
We will repeat the above two steps once one of the following conditions is true:
•	Our centroids stop changing their positions.
•	Maximum number of iterations are reached.
Our data is now arranged into clusters.

So finally after aplication of k-means we got final cluster as,

<img<EMAIL_ADDRESS>alt="flow diagram for k-means algorithm">

Let's discuss the flow chart in detailed

**Steps involved**
1.	Select the number of clusters to be identified for eg:-select k=3 in above case

2.	Randomly select 3 distinct data points

3.	Measure the distance between the 1st point & selected 3 clusters
4.	Assign the first point to nearest cluster(red in this case)
5.	Calculate the centroid value including the new point for red cluster

6.	Find to which does point 2 belongs and how?
•	Repeat the same above procedure but measure the distance of 2nd point from mean position
•	Calculate the cluster mean including new point
7.	Repeat the procedure for points in 1st cluster.
8.	Do the iteration until the data points within each cluster don't have space for moving
>In case of graph we perform the same procedure the only difference is distance is calculated as euclidean distance in 2D it's nothing but a simple Pythagoras theorem.

Let's have one quiz:-
Calculate distortion of clustering algorithm for following values
£(data xi-centroid x) ^2 + (data yi-centroid y) ^2

          Data x	           Data y	          Centroid x	         Centroid y
               5	                3	                3	                   3
                2	                  3

**how to decide centroids**
But main question arises here Is that how do you go about deciding how many centroids to take over here just to explain  we take two clusters but by even looking at the data we know there are 2 clusters only but how about when you are in higher dimensions like when you have 1000 features we can't even visualize that but approach is gonna same you have to use hit and trail method initializing from k=1

1.	K=1 is the worst case scenario
          >it will have 20different clusters for.   20 different data points
2.	K=2 is still better than k=1 it compares the total variation with k=1
3.	K=3 is even better in this total variation is less than that of k=2

Each time you increase the clusters the total variation decreases if,
**number of cluster=number of data points then in that case variation=0**
>number of clusters is inversely proportional to total variation.

Finally we plot reduction in variance,for per value of k on that basis we plot one graph in which on x axis there is reduction in variance and on y axis there is no of clusters that method is called as elbow method

Let's understand elbow method through above image

Initially we start with 1 cluster and we will see that distortion is 3.5 ok now let's do k-means once more say number of cluster at 2 & distortion is 1.5 after a point you will get elbow like structure so you select the point which is at elbow location which is at around 3 and reason behind that is after this we are getting some incrementally better results so you are not getting significant improvement in your distortion so it doesn't make any sense.these is what elbow method is used to determine how many number of clusters we should choose. on x axis we have no of k and on y axis we have distortion,
 So now by looking above graph we are going to choose point which looks like elbow and which is 3 it will show that we have 3 clusters i.e k=3
In these way k-means algorithm works

Coming to the next algorithm let's see hierarchical clustering algorithm in detail

# hierarchical clustering

What is hierarchical clustering?
It is separating data into different groups based on some measures of similarity.
Let's consider we have 5 letters a,b,c,d,e in which a,b are closed and c,d are close to each other and e is a little bit far away from c and d so
a,b form one cluster
c,d forms one cluster
c,d,e comines and form one cluster
and finally all comines and form cluster consisting of a,b,c,d,e

In these way hierarchical clustering goes.
**types involved are**
Agglomerative clustering:-it is a bottom up approach it combines the clusters and form one cluster
Divisive clustering:-it is a top down approach it splits the clusters into subclusters.

Let's understand the types one by one

**Agglomerative clusters**
 Let's consider we have few points on plane having x and y axis
We are going to start by measuring the distance between each data point so we need to figure it out
>remember each data point is a cluster of its own.

Now by going from bottom up agglomerative then we have each point being it's own cluster we try to find out the least distance between two data points to form a cluster and once by finding those points we start clustering of multiple points these tree like structure is called dendogram.

How to measure distance between two data points?

Distance measure will determine similarity between two elements and it will influence shape of cluster

4 ways to determine distance are as follows
Euclidean distance:-playing with triangle shape
Square euclidean distance:-playing with square shape
Manhattan distance
Cosine distance:-similarity  measure angle between two vector.

Let's understand agglomerative clustering through three questions
How do we represent cluster of more than one point?
Steps:-
We make use of centroid which is the argument of its points
Once we made centroid of two clusters we find out which another is close to it then we make new point centroid
Combine the clusters.

When do we stop combining clusters?
approaches involved are:-
Pick a no of clusters k upfront
>we decide the cluster required in the beginning and we terminate when we reach the value k for ex:if we start with 2 clusters we have to terminate it when we left with 2 clusters
Clusters are going to Stop when the next merge would create a cluster having low cohesion
>we keep clustering till next merge of clusters create a bad cluster/low cohesion
How is cohesion define:- diameter of cluster=maximum distance between any pair of points in the cluster we stop it when diameter of new cluster exceeds threshold we don't want 2 clusters overlap.we stop before overlapping.

**divisibe clustering**
What is divisive clustering:-
We start with a single cluster consisting of all data points
We separate it into different clusters
>separation can be done using monothetic divisive method

**monothetic divisive method**
Let's understand it through one example

Suppose we have 6 points a,b,c,d,e,f now we are going to apply top down approach so,
Obtain all possible splits into two clusters
For each split compute cluster sum of squares
Bj12=n1(xj1-xj) ^2 +n2(xj2-xj) ^2

Where, Bj=between clusters 1&2
  Xj1/2=mean of clusters
  n=no of member in cluster
  Xj=total mean
We always selects cluster with largest sum of square distances

Let's have a look on steps involved in hierarchical clustering algorithm
Import dataset
Create a scatter plot
Normalize the data
Calculate euclidean distance
Create a dendogram

Well we'll see how it's gonna implement in **HOW** section.

So at the end we all can see how we start to explore data & we start to see things where things are grouped together in a ways we might not have seen before and there is good start for giving advice for ex: city developement & many more.

**do visit me** :point_down:

  <img align="left"  width="16px"<EMAIL_ADDRESS>/>

 <img align="left"  width="16px"<EMAIL_ADDRESS>/>

  <img align="left"  width="16px"<EMAIL_ADDRESS>/>

 <img align="left"  width="16px"<EMAIL_ADDRESS>/>

***thanks for reading*** :heart:

gha_license_id: MIT


text:
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/753cdb0b87e34947b7bb6295ad861e21)](https://www.codacy.com/app/zim182/unified-test-core?utm_source=github.com&utm_medium=referral&utm_content=Invictum/unified-test-core&utm_campaign=Badge_Grade)

Invictum Test
====

Enhanced version of Serenity TAF project.

Quick start
----
The easiest way to start with Invictum test framework is to use maven archetype. Just invoke command in terminal:
```
mvn archetype:generate -DarchetypeCatalog=https://oss.sonatype.org/content/groups/public/ -DarchetypeGroupId=com.github.invictum -DarchetypeArtifactId=invictum-junit-archetype -DarchetypeVersion=1.5
```
Project structure will be generated and ready for tests implementation.
For now only jUnit style archetype is prepared, but it is also possible just to add maven dependency manually.

Please refer to [Wiki section](https://github.com/Invictum/invictum-test/wiki) for more details.

Important notes
---------------
Starting from version 1.8 `allure-invictum-integration` module will not be supported anymore and scheduled for removal. Use [serenity-allure-integration](https://github.com/Invictum/serenity-allure-integration) module instead.

repository: Invictum/invictum-test

branch_name: refs/heads/develop

gha_language: Java

repo_name: Invictum/invictum-test


text:
# Notebooks

Some important notebooks in this directory

* `Bootstrap Training Data.ipynb` generated the set of negative training examples described in Section 2.4

* `Final Training Data.ipynb` generates the final training dataset used to build the model in `../scripts/build_full_classifier.py`

* `distributions.ipynb`, `wide_area_plots.ipynb`, `trigger.ipynb` generate some figures from the paper


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

#Data Structures
Implementation of LinkedList and Stack data structures in Python.

##LinkedList
The LinkedList class is composed of a Node base class.

Available methods inlude:
* insert(val)
* pop()
* size()
* search(val)
* remove(node)
* display()

##Stack
The Stack data class is a first-in-first-out data structure built via composition from LinkedList.
Available methods include:
* push(value)
* pop()

##Queue
The Queue data class is a first-in-last-out data structure built via encapsulation of a LinkedList.

Available methods inlude:
* enqueque(value)
* dequeque()
* len()

##Binary Heap
The Binary Heap data class is a binary tree data structure built implemented on a built-in Python
list. The binary heap default to a minheap sort, meaning that the smallest values will be sorted to
the top of the heap. Alternatively, the binary heap can be instantiated as a maxheap so that the
greatest values will be sorted to the top.

Available methods include:
* pop()
* push()
See the doc strings for implementation details.

##PriorityQ
The PriorityQ data class is a binary tree that implements sorting primarily by priority value and
secondarily by insertion order. The PriorityQ defaults to minheap sorting for both. A QNode is implemented
as a base class to containerize the value and priority and to provide convenient APIs for comparison.

Available methods include:
* insert(item)
* pop()
* peek()
See the doc strings for implementation details.

Instantiation of a PriorityQ takes an iterable which may contain (value, priority) iterables,
non-iterable values, or QNode objects.

##Graph
The graph data class is a network consisting nodes with an arbitrary number of references (edges) to other
nodes in the graph. Methods allows abilities such as adding, removing, and checking the existance of nodes
and edges in the graph. Additionaly, the graph class contains to traversal methods. Given a start node, the
methods will traverse the entire network reachable from that node and return the path travelled as a list of
nodes travelled. Both [depth-first](https://en.wikipedia.org/wiki/Graph_traversal#Depth-first_search) and [breadth first](https://en.wikipedia.org/wiki/Graph_traversal#Breadth-first_search) traversal methods are available.

Available methods include:

* nodes()
* edges()
* add_node(n)
* add_edge(n1, n2)
* del_node(n)
* del_edge(n1, n2)
* has_node(n)
* neighbors(n)
* adjacent(n1, n2)
* depth_first_traversal(start)
* breadth_first_traversal(start)
* uniform_cost_search(n1, n2)
* bellmanford(n1, n2)

The uniform_cost_search method returns a path that corresponds to the
shortest path between n1 and n2. This algorithm tracks historical paths
and is able to search for the shortest path in a relatively uncostly way.
Time complexity is O(edges + node log nodes) with relatively low memory
overhead.

The bellmanfor search method also returns the same path, but has the added
ability to handle edges with negative values and detect negative feedback
loops. It is relatively robust, but at added time complexity cost of
O(nodes * edges).

See the doc strings for additional implementation details.

##Binary Search Tree
Contains a Node class which implements an AVL binary search tree.

Each node can be considered a binary search tree and has the usual
methods to insert, delete, and check membership of nodes. By default,
the insert and delete methods will perform self-balancing consistent
with an AVL tree. This behavior can be suppressed by passing the optional
'balanced=False' keyword argument to the insert or delete methods.

The class also supports four traversal methods which return generators:

- in_order
- pre_order
- post_order
- breadth_first.

Additionally, methods are included to help visualize the tree structure.
get_dot returns DOT source code, suitable for use with programs such as
Graphviz (http://graphviz.readthedocs.org/en/stable/index.html), and
save_render saves a rendering of the tree structure to the file system.
Passing the optional 'render=True' keyword argument to the insert and
delete methods will automatically save a render to disk upon execution.

Finally, the helper methods 'create_best_case' and 'create_worst_case'
facilitates creation of tree composeds of _n_ integers.

This module was completed with reference to the following:

[Binary Search Tree libary in Python](http://www.laurentluce.com/posts/binary-search-tree-library-in-python/)
by Laurent Luce.

[How to Balance your Binary Search Trees - AVL Trees](https://triangleinequality.wordpress.com/2014/07/15/how-to-balance-your-binary-search-trees-avl-trees/)

[The AVL Tree Rotations Tutorial](http://pages.cs.wisc.edu/~paton/readings/liblitVersion/AVL-Tree-Rotations.pdf)
by John Hargrove
Available methods include:

* insert(val, balanced=True, render=False)
* delete(val, balanced=True, render=False)
* contains(val)
* lookup(val)
* size()
* depth()
* balance()
* in_order()
* pre_order()
* post_order()
* breadth_first()
* get_dot()
* save_render()
* create_best_case()
* create_worst_case()

See the doc strings for additional implementation details.

##Hash Table
Contains a HashTable class. The [hash table](https://en.wikipedia.org/wiki/Hash_table)
is implemented on a list of lists, with a default table size of 8192. This table
size can be overridden on initialization by passing a size keyword argument. Insertion
and lookup time complexity ranges from O(1) at best to O(n) at worst.

Available methods include:

* set(key, value)
* get(key)

##Insertion Sort
This module contains the in_sort method, which performs an
in-place insertion sort on a passed in list. Insertion sort has a best case time
complexity of O(n) when list is nearly sorted, and a worst case of O(n2)
when the incoming list is already reverse sorted. While this not always
the most efficient algorithm, it is still popular when the data is nearly
sorted (because it is adaptive) or when the problem size is small.
See the excellent 'sortingalgorithms.com' for more information.

## Merge Sort
This module contains the merge_srt method, which performs an
in-place merge sort on a passed in list. Merge sort has a best case time
complexity of O(n log n) when list is nearly sorted, and also a worst case of
O(n log n). Merge sort is a very predictable and stable sort, but it is not
adaptive. See the excellent 'sortingalgorithms.com' for more information.

##Quick Sort
"""This module contains the quick sort method (quick_srt), which performs an
in-place sort on a passed in list. Quick sort has a best case time
complexity of O(n log n) when all elements are equal, and a worst case of
O(n2). Quick sort is not stable or adaptive, but it is robust and has low
overhead.

This module was completed with reference to:
[Quicksort: A Python Implementation](http://pfsensesetup.com/pythonscript.net/quicksort-a-python-implementation/)
by maximumdx

See the excellent 'sortingalgorithms.com' for more information.

repository: jonathanstallings/data-structures

gha_language: Python

repo_name: jonathanstallings/data-structures


text:
# checksum-loader

A loader for [webpack](http://webpack.github.io/) that provides the checksum of a file. Useful when dynamically including resources that need a cache-busting suffix.

```sh
$ npm install checksum-loader --save
```

### Usage

```js
var checksum = require('checksum!./file.js');
```

## License

Copyright © 2014 [Brian Reavis](https://github.com/brianreavis) & [Contributors](https://github.com/naturalatlas/checksum-loader/graphs/contributors)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0

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

repository: naturalatlas/checksum-loader

repo_name: naturalatlas/checksum-loader


text:
MEDLINE staging data load process
===================================

Background
----------
This is the MEDLINE staging data load process.

The ETL job downloads the source data files from the following ftp sites:

[PUBMED ftp site](ftp://ftp.ncbi.nlm.gov/pubmed)
[MESH ftp site](ftp://nlmpubs.nlm.nih.gov)

Table(s) loaded
---------------
staging_medline tables

Dependencies
------------
1. Java JDK (e.g. openjdk).
2. MedlineXmlToDatabase java executable - see the below GitHub repo for installation and usage details:

[MedlineXMLToDatabase GitHub repository](https://github.com/OHDSI/MedlineXmlToDatabase)

Install the MedlineXmlToDatabase java app in the same directory as the Pentaho job.

Instructions
------------
1. Load the Pentaho job in the Pentaho Spoon client.
2. Run the job.


text:
---
title: "Second Workshop of the EGYLandscape Project"
excerpt: "Next Steps - 2020"
avatar: "/assets/images/conference_avatar_virtual.png"
institution: "A Virtual Gathering"
toc: true
toc_sticky: true
layout: single
gallery:
  - url: /assets/images/workshops/june_8th_session.jpg
    image_path: /assets/images/workshops/june_8th_session.jpg
    alt: "placeholder image 1"
  - url: /assets/images/workshops/prof_borsch_presenting.jpg
    image_path: /assets/images/workshops/prof_borsch_presenting.jpg
    alt: "placeholder image 2"
  - url: /assets/images/workshops/june_9th_session.jpg
    image_path: /assets/images/workshops/june_9th_session.jpg
    alt: "placeholder image 3"
---

{% include gallery caption="Photos From The Second Workshop of the EGYLandscape Project" %}

## Second Workshop of the EGYLandscape Project
**Next Steps: A Virtual Gathering**
*8-9 June 2020*

[*Download Program Here*](https://www.egylandscape.org/workshops/EGYLandscape_Virtual2020_Workshop_Program.pdf)

[*Download Flier Here*](https://www.egylandscape.org/workshops/EGYLandscapes_Virtual2020_Workshop_Flier.pdf)

The second workshop of the EGYLandscape project was initially planned to be held at the French Archaeological Institute in Cairo, Egypt. However, given the ongoing COVID-19 pandemic, the EGYLandscape project moved the workshop to a virtual platform. Using the open-source platform TheBigBlueButton, EGYLandscape’s second workshop was held on 8-9 June 2020.

Like the first meeting in Marburg in September 2019, the virtual gathering offered an opportunity to have updates from the project’s participants and contributors regarding the state of their research projects. While not as ideal as an in-person meeting, thirteen team members discussed their research projects; and at various points, between twenty and twenty-five participants and guests joined in for the talks and subsequent discussions. The projects surveyed were from EGYLandscape’s historians as the format was not as conducive to the archaeological presentations and seminars that had been planned for Cairo. This was the real limitation of the virtual platform.

On the afternoon of the second day of the virtual gathering, there were several sessions devoted to discussing the current state of the project as well as next steps. The team also heard from Nicolas Michel about the ongoing GIS mapping project. Anthony Quickel gave updates about the team’s mid-project publication – a special issue of the Mamluk Studies Review, the project’s working papers and website, as well as other new news. The virtual workshop concluded with a roundtable discussion hosted by project leaders Nicolas Michel and Albrecht Fuess to share and gather thoughts about what the EGYLandscape Project is doing well and how it might continue to advance.

The next EGYLandscape Project workshop is planned for the beginning of June 2021 in Alexandria, Egypt.

gha_language: JavaScript


text:
# Heh

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

Heh is a functional programming language with a built-in support for infinite arrays.
The language is strict, but the infinite structures are lazy.  The language includes three
built-in higher-order constructs: `imap`, `reduce` and `filter` which make it possible
to construct complex array operations that can be often seen in APL or SaC.

One of the main distinctive features of the language is that we use ordinals to index
arrays as well as to maintain shapes of the arrays.  This gives a rise to a number of
important static properties that one can observe in Heh.

Heh makes it possible to write generic programs that do not make distinction between
arrays and streams.  One can write truly infinity-polymorphic programs:
```
λa.λv.imap |a| { _(iv): (a iv) + v
```
Keep in mind, that the increment function never specifies whether the shape of `a`
is finite.

The name Heh refers to the Egyptian mythology, where Heh is the god of
infinity.

<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Heh.svg/700px-Heh.svg.png" width=250 alt="Heh -- the god of infinity"/>

# Results and work in progress

Currently, Heh demonstrates that the concept described in [this paper](https://arxiv.org/abs/1710.03832)
can be implemented.  We have formalized semantics of the language [here](https://github.com/ashinkarov/heh/blob/master/semantics/lambda-omega-semantics.pdf).

We have shown that the number of array equalities from various array algebras hold for infinite arrays as well.
As an example, consider `drop |a| (a ++ b) == b`, where `a` and `b` are of infinite shape, `++` is
concatenation over the first axis and `drop` is an inverse of `++`.

There is a backend that compiles programs with non-recursive finite imaps can into SaC.
See [sac backend](https://github.com/ashinkarov/heh/blob/master/compile_sac.ml) for more details.

Further we have explored Heh compilation into Python, APL, Julia and C in
[this paper](http://ashinkarov.github.io/publications/rosetta-stone.pdf).

We explore how to bring the power of recursive imaps into a strict language.  We found a neat way to
do this, making sure that parallel execution of such recursively specified arrays is possible.
See [this paper](http://ashinkarov.github.io/publications/array-comp.pdf) for more details.

Currently we are working on:
  * Designing a type system for Heh.  The main challenge is to keep the type system decidable,
    yet propagate as much of the shape information as possible.  Knowing shapes of all the arrays
    statically vastly improves the runtime.  Currently we are investigating whether the
    [SaC](http://www.sac-home.org/doku.php) approach of combining sub-typing and intersection types
    is powerful enough.  Alternatively, dependent types offer a solution, but they do have potential
    impact on the performace.  The excalt treatment ordinals within the type system is not yet clear.

  * Compiling Heh.  So far compilation works for a finite non-recursive subset.
    Infinite recursive case is more challenging.  We didn't fix representation for imaps at
    runtime.  Most likely we want to treat them as hash-tables, where every entry stores a contiguous
    piece of memory, representing an index subspace.

    Memory management is fun.  SaC uses reference counting, which is efficient in the strict and finite
    array scenario.  Here, as imaps can be infinite and recursive, most likely we'd have to combine
    reference counting and garbage collection.

  * Proving programs in Heh.  Heh treats infinite structures without using co-induction.  It uses
    transfinite induction instead.  Can we use this to take and advantage over co-inductive data structures
    is not yet clear.

  * Streaming primitives.  We have seen that a number of streaming primitives can be implemented in Heh
    right now.  Whether it is sufficient for all the streaming scenarios is not clear.  Also, we didn't
    properly investigate how to treat finite streams.

The above list is not exhaustive, and a number of open question still remain.
In case you are interested in joining to research around Heh, please contact
[Artem Shinkarov](mailto:artyom.shinkaroff@gmail.com).  We are open for collaboration.

# Building the interpreter

The following dependencies are required:
  * Ocaml version >= 4.3;
  * ocamlbuild
  * oUnit _if you wan to run unittests_

To build the interpreter run `make` within the top-level directory which by default
creates `main.native` (the interpreter) and `test.native` (unit tests).

Building the interpreter without unit tests can be acheived by `make main.native`.

# Running the interpreter

An interpreter reads a file and executes the program.  Consider an example:

```bash
$ echo "2 + 2" | ./main.native /dev/stdin
2 + 2
res: p3 = 4
$ echo "(imap [omega] {[0] <= iv < [omega]: iv.[0]).[42]" > /tmp/x.heh
$ ./main.native /tmp/x.heh
((imap [ω]|[] { [0] <= iv < [ω]: (((iv).([0])))).([42]))
res: p14 = 42
```
The output contains:
  1. the text of a program
  2. the resulting pointer and value of the evaluated program.

The interpreter comes with a few flags, which description is available via `./main/native --help`.

The interpreter comes with a number of examples available in the `examples` directory.

# Testing

The unit tests can be run as follows `./test.native`.

This repository uses travis continuous integration.  See `.travis.yml` file for more details.

# Syntax hilighting

Heh comes with a syntax highlighting description for Vim.
Copy `vim/heh.vim` into `~/.vim/syntax` to make use of it.

license: ISC

repository: ashinkarov/heh

gha_language: OCaml

gha_license_id: ISC

repo_name: ashinkarov/heh


text:
# Git Semantic Commit Aliases

:warning: not well tested, but should cause no big issue :)

> Git semantic commit local aliases installer, based on [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages) article.

 To configure it, you need to add `semanticCommits.scope` strategy to your root `package.json`, i.e.:

```json
{
  "name": "root",
  "version": "1.0.0",
  "semanticCommits": {
    "scope": "package.json"
  }
}
```

There are currently no other strategies available, but "package.json" one. This strategy will look upwards from committing file paths to find related `package.json` files and use their `name` field as scope.

```
├── package.json
└── packages
    ├── first
    │   └── package.json
    └── second
        └── package.json
```

Now, whenever you use the semantic commit aliases this package provides for committing files in this repository, a few patterns will be found:

- `chore: message`: when only files outside packages were changed;
- `chore(first): message`: when only files inside _first_ were changed:
- `chore(first, second): message`: when files in both _first_ and _second_ packages were changed;
- `chore(@root, first): message`: when files in root and inside _first_ packages were changed.

P.s.: you can still override the scope used by setting the `-s` parameter.

## See also

- [git-shared-aliases](https://github.com/lucasconstantino/git-shared-aliases) - Git aliases made available across your team
- [husky](https://github.com/typicode/husky) - Git hooks made easy 🐶 woof!

## License

MIT


text:
# Blazored Modal

A powerful and customizable modal implementation for [Blazor](https://blazor.net) applications.

[![Build Status](https://github.com/Blazored/Modal/workflows/Build%20&%20Test%20Main/badge.svg)](https://github.com/Blazored/Modal/actions?query=workflow%3A%22Build+%26+Test+Main%22)
[![Nuget](https://img.shields.io/nuget/v/blazored.modal.svg)](https://www.nuget.org/packages/Blazored.Modal/)

![Screenshot of the component in action](screenshot.png)

## Getting Setup

You can install the package via the nuget package manager just search for *Blazored.Modal*. You can also install via powershell using the following command.

```powershell
Install-Package Blazored.Modal
```

Or via the dotnet CLI.

```bash
dotnet add package Blazored.Modal
```

#### Internet Explorer 11
This package can be used with Internet Explorer 11, but some special care should to be taken.

- Only Blazor Server works with IE11. Blazor WebAssembly does not work with any IE version. See [this](https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-3.1)
- A [polyfill](https://github.com/Daddoon/Blazor.Polyfill) is necessary for this component to work. See [this](https://github.com/Daddoon/Blazor.Polyfill) page for an explanation on how to install and use it. The sample project for Blazor Server uses the polyfill and thus should work on IE11
- V6.0.1 or higher of `Blazored.Modal` should be used

Taking these things into account, `Blazored.Modal` should work on IE11.

### Please note: When upgrading from v4 to v5 (or higher) you must remove the `<BlazoredModal>` tag from your `MainLayout` component.

### 1. Register Services

**For Blazor Server**: You will need to add the following using statement and add a call to register the Blazored Modal services in your applications `Startup.ConfigureServices` method.

```csharp
using Blazored.Modal;

public void ConfigureServices(IServiceCollection services)
{
    services.AddBlazoredModal();
}
```

**For Blazor WebAssembly**: You will need to add the following using statement and add a call to register the Blazored Modal services in your applications `Program.Main` method.

```csharp
using Blazored.Modal;

public static async Task Main(string[] args)
{
    var builder = WebAssemblyHostBuilder.CreateDefault(args);
    builder.RootComponents.Add<App>("app");

    builder.Services.AddBlazoredModal();

    await builder.Build().RunAsync();
}
```

### 2. Add Imports

Add the following to your *_Imports.razor*

```razor
@using Blazored.Modal
@using Blazored.Modal.Services
```

### 3. Add CascadingBlazoredModal Component around the existing Router component

Add the `<CascadingBlazoredModal />` component into your applications *App.razor*, wrapping the Router as per the example below.

```razor
<CascadingBlazoredModal>
    <Router AppAssembly="typeof(Program).Assembly">
        ...
    </Router>
</CascadingBlazoredModal>
```

### 4. Add reference to style sheet & javascript reference

Add the following line to the `head` tag of your `_Host.cshtml` (Blazor Server) or `index.html` (Blazor WebAssembly).

```html
<link href="_content/Blazored.Modal/blazored-modal.css" rel="stylesheet" />
```

Then add a reference to the Blazored Modal JavaScript file at the bottom of the respective page after the reference to the Blazor file.

```html
<script src="_content/Blazored.Modal/blazored.modal.js"></script>
```

## Usage
Please checkout the [sample projects](https://github.com/Blazored/Modal/tree/main/samples) in this repo to see working examples of the features in the modal.

### Displaying the modal

In order to show a modal, you need to inject the `IModalService` into the component or service you want to invoke the modal. You can then call the `Show` method passing in the title for the modal and the type of the component you want the modal to display.

For example, if I have a component called `Movies` which I want to display in the modal and I want to call it from the `Index` component on a button click.

```razor
@page "/"

<h1>Hello, world!</h1>

Welcome to Blazored Modal.

<button @onclick="@(() => Modal.Show<Movies>("My Movies"))" class="btn btn-primary">View Movies</button>

@code {
    [CascadingParameter] public IModalService Modal { get; set; }
}
```

### Passing Parameters

If you want to pass values to the component you're displaying in the modal, then you can use the `ModalParameters` object. The name you provide must match the name of a parameter defined on the component being displayed.

#### Index Component

```razor
@page "/"

<h1>My Movies</h1>

<ul>
    @foreach (var movie in Movies)
    {
<EMAIL_ADDRESS>(@movie.Year) - <button @onclick="@(() => ShowEditMovie(movie.Id))" class="btn btn-primary">Edit Movie</button></li>
    }
</ul>

@code {

    [CascadingParameter] public IModalService Modal { get; set; }

    List<Movies> Movies { get; set; }

    void ShowEditMovie(int movieId)
    {
        var parameters = new ModalParameters();
        parameters.Add(nameof(EditMovie.MovieId), movieId);

        Modal.Show<EditMovie>("Edit Movie", parameters);
    }

}
```

#### EditMovie Component

```razor
@inject IMovieService MovieService

<div class="simple-form">

    <div class="form-group">
        <label for="movie-name">Movie Name</label>
        <input<EMAIL_ADDRESS>type="text" class="form-control" id="movie-name" />
    </div>

    <div class="form-group">
        <label for="year">Year</label>
        <input<EMAIL_ADDRESS>type="text" class="form-control" id="year" />
    </div>

    <button @onclick="SaveMovie" class="btn btn-primary">Submit</button>
    <button @onclick="ModalInstance.CancelAsync" class="btn btn-secondary">Cancel</button>
</div>

@code {

    [CascadingParameter] BlazoredModalInstance ModalInstance { get; set; }

    [Parameter] public int MovieId { get; set; }

    Movie Movie { get; set; }

    protected override void OnInitialized()
    {
        Movie = MovieService.Load(MovieId);
    }

    void SaveMovie()
    {
        MovieService.Save(Movie);
        ModalInstance.CloseAsync(ModalResult.Ok<Movie>(Movie));
    }

}
```

### Modal Reference

When you open a modal you can capture a reference to it and await the result of that modal. This is useful when you want to perform an action when a modal is closed or cancelled.

```razor
@page "/"

<h1>My Movies</h1>

<button @onclick="ShowModal" class="btn btn-primary">View Movies</button>

@code {

    [CascadingParameter] public IModalService Modal { get; set; }

    async Task ShowModal()
    {
        var moviesModal = Modal.Show<Movies>("My Movies");
        var result = await moviesModal.Result;

        if (result.Cancelled)
        {
            Console.WriteLine("Modal was cancelled");
        }
        else
        {
            Console.WriteLine("Modal was closed");
        }
    }
}
```

### Returning objects back to the calling code

It is common to want to return messages or objects back from a modal to the calling code. This is achieved using the `ModalResult` class.

In the example below, when the form is submitted a `ModalResult.Ok` containing the string "Form was submitted successfully." will be returned back to the calling code. If it is cancelled a `ModalResult.Cancelled` will be returned.

```razor
<div class="simple-form">

    <div class="form-group">
        <label for="first-name">First Name</label>
        <input @bind="FirstName" type="text" class="form-control" id="first-name" placeholder="Enter First Name" />
    </div>

    <div class="form-group">
        <label for="last-name">Last Name</label>
        <input @bind="LastName" type="text" class="form-control" id="last-name" placeholder="Enter Last Name" />
    </div>

    <button @onclick="SubmitForm" class="btn btn-primary">Submit</button>
    <button @onclick="Cancel" class="btn btn-secondary">Cancel</button>
</div>

@code {

    [CascadingParameter] BlazoredModalInstance ModalInstance { get; set; }

    bool ShowForm { get; set; } = true;
    string FirstName { get; set; }
    string LastName { get; set; }
    int FormId { get; set; }

    void SubmitForm()
    {
        ModalInstance.CloseAsync(ModalResult.Ok($"Form was submitted successfully."));
    }

    void Cancel()
    {
        ModalInstance.CancelAsync();
    }

}
```

Below is the caller for the component above. When the result is returned the string set in the `Ok` method can be access via the `Data` property on the `ModalResult`.

```razor
@page "/"

<button @onclick="ShowModal" class="btn btn-primary">View Form</button>

@code {

    [CascadingParameter] public IModalService Modal { get; set; }

    async Task ShowModal()
    {
        var formModal = Modal.Show<SignUpForm>("Please SignUp");
        var result = await formModal.Result;

        if (result.Cancelled)
        {
            Console.WriteLine("Modal was cancelled");
        }
        else
        {
            Console.WriteLine(result.Data);
        }
    }
}
```

The example above is only using a string value but you can also pass complex objects back as well.

### Customizing the modal

The modals can be customized to fit a wide variety of uses. These options can be set globally or changed programatically on a per modal basis.

#### Hiding the close button

A modal has a close button in the top right hand corner by default. The close button can be hidden by using the `HideCloseButton` parameter:

`<CascadingBlazoredModal HideCloseButton="true" />`

Or in the `Modal.Show()` method:

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            HideCloseButton = false
        };

        Modal.Show<Movies>("My Movies", options);
    }
}
```

#### Disabling background click cancellation

You can disable cancelling the modal by clicking on the background using the `DisableBackgroundCancel` parameter.

`<CascadingBlazoredModal DisableBackgroundCancel="true" />`

Or in the `Modal.Show()` method:

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            DisableBackgroundCancel = true
        };

        Modal.Show<Movies>("My Movies", options);
    }
}
```

#### Styling the modal

You can set an alternative CSS class for the modal if you want to customize the look and feel. This is useful when your web application requires different kinds of modals, like a warning, confirmation or an input form.

Use the `Class` parameter to set the custom styling globally:

`<CascadingBlazoredModal Class="custom-modal" />`

Or in the `Modal.Show()` method:

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            Class = "blazored-modal-movies"
        };

        Modal.Show<Movies>("My Movies", options);
    }
}
```

Note that supplying a custom CSS class will remove **all** of the default parameters and values used to display modals, specifically by overwriting the `.blazored-modal` class in `blazored-modal.css` with a class you supply. All default values for layout and background will be lost.

Unexpected behavior may result if certain CSS parameters are not provided to replace the default values, such as:
* `flex-direction: column;` while using a header
    * The modal header and content use a `flexbox`. If you display a header but do not specify that the modal should be a `column`, the header and content will be displayed side-by-side in a row.
* `z-index: 102;`
    * The z-index needs to be greater than the background overlay, otherwise the modal and overlay will be displayed together and you cannot interact with any modal elements, such as forms or buttons. If the overlay click to close is disabled, this will lock the modal open until the page is refreshed.
* `background-color: #fff;` and `border`.
    * If no background color or border is provided, the modal background will be transparent (which may be desired).

#### Setting the position

Modals are shown in the center of the viewport by default. The modal can be shown in different positions if needed.

The following positions are available out of the box: `ModalPosition.Center`, `ModalPosition.TopLeft`, `ModalPosition.TopRight`, `ModalPosition.BottomLeft` and `ModalPosition.BottomRight`.

Use the `Position` parameter to set the position globally:

`<CascadingBlazoredModal Position="ModalPosition.BottomLeft" />`

Or in the `Modal.Show()` method:

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            Position = "ModalPosition.BottomLeft"
        };

        Modal.Show<Movies>("My Movies", options);
    }
}
```

If you need to use a custom position use `ModalPosition.Custom` and set the CSS class to use in `PositionCustomClass`.

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            Position = ModalPosition.Custom
            PositionCustomClass = "custom-position-class";
        };
        Modal.Show<Movies>("My Movies", options);
    }
}
```

#### Animation
The modal also supports some animations.

The following animation types are available out of the box: `ModalAnimation.FadeIn`, `ModalAnimation.FadeOut` and `ModalAnimation.FadeInOut`.

Use the `Animation` parameter to set the custom styling globally:

`<CascadingBlazoredModal Animation="@ModalAnimation.FadeIn(2)"/>`

Or in the `Modal.Show()` method:

```razor
@code {
    void ShowModal()
    {
        var options = new ModalOptions()
        {
            Animation = ModalAnimation.FadeInOut(1)
        };

        Modal.Show<Movies>("My Movies", options);
    }
}
```

### Multiple Modals

It's possible to have multiple active modal instances at a time. You can find a working example of this in the sample projects but here is some sample code.

Below is a component which being displayed inside a Blazored Modal instance. When a user clicks on the _Delete_ button the `Yes` method is invoked and creates a new modal instance.

```razor
<div class="simple-form">
    <div class="form-group">
        Are you sure you want to delete the record?
    </div>

    <button @onclick="Yes" class="btn btn-outline-danger">Delete</button>
    <button @onclick="No" class="btn btn-primary">Cancel</button>
</div>

@code {

    [CascadingParameter] IModalService Modal { get; set; }
    [CascadingParameter] BlazoredModalInstance ModalInstance { get; set; }

    async Task Yes()
    {
        var confirmationModal = ModalService.Show<ConfirmationPrompt>();
        var result = await confirmationModal.Result;

        if (result.Cancelled)
            return;

        ModalInstance.CloseAsync(ModalResult.Ok($"The user said 'Yes'"));
    }

    void No()
    {
        ModalInstance.CloseAsync(ModalResult.Cancel());
    }

}
```

repository: manureini/Modal

branch_name: refs/heads/main

gha_language: C#

repo_name: manureini/Modal


text:
*** THIS IS A FORK OF (https://github.com/mwunsch/handlebars.scala), although it now is NOT actively maintained, apart from an "as I get to it" zero-touch PR->Merge->Release cycle. Happy for anyone to take it over :)  ***

A Scala implementation of [Handlebars](http://handlebarsjs.com/), an extension to and superset of the [Mustache](http://mustache.github.com/) templating language. Currently implements version [1.0.0](https://github.com/wycats/handlebars.js/tree/1.0.0) of the JavaScript version.

This project began as an attempt to learn Scala and to experiment with Scala's [Parser Combinators](http://www.scala-lang.org/api/current/index.html#scala.util.parsing.combinator.Parsers) in an attempt to get handlebars.js templates working in Scala.

## Installation

If you're using SBT you can add this line to your build.sbt file.

~~libraryDependencies += "com.gilt" %% "handlebars-scala" % "2.1.1"~~

    libraryDependencies += "io.github.daviddenton" %% "handlebars-scala-fork" % "2.3.0"

## Usage

Given a template:

    val template = """

Hello, my name is {{name}}. I am from {{hometown}}. I have {{kids.length}} kids:

        {{#kids}}
{{name}} is {{age}}
{{/kids}}

    """

And an arbitrary Scala object:

    object Guy {
      val name = "Alan"
      val hometown = "Somewhere, TX"
      val kids = Seq(Map(
        "name" -> "Jimmy",
        "age" -> "12"
      ), Map(
        "name" -> "Sally",
        "age" -> "4"
      ))
    }

Pass those into Handlebars like so:

    scala> import com.gilt.handlebars.scala.binding.dynamic._
    import com.gilt.handlebars.scala.binding.dynamic._

    scala> import com.gilt.handlebars.scala.Handlebars
    import com.gilt.handlebars.scala.Handlebars

    scala> val t = Handlebars(template)
    t: com.gilt.handlebars.scala.Handlebars = com.gilt.handlebars.scala.Handlebars@496d864e

    scala> t(Guy)
    res0: String =
    "

Hello, my name is Alan. I am from Somewhere, TX. I have 2 kids:

Jimmy is 12

Sally is 4

        "

Handlebars.scala will work just fine for [Mustache](http://mustache.github.com/mustache.5.html) templates, but includes features such as Paths and Helpers.

The example above demonstrates the `apply` method of a `Handlebars` instance, which should be familiar to Scala-fans. `apply` takes additional optional arguments:

+ `data` additional custom data to be referenced by @variable private variables.
+ `partials` custom partials in addition to the globally defined ones. These partials will override the globally provided ones.
+ `helpers` custom helpers in addition to the globally defined ones. These helpers will override the globally provided ones.

The signature for apply looks like this:

    def apply[T](context: T,
          data: Map[String, Binding[T]] = Map.empty,
          partials: Map[String, Handlebars[T]] = Map.empty,
          helpers: Map[String, Helper[T]] = Map.empty): String

## Bindings

In order to facilitate multiple ways of interacting with data, Handlebars provides a data-binding facility. Handlebars ships with a default binding strategy, DynamicBinding, which uses Scala reflection to work with scala standard-library data structures and primitives. You can implement your own Binding strategies by implementing the following traits:

- `com.gilt.handlebars.scala.binding.FullBinding`
- `com.gilt.handlebars.scala.binding.BindingFactory`

Provide the implicit BindingFactory which uses your new binding. If you need an example, see the source code in `binding/dynamic/DynamicBinding.scala`.

### Binding Interface

+ `def get: T` - Retrieve the contents of the binding. Throws runtime exception if in the void.
+ `def getOrElse(default: => T): T` - Get the contents of the binding if full; else is VoidBinding return default
+ `def toOption: Option[T]` - Similar to the Option constructor, returns Some(value) where value is defined
+ `def render: String` - Returns a string representation for the object, returning empty string where value is not defined.
+ `def traverse(key: String, args: List[Binding[T]] = List.empty): Binding[T]` For dictionaries / objects, traverse into named key, returning a binding for the matched value, VoidBinding if key is not declared.

    Important! Take note of the difference here:

    ```scala
    val binding = DynamicBinding(Map("a" -> null))
    binding.traverse("a") // => DynamicBinding(null)
    binding.traverse("b") // => VoidBinding
    ```

+ `def isTruthy: Boolean` - Returns whether the bound value evaluate to truth in handlebars if expressions?
+ `def isCollection: Boolean` - Returns whether the bound value is an iterable (and not a dictionary)
+ `def isDictionary: Boolean` - Returns whether the bound value is a dictionary
+ `def isPrimitive` - Returns whether bound value is neither collection or dictionary

+ `def asOption: Option[Binding[T]]` - If value is defined, returns Some(this), else None
+ `def asCollection: Iterable[Binding[T]]` - Returns List of bindings if isCollection; else empty List
+ `def asDictionaryCollection: Iterable[(String, Binding[T])]` - returns List of key-value tuples if isDictionary; else empty list

### `Unit` vs `null` vs `None` vs `VoidBinding`

In order to preserve the signal of "a value was defined in your model", vs., "you traversed outside the space covered by your model", bindings are monadic and capture whether they've a value from your model or not: a `FullBinding` if bound against a value from your model, a `VoidBinding` is you traversed outside the space of your model.

If the model contained a `null`, `Unit`, or `None`

`isDefined` is `true` if the bound value is within the space of the model, and it evaluates to some value other than . `VoidBinding` is, naturally, never defined, and always returns `isDefined` as `false`.

### Pattern matching value extraction

You can extract the bound value by matching `FullBinding`, like so:

```scala
DynamicBinding(1) match {
  case FullBinding(value) => value
  case VoidBinding => Unit
}
```

## Helpers

The trait for a helper looks like this:

    trait Helper[Any] {
      def apply(binding: Binding[Any], options: HelperOptions[Any]): String
    }

+ `binding` the binding for the model in the context from which the helper was called.
+ `options` provides helper functions to interact with the context and evaluate the body of the helper, if present.

You can define a new helper by extending the trait above, or you can use companion obejct apply method to define one on the fly:

    val fullNameHelper = Helper[Any] {
      (binding, options) =>
        "%s %s".format(options.lookup("firstName").renderString, options.lookup("lastName").renderString)
    }

If you know that the information you need is on `binding`, you can do the same thing by accessing first and last name on the data directly. However, you will be responsible for casting model to the correct type.

    val fullNameHelper = Helper[Any] {
      (binding, options) =>
        val person = binding.get.asInstanceOf[Person]
        "%s %s".format(person.firstName, person.lastName)
    }

### HelperOptions

The `HelperOption[T]` object gives you the tools you need to get things done in your helper. The primary methods are:

+ `def argument(index: Int): Binding[T]` Retrieve an argument from the list provided to the helper by its index.
+ `def data(key: String): Binding[T]` Retrieve data provided to the Handlebars template by its key.
+ `def visit(binding: Binding[T]): String` Evaluates the body of the helper using a context with the provided binding.
+ `def inverse(binding: Binding[T]): String` Evaluate the inverse of body of the helper using the provided model as a context.
+ `def lookup(path: String): Binding[T]` Look up a value for a path in the the current context. The one in which the helper was called.

## Caveats when using DynamicBinding

**Implicit conversions will not work in a template**. Because Handlebars.scala makes heavy use of reflection. Bummer, I know. This leads me too...

**Handlebars.scala makes heavy use of reflection**. This means that there could be unexpected behavior. Method overloading will behave in bizarre ways. There is likely a performance penalty. I'm not sophisticated enough in the arts of the JVM to know the implications of this.

**Not everything from the JavaScript handlebars is supported**. See [NOTSUPPORTED](NOTSUPPORTED.md) for a list of the unsupported features. There are some things JavaScript can do that simply does not make sense to do in Scala.

### Play-Json integration

If you wish for more type-safety, Handlebars-scala comes with integration for play-json. Using PlayJson AST data structures with handlebars provides identical truthy / collection / traversal behavior that you would find using JavaScript values in handlebars-js.

To use:

    libraryDependencies += "com.gilt" %% "handlebars-scala-play-json" % "2.1.1"

[Example / usage](addons/play-json/README.md)

## Thanks

Special thanks to the fine folks working on [Scalate](http://scalate.fusesource.org/) whose Mustache parser was my primary source of inspiration. Tom Dale and Yehuda Katz who inceptioned the idea of writing a Handlebars implementation for the JVM. The UI team at Gilt who insisted on using Handlebars and not Mustache for client-side templating. And finally, the denizens of the Scala 2.9.1 chat room at Gilt for answering my questions with enthusiastic aplomb.

## Build

The project uses [sbt](https://github.com/harrah/xsbt/wiki). Assuming you have sbt you can clone the repo, and run:

    sbt test

[![Build Status](https://secure.travis-ci.org/mwunsch/handlebars.scala.png?branch=master)](http://travis-ci.org/mwunsch/handlebars.scala)

## Copyright and License

Copyright 2014 Mark Wunsch and Gilt Groupe, Inc.

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

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

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

gha_language: Scala


text:
# NebulaGraph Analytics

NebulaGraph Analytics is a high-performance graph computing framework tool that performs graph analysis of data in the NebulaGraph database.

## Prerequisites

- The NebulaGraph Analytics installation package has been obtained. [Contact us](https://www.nebula-graph.io/contact) to apply.

- The [license key](../9.about-license/2.license-management-suite/3.license-manager.md) is loaded.

- The [HDFS](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/ClusterSetup.html) 2.2.x or later has been deployed.

- The JDK 1.8 has been deployed.

## Scenarios

You can import data from data sources as NebulaGraph clusters, CSV files on HDFS, or local CSV files into NebulaGraph Analytics and export the graph computation results to NebulaGraph clusters, CSV files on HDFS, or local CSV files from NebulaGraph Analytics.

## Limitations

When you import NebulaGraph cluster data into NebulaGraph Analytics and export the graph computation results from NebulaGraph Analytics to a NebulaGraph cluster, the graph computation results can only be exported to the graph space where the data source is located.

## Version compatibility

The version correspondence between NebulaGraph Analytics and NebulaGraph is as follows.

|NebulaGraph |NebulaGraph Analytics |
|:---|:---|
|3.5.0| 3.5.0 |
|3.4.0 ~ 3.4.1| 3.5.0、3.4.0 |
|3.3.0      | 3.3.0 |
|3.1.0 ~ 3.2.x| 3.2.0 |
|3.0.x      | 1.0.x |
|2.6.x      | 0.9.0 |

## Graph algorithms

NebulaGraph Analytics supports the following graph algorithms.

|           Algorithm        |Description            |Category        |
|:----------------------|:----------------|:-----------|
|  APSP                 | All Pair Shortest Path      |  Path       |
|  SSSP                 | Single Source Shortest Path      | Path        |
|  BFS                  | Breadth-first search      |  Path       |
| ShortestPath | The shortest path | Path |
|  PageRank             | It is used to rank web pages.          | Node importance measurement   |
|  KCore                | k-Cores              | Node importance measurement   |
|  DegreeCentrality     | It is a simple count of the total number of connections linked to a vertex.           | Node importance measurement   |
|  DegreeWithTime        | Neighbor statistics based on the time range of edge ranks | Node importance measurement  |
| BetweennessCentrality | Intermediate centrality | Node importance measurement|
| ClosenessCentrality    | Closeness centrality   | Node importance measurement|
|  TriangleCount        | It counts the number of triangles.         | Graph feature      |
|  Node2Vec              | Graph neural network        | Graph feature       |
|  Tree_stat             | Tree structure statistics        | Graph feature       |
|  HyperANF              | Estimate the average distance of the graph     | Graph feature      |
| LPA                   | Label Propagation Algorithm          |  Community discovery    |
| WCC                   | Weakly connected component          |  Community discovery    |
| LOUVAIN               | It detects communities in large networks.          |  Community discovery   |
| InfoMap | Community classification | Community discovery |
| HANP                  | Hop attenuation & Node Preference   |  Community discovery    |
| Clustering Coefficient| It is a measure of the degree to which nodes in a graph tend to cluster together.          |  Clustering       |
| Jaccard               | Jaccard similarity | Similarity|

## Install NebulaGraph Analytics

1. Install the NebulaGraph Analytics. When installing a cluster of multiple NebulaGraph Analytics on multiple nodes, you need to install NebulaGraph Analytics to the same path and set up SSH-free login between nodes.

  ```
  sudo rpm -ivh <analytics_package_name> --prefix <install_path>
  sudo chown <user>:<user> -R <install path>
  ```

  For example:

  ```
  sudo rpm -ivh nebula-analytics-{{plato.release}}-centos.x86_64.rpm --prefix=/home/vesoft/nebula-analytics
  sudo chown vesoft:vesoft -R /home/vesoft/nebula-analytics
  ```

2. Configure the correct Hadoop path and JDK path in the file `set_env.sh`, the file path is `nebula-analytics/scripts/set_env.sh`. If there are multiple machines, ensure that the paths are the same.

  !!! note

        The default TCP port range used by the MPICH process manager and MPICH library is 10000 to 10100. To adjust this, modify the value of the environment variable `MPIR_CVAR_CH3_PORT_RANGE` in the `set_env.sh` file.

  ```
  export HADOOP_HOME=<hadoop_path>
  export JAVA_HOME=<java_path>
  ```

3. Configure the `analytics.conf` file with the path `nebula-analytics/scripts/analytics.conf`. Set the value of `license_manager_url` to the host IP and port number `9119` where the license management tool is located, e.g. `<IP_ADDRESS>:9119`.

<!--
### Install NebulaGraph Analytics with the source code

The preparations for compiling NebulaGraph Analytics are similar to compiling NebulaGraph. For details, see [Resource preparations](4.deployment-and-installation/1.resource-preparations.md).

1. Clone the `analytics` repository.

  ```bash
  $ git clone -b {{plato.branch}} https://github.com/vesoft-inc/nebula-analytics.git
  ```

2. Access the `nebula-analytics` directory.

  ```bash
  $ cd nebula-analytics
  ```

3. Execute the following script to install compile dependencies.

  ```bash
  $ sudo ./docker/install-dependencies.sh
  ```

4. Download a static library and compile it.

  ```bash
  $ ./3rdtools.sh distclean && ./3rdtools.sh install
  ```

5. Compile NebulaGraph Analytics.

  ```bash
  $ ./build.sh
  ```
-->

## How to use NebulaGraph Analytics

After installation, you can set parameters of different algorithms and then execute a script to obtain the results of the algorithms and export them to the specified format.

1. Select one node from the NebulaGraph Analytics cluster and then access the `scripts` directory.

  ```bash
  $ cd scripts
  ```

2. Confirm the data source and export path. Configuration steps are as follows.

  - NebulaGraph clusters as the data source

    1. Modify the configuration file `nebula.conf` to configure the NebulaGraph cluster.

      ```bash
      # The number of retries connecting to NebulaGraph.
      --retry=3
      # The name of the graph space where you read or write data.
      --space=baskeyballplayer

      # Read data from NebulaGraph.
      # The name of edges.
      --edges=LIKES
      # The name of the property to be read as the weight of the edge. Can be either the attribute name or _rank.
      #--edge_data_fields
      # The number of rows read per scan.
      --read_batch_size=10000

      # Write data to NebulaGraph.
      # The graphd process address.
      --graph_server_addrs=<IP_ADDRESS>:9669
      # The account to log into NebulaGraph.
      --user=root
      # The password to log into NebulaGraph.
      --password=nebula
      # The pattern used to write data back to NebulaGraph: insert or update.
      --mode=insert
      # The tag name written back to NebulaGraph.
      --tag=pagerank
      # The property name corresponding to the tag.
      --prop=pr
      # The property type corresponding the the tag.
      --type=double
      # The number of rows per write.
      --write_batch_size=1000
      # The file path where the data failed to be written back to NebulaGraph is stored.
      --err_file=/home/xxx/analytics/err.txt

      # other
      # The access timeout period of the service.
      --graphd_timeout=60000
      --metad_timeout=60000
      --storaged_timeout=60000
      ```

    2. Modify the related parameters in the script to be used, such as `run_pagerank.sh`.

      ```bash
      # The sum of the number of processes running on all machines in the cluster. It is recommended to be the number of machines or the number of nodes in the NUMA architecture.
      WNUM=3
      # The number of threads per process. It is recommended to set the maximum value to be the number of hardware threads of the machine.
      WCORES=4
      # The path to the data source.
      # Set to read data from NebulaGraph via the nebula.conf file.
      INPUT=${INPUT:="nebula:$PROJECT/scripts/nebula.conf"}
      # Set to read data from the CSV files on HDFS or on local directories.
      # #INPUT=${INPUT:="$PROJECT/data/graph/v100_e2150_ua_c3.csv"}

      # The export path to the graph computation results.
      # Data can be exported to a NebulaGraph. If the data source is also a NebulaGraph, the results will be exported to the graph space specified in nebula.conf.
      OUTPUT=${OUTPUT:="nebula:$PROJECT/scripts/nebula.conf"}
      # Data can also be exported to the CSV files on HDFS or on local directories.
      # OUTPUT=${OUTPUT:='hdfs://<IP_ADDRESS>:9000/_test/output'}

      # If the value is true, it is a directed graph, if false, it is an undirected graph.
      IS_DIRECTED=${IS_DIRECTED:=true}
      # Set whether to encode ID or not.
      NEED_ENCODE=${NEED_ENCODE:=true}
      # The ID type of the data source vertices. For example string, int32, and int64.
      VTYPE=${VTYPE:=int32}
      # Encoding type. The value distributed specifies the distributed vertex ID encoding. The value single specifies the single-machine vertex ID encoding.
      ENCODER=${ENCODER:="distributed"}
      # The parameter for the PageRank algorithm. Algorithms differ in parameters.
      EPS=${EPS:=0.0001}
      DAMPING=${DAMPING:=0.85}
      # The number of iterations.
      ITERATIONS=${ITERATIONS:=100}
      ```

  - Local or HDFS CSV files as the data source

    Modify parameters in the script to be used, such as `run_pagerank.sh`.

    ```bash
    # The sum of the number of processes running on all machines in the cluster. It is recommended to be the number of machines or the number of nodes in the NUMA architecture.
    WNUM=3
    # The number of threads per process. It is recommended to set the maximum value to be the number of hardware threads of the machine.
    WCORES=4
    # The path to the data source.
    # Set to read data from NebulaGraph via the nebula.conf file.
    # INPUT=${INPUT:="nebula:$PROJECT/scripts/nebula.conf"}
    # Set to read data from the CSV files on HDFS or on local directories.
    INPUT=${INPUT:="$PROJECT/data/graph/v100_e2150_ua_c3.csv"}

    # The export path to the graph computation results.
    # Data can be exported to a NebulaGraph. If the data source is also a NebulaGraph, the results will be exported to the graph space specified in nebula.conf.
    # OUTPUT=${OUTPUT:="nebula:$PROJECT/scripts/nebula.conf"}
    # Data can also be exported to the CSV files on HDFS or on local directories.
    OUTPUT=${OUTPUT:='hdfs://<IP_ADDRESS>:9000/_test/output'}

    # If the value is true, it is a directed graph, if false, it is an undirected graph.
    IS_DIRECTED=${IS_DIRECTED:=true}
    # Set whether to encode ID or not.
    NEED_ENCODE=${NEED_ENCODE:=true}
    # The ID type of the data source vertices. For example string, int32, and int64.
    VTYPE=${VTYPE:=int32}
    # The value distributed specifies the distributed vertex ID encoding. The value single specifies the single-machine vertex ID encoding.
    ENCODER=${ENCODER:="distributed"}
    # The parameter for the PageRank algorithm. Algorithms differ in parameters.
    EPS=${EPS:=0.0001}
    DAMPING=${DAMPING:=0.85}
    # The number of iterations.
    ITERATIONS=${ITERATIONS:=100}
    ```

3. Modify the configuration file `cluster` to set the NebulaGraph Analytics cluster nodes and task assignment weights for executing the algorithm.

  ```bash
  # NebulaGraph Analytics Cluster Node IP Addresses: Task Assignment Weights
  <IP_ADDRESS>:1
  <IP_ADDRESS>:1
  <IP_ADDRESS>:1
  ```

4. Run the algorithm script. For example:

  ```bash
  ./run_pagerank.sh
  ```

5. View the graph computation results in the export path.

  - For exporting to a NebulaGraph cluster, check the results according to the settings in `nebula.conf`.

  - For exporting the results to the CSV files on HDFS or on local directories, check the results according to the settings in `OUTPUT`, which is a compressed file in the `.gz` format.

repository: vesoft-inc/nebula-docs

gha_language: HTML

repo_name: vesoft-inc/nebula-docs


text:
App Enlight PHP Client
======================

IMPORTANT: This library is under development. You can use it for productive application on your own risk!

PHP Client for AppEnlight (previously known as Errormator).

App Enlight main goal is to monitor your application. This API client for PHP provides an easy to use interface to send to App Enlight:
- logs;
- error reports;
- slow requests (with metrics).

Requirements
============
- PHP 5.3.2+ with cURL extension available;
- OpenSSL Support for HTTPS curl requests (if you would like to use http, this is not required);
- (optional) enabled mod_unique_id model in httpd.conf http://httpd.apache.org/docs/2.2/mod/mod_unique_id.html;

Installation
============
To install this API in your application copy all folders to a location accessible by your application.
Then whenever you want to use the App Enlight PHP client you should use the namespace:

```php
use AppEnlight;
```

Framework integrations
======================
You can use this PHP client in any PHP application but it will require from you a little effort to integrate the client with your application.
If you are using [Yii framework](http://yiiframework.com/)you are really lucky guy :) This PHP client is delivered with extension allowing to use client within Yii Framework with minimal effort.
If you like to add support for other frameworks, please feel free to contact me.

Pass your application API key
=============================
The most important, before you initialize client, is to pass your private API key generated in App Enlight dashboard for your application. If you like, you can set the other settings to according to your needs.
Note that you can ommit other settings and client will still work. Below example shows all available settings

```php
    $settings = new \AppEnlight\Settings();
    $settings->setApiKey('123APIKEY');
    $settings->setClient('php');
    $settings->setScheme('https');
    $settings->setUrl('api.appenlight.com/api');
    $settings->setVersion('0.5');
    return $settings;
```

Create client
=============
Once settings are defined, you can pass them to client.

```php
$client = new \AppEnlight\Client($settings);
```

Send log data
=============
Once the client is created you need to decide what kind of information you would like to send. You can choose from two endpoints:
- log,
- reports.

First is very simple and is used to store logs comming from your application.

```php
    use \AppEnlight\Endpoint\Logs;
    use \AppEnlight\Endpoint\Data\Log;

    $uuid = $client->getUUID();

    /* add just 1 log */
    $aeLog = new Log();
    $aeLog->setMessage("Test message");
    $aeLog->setLogLevel('error');
    $aeLog->setNamespace('application.site.signin');
    $aeLog->setDate('2014-07-21T00:15:38.955371');
    $aeLog->setRequestId($uuid);
    $aeLog->setServer('localhost');
    $client->addLog($aeLog);
    $client->setEndpoint($aeLogs);
```

Send repot data
===============
You can send multiple reports within one request. Each report may consist different set of data. You can send information about slow calls including traceback, error information, etc.

Below example shows how to send simple report

```php
    use \AppEnlight;
    use \AppEnlight\Endpoint;
    use \AppEnlight\Endpoint\Data;
    use \AppEnlight\Endpoint\Data\Report;

    //get client
    $client = new Client($settings);

    //prepare report detail data
    $report = new Report();
    $report->setUsername('test user');
    $report->setUrl('http://localhost');
    $report->setIp('<IP_ADDRESS>');
    $report->setUserAgent('Chrome');
    $report->setMessage('Very serious error');
    $report->setRequestId($client->getUUID());
    $report->setRequestStats(new RequestStats());

    //analyse trace returned by exception
    $trace = $exception->getTrace();
    foreach($trace as $t) {
      $aeTrace = new Traceback();
      $aeTrace->setFile(isset($t['file']) ? $t['file'] : 'unknown');
      $aeTrace->setFn(isset($t['class']) ? "{$t['class']}->{$t['function']}" : $t['function']);
      $aeTrace->setLine(isset($t['line']) ? $t['line'] : 0);
      $reportDetail->addTraceback($aeTrace);
    }

    $report->setRequest(new Request(););

    $report->setError('Very dangerouse error');
    $report->setHttpStatus(500);

    $client->addReport($report);
    $client->send();
```

Update from version 0.4 to 0.5
==============================
Note that API in version 0.5 has been changed comparing to version 0.4.
Briefly, report grouping has been changed and since version 0.5 content of report_details became part of single report.
For more details compare documentation Reports endpoint for version [0.4](https://appenlight.com/page/api/0.5/reports) with [0.5](https://appenlight.com/page/api/0.5/reports)

Integration with Laravel5
=========================
- Run `php artisan vendor:publish --provider="AppEnlight\Laravel\ServiceProvider"` to publish config (`config/app-enlight.php`)
- Add `AppEnlight\Laravel\ServiceProvider` to your providers array in `config/app.php`
- Add 2 lines in `App\Exceptions\Handler` to `report` function
```php
    //Send error report to AppEnlight
    global $app;
    $app->make('AppEnlight\Laravel\ErrorHandler', $e);
```

the final function should look like this:
```php
    public function report(Exception $e)
    {
        //Send error report to AppEnlight
        global $app;
        $app->make('AppEnlight\Laravel\ErrorHandler', $e);

        return parent::report($e);
    }
```

Todo
====
- add documentation how to use extension in Yii;

repository: dark-cms/app-enlight-php-client

repo_name: dark-cms/app-enlight-php-client


text:
# gke-node-termination-handler

[gke-node-termination-handler](https://github.com/GoogleCloudPlatform/k8s-node-termination-handler)
is a tool for gracefully draining preemptible GCP nodes before Google automatically shuts them down.

## Installation
We recommend installing gke-node-termination-handler in its own namespace.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| image.repository | string | `"k8s.gcr.io/gke-node-termination-handler@sha256"` | The image repository to pull from |
| image.tag | string | `"aca12d17b222dfed755e28a44d92721e477915fb73211d0a0f8925a1fa847cca"` | The image tag to use |
| image.pullPolicy | string | `"Always"` | The image pull policy. We recommend not changing this |
| nameOverride | string | `""` | A template override for name |
| fullnameOverride | string | `""` | A template override for fullname |
| daemonset.updateStrategy.type | string | `"RollingUpdate"` | The daemonset update strategy |
| resources | object | `{"limits":{"cpu":"150m","memory":"30Mi"},"requests":{"cpu":"150m","memory":"30Mi"}}` | A resource limit and requess block for the daemonset |


text:
# CountryProfileCliGem

The country_profile_cli_gem allows you to extract a number of key indicators for a country in order to display a country profile containing key broad indicators including for instance, population, gdp, gdp growth, etc.
Once the gem installed and running, you can choose to display the list of countries which are available, you can retrieve indicators for a specific country or zone (eg. European Union) by typing the name of the desired country (please make sure you type the name as it is showed in the list of countries) or exit the program.
If you choose to display the profile of a country, you can then, for this same country, obtain a history of a specific indicator over a period of time up to 40 years back in time. To display the historical value of a specific indicator, select the desired indicator by providing its number (range from 1 to 9 as indicated in the country profile) and indicate over how many years back in time you would want to go back. This will display the evolution of this specific indicator over the period of time you chose. Once displayed, you can either choose to display the evolution of a new indicator over a new period of time or you can exit to come back to the main menu.

All data and information are sourced from the World Bank database.
All data showed for country profile are dated 2014.
2014 are the most up to date data available for now.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'country_profile_cli_gem'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install country_profile_cli_gem

## Usage

Run: country_profile after installing the gem

## Development

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

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

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/country_profile_cli_gem.

## License

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

## Contact
<EMAIL_ADDRESS>


text:
# Introduction to the FormState API

The introductory walkthrough made a rough equivalence between this code:

```jsx
constructor(props) {
  super(props);

  // initialize default values
  this.state = {model: {name: '', country: 'USA'}};
}

render() {
  if (this.state.model.country === 'USA') {
    // this block of code would run upon initial render
  }
  return (
    <form ...>
      <input value={this.state.model.name} .../>
      <input value={this.state.model.country} .../>
      <input type='submit' value='Submit'/>
    </form>
  );
}
```

and this code:

```jsx
constructor(props) {
  super(props);
  this.formState = FormState.create(this);
  this.state = {};
}

render() {
  if (this.formState.get('country') === 'USA') {
    // this block of code WOULD NOT run upon initial render
  }
  return (
    <Form formState={this.formState} ...>
      <RfsInput formField='name'/>
      <RfsInput formField='country' defaultValue='USA'/>
      <input type='submit' value='Submit'/>
    </Form>
  );
}
```

However, in a more general sense, this is the equivalent code:

```jsx
constructor(props) {
  super(props);
  this.formState = FormState.create(this);
  this.state = this.formState.injectModel({name: '', country: 'USA'});
}

render() {
  if (this.formState.get('country') === 'USA') {
    // this block of code would run upon initial render
  }
  return (
    <Form formState={this.formState} ...>
      <RfsInput formField='name'/>
      <RfsInput formField='country'/>
      <input type='submit' value='Submit'/>
    </Form>
  );
}
```

### Understanding default values

In react-formstate, a default value is used to supply a value to an input only if the value for the corresponding field is undefined in your component state. The default value itself is **not** stored in component state. It is a static property provided to the input element.

Default values are syntactic sugar that serve a limited purpose. They are an expressive way to initialize a form input only when you don't have any conditional logic in the render function based on the value of that input. In fairness, this is often the case.

## Initializing form state

It is generally more flexible and powerful to inject the initial form model directly into your state. If a user is editing or updating a form, this is surely the case:

```es6
constructor(props) {
  super(props);
  this.formState = FormState.create(this);
  // the model to edit is supplied in props.model
  this.state = this.formState.injectModel(props.model);
}
```

'injectField' can also be used to inject initial values:

```es6
constructor(props) {
  super(props);
  this.formState = FormState.create(this);
  this.state = this.formState.injectModel(props.model);

  // If we are using the same form for CRUD 'creates' and 'updates',
  // and if in 'create' mode, props.model is null or undefined,
  // and if we have to do something dynamic during render based on country,
  // we can initialize a default value for country using the 'injectField' method.
  if (!this.formState.get('country')) {
    this.formState.injectField(this.state, 'country', 'USA');

    // The 'injectField' method can inject both primitive types and objects.
    // The main difference between using injectField and injectModel
    // is whether you are injecting your root form model,
    // or a specific field within that model.
    this.formState.injectField(this.state, 'favoriteFormPackage', {name: 'react-formstate', foundedIn: 2016});
  }
}
```

If necessary, you can initialize form state outside of your constructor:

```es6
constructor(props) {
  super(props);
  this.formState = FormState.create(this);
  this.state = {};
}
componentDidMount() {
  getModel().then((model) => {
    // this is a sneak peek at the UnitOfWork API
    // it is properly introduced later
    const context = this.formState.createUnitOfWork();
    context.injectModel(model);
    context.injectField('isInitialized1', true);
    // alternatively you can set this flag directly in your state object
    context.updateFormState({isInitialized2: true});
  });
}
```

FormState is a simple wrapper around initializing and reading this.state. It transforms the data into, and out of, a format useful to react-formstate. You can, of course, still use your component's state object directly if you want:

```es6
render() {
  // Continuing the example above, whether these are true depends
  // on whether the promise in ComponentDidMount is fulfilled.
  if (this.state.isInitialized2 || this.formState.get('isInitialized1')) {
    // ...
  }
}
```

## Model output depends on rendered inputs

The above example shows that it is arbitrary whether you want to manipulate certain aspects of form state directly in component state, or whether you want to work through the FormState API. Which is easiest may depend on the particular situation.

The reason why this is arbitrary is important to understand. If you supply this model:

```es6
{
  name: 'Huckle',
  city: 'Busytown'
}
```

to this form:

```jsx
import React, { Component } from 'react';
import { FormState, Form } from 'react-formstate';

export default class SimpleRfsForm extends Component {

  constructor(props) {
    super(props);
    this.formState = FormState.create(this);
    this.state = this.formState.injectModel(props.model);
  }

  render() {
    return (
      <Form formState={this.formState} onSubmit={e => this.handleSubmit(e)}>
        <RfsInput formField='name' label='Name' required/>
        <input type='submit' value='Submit'/>
      </Form>
    );
  }

  handleSubmit(e) {
    e.preventDefault();
    const model = this.formState.createUnitOfWork().createModel();
    if (model) {
      alert(JSON.stringify(model));
    }
  }
}
```

and if you immediately submit the form, the output in the alert window will be:

```es6
{name: 'Huckle'}
```

The 'city' field is not included in the resulting model.

This is because the schema of the model produced by the submit handler depends on the inputs actually rendered in the JSX, **not** on the collection of values stored in your form state.

(This means you should be familiar with HTML hidden inputs)

```jsx
const HiddenInput = ({fieldState}) => {
  return (
    <input type='hidden' value={fieldState.getValue()}/>
  );
}
```

```jsx
<HiddenInput formField='id' defaultValue='0' intConvert/>
```

## The underlying representation

Injecting this model:

```es6
{
  name: 'Huckle',
  age: 3,
  contacts: [
    {
      email<EMAIL_ADDRESS>      address: {
        city: 'Busytown',
        line2: null
      }
    }
  ],
  roleIds: [1,2,3]
}
```

flattens the data and returns this state object:

```es6
this.state = {
  'formState.name': { value: 'Huckle' },
  'formState.age': { value: 8 }, // <--- can be coerced to '8'
  'formState.contacts.0.email': { value<EMAIL_ADDRESS>},
  'formState.contacts.0.address.city': { value: 'Busytown' },
  'formState.contacts.0.address.line2': { value: null }, // <--- can be coerced to ''
  'formState.roleIds': { value: [1,2,3] } // for providing to a multi-select
  // some extraneous fields omitted
};
```

Note that, since react-formstate cannot know how your model will be used, it may inject extra fields:

```es6
  // These fields, for example, will go unused.
  // Remember, model output depends on the inputs actually rendered.
  'formState.roleIds.0': { value: 1 },
  'formState.roleIds.1': { value: 2 },
  'formState.roleIds.2': { value: 3 }
```

## Querying form state

You can use accessor methods to read whatever you want from your "form state".

To keep HTML inputs happy, values are typically coerced to strings upon retrieval, but you have a choice in the matter:

```es6
render() {
  this.formState.get('age') === '8'; // true
  this.formState.getu('age') === 8;  // true

  this.formState.get('contacts.0.address.line2') === '';    // true
  this.formState.getu('contacts.0.address.line2') === null; // true

  this.formState.get('notInState') === '';         // true
  this.formState.getu('notInState') === undefined;      // true

  this.formState.get('formState.roleIds'); // returns ['1','2','3']
  this.formState.getu('formState.roleIds'); // returns [1,2,3]
}
```

(If you want to jump ahead and learn more about string coercion in react-formstate, this [example](/docs/datePickerExample.md) is informative.)

There are several other helper methods to read from form state that will be covered later. We have already seen at least one in the course of the examples:

```jsx
<input type='submit' value='Submit' disabled={this.formState.isInvalid()}/>
```

We have discussed initializing and accessing form state with the FormState API. The [next step](updatingFormState.md) in the walkthrough is to learn how to *update* form state.

repository: dtrelogan/react-formstate

repo_name: dtrelogan/react-formstate


text:
>  Javascript Basics and Testing Workshop taught by Plainconcepts 👨🏻💻

## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:4000
npm start

For a detailed explanation on how things work, check out the [repo](https://github.com/CKGrafico/Frontend-Boilerplates) and [docs](https://boilerplates.js.org/).

repository: marioballe/workshop-javascript-testing

repo_name: marioballe/workshop-javascript-testing