text:
This chapter will teach you how to add Angular 2 to your Blaze application and how to use both platforms at the same time.

We need coexistence of this two platform because we want to update our components step-by-step.

## What it takes?

To achieve coexistence, we need to understand few things:

1. Both Angular 2 and Blaze have a HTML files compiler - which means that we need to find a way to make a difference between the two HTML file types.

2. Angular 2 application usually written in TypeScript, while Blaze application written in ES2016 - so need need to make sure we can run both at the same time.

## How to start?

First, let's solve the HTML issue.

Your Blaze project already uses `blaze-html-templates` package, and it compiles files with `.html` extensions which means that we can't use that extension for Angular 2 HTML files.

Angular 2 has it's own HTML compiler package for Meteor, which is a part of Angular2-Meteor stack - it called `angular2-compilers`, but we can't use it because it also handles `.html` files - and Meteor allow only one compiler for each extensions.

Our solution is this case is to use `angular2-with-blaze-compilers` package, which is similar to the original package - only uses the `.ng2.html` extension instead.

> The compilers package contains compilers for LESS, TypeScript, HTML and templates files.

So let's add the package to our project:

       meteor add angular2-with-blaze-compilers

> Make sure that use Meteor >= 1.3.1 in your project.

If you already have in your project any other package that handles TypeScript or LESS files, please remove those packages by using `meteor remove` command.

#### How to know if it works?

Create a file named `client/angular-test.ng2.html` and put any content you want inside of it - now go to your browser and try to open the following URL:

http://localhost:3000/client/angular-test.html

> Note that we access the file without the `.ng2` in the browser! the `.ng2` is only there for the compiler to understand that this file is Angular 2 HTML template.

#### Adding Angular 2 and Angular2-Meteor

So now our application is capable to use both Angular 2 and Blaze at the same time - we are only missing the actual Angular 2 package.

We will add Angular2-Meteor and Angular 2 core from NPM:

    meteor npm install --save angular2-meteor babel-runtime @angular/core @angular/compiler @angular/common @angular/router @angular/platform-browser @angular/platform-browser-dynamic @angular/forms meteor-rxjs reflect-metadata rxjs zone.js

> This will install Angular2-Meteor, Angular 2 core, Angular 2 router and polyfills that required to run Angular2-Meteor.

In this example, the To-do app already have a dependency for LESS, so we need to remove it because the `angular2-with-blaze-compilers` already compilers them to match Angular 2 stylesheets.

So let's remove it:

    meteor remove less

> That's it! now our app can run both Angular 2 and Blaze and we can start coding!

## How to start?

So now we need to create Angular 2 application in order to begin with the migration.

The first thing that we need to do is to create main file that creates the application, but still have the ability to run the original Blaze application.

This is little bit tricky and our goal here is to wrap the Blaze application with an Angular 2 application.

The next step of this tutorial will cover step-by-step migration tutorial, and you can find there the instructions for creating Angular 2 app.

## Blaze Template inside Angular 2 Components

Angular2-Meteor team also provides a solution for step-by-step migration, so you can create Angular 2 application around your current Blaze application, and load your already exists and implemented code into Angular 2.

In order to use this feature, let's add `angular2-blaze-template` package to the project:

    meteor npm install --save angular2-blaze-template

The usage is simple, you just need to provide the name of the Template and optional context object.

You will see in the next chapters that we will use this in the first steps of the migration.

gha_license_id: NOASSERTION


text:
# History

## Overview

Performing raymarching each frame is expensive. Instead of adding additional
steps to each frame, we can instead try to use previous frames' results to
supplement the current frame's results.

We can consider two main styles of approach. The first is to perform raymarching
at very small step size, but update only one pixel in a group of neighbours each
frame. This approach is taken by the Nubis system, evaluating one pixel in a
group of 4x4 each frame.

