text:
---
collection: workshops
title: 'Lab 12: Deleting Data'
published: true
type: ionic
layout: workshoppost2
order: 12
lab: ionic
length: 10 minutes
date: 2016-05-16
todo: |
    * write wrap up
    * add screeshots
---

{% assign imagedir = "../images/deleting-data"  %}

{:.fake-h2}
Objective

To implement the ability to delete an existing project and task.

Key Concepts:

* Swipe on a row in a list to show action buttons
* Having icons on both sides of an ion-item
* Have a confirm popup before deleting data
* Removing a row from the in-memory array of projects and tasks

{:.fake-h2}
Table of Contents

* TOC
{:toc}

## 12.0: Deleting Tasks

For the deleting of tasks we are going to add another icon into the row for each task.  We are going to put the delete icon on the right side of each row so that the UI will have a balanced look.  Plus I want to show off how cool the built-in Ionic functionality for implementing an icon on boths sides of an ion-item is.

### 12.0.1: TasksService

1. Open the www/js/service/tasks.service.js file
1. We are going to add a new function called `deleteTask`.  This function will take in the task id and call the Back& API to delete the task.

        function deleteTask(taskId) {
          return $http({
            method: 'delete',
            url: Backand.getApiUrl() + '/1/objects/task/' + taskId
          })
            .then(function (result) {
              return result;
            });
        }

1. Don't forget to expose the deleteTask to the service.

          var service = {
              getTasks: getTasks,
              addTask: addTask,
              updateTask: updateTask,
              deleteTask: deleteTask
          };

### 12.0.2: TasksController

1. Open the www/js/controllers/tasks.controller file
1. We are going to add a new function called `deleteTask` that takes a parameter called taskId and then calls the `TasksService.deleteTask` function.  Upon successfully deletion it removes the row from the `vm.tasks`.

         function deleteTask(task) {
           TasksService.deleteTask(task.id).then(function(result) {
               vm.tasks.splice(vm.tasks.indexOf(task), 1);
           })
        }

1. Now we need to expose the `deleteTask` function to the view

         vm.deleteTask = deleteTask;

### 12.0.3: Tasks Page

1. Open the www/templates/tasks.html file
1. After the checkmark icon, add a new icon using the `i1_iconclose` snippet
1. To the close icon we need to add an `ng-click` that calls the `vm.deleteTask` function

        < i class="ion-close icon"
            ng-click="vm.deleteTask(task)">
        </i>

1. If you were to look at the Task page right now you would notice that the close icon is sitting on top of the checkmark icon.  To make it go to the right side of the ion-item, we need to add the `item-icon-right` css class to the ion-item.

    >When you are using both item-icon-left and item-icon-right, the position of the icon is decided by the order that the icon is listed in the ion-item.

1. The icons are now in the right position but from a usability perspective the close icon is drawing your eyes to it.  To remedy this we want to use the `icon-accessory` css class on the icon to make it smaller and gray.

        <i class="ion-close icon icon-accessory"
          ng-click="vm.deleteTask(task)"
         ></i>

We are now ready to test the delete functionality.

1. If you don't already have ionic serve running, open a command prompt and run the command ionic serve
1. Select a project and for any task when you click on the close icon it will delete the task.

>It is problematic though that it deletes the task without warning
{:.warning}

### 12.0.4: Confirming Task Delete

The last remaining functionality to implement for deleting a task is to ask the user to confirm that they really did mean to delete the task.  Anytime that you are performing destructive task, it is a good idea to double check that the user didn't accidentally hit the button.  You could use a javascript confirm for this but Ionic has a built-in component called $ionicPopup that is mobile friendly and can be easily styled.

1. Open the www/js/controllers/tasks.controller.js file
1. To the controller inject `$ionicPopup`

          TasksController.$inject = ['TasksService', '$stateParams', '$scope', '$ionicModal', '$ionicPopup'];

          function TasksController(TasksService, $stateParams, $scope, $ionicModal, $ionicPopup) {
            .......
          }

1.  Replace the contents of the `deleteTask` function with

        $ionicPopup.confirm({
            title: 'Are You Sure?',
            template: 'Are you sure you want to delete this task?',
            okText: 'Yes',
            cancelText: 'No'
        }).then(function (res) {
            if (res) {
              TasksService.deleteTask(task.id).then(function (result) {
                vm.tasks.splice(vm.tasks.indexOf(task), 1);
              })
            }
        });

1. If you don't already have ionic serve running, open a command prompt and run the command ionic serve
1. Select a project and for any task when you click on the close icon it will ask you if you are sure you want to delete the task.  If you click in delete the task.

## 12.1: Project Delete

For deleting a project we are going to implement a standard feature that many mobile applications have on their list display where you can left swipe to show buttons for additional actions.

### 12.1.1: ProjectsService

1. Open the www/js/service/projects.service.js file
1. We are going to add a new function called `deleteProject`.  This function will take in the project id and call the Back& API to delete the project and all of the associated tasks.

        function deleteProject(projectId) {
          return $http({
            method: 'delete',
            url: Backand.getApiUrl() + '/1/objects/project/' + projectId
          })
            .then(function (result) {
              return result;
            });
        }

1. Don't forget to expose the deleteProject to the service.

             var service = {
               getProjects: getProjects,
               addProject: addProject,
               deleteProject: deleteProject
             };

### 12.1.2: ProjectsController

1. Open the www/js/controllers/projects.controller file
1. We are going to add a new function called `deleteProject` that takes a parameter called projectId and then calls the `ProjectsService.deleteProject` function.  Upon successfully deletion it removes the row from the `vm.projects`.

         function deleteProject(project) {
           ProjectsService.deleteProject(project.id).then(function(result) {
               vm.projects.splice(vm.projects.indexOf(project), 1);
           })
        }

1. Now we need to expose the `deleteProject` function to the view

         vm.deleteProject = deleteProject;

### 12.1.3: Project Page

1. Open the www/templates/projects.html
1. After the `ion-chevron-right` arrow icon we need to add an ion-option-button.

          <ion-option-button class="button-assertive "
              ng-click="vm.deleteProject(project) ">
              Delete
          </ion-option-button>

1. If you don't already have ionic serve running, open a command prompt and run the command ionic serve
1. On the project page, if you swipe to the left it will show the option menu and the delete button.  When you click on the delete button it will call the Back& delete API and then removed it from vm.projects on successfully completed.

>At this point we have 2 major issues.  First, the option buttons may stay open when there is an error and this can cause unintended UI features.  To remedy this issue we need to use the `$ionicListDelete.closeoptionButtons` to close the option buttons.  The second issue is that it does not ask to confirm the delete.
{:.warning}

To ensure that the option buttons always close we need to add a finally block on the `deleteProject` function in the controller and call the `$ionicListDelete.closeOptionButton`.  To add the confirm to delete option we are going to use the `$ionicPopup` like we did for the task.

1. Open the www/js/controllers/projects.controller.js file
1. Inject `$ionicPopup` and `$ionicListDelegate` into the controller

      ProjectsController.$inject = ['ProjectsService', '$ionicModal', '$scope', '$state', '$ionicPopup', '$ionicListDelegate'];

      function ProjectsController(ProjectsService, $ionicModal, $scope, $state, $ionicPopup, $ionicListDelegate) {
        .....
      }

1. Replace the contents of the deleteProject function with:

        $ionicPopup.confirm({
           title: 'Are You Sure?',
           template: 'Are you sure you want to delete this project?',
           okText: 'Yes',
           cancelText: 'No'
         }).then(function (res) {
           if (res) {
             ProjectsService.deleteProject(project.id).then(function (result) {
               vm.projects.splice(vm.projects.indexOf(project), 1);
             })
               .finally(function () {
                 $ionicListDelegate.closeOptionButtons();
               });
           }
         });

1. If you don't already have ionic serve running, open a command prompt and run the command ionic serve
1. Now when you try to delete a project is will ask you to confirm the action and even if there is an error trying to delete the project the option buttons will still close.

## Wrap-up


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

### Description

All versions of Samba from 4.0.0 onwards are vulnerable to a denial of service attack when the RPC spoolss service is configured to be run as an external daemon. Missing input sanitization checks on some of the input parameters to spoolss RPC calls could cause the print spooler service to crash.

### POC

#### Reference
- https://help.ecostruxureit.com/display/public/UADCE725/Security+fixes+in+StruxureWare+Data+Center+Expert+v7.6.0

#### Github
- https://github.com/wiseeyesent/cves

license: MIT

repository: trickest/cve

branch_name: refs/heads/main

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: trickest/cve


text:
# Arduino Examples
Various Arduino examples from the course "Applied Sensorics and Electronics"".

## Used technologies

C++, Arduino, Arduino IDE

## Prerequisites

