text:
+++
date = "2015-03-17T15:36:56Z"
title = "Quick Start"
draft = true
[menu.main]
  parent = "MongoDB Driver"
  identifier = "Sync Quick Start"
  weight = 10
  pre = "<i class='fa'></i>"
+++

# MongoDB Driver Quick Start

{{% note %}}
The following code snippets come from the [`QuickTour.java`]({{< srcref "driver/src/examples/tour/QuickTour.java">}}) example code
that can be found with the driver source on github.
{{% /note %}}

## Prerequisites

- A running MongoDB on localhost using the default port for MongoDB `27017`

- MongoDB Driver.  See [Installation]({{< relref "driver/getting-started/installation.md" >}}) for instructions on how to install the MongoDB driver.

- The following import statements:

```java
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.ServerAddress;

import com.mongodb.client.MongoDatabase;
import com.mongodb.client.MongoCollection;

import org.bson.Document;

import com.mongodb.client.MongoCursor;
import static com.mongodb.client.model.Filters.*;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import java.util.ArrayList;
import java.util.List;
```
## Make a Connection

Use [`MongoClient()`]({{< apiref "com/mongodb/MongoClient.html">}}) to make a connection to a running MongoDB instance.

The `MongoClient` instance represents a pool of connections to the database; you will only need one instance of class `MongoClient` even with multiple threads.

{{% note class="important" %}}

 Typically you only create one `MongoClient` instance for a given MongoDB deployment (e.g. standalone, replica set, or a sharded cluster) and use it across your application. However, if you do create multiple instances:

 - All resource usage limits (e.g. max connections, etc.) apply per `MongoClient` instance.

 - To dispose of an instance, call `MongoClient.close()` to clean up resources.
{{% /note %}}

### Connect to a Single MongoDB instance

The following example shows five ways to connect to the
database `mydb` on the local machine. If the database does not exist, MongoDB
will create it for you.

To connect to a single MongoDB instance:

- You can instantiate a MongoClient object without any parameters to connect to a MongoDB instance running on localhost on port ``27017``:

```java
MongoClient mongoClient = new MongoClient();
```

- You can explicitly specify the hostname to connect to a MongoDB instance running on the specified host on port ``27017``:

```java
MongoClient mongoClient = new MongoClient( "localhost" );
```

- You can explicitly specify the hostname and the port:

```java
MongoClient mongoClient = new MongoClient( "localhost" , 27017 );
```

- You can specify the
[`MongoClientURI`]({{< apiref "/com/mongodb/MongoClientURI.html">}}) connection string:

```java
 MongoClientURI connectionString = new MongoClientURI("mongodb://localhost:27017");
 MongoClient mongoClient = new MongoClient(connectionString);
```