The second is to perform raymarching at a more moderate step size, but update
each pixel every frame, relying on the time average to ontain higher-quality
results than the step size alone could achieve. This is the approach taken by
Frostbite, as can be seen in yangrc1234's
[VolumeCloud GitHub repo](https://github.com/yangrc1234/VolumeCloud) --
particularly check out the corresponding notes on the
[implementation details](https://github.com/yangrc1234/VolumeCloud/blob/master/IMPLEMENTATIONDETAIL.md).
This is the approach we will also follow.

## Setup

We will set up an ImageEffect in `CloudHistoryEffect.cs` containing multiple
passes that will perform raymarching for the current frame, combine it with a
historical result, then apply lighting and blend with the scene. Each of these
steps will be a separate pass in the shader, `CloudHistoryEffectShader.shader`.

* Pass 0: Raymarch intensities and average depth. We'll need to save these in a
RenderTexture to be used in the next pass.
* Pass 1: Combine current raymarch with previous history. Using the previous
frame's camera view matrix, we look up from the past frame's history, combine it
with pass 0's result, and write it to this frame's history. We need a
double-buffer to store previous and current frame's history, and we switch between
them every frame.
* Pass 2: Combine the current frame's combined history result with the scene,
applying raymarch lighting using pre-multiplied alpha blending
(see [Lighting](Lighting.md)).

### Raymarch Offset

Of course, if the camera doesn't change frame-to-frame, with reasonable values
of wind speed, pass 0 will simply be performing the same raymarch calculation
frame-to-frame. That is, the raymarch steps will land at the same places, and
our results suffer the safe effects from the corresponding approximation.

Particularly at the edge of the cloud closest to the camera, small raymarch
steps are crucial to correctly sampling the cloud density with enough detail.
Since transmittance there is still large, the closest edges of the clouds will
contribute the most to the total scattering intensity.

By uniformly offsetting the raymarch start position by a different fraction of
the step size each frame, we can ensure that, over time, we evaluate raymarching
at a much finer level of detail over each step. This way, we can average over
raymarch contributions along each step by combining previous intensity values
with the current ones.

We'd like our offset to cover the range [0, 1] uniformly, and to continue to do
so as additional frame pass. A
[low-discrepancy sequence](https://en.wikipedia.org/wiki/Low-discrepancy_sequence)
perfectly fits the bill for this. We implement a simple one-dimensional
[Halton sequence](https://en.wikipedia.org/wiki/Halton_sequence) in
`LowDiscrepancySequence.cs`. Each time we perform the image effect, we get the
next value in the sequence as the raymarch offset.

This ties into the discussion of non-equal step sizes in
[Raymarching](Raymarching.md).

### Render Target Setup

We note that the output of our raymarching contains _five_ values that we will
need to write to RenderTextures in Pass 0. Four of these will be used in
determining the final color, including transmittance and three light intensity
fractions: directional, ambient (top), and ambient (bottom).
The average depth is not used in determining the color, so will only be used in
the input of Pass 1, not its output into one of the history buffers.
Therefore, `RenderTextureFormat.ARGBFloat` can be used to pack the transmittance
and intensity values into one RenderTexture, and `RenderTextureFormat.RFloat`
for the average depth.

We can use the `Graphics.SetRenderTarget` function, specifying a
`RenderTargetSetup` with the two color `RenderBuffer` of the `RenderTexture`s
above. `BlitMRT` in `ImageEffectBase` handles setting up the render targets
and material pass, then drawing the full-screen quadrilateral.

### History Double Buffers

We will have two buffers to store the result of blending with history,
each with the same `RenderTextureFormat.ARGBFloat` format as the raymarch
transmittance and intensity results from Pass 0.
Each frame, in Pass 1's `Graphics.Blit` command, we will use one of these as the
source RenderTexture, and the other as the destination RenderTexture.
We switch their roles every other frame, so that the output of one frame becomes
the historical input for the next frame.

### Vertex Shader

The incoming vertex data requires only position and uv input data:
`float4 vertex : POSITION` and `float2 uv : TEXCOORD0`.
The vertex shader will forward those two values to the fragment shader, as
well as the screen position, `float4 screenPos : TEXCOORD1` using UnityCG's
`ComputeScreenPos`, and the view-space ray xy coordinates at z-distance of 1,
`float2 viewRay : TEXCOORD2`, computed using the results of
GetProjectionExtents decribed in [ImageEffects](../ImageEffects/ImageEffects.md).

Pass 0 does not need the uv values, so they are not forwarded to its fragment
shader.

### Downscaling

We set up two buffers to hold the results of Pass 0, and two history buffers
to hold the input and ouput of Pass 1. In the highest-quality scenario, we will
create these all with the height and width of the screen, so that each pixel
of the final image will map in a 1-to-1 fashion to a pixel from the current
history buffer. In turn, the blending in Pass 1 will map 1-to-1 to the raymarch
results in Pass 0.

However, we may instead downscale _all_ of these textures to half or quarter
size, significantly reducing the number of pixels we need to perform raymarching
on in Pass 0, and also reducing the number of pixels used for blending in Pass 1.
The final pass will write to the screen, looking up from the lower-resolution
history buffer using bilinear interpolation.

In practice, at larger screen resolutions and  for many sets of cloud
configuration parameters, using half-resolution buffers is not noticeably
visually different from full-resolution ones, and saves a significant amount
of execution time.

### Depth

As dicussed in [Raymarching](Raymarching.md), in the normal frame-by-frame case,
raymarching does not need to be performed along a ray that is behind an opaque pixel in the
scene. However, since the history effect may need to look up the history buffer
corresponding to such rays when the camera moves, and since the blend pass also
performs a neighbourhood lookup, we may need to perform raymarching even several
pixels from the edge of opaque objects in the scene.

Instead of sampling the depth, we'll just use a Linear01Depth value of 1 in this shader to ensure that
the raymarch happens regardless of the content of the depth texture. This is a
bit of a simplification, since we could try to identify these relevant edge
pixels to perform raymarching on. However, this starts to blend into areas
belonging to the rendering pipeline as a whole; as discussed in [Tutorial](Tutorial.md),
these areas are out of scope for this project.

## Passes

### 0: Raymarch (Moderate Quality)

First, we calculate the xy screen-space coordinates from the 4D projective
coordinates returned by the vertex shader, which becomes the uv value for
the scene depth texture lookup. We also multiply a point on the view-space ray by
unity_CameraToWorld so we can calculate the world-space direction of the
raymarch.

Next, we compute the raymarch offset. We already discussed varying the offset
uniformly with time in a low-discrepancy manner. We will also wish to do so
spatially, as well. We will offset the radius by a Bayer matrix applied over
groups of 3x3 pixels, using concepts from
[ordered dithering](https://en.wikipedia.org/wiki/Ordered_dithering).
This is needed because we will add a step in Pass 1 that will look up
raymarch values in a 3x3 neighbourhood, and we want to make sure we have a full
distribution of offset fractions over that region, so all samples are not just
from the same depth along the raymarch. Otherwise, neighbouring pixel results
would be independent, and we could rely on the historical blending and uniform
raymarch offset to handle proper depth sampling. By dividing the screen position
by the texel size, we obtain a 2D pixel ID, which is used to determine the index
within the repeating 3x3 Bayer matrix. This offset is added to the uniform
raymarch offset, and brought back into the [0, 1] range.

Finally, we perform raymarching, returning the average depth value as a `float`,
and the transmittance and intensity values as a `float4`, to the two targets
of this pass. Note that we also handle here cases where there will be no
raymarching, (an object in the way, or when the ray does not pass through the atmosphere)
as well as the horizon angle fading discussed in [Raymarching](Raymarching.md).

### 1: Blend Raymarch into History

#### Previous View Lookup

We begin by looking up the two results from the previous pass using the
screen-space uv values, and re-calculate the world-space raymarch direction.
Then, using the average depth raymarch result, we calculate the corresponding
3D world-space position as the representative point along the ray.

Taking this world position
to homogeneous coordinates, multiplying by the previous frame's view-projection
matrix, taking the x-y non-homogeneous coordinates by dividing by w, we get the
uv-space position of that point with respect to the previous frame's camera
matrix. We use
`GL.GetGPUProjectionMatrix(camera.projectionMatrix, false) * camera.worldToCameraMatrix)`
to assign the view-projection matrix to the material in the correct format.

With this uv, we can simply sample from the history buffer to look up the
raymarch transmittance and intensity values from the previous frame along a
roughly equivalent ray. Note that if the camera is only rotating, all rays from
both frames will start at the same position, so this lookup is exact; different
points along the current frame's ray will lie on the same ray with respect to the
previous frame's camera. If the camera is moving, however, lookup up the
previous frame's values from this approximate center of density is needed to
ensure that the lookup is yielding correspondingly similar transmittance and
intensity values.

#### Blending

The final step is to combine the previous frame's final result from the history
buffer, with the current frame's Pass 0 raymarch results, producing the final
sample for this frame that will be stored into the new history buffer.

Let's first consider the case when the ray lookup uv was found within the
[0,1]x[0,1] uv space of the history buffer. In this case, we perform a
frame-by-frame interpolation:
`lerp(history, raymarch, fraction)`, where we choose a small fraction around 0.05.
Let's consider how this interpolation will look like with a sudden change in the
base raymarch value, going from 1 (in the history buffer) to zero
(in subsequent raymarch passes). At time t, in increments of Δt per frame
(around 1/60 of a second),
R(t + Δt) = R(t)(1-f) + 0*f, where R(0) = 1. So
[R(t + Δt) - R(t)]/Δt = -fR(t)/Δt.
This is a simple differential equation: dR(t)/dt = -(f/Δt)R(t), and the solution is
an exponential: R(t) = A exp(-(f/Δt) t), where in this case the constant A = 1 so
that R(0) = 1, the initial value.
In short, this means that new values will be blended to exponentially, with a
half-life of TH = ln(2) Δt / f, around 0.23 s for the values
discussed above. Alternatively, f = ln(2) Δt / TH, and we
can parametrize TH directly.

Now we consider when the ray lookup uv was found outside of [0,1]x[0,1]. We
consider the maximum distance outside of the unit square along either x or y axis.
If this value is larger than the blend fraction, we use it instead. In this way,
we can weigh newly-uncovered pixels at the edges of the screen much more heavily
with the current raymarch results, while still blending with the results of the
history buffer. By using `TextureWrapMode.Clamp`, this lookup can at best
clamp to the edge of the texture, but we can expect some amount of spatial
coherence. In practice, this works well enough to handle camera rotation.

#### Neighbourhood Lookup

While lookup and blending alone may be enough to handle camera rotation, the
case of camera translation may still end up with significantly different
values between the previous frame's lookup and the current raymarch values.
However, these will still be blended with the usual weight, and in these cases
the half-life discussed above will be noticeable. This effect is most obvious
at the edges of clouds.

Just like we did for the case where the previous uv fell outside of the screen,
we wish to weight values towards the current raymarch values more highly in
these cases. To help determine if the previous and current raymarch values are
significantly different, we'll also consider the values in the 3x3 neighbourhood
of pixels of the current frame. If there is little spatial variance, but a
significant difference from last frame, we'll want to trust the current frame's
values more.

From the values in this 3x3 area, we will determine the average and standard
deviation for each of the four raymarch values: the transmittance and three
intensities. We create a four-dimensional bounding box centered at the average
of these values, with a width of 1.5 times the standard deviation. This box
encapsulates roughly the expected spatial range of the values in the
neighbourhood. Note that this 3x3  size is the same as our repeating
Bayer matrix for the raymarch offset, so we can be sure that the depth is sampled
appropriately within each neighbourhood.

Before performing blending, we clamp the previous frame's looked-up value to the
closest point on the bounding box, if it lies outside. This will make the
blending look more temporally consistent when the camera performs translations.

### 2: Apply Lighting, Blend with Scene

In this pass, we look up the scene color and recent history buffer's
transmittance and intensity values. We then look up the raymarch color
from these intensity values, and blend with the scene color based on the
transmittance. Note that we also perform this blending in linear space,
meaning we need to convert from and to Gamma space if that's the color space
our project is using.

license: MIT

repository: TylerDodds/VolumetricCloudsTutorial

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: TylerDodds/VolumetricCloudsTutorial


text:
---
lab:
    title: 'Setup'
---

# Lab: Setup

### Lab scenario

In this lab, you will redeem your Azure pass using the same credentials as your Microsoft 365 tenant.  This will make for a seamless experience when moving between Microsoft 365 and Azure. As part of the setup, you will also enable the audit log capability, in your Microsoft 365 tenant, as it can take some time take effect. Microsoft 365 uses audit logs for user insights and activities identified in policies and analytics insights.

**Estimated Time**: 5-10 minutes

#### Setup part 1 - Redeem Azure Pass
In this setup task, you will redeem your Azure pass using the same credentials as your Microsoft 365 tenant.  This will make for a more seamless experience when moving between Microsoft 365 and Azure.

1. If you have any open browser windows, it is recommended you close all browsers.

1. Right click on the Microsoft Edge icon and and select **New InPrivate window** to open a new In-Private Browser session. Other

1. In the address bar enter **www.microsoftazurepass.com**.

1. Select the **start** button to get started.

    1. In the Sign in window, enter the email<EMAIL_ADDRESS>(where ZZZZZZ is your unique tenant ID provided by your lab hosting provider) then select **Next**.
    1. Enter the admin password which should be provided by your lab hosting provider. Select **Sign in**.  If prompted to stay signed in, select **Yes**.
    1. Select **Confirm Microsoft Account** if the correct email address is listed.
    1. Enter your promo code in the Promo code box and click **Claim Promo Code**.
    1. In the "Your profile" page, leave all the default information, select **I agree to the subscription agreement, offer details, and privacy statement.** then select **Sign up**.
    1. If a survey window open, you choose to close it by selecting the **X** or respond as appropriate and select **Submit**.

1. It may take a few minutes to activate your account.  Once activated you are directed to the Azure portal Home page. A Welcome to Microsoft Azure window opens, select **Maybe later** . You may get a pop-up window "Optimize your cloud workloads with personalized recommendations", select **X** on the top right corner of the window.

1. Leave the browser tab to the Azure portal home page open, you will come back to it in the next demo.

#### Setup part 2 - Enable Microsoft 365 audit log
In this setup task, you will enable the Audit log capability in Microsoft 365.  Although documentation indicates that audit log is turned on by default, most lab tenants do not have this feature enabled and it can take several hours for this to take effect.  It is beneficial to enable this feature, as Microsoft 365 uses audit logs for user insights and activities identified in policies and analytics insights.

1. Open Microsoft Edge. In the address bar enter **admin.microsoft.com**.

1. Sign in with your admin credentials.
    1. In the Sign in window enter<EMAIL_ADDRESS>(where ZZZZZZ is your unique tenant ID provided by your lab hosting provider) then select **Next**.
    1. Enter the admin password which should be provided by your lab hosting provider. Select **Sign in**.
    1. When prompted to stay signed- in, select **Yes**. This takes you to the Microsoft 365 admin center page.

1. From the left navigation pane of the Microsoft 365 admin center, select **Show all**.

1. Under Admin centers, select **Compliance**.  A new browser page opens to the welcome page of the Microsoft 365 compliance center.

1. In the left navigation panel, under solutions, select **Audit**.  Note: the audit functionality is also accessible through the Microsoft 365 Defender home page (previously referred to as the Microsoft 365 security center).

1. Verify that the **Search** tab is selected (underlined).

1. Once you land on the Audit page, wait 2-3 minutes.  If Auditing is NOT enabled, you will see a blue bar on the top of the page that says start recording user and admin activity.  Select **Start recording user and admin activity**.  Once auditing is enabled, the blue bar disappears.  If the blue bar is not present then auditing is already enabled, and no further action is required.  Another way to check if auditing is enabled is through PowerShell, but that is outside the scope of this course.

1. Return to the home page of the Microsoft 365 compliance center by selecting **Home** from the left navigation panel.

#### Review

In this setup you redeemed your Azure pass, using the same credentials as your Microsoft 365 tenant.  You also enabled the audit log capability in Microsoft 365.


text:
# Learning-mixtures-of-prod-dist
My Msc dissertation topic is about learning mixtures of product distributions from sampled data. In this repo I'll add my implementations of current state of the art algorithms that tackle this problem and maybe later my trials to improve them.

Files:
  - main.py: execution file that manages the execution workflow
  - pd.py: functions related to product distributions
  - fm.py: implementation of the Freund Mansour algorithm
  - sfod.py: implementation of the Serveido Feldman O'Donnell algorithm

Dependencies:
	- python3
	- numpy

repository: addja/Learning-mixtures-of-prod-dist

repo_name: addja/Learning-mixtures-of-prod-dist


text:
# Here's a list of suggested Issues or Repos for doing Pull Requests

Language | Link
---------|----------
Documentation / First PR | https://github.com/firstcontributions/first-contributions
PowerShell | https://github.com/Stephanevg/PSHTML/issues/19
First PR | https://github.com/monsij/HelloWorld_Hacktober18/issues/71

path: /2018/Suggested PRs.md

filename: Suggested PRs.md

gha_license_id: MIT


text:
# Pico UI

This repository contains various UI-related plugins for Pico CMS.

## Why use these

Pico CMS is a great, simple CMS and there are a lot of themes and templates available. It is however
still primarily designed for text content sites.

Most themes can provide some sort of neatly designed homepage, that primarily uses the auto menu
(`pages` array generated by Pico).

If you actually maintain a blog-like content site with featured content and want to manually maintain
your featured articles on the homepage, this becomes a challenge -- you have to create manual HTML/CSS
for your featured links.

Worse yet, if you have a moderately-sized site with hundreds of pages, loading the pages array slow
down Pico a lot, and you may have to use something like my [TooManyPages](https://github.com/bigicoin/PicoTooManyPages)
plugin to keep your site running fast, and you won't get the `pages` array populated at all for the
auto-menus on most themes.

# Pico UI: Card

Create a card (with a hyperlink) such as this:

![image](https://cloud.githubusercontent.com/assets/5854176/24847145/fc8b6728-1d73-11e7-9f25-11b93a3ae564.png)

Using code that looks like below in your markdown file:

```
[ui.card href="https://google.com" img="http://i.imgur.com/TkTgq3L.jpg" ratio="16:9"]
[title]Cute Dog[/title]
[text]This page is about this cute dog.[/text]
[/ui.card]
```

## Installation

Installation is simple. Simply drop the `PicoUICard.php` file into the `plugins` directory of your Pico installation.

## Configuration

The plugin will not be enabled by default, so simply add the following line to your
`config/config.php` file to enable it:

```
$config[ 'PicoUICard.enabled' ] = true;
```

**Bootstrap**: Bootstrap is a CSS and JS framework used commonly on many web sites. Pico UI Card relies on
some Bootstrap CSS elements to style and position cards properly.

If your theme already includes Bootstrap, you are good. Default config will not include an extra copy of it.

If you don't, you can enable this setting to load Bootstrap from their official CDN.

```
$config[ 'PicoUICard.loadBootstrap' ] = true;
```

**Card size ratio**: By default, card images are 16:9, meaning that the height is 56.25% of the width. You
can change this default ratio, by assigning a value of `width:height` ratio. Default value is `16:9`.

```
$config[ 'PicoUICard.cardRatio' ] = '4:3';
```

Note that in addition to the default ratio setting, you can also change each individual card's ratio using
the `ratio` attribute in the markdown tag.

**Card size and positioning**: Pico UI Cards are wrapped within a `row` class (Bootstrap), and so each card
has a definition of column size. (See [Bootstrap: Grid System](http://getbootstrap.com/css/#grid))

Use the following config to change it. The default value is: `col-md-4 col-sm-6 col-xs-6`.

```
$config[ 'PicoUICard.cssClass.cardPosition' ] = 'col-md-6';
```

**Title text and description text**: You can define your own CSS classes for the title text and description text.
Typically the use case for this would be customizing font sizes, colors, etc.

```
$config[ 'PicoUICard.cssClass.cardTitle' ] = 'my-title-class';
$config[ 'PicoUICard.cssClass.cardText' ] = 'my-description-class';
```

# Pico UI: Carousel

Create a carousel (with hyperlinked slides) such as this:

![image](https://cloud.githubusercontent.com/assets/5854176/25067283/5ae21d02-21f3-11e7-8fbd-cdbea0038bde.png)

Using code that looks like below in your markdown file:

```
[ui.carousel ratio="2.35:1"]
[slide href="https://google.com" img="http://i.imgur.com/3jRDGza.png"]First Cute Dog[/slide]
[slide href="https://google.com" img="http://i.imgur.com/k6CAga7.png"]Second Cute Dog[/slide]
[slide href="https://google.com" img="http://i.imgur.com/cnSJLRs.png"]Third Cute Dog[/slide]
[/ui.carousel]
```

## Installation

Installation is simple. Simply drop the `PicoUICarousel.php` file into the `plugins` directory of your Pico installation.

## Configuration

The plugin will not be enabled by default, so simply add the following line to your
`config/config.php` file to enable it:

```
$config[ 'PicoUICarousel.enabled' ] = true;
```

**jQuery and Slick**: jQuery and the [Slick jQuery plugin](https://github.com/kenwheeler/slick/) are used in
the Pico UI: Carousel plugin to create carousel displays. Since jQuery is commonly used, if your theme is
already using it, you don't have to load it. Default config will not include an extra copy of it.

As for Slick, if you have downloaded it to your site, you may config it to load locally. Otherwise, the plugin
will automatically load it from the official CDN.

```
$config[ 'PicoUICarousel.loadJquery' ] = true;
$config[ 'PicoUICarousel.jqueryUrl' ] = '//cdn.jsdelivr.net/jquery/3.2.1/jquery.min.js';
$config[ 'PicoUICarousel.slickPath' ] = '//cdn.jsdelivr.net/jquery.slick/1.6.0';
```

**Carousel size ratio**: The size of the carousel will always be full screen width right now. You can however
adjust the width to height ratio of it. The default ratio is 2.35:1, meaning that the height is 46.25% of
the width. You can change this default ratio, by assigning a value of `width:height` ratio.

```
$config[ 'PicoUICarousel.carouselRatio' ] = '16:9';
```

Note that in addition to the default ratio setting, you can also change a carousel's ratio using
the `ratio` attribute in the markdown tag.

**Title text**: You can define your own CSS classes for the title text of a slide. Typically the use case for
this would be customizing font sizes, colors, etc.

```
$config[ 'PicoUICarousel.cssClass.carouselText' ] = 'my-title-class';
```

# Pico UI: Blurb

Create a text blurb (with a hyperlink) along an image such as this, typically used to feature content:

![image](https://cloud.githubusercontent.com/assets/5854176/26037599/8c90361c-38ab-11e7-9465-d7ab5928ff92.png)

Using code that looks like below in your markdown file:

```
[ui.blurb href="https://google.com" img="http://i.imgur.com/BLPXYLZ.png"]
[title]Pancake Chef[/title]
[text]This dog is really good at making pancakes! To see what kind of recipes he uses and what his pancakes look like,
you should totally click into this page to read more about it.
[/text]
[more]Read more...[/more]
[/ui.blurb]
```

## Installation

Installation is simple. Simply drop the `PicoUIBlurb.php` file into the `plugins` directory of your Pico installation.

## Configuration

The plugin will not be enabled by default, so simply add the following line to your
`config/config.php` file to enable it:

```
$config[ 'PicoUIBlurb.enabled' ] = true;
```

**Bootstrap**: Bootstrap is a CSS and JS framework used commonly on many web sites. Pico UI Card relies on
some Bootstrap CSS elements to style and position cards properly.

If your theme already includes Bootstrap, you are good. Default config will not include an extra copy of it.

If you don't, you can enable this setting to load Bootstrap from their official CDN.

```
$config[ 'PicoUIBlurb.loadBootstrap' ] = true;
```

**Title text, description text, more link text**: You can define your own CSS classes for the title text,
description text and "More" link text. Typically the use case for this would be customizing font sizes, colors, etc.

```
$config[ 'PicoUIBlurb.cssClass.blurbTitle' ] = 'my-title-class';
$config[ 'PicoUIBlurb.cssClass.blurbText' ] = 'my-text-class';
$config[ 'PicoUIBlurb.cssClass.blurbMoreLink' ] = 'my-more-link-class';
```

repository: bigicoin/PicoUI

repo_name: bigicoin/PicoUI


text:
# ETSource

[![Build Status](https://quintel.semaphoreci.com/badges/etsource/branches/master.svg)](https://quintel.semaphoreci.com/projects/etsource)

ETSource contains the data used by Quintel applications for modelling energy
transition. The files contained herein are a mixture of human-editable
"documents", source files used to do offline calculations with [Atlas][atlas]
and [Refinery][refinery], and files containing the results of these
calculations for use in [ETEngine][etengine].

You may also wish to view the [Atlas readme][atlas-readme] for information on
loading the ETSource data in a console, importing data from the old InputExcel
output files, or for instructions on exporting data for ETEngine.

## Open Source

ETSource is released under the [MIT License](LICENSE.txt).

The sole exception to this is the **energy balance** in [datasets](datasets).
These Energy Balances come from the [IEA][IEA], that does not allow
redistribution of their data. You may want to purchase this data [with the
IEA](http://wds.iea.org/WDS/Common/Login/login.aspx) and put it in the appropiate
dataset directory to have a fully functioning ETSource for that region. You
will have to adjust and extend the energy balance with the use of
[ETDataset][etdataset].

Please [contact us][contact] when you have questions.

## Setup

Prerequisites:
- rbenv
- ruby
- bundler
- rspec

There's no additional setup required for ETSource. There are however optional
arguments you can set in a `.env` file in the root directory of your local
ETSource project. See the `.env.default` which options are available.

## "Active" Documents

Files with an ".ad" extension are editable through the [Atlas console][console]
and are used by ETEngine to set up the graph structure. These files typically
contain global data which applies to all regions.

If you prefer, ActiveDocument files can be editted in your favourite text
editor. Each document is split into two sections: a comments section where
each line begins with a hash ("#"), a section containing attributes values.

```
# This is the comment section. You can wrap across as many lines as you want,
# but each one should begin with a hash.
#
# Paragraphs are also acceptable.

- use = energetic
- renewability = 1.0

~ demand = EB(something, something)
```

#### Comments Section

The comment section is optional, and should be placed at the top of the
document. When the file is loaded by Atlas, the comment is available as the
`description` attribute.

```ruby
document.description
# => "String containing the file comment"
```

#### Attributes Section

The attributes section is parsed so that each one is available with a native
Ruby datatype. Attributes are specified with one on each line and preceeded
with a dash and space.

```ruby
# - use = energetic
# - renewability = 1.0

document.use           # => "energetic" (String)
document.renewability  # => 1.0 (Float)
```

Values may also be an array of numbers or strings by wrapping each one in
square brackets.

```ruby
# - range = [1, 2.0, 3, 4.5, 9]
# - strs  = [a, b, c]

document.range  # => [1, 2.0, 3, 4.5, 9]
document.strs   # => ['a', 'b', 'c']
```

##### Multi-line Attributes

An attribute value may span multiple lines so long as each line is intended
with spaces:

```
- description =
    Felis catus is your taxonomic nomenclature,
    An endothermic quadruped, carnivorous by nature;
    Your visual, olfactory, and auditory senses
    Contribute to your hunting skills and natural defenses.
```

The leading spaces will be trimmed:

```ruby
# - query =
#     SUM(
#       MAX(1, 2),
#       MAX(3, 4)
#     )

puts document.query

# SUM(
#   MAX(1, 2),
#   MAX(3, 4)
# )
```

##### Hashes and Namespaces

You can specify "namespaced" attributes which are converted to hashes in the
Ruby model:

```ruby
# - efficiency.gas = 0.5
# - efficiency.electricity = 0.6

document.efficiency  # => { gas: 0.5, electricity: 0.6 }

# - one.two = 2
# - one.three.four = 4

document.one # => { two: 2, three: { four: 4 } }
```

##### Dynamic Attributes

All of the attributes described so far are "static" -- they are the same for
every region and do not require any extra processing. However some
attributes, such as the demand of a node, or the share of an edge, may vary
from region-to-region, or depend on external (CSV) sources.

These values are assigned by writing a query which outputs the desired value.

Queries are prefixed with a `~` instead of the usual `-`, and are followed by
the query to be executed:

```ruby
~ demand =
    EB(residential, gas) +
      EB(residential, electricity) +
      EB(residential, infinite_improbability_drive)
```

The values output by queries are used during for Refinery calculations. You
may set the following attributes using a query:

* Node: `demand`.
* Edge: `parent_share`, `child_share`, or `demand`.
* Slot: `share` ("conversion").

Set a slot share by adding an appropriate query in the node document:

```ruby
~ output.coal = CONVERSION(my_node_outputs, coal)
```

##### EB(use, carrier)

The `EB()` function returns the value of a cell from the energy balance data.
This data is stored in a CSV file in "data/energy_blanace". Supply the use
(the name of a row in the CSV) with a carrier (a column name):

```ruby
EB(industry, electricity) # => 140673.72
```

##### AREA(attribute)

Retrieve a single attribute value from the area data with the `AREA()`
function. The area data is stored in "data/datasets/:area/:area.ad".

```ruby
AREA(coast_line) # => 451.0
```

##### SHARE(file_name, attribute)

Files containing share data (application and technology splits) are found at
"data/datasets/:area/shares". Provide the name of the share file, plus the
column name, and you'll get the share value:

```ruby
SHARE(cng, cars) # => 0.5
```

CSV files containing shares can be given whatever name you want, but it should
be consistent across every region, i.e. if you add a "cng.csv" file to
"datasets/nl/shares", then a similar file should be added for the other
regions also.

##### CENTRAL_PRODUCTION(node_key)

Like CHP data, the energy output of central production nodes is specified in
a separate CSV file. This is at "data/datasets/:area/central_producers.csv".
Provide the node key to retrieve the demand:

```ruby
CENTRAL_PRODUCTION(energy_power_solar_csp_solar_radiation) # => 5678.0
```

##### PRIMARY_PRODUCTION(node_key, attribute)

The same as `CENTRAL_PRODUCTION` except that it reads from the CSV file at
"data/dataset/:area/primary_production.csv". It also takes an `attribute`
parameter to identify which column you wish to read.

#### Before Committing...

After editing documents by hand, you should run the Atlas validation to ensure
that you did not introduce any illegal changes:

```
$ cd ~/code/atlas
$ rake validate[../etsource/data]
OK
```

#### Special Attributes

##### Node

You can set a slot share ("conversion") for a node like so:

```
- input.gas = 0.4
- input.oil = 0.6
```

This tells the node that is has two input slots; gas providing 40%, and oil
providing 60% of the demanded energy. Swapping "input" for "output" does the
same for output slots.

A special "elastic" value will tell the node that this slot should fill up
whatever share is required to sum to 1.0:

```
- output.heat = 0.2
- output.electricity = 0.5
- output.loss = elastic
```

This node outputs 20% of its energy has heat, and 50% as electricity. The
elastic slot will therefore take the remaining 30%. A node may not contain
more than one elastic input slot, and one elastic output slot.

Slot share may vary depending on the share of the inputs; this is called
"carrier efficiency", and is often used to model converters whose efficiency
varies depending on the energy source given to them. In this case, you need
to provide the efficiency of the slot if the node were to be given 100% of
each input.

```
- output.electricity.coal = 0.4
- output.electricity.biomass = 0.5
```

This tells ETSource/Atlas that the "electricity" output slot has a share of 0.4
when only coal is given to the node, and a share of 0.5 when only biomass is
given. In reality, your node will likely have a split of inputs; you **must**
provide a share for each input:

```
- input.coal = 0.7
- input.biomass = 0.3
- output.electricity.coal = 0.4
- output.electricity.biomass = 0.5
- output.loss = elastic
```

## CSV Documents

Throughout the ETSource repo are ".csv" files which contain raw data used by
Atlas for creating the processed files for ETEngine. Many are sourced from
third-parties (such as energy-balance data from the IEA), while others are
created by Quintel staff.

## Directory Structure

The ETSource repository is split into many directories, each containing files
serving different purposes. Data is either **global** and affects all regions,
or is **regional** and affects only one area.

#### ./carriers (global)

Contains a document for each type of carrier in the Energy Transition Model.
In each file is global data specifying how the carrier works, such as whether
the energy is infinite in supply.

#### ./datasets (regional)

Inside the datasets directory is a subdirectory for each region. Inside each
of those folders is *regional* data: an ActiveDocument whose name matches the
folder. Each also has a "shares" subdirectory containing CSVs whose values
are used by Atlas to set edge shares.

#### ./edges (global)

ActiveDocuments; one for each edge ("link") between nodes in the graph. Each
filename contains the supplier ("parent" or "output") node, and the consumer
("child" or "input") node, and the name of the carrier in the format:
`consumer-supplier@carrier`.

Edges are typically organised into subdirectories whose names match the sector
of the supplier node. This may change in the future, and presently nothing
will break if you put an edge in the wrong subdirectory.

#### ./gqueries (global)

ActiveDocuments detailing the queries which may be performed on ETEngine by
application such as ETModel and ETFlex. The subdirectories have no
significance except to keep things organised.

#### ./inputs (global)

Documents containing values which may be set on ETEngine by applications like
ETModel. One file per input, and the directories are purely for organisation
and have no significance.

#### ./nodes (global)

Contains documents for nodes. One document per node, organised into
subdirectories whose names indicate the sector to which the node belongs.

#### ./presets (global)

Contains scenarios completed by QI'ers and notable public figures which can be
viewed on ETModel.

[atlas]:        https://github.com/quintel/atlas
[atlas-readme]: https://github.com/quintel/atlas#readme
[refinery]:     https://github.com/quintel/refinery
[etengine]:     https://github.com/quintel/etengine
[etdataset]:    https://github.com/quintel/etdataset
[console]:      https://github.com/quintel/atlas#using-the-atlas-console
[IEA]:          http://www.iea.org
[contact]:      http://quintel.com/contact

repository: quintel/etsource

gha_language: Ruby

repo_name: quintel/etsource


text:
---
parent: 2020-05-04_05-00-00_resources
title: Cardano node cli reference
description: Cardano node cli reference
order: 1
last_updated: 2020-05-01T08:00:00.000Z
---
## CLI Reference

The Cardano command line interface (CLI) provides a collection of tools for key generation, transaction construction, certificate creation, and other important tasks. It is organized in a hierarchy of subcommands, and each level comes with its own built-in documentation of command syntax and options.

This section provides a reference of the core `cardano-cli` commands and their associated sub commands:

*cardano-cli*

The set of top level `cardano-cli` commands include:
* `address`: Payment address commands
* `stake-address`: Stake address commands
* `transaction`: Transaction commands
* `node`: Node operation commands
* `stake-pool`: Stake pool commands
* `query`: Node query commands. This queries the local node whose Unix domain socket is obtained from the CARDANO_NODE_SOCKET-PATH environment variable.
* `block`: block commands
* `system`: system commands
* `genesis`: Genesis block commands
* `governance`: Governance commands
* `text-view`: Commands for dealing with Shelley TextView files. Transactions and addresses are stored on disk such as TextView files.

*cardano-cli address*

The `address` command contains the following sub commands:
* `key-gen`: creates a single address key pair
* `key-hash`: prints the hash of an address to stdout
* `build`: builds a Shelley payment address, with optional delegation to a stake address
* `build-multisig`: builds a Shelley payment multi-sig address.
* `info`: prints details about the address

*cardano-cli stake-address*

The `stake-address` command contains the following sub commands:
* `key-gen`: creates a single address key pair
* `build`: builds a stake address
* `register`: registers a stake address
* `delegate`: delegates from a stake address to a stake pool
* `de-register`: de-registers a stake address
* `registration-certificate`: creates a registration certificate
* `delegation-certificate`: creates a stake address delegation certificate
* `deregistration-certificate`: creates a de-registration certificate

*cardano-cli transaction*

The `transaction` command contains the following sub commands:
* `build-raw`: builds a low-level transaction
* `build`: builds a transaction
* `sign`: signs the transaction
* `witness`: witnesses a transaction
* `sign-witness`: signs and witnesses a transaction
* `check`: checks the transaction
* `submit`: submits the transaction to the local node whose Unix domain socket is obtained from the CARDANO_NODE_SOCKET_PATH environment variable.
* `calculate-min-fee`: calculates the minimum fee for the transaction
* `info`: prints information about the transaction

*cardano-cli node*

The `node` command contains the following sub commands:
* `key-gen`: creates a key pair for a node operator’s offline key and a new certificate issue counter
* `key-gen-KES`: creates a key pair for a node KES operational key
* `key-gen-VRF`: creates a key pair for a node VRF operational key
* `issue-op-cert`: issues a node operational certificate

*cardano-cli stake-pool*

The `stake-pool` command contains the following sub commands:
* `register`: registers a stake pool
* `re-register`: re-registers a stake pool
* `retire`: retires a stake pool
* `registration-certificate`: creates a stake pool registration certificate
* `de-registration-certificate`: creates a stake pool de-registration certificate
* `id`:  builds pool id from the offline key

*cardano-cli query*

The `query` command contains the following sub commands:
* `pool-id`: retrieves the node’s pool ID
* `protocol-parameters`: retrieves the node’s current pool parameters
* `tip`: gets the node’s current tip (slot number, hash, and block number)
* `utxo`: retrieves the node’s current UTxO, filtered by address
* `version`: retrieves the node’s version details
* `status`: retrieves the current status of the node
* `ledger-state`:  dumps the current state of the node
* `stake-address-info`: get the current delegations and reward accounts filtered by stake address.
* `stake-distribution`: get the node's current aggregated stake distribution
* `pool-params`: Queries the pool parameters
* `query stake-snapshot`: Queries the stake snap shot
* `query protocol-state`: Queries the protocol state
* `query ledger-state`: Queries the ledger state

*cardano-cli block*

The `block` command contains the following sub command:
* `info`: retrieves the pool ID that produced a particular block.

*cardano-cli system*

The `system` command contains the following sub commands:
* `start`: starts the system
* `stop`: stops the system

*cardano-cli governance*

The `governance` command contains the following sub commands:
* `create-mir-certificate`: creates an MIR (move instantaneous rewards) certificate
* `create-update-proposal`: creates an update proposal
* `protocol-update`: performs a protocol update
* `cold-keys`: retrieves the cold keys

*cardano-cli genesis*

The `genesis` command contains the following sub commands:
* `key-gen-genesis`: creates a Shelley genesis key pair
* `key-gen-delegate`: creates a Shelley genesis delegate key pair
* `key-gen-utxo`: creates a Shelley genesis UTxO key pair
* `key-hash`: prints the identifier, or hash, of a public key
* `get-ver-key`: derives verification key from a signing key
* `initial-addr`: gets the address for an initial UTxO based on the verification key
* `initial-txin`: gets the transaction ID for an initial UTxO based on the verification key.
* `create`: creates a Shelley genesis file from a genesis template, as well as genesis keys, delegation keys, and spending keys.

*cardano-cli text-view*

The `text-view` command contains the following sub command:
* `decode-cbor`: prints a text view file, as decoded CBOR.

repository: stakingcare/testnets-cardano-org

repo_name: stakingcare/testnets-cardano-org


text:
# Git Prompt
Windows command line prompt for Git.

![Command prompt example](img/screenshot.png)

1. [Problem](#problem)
2. [Solution](#solution)
3. [Installation](#installation)
4. [Modules](#modules)
    * [Dynamic prompt](#1-dynamic-prompt)
    * [Git wrapper](#2-git-wrapper)

---

## Problem
Goal is to have a GIT active branch name always in command prompt.

The problem is that it is not possible to use any variables when you set command line prompt e.g. the following command will set the time in the prompt but it won't be changing dynamically:

```
prompt %time% $P$G
```
Result:
```
9:40:07.23 D:\Projects>
9:40:07.23 D:\Projects>
9:40:07.23 D:\Projects>echo %time%
 9:40:26.88

9:40:07.23 D:\Projects>
```

When batch script line or command is executed it resolves all the variables first and executes the result. It means that the above command is equal to:
```
prompt 9:40:07.23 $P$G
```
Trying to escape % chars won't help here.

## Solution
Script which will be executing always on given command and setting the updated command prompt.

## Installation
To initialize Git Prompt use the following command:
```
git-wrapper.cmd /init
```
You can create a shortcut to cmd.exe and add this command in Target field on "Shortcut" properties tab e.g.:
```
cmd.exe /k "D:\Projects\git-wrapper.cmd /init"
```
## Modules
### 1. Dynamic prompt

Responsible for setting prompt based on given template. This file can be reused for any other purposes where you want to have a dynamic command prompt.

It uses template.txt file where you can define your custom command prompt e.g.
```
%time% %my_dynamic_var% $P$G
```

To initialize it you need to use /init switch with the command after which prompt should be updated. The following will be updating command prompt on every issued "git" command:
```
dynamic-prompt.cmd /init git
```
You can specify custom script (as a second param) which will run instead of the command given as first param. The following will setup dynamic-prompt to run on every "git" command and will execute git-wrapper.cmd instead of original "git" command (all the other arguments following the second one will be passed to the git-wrapper script)
```
dynamic-prompt.cmd /init git D:\Path\git-wrapper.cmd
```
### 2. Git wrapper
This script is responsible for two things:

1. Initialize the Git dynamic prompt
2. Update global variable which stores current branch name

repository: maxwroc/git-prompt

repo_name: maxwroc/git-prompt


text:
peco
======

Simplistic interfacting filtering tool

Description
===========

peco is based on [percol](https://github.com/mooz/percol). The idea is that percol was darn useful, but I wanted a tool that was a single binary.

peco is written in Go, and as of this writing only implements the basic filtering feature (mainly because that's the only thing I use -- you're welcome to send me pull requests to make peco more compatible with percol). I have also been told that peco even works on windows :)

Installation
============

```
go get github.com/lestrrat/peco/cmd/peco/
```

Usage
=====

If you can read Japanese, [here's one cool usage](http://blog.kentarok.org/entry/2014/06/03/135300).

Basically, you can define a simple function to easily move around your source code tree:

```zsh
function peco-src () {
    local selected_dir=$(ghq list --full-path | peco --query "$LBUFFER")
    if [ -n "$selected_dir" ]; then
        BUFFER="cd ${selected_dir}"
        zle accept-line
    fi
    zle clear-screen
}
zle -N peco-src
```

Or to easily navigate godoc for your local stuff:

```zsh
function peco-godoc() {
    local selected_dir=$(ghq list --full-path | peco --query "$LBUFFER")
    if [ -n "$selected_dir" ]; then
        BUFFER="godoc ${selected_dir} | less"
        zle accept-line
    fi
    zle clear-screen
}

zle -N peco-godoc
```

Filtering
=========

After you laungu peco, type somethig in. It will be matched against the
text you fed to peco, and the results will be filtered.

Navigation
==========

Use the left, right, up, and down arrow keys to navigate through all the results

TODO
====

Test it. In doing so, we may change the repo structure

Implement all(?) of the original percol options

Notes
=====

Much code stolen from https://github.com/mattn/gof

repository: syohex/peco

repo_name: syohex/peco


text:
# Agent Communication Network (ACN)

## Installing the agent communication network (ACN) in Kubernetes using helm

**Requirements:** `helm` needs to be installed.

`helm` provides a quick way of installing and updating existing ACN deployments.

**NOTE:** Please use the provided `values.yaml` file only for deploying test networks as it includes private keys.

To deploy a test network do the following steps:

1. Build and upload the ACN node image by running `./build_upload_img.sh`. You have to execute this from this folder.
2. update the image tag (two instances) in the `helm-chart/values.yaml`
3. `cd helm-chart`
   **NOTE: Make sure to be in the `agents-p2p-dht-testnet` namespace before proceeding**
4. If:
   1. this is the first time deploying: run `helm install agents-dht-test .`
   2. you are upgrading an existing installation (see if there is one by `helm ls`): run `helm upgrade agents-dht-test .`

### Simple image update

Run `./build_upload_img.sh` and take note of the image tag.

Replace below `IMAGE_TAG_HERE` with the image tag.

``` bash
kubens agents-p2p-dht-testnet
kubectl set image sts/acn-node-9005 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}
kubectl set image sts/acn-node-9003 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}
kubectl set image sts/acn-node-9004 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}

kubens agents-p2p-dht
kubectl set image sts/acn-node-9002 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}
kubectl set image sts/acn-node-9000 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}
kubectl set image sts/acn-node-9001 acn-node=gcr.io/fetch-ai-colearn/acn_node:{IMAGE_TAG_HERE}
```

## The agent communication network (ACN) Kubernetes deployment script

The `k8s_deploy_acn_node.py` script provides a configurable, reproducible, and verifiable deployment of the ACN node to a Kubernetes cluster.
Configuration of the ACN node, docker image, and Kubernetes is passed through command-line interface. The script will then verify it, generate the
corresponding YAML deployment file and finally deploy it.
The script can also delete a deployment by appending `--delete` to the CLI arguments used to create the deployment.

The generated YAML deployment file includes:

- a `statefulSet` to persist ACN node log file across runs
- a service for restarting the node (pod) in case of failure
- a `DNSEndpoint` to expose public port
- a secret to safely upload the node's private key

The generated YAML deployment file can be saved for future re-deployments by using CLI option `--from-file`.
Options `--from-file` and `--delete` can be combined as quick way to delete a previous deployment from Kubernetes cluster.
Option `--generate-only` can be used to generate the deployment file without submitting it to the cluster.

To reduce the number of CLI arguments to pass, the script offers defaults for docker and Kubernetes configuration
that can be used by setting `--k8s-fetchai-defaults`, `--docker-fetchai-defaults` or `--docker-fetchai-defaults-dev`.

### Usage examples

- deploy a node using CLI options

  ```bash
  python3 scripts/acn/k8s_deploy_acn_node.py --acn-key-file fet_key_test_1.txt --acn-port 9009 --acn-port-delegate 11009 --k8s-fetchai-defaults --docker-fetchai-defaults-dev
  ```

- delete deployment using CLI options

  ```bash
  python3 scripts/acn/k8s_deploy_acn_node.py --acn-key-file fet_key_test_1.txt --acn-port 9009 --acn-port-delegate 11009 --k8s-fetchai-defaults --docker-fetchai-defaults-dev --delete
  ```

- redeploy using the generated deployment file

  ```bash
  python3 scripts/acn/k8s_deploy_acn_node.py --from-file .acn_deployment.yaml
  ```

- delete deployment using the generated deployment file

  ```bash
  python3 scripts/acn/k8s_deploy_acn_node.py  --from-file .acn_deployment.yaml --delete
  ```

repository: fetchai/agents-aea

branch_name: refs/heads/main

gha_language: Python

repo_name: fetchai/agents-aea


text:
See [CONTRIBUTING.md](./CONTRIBUTING.md) for general instructions.

Here are additional instructions for working on the ACL2020 fork.
1. Run the command below check out the private [sitedata_acl2020](https://github.com/acl-org/acl-2020-virtual-conference-sitedata).
    ```bash
    git submodule update --init --recursive
    ```
   * All ACL2020 sitedate are stored in this folder.
2. All images should be saved under [static/images/acl2020](./static/images/acl2020) folder.

## Deploy at AWS with login authentication
TBD


text:
# Tutorial 1: Hello ZED

This tutorial simply shows how to configure and open the ZED, then print its serial number and then close the camera. This is the most basic step and a good start for using the ZED SDK.

## Getting started

- First, download the latest version of the ZED SDK on [stereolabs.com](https://www.stereolabs.com).
- For more information, read the ZED [API documentation](https://www.stereolabs.com/developers/documentation/API/).

### Prerequisites

- Windows 10, Ubuntu LTS, L4T
- [ZED SDK](https://www.stereolabs.com/developers/) and its dependencies ([CUDA](https://developer.nvidia.com/cuda-downloads))
- ZED SDK C API

# Code overview
The ZED API provides low-level access to camera control and configuration. To use the ZED in your application, you will need to create and open a Camera object. The API can be used with two different video inputs: the ZED live video (Live mode) or video files recorded in SVO format with the ZED API (Playback mode).

## Camera Configuration
To configure the camera, create a Camera object and specify your `SL_InitParameters`. Initial parameters let you adjust camera resolution, FPS, depth sensing parameters and more. These parameters can only be set before opening the camera and cannot be changed while the camera is in use.

```c
//Create a ZED camera object
int camera_id = 0;
sl_create_camera(camera_id);

//Set configuration parameters
struct SL_InitParameters init_param;
init_param.camera_fps = 30;
init_param.resolution = SL_RESOLUTION_HD1080;
init_param.input_type = SL_INPUT_TYPE_USB;
init_param.camera_device_id = camera_id;
init_param.camera_image_flip = SL_FLIP_MODE_AUTO;
init_param.camera_disable_self_calib = false;
init_param.enable_image_enhancement = true;
init_param.svo_real_time_mode = true;
init_param.depth_mode = SL_DEPTH_MODE_PERFORMANCE;
init_param.depth_stabilization = true;
init_param.depth_maximum_distance = 40;
init_param.depth_minimum_distance = -1;
init_param.coordinate_unit = SL_UNIT_METER;
init_param.coordinate_system = SL_COORDINATE_SYSTEM_LEFT_HANDED_Y_UP;
init_param.sdk_gpu_id = -1;
init_param.sdk_verbose = false;
init_param.sensors_required = false;
init_param.enable_right_side_measure = false;
```
Once initial configuration is done, open the camera.

```c
# Open the camera
int state = sl_open_camera(camera_id, &init_param, "", "", "", "", "", "");

  if (state != 0) {
  printf("Error Open \n");
      return 1;
  }
```

You can set the following initial parameters:
* Camera configuration parameters, using the `camera_*` entries (resolution, image flip...).
* SDK configuration parameters, using the `sdk_*` entries (verbosity, GPU device used...).
* Depth configuration parameters, using the `depth_*` entries (depth mode, minimum distance...).
* Coordinate frames configuration parameters, using the `coordinate_*` entries (coordinate system, coordinate units...).
* SVO parameters to use Stereolabs video files with the ZED SDK (filename, real-time mode...)

### Getting Camera Information
Camera parameters such as focal length, field of view or stereo calibration can be retrieved for each eye and resolution:

- Focal length: fx, fy.
- Principal points: cx, cy.
- Lens distortion: k1, k2.
- Horizontal and vertical field of view.
- Stereo calibration: rotation and translation between left and right eye.

In this tutorial, we simply retrieve the serial number of the camera:

```c
// Get camera information (serial number)
int sn = sl_get_zed_serial(camera_id);
printf("Hello! This is my serial number: %d\n", sn);
```

In the console window, you should now see the serial number of the camera (also available on a sticker on the ZED USB cable).

<i> Note: </i>`CameraInformation` also contains the firmware version of the ZED, as well as calibration parameters.

To close the camera properly, use zed.close() and exit the program.

```c
# Close the camera
sl_close_camera(camera_id);
  return 0;
```

url: https://raw.githubusercontent.com/Russ76/zed-examples/893aea95c665aa06dc2770095482561c2fe0d301/tutorials/tutorial 1 - hello ZED/c/README.md


text:
# abac-backend

An abstract class implementing [ABAC](https://github.com/vovantics/abac/)'s back-end API.

## Install

    $ npm install abac-backend

## Usage

This module exports an abstract `BackEnd` class that should be extended and implemented. The subclassed back-end can be used in applications that use ABAC middleware for authorization (via ABAC).

#### Subclass BackEnd

Create a new `CustomBackEnd` constructor which inherits from `BackEnd`:

```javascript
var util = require('util'),
    BackEnd = require('abac-backend');

function CustomBackEnd(...) {
  BackEnd.call(this);
}

util.inherits(CustomBackEnd, BackEnd);
```

#### Implementing can()

`can()` is a high order function that calls a `yes()` or `no()` function after executing a Policy's Rules on the Subject (`request`).

```javascript
BackEnd.prototype.can = function(req, action, options) {
  // Can request perform action?
}
```

#### Implementing serialize()

`serialize()` is a high order function that returns a `callback(err, permissions)` function, where permissions is a JavaScript object that maps actions to a boolean value.

```javascript
BackEnd.prototype.serialize = function(req, callback) {
  // Return the permissions for the Subject (`req`).
}
```

#### Implementing set_policy()

`set_policy()` is a function that upserts a policy represented as a key-value pair, where the key is the action and the value is the rule.

```javascript
BackEnd.prototype.set_policy = function(action, rule) {
  // Upsert action and rule.
}
```

## Tests

    $ npm install
    $ npm test

## License

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

Copyright (c) 2014 Stevo <[http://github.com/vovantics/](http://github.com/vovantics/)>

repository: vovantics/abac-backend

repo_name: vovantics/abac-backend


text:
# RomonisedNepali

An node module to convert romonised input to nepali unicode characters.
This node module is based on Romonised Nepali to Unicode converter from [ashesh.com.np](http://www.ashesh.com.np/nepali-unicode.php)

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Support](#support)
- [Contributing](#contributing)

## Installation

```sh
$ npm install -g romonisednepali
```
OR

Manully:

```sh
$ git clone  https://github.com/psuzn/romonisedNepali.git
$ cd romonisedNepali
$ npm install -g
```
## Usage

- Import it into your project
```js
let conveter=requre('romonisednepali');
let converted=converter.comvert("namaskar");
console.log(converted);
//नमस्कार

```
if you passed characters inside {} they won't be converted
```js
let conveter=requre('romonisednepali');
let converted=converter.comvert("namaste {Nepal}");
console.log(converted);
//नमस्ते Nepal

```
It supports all the conversion techniques as written [here](http://www.ashesh.com.np/nepali-unicode.php)

This module adds a executable ```romonisednepali``` on /bin/ (not sure /bin or not)
which can be executed from teminal to run a converter server on port:8058 which receives a post request as
```
{
    data:"namaskar", //characters to be converted
    smartconvert:True //Smart conversion
}
```
And gives the unicode value of the converted characters as
```JSON
#¬2344##¬2350##¬2360##¬2381##¬2340##¬2375#
```

## Support

Please [open an issue](https://github.com/psuzn/romonisedNepali/issues/new) for support.

## Contributing

Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/psuzn/romonisedNepali/compare/).

repository: psuzn/romonisedNepali

repo_name: psuzn/romonisedNepali


text:
# 3commas-postman

A "Plug and Play" postman collection created from the official swagger doc.
The signature is created automatically.

You just need to add your own api key-secret pair as the THREE_COMMAS_API_KEY and THREE_COMMAS_API_SECRET collection variables.

Some requests require write permissions. Which exactly can be found on the official repo:
https://github.com/3commas-io/3commas-official-api-docs


text:
# MyMealApp

It is a mobile Flutter project to help me organize the time bettween my meals.
This will grow as I add more functionality around organizing my meals.

please the see the walk through Video
-[Youtube (Atlanta Dev Talk)] (https://youtu.be/8hm71QNrq-U)

[![Watch the video](https://github.com/e17769/myMealFlutterMobileApp/blob/main/documentation/images/youtubevid.png?raw=true)](https://youtu.be/8hm71QNrq-U)

Here are some screen shots of the application

![Screens](https://github.com/e17769/myMealFlutterMobileApp/blob/main/documentation/images/appv1.gif?raw=true)

![Step 1](https://github.com/e17769/myMealFlutterMobileApp/blob/main/documentation/images/step1.jpg?raw=true)

![Step 2](https://github.com/e17769/myMealFlutterMobileApp/blob/main/documentation/images/step2.jpg?raw=true)

![Step 3](https://github.com/e17769/myMealFlutterMobileApp/blob/main/documentation/images/step3.jpg?raw=true)

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

You will find most of the logic in the [tree/main/lib folder](https://github.com/e17769/myMealFlutterMobileApp/tree/main/lib)
you can create your own new classes `newclass.dart` in that folder, then include it like so `import 'newclass.dart';`

gha_language: Makefile


text:
---
layout: default
title: call
parent: Actions
nav_order: 6
---

<link rel="stylesheet" href="../../../assets/css/custom.css">

# call

The action **call** is used to invoke defined functions.

## Specification

### Arguments

|                 | Type      | Required?| Vars supported? |
|:----------------|:----------|---------:|----------------:|
| **as**          | string    | no       | no              |
| **description** | string    | no       | no              |
| **while**       | boolean   | no       | yes             |
| **when**        | boolean   | no       | yes             |
| **count**       | numeric   | no       | yes             |

**as** ( string \| optional )  The name of the variable used to persist the output of the invoked function.

*Example 1: Basic use of argument*

```hcl
call listPeople{
  as = people
}
```
---
**description** ( string \| optional )  It is used to apply descriptive text to  the action.

*Example 1: Basic use of argument*

```hcl
call createPerson{
  description = "it invokes function createPerson"
}
```
---
**when** ( bool | optional ) It is used to control if the action must be executed.

```hcl
var {
  mustCreatePerson = false
}

call createPerson{
  when = mustCreatePerson
}
```
---
**count** ( number || optional ) It determines the number of times the action is executed. Additionally, the variable **_.index** is increased in each iteration.
The value of _.index starts with 0 and it ends with count-1.

*Example 1: Basic use of the argument*
```hcl
call createPerson{
  with {
    id = "user_${_.index}"
  }
  count = 3
}
// After this statement the value of variable counter will be 2
```

---
**while** ( boolean \| optional )  The action is executed repeatedly as long as the value of this argument is met. Additionally, the variable **_.index** is increased in each iteration. The value of _.index starts with 0 and increase in 1 in each iteration.

*Example 1: Basic use of argument while*
```hcl
call createPerson{
  with {
    id = "user_${_.index}"
  }
  while = _.index<=2
}
```

### Blocks

A function could require arguments. The arguments are provided within a block `with`.

```hcl
call createPerson {
    with {
        firstname = user.firstname
        role = "ADMIN"
    }
}
```

repository: fengpf/orion

repo_name: fengpf/orion


text:
# Peaches 'n' Stink

Peaches 'n' Stink is an experimental Internet forum. Users write posts and nested comments. You can try out the official instance at [peachesnstink.com](https://www.peachesnstink.com)!

## Install

Create a PostgreSQL 11 database and execute all the code in `doc-commit/structure.sql`. This will create all the database tables, triggers, etc. PostgreSQL 11+ is probably fine.

Install Redis. This is only for the session store. Redis versions 2 and 6 worked for us, so version 2+.

Run `npm install` to download all the Node.js dependencies that are listed in `package.json`.

Set the following environment variables:

* `PGHOST`: PostgreSQL host (usually `localhost`)
* `PGUSER`: PostgreSQL username
* `PGDATABASE`: PostgreSQL database name
* `PGPASSWORD`: PostgreSQL password
* `PGPORT`: PostgreSQL port
* `HTTP_PORT`: Port this app will use
* `REDIS_PORT`: Redis port
* `IS_PROD`: This is a redundant production flag (there's already the built-in `NODE_ENV`) that must be set. If `NODE_ENV` is `"production"` then set this flag to `1`, otherwise use `0`.
* `SESSION_NAME`: `express-session` `name`
* `SESSION_SECRET`: `express-session` `secret`
* `NODE_ENV`: built-in node environment flag

On Windows you can use a `.env` and `npm start` to set the environment variables. Here's a sample `.env`:

```
PGHOST=localhost
PGUSER=postgres
PGDATABASE=mydb
PGPASSWORD=123abc
PGPORT=5432
HTTP_PORT=80
REDIS_PORT=6379
IS_PROD=1
SESSION_NAME=mysesh
SESSION_SECRET=wOgw3oQpmbYbie7V
NODE_ENV=production
```

On Linux we used an `ecosystem.config.js` and `pm2 start ecosystem.config.js` to set the environment variables. Here is a sample `ecosystem.config.js`:

```
module.exports = {
    apps : [{
        name: "myappid",
        script: "./app.js",
        env: {
            PGHOST: "localhost",
            PGUSER: "postgres",
            PGDATABASE: "mydb",
            PGPASSWORD: "123abc",
            PGPORT: 5432,
            HTTP_PORT: 80,
            REDIS_PORT: 6379,
            IS_PROD: 1,
            SESSION_NAME: "mysesh",
            SESSION_SECRET: "wOgw3oQpmbYbie7V",
            NODE_ENV: "production",
        }
    }]
}
```

There must exist a user with a `user_id` of `1` and a `username` of `stink`. These two values are currently hardcoded into the application and serve as the default user whitelist. So after an instance of this application is launched, you should immediately sign up as the user `stink`. Also set `is_eyes` to `true` for `stink` in the `tuser` database table.

On the [API page](https://www.peachesnstink.com/api), a post ID and comment ID are used in URLs on the page. If you want these links to work, you must create a post and comment and then set their IDs to match the ones used on the page.

repository: defistar/peaches-n-stink

repo_name: defistar/peaches-n-stink


text:
# Conformal Bayesian Computation

This repository is the official implementation of [Conformal Bayesian Computation](https://arxiv.org/abs/2106.06137).

## Requirements

To install requirements and the `conformal_bayes` package, run the following in the main folder:

```setup
python3 setup.py install
```

If the above does not work, then please run the following instead:

```
pip install .
```

This should install all dependencies needed. We have only tested this on Python 3.7.5, and for reproducibility we have used `jax (0.2.13)` and `jaxlib (0.1.66)`. We recommend creating a new virtualenv/conda environment before installing the package, and using the latest verson of `setuptools` or `pip`.

We have included PyMC3 as a dependency for `conformal_bayes` for convenience, but computing conformal Bayesian intervals only requires [JAX](https://github.com/google/jax). If you pip fails to install PyMC3, please take a look at the installation instructions in the sidebar [here](https://github.com/pymc-devs/pymc3/wiki). If PyMC3 returns errors related to multiprocessing, try seting `chains = 1` in the MCMC scripts (with `_mcmc.py`).

The required datasets are self-contained in this repo. We have provided the [Radon](http://www.stat.columbia.edu/~gelman/arm/examples/radon/) dataset (Gelman and Hill (2006)) and [Parkinsons](https://archive.ics.uci.edu/ml/datasets/parkinsons) dataset (Little et al. (2008)) in the `./data` folder, and other datasets are already available in `sklearn` or are simulated.

## Training

To carry out all experiments in the paper, run this command:

```train
python3 train.py
```
This will run all the MCMC examples and compute all intervals over 50 repetitions by calling functions in `./run_expts`. The functions in this folder are split between MCMC scripts (with `_mcmc.py`) and conformal scripts (with `_conformal.py`).

The posterior samples will be saved in  `./samples` and intervals/coverage/timings will be saved in `./results`.

## Evaluation

To load and print all the coverage/length/timing results, run:

```eval
python3 eval.py
```
This script will load the results in the `./results` folder, and print them in a similar format to the tables in the paper. Note that the evaluation (such as computing coverage/length) is actually computed in the `_conformal.py` functions.

## Pre-trained Models

Note that running MCMC will take a significant amount of time, but we are only able to provide posterior samples from the diabetes example to keep within file size limits. However, we have included the results folder so running the evaluation script will still work without fitting the models.

## Notebooks

We also provide a few Jupyter notebooks for producing the plots, which rely on the `./results` folder.

## References
Gelman, A., & Hill, J. (2006). Data analysis using regression and multilevel/hierarchical models. Cambridge university press.

Little, M., McSharry, P., Hunter, E., Spielman, J., & Ramig, L. (2008). Suitability of dysphonia measurements for telemonitoring of Parkinson’s disease. Nature Precedings, 1-1.


text:
# MetacatUI Documentation
This folder of the MetacatUI repository contains the documentation for MetacatUI. This documentation includes:
- Basic information about MetacatUI
- Installation instructions
- Developer documentation for the MetacatUI application

## Building the documentation website
This directory is also built into a simple HTML website, using Jekyll, that is hosted on Github Pages. You can view the last published version of the Github site here: https://nceas.github.io/metacatui/

To build a local version of the MetacatUI Github pages site, make sure `Bundler` is installed:

  ```
  gem install bundler
  ```

Then serve the Jekyll site from the `docs` directory:

  ```
  bundle exec jekyll serve
  ```

[See the Github Pages documentation for additional help](https://help.github.com/en/enterprise/2.14/user/articles/setting-up-your-github-pages-site-locally-with-jekyll#step-4-build-your-local-jekyll-site)

## Building Developer documentation
MetacatUI uses [JSDoc](https://github.com/jsdoc/jsdoc) comments to provide inline documentation of classes, methods, and variables. A JSDoc documentation generator will collect all those comments and generate HTML webpages for easier reading and navigation.

The MetacatUI git repository already contains these generated HTML pages in the `docs/docs` directory. However, if you have made changes to the MetacatUI code and documentation and want to update the HTML doc pages, you will need to run the JSDoc generator.

To build a fresh version of the MetacatUI developer docs, simply run the `docs/build.sh` script. This script must be run from the root directory of MetacatUI (`datadepot`) or from the first `docs` directory (`datadepot/docs`)

To view the JSDoc documentation, you can navigate to the file in your web browser. E.g. file:///Users/walker/git/datadepot/docs/docs/index.html

Once your changes to the JSDocs are merged into the `master` branch, they will go live on the Github pages site at https://nceas.github.io/metacatui/docs/index.html

## Adding to this site
Feel free to add pages to the MetacatUI docs website by adding markdown files to this `docs` directory. Use subdirectories
as much as possible to keep things organized. Use relative links with `.html` suffixes instead of `.md` so that the links work on the Github Pages site.

## Anything missing?
We maintain a list of questions about MetacatUI that are reviewed and worked into this documentation. If you have a question that was not answered by these docs, or want to make a suggestion for these docs, please add to the list by commenting on [the FAQ Github issue](https://github.com/NCEAS/metacatui/issues/1389)

repository: csjx/metacatui

repo_name: csjx/metacatui


text:
---
layout: layout-sidebar
name: Applications
description: Learn how to successfully create an application with SKY API.
order: 200
published: true
showInNav: true
back_to_top: true
title: Create an Application Tutorial
---

 Create an App with {{ stache.config.product_name_short }}

<bb-alert bb-alert-type="warning">This page has moved to **https://developer.blackbaud.com/skyapi/docs/createapp**. Redirecting in 10 seconds...
</bb-alert>

repository: blackbaud/sky-api-docs

gha_language: JavaScript

repo_name: blackbaud/sky-api-docs


text:
# Jupyter Security Bi-weekly Meeting

## March 21, 2023

| Name               | affiliation| username         |
| -------------------| -----------| -----------------|
| Rick Wagner        | UCSD       | @rpwagner        |
| Matthias Bussonnier| Quansight  | @Carreau         |
| Jason Grout        | Databricks | @jasongrout      |
| Rollin Thomas      | NERSC      | @rcthomas        |

* Maybe use the JupyterCon room during the setup day for SSC/EC meeting.
* Joe Lucas will be driving, but will try to call in
* [TrustedCI Summit and Workshop in October 24-26](https://www.trustedci.org/2023-cybersecurity-summit) at LBNL
    * Recap:
        * Met w/Deputy Director of TrustedCI, Sean Peisert, on possibility to have Jupyter-related events at TrustedCI summit
            * First day is half-day, full day workshop/tutorial type things
            * Then main summit conent, 3 days
            * Then last day has more workshop type things
        * Time is good for for some kind of Jupyter security get-together
            * Suggested plan is something on
            * Reviving the Jupyter security training done at PEARC etc for first day
            * Then Jupyter security workshop on the last day
    * Having a story by the time of JupyterCon would be good
    * Enabling folks coming for Jupyter content maybe also to go to the TrustedCI summit itself
        * Contributions of travel/registration funding from other sources to enable this, e.g. Anaconda
        * Example: Zeek (intrusion detection) + Jupyter conversation, connecting Jupyter + security community
    * Do we have a way for people from either side to participate in the other?
    * Longer term topic, relationship is workshop/tutorials angle:
        * JupyterCon 2024
        * Expanding to 5 days, having workshops and tutorials as part of that?
            * This year it's 3 days because that's what we could get more.
            * Depends on budget outcome of 2023
    * For this JupyterCon (2023):
        * May be possible to have some space/time for talking security/building momentum for the TrustedCI
        * There's an existing tutorial room possibly on Wednesday for a day... could use that?
        * Yes for some structured discussion (more than a BoF, less than a tutorial/workshop)?
            * Have the security training in shape by then?
            * Seems tempting to Rick since he has such positive feedback from the Jupyter community
            * Rick favors Wednesday morning 2.5h
    * => Folks need to respond to the doodle poll (first dates as early as tomorrow or next week)
* An async update about bug bounty:
    * JupyterHub, JupyterLab, and Jupyter Server accepted
    * Jason to send email to those not accepted leting them know
    * Jason to send a scheduling email
* Interaction with TideLift from Matthias
    * What TideLift brings us
    * How money is handled

repository: jupyter/security

repo_name: jupyter/security


text:
# Fancy Booze for Fancy Folks

## Simple application to search for cocktails by spirit and also browse random selections

### https://barton-w.github.io/fancy-booze/

### API - https://www.thecocktaildb.com/api.php

* On load, the app queries the API's random endpoint multiple times via AJAX with async: false.
* Each request returns a random cocktail which is parsed and displayed on the random section of the page.
* The user has the option to search for a specific spirit via a simple form.
* Form submissions are handled via 2 requests to the API:
  1. The filter endpoint returns all cocktail names, images, and ids associated with the specified spirit.
  2. Ids are selected randomly, and a subsequent call is made for each id to the lookup endpoint to retrieve full ingredients and instructions.
* Ingredients and instructions are populated into overlay divs, initially fully-transparent with an opacity transition on hover.

#### Initial Page Wireframe
![](https://i.imgur.com/PgKvRdk.png)

repository: barton-w/fancy-booze

repo_name: barton-w/fancy-booze


text:
---
layout: post
title: The Most Important Principle Of Data/Computer Science
classes: wide
excerpt: "How to avoid the traps?"
image: /images/gigo.jpg
---

Reading some fitness guide, I stumbled upon, to my surprise, the most important principle of computer science: *GIGO*, or *Garbage-In-Garbage-Out*.
The author implied that to have good training results (output), you must make sure that your training methods are good too (input) and vice versa:
poor methods yield poor results. Obvious, right? Yet, it is too tempting to just start mindlessly working out (Nike's infamous "Just do it")
instead of developing a sound strategy in the first place.

Fitness world aside, I then tried to remember any computer science, programming or data science lecture, book or tutorial that I had come across, and, to my astonishment,
this emphatic and beautiful principle was not there to be found. Too obvious! And, we are way too smart, we people working with code/AI/<another-buzzword>,
to be reminded of such, perhaps patronizing, "words of wisdom".

Well, at a risk of merely entertaining you, here is my attempt to stand up for GIGO and let it be a beacon, saving your data ships from crashing into coastal rocks.
As a machine learning engineer, one may be tempted to quickly label a business problem as classification, clustering, regression, computer vision, or other species,
before actually understanding the *real* problem itself. If you work as a consultant, I believe, your responsibility is to make the most of your data skills to increase the company profits.
There are two ways to achieve this goal: increase the revenue and/or decrease the costs. Period. It is way too easy to focus on the former and skip the latter.
For example, one may develop a sophisticated model that requires expensive infrastructure, increasing, perhaps, the turnover, but also, the costs. Meanwhile, a single-CPU solution would suffice.
Therefore, even a seemingly meaningful dataset or approach may become a garbage, if it misses the business goal.
Speaking with a project manager / CTO about the enterprise goals, business model and needs, and keeping this big picture would be the first GIGO beacon.

Then, once the objectives (ideally, including the budget) are well-defined, we may proceed to the next step: defining the data science project itself. That is to say, translating the business needs into the data science lingo (here comes classification, regression, sampling, cleaning, data ingestion). Some helpful steps and questions include:

- Finding bugs in data
- Asking "what does X column really mean"?
- How would you teach the ML task to a kid?
- Is the database structure OK or should we rebuild it?
- What will change in the future? How might the project scale up? What's the expected size of the database?

I might continue this post by laying out the end-to-end generic checklist for most data science projects, but that is not the point.
Instead, I just wanted to suggest that it is primordial to always keep the GIGO beacon on, especially when we get too enthusiastic
about optimizing our favourite model.

Here's an anecdote to sum it all up: my high school maths teacher, in case someone slightly misinterpreted the homework problem, but applied the correct method,
would still give the worst grade, because, as she used to put it: "You solved your *OWN* problem. That's not *MY* problem".

Let the GIGO beacon guide us all.


text:
# Unity tracker

![logo_rage_top-of-the-web](https://cloud.githubusercontent.com/assets/5657407/16461800/9ae669fc-3e2e-11e6-97f4-4e93f2c96dea.jpg)

This code belongs to [RAGE project](http://rageproject.eu/) and sends analytics information to a server; or, if the server is currently unavailable, stores them locally until it becomes available again.

After a game is developed, a common need is to know how the players play, what interactions they follow within the game and how much time they spend in a game session; collectively, these are known as game analytics. Analytics are used to locate gameplay bottlenecks and assess  game effectiveness and learning outcomes, among other tasks.

## Installation
1. Clone the repository in your **Assets** folder inside your Unity project
1. Add the [Tracker MonoBehaviour](https://github.com/e-ucm/unity-tracker/blob/master/Tracker/Tracker.cs) into an empty object in your first scene (the component will be kept across scenes)
	![unitytracker add tracker](https://cloud.githubusercontent.com/assets/5657407/21893124/07974d46-d8da-11e6-9168-e1cb0e7547f1.png)
1. Configure the component parameters
  1. **Flush interval**: time between each flush of the tracker to the server. If this is set to `-1`, it will be necessary to call `T().RequestFlush()` to send traces to the server.
  1. **Storage type**: can be `net`, to send traces to a server, o `local`, to store them locally.
  1. **Trace format**: the format of the traces. Can be `csv`, `json` or `xapi`.
  1. **Host**: If storage type is set to `net`, this should have the host for the analysis server
  1. **Tracking code**: If storage type is set to `net`, this is the [tracking code identifying the game](https://github.com/e-ucm/rage-analytics/wiki/Tracking-code)
  1. **Debug**: Enable to see tracker messages in the Unity console.
1. Send traces

The configuration process is very simple. If a game is exported, a track.txt file has to be created in the root project directory, into an Asset folder.

The [track.txt](https://github.com/e-ucm/QuizDemo/blob/master/Assets/Assets/track.txt) file must be edited changing the `host` and `trackingCode`
with the correct values. Normaly the `host` looks like this `http://localhost:3000/api/proxy/gleaner/collector/` and the `trackingCode` normally looks like [this](https://github.com/e-ucm/rage-analytics/wiki/Tracking-code).

<b>Note</b>: The traces file are saved in `C:/Users/[username]/AppData/LocalLow/[Company Name]/[Product Name]` under the name `traces.csv`

If you are not sure or you don’t know your company and product name, you can check and change it the path using the Unity menu:
`Edit > Project Settings > Player`
![inspector unity](https://cloud.githubusercontent.com/assets/5657407/21893123/07972abe-d8da-11e6-8f79-94903f62dced.png)

## MonoBehaviour Example

```c#
using UnityEngine;
using System.Collections;

public class TraceGeneratorsScript : MonoBehaviour {

	void Start () {
		Tracker.T.accessible.Accessed("Scene1");
		Tracker.T.setScore(0);
	}

	void Update () {
	}
}
```

## Detailed Feature List
1. Configurable flush intervals (via `T().SetFlushInterval()`; use `-1` to entirely avoid auto-flush). If flushing fails, for example due to transient network problems, the tracker will periodically attempt to re-send the data.
1. Different storage types:
	1. `net`: sends data to a trace-server, such as the [rage-analytics Backend](https://github.com/e-ucm/rage-analytics-backend). If set, a hostname should be specified via the `host` property.
	2. `local`, to store them locally for later retrieval. Un-sent traces are always persisted locally before being sent through the net, to support intermittent internet access.
1. Different trace formats:
	2. `csv`: allow processing in MS Excel or other spreadsheets. Also supported by many analytics environments.
	3. `json`: especially intended for programmatic analysis, for instance using python or java/javascript or
	4. `xapi`: an upcoming standard for student activity. Note that, if the tracker's storage type is `net` it is required to use the `xapi` trace format since the [rage-analytics Backend](https://github.com/e-ucm/rage-analytics-backend) expects xAPI Statements. The [xAPI tracking model] (https://github.com/e-ucm/xapi-seriousgames) that the backend expects is composed of [Completables](https://github.com/e-ucm/xapi-seriousgames/blob/master/README.md#1341-completable), [Reachables](https://github.com/e-ucm/xapi-seriousgames/blob/master/README.md#1341-reachable), [Variables](https://github.com/e-ucm/xapi-seriousgames/blob/master/README.md#1342-variables) and [Alternatives](https://github.com/e-ucm/xapi-seriousgames/blob/master/README.md#1343-alternatives).
1. Tracker messages can be displayed in the Unity console by setting the `Debug` property
1. Uses Unity's in-built facilities to handle connections, files and timing.

### User Guide

The tracker requires (if `net` mode is on) the [RAGE Analytics](https://github.com/e-ucm/rage-analytics) infrastructure up and running. Check out the [Quickstart guide](https://github.com/e-ucm/rage-analytics/wiki/Quickstart) and follow the `developer` and `teacher` steps in order to create a game and [setup a class](https://github.com/e-ucm/rage-analytics/wiki/Set-up-a-class). It also requires a:

* **Host**: where the server is at. This value usually looks like `<rage_server_hostmane>/api/proxy/gleaner/collector/`. The [collector](https://github.com/e-ucm/rage-analytics/wiki/Back-end-collector) is an endpoint designed to retrieve traces and send them to the analysis pipeline.
* **Tracking code**: an unique tracking code identifying the game. [This code is created in the frontend](https://github.com/e-ucm/rage-analytics/wiki/Tracking-code), when creating a new game.

The tracker exposes an API designed to collect, analyze and visualize the data. The  API consists on defining a set of **game objects**. A game object represents an element of the game on which players can perform one or several types of interactions. Some examples of player's interactions are:

* start or complete (interaction) a level (game object)
* increase or decrease (interaction) the number of coins (game object)
* select or unlock (interaction) a power-up (game object)

A **gameplay** is the flow of interactions that a player performs over these game objects in a sequential order.

The main typed of game objects supported are:

* [Completable](https://github.com/e-ucm/unity-tracker/blob/master/Tracker/Format/CompletableTracker.cs) - for Game, Session, Level, Quest, Stage, Combat, StoryNode, Race or any other generic Completable. Methods: `Initialized`, `Progressed` and `Completed`.
* [Accessible](https://github.com/e-ucm/unity-tracker/blob/master/Tracker/Format/AccessibleTracker.cs) - for Screen, Area, Zone, Cutscene or any other generic Accessible. Methods: `Accessed` and `Skipped`.
* [Alternative](https://github.com/e-ucm/unity-tracker/blob/master/Tracker/Format/AlternativeTracker.cs) - for Question, Menu, Dialog, Path, Arena or any other generic Alternative. Methods: `Selected` and `Unlocked`.
* [TrackedGameObject](https://github.com/e-ucm/unity-tracker/blob/master/Tracker/Format/GameObjectTracker.cs) for Enemy, Npc, Item or any other generic GameObject. Methods: `Interacted` and `Used`.

##### Completable

Usage example for the tracking of an in-game quest. We decided to use a [Completable](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/CompletableTracker.cs) game object for this use-case as the most suitable option:

```c#

	// Completable
	// Initialized
	Tracker.T.completable.Initialized("MyGameQuestId", Completable.Quest);

	//...

	// Progressed
	Tracker.T.completable.Progressed("MyGameQuestId", Completable.Quest, 0.8);

	//...

	// Progressed
	bool success = true;
	Tracker.T.completable.Completed("MyGameQuestId", Completed, success);

```

##### Accessible

Usage example for the tracking the player's movement through some in-game screens and skipping the `Intro` cutscene:

```c#

	// Accessible
	// The player accessed the 'MainMenu' screen
	Tracker.T.accessible.Accessed("MainMenu", Accessible.Screen);

	//...

	// The player skipped a cutscene
	Tracker.T.accessible.Skipped("Intro", Accessible.Cutscene);

```

##### Alternative

Usage example for the tracking the player's choices during a conversation:

```c#

	// Alternative
	// The player selected the 'Dan' answer for the question 'What's his name?'
	Tracker.T.alternative.Selected("What's his name?", "Dan", Alternative.Question);

	//...

	// The player selected 'OK' for the question 'Do you want it?'
	Tracker.T.alternative.Selected("Do you want to start right now?", "OK", Alternative.Question);

	//...

	// The player unlocked 'Combat Mode' for the menu 'Menues/Start'
	Tracker.T.alternative.Unlocked("Menues/Start", "Combat Mode", Alternative.Menu);

```

##### Tracked Game Object

Usage example for the tracking the player's with a NPC villager and using a health potion (item):

```c#

	// Tracked Game Object
	// The player interacted with a Non Playable Character
	Tracker.T.trackedGameObject.Interacted("NPC/Villager", TrackedGameObject.Npc);

	//...

	// The player used a health potion
	Tracker.T.trackedGameObject.Used("Item/HealthPotion", TrackedGameObject.Item);

```

Note that in order to track other type of user interactions it is required to perform a previous analysis to identify the most suitable game objects ([Completable](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/CompletableTracker.cs), [Accessible](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/AccessibleTracker.cs), [Alternative](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/AlternativeTracker.cs), [TrackedGameObject](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/GameObjectTracker.cs)) for the given case. For instance, in order to track conversations [Alternative](https://github.com/e-ucm/unity-tracker/blob/master/Assets/Format/AlternativeTracker.cs) is the best choice

### Tracker and Collector Flow
If the storage type is `net`, the tracker will try to connect to a `Collector` [endpoint](https://github.com/e-ucm/rage-analytics/wiki/Back-end-collector), exposed by the [rage-analytics Backend](https://github.com/e-ucm/rage-analytics-backend).

More information about the tracker can be found in the [official documentation of rage-analytics] (https://github.com/e-ucm/rage-analytics/wiki/Tracker).

gha_language: C#