text:
---
title: Jenkins- Introduction
permalink: /jenkins/introduction
key: jenkins-introduction
categories:
- Jenkins
tags:
- Jenkins
---

Jenkins – Introduction
======================

Jenkins is an open source automation tool written in Java programming language
that allows continuous integration.

### What Is Continuous Integration.

![](media/d7f8e6b3541d1103e500ef5860123155.png)

**Continuous Integration**, every code commit is built and tested, but, is not
in a condition to be released. I mean the build application is not automatically
deployed on the test servers in order to validate it using different types of
Blackbox testing like - User Acceptance Testing (UAT).

**Continuous Delivery**, the application is continuously **deployed on the test
servers for UAT**. Or, you can say the application is ready to be released to
production anytime. So, obviously Continuous Integration is necessary for
Continuous Delivery.

**Continuous Deployment** is the next step past Continuous Delivery, where you
are not just creating a deployable package, but you are actually deploying it in
an automated fashion.

### Continuous Integration Tools

![](media/95378412d318153ae1647d803f275689.png)

**Bamboo**
This is available with **free trial license**. Bamboo is written in Java and it
is easily works with JIRA & Bitbucket. It’s also allow you to import jenkins
data to Bamboo easily. Bamboo also supports others tools like AWS, Amazon S3,
Ant, Docker, codeDeploy, Maven, Git & SVN.

<https://www.atlassian.com/software/bamboo>

**TeamCity**
java based continuous integration server which is belongs to JetBrains labs. It
is available **in free and paid license for users**. It’s free version offers
almost all the features but for up to 20 build configurations and 3 free Build
Agents. Teamcity also supports different tools and frameworks and also it’s
available with wide variety of plugins. It’s also support .Net features which
makes it suitable for .Net projects.

<https://www.jetbrains.com/teamcity/>

**Travis CI**
**Travis CI** is an open source continuous integration tool which is written in
RUBY. It’s easily get sync with GitHub. It’s supports platforms like Linux, Mac
or iOS and also supports many languages in which Node js, php, Xcode, python,
java, are few of them. It also performs parallel test runs using their great
APIs and command line tools. **Free for open repositories, Enterprise for
private.**
<https://travis-ci.org/getting_started>

**UrbanCode**
UBuild-UDeploy-URelease is also known as Urbancode deploy is a collaborative
product of IBM. UrbanCode from IBM is built.So its Paid.
<https://developer.ibm.com/urbancode/>

**CruiseControl**
Open Source. Very old. <http://cruisecontrol.sourceforge.net/>

## Types of Environments

1. **Development**

2. **QA** -only Functional testing of the system

3. **Integration Testing** -Tests the system from end to end

4. **User Acceptance Testing(UAT**) -user will validate the functionality over
time.

5. **CERT** -CERT is Certification environment! It’s just where you certify your
product so that it can move to production

6. **Production** - Production

7. **Production Parallel** -A parallel of production to replicate production
issues

# How Jenkins works