The connection string mostly follows [RFC 3986](http://tools.ietf.org/html/rfc3986), with the exception of the domain name. For MongoDB, it is possible to list multiple domain names separated by a comma. For more information on the connection string, see [connection string]({{< docsref "reference/connection-string" >}}).

## Access a Database

Once you have a ``MongoClient`` instance connected to a MongoDB deployment, use the [`MongoClient.getDatabase()`]({{<apiref "com/mongodb/MongoClient.html#getDatabase-java.lang.String-">}}) method to access a database.

Specify the name of the database to the ``getDatabase()`` method. If a database does not exist, MongoDB creates the database when you first store data for that database.

The following example accesses the ``mydb`` database:

```java
 MongoDatabase database = mongoClient.getDatabase("mydb");
 ```

`MongoDatabase` instances are immutable.

## Access a Collection

Once you have a `MongoDatabase` instance, use its [`getCollection()`]({{< apiref "com/mongodb/client/MongoDatabase.html#getCollection-java.lang.String-">}})
method to access a collection.

Specify the name of the collection to the `getCollection()` method. If a collection does not exist, MongoDB creates the collection when you first store data for that collection.

For example, using the `database` instance, the following statement accesses the collection named `test` in the `mydb` database:

```java
MongoCollection<Document> collection = database.getCollection("test");
```

`MongoCollection` instances are immutable.

## Create a Document

To create the document using the Java driver, use the [`Document`]({{< apiref "org/bson/Document.html" >}}) class.

For example, consider the following JSON document:

```javascript

  {
   "name" : "MongoDB",
   "type" : "database",
   "count" : 1,
   "versions": [ "v3.2", "v3.0", "v2.6" ],
   "info" : { x : 203, y : 102 }
  }
```

To create the document using the Java driver, instantiate a `Document` object with a field and value, and use its
 [`append()`]({{< apiref "org/bson/Document.html#append" >}}) method to include additional fields and values to the document object. The value can be another `Document` object to specify an embedded document:

 ```java
 Document doc = new Document("name", "MongoDB")
                .append("type", "database")
                .append("count", 1)
                .append("versions", Arrays.asList("v3.2", "v3.0", "v2.6"))
                .append("info", new Document("x", 203).append("y", 102));
 ```

{{% note %}}
The BSON type of array corresponds to the Java type `java.util.List`. For a list of the BSON type and the corresponding type in Java, see .
{{% /note %}}

## Insert a Document

Once you have the `MongoCollection` object, you can insert documents into the
collection.

### Insert One Document

To insert a single document into the collection, you can use the collection's [`insertOne()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertOne-TDocument-" >}}) method.

```java
collection.insertOne(doc);
```

{{% note %}}
If no top-level `_id` field is specified in the document, MongoDB automatically adds the `_id` field to the inserted document.
{{% /note %}}

## Add Multiple Documents

To add multiple documents, you can use the collection's [`insertMany()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertMany-java.util.List-" >}}) method method which takes a list of documents to insert.

The following example will add multiple documents of the form:

```javascript
{ "i" : value }
```

Create the documents in a loop and add to the `documents` list:

```java
List<Document> documents = new ArrayList<Document>();
for (int i = 0; i < 100; i++) {
    documents.add(new Document("i", i));
}
```

To insert these documents to the collection, pass the list of documents to the
[`insertMany()`]({{< apiref "com/mongodb/client/MongoCollection.html#insertMany-java.util.List-" >}}) method.

```java
collection.insertMany(documents);
```
{{% note %}}
If no top-level `_id` field is specified in the document, MongoDB automatically adds the `_id` field to the inserted document.
{{% /note %}}

## Count Documents in A Collection

To count the number of documents in a collection, you can use the collection's [`count()`]({{< apiref "com/mongodb/client/MongoCollection#count--">}})
method.  The following code should print `101` (the 100 inserted via `insertMany` plus the 1 inserted via the `insertOne`).

```java
System.out.println(collection.count());
```

## Query the Collection

To query the collection, you can use the collection's [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method. You can call the method without any arguments to query all documents in a collection or pass a filter to query for documents that match the filter criteria.

The [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method returns a [`FindIterable()`]({{< apiref "com/mongodb/client/FindIterable.html" >}}) instance that provides a fluent interface for chaining other methods.

### Find the First Document in a Collection

To return the first document in the collection, use the [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method without any parameters and chain to `find()` method the [`first()`] ({{< apiref "com/mongodb/client/MongoIterable.html#first--">}}) method.

If the `FindIterable` object returned by the `find()` method is empty, the operation returns null.

{{% note class="tip" %}}
The `find().first()` construct is useful for queries that should only match a single document or if you are interested in the first document only.
{{% /note %}}

The following example prints the first document found in the collection.

```java
Document myDoc = collection.find().first();
System.out.println(myDoc.toJson());
```

The example should print the following document:

```json
{ "_id" : { "$oid" : "551582c558c7b4fbacf16735" },
  "name" : "MongoDB",
  "type" : "database",
  "count" : 1,
  "info" : { "x" : 203, "y" : 102 } }
```

{{% note %}}

The `_id` element has been added automatically by MongoDB to your
document and your value will differ from that shown. MongoDB reserves field
names that start with
`"_"` and `"$"` for internal use.
{{% /note %}}

### Find All Documents in a Collection

To retrieve all the documents in the collection, we will use the
`find()` method without any parameters.

To iterate through the results, chain the
[`iterator()`]({{< apiref "com/mongodb/client/MongoIterable.html#iterator--" >}}) method to the `find()`.

The following example retrieves all documents in the collection
and prints the returned documents (101 documents):

```java
MongoCursor<Document> cursor = collection.find().iterator();
try {
    while (cursor.hasNext()) {
        System.out.println(cursor.next().toJson());
    }
} finally {
    cursor.close();
}
```

Although the following idiom for iteration is permissible, avoid its use as the application can leak a cursor if the loop terminates early:

```java
for (Document cur : collection.find()) {
    System.out.println(cur.toJson());
}
```

## Specify a Query Filter

To to query for documents that match certain conditions, pass a filter object to the [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}}) method. To facilitate creating filter objects, Java driver provides the [`Filters`]({{< apiref "com/mongodb/client/model/Filters.html">}}) helper.

### Get A Single Document That Matches a Filter

For example, to find the first document where the field ``i`` has the value `71`, pass an [`eq`]({{<apiref  "com/mongodb/client/model/Filters.html#eq-java.lang.String-TItem-">}}) filter object to specify the equality condition:

```java
myDoc = collection.find(eq("i", 71)).first();
System.out.println(myDoc.toJson());
```
The example prints one document:

```json
{ "_id" : { "$oid" : "5515836e58c7b4fbc756320b" }, "i" : 71 }
```

### Get All Documents That Match a Filter

The following example returns and prints all documents where ``"i" > 50``:

```java
Block<Document> printBlock = new Block<Document>() {
     @Override
     public void apply(final Document document) {
         System.out.println(document.toJson());
     }
};

collection.find(gt("i", 50)).forEach(printBlock);
```

The example uses the [`forEach`]({{ <apiref "com/mongodb/client/MongoIterable.html#forEach-com.mongodb.Block-">}}) method on the ``FindIterable`` object to apply a block to each document.

To specify a filter for a range, such as ``50 < i <= 100``, you can use the [`and`]({{<apiref "com/mongodb/client/model/Filters.html#and-org.bson.conversions.Bson...-">}}) helper:

```java
collection.find(and(gt("i", 50), lte("i", 100))).forEach(printBlock);
```

## Update Documents

To update documents in a collection, you can use the collection's [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne-org.bson.conversions.Bson-org.bson.conversions.Bson-">}})  and  [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) methods.

Pass to the methods:

- A filter object to determine the document or documents to update. To facilitate creating filter objects, Java driver provides the [`Filters`]({{< apiref "com/mongodb/client/model/Filters.html">}}) helper. To specify an empty filter (i.e. match all documents in a collection), use an empty [`Document`]({{< apiref "org/bson/Document.html" >}}) object.

- An update document that specifies the modifications. For a list of the available operators, see [update operators]({{<docsref "reference/operator/update-field">}}).

```java
new Document( <field1>, <value1> ).append(<field2>, <value2>) ...
```

The update methods return an [`UpdateResult`]({{<apiref "com/mongodb/client/result/UpdateResult.html">}}) which provides information about the operation including the number of documents modified by the update.

###Update a Single Document

To update at most a single document, use the [`updateOne`]({{<apiref "com/mongodb/client/MongoCollection.html#updateOne-org.bson.conversions.Bson-org.bson.conversions.Bson-">}})

The following example updates the first document that meets the filter ``i`` equals ``10`` and set the value of ``i`` to ``110``:

```java
collection.updateOne(eq("i", 10), new Document("$set", new Document("i", 110)));
```

### Update Multiple Documents

To update all documents matching the filter, use the [`updateMany`]({{<apiref "com/mongodb/async/client/MongoCollection.html#updateMany-org.bson.conversions.Bson-org.bson.conversions.Bson-">}}) method.

The following example increments the value of ``i`` by ``100`` where ``i`` is less than ``100``:

```java
UpdateResult updateResult = collection.updateMany(lt("i", 100), inc("i", 100));
System.out.println(updateResult.getModifiedCount());

UpdateResult updateResult = collection.updateMany(lt("i", 100), new Document("$inc", new Document("i", 100))); System.out.println(updateResult.getModifiedCount());

```

## Delete Documents

To delete documents from a collection, you can use the collection's [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne-org.bson.conversions.Bson-">}}) and [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) methods.

Pass to the methods a filter object to determine the document or documents to delete. To facilitate creating filter objects, Java driver provides the [`Filters`]({{< apiref "com/mongodb/client/model/Filters.html">}}) helper. To specify an empty filter (i.e. match all documents in a collection), use an empty [`Document`]({{< apiref "org/bson/Document.html" >}}) object.

The delete methods return a [`DeleteResult`]({{< apiref "com/mongodb/client/result/DeleteResult.html">}})
which provides information about the operation including the number of documents deleted.

### Delete a Single Document

To delete at most a single document that match the filter, use the [`deleteOne`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteOne-org.bson.conversions.Bson-">}}) method:

The following example deletes at most one document that meets the filter ``i`` equals ``110``:

```java
collection.deleteOne(eq("i", 110));
```

### Delete All Documents That Match the Filter

To delete all documents matching the filter use the [`deleteMany`]({{< apiref "com/mongodb/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) method.

The following example deletes all documents where ``i`` is greater or equal to ``100``:

```java
DeleteResult deleteResult = collection.deleteMany(gte("i", 100));
System.out.println(deleteResult.getDeletedCount());
```

## Create Indexes

To create an index on a field or fields, pass an index specification document to the [`createIndex()`]({{<apiref "com/mongodb/client/MongoCollection.html#createIndex-org.bson.conversions.Bson-">}}) method. An index key specification document contains the fields to index and the index type for each field:

```java
 new Document(<field1>, <type1>).append(<field2>, <type2>) ...
```

- For an ascending index type, specify ``1`` for ``<type>``.
- For a descending index type, specify ``-1`` for ``<type>``.

The following example creates an ascending index on the ``i`` field:

```java
 collection.createIndex(new Document("i", 1));
```

For a list of other index types, see [Create Indexes]({{< ref "driver/tutorials/indexes.md" >}})

### Additional Information

For additional tutorials (such as to use the aggregation framework, specify write concern, etc.), see [Java Driver Tutorials]({{< ref "driver/tutorials/index.md" >}})

repository: trishagee/mongo-java-driver

repo_name: trishagee/mongo-java-driver


text:
# Overview

These results accompany **Monks and Harper (2023). Model and code sharing practices in healthcare discrete-event simulation: a systematic scoping review**

> An early version of these results was presented at the WSC2022 conference for the panel on **Grand Challenges in Healthcare Simulation**.  Thanks goes to Prof Christine Currie for her support.

## Author ORCIDs

[![ORCID: Harper](https://img.shields.io/badge/ORCID-0000--0001--5274--5037-brightgreen)](https://orcid.org/0000-0001-5274-5037)
[![ORCID: Monks](https://img.shields.io/badge/ORCID-0000--0003--2631--4481-brightgreen)](https://orcid.org/0000-0003-2631-4481)

## Aim and research questions:

The overarching research aim is determine to what extent authors of DES health studies share models and where models are shared how is this done.

### Primary research questions:

1. What proportion of DES healthcare studies share code?
2. How is sharing affected by FOSS, Covid-19, publication type and year of publication?
3. What proportion of studies make use of a reporting guideline?
4. What methods, tools, and resources did authors use to share their computer models and code?
5. To what extent do the DES health community follow best practice for open science when sharing computer models?
6. To what extent can the healthcare DES community improve its sharing of computer models?

license: MIT

branch_name: refs/heads/main

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive


text:
---
layout: default
---

# 1998-01-16 - Re: how to release code if the programmer is a target for (fwd)

## Header Data

From: Jim Choate<EMAIL_ADDRESS>To<EMAIL_ADDRESS>(Cypherpunks Distributed Remailer)

Message Hash: d6d17f0d026bfa513b0c1423154d1ed84b3c7467d1a44791cf94898ff14df42d

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1998-01-16 23:21:50 UTC

Raw Date: Sat, 17 Jan 1998 07:21:50 +0800

## Raw message

```
{% raw  %}From: Jim Choate<EMAIL_ADDRESS>Date: Sat, 17 Jan 1998 07:21:50 +0800
To<EMAIL_ADDRESS>(Cypherpunks Distributed Remailer)
Subject: Re: how to release code if the programmer is a target for (fwd)
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text

Forwarded message:

> Date: Fri, 16 Jan 1998 12:29:34 -0800
> From: Jonathan Wienke<EMAIL_ADDRESS>> Subject: Re: how to release code if the programmer is a target for
>   coercion (fwd)

[my entire previous post deleted...geesh]

> Jim, there are > 2 parties in the matter being discussed:

EXACTLY. That is why there is a potential for a MITM (requires at least
3 parties) attack.

> My key is publicly available at the MIT keyserver; it has been since PGP
> 5.0 came out.

So what? If Alice is being monitored for whatever reason and she requests
your key Mallet simply intercedes and inserts their own key. How is Alice
going to catch a clue?

> key.  It would be fairly difficult for any attacker to forge a signature
> with a false key;

It isn't the source but the recipient that is under attack.

[rest deleted]

    ____________________________________________________________________
   |                                                                    |
   |       The most powerful passion in life is not love or hate,       |
   |       but the desire to edit somebody elses words.                 |
   |                                                                    |
   |                                  Sign in Ed Barsis' office         |
   |                                                                    |
   |            _____                             The Armadillo Group   |
   |         ,::////;::-.                           Austin, Tx. USA     |
   |        /:'///// ``::>/|/                     http://www.ssz.com/   |
   |      .',  ||||    `/( e\                                           |
   |  -====~~mm-'`-```-mm --'-                         Jim Choate       |
   |<EMAIL_ADDRESS>   |
   |<PHONE_NUMBER>      |
   |____________________________________________________________________|

{% endraw %}
```

## Thread

+ Return to [January 1998](/archive/1998/01)

+ Return to "[Jim Choate <ravage@ssz.com>](/authors/jim_choate_ravage_at_ssz_com_)"
+ Return to "[Jonathan Wienke <JonWienk@ix.netcom.com>](/authors/jonathan_wienke_jonwienk_at_ix_netcom_com_)"

+ 1998-01-16 (Sat, 17 Jan 1998 07:21:50 +0800) - Re: how to release code if the programmer is a target for (fwd) - _Jim Choate<EMAIL_ADDRESS>  + 1998-01-17 (Sun, 18 Jan 1998 04:56:23 +0800) - [Re: how to release code if the programmer is a target for (fwd)](/archive/1998/01/7bc6b01f95a16971e0e7990f18b43c7d38f27f99eb3cca3bd8ac0decea6ca242) - _Jonathan Wienke<EMAIL_ADDRESS>

branch_name: refs/heads/master


text:
# Reproducibility of experiments

Here, you can find the code and instructions to reproduce the experiments to evaluate NextiaJD. On the one hand, we quantify the ability of the model to discover high quality joins through several experiments, and on the other hand we compare its performance to state of the art competitors.

## Setting
For evaluation purposes, we collected 139 real datasets. We further divided such datasets into 4 testbeds (extra-small, small, medium and large) according to their file size. The  characteristics and the download link for each testbed is in the following table:

| Testbed | File size       | datasets | String attributes |
|---------|-----------------|----------|-------------------|
| [XS](https://mydisk.cs.upc.edu/s/eCmfrNEBSKkcWcn/download), [XS with profiles computed](https://mydisk.cs.upc.edu/s/KEGRGHxwgd844aC)      | up to 1mb       | 28       | 159               |
| [S](https://mydisk.cs.upc.edu/s/dX3FajwWZn7rrrd/download)       | up to 100mb     | 46       | 590               |
| [M](https://mydisk.cs.upc.edu/s/niPyR4WTtxydprj/download)       | up to 1gb       | 46       | 600               |
| [L](https://mydisk.cs.upc.edu/s/4qoi76ziT2wJaCR/download)       | bigger than 1gb | 29       | 331               |

Each testbed zip file contains the below files:

* **datasetInformation_testbedX.csv** contains a list with the datasets names, the configuration to read them properly and the dataset source.
* **groundTruth_testbedX.csv** contains the ground truth with the containment obtained and the quality assigned for each pair of attributes.
* **dataset folder** contains all datasets used for the testbed

## Experiment 1: Predictive accuracy

The goal of the first experiment is to evaluate the prediction quality on generating a ranking of candidate equi join predicates.

The code and instructions for this experiment can be found [here](https://github.com/dtim-upc/NextiaJD/tree/main/experiments/NextiaJD#experiment-1-predictive-accuracy-of-nextiajd).

## Experiment 2: Comparison with the state-of-the-art

We compare our approach with the following state-of-the-art data discovery solutions, whose source code is openly available: [LSH Ensemble](https://github.com/ekzhu/datasketch) and [FlexMatcher](https://github.com/biggorilla-gh/flexmatcher).
The code and instruction for each solution can be found in the following links:

* [NextiaJD](https://github.com/dtim-upc/NextiaJD2/tree/nextiajd_v3.0.1/sql/nextiajd/experiments/NextiaJD#nextiajd-experiments) -- Note that it is not necessary to run again this step if you previously executed Experiment 1.
* [FlexMatcher](https://github.com/dtim-upc/NextiaJD/tree/1.0/experiments/FlexMatcher#flexmatcher-discovery)
* [LSH Ensemble](https://github.com/dtim-upc/NextiaJD/tree/1.0/experiments/LSH%20Ensemble#lsh-ensemble-discovery)

Each solution will generate a discovery file with the results proposed. Afterwards, in order to combine the results, we provide you with class `EvaluateDiscovery`. The instructions on how to use it are described in the following [website](https://github.com/dtim-upc/NextiaJD/tree/1.0/experiments/DiscoveryMetrics#discovery-metrics).

## Experiment 3: Scalability

The most intensive task for our approach in terms of computational resources is the generation of attribute profiles from datasets. Hence, we performed a stress test of this component. We created a jar to prepare the files for this experiment. The code and more information can be found [here](https://github.com/dtim-upc/NextiaJD/tree/main/experiments/Scalability#scalability).

## Experiment 4: Discovery of semantic non-syntactic relationships

This experiment evaluates if NextiaJD can find semantic attributes represented in different formats. The code for this experiment can be found [here](https://github.com/dtim-upc/NextiaJD/tree/1.0/experiments/SemanticNS).

repository: adityakatta/NextiaJD

repo_name: adityakatta/NextiaJD


text:
# Code name: Purple
A delightfully colorful iOS game written in Swift where the goal is to get to purple.

### Support or Contact
Visit [ddApps.co](http://ddapps.co) to see more.

repository: duliodenis/purple

repo_name: duliodenis/purple


text:
---
title: Story Splitting (PoC)
permalink: /docs/story-splitting/
image: /img/cm-og-image.png
---

The Context Mapper DSL (CML) supports capturing [user story](/docs/user-requirements/#user-story). Serving as initial input to our [OOAD transformations](/docs/rapid-ooad/), these stories allow our users to start prototyping an application rapidly. Before you start generating Subdomains and Bounded Contexts in such transformations, you have to create and evolve some use cases or user stories. During this process (in case you work with user stories), you may want to [split your stories](https://www.humanizingwork.com/the-humanizing-work-guide-to-splitting-user-stories/). Our story splitting transformations based on [_Patterns for Splitting User Stories_](https://agileforall.com/patterns-for-splitting-user-stories/) support such effort.

Note: This feature is in "proof of concept" state. It might not be stable and we currently only support one transformation. In the future we may support more Patterns for Splitting User Stories.

## Split Story by Verb/Operation
As a first proof of concept for this feature we implemented the transformation "Split Story by Verb/Operation". It splits a CML user story by its verb.

We illustrate the idea with the following user story written in CML:

UserStory Account_Admin_Story {
    As an "Admin" I want to "manage" an "Account" so that "can enable users to work with the system."
}

The Context Mapper editor provides a quick fix on the verb:

![Story Splitting in VS Code - Example (1)](/img/story-splitting-example-1.png)

By clicking on the verb and then on the light bulb, users can click "Split Story by Verb/Operation":

![Story Splitting in VS Code - Example (2)](/img/story-splitting-example-2.png)

Users can then enter multiple new verbs, one after the other:

![Story Splitting in VS Code - Example (3)](/img/story-splitting-example-3.png)

Once you entered all desired verbs, you can press `ESC` and the transformation will be applied. In our case here we entered the verbs **create**, **edit**, and **cancel**. This leads to the following CML result:

![Story Splitting in VS Code - Example (4)](/img/story-splitting-example-4.png)

The resulting CML model is:

UserStory Account_Admin_Story split by Account_Admin_Story_Split {
	As an "Admin" I want to "manage" an "Account" so that "can enable users to work with the system."
}

UserStory Account_Admin_Story_Split {
	As an "Admin"
	I want to "cancel" an "Account"
	I want to "edit" an "Account"
	I want to create an "Account"
	so that "can enable users to work with the system."
}

With the _split by_ keyword we provide a back-reference so that you still know which story was split by which other story (and how the original story looked like).

## Next Steps
After you have modelled and split a sufficient amount user stories, you can use our [OOAD transformations](/docs/rapid-ooad/) to derive Subdomains and Bounded Contexts from them. The transformations will always use the _split_ version of a story and ignore the original one!

gha_language: SCSS


text:
Letafont
========

By John P. Stevenson. A great font editor and several executable fonts, plus: their UDG sources. COMmand file version of the earlier User Defined Graphics (UDGs) in BASIC.

From the LETAFONT Amstrad PCW CP/M software package, available at http://www.fvempel.nl/software.html.

repository: robhagemans/hoard-of-bitfonts

gha_language: Pascal

gha_license_id: NOASSERTION

repo_name: robhagemans/hoard-of-bitfonts


text:
# End-to-end tests for `jp_proxy_widgets`

This folder contains the infrastructure for testing that `jp_proxy_widgets` work
in Jupyter notebooks running in a browser.  The infrastructure uses "headless chrome"
and browser automation to implement the tests.

## Running the tests

The `npm` tests for the module are end-to-end tests which do not attempt
to install all the components required to run the tests.  The tests assume
the following have been installed in the environment:

- Python 3 (tested with 3.6)
- node and npm
- jupyterlab=2.1.2
- jupyter labextension install @jupyter-widgets/jupyterlab-manager
- ipywidgets
- jp_proxy_widgets

The test suite was built using these versions:

```bash
$ npm -v
6.14.4
$ node -v
v10.13.0
```

Before running the tests you must install the dependencies:

```
$ cd <root>/jp_proxy_widget/end_to_end_tests
$ npm install
```

After the external and internal dependencies have been installed run the tests like this:

```
$ npm run test
```

To watch the tests running in slow motion (not headless)

```
HEADLESS="false" SLOWMO=100 npm run test
```

To watch the a single test running by itself in slow motion, specify its name:

```
HEADLESS="false" SLOWMO=100 jest -t "runs a widget in an example notebook"
```

## How to install tests for a widget repository:

The following is an outline of the steps to create these tests:

```
$ cp -r ~/tmp/jupyter_puppeteer_helpers/* .
$ git add *
$ git commit -m "copy test framework from jupyter_puppeteer_helpers"
$ git rm src/jp_helpers.js
$ git commit -m "don't include the source module -- add it to dev dependencies instead"
```
Then edit package.json to change the package name and description and remove stuff.
```
$ npm install
$ npm install<EMAIL_ADDRESS>--save-dev
```

Edit import in `jest/globalSetup.js`.

```
$ git diff jest/globalSetup.js
diff --git a/end_to_end_tests/jest/globalSetup.js b/end_to_end_tests/jest/globalSetup.js
index 7917162..90a9a70 100644
--- a/end_to_end_tests/jest/globalSetup.js
+++ b/end_to_end_tests/jest/globalSetup.js
@@ -1,6 +1,6 @@
 const { setup: setupDevServer } = require('jest-dev-server')
 const { setup: setupPuppeteer } = require('jest-environment-puppeteer')
-const { RUN_JUPYTER_SERVER_CMD } = require("../src/jp_helpers");
+const { RUN_JUPYTER_SERVER_CMD } = require("jupyter_puppeteer_helpers");
```

Similarly edit `tests/headless.test.js`

```
$ git diff tests/headless.test.js
diff --git a/end_to_end_tests/tests/headless.test.js b/end_to_end_tests/tests/headless.test.js
index 810ee42..51b6c77 100644
--- a/end_to_end_tests/tests/headless.test.js
+++ b/end_to_end_tests/tests/headless.test.js
@@ -2,7 +2,7 @@
 // These end-to-end tests use puppeteer and headless chrome using the default jest-environment configuration.

 const fs = require("fs");
-const { JupyterContext, sleep, JUPYTER_URL_PATH } = require("../src/jp_helpers");
+const { JupyterContext, sleep, JUPYTER_URL_PATH } = require("jupyter_puppeteer_helpers");

 const verbose = true;
 //const JUPYTER_URL_PATH = "./_jupyter_url.txt";
```

Then run the basic tests
```
$ npm test
```

Then modify contents of `notebook_test` and `tests` to add local tests and examples.

gha_language: Jupyter Notebook


text:
# All discussion posts and announcements on the Enigma

[Pooh Bear day 5 updated](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21762)

[PEX 3 - student question on file chooser](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21760)

[What's the difference between encode and decode](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21729)

[New Test Cases Uploaded](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21728)

[Pex 3 Reflector Setting for days 1-8 updated](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21727)

[Pex 3 Grading Matrix and Requirements](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21713)

[Pex 3 question - how to rotate to start and ...](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21636)

[Test Case results](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21558)

[Test Files updated](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21557)

[Rotor selections](https://floridapolytechnic.instructure.com/courses/1853/discussion_topics/21545)

## Test Cases
All updated test cases are included in the test cases folder.

license: Unlicense


text:
#### 10.0.1

- using latest google api

#### 10.0.0

- support angular 8

#### 9.1.0

- added oauthOptions to the exchange for token flow in oauth 1.0a

#### 9.0.0

- using angular cli version 6 to build the library
- StorageType is now a proper enum
- Universal might be working now
- Update providers function

#### 8.0.1

- fixed facebook and twitter config
- fixed a bug in JwtInterceptor

#### 8.0.0

- added storage type 'none' and 'memory' and added StorageType "enum".
- `forRoot` without options will give you the ability to inject your own config
- you can decide to not inject the JwtInterceptor view `forRoot` function
- issue #124: export IProviders
- issue #121: ability to inject config
- issue #122: ability to decode unicode characters
- Angular 5.0.0 (for <5.0.0 use version 7.0.2)
- Rxjs lettables
- Total refactor, code is much cleaner, shorter and easier to read
- #### BREAKING CHANGES:
  - Using HttpClient instead of Http
  - Using HttpClient Interceptor instead of JwtHttp
  - In the `exchangeForToken` flow (when you want to exchange authorization code given by the authorization endpoint with your server's token) this library now sends a body that looks like this instead of a flat mesh of the oauth options, oauth result and user data:

```js
{
    "authorizationData": {
        //the same data sent to the auth endpoint
    },
    "oauthData": {
        //the data received from the oauth endpoint
    },
    "userData": {
        //additional data you've provided
    }
}
```

- You don't need a class for the options and several options were removed (mostly because you can't make requests while you intercept requests...):
  - `defaultHeaders` - No need, you can create your own interceptor.
  - `tryTokenRefreshIfUnauthorized`, `refreshBeforeExpiration`, `autoRefreshToken`, `refreshUrl` - Removed since can't refresh while intercepting (if you come up with a clever idea how please send a pull request / issue)
- changed the OauthOptions
  - removed `exchangeForToken` - was hard to use and nobody was using it
  - removed `responseParams` - was not in use
  - removed `scopePrefix` - you can just add it as the first param in `scope`
  - `scope` is only an array
  - No more `requiredUrlParams`/`optionalUrlParams` confusion! introducing `additionalUrlParams` - just add a param name, and value and it will be added to the request, if the value is `undefined` the param will not be added, if the value is `null` it will be added without a value, if the value is a function, it will run the function.

#### 7.0.2

- issue #105: Make the library FESM15 includeable by using ng-packagr.

#### 7.0.1

- issue #98: responseType = 'token' not returning control to client app
- pull request #103: update packages + fixed support for TypeScript 2.4
- `logout` now removes the token only if subscribing to it, to logout syncronically use `removeToken` instead.
- issue #100: added visibleToolbar to popup options
- removed `defaultUrlParams` customization, use `optionalUrlParams` instead
- issue #81: support for 'cookie' & 'sessionCookie' (cookie without expiration) storage types

**BREAKING CHANGE:** This version drops official support for angular 2.0

#### 6.2.0

- pull request #91: rename StorageService to BrowserStorageService + add BaseStorage.

#### 6.1.6

- fixed google new login 500 issue with undefined optional params

#### 6.1.4

- supporting angular 4 in package.json

#### 6.1.3

- pull request #83: avoid import Type from `src`.

#### 6.1.2

- pull request #82: throw 'Authentication Canceled' when on a cordova app
- issue #78: added optional params on google provider
- issue #77: added ability to change the exchangeForToken request method

#### 6.1.0

- pull request #73: universal support
- throwing `new Error('Authentication Canceled')` when popup is closed prematurely so you could stop your spinners on `subscribe({..., error: err => <stop spinners here>, complete: () => <and here>})`

#### 6.0.0

- issue #68 - fixed issue with responseType='token'
- issue #65 - added tryTokenRefreshIfUnauthorized (off by default)
- pull request #64 & pull request #67 - added ability to change the httpService `Ng2UiAuthModule.forRootWithCustomHttp(config, {provide: JwtHttp, useClass: MyHttp, deps: [Http, SharedService, ConfigService]})`
- **BREAKING CHANGE:** Replaced `Ng2UiAuthModule.getWithConfig(MyAuthConfig)` with `Ng2UiAuthModule.forRoot(MyAuthConfig)` to look more like other modules

#### 5.0.0

- might be breaking: changed out folder names, not linking to the bundled version by default because of webpack issues with the pre-bundled version
- pull request #63 set token only when it's available
- pull request #61 [expiration date] check payload is defined.
- pull request #60 allow string as a scope option.
- pull request #57 allow any type in http body.

#### 4.1.1

- `cordova` variable defaults to `window.cordova`
- fixed issue with oauth 1

#### 4.1.0

- fix issue #47 using this library without server url causes exception.
- switched concatMap with switchMap (should be a better fit for that scenerio)
- added ability to force "exchangeForToken" by setting it to true in `IOauthOptions`
- added ability to force "exchangeForToken" and provide your own implementation by providing an exchangeForToken function in `IOauthOptions`
- fix issue #50 added ability to manually configure the `resolveToken` method via config
- fix issue #50 tokenRoot and tokens received from data property did not resolve.

#### 4.0.0

- Aligned default config with Satellizer (added Spotify)
- AOT compilation now works
- Peer dependency is now ^2.0.0
- **BREAKING CHANGE:** Changed service names to have "Service" postfix ("Auth" is now AuthService) all except JwtHttp which remains the same.
- **BREAKING CHANGE:** Initializing the library works like this now:

```typescript
export class MyAuthConfig extends CustomConfig {
    providers = {google: {clientId: GOOGLE_CLIENT_ID}};
}

@NgModule({
    imports: [
        BrowserModule,
        HttpModule,
        Ng2UiAuthModule.getWithConfig(MyAuthConfig),
        ...
    ]
    ...
```

#### 3.2.5

- Added "refresh token" flow, if you configure 'autoRefreshToken' to true then if you call a webservice when the token expires this library automatically sends it to the server using 'refreshUrl' endpoint (can be set in config default = '/auth/refresh') first and then sets a new token if it receives it and tries to call the original request. (issue #41)
- Added 'state' to the 'optionalUrlParams' of google according to issue #43

#### 3.2.2

- after testing issue #29 should be fixed

#### 3.2.1

- reverting to 3.1.2 since the 3.2.0 fix was not enough

#### 3.2.0

- fixed issue #29: extend() did not work causing custom options of popup window size to not work and `authenticate('provider', userCustomData)` with user custom data to not work properly

#### 3.1.2

- fixed issue #27: added missing `authHeader` to `ICustomConfig` interface

#### 3.1.0

- support rc2 "withCredentials" http flag

#### 3.0.5

- fixed issue #25: signup should accept "string" user and custom body

#### 3.0.3

- made a different folder for declarations so typescript won't try to re-compile the library

#### 3.0.2

- fixed issue: Not able to send a string user, or the user in the options body.

#### 3.0.0

- updated to support rc.0 and hopefully above

#### 2.1.0

- using rollup to bundle (fixes warning in webpack import)
- breaking change: adding default headers even without authentication
- removed dependency on "flatMap"
- updated peer dependencies to beta.12

#### 2.0.0

- breaking change: removed JWT_HTTP_PROVIDER, JwtHttp is provided in the default provider,
- breaking change: all internal calls use JwtHttp for their calls instead of Http
- added configurable default headers (`NG2_UI_AUTH_PROVIDERS({ defaultHeaders: {'Content-Type': 'application/json'}, providers: {google: {clientId: GOOGLE_CLIENT_ID}}})`)
- added configurable token seperator (`NG2_UI_AUTH_PROVIDERS({ tokenSeparator: '-', providers: {google: {clientId: GOOGLE_CLIENT_ID}}})`)
- fix for JwtHttp to support "Request" class as a parameter.

#### 1.1.0

- bundled the entire sources to dist/ng2-ui-auth.js and provided a minified version
- added a provider for plain JwtHttp (JWT_HTTP_PROVIDER)
- bumped peer dependency to beta.7

#### 1.0.15

- bumped to angular 2.0.0-beta.2
- changed dependencies to angular2 being a "peerDependency"

#### 1.0.14

- fixed http "unlink" call

#### 1.0.13

- changed module from system to commonjs

#### 1.0.10

- Removed dependency on angular-jwt (you can now use the included JwtHttp)
- Readded "authHeader" to the configuration
- Added an api for getting token expiration date (auth.getExpirationDate())
- changed default token prefix and the name of the providers from SATELLIZER_PROVIDERS to NG2_UI_AUTH_PROVIDERS

#### 1.0.9

- everything is working!


text:
# Circle Color Picker

![Version](https://img.shields.io/cocoapods/v/CircleColorPicker.svg?style=flat)
![License](https://img.shields.io/cocoapods/l/CircleColorPicker.svg?style=flat)
![Platform](https://img.shields.io/cocoapods/p/CircleColorPicker.svg?style=flat)

This is a highly customizable color picker view written in Swift.

## Installation

## How to use

## Screenshots

repository: carabina/CircleColorPicker

repo_name: carabina/CircleColorPicker


text:
# Discord-VC-analyser
This is a simple bot based on [discord.py](https://github.com/Rapptz/discord.py) that efficiently tracks individually who's connected to each voice chat in a Discord server and at what times.

## RUNNING

To use the bot, simply download it into a directory, create a `/data` folder in the same directory, [create a discord bot with no additional permissions and invite it to your desired server](https://discordpy.readthedocs.io/en/latest/discord.html#discord-intro), copy its token into `main.py`, and run `main.py`. After login success, the `/data` folder should fill up with text files, one for each voice channel in the server, formatted like so:
```
UTC_TIME_FLOAT, user1#XXXX, user2#XXXX, ...
```
Note that the bot only identifies users which joined the voice channel after the bot started running, and that it automatically deletes "unneeded" samples, I.E samples which are the same as the ones directly before and after them (where no user joined or left).

## PARSING
Since the data files are simply text, they can be parsed in many ways. In case you don't want to write a parser from scratch, a small convenience module is included which can parse one or all of the data files to a usable format. The simplest way to use it is like so:
```python
from basic_parser import parse_all
user_id_dict, res_lis = parse_all()
```
Where `user_id_dict` is a `dict` containing user names and a respective "local ID" _i.e_ `{'user1#XXXX': 1, 'user2#XXXX': 2, ...}`, and `res_lis` is a list of tuples sorted by voice channels of `('<channel_name>', utc_timestamp_list, conected_user_tuple_list)`, with the UTC times represented as floats and the connected users being tuples of integers (corresponding to the used IDs returned in the first argument).

repository: sonicrs/Discord-VC-analyser

repo_name: sonicrs/Discord-VC-analyser


text:
## Title of the App:
weather-checker

## Overview & Technologies Used:

I created this weather dashboard that helps the user to indicate what the weather looks like in a city they search for. It also shows the next five days's weather forecast. I started with creating a navigation bar that includes the name of the app, which is Weather Checker, and then the body, which includes the search bar, and the dashboard itself, and the cards that show the weather forecast for the next five days of the searched city.

This app is based on the acceptence creteria the user wishes to have, which is:

GIVEN a weather dashboard with form inputs
WHEN I search for a city
THEN I am presented with current and future conditions for that city and that city is added to the search history
WHEN I view current weather conditions for that city
THEN I am presented with the city name, the date, an icon representation of weather conditions, the temperature, the humidity, the wind speed, and the UV index
WHEN I view the UV index
THEN I am presented with a color that indicates whether the conditions are favorable, moderate, or severe
WHEN I view future weather conditions for that city
THEN I am presented with a 5-day forecast that displays the date, an icon representation of weather conditions, the temperature, and the humidity
WHEN I click on a city in the search history
THEN I am again presented with current and future conditions for that city
WHEN I open the weather dashboard
THEN I am presented with the last searched city forecast

Multiple fuinctions are used in this app, and one API from openweathermap.org

jQuery was used in creating this app in addition to the javascript.

## Screenshot of the Project:

<img width="1280" alt="weather" src="https://user-images.githubusercontent.com/67847324/95348950-8b460e80-088c-11eb-837d-0bbf6946907e.png">

## Review:
* The URL of the deployed application.
https://mohammed-19992.github.io/weather-dashboard/

* The URL of the GitHub repository. Give the repository a unique name and include a README describing the project.
https://github.com/Mohammed-19992/weather-dashboard

## MIT License

Copyright (c) [2020] [Mohammed Arafat]

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

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

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


text:
elasticwatch
==
Elasticwatch (EW) performs queries against Elastic Search, firing off violation and resolve events when they exceed/return to constraints.

There are 2 main types used by the Elasticwatch service:
  1. Policies - define an Elastic Search query and the minimum or maximum events detected by that query
  2. Handlers - logic for handling event state transitions

Running:
  `elasticwatch`   (use default configuration file config.json)
  or
  `elasticwatch -f /path/to/config.json`

  If there is a problem starting up, a message will go to stderr, otherwise log messages during runtime will be sent to stdout.

Configuration:
  EW uses a JSON configuration file.

  Below is an example where the service listens on port <IP_ADDRESS>:8080 to give status reports, and performs search requests against an Elastic Search instance on http://<IP_ADDRESS>:9200

  There are two handlers defined at the top level:

  shell - runs the command specified and passes it 3 parameters
  * status - "violation" or "resolved"
  * id - internal guid for the event
  * policy name

  hipchat - uses the HipChat notifications API to send a message
  properties required:
  * apikey
  * room (name or id)

  Two policies are defined.  Each policy must have the following properties:
  * name
  * query
  * min_count and/or max_count
  * polling_secs

  index is an optional property, if not defined, it will default to using '_all'.

See the config.json.example file in the repo
```
{
  "listen_address": "<IP_ADDRESS>:8080",
  "elasticsearch_url": "http://<IP_ADDRESS>:9200",
  "handlers": {
    "shell": {
      "command": "/usr/local/bin/alert"
    },
   "hipchat": {
     "apikey": "abc123",
     "room": "devops"
   }
  },
  "policies": [{
    "name": "apache requests",
    "query": "path:/var/log/apache2/access_log AND @timestamp:{now-1h TO now}",
    "min_count": 100,
    "polling_secs": 3600,
    "handlers": ["shell"]
  }, {
    "name": "crawl requests",
    "query": "path:/var/log/crawler AND @timestamp:{now-5m TO now}",
    "min_count": 10,
    "max_count": 100,
    "polling_secs": 300,
    "handlers": ["shell", "hipchat"]
  }]
}
```

repository: billhathaway/elasticwatch

repo_name: billhathaway/elasticwatch


text:
# PyTorch HelloWorld
The official PyTorch has been optimized using Intel(R) Deep Neural Networks Library (Intel(R) DNNL) primitives by default. This sample shows how to train a PyTorch model and run the inference with Intel DNNL enabled.

## Key implementation details
This Hello World sample code is implemented for CPU using the Python language.

*Please* **export the environment variable `MKLDNN_VERBOSE=1`** *to display the deep learning primitives trace during execution.*

### Notes
 - The test dataset is inherited from `torch.utils.data.Dataset`.
 - The model is inherited from `torch.nn.Module`.
 - For the inference portion, `to_mkldnn()` function in `torch.utils.mkldnn` can accelerate performance by eliminating data reorders between operations which are supported by Intel(R) DNNL.

## Pre-requirement

PyTorch is ready for use once you finish the Intel AI Analytics Toolkit installation, and have run post installation script.

You can refer to the oneAPI [main page](https://software.intel.com/en-us/oneapi) for toolkit installation, and the Toolkit [Getting Started Guide for Linux](https://software.intel.com/en-us/get-started-with-intel-oneapi-linux-get-started-with-the-intel-ai-analytics-toolkit) for post-installation steps and scripts.

## Activate conda environment With Root Access

Please follow the Getting Started Guide steps (above) to set up your oneAPI environment with the setvars.sh script. Then navigate in linux shell to your oneapi installation path, typically `~/intel/inteloneapi`. Activate the conda environment with the following command:

#### Linux
```
source activate pytorch
```

## Activate conda environment Without Root Access (Optional)

By default, the Intel AI Analytics toolkit is installed in the inteloneapi folder, which requires root privileges to manage it. If you would like to bypass using root access to manage your conda environment, then you can clone your desired conda environment using the following command:

#### Linux
```
conda create --name user_pytorch --clone pytorch
```

Then activate your conda environment with the following command:

```
source activate user_pytorch
```

## How to Build and Run

To run the program on Linux*, Windows* and MacOS*, simply type the following command in the terminal with Python installed:

```
    python PyTorch_Hello_World.py
```

With successful execution, it will print out `PASSED_CICD` in the terminal.

You will see the DNNL verbose trace after exporting the `MKLDNN_VERBOSE`:

```
    export MKLDNN_VERBOSE=1
```

Please go to https://intel.github.io/mkl-dnn/dev_guide_verbose.html to find more information about the mkldnn log.

## License
This code sample is licensed under MIT license.

repository: app-creative/AiKit-code-samples

repo_name: app-creative/AiKit-code-samples


text:
# PharmaNet Revisions of Information Managment Enhancements (PRIME) WEBAPI

## Table of Contents

[TOC]

## .NET API

### Installation

If you are developing on Linux, to avoid this error during the Site Registration user story:
```
System.ComponentModel.Win32Exception (13): Permission denied
   at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html)
   at Wkhtmltopdf.NetCore.GeneratePdf.GetPDF(String html)
   at Prime.Services.PdfService.Generate(String htmlContent) in /moh-prime/prime-dotnet-webapi/Services/PdfService.cs:line 16
```

make sure you enable execution permissions for `wkhtmltopdf`, i.e. `/moh-prime/prime-dotnet-webapi/Resources/wkhtmltopdf/Linux$ chmod +x wkhtmltopdf`.
If you have already built the binaries, you will need to re-build to include `wkhtmltopdf` with the correct permissions.

## Database (PostgreSQL + .NET Core EF)

### Installation

### Creating Migration

[.Net Core EF Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli)

When you have completed updates to the models and want to create a migration for the database run:

```bash
dotnet ef migrations add <MigrationName>
```

Note: you will have to bring down your api if you are running it in debug mode to run migrations.

### Database Update (Running Migrations)

[.Net Core EF Updates](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli#update-the-database)

To run the migrations in your migration use the update command:

```bash
dotnet ef database update
```

Using the same command, but passing in a target migration you can rollback to a specific migration:

```bash
dotnet ef database update <MigrationName>
```

Note: you will have to bring down your api if you are running it in debug mode to run updates.

### TIPS + TRICKS

repository: peggy-gov-bc-ca/moh-prime

repo_name: peggy-gov-bc-ca/moh-prime


text:
# QASM-Bench

## OVERVIEW

QASM-Bench is a quantum-software benchmark suite that helps evaluate quantum volumes and performance of quantum computers and simulators registered as backends in Qiskit API.

## Getting Started

### Setup Qiskit

see https://github.com/Qiskit/qiskit-terra/#installation

### Generate QASM files

Each directory has a .py file to generate qasm files.
You can generate a qasm file by specifying qubit with `-n` (and depth with `-d`).
For example, 30 qubits QFT is generated with following commands:

```
$ cd qft;
$ python3 qft.py -n 30
$ cat qft_n30.qasm
```

### Run benchmarks

You can run benchmark `run_simbench.py` with following options.

- `-a`: specify an application to be evaluated
- `-b`: specify a backend supported by Qiskit
- `-s`: specify a qubit number to start evaluation
- `-e`: specify a qubit number to end evaluation
- `-d`: specify a depth to be evaluated (optional)
- `-v`: verify simulation results (optional)
- `-l`: show the list of benchmark scenario (optional)

For example, the following commands run qft from 10 to 20 qubit with local_qiskit_simulator.

```
$ python3 run_simbench.py -a qft -b local_qiskit_simulator -s 10 -e 20
```

## Applications

### Fourier Transform

https://github.com/Qiskit/qiskit-tutorials/blob/master/community/terra/qis_adv/fourier_transform.ipynb

### Quantum Volume

Generate randomized circuits for Quantum Volume analysis.

### SAT

This is a set of SAT (satisfiability) problem instances of [DIMACS](http://people.sc.fsu.edu/~jburkardt/data/cnf/cnf.html) CNF (conjunctive normal form) format with corresponding quantum Grover's search programs. Please note that all SAT instances are randomly generated, with no guarantee of having satisfying solutions.
Original script files to generate sat is https://github.com/hushaohan/cnf (Author: Shaohan Hu /<EMAIL_ADDRESS>
### Bernstein-Vazirani algorithm

This program is based on the Bernstein-Vazirani algorithm in the [Qiskit-tutorial](https://nbviewer.jupyter.org/github/Qiskit/qiskit-tutorial/blob/stable/index.ipynb).

### Counterfeit-Coin Finding algorithm

This program is based on the Counterfeit-Coin Finding algorithm in the [Qiskit-tutorial](https://nbviewer.jupyter.org/github/Qiskit/qiskit-tutorial/blob/stable/index.ipynb).

repository: adityakhannaadk/openqasm

repo_name: adityakhannaadk/openqasm


text:
# dsu-explorer-workspace

dsu-explorer-workspace is a basic workspace based on [template-workplace](https://github.com/PrivateSky/template-workspace) and contains the following applications:
* [dossier-explorer-ssapp](https://github.com/PrivateSky/dossier-explorer-ssapp.git)
* [psk-marketplace-ssapp](https://github.com/RomSoftIasi/psk-marketplace-ssapp.git)

**Notes**:
* A _workspace_ is a project with many other libraries and configuration loaded.
* An _included_ application means that the original code is in a separate repo but got included here (either by hard copy or brought in by git's clone commands)

## Prerequisites

You need the following software installed on your machine in order to continue the this guide

1. Install or update [Node](https://nodejs.org/en/) (including NPM) to version 12.14.0.
2. Install or update [Git](https://git-scm.com/)

## Installation

The only commands you need to run in the *dsu-explorer-workspace* workspace are:

```sh
# Step 0: Go inside the [dsu-explorer-workspace] folder
cd dsu-explorer-workspace

# Step 1: Brings all dependencies needed
$ npm install

# Step 2: Launch the Node js
$ npm run server

# Step 3: Scans all applications and wallet it finds in the configuration and tries to run the build script for each one
$ npm run build-all
```

After all this steps are done, you can access the application by going to [http://localhost:8080/web-wallet/loader/](http://localhost:8080/web-wallet/loader/)

repository: PrivateSky/dsu-explorer-workspace

repo_name: PrivateSky/dsu-explorer-workspace


text:
# Tekton CLI Releases

## Release Frequency

Tekton CLI follows the Tekton community [release policy][release-policy]
as follows:

- Versions are numbered according to semantic versioning: `vX.Y.Z`
- A new release is produced on a monthly basis
- Four releases a year are chosen for [long term support (LTS)](https://github.com/tektoncd/community/blob/main/releases.md#support-policy).
  All remaining releases are supported for approximately 1 month (until the next
  release is produced)
    - LTS releases take place in January, April, July and October every year
    - The first Tekton CLI LTS release will be **v0.30.0** in January 2023
    - Releases happen towards the middle of the month, but the exact date may vary,
      depending on week-ends and readiness

Tekton CLI produces nightly builds, publicly available on
`gcr.io/tekton-nightly`.

### Transition Process

Before release v0.28 Tekton CLI has worked on the basis of an undocumented
support period of four months, which will be maintained for the releases between
v0.26 and v0.27.

## Release Process

Read about releasing the Tekton CLI in the [release process documentation]
[tekton-release-process].

Further documentation available:

- [Tekton resources][tekton-releases-docs]
- Standard for [release notes][release-notes-standards]

## Releases

### v0.31 (LTS)

- **Latest Release**: [v0.31.2][v0-31-2] (2023-08-01) ([docs][v0-31-2-docs])
- **Initial Release**: [v0.31.0][v0-31-0] (2023-05-10) ([docs][v0-31-0-docs])
- **End of Life**: 2024-05-10

### v0.30 (LTS)

- **Latest Release**: [v0.30.1][v0-30-1] (2023-04-10) ([docs][v0-30-1-docs])
- **Initial Release**: [v0.30.0][v0-30-0] (2023-03-27) ([docs][v0-30-0-docs])
- **End of Life**: 2024-03-27

### v0.29

- **Latest Release**: [v0.29.1][v0-29-1] (2022-02-02) ([docs][v0-29-1-docs])
- **Initial Release**: [v0.29.0][v0-29-0] (2022-01-05) ([docs][v0-29-0-docs])
- **End of Life**: 2023-02-04
- **Patch Releases**: [v0.29.1][v0-29-1]

### v0.28

- **Latest Release**: [v0.28.0][v0-28-0] (2022-11-25) ([docs][v0-28-0-docs])
- **Initial Release**: [v0.28.0][v0-28-0] (2022-11-25)
- **End of Life**: 2023-01-24
- **Patch Releases**: [v0.28.0][v0-28-0]

### v0.27

- **Latest Release**: [v0.27.0][v0-27-0] (2022-10-11) ([docs][v0-27-0-docs])
- **Initial Release**: [v0.27.0][v0-27-0] (2022-10-11)
- **End of Life**: 2023-02-10
- **Patch Releases**: [v0.27.0][v0-27-0]

### v0.26

- **Latest Release**: [v0.26.0][v0-26-0] (2022-09-02) ([docs][v0-26-0-docs])
- **Initial Release**: [v0.26.0][v0-26-0] (2022-09-02)
- **End of Life**: 2023-01-08
- **Patch Releases**: [v0.26.0][v0-26-0]

### v0.25

- **Latest Release**: [v0.25.0][v0-25-0] (2022-07-22) ([docs][v0-25-0-docs])
- **Initial Release**: [v0.25.0][v0-25-0] (2022-07-22)
- **End of Life**: 2022-11-21
- **Patch Releases**: [v0.25.0][v0-25-0]

## End of Life Releases

Older releases are EOL and available on [GitHub][tekton-cli-releases].

[release-policy]: https://github.com/tektoncd/community/blob/main/releases.md
[tekton-chains]: https://github.com/tektoncd/chains
[tekton-cli-releases]: https://github.com/tektoncd/cli/releases
[tekton-releases-docs]: tekton/README.md
[release-notes-standards]:
    https://github.com/tektoncd/community/blob/main/standards.md#release-notes
[tekton-release-process]: RELEASE_PROCESS.md

[v0-31-2]: https://github.com/tektoncd/cli/releases/tag/v0.31.2
[v0-31-0]: https://github.com/tektoncd/cli/releases/tag/v0.31.0
[v0-30-1]: https://github.com/tektoncd/cli/releases/tag/v0.30.1
[v0-30-0]: https://github.com/tektoncd/cli/releases/tag/v0.30.0
[v0-29-1]: https://github.com/tektoncd/cli/releases/tag/v0.29.1
[v0-29-0]: https://github.com/tektoncd/cli/releases/tag/v0.29.0
[v0-28-0]: https://github.com/tektoncd/cli/releases/tag/v0.28.0
[v0-27-0]: https://github.com/tektoncd/cli/releases/tag/v0.27.0
[v0-26-0]: https://github.com/tektoncd/cli/releases/tag/v0.26.0
[v0-25-0]: https://github.com/tektoncd/cli/releases/tag/v0.25.0

[v0-31-2-docs]: https://github.com/tektoncd/cli/tree/v0.31.2/docs
[v0-31-0-docs]: https://github.com/tektoncd/cli/tree/v0.31.0/docs
[v0-30-1-docs]: https://github.com/tektoncd/cli/tree/v0.30.1/docs
[v0-30-0-docs]: https://github.com/tektoncd/cli/tree/v0.30.0/docs
[v0-29-1-docs]: https://github.com/tektoncd/cli/tree/v0.29.1/docs
[v0-29-0-docs]: https://github.com/tektoncd/cli/tree/v0.29.0/docs
[v0-28-0-docs]: https://github.com/tektoncd/cli/tree/v0.28.0/docs
[v0-27-0-docs]: https://github.com/tektoncd/cli/tree/v0.27.0/docs
[v0-26-0-docs]: https://github.com/tektoncd/cli/tree/v0.26.0/docs
[v0-25-0-docs]: https://github.com/tektoncd/cli/tree/v0.25.0/docs

repository: tektoncd/cli

gha_language: Go

repo_name: tektoncd/cli


text:
![](img.png)

---

## The Creator WiFire application

The Creator WiFire application runs on a [ChipKIT WiFire](http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=TDGL021-2#utm_source=MicroSolutions&utm_medium=Link&utm_term=FY17Q1&utm_content=ThirdParty&utm_campaign=Article) development board and is designed to demonstrate IoT protocols and capabilities.

## Dependencies
The complete IoT demonstration requires:
* a device, or several devices, to monitor and manage (in this case the WiFire)
* a device management server supporting suitable Lightweight machine to machine (LWM2M) protocols (see the [Creator device server](https://github.com/CreatorDev/creator-wifire-mobile-app))
* a mobile application to configure and manage devices remotely via the device server (see the Creator mobile application)

## WiFire application specific dependencies
This application uses the [Awa LightweightM2M](https://github.com/FlowM2M/AwaLWM2M) implementation of the OMA Lightweight M2M protocol to provide a secure and standards compliant device management solution without the need for an intimate knowledge of M2M protocols. The Awa libraries are automatically loaded in with the WiFire application build.

## Documentation
The full documentation detailing a suitable, free of charge developer environment and application build instructions are available [here.](doc/wiFireDeveloperEnvironment.md)
An application overview, a list of IPSO supported objects, and command line setup guide are available [here.](doc/wiFireApp.md)

---

For further information please visit:
* [The CreatorDev forum](https://forum.creatordev.io/)
* [CreatorDev online documentation](https://docs.creatordev.io/wifire)

---

## License
 Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.
 All rights reserved.
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.

----

----

repository: sdsxpln/creator-wifire-app

repo_name: sdsxpln/creator-wifire-app


text:
# vue-events

A [Vue.js](http://vuejs.org) plugin that provides a global event bus and a couple helper methods.

Works with both `Vue 1.0` & `Vue 2.0`

## Installation

##### 1.) Install package via NPM

```
$ npm install vue-events
```

##### 2.) Install plugin within project.
```
import Vue from 'vue';
import VueEvents from 'vue-events';

Vue.use(VueEvents)
```

or

```
window.Vue = require('vue');
require('vue-events');
```

## Usage

#### The `$events` prototype object.
This plugin extends `Vue.prototype` to include a new `$events` object. The `$events` object is a simple Vue model which
includes couple aliases for the `vm.$emit` & `vm.$on` methods.

#### Firing an event
There are 3 methods that fire events. They're functionally identical and only differ in name.
```
new Vue({

    data() {
        return {
            eventData: {
                foo: 'baz'
            }
        }
    },

    mounted() {
        // Option #1
        this.$events.fire('testEvent', this.eventData);

        // Option #2
        this.$events.emit('testEvent', this.eventData);

        // Option #3
        this.$events.$emit('testEvent', this.eventData);
    }

})
```

_Note: `$events.fire` and `$events.emit` are aliases for `$events.$emit`._

#### Listening for an event
There are 3 methods that register event listeners. They're functionally identical and only differ in name.
```
new Vue({

    mounted() {
        // Option #1
        this.$events.listen('testEvent', eventData => console.log(eventData));

        // Option #1
        this.$events.on('testEvent', eventData => console.log(eventData));

        // Option #3
        this.$events.$on('testEvent', eventData => console.log(eventData));
    }

})
```

_Note: `$events.listen` and `$events.on` are aliases for `$events.$on`._

## Demo
If you'd like to demo `vue-events` try [vue-stack-2.0](https://github.com/cklmercer/vue-stack-2.0)

## License

[MIT](http://opensource.org/licenses/MIT)

repository: pongoman/vue-events

repo_name: pongoman/vue-events


text:
Arduino Robot
====================
An Arduino Robot controlled via Bluetooth communication. Multiple sensors are connected to the ArduinoUNO mounted onto the Robot. The data collected by the sensors are communicated to a python client (running on a PC) via bluetooth. This client in turn publishes this data to WSO2 CEP or BAM.

Publishing the sensor data to BAM/CEP is enabled in two different ways:

	1 The Python client directly publishes the sensor data to the BAM/CEP Thrift-port
    2 The Python client publishes the sensor data to BAM/CEP by making a REST call to a service endpoint deployed in a WSO2-AS instance.

Prerequisites
--------------

* Robot Base + Gear Motors + Wheels + BatteryPack
* Arduino-to-Motor power amplifier IC
* ArduinoUNO
* Arduino Sensor Sheilds (Sonar + LDR + PIR + GAS + DHT-Temperature)
* Arduino Bluetooth Sheild
* Python 2.7

Folder Structure
-----------------
* **Arduino** : Arduino code for Motor-Controller + Reading Sensor Input + Schematics to connect the circuits
* **BAM-Tool-Boxes/sensorDataSummary** : WSO2 BAM Confoguration files
* **PC_Clients** : Python clients to connect and motion-control the robot via bluetooth, to receive sensor data and to publish these data to WSO2 BAM
* **RestService/ConnectedDevices** : Source code for the RESTService which is called by the python client to publish sensor-data to WSO2 BAM

Configurations
------------------

Change relevant information in the respective python client file.

There are two types of python clients available in the project. Please refer the ***README*** file inside the **Arduino Robot/PC_Clients/+** folder for more ndetails about it.

* ip = '<IP_ADDRESS>'           # IP address of the BAM/CEP server
* port = 7711                    # Thrift listen port of the BAM/CEP server
* username = 'admin'       # username to connect to the BAM/CEP
* password = 'admin'       # password to connect to the BAM/CEP

Run
------------

###### Arduino Setup

	1. Follow the schematics as shown in the "robot-motor_bb.png" & "robot-bb.png" to setup the circuitry.
    		(Schematics Path: /Arduino Robot/Arduino/Schematics/)

	2. Download the "dht" library for the temperature sensor from
    		https://arduino-info.wikispaces.com/DHT11-Humidity-TempSensor

	3. Download the "protothread" library from
    		https://code.google.com/p/arduinode/downloads/detail?name=pt.zip

	4. Upload the arduino libraries from within the Arduino IDE:
    		"Sketch -> Include Library -> Upload zip".

    5. Download the "RobotController" Arduino sketch and upload the "RobotController.ino" file to the Arduino Board via the ArduinoIDE.
    		(Path: Arduino Robot/Arduino/RobotController/+)

###### Setup BAM
	* Add the local machine ip to the file:
    		<BAM_HOME>/repository/conf/data-bridge/data-bridge-config.xml

	* Set port offset to 2 in the "carbon.xml" file:
    		<Ports>
        		<Offset>2</Offset>
                .......
            <Ports>

	* Once the above is done, follow the instructions in the "README.md" file at path:
    		"/Arduino Robot/BAM-Tool-Boxes/sensorDataSummary/."

###### Setup AS (required only if sensor-data is published via a call to the REST-Endpoint)
	* Deploy the .war file generated by the project inside the "RestService/ConnectedDevices" folder into a WSO2 Application Server setup configured in your local machine.
    	(WSO2 AS: https://docs.wso2.com/display/AS520/Deploying+JAX-WS+and+JAX-RS+Applications)

	* For more instructions read the "README.md" file at path:
    		"/Arduino Robot/RestService/ConnectedDevices/."

###### Python Client Setup

	1. Install PySerial Library

		- Download the .tar.gz for "PySerial", according to your operating system and install the package for PySerial.
        	(https://pypi.python.org/pypi/pyserial)
		- Uncompress the download.
		- Move ("cd") into the folder and use - "sudo python setup.py install" in the terminal.

    2. Install the Requests Python Library (Only required if publishing sensor-data via call to REST Endpoint)

    	- Follow the instructions given the Installation page of the Requests library:
        	http://docs.python-requests.org/en/latest/user/install/#install

> Once the above is done, follow the instructions in the ***README.md*** file at path: **"/Arduino Robot/PC_Clients/."**

repository: rogermurgo/iot-server-appliances

path: /Arduino Robot/README.md

repo_name: rogermurgo/iot-server-appliances


text:
# TIC_TAC_TOE

Building a Tic tac toe game with Javascript

![alt text](https://github.com/shloch/TIC_TAC_TOE/blob/master/asset/tictac.gif)

## Live demo

https://raw.githack.com/shloch/TIC_TAC_TOE/development/index.html

## Future features
- Adding sound effects upon clicks
- Keep track of each player's scores over multiple rounds

## Contributors

### 👤 **SHEY Louis CHIA**

- Github: [shloch](https://github.com/shloch)
- Twitter: [@shloch](https://twitter.com/shloch)
- Linkedin: [/in/shey-louis-chia](https://www.linkedin.com/in/shey-louis-chia)
- Email<EMAIL_ADDRESS>
## 👤 **Terver Aosu**
- Terver Aosu _https://github.com/truetechcode_

## Acknowledgements
- https://fonts.googleapis.com
- https://www.theodinproject.com/
- https://javascript.info/


text:
# My little planet

Procedural planet generator using WebGL made for the course TNM084 (Procedural
Methods for Images) at Linköping University.

[![Screen shot](report/images/app.png)](http://klaseskilson.se/TNM084-my-little-planet/)

### Setup

Make sure you have [Node.js](https://nodejs.org/en/) installed. Then, install
`grunt-cli` and our our dependencies using:

```bash
npm install -g grunt-cli
npm install
```

### Run

Run the application for development:

```bash
grunt dev
```

Then open [`localhost:3000`](http://localhost:3000) in your browser (preferably
Chrome(ium)).

### Build and Deploy

Build it for deployment:

```bash
grunt deploy
```

This builds, minifies and hashes the JS, followed by appending the hash to the
file name. This busts the cache if the file has changed. (It also changes the
reference to the js file in [`index.html`](index.html).)

Then deploy this to your favourite static hosting solution.

license: ISC


text:
# FuelConsumption
Average fuel consumption calculator and history

##
TODOS:

* Implement basic UI to show history and odometer + refueled amount entry
* Average fuel consumption calculation based on refuling history entries (Total odometer Km & Refueled gas amount)
* Core data for history
* Tesseract or Anyline text scan (take photo of odometer and gas dispenser meter) - automatic input


text:
MethodEvaluation
================

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

MethodEvaluation is part of the [OHDSI Methods Library](https://ohdsi.github.io/MethodsLibrary).

Introduction
============
This R package contains resources for the evaluation of the performance of methods that aim to estimate the magnitude (relative risk) of the effect of a drug on an outcome.
These resources include reference sets for evaluating methods on real data, as well as functions for inserting simulated effects in real data based on negative control drug-outcome pairs. Further included are functions for the computation of the minimum detectable relative risks and functions for computing performance statistics such as predictive accuracy, error and bias.

Features
========
- Contains the OMOP and EU-ADR reference set, and the OHDSI Method benchmark for evaluating method performance using real data.
- Function for inserting simulated effects in real data based on negative control drug-outcome pairs.
- Function for computation of the minimum detectable relative risk (MDRR)
- Functions for computing predictive accuracy, error, and bias

Technology
==========
MethodEvaluation is a pure R package.

Installation
============
1. On Windows, make sure [RTools](http://cran.r-project.org/bin/windows/Rtools/) is installed.
2. The DatabaseConnector and SqlRender packages require Java. Java can be downloaded from
http://www.java.com.
3. In R, use the following commands to download and install MethodEvaluation:

  ```r
  install.packages("drat")
  drat::addRepo("OHDSI")
  install.packages("MethodEvaluation")
  ```

User Documentation
==================
* Package manual: [MethodEvaluation.pdf](https://raw.githubusercontent.com/OHDSI/MethodEvaluation/master/extras/MethodEvaluation.pdf)
* Vignette: [Running the OHDSI Methods Benchmark](https://raw.githubusercontent.com/OHDSI/OhdsiMethodsBenchmark/master/inst/doc/OhdsiMethodsBenchmark.pdf)

Support
=======
* Developer questions/comments/feedback: OHDSI Forum
* We use the GitHub issue tracker for all bugs/issues/enhancements

License
=======
MethodEvaluation is licensed under Apache License 2.0

Development
===========
MethodEvaluation is being developed in R Studio.

### Development status

Beta

Acknowledgements
================
- This project is supported in part through the National Science Foundation grant IIS 1251151.

repository: jamieweaver/MethodEvaluation

repo_name: jamieweaver/MethodEvaluation


text:
---
layout: rsk
title: Introduction
tags: rif, enveloping, rsk, gas station network, gsn, defi
description: "A Secure sponsored transaction system to enable users to pay fees using ERC-20 tokens."
---

The first version of Enveloping was based on the [Gas Station Network (GSN) project](https://github.com/opengsn/gsn). GSN is a decentralized system that improves dApp usability without sacrificing security. In a nutshell, GSN abstracts away gas (used to pay transaction fees) to minimize onboarding and UX friction for dApps. With GSN, "gasless clients" can interact with smart contracts paying for gas with tokens instead of native-currency.

RIF Enveloping V2 is a redesign of GSN. It reduces gas costs and simplifies contract interaction.

It achieves this by:

- Securely deploying counterfactual Smart Wallet proxies for each user account: this eliminates the need for relying on `_msgSender()` and `_msgData()` functions, making existing and future contracts compatible with RIF Enveloping without any modification.
- Allowing Relay providers to receive tokens in a worker address under their control to later on decide what to do with funds.
- Reducing gas costs by optimizing the existing GSN architecture.

Our main objective is to provide the RSK ecosystem with the means to enable blockchain applications and end-users (wallet-apps) to pay for transaction fees using tokens (e.g. RIF tokens), and thereby remove the need to acquire RBTC in advance.

It is important to recall that - as a security measure - the version 1 contracts deployed on Mainnet have limits on the staked amounts to operate, these limits were removed in version 2.

repository: rcoscali/devportal

repo_name: rcoscali/devportal


text:
# Monitoring

We use a [Prometheus](https://prometheus.io/), [Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) and [Grafana](https://grafana.com/) stack for a complete monitoring setup of both our clusters and applications running on them.

We make use of the CoreOS _operator_ principle: by deploying [prometheus-operator](https://github.com/coreos/prometheus-operator) we define new Kubernetes Custom Resource Definitions (CRD) for `Prometheus`, `Alertmanager`, `ServiceMonitor` and `PrometheusRule` which are responsible for deploying Prometheus and Alertmanager setups, Prometheus scrape targets and alerting rules, respectively.

As of this writing there isn't an operator setup yet for Grafana, but you can add custom dashboards dynamically via `ConfigMaps`.

- Prometheus does the _service monitoring_ and keeps time-series data.
- Alertmanager is responsible for handling alerts, based on _rules_ from Prometheus. In our case Alertmanager is responsible for making sure alerts end up in [Opsgenie](https://www.opsgenie.com/) and Slack.
- Grafana provides nice charts and dashboards of the Prometheus time-series data.

- [Monitoring](#monitoring)
  - [Accessing the monitoring dashboards](#accessing-the-monitoring-dashboards)
    - [Github](#github)
    - [Microsoft Azure](#microsoft-azure)
  - [Kubernetes application monitoring](#kubernetes-application-monitoring)
    - [Example ServiceMonitor](#example-servicemonitor)
    - [Example PrometheusRule](#example-prometheusrule)
    - [Example Grafana Dashboard](#example-grafana-dashboard)
  - [AWS services monitoring](#aws-services-monitoring)
  - [Recommendations and best practices](#recommendations-and-best-practices)
    - [Prometheus labels](#prometheus-labels)
  - [Prometheus scrapers for common technologies](#prometheus-scrapers-for-common-technologies)
    - [PHP](#php)
      - [Native](#native)
      - [PHP-FPM](#php-fpm)
    - [Ruby](#ruby)
      - [Native](#native-1)
      - [Workers](#workers)
    - [Nginx](#nginx)
      - [Setup](#setup)
    - [RabbitMQ](#rabbitmq)

## Accessing the monitoring dashboards

Prometheus, Alertmanager and Grafana are accessible via their respective dashboards. These dashboards are exposed via Ingresses, either private or public, depending on your cluster's configuration. If the dashboards are set to be private, you'll need to be connected to the cluster's VPN in order to access them.

These monitoring dashboards are secured via [Dex](https://dexidp.io/), which adds an authentication layer. Dex can be configured with multiple identity providers to provide a seamless authentication experience. The most typical providers that we use are GitHub and Azure, which are explained in more detail below. Dex configuration is specific to each cluster, and is currently managed by Skyscrapers, although some integration details might need to be provided by you (the customer).

### Github

The GitHub integration uses the GitHub OAuth2 flow, and it's pretty straight-forward to configure. In most cases, we will set up this integration for you, creating the OAuth application in our GitHub organization. For reference, this is the official [Dex documentation](https://dexidp.io/docs/connectors/github/) to configure this integration.

### Microsoft Azure

[Dex Microsoft connector](https://dexidp.io/docs/connectors/microsoft/) also works with Azure accounts and tenants. You'll need to register a new application in your Azure tenant. To do so, go to the Azure Active Directory portal for the correct tenant, go to `App Registrations` in the side bar and click `New registration`. You can give it the name you want, something significant like `DEX - <cluster name>`. Once the application is created, you'll need to create a client secret by going to `Certificates & secrets` in the side bar and clicking the `New client secret` button.

Once the application is registered and configured, you'll have to provide us with the following information:

- application client id
- application secret value
- tenant id
- the list of groups to authorize in Dex. Users belonging to these groups will be granted access.

In some cases, you might need to give the application special admin consent so Dex is able to list groups on behalf of logged in user. If that is the case, you'll need to add an explicit `Directory.Read.All` permission to the list of `Delegated Permissions` and then open the following link in your browser and log in under organization administrator account: `https://login.microsoftonline.com/<tenant>/adminconsent?client_id=<dex client id>`. You'll get a page similar to this one:

![azure auth](images/azure-auth.png)

*Note that after you click `Accept` and grant the necessary permissions, you might get an error page from Dex. That's ok and you can ignore it and close it.*

## Kubernetes application monitoring

You can also use Prometheus to monitor your application workloads and get alerts when something goes wrong. In order to do that you'll need to define your own `ServiceMonitors` and `PrometheusRules`. There are two requirementes though:

- All `ServiceMonitors` and `PrometheusRules` you define need to **have the `prometheus` label (any value will do)**.
- The **namespace** where you create your `ServiceMonitors` and `PrometheusRules` need to **have the `prometheus` label too (any value will do)**.

   ```bash
   kubectl label namespace yournamespace prometheus=true
   ```

Custom Grafana Dashboards can also be added to this same namespace by creting a `ConfigMap` with **a `grafana_dashboard` label (any value will do)**, containing the dashboard's json data. Please make sure that `"datasources"` are set to `"Prometheus"` in your dashboards!

*Note: even if these objects are created in a specific namespace, Prometheus can scrape metric targets in all namespaces.*

It is possible to configure alternative routes and receivers for Alertmanager. This is done in your cluster definition file under the addons section. Example:

   ```yaml
   spec:
    cluster_monitoring:
      alertmanager:
        custom_routes: |
          - match:
              namespace: my-namespace
            receiver: custom-receiver
   ```

- [Upstream documentation](https://prometheus.io/docs/alerting/configuration/#route)

   ```yaml
   spec:
    cluster_monitoring:
      alertmanager:
        custom_receivers_payload:
          | # (The whole yaml block should be encrypted via KMS with the context 'k8s_stack=secrets')
          - name: custom-receiver
            webhook_configs:
              - send_resolved: true
                url: <opsgenie_api_url>
   ```

- [Upstream documentation](https://prometheus.io/docs/alerting/configuration/#receiver)

*Note: This configuration can be made by creating a PR to your repo (optional), and/or communicated to your Customer Lead because this needs to be rolled out to the cluster.*

### Example ServiceMonitor

```yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    prometheus: application
  name: myapplication-php-fpm-exporter
  namespace: mynamespace
spec:
  endpoints:
    - targetPort: 8080
      interval: 30s
  namespaceSelector:
    matchNames:
      - production
  selector:
    matchLabels:
      app: application
      component: php
```

You can find more examples in the official [Prometheus Operator documentation](https://github.com/coreos/prometheus-operator/tree/master/Documentation/user-guides) or get inspired by the ones already deployed in the cluster:

```bash
kubectl get servicemonitors --all-namespaces
```

### Example PrometheusRule

```yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    prometheus: application
  name: myapplication-alert-rules
  namespace: mynamespace
spec:
  groups:
  - name: myapplication.rules
    rules:
    - alert: MyApplicationPhpFpmDown
      expr: phpfpm_up{job="application"} == 0
      for: 10m
      labels:
        severity: critical
        namespace: namespace
      annotations:
        description: '{{`{{ $value }}`}}% of {{`{{ $labels.job }}`}} PHP-FPM are down!'
        summary: PHP-FPM down
        runbook_url: 'https://github.com/myorg/myapplication/tree/master/runbook.md#alert-name-myapplicationphpfpmdown'
```

You can find more examples in the official [Prometheus Operator documentation](https://github.com/coreos/prometheus-operator/tree/master/Documentation/user-guides) or get inspired by the ones already deployed in the cluster:

```bash
kubectl get prometheusrules --all-namespaces
```

**Note:** we use the `namespace` label in the alerts, to distinguish between infrastructure and application alerts, and distribute them to the appropriate receivers. If the namespace label is set to any of the namespaces we are responsible for (e.g. infrastructure, cert-manager, keda, istio-system, ...), or if the alert doesn't have a namespace label (a sort of catch-all), we consider them infrastructure, and are routed to our on-call system and Slack channels. Otherwise the alerts are considered application alerts and routed to the `#devops_<customername>_alerts` Slack channel (and any other receivers that you define in the future). This label can be "hardcoded" as an alert label in the alert definition, or exposed from the alert expression. This is important since some alerts span multiple namespaces and it's desirable to get the namespace from which the alert originated.
**Note:** we highly recommend including a `runbook_url` annotation to all alerts so the engineer that handles those alerts has all the needed information and can troubleshoot issues faster.

### Example Grafana Dashboard

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    grafana_dashboard: application
  name: grafana-dashboard-myapplication
  namespace: mynamespace
data:
  grafana-dashboard-myapplication.json: |
{ <Grafana dashboard json> }
```

You can get inspired by some of the dashboards already deployed in the cluster:

```bash
kubectl get configmaps -l grafana_dashboard --all-namespaces
```

## AWS services monitoring

AWS services can also be monitored via Prometheus and Alertmanager, like the rest of the cluster. To do so we use the [Prometheus cloudwatch-exporter](https://github.com/prometheus/cloudwatch_exporter), which imports CloudWatch metrics into Prometheus. From there we can build alerts that trigger when some conditions happen.

The cloudwatch-exporter is not deployed by default as a base component of the reference solution, as it's highly dependent on the customer needs.

We provide pre-made Helm charts for some AWS resources, like [RDS](https://github.com/skyscrapers/charts/tree/master/rds-monitoring), [Redshift](https://github.com/skyscrapers/charts/tree/master/redshift-monitoring) and [Elasticsearch](https://github.com/skyscrapers/charts/tree/master/elasticsearch-monitoring), which deploy the cloudwatch-exporter and some predefined alerts, but additional cloudwatch-exporters can be deployed to import any other metrics needed. Be aware that exporting data from Cloudwatch is quite costly, and every additional exported metric requires additional API calls, so make sure you only export the metrics you'll use.

Normally, you'll deploy a different cloudwatch-exporter for each AWS service that you want to monitor, as each of them will probably require different period configurations.

You'll also need an IAM role for the cloudwatch-exporter with the following policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "cloudwatch:ListMetrics",
        "cloudwatch:GetMetricStatistics",
        "tag:GetResources"
      ],
      "Resource": "*"
    }
  ]
}
```

*Note that a single role can be used for all cloudwatch exporters deployed on the same cluster.*

## Recommendations and best practices

### Prometheus labels

As the [Prometheus documentation](https://prometheus.io/docs/practices/naming/#labels) states:

> Use labels to differentiate the characteristics of the thing that is being measured:
>
> - api_http_requests_total - differentiate request types: type="create|update|delete"
> - api_request_duration_seconds - differentiate request stages: stage="extract|transform|load"

It's **important** to note the CAUTION box in the documentation, that states:

> CAUTION: Remember that every unique combination of key-value label pairs represents a new time series, which can dramatically increase the amount of data stored. Do not use labels to store dimensions with high cardinality (many different label values), such as user IDs, email addresses, or other unbounded sets of values.

Not following that advise can cause the whole Prometheus setup to become unstable, go out of memory and eventually cause collateral damage on the node that's running on. A good example can be found in [this Github issue](https://github.com/prometheus/client_golang/issues/491).

This is how Prometheus would perform with "controlled" metric labels:

![prometheus-healthy](./images/prometheus-healthy.png)

Vs. a Prometheus with "uncontrolled" metric labels:

![prometheus-unhealthy](./images/prometheus-unhealthy.png)

## Prometheus scrapers for common technologies

Here's a list of Prometheus scrapers already available for common frameworks.

### PHP

#### Native

Prometheus has a [native client library](https://github.com/Jimdo/prometheus_client_php) for PHP. This is easy to implement inside your application, but by default doesn't expose standard metrics. This is ideal if you want to expose your own metrics (can also be business metrics).

#### PHP-FPM

If you want to get PHP-FPM metrics, we recommend using [this exporter](https://github.com/hipages/php-fpm_exporter). It's being actively maintained and the documentation is reasonably good. You have to setup the exporter as a sidecar container in your pods/task-definition, then it'll access the PHP-FPM socket to read statistics and expose them as Prometheus metrics.

You first need to expose the metrics in PHP-FPM. You can do this by adding the following config to your PHP-FPM image.

```ini
pm.status_path = /status
```

Then you'll need to add the `php-fpm-exporter` as a sidecar container to your pod/task-definition.

Here is an example for **k8s**:

```yaml
- name: {{ template "app.fullname" . }}-fpm-exporter
  image: "hipages/php-fpm_exporter:0.5.2"
  command: ["--phpfpm.scrape-uri", "tcp://<IP_ADDRESS>:{{ .Values.app.port }}/status"]
  ports:
    - name: prom
      containerPort: 9253
      protocol: TCP
  livenessProbe:
    tcpSocket:
      port: prom
    initialDelaySeconds: 10
    periodSeconds: 5
  readinessProbe:
    tcpSocket:
      port: prom
    initialDelaySeconds: 10
    timeoutSeconds: 5
```

*Note that you'll need to adjust `{{ template "app.fullname" . }}` and `{{ .Values.app.port }}` to the correct helm variables. The first one represents the app name we want to monitor. The second is the php-fpm port of the application.*

### Ruby

#### Native

Prometheus has a [native client library](https://github.com/prometheus/client_ruby) for Ruby. This is a really good library when you run your ruby application as single process. Unfortunately a lot of applications use Unicorn or another multi-process integration. When using a multi-process Ruby you can best use the [fork](https://gitlab.com/gitlab-org/prometheus-client-mmap) of GitLab.

You have to integrate this library in your application and expose it as an endpoint. Once that is done, you can add a `ServiceMonitor` to scrape it.

#### Workers

Workers by default don't expose a webserver to scrape from. This will have to change and every worker will need to expose a simple webserver so that Prometheus can scrape its metrics.

It is really discouraged to use Pushgateway for this. For more info why this is discouraged, see the [Pushgateway documentation](https://prometheus.io/docs/practices/pushing/#should-i-be-using-the-pushgateway).

### Nginx

Nginx has an exporter through the [Nginx VTS module](https://github.com/vozlt/nginx-module-vts). We [forked](https://github.com/skyscrapers/docker-images/tree/master/nginx) the official Docker Nginx image and added the VTS module to nginx. We had to fork it because the VTS module needs to be compiled with Nginx.

#### Setup

1. Use our [Nginx](https://hub.docker.com/r/skyscrapers/nginx/) Docker image instead of the upstream Nginx.
2. Add the [exporter](https://github.com/hnlq715/nginx-vts-exporter) as sidecar to the pod/task-definition.

Example for **k8s**:

```yaml
- name: {{ template "app.fullname" . }}-exporter
  image: "sophos/nginx-vts-exporter:v0.10.0"
  env:
    - name: NGINX_STATUS
      value: http://localhost:9999/status/format/json
  ports:
    - name: prom
      containerPort: 9913
```

*Note that you will need to adjust `{{ template "app.fullname" . }}` to the correct helm variables. It represents the app name you want to monitor.*

### RabbitMQ

Starting from version 3.8.0, RabbitMQ ships with built-in Prometheus & Grafana support. The Prometheus metric collector needs to be enabled via the `rabbitmq_prometheus` plugin. Head to the [official documentation](https://www.rabbitmq.com/prometheus.html#overview-prometheus) to know more on how to enable and use it.

Once the `rabbitmq_prometheus` plugin is enabled, the metrics port needs to be exposed in the RabbitMQ Pods and Service. RabbitMQ uses TCP port `15692` by default.

Then a `ServiceMonitor` is needed to instruct Prometheus to scrape the RabbitMQ service. Follow the [instructions above](#example-servicemonitor) to set up the correct `ServiceMonitor`.

At this point the RabbitMQ metrics should already be available in Prometheus. We can also deploy a RabbitMQ overview dashboard in Grafana, which displays detailed graphs and metrics from the data collected in Prometheus. Reach out to your Customer Lead in case you'd be interested in such dashboard.

repository: skyscrapers/documentation

repo_name: skyscrapers/documentation


text:
php-pdftoppm
=============

PHP wrapper for the [pdftoppm command][1] which is part of
[poppler-utils][2].

The Pdftoppm is a library that handles conversion of PDF files to images. It is available on variety of systems.

Available packages:
[http://pkgs.org/download/poppler-utils][3]

Usage
-------------
```
use Wb\PdfToPpm\PdfToPpm;
$pdfToPpm = PdfToPpm::create();
// $result is an instance of \FilesystemIterator
$result1 = $pdfToPpm->convertPdf('path/to/pdf');
$result2 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp');

// Save as png
$result3 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp', true);

// Set specific resolution
$result4 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp', true, 300);

```

Testing
-------------

```
cp phpunit.xml.dist phpunit.xml
```

Change the phpunit.xml ```env``` ```binary``` directive if necessary.

```
composer install
```

```
php vendor/bin/phpunit
```

[1]: http://linux.die.net/man/1/pdftoppm
[2]: http://en.wikipedia.org/wiki/Poppler_(software)
[3]: http://pkgs.org/download/poppler-utils

repository: gitter-badger/php-pdftoppm

repo_name: gitter-badger/php-pdftoppm