text:
---
layout: post
title: Summary of Densenet Paper
description: The authors developed a dense newtork model for image classification. The main idea of the network was to connect each layer to every other layer in the feed forward fashion to improve the information flow in both forward and backward ways of a network.
---

## Paper
- Title: Densely Connected Convolutional Networks ([Densenet](https://arxiv.org/abs/1608.06993))
- Submission date: 25 Aug 2016

## Key Contributions
- Developed densenet model for image classification.
- The idea of the dense convolutional neural network is to connect each layer to every other layer in the feed forward fashion.
- Concatenating feature-maps learned by different layers increases variation in the input of subsequent layers and improves efficiency.

## Advantages
The advantages of the denset are:
- Decrease the vanishing-gradient problem
- Improve feature propogation both in forward as well as backward fashion
- Encourage the feature reuse
- Reducing the number of parameters

## Densenet
Increased in the depth of convolutional neural network caused a problem of vanishing information about the input or gradiant when passing through many layers. In order to solve this, authors introduced an architecture with simple connectivity pattern to ensure the maximum flow of information between layers both in forward computation as well as in backward gradiants computation. This network connects all layers in such a way each layer obtains additional inputs from all preceding layers and passes its own feature-maps to all subsequent layers.

The network comprises L layers. Each layer implements a non-linear transformation $H_l([x_0, x_1, ..., x_{l-1}])$ where l indexes the layer. $H_l(.)$ can be a composite function of operations such as Batch normalization (BN), rectified linear unit (ReLU), pooling or convolution (Conv). Here $[x_0, x_1, ..., x_{l-1}]$ refers to concatenation of the feature-maps produced in layers $0,...,l-1$.

The concatenation operation mentioned above is not vitable when the size of feature-maps are variable. As we know, the essential part of image recognition convolutional networks is down-sampling layers. To facilitate the down-sampling in the architecture, authors divided the entire architecture into multiple densely connected dense blocks. The layers between these dense blocks are transition layers which perform convolution and pooling.

### DenseNet vs ResNet
Superficially, DenseNets are quite similar to ResNets. But the inputs format is different in two networks which lead to substantially different behaviours. The following table presents the differences between two networks.

|Feature| Densenet   |     Resnet     |
|:-----:|:---------------:|:-----------------------:|
|Format of passing previous layer features to other layers| by concatening| by summation|
|No of inputs to $l^{th}$ layer| $l$ | $1$ |
|Total no of connections in L-layer network| $L(L+1)/2$ | $L$ |
|The way to address vanishing-gradient problem| using dense connections|using stochastic depth|
|Performance Improvement|using power of deep architecture| using power of feature reuse|

## Experiments
Experiments are done on popular datasets like CIFAR-10 (C10), CIFAR-100 (C100), SVHN and Imagenet datasets. In C10+ and C100+ datasets, "+" indicates data augmentation. Error rates (%) on validation data are presented in the below table. The k parameter in DenseNet (k=\<num\>) below is growth rate, which means each composite function of a DenseNet produces k feature-maps.

|Method| Depth   | Params | C10| C10+| C100 | C100+ | SVHN|
|:-----:|:------:|:------:|:--:|:---:|:----:|:-----:|:---:|
|ResNet|110|1.7M|13.63|6.41|44.74|27.22|2.01|
|ResNet + Stochiastic Depth|110|1.7M|11.66|5.23|37.80|24.58|1.75|
|ResNet + Stochiastic Depth|1202|10.2M|-|4.91|-|-|-|
|ResNet (pre-activation)|164|1.7M|11.26|5.46|35.58|24.33|-|
|ResNet (pre-activation)|1001|10.2M|10.56|4.62|33.47|22.71|-|
|DenseNet (k=12)|40|1.0M|7.00|5.24|27.55|24.42|1.79|
|DenseNet (k=12)|100|7.0M|5.77|4.10|23.79|20.20|1.67|
|DenseNet (k=24)|100|27.2M|5.83|3.74|23.42|19.25|1.59|
|Densenet-BC (k=12)|100|0.8M|5.92|4.51|24.15|22.27|1.76|
|Densenet-BC (k=24)|250|15.3M|5.19|3.62|19.64|17.60|1.74|
|Densenet-BC (k=40)|190|25.6M|-|3.46|-|17.18|-|

 - DenseNet-B network - It introduces 1 x 1 convolution as a bottleneck layer before each 3 x 3 layer to reduce the number of input feature-maps, and thus to improve computational efficiency.
 - DenseNet-BC network - It is same as DenseNet-B with additional compression factor.

Compression factor $(\theta)$ - If a denseblock generates m feature-maps, then the next transition layer outputs $\theta \times m$ feature-maps (where $\theta$ varies from 0 to 1). This compression factor is introduced to improve model compactness.

In the above experiments, Densenet and DenseNet-BC uses 3 dense blocks as shown in the above network diagram.
Whereas for training on Imagenet dataset, DenseNet-BC uses four dense blocks.

|Model| top-1   | top-5 |
|:-----:|:------:|:------:|
|DenseNet-BC-121| 25.02 / 23.61|7.71 /6.66|
|DenseNet-BC-169|23.80 / 22.08|6.85 / 5.92|
|DenseNet-BC-201|22.58 / 21.46|6.34 / 5.54|
|DenseNet-BC-264|22.15 / 20.80|6.12 / 5.29|

The above table shows top-1 and top-5 error rates on the Imagenet validation data set with a single-crop / 10-crop testing.


text:
# USE CASE:7 Update an employee details

## CHARACTERISTIC INFORMATION

### Goal in Context

As an *HR advisor* I want *to update an employee's details* so that *employee's details can be kept up-to-date.*

### Scope

Company.

### Level

Primary task.

### Preconditions

The Database allows for updating employee information.

### Success End Condition

The new employee information is added to the database.

### Failed End Condition

The new employee information is not added to the database.

### Primary Actor

HR Advisor.

### Trigger

There is a change in the employee's information.

## MAIN SUCCESS SCENARIO

1. HR advisor updates employee's information to the database.
2. New employees information is successfully added to the database.

## EXTENSIONS

None

## SUB-VARIATIONS

None.

## SCHEDULE

**DUE DATE**: Release 1.0

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
title: "Fish"
date: "2020-02-01"
description: N voracious fish are moving along a river. Calculate how many fish are alive.
category: Codility
---

[Fish](https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/)

You are given two non-empty arrays A and B consisting of N integers. Arrays A and B represent **N voracious fish** in a river, ordered downstream along the flow of the river.

The fish are numbered from 0 to N − 1. If P and Q are two fish and P < Q, then fish P is initially upstream of fish Q. Initially, each fish has a unique position.

Fish number P is represented by A\[P\] and B\[P\]. Array A contains the sizes of the fish. All its elements are unique. Array B contains the directions of the fish. It contains only 0s and/or 1s, where:

•	0 represents a fish flowing **upstream**,
•	1 represents a fish flowing **downstream**.

If two fish move in opposite directions and there are no other (living) fish between them, they will eventually meet each other. Then only one fish can stay alive − **the larger fish eats the smaller one**. More precisely, we say that two fish P and Q meet each other when P < Q, B\[P\] = 1 and B\[Q\] = 0, and there are no living fish between them. After they meet:

•	If A\[P\] > A\[Q\] then P eats Q, and P will still be flowing downstream,
•	If A\[Q\] > A\[P\] then Q eats P, and Q will still be flowing upstream.

We assume that all the fish are flowing at the same speed. That is, fish moving in the same direction never meet. The goal is to calculate the number of fish that will stay alive.
For example, consider arrays A and B such that:

A\[0\] = 4 B\[0\] = 0
A\[1\] = 3 B\[1\] = 1
A\[2\] = 2 B\[2\] = 0
A\[3\] = 1 B\[3\] = 0
A\[4\] = 5 B\[4\] = 0

Initially all the fish are alive and all except fish number 1 are moving upstream. Fish number 1 meets fish number 2 and eats it, then it meets fish number 3 and eats it too. Finally, it meets fish number 4 and is eaten by it. The remaining two fish, number 0 and 4, never meet and therefore stay alive.

**Write a function:**
function solution(A, B);
that, given two non-empty arrays A and B consisting of N integers, returns the number of fish that will stay alive.

For example, given the arrays shown above, the function should return 2, as explained above.
Write an efficient algorithm for the following assumptions:
•	N is an integer within the range \[1..100,000\];
•	each element of array A is an integer within the range \[0..1,000,000,000\];
•	each element of array B is an integer that can have one of the following values: 0, 1;
•	the elements of A are all distinct.

```js
function solution(A, B) {
    // write your code in JavaScript (Node.js 8.9.4)
    let up = []
    let dn = []
    let d

    for(let i=0; i<A.length; i++){
        if(B[i]==0){ // upstream

            while(dn.length>0){
                d = dn.pop()
                if(d>A[i]){    // downstream is bigger
                    dn.push(d) // put it back
                    break
                }
            }
            if(dn.length<1) up.push(A[i]) // no bigger downstream ahead

        }else{ //downstream
            dn.push(A[i])
        }
    }

    return dn.length + up.length
}
```

license: MIT

repository: taislu/mobilelu-starter-blog

gha_language: JavaScript

gha_license_id: MIT

repo_name: taislu/mobilelu-starter-blog


text:
# The code base of xRally plugins for Kubernetes platform

## Project structure

The root module of __xrally_kubernetes__ project should not be overloaded, so let's
keep it as simple as possible.

* __env__ module
  a location of plugins for Environment xRally component
  (ex Deployment component).

* __task__ module
  a location of plugins for Task xRally component (i.e scenario, context, sla,
  etc, plugins).

* __verify__ module
  a location of plugins for Verification xRally component.

* __service.py__ module
  a python module with a helper class which simplify usage of kubernetes client.

* __common__ module
  a set of different helpers for inner use which does not not relate to any
  particular component and which should not be exposed to the end user

repository: xrally/xrally-kubernetes

gha_language: Python

repo_name: xrally/xrally-kubernetes


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

### Description

Kibana before 4.5.4 and 4.1.11 are vulnerable to an XSS attack that would allow an attacker to execute arbitrary JavaScript in users' browsers.

### POC

#### Reference
- https://www.elastic.co/community/security

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
---
title: "switch recent two buffer alternatively"
date: 2018-05-23
tags:
categories: ["programming"]
link:
description:
---

so there is a post [described using key chord for fast buffer switching
between most recent two
buffers](http://emacsredux.com/blog/2013/04/28/switch-to-previous-buffer/).
it works for most cases, but if you are using org babel mode and editing
source code in the \*org src .\* buffer, then this \*org src .\*
buffer cannot be accessed by the method described here.

so I made another function to solve this issue, and here it is:

```{.commonlisp .rundoc-block rundoc-language="emacs-lisp" rundoc-tangle="yes"}
(defun get-next-buffer ()
  (interactive)
  (if (string= (car (helm-buffer-list)) " *Minibuf-1*")
      (switch-to-buffer (car (cdr (helm-buffer-list))))
    (switch-to-buffer (car (helm-buffer-list)))))
(key-chord-define-global "jk" 'get-next-buffer)
```

strangely when switching buffer using \`helm-buffer-lists\`, and if you
exit without selecting any buffer, you gets \`\*Minibuf-1\*\` into the
buffer list and will switch to minibuffer.so here I compared the
first buffer name in the list to \`\*Minibuf-1\*\` and remove it if it
is for \`Minibuf-1\`

in addition i added the function and key binding below to enable:

1.  always change to normal mode when switch-to-buffer
2.  always move to the end of buffer for comint-mode and eshell mode

the code is here:

```{.commonlisp .rundoc-block rundoc-language="emacs-lisp" rundoc-tangle="yes"}
;; goto buffer end and use insert mode if switch to a shell or comint mode
(defvar last-buffer nil)
(defun post-switch-buffer-func ()
  (if (not (eq (current-buffer) last-buffer))
      (progn
        (setq last-buffer (current-buffer))
        (if (derived-mode-p 'eshell-mode 'comint-mode)
            (progn
              ;; (evil-insert-state) ;uncomment for insert mode when switched to
              (end-of-buffer)))
        (if (derived-mode-p 'prog-mode)
            (evil-normal-state)))))
(add-hook 'post-command-hook 'post-switch-buffer-func)
```


text:
---
layout: post
section-type: post
title: "[tech interview 4 편] Operating System"
categories: Tech_Interview
tags: [ 'interview', 'technology', 'it', 'OS' ]
comments: true
---

이글은 tech interview를 볼 때 기본적으로 물어보는 것들을 정리하기 위해 쓴 글입니다.
깊이 보다는 compact 성을 강조합니다.
---
이 글은 시리즈 물입니다.

[tech interview 1 편] DB https://joosjuliet.github.io/db_technical_interview/
[tech interview 2 편] JAVA https://joosjuliet.github.io/java_technical_interview/
[tech interview 3 편] Network https://joosjuliet.github.io/network_technical_interview/
[tech interview 4 편] Operating System
 https://joosjuliet.github.io/os_technical_interview/
[tech interview 5 편] WEB https://joosjuliet.github.io/web_technical_interview/
[tech interview 6 편] SPRING https://joosjuliet.github.io/spring_technical_interview/
---

# 1. What is an operating system?

An operating system is a program that acts as an intermediary between the user and the computer hardware. The purpose of an OS is to provide a convenient environment in which user can execute programs in a convenient and efficient manner.

# 2. What are the different operating systems?

# 3. Batched operating systems

# 4. Multi-programmed operating systems

# 5. timesharing operating systems

# 6. Distributed operating systems

# 7. Real-time operating systems

# 8. What are the basic functions of an operating system?

Operating system controls and coordinates the use of the hardware among the various applications programs for various uses. Operating system acts as resource allocator and manager. Also operating system is control program which controls the user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.

# 9. What is kernel?

Kernel is the core and essential part of computer operating system that provides basic services for all parts of OS.

# 10. What is dead lock?

Deadlock is a situation or condition where the two processes are waiting for each other to complete so that they can start. This result both the processes to hang.

# 11. What is a process?

A program in execution is called a process.

Processes are of two types:
1. Operating system processes
2. User processes

# 12. What are the states of a process?

1. New
2. Running
3. Waiting
4. Ready
5. Terminated

# 13. What is starvation and aging?

Starvation is Resource management problem where a process does not get the resources it needs for a long time because the resources are being allocated to other processes.

Aging is a technique to avoid starvation in a scheduling system.

# 14. What is semaphore?

Semaphore is a variable, whose status reports common resource, Semaphore is of two types one is Binary semaphore and other is Counting semaphore.

# 15. What is context switching?

Transferring the control from one process to other process requires saving the state of the old process and loading the saved state for new process. This task is known as context switching.

# 16. What is a thread?

A thread is a program line under execution. Thread sometimes called a light-weight process, is a basic unit of CPU utilization; it comprises a thread id, a program counter, a register set, and a stack

# 17. What is process synchronization?

A situation, where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called race condition. To guard against the race condition we need to ensure that only one process at a time can be manipulating the same data. The technique we use for this is called process synchronization.

# 18. What is virtual memory?

Virtual memory is hardware technique where the system appears to have more memory that it actually does. This is done by time-sharing, the physical memory and storage parts of the memory one disk when they are not actively being used.

17. What are necessary conditions for dead lock?

1. Mutual exclusion (where at least one resource is non-sharable)

2. Hold and wait (where a process holds one resource and waits for other resource)

3. No preemption (where the resources cant be preempted)

4. Circular wait (where p[i] is waiting for p[j] to release a resource. i= 1,2,n

j=if (i!=n) then i+1

else 1 )

18. What is cache memory?

Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if it finds the data there (from a previous reading of data), it does not have to do the more time-consuming reading of data from larger memory.

19. What is logical and physical addresses space?

Logical address space is generated from CPU; it bound to a separate physical address space is central to proper memory management. Physical address space is seen by the memory unit. Logical address space is virtual address space. Both these address space will be same at compile time but differ at execution time.

20. Differentiate between Complier and Interpreter?

An interpreter reads one instruction at a time and carries out the actions implied by that instruction. It does not perform any translation. But a compiler translates the entire instructions

28. What is a long term scheduler & short term schedulers?

Long term schedulers are the job schedulers that select processes from the job queue and load them into memory for execution. The short term schedulers are the CPU schedulers that select a process from the ready queue and allocate the CPU to one of them.

29. Explain the meaning of mutex.

Mutex is the short form for Mutual Exclusion object. A mutex allows multiple threads for sharing the same resource. The resource can be file. A mutex with a unique name is created at the time of starting a program. A mutex must be locked from other threads, when any thread that needs the resource. When the data is no longer used / needed, the mutex is set to unlock

32. What is a daemon?

Daemon is a program that runs in the background without users interaction. A daemon runs in a multitasking operating system like UNIX. A daemon is initiated and controlled by special programs known as processes.

33. What is pre-emptive and non-preemptive scheduling?

Preemptive scheduling: The preemptive scheduling is prioritized. The highest priority process should always be the process that is currently utilized.

Non-Preemptive scheduling: When a process enters the state of running, the state of that process is not deleted from the scheduler until it finishes its service time.

34. What is busy waiting?

The repeated execution of a loop of code while waiting for an event to occur is called busy-waiting. The CPU is not engaged in any real productive activity during this period, and the process does not progress toward completion.

35. What is page cannibalizing?

Page swapping or page replacements are called page cannibalizing.

37. What is process migration?

It is the transfer of sufficient amount of the state of process from one machine to the target machine.

53. What is an idle thread?

The special thread a dispatcher will execute when no ready thread is found.


text:
# Unit Testing Introduction

The `PrimeService` example is included in this repo. This will open in Visual Studio.

### VS.Code

The .NET Core libraries used in VS.Code are slightly different, but there is [this tutorial](https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test) on the Microsoft website.


text:
# PyTorch YOLOv3

## Introduction

This is a yet another PyTorch implementation of YOLOv3.

With this repository, you can
* run inference with darknet pretrained models
* train with multiple GPUs
* train with COCO-style datasets
* easily change backbone architecture
* reproduce training results

## Training Results on COCO

| Model                              | Train     | Test     | AP@416 | AP@608 | AP50@416 | AP50@608 |
|:-----------------------------------|:----------|:--------:|:------:|:------:|:--------:|:--------:|
| Paper                              | train+val | test-dev |  31.0  |  33.0  |   55.3   |   57.9   |
| Converted pretrained model         | train2014 | test-dev |  30.5  |  31.9  |   54.4   |   56.5   |
| This repository                    | train2017 | test-dev |  31.8  |  33.3  |   53.5   |   55.8   |
| This repository (cosine annealing) | train2017 | test-dev |  32.0  |  33.7  |   53.7   |   56.2   |

For more detailed experiments, see [this section](#experiments).

## Requirements

* Python 3.6+
* matplotlib
* numpy
* OpenCV
* [pycocotools](https://github.com/cocodataset/cocoapi)
* [tensorboardX](https://github.com/lanpa/tensorboardX) >=1.6
* PyTorch >=1.0.1
* tqdm
* [YACS](https://github.com/rbgirshick/yacs) >=0.1.6

## Installation

### Option 1: Step-by-step installation

```bash
git clone https://github.com/hysts/pytorch_yolov3
cd pytorch_yolov3
pip install cython numpy
python setup.py install
```

### Option 2: Using Docker

You need nvidia-docker2 for this.

#### Build

```bash
docker build . -f docker/Dockerfile -t yolov3
```

#### Run

```bash
docker run --runtime nvidia --ipc host -it yolov3
```

## Inference with pretrained models

### Download darknet pretrained models

Following command downloads pretrained model from
[darknet site](https://pjreddie.com/darknet/yolo/), and convert them to PyTorch
model files this repository uses.

```bash
bash scripts/tools/download_darknet_weights.sh darknet_weights
```

In this repository, images are considered to have BGR channel order,
so we swap channels of the first convolutional layer in darknet pretrained
models, which are trained with images with RGB channel order.

### Run demo

`scripts/demo.py` supports an image input, a video input, and a camera input.
To stop demo, press `q` or `Esc` key on the shown image.

#### On an image

```bash
python scripts/demo.py --ckpt darknet_weights/yolov3.weights.pth --image /path/to/image.jpg
```

#### On an image directory

```bash
python scripts/demo.py --ckpt darknet_weights/yolov3.weights.pth --image_dir /path/to/image/directory
```

To process next image, press any key other than `q` or `Esc`.

#### On a video

```bash
python scripts/demo.py --ckpt darknet_weights/yolov3.weights.pth --video /path/to/video.mp4
```

#### On a webcam

```bash
python scripts/demo.py --ckpt darknet_weights/yolov3.weights.pth --camera
```

## Training

This repository supports training with COCO-style dataset.

### Download COCO 2017 dataset

```bash
bash scripts/tools/download_coco2017.sh ~/datasets/coco2017
```

### Download pretrained backbone model (optional)

You can train YOLOv3 from scratch, but using pretrained backbone weights makes
training faster ([arXiv:1811.08883](https://arxiv.org/abs/1811.08883)).
If you haven't run the script in
[this section](#download-darknet-pretrained-models), run it.

### Write your configuration file

This repository uses [YACS](https://github.com/rbgirshick/yacs) for
configuration.
Default parameters are specified in
[`yolov3/config/defaults.py`](yolov3/config/defaults.py) (which is not
supposed to be modified directly) and you can override them using a YAML file.
All the configurable parameters are listed in
[`configs/yolov3_default.yaml`](configs/yolov3_default.yaml).

You need to create YAML file like that, but you only have to add parameters
you want to override.
For example, if you want to change learning rate,

```yaml
train:
  base_lr: 0.002
```

is enough.

### Training with a single GPU machine

```bash
python scripts/train.py --config /path/to/config/file
```

**Note:** This repository makes it clear not to overwrite output directory
because training object detection model takes so long time that accidentally
corrupting past experiment results is really terrible.
You might find this feature bothersome when you're first trying to run training,
but it's not that bad after all.

### Distributed training with multiple GPUs

This repository supports multi-GPU training with
[`torch.distributed` package](https://pytorch.org/docs/stable/distributed.html).
PyTorch provides `torch.distributed.launch` utility to start multi-GPU
training, and following command is an example to launch training using 8 GPUs.

```bash
python -m torch.distributed.launch --nproc_per_node 8 scripts/train.py --config /path/to/config/file
```

Here, you need to set `train.distributed` in configuration file as follows.

```yaml
train:
  distributed: True
```

**Note:** You could also use `torch.nn.DataParallel` instead of
`torch.nn.parallel.DistributedDataParallel` in this repository, but there's no
reason to use it, as the latter is a lot faster most of the time.

**Note:** Because default parameters specified in
[`yolov3/config/defaults.py`](yolov3/config/defaults.py) are for
single-GPU training, you need to change them in case of multi-GPU training.
If you keep the batch size, you need to raise the learning rate and reduce
the number of iterations. In this case, multiplying learning rate by the number
of GPUs following linear scaling rule
([arXiv:1706.02677](https://arxiv.org/abs/1706.02677), [arXiv:1711.07240](https://arxiv.org/abs/1711.07240)) would be a good idea.
Or, you could divide the batch size by the number of GPUs and reduce
`subdivision` so that `batch_size` / `subdivision` (number of images processed
by each GPU at a time) stays the same.

#### Performance of multi-GPU training

![](figures/multi_gpu_training.png)

As you can see in the figure above, multi-GPU training brings decent speed-up.
Training YOLOv3 takes quite a long time, but with 8 GPUs (Tesla V100),
training would finish in a few days.

### Resume training

You only need to specify the checkpoint directory with `--resume` option.
Configuration file from checkpoint directory is automatically used and even
if you specify configuration file with `--config` option, it's ignored.

#### In case of single GPU training

```bash
python scripts/train.py --resume /path/to/checkpoint/directory
```

#### In case of multi-GPU training

```bash
python -m torch.distributed.launch --nproc_per_node 8 scripts/train.py --resume /path/to/checkpoint/directory
```

### Restart training from a checkpoint, with different configuration

For this, you just need to specify `train.ckpt_path` in a configuration file,
and run as normal.

```yaml
train:
  ckpt_path: /path/to/checkpoint
```

## Evaluation

No validation is run while training in this repository, so you need to validate
separately.
Validation takes following 2 steps.

### Run prediction on validation dataset

This command runs the model on validation dataset, and saves the detection
results to `predictions.json` in the format that can be fed to COCO API.

```bash
python -u scripts/predict.py --config /path/to/config/file \
                             --ckpt_path /path/to/checkpoint \
                             --outdir /path/to/output/directory
```

### Evaluate detection results using COCO API

This command runs evaluation, saves the results to `stats.json`, and also
reports the results to TensorBoard with a step number specified by
`--step` option.

```bash
python -u ./scripts/evaluate_detection_results.py \
    --gt ~/datasets/coco2017/annotations/instances_val2017.json \
    --pred /path/to/predictions.json \
    --step STEP \
    --outdir /path/to/output/directory
```

## Experiments

### Comparison with converted pretrained model on test-dev

Note that following comparison is not perfectly fair because training data and hyperparameters are not the same.
* Darknet pretrained model uses their own split of COCO, while we use COCO 2017 official train/val split.
* Hyperparameters used for darknet pretrained model is unknown.

| model            | base_lr | schedule        | iter   | size | train     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:-----------------|:--------|:----------------|:-------|:----:|:----------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
| Paper            |         | step            |        | 416  | train+val | 31.0 | 55.3 |      |      |      |      |      |      |       |      |      |      |
| pretrained model |         | step            |        | 416  | train2014 | 30.5 | 54.4 | 31.1 | 13.6 | 32.3 | 42.8 | 26.2 | 39.1 | 40.8  | 21.6 | 43.4 | 55.6 |
| this repository  |  0.005  | step            | 460000 | 416  | train2017 | 31.8 | 53.5 | 33.7 | 13.6 | 33.8 | 44.6 | 27.1 | 40.5 | 42.2  | 22.2 | 44.5 | 57.2 |
| this repository  |  0.005  | constant+cosine | 450000 | 416  | train2017 | 32.0 | 53.7 | 33.8 | 13.5 | 33.9 | 44.8 | 27.1 | 40.6 | 42.3  | 22.1 | 44.7 | 57.0 |

| model            | base_lr | schedule        | iter   | size | train     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:-----------------|:--------|:----------------|:-------|:----:|:----------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
| Paper            |         | step            |        | 608  | train+val | 33.0 | 57.9 | 34.4 | 18.3 | 35.4 | 41.9 |      |      |       |      |      |      |
| pretrained model |         | step            |        | 608  | train2014 | 31.9 | 56.5 | 33.1 | 17.5 | 34.4 | 40.6 | 27.2 | 41.2 | 43.0  | 26.3 | 45.4 | 54.1 |
| this repository  |  0.005  | step            | 460000 | 608  | train2017 | 33.3 | 55.8 | 35.4 | 18.4 | 36.2 | 40.9 | 27.8 | 42.9 | 44.9  | 28.7 | 46.9 | 54.6 |
| this repository  |  0.005  | constant+cosine | 450000 | 608  | train2017 | 33.7 | 56.2 | 35.8 | 18.6 | 36.6 | 41.1 | 28.0 | 43.1 | 45.2  | 29.1 | 47.5 | 54.9 |

### Changing learning rate scheduling

Cosine annealing ([arXiv:1608.03983](https://arxiv.org/abs/1608.03983)) is effective for object detection too ([arXiv:1809.00778](https://arxiv.org/abs/1809.00778), [arXiv:1902.04103](https://arxiv.org/abs/1902.04103)).

It takes so long to train YOLOv3, so here we train a model using cosine annealing for 50k iterations from the checkpoint trained for 400k iterations with base learning rate.

| base_lr | schedule        | iter   | size | val     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:--------|:----------------|:-------|:----:|:--------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|  0.005  | step            | 460000 | 416  | val2017 | 31.9 | 53.5 | 33.5 | 14.1 | 34.9 | 46.6 | 27.1 | 40.5 | 42.4  | 22.6 | 45.8 | 57.5 |
|  0.005  | constant+cosine | 450000 | 416  | val2017 | 32.1 | 54.0 | 33.8 | 14.3 | 35.5 | 46.5 | 27.2 | 40.8 | 42.6  | 22.8 | 46.1 | 57.2 |

| base_lr | schedule        | iter   | size | val     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:--------|:----------------|:-------|:----:|:--------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|  0.005  | step            | 460000 | 608  | val2017 | 33.3 | 55.6 | 35.5 | 19.1 | 37.4 | 42.6 | 27.6 | 42.8 | 45.1  | 29.9 | 48.0 | 54.9 |
|  0.005  | constant+cosine | 450000 | 608  | val2017 | 34.0 | 56.5 | 36.2 | 20.4 | 37.7 | 43.7 | 28.2 | 43.5 | 45.7  | 31.4 | 48.2 | 56.1 |

![](figures/experiments_on_lr_decay.png)

### Changing learning rate

| base_lr | schedule | iter   | size | val     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:--------|:---------|:-------|:----:|:--------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|  0.002  | step     | 440000 | 416  | val2017 | 30.4 | 52.4 | 31.6 | 13.2 | 33.3 | 43.5 | 25.8 | 38.5 | 40.3  | 20.6 | 43.8 | 54.3 |
|  0.005  | step     | 460000 | 416  | val2017 | 31.9 | 53.5 | 33.5 | 14.1 | 34.9 | 46.6 | 27.1 | 40.5 | 42.4  | 22.6 | 45.8 | 57.5 |
|  0.01   | step     | 500000 | 416  | val2017 | 32.1 | 53.9 | 33.7 | 14.5 | 34.7 | 46.7 | 27.2 | 41.0 | 42.9  | 22.8 | 46.1 | 57.6 |

| base_lr | schedule | iter   | size | val     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:--------|:---------|:-------|:----:|:--------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|  0.002  | step     | 440000 | 608  | val2017 | 31.4 | 53.6 | 33.2 | 17.8 | 35.1 | 39.6 | 26.2 | 40.3 | 42.5  | 27.5 | 45.3 | 51.2 |
|  0.005  | step     | 460000 | 608  | val2017 | 33.3 | 55.6 | 35.5 | 19.1 | 37.4 | 42.6 | 27.6 | 42.8 | 45.1  | 29.9 | 48.0 | 54.9 |
|  0.01   | step     | 500000 | 608  | val2017 | 33.0 | 55.7 | 34.7 | 19.9 | 37.4 | 41.9 | 27.6 | 42.9 | 45.3  | 30.8 | 48.4 | 54.9 |

![](figures/experiments_on_base_lr.png)

### Changing when to decrease learning rate

| base_lr | schedule        | iter_to_start_decay | iter   | size | val     | AP   | AP50 | AP75 | APs  | APm  | APl  | AR1  | AR10 | AR100 | ARs  | ARm  | ARl  |
|:--------|:----------------|:--------------------|:-------|:----:|:--------|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|  0.005  | constant+cosine |       100000        | 150000 | 416  | val2017 | 30.3 | 52.3 | 31.4 | 13.0 | 32.9 | 44.5 | 25.9 | 39.0 | 40.9  | 21.8 | 44.1 | 55.6 |
|  0.005  | constant+cosine |       200000        | 250000 | 416  | val2017 | 31.6 | 53.5 | 32.9 | 13.8 | 34.9 | 46.0 | 26.6 | 40.1 | 42.1  | 22.4 | 46.0 | 57.2 |
|  0.005  | constant+cosine |       300000        | 350000 | 416  | val2017 | 31.7 | 53.6 | 33.4 | 14.4 | 34.9 | 45.4 | 26.8 | 40.4 | 42.3  | 22.5 | 46.2 | 56.2 |
|  0.005  | constant+cosine |       400000        | 450000 | 416  | val2017 | 32.1 | 54.0 | 33.8 | 14.3 | 35.5 | 46.5 | 27.2 | 40.8 | 42.6  | 22.8 | 46.1 | 57.2 |
|  0.005  | constant+cosine |       500000        | 550000 | 416  | val2017 | 32.2 | 53.9 | 33.8 | 15.0 | 35.5 | 46.5 | 27.0 | 40.5 | 42.4  | 23.3 | 45.9 | 57.1 |

![](figures/experiments_on_iterations.png)

## References

* Redmon, Joseph, Santosh Divvala, Ross Girshick, and Ali Farhadi. "You Only Look Once: Unified, Real-Time Object Detection." The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. [link](http://openaccess.thecvf.com/content_cvpr_2016/html/Redmon_You_Only_Look_CVPR_2016_paper.html), [arXiv:1506.02640](https://arxiv.org/abs/1506.02640), [Project website](https://pjreddie.com/darknet/yolov1), [GitHub](https://github.com/pjreddie/darknet)
* Redmon, Joseph, and Ali Farhadi. "YOLO9000: Better, Faster, Stronger." The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017. [link](http://openaccess.thecvf.com/content_cvpr_2017/html/Redmon_YOLO9000_Better_Faster_CVPR_2017_paper.html), [arXiv:1612.08242](https://arxiv.org/abs/1612.08242), [Project website](https://pjreddie.com/darknet/yolov2), [GitHub](https://github.com/pjreddie/darknet)
* Redmon, Joseph, and Ali Farhadi. "YOLOv3: An Incremental Improvement." arXiv preprint arXiv:1804.02767 (2018). [arXiv:1804.02767](https://arxiv.org/abs/1804.02767), [Project website](https://pjreddie.com/darknet/yolo), [GitHub](https://github.com/pjreddie/darknet)

* Loshchilov, Ilya, and Frank Hutter. "SGDR: Stochastic Gradient Descent with Warm Restarts." In International Conference on Learning Representations (ICLR), 2017. [link](https://openreview.net/forum?id=Skq89Scxx), [arXiv:1608.03983](https://arxiv.org/abs/1608.03983), [GitHub](https://github.com/loshchil/SGDR)
* Goyal, Priya, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He, "Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour." arXiv preprint arXiv:1706.02677 (2017). [arXiv:1706.02677](https://arxiv.org/abs/1706.02677)
* Peng, Chao, Tete Xiao, Zeming Li, Yuning Jiang, Xiangyu Zhang, Kai Jia, Gang Yu, and Jian Sun, "MegDet: A Large Mini-Batch Object Detector." arXiv preprint arXiv:1711.07240 (2017). [arXiv:1711.07240](https://arxiv.org/abs/1711.07240)
* Akiba, Takuya, Tommi Kerola, Yusuke Niitani, Toru Ogawa, Shotaro Sano, and Shuji Suzuki, "PFDet: 2nd Place Solution to Open Images Challenge 2018 Object Detection Track." arXiv preprint arXiv:1809.00778 (2018). [arXiv:1809.00778](https://arxiv.org/abs/1809.00778)
* He, Kaiming, Ross Girshick, and Piotr Dollár, "Rethinking ImageNet Pre-training." arXiv preprint arXiv:1811.08883 (2018). [arXiv:1811.08883](https://arxiv.org/abs/1811.08883)
* Zhang, Zhi, Tong He, Hang Zhang, Zhongyuan Zhang, Junyuan Xie, and Mu Li, "Bag of Freebies for Training Object Detection Neural Networks." arXiv preprint arXiv:1902.04103 (2019). [arXiv:1902.04103](https://arxiv.org/abs/1902.04103)


text:
# SuperNEMO-DBD.github.io

A testing template for a Jekyll-based website for SuperNEMO

# Developing Locally
The site can be developed locally by using the supplied `snjekyll` self-executing
Makefile. This sets up a local instance of Jekyll, so changes can be previewed
before submitting a PR to regenerate the actual website. The currently known
requirements are:

- Linux or macOS Platform
- Ruby 2 or better, including development headers and library
  - macOS/Home/Linuxbrew supply these
  - Linux systems may require the `ruby-dev` or similar package to be installed
- GNU Make >= 3.81

The resulting workflow should be:

```console
$ git clone https://github.com/supernemo-dbd/supernemo-dbd.github.io
$ cd supernemo-dbd.github.io
$ ./snjekyll serve
```

The last command will download and setup the local Jekyll instance, and
start a local isolated webserver at `http://<IP_ADDRESS>:4000`. Simply point
your favoured browser to this address to view the generated site.

The server runs in the foreground and watches the site sources for changes
(for example, `index.md`). When a file changes, the server will rebuild the
site automatically, so simply refresh your browser to see the resultant
regenerated site. For example, try making some changes to `index.md`
The server may be shutdown at any point using `Ctrl-C`.

Further information on tasks available from `snjekyll` can be seen by
running

```console
$ ./snjekyll help
```

## Known Issues
- No reliable check for existence of `ruby-dev{el}` package on Linuces
  - Will issue a warning, but nothing more
- The `xz` package installed by Home/Linuxbrew is not compatible with the
  `nokogiri` gem required by Jekyll, and will cause compiliation of
  the gem to fail
  - `snjekyll` will issue a warning about this, but will not take further action.
  - To work around this issue, either do `brew unlink xz` or remove Home/Linuxbrew settings
    from your environment. The latter may not be possible if you have Homebrew installed
    in `/usr/local`

# TODO
More documentation, including:

- Working with the repo and making Pull Requests
- Jekyll data for collaborators and institutes

branch_name: refs/heads/develop

gha_language: CSS


text:
# Abstraction

Packing lower level capabilities into more convenient APIs.  See [definition](https://github.com/GravityNetwork/Gravity/wiki/What-are-Capabilities#abstraction).

This is different from @ref:[abstraction](abstraction.md) in that abstraction works to perform an operation using the lower level capabilities, but that operation could have been performed by working with the lower level capabilities individually i.e. no new functionality was revealed.

Here's an example of a repository exposed with several facets, with a higher level `NameChanger` capability composed out of two lower level ones.

@@snip [RepositoryComposition.scala]($examples$/RepositoryComposition.scala) { #repository-composition }

repository: tersesystems/ocaps

repo_name: tersesystems/ocaps


text:
---
title:  The Agreement With Abraham
date:  07/05/2022
---

**This is Easy Reading Edition of the Sabbath School. For the regular Adult version with Teacher comments and EGW notes please open the top lesson on the main screen**

### Read for This Week’s Study
Genesis 15:1–21; Genesis 16:1–16; Genesis 17:1–19; Genesis 18:1–15; Genesis 18:16–19:29.

>
Memory Text

> “But Abram said, ‘Lord and King, what can you give me? I still don’t have any children. My servant Eliezer comes from Damascus. When I die, he will get everything I own’ ” (Genesis 15:2, NIrV).

IN GENESIS 15, we read about the agreement that God makes with Abram. This agreement is the second one that God makes with humans. The first agreement God makes is with Noah.

The agreement with Noah included a blessing for other people. The agreement with Abram also includes a blessing for other people (Genesis 17:7; Hebrews 13:20).

At this time, the life of Abram is filled with both fear and laughing. The Bible tells us that Abram is afraid (Genesis 15:1). Sarah is afraid, too (Genesis 18:15). So is Hagar (Genesis 21:17). Abram laughs (Genesis 17:17). Sarah laughs, too (Genesis 18:12). So does Ishmael (Genesis 21:9). These chapters show us the warm feelings and the love in the heart of Abram. Abram cares very deeply about the evil people in Sodom. Abram wants them to be saved. Abram shows how much he cares for Sarah, Hagar, and Lot. Abram also is kind to the three visitors (Genesis 18:6).

During this time, God changes the name of Abram to Abraham. This name shows us that Abraham will be the “father of many nations” (Genesis 17:5, ERV). This promise shows us that God has big plans for Abraham, for sure.

repository: Adventech/sabbath-school-lessons

branch_name: refs/heads/stage

repo_name: Adventech/sabbath-school-lessons


text:
# SPLeverageSim
A simulation made in R to run possible outcomes in being able to guess the daily direction of the S&P 500 with particular odds and determining success based being able to use 2x (SSO/SDS), 3x (UPRO/SPXU) leveraged ETFs

# Inspiration
The inspiration to make this was brought on by a discussion with a friend claiming he could successfully predict the direction of the market with 60% success (and also knows when he should not participate, i.e knows when he doesn't know the direction). Being able to predict the direction of the market in general is something that is seemingly simpler than predicting the movements of a particular stock. The simulation is intended as a proof that if one were to be able to determine the direction of the market with a 60% success rate they should employ this strategy and see exceedingly high returns.

# Limitations and Assumptions
This simulation makes some assumptions that leave room for improvement.
* We assume our stock picker begins with $100,000.00
* We assume that market movement is a [random walk](http://en.wikipedia.org/wiki/Random_walk_hypothesis)
* We also assume that on the days that the simulated stock-picker chooses to buy they go all-in with their current amount of money, we also allow for fractional shares.
* We assume the stock picker is paying a flat ($6.95 * 2) on the sell side of their trade.
* We assume that the stock picker will hold until the end of each day
* For the sake of example, only 2x leverage will be simulated (but can be extended to 3x by a change of constants)
* Cost of future heart medication required from increased stress of playing daily market movement is ignored
* Only the trailing 10 years of daily market movement could be retrieved, thus the results may be further skewed.
* Each simulation is run over 365 days (365 possible buying periods)
* We assume that the leveraged ETFs would pay *no* cost to maintain their leverage (borrowing/other instruments) which is not true. This will lead to higher returns than what would be possible employing this strategy in real life.

# Conclusions
Ultimately the purpose of this program was to convince someone that if they truly believe they could predict the market's direction with 60% accuracy they should buy 2x and 3x leveraged ETFs on days where they believed they could predict the market movement.

Running the simulation 1000 times lead to the following results:
```
[1] "Successes: 920"
[1] "Greatest Success: $<PHONE_NUMBER>08"
[1] "-------------"
[1] "Failures: 80"
[1] "Worst Failure: $ 46340.775260"
[1] "-------------"
```
Where a `success = currentMoney >= START_MONEY`

and a `failure = currentMoney < START_MONEY`

The following is a histogram where START_MONEY was set to $10,000 for the sake of clarity in reading the histogram. Note the histogram is mislabelled, this does not occur in the running version of the program.
![Results](https://raw.githubusercontent.com/jjestrel/SPLeverageSim/master/sim_results.png)

Ultimately, the assumptions made prevent the results of the simulation to be very accurate (cost of leverage, lack of historicial data in particular). However a general claim can be made, if one can predict the daily market direction with a > 60% accuracy they very likely can make a lot of money by making a "guess" daily.

repository: jjestrel/SPLeverageSim

repo_name: jjestrel/SPLeverageSim


text:
# IPASS
This library is created by Sander van Sterkenburg For the IPASS project 2018 at the HU. This library can be used to read the data from the gyroscope, accelerometer and temperature registers of the MPU6050.

## Hardware
The hardware used is this project are: an Arduino Due, a MPU6050 and a 128 by 64 I2C display.

## License
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

repository: SandervST/IPASS

repo_name: SandervST/IPASS


text:
# Toolbox for Data Science Techniques

## GitHub Page: https://congxinxu0116.github.io/data_science_toolbox.io/

## Description
This GitHub repo is a collection of data science tutorials on how to solve different types of data science problems. I will use both Python and R to achieve the same goal. More detailed breakdown will be added to this README.

## Repo File Structure
- Tutorials
  - R
  - Python
- Data
- Playground

## Content

## Package Dependency
- R
  - [`tidyverse`](https://www.tidyverse.org/)
- Python
  - [`pandas`](https://pandas.pydata.org/)
  - [`numpy`](https://numpy.org/)
  - [`pymc3`](https://docs.pymc.io/)

## Forecasting Tools

- K-Nearest Neighbor
- Ordinary Least Squares Regression
- Stepwise Regression
- Ridge, Lasso and Elastic Net
- Generative Classification Models
  - Linear Discriminant Analysis
  - Quadratic Discriminant Analysis
  - Naïve Bayes Model
- Support Vector Machine
- Density Estimation
  - Parametric
  - Non-parametric
  - Kernel Density Estimation
  - Multivariate KDE
- Cluster Analysis
  - K-Means
  - Gaussian Mixture Model
- Random Forest
  - Bootstrap
  - Bagging
- Boosting
  - L2 Boosting
  - Ada Boosting
  - XGBoost
    - Gradient
  - CatBoost
  - Light GBM
- Ensemble
  - Model Averaging
  - Stacking
  - Base learner and super leaner
- Association:	Market Basket Model

## Feature Engineering Tools

- Polynomial Expansion
- B-spline
- Principal Component Analysis
- Anormal Detection

 ## Model Validation

- Cross Validation
- K-fold Validation

## Other
- Network Analysis

## Author:
- Congxin (David) Xu
- [LinkedIn](https://www.linkedin.com/in/congxin-xu/)


text:
# Relationship Management
Relationship Management is about your ability to get the best out of others, inspire and influence them, communicate and build bonds with them, and help them grow; develop; change and resolve conflict.

## Inspiration
Creates resonance between the person inspiring and those who are impacted.  They embody and articulate a vision in a way that others want to follow.

"I wanted to make somebody feel like Coltrane made me feel, listening to it.
\- Wynton Maralis

Optimism + Empathy = Positive Relationship
## Influence
### Rhetoric
The art of effective or persuasive speaking or writing, especially the use of figures of speech and other compositional techniques.

## Developing Others
### 2 Types of Coaching

Coaching for Compliance

Mostly course correction for individuals not meeting management expectations

Coaching with Compassion

Identifying another's needs, empathizing and acting to enhance their wellbeing. Helping others through their rough spot. Being compassionate helps others open up to their potential and see possibilities.

Can you use your organizational awareness skills to help that mentee fit well and grow in the current organization?

Coach: Helps someone for a short period of time on a specific problem or goal.
Mentor: An experienced and trusted advisor.

Timing

Focused

Respectful

Factual

Achievable

Positive

</div

## Change Catalyst
An individual or group that precipitates change
## Conflict Management
People together over time equals conflict

People/Time = Conflict

### Conflict Resolution Scenarios
- Win/Win
- Forcing
- Withdrawing
- Smoothing

1. Know exactly what you wish the outcome to be
2. Lead the conversation with dialog
3. Is anyone taking the situation personally?
4. State the facts and conclusions you have drawn from those facts
5. Work together to move towards a resolution

## Teamwork and Collaboration
Teamwork: A group of people working together to reach a goal.
Collaboration: Working together with each individual responsible for providing valuable input

- Do you help out others even if they don't ask you?
- Do you ask for help when you need it?
- Do you acknowledge someone else's strengths?
- Are you comfortable with relinquishing control?
- Do you trust your team members and do they trust you?

##
##
##
##

url: https://raw.githubusercontent.com/jonesca/Leadership/b983b46698dedfaf662c6b2f72dfd84879c06108/06 Introduction to Emotional Intelligence/05 Relationship Management.md

repository: jonesca/Leadership

filename: 05 Relationship Management.md

repo_name: jonesca/Leadership


text:
# qe-qiskit

[![codecov](https://codecov.io/gh/zapatacomputing/qe-qiskit/branch/master/graph/badge.svg?token=G64YYS2IOS)](https://codecov.io/gh/zapatacomputing/qe-qiskit)

An Orquestra Quantum Engine Resource for Qiskit

## Overview

Contained in this repository is an Orquestra quantum engine resource for using qiskit. For more information regarding Orquestra and resources, please refer to the [Orquestra documentation](https://www.orquestra.io/docs).

## QiskitSimulator

Included in this resource is the `QiskitSimulator` which implements the `zquantum.core.interfaces.QuantumSimulator` interface.

It can be imported with:
```
from qeqiskit.simulator import QiskitSimulator
```

## QiskitBackend

Included in this resource is the `QiskitBackend` which implements the `zquantum.core.interfaces.QuantumBackend` interface.

It can be imported with:
```
from qeqiskit.backend import QiskitBackend
```

repository: TimWeaving/qe-qiskit

repo_name: TimWeaving/qe-qiskit


text:
---
title: On Fireflies
date: 2015-06-15
description: ""
pubDate: "2015-06-15"
heroImage: ""
postType: "newsletter"
tags: [season_1, letters]
permalink: /:categories/:title-1.html
---

Fireflies are the signs of summer. They are this bright glow of hope. They seem to say, "winter has past, you can come out now". Their green ominous glow like magic as you walk down the road. At least, this is what I would tell you if I hadn’t grown up in California. As a Californian, I can tell you there were no fireflies, no glimmer signaling the start of summer. When I read about fireflies in grade school, I would wonder what was so special about them. They were the mythical unicorns of my childhood.

It wasn’t until an adult when I first encountered a firefly. It was in the midwest, Iowa, biking through the woods. The sun was hanging low and there they were. Glowing in short spurts luminance, shining the path for my bike to head towards. They made me smile, and I wondered if I should be a kid at that moment, drop my bike, and try to catch them. Their presence allowed me to finally understand what many writers were talking about in those children books - a glow to the summer.

I don’t understand how something as simple as a glowing green light could make me feel so happy. It set the setting, and for the rest of that night, they were the entertainment. It was more entertainment than any manufactured, designed, or advertised piece of media humans had developed, at least for my tastes. It felt pure, and in a way, the path I was taking was this magical journey down the rabbit hole. And appreciating these tiny things are why we live life, right?

![Anime - Fireflies](https://gallery.tinyletterapp.com/b7acb1dd09358f1ed19f16a562a005fc08d42511/images/bdd046a6-6606-47ae-bf3b-18a52b3f5621.gif)


text:
# Batch Post Processing Examples

## [pps_simple.bat](pps_simple.bat)

A simple example to show how to create and use post processing scripts. This script adds line numbers to the report before displaying it.

---

repository: AnalyticalGraphicsInc/STKCodeExamples

gha_language: Jupyter Notebook

repo_name: AnalyticalGraphicsInc/STKCodeExamples


text:
Displayed in process list and help. Should not be too long
(~ one line).

**help**: optional string to describe in depth a process. Displayed in process help. Can be multiline.

**entry_point**: optional task code (default is none) that will receive the process input. The referenced task cannot have
ancestors.

**end_point**: optional task code (default is none) that will provide the process output

**public**: optional boolean (default is true) to mark a process as public or private. Private process are filtered from
process list but execution is still allowed

**options**: deprecated variable node

**tasks**: list of task definitions contained in the process. See [task definition](02-task_definition.md)

repository: cleverage/process-bundle

gha_language: PHP

repo_name: cleverage/process-bundle


text:
# BurSim
Windows screen saver that simulates a Unisys V-Series computer.

This Win32 program:
- Acts as a screensaver, displaying an emulated Unisys V-Series computer
- Acts as a telnet server, allowing you to connect via a Unisys T27 emulator, making it look as if you are accessing a V-Series computer.

repository: riordanmr/BurSim

repo_name: riordanmr/BurSim


text:
There are 4 types of triggers: `after`, `on`, `every`, and `cron`.

**after**

`after` specifies a countdown until the execution of a task. It will only occur once. It takes at least 1 keyword argument: hours, minutes, and/or seconds, of type <int>. Those keywords arguments are cumulative (same for the `every` trigger). For example, `hours=1, minutes=30` equals `minutes=90`.

```python
crono.after(minutes=30).…
```

**on**

`on` specifies the execution of a task at a specific date and time. It will only occur once. It takes 1 positional argument of type `<datetime.datetime>`.

```python
import datetime
date = datetime.datetime(2019, 7, 4)
crono.on(date).…
```

**every**

`every` specifies a frequency at which to execute a task. It will occur multiple times. It takes at least 1 keyword argument: hours, minutes, and/or seconds, of type <int>. Those keywords arguments are cumulative (similarly to the `after` trigger). For example, `hours=1, minutes=30` equals `minutes=90`.

```python
crono.every(hours=1, minutes=30).…
```

**cron**

`cron` uses an expression to specify the execution time. It will occur mutiple times. It takes exactly 1 positional argument of type `<str>`.

```python
crono.cron('0 6 * * 2').…
```

### Tasks

A task defines what a job will do. There are 4 types of tasks: `log`, `request`, `message`, and `email`.

**log**

`log` uses the standard [logging](https://docs.python.org/3.8/library/logging.html) Python library.

```python
crono.log('DEBUG', '{text}', *args, **kwargs)
```

**request**

`request` sends an HTTP request. It is powered by the [Requests](http://docs.python-requests.org/en/master/) library.

```python
crono.request('POST', '{url}', **kwargs).…
```

**message**

`message` sends an SMS. It is powered by [Twilio](https://www.twilio.com/). To use it, you will have to specify `twilio_account_sid` and `twilio_auth_id`.

_Not implemented, yet._

**email**

`email` sends an email. It is powered by [Postmark](https://postmarkapp.com/). To use it, you will have to specify `postmark_api_key` and `postmark_sender`.

_Not implemented, yet._

### Examples

```python
import crono

# Timer
crono.request('POST', '{url}').after(minutes=1)

# Datetime
crono.log('DEBUG', '{text}').on(<datetime>)

# Interval
crono.email(…).every(hours=1) # `email` task not implemented (yet)

# Cron
crono.message(…).cron('0 6 * * 2') # `message` task not implemented (yet)
```

## Configuration

Crono comes with sensible default values that you can override:
```
# Required
CELERY_BROKER

# Optional
CELERY_RESULT_BACKEND
REDIS_MAX_CONNECTIONS (default: 20)
CELERY_BROKER_POOL_LIMIT (default: 0)
CELERY_TASK_IGNORE_RESULT (default: True)
CELERY_BEAT_MAX_LOOP_INTERVAL (default: 300)
CELERY_WORKER_MAX_TASKS_PER_CHILD (default: 100)
```

## Test

```
python -m pytest
```

## Development

Packaging

```console
# Generating distribution archives
$ python setup.py sdist bdist_wheel

# Uploading the distribution archives
$ twine upload --skip-existing dist/*
```

repository: thrbowl/crono

repo_name: thrbowl/crono


text:
# RTI Log Parser for Connext DDS [<img alt="License Apache" src="https://img.shields.io/badge/license-Apache-blue.svg?style=flat" align="right" />](https://www.apache.org/licenses/LICENSE-2.0.html)

**RTI® Log Parser** is a command-line tool that processes and enhances RTI Connext® DDS log messages, making it easier to debug applications.
You can find a quick-start guide in the [tutorial](tutorial/README.md) folder.

## Features
* Show sent and received packets with IP addresses.
* Show events like entities creation and discovery information.
* Detect possible issues and report them as warnings and errors.
* Obfuscate sensitive information by using MD5 and custom salts.
* Show network usage statistics.

## Requirements
You will need **[Python](https://www.python.org/) 2.7 or 3.x**. Log Parser works in any OS that supports Python including Linux, Mac OS and Windows.

## Usage
```
python rtilogparser -i <log_file>
```

The output is generated in Markdown format, which is easy to read in raw format while also allowing you to convert the output into HTML using viewers like [Atom](https://atom.io/) or [dillinger](http://dillinger.io/).

Additional features can be enabled or disabled with the following arguments:
* `--input FILE, -i FILE`: log file path, by default read from the standard input.
* `-v`: verbosity level. You can control the level adding more 'v'.
* `--output FILE, -o FILE`: write the output into the specified file.
* `--overwrite-output FILE, -oo FILE`: write the output into a new file.
* `--write-original FILE`: write the original log into the specified file.
* `--show-ip`: show the IP address instead of an assigned name.
* `--obfuscate`: hide sensitive information like IP addresses.
* `--salt SALT, -s SALT`: salt for obfuscation. It will be random if not set.
* `--show-timestamp, -t`: show timestamp log field.
* `--show-lines`: print the original and parsed log lines.
* `--only regex`: show only log messages that match the regex.
* `--colors, -c`: apply colors to log messages (e.g.: warnings in yellow).
* `--highlight regex`: show in bold regex matched logs, requires -c.
* `--local-host LOCAL_HOST`: set the local address.
* `--no-network`: do not show the network related logs.
* `--no-inline`: do not show warnings and errors in network logs.
* `--no-stats`: do not show the network and packet statistics.
* `--no-progress`: do not show the interative information at the bottom.
* `--debug`: export the unmatched log messages.
* `--version`: show the program version.
* `--help, -h`: show the arguments help.

### Enable Connext DDS logs
By default, any application built with Connext DDS will print the errors from the middleware to the standard output. In order to take advantage of Log Parser, we recommend enabling the higher log verbosity and redirecting the output into a file. There are several ways to increase the log verbosity:

* QoS XML (such as *USER_QOS_PROFILES.xml*):
```xml
<participant_factory_qos>
    <logging>
        <verbosity>ALL</verbosity>
        <category>ALL</category>
        <print_format>TIMESTAMPED</print_format>
        <!-- Optional. Be careful if this QoS XML file is used by
             different applications at the same time since more
             than one could try to write the logs into the same file. -->
        <output_file>ddslog.txt</output_file>
    </logging>
</participant_factory_qos>
```

* Code:
```c
// c
NDDS_Config_Logger_set_verbosity_by_category(
    NDDS_Config_Logger_get_instance(),
    NDDS_CONFIG_LOG_CATEGORY_ALL,
    NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
```
```c++
// c++
NDDSConfigLogger::get_instance()->set_verbosity_by_category(
    NDDS_CONFIG_LOG_CATEGORY_ALL,
    NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
```
```c++
// c++03 and c++11
#include <rti/config/Logger.hpp>
rti::config::Logger::instance().verbosity_by_category(
    rti::config::LogCategory::ALL_CATEGORIES,
    rti::config::Verbosity::STATUS_ALL);
```
```csharp
// C#
NDDS.ConfigLogger.get_instance().set_verbosity_by_category(
    NDDS.LogCategory.NDDS_CONFIG_LOG_CATEGORY_ALL,
    NDDS.LogVerbosity.NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
```
```java
// Java
Logger.get_instance().set_verbosity_by_category(
    LogCategory.NDDS_CONFIG_LOG_CATEGORY_ALL,
    LogVerbosity.NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
```

* Environment variable `NDDS_QOS_PROFILES`. It is possible to specify an inline XML QoS profile inside the variable:
```bash
# Bash
export NDDS_QOS_PROFILES="str://\"<dds><qos_library name=\"myLoggingLib\"><qos_profile name=\"myLoggingProfile\" is_default_participant_factory_profile=\"true\"><participant_factory_qos><logging><verbosity>ALL</verbosity><category>ALL</category><print_format>TIMESTAMPED</print_format></logging></participant_factory_qos></qos_profile></qos_library></dds>\""

# Tcsh
setenv NDDS_QOS_PROFILES 'str://"<dds><qos_library name="myLoggingLib"><qos_profile name="myLoggingProfile" is_default_participant_factory_profile="true"><participant_factory_qos><logging><verbosity>ALL</verbosity><category>ALL</category><print_format>TIMESTAMPED</print_format></logging></participant_factory_qos></qos_profile></qos_library></dds>"'

# Windows CMD
set NDDS_QOS_PROFILES=str://"<dds><qos_library name="myLoggingLib"><qos_profile name="myLoggingProfile" is_default_participant_factory_profile="true"><participant_factory_qos><logging><verbosity>ALL</verbosity><category>ALL</category><print_format>TIMESTAMPED</print_format></logging></participant_factory_qos></qos_profile></qos_library></dds>"
```

## Compilation
It is not necessary to compile Log Parser since it uses Python. Optionally, the source code can be zipped into a single file with `create_redist.sh` to simplify the distribution. The zip file can be executed as a .py file. For example: `python rtilogparser -i log.txt`.

## Adding new logs
Log Parser can be extended to parse custom log messages from an application. This can be done by adding a prefix to the log message or adding a new regular expression to Log Parser.

### Log prefixes
Any log message starting with `#Custom: ` is parsed and will appear in the output with the prefix `[APP]`.

### Adding a parser
Log Parser can be extended to implement custom parsers, by following these steps:

1. Add the regular expression for the log message. Open *logparser/logs/custom/logs.py* and append a new *tuple* with the following format to the `regex` variable:
```
regex.append([custom.FUNCTION_NAME_TO_CALL_IF_MATCHED, LOG_REGEX])
```

2. Implement the function that will be called if the regular expression is matched. This function should call methods from the *logger* class like `send` for messages related to sending data. For instance:
```python
def on_accept_data(match, state, logger):
    # match is an array with the regular expression matched groups.
    # state is a dictionary where you can store and retrieve variables.
    # logger the logger that process the messages
    seqnum = parse_sn(match[0])
    logger.process("", "", "Reader accepted DATA (%d)" % seqnum, 1)
```

repository: rticommunity/rticonnextdds-logparser

repo_name: rticommunity/rticonnextdds-logparser


text:
# Dice rolling conventions

`Open-ended roll` - a **1d100** roll that can yield a result lower than 01 or higher than 100.
- A roll under **06** calls for a second roll to be made and subtracted from the first.
- A roll over **95** calls for a second roll to be made and added to the first.

`Modifier` - a **bonus** or **penalty** which is applied to the dice roll (e.g. -10 or +25) due to skill bonuses, stat bonuses, difficulty levels, and miscellaneous modifiers applied to the situation.

| Difficulty level | Modifier
| --- | --- |
Routine | +30
Easy | +20
Light | +10
Medium | 0
Hard | -10
Very Hard | -20
Extremely Hard | -30
Sheer Folly | -50
Absurd NA | -70

`Maneuver roll` - a modified `Open-ended roll`. To resolve the roll, the result is applied to an appropriate chart.

repository: coprolit/rpg-rules

repo_name: coprolit/rpg-rules


text:
# Contributing to L7

👍🎉 Welcome to contribute code to L7! 🎉👍

## Source Code

```bash
git clone https://github.com/antvis/L7  --depth=1
```

## Pre-installation

### Install Yarn

Since Yarn workspace is used, Yarn needs to be installed first: https://yarnpkg.com/en/docs/install#windows-stable

### Windows environment configuration

[The L7 test solution](https://github.com/antvis/L7/blob/master/dev-docs/%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%96%B9%E6%A1%88.md) relies on headless-gl, which requires node-gyp [to compile local dependencies](https://github.com/nodejs/node-gyp#on-windows).

1. Start PowerShell as an administrator
2. Run `npm install --global --production windows-build-tools` to install Microsoft's windows-build-tools

See [other issues](https://github.com/antvis/L7/issues/101) during installation.

## Install dependencies

Install dependencies and complete Yarn workspace initialization:

```bash
yarn install
```

### Windows

```bash
copy node_modules/gl/deps/windows/dll/x64/*.dll c:\windows\system32
```

## Run DEMO

Start each package code change monitoring:

```bash
yarn watch
```

Start Storybook, it will automatically open `http://localhost:6006/`:

```bash
yarn storybook
```

## Run test

Run unit tests:

```bash
yarn test
```

Run unit tests and view code coverage:

```bash
yarn coveralls
```

## Add Lerna package

Add a new lerna package:

```bash
lerna create my-pack -y
```

Use ui-lib as a dependency of my-pack:

```bash
yarn workspace my-pack add ui-lib/1.0.0
```

Add lodash as a dependency of all packages (excluding root)

```bash
yarn workspaces run add lodash
```

Set typescript to root development dependency:

```bash
yarn add -W -D typescript jest
```

## Submit code

Instead of `git commit`:

```bash
yarn commit
```

## release

### Set the version number

```bash
yarn run version:prerelease
```

After setting, you need to commit the code

### release

yarn run release


text:
# Getting Started with Lisk Blockchain Client

This project was bootstrapped with [Lisk SDK](https://github.com/LiskHQ/lisk-sdk)

### Start a node

```
./bin/run start
```

### Add a new module

```
lisk generate:module ModuleName ModuleID
// Example
lisk generate:module token 1
```

### Add a new asset

```
lisk generate:asset ModuleName AssetName AssetID
// Example
lisk generate:asset token transfer 1
```

### Add a new plugin

```
lisk generate:plugin PluginName
// Example
lisk generate:plugin httpAPI
```

## Learn More

You can learn more in the [documentation](https://lisk.com/documentation/lisk-sdk/).

repository: LiskHQ/lisk-sdk

branch_name: refs/heads/development

gha_language: TypeScript

repo_name: LiskHQ/lisk-sdk


text:
# Code-Innovation-Series-SVNIT

Code Innovation Series powered by GitHub

## Submission Procedure
Read the following steps and guidelines properly for proper submission of your project. Missing out any step or performing it wrongly can lead to unsuccessful submission.

### Step 1
#### Fork this repository

### Step 2
#### Create a New Folder within the forked repository, with the 'folder name' being your 'Team Name'

## Contents of the folder
+ The project directory.
+ The presentation that you will be presenting while presenting your project before the judges.
+ A text file that contains proper documentation. The documentation should contain:
    - A description of your project.
    - The contents of your project directory.
    - Ways to host your project on the localhost.
+ The name of the 'pptx' and 'text' files should also be the 'team name'.

### People with only hardware solution are required to submit only the 'pptx' and 'text' files. A link to the video demonstration of your working model should also be included in both the files.

### Step 3
Create a Pull Request only after you have completed the entire project and do not wish to make any further changes. We will not be accepting more than one Pull Request from any team. \
\
You can complete your work on the local machine and then upload your project folder in the forked repository and proceed to create a Pull Request.
## Result
+ Winner - Pied Piper
+ 1st Runner up - Polygon
+ 2nd Runner up- Automate

Congratulations and best wishes to above winners for national level competition to be held in 1st quarter of 2021.


text:
---
layout: post
title:   centos系统yum更新出错Error： Nothing to dothing to do
category: Linux
tags: [Linux]
excerpt:  centos系统yum更新出错Error： Nothing to dothing to do
---

	Setting up Install Process No package update available Error: Nothing to dothing to do

更新yum源命令：

	yum -y update

**[参考文献]**

1. [centos系统yum更新出错Error: Nothing to dothing to do](https://blog.csdn.net/dongxie_tk/article/details/77629704 "centos系统yum更新出错Error: Nothing to dothing to do")


text:
# Collections

Beyonic uses the term "Collections" for payments you receive (or collect) from mobile subscribers. See the [Beyonic collections guide](https://support.beyonic.com/beyonic-collections-receive-mobile-money-through-beyonic) for more information.

When the user sends in a payment, it will create a collection object that you can access via the Collections API using the methods shown below.

The collections api endpoint is:
  <aside class="notice">https://app.beyonic.com/api/collections</aside>

**NOTE: If you want to initiate new collections, use the [Collection Requests API](#collection-requests. The collections api only allows you to view funds that have already been sent to you.**

## The Collection object

> Sample Collection Object (JSON):

```json
{
    "id": 230,
    "remote_transaction_id": "12132",
    "organization": 1,
    "amount": "20.0000",
    "currency": "BXC",
    "phonenumber": "+80000000001",
    "payment_date": "2015-12-12T00:00:00Z",
    "reference": null,
    "status": "successful",
    "created": "2015-08-01T16:49:48Z",
    "author": null,
    "modified": "2015-08-01T16:55:38Z",
    "updated_by": null
}
```

Field | Type | Description
----- | -----| ----
id | long integer | Unique object identifier
remote_transaction_id | string | The unique transaction ID from the mobile network operator
organization | long integer | The ID of the organization that the collection was matched to
amount | decimal | The collection amount
currency | string | The 3 letter ISO currency code for the collection. **Note:**: BXC is the Beyonic Test Currency code. See the "Testing" section for more information. Supported currency codes are BXC (Testing), UGX (Uganda), KES (Kenya)
phonenumber | string | The phone number that the collection was initiated from, in international format, starting with a +
payment_date | string | The date that the collection was made, in the UTC timezone. Format: "YYYY-MM-DDTHH:MM:SSZ"
reference | string | The description or reference code that was included with the collection
status | string | A string showing the status of the collection. One of: successful, failed, pending or cashed_out
created | string | The date that the collection was created, in the UTC timezone. Format: "YYYY-MM-DDTHH:MM:SSZ"
author | long integer | The ID of the user who created the collection
modified | string | The date that the collection was last modified, in the UTC timezone. Format: "YYYY-MM-DDTHH:MM:SSZ"
updated_by | string | The ID of the user who last updated the collection
collection_request | JSON string| *New in V3.* A JSON representation of the collection request that this collection was matched to, if any. Before V3, this was simply the id of the collection request object. In V3. It's an expanded representation of the collection request object.

## Accept or reject Collections

By default, collections are matched to your account and automatically accepted. However, the following networks allow you to decide whether you want to accept or reject a collection.

* Safaricom (MPESA) Kenya
* MTN Uganda
* Airtel Tanzania
* Vodacom Tanzania
* All Rwanda Networks

### Enabling Collection verification

To enable this functionality, you need to add a verificaiton URL to your collection settings:

1. Log into your Beyonic Account
2. Click "Company Settings" on the home page
3. Click "Advanced Settings"
4. Click "Collection Settings"
5. Enter a Collection Verification URL.
6. You can also decide what action we should take if we cannot reach your verification URL for some reason. This is controlled by the "Accept Collections By Default" option. If this option is checked, we'll accept collections when your URL is unreachable. Otherwise, they will be rejected.

### Verification request parameters

```json
{
    "remote_transaction_id": "ASD12132",
    "phonenumber": "+80000000001",
    "reference": "Payment for A/C 13112313",
    "amount": "500",
    "currency_code": "BXC",
}
```

Once you have created a URL, we will send a JSON POST to the URL you have provided, whenever a new collection is received. The request body shall include the following parameters as a JSON object:

Field | Description
----- |----- | ----
phonenumber | The subscriber's phone number that was used to send collection in international format, e.g. +256782123123
amount | The amount that was sent, e.g. 500
currency_code | The 3 letter currency code, e.g. UGX
reference | The reference or description that the subscriber sent along with the collection. e.g A/C 12312
remote_transaction_id | The network transaction id that identifies this collection on the mobile network operator's system e.g. ASDASDW12321312

### ACCEPT response

> ACCEPT < remote_transaction_id >

```text
For example:

ACCEPT ASCD1234
```

In order to accept the collection, you must respond with a 200 response, and the following text in the body of the response:

ACCEPT < remote_transaction_id >

E.g. if the remote transaction id was ASCD1234, then you must respond with:

ACCEPT ASCD1234

### REJECT response

> REJECT < remote_transaction_id > < optional reason >

``` Text
For example:

REJECT ASCD1234 Wrong Account Number.
```

In order to reject the collection, you must respond with a 200 response, and the following text in the body of the response:

REJECT < remote_transaction_id > < optional reason >

E.g. if the remote transaction id was ASCD1234, then you must respond with:

NOTE: The reject reason is optional. If included, we shall attempt to return it to the network (and the network may send it on to the subscriber)

### Response timeout

You must respond within 60 seconds, otherwise the verification request will timeout and the default action shall be taken.

## Retrieving a single Collection

> Sample Request:

```shell
curl https://app.beyonic.com/api/collections/131820 -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
```

```ruby
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collection = Beyonic::Collection.get(131820)
```

```php
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");

$collection = Beyonic_Collection::get(131820);
?>
```

```python
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collection = beyonic.Collection.get(131820)

```

```java
package com.beyonic.examples.collections;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class SingleCollectionExample {

    private static final String API_ENDPOINT = "https://app.beyonic.com/api/collections";
    private static final String API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
    private static final String CHARSET = "UTF-8";

    public static void main(String[] args){
        URL url = null;
        try {
            url = new URL(API_ENDPOINT + "/131820");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("charset", CHARSET);
            conn.setRequestProperty("Authorization", "Token " + API_KEY);

            System.out.println(conn.getResponseCode() + " // " + conn.getResponseMessage());

            try {
                if (conn.getResponseCode() == 200) {
                    InputStream inputStream = conn.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                    String response = reader.readLine();
                    reader.close();

                    System.out.println(response);
                }
            } finally {
                conn.disconnect();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
```

> Sample Response (JSON) - if you use one of the development libraries, this is automatically converted into a native object for you:

```json
{
    "id": 131820,
    "remote_transaction_id": "12132",
    "organization": 1,
    "amount": "200.0000",
    "currency": "BXC",
    "phonenumber": "+254722000000",
    "payment_date": "2016-09-21T08:55:54Z",
    "reference": "98989",
    "status": "successful",
    "created": "2016-09-21T08:56:18Z",
    "author": 1,
    "modified": "2016-09-21T09:07:13Z",
    "updated_by": 1,
    "collection_request": {
        "id": 2,
        "organization": 1,
        "amount": "200.0000",
        "currency": "BXC",
        "phonenumber": "+254722000000",
        "reason": "Test payment",
        "metadata": {},
        "created": "2016-09-21T08:52:54Z",
        "author": 1,
        "modified": "2016-09-21T09:04:14Z",
        "updated_by": 1,
        "collection": 1,
        "success_message": "",
        "instructions": "",
        "send_instructions": false,
        "status": "successful",
        "error_message": null,
        "error_details": null
    }
}
```

To retrieve a single collection object, provide the collection id and a collection object will be returned.

Parameter | Required | Type | Example | Notes
--------- | -------- | ---- | ------- | -----
id | Yes | Integer | 23 | The id of the collection you want to retrieve

## Listing all Collections

> Sample Request:

```shell
curl https://app.beyonic.com/api/collections -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
```

```ruby
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collection = Beyonic::Collection.list
```

```php
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");

$collection = Beyonic_Collection::getAll();
?>
```

```python
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collection = beyonic.Collection.list()

```

```java
package com.beyonic.examples.collections;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ListAllCollectionsExample {

    private static final String API_ENDPOINT = "https://app.beyonic.com/api/collections";
    private static final String API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
    private static final String CHARSET = "UTF-8";

    public static void main(String[] args){
        URL url = null;
        try {
            url = new URL(API_ENDPOINT);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("charset", CHARSET);
            conn.setRequestProperty("Authorization", "Token " + API_KEY);

            System.out.println(conn.getResponseCode() + " // " + conn.getResponseMessage());

            try {
                if (conn.getResponseCode() == 200) {
                    InputStream inputStream = conn.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                    String response = reader.readLine();
                    reader.close();

                    System.out.println(response);
                }
            } finally {
                conn.disconnect();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
```

> Sample Response (JSON) - if you use one of the development libraries, this is automatically converted into a native object for you:

```json
{
    "count": 3,
    "next": "https://app.beyonic.com/api/collections?offset=10",
    "previous": null,
    "results": [
        {
            "id": 82,
            "remote_transaction_id": "1485758785",
            "organization": 1,
            "amount": "2000.0000",
            "currency": 2,
            "phonenumber": "+80000000001",
            "payment_date": "2015-07-14T09:57:44Z",
            "reference": "beyonic",
            "status": "successful",
            "created": "2015-07-14T15:19:05Z",
            "author": null,
            "modified": "2015-08-20T16:48:51Z",
            "updated_by": null
        },
        {
            "id": 81,
            "remote_transaction_id": "225718814",
            "organization": 1,
            "amount": "2000.0000",
            "currency": 2,
            "phonenumber": "+80000000001",
            "payment_date": "2015-07-14T10:26:32Z",
            "reference": "Payment Ian M",
            "status": "successful",
            "created": "2015-07-14T10:27:08Z",
            "author": null,
            "modified": "2015-07-14T10:27:11Z",
            "updated_by": null
        },
        {
            "id": 77,
            "remote_transaction_id": "215569420",
            "organization": 1,
            "amount": "500.0000",
            "currency": 2,
            "phonenumber": "+80000000001",
            "payment_date": "2015-06-25T08:16:26Z",
            "reference": "payment 10",
            "status": "successful",
            "created": "2015-06-25T08:17:07Z",
            "author": null,
            "modified": "2015-06-25T08:17:18Z",
            "updated_by": null
        },
	]
}
```

To retrieve a list of all collections, make a GET request to the collections endpoint. This will return a list of collection objects.

## Filtering Collections

> Sample Request:

```shell
curl https://app.beyonic.com/api/collections?phonenumber=%2B80000000001&remote_transaction_id=SS12312 -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
```

```ruby
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collections = Beyonic::Collection.list(
  phonenumber: "+80000000001",
  remote_transaction_id: "SS12312"
)
```

```php
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");

$collections = Beyonic_Collection::getAll(array(
  "phonenumber" => "+80000000001",
  "remote_transaction_id" => "SS12312"
));
?>
```

```python
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collections = beyonic.Collection.list(phonenumber='+80000000001',
                                     remote_transaction_id='SS12312')

```

```java
package com.beyonic.examples.collections;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class FilterCollectionsExample {

    private static final String API_ENDPOINT = "https://app.beyonic.com/api/collections";
    private static final String API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
    private static final String CHARSET = "UTF-8";

    public static void main(String[] args){
        URL url = null;
        try {
            url = new URL(API_ENDPOINT + "?remote_transaction_id=SS12312");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("charset", CHARSET);
            conn.setRequestProperty("Authorization", "Token " + API_KEY);

            System.out.println(conn.getResponseCode() + " // " + conn.getResponseMessage());

            try {
                if (conn.getResponseCode() == 200) {
                    InputStream inputStream = conn.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                    String response = reader.readLine();
                    reader.close();

                    System.out.println(response);
                }
            } finally {
                conn.disconnect();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
```

> Sample Response (JSON) - if you use one of the development libraries, this is automatically converted into a native object for you:

```json
[
       {
        "id": 134,
        "phonenumber": "+256XXXXXX",
        "remote_transaction_id": "ASDCECASF",
        "payment_date": "2014-11-22T20:57:04Z",
        "reference": "Test Payment",
        "amount": 3000.000,
        "currency": "BXC",
        "status": "successful"
       }
]
```

You can search or filter collections on the following fields. Simply add them to your request as shown in the examples. You can combine multiple filters. Note that filters return exact matches only (the phonenumber field is treated differently - see below).

* amount - the collection amount
* currency - the currency code
* phonenumber - the phonenumber that the collection request was intended for. Note that the phonenumber will be matched in international format, starting with a '+' sign. If the '+' sign isn't included in your request, it will be appended before attempting to match your request. This is only true for phone number searches with collections, to make claiming of transactions easier. Other
* reference - the reference code that the customer used when sending the collection
* remote_transaction_id - the transation id or transaction reference of the collection on the mobile network operator's side
* collection_request - the ID of the collection request that this collection was matched to
* created_after - only return collections created after this date (E.g. 2017-01-01 00:00)
* created_before - only return collections created before this date (E.g. 2017-01-01 00:00)

**Response**

Note that the response will be a list of collections, not a single collection.

## Claiming an ummatched Collection

> Sample Request:

```shell
curl https://app.beyonic.com/api/collections?phonenumber=%2B80000000001&remote_transaction_id=SS12312&claim=True&amount=200 -H "Authorization: Token ab594c14986612f6167a975e1c369e71edab6900"
```

```ruby
require 'beyonic'
Beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collections = Beyonic::Collection.list(
  phonenumber: "+80000000001",
  remote_transaction_id: "SS12312",
  claim: true,
  amount: 200
)
```

```php
<?php
require_once('./lib/Beyonic.php');
Beyonic::setApiKey("ab594c14986612f6167a975e1c369e71edab6900");

$collections = Beyonic_Collection::getAll(array(
  "phonenumber" => "+80000000001",
  "remote_transaction_id" => "SS12312",
  "claim" => "True",
  "amount" => "200",
));
?>
```

```python
import beyonic
beyonic.api_key = 'ab594c14986612f6167a975e1c369e71edab6900'

collections = beyonic.Collection.list(phonenumber='+80000000001',
                                     remote_transaction_id='SS12312',
                                     claim=True,
                                     amount='200')

```

```java
package com.beyonic.examples.collections;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ClaimUnmatchedCollectionExample {

    private static final String API_ENDPOINT = "https://app.beyonic.com/api/collections";
    private static final String API_KEY = "ab594c14986612f6167a975e1c369e71edab6900";
    private static final String CHARSET = "UTF-8";

    public static void main(String[] args){
        URL url = null;
        try {
            url = new URL(API_ENDPOINT + "?phonenumber=%2B80000000001&remote_transaction_id=SS12312&amount=200&claim=True");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("charset", CHARSET);
            conn.setRequestProperty("Authorization", "Token " + API_KEY);

            System.out.println(conn.getResponseCode() + " // " + conn.getResponseMessage());

            try {
                if (conn.getResponseCode() == 200) {
                    InputStream inputStream = conn.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                    String response = reader.readLine();
                    reader.close();

                    System.out.println(response);
                }
            } finally {
                conn.disconnect();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
```

> Sample Response (JSON) - if you use one of the development libraries, this is automatically converted into a native object for you:

```json
[
       {
        "id": 134,
        "phonenumber": "+800XXXXXXXX",
        "remote_transaction_id": "ASDCECASF",
        "payment_date": "2014-11-22T20:57:04Z",
        "reference": "Test Payment",
        "amount": 3000.000,
        "currency": "BXC",
        "status": "successful"
       }
]
```

By default, when you search for a collection, only collections that have been successfully assigned to your organization are searched.

You can add the "claim" parameter to instruct Beyonic to also search unmatched collections, and if any of the unmatched collections match your input, they will be assigned to your organization.

Note that when you include the claim parameter, you **must** also include the amount, remote_transaction_id and phonenumber parameters. Failure to do so will result in an error.

Also note that the phonenumber will be matched in international format, starting with a '+' sign. Partial phone number matches will fail when you try to claim a transaction. If the '+' sign isn't included in your request, it will be appended before attempting to match your request.

Lastly, if your search parameters match more than one collection, the claim will fail.

Parameter | Type | Example | Notes
----------| ---- | ------- | -----
claim | Boolean or String | True | Instruct system to search unmatched transctions and claim them for your organization.

**Response**

Note that the response will be a list of collections, not a single collection.

repository: Jadamoureen/api-docs

repo_name: Jadamoureen/api-docs


text:
# fast-check-numbers
[![License][]](https://opensource.org/licenses/ISC)
[![NPM Package][]](https://npmjs.org/package/fast-check-numbers)
[![Build status][]](https://travis-ci.org/EricCrosson/fast-check-numbers)
[![Code Coverage][]](https://codecov.io/gh/EricCrosson/fast-check-numbers)

[License]: https://img.shields.io/badge/License-ISC-blue.svg
[NPM Package]: https://img.shields.io/npm/v/fast-check-numbers.svg
[Build status]: https://travis-ci.org/EricCrosson/fast-check-numbers.svg?branch=master
[Code Coverage]: https://codecov.io/gh/EricCrosson/fast-check-numbers/branch/master/graph/badge.svg

> fast-check arbitraries for narrowed numeric types

## Install

``` shell
npm install fast-check-numbers
```

## Use

``` typescript
import * as fc from 'fast-check'
import { PositiveArbitrary } from 'fast-check-numbers'

fc.sample(PositiveArbitrary, 1)
// => [ 1018.612465441227 ]
```

## Related

- [io-ts-numbers](https://github.com/EricCrosson/io-ts-numbers)

## Acknowledgments

- [fast-check](https://github.com/dubzzz/fast-check)

license: ISC

repository: EricCrosson/fast-check-numbers

repo_name: EricCrosson/fast-check-numbers