text:
# Deep Learning Workshop

![](graphics/workshop_lander.gif)

## Agenda
|   | Session | Approximate Start Time (PST) | Resources |
| - | --------| ---------------------- | --------- |
| 1 | Welcome!| 1:00 | |
| 2 | Setting up your computing environment | 1:05 | |
| 3 | Storytime - the summer project that took 50 years | 1:15 | |
| 4 | Getting image classification results fast with [fastai](https://docs.fast.ai/) | 1:25 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/stephencwelch/dsgo-dl-workshop-summer-2020/blob/master/01-image-classification-with-fastai.ipynb) |
| 5 | Bounding box detection | 1:50 |[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/stephencwelch/dsgo-dl-workshop-summer-2020/blob/master/02-bounding-box-detection.ipynb)|
| 5 | Break | 2:10 | |
| 6 | Semantic segmentation | 2:20 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/stephencwelch/dsgo-dl-workshop-summer-2020/blob/master/03-semantic-segmentation.ipynb)|
| 7 | Deploying models with [docker](https://github.com/moby/moby) and [render](http://render.com) | 2:40 | |
| 8 | Q&A | 3:10 | |
| 10 | (Optional, if time) GANs | | [Big ole notebook](https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020/blob/master/04-generative-adversarial-networks.ipynb) |
| 11 | (Optional, if time) Reflection on studying and working in AI in 2020 | | [pdf](https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020/blob/master/reflection-on-studying-and-working-in-ml.pdf)|

## 1. Welcome!

### 1.1 Goal for Our Time Together
Train and deploy deep learning computer vision models, and have some fun along the way :)

## 2. Setting up your computing environment
Installing the software you need to train deep learning models can be difficult. For the purposes of this workshop, we're offering 3 recommended methods of setting up your computing environment. Your level of experience and access to machines, should help you determine which appraoch is right for you.