![https://static.javatpoint.com/tutorial/jenkins/images/continuous-integration-with-jenkins.png](media/dfb6651cdaab43865faec872db7ff847.png)

-   developer commits the code to the source code repository. Meanwhile, the
    Jenkins checks the repository at regular intervals for changes.

-   Soon after a commit occurs, the Jenkins server finds the changes that have
    occurred in the source code repository. Jenkins will draw those changes and
    will start preparing a new build.

-   If the build fails, then the concerned team will be notified.

-   If built is successful, then Jenkins server deploys the built in the test
    server.

-   After testing, Jenkins server generates a feedback and then notifies the
    developers about the build and test results.

-   It will continue to verify the source code repository for changes made in
    the source code and the whole process keeps on repeating.

Jenkins Architecture
--------------------

Jenkins architecture has two components:

-   Jenkins Master/Server

-   Jenkins Slave/Node

![https://static.javatpoint.com/tutorial/jenkins/images/jenkins-architecture.jpg](media/a4711b5b3d00e290a5fdc8d0431fa4e9.jpg)

Jenkins Installation
--------------------

### Windows

1.[Download & Install
Java](https://www.oracle.com/technetwork/java/javase/downloads/index.html)

[2.Download Jenkins war File](https://jenkins.io/download/)

3.Open Command Line as **Administrator** & Run below cmd by navigate to
downloaded location

```python
java -jar Jenkins.war

#By changing Port number
java -jar jenkins.war --httpPort=2222

```

![](media/e3e811f1239d7db095396557c9744da9.png)
Copy the password from console

4.Accessing Jenkins by <http://localhost:8080> , it will ask for the
Administrator password – Paste above copied password.
![](media/a56715b54981aec8d7c634b600ad9199.png)

5.Next, select plug-ins to install.
![](media/bf4d1dd00b288cbf1eabfc64c7130964.png)

6.Create admin user.
![](media/71ce93b62e6ea2d7542f0e9f131ea48a.png)

7.After that’s just click finish, I will navigate to Dashboard page.
![](media/0dd874fb6eb0f20266759d9317564c1f.png)

# Ubuntu -vagrant

**Installing Java**

-   Open a terminal window on your Ubuntu server.

-   Issue the command below & Allow the installation to complete.

```python
sudo add-apt-repository ppa:webupd8team/java
sudo -E add-apt-repository ppa:openjdk-r/ppa

sudo apt-get update
sudo apt-get install openjdk-8-jdk
```

To verify Java has been installed, issue the command:
```python
java --version
```

**Jenkins Install**

```python
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ >
/etc/apt/sources.list.d/jenkins.list'

sudo apt-get update
sudo apt-get install Jenkins -y
```

**Check Status**
```python
service jenkins status
systemctl status jenkins
```

**jenkins restart**
```python
# Usage: /etc/init.d/jenkins {start\|stop\|status\|restart\|force-reload}
sudo /etc/init.d/jenkins restart

# Jenkins Install location
/etc/init.d/jenkins

# Port Change
edit the /etc/default/jenkins to replace HTTP_PORT=8081
```

**To Access Jenkins VIA Browser**

-   Open the vagrant file (should be in the directory where you specified to
    create a new vagrant machine).

-   Search for config.vm.network.
`config.vm.network "private_network", ip: "<IP_ADDRESS>"`

-   Here ip address (<IP_ADDRESS>) can be any ip address you want.

-   Now logout from the vagrant machine and reload your vagrant machine by this
    command vagrant reload.

Access Jenkins : <http://<IP_ADDRESS>:8080/login?from=%2F>

![](media/d75a30fbbc076c915f1c91a495b54fa1.png)

In the terminal window, we’ll use the **cat** command to display the password:
`sudo cat /var/lib/jenkins/secrets/initialAdminPassword`

> Follow same steps as windows Installation from now on wards.

## CentOS – Vagrant

**Installing Java**
`sudo yum install java-1.8.0-openjdk-devel`

To verify Java has been installed, issue the command:
```python
java --version
```

**Install Jenkins**

To enable Jenkins repository, import the GPG key using the following curl
command:
```python
curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo|
sudo tee /etc/yum.repos.d/jenkins.repo

sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
```

install the latest stable version of Jenkins
`sudo yum install jenkins`

Start Jenkins
`sudo systemctl start jenkins`

Check Status
`systemctl status Jenkins`
`service jenkins status`

Finally enable the Jenkins service to start on system boot.
`sudo systemctl enable jenkins`

Update Vagrant file with Private IP to able to access with host system browser
`config.vm.network "private_network", ip: "<IP_ADDRESS>"`

Reload vagrant CentOS box
`vagrant reload`

Access Jenkins <http://<IP_ADDRESS>:8080> , for the first time enter password by doing
```python
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
O/p : 576f5d4d5e6a45b68061ba22c08eb27a
```
Select Plugins to install > Done!!!

Manage Jenkins
--------------

**Configure System**

Configure global settings and paths.

-   **Home directory** -where Jenkins stores all of its data in file system.

-   **Maven Configuration** - Installation location, MAVEN_HOME, .m2 location,

-   **Jenkins URL** - Custom Jenkins URL

-   **SonarQube** - Servers Details

-   **E-mail Notification** - SMTP servers

-   **Artifactory servers**

-   **Subversion**

**Configure Global Security**
Secure Jenkins; define who can access/use the system.

**Configure Credentials**
Configure the credential providers and types – LDAP servers.

**Global Tool Configuration**
Configure tools, their locations and automatic installers.

-   Maven installations

-   JDK installations

-   Ant installations

-   SonarQube Scanner installations

**Reload Configuration from Disk**
Discard all the loaded data in memory and reload everything from file system.
Useful when you modified config files directly on disk.

**Manage Plugins**
Add, remove, disable or enable plugins that can extend the functionality of
Jenkins.

**System Information**
Displays various environmental information to assist trouble-shooting.

**System Log**
System log captures output from java.util.logging output related to Jenkins.

**Load Statistics**
Check your resource utilization and see if you need more computers for your builds.

**Jenkins CLI**
Access/manage Jenkins from your shell, or from your script.

**Script Console**
Executes arbitrary script for administration/trouble-shooting/diagnostics.

**Manage Nodes and Clouds**
Add, remove, control and monitor the various nodes that Jenkins runs jobs on.

**Manage Users**
Create/delete/modify users that can log in to this Jenkins

**Prepare for Shutdown**
Stops executing new builds, so that the system can be eventually shut down
safely.

path: /jenkins/1 Jenkins – Introduction.md

filename: 1 Jenkins – Introduction.md


text:
# SimpleRec
Simple Recommendation Engine in Python

Based on the  Correlated Cross Occurrence originally put forth by [Ted Dunning](http://tdunning.blogspot.com/2008/03/surprise-and-coincidence.html)

And the Mahout version:

https://github.com/apache/mahout/blob/08e02602e947ff945b9bd73ab5f0b45863df3e53/spark/src/test/scala/org/apache/mahout/cf/SimilarityAnalysisSuite.scala#L49
https://github.com/apache/mahout/blob/08e02602e947ff945b9bd73ab5f0b45863df3e53/math/src/test/java/org/apache/mahout/math/stats/LogLikelihoodTest.java#L50
https://github.com/apache/mahout/blob/4f2108c576daaa3198671568eaa619266e787b1a/math/src/main/java/org/apache/mahout/math/stats/LogLikelihood.java#L1

license: MIT

repository: mgcdanny/SimpleRec

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: mgcdanny/SimpleRec


text:
---
layout: post
change_frequency: weekly
priority: 0.8
published: true
comments: true
date: 2013-03-15 14:11:59
title: PHP wrapper for DigitalOcean API
summary: If you use DigitalOcean, PHP and Composer - you should give a look to this little library that I just open-sourced. I made for my own need. Do not hesitate to PR, refactor, typo, CS ... :)
category: php
tags: api digitalocean
redirects:
- /DigitalOcean
---

Version **1.0.0** is released!

![DigitalOcean CLI](http://i.imgur.com/Zhvk5yr.png)

--

[DigitalOcean](https://www.digitalocean.com) is built for Developers, helps to get things done faster and to deploy an SSD cloud server in less than 55 seconds with a dedicated IP and root access. [Read more](https://www.digitalocean.com/features).

2 PHP libraries exists which are [Dropper](https://github.com/StylusEater/Dropper) and [DigitalOcean-PHP-Class](https://github.com/tuefekci/DigitalOcean-PHP-Class) but they are not in packagist :S

For my **own needs** I made a library which can be installed via [Composer](https://getcomposer.org/). You can find it [here](https://packagist.org/packages/toin0u/digitalocean).

The first release, **0.1.0**, has only the basic implementation. I planned to implement a console so it will be easy to interact with DigitalOcean :)

If you need a wapper in other languages, please look [here](https://www.digitalocean.com/community/questions/community-built-tools) :)


text:
[![PyPI](https://img.shields.io/pypi/v/tryalgo.svg)](https://pypi.python.org/pypi/tryalgo/)
[![PyPI](https://img.shields.io/pypi/pyversions/tryalgo.svg)](https://pypi.python.org/pypi/tryalgo/)
![Pylint score](https://mperlet.github.io/pybadge/badges/10.svg)
[![Codecov](https://img.shields.io/codecov/c/github/jilljenn/tryalgo.svg)](https://codecov.io/gh/jilljenn/tryalgo/)

# Algorithmic Problem Solving

Algorithms and data structures for preparing programming competitions (e.g. ICPC, [see more](https://tryalgo.org/contests/)) and coding interviews.
By Christoph Dürr and Jill-Jênn Vie.

[Our book](https://tryalgo.org/book) is available in French, English, Simplified and Traditional Chinese.

## Install

    pip install tryalgo

## Documentation

- [Documentation](http://jilljenn.github.io/tryalgo/) of tryalgo 1.4
- [Blog tryalgo.org](http://tryalgo.org) in French and English

## Demo: [TryAlgo in Paris](http://nbviewer.jupyter.org/github/jilljenn/tryalgo/blob/master/examples/TryAlgo%20Maps%20in%20Paris.ipynb)

Shortest paths on the graph of Paris.

To run it yourself:

    pip install -r examples/requirements.txt
	jupyter notebook  # Then go to examples folder

## Usage

**Dynamic programming** some example with coin change:

```python
from tryalgo import coin_change

print(coin_change([3, 5, 11], 29))  # True because 29 = 6 x 3 + 0 x 5 + 1 x 11
```

***Des chiffres et des lettres*** (that inspired *Countdown*)

```python
from tryalgo.arithm_expr_target import arithm_expr_target

arithm_expr_target([25, 50, 75, 100, 3, 6], 952)
```

Returns `'((((75*3)*(100+6))-50)/25)=952'`.

## Tests

All algorithms are thoroughly tested. These tests can be used to [practice your programming skills](https://tryalgo.org/en/miscellaneous/2019/08/10/how-to-practice-algorithms-with-tryalgo/)!

```python
python -m unittest
```

Most snippets from the book are within 76 columns (French version) or 75 columns (English version).

Our code is checked. Using optional requirements, you can check it too:

    pip install pycodestyle pylint
    make pycodestyle  # PEP8
	make pylint

## Found a bug?

Please [drop an issue](https://github.com/jilljenn/tryalgo/issues).

## Authors

© 2016–2023, Christoph Dürr and Jill-Jênn Vie (vie@jill-jenn.net).
Released under the MIT License.

## Contributors

Thanks!

- Louis Abraham
- Lilian Besson
- Xavier Carcelle
- Stéphane Henriot
- Ryan Lahfa
- Olivier Marty
- Samuel Tardieu

repository: jilljenn/tryalgo

gha_language: Python

gha_license_id: MIT

repo_name: jilljenn/tryalgo


text:
### Example output of `ios_facts`

Below are examples of facts the `ios_facts` module will collect for different
Cisco IOS routers and switches.

* [Cisco IE3000](ios_facts_ie3000.json)
* more to add...

repository: mjuenema/ansible-role-secure-cisco-ios

repo_name: mjuenema/ansible-role-secure-cisco-ios


text:
Django project template for wq framework
=========================================

This is the recommended Django project template for projects utilizing the [wq framework], with [wq.app] for the front end and [wq.db] as the backend component.   This template is meant to be used together with [wq.start].  See the [Getting Started] docs for more information.

### Rationale

This project template is also useful as an example of how to build a web app with [RequireJS] and a [Django REST Framework] backend.  It differs from the default Django project template in a few key ways:

 * A default Apache2 WSGI configuration is included in `conf/`
 * All static files are kept in the `app/` folder, with the idea that they will be built with a RequireJS-powered [build process].  This clean separation between the front end and backend components makes it easier to wrap the front end in [PhoneGap] for release on app stores.
 * Because of this separation, the root of the Django project is in `db/` rather than at the top level of the project.  `db/` is included on the Python path in the Apache config (and implicitly when running `./manage.py`).
 * Mustache templates are kept at the top level, because they are [shared between the client and the server](http://wq.io/docs/templates).

[wq framework]: http://wq.io/
[wq.app]: https://wq.io/wq.app
[wq.db]: https://wq.io/wq.db
[wq.start]: https://wq.io/wq.start
[Getting Started]: https://wq.io/docs/setup
[RequireJS]: http://requirejs.org
[Django REST Framework]: http://www.django-rest-framework.org
[build process]: http://wq.io/docs/build
[PhoneGap]: http://phonegap.com


text:
# Start Communications Internet Usage Tracker
This simple tool uses the Start Communications API to grab your latest usage statistics and puts it into a (somewhat) nice UI.

# USAGE

At the top of index.php, you will find:

```php
/*	Configure this first! Update the $usage_url to your own:
*	URL should look something like: www.start.ca/support/usage/api?key=123456ABCDEFG12345ABCDEF
*	For more information, visit http://www.start.ca/support/usage/api */
$usage_url = 'https://your-own-start-communications-usage-api-url';

//	Set your timezone
date_default_timezone_set("America/New_York");

//	Set your monthly limit in GB. The default below is 200GB.
$limit = 200;

//	Show daily usage - Adds a section below to view your daily usage (only works on your current Start Communications network)
$show_daily_usage = false;
```

Plug in your own Start Communications usage API url, timezone, and monthly limit to view your current internet usage this month.

# Note
This tool is only for those who have a limited amount of bandwidth every month. Those who have unlimited and still want to check their usage, go to your Start Communications page to view this information.

repository: lalaman/start-communications-usage

repo_name: lalaman/start-communications-usage


text:
# Main

This repository is the main repository for our artifact release for *Keeping Privacy Labels Honest* a publication in the *Proceedings on Privacy Enhancing Technologies Symposium 2022*.
In this repository you will find our bibtex, our acknowledgements, and further guidance on the structure of this github org containing the relevant artifacts.
If you have any questions, feel free to open a ticket or simply email us.

Please be aware that most of the work was done in 2021 and leveraged API endpoints might have gone dead by now or slightly changed in how to access them.

## Contents

This artifact release contains our raw data set of all Privacy Labels we evaluated as well as the source code for actually downloading privacy labels, analyzing privacy labels, automating traffic collection on an iPhone, as well as analyzing the collected traffic.

### Screenshots

[This](https://github.com/Keeping-Privacy-Labels-Honest/screenshots) is our raw data set containing our screenshots made of the analyzed apps.

### Privacy Labels

[This](https://github.com/Keeping-Privacy-Labels-Honest/privacyLabels) is our raw data set containing all analyzed privacy labels.

### Privacy Label Downloader

[This](https://github.com/Keeping-Privacy-Labels-Honest/IndiaPaleAle) is the tool to use the 3u API to get a list of app ids that can then be used to download privacy labels from the Apple store.

### iPhone automation

[This](https://github.com/Keeping-Privacy-Labels-Honest/ios-app-analyzer) is our script for automating the install, run, and stop of different apps on the iPhone. You require an jailbroken iPhone as well as a set of IPA files linked to the account on that iPhone.

### Analyzing Privacy Labels and Traffic

[This](https://github.com/Keeping-Privacy-Labels-Honest/ledeco) is our main tool. It will analyze a given set of privacy label and generate pretty graphs, as well as analyze the traffic collected when running apps on the iPhone.

# Acknowledgements

- This project was conceived and executed at the [Institute for Application Security (Technische Universität Braunschweig)](https://www.tu-braunschweig.de/ias)

- This project has received funding from the European Union’s Horizon 2020 research and innovation  programme under grant agreement No 101019206.

- This project has received funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy - EXC 2092 CASA - 390781972.

- [Datenanfragen.de e. V.](https://www.datarequests.org) is a non profit organisation co-founded by one of our authors (Benjamin Altpeter), they will further use the technology developed during this project to fight for our privacy rights.

# Docker

Both [the privacy label downloader](https://github.com/Keeping-Privacy-Labels-Honest/IndiaPaleAle/tree/main/resources/docker) and [our main tool](https://github.com/Keeping-Privacy-Labels-Honest/ledeco/tree/main/resources/docker) have a corresponding dockerfile to build the projects. Please build the privacy label downloader first as our main tool docker file depends on it.

You can then use the `-v` flag of `docker run` to mount required input our output folder and `-it --entrypoint /bin/bash` to start the container with a bash open. You may then use the running docker image as if it was your regular computer and can use our tools as described in the corresponding repository READMEs.

# BibTex
```
@inproceedings{PETS:Koch:2022,
 author = {Simon Koch and Malte Wessels and Benjamin Altpeter and Madita Olvermann and Martin Johns},
 title  = {Keeping Privacy Labels Honest},
 booktitle = {Proceedings on Privacy Enhancing Technologies Symposium (PoPETS 2022)},
 year = {2022}
}
```

repository: Keeping-Privacy-Labels-Honest/Main

branch_name: refs/heads/main

repo_name: Keeping-Privacy-Labels-Honest/Main


text:
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/itzg/mc-server-runner)](https://github.com/itzg/mc-server-runner/releases/latest)
[![Test](https://github.com/itzg/mc-server-runner/actions/workflows/test.yml/badge.svg)](https://github.com/itzg/mc-server-runner/actions/workflows/test.yml)

This is a process wrapper used by
[the itzg/minecraft-server Docker image](https://hub.docker.com/r/itzg/minecraft-server/)
to ensure the Minecraft server is stopped gracefully when the container is sent the `TERM` signal.

## Usage

> Available at any time using `-h`

```
  -bootstrap string
        Specifies a file with commands to initially send to the server
  -debug
        Enable debug logging
  -detach-stdin
        Don't forward stdin and allow process to be put in background
  -shell string
        When set, pass the arguments to this shell
  -stop-duration duration
        Amount of time in Golang duration to wait after sending the 'stop' command.
  -stop-server-announce-delay duration
        Amount of time in Golang duration to wait after announcing server shutdown
```

## Development Testing

Start a golang container for building and execution:

```bash
docker run -it --rm \
  -v ${PWD}:/build \
  -w /build \
  golang:1.19
```

Within that container, build/test by running:

```bash
go run . test/dump.sh
go run . test/bash-only.sh
# The following should fail
go run . --shell sh test/bash-only.sh
```

repository: itzg/mc-server-runner

gha_language: Go

repo_name: itzg/mc-server-runner


text:
# ![CI](https://github.com/lob/lob-openapi/workflows/CI/badge.svg) ![CD](https://github.com/lob/lob-openapi/workflows/CD/badge.svg) Lob [OpenAPI v3](https://github.com/OAI/OpenAPI-Specification) Specification

- [What is this project?](#what-is-this-project)
- [Contributing](#contributing)
- [Design](#design)
- [OpenAPI Style Guide and linting](#openapi-style-guide-and-linting)
- [Readability](#readability)
- [OAS v3.1 compatibility](#oas-v31-compatibility)
- [Previewing the spec as docs (aka QAing your work)](#previewing-the-spec-as-docs-aka-qaing-your-work)
- [Bundled spec](#bundled-spec)
- [See also](#see-also)

## What is this project?

We're writing an OpenAPI v3 authored specification for the current [Lob API](https://docs.lob.com/).
This repo contains the spec as well as a growing set of tooling for working with OpenAPI v3 specs.

## Contributing

[Contributing Guide](CONTRIBUTING.md)

## Design

Our spec is a multifile spec organized semantically, by _resource_, instead of syntactically, by OpenAPI element. Organizing the spec semantically reduces cognitive friction, helping developers reason from _interaction_ (endpoints) to data (and process) design. As developers from multiple teams work with the spec, the design surfaces business semantics rather than presenting the canonical wall-o-yaml (or json-schema) that typifies the traditional API spec.

```
.
.
├── Lob-API-public.yml            # base file (metadata, tags, servers, ...)
├── resources
│   ├── addresses                 # elements specific to addresses
│   │   ├── addresses.yml         # operations on /addresses
│   │   ├── address.yml           # operations on /addresses/{id}
│   │   ├── attributes
│   │   │   └── ...
│   │   ├── models
│   │   │   └── address.yml
│   │   └── responses
│   │       ├── address.yml
│   │       └── all_addresses.yml
│   └── postcards                 # elements specific to postcards
│       ├── postcards.yml         # operations on /postcards
│       ├── postcard.yml          # operations on /postcards/{id}
│       └── ...
├── shared                        # elements used by multiple resources
│   ├── attributes                # properties not of type `object`
│   ├── headers
│   ├── models                    # properties of type `object`
│   ├── parameters
│   └── responses
|
├── actions                       # private github actions or resources needed by actions
│   ├── contract_tests
│   └── redoc
├── dist                          # contents created during CD by github actions
└── tests                         # contract tests
    ├── setup.js                  # contract test framework
    ├── addresses_test.js         # tests for addresses resource
    ├── us_verifications.test.js  # tests for us_verifications resource...
    └── ...
```

## OpenAPI Style Guide and linting

Our OpenAPI style guide is an extension of
[Spectral's](https://meta.stoplight.io/docs/spectral/README.md) [OpenAPI
ruleset](https://meta.stoplight.io/docs/spectral/docs/reference/openapi-rules.md). Spectral's
ruleset goes beyond the OpenAPI v3 standard to incorporate a recommended set of
best practices.

Spectral runs in CI on push and pull request. You can also run Spectral locally
via `npm run lint`. VS Code users can use the
[stoplight.spectral](https://marketplace.visualstudio.com/items?itemName=stoplight.spectral)
VS Code extension.

## Readability

We use [Prettier](https://prettier.io/) to ensure that all our code follows a consist format for
maximum readability. You can run `prettier` as you work via `npm run pretty` and/or through [editor integrations](https://prettier.io/docs/en/editors.html) for many major editors.

In addition, a pre-commit githook runs `prettier --check .` (the same check run in CI).

## OAS v3.1 compatibility

On February 15, 2021, the [OpenAPI Initiative](https://www.openapis.org/) published [OpenAPI v3.1](https://spec.openapis.org/oas/v3.1.0).
OAS 3.1 includes many [extremely useful changes](https://github.com/OAI/OpenAPI-Specification/releases/tag/3.1.0-rc0), including full JSON schema compatibility and the ability to extend discriminators with specification extensions.

We will move to v3.1 as soon as is practical. In the meantime, we're working to minimize the changes we'll need to make. Some changes, like switching from `nullable` to `null`, are both unavoidable and easy. Others, like using `ReadOnly` and `WriteOnly` with `required`, can and should be avoided.

## Previewing the spec as docs (aka QAing your work)

Each time a commit is pushed to github, we generate documentation for the
API from the spec using [redoc](https://github.com/Redocly/redoc). The generated
docs are pushed to `docs/index.html` in the branch.

In addition to the file generated on push to github, you can
generate the same single file version of the documentation
(`docs/index.html`) at any time locally by running `npm run redoc`.

## Bundled spec

A lot of tooling for working with OpenAPI specs does not support the full
specification. In particular, many tools do not support multiple file specs.
We maintain a single file 'bundled' version of the spec for use with such
tools. The bundled version is generated as part of CI/CD, and can be found
on github at `dist/Lob-API-bundled.yml` in each branch.

You can also generate a bundled version locally at any time using `npm run bundle`.

The CLI tool used by `npm run bundle` can do much more than bundle a multiple file spec
into a single file. It can convert specs between `YAML` and `JSON`, fully
dereference a spec, and more.

## See also

- [Lob API docs generated from this spec (DRAFT)](https://lob.github.io/lob-openapi/)
- [Full Lob API documentation (LIVE)](https://docs.lob.com/)
- [Lobsters](https://www.lob.com/careers) only
  - [Notion: Lob API OpenAPI Project](https://www.notion.so/lob/Lob-API-v1-OpenAPI-spec-d6c3229d31bc45329d18e01905117fda)
  - [Notion: OpenAPI tooling](https://www.notion.so/lob/OpenAPI-tooling-e17f5a864a4a48d1886dcd95b53cf694)


text:
# cq-cli

![tests](https://github.com/CadQuery/cq-cli/workflows/tests/badge.svg)

## Contents

* [Introduction](https://github.com/CadQuery/cq-cli#introduction)
* [Getting Help](https://github.com/CadQuery/cq-cli#getting_help)
* [Installation](https://github.com/CadQuery/cq-cli#installation)
* [Usage](https://github.com/CadQuery/cq-cli#usage)
* [Examples](https://github.com/CadQuery/cq-cli#examples)
* [Drawbacks](https://github.com/CadQuery/cq-cli#drawbacks)
* [Contributing](https://github.com/CadQuery/cq-cli#contributing)

## Introduction

***Please Note*** cq-cli is in alpha currently. Major features may be broken, and the application may change a lot before a full release.

cq-cli is a Command Line Interface for executing CadQuery scripts and converting their output to another format. It uses a plugin system where "codecs" can be placed in the cqcodecs directory and will be automatically loaded and used if a user selects that codec from the command line.

cq-cli is designed to be a batteries-included distribution, although this approach comes with some drawbacks as listed below. However, to have a CadQuery conversion utility that requires no installation and no Anaconda environment can be useful in certain cases.

It is possible to specify input and output files using arguments, but cq-cli also allows the use to the stdin, stdout and stderr streams so that it can be used in a pipeline.

Linux, MacOS and Windows are supported, but some features may be used differently or may not work the same in Windows.

## Getting Help

In addition to opening an issue on this repo, there is a [CadQuery Discord channel](https://discord.gg/qz3uAdF) and a [Google Group](https://groups.google.com/g/cadquery) that you can join to ask for help getting started with cq-cli.

## Installation

Download a binary distribution that is appropriate for your operating system from the [latest release](https://github.com/CadQuery/cq-cli/releases/tag/v0.1.0-alpha), extract the zip file, and make sure to put the cq-cli binary in the PATH. Then the CLI can be invoked as `cq-cli` (`cq-cli.exe` on Windows).

If installing on Windows, the [latest redistributable for Visual Studio](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) will need to be installed.

If a development installation is desired, see the [Contributing](#contributing) section below.

## Usage

usage: cq-cli.py [-h] [--codec CODEC] [--infile INFILE] [--outfile OUTFILE] [--errfile ERRFILE] [--params PARAMS] [--outputopts OPTS] [--validate VALIDATE]

Command line utility for converting CadQuery script output to various other output formats.

optional arguments:
* -h, --help Show this help message and exit
* --codec CODEC The codec to use when converting the CadQuery output. Must match the name of a codec file in the cqcodecs directory.
* --infile INFILE The input CadQuery script to convert.
* --outfile OUTFILE File to write the converted CadQuery output to. Prints to stdout if not specified.
* --errfile ERRFILE File to write any errors to. Prints to stderr if not specified.
* --params PARAMS A colon and semicolon delimited string (no spaces) of key/value pairs representing variables and their values in the CadQuery script. i.e. var1:10.0;var2:4.0;
* --outputopts OPTS A colon and semicolon delimited string (no spaces) of key/value pairs representing options to pass to the selected codec.  i.e. width:100;height:200;
* --validate VALIDATE Setting to true forces the CLI to only parse and validate the script and not produce converted output.

## Examples

1. Find out what codecs are available.
```
./cq-cli.py --codec help
```
2. Validate a CadQuery script.
```
./cq-cli.py --validate true --infile /input/path/script.py
```
3. Convert a CadQuery script to STEP format and output to stdout.
```
./cq-cli.py --codec step --infile /input/path/script.py
```
4. Convert a CadQuery script to STEP format and write to a file.
```
./cq-cli.py --codec step --infile /input/path/script.py --outfile /output/path/newfile.step
```
5. Convert a CadQuery script and write any errors to a separate file.
```
./cq-cli.py --codec step --infile /input/path/script.py -errfile /error/path/error.txt
```
6. Convert a CadQuery script using the stdin and stdout streams. This example counts the lines in the resulting STEP output as a trivial example.
```
cat /input/path/script.py | cq-cli.py --codec step | wc -l
```
7. Convert a CadQuery script to SVG, passing in output options to influence the resulting image.
```
./cq-cli.py --codec svg --infile /input/path/script.py --outfile /output/path/newfile.svg --outputopts "width:100;height:100;marginLeft:12;marginTop:12;showAxes:False;projectionDir:(0.5,0.5,0.5);strokeWidth:0.25;strokeColor:(255,0,0);hiddenColor:(0,0,255);showHidden:True;"
```

## Drawbacks

* The file (and directory) size for cq-cli is very large. cq-cli uses pyinstaller to package the binaries for each platform, and must embed all needed dependencies. The OCP and OCCT library dependencies add a minimum of ~270 MB of data on top of the included Python distribution. It is possible that the pyinstaller spec file could be optimized. If you are interested in helping with this, please let us know by opening an issue.
* Startup times for the single binary are relatively slow. If startup and execution time is important to you, consider using the pyinstaller_dir.spec spec file with pyinstaller: `pyinstaller pyinstaller_dir.spec`.

## Contributing

If you want to help improve and expand cq-cli, the following steps should get you up and running with a development setup. There is a  [CadQuery Discord channel](https://discord.gg/qz3uAdF) and a [Google Group](https://groups.google.com/g/cadquery) that you can join to ask for help getting started.

### Anaconda Environment

A CadQuery Anaconda environment is required to run and build cq-cli via PyInstaller. For those unfamiliar (or uncomfortable) with Anaconda, it is probably best to start by installing Miniconda to a local directory and to avoid running `conda init`. After performing a local directory installation, an Anaconda environment can be activated via the [scripts,bin]/activate scripts. This will help avoid polluting and breaking the local Python installation.

Once the conda command is available, it is recommended that users build the environment from the latest master of the cadquery repo.
```
conda create -n cq-cli
conda activate cq-cli
conda install -c cadquery -c conda-forge cadquery=master
```

### Adding a Codec

The codec plugin system is based on naming conventions so that cq-cli knows what codec options to accept from the user. When adding a codec, make sure to place it in the `cqcodecs` directory and follow the naming convention `cq_codec_[your codec name].py`. The `your codec name` part of the filename will automatically be used as the codec name that the user specifies.

A good example to start with when creating your own codec would be `cqcodecs/cq_codec_step.py` as it shows a simple implementation of the codec that relies on CadQuery to do all the heavy lifting. At the very least, your codec needs to have a `convert` function that takes in a [CQGI BuildResult object](https://cadquery.readthedocs.io/en/latest/cqgi.html#cadquery.cqgi.BuildResult) and returns a string representing the converted model(s). As an alternative, cq-cli will pass the output file name, which makes it possible to write the output to the outfile path directly from the codec. If `None` is returned from the `convert` function, cq-cli will assume that the output was written directly to the output file by the codec.

For pyinstaller to know about the new dynamically loaded codec, it must be added to the `hiddenimports` array in both cq-cli_onfile_pyinstaller.spec and cq-cli_dir_pyinstaller.spec files. Leave the `.py` off of the name when adding to the array, for instance `codec.cq_codec_step` is the string used for the STEP codec. When only running a codec locally and not contributing it, this step is not required.

### Adding a Codec Test

A test is required when adding a codec to cq-cli, but is easy to add. Add a file named `test_[your codec name]_codec.py` in the tests directory, and add the test to it. `test_step_codec.py` would be a good template to base any new tests off of.

### pyinstaller

If building cq-cli to run as a stand-alone app is required, there are two modes to build it in: `onefile` and `dir` (directory). onefile mode creates a single file for the app, which is easy to distribute but takes longer to start up run on each execution. dir mode creates a directory with numerous dependency files in it, including the cq-cli binary file, and starts up faster than the single file. However, the directory distribution can take up more than twice the disk space and can be messier to distribute. A PyInstaller spec file has been provided for both modes, and selecting between them only requires the addition of a command line argument. The commands to build in each type of mode are outlined below.

There are a few packages, including PyInstaller, must be installed via conda or pip before executing either of the `pyinstaller` commands below.
```
pip install pyinstaller
pip install path
```
The output for both of the commands will be in the `dist` directory. If the mode argument is left off, `onefile` is assumed.

#### pyinstaller onefile
```
pyinstaller cq-cli_pyinstaller.spec onefile
```

#### pyinstaller directory
```
pyinstaller cq-cli_pyinstaller.spec dir
```

repository: jmwright/cq-cli

repo_name: jmwright/cq-cli


text:
## Occurrence Clustering

Provides utilities to cluster GBIF occurrence records.

Status: Having explored approaches using Spark ML (no success due to data skew) and
[LinkedIn ScANNs](https://github.com/linkedin/scanns) (limited success, needs more investigation)
this uses a declarative rule-based approach making use of domain knowledge. A multi-blocking stage
groups candidate record pairs, followed by a pair-wise comparison to detect links within the group.

The initial focus is on specimens to locate:
 1. Physical records (e.g. Isotypes and specimens split and deposited in multiple herbaria)
 2. Database duplicates across datasets (huge biases observed within datasets (e.g. gutworm datasets))
 3. Strong links between sequence records, citations and specimens

This is intended to be run regularly (e.g. daily) and therefore performance is of critical concern.

The output is bulk loaded into HBase, suitable for an API to deployed on.

Build the project: `mvn clean package`

To run (while in exploration - will be made into Oozie workflow later):

Setup hbase:
```
disable 'occurrence_relationships_experimental'
drop 'occurrence_relationships_experimental'
create 'occurrence_relationships_experimental',
  {NAME => 'o', VERSIONS => 1, COMPRESSION => 'SNAPPY', DATA_BLOCK_ENCODING => 'FAST_DIFF', BLOOMFILTER => 'NONE'},
 {SPLITS => [
    '01','02','03','04','05','06','07','08','09','10',
    '11','12','13','14','15','16','17','18','19','20',
    '21','22','23','24','25','26','27','28','29','30',
    '31','32','33','34','35','36','37','38','39','40',
    '41','42','43','44','45','46','47','48','49','50',
    '51','52','53','54','55','56','57','58','59','60',
    '61','62','63','64','65','66','67','68','69','70',
    '71','72','73','74','75','76','77','78','79','80',
    '81','82','83','84','85','86','87','88','89','90',
    '91','92','93','94','95','96','97','98','99'
  ]}
```

Remove hive tables from the target database:
```
drop table occurrence_clustering_hashed;
drop table occurrence_clustering_candidates;
drop table occurrence_relationships;
```

Run the job (In production this configuration takes 2.6 hours with ~2.3B records)
```
nohup sudo -u hdfs spark2-submit --class org.gbif.pipelines.clustering.Cluster \
  --master yarn --num-executors 100 \
  --executor-cores 6 \
  --conf spark.dynamicAllocation.enabled=false \
  --conf spark.sql.shuffle.partitions=1000 \
  --executor-memory 64G \
  --driver-memory 4G \
  clustering-gbif-2.14.0-SNAPSHOT.jar \
  --hive-db prod_h \
  --hive-table-hashed occurrence_clustering_hashed \
  --hive-table-candidates occurrence_clustering_candidates  \
  --hive-table-relationships occurrence_relationships \
  --hbase-table occurrence_relationships_experimental \
  --hbase-regions 100 \
  --hbase-zk c5zk1.gbif.org,c5zk2.gbif.org,c5zk3.gbif.org \
  --hfile-dir /tmp/clustering &
```

Load HBase
```
sudo -u hdfs hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles -Dcreate.table=no \
  /tmp/clustering occurrence_relationships_experimental
```

repository: gbif/pipelines

branch_name: refs/heads/dev

gha_language: Java

repo_name: gbif/pipelines


text:
# **AppD-AWS-AppRegistry**

Prototype utility of an [AppDynamics](https://www.appdynamics.com) integration with [AWS AppRegistry](https://aws.amazon.com/blogs/mt/increase-application-visibility-governance-using-aws-service-catalog-appregistry/).  It can be used to pull the meta-data of one or more applications from an AppDynamics Controller and push it to the AppRegistry.

## **Dependecies**

- Java 1.8
  - Needed to run the utility Jar file [AppD-AWS-AppRegistry.jar](https://github.com/Appdynamics/AppD-AWS-AppRegistry/blob/main/AppD-AWS-AppRegistry.jar)
- AWS Account
  - An AWS user in the account with appropriate permissions for AppRegistry
- Maven - ( Optional )
  - Used for re-building the Jar file

## **Usage**

The utility Jar file uses the list of application names along with the connection details for an AppDynamics Controller that are defined in the [application-config.yaml](https://github.com/Appdynamics/AppD-AWS-AppRegistry/blob/main/application-config.yaml) configuration file.

The utiltiy Jar file can be run with one of the two supported options:

- **Create**
  - The create option pulls the meta-data of the applications defined in the configuration file from the AppDynamics Controller defined in the configuration file and publishes that data to AppRegistry.
- **List**
  - The list option simply lists the details of all the applications contained within AppRegistry.

## **Configuration File**

The configuration file is where you define the following:

- Connection details to the AppDynamics Controller
  -  controllerAccount:
  -  controllerUsername:
  -  controllerPassword:
  -  controllerPort:
  -  controllerSslEnabled:

- The list of application names to publish to AppRegistry
  -  applicationNames:

- The option to add the AppDynamics Id of the application to the application name when publishing to AppRegistry
  - addAppIdToAppName:

*Example Configuration File:*
```bash
!!com.appdynamics.cloud.aws.appregistry.ApplicationConfig

controllerAccount: "mydemo"
controllerUsername: "demouser1"
controllerPassword: "demouser1pwd123"
controllerHostName: "mydemo.saas.appdynamics.com"
controllerPort: 443
controllerSslEnabled: true

applicationNames:
  - AD-Travel
  - Ecommerce
  - AD-Movie Tickets Core

addAppIdToAppName: false
```

**Note:** At the time this utility was created, AppRegistry had specific naming conventions for the name of each application and each attribute group.  To accomodate this, the utility converts any dash characters and space characters found in the application name as it is defined within AppDynamics, with the underscore character when it publishes the application meta-data to AppRegistry.

## **Create Functionality**

The utility connects to the AppDynamics Controller defined in the configuration file (**application-config.yaml**) and then retrieves a list of applications in the Controller.  If any of the application names match one of the application names defined in the configuration file then the utility publishes the data for that application to AppRegistry.

Below is an example command that executes the utility with the create action to publish the applications defined in the configuration file specified.  Adjust the path to the configuration file and the utility Jar file to specify the appropriate locations for both.

*Example command for the create action:*

```bash
java -DappConfigFilePath=/home/ec2-user/application-config.yaml -DappAction=create -jar /home/ec2-user/AppD-AWS-AppRegistry.jar
```

The specific data published for an application and its components are as follows:

### **Application Level Data:**

This data is found either in the top level [Application](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/appregistry/model/Application.html) object within the AppRegistry once published or in the tags associated with it.

| Attribute Name | Description                                  | Attribute Source | Attribute Type |
| :------------- | :------------------------------------------- | :--------------: | :------------: |
| App Name | The name of the application with naming convention conversions | Controller | App Attribute |
| App Id | The id of the application generated by AppRegistry   | AppRegistry | App Attribute |
| App Description | The description of the application as found in the Controller | Controller | App Attribute |
| App ARN | The Amazon resource name (ARN) that specifies the application across services | AppRegistry | App Attribute |
| Associated Resource Count | The number of top-level resources that were registered as part of this application | AppRegistry | App Attribute |
| Creation Time | The ISO-8601 formatted timestamp of the moment when the application was created | AppRegistry | App Attribute |
| Last Update Time | The ISO-8601 formatted timestamp of the moment when the application was last updated | AppRegistry | App Attribute |
| APPD_APP_NAME | The name of the application as defined in the AppDynamics Controller | Controller | App Tag |
| APPD_APP_ID | The id of the application as defined in the AppDynamics Controller | Controller | App Tag |
| APPD_APP_CONTROLLER_HOST | The host name of the AppDynamics Controller this application is reporting to | Controller | App Tag |
| APPD_APP_NUMBER_OF_TIERS | The number of tiers contained in this application | Controller | App Tag |
| APPD_APP_NUMBER_OF_NODES | The number of nodes contained in this application | Controller | App Tag |

### **Attribute Group Level Data:**

This data is found in the [AttributeGroup](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/appregistry/model/AttributeGroup.html) object within the AppRegistry once published.  The utility creates only one AttributeGroup for each Application created.

| Attribute Name | Description                                  | Attribute Source | Attribute Type |
| :------------- | :------------------------------------------- | :--------------: | :------------: |
| Group Name | The name of the attribute group, similarly named after the application | Controller | Group Attribute |
| Group Id | The id of the attribute group generated by AppRegistry | AppRegistry | Group Attribute |
| Group Description | The description of the attribute group | Controller | Group Attribute |
| Group ARN | The Amazon resource name (ARN) that specifies the attribute group across services | AppRegistry | Group Attribute |
| Group Attributes | The JSON representation of the application with its tiers and nodes | Controller | Group Attribute |

![image](images/ad-travel-app-01.png)

## **List Functionality**

Below is an example command that executes the utility with the list action that lists all the applications defined in the AppRegistry.  Adjust the path to the configuration file and the utility Jar file to specify the appropriate locations for both.

*Example command for the list action:*

```bash
java -DappConfigFilePath=/home/ec2-user/application-config.yaml -DappAction=list -jar /home/ec2-user/AppD-AWS-AppRegistry.jar
```

repository: Appdynamics/AppD-AWS-AppRegistry

repo_name: Appdynamics/AppD-AWS-AppRegistry


text:
Day 1
=====

[PRINSEQ](http://prinseq.sourceforge.net) was used for quality trimming and data analysis (link to standalone version is [here](http://sourceforge.net/projects/prinseq/files/standalone)).


text:
## About nunomaduro.com

nunomaduro.com was created by, and is maintained by [Nuno Maduro](https://github.com/nunomaduro), and is a personal website.

## Support the development
**Do you like this project? Support it by donating**

- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)
- Patreon: [Donate](https://www.patreon.com/nunomaduro)

## License

nunomaduro.com is an open-sourced software licensed under the [MIT license](LICENSE.md).

gha_language: PHP


text:
---
  topics:
  - title: Using the $KANDY$ Mobile SDK in the iOS Project
    body: In this section you will learn how to use the $KANDY$ Mobile SDK in the iOS project.
  - title: Creating the iOS project
    body: In this section you will learn how to create the iOS project using XCode.
---
# Get Started

## Installation

This section contains the required steps for beginning your mobile application development by using $KANDY$ Mobile SDK in the Xcode iOS project.

## Compatible XCode and Swift Versions

The applications which uses $KANDY$ MobileSDK can be built with the XCode 11.x+ and Swift 5.1.2+ versions.

## Creating the iOS project

1. Open the Xcode application.
2. Click Create a new Xcode project.
3. Click **iOS** heading, select **Single View App**, and click **Next**.

![alt text](img/get_started_1.png)

4. Type the project details and click **Create**.
5. Select one of the installation methods below

### Cocoapods installation
1. Add below pods to your Podfile (If you dont have any Podfile, visit this link to install cocoapods: https://guides.cocoapods.org/using/using-cocoapods.html)

```ruby
...

target 'YOUR_TARGET_NAME' do
    pod 'KandyCPaaSMobileSDK', '~> $SDK_VERSION$ '
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

...
```

2. Go to project folder via command line and run "pod install" command and wait for cocoapods to finish installation of Kandy CPaaS MobileSDK & WebRTC frameworks and their dependencies

If you have a trouble with getting latest version of *$KANDY$ iOS SDK* plaese run these suggested commands [here](https://gist.github.com/mbinna/4202236) in project directory where Podfile is located.

### Manual Installation
**IMPORTANT:** This installation section applies to **$KANDY$ iOS SDK** versions prior to v2.17.0. If you are using a more recent version, follow the instructions [here](GetStarted?id=manual-installation-after-v2170).

 Before those steps you need to download **$KANDY$ iOS SDK** framework file from [this link](https://raw.githubusercontent.com/Kandy-IO/kandy-cpaas-ios-sdk/$SDK_VERSION$/dist/CPaaSSDK_$SDK_VERSION$.zip)

1. Go to project settings and navigate to **Build Phases**.
2. Add **CPaaSSDK.framework** under **Link Binary With Libraries** section.

![alt text](img/get_started_2.png)

3. Add the following frameworks to the project under the **Link Binary With Libraries**:
	* AvFoundation.framework
	* SystemConfiguration.framework
	* CFNetwork.framework
	* Security.framework
	* OpenGLES.framework
	* QuartzCore.framework
	* AudioToolbox.framework
	* CoreAudio.framework
	* CoreMedia.framework
	* CoreVideo.framework
	* CoreGraphics.framework
	* UIKit.framework
	* Foundation.framework
	* GLKit.framework
	* libc++.tbd
	* libsqlite3.tbd
	* libstdc++.6.0.9.tbd
	* libstdc++.tbd
	* libicucore.tbd

4. Add WebRTC.framework under the **Embedded Binaries** section in **General** tab on Project Settings. Select **Copy items if needed**.
5. Under the **Build Settings** section, search for **Framework Search Paths** and add the following:

  `$(PROJECT_DIR)/CPaaSSDK.framework/SubFrameworks/`

  **Note:** If framework is located in different place rather than main directory of project, above line should be modified accordingly.

6. The following part shows how to use **$KANDY$ Mobile SDK** with basic features. While codes are shared for both *Swift* and *Objective-C* languages, some parts may need different implementations, are also indicated.

  **If the project language is selected as *Swift*, do the following:**
  * Navigate to the **Build Settings** in the project settings.
  * Search for **Other Linker Flags** listed under the **Linking** and click.
  * Click **+** button in the list appeared next under to the **Other Linker Flags**.
  * Type *-ObjC* and close the panel.

  ![alt text](img/get_started_3.png)

  * In order to run framework, search for **Enable Bitcode** option listed under the **Build Options**, and change it to the **NO**.

  $KANDY$ Mobile SDK is now ready to use in the application.

### Manual Installation (After v2.17.0)
Support for XCFramework has been added to **$KANDY$ iOS SDK** with the v2.17.0 release. You can install **$KANDY$ iOS SDK** as XCFramework by following the steps below. (more information about XCFramework, see [link](https://help.apple.com/xcode/mac/11.4/#/dev6f6ac218b)).

First of all, you must have the **$KANDY$ iOS SDK** XCFramework file for installation. You can download from [this link](https://raw.githubusercontent.com/Kandy-IO/kandy-cpaas-ios-sdk/$SDK_VERSION$/dist/CPaaSSDK_$SDK_VERSION$.zip).

1. Go to project settings and navigate to **General**.
2. Add **CPaaSSDK.xcframework** and **WebRTC.xcframework** under **Framework, Libraries, and Embedded Content** section.

![Adding CPaaSSDK XCFramework to Project](img/get_started_6.png)

3. Add the following frameworks to the project under the **Link Binary With Libraries**:
	* AvFoundation.framework
	* SystemConfiguration.framework
	* CFNetwork.framework
	* Security.framework
	* OpenGLES.framework
	* QuartzCore.framework
	* AudioToolbox.framework
	* CoreAudio.framework
	* CoreMedia.framework
	* CoreVideo.framework
	* CoreGraphics.framework
	* UIKit.framework
	* Foundation.framework
	* GLKit.framework
	* libc++.tbd
	* libsqlite3.tbd
	* libstdc++.6.0.9.tbd
	* libstdc++.tbd
	* libicucore.tbd

4. Under the **Build Settings** section, search for **Framework Search Paths** and add the following paths:

    **Debug & Release** Any iOS Simulator SDK:
    `$(PROJECT_DIR)/CPaaSSDK.xcframework/ios-arm64_x86_64-simulator/CPaaSSDK.framework/SubFrameworks/`

    **Debug & Release** Any iOS SDK:
    `$(PROJECT_DIR)/CPaaSSDK.xcframework/ios-arm64/CPaaSSDK.framework/SubFrameworks/`

    ![Fremework Search Paths](img/get_started_7.png)

    **Note:** If framework is located in different place rather than main directory of project, above line should be modified accordingly.

5. The following part shows how to use **$KANDY$ Mobile SDK** with basic features. While codes are shared for both *Swift* and *Objective-C* languages, some parts may need different implementations, are also indicated.

  **If the project language is selected as *Swift*, do the following:**
  * Navigate to the **Build Settings** in the project settings.
  * Search for **Other Linker Flags** listed under the **Linking** and click.
  * Click **+** button in the list appeared next under to the **Other Linker Flags**.
  * Type *-ObjC* and close the panel.

  ![alt text](img/get_started_3.png)

  * In order to run framework, search for **Enable Bitcode** option listed under the **Build Options**, and change it to the **NO**.

  $KANDY$ Mobile SDK is now ready to use in the application.

### Using the $KANDY$ Mobile SDK in the iOS Project
1. Open *Main.storyboard* and create a basic user interface which contains username, password text fields, and login button.

     Note, when importing $KANDY$ Mobile SDK please import main module instead of submodule for preventing further backward compability issues.

    eg. import CPaaSSDK for Swift and @import CPaaSSDK for Objective-C

2. Set **CPAuthenticationDelegate** to view controller and add protocol stubs.

![alt text](img/get_started_4.png)

3. In order to set configurations for registering to $KANDY$, add followings in to login action.

#### ** Swift Code **

```swift
import CPaaSSDK

let configuration = CPConfig.sharedInstance()
configuration.restServerUrl = "$KANDYFQDN$"
configuration.restServerPort = "443"
```

#### ** Objective-C Code **

```objectivec
@import CPaaSSDK;

CPConfig *configuration = [CPConfig sharedInstance];
configuration.restServerUrl = @"$KANDYFQDN$";
configuration.restServerPort = @"443";
```

4. Getting access and id token is explained in [**Getting Access and Id Token from Provider**](GetStarted.md#getting-access-and-id-token-from-provider) section in detail.

5. When all configurations are set correctly, connect method can be called as following.

#### ** Swift Code **

```swift
import CPaaSSDK

let services = [CPServiceInfo(type: .call, push: true), CPServiceInfo(type: .chat, push: true), CPServiceInfo(type: .sms, push: true)]

cpaas = CPaaS(services: services)
cpaas.authenticationService.delegate = self
cpaas.authenticationService.connect(idToken: <ID-Token>, accessToken: <Access-Token>, lifetime: 3600) { (error, channelInfo) in
    if let error = error {
        print("error occured: \(error.localizedDescription)")
        return
    }

    print("Channel Info: \(channelInfo!)")
}
```
#### ** Objective-C Code **

```objectivec
@import CPaaSSDK;

NSArray* services= @[[CPServiceInfo buildWithType:CPServiceTypeSms push:YES],
                    [CPServiceInfo buildWithType:CPServiceTypeCall push:YES],
                    [CPServiceInfo buildWithType:CPServiceTypeChat push:YES]];

cpaas = [[CPaaS alloc] initWithServices: services];
cpaas.authenticationService.delegate = self;
[cpaas.authenticationService connectWithIdToken:<YOUR_ID_TOKEN> accessToken:<YOUR_ACCESS_TOKEN> lifetime:lifetime completion:^(CPError * _Nullable error, NSString * _Nullable channelInfo) {
        if (error) {
        	NSLog(@"error occured: %@", error.localizedDescription);
        	return
        }

        NSLog(@"Channel Info: %@", channelInfo);
}];
```

6. When $KANDY$ is registered, **connectionStatusChanged(state:)** method will be called by *CPAuthenticationDelegate*.

![alt text](img/get_started_5.png)

## Getting Access and Id Token from Provider

To get more information about `clientID`, please look [here](https://apimarket.att.com/developer/quickstarts/rest-api/get-started#get-started-authentication-and-authorization)

#### ** Swift Code **

```swift
func requestAccessToken(completion: @escaping (_ error: String?, _ accessToken: String?)->()) {
    var request = createAuthenticationRequest(with: self.clientID)
    var bodyStr = String(format: "grant_type=password&username=%@&password=%@&client_id=%@&scope=openid", UserConfigurations.sharedInstance.username!, self.password!, self.clientID)
    bodyStr = self.clientSecret != nil && self.clientSecret != "" ? bodyStr+"&clientSecret="+self.clientSecret : bodyStr
    request.httpBody = bodyStr.data(using: String.Encoding.utf8)

    self.makeAccessTokenRequest(request: request, completion: completion)
}

private func createAuthenticationRequest(with clientID: String) -> URLRequest {

        let url = URL(string: "https://$KANDYFQDN$/cpaas/auth/v1/token")!
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
        return request

    }

private func makeAccessTokenRequest(request:URLRequest, completion: @escaping (_ error: String?, _ accessToken: String?)->()) {
    let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
        if let error = error {
            print("Can't get access token - Error: \(error.localizedDescription)")
            completion(error.localizedDescription, nil)
            return
        } else if let response = response as? HTTPURLResponse {
            if response.statusCode < 300 {
                if data != nil {
                    guard let json = try? JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions(rawValue: 0)),
                        let jsonDictionary = json as? [String: AnyObject] else {
                            print("Couldn't parse response body")
                            completion("Couldn't parse response body", nil)
                            return
                    }
                    //YOUR_ACCESS_TOKEN
                    let accessToken = jsonDictionary["access_token"] as? String
                    //YOUR_ID_TOKEN
                    if let idToken = jsonDictionary["id_token"] as? String { UserConfigurations.sharedInstance.idToken = idToken }

                    if let accessTokenStr = accessToken {
                        completion(nil, accessTokenStr)
                    } else {
                        completion("Can't get access token: \(jsonDictionary.description)", nil)
                    }
                }
            } else {
                // some http error code
                completion("\(response.statusCode) - \(HTTPURLResponse.localizedString(forStatusCode: response.statusCode))", nil)
            }
        } else {
            completion("Unexpected response.", nil)
        }
    }
    task.resume()
}
```
#### ** Objective-C Code **

```objectivec
(void)requestAccessToken: (void (^)(NSString *_Nullable error, NSString *_Nullable accessToken, NSString *_Nullable accessTokenTimeOut))completion {
    NSMutableURLRequest *request = [self createAuthenticationRequestWithClientID:_clientID];
    NSString *bodyStr = [NSString stringWithFormat:@"grant_type=password&username=%@&password=%@&client_id=%@&scope=openid", UserConfigurations.sharedInstance.username!, self.password!, self.clientID];
    bodyStr = _clientSecret && ![_clientSecret isEqualToString:@""] ? [NSString stringWithFormat:@"%@&client_secret=%@", bodyStr, _clientSecret] : bodyStr;

    [request setHTTPBody:[bodyStr dataUsingEncoding:kCFStringEncodingUTF8]];
    [self makeAccessTokenRequest:request completion:completion];
}

- (NSMutableURLRequest *) createAuthenticationRequestWithClientID: (NSString *)_id {
    NSString *urlStr = [NSString stringWithFormat:@"https:%@/cpaas/auth/v1/token", [[CPConfig sharedInstance] restServerUrl]];
    NSURL *url = [NSURL URLWithString:urlStr];
    NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url];
    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    return request;
}

 (void)makeAccessTokenRequest:(NSMutableURLRequest *)request completion: (void (^)(NSString * _Nullable error, NSString * _Nullable accessToken, NSString * _Nullable accessTokenTimeOut))completion {
    NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        if (error != nil) {
            completion([NSString stringWithFormat:@"Can't get access token - Error: %@", error.localizedDescription], nil, nil);
            return;
        }
        if (data != nil) {
            NSError *e = nil;
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&e];
            if (!dict) {
                NSLog(@"Couldn't parse response body - Error: %@", e);
                completion([NSString stringWithFormat:@"Couldn't parse response body - Error: %@", e], nil, nil);
            } else {
                //YOUR_ACCESS_TOKEN
                NSString *accessToken = dict[@"access_token"];
                //YOUR_ID_TOKEN
                NSString *idToken = dict[@"id_token"];
                if (idToken) [[UserConfigurations sharedInstance] setIdToken:idToken];
                if (accessToken) {
                    [self.CPaaS.authenticationService setToken:accessToken];
                    completion(nil, accessToken, dict[@"expires_in"]);
                } else {
                    completion([NSString stringWithFormat:@"Couldn't get access token - Error: %@", dict.description], nil, nil);
                }
            }
        }
    }];
    [task resume];
}
```

repository: Kandy-IO/kandy-cpaas-ios-sdk

gha_language: Objective-C

gha_license_id: NOASSERTION

repo_name: Kandy-IO/kandy-cpaas-ios-sdk


text:
# Milestone Delivery :mailbox:

**The [invoice form :pencil:](https://docs.google.com/forms/d/e/1FAIpQLSfmNYaoCgrxyhzgoKQ0ynQvnNRoTmgApz9NrMp-hd8mhIiO0A/viewform) has been filled out correctly for this milestone and the delivery is according to the official [milestone delivery guidelines](https://github.com/w3f/Grants-Program/blob/master/docs/milestone-deliverables-guidelines.md).**

* **Application Document:** [Contract](https://github.com/w3f/Grants-Program/blob/master/applications/QRUCIAL_DAO.md)
* **Milestone Number:** 2

**Context**
We have developed the frontend of QRUCIAL DAO, extended the system, fixed bugs and wrote the full how-to article. We started the live testnet.

**Deliverables**

| Number | Deliverable | Link | Notes |
| ------------- | ------------- | ------------- |------------- |
| 0a. | License | [Link](https://github.com/Qrucial/QRUCIAL-DAO/blob/milestone2/LICENSE) | - |
| 0b. | Documentation | [Wiki](https://github.com/Qrucial/QRUCIAL-DAO/wiki) | - |
| 0c. | Testing Guide | [Development and testing guide](https://github.com/Qrucial/QRUCIAL-DAO/wiki/Development-and-testing-guide) | - |
| 0d. | Docker | [Docker](https://github.com/Qrucial/QRUCIAL-DAO/blob/milestone2/docker/files/dockerfile) and [node-setup.sh](https://github.com/Qrucial/QRUCIAL-DAO/blob/milestone2/node-setup.sh) | The node-setup.sh prepares the system as a native node, while we also have the Docker image which starts the full system inside a container. Additionally ExoTools can be run as separate docker images. |
| 0e. | Article | [QDAO M2 article](https://cryptoctf.org/2023/06/08/delivery-of-qdao-milestone-2/)| - |
| 1. | ExoSys Deamon | [Source code](https://github.com/Qrucial/QRUCIAL-DAO/tree/milestone2/exosysd) | - |
| 2. | QRUCIAL DAO Frontend | [Frontend code](https://github.com/Qrucial/QRUCIAL-DAO/tree/milestone2/frontend/substrate-front-end-template) | - |
| 3. | ExoTool - CCA | [Added to audit script](https://github.com/Qrucial/QRUCIAL-DAO/blob/milestone2/exotools/docker/docker_files/scripts/audit_script.sh) | - |
| 4. | ExoTool - Octopus | [Added to audit script](https://github.com/Qrucial/QRUCIAL-DAO/blob/milestone2/exotools/docker/docker_files/scripts/audit_script.sh) | - |

**Additional Information**
- You can use our live testnet to test the system: https://qrucial.io/
- We keep the live testnet up to date to the main branch. If Alice key is depleted, contact us on Matrix.
- QDAO as a project is under development, changes are ongoing in the code.


text:
# Laravel JSON:API HTTP package

## Description

A package for Laravel projects supporting the [JSON:API](http://jsonapi.org)
specification.

Features supported in the package:

* Relationships
* Includes
* Filtering
* Pagination
* Sorting

For full details of the JSON:API spec see
[http://jsonapi.org/format](http://jsonapi.org/format).

## Installation using Composer

Use [Composer](https://getcomposer.org/) to install this package. If you don't
have Composer already installed, then install as per the
[documentation](https://getcomposer.org/doc/00-intro.md).

Inside your application folder run:

    composer require tomblakemore/laravel-jsonapi-http

## Setup

Add the service provider to the `config/app.php` file.

    'providers' => [
        ...

        JsonApiHttp\RequestServiceProvider::class
    ],

Add the following middleware groups to the `app\Http\Kernel.php` class.

    protected $middlewareGroups = [
        ...

        'jsonapi' => [
            \JsonApiHttp\Middleware\SetRequest::class,
            \JsonApiHttp\Middleware\CheckAcceptHeaders::class,
            \JsonApiHttp\Middleware\CheckForContentTypeHeader::class,
            \JsonApiHttp\Middleware\VerifyContentTypeHeader::class,
            \JsonApiHttp\Middleware\VerifyContent::class,
            \JsonApiHttp\Middleware\SetResponseHeaders::class
        ],

        'relationships' => [
            \JsonApiHttp\Middleware\VerifyRelationship::class,
            \JsonApiHttp\Middleware\AddRelationshipToModel::class,
            \JsonApiHttp\Middleware\RemoveRelationshipFromModel::class
        ],

        'resources' => [
            \JsonApiHttp\Middleware\VerifyResource::class,
            \JsonApiHttp\Middleware\AddResourceAttributesToModel::class,
            \JsonApiHttp\Middleware\AddResourceRelationshipsToModel::class,
            \JsonApiHttp\Middleware\RemoveResourceRelationshipsFromModel::class
        ]
    ];

## Basic usage

Below is a simple model and controller example for showing a list of people
and fetching a specific person.

Create the `people` table.

    php artisan make:migration create_people_table --create=people

Add the below to the migration file.

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('people', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->timestamps();
        });
    }

Create the `Person` model and fill in the property `$type`. The type is the
JSON:API resource type and should be the plural representation of the model
name, so in this case `people`.

    <?php

    namespace App;

    use JsonApiHttp\AbstractModel;

    class Person extends AbstractModel
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'people';
    }

A controller with two actions to fetch people and a person.

    <?php

    namespace App\Http\Controllers;

    use App\Person;

    use JsonApiHttp\Controller;
    use JsonApiHttp\Request;

    class PersonController extends Controller
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'people';

        /**
         * Display a list of people.
         *
         * @param \JsonApiHttp\Request $request
         * @return \Illuminate\Http\Response
         */
        public function index(Request $request)
        {
            $query = Person::query();

            $request->filter($query)->sort($query);

            $people = $request->paginate($query, Person::perPage());
            $people->appends($request->query());

            $resources = $this->resources($request, $people);

            return response($resources);
        }

        /**
         * Display a person.
         *
         * @param \JsonApiHttp\Request $request
         * @param \App\Person $person
         * @return \Illuminate\Http\Response
         */
        public function show(Request $request, Person $person)
        {
            $resource = $this->resource($request, $person);
            return response($resource);
        }
    }

Two routes to direct requests to the two controller actions.

    Route::group(['middleware' => ['jsonapi', 'resources']], function () {
        Route::get('/people', 'PersonController@index')->name('people.index');
        Route::get('/people/{person}', 'PersonController@show')->name('people.show');
    });

The resources are now accessible on the following endpoints:

* `GET /people`
* `GET /people/:id`

### Relationships

Objects can be represented by JSON:API relationship endpoints. We'll create a
simple `Patient` > `Doctor` relationship as an example.

Create the `doctors` table.

    php artisan make:migration create_doctors_table --create=doctors

Add the below to the migration file.

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('doctors', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->timestamps();
        });
    }

Create the `Doctor` model and `patients` relationship.

    <?php

    namespace App;

    use JsonApiHttp\AbstractModel;

    class Doctor extends AbstractModel
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'doctors';

        /**
         * @return \Illuminate\Database\Eloquent\Relations\HasMany
         */
        public function patients()
        {
            return $this->hasMany(Patient::class);
        }

        /**
         * Return any the relations to display in the JSON:API output.
         *
         * @return array
         */
        public function relations()
        {
            return ['patients'];
        }
    }

Create a controller for the relationships.

    <?php

    namespace App\Http\Controllers;

    use App\Doctor;

    use JsonApiHttp\RelationshipsController;
    use JsonApiHttp\Request;

    class DoctorRelationshipsController extends RelationshipsController
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'doctors';

        /**
         * Display a relation or collection of relations.
         *
         * @param \JsonApiHttp\Request $request
         * @param \App\Doctor $doctor
         * @param string $relation
         * @return \Illuminate\Http\Response
         */
        public function index(Request $request, Doctor $doctor, $relation)
        {
            $relations = $this->relations($request, $doctor, $relation);
            return response($relations);
        }

        /**
         * Display a relationship.
         *
         * @param \JsonApiHttp\Request $request
         * @param \App\Doctor $doctor
         * @param string $relation
         * @return \Illuminate\Http\Response
         */
        public function show(Request $request, Doctor $doctor, $relation)
        {
            $relationship = $this->relationship($request, $doctor, $relation);
            return response($relationship);
        }
    }

Create the `patients` table.

    php artisan make:migration create_patients_table --create=patients

Add the below to the migration file.

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('patients', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('doctor_id')->unsigned()->index();
            $table->foreign('doctor_id')->references('id')->on('doctors');
            $table->string('name');
            $table->timestamps();
        });
    }

Create the `Patient` model and `doctor` relationship.

    <?php

    namespace App;

    use JsonApiHttp\AbstractModel;

    class Patient extends AbstractModel
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'patients';

        /**
         * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
         */
        public function doctor()
        {
            return $this->belongsTo(Doctor::class);
        }

        /**
         * Return any the relations to display in the JSON:API output.
         *
         * @return array
         */
        public function relations()
        {
            return ['doctor'];
        }
    }

Create a controller for the relationships.

    <?php

    namespace App\Http\Controllers;

    use App\Patient;

    use JsonApiHttp\RelationshipsController;
    use JsonApiHttp\Request;

    class PatientRelationshipsController extends RelationshipsController
    {
        /**
         * The resource type.
         *
         * @var string
         */
        protected $type = 'patients';

        /**
         * Display a relation or collection of relations.
         *
         * @param \JsonApiHttp\Request $request
         * @param \App\Patient $patient
         * @param string $relation
         * @return \Illuminate\Http\Response
         */
        public function index(Request $request, Patient $patient, $relation)
        {
            $relations = $this->relations($request, $patient, $relation);
            return response($relations);
        }

        /**
         * Display a relationship.
         *
         * @param \JsonApiHttp\Request $request
         * @param \App\Patient $patient
         * @param string $relation
         * @return \Illuminate\Http\Response
         */
        public function show(Request $request, Patient $patient, $relation)
        {
            $relationship = $this->relationship($request, $patient, $relation);
            return response($relationship);
        }
    }

Create routes to direct requests to two relationship controllers.

    Route::group(['middleware' => ['jsonapi', 'relationships']], function () {

        Route::get(
            'doctors/{doctor}/{relation}',
            'DoctorRelationshipsController@index'
        )
        ->where('relation', 'patients')
        ->name('doctors.relations.index');

        Route::get(
            'doctors/{doctor}/relationships/{relation}',
            'DoctorRelationshipsController@show'
        )
        ->where('relation', 'patients')
        ->name('doctors.relations.show');

        Route::get(
            'patients/{patient}/{relation}',
            'PatientRelationshipsController@index'
        )
        ->where('relation', 'doctor')
        ->name('patients.relations.index');

        Route::get(
            'patients/{patient}/relationships/{relation}',
            'PatientRelationshipsController@show'
        )
        ->where('relation', 'doctor')
        ->name('patients.relations.show');

    });

The relationships are now accessible on the following endpoints:

* `GET /doctors/:id/patients`
* `GET /doctors/:id/relationships/patients`
* `GET /patients/:id/doctor`
* `GET /patients/:id/relationships/doctor`

### Includes

To fetch the related objects in a single request use the `?include` query
parameter.

    GET /patients/1?include=doctor

You can also use the dot notation to return the relations of relations.

    GET /patients/1?include=doctor.patients

### Filtering

To filter a result set pass a `filter` parameter in the query string.

The value can be a combination of comma separated values (AND) and/or pipe
separated values (OR).

Nesting of AND and OR operations can be achieved using parathesis.

The attribute and attribute/value pair to query on are joined by a colon
character.

Operators supported include `!` (not equal to), `< <= => > <>` (less and
greater than operators including an alternative not equal to operator), `^ !^`
(begins/does not begin with), `$ !$` (ends/does not end with), `^$ !^$`
(contains/does not contain).

To filter by a single attribute (exact value).

    GET /patients?filter=name:tom

To filter by multiple values on a single attribute.

    GET /patients?filter=name:(tom|ben)

Relationships can be queried with the value being one or more IDs of the
related resources to query on. Both belongs to and has many type relationships
are supported.

    GET /patients?filter=doctor:1

### Pagination

Use the `page` and `perPage` query parameters to control the paging of result
sets.

    GET /patients?page=1&perPage=10

### Sorting

Use the `sort` query parameter to sort a result set. The value should be an
attribute of the model. Prefix with `-` sign to sort descending. Multiple
attributes can be specified, separated by a comma.

    GET /patients?sort=-name

## Tests

These will be added soon!

repository: tomblakemore/laravel-jsonapi-http

repo_name: tomblakemore/laravel-jsonapi-http


text:
Simple Quantum Simulator Benchmark
----------------------------------

Target simulators are:
- Blueqat
- Cirq
- Qiskit
- SymPy

Benchmark circuits are:
- TIME_ADD - Execution time of quantum adder circuit (4bit + 4bit = 5bit, measure 10 times)
- TIME_SUB - Execution time of quantum subtractor circuit (4bit - 4bit = 5bit, measure 10 times)
- TIME_MUL - Execution time of quantum multiplier circuit (3bit * 3bit = 6bit, measure 10 times)
- TIME_MODULOADD - Execution time of quantum modulo-adder circuit (3bit + 3bit mod 3bit = 4bit, measure 10 times)

For SymPy, I emulated 'measure' operation by using random-choice of 'measure_all' results.

Summary
-------

| Simulator  | TIME_ADD    | TIME_SUB    | TIME_MUL    | TIME_MODULOADD |
| ---------- | ----------: | ----------: | ----------: | -------------: |
| Blueqat    |   1.731 sec |   1.720 sec |   6.313 sec |  34.661 sec    |
| Cirq       |  49.173 sec |  49.148 sec | 100.250 sec | 389.615 sec    |
| Qiskit     |   0.190 sec |   0.134 sec |   0.293 sec |   0.940 sec    |
| SymPy      | 199.883 sec | 199.850 sec | 149.376 sec | 435.899 sec    |


text:
For this meeting we'll have a few people showing us a bit about something they're working on, with an eye toward how we can learn to do the same:

- Jason Saitta on programming the Tango (3d reckoning device)
- Scott Hawley: "Tutorial on Recurrent Neural Networks"
- We'll also have some students making impulse responses at different locations in the room, who can show & tell us what they're doing.

Hope to see you!

Location: 15th & Wedgewood, JAAC building room 1034, Belmont University
Time: 6:30pm - 8:30pm.


text:
# EurekaCreditCard

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

## Usage

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

## Requirements

## Installation

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

```ruby
pod "EurekaCreditCard"
```

## Code
```swift
form +++= Section("Credit card information")

                <<< CreditCardRow() {
            //$0.title = "Card"
            $0.cardNumberPlaceholder = "Card Number"
            $0.expirationMonthPlaceholder = "MM"
            $0.expirationYearPlaceholder = "YY"
            $0.cvcPlaceholder = "CVC"
            //$0.dataSectionWidthPercentage = CGFloat(0.5)
//            $0.value = CreditCard()
            $0.value = CreditCard(
            cardNumber: "1",
                    expirationMonth: "02",
                    expirationYear: "2018",
                    cvc: "4"
            )
        }
```

## Screenshots

##### Styles
![Styles](demo_styles.png)

##### Selectors for month and year
![Selectors for month and year](demo_selector.png)

### TODO
* Swift 3 version
* SwiftValidator integration?

## Author

Demetrio Filocamo<EMAIL_ADDRESS>
## License

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

gha_language: Swift


text:
---
id: "account.AccountAuthorizedApp"
title: "Interface: AccountAuthorizedApp"
sidebar_label: "AccountAuthorizedApp"
custom_edit_url: null
---

[account](../modules/account.md).AccountAuthorizedApp

## Properties

### amount

 **amount**: `string`

#### Defined in

[account.ts:59](https://github.com/near/near-api-js/blob/ef6d7fbf/packages/near-api-js/src/account.ts#L59)

___

### contractId

 **contractId**: `string`

#### Defined in

[account.ts:58](https://github.com/near/near-api-js/blob/ef6d7fbf/packages/near-api-js/src/account.ts#L58)

___

### publicKey

 **publicKey**: `string`

#### Defined in

[account.ts:60](https://github.com/near/near-api-js/blob/ef6d7fbf/packages/near-api-js/src/account.ts#L60)

repository: think-in-universe/docs

gha_language: TypeScript

repo_name: think-in-universe/docs


text:
# Mandelbrot Set

This is a simulation and rendering of the Mandelbrot Set,  named after mathematician Benoit Mandelbrot, that provides a visual for the set of complex numbers that remain bounded in absolute value from the function.

![mandelbrot.png](https://github.com/SVJayanthi/MandelbrotSet/blob/master/output/mandelbrot_1.png)

The function is

  `f_{n+1} = f_{n}^2 + c`

with the initial condition simply formed by taking the coordinates in the complex plane,

  `f_{0} = x + iy`

It produces an aesthetic depiction of a fractal that does not diverge with recursive details similar in design to other parts of the fractal.

## Code

### Implementation

The programs were designed to simulate and render efficiently and each implemented unique high-performance optimization compilers. The namesake program was designed utilizing NUMBA AutoJIT high performance python compiler. The cuda extension was designed implementing parrallel computation with NVIDIA CUDA GPU technology.

### Dynamic

```
@autojit
def create_fractal(min_x, max_x, min_y, max_y, image, iters):
  height = image.shape[0]
  width = image.shape[1]

  pixel_size_x = (max_x - min_x) / width
  pixel_size_y = (max_y - min_y) / height

  for x in range(width):
    real = min_x + x * pixel_size_x
    for y in range(height):
      imag = min_y + y * pixel_size_y
      image[y, x] = mandel(real, imag, iters)

image = np.zeros((1024, 1536), dtype = np.uint8)
start = timer()
create_fractal(-2.0, 1.0, -1.0, 1.0, image, 20)
dt = timer() - start
```

### CUDA

```
@cuda.jit
def mandel_kernel(min_x, max_x, min_y, max_y, image, iters):
  height = image.shape[0]
  width = image.shape[1]

  pixel_size_x = (max_x - min_x) / width
  pixel_size_y = (max_y - min_y) / height

  startX, startY = cuda.grid(2)
  gridX = cuda.gridDim.x * cuda.blockDim.x;
  gridY = cuda.gridDim.y * cuda.blockDim.y;

  for x in range(startX, width, gridX):
    real = min_x + x * pixel_size_x
    for y in range(startY, height, gridY):
      imag = min_y + y * pixel_size_y
      image[y, x] = mandel_gpu(real, imag, iters)

gimage = np.zeros((1024, 1536), dtype = np.uint8)
blockdim = (32, 8)
griddim = (32, 16)

start = timer()
d_image = cuda.to_device(gimage)
mandel_kernel[griddim, blockdim](-2.0, 1.0, -1.0, 1.0, d_image, 20)
d_image.to_host()
dt = timer() - start
```

## License

[MIT](LICENSE)

repository: SVJayanthi/MandelbrotSet

repo_name: SVJayanthi/MandelbrotSet


text:
# Administrate::SerializedFields

[![Build Status: master](https://travis-ci.com/XPBytes/administrate-serialized_fields.svg)](https://travis-ci.com/XPBytes/administrate-serialized_fields)
[![Gem Version](https://badge.fury.io/rb/administrate-serialized_fields.svg)](https://badge.fury.io/rb/administrate-serialized_fields)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)

Automatically deserialize administrate fields on form submit.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'administrate-serialized_fields'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install administrate-serialized_fields

## Usage

In order to use this, `include 'Administrate::SerializedFields'` in your base admin `ApplicationController`.

```ruby
require 'administrate/serialized_fields'

class ApplicationController < Administrate::ApplicationController
  include Administrate::SerializedFields
end

class NotificationController < ApplicationController
  deserialize_json_fields :options, :messages, :settings
end
```

The `deserialize_json_fields` by default looks for `Oj` and falls back to `JSON`. Use `load:` or `deserialize_fields` to
apply custom behaviour or a different deserializer.

You _must_ ensure there is a method `read_param` that takes **2** arguments (key and value), as opposed to the 0.11.0
administrate one param (value). Alternatively, use the [`administrate-base_controller` gem](https://github.com/XPBytes/administrate-base_controller)
and get this addition for free.

```ruby
class Application < Administrate::ApplicationController
  protected

  def resource_params
    permitted = params.require(resource_class.model_name.param_key)
                      .permit(dashboard.permitted_attributes)
                      .to_h

    permitted.each_with_object(permitted) do |(k, v), result|
      result[k] = read_param(k, v)
    end
  end

  def read_param(_, data)
    if data.is_a?(ActionController::Parameters) && data[:type]
      return read_param_value(data)
    end

    data
  end
end
```

## Related

- [`Administrate`](https://github.com/thoughtbot/administrate): A Rails engine that helps you put together a super-flexible admin dashboard.
- [`Administrate::BaseController`](https://github.com/XPBytes/administrate-base_controller): :stars: A set of application controller improvements.

### Concerns

- [`Administrate::DefaultOrder`](https://github.com/XPBytes/administrate-default_order): :1234: Sets the default order for a resource in a administrate controller.

### Fields

- [`Administrate::Field::Code`](https://github.com/XPBytes/administrate-field-code): :pencil: A `text` field that shows code.
- [`Administrate::Field::Hyperlink`](https://github.com/XPBytes/administrate-field-hyperlink): :pencil: A `string` field that is shows a hyperlink.
- [`Adminisrtate::Field::JsonEditor`](https://github.com/XPBytes/administrate-field-json_editor): :pencil: A `text` field that shows a [JSON editor](https://github.com/josdejong/jsoneditor).
- [`Administrate::Field::LazyBelongsTo`](https://github.com/XPBytes/administrate-field-lazy_belongs_to): :pencil: A `belongs to`-like field that lazily loads candidates from a custom endpoint.
- [`Administrate::Field::ScopedBelongsTo`](https://github.com/XPBytes/administrate-field-scoped_belongs_to): :pencil: A `belongs_to` field that yields itself to the scope `lambda`.
- [`Administrate::Field::ScopedHasMany`](https://github.com/XPBytes/administrate-field-scoped_has_many): :pencil: A `has_many` field that yields itself to the scope `lambda`.
- [`Administrate::Field::TimeAgo`](https://github.com/XPBytes/administrate-field-time_ago): :pencil: A `date_time` field that shows its data as `time_ago` since.

## Development

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

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

## Contributing

Bug reports and pull requests are welcome on GitHub at [XPBytes/administrate-serialized_fields](https://github.com/XPBytes/administrate-serialized_fields).

gha_language: Ruby


text:
# inSelect - An AngularJS directive for indendation based group drop-down list

## Features

* Provides indendation for option values
* Single and Nested option group indendation
* Option group header can be bolded or unbolded by the user (Not Yet Implemented)
* Users can select the group option header which is the main feature of inSelect
* Coloring of options (Not Yet Implemented)
* Works in all modern browsers (IE8+, Chrome, Firefox, Safari etc.)

##How do I add this to my project?

You can download the unminified version manually from CDN
```
<script type="text/javascript" src="https://cdn.rawgit.com/nidhishkrishnan/in-select/master/in-select.js"></script>
```
Adding `inSelect` Dependency to your app
```
// Add inSelect as a dependency to your app
angular.module('your-app', ['inSelect']);
```
Use the below syntax in your templates:
```
<in-select ng-model="yourModal" select-list="selectList"></in-select>
```

## Compared to classic group related drop-down list

* Classic group related drop-down list uses `<optgroup>` for showing up the group header, but the main issue is that users can't select
  those header label at any cost ([Demo](https://jsfiddle.net/gm23gwq5/embedded/result/))

  <iframe width="100%" height="300" src="//jsfiddle.net/gvbodbb9/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

## Working Demo

Try out the demo :
[Demo](https://jsfiddle.net/a1jffmyt/)

repository: nidhishkrishnan/in-select

repo_name: nidhishkrishnan/in-select


text:
# Circle CI Demo

Build, Test and Deploy a modern webapp using CircleCI.

Technologies covered:
- Build a Spring Boot app with Maven (and caching maven repos!)
- Browser testing with Selenium and [Sauce Labs](https://saucelabs.com)
- Static Code Analysis with SonarQube
- Manual Approval/Promotion
- Blue/Green (zero downtime) Deployments with Cloud Foundry.

[![CircleCI](https://circleci.com/gh/eddiewebb/demo-blueskygreenbuilds.svg?style=svg)](https://circleci.com/gh/eddiewebb/demo-blueskygreenbuilds)
[![Maintainability](https://api.codeclimate.com/v1/badges/4c9bacea44f3d3993256/maintainability)](https://codeclimate.com/github/eddiewebb/demo-blueskygreenbuilds/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/4c9bacea44f3d3993256/test_coverage)](https://codeclimate.com/github/eddiewebb/demo-blueskygreenbuilds/test_coverage)

##  Testing
To test simple UI functionality we're using Spring Boot's test starter and SauceLabs Connect Tunnel binaries driven through Selenium's `WebDriver` interface.  The use of SauceLabs let's us run several browser combinations in parallel.

You can see these simple tests in [HomePagesTests.java](src/test/java/com/edwardawebb/circleci/demo/it/HomePageIT.java)

## Deploying on Cloud Foundry
One of my favorite features of CF is the **zero-downtime** deployments using [Blue/Green strategy](https://martinfowler.com/bliki/BlueGreenDeployment.html).

1. Push new version of app on a 'dark' URL not used by customers
1. Validate application health on dark URL
1. Begin routing customer facing URL to new version
1. Stop sending customer traffic to old version
1. Stop and remove previous version

![CloudFoundry panel showing blue and green version on unique routes](src/main/resources/static/images/bluegreen.png)

You can see this executed in [config.yml](.circleci/config.yml#L107)

#### Viewing
And live app visible on http://blueskygreenbuilds.com

## Running locally

This project uses spring boot, so run as you would any other like project to start on port :8080 locally.

```
mvn spring-boot:run
```

# Demo
See [demo-assets](demo-assets)

repository: heug/demo-blueskygreenbuilds

repo_name: heug/demo-blueskygreenbuilds


text:
---
layout: post
title: "Blogging with MovableType"
date: 2003-01-29 18:24
comments: true
categories: Blogging
author: Oliver Thylmann
---

It's done. I installed [MovableType](http://www.movabletype.org/) and I am loving it. This is so wonderful to use and optimize and I really like having all of it in my own database. Sure, [LiveJournal](http://www.livejournal.com/) is a very nice service and all, and I liked having it, but this is nicer. I really like the design, the templates system, management interface and capabilities like an RDF feed so other people can look at updates in my blog. Now I need to get my old LJ posts imported here and I am happy.

Next up would be getting the design done. At the moment I am just using a normal template and actually like it. I need to build it around my site though which will change once again. I have been using Typo3 as a content management system at [oliver.thylmann.com](http://oliver.thylmann.com/) but want to move away from that to build my own system. Sure, then I should actually build my own blogging system but lets now overdo it please.

That's it for now though. More coming soon. :)

extension: markdown