1. Have an Arduino UNO kit or similar microcontroller. See the [official Arduino website](https://www.arduino.cc/) for more information

2. Install the [Arduino IDE](https://www.arduino.cc/en/Main/Software) on your computer

3. Select your Arduino board and correct port in the Arduino IDE. For more information see the [official Arduino documentation](https://www.arduino.cc/en/Guide/HomePage)

## Installation

1. Download the [code repository](https://github.com/marcelalmesberger/Arduino-Examples/archive/master.zip) and unzip the folder

2. Build the respective circuit (description will follow!)

## Usage

1. Open the respective file in the Arduino IDE and transfer the program on your Arduino board

## Copyright and Licence

Code copyright 2019 Almesberger Marcel. Code released under the [MIT Licence](https://github.com/marcelalmesberger/Arduino-Examples/blob/master/LICENSE)

repository: marcelalmesberger/Arduino-Examples

branch_name: refs/heads/master

repo_name: marcelalmesberger/Arduino-Examples


text:
# email-user-creation

Signup new users in your app using email and password and receive a token in return.

## Signup flow in app

1. Your app calls the Graphcool mutation `signupEmailUser(email: String!, password: String!)`
2. If no user exists yet that corresponds to the passed `email`, a new `User` node will be created with the password (after being hashed and salted)
3. If a user with the passed `email` exists, a `User` node is not created and an error is returned
4. If a user is created, then the `signupEmailUser(email: String!, password: String!)` mutation returns the id for the new user

## Setup the Create User Function

* Create a new Schema Extension Function and paste the schema from `schema-extension.graphql` and code from `signup.js`.
* add a PAT to the project *called the same as your function*. The token can be obtained from the Authentication tab in the project settings.
* Remove all Create permissions for the `User` type. The function uses a Permanent Access Token to create users via the API so the permissions are not needed.

## Test the Code

Go to the Graphcool Playground:

```sh
graphcool playground
```

Run this mutation to create a user:

```graphql
mutation {
  # replace __EMAIL__ and __PASSWORD__
  signupEmailUser(email: "__EMAIL__", password: "__PASSWORD__") {
    id
  }
}
```

You should see that a new user has been created. The returned id can be used to query your Graphcool API for that user. Note that running the mutation again with the same email will return an error stating that the email is already in use.

repository: MillerGregor/functions

repo_name: MillerGregor/functions


text:
# SUSE-udacity-cloud-native-scholarship

A repository containing useful resources needed to complete the SUSE Scholarship Challenge #UdacitySUSEScholars #poweredbySUSE

<img src="https://udacity-email.s3-us-west-2.amazonaws.com/SUSE+Scholarship+badge.png?bsft_aaid=affd8710-61ff-4001-baca-1d4a7303381d&bsft_eid=02c4a236-2164-461d-ab1a-8c4660033b44&utm_campaign=sch_600_2021-06-03_ndxxx_suse-winner_p1_global&utm_source=blueshift&utm_medium=email&utm_content=sch_600_2021-06-03_ndxxx_suse-winner_p1_global&bsft_clkid=58b41dd3-8224-4592-9be5-7e6e141111b4&bsft_uid=f7dd5e62-2463-4d3e-a3d9-829d4c44f344&bsft_mid=36c73aec-5a66-4a4c-b5c1-d4a17bf3787f&bsft_mime_type=html&bsft_ek=2021-06-03T16%3A32%3A30Z&bsft_lx=5&bsft_tv=4" height="200px">

---

## Resources

- Detailed notes of the lessons are available [here](https://smolpkg.notion.site/Udacity-SUSE-Cloud-Native-Scholarship-Program-e42890b84701411da4b6e7b95403ce08)
- Answers to all the quizzes and exercises are available [here](https://smolpkg.notion.site/Udacity-SUSE-Cloud-Native-Scholarship-Program-Exercises-and-Quizzes-83cb4ccfac3b4f92b663dcbf6886409d)
- Docker Cheat Sheet for beginners is available [here](resources/Docker-Cheat-Sheet.pdf)
- Kubernetes Resources mind map is available [here](https://whimsical.com/kubernetes-resources-5nAUygYA97TfJ71aUKs6Tg)

---

## Exercises
1. [Exercise: Endpoints for Application Status](exercises/1-endpoints)
2. [Exercise: Application Logging](exercises/2-logging)
3. [python-helloworld](exercises/python-helloworld)
4. [go-helloworld](exercises/go-helloworld)

---

## Docker Images
1. [python-helloworld](https://hub.docker.com/repository/docker/nandiniproothi/python-helloworld)
2. [go-helloworld](https://hub.docker.com/repository/docker/nandiniproothi/go-helloworld)
---
## Notes
1. [Lesson 1](notes/l1.pdf)
2. [Lesson 2](notes/l2.pdf)
3. [Lesson 3](notes/l3.pdf)
4. [Lesson 4](notes/l4.pdf)
5. [Lesson 5](notes/l5.pdf)
6. [Commands Used](notes/cu.pdf)
---
## Usage
To run a Flask application, navigate to the folder and run either `python3 app.py` or `flask run` commands

---

## Contributing

All contributions are welcome!

- If you're a fellow scholar or just someone who is interested to learn, feel free to make a PR
- In case of major changes/enhancements, please open an [Issue](https://github.com/nandiniproothi/udacity-SUSE-cloud-native-scholarship/issues) first

---
## License

[MIT](LICENSE)


text:
ComputerCraft Developing Community is an unofficial community made by [manu_03](https://github.com/manu-03) that is intended to join all the developers to make better programs (our slogan is "better together").

Our organisation gitter is here: [![Join the chat at https://gitter.im/manu-03/CC-DevCommunity](https://badges.gitter.im/manu-03/CC-DevCommunity.svg)](https://gitter.im/manu-03/CC-DevCommunity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

New to using GitHub? Try reading this [tutorial on the computercraft forums](http://www.computercraft.info/forums2/index.php?/topic/26002-).

# About
* Anyone can fork or create anything.
* All programs developed by the community are licensed under MIT.
* This is intended for players who didn't publish a program and want to start: Other people help you with parts of code that are hard for you, and vice versa.


text:
### Introduction

Docker Images Migration is a Tool Used for Packaging Images to a Tar File,
and Import Images to another Registry (maybe to a private registry, copy tar file and this tool to the private cloud environment).

### Build

Used for Linux

````
 make
````

Used for Mac

````
make build-mac
````

### Usage

Detail in

````
./docker-images-migration
````


text:
---
layout: post
title: Configuring MicroK8s
date: 2019-12-2 00:00:00
author: Juan Medina
comments: true
categories: [Cloud]
image: /assets/img/microk8s.png
image-sm: /assets/img/microk8s.png
---

[Kubernetes (K8s)](https://kubernetes.io/){:target="_blank"} has become the defacto standard for containers orchestration, and since I like to do
some more example about it I was needed to setup it on my system.

In the past I've use [minikube](https://minikube.sigs.k8s.io/){:target="_blank"} for running a local installation of k8s on my environment but since I recently switched to [Linux Mint](https://linuxmint.com/){:target="_blank"} for most of my development I decided to to use [MicroK8s](https://microk8s.io/){:target="_blank"}.

MicroK8s is a small, fast and very simple to install, even for clustering, k8s in a single package, created by [Canonical](https://canonical.com/){:target="_blank"} the company behind [Ubuntu](https://ubuntu.com/){:target="_blank"}.

One the benefits for using Microk8s on Linux is that its run natively (without virtualization), and since Mint is base on Ubuntu this installation is even easer. On Windows and Mac you will need to use [Micropass](https://multipass.run/){:target="_blank"} to run a virtual machine with Ubuntu first.

Minikube uses virtualization in all of the OS that runs, even in linux, and for this is more resource intensive, however is developed by the same team that develop k8s, regardless both are [CNF certified](https://www.cncf.io/certification/software-conformance/){:target="_blank"} k8s solutions. MicroK8s tracks upstream releases of k8s to keep itself up to date with k8s development.

**Installing Snap**

We will install microk8s using an [Snap](https://snapcraft.io/){:target="_blank"}.

[Snaps](https://snapcraft.io/){:target="_blank"} are linux app packages for desktop, cloud and IoT that are easy to install, secure and cross-platform, they are self-contained, including dependencies, and they could be uninstalled without affecting the rest of your system.

From Ubuntu 14.04 LTS onwards snap is already installed, for previous versions we need to install it with apt :

{% highlight bash %}
$ sudo apt update
$ sudo apt install snapd
{% endhighlight %}

After installed we could just check the version that we have using :

{% highlight bash %}
$ snap version
snap       2.42.1+18.04
snapd      2.42.1+18.04
series     16
linuxmint  19.2
kernel     4.15.0-72-generic
{% endhighlight %}

**Installing MicroK8s**

Now that we have snap we could install MicroK8s just doing :

{% highlight bash %}
$ sudo snap install microk8s --classic
microk8s v1.16.3 from Canonical✓ installed
{% endhighlight %}

In order tu use MicroK8s we need either to use sudo or add our **username** to the microk8s group:

{% highlight bash %}
$ sudo usermod -a -G microk8s username
{% endhighlight %}

After login in back again we could not check the status of our k8s cluster with :

{% highlight bash %}
$ microk8s.status
microk8s is running
{% endhighlight %}

If we want to stop or start our cluster we could do it using `microk8s.stop` or `microk8s.start` whenever we need.

MicroK8s provide several commands to manage our cluster, but embed within the installation for example if we want
to see what is running in our cluster using [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/){:target="_blank"} we need to do:

{% highlight bash %}
$ microk8s.kubectl get all --all-namespaces
NAMESPACE   NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
default     service/kubernetes   ClusterIP   <IP_ADDRESS>   <none>        443/TCP   17m
{% endhighlight %}

**Adding addons**

Microk8s installation is very minimal if we like to have a dashboard we need to enable as an [addon](https://microk8s.io/docs/addons){:target="_blank"},
they are several of them so we will enable some basics ones :

{% highlight bash %}
$ microk8s.enable dashboard dns registry fluentd
{% endhighlight %}

**Using the dashboard**

For using the dashboard we need first to find the IP address in our cluster, for this we could just do :

{% highlight bash %}
$ microk8s.kubectl get service kubernetes-dashboard -n kube-system

NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
kubernetes-dashboard   ClusterIP   <IP_ADDRESS>   <none>        443/TCP   28m
{% endhighlight %}

No we know that our dashboard is running at [https://<IP_ADDRESS>](https://<IP_ADDRESS>){:target="_blank"}, however we need a access token for using it,
we could get the token with the following commands:

Get from secrets the default-token secret name:
{% highlight bash %}
$ microk8s.kubectl get secret -n kube-system | grep default-token
default-token-gkjsl                              kubernetes.io/service-account-token
{% endhighlight %}

Get the token, that is the value for the secret name:

{% highlight bash %}
$ microk8s.kubectl describe secret default-token-gkjsl -n kube-system
{% endhighlight %}

Now with this token we can logon into our dashboard:

[![d](/assets/img/captures/kubernetes_dashboard_logon.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kubernetes_dashboard_logon.jpg){:target="_blank"}

We will choose to use a token and we will use the one that we just get, and finally we will see our dashboard:

[![d](/assets/img/captures/kubernetes_dashboard.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kubernetes_dashboardjpg){:target="_blank"}

**Adding a demo application**

For configuring further our MicroK8s we will deploy a new application with two replicas:

{% highlight bash %}
$ microk8s.kubectl create deployment microbot --image=dontrebootme/microbot:v1
deployment.apps/microbot created
$ microk8s.kubectl scale deployment microbot --replicas=2
{% endhighlight %}

Now we could check that we have actually two pods runing with :

{% highlight bash %}
$ microk8s.kubectl get pod --selector=app=microbot
NAME                        READY   STATUS    RESTARTS   AGE
microbot-5bb7fd7f5d-dshtf   1/1     Running   0          2m30s
microbot-5bb7fd7f5d-mdcvs   1/1     Running   0          3m30s
{% endhighlight %}

To access to our applicacion we will expose it trough a NodePort :

{% highlight bash %}
$ microk8s.kubectl expose deployment microbot --type=NodePort --port=80 \
    --name=microbot-service
service/microbot-service exposed
{% endhighlight %}

We could check our services with :

{% highlight bash %}
$ microk8s.kubectl get service --selector=app=microbot
NAME               TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
microbot-service   NodePort   <IP_ADDRESS>   <none>        80:31771/TCP   2m27s
{% endhighlight %}

And since is a NodePort we could use with the IP of our local machine at http://localhost :

[![d](/assets/img/captures/microbot.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/microbot.jpg){:target="_blank"}

If we refresh the page invalidating cache, shift+ctrl+r on Firefox, we will get different containers for this application.

**Configuring Kibana**

Since we original add the addon fluentd we have a Elasticsearch + Kibana for our pods logs, but we need the URL Kibana,
listing the cluster info will display urls for the addons that we have installed:

{% highlight bash %}
$ microk8s.kubectl cluster-info

Kubernetes master is running at https://<IP_ADDRESS>:16443
Elasticsearch is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy
Heapster is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/heapster/proxy
Kibana is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/kibana-logging/proxy
CoreDNS is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Grafana is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
InfluxDB is running at https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/monitoring-influxdb:http/proxy
{% endhighlight %}

However before accessing we need the user and password for managing this cluster this could obtain with the command

{% highlight bash %}
$ microk8s.kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://<IP_ADDRESS>:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    password: aRZbT45aNLB3AYUaz2rVa2RtzACoUR3zOGZoeWQ4c016SjlJSUt6bXNlRT0K
    username: admin
{% endhighlight %}

Now we could visit our Kibana in the url https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/kibana-logging/proxy and use our
admin user and password.

[![d](/assets/img/captures/kibana_main.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kibana_main.jpg){:target="_blank"}

However if we like to browse the data when clicking on Discover we will get redirect to create an index, the pattern will be `logstash*`:

[![d](/assets/img/captures/kibana_index.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kibana_index.jpg){:target="_blank"}

And finally we will set our *Time Filter field name* to be `@timestamp`:

[![d](/assets/img/captures/kibana_index_2.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kibana_index_2.jpg){:target="_blank"}

Now we could click on *Create index pattern* to complete our index creation.

For testing our index lets deploy another service to our cluster, one application that output on the logs random name into the stdout :

{% highlight bash %}
$ microk8s.kubectl create deployment random-generator --image=chriscmsoft/random-generator:latest
deployment.apps/random-generator created
$ microk8s.kubectl scale deployment random-generator --replicas=2
$ microk8s.kubectl get all --selector=app=random-generator
NAME                                    READY   STATUS    RESTARTS   AGE
pod/random-generator-7b6c47d877-plbsg   1/1     Running   0          54s
pod/random-generator-7b6c47d877-wh4jj   1/1     Running   0          11s

NAME                               READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/random-generator   2/2     2            2           54s

NAME                                          DESIRED   CURRENT   READY   AGE
replicaset.apps/random-generator-7b6c47d877   2         2         2       54
{% endhighlight %}

We could check the log of this service with :
{% highlight bash %}
$ microk8s.kubectl logs --selector=app=random-generator
{"name": "Gara, The Magnificent"}
{"name": "Gairvol, The Puny"}
{"name": "Zyvrieliar, The Swift"}
{"name": "Gara, The Magnificent"}
{"name": "Xaymmynth, Champion Of The Blue"}
{"name": "Chynnyrth, Champion Of Men"}
{"name": "Xaerlulth, The Warm"}
{"name": "Xarsot, The Tyrant"}
{"name": "Xaerlulth, The Warm"}
{"name": "Xaerlulth, The Warm"}
{"name": "Siovaeloi, Protector Of The Weak"}
{"name": "Siovaeloi, Protector Of The Weak"}
{"name": "Zaellyt, The Gifted One"}
{"name": "Gorsolun, Warmheart"}
{"name": "Vugeo, The Youngling"}
{"name": "Vugeo, The Youngling"}
{"name": "Xughus, The Tall"}
{"name": "Xaerlulth, The Warm"}
{"name": "Gorsolun, Warmheart"}
{% endhighlight %}

Now back into Kibana we could just do a simple filter `kubernetes.container_name: random-generator` and select the `docker` and `log` fields to view the logs
of this application.

[![d](/assets/img/captures/kibana_search.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/kibana_search.jpg){:target="_blank"}

**Configuring Grafana**

As we did for Kibana we could grab the url for Grafana for the cluster info, this case is https://<IP_ADDRESS>:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy , we will need our admin user and password as we needed before.

[![d](/assets/img/captures/grafana_login.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/grafana_login.jpg){:target="_blank"}

MicroK8s has already configure some dashboard we could choose *Pods* and then select our *default* namespace an any of our random-generator pods to look some of
the graphs.

[![d](/assets/img/captures/grafana_pod.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/grafana_pod.jpg){:target="_blank"}

The defaul Pod dashboard allow us to just select one pod let modify it to allow to choose several.

Click on the gear icon on Grafana and choose *Templating* :

[![d](/assets/img/captures/grafana_templating.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/grafana_templating.jpg){:target="_blank"}

Now on the field *$podname* we click on the *Edit* button.

[![d](/assets/img/captures/grafana_podname.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/grafana_podname.jpg){:target="_blank"}

We need to activate *Multi-value* on the *Selection Options* and then click now *Update*, sometimes the field Data Source get set to blank we need to set it to *influxdb-dataset*.

With this now could close the Templating and choose all of the pods for our random-generator to get an update graph with the sum of both pods.

[![d](/assets/img/captures/grafana_all_pods.jpg){:style="width:80%; display:block; margin-left:auto; margin-right:auto;"}](/assets/img/captures/grafana_all_pods.jpg){:target="_blank"}

**Clean up**

Now that we have test some of the tools in our MicroK8s installation we could delete the applications that we do not need anymore :

{% highlight bash %}
$ microk8s.kubectl delete all --selector=app=microbot
pod "microbot-5bb7fd7f5d-dshtf" deleted
pod "microbot-5bb7fd7f5d-mdcvs" deleted
service "microbot-service" deleted
deployment.apps "microbot" deleted
replicaset.apps "microbot-5bb7fd7f5d" deleted

$ microk8s.kubectl delete all --selector=app=random-generator
pod "random-generator-7b6c47d877-plbsg" deleted
pod "random-generator-7b6c47d877-wh4jj" deleted
deployment.apps "random-generator" deleted
replicaset.apps "random-generator-7b6c47d877" deleted
{% endhighlight %}

**Conclusions**

MicroK8s is very easy to install it took just seconds to download and get it ready, it provide many already config addons that allows use it easily and
kickstart a k8s cluster very fast with everything that we need, and is really slim and fast so a really good candidate for IoT deployments.

I've enjoy a lot this installation and I'm looking forward to learn more of k8s using MicroK8s, they are several addons that I'ven't tryout yet such [Istio](https://istio.io/){:target="_blank"} and [Knative](https://knative.dev/){:target="_blank"}, maybe in a nearby future.

**Reference**

- [https://tutorials.ubuntu.com/tutorial/install-a-local-kubernetes-with-microk8s](https://tutorials.ubuntu.com/tutorial/install-a-local-kubernetes-with-microk8s){:target="_blank"}
- [https://kubernetes.io/docs/reference/kubectl/cheatsheet/](https://kubernetes.io/docs/reference/kubectl/cheatsheet/){:target="_blank"}
- [https://medium.com/@chris_linguine/how-to-monitor-distributed-logs-in-kubernetes-with-the-efk-stack-1218a565ce0c](https://medium.com/@chris_linguine/how-to-monitor-distributed-logs-in-kubernetes-with-the-efk-stack-1218a565ce0c){:target="_blank"}

repository: juan-medina/blog

repo_name: juan-medina/blog


text:
# The paket.lock file

Consider the following [`paket.dependencies` file](dependencies-file.html):

```paket
source https://nuget.org/api/v2

nuget Castle.Windsor-log4net !~> 3.2
nuget Rx-Main !~> 2.0
```

Here we [specify dependencies](dependencies-file.html) on the default NuGet
feed's
[`Castle.Windsor-log4net`](https://www.nuget.org/packages/Castle.Windsor-log4net/)
and [`Rx-Main`](https://www.nuget.org/packages/Rx-Main/) packages; both these
packages have dependencies on other NuGet packages.

The [`paket.lock` file](lock-file.html) records the concrete dependency
resolution of all direct and [transitive dependencies](faq.html#transitive) of
your project:

```paket
NUGET
  remote: https://nuget.org/api/v2
    Castle.Core (3.3.0)
    Castle.Core-log4net (3.3.0)
      Castle.Core (>= 3.3.0)
      log4net (1.2.10)
    Castle.LoggingFacility (3.3.0)
      Castle.Core (>= 3.3.0)
      Castle.Windsor (>= 3.3.0)
    Castle.Windsor (3.3.0)
      Castle.Core (>= 3.3.0)
    Castle.Windsor-log4net (3.3.0)
      Castle.Core-log4net (>= 3.3.0)
      Castle.LoggingFacility (>= 3.3.0)
    Rx-Core (2.2.5)
      Rx-Interfaces (>= 2.2.5)
    Rx-Interfaces (2.2.5)
    Rx-Linq (2.2.5)
      Rx-Interfaces (>= 2.2.5)
      Rx-Core (>= 2.2.5)
    Rx-Main (2.2.5)
      Rx-Interfaces (>= 2.2.5)
      Rx-Core (>= 2.2.5)
      Rx-Linq (>= 2.2.5)
      Rx-PlatformServices (>= 2.2.5)
    Rx-PlatformServices (2.2.5)
      Rx-Interfaces (>= 2.2.5)
      Rx-Core (>= 2.2.5)
    log4net (1.2.10)
```

If the [`paket.lock` file](lock-file.html) is not present when
[`paket install`](paket-install.html) is run, it will be generated. Subsequent
runs of [`paket install`](paket-install.html) will only perform updates
according to the latest changes in the
[`paket.dependencies` file](dependencies-file.html).

Committing the [`paket.lock` file](lock-file.html) to your version control
system guarantees that other developers and/or build servers will always end up
with a reliable and consistent set of packages regardless of where or when
[`paket restore`](paket-restore.html) is executed.

## Performing updates

If you make changes to [`paket.dependencies`](dependencies-file.html) or you
want Paket to check for newer versions of the direct and
[transitive dependencies](faq.html#transitive) as specified in
[`paket.dependencies`](dependencies-file.html), run:

* [`paket outdated`](paket-outdated.html) to check for new versions, and report
  what's available.
* [`paket install`](paket-install.html) to analyze the modifications in the
  [`paket.dependencies` file](dependencies-file.html) and perform a selective
  update (only changed dependencies are updated).
* [`paket update`](paket-update.html) to check for new versions, download any
  that fit the criteria, and update the references within the project files as
  specified by their associated [`paket.references`](references-files.html).

repository: fredbuluku/Paket

repo_name: fredbuluku/Paket


text:
# phin-retry

![Build](https://github.com/ASaiAnudeep/phin-retry/workflows/Build/badge.svg?branch=master)
![Coverage](https://img.shields.io/codeclimate/coverage/ASaiAnudeep/phin-retry)

The ultra-lightweight Node.js HTTP client.

> This is a wrapper around [Phin](https://github.com/ethanent/phin) that adds support for retry & looks like [request-promise](https://github.com/request/request-promise).

## Install

```shell
npm install phin-retry
```

## Usage

```javascript
const request = require('phin-retry');

// should be used in async context
const response = await request.get('https://jsonplaceholder.typicode.com/posts/1');

await request.post({
    url: 'http://localhost:9393/api/post',
    body: { msg: 'input' },
    retry: 3,
    delay: 500
  });

// custom retry, error & delay strategy
const response = await request.delete({
    url: 'http://localhost:9393/api/delete',
    auth: {
      user: 'name',
      pass: 'secret'
    },
    errorStrategy: ({response, error, options}) => {
        if (error) return true;
        if (response.statusCode >= 400) {
          return false;
        }
        return true;
      },
    retryStrategy: ({response, error, options}) => {
        if (error) return true;
        if (options.method === 'POST') return false;
        if (response.statusCode >=200 && response.StatusCode < 300) {
          return false;
        }
        return true;
      },
    delayStrategy: ({response, error, options, delay}) => {
        if (error) return 5000;
        return 2000;
      },
  });

```

* It supports **get**, **post**, **put**, **delete**, **patch** HTTP methods.
* By default, this library will retry once on failure (StatusCode >= 500 & network errors) with a delay of 100 or 1000 milliseconds. Override this behavior with custom retry strategy function.
* Responses with status codes < 200 & >= 300 are thrown as errors. Override this behavior with custom error strategy function.
* All options from **phin** are supported. Refer [Phin](https://www.npmjs.com/package/phin) for more usage examples.
* Access underlying **phin** library through `request.phin`.

## API

### Defaults

Access default options through `request.defaults`.

| Option              | Type     | Description                        |
| ----------------    | -------- | ---------------------------------- |
| `retry`             | number   | max no of times to retry (1)       |
| `delay`             | number   | delay between retries (100ms)      |
| `networkErrorDelay` | number   | delay for network errors (1000ms)  |
| `retryStrategy`     | function | default retry strategy function    |
| `delayStrategy`     | function | default delay strategy function    |
| `errorStrategy`     | function | default error strategy function    |

### Options

It supports all options from **phin**, refer [Phin](https://www.npmjs.com/package/phin) for more details.

| Method           | Type     | Description                     |
| ---------------- | -------- | ------------------------------- |
| `url`            | string   | request url                     |
| `qs`             | object   | query parameters                |
| `auth`           | object   | authentication object           |
| `headers`        | object   | headers object                  |
| `retry`          | number   | max no of times to retry        |
| `delay`          | number   | delay between retries           |
| `body`           | any      | equivalent to data in phin      |
| `fullResponse`   | boolean  | returns full phin response      |
| `retryStrategy`  | function | custom retry strategy function  |
| `delayStrategy`  | function | custom delay strategy function  |
| `errorStrategy`  | function | custom error strategy function  |

repository: ASaiAnudeep/phin-retry

gha_language: JavaScript

repo_name: ASaiAnudeep/phin-retry


text:
Returns the number of keys in the specified Redis Cluster hash slot. The
command only queries the local data set, so contacting a node
that is not serving the specified hash slot will always result in a count of
zero being returned.

```
> CLUSTER COUNTKEYSINSLOT 7000
(integer) 50341
```

@return

@integer-reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.

repository: laixintao/iredis

gha_language: Python

repo_name: laixintao/iredis


text:
# Challenge in concurrency control

本文总结在concurrency control中的一些challenge。

## wikipedia [Starvation](https://en.wikipedia.org/wiki/Starvation_(computer_science))

In [computer science](https://en.wikipedia.org/wiki/Computer_science), **resource starvation** is a problem encountered in [concurrent computing](https://en.wikipedia.org/wiki/Concurrent_computing) where a [process](https://en.wikipedia.org/wiki/Computer_process) is perpetually denied necessary [resources](https://en.wikipedia.org/wiki/Resource_(computer_science)) to process its work.[[1\]](https://en.wikipedia.org/wiki/Starvation_(computer_science)#cite_note-1) Starvation may be caused by errors in a scheduling or [mutual exclusion](https://en.wikipedia.org/wiki/Mutual_exclusion) algorithm, but can also be caused by [resource leaks](https://en.wikipedia.org/wiki/Resource_leak), and can be intentionally caused via a [denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) such as a [fork bomb](https://en.wikipedia.org/wiki/Fork_bomb).

## Fairness and starvation

1、如果能够保证"fairness" ，那么就能够免于starvation

### 素材: wikipedia [Test-and-set](https://en.wikipedia.org/wiki/Test-and-set) # [Performance evaluation of test-and-set locks](https://en.wikipedia.org/wiki/Test-and-set#Performance_evaluation_of_test-and-set_locks)

When we consider fairness, we consider if a processor gets a fair chance of acquiring the lock when it is set free. In an extreme situation the processor might **starve** i.e. it might not be able to acquire the lock for an extended period of time even though it has become free during that time.

repository: dengking/Parallel-computing

repo_name: dengking/Parallel-computing


text:
# Reflection utility for Kotlin

## Overview

The library aim to provide more smarter way of the reflection with the Kotlin.

Here is the example.

```kotlin
// Target.kt
package com.example

class Target {
    fun hello(name: String): String{
        return "Hello $name!"
    }
}
```

```kotlin
// Example.kt
package com.example

import net.refy.android.reflect.Reflect

class Example : Reflect("com.example.Target"){
    val hello by virtual<String>(String::class.java)
}
```

```kotlin
// Program.kt
package com.example

fun main(args: Array<String>){
    // print "Hello Alice"
    System.out.println(Example().hello("Alice"))
}
```

## Installation

Add gradle repositories and dependency in your build.grade.

```gradle
repositories {
    maven { url 'https://tmyt.github.io/reflect/' }
}

dependencies {
    ...
    implementation 'tech.onsen:reflect:1.1.0'
    ...
}
```

## Usage

You need to initialize the target type via `constructor(className: String)`, `constructor(clazz: Class<*>)` or `override val type: Class<*>`.
And optionally needed to override `val value: Any?`, if you need some constructor arguments.

### Constructors

#### constructor()

Note: You need to override `val type: Class<*>` and optinally `val value: Any?` properties.

For Exmple:
```kotlin
class Example : Reflect() {
    override type by lazy { Class.forName("com.example.Target") }
}
```

#### constructor(className: String)

Initialize `type` property with `Class.forName(className)`, and `value` property initialized with default constructor of `type`.
You can override `value` property optionally, if you need some constructor arguments.

For Example:
```kotlin
class Example : Reflect("com.example.Target") {
}
```

#### constructor(clazz: Class<*>)

Initialize `type` property with argument, and `value` property initialized with default constructor of `type`.
You can override `value` property optionally, if you need some constructor arguments.

For example:
```kotlin
class Example(target: Class<*>) : Reflect(target) {
}
```

### Property Delegates

#### <T> virtual(vararg args: Class<*>)

Initialize property as virtual method.

For example: You want to call `hello` method with `String` argument and `Boolean` return value,

```kotlin
val hello by virtual<Boolean>(String::class.java)
```

You can invoke the property same as function.

```kotlin
hello("alice")
```

#### <T> static(vararg args: Class<*>)

Initialize property as static method.

For example: You want to call `hello` method with `String` argument and `Boolean` return value,

```kotlin
val hello by static<Boolean>(String::class.java)
```

You can invoke the property same as function.

```kotlin
hello("bob")
```

### Utilities

#### ctor(vararg args: Class<*>)

Reflect constructor with `args` arguments. You can invoke the return value same as funtion, you can initialize the `value` property smiply.

For example: Call constructor with One String argument.

```kotlin
val value = ctor(String::class.java)("hello alice")
```

### Properties

#### val type: Class<*>

The property indicates the Class<*> of reflect target.

The proeprty automatically initialized when only use constructor with arguments. If you use primary constructor of `Reflect`, you need override the property in the derived class.

For example:

```kotlin
override val type: Class<*> by lazy { value.javaClass }
```

#### val value: Any?

The property indicates the instance of the reflect target.

The property automatically initialized with default constructor of the `type`. If you need some constructor arguments, you need override the property in the derived class.

For example:

```kotlin
override val value: Any? by lazy { ctor(String::class.java)("hello alice") }
```

## Other classes

### Ref<T>

#### Functions

##### operator invoke(vararg arg: Any?): T

Call Reflected method with arguments.
If no method available, this method throw `NoSuchMethodException`.

#### Properties

##### val available: Boolean

Return `true` if reflected method is available.

## License

MIT

repository: tmyt/reflect

repo_name: tmyt/reflect


text:
---
title: Open source licenses- What, which, and why
author: PipisCrew
date: 2020-02-24
categories: [news]
toc: true
---

Most people have at least heard of open source software by now—and even have a fairly good idea of what it is.

https://arstechnica.com/?p=1655696

origin - https://www.pipiscrew.com/2020/02/open-source-licenses-what-which-and-why/ open-source-licenses-what-which-and-why


text:
# MultiZone Secure IoT Stack

The first Secure IoT Stack for RISC-V – a secure implementation of freeRTOS with hardware enforced separation between the OS, TCP/IP stack and root of trust with TLS 1.3 / ECC for secure Internet of Things applications.

This reference implementation combines freeRTOS, picoTCP, wolfSSL and Root of Trust as physically isolated TEE zones
 - X300 Bitstream : Rocket core with Ethernet Peripheral for Xilinx A7-35T Arty Board
 - MultiZone Security Trusted Execution Environment configured for 4 Zones
 - Zone 1: FreeRTOS with 3 tasks (CLI, LED PWM, Robot)
 - Zone 2: PicoTCP + wolfSSL TLS 1.3 / ECC terminating Ethernet port
 - Zone 3: Root of Trust
 - Zone 4: USB UART Console

This repository, maintained by Hex Five Security, makes it easy to build a robust Secure IoT Stack with four Zones based on MultiZone Security.

### Installation ###

Hex Five created a modified version of the Rocket SoC called teh X300 with an additional Ethernet port and improved performance

Upload the X300 Bitstream to a Xilinx Artik-7 35T Arty FPGA board
prerequisites: Xilinx Vivado, Olimex ARM-USB-TINY-H Debugger
 - Download the X300 bitstream .mcs file from https://github.com/hex-five/multizone-fpga/releases
 - Push the .mcs file to the Arty board using Vivado

 Install the reference RISC-V toolchain for Linux - directions specific to a fresh Ubuntu 18.04 LTS, other Linux distros generally a subset
 ```
 sudo apt update
 sudo apt upgrade -y
 sudo apt install git make default-jre libftdi1-dev
 sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
 wget https://github.com/hex-five/multizone-sdk/releases/download/v0.1.0/riscv-gnu-toolchain-20181226.tar.xz
 tar -xvf riscv-gnu-toolchain-20181226.tar.xz
 wget https://github.com/hex-five/multizone-sdk/releases/download/v0.1.0/riscv-openocd-20181226.tar.xz
 tar -xvf riscv-openocd-20181226.tar.xz
 git clone https://github.com/hex-five/multizone-secure-iot-stack
 sudo apt-get install libusb-0.1-4
 sudo apt-get install screen
```

If you have not already done so, you need to edit or create a file to place the USB devices until plugdev group so you can access them without root privileges:
```
sudo vi /etc/udev/rules.d/99-openocd.rules
```
Then place the following text in that file
```
# These are for the HiFive1 Board
SUBSYSTEM=="usb", ATTR{idVendor}=="0403",
ATTR{idProduct}=="6010", MODE="664", GROUP="plugdev"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403",
ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
# These are for the Olimex Debugger for use with E310 Arty Dev Kit
SUBSYSTEM=="usb", ATTR{idVendor}=="15ba",
ATTR{idProduct}=="002a", MODE="664", GROUP="plugdev"
SUBSYSTEM=="tty", ATTRS{idVendor}=="15ba",
ATTRS{idProduct}=="002a", MODE="664", GROUP="plugdev"
```
Detach and re-attach the USB devices for these changes to take effect.

Add environment variables and a path to allow the Makefiles to find the toolchain

edit ~/.bashrc and ~/.profile and place the following text at the bottom of both files.
```
export RISCV=/home/<username>/riscv-gnu-toolchain-20181226
export OPENOCD=/home/<username>/riscv-openocd-20181226
export PATH="$PATH:/home/<username>/riscv-gnu-toolchain-20181226/bin"
```
Close and restart the terminal session for these changes to take effect.

### Compile and Upload the Project to the Arty Board ###

```
cd multizone-secure-iot-stack/
make clean
make
```

This will result in a HEX file that is now ready to upload to the Arty board.  The first time you push this HEX file up it takes about 2 minutes, on subsequent passes it goes much faster.
```
make load
```

### Operate the Demo ###

The system contains four zones:
 - Zone 1: FreeRTOS with three tasks - CLI, LED PWM and Robot Control plus three interrupt handlers (BTN0-2)
   - Press enter for a list of support commands
 - Zone 2: TCP/IP + TLS Stack (picoTCP + wolfSSL) - accessable via ethernet port
   - Ping to <IP_ADDRESS> (default address, set in Makefile)
   - Telnet to port 23
   - Secure telnet (TLS) to port 443
 - Zone 3: Root of Trust and Session Key Storage
 - Zone 4: UART Console - access via USB UART at 115,200 buard 8N1
   - Press enter for a list of supported commands

### For More Information ###

See the MultiZone Manual (Pending) or visit [http://www.hex-five.com](https://www.hex-five.com)

license: ISC

repository: sergioagp/multizone-secure-iot-stack

repo_name: sergioagp/multizone-secure-iot-stack


text:
# Moses Tokenizer for GoLang

GoLang implementation of [Tokenizer & Normalizer from Moses Decoder](https://github.com/moses-smt/mosesdecoder)

## Installation

```bash
go get github.com/khaibin/go-mosestokenizer
```

## Usage

```go
package main

import (
    "fmt"
    "github.com/khaibin/go-mosestokenizer"
    "github.com/khaibin/go-mosestokenizer/nonbreaking_prefix"
)

func main() {
    text := "This is a string"
    lang := "en"

    // Tokenize and get the result as []string
    mosestokenizer.Tokenize(text, lang)

    // Tokenize and get the result as string
    mosestokenizer.TokenizeAsString(text, lang)

    // Normalization
    mosestokenizer.Normalize(text, lang)

    prefix := "mr"
    prefix_lang := "en"

    // Returns true if string is non-breaking prefix
    nonbreaking_prefix.Find(prefix, prefix_lang)

    // Returns true if string is non-breaking numeric only prefix
    nonbreaking_prefix.FindNumeric(prefix, prefix_lang)

    // Constants
    //   perluniprops.ALPHA
    //   perluniprops.NUM
    //   perluniprops.ALNUM
}
```

## Publications
The segmentation methods are described in:

[Rico Sennrich, Barry Haddow and Alexandra Birch (2016): Neural Machine Translation of Rare Words with Subword Units Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (ACL 2016). Berlin, Germany.](https://arxiv.org/abs/1508.07909)

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: kabychow/go-mosestokenizer

repo_name: kabychow/go-mosestokenizer


text:
---
title: UE4 Platformer Game Analysis
author: error454
layout: post
permalink: /2014/11/10/platformer-game-analysis/
categories:
  - ue4
tags:
  - ue4
  - platformer
  - analysis
  - c++
---

My journal from the disection of the platformer game sample.

## PlatformerGameMode.h ##
* Contains a custom state enum for tracking the states of the game. Also exposes this through a getter but there's no setter, the state gets modified based on the flow of the game.
* Has private variables related to scoring
* Manages the time remaining in the game as well as adding/subtracting from that time based on picking up things in the world
* Has functions that manage saving best checkpoint times
* Pauses/Unpauses the game
* Starts/restarts the game
* Positions the player at the start location

## PlatformerBlueprintLibrary ##
This code is basically a huge set of wrappers to expose functions that live in `PlatformerGameMode` to blueprints.  For instance the FinishRace function, notice that there isn't a 1:1 function to call, instead it finishes the round and then asks if the round was won:
<!--more-->

    bool UPlatformerBlueprintLibrary::FinishRace(class UObject* WorldContextObject)
    {
    	bool bHasWon = false;

    	APlatformerGameMode* MyGame = GetGameFromContextObject(WorldContextObject);
    	if (MyGame)
    	{
    		MyGame->FinishRound();
    		bHasWon = MyGame->IsRoundWon();
    	}

    	return bHasWon;
    }

I don't really understand the motivation behind this organization. If I were writing something from scratch, I would have the instinct to expose the Game Mode functions to blueprint and have my blueprints calling the same functions 1:1.

On the other hand, not every function in here is a wrapper for `PlatformerGameMode` functions. There is also stuff that calls through to the HUD, sorts scores and formats time strings.  Also, you can then treat the blueprints like a traditional getter/setter where you do more careful type checking to make sure inputs and outputs are dealt with.

## PlatformerGameUserSettings ##
This class handles applying and modifying settings in the game:

* Sound volume
* Fullscreen mode

Of interest is the `UPROPERTY(config)` for the sound volume variable. [More docs](https://docs.unrealengine.com/latest/INT/Programming/Basics/ConfigurationFiles/index.html).

## PlatformerPlayerMovementComponent ##

> The [CharacterMovementComponent](https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Pawn/Character/index.html) allows avatars not using rigid body physics to move by walking, running, jumping, flying, falling, and swimming. It is specific to Characters, and cannot be implemented by any other class. Properties that can be set in the CharacterMovementComponent include values for falling and walking friction, speeds for travel through air and water and across land, buoyancy, gravity scale, and the physics forces the Character can exert on Physics objects. The CharacterMovementComponent also includes root motion parameters that come from the animation and are already transformed in world space, ready for use by physics.

The default CharacterMovementComponent is overriden in the `PlatformerCharacter` constructor. The main new things that I see this class doing are:

* Implement sliding - this includes functions to query the sliding state
* Expose a bunch of variables to tune various aspects of the movement mechanics
* Overriding StartFalling PhysWalking and ScaleInputAcceleration

## PlatformerPlayerCameraManager ##
A subclass of `APlayerCameraManager` with an override for:

* UpdateViewTargetInternal

And new functionality for:

* Setting a fixed camera Z offset
* Settings/Getting camera zoom

## PlatformerPlayerController ##
Subclass of [APlayerController](https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/index.html):

> The PlayerController implements functionality for taking the input data from the player and translating that into actions such as movement, using items, firing weapons, etc. These actions are generally passed on to other components of the system; most notably, the Pawn and Camera.

Provides overrides for:

* PostInitializeComponents
    * Creates the in-game menu
* SetupInputComponent
    * Binds the `InGameMenu` action to the public function `OnToggleInGameMenu()`

Special functions:

* Enables click and touch events
* TryStartingGame() exposed to blueprints.
* Toggle in game menu
* Handle to an in-game menu

In the constructor is where the custom Player Camera Manager is set:

`PlayerCameraManagerClass = APlatformerPlayerCameraManager::StaticClass();`

It turns out that UE4 has their own implementation of Smart Pointers, [TSharedPtr, TSharedRef, TWeakPtr](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/SmartPointerLibrary/index.html). You can see one used for the menu instantiation:

    PlatformerIngameMenu = MakeShareable(new FPlatformerIngameMenu());

## Input Handling ##
The player controller only handles the ESC button to toggle the menu. The other input bindings are handled directly in the pawn.


text:
# waterledger
App for logging water consumption and to remember to drink water.\
This application uses a Redux Pattern.\
It uses Firebase to handle the backend, analytics, and authentication.\
It is built in flutter. The app was developed for android, but can easily be released on iOS
as well with some slight tweaks. \
Link to the play store listing: https://play.google.com/store/apps/details?id=me.bobbyjones.waterledger

BTW the app on the store may not actually work. I minified the code using proguard and it broke the app.
I undid some but not all of the minification due to size constraints. I am currently not able to test the latest release
due to my android device being destroyed on the day of release. So if you guys test the release please leave an issue if
it does not work as expected thanks.

repository: Bobbyjoness/waterledger

repo_name: Bobbyjoness/waterledger


text:
# Notes

> ORY Keto is still a `sandbox` project and the included APIs are unstable until
> we reach `v1` and release `v1.0.0` of Keto!
>
> Older API versions, such as `v1alpha2`, will still get support for a
> reasonable amount of time after release of `v1`!

This directory contains the ProtoBuf & gRPC definitions for the Access Control
APIs.

**ACL is the flexible and scalable "base system" all other access control
schemes built upon.**

## Directory layout

```
ory
└── keto
    └── acl
        └── v1* - "Base" API definitions
```

- `acl/v1*`
  - model definitions
  - read
  - write
  - check
  - expand

repository: ory/keto

gha_language: Go

repo_name: ory/keto


text:
# Google-Search-Scrape

Simple Web Scrape for Google Search, Images, News

### Version
0.1.0

### Installation
```sh
$ npm i --save google-search-scrape
```

### Usage
    var google-search-scrape = require('google-search-scrape');
    // Returns promise with array of Searches (Object)
    var query = 'cats'

    // Returns promise with website link (String)
    google-search-scrape.getWebsite(query);
    // "link"

    // Returns promise with array of Searches (Object)
    google-search-scrape.getSearch(query);
    // [{ link: "link", description: "description" }, ...]

    // Returns promise with array of news (Object)
    google-search-scrape.getNews(query);
    // [{ link: "link", description: "description" }, ...]

    // Returns promise with all images in array (Array)
    google-search-scrape.getImages(query);
    // ["link","link", ...]

License
----
MIT

repository: digitized/googlesearch

repo_name: digitized/googlesearch


text:
# NReco.Data
Lightweight data access components for generating SQL commands, mapping results to strongly typed POCO models or dictionaries, schema-less CRUD-operations with RecordSet.

NuGet | Windows x64 | Ubuntu 14.04
--- | --- | ---
[![NuGet Release](https://img.shields.io/nuget/v/NReco.Data.svg)](https://www.nuget.org/packages/NReco.Data/) | [![AppVeyor](https://img.shields.io/appveyor/ci/nreco/data/master.svg)](https://ci.appveyor.com/project/nreco/data) | [![Travis CI](https://img.shields.io/travis/nreco/data/master.svg)](https://travis-ci.org/nreco/data)

* abstract DB-independent [Query structure](https://github.com/nreco/data/wiki/Query) (no need to compose raw SQL)
* DbCommandBuilder for generating SELECT, INSERT, UPDATE and DELETE commands
* DbBatchCommandBuilder for generating several SQL statements into one IDbCommand (batch inserts, updates, select multiple recordsets)
* [RecordSet model](https://github.com/nreco/data/wiki/RecordSet) for in-memory data records (lightweight and efficient replacement for DataTable/DataRow)
* DbDataAdapter for CRUD-operations:
 * supports annotated POCO models (like EF Core entity models)
 * schema-less data access API (dictionaries / RecordSet)
 * async support for all methods
* application-level data views (for complex SQL queries) that accessed like simple read-only tables (DbDataView)
* best for schema-less DB access, dynamic DB queries, user-defined filters; NReco.Data can be used in addition to EF Core
* fills the gap between minimalistic .NET Core (corefx) System.Data and EF Core
* parser/builder for compact string query representation: [relex](https://github.com/nreco/data/wiki/Relex) expressions
* can be used with any existing ADO.NET data provider (MsSql, PostgreSql, Sqlite, MySql etc)
* supports both full .NET Framework 4.5+ and .NET Core (netstandard1.5)

Nuget package: [NReco.Data](https://www.nuget.org/packages/NReco.Data/)
NReco.Data documentation:
* [Getting started and HowTos](https://github.com/nreco/data/wiki)
* [API Reference](http://www.nrecosite.com/doc/NReco.Data/)
* something is still not clear? Feel free to [ask a question on StackOverflow](http://stackoverflow.com/questions/ask?tags=nreco,c%23)

## How to use
**DbCommandBuilder for SqlClient**:
```
var dbFactory = new DbFactory(System.Data.SqlClient.SqlClientFactory.Instance) {
	LastInsertIdSelectText = "SELECT @@IDENTITY"
};
var dbCmdBuilder = new DbCommandBuilder(dbFactory);
var selectCmd = dbCmdBuilder.GetSelectCommand(
	new Query("Employees", (QField)"BirthDate" > new QConst(new DateTime(1960,1,1)) ) );
var insertCmd = dbCmdBuilder.GetInsertCommand(
	"Employees", new { Name = "John Smith", BirthDate = new DateTime(1980,1,1) } );
var deleteCmd = dbCmdBuilder.GetDeleteCommand(
	new Query("Employees", (QField)"Name" == (QConst)"John Smith" ) );
```
**Sqlite** - only difference is:
```
var dbFactory = new DbFactory(Microsoft.Data.Sqlite.SqliteFactory.Instance) {
	LastInsertIdSelectText = "SELECT last_insert_rowid()"
};
```
**DbDataAdapter** - provides simple API for CRUD-operations:
```
var dbConnection = dbFactory.CreateConnection();
var dbAdapter = new DbDataAdapter(dbConnection, dbCmdBuilder);
// map select results to POCO models
var employeeModelsList = dbAdapter.Select<Employee>( new Query("Employees") ).ToList();
// read select result to dictionary
var employeeDictionary = dbAdapter.Select(
		new Query("Employees", (QField)"EmployeeID"==(QConst)newEmployee.EmployeeID ).Select("FirstName","LastName")
	).ToDictionary();
// update by dictionary
dbAdapter.Update(
	new Query("Employees", (QField)"EmployeeID"==(QConst)1001 ),
	new Dictionary<string,object>() {
		{"FirstName", "Bruce" },
		{"LastName", "Wayne" }
	});
// insert by model
dbAdapter.Insert( "Employees", new { FirstName = "John", LastName = "Smith" } );
```
**[RecordSet](https://github.com/nreco/data/wiki/RecordSet)** - efficient replacement for DataTable/DataRow with very similar API:
```
var rs = dbAdapter.Select(new Query("Employees")).ToRecordSet();
rs.SetPrimaryKey("EmployeeID");
foreach (var row in rs) {
	Console.WriteLine("ID={0}", row["EmployeeID"]);
	if ("Canada".Equals(row["Country"]))
		row.Delete();
}
dbAdapter.Update(rs);
var rsReader = new RecordSetReader(rs); // DbDataReader for in-memory rows
```
**[Relex](https://github.com/nreco/data/wiki/Relex)** - compact relational query expressions:
```
var relex = @"Employees(BirthDate>""1960-01-01"":datetime)[Name,BirthDate]"
var relexParser = new NReco.Data.Relex.RelexParser();
Query q = relexParser.Parse(relex);
```

## More examples
* [Command Builder](https://github.com/nreco/data/tree/master/examples/SqliteDemo.CommandBuilder/Program.cs): illustrates SQL commands generation, command batching (inserts)
* [Data Adapter](https://github.com/nreco/data/tree/master/examples/SqliteDemo.DataAdapter/Program.cs): CRUD operations with dictionaries, POCO, RecordSet
* [DB WebApi](https://github.com/nreco/data/tree/master/examples/SqliteDemo.WebApi): configures NReco.Data services in MVC Core app, simple REST API for database tables
* [MVC Core CRUD](https://github.com/nreco/data/tree/master/examples/SqliteDemo.MVCApplication): full-functional CRUD (list, add/edit forms) that uses NReco.Data as data layer in combination with EF Core
* [DB Metadata](https://github.com/nreco/data/tree/master/examples/MySqlDemo.DbMetadata): extract database metadata (list of tables, columns) with information_schema queries

## License
Copyright 2016-2017 Vitaliy Fedorchenko and contributors

Distributed under the MIT license

repository: MakaBuka/data

repo_name: MakaBuka/data


text:
# k-card

`k-card` is Vuh's web component for cards.

It acts a general purpose container which can receive any elements it may require as its children.

<!-- Auto Generated Below -->

----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*

repository: jf-gm/vuh-components-test

gha_language: TypeScript

repo_name: jf-gm/vuh-components-test


text:
TiTokenField
============

Titanium Module for NSTokens like interface leveraging JSTokenField viz. Email.app and Messages.app

![screenshot](screenshot.png)

INSTALL THE MODULE
--------------------

1. Run `build.py` which creates your distribution
2. cd to `/Library/Application Support/Titanium`
3. copy this zip file into the folder of your Titanium SDK

REGISTER THE MODULE
---------------------

Register your module with your application by editing `tiapp.xml` and adding your module.
Example:

<modules>
	<module version="0.1">com.dezinezync.tokenfield</module>
</modules>

When you run your project, the compiler will know automatically compile in your module
dependencies and copy appropriate image assets into the application.

USING THE MODULE IN CODE
-------------------------
Include the module in your app, preferrably in the app.js file so you can access it from anywhere in your app.

~~~~
var TiTokenField = require('com.dezinezync.tokenfield');
~~~~

Create an instance of TiTokenField and add it to the current window or a view like so

~~~~
var myWin = Ti.UI.createWindow({…});
var myView = Ti.UI.createView({…});

var tf = TiTokenField.createView({
	top:0,
	height: 40,
	width: Ti.UI.FILL
});

myWin.add(tf);
//or
myView.add(tf); myWin.add(myView);
~~~~

### Parameters
TiTokenField accepts the following parameters

~~~~
top:  //int
left:  //int
right:  //int
bottom: //int

width: //int or Ti defined constants. Default: Full width of the parent
height: //int or Ti defined constants. Default: 30 points

label: //string ("To: " in the above screenshot). Default: empty string

backgroundColor: //string. Default: grey

color: //string (color for the InputField's text). Default: Black
~~~~

###ToDo
- Allow for setting of the Font for the input field from the Ti app
- Allow for setting of the color and Font for the individual tokens

###License
Please refer to the LICENSE file included in the repo for details.

### Feel free to Contribute
Fork it, upgrade or improve it, send a PR this repo's way! It loves you, too!


text:
# 📎 One time file share
Easily generate one time link to share a file to any device with ngrok and qrcode in terminal, once the download is done your link is destroyed.

# 👨💻 How it works?
The program creates a temporary express server with a random available TCP port and creates a ngrok tunnel to expose this port over the internet. Once the file is downloaded the server is destroyed and the tunnel is closed.

# 🐧 Linux Installation
Ngrok dependency requires extra options in Linux

```
sudo npm i -g onetime-file-share --unsafe-perm=true --allow-root
```

# ✅ Windows Installation
```
npm i -g onetime-file-share
```

# 🍏 MacOS Installation

Unfortunately not tested yet
```
npm i -g onetime-file-share
```

# 🚀 Usage
```
fshare <filepath>
````
![image](https://user-images.githubusercontent.com/14078661/80435518-1f21b080-88d3-11ea-8e03-a313f8f2e890.png)

repository: abnerfs/onetime-file-share

repo_name: abnerfs/onetime-file-share


text:
---
title: "<certificate> of <clientCertificate> Element | Microsoft Docs"
ms.custom: ""
ms.date: "03/30/2017"
ms.prod: ".net-framework"
ms.reviewer: ""
ms.suite: ""
ms.technology:
  - "dotnet-clr"
ms.tgt_pltfrm: ""
ms.topic: "article"
ms.assetid: 00297efb-a7f2-4e03-bc2b-943d545610fc
caps.latest.revision: 9
author: "Erikre"
ms.author: "erikre"
manager: "erikre"
---
# <certificate> of <clientCertificate> Element
Specifies an X.509 certificate used to sign and encrypt messages.

 \<system.ServiceModel>
\<behaviors>
\<serviceBehaviors>
\<behavior>
\<serviceCredentials>
\<clientCertificate>
\<certificate>

## Syntax

```

<certificate findValue = "String"
storeLocation = "CurrentUser/LocalMachine"
storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
X509FindType="FindByThumbPrint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialNumber/FindByTimeValid/FindByTimeNotYetValid/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier"
/>
```

## Attributes and Elements
 The following sections describe attributes, child elements, and parent elements

### Attributes

|Attribute|Description|
|---------------|-----------------|
|`findValue`|A string that contains the value to search for in the X.509 certificate store. The type contained in the attribute must satisfy the requirements of the specified X509FindType. The default is an empty string.|
|`storeLocation`|Specifies the location of the X.509 certificate store that the client uses to validate the server’s certificate against. Valid values include the following:

 -   LocalMachine: the certificate store assigned to the local machine.
-   CurrentUser: the certificate store assigned to the current user.

 The default is LocalMachine.|
|`storeName`|Specifies the name of the X.509 certificate store to open. Valid values include the following:

 -   AddressBook: Certificate store for other users.
-   AuthRoot: Certificate store for third-party certification authorities (CAs).
-   CertificationAuthority: Certificate store for intermediate certification authorities (CAs).
-   Disallowed: Certificate store for revoked certificates.
-   My: Certificate store for personal certificates.
-   Root: Certificate store for trusted root certification authorities (CAs).
-   TrustedPeople: Certificate store for directly trusted people and resources.
-   TrustedPublisher: Certificate store for directly trusted publishers.

 The default is My.|
|`X509FindType`|Defines the type of X.509 search to be executed. Valid values include the following:

 -   FindByThumbPrint
-   FindBySubjectName
-   FindBySubjectDistinguishedName
-   FindByIssuerName
-   FindByIssuerDistinguishedName
-   FindBySerialNumber
-   FindByTimeValid
-   FindByTimeNotYetValid
-   FindByTemplateName
-   FindByApplicationPolicy
-   FindByCertificatePolicy
-   FindByExtension
-   FindByKeyUsage
-   FindBySubjectKeyIdentifier

 The type contained in the `findValue` attribute must satisfy the requirements of the specified X509FindType.

 The default value is FindBySubjectDistinguishedName.|

### Child Elements
 None.

### Parent Elements

|Element|Description|
|-------------|-----------------|
|[\<clientCertificate>](../../../../../docs/framework/configure-apps/file-schema/wcf/clientcertificate-of-servicecredentials.md)||

## Remarks
 The `<certificate>` element is used when the service must have the client's certificate in advance to communicate securely with the client. This occurs when using the duplex communication pattern. In the more typical request/response pattern, the client includes its certificate in the request, which the service uses to encrypt and sign its response back to the client. In the duplex communication pattern, however, the service does not have a request from the client and therefore it needs the client's certificate in advance to secure the message to the client. Therefore you must obtain the client's certificate in an out-of-band negotiation, and specify the certificate using this element. For more information about duplex services, see [How to: Create a Duplex Contract](../../../../../docs/framework/wcf/feature-details/how-to-create-a-duplex-contract.md).

## Example
 The following code specifies how to find an appropriate X.509 certificate and a custom validation type in the `<authentication>` element.

```
<serviceBehaviors>
 <behavior name="myServiceBehavior">
  <clientCertificate>
   <certificate
         findValue="www.cohowinery.com"
         storeLocation="CurrentUser"
         storeName="TrustedPeople"
         x509FindType="FindByIssuerName" />
   <authentication customCertificateValidatorType="MyTypes.Coho"
    certificateValidationMode="Custom"
    revocationMode="Offline"
    includeWindowsGroups="false"
    mapClientCertificateToWindowsAccount="true" />
  </clientCertificate>
 </behavior>
</serviceBehaviors>
```

## See Also
 <xref:System.ServiceModel.Security.X509CertificateInitiatorServiceCredential.Certificate%2A>
 <xref:System.ServiceModel.Configuration.X509InitiatorCertificateServiceElement.Certificate%2A>
 <xref:System.ServiceModel.Configuration.X509ClientCertificateCredentialsElement>
 [Security Behaviors](../../../../../docs/framework/wcf/feature-details/security-behaviors-in-wcf.md)
 [How to: Create a Service that Employs a Custom Certificate Validator](../../../../../docs/framework/wcf/extending/how-to-create-a-service-that-employs-a-custom-certificate-validator.md)
 [Working with Certificates](../../../../../docs/framework/wcf/feature-details/working-with-certificates.md)


text:
# Multi-Platform Game Training Kit

|Area|Submitted|Type|
|-|-|-|
Games: 2D Graphics, Games: Content Pipeline, Games: Graphics, Input, Touch & Gestures|12/10/2010|Code Sample
||||

## Sample Overview

This training kit is a set of resources for extending the Honeycomb Rush Lab to better understand and experiment with games in different platforms by using XNA Game Studio 4.0. This lab shows you how simple it is to port a Windows Phone 7 game to both Xbox 360 and Windows, while retaining the original game’s feel and functionality.

> All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).

![](https://github.com/SimonDarksideJ/XNAGameStudio/raw/archive/Images/honeycombrush2.png?raw=true)

Download | Size | Description
---|---|---|
[HoneycombRushTrainingKit_4_0](https://github.com/simondarksidej/XNAGameStudio/tree/archive/Samples/HoneycombRushTrainingKit_4_0) | 59.93MB | Source code and assets for the Honeycomb Rush Training Kit.
[HoneycombRushTrainingKit_4_0.zip](https://github.com/simondarksidej/XNAGameStudioZips/raw/zips/HoneycombRushTrainingKit_4_0.zip) | 59.93MB | Source code and assets for the Honeycomb Rush Training Kit.
||||

license: MS-PL

path: /Articles/Multi-Platform Game Training Kit.md

filename: Multi-Platform Game Training Kit.md


text:
# CHANGELOG.md

## 2.4.2
- Fix an issue in Streams’ Voice ID APIs that may have led to incorrect values being set against the generatedSpeakerID field in the VoiceIdResult segment of Connect Contact Trace Records (CTRs).

## 2.4.1
- This version brings in updates that will provide enhanced monitoring experience to agents and supervisors, allowing to silently monitor multiparty calls, and if needed to barge in the call and take over control, mute agents, or drop them from the call. New APIs introduced with this feature are `isSilentMonitor`, `isBarge`, `isSilentMonitorEnabled`, `isBargeEnabled`, `isUnderSupervision`, `updateMonitorParticipantState`, `getMonitorCapabilities`, `getMonitorStatus`, `isForcedMute`.

## 2.4.0
- Introduce Amazon Connect Step-by-step guides embedding support via `connect.agentApp.initApp`.

## 2.3.0
- Make StreamsJS compatible with strict mode
- Fix an issue that connect.ValueError and connect.StateError don't print error message properly

## 2.2.0
Added functions:
* `contact.getChannelContext` method to get the channel context for the contact. See Documentation.md for more details
* `connect.core.onAuthorizationSuccess`. See Documentation.md for more details
* `connect.core.onAuthorizeRetriesExhausted` and `connect.core.onCTIAuthorizeRetriesExhausted` methods, along with some backoff logic to the retries / page reloads for the CTI and authorize apis. Please see these methods' entries in Documentation.md for more information.

Added support for Task templates APIs.

## 2.1.0
Added functions:
* `contact.isMultiPartyConferenceEnabled` method to determine whether this contact is a softphone call and multiparty conference feature is turned on. See Documentation.md for more details

## 2.0.0
Removed Functions:
* `agent.onContactPending` has been removed. Please use `contact.onPending` instead.

New build system:
* `Make` and `gulp` have been removed and `Webpack` has been added as the new build system.
* Running `npm run release` will continue to produce both `release/connect-streams.js` and `release/connect-streams-min.js` and run tests.
* `npm run build-streams` will now produce the same files without running any tests.
* `npm run test-mocha` will just run tests and relies on the release files.
* Every command that runs a `gulp` script has been removed.
* See the README for more details

Bugs Fixed:
  - `connect.onError` now triggers. Previously, this api did not work at all. Please be aware that, if you have application logic within this function, its behavior has changed. See its entry in documentation.md for more details.
  - `initCCP` will no longer append additional embedded CCPs to the window when called multiple times. Please note that the use-case of initializing multiple CCPs with `initCCP` has never been supported by Streams, and this change has been added to prevent unpredictable behavior arising from such cases.

New Features:
  - 1. `connect.core.onIframeRetriesExhausted`: Streams now performs backoff while attempting to reload the iframed CCP. Previously, it would endlessly retry on each ACK TIMEOUT event (`connect.EventType.ACK_TIMEOUT`). Now, there are six retries, performed with exponential backoff. Once these six retries to load the embedded CCP are exhausted, no more retries will be attempted. You can subscribe a callback via the api: `connect.core.onIframeRetriesExhausted` to understand when the retries are exhausted, and take some action.

## 1.6.0 (2020-12-01)
Features Introduced:
  - A new media channel--tasks--has been added to Connect's offerings, alongside chat and voice. With this release, Streams, in conjunction with [TaskJS](https://github.com/amazon-connect/amazon-connect-taskjs) now supports this feature with relevant apis, etc.
  - VoiceId: You can find relevant apis for using the feature in the src/api.js file.
  - Agent App features: Connect is expanding its agent-app offering with an agent application container called Agent App. Within agent app you can embed CCP UI, Customer Profiles UI, and Wisdom UI.
  - onConnectionOpened and onConnectionClosed websocket manager apis were introduced.


text:
---
layout: post
title: "cs224n: Neural Network"
comments: true
author: "Yi"
header-style: text
mathjax: true
tags:
  - nlp
---

Notes for [Lecture 3 & 4](http://web.stanford.edu/class/cs224n/slides/cs224n-2020-lecture04-neuralnets.pdf).

##  Name Entity Recognition on Word Sequences

Goal: Train softmax classifier to classify a center word by taking
concatenation of word vectors surrounding it in a window.

We construct the sentence vector by concatenating all word vectors into
$\displaystyle X_{window}$  . As the figure below shows, for each class,
we apply a non-linear function  $\displaystyle f_c$  on the second layer to
learn non-linear interactions between the input word vectors, and finally do a
dot product to provide the final prediction  $\displaystyle s_c$  , the score
that the center word is a location. We can add a softmax over the score to get
a probability for each class.
![](/img/in_post/nn-cover.jpg)

When doing gradient descent, we'd like to compute the derivative of
$\displaystyle \frac{\partial \vec s}{\partial W}$  to train the parameter
$\displaystyle W$  . Notice that in logistic regression we only have 1 class,
but here we have  $\displaystyle c$  classes, so the dimension of
$\displaystyle w$  and  $\displaystyle b$  would be changed.

For this task,  $\displaystyle X \in R^{mk}$  is a matrix, where
$\displaystyle k$  is the window size and  $\displaystyle m$  is the word
vector dimension. So  $\displaystyle W \in R^{mk, c}, b \in R^c$  , where
$\displaystyle c$  is the class size.

$\displaystyle \frac{\partial\vec s}{\partial b} = \frac{\partial s}{\partial
a}\frac{\partial a}{\partial z}\frac{\partial z}{\partial
b}=h^Tdiag(f'(z))I=h^T\circ f' (z)$

We may reuse the intermediate steps above in  $\displaystyle \frac{\vec
s}{\partial W}$  .

$\displaystyle \frac{\partial\vec s} {\partial W} = u^T\circ
f'(z)\frac{\partial z}{\partial W} =\delta \frac{\partial z}{\partial W}$

We call  $\displaystyle \delta$  local error signal at z:  $\displaystyle
\frac{\partial s}{\partial z}$  ,  $\displaystyle x$  is local input signal.
Then

$\displaystyle \frac{\partial\vec s}{\partial W} = \delta^Tx^T$  (transpose is
added to let the result is the same matrix size as  $\displaystyle W$  ).

The size of the local error signal has the same dimensionality as the local
input.

##  Back Propagation

![](/img/in_post/v2-c1416c2b15fc9dc9307265125439cb3e_b.jpg)

downstream gradient = upstream gradient * local gradient. The example in the
lecture slides very clearly shows this idea.

For gradients that come from multiple places, we just sum them up.

Tricks to avoid overfitting(since we have so many parameters): regularization.
e.g L2 norm:

$\displaystyle J(\theta) = \frac{1}{N}\sum-
log(L(\theta))+\lambda\sum_k\theta_k^2$


text:
# react-es7

Example of [React](http://facebook.github.io/react/) + [Reflux](https://www.npmjs.com/package/reflux) + [routing](https://github.com/rackt/react-router) + [ES6 with experimental ES7 syntax](https://babeljs.io/docs/usage/experimental/) + [Semantic-UI](http://semantic-ui.com/)

* All JavaScript files are transpiled with [Babel](https://babeljs.io/) library with enabled [experimental ES7 syntax](http://babeljs.io/docs/usage/transformers/#es7-experimental-).
* For using experimental ES7 code in [Jest](http://facebook.github.io/jest/docs/tutorial-react.html) tests
* The workflow and communication between components is built using [Reflux](https://github.com/spoike/refluxjs), a slighty [improved](http://blog.krawaller.se/posts/reflux-refinement/) Flux paradigm.
* Unit testing is provided by [Jest](https://facebook.github.io/jest/).
* Using [Semantic-UI](http://semantic-ui.com/) framework with React components ([react-semantify](http://react-components.com/component/react-semantify)).

If for some reasons you can't or don' want to use Node for file processing, you can use [hipertracker/react-babel](https://github.com/hipertracker/react-babel). It uses only the browser but with AMD. All ES6 files are transpiled only once (during module loading), and cached.

## Install

```
npm install -g broccoli-cli
npm install
```

## Usage

* fast processing in memory:

```
broccoli serve
```

* with additional [LiveReload](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei):

```
broccoli serve --live-reload-port 35729
```

* with watcher and generating files:

```
broccoli-timepiece dist
http-server dist/ -p 4200
```

Open `http://localhost:4200`

* building files for production (minified, mangled and compressed):

```
BROCCOLI_ENV=production broccoli build dist
```

Test:

```
$ npm test
```

Currently just a simple example of using unit tests in React for files using ES6/ES7 syntax.

## Todo

* Add more [prop validation](http://facebook.github.io/react/docs/reusable-components.html) examples
* Add  more unit tests showing [Jest](http://facebook.github.io/jest/) testing ES5/ES7 code.
* Add [Yeoman](http://yeoman.io/) project with options to choose SASS/Less/Stylus and Bootstrap/Semantic-UI.


text:
# Aleurodiscus sajanensis Murashk. ex Pilát, 1931 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Hedwigia, Beibl. 71: 32 (1931)

#### Original name
Aleurodiscus sajanensis Murashk. ex Pilát, 1931

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Russulales/Stereaceae/Aleurodiscus/Aleurodiscus diffissus/ Syn. Aleurodiscus sajanensis/README.md

repo_name: mdoering/backbone


text:
# wpbin.io

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

[http://wpbin.io](http://wpbin.io) is just the coolest Wordpress paste site, you know?

## Development

The project builds on Laravel 7.x

Development and testing can easily be spun up by using SQLite and the built in PHP webserver.

Make sure your `.env` file has `DB_CONNECTION` set to `sqlite`.

Run migrations with `php artisan migrate`, which sets up the database tables for you.

Then start up the artisan server with `php artisan serve`, you now have a functioning local development version.

If you would like to have the WordPress function references included, please use `php artisan scrape:tags` and watch in awe.

Et voila!

### PHP and javaScript

To build the JavaScript and CSS resources start by installing the dependencies with `npm install`.

Once you are done, you can build everything using `npm run build`, you can also start a watcher with `npm run watch`.

repository: aMoniker/wpbin

gha_language: PHP

repo_name: aMoniker/wpbin


text:
![App Brewery Banner](Documentation/AppBreweryBanner.png)

#  Bitcoin Ticker

## Our Goal

The objective of this challenge is to apply the skills you learned in the Clima tutorial and make a Bitcoin price reporter. We are going to revisit how to use Cocoapods, networking calls and JSON parsing. This will be the most advanced challenge you will face to date. We believe in you!

## What you will create

We’re going to make a Bitcoin price ticker. The app will give you the latest Bitcoin prices in all the popular, traded currencies, so you can track how well your Bitcoin investments are doing on the go.

>This is a companion project to The App Brewery's Complete App Developement Bootcamp, check out the full course at [www.appbrewery.co](https://www.appbrewery.co/)

![End Banner](Documentation/readme-end-banner.png)
=======
# bitcoin-tracker
IOS app, Cocoapods, REST, APIs - Build a Bitcoin Price Tracker

Bitcoin price ticker. The app will give you the latest Bitcoin prices in all the popular, traded currencies, so you can track how well your Bitcoin investments are doing on the go.

repository: IamGiel/bitcoin-tracker

repo_name: IamGiel/bitcoin-tracker


text:
# Data-Structures-Algorithms-Assignments
A small collection of Java console programs created for my academic Data Structures and Algorithms Class. Created using NetBeans IDE.

Directory name/Description
- BinaryTree
  - A java program that creates a binary tree out of a string of user input letters. Each letter will be displayed in its own node. The program also display various traversals(PreOrder, PostOrder, InOrder) of the tree.
- Breadth-First-Search
  - A program that performs breadth-first search to finds the minimum spanning tree.
- PriorityQueue
  - This is a java program that demonstrates a priority queue implementation using a heap instead of an array.


text:
Passe-Partout
=============
There are lots of games out there, but you can’t share stuff between them. It would be really cool to be able to use the same toon, with the same characteristics, capabilities, and property, in multiple virtual worlds.

In addition to some pretty graphics and a painless way to transition from one domain to another, there is the more fundamental issue of exactly how your toon, and its possessions, are transferred from one domain to another. Normally, a virtual world is controlled by a single company, which has a central strategy for ensuring that the game is balanced and fun. One problem with transporting stuff between worlds is that a poorly (or maliciously) run domain could grant its visitors ridiculous powers or items.

Passe Partout is a mechanism for transporting stuff between worlds. Its key ideas are:
* Local inventory: inventory is maintained by the user
 * items can be transferred directly between users
 * but items can’t be duplicated!
* Immigration: servers can decide whether to allow each item to be imported, based both on
 * which server originally issued the item (do you trust those guys?)
 * and based on its description (is a 10 foot long sword realistic?)

A related idea is a standardized protocol for describing items, so that they can be screened in immigration, and implemented in the context of a particular virtual world.

The key mechanisms underlying Passe-Partour are crytographic signatures to verify the originating server of an item, and the usage of the bitcoin block chain to make items transferrable but not copyable.

Further details are provided below, after quick start instructions.

TODO
====
* More interesting demos.

QUICK START
===========
There is a demo quizler_bar server set up at shen.timbrel.org, which you can connect by specifying "server_url = https://shen.timbrel.org:8000/" in your .pp_game.cfg (see demo/quizler_bar/quizler_bar_client.py for details).

A server is more complicated because it requires the complete bitcoin blockchain: see the instructions at the top of demo/quizler_bar/quizler_bar_server.py for instructions.

Some other notes:
* You'll need to install bitcoin and sync to the block chain (may take a long time).  Alternatively, set up a test net.
* Fund your bitcoin wallet (0.1 bitcoins is plenty).
* Create a server key, and then upload it to the keyservers if you want other servers to be able to find it:

        $ python
        >>> import pp_keys
        >>> my_server_key = pp_keys.GenerateServerKey('MyServerName')
        >>> my_exported_key = pp_keys.ExportPubKey(my_server_key)
        >>> pp_keys.UploadKey(my_exported_key)

DETAILS
=======

TRANSFERRABLE BUT NOT COPYABLE ITEMS
------------------------------------

How are digital items handled?  In the simplest case, server1 gives an item to player1 by entering it into server1's internal record of player1's inventory.

If player1 wants to transfer an item to player2, server1 is the clearing-house: after verifying the transaction with both players it clears the item from player1's inventory, and adds it to player2's inventory.

These items are valid only for this server. To support exchanging items with other servers, server1 can issue a signed item that can be imported into other servers:
 itemA:{server1_sig(item_desc, player1_pub_key])}.
This item is not (necessarily) stored by server1: it is stored by player1. The
item has been signed so that when player1 declares itemA, any server can verify:
 1) itemA is owned by player1, who presents proof that they own the private key.
 2) itemA is untampered and was signed by a trusted peer server.
Which is sufficient to determine whether to allow player1 to import itemA.

However, player1 may want to trade the item to player2 while connected to a different server (or no server at all). Since the connection to the internal inventories of the servers has been broken, there is no way to verify that player1 doesn't simply keep a copy of the itemA, and continue to present it for import: so there is no uniqueness-preserving method for transferring the item to player2.

To allow uniqueness-preserving distributed transactions, we can use the bitcoin block chain as a common ledger.

An exported item is paired with a special bitcoin transaction that is transferred to player1:
 txE{single output: (fixed_value, player1_bitcoin_address)},
 itemE:{server_sig(item_desc, txE)}.
Note that itemE no longer has the player_id embedded in it: this information is now encoded in txE.  However itemE *does* include the originating bitcoin transaction txE.

To declare an item that has been exported, player1 must present both itemE and a transaction txE to the server. They must verify that they own the private key that backs txE. This is done by signing a message from the server (which includes the server's name and signature, to prevent man-in-the-middle attacts) with the private key that backs player1's bitcoin address. The server will have a list of the public keys of peer servers, and will be able to verify
 1) The output of txE is owned by player1 (verifies they own the private key),
 2) itemE is untampered and was signed by a trusted peer server.
This is sufficient to demonstrate that player1 owns itemE, and that they got it from server1. ServerN can then decide whether to allow the item to be imported.

If the user wishes to transfer the item to another user, they create a bitcoin transaction:
 txN:{in: txE, single output: player2_bitcoin_address}

Note that a chain of these transactions may have multiple inputs (to inject funds for fees, for example), but only *one* output.  This chain of single outputs means that the progenitor transaction (txE) that is part of the signed payload of itemE can only have a single heir.

When player2 declares itemE, the destination server will have to verify the transaction chain all the way back to the progenitor tx (txE) -- although this chain should be fairly short for most items.

WEBS OF TRUST
-------------

People who run servers can establish webs of trust using the standard public key signature methods used by gnupg.

repository: thandal/passe-partout

repo_name: thandal/passe-partout


text:
# livestack

A stand-alone, background stacker for astro images. Will do dark subtraction,
flat calibration, alignment, and stacking of images.

# Quick Start with Docker

First install Docker and docker-compose.

https://docs.docker.com/get-docker/

https://docs.docker.com/compose/install/

```
git clone https://github.com/rickbassham/livestack.git
cd livestack
nano docker-compose.yml
```

Replace `./data/input` with the location your imaging software places new exposures.
DO NOT change the `:/livestack/input` part of the line.
Save and exit.

```
docker-compose build
docker-compose up
```

As images are added to the input folder, they will be stacked, auto stretched,
and converted to png for viewing. The png files will be stored in the output folder.

You can browse the files via the web browser by visiting http://localhost:8080.

# Alpha Software

This is very much alpha software at this point. One Shot Color images are not
supported at all, and will likely break in weird ways.

This should not modify your original files in any way, however.

There are no options to configure, other than the folders used.

# How it works

When fits images are added to the input folder, we queue them up to be processed.
The service will look at the `IMAGETYP` fits header to determine if it is a light,
dark, or flat frame and process it accordingly.

Flat and Dark frames are processed by a simple mean calculation after applying
a guassian blur. Flat frames will have a dark frame subtracted if the service can
find a matching dark frame. Matches are done by comparing the following fits
keywords: `INSTRUME`, `EXPTIME`, `GAIN`, `CCD-TEMP`.

Light frames are dark subtracted (if we can find a matching dark) and flat
calibrated. Flats are matched on the following fits keywords: `INSTRUME`, `FILTER`,
`GAIN`, `CCD-TEMP`. Then the light frames are aligned to an existing stack, if found.
These are matched using the following fits keywords: `INSTRUME`, `FILTER`,
`GAIN`, `CCD-TEMP`, `OBJECT`, `EXPTIME`. Once aligned, they are stacked using a
simple mean algorithm, then a PNG file is created by auto-stretching the midtones
of the image.

The service can be restarted and will remember which files it has processed.

It is recommended to do darks and flats first, so the stack of lights will be of
higher quality.

If a stack is created poorly for some reason, you can remove it from the storage
folder. The list of processed files is stored in the storage folder. If you delete
this list, it the service will forget which files have been processed, and will
reprocess them.

repository: inglis-dl/livestack

repo_name: inglis-dl/livestack