| | Option | Pros | Cons | Cost | Instructions |
| - | ------ | ---- | ---- | ---- | ------------ |
| 1 | Google Colab | Virtually no setup required, start coding right away! | GPUs not always available, limited session times, limited RAM | Free! There's also a paid tier at [$10/month](https://colab.research.google.com/signup) | [Colab Setup](https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020#21-setup-google-colab) |
| 2 | Your Own Linux GPU Machine | No recurring cost, complete control over hardware. | High up-front cost, takes time to configure. | $1000+ fixed up front cost | [Linux Setup](https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020#22-setup-on-your-own-gpu-machine-running-linux) |
| 3 | Virtual Machine | Highly configurable & flexible, pay for the performance level you need | Can be difficult to configure, only terminal-based interface | Starts ~$1/hour | [VM Setup](https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020#23-setup-a-virtual-machine) |

### 2.1 Setup Google Colab
Google colab is delightfully easy to setup. All you really need to is a google account. Clicking one of the "Open in Colab" links above should take you directly to that notebook in google colab, ready to run. The only configuration change you'll be required to make is **changing your runtime type**. Simply click the runtime menu dropdown at the top of your notebook, select "change runtime type", and select "GPU" as your hardware accelerator.

### 2.2 Setup on Your Own GPU Machine Running Linux
After doing this for a while, my preferred configuration is training models on my own Linux GPU machine. This can require some up front investment, but if you're going to be training a lot of models, having your own machine really makes your life easier.

2.2.1 Install [Anaconda Python](https://www.anaconda.com/products/individual)

2.2.2 Clone this repository
```
git clone https://github.com/stephencwelch/dsgo-dl-workshop-summer-2020

```

2.2.3 (Optional) Create conda environment
```
conda create -n dsgo-cv python=3.7
conda activate dsgo-cv
```

2.2.4 Install packages
```
cd dsgo-dl-workshop-summer-2020
pip install -r requirements.txt
```

2.2.5 Launch Jupyter
```
jupyter notebook
```

### 2.3 Setup a Virtual Machine
Virtual machines provide a nice highly configurable platform for data science tasks. I recommnend following the [fastai server setup](https://course.fast.ai/start_azure.html) guide for the cloud platform of your choice.

## 3. Storytime - the summer project that took 50 years

### 3.1 The Original Problem
![](graphics/original_mit_crew-01.png)

**Computer Vision** has a very interesting history. It's roots really go all the way back to the beginning of computing and **Artifical Intelligence.** In these early days, it was unknown just how easy or difficult it would be to recreate the function of the human visual system. A great example of this is the 1966 MIT Summer Vision Project. Marvin Minsky and Seymour Papert, co-directors of the MIT AI Labratory, begun the summer with some ambitious goals:

![](graphics/summer_project_abstract-01.png)

Minsky and Papert assigned Gerald Sussman, an MIT undergraduate studunt as project lead, and setup specific goals for the group around recognizing specific objects in images, and seperating these objects from their backgrounds.

![](graphics/summer_project_goals-01.png)

Just how hard is it to acheive the goals Minsky and Papert laid out? How has the field of computer vision advance since that summer? Are these tasks trivial now, 50+ years later? Do we understand how the human visual system works? Just how hard *is* computer vision and how far have we come?

### 3.2 Computer Vision is Hard

Interestingly, comptuer vision  turns out to be significantly harder than people first expected. Part of the challenge here is that vision, like other processes that involve the brain, can be a bit hard to pin down.

What exactly does it mean to see? To have vision?

You’re probably using your own vision system right now to read these words, but if I asked you to break down piece by piece how exactly your brain is processing the light that hits your retina into meaningful information, you would have a really tough time.

The vision researchers Peter Hart and Richard Duda had a really nice way of putting this when they wrote one of the first [computer vision books](https://www.amazon.com/Pattern-Classification-Scene-Analysis-Richard/dp/0471223611):

> "Paradoxically, we are all expert at perception, but none of us knows much about it."

Now, as you may know, it’s taken longer than we thought, but we have made some good progress in computer vision. Today, the computer vision systems we’ve built are even better than humans at certain tasks.

### 3.3 Everything Popular is Wrong

In fact, in today's workshop, **we'll achieve exactly what Minsky and Papert set out to do.** And what I think makes this *really* interesting, is that just 10 years ago, this really would not have been possible. You see, it really took around 50 years to achieve the goals of the MIT summer project.

Now, just becuase it took 50 years to acheive these goals, this does not mean that we should only pay attention to recent breakthroughs. Computer vision has a rich and detailed history that deeply informs that work we see today. One aspect that we would be remiss if we didn't breifly discuss is the tradeoff between **analytical and empirical techniques**.

### Part of an analytical pipeline for recognizing a brick

![](graphics/hough_pipeline_short.gif)

Throughout the history of computer vision (and computation and philosophy), we've seen a natural oscillation and competition between techniques that are grounded in reason (analytical), and techniques that are grounding in observation or data. Today we live in a time that is very much dominated by empricism. Decisions must be data driven. In machine learning and computer vision, we see huge breakthroughs from emprical techniques that learn from data, such as deep learning.

So as we dive into building and training our own deep learning models, just remember that this is only one approach. We've seen huge performance increases from empirical approaches recently, and that's what we'll be spending our time on here.

### 3.4 Our dataset for the day
To solve the original computer vision problem using an emprical appraoch, we're going to need some data. We'll be using a fun little dataset called bbc1k. This dataset was collected in the spirit of the original MIT summer project, and contains 1000 images of bricks, balls, and cylinders against cluttered backgrounds.

![](graphics/bbc1k.gif)

You can download the dataset [here](http://www.welchlabs.io/unccv/deep_learning/bbc_train.zip), or with the download script in the util directory of this repo:

```
python util/get_and_unpack.py -url http://www.welchlabs.io/unccv/deep_learning/bbc_train.zip
```

![](graphics/bbc_sample.jpg)

 BBC-1k dataset includes ~1000 images including classification, bounding box, and segmentation labels. Importantly, each image only contains one brick, ball or cylinder.

### 3.5 Further Reading & Viewing
- [Computer Vision Course at UNCC](https://github.com/unccv/uncc_course_overview)
- [Learning to See](https://www.youtube.com/watch?v=i8D90DkCLhI)
- [Great Book on the History of AI](https://www.amazon.com/Ai-Tumultuous-History-Artificial-Intelligence/dp/0465029973)

## 4-6 Model Training
Instructions for sections 4-6 are contained inside of the image classification, bounding box detection, and semantic segmentation notebooks. You ran quickly run these notebooks in google colab using the links above, or you can run the notebooks on your own machine by launching your own notebook server:

```
cd dsgo-dl-workshop-summer-2020
jupyter notebook
```

## 7. Deploying models with docker and render
Alright, enough training, let's get something into production! We'll be borrowing some deployment code from [fastai](https://course.fast.ai/deployment_render.html), and deploying our model as a web service using docker and [render](https://render.com/).

7.1 On the github website, create a fork of this repository. We'll be directly integrating render with github to pull in the code for deployment.

7.2 (Optional) Clone your forked repository to your machine.

7.3 We'll be deploying the brick/ball/cylinder classifier we trained earlier. You'll need to point your web server at the correct url to downlaod the model you trained. To do this, you'll modify `export_file_url` in `app/server.py`. The application is setup to pull from google drive, so if you ran the classification notebook from google colab, you should be all set. If you ran in a VM or locally, you may need to manuall upload your model weights `.pkl` file to google drive. Once you've done that, you'll need to create a share-able link to the file in the google drive web app, and modify the permissions to allow anyone with the link to view the file. You can then modiry `export_file_url` in `app/server.py`. **Warning** to not completely overwrite `export_file_url` with your copied link. Instead, only replace the id portion with the id from the share-able link. You id should start after file/d/ and end before /view in your link.

7.4 (Optional) If you cloned your repository locally, you can test your web-service locally by running:
```
cd dsgo-dl-workshop-summer-2020
python app/server.py serve
```
and navigating your browser to: `http://<IP_ADDRESS>:5000`. If your app is working correctly, you should see a website like the one shown below. You can upload an image (there's some example images in /graphics), and analyze it!

![](graphics/web-app-screenshot.png)

7.5 (Optional) If you cloned your repository locally, you can also build the docker container that render will use to deploy your aplication. I find that testing docker containers locally can be really helpful to smoke our potentially issues before you get to close to production. If you have docker installed, build the container with `docker build`:

```
cd dsgo-dl-workshop-summer-2020
docker build -t bbc-classifier .
```

Run the container with:
```
docker run --rm -it -p 5000:5000 bbc-classifier
```
Navigating your browser to: `http://<IP_ADDRESS>:5000`, and see if your app is working!

7.6 Deploy on render. Setup a render account (no credit card required). Create a new web service, and point it at your forked repository. Watch the logs as your container builds - so cool! Once your build is complete, point your browser to `https://YOUR_APP_NAME.onrender.com/`. If eveything is working properly, you should have a deep learning inference app ready to go!

![](graphics/render-example.png)


text:
+++
title = "A simple JSON configuration"
slug = "a-json-config"
weight = 1
in_search_index = true
+++

UCG is a pure functional language, with immutable values, and forward type
inference. It can be used to translate it's various datatypes into a number of
common configuration file formats as well as create some environment variables
and command line flags.

One of it's intended use cases is to create json configuration files safely.
Lets imagine a webservice that uses json as it's configuration format. It needs
to know a few things to operate properly.

* The port it should listen on
* The ip address it should listen on
* The database connection information
* The host to check for it's dynamic configuration service (i.e. Consul or Etcd)

The service expects the config file to look something like this

```json
{
    "port": 8888,
    "addr": "<IP_ADDRESS>",
    "db": {
        "host": "mydbhost",
        "port": 3306,
        "database": "myservicedb",
    },
    "config_svc": "https://consul.internal:8080"
}
```

To get started we need to create file config.ucg that to hold our services
configuration.

```sh
touch config.ucg
```

Then we create our configuration starting with a UCG tuple.

```
let conf = {
    port = 8888,
    addr = "<IP_ADDRESS>",
};
```

This is our first UCG statement. Statements in UCG start with an optional
keyword, in this case `let` and are terminated by a semicolon (`;`).

`let` introduces a named binding, in this case, a tuple. Inside the tuple we
have two keys: `port` and `addr`. Quoting a key is optional in UCG if the key
is a single word with all word characters or `_` and no spaces. If you need
dashes or spaces you can quote the key. The first key `port` is a number,
specifically an integer. the second `addr` is a string.

Now we need to add our database and dynamic configuration service values to our
tuple.

```
let db_confs = import "db/mysql/hosts.ucg";
let consul_hosts = import "services/consul/hosts.ucg".host_pool;

let conf = {
    port = 8888,
    addr = "<IP_ADDRESS>",
    db = {
        host = db_confs.host_pool.addr,
        port = db_confs.host_pool.port,
        database = "myservicedb",
    },
    config_svc = consul_hosts.url,
};
```

There are a couple new items here. The first is the UCG import expression.
Import expressions start with the keyword `import` and are followed by a string
specifying the relative or absolute path to a UCG file. Relative import paths
are relative to the file they appear in or if not there then relative the path
specified in the `UCG_IMPORT_PATH` variable. When you import a file all of it's
named bindings are exposed as a UCG tuple. We select specific values from the
`services/consul/hosts.ucg` file as part of the import statement using dot
selectors.

This file assumes that the `db/mysql/hosts.ucg` import contains a named binding
called `host_pool` that is a tuple with an `addr` field and a `port` field. It
also assumes the `services/consul/hosts.ucg` has a host_pool named binding with
a url field.

Imports allow us to share our configuration values for shared services among
all of the configurations for their consumers regardless of the format they
expect.

Let's create those two files now.

```sh
mkdir -p db/mysql/
mkdir -p services/consul
touch db/mysql/hosts.ucg
touch db/services/consul/hosts.ucg
```

In the `db/mysql/hosts.ucg` file add the following.

```
let host_pool = {
    addr = "mysql-pool.internal,
    port = 3306,
};
```

In the `services/consul/hosts.ucg` file add the following.

```
let make_pool = func (addr, port) => {
    addr = addr,
    port = port,
    url = "https://@:@" % (addr, port),
};

let host_pool = make_pool("consul.internal", 8080);
```

Our `services/consul/hosts.ucg` file is a little more interesting that our
previous files. We introduce UCG functions as well as format strings. A UCG
function starts with the `func` keyword a set of argments the fatcomma (`=>`)
and a valid UCG expression. Functions can close over their environment and they
can reference the variables defined in the argument in the expression. This one
constructs a tuple for us.

The function also uses a format string to construct our URL for the consul
service. Format strings start with a template string followed by the `%`
character. They are then followed by a parenthesized list with the items to
substitute in the string.

Format strings also have an alternate form that you can read about in the
reference.

We have now constructed our config format but we don't have a json file yet.
For that we need an `out` statement. Back in our `config.ucg` file add the
following statement at the bottom: `out json conf;`.

```
let db_confs = import "db/mysql/hosts.ucg";
let consul_hosts = import "services/consul/hosts.ucg".host_pool;

let conf = {
    port = 8888,
    addr = "<IP_ADDRESS>",
    db = {
        host = db_confs.host_pool.addr,
        port = db_confs.host_pool.port,
        database = "myservicedb",
    },
    config_svc = consul_hosts.url,
};

out json conf;
```

The out statement converts the UCG intermediate representation into the desired
output format. Each output format has a defined translation and in some cases
expected rules that the value should satisfy. Any errors in the translation
will result in a compile error and no output will be generated. In this case we
specify the `json` compile target and the `conf` value we generated.

Running the following will generate a `config.json` file that looks like our
example above.

```sh
ucg build config.ucg
```

repository: zaphar/ucg

branch_name: refs/heads/master

extension: md

gha_language: Rust

license_type: permissive

repo_name: zaphar/ucg


text:
---
title: How to calculate the distance between two locations using JavaScript
date: '2021-09-25'
categories: ["html", "javascript"]
---

The most popular way of calculating the distance between two points on a
sphere is using the Haversine equation.
If you have the coordinates (that is; longitude and latitude) of the the starting and
destination locations, you can use this equation to calculate it.
Here's how to do calculate the distance in kilometers between two locations using
JavaScript and the geolocation API.

By default, coordinates (gotten using the Geolocation API) are given in degrees.
We need them in radians for the formula. Here's our conversion function:

```js
// Convert from degrees to radians
function degreesToRadians(degrees) {
  var radians = (degrees * Math.PI)/180;
  return radians;
}
```

Here's the function that does the distance calculation using coordinates (longitudes and latitudes).

```js
// Function takes two objects, that contain coordinates to a starting and destination location.
function calcDistance (startingCoords, destinationCoords){
  let startingLat = degreesToRadians(startCoords.latitude);
  let startingLong = degreesToRadians(startCoords.longitude);
  let destinationLat = degreesToRadians(destCoords.latitude);
  let destinationLong = degreesToRadians(destCoords.longitude);

  // Radius of the Earth in kilometers
  let radius = 6571;

  // Haversine equation
  let distanceInKilometers = Math.acos(Math.sin(startingLat) * Math.sin(destinationLat) +
  Math.cos(startingLat) * Math.cos(destinationLat) *
  Math.cos(startingLong - destinationLong)) * radius;
}
  return distanceInKilometers;
}
```

Now, you can the call `calcDistance` function and pass it any two coordinates.
For example:

```js
let sCoords = {
latitude: 58.39343;
longitude: -259.2627;
}

let dCoords = {
latitude: 43.8394;
longitude: -129.3984;
}
let dist = calcDistance(sCoords, dCoords)
```

license: MIT


text:
---
title: Customize a ContainerShape
page_title: Customize a ContainerShape
description: Check our "Customize a ContainerShape" documentation article for the RadDiagram {{ site.framework_name }} control.
slug: raddiagram-howto-customize-containers
tags: customize,a,containershape
published: True
position: 8
---

# Customize a ContainerShape

This tutorial describes how to customize the default look and feel of the RadDiagramContainerShape.

## Edit the Header

In order to customize the content of the header part of the __RadDiagramContainerShape__, you can use the __Content__ property. For instance, if you wish to display an icon in the header you can define the following layout:

#### __XAML__
{{region raddiagram-howto-customize-containers-0}}
    <telerik:RadDiagram>
        <telerik:RadDiagramContainerShape Width="264" Position="120,120">
            <telerik:RadDiagramContainerShape.Content>
                <Grid Height="Auto">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="0"
                            Width="25"
                            Height="25"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Source="TelerikIcon.png" />
                    <TextBlock Grid.Column="1"
                                Margin="10,0,0,0"
                                VerticalAlignment="Center"
                                FontSize="13"
                                FontWeight="Bold"
                                Text="Container" />
                </Grid>
            </telerik:RadDiagramContainerShape.Content>
            <telerik:RadDiagramShape Content="Shape 1"
                                        Geometry="{telerik:CommonShape ShapeType=TriangleShape}"
                                        Position="260,300" />
            <telerik:RadDiagramShape Content="Shape 2"
                                        Geometry="{telerik:CommonShape ShapeType=OctagonShape}"
                                        Position="140,260" />
            <telerik:RadDiagramShape Content="Shape 3"
                                        Geometry="{telerik:CommonShape ShapeType=RectangleShape}"
                                        Position="260,160" />
        </telerik:RadDiagramContainerShape>
    </telerik:RadDiagram>
{{endregion}}

![Rad Diagram How To Customize Containers Content](images/RadDiagram_HowTo_Customize_ContainersContent.png)

## Edit the ControlTemplate

You can further customize the appearance of the __RadDiagramContainerShape__ by editing its default style and template.

In Expression Blend, add a __RadDiagram__ control and a __RadDiagramContainerShape__ onto it (accessible via the *Assets* panel).

Select the container shape and in the *'Objects and Timeline'* panel right-click the object or use the dropdown as shown in the picture below. Select *'Edit template > Edit a copy'*, this will create a copy of the default template which you can customize.

![Rad Diagram How To Customize Containers](images/RadDiagram_HowTo_Customize_Containers.png)

>tip If you choose to define the style in Application, it would be available for the entire application. This allows you to define a style only once and then reuse it where needed.

After clicking 'OK', Expression Blend will generate the default style of the __RadDiagramContainerShape__ control in the __Resources__ section of your UserControl/application. The properties available for the style will be loaded in the *'Properties'* pane and you will be able to modify their default values.

{% if site.site_name == 'Silverlight' %}
If you go to the *'Resources'* pane, you will see an editable list of resources generated together with the style and used by it. In this list you will find the brushes, styles and templates needed to change the visual appearance of the __RadDiagramContainerShape__. Their names indicate to which part of the __RadDiagramContainerShape__'s appearance they are assigned.
{% endif %}

If you want to change the __ControlTemplate__ elements of the __RadDiagramContainerShape__ select the style in the *'Objects and Timeline'* pane, right-click on it and choose *Edit Template -> Edit Current*. In the same pane the element parts for the __RadDiagramContainerShape__'s template will get loaded.

>important Please note that at the moment Expression Blend seems not to extract well the default template as it can't extract the __ItemsSource__ applied on the __ConnectorsControl__ within the template. This is why you'll have to manually add it <Telerik_Windows_Controls_Diagrams_Primitives:ConnectorsControl ItemsSource="{TemplateBinding Connectors}" .../>

The final definition of the __ConnectorsControl__ should look like this:

#### __XAML__
{{region raddiagram-howto-customize-containers-1}}
    <Telerik_Windows_Controls_Diagrams_Primitives:ConnectorsControl x:Name="ConnectorsControl"
                                                                Grid.RowSpan="2"
                                                                ItemContainerStyle="{TemplateBinding ConnectorStyle}"
                                                                ItemsSource="{TemplateBinding Connectors}"
                                                                Visibility="Collapsed" />
{{endregion}}

The various things which apply to __ControlTemplates__ in general and customization of __RadDiagram__ shapes in particular apply to the __RadDiagramContainerShape__ as well. This means that you can modify the __ControlTemplate__ elements definitions to better fit your requirements.

For example, let's change the default __Background__ color of the container in the style we extracted:

#### __XAML__
{{region raddiagram-howto-customize-containers-2}}
    <Style x:Key="RadDiagramContainerShapeStyle" TargetType="{x:Type telerik:RadDiagramContainerShape}">
		<Setter Property="Background" Value="#FFE4C4"/>
		...
    </Style>
{{endregion}}

![Rad Diagram How To Customize Containers Background](images/RadDiagram_HowTo_Customize_ContainersBackground.png)

## See Also
 * [ContainerShapes]({%slug raddiagram-features-container-shapes%})
 * [Shapes]({%slug raddiagrams-features-shapes%})
 * [Customize Appearance]({%slug raddiagram-styling-appearance%})

repository: telerik/xaml-docs

gha_language: JavaScript

gha_license_id: NOASSERTION

repo_name: telerik/xaml-docs


text:
# Accessify

Accessify is a control interface for Spotify on Windows, designed to be accessible for screen reader users.  Until Spotify release an alternative to libspotify, it will use the standard Spotify Windows client for the actual playback of content.

## Features

### Search

High priority:

- Search for tracks, artists, albums and playlists.
- Play results continuously when one is selected for playback.
- Show the first 50 results by default, and fetch more as the user scrols down the list.

Medium priority:

- Cache results to speed up repeated searches.
- Store a history of previously performed searches and autocomplete as the user types.
- Opt to display saved albums/tracks at the top of search results.

Low priority:

- Give weights to autocomplete suggestions based on previous search frequency.
- Browse previous search history.
- Specify advanced search criteria in a dialog instead of using Spotify search modifiers e.g. artist and year directly.

Other ideas:

- Show frequently/recently played content first in results lists.
- Use croud-sourced data to provide search suggestions via an API.

### Playlist Management

Note: These features should be designed in line with how the Spotify playlists system works and is presented in their official apps.  Specifically:

- A playlist cannot be deleted or restored, only followed or unfollowed.
- The impression of playlist deletion in Spotify's own apps is achieved by unfollowing a playlist.
- When showing the list of a user's playlists within an official Spotify app, only followed ones are shown.

High priority:

- Create new playlists, with the option to make them public or private.
- List the playlists owned and followed by a user.
- Delete or rename user-owned playlists.
- Fetch and browse all tracks in a playlist.
- Remove tracks from a user-owned playlist.

Medium priority:

- Follow and unfollow other users' playlists.
- Filter or sort the tracks in a playlist.
- Reorder the tracks in user-owned playlists.
- Sort playlists into folders.
- Show a list of deleted playlists with the option to restore them (playlist recycle bin).

Low priority:

- Add labels to playlists e.g. instrumental, folk, exercise, shower.
- Set the public/collaborative flags and description for user-owned playlists.
- Replace tracks in a user-owned playlist.
- View previous snapshots for a playlist.

Other ideas:

- Copy/paste between playlists and other lists of content in the application (e.g. copy a search result onto a playlist) and cut/paste within the same playlist to reorder tracks.
- Create our own API for collaborating on a playlist as Spotify currently don't provide one.

### User Library

High priority:

- Save tracks and albums.
- List all saved tracks and albums.
- Remove saved tracks and albums.

Medium priority:

- Sort and filter saved tracks and albums.
- Browse a list of saved artists, made up of the artists for currently saved tracks and albums plus any artists the user follows.
- Browse a list of the user's recently played tracks.

Low priority:

- Browse a separate list of artists that the user follows.
- Follow/unfollow artists.
- Browse a list of the user's top artists or tracks.

### Browse

- Featured playlists.
- New releases.
- Categories and playlists for each category.

### Playback Control

High priority:

- Play/pause, previous/next track, seek backwards/forwards, volume up/down.
- Add tracks, albums and playlists to the playback queue.
- Copy the Spotify URI for the currently playing track to the clipboard.
- Transfer playback to an alternative Spotify Connect device (Premium users only).
- Start playback of a given URI, handling both the standard URI format and HTTP/HTTPS links (open.spotify.com/play.spotify.com/etc).

Medium priority:

- Jump to time in currently playing track.
- Provide a Windows URI handler to play URIs from the Run dialog, web pages etc, intercepting Spotify's default handling.

Low priority:

- Browse and modify the current playback queue.
- Copy the Spotify URI for the currently playing track to the clipboard including current playback position.

Other ideas:

- Shuffle and repeat.  Lots of details to be worked out, it might be best to wait until we have native playback capability to implement them.

### Radio and Recommendations

High priority:

- Access user library, recommendations and mix stations from Last.fm (login required).
- Access recommendations for Spotify tracks, albums or artists using default recommendations API parameters.

Medium priority:

- Access similar artists and tag radio streams from Last.fm.
- Substitute certain tracks in Last.fm for user-preferred versions.

- Create a custom recommendations request, setting parameters such as key, tempo, liveness etc.

Other ideas:

- Create a user-friendly UI for obtaining recommendations, which offers check-boxes, dropdowns and the like instead of presenting raw values for the parameters.

### Content Management

- Bookmark favourite searches, tracks, artists, albums and playlists for quick access.
- Add labels to tracks, albums, artists and playlists e.g. classical, folk, exercise, shower, instrumental etc.
- Save labelled content to playlists so they can be accessed from other Spotify devices and apps.
- Filter content views such as saved tracks based on labels.
- Tag local media files using metadata obtained from Spotify.

### Application User Experience

High priority:

- Automatically update to new stable and beta releases.
- Control playback using global hotkeys.
- Minimise Accessify to the System Tray.

Medium priority:

- Customise the global and local hotkeys assigned to actions.
- Submit bug reports and log files from within the application.

Low priority:

- Submit bug reports and log files even if the application cannot fully start.
- File new feature requests and vote on those suggested by other users.
- Run the application as an installed or portable copy.

repository: jscholes/accessify-prototype

repo_name: jscholes/accessify-prototype


text:
# repro-material-issue

Reproduction repository for https://github.com/mui-org/material-ui/issues/17418

1. Install dependencies with `yarn install` and start the app with `yarn start`
2. Go to http://localhost:8080 and notice 1) the warning in the JS console, 2) the button is not red
3. Switch to the `astorije/sort-of-fix` branch where the dependencies were updated to latest, restart the app, and see the red button

repository: astorije/repro-material-issue

gha_language: TypeScript

gha_license_id: MIT

repo_name: astorije/repro-material-issue


text:
---
pageClass: rule-details
sidebarDepth: 0
title: vue/valid-v-is
description: enforce valid `v-is` directives
since: v7.0.0
---
# vue/valid-v-is

> enforce valid `v-is` directives

- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.

This rule checks whether every `v-is` directive is valid.

## :book: Rule Details

This rule reports `v-is` directives in the following cases:

- The directive has that argument. E.g. `<div v-is:aaa="foo"></div>`
- The directive has that modifier. E.g. `<div v-is.bbb="foo"></div>`
- The directive does not have that attribute value. E.g. `<div v-is></div>`
- The directive is on Vue-components. E.g. `<MyComponent v-is="foo"></MyComponent>`

<eslint-code-block :rules="{'vue/valid-v-is': ['error']}">

```vue
<template>
  <!-- ✓ GOOD -->
  <tr v-is="'blog-post-row'"></tr>
  <tr v-is="foo"></tr>

  <!-- ✗ BAD -->
  <tr v-is:a="foo"></tr>
  <tr v-is.m="foo"></tr>
  <tr v-is></tr>
  <tr v-is=""></tr>
  <MyComponent v-is="foo" />
</template>
```

</eslint-code-block>

::: warning Note
This rule does not check syntax errors in directives because it's checked by [vue/no-parsing-error] rule.
:::

## :wrench: Options

Nothing.

## :couple: Related Rules

- [vue/no-deprecated-v-is]
- [vue/no-parsing-error]

[vue/no-deprecated-v-is]: ./no-deprecated-v-is.md
[vue/no-parsing-error]: ./no-parsing-error.md

## :books: Further Reading

- [API - v-is (Recent)](https://github.com/vuejs/docs/blob/8b4f11a4e94d01c7f1c91a60ceaa5b89d6b6de9f/src/api/built-in-directives.md#v-is-)
- [API - v-is (Old)](https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)

## :rocket: Version

This rule was introduced in eslint-plugin-vue v7.0.0

## :mag: Implementation

- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/valid-v-is.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/valid-v-is.js)

repository: vuejs/eslint-plugin-vue

repo_name: vuejs/eslint-plugin-vue


text:
# POT.PMM Template (Project Of Things-Product Manifacturing Management Template)

[POT.PMM](https://zildot.com/frameworks/pot/pmm) is dedicated to PMM projects

# Packages

### Getting Started

### Contributing

### Examples

### Future Goals

to be useful in the world!

### Pot V1

repository: saids/POT

repo_name: saids/POT


text:
# falling-frog-2650
Web application that allow to search twitch.tv streams by name

Instructions:

1. For running application you should download the "test" folder and open "index.html" file on browser, like google chrome, firefox, safari;
2. When file is opened, just type a search you want and click on "Search";
3. After search, the results appear below and it's possible to navigate to next/previous pages. By clicking on one result, the stream opens on overlay;
4. At each 10 seconds the info of stream (viewers, views, followers) are updated;
5. For close the stream and return to the list of results, just click on "X" at the top right corner of page.


text:
# PTA Overview

## Table of Contents

1. [Summary](README.md)
1. [The Need](the_need.md)
1. [Architecture](architecture.md)
1. [Applications](applications.md)
1. [Benefits](benefits.md)
1. [Initial Setup](initial_setup.md)
1. __[Building Blocks](building_blocks.md)__
1. [Create Your Hosts](create_your_hosts.md)

## Building Blocks

The Terraform Modules and the Ansible Roles is really where the magic happens.

---

### Terraform Modules

Here is a list of the different available Terraform modules for use with PTA. There's really only a couple
variants - 1) Linux or Windows, 2) Datastore or Datastore Cluster, and 3) Second Disk or Not.

With the latest release of Terraform I believe these Modules can be combined down into just one,
but I haven't taken the time to figure out how to do it yet.

1. [vsphere-vm-linux-datastore](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-linux-datastore)

1. [vsphere-vm-linux-datastore-cluster](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-linux-datastore-cluster)

1. [vsphere-vm-linux-datastore-second-disk](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-linux-datastore-second-disk)

1. [vsphere-vm-linux-datastore-cluster-second-disk-drsoverride](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-linux-datastore-cluster-second-disk-drsoverride)

1. [vsphere-vm-windows-datastore](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-windows-datastore)

1. [vsphere-vm-windows-datastore-cluster](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-windows-datastore-cluster)

1. [vsphere-vm-windows-datastore-second-disk](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-windows-datastore-second-disk)

1. [vsphere-vm-windows-datastore-cluster-second-disk-drsoverride](https://github.com/Forcepoint/fp-pta-terraform-vsphere-vm-windows-datastore-cluster-second-disk-drsoverride)

#### Notes

1. For your applications that need a secondary disk, you should take special care to plan for how
much space you'll need. You can always add a bigger disk and copy files over, but that's painful.

I suggest that for Artifactory, your _second_disk_size_ be 3000 (GB) at least. For Jenkins and Gitlab, I have found
that the default of 500 GB is more than enough.

---

### Ansible Roles

Here is a comprehensive list of all the available Ansible roles for PTA.

A role ending with `-win` is exclusively for use on Windows. Of the roles that do not end in `-win`,
they may support only CentOS (EX: docker-host), or only Windows (EX: prtg), or even both (EX: general-config).
You'll need to investigate the role's tasks and determine if there's a portion for Windows.
A `-win` role is only created when the CentOS version of the role would require changes to the
variables for it to work with Windows. For example, the backup-local role uses cron for scheduling,
but the Windows version uses the Task Scheduler, and they require different information to run.

1. [backup-local](https://github.com/Forcepoint/fp-pta-ansible-backup-local)

1. [backup-local-win](https://github.com/Forcepoint/fp-pta-ansible-backup-local-win)

1. [change-sshd-port](https://github.com/Forcepoint/fp-pta-ansible-change-sshd-port)

1. [docker-artifactory](https://github.com/Forcepoint/fp-pta-ansible-docker-artifactory)

1. [docker-gitlab](https://github.com/Forcepoint/fp-pta-ansible-docker-gitlab)

1. [docker-host](https://github.com/Forcepoint/fp-pta-ansible-docker-host)

1. [docker-jenkins](https://github.com/Forcepoint/fp-pta-ansible-docker-jenkins)

1. [docker-selenium-grid-hub](https://github.com/Forcepoint/fp-pta-ansible-docker-selenium-grid-hub)

1. [docker-selenium-grid-node-chrome](https://github.com/Forcepoint/fp-pta-ansible-docker-selenium-grid-node-chrome)

1. [extra-disk](https://github.com/Forcepoint/fp-pta-ansible-extra-disk)

1. [extra-disk-win](https://github.com/Forcepoint/fp-pta-ansible-extra-disk-win)

1. [general-config](https://github.com/Forcepoint/fp-pta-ansible-general-config)

1. [gnome](https://github.com/Forcepoint/fp-pta-ansible-gnome)

1. [jenkins-node-jnlp](https://github.com/Forcepoint/fp-pta-ansible-jenkins-node-jnlp)

1. [jenkins-node-jnlp-win](https://github.com/Forcepoint/fp-pta-ansible-jenkins-node-jnlp-win)

1. [jenkins-node-ssh](https://github.com/Forcepoint/fp-pta-ansible-jenkins-node-ssh)

1. [jfrog-cli](https://github.com/Forcepoint/fp-pta-ansible-jfrog-cli)

1. [mount](https://github.com/Forcepoint/fp-pta-ansible-mount)

1. [ntp](https://github.com/Forcepoint/fp-pta-ansible-ntp)

1. [packer](https://github.com/Forcepoint/fp-pta-ansible-packer)

1. [prtg](https://github.com/Forcepoint/fp-pta-ansible-prtg)

1. [terraform](https://github.com/Forcepoint/fp-pta-ansible-terraform)

1. [virtualbox](https://github.com/Forcepoint/fp-pta-ansible-virtualbox)

1. [vmware-workstation](https://github.com/Forcepoint/fp-pta-ansible-vmware-workstation)

##### ...continue to the next topic [Create Your Hosts](create_your_hosts.md).

_Send feedback and comments to [jeremy.cornett<EMAIL_ADDRESS>Forcepoint 2020, BSD-3-Clause_

repository: Forcepoint/fp-pta-overview

repo_name: Forcepoint/fp-pta-overview


text:
# Neat

Neat is a framework for in-code declarative Unity UI 💻 (using uGUI)

Currently v1.0 is available and v2.0 is totally WIP

## Installation

As shown in [Git URLs Unity manual](https://docs.unity3d.com/Manual/upm-git.html)


text:
##Info

This is to be a part of the maybe to be runner.
This can also be ran itself.

#Get started

##Installation:

```console
Make sure you have bash installed.
You can't run stubs for which you do not have the needed dependencies installed on your computer.
```
usage:
```console
$ bash run <language> <stub> <conf> [certs] [curpath] [stubname]
```
example:
* language = python3
* stub = ../run.py
* conf = badssl
* certs = ../certs
* curpath = ../simplerunner
* stubname = python3-urllib

##Example usage:

against badssl (run the code on your computer and you will see the colorcoded version)
* Green/Blue = Good
* Red = Bad
* White = Middle/OK?
* Others = Can't say (but not bad, either good or middle)

```console
$ bash run python3 '../trytls/stubs/python3-urllib/run.py' 'conf/const/badssl_https_conf' | sort
python3_1  | [python3-urllib][SUCCESS] VERIFY FAILURE: wrong host [wrong.host.badssl.com]
python3_1  | [python3-urllib][SUCCESS] VERIFY FAILURE: edellroot [edellroot.badssl.com]

...
```

agains trytls backend
```console
$ bash run python3 '../trytls/stubs/python3-urllib/run.py' '../trytls/backends/trytls/tmp/conf' ../trytls/backends/trytls/tmp/certs
...
```

repository: timattil/trytls

repo_name: timattil/trytls


text:
---
layout: default
---

# 1996-01-24 - Re: IPSEC == end of firewalls

## Header Data

From: Frank Willoughby<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: c5f5279cd8c7204948aaa31efb29f7587a092bc8cb80afd894922905c7d8045e

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-01-24 14:29:44 UTC

Raw Date: Wed, 24 Jan 1996 22:29:44 +0800

## Raw message

```
{% raw  %}From: Frank Willoughby<EMAIL_ADDRESS>Date: Wed, 24 Jan 1996 22:29:44 +0800
To<EMAIL_ADDRESS>Subject: Re: IPSEC == end of firewalls
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

While IP level security & authentication will go a long way to help
prevent abuses and reduce unauthorized accesses, I doubt if it will
provide enough protection by itself.  While I would love to be proven
wrong, I believe firewalls are here to stay (at least for the next
year or two).  A couple of reasons why:

o Node Spoofing will probably still be possible
o The connections will probably also be subject to man-in-the-middle attacks
   (Never underestimate the creativity of people who want to compromise your
   networks)
o Authentication by itself will *not* provide adequate protection against
   many abuses
o End-to-end encryption by itself won't completely solve the problems either
   (however, it *does* go a long way to prevent man-in-the-middle attacks
o While IP security & authentication helps to secure the pipe between the
   two systems which want to communicate with each other, it does not provide
   any security about the applications running over the pipe.

   (ie - if you and I have a secure pipe between your system and mine & you
have
   a worm running loose on your network, the only thing the secure pipe will do
   is ensure that other systems (not in the pipe) won't be damaged as the worm
   propagates out of your network into mine).

   Also.  Which version of sendmail are we up to now?

As far as the future of firewalls goes, I would probably guess that the
functionality of most firewalls would eventually be an add-on application
option for Operating Systems and that eventually it will be a standard
part of every Operating System.  Until then, we have to punt & keep using
firewalls.

I suspect even when firewalls are embedded in the O/S, that some type of
firewall will still be needed to quasi-isolate a company's network from
the Internet (and establish them as one entity) and to contain potential
networking problems which arise when someone configures their system with
the wrong IP address (or other type of problem).

IMHO, the first company to include a firewall as a standard part of their
Operating Systems has a real good shot at increasing their market share.
Perhaps the O/S vendors are paying attention to this list & will implement
this (would be nice).  8^)  Of course, it would also help, if their systems
were delivered secure - out-of-the-box and we didn't have to spend so much
time continually locking them down & keeping up with the latest CERT Advisories.
8^)  8^)

Best Regards,

Frank
Fortified Networks Inc. - Management & Information Security Consulting
Phone:<PHONE_NUMBER>   - http://www.fortified.com/fortified/

<standard disclaimer>
The opinions expressed above are of the author and may not
necessarily be representative of Fortified Networks Inc.

{% endraw %}
```

## Thread

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

+ Return to "[Ben <adept@minerva.cis.yale.edu>](/authors/ben_adept_at_minerva_cis_yale_edu_)"
+ Return to "[David Mazieres <dm@amsterdam.lcs.mit.edu>](/authors/david_mazieres_dm_at_amsterdam_lcs_mit_edu_)"
+ Return to "[Frank Willoughby <frankw@in.net>](/authors/frank_willoughby_frankw_at_in_net_)"
+ Return to "["Perry E. Metzger" <perry@piermont.com>](/authors/perry_e_metzger_perry_at_piermont_com_)"

+ 1996-01-24 (Wed, 24 Jan 1996 22:29:44 +0800) - Re: IPSEC == end of firewalls - _Frank Willoughby<EMAIL_ADDRESS>  + 1996-01-23 (Wed, 24 Jan 1996 00:12:52 +0800) - [Re: IPSEC == end of firewalls](/archive/1996/01/6b6e71e529c5438263b9cec09f80da01d4ea38edc90266f5b70e45d472b645d1) - _"Perry E. Metzger"<EMAIL_ADDRESS>  + 1996-01-23 (Wed, 24 Jan 1996 01:33:49 +0800) - [Re: IPSEC == end of firewalls](/archive/1996/01/3872ce390c02f511fd01f89ce6a542bc52750936106d8c0cbdd2372c4892bb8b) - _Ben<EMAIL_ADDRESS>  + 1996-01-23 (Wed, 24 Jan 1996 05:35:28 +0800) - [Re: IPSEC == end of firewalls](/archive/1996/01/3907378e9238dc49f09bea7f9a8980830a0b054bf94ef37bc29f0c802186b76a) - _David Mazieres<EMAIL_ADDRESS>


text:
# Collection of projects Working on various data sets

### Table of Contents
1. [AirBnB_realty](#AirBnB)
2. [Recommendation Engine with IBM ](#IBM)
3. [Licensing, Authors, and Acknowledgements](#licensing)

## Earning estimation on a AirBnB Listing

This project answers the questions on annual earning benefits to a listing owner within Boston City.
The working section is available [here](https://github.com/rindhane/DataMusings/tree/master/AirBnB_realty)

## Recommendation Engine on IBM DataSets

This project shows how to create a user based collaborative recommdantion mechanism. It uses the data of annonymized users interaction details with articles pertaining to data science community.
The working section is available [here](https://github.com/rindhane/DataMusings/tree/master/IBM_recommendations)

## Licensing, Authors, Acknowledgements

This repository is licensed under the MIT License - see the [LICENSE.md](https://github.com/rindhane/DataMusings/blob/master/LICENSE.md) file for details

------------------------------------
***End***

repository: rindhane/DataMusings

repo_name: rindhane/DataMusings


text:
# Get A Private Key From AtomicDEX

This guide will teach you how to find a coin's private key in AtomicDEX.

### Please Note

A private key is used to spend the coins in its address. Do not share it with anyone.

### Instructions

1. Open AtomicDEX-Desktop.

2. Login to your wallet.

3. Enable the coin you'd like the private key for.

4. Go to `Settings`.

5. Go to `Security`.

6. Click on `Show` next to View seed and private keys.

7. Enter your password.

8. Click on the `Copy` button for the private key you'd like.

repository: SpaceWorksCo/guides

gha_language: HTML

repo_name: SpaceWorksCo/guides


text:
---
title: Haskell Yesod Web Application in Docker
date: "2020-06-27T18:38:00.000Z"
tags:
  - webdev
  - haskell
  - functional-programming
  - docker
---

[Yesod](https://www.yesodweb.com/) is one of the [web frameworks available for Haskell](https://wiki.haskell.org/Web/Frameworks).
It seems to be the easiest one out of the multiple choices available to get started with.

### Prerequisites
1. Docker
1. [Haskell Stack](http://haskellstack.org/) version 2.3.1

You can find all yesod stack templates available from the [github repository](https://github.com/yesodweb/stack-templates).
At the time of writing, the available stack yesod templates are:
1. yesodweb/minimal
1. yesodweb/mongo
1. yesodweb/mysql
1. yesodweb/postgres
1. yesodweb/simple
1. yesodweb/sqlite

We will use the minimal yesod template:
```
stack new my-project yesodweb/minimal
```
It scaffolds the following files...
```
.
|____.dir-locals.el
|____stack.yaml
|____app
| |____Main.hs
|____my-project.cabal
|____README.md
|____.gitignore
|____package.yaml
|____routes
|____src
| |____Application.hs
| |____Home.hs
| |____Add.hs
| |____Foundation.hs
```

### Dockerfile
This Dockerfile was greatly influenced by the blog post [Optimized Docker builds for Haskell Stack](https://medium.com/permutive/optimized-docker-builds-for-haskell-76a9808eb10b)
by [Time Spence](https://medium.com/@timothywspence). Create a Dockerfile at the root of the director with the following content:

```Dockerfile
FROM fpco/stack-build:lts-16.0 as dependencies
RUN mkdir /opt/build
WORKDIR /opt/build

# GHC dynamically links its compilation targets to lib gmp
RUN apt-get update \
  && apt-get download libgmp10
RUN mv libgmp*.deb libgmp.deb

# Docker build should not use cached layer if any of these is modified
COPY stack.yaml package.yaml stack.yaml.lock /opt/build/
RUN stack build --system-ghc --dependencies-only

# ------------------------------------------------------------------------
FROM fpco/stack-build:lts-16.0 as build

# Copy compiled dependencies from previous stage
COPY --from=dependencies /root/.stack /root/.stack
COPY . /opt/build/

WORKDIR /opt/build

RUN stack build --system-ghc

RUN mv "$(stack path --local-install-root --system-ghc)/bin" /opt/build/bin

# -----------------------------------------------------------------------
# Base image for stack build so compiled artifact from previous
# stage should run
FROM ubuntu:18.04 as app
RUN mkdir -p /opt/app
WORKDIR /opt/app

# Install lib gmp
COPY --from=dependencies /opt/build/libgmp.deb /tmp
RUN dpkg -i /tmp/libgmp.deb && rm /tmp/libgmp.deb

COPY --from=build /opt/build/bin .
COPY --from=build /opt/build/static ./static
COPY --from=build /opt/build/config ./config
ENV YESOD_PORT 8080
EXPOSE 8080
CMD ["/opt/app/my-project"]
```

The blog post from [Time Spence](https://medium.com/@timothywspence) also mentions to replace the base images with
[haskell docker image](https://hub.docker.com/_/haskell). However, I was encountered with many issues when I tried that.
Package conflicts for `language-javascript` version was one of them.
After digging into the reason behind it, I figured out that I needed to use Stackage package registry instead of Hackage.

> Most Haskell dependencies you use live on the Hackage repository. But Stack adds a further layer with Stackage.
A resolver set in Stackage contains many of the most common Haskell libraries out there. But there's only a single version of each.
Stack maintainers have curated all the resolver sets. They've exhaustively checked that there are no dependency conflicts between
the package versions in the set.

The readme at [haskell docker image](https://hub.docker.com/_/haskell) also advises against using stack tool inside the Dockerfile.

> Do not use stack commands inside the dockerfile. Instead use cabal to install and build the image.

> **Cabal** is a system for building and packaging Haskell libraries and programs. It defines a common interface for package authors and distributors
to easily build their applications in a portable way. Cabal is part of a larger infrastructure for distributing, organizing, and cataloging Haskell
libraries and programs

Another problem I faced when trying to use Cabal inside the Dockerfile was that Cabal kept complaining that it can't find the modules specified inside the `*.cabal` file's `exposed-modules`.

### Summary
I found it very hard to find enough blog articles or up to date documentation available that shows how to setup a docker image for Yesod or Haskell.
Even though I've managed to configure a working Dockerfile, the whole step for build the docker image takes very long to build.
Hopefully, I will find other alternatives or optimizations in the future. If I do, I will update this blog with the details.


text:
# The DS3231 real time clock chip

This is a remarkably inexpensive and easily interfaced battery-backed RTC. It
is an ideal way to rapidly calibrate the Pyboard's RTC which can then achieve
similar levels of accuracy (+- ~2 mins/year). The chip can also provide
accurate time to platforms lacking a good RTC (notably the ESP8266).

Two drivers are provided:
 1. `ds3231_port.py` A multi-platform driver.
 2. `ds3231_pb.py` A Pyboard-specific driver with RTC calibration facility.

Breakout boards are widely available. The interface is I2C. Pullups to 3.3V
(typically 10KΩ) should be provided on the `SCL` and `SDA` lines if these are
not supplied on the breakout board.

Both divers use edge detection to achieve millisecond-level precision from the
DS3231. This enables relatively rapid accuracy testing of the platform's RTC,
and fast calibration of the Pyboard's RTC.

###### [Main README](../README.md)

# 1. The multi-platform driver

This can use soft I2C so any pins may be used.

It is based on the assumption that, where a hardware RTC exists, MicroPython's
local time (`utime.localtime()`) is based on the RTC time. Changes to local
time don't propagate to the RTC which must explicitly be set. This holds for
the Pyboard, ESP8266 and ESP32.

The official ESP32 port currently lacks support for the RTC so the Loboris port
should be used for this purpose. The driver supports both but if the official
port is used only the local time can be updated from the DS3231.

## 1.1 The DS3231 class

Constructor:
This takes one mandatory argument, an initialised I2C bus.

Public methods:
 1. `get_time` Optional boolean arg `set_rtc=False`. If `set_rtc` is `True` it
 sets the platform's RTC from the DS3231. It returns the DS3231 time as a tuple
 in the same format as `utime.localtime()` except that yday (day of year) is 0.
 So the format is (year, month, day, hour, minute, second, wday, 0).
 Note that on ports/platforms which don't support an RTC, if `set_rtc` is
 `True`, the local time will be set from the DS3231.
 2. `save_time` No args. Sets the DS3231 time from the platform's local time.
 3. `rtc_test` Optional args: `runtime=600`, `ppm=False`. This tests the
 platform's local time against the DS3231 returning the error in parts per
 million (if `ppm` is `True`) or seconds per year. A positive value indicates
 that the  DS3231 clock leads the platform local time.
 The `runtime` value in seconds defines the duration of the test. The default
 of 10 minutes provides high accuracy but shorter durations will suffice on
 devices with poor RTC's (e.g. ESP8266).

# 2. The Pyboard driver

The principal reason to use this driver is to calibrate the Pyboard's RTC.

This assumes that the DS3231 is connected to the hardware I2C port on the `X`
or `Y` side of the board, and that the Pyboard's RTC is set to the correct time
and date.

Usage to calibrate the Pyboard's RTC. Takes 5 minutes.

```python
from ds3231_pb import DS3231
ds3231 = DS3231('X')
ds3231.save_time()  # Set DS3231 to match Pyboard RTC
ds3231.calibrate()
```

Calibration data is stored in battery-backed memory. So if a backup cell is
used the RTC will run accurately in the event of a power outage.

## 2.1 The DS3231 class

Constructor:
This takes one mandatory argument, a string identifying the Pyboard side in use
('X' or 'Y').

Public methods:
 1. `get_time` Optional boolean arg `set_rtc=False`. If `set_rtc` is True it
 sets the Pyboard's RTC from the DS3231. It returns the DS3231 time as a tuple
 in the same format as `utime.localtime()` except that yday (day of year) is 0.
 namely (year, month, day, hour, minute, second, wday, 0).
 2. `save_time` No args. Sets the DS3231 time from the Pyboard's RTC.
 3. `calibrate` Optional arg `minutes=5`. The time to run. This calculates the
 calibration factor and applies it to the Pyboard. It returns the calibration
 factor which may be stored in a file if the calibration needs to survive an
 outage of all power sources.

repository: kelsonengineering/micropython-samples

repo_name: kelsonengineering/micropython-samples


text:
# CloudFormation Templates

CloudFormation templates are available if you would like to move faster or see the intended outcome of a single module or the entire lab. Following are links to CloudFormation templates for each module of the workshop. **Copy the link address and use that with CloudFormation to create the module contents in your account.** You may need to enter information into the CloudFormation template about resources created in previous modules. If you are not familiar with AWS CloudFormation, review the online [User Guide](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

## Prerequisites

### Permissions

The CloudFormation templates rely on permissions necessary to create and configure the AWS Cloud services from each module. These are the same permission you will need to perform the creation and configuration of the AWS Cloud services manually.

### Hosting

The current templates can be downloaded here and run individually. They can also be run from the hosted location within AWS using the links below. The main template named LiveStreamingWorkshopResources.json includes hosted links to the subordinate templates. If you plan to fork and modify these templates, you will need to consider hosting them to take advantage of the nesting.

## Templates

**These templates are supported in regions: us-west-2, us-east-1, and eu-west-1.**

- [**Entire Workshop**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/LiveStreamingWorkshopResources.json) - This template will perform all the configuration steps of modules 1, 2, 3 and the Extra Cloudwatch module.

- [**AWS IAM**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/IAMResources.json)

- [**AWS Elemental MediaPackage**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/MediaPackageResources.json)

- [**AWS Elemental MediaLive**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/MediaLiveResources.json)

- **Browser Page** (not applicable)

- [**AWS Elemental MediaTailor**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/CreateCloudfrontDistribution.json) - This template only automates the creation of CloudFront for MediaTailor. This does **not** automate the MediaTailor configuration creation.

- [**Extra: AWS CloudWatch**](https://s3-us-west-2.amazonaws.com/rodeolabz-us-west-2/cloudformation/CloudWatchResources.json)

## Completion

At the end of the module you learned how to test streaming video endpoints using web and standalone players. You learned about the design of browser pages that support video playback, how different security models of browsers effect streaming playback, and how to access live and restart window streams of the origin service using URL parameters.

Return to the [main](../README.md) page.

## Cloud Resource Clean Up

Deleting a deployed stack through the CloudFormation console will remove all resources created with the template or templates previously applied. The CloudFormation templates for AWS Elemental MediaLive will automatically start and stop channels to allow several steps to be completed without user intervention.

You should always try to use CloudFormation to remove resources created by templates. If that is not possible, consult the CloudFormation documentation on the best practices for cleaning up a problematic stack.

gha_language: Python


text:
# Vagrant::Betterhosts

This vagrant plugin adds host file entries to the host pointing to the guest VM, using the [GoodHosts](https://github.com/goodhosts/cli) cli tool. This plugin is based on [vagrant-hostsupdater](https://github.com/cogitatio/vagrant-hostsupdater) and aims to be compatible with the same config parameters.

On **up**, **resume** and **reload** commands, it tries to add the hosts if they do not already exist in your hosts file. If it needs to be added, you will be asked for the `sudo` password to make the necessary edits.

On **halt**, **destroy**, and **suspend**, those entries will be removed again. By setting the `config.betterhosts.remove_on_suspend  = false`, **suspend** and **halt** will not remove them.

## Installation

```shell
vagrant plugin install vagrant-betterhosts
```

To uninstall :

```shell
vagrant plugin uninstall vagrant-betterhosts
```

To update the plugin:

```shell
vagrant plugin update vagrant-betterhosts
```

## Usage

You currently only need the `hostname` and a `:private_network` network with a fixed IP address.

```ruby
config.vm.network :private_network, ip: "<IP_ADDRESS>"
config.vm.hostname = "www.testing.de" # This is not used by the plugin
config.betterhosts.aliases = ["alias.testing.de", "alias2.somedomain.com"]
```

This IP address and the hostname will be used for the entry in the `/etc/hosts` file.

### vagrant-hostsupdater conflicts

The original plugin has the issue of be executed in any vagrant environment, also that is not using and will add a rule in the hosts file that is not generated by this one.
To avoid issues is better to remove that plugin and in case update accordingly the Vagrantfile if use it. Require just a change of the reference of the plugin name as the example above.

### Multiple private network adapters

If you have multiple network adapters i.e.:

```ruby
config.vm.network :private_network, ip: "<IP_ADDRESS>"
config.vm.network :private_network, ip: "<IP_ADDRESS>"
```

You can specify which hostnames are bound to which IP by passing a hash mapping the IP of the network to an array of hostnames to create, e.g.:

```ruby
config.betterhosts.aliases = {
    '<IP_ADDRESS>' => ['foo.com', 'bar.com'],
    '<IP_ADDRESS>' => ['baz.com', 'bat.com']
}
```

This will produce `/etc/hosts` entries like so:

```
<IP_ADDRESS> foo.com
<IP_ADDRESS> bar.com
<IP_ADDRESS> baz.com
<IP_ADDRESS> bat.com
```

### Keeping Host Entries After Suspend/Halt

To keep your `/etc/hosts` file unchanged simply add the line below to your `VagrantFile`:

```ruby
config.betterhosts.remove_on_suspend = false
```

This disables `vagrant-betterhosts` from running on **suspend** and **halt**.

### Disable file hosts clean

If you want `/etc/hosts` file cleaned add in your `VagrantFile`:

```ruby
config.betterhosts.disable_clean = false
```

This enable `vagrant-betterhosts` from running the clean command in every call.

## Suppressing prompts for elevating privileges

These prompts exist to prevent anything that is being run by the user from inadvertently updating the hosts file.
The command path is printed in red when there are errors with Vagrant eg. if the sudo password is entered incorrectly for 3 times.
If you understand the risks that go with supressing them, here's how to do it.

### Linux/OS X: Passwordless sudo

To allow vagrant to automatically update the hosts file without asking for a sudo password, add one of the following snippets to a new sudoers file include, i.e. `sudo visudo -f /etc/sudoers.d/vagrant_goodhosts`.
The command path is printed when there are errors with Vagrant, check the output marked in red.

For Ubuntu and most Linux environments:

    %sudo ALL=(root) NOPASSWD: [the-command-path]

An example complete:

    %sudo ALL=(root) NOPASSWD: /home/user/sites/vvv/.vagrant/plugins/gems/3.1.2/gems/vagrant-goodhosts-1.1.6/lib/vagrant-goodhosts/bundle/cli_amd64_linux

For MacOS:

    %admin ALL=(root) NOPASSWD: [the-command-path]

Replace in both %sudo/%admin with the username it if it is not working for you.

### Windows: UAC Prompt

You can use `cacls` or `icacls` to grant your user account permanent write permission to the system's hosts file.
You have to open an elevated command prompt; hold `❖ Win` and press `X`, then choose "Command Prompt (Admin)"

    cacls %SYSTEMROOT%\system32\drivers\etc\hosts /E /G %USERNAME%:W

## Generate The Development Version

If you would like to install `vagrant-betterhosts` to make contributions or changes, run the following commands::

```shell
git clone https://github.com/ajxb/vagrant-betterhosts vagrant-betterhosts
cd vagrant-betterhosts
./package.sh
vagrant plugin install vagrant-betterhosts-*.gem
```

## Test the plugin

You need to run a Vagrant machine with the minimum settings specified in the [Usage](https://github.com/goodhosts/vagrant#usage) section, it is enough a turn on and off and in the meantime if the hosts file in your machine is written in the right way.

repository: ajxb/vagrant-betterhosts

branch_name: refs/heads/main

repo_name: ajxb/vagrant-betterhosts


text:
* [Current Year Ad Hoc Reporting Tool](http://warehouse.thinkthroughmath.com/adhoc/new)
* [SY2014-15 Ad Hoc Reporting Tool](http://warehouse-2014-2015.thinkthroughmath.com/adhoc/new)
* [SY2013-14 Ad Hoc Reporting Tool](http://warehouse-2013-2014.thinkthroughmath.com/adhoc/new)

You can also [access the 2012-2013 Warehouse](/operations/Accessing-The-2012-2013-Warehouse.md) if you really really really need to.

Note that the schemas and reports available between years will change, so a report that's runnable in the current year isn't necessarily backported to previous versions of the warehouse and adhoc tool.

## Achievement Report

### Running the Achievement Report
- Select "Achievement Report" from the Report Type dropdown.
- The report will be filtered by the dates provided *or* if either field is left empty, it will filter by the start and end dates of the current school year (08/01 - 07/30 range that contains the date the report is being run).
- You can filter by Classroom, School, District, Customer, or State. Choose which level you would like to use for your filter, and start typing - the filter should auto complete, and when you press enter or select an option, the filter is added. Filters can be removed by clicking the associated 'Remove' button.
- Once you've set up the report filters as you would like them, click 'Run Query'.
- When the report is ready, a green 'Download Results' button will appear. Click on this button to get a csv file of the Achievement Report.

### The Achievement Report Described

The Achievement Report has a row for each student with these columns:

- customer_name
- district_name
- school_name
- classroom_name
- student_id
- student_information_number
- student_name
- grade_level
- performance_grade_level
- columns for each month in the specified date range
  - each of these columns shows the percentage of lessons that are on the student's *default* pathway that have been passed up to that month (but only counts passed lessons that are within the specified date range of the report - so lessons passed prior to the date range of the report will not be included).

For example, suppose that Sam has a default pathway with 10 lessons. As those lessons are passed, the percentages will go up (regardless of how those default pathway lessons are passed - it doesn't matter if they are on the pathway that Sam is currently on or if they are passed as remediation lessons or any other way). Here's a simplified version of the report, supposing that Sam passed 2 lessons in January and 3 in February:

| Student | 12-2012 | 01-2013 | 02-2013 | 03-2013 |
|:-------:|--------:|--------:|--------:|--------:|
| Sam     | 0%      | 20%     | 50%     | 50%     |

repository: ex-ttmers/meta

repo_name: ex-ttmers/meta


text:
## Neural Networks

* Neurons as structural constituents of the brain [Ramón y Cajál, 1911];
* Five to six orders of magnitude slower than silicon logic gates;
* In a silicon chip happen in the nanosecond (on chip) vs millisecond range (neural events);
* A truly staggering number of neurons (nerve cells) with massive interconnections between them;

---
## Neural Networks

* Receive input from other units and decides whether or not to fire;
* Approximately 10 billion neurons in the human cortex, and 60 trillion synapses or connections [Shepherd and Koch, 1990];
* Energy efficiency of the brain is approximately $10^{−16}$ joules per operation per second against ~ $10^{−8}$ in a computer;

---
{{<slide background-image="neuron2.png">}}
## Neurons

---
## Neurons

* input signals from its dendrites;
* output signals along its (single) axon;

{{% note %}}
* three major types of neurons: sensory neurons, motor neurons, and interneurons
{{% /note %}}

---
## Neurons
### How do they work?

{{% fragment %}}
Control the influence from one neuron on another:
 {{% /fragment %}}

{{% fragment %}}
Excitatory when weight is positive; or
 {{% /fragment %}}

{{% fragment %}}
Inhibitory when weight is negative;
 {{% /fragment %}}

{{% fragment %}}
Nucleus is responsible for summing the incoming signals;
 {{% /fragment %}}

{{% fragment %}}
If the sum is above some threshold, then fire!
 {{% /fragment %}}

---
## Neurons
### Artificial Neuron

---
{{<slide background-image="neurons.png">}}
## Neural Networks

---
## Neural Networks
* It appears that one reason why the human brain is so powerful is the
sheer complexity of connections between neurons;
* The brain exhibits huge degree of parallelism;

---
## Artificial Neural Networks
* Model each part of the neuron and interactions;
* Interact multiplicatively (e.g. $w_0x_0$) with the dendrites of the other neuron based on the synaptic strength at that synapse (e.g. $w_0$ );
* Learn synapses strengths;

---
## Artificial Neural Networks
### Function Approximation Machines
* Datasets as composite functions: $y=f^{*}(x)$
  * Maps $x$ input to a category (or a value) $y$;
* Learn synapses weights and aproximate $y$ with $\hat{y}$:
  * $\hat{y} = f(x;w)$
  * Learn the $w$ parameters;

---
## Artificial Neural Networks
* Can be seen as a directed graph with units (or neurons) situated at the vertices;
  * Some are input units
* Receive signal from the outside world;
* The remaining are named computation units;
* Each unit produces an output
  * Transmitted to other units along the arcs of the directed graph;

---
## Artificial Neural Networks
* Input, Output, and Hidden layers;
* Hidden as in "not defined by the output";

---
## Artificial Neural Networks
###### Motivation Example (taken from Jay Alammar blog post)
* Imagine that you want to forecast the price of houses at your neighborhood;
  * After some research you found that 3 people sold houses for the following values:

Area (sq ft) (x)|	Price (y)
----------------|----------
2,104	          |  $\$399,900$
1,600	          |  $\$329,900$
2,400	          |  $\$369,000$

---
## Artificial Neural Networks
###### Motivation Example (taken from Jay Alammar blog post)

{{% fragment %}} If you want to sell a 2K sq ft house, how much should ask for it? {{% /fragment %}}

{{% fragment %}} How about finding the average price per square feet?{{% /fragment %}}

{{% fragment %}} $\$180$ per sq ft. {{% /fragment %}}

---
## Artificial Neural Networks
###### Motivation Example (taken from Jay Alammar blog post)
* Our very first neural network looks like this:
{{% fragment %}} {{% /fragment %}}

---
## Artificial Neural Networks
###### Motivation Example (taken from Jay Alammar blog post)
* Multiplying $2,000$ sq ft by $180$ gives us $\$360,000$.
* Calculating the prediction is simple multiplication.
* We needed to think about the weight we’ll be multiplying by.
* That is what training means!

Area (sq ft) (x)|	Price (y)    | Estimated Price($\hat{y}$)
----------------|--------------|---------------------------
2,104	          |  $\$399,900$ |          $\$378,720$
1,600	          |  $\$329,900$ |          $\$288,000$
2,400	          |  $\$369,000$ |          $\$432,000$

---
## Artificial Neural Networks
###### Motivation Example (taken from Jay Alammar blog post)
* How bad is our model?
	* Calculate the Error;
	* A better model is one that has less error;

{{% fragment %}} Mean Square Error{{% /fragment %}}{{% fragment %}}: $2,058$ {{% /fragment %}}

Area (sq ft) (x)|	Price (y)    | Estimated Price($\hat{y}$) | $y-\hat{y}$ | $(y-\hat{y})^2$
----------------|--------------|----------------------------|-------------|---------------
2,104	          |  $\$399,900$ |          $\$378,720$       | $\$21$      |  $449$
1,600	          |  $\$329,900$ |          $\$288,000$       | $\$42$      |  $1756$
2,400	          |  $\$369,000$ |          $\$432,000$       | $\$-63$     |  $3969$

---
## Artificial Neural Networks
* Fitting the line to our data:

Follows the equation: $\hat{y} = W * x$

---
## Artificial Neural Networks

How about addind the Intercept?

{{% fragment %}} $\hat{y}=Wx + b$ {{% /fragment %}}

---
## Artificial Neural Networks
### The Bias

---
## Artificial Neural Networks
### Try to train it manually:

---
## Artificial Neural Networks
### How to discover the correct weights?
* Gradient Descent:
  * Finding the minimum of a function;
    * Look for the best weights values, minimizing the error;
  * Takes steps proportional to the negative of the gradient of the function at the current point.
  * Gradient is a vector that is tangent of a function and points in the direction of greatest increase of this function.

---
## Artificial Neural Networks
### Gradient Descent
* In mathematics, gradient is defined as partial derivative for every input variable of function;
* Negative gradient is a vector pointing at the greatest decrease of a function;
* Minimize a function by iteratively moving a little bit in the direction of negative gradient;

---
## Artificial Neural Networks
### Gradient Descent
* With a single weight:

---
## Artificial Neural Networks
### Gradient Descent

---
## Artificial Neural Networks
### Perceptron
* In 1958, Frank Rosenblatt proposed an algorithm for training the perceptron.
* Simplest form of Neural Network;
* One unique neuron;
* Adjustable Synaptic weights

---
## Artificial Neural Networks
### Perceptron
* Classification of observations into two classes:

###### Images Taken from Towards Data Science

---
## Artificial Neural Networks
### Perceptron
* Classification of observations into two classes:

###### Images Taken from Towards Data Science

---
## Artificial Neural Networks
### Perceptron
* E.g, the OR function:

#### Find the $w_i$ values that could solve the or problem.

---
## Artificial Neural Networks
### Perceptron
* E.g, the OR function:

---
## Artificial Neural Networks
### Perceptron
* One possible solution $w_0=-1$, $w_1=1.1$, $w_2=1.1$:

---
## Artificial Neural Networks
### The Keras framework

* High-level neural networks API;
* Capable of running on top of TensorFlow, CNTK, or Theano;
* Focus on enabling fast experimentation;
  * Go from idea to result with the least possible delay;
* Runs seamlessly on CPU and GPU;
* Compatible with: Python 2.7-3.6;

---
## Artificial Neural Networks
### The Keras framework
* Use the implementation of the tensorflow:
  * Create a sequential model (perceptron)
```python
# Import the Sequential model
from tensorflow.keras.models import Sequential

# Instantiate the model
model = Sequential()
```

---
## Artificial Neural Networks
### The Keras framework
* Create a single layer with a single neuron:
  * `units` represent the number of neurons;
```python
# Import the Dense layer
from tensorflow.keras.layers import Dense

# Add a forward layer to the model
model.add(Dense(units=1, input_dim=2))
```

{{% note %}}
* Dense means a fully connected layer.
{{% /note %}}

---
## Artificial Neural Networks
### The Keras framework
* Compile and train the model
  * The compilation creates a computational graph of the training;
```python
# Specify the loss function (error) and the optimizer
#   (a variation of the gradient descent method)
model.compile(loss="mean_squared_error", optimizer="sgd")

# Fit the model using the train data and also
#   provide the expected result
model.fit(x=train_data_X, y=train_data_Y)
```
{{% note %}}
* Computational Graphs:
  * Nodes represent both inputs and operations;
  * Even relatively “simple” deep neural networks have hundreds of thousands of nodes and edges;
  * Lots of operations can run in parallel;
    * Example: $(x*y)+(w*z)$
  * Makes it easier to create an auto diferentiation strategy;
{{% /note %}}

---
## Artificial Neural Networks
### The Keras framework
* Evaluate the quality of the model:
```python
# Use evaluate function to get the loss and other metrics that the framework
#  makes available
loss_and_metrics = model.evaluate(train_data_X, train_data_Y)
print(loss_and_metrics)
#0.4043288230895996

# Do a prediction using the trained model
prediction = model.predict(train_data_X)
print(prediction)
# [[-0.25007164]
#  [ 0.24998784]
#  [ 0.24999022]
#  [ 0.7500497 ]]
```

---
## Artificial Neural Networks
### The Keras framework
#### Exercise:
Run the example of the Jupyter notebook:

Perceptron - OR

---
## Artificial Neural Networks
### Perceptron
#### Exercise:
* What about the AND function?

$x_1$|$x_2$|$y$
-----|-----|----
0    |0    |0
0    |1    |0
1    |0    |0
1    |1    |1

---
## Artificial Neural Networks
### Activation Functions
* Describes whether or not the neuron fires, i.e., if it forwards its value for the next neuron layer;
* Historically they translated the output of the neuron into either 1 (On/active) or 0 (Off) - Step Function:
```python
if prediction[i]>0.5: return 1
return 0
```

---
## Artificial Neural Networks
### Activation Functions
* Multiply the input by its weights, add the bias and applies activation;
* Sigmoid, Hyperbolic Tangent, Rectified Linear Unit;
* Differentiable function instead of the step function;

{{% note %}}
* With this modification, a multi-layered network of perceptrons would become
differentiable. Hence gradient descent could be applied to minimize the
network’s error and the chain rule could “back-propagate” proper error
derivatives to update the weights from every layer of the network.

* At the moment, one of the most efficient ways to train a multi-layer neural
network is by using gradient descent with backpropagation. A requirement for
backpropagation algorithm is a differentiable activation function. However, the
Heaviside step function is non-differentiable at x = 0 and it has 0 derivative
elsewhere. This means that gradient descent won’t be able to make a progress in
updating the weights.

* The main objective of the neural network is to learn the values of the weights
and biases so that the model could produce a prediction as close as possible to
the real value. In order to do this, as in many optimisation problems, we’d
like a small change in the weight or bias to cause only a small corresponding
change in the output from the network. By doing this, we can continuously
tweaked the values of weights and bias towards resulting the best
approximation. Having a function that can only generate either 0 or 1 (or yes
and no), won't help us to achieve this objective.
{{% /note %}}

---
## Artificial Neural Networks
### The Bias

---
## Artificial Neural Networks
### The Bias

---
## Artificial Neural Networks
### Perceptron - What it can't do!

* The XOR function:

---
## Artificial Neural Networks
### Perceptron - Solving the XOR problem
* 3D example of the solution of learning the OR function:
  * Using Sigmoid function;

{{% note %}}
That creates a hyperplane that separates the classes;
{{% /note %}}

---
## Artificial Neural Networks
### Perceptron - Solving the XOR problem
* Maybe there is a combination of functions that could create hyperplanes that separate the XOR classes:
  * By increasing the number of layers we increase the complexity of the function represented by the ANN:

{{% note %}}
Now, there are 2 hyperplanes, that when put together, can perfectly separate the classes;
{{% /note %}}

---
## Artificial Neural Networks
### Perceptron - Solving the XOR problem
* The combination of the layers:

{{% note %}}
* That is what people mean when they say we don't know how deep neural networks
  work. We know that it is a composition of functions, but the shape of that
  remains a little bit hard to define;
* Yesterday we saw polynomial transformation of features - in that we saw that
  we changed the shape of the regression line being built;

{{% /note %}}

---
## Artificial Neural Networks
### Perceptron - Solving the XOR problem
* Implementing an ANN that can solve the XOR problem:
  * Add a new layer with a larger number of neurons:

```python
...
#Create a layer with 4 neurons as output
model.add(Dense(units=4), activation="sigmoid", input_dim=2)

# Connect to the first layer that we defined
model.add(Dense(units=1, activation="sigmoid")
```

{{% note %}}
Train for little steps and then increase the number of epochs
{{% /note %}}

---
## Artificial Neural Networks
#### Multilayer Perceptrons - Increasing the model power
* Typically represented by composing many different
functions:
$$y = f^{(3)}(f^{(2)}(f^{(1)}(x)))$$

* The depth of the network - the deep in deep learning! (-;

---
## Artificial Neural Networks
#### Multilayer Perceptrons - Increasing the model power
* Information flows from $x$ , through computations and finally to $y$.
* No feedback!

---
## Artificial Neural Networks
### Understanding the training
* Plot the architecture of the network:
```python
tf.keras.utils.plot_model(model, show_shapes=True, show_layer_names=False)
```

{{% note %}}
The ? means that they take as much examples as possible;
{{% /note %}}

---
## Artificial Neural Networks
### Understanding the training
* Plotting the training progress of the XOR ANN:
```python
history = model.fit(x=X_data, y=Y_data, epochs=2500, verbose=0)
import matplotlib.pyplot as plt
plt.plot(history.history['loss'])
plt.title('Model Training Progression')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Loss'], loc='upper left')
plt.show()
```

{{% note %}}
* This is called the learning curve;
* In the case of the XOR. What is wrong with that?
{{% /note %}}

---
## Artificial Neural Networks
### Problems with the training procedure:
* Saddle points:
	* No matter how long you train your model for,  the error remains (almost) constant!

{{% note %}}
* That eventually happens because of a bad optimization function;
* Imagine that you could add momentum to the gradient descent - probably it
  could continue updating;
{{% /note %}}

---
## Artificial Neural Networks
### Optimization alternatives
* The Gradient Descent is not always the best option to go with:
  * Only does the update after calculating the derivative for the whole
    dataset;
  * Can take a long time to find the minimum point;

---
## Artificial Neural Networks
### Optimization alternatives
* The Gradient Descent is not always the best option to go with:
  * For non-convex surfaces, it may only find the local minimums - the saddle situation;
  * Vectorization

{{% note %}}
* For large datasets, the vectorization of data doesn’t fit into memory.
{{% /note %}}

---
## Artificial Neural Networks
### Optimization alternatives
* Gradient Descent alternatives:
  * Stochastic Gradient Descent: updates at each input;
  * Minibatch Gradient Descent: updates after reading a batch of examples;

###### Animations taken from Vikashraj Luhaniwal post.

{{% note %}}
Minibatch:
* Updates are less noisy compared to SGD which leads to better convergence.
* A high number of updates in a single epoch compared to GD so less number of epochs are required for large datasets.
* Fits very well to the processor memory which makes computing faster.
{{% /note %}}

---
## Artificial Neural Networks
### Optimization alternatives
###### Adaptative Learning Rates:
* Adagrad, RMSProp, Adam;
######

###### Animations taken from Vikashraj Luhaniwal post.

{{% note %}}
* For Adagrad:
  * Parameters with small updates(sparse features) have high learning rate whereas the parameters with large updates(dense features) have low learning rateupdates at each input;
  * The learning rate decays very aggressively
* RMSProp: A large number of oscillations with high learning rate or large gradient
{{% /note %}}

---
## Artificial Neural Networks
### Multilayer Perceptron - XOR
* Try another optimizer:
```python
model.compile(loss="mean_squared_error", optimizer="adam")
```
* My solution

---
## Artificial Neural Networks
### Predicting probabilities
* Imagine that we have more than 2 classes to output;
* One of the most popular usages for ANN;

---
## Artificial Neural Networks
### Predicting probabilities
* The Softmax function;
* Takes an array and outputs a probability distribution, i.e., the probability
  of the input example belonging to each of the classes in my problem;
* One of the activation functions available at `Keras`:
```python
model.add(Dense(2, activation="softmax"))
```

{{% note %}}
* Softmax - function that takes as input a vector of K real numbers, and normalizes it into a probability distribution
{{% /note %}}

---
## Artificial Neural Networks
### Loss functions
* For regression problems
  * Mean squared error is not always the best one to go;
    * What if we have a three classes problem?
  * Alternatives: `mean_absolute_error`, `mean_squared_logarithmic_error`

{{% note %}}
* logarithm means changing scale as the error can grow really fast;
{{% /note %}}

---
## Artificial Neural Networks
### Loss functions
* Cross Entropy loss:
  * Default loss function to use for binary classification problems.
  * Measures the performance of a model whose output is a probability value between 0 and 1;
  * Loss increases as the predicted probability diverges from the actual label;
  * A perfect model would have a log loss of 0;

{{% note %}}
*  As the correct predicted probability decreases, however, the log loss increases rapidly:
  * In case the model has to answer 1, but it does with a very low probability;
{{% /note %}}

---
## Artificial Neural Networks
### Dealing with overfitting
* Dropout layers:
  * Randomly *disable* some of the neurons during the training passes;

---
## Artificial Neural Networks
### Dealing with overfitting
* Dropout layers:
```python
# Drop half of the neurons outputs from the previous layer
model.add(Dropout(0.5))
```

{{% note %}}
* “drops out” a random set of activations in that layer by setting them to zero;
* forces the network to be redundant;
* the net should be able to provide the right classification for a specific example even if some of the activations are dropped out;
{{% /note %}}

---
## Artificial Neural Networks
### Larger Example
* The MNIST dataset: database of handwritten digits;
* Dataset included in Keras;

---
## Artificial Neural Networks
### The MNIST MLP
* Try to improve the classification results using this notebook:
* Things to try:
  * Increase the number of neurons at the first layer;
  * Change the optimizer and the loss function;
  * Try `categorical_crossentropy` and `rmsprop` optimizer;
  * Try adding some extra layers;

---
## Artificial Neural Networks
### The MNIST MLP
* Try to improve the classification results using this notebook:
* Things to try:
  * Try addind `Dropout` layers;
  * Increase the number of `epochs`;
  * Try to normalize the data!

* What is the best accuracy?
* My solution.

---
{{<slide background-image="cms.png">}}
#  The Exercise

---
## Artificial Neural Networks
### The Exercise

---
## Artificial Neural Networks
### The Exercise

---
## Artificial Neural Networks
### The Exercise
* Quantum Chromodynamics

---
## Artificial Neural Networks
### Signal VS Background

---
## Artificial Neural Networks
### Signal VS Background

Run this Jupyter Notebook for performing the Jet Classification.

gha_language: CSS


text:
iOS Ingress
===========

Google's AR Game Ingress port for iOS

Help
----

I need few invitations for testing activation. If you have some, please contact me at studnicka(at)aacode.cz. Thank you.

Video
-----

Video of codename creating and intro which have been recently finished

http://youtu.be/jRi8PuquP50

Getting map data from API
-------------------------

**This is temporary fixed by loading data from intel instead of API, so IITC's script can be used. But still needs to be fixed, because this solution is super slow and doesn't load XM and dropped items.**

I have big problems with this part. Ingress uses cell/tile IDs for getting data from API and I don't know how it works. If somebody knows how it works, please contact me at studnicka(at)aacode.cz. Thank you.

Few examples for New York (40.714021,-74.00588):

    89c25a1750000000
    89c25a1050000000
    89c25a1910000000
    89c25a1a10000000
    89c25a1710000000
    89c25a1850000000
    89c25a1110000000
    89c25a1a50000000
    89c25a16d0000000
    89c25a10d0000000
    89c25a1990000000
    89c25a1a90000000
    89c25a1790000000
    89c25a1090000000
    89c25a19d0000000
    89c25a1bd0000000
    89c25a1830000000
    89c25a1070000000
    89c25a1a30000000
    89c25a1770000000
    89c25a1970000000
    89c25a1130000000
    89c25a1a70000000
    89c25a1730000000
    89c25a10f0000000
    89c25a19b0000000
    89c25a10b0000000
    89c25a19f0000000
    89c25a17b0000000

Choosing faction
----------------

Choosing faction is not yet implemented, but you can choose by calling this method:

    API
        - (void)chooseFaction:(NSString *)faction completionHandler:(void (^)(void))handler;

        "ALIENS"        = enlightened
        "RESISTANCE"    = resistance

Screenshots
-----------

![Screenshot 1](http://i.imgur.com/XJLt6wn.png)
![Screenshot 2](http://i.imgur.com/r21wnTc.png)
![Screenshot 3](http://i.imgur.com/FIYe6bm.png)
![Screenshot 4](http://i.imgur.com/V1r6eER.png)
![Screenshot 5](http://i.imgur.com/Joik8Qe.png)
![Screenshot 6](http://i.imgur.com/hLajkw3.png)
![Screenshot 7](http://i.imgur.com/uC9hXxk.png)

Attribution & License
---------------------

This project is licensed under the permissive ISC license. Parts imported from other projects remain under their respective licenses.

license: ISC

repository: BBLionel/iOS-Ingress

repo_name: BBLionel/iOS-Ingress


text:
## Segments
Use this endpoint to obtain details on Mautic's contact segments or to manipulate contact memberships.

```php
<?php
use Mautic\MauticApi;
use Mautic\Auth\ApiAuth;

// ...
$auth     = ApiAuth::initiate($settings);
$apiUrl   = "https://your-mautic.com";
$segmentApi = MauticApi::getContext("segments", $auth, $apiUrl);
```

### List Contact Segments

```php
<?php

//...
$segments = $segmentApi->getSegments();
```
```json
{
  "1": {
    "id": 1,
    "name": "New Contacts",
    "alias": "new"
  },
  "2": {
    "id": 2,
    "name": "Region A Contacts",
    "alias": "region-a-laeds"
  },
  "3": {
    "id": 3,
    "name": "Region B Contacts",
    "alias": "region-b-contacts"
  }
}
```
Returns a list of contact segments available to the user. This list is not filterable.

#### HTTP Request

`GET /segments`

#### Response

`Expected Response Code: 200`

See JSON code example.

**Segment Properties**

Name|Type|Description
----|----|-----------
id|int|ID of the segment
name|string|Name of the segment
alias|string|Alias of the segment

### Add Contact to a Segment

```php
<?php

//...
$response = $segmentApi->addContact($contactId, $segmentId);
if (!isset($response['success'])) {
    // handle error
}
```
```json
{
    "success": true
}
```

Manually add a contact to a specific segment.

#### HTTP Request

`POST /segments/SEGMENT_ID/contact/add/CONTACT_ID`

#### Response

`Expected Response Code: 200`

See JSON code example.

### Remove Contact from a Segment

```php
<?php

//...
$response = $segmentApi->removeContact($contactId, $segmentId);
if (!isset($response['success'])) {
    // handle error
}
```
```json
{
    "success": true
}
```

Manually remove a contact to a specific segment.

#### HTTP Request

`POST /segments/SEGMENT_ID/contact/remove/CONTACT_ID`

#### Response

`Expected Response Code: 200`

See JSON code example.

repository: virlatinus/developer-documentation

repo_name: virlatinus/developer-documentation


text:
react-weibo
==========

An experiment to make a pure client-side Sina weibo client with reactjs.

[Live demo](http://react-weibo.herokuapp.com/) here.

PS: Still WIP.

### Tools

* Webpack - Build(There's also an browserify branch)
* React - View
* Flux - Data flow
* react-router - Router
* Express - Auth server only, to send accessToken to client.

### Development

```
$ cp config.example.json config.json
$ npm i
$ webpack
```

### License

MIT

repository: fraserxu/react-weibo

repo_name: fraserxu/react-weibo