text:
# Demo

For the demo, we'll use [daytrader7](https://github.com/WASdev/sample.daytrader7) as an example. Feel free to follow along with your own application and your personal directories. But, keep track of the _directories_ where the application _source code_ and the _built jar/war/ear_ reside and replace them appropriately below.

1. To get started, clone this repo and save the repository root as `$DGI_ROOT`:

    ```sh
    git clone https://github.com/konveyor/tackle-data-gravity-insights.git
    cd tackle-data-gravity-insights
    ```

    > This repository comes with a `demo` folder to work through an example app.

2. Let's download a copy of our sample application and build it.

    ```sh
    # Download and extract the demo application
    wget -c https://github.com/WASdev/sample.daytrader7/archive/refs/tags/v1.4.tar.gz -O - | tar -xvz -C demo/sample-application
    # Now build the application
    docker run --rm -v $(pwd)/demo/sample-application/sample.daytrader7-1.4:/build maven:3.8.4-openjdk-8-slim mvn --file=/build/pom.xml install
    ```

    This will create an EAR file called `daytrader-ee7-1.0-SNAPSHOT.ear` in `demo/sample-application/sample.daytrader7-1.4/daytrader-ee7/target` directory.

3. For convenience, let's put the generated `daytrader-ee7-1.0-SNAPSHOT.ear` in the `demo/code2graph-samples/doop-input` folder

    ```sh
    cp demo/sample-application/sample.daytrader7-1.4/daytrader-ee7/target/daytrader-ee7-1.0-SNAPSHOT.ear demo/code2graph-samples/doop-input
    ```

repository: konveyor/tackle-data-gravity-insights

gha_language: Python

repo_name: konveyor/tackle-data-gravity-insights


text:
# mmir-plugin-speech-android
----

[![MIT license](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/mmig/mmir-plugin-speech-android/master)](https://github.com/mmig/mmir-plugin-speech-android)
[![npm](https://img.shields.io/npm/v/mmir-plugin-speech-android)](https://www.npmjs.com/package/mmir-plugin-speech-android)

Cordova plugin for the MMIR framework for accessing Android's system speech recognition and synthesis

The plugin provides access to Android's speech recognition service (i.e. it does not use / trigger
the default graphical interface when accessing using recognition via Intents).

This Cordova plugin is specifically targeted to be used with the [MMIR framework][1]:
On adding the plugin, two MMIR "modules" (for recognition and synthesis) will be copied
into the platform's resource folders `<www assets>/mmirf/env/media/*Android.js`

For details on using (speech) plugins in the MMIR framework, also see the corresponding
section in the [wiki][2].

# USAGE
------

## INSTALLATION

### From NPM

execute one of the following commands in Cordova project's root directory:

    cordova plugin add mmir-plugin-speech-android
    cordova plugin add mmir-plugin-speech-android --variable MMIR_PLUGIN_MODE=<one of "normal" | "compat" | "webpack">

### From GIT repository

execute one of the following commands in Cordova project's root directory:

    cordova plugin add git+https://github.com/mmig/mmir-plugin-speech-android.git
    cordova plugin add git+https://github.com/mmig/mmir-plugin-speech-android.git --variable MMIR_PLUGIN_MODE=<one of "normal" | "compat" | "webpack">

### From local copy of the repository

(1) check out the repository into a local directory (or download its ZIP file and decompress it)

(2) add the plugin to the Cordova project:

use command:

    cordova plugin add <file path to plugin directory>

If plugin source code (from this repository) is located in directory:

    D:\DevProjects\Eclipse_workplace\mmir-plugin-speech-android

execute the following command in Cordova project's root directory:

    cordova plugin add D:\DevProjects\Eclipse_workplace\mmir-plugin-speech-android

## FILES

the MMIR modules the give access to the speech recognition / synthesis will be copied
from the plugin directory

    /www/asrAndroid.js
    /www/ttsAndroid.js

into into the platform folders of the www-resource files to:

    /www/mmirf/env/media/*

## MMIR CONFIGURATION

for configuring the MMIR app to use this plugin/module for its speech input/output do the following:

edit the configuration file in

    /www/config/configuration.json

modify or add (if it does not exist already) the configuration entries
for the MediaManager plugins, i.e. edit the JSON file to:
```javascript
{
 ...

  "mediaManager": {
    "plugins": {
      "browser": [
        ...
      ],
      "cordova": [{"mod": "cordovaAudio", "type": "audio"},

                  {"mod": "asrAndroid", "type": "asr"},
                  {"mod": "ttsAndroid", "type": "tts"}
      ]
    }
  }

 ...
}
```
i.e. change (or add) the `"cordova"` array entries to `"asrAndroid.js"` and `"ttsAndroid.js"`
in order to use the 'native' Android ASR and TTS engine, when the application is run as Cordova app
on Android.

# API
----

### Speech Input

A general description for the MMIR speech input API can be found in the [wiki][3].

```javascript
mmir.media.recognize([options: Options, statusCallback: Function, failureCallback: Function])
mmir.media.startRecord([options: Options, statusCallback: Function, failureCallback: Function])
```

supported Options by this plugin:
 * `success: OPTIONAL Function`, the status-callback (see arg statusCallback in [wiki][3])
 * `error: OPTIONAL Function`, the error callback (see arg failureCallback in [wiki][3])
 * `language: OPTIONAL String`, the language for recognition (if omitted, the current language setting is used)
 * `intermediate: OTPIONAL Boolean`, set true for receiving intermediate results (NOTE not all ASR engines may support intermediate results)
 * `results: OTPIONAL Number`, set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option)
 * `mode: OTPIONAL "search" | "dictation"`, set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option)
 * `eosPause: OTPIONAL "short" | "long"`, length of pause after speech for end-of-speech detection (NOTE not all ASR engines may support this option)
 * `disableImprovedFeedback: OTPIONAL Boolean`, disable improved feedback when using intermediate results (NOTE not all ASR engines may support this option)

### Speech Output

A general description for the MMIR speech output API can be found in the [wiki][4].

```javascript
mmir.media.tts(options: Options | string | Array<string>[, onPlayedCallback: Function, failureCallback: Function, onReadyCallback: Function])
```

supported Options by this plugin:
 * `text: String | String[]`, text that should be read aloud
 * `pauseDuration: OPTIONAL Number`, the length of the pauses between sentences (i.e. for String Arrays) in milliseconds
 * `language: OPTIONAL String`, the language for synthesis (if omitted, the current language setting is used)
 * `voice: OPTIONAL String`, the voice (language specific) for synthesis; NOTE that the specific available voices depend on the TTS engine
 * `success: OPTIONAL Function`, the on-playing-completed callback (see arg onPlayedCallback in [wiki][4])
 * `error: OPTIONAL Function`, the error callback (see arg failureCallback in [wiki][4])
 * `ready: OPTIONAL Function`, the audio-ready callback (see arg onReadyCallback in [wiki][4])

 * `fileUri: OTPIONAL String`, CUSTOM an absolute file URI, if given, will store synthesized text to the file instead of playing the audio

_Note: the function `textToSpeech()` is a deprecated alias for `tts()`_

# DEVELOPMENT AND BUILDING THE PLUGIN
------

NOTE:
"building" is not necessary for using the plugin, but it
may provide helpful feedback during plugin development.

This project requires Cordova 5.x for building the Java source.

You can checkout the CordovaLib project from a repository and then
reference the checked-out project from this project:

(1) checkout the Cordova5Lib project into the same Eclipse workspace:

    t.b.a.: XXXX/Cordova5Lib

(2) (in Eclipse) open the project Properties for this project, goto "Java Build Path", open tab "Projects"
 and add the CordovaLib project (you may also need to clean / rebuild the project).

[1]: https://github.com/mmig/mmir
[2]: https://github.com/mmig/mmir/wiki/3.9.2-Speech-Processing-in-MMIR
[3]: https://github.com/mmig/mmir/wiki/3.9.2-Speech-Processing-in-MMIR#speech-input-api
[4]: https://github.com/mmig/mmir/wiki/3.9.2-Speech-Processing-in-MMIR#speech-output-api

license: MIT

repository: mmig/mmir-plugin-speech-android

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: mmig/mmir-plugin-speech-android


text:
# Multitool

### Slack

Often when attempting to copy and paste text from a slack conversation there is
excess whitespace and timestamps riddled throughout. This tool will remove the whitespace
and pesky timestamps automatically within the clipboard. Usage

```
<copy text to the clipboard from slack>
mt slck [names]
<paste text into desired output>
```

Note that the `[names]` arguments are optional but add extra whitespace between the
conversation paragraphs from different participants. The name is the slack handle of
the participant.

### Got

Adapted from https://github.com/ebuchman/got

Got is a tool for doing things with go and git that the go tool doesn't do for you by default. It's particularly useful for working with
forks of open source projects, where import paths become an issue.

##### Usage
Replace strings in an entire directory tree
```
got replace [-d <depth> -p <dirpath>] <oldString> <newString>
```
Switch import paths to upstream repo, pull, switch back
```
got pull <remote> <branch>
```
This does the same thing as running replace, followed by a commit, followed by a git pull, followed by a replace which undoes the first replace.

Check out the same branch across many repositories
```
got checkout develop
```
This will `cd` into every directory in the current one and run `git checkout develop`. If you want to specify exceptions, add arguments of the form `<repo>:<branch>`, ie
```
got checkout develop myrepo:newfeature repo2:master
```
will `cd` into every repo and run `git checkout develop` except in `myrepo` it will do `git checkout newfeature` and in `repo2` will do `git checkout master`. To only `cd` into some directories, just list them, ie.
```
got checkout develop myrepo anotherepo repo2:master
```
will checkout `myrepo` and `anotherepo` onto develop and `repo2` onto master while leaving all others alone.

See which branch every repo in a directory is on
```
got branch
```
Toggle the import path in a go directory between the Godep/ vendored packages and the $GOPATH based location

```
got dep --local github.com/myorg/myrepo
```
and
```
got dep --vendor github.com/myorg/myrepo
```

repository: jsimnz/multitool

repo_name: jsimnz/multitool


text:
# Release 2.0.1

# API changes

## Module name for Java 9

Not really an API change but rather an API specification.

The deployed big-math Jar file contains now a module name for the Java 9 JigSaw module system.

This allows it to be used as automatic module with a well defined module name instead
of deriving the name magically from the Jar file name.

The module name follows the reverse domain convention and is: `ch.obermuhlner.math.big`

## OSGi support

The big-math Jar file is now OSGi compatible.

The `MANIFEST.MF` contains all the necessary headers and exports the public packages
- `ch.obermuhlner.math.big`
- `ch.obermuhlner.math.big.stream`

# Bugfixes

## Fixed `BigDecimalMath.log(BigDecimal, MathContext)` argument `x` very close to 0

`BigDecimalMath.log(BigDecimal, MathContext)` failed with arguments very close to 0 due to
`BigDecimal.doubleValue()` rounding down to 0.

# Enhancements

No enhancements.

# Examples

Note: The example code is available on github, but not part of the big-math library.

No changes in the examples.

repository: eobermuhlner/big-math

gha_language: Java

gha_license_id: MIT

repo_name: eobermuhlner/big-math


text:
## Project: Perception Pick & Place

---
### James Covino Writeup

#### 1. Provide a Writeup / README that includes all the rubric points and how you addressed each one.  You can submit your writeup as markdown or pdf.

### Exercise 1, 2 and 3 pipeline implemented
#### 1. Completed Exercise 1 steps. Pipeline for filtering and RANSAC plane fitting implemented.
Followed the tutorial.
#### 2. Completed Exercise 2 steps: Pipeline including clustering for segmentation implemented.
Followed the tutorial.
#### 2. Completed Exercise 3 Steps.  Features extracted and SVM trained.  Object recognition implemented.
Followed the tutorial. I Had troubles with the Sklearn package. The code written by Udacity was not compatible with the recent version of SKlearn. Initially, I tried to change the code to fit with the updates, but decided a pip install to an older version was more efficient.

Trained model results from training excerise, below.

![image-1](./training_result_Excercise.png)

Trained model results from Project, below.  Notice improvements to object calls. This was accomplished by increasing the iterations in the for loop in the capture features script.

![image-2](./Training_result_project.png)

### Pick and Place Setup

#### 1. For all three tabletop setups (`test*.world`), perform object recognition, then read in respective pick list (`pick_list_*.yaml`). Next construct the messages that would comprise a valid `PickPlace` request output them to `.yaml` format.

The 3 yaml file were generated for worlds 1,2, and 3.

World-1 was successful with 3/3:
![image-3](./yaml1.png)

World 2 was successful with 5/5:
![image-4](./yaml2.png)

World 3 was succesful with 7/8:
![image-5](./yaml3.png)

### Discussion
Despite the project being primarly written by Udacity, I had trouble getting through it. There were multiple hurdles from errors in transferring Udacity's code and compatibility issues with Sklearn.  Once I had the trained model in place with excellent accuracy and precision, I knew I was close. However, some final tweaking was required.

Note- I used the following github to troubleshoot my code, especially the pr2_mover(object_list) function found in project_template.py :   https://github.com/chriswernst/Perception-Udacity-RoboticsND-Project3

Changes that resulted in a succesful submision included:
* y and z axis passthrough filtering
* values that work for segmenting objects
    ec.set_ClusterTolerance(0.02)
    ec.set_MinClusterSize(100)
    ec.set_MaxClusterSize(3000)

* Take into account that all the objects may not be detected in World 3.
	The code below handled the situation, see * sections. If an object from the pick list was detected, then it was processed.
	~~~~
    object_centroid_dict = {}  #*
    detected_name_list = []
    for object in object_list:
        points_arr = ros_to_pcl(object.cloud).to_array()
        object_centroid_dict[object.label] = np.mean(points_arr, axis=0)[:3]  #*
        detected_name_list.append(object.label)

    dict_list = []
    object_list_param = rospy.get_param('/object_list')

    for i in range(0, len(object_list_param)):
        object_name.data = object_list_param[i]['name']
        item_name= object_list_param[i]['name']

        if item_name in detected_name_list: #*
            print item_name
            try:
                pick_pose.position.x = np.asscalar(object_centroid_dict[item_name][0])
                pick_pose.position.y = np.asscalar(object_centroid_dict[item_name][1])
                pick_pose.position.z = np.asscalar(object_centroid_dict[item_name][2])
            except ValueError:
                continue

	~~~~

repository: VinoVino/RoboND-Perception-Project

repo_name: VinoVino/RoboND-Perception-Project


text:
## Menu manager like Wordpress using Laravel and Nestable

See demo at: http://laravel-menu-builder.gopagoda.com/admin/menu
Tutorial coming up at: http://maxoffsky.com

This application demonstrates usage of [Nestable plugin](https://github.com/dbushell/Nestable) jQuery plugin to provide the user with nice menu ordering experience without a page refresh:
![menu ordering in action](https://raw.github.com/msurguy/laravel-shop-menu/master/menumanager.gif)

The menu controller is in app/controllers/Admin/MenuController.php
The menu model is in app/models/Menu.php

### A note on the data structure for the menu

The important columns of the "menus" table are:
- id
- parent_id
- order

With these 3 fields we can build nested menus as many levels deep as you want.
The Nestable plugin helps modify the values of these fields for the appropriate rows of data.

### Use of recursion

The hard part that took me a looong time to build is a very small function inside of app/models/Menu.php:
```
public function buildMenu($menu, $parentid = 0)
{
  $result = null;
  foreach ($menu as $item)
    if ($item->parent_id == $parentid) {
      $result .= "<li class='dd-item nested-list-item' data-order='{$item->order}' data-id='{$item->id}'>
      <div class='dd-handle nested-list-handle'>
        <span class='glyphicon glyphicon-move'></span>
      </div>
      <div class='nested-list-content'>{$item->label}
        <div class='pull-right'>
          <a href='".url("admin/menu/edit/{$item->id}")."'>Edit</a> |
          <a href='#' class='delete_toggle' rel='{$item->id}'>Delete</a>
        </div>
      </div>".$this->buildMenu($menu, $item->id) . "</li>";
    }
  return $result ?  "\n<ol class=\"dd-list\">\n$result</ol>\n" : null;
}

```

This function uses recursion to display the menu to the user even if the menu is many many levels deep.

### Installation instructions:
- Download this repo
- Set up a MySQL DB named 'shop-menu' and import install.sql file into it, make sure you edit credentials in app/config/database.php to match yours
- Open up terminal and CD into the folder of this repo
- Run "php artisan serve" to run the application
- Open up the browser and navigate to "localhost:8000" to see it in action

### Star this repo!

The more people star my repos - the more I will give back to the community.

### Read more on my blog and follow on Twitter

I post tutorials all the time on my blog : http://maxoffsky.com, stay updated on my Twitter: http://twitter.com/msurguy

### License

The Laravel menu manager is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)


text:
Use the McAfee Threat Intelligence Exchange (TIE) integration to get file reputations and the systems that reference the files.
Connect to McAfee TIE using the McAfee DXL client.
This integration was integrated and tested with version 2.0 of McAfee Threat Intelligence Exchange V2

Some changes have been made that might affect your existing content.
If you are upgrading from a previous version of this integration, see [Breaking Changes](#breaking-changes).

## Detailed Instructions
This section includes information required for configuring an integration instance.
### Prerequisites - Connect to McAfee Threat Intelligence Exchange (TIE) using the DXL TIE Client
To connect the McAfee TIE using the DXL TIE client, you need to create certificates and configure DXL. For more information, see the [documentation](https://xsoar.pan.dev/docs/reference/integrations/mc-afee-dxl#how-to-create-the-rsa-key-pair). After you complete this configuration, you will have the following files:
1. Broker CA certificates (`brokercerts.crt` file)
2. Client certificate (`client.crt` file)
3. Client private key (`client.key` file)
4. Broker list properties file (`brokerlist.properties` file)

**Important**: These are the actual certificates, not request certificates.

### set-file instruction
To use the ***tie-set-file-reputation*** command, you need to authorize the client (Cortex XSOAR) to run the command. Follow the [instructions](https://opendxl.github.io/opendxl-client-python/pydoc/marsendauth.html) to do so. In step 4, instead of selecting **Active Response Server API**, select **TIE Server Set Enterprise Reputation**.

### Dependencies (Python packages)
You don't need to install the packages, they are included in the Docker image.
  - DXL Client [documentation](https://opendxl.github.io/opendxl-client-python/pydoc/dxlclient.client.html)
  - DXL TIE Client [documentation](https://opendxl.github.io/opendxl-tie-client-python/pydoc/dxltieclient.client.html)

## Configure McAfee Threat Intelligence Exchange V2 on Cortex XSOAR

1. Navigate to **Settings** > **Integrations** > **Servers & Services**.
2. Search for McAfee Threat Intelligence Exchange V2.
3. Click **Add instance** to create and configure a new integration instance.

    | **Parameter** | **Description** | **Required** |
    | --- | --- | --- |
    | Broker CA certificates | From \`brokercerts.crt\` file. | True |
    | Client certificates | From \`client.crt\` file. | True |
    | Client private key | From \`client.key\` file. Make sure that the type of the field is not \`encrypted\` when filling it out. | True |
    | Broker URLs | The format should be: `[ssl://]<hostname>[:port]`. Get the hostname and port from the \`brokerlist.properties\` file. The broker should be reachable from Cortex XSOAR server. | True |
    | Source Reliability | Reliability of the source providing the intelligence data. | False |

4. Click **Test** to validate the URLs, token, and connection.
## Commands
You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
### file
***
Retrieves the reputations for the specified hashes. Can be "MD5", "SHA1", or "SHA256".

#### Base Command

`file`
#### Input

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| file | Hashes of the files to query. Supports "MD5", "SHA1", and "SHA256". | Required |

#### Context Output

| **Path** | **Type** | **Description** |
| --- | --- | --- |
| File.Hashes.type | String | The type of the hash. |
| File.Hashes.value | String | The value of the hash. |
| File.MD5 | String | The MD5 hash of the file. |
| File.SHA1 | String | The SHA1 hash of the file. |
| File.SHA256 | String | The SHA256 hash of the file. |
| File.Malicious.Vendor | String | The vendor that reported the file as malicious. |
| File.Malicious.Description | String | A description of why this file was found malicious. |
| DBotScore.Score | Number | The actual score. |
| DBotScore.Vendor | String | The vendor used to calculate the score. |
| DBotScore.Type | String | The indicator type. |
| DBotScore.Indicator | String | The indicator that was tested. |
| DBotScore.Reliability | String | How reliable the score is \(for example, "C - fairly reliable"\). |
| McAfee.TIE.FilesReputations.Reputations.Hash | String | The value of the hash. |
| McAfee.TIE.FilesReputations.Reputations.GTI.Provider_ID | Number | The [identifier](#providers-table) of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.GTI.Trust_Level | Number | The [trust level](#trust-level-table) for the reputation subject. |
| McAfee.TIE.FilesReputations.Reputations.GTI.Create_Date | String | The time this reputation was created (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.GTI.Provider | String | The name of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.GTI.Original_Response | String | The raw response as returned by the Global Threat Intelligence \(GTI\) reputation provider. |
| McAfee.TIE.FilesReputations.Reputations.GTI.First_Contact | String | The time the file was first seen (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.GTI.Prevalence | String | The number of times the file has been requested. |
| McAfee.TIE.FilesReputations.Reputations.ATD.Provider_ID | Number | The [identifier](#providers-table) of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.ATD.Trust_Level | Number | The [trust level](#trust-level-table) for the reputation subject. |
| McAfee.TIE.FilesReputations.Reputations.ATD.Create_Date | String | The time this reputation was created (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.ATD.Provider | String | The name of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.ATD.GAM_Score | String | The [trust score](#atd-trust-score-table) reported by the Gateway Anti-Malware \(GAM\). |
| McAfee.TIE.FilesReputations.Reputations.ATD.AV_Engine_Score | String | The [trust score](#atd-trust-score-table) reported by the Anti-Virus engine. |
| McAfee.TIE.FilesReputations.Reputations.ATD.Sandbox_Score | String | The [trust score](#atd-trust-score-table) as a result of the sandbox evaluation. |
| McAfee.TIE.FilesReputations.Reputations.ATD.Verdict | String | The overall [verdict](#atd-trust-score-table) \(taking into consideration all available information\). |
| McAfee.TIE.FilesReputations.Reputations.ATD.Behaviors | String | An encoded structure that contains observed behaviors of the file. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Provider_ID| Number | The [identifier](#providers-table) of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Trust_Level | Number | The [trust level](#trust-level-table) for the reputation subject. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Create_Date | String | The time this reputation was created (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Provider | String | The name of the particular provider that provided the reputation. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Server_Version | String | The version of the TIE server that returned the reputations \(encoded version string\). |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.First_Contact | String | The time the file was first seen (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Prevalence | String | The number of unique systems that have executed the file. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Enterprise_Size | String | The number of systems within the local enterprise. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Min_Local_Rep | String | The lowest reputation found locally on a system. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Max_Local_Rep | String | The highest reputation found locally on a system. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Avg_Local_Rep | String | The average reputation found locally on systems. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Parent_Min_Local_Rep | String | The lowest reputation for the parent found locally on a system. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Parent_Max_Local_Rep | String | The highest reputation for the parent found locally on a system. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Parent_Avg_Local_Rep | String | The average reputation for the parent found locally on systems. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.File_Name_Count | String | The number of unique file names for the file. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Detection_Count | String | The number of detections for the file or certificate. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Last_Detection_Time | String | The last time a detection occurred (UTC timezone). |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Is_Prevalent | String | Whether the file is considered to be prevalent within the enterprise. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Child_File_Reps | String | The child file reputations \(aggregate string\) according to the following format:
 - The number of files.
- The maximum trust level found across the files.
 - The minimum trust level found across the files.
 - The trust level for the last file.
 - The average trust level across the files. |
| McAfee.TIE.FilesReputations.Reputations.Enterprise.Parent_File_Reps | String | The parent file reputations \(aggregate string\) according to the following format:
 - The number of files.
 - The maximum trust level found across the files.
 - The minimum trust level found across the files.
 - The trust level for the last file.
 - The average trust level across the files. |

### Providers Table
| **Provider** | **Numeric** | **Description** |
| --- | --- | --- |
| GTI | 1 | Global Threat Intelligence (GTI). |
| ENTERPRISE | 3 | Enterprise reputation (specific to the local enterprise). |
| ATD | 5 | McAfee Advanced Threat Defense (ATD). |

### Trust Level Table
| **Trust Level** | **Numeric** | **Description** |
| --- | --- | --- |
| KNOWN_TRUSTED_INSTALLER | 100 | It is a trusted installer. |
| KNOWN_TRUSTED | 99 | It is a trusted file. |
| MOST_LIKELY_TRUSTED | 85 | It is almost certain that the file is trusted. |
| MIGHT_BE_TRUSTED | 70 | It seems to be a benign file. |
| UNKNOWN | 50 | The reputation provider has encountered the file before but the provider can't determine its reputation at the moment. |
| MIGHT_BE_MALICIOUS | 30 | It seems to be a suspicious file. |
| MOST_LIKELY_MALICIOUS | 15 | It is almost certain that the file is malicious. |
| KNOWN_MALICIOUS | 1 | It is a malicious file. |
| NOT_SET | 0 | The file's reputation hasn't been determined yet. |

### ATD Trust Score Table
| **Trust Level** | **Numeric** | **Description** |
| --- | --- | --- |
| KNOWN_TRUSTED | -1 | It is a trusted file. |
| MOST_LIKELY_TRUSTED | 0 | It is almost certain that the file is trusted. |
| MIGHT_BE_TRUSTED | 1 | It seems to be a benign file. |
| UNKNOWN | 2 | The reputation provider has encountered the file before but the provider can't determine its reputation at the moment. |
| MIGHT_BE_MALICIOUS | 3 | It seems to be a suspicious file. |
| MOST_LIKELY_MALICIOUS | 4 | It is almost certain that the file is malicious. |
| KNOWN_MALICIOUS | 5 | It is a malicious file. |
| NOT_SET | -2 | The file's reputation hasn't been determined yet. |

### Command Example
`!file file=f2c7bb8acc97f92e987a2d4087d021b1,7eb0139d2175739b3ccb0d1110067820be6abd29`

#### Context Example
```json
{
    "DBotScore": [
        {
            "Indicator": "f2c7bb8acc97f92e987a2d4087d021b1",
            "Reliability": "C - Fairly reliable",
            "Score": 1,
            "Type": "file",
            "Vendor": "McAfee Threat Intelligence Exchange V2"
        },
        {
            "Indicator": "7eb0139d2175739b3ccb0d1110067820be6abd29",
            "Reliability": "C - Fairly reliable",
            "Score": 3,
            "Type": "file",
            "Vendor": "McAfee Threat Intelligence Exchange V2"
        }
    ],
    "File": [
        {
            "Hashes": [
                {
                    "type": "MD5",
                    "value": "f2c7bb8acc97f92e987a2d4087d021b1"
                }
            ],
            "MD5": "f2c7bb8acc97f92e987a2d4087d021b1"
        },
        {
            "Hashes": [
                {
                    "type": "SHA1",
                    "value": "7eb0139d2175739b3ccb0d1110067820be6abd29"
                }
            ],
            "Malicious": {
                "Description": "Trust level is 1",
                "Vendor": "McAfee Threat Intelligence Exchange V2"
            },
            "SHA1": "7eb0139d2175739b3ccb0d1110067820be6abd29"
        }
    ],
    "McAfee": {
        "TIE": {
            "FilesReputations": [
                {
                    "Reputations": {
                        "Enterprise": {
                            "Create_Date": "2017-10-15 15:33:20",
                            "Enterprise_Size": "167565",
                            "File_Name_Count": "3",
                            "First_Contact": "2017-10-15 15:33:20",
                            "Is_Prevalent": "0",
                            "Prevalence": "4336",
                            "Provider": "Enterprise reputation",
                            "Provider_ID": 3,
                            "Server_Version": "<IP_ADDRESS>0",
                            "Trust_Level": 85
                        },
                        "GTI": {
                            "Create_Date": "2017-10-15 15:33:20",
                            "Original_Response": "2139160704",
                            "Provider": "Global Threat Intelligence (GTI)",
                            "Provider_ID": 1,
                            "Trust_Level": 99
                        },
                        "Hash": "f2c7bb8acc97f92e987a2d4087d021b1"
                    }
                },
                {
                    "Reputations": {
                        "Enterprise": {
                            "Create_Date": "2017-10-15 16:30:54",
                            "Enterprise_Size": "167566",
                            "File_Name_Count": "1",
                            "First_Contact": "2017-10-15 16:30:54",
                            "Is_Prevalent": "0",
                            "Prevalence": "2736",
                            "Provider": "Enterprise reputation",
                            "Provider_ID": 3,
                            "Server_Version": "<IP_ADDRESS>0",
                            "Trust_Level": 1
                        },
                        "GTI": {
                            "Create_Date": "2018-06-04 13:31:02",
                            "Original_Response": "2139160704",
                            "Provider": "Global Threat Intelligence (GTI)",
                            "Provider_ID": 1,
                            "Trust_Level": 99
                        },
                        "Hash": "7eb0139d2175739b3ccb0d1110067820be6abd29"
                    }
                }
            ]
        }
    }
}
```

#### Human Readable Output
### McAfee TIE Hash Reputations For f2c7bb8acc97f92e987a2d4087d021b1:
|Created date|Provider (verbose)|Provider ID|Trust level|Trust level (verbose)|
|---|---|---|---|---|
| 2017-10-15 15:33:20 | Global Threat Intelligence (GTI) | 1 | 99 | KNOWN_TRUSTED |
| 2017-10-15 15:33:20 | Enterprise reputation | 3 | 85 | MOST_LIKELY_TRUSTED |

### McAfee TIE Hash Reputations For 7eb0139d2175739b3ccb0d1110067820be6abd29:
|Created date|Provider (verbose)|Provider ID|Trust level|Trust level (verbose)|
|---|---|---|---|---|
| 2017-10-15 16:30:54 | Enterprise reputation | 3 | 1 | KNOWN_MALICIOUS |
| 2018-06-04 13:31:02 | Global Threat Intelligence (GTI) | 1 | 99 | KNOWN_TRUSTED |

### tie-set-file-reputation
***
Sets the “Enterprise” reputation (trust level, filename, and comment) of the specified hashes. Hashes that represent the same file can have a different "Enterprise" reputation if they are given different reputations. Permissions are required to invoke this method. See the [instruction](#set-file-instruction) section.

#### Base Command

`tie-set-file-reputation`
#### Input

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| file | Hashes of the files for which to set the reputation. Can be "MD5", "SHA1", or "SHA256". | Required |
| trust_level | The new trust level for the files. Possible values are: NOT_SET, KNOWN_MALICIOUS, MOST_LIKELY_MALICIOUS, MIGHT_BE_MALICIOUS, UNKNOWN, MIGHT_BE_TRUSTED, MOST_LIKELY_TRUSTED, KNOWN_TRUSTED, KNOWN_TRUSTED_INSTALLER. | Required |
| filename | A file name to associate with the specified files. | Optional |
| comment | A comment to associate with the specified files. | Optional |

#### Context Output
`There is no context output for this command.`

### Command Example
```!tie-set-file-reputation file=f2c7bb8acc97f92e987a2d4087d021b1,7eb0139d2175739b3ccb0d1110067820be6abd29 trust_level=MOST_LIKELY_TRUSTED comment="For testing" filename="tesing.exe"```

#### Human Readable Output
`Successfully set files reputation.`

### tie-file-references
***
Retrieves the set of systems which have referenced (typically executed) the specified hashes.

#### Base Command

`tie-file-references`
#### Input

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| file | Hashes of the files for which to search. Can be "MD5", "SHA1", or "SHA256". | Required |
| query_limit | The maximum number of results to return. The default and maximum number is 500 results. | Optional |

#### Context Output

| **Path** | **Type** | **Description** |
| --- | --- | --- |
| File.Hashes.type | String | The type of the hash. |
| File.Hashes.value | String | The value of the hash. |
| File.MD5 | String | The MD5 hash of the file. |
| File.SHA1 | String | The SHA1 hash of the file. |
| File.SHA256 | String | The SHA256 hash of the file. |
| McAfee.TIE.FilesReferences.References.AgentGuid | String | The GUID of the system that referenced the file. |
| McAfee.TIE.FilesReferences.References.Date | String | The time the system first referenced the file (UTC timezone). |
| McAfee.TIE.FilesReferences.Hash | String | The value of the hash. |

### Command Example
`!tie-file-references file=f2c7bb8acc97f92e987a2d4087d021b1,7eb0139d2175739b3ccb0d1110067820be6abd29 query_limit=5`

#### Context Example
```json
{
    "File": [
        {
            "Hashes": [
                {
                    "type": "MD5",
                    "value": "f2c7bb8acc97f92e987a2d4087d021b1"
                }
            ],
            "MD5": "f2c7bb8acc97f92e987a2d4087d021b1"
        },
        {
            "Hashes": [
                {
                    "type": "SHA1",
                    "value": "7eb0139d2175739b3ccb0d1110067820be6abd29"
                }
            ],
            "SHA1": "7eb0139d2175739b3ccb0d1110067820be6abd29"
        }
    ],
    "McAfee": {
        "TIE": {
            "FilesReferences": [
                {
                    "Hash": "f2c7bb8acc97f92e987a2d4087d021b1",
                    "References": [
                        {
                            "AgentGuid": "0c906be0-224c-45d4-8e6f-bc89da69d268",
                            "Date": "2017-10-15 15:33:20"
                        },
                        {
                            "AgentGuid": "70be2ee9-7166-413b-b03e-64a48f6ab6c8",
                            "Date": "2017-10-15 15:34:11"
                        },
                        {
                            "AgentGuid": "c21b8995-9c5a-412c-b727-c4284d42380a",
                            "Date": "2017-10-15 16:30:48"
                        },
                        {
                            "AgentGuid": "24e0e935-2241-47d7-822b-20dfe0fe86de",
                            "Date": "2017-10-15 16:30:49"
                        },
                        {
                            "AgentGuid": "e50a8b51-2063-42cb-a85f-10bd0a698323",
                            "Date": "2017-10-15 16:30:51"
                        }
                    ]
                },
                {
                    "Hash": "7eb0139d2175739b3ccb0d1110067820be6abd29",
                    "References": [
                        {
                            "AgentGuid": "157eaf84-88ab-4d95-9456-30878fded9d5",
                            "Date": "2017-10-15 16:30:54"
                        },
                        {
                            "AgentGuid": "0bbcd439-aaed-4931-b9f4-b37e4a49b980",
                            "Date": "2017-10-16 13:28:43"
                        },
                        {
                            "AgentGuid": "f87fb2c3-2032-4fc5-a54f-7d36b441a122",
                            "Date": "2017-10-16 13:28:46"
                        },
                        {
                            "AgentGuid": "33b05a2e-6bb2-46c2-998f-893668c46402",
                            "Date": "2017-10-16 14:12:17"
                        },
                        {
                            "AgentGuid": "99ed15bb-ebc5-4b48-9a4d-5ad1b30abaac",
                            "Date": "2017-10-16 14:14:36"
                        }
                    ]
                }
            ]
        }
    }
}
```

#### Human Readable Output
### References For Hash f2c7bb8acc97f92e987a2d4087d021b1:
|AgentGuid|Date|
|---|---|
| 0c906be0-224c-45d4-8e6f-bc89da69d268 | 2017-10-15 15:33:20 |
| 70be2ee9-7166-413b-b03e-64a48f6ab6c8 | 2017-10-15 15:34:11 |
| c21b8995-9c5a-412c-b727-c4284d42380a | 2017-10-15 16:30:48 |
| 24e0e935-2241-47d7-822b-20dfe0fe86de | 2017-10-15 16:30:49 |
| e50a8b51-2063-42cb-a85f-10bd0a698323 | 2017-10-15 16:30:51 |

### References For Hash 7eb0139d2175739b3ccb0d1110067820be6abd29:
|AgentGuid|Date|
|---|---|
| 157eaf84-88ab-4d95-9456-30878fded9d5 | 2017-10-15 16:30:54 |
| 0bbcd439-aaed-4931-b9f4-b37e4a49b980 | 2017-10-16 13:28:43 |
| f87fb2c3-2032-4fc5-a54f-7d36b441a122 | 2017-10-16 13:28:46 |
| 33b05a2e-6bb2-46c2-998f-893668c46402 | 2017-10-16 14:12:17 |
| 99ed15bb-ebc5-4b48-9a4d-5ad1b30abaac | 2017-10-16 14:14:36 |

## Breaking Changes
The following sections list the changes in this version.
- You can now pass more than one file to the following commands:
   - ***tie-set-file-reputation***
   - ***tie-file-references***
- Added additional context outputs to the following commands:
   - ***file***
   - ***tie-file-references***

repository: demisto/content

repo_name: demisto/content


text:
# Couchbase ORM for Rails

[![Build Status](https://secure.travis-ci.org/acaprojects/couchbase-orm.svg)](http://travis-ci.org/acaprojects/couchbase-orm)

## Rails integration

To generate config you can use `rails generate couchbase_orm:config`:

    $ rails generate couchbase_orm:config dev_bucket dev_user dev_password
      => create  config/couchbase.yml

It will generate this `config/couchbase.yml` for you:

    common: &common
      hosts: localhost
      username: dev_user
      password: dev_password

    development:
      <<: *common
      bucket: dev_bucket

    test:
      <<: *common
      bucket: dev_bucket_test

    # set these environment variables on your production server
    production:
    hosts: <%= ENV['COUCHBASE_HOST'] || ENV['COUCHBASE_HOSTS'] %>
    bucket: <%= ENV['COUCHBASE_BUCKET'] %>
    username: <%= ENV['COUCHBASE_USER'] %>
    password: <%= ENV['COUCHBASE_PASSWORD'] %>

Views are generated on application load if they don't exist or mismatch.
This works fine in production however by default in development models are lazy loaded.

    # config/environments/development.rb
    config.eager_load = true

## Examples

```ruby
    require 'couchbase-orm'

    class Post < CouchbaseOrm::Base
      attribute :title, type: String
      attribute :body,  type: String
      attribute :draft, type: Boolean
    end

    p = Post.new(id: 'hello-world',
                 title: 'Hello world',
                 draft: true)
    p.save
    p = Post.find('hello-world')
    p.body = "Once upon the times...."
    p.save
    p.update(draft: false)
    Post.bucket.get('hello-world')  #=> {"title"=>"Hello world", "draft"=>false,
                                    #    "body"=>"Once upon the times...."}
```

You can also let the library generate the unique identifier for you:

```ruby
    p = Post.create(title: 'How to generate ID',
                    body: 'Open up the editor...')
    p.id        #=> "post-abcDE34"
```

You can define connection options on per model basis:

```ruby
    class Post < CouchbaseOrm::Base
      attribute :title, type: String
      attribute :body,  type: String
      attribute :draft, type: Boolean

      connect bucket: 'blog', password: ENV['BLOG_BUCKET_PASSWORD']
    end
```

## Validations

There are all methods from ActiveModel::Validations accessible in
context of rails application. You can also enforce types using ruby
[conversion methods](http://www.virtuouscode.com/2012/05/07/a-ruby-conversion-idiom/)

```ruby
    class Comment < Couchbase::Model
      attribute :author, :body, type: String

      validates_presence_of :author, :body
    end
```

## Views (aka Map/Reduce indexes)

Views are defined in the model and typically just emit an attribute that
can then be used for filtering results or ordering.

```ruby
    class Comment < CouchbaseOrm::Base
      attribute :author, :body, type: String
      view :all # => emits :id and will return all comments
      view :by_author, emit_key: :author

      # Generates two functions:
      # * the by_author view above
      # * def find_by_author(author); end
      index_view :author

      # You can make compound keys by passing an array to :emit_key
      # this allow to query by read/unread comments
      view :by_read, emit_key: [:user_id, :read]
      # this allow to query by view_count
      view :by_view_count, emit_key: [:user_id, :view_count]

      validates_presence_of :author, :body
    end
```

You can use `Comment.find_by_author('name')` to obtain all the comments by
a particular author. The same thing, using the view directly would be:
`Comment.by_author(key: 'name')`

When using a compound key, the usage is the same, you just give the full key :

```ruby
   Comment.by_read(key: '["'+user_id+'",false]') # gives all unread comments for one particular user

   # or even a range !

   Comment.by_view_count(startkey: '["'+user_id+'",10]', endkey: '["'+user_id+'",20]') # gives all comments that have been seen more than 10 times but less than 20
```

Check this couchbase help page to learn more on what's possible with compound keys : https://developer.couchbase.com/documentation/server/3.x/admin/Views/views-translateSQL.html

Ex : Compound keys allows to decide the order of the results, and you can reverse it by passing `descending: true`

## Associations and Indexes

There are common active record helpers available for use `belongs_to` and `has_many`

```ruby
    class Comment < CouchbaseOrm::Base
        belongs_to :author
    end

    class Author < CouchbaseOrm::Base
        has_many :comments, dependent: :destroy

        # You can ensure an attribute is unique for this model
        attribute :email, type: String
        ensure_unique :email
    end
```

## Performance Comparison with Couchbase-Ruby-Model

Basically we migrated an application from [Couchbase Ruby Model](https://github.com/couchbase/couchbase-ruby-model)
to [Couchbase-ORM](https://github.com/acaprojects/couchbase-orm) (this project)

* Rails 5 production
* Puma as the webserver
* Running on a 2015 Macbook Pro
* Performance test: `siege -c250 -r10  http://localhost:3000/auth/authority`

The request above pulls the same database document each time and returns it. A simple O(1) operation.

| Stat | Couchbase Ruby Model | Couchbase-ORM |
| :--- | :---                 |   :---        |
|Transactions|2500 hits|2500 hits|
|Elapsed time|12.24 secs|6.82 secs|
|Response time|0.88 secs|0.34 secs|
|Transaction rate|204.25 trans/sec|366.57 trans/sec|
|Request Code|[ruby-model-app](https://github.com/QuayPay/coauth/blob/95bbf5e5c3b3340e5af2da494b90c91c5e3d6eaa/app/controllers/auth/authorities_controller.rb#L6)|[couch-orm-app](https://github.com/QuayPay/coauth/blob/87f6fdeaab784ba252a5d38bbcf9e6b0477bb504/app/controllers/auth/authorities_controller.rb#L8)|

repository: acaprojects/couchbase-orm

gha_language: Ruby

gha_license_id: NOASSERTION

repo_name: acaprojects/couchbase-orm


text:
+++
Description = ""
Tags = ["Development", "Haskell"]
date = "2015-10-13T10:46:54+02:00"
title = "Foldable for non-Haskellers: Haskell's controversial FTP proposal"
+++

In the Haskell world, there is currently a big fuss about
[the "Foldable/Traversable in Prelude"-proposal](https://wiki.haskell.org/Foldable_Traversable_In_Prelude).

**Edit:** For the record: it **was** a proposal, and has been implemented in the current version of Haskell (GHC)

As a non-Haskeller, you probably wonder what all the fuss is about.

## First things first: some context

In most languages, you have functions to iterate over a `sequence` / `array` / `iterable` / `list`, for example in C# (assuming we have an array called `values`)

```C#
int[] values = new int[] {1, 2, 3};

foreach(var v in values) {
  Console.WriteLine(v);
}
```

In Haskell, we usually refer to an `sequence` with a `list`, and the example code would look like this:

```Haskell
values = [1,2,3]

mapM_ print values
```

Let's say we need a function that concatenates several sequences of the type `a`.

In somewhat contrived C# we would write it like this (assuming we use arrays):

```C#
static Ta[] Concat<Ta>(Ta[][] values) {
    var res = new Ta[]{};
    foreach(var v in values) {
        res = res.Concat(v).ToArray();
    }
    return res;
}

int[][] values = new int[][] {
    new int[] {1, 2, 3},
    new int[] {4, 5, 6}
};

Concat(values);
// results in [1,2,3,4,5,6]
```
In Haskell we'd write it like this:

```Haskell
values :: [[Int]]
values = [[1,2,3],[4,5,6]]

concat :: [[a]] -> [a]
concat vals = foldr (\val acc -> val ++ acc) [] vals

concat values
-- results in [1,2,3,4,5,6]
```
> ### Optional reading: type definitions
>
> The odd `someName :: a -> b -> c` you see on top of the function implementations is a type definition.
>
> - The thing before the `::` defines the name of the function
> - The last term defines the type of return value.
> - Other terms define type of the function's parameters.
>
> A few examples:
>
> - `value :: Int`
>    - Takes no input
>    - Returns a value of the type `Int`
>    - Example: `value = 5`
> - `values :: [Int]`
>    - Takes no input
>    - Returns a `list` of values of the type `Int`
>    - Example: `values = [1,2,3]`
> - `values :: [[Int]]`
>    - Takes no input
>    - Returns a `list` of a `list` of values of the type `Int`
>    - Example: `values = [[1,2,3],[4,5,6]]`
> - `decrement :: Int -> Int`
>   - Takes a parameter of the type `Int`
>   - Returns a value of the type `Int`
>   - Example: `decrement x = x - 1`
> - `add :: Int -> Int -> Int`
>   - Takes two parameters of the type `Int`
>   - Returns a value of the type `Int`
>   - Example: `addTwoInts x y = x + y`
> - `length :: [a] -> Int`
>   - Takes a `list` of `a` where `a` can be any type
>   - Returns a value of the type `Int`
>   - This function works on any `list`, no matter which is the type of `a`:
>       - `length [4,5,6]` returns `3`
>       - `length ['a','b','c']` also returns `3`
>       - `length "abc"` also returns `3`, as a `String` is a synonym for a `list` of `Char`
> - `decrement :: Num a => a -> a`
>   - Requires a type `a` to implement the `Num` type class.
>      - A `type class` is somewhat similar to an `interface` in other languages.
>      - The type class `Num` implements arithmetic operators for the type.
>   - Takes a parameter of the type `a`
>   - Returns a value of the type `a`
>   - Example: `decrement x = x - 1`.
>
>Now back to the main content...

## What is a `Foldable` anyway

Notice that in the Haskell example the `concat` function is defined for a `list` of `lists`, i.e. `concat :: [[a]] -> [a]`.

There is a well known functional paradigm called a `fold`, which allows you to convert something that has multiple values into a single value.

Let's take the example of a `sum`:

- Starts with an initial `accumulator` value of `0`
- Adds each of the sequence's `values` one by one to the `accumulator`
- returns the final `accumulator`.

This would be the code:

```Haskell
sum :: Num a => [a] -> a
sum vals = foldl (\acc val -> acc + val) 0 vals

product :: Num a => [a] -> a
product vals = foldl (\acc val -> acc * val) 1 vals
```

Now, imagine that you have a `binary tree structure` where a `node` contains either:

- a node with a left and a right child node
- a leaf with a value
- an empty node:

```Haskell
data Tree a = Node (Tree a) (Tree a)
            | Leaf a
            | Empty
```

And that you need to get the sum and product for all these leaves. This goes as follows:

- `acc` refers to `the currently accumulated value`
- `ln` refers to a `left child node`
- `rn` refers to a `right child node`
- `val` refers to a `value of a leaf node`

If it's a `node`, the `XXXacc` recursively calls itself to add or multiply it's children's values,
if it's a leaf, it just adds/multiplies the value with the accumulator.

```Haskell
sum :: Num a => Tree a -> a
sum tree = sumAcc tree 0
  where
    sumAcc node acc =
      case node of
        Leaf val   -> acc + val
        Node ln rn -> acc + (sumAcc ln) + (sumAcc rn)
        Empty      -> acc

prod :: Num a => Tree a -> a
prod tree = prodAcc tree 1
  where
    prodAcc node acc =
      case node of
        Leaf val   -> acc * val
        Node ln rn -> acc * (prodAcc ln) * (prodAcc rn)
        Empty      -> acc
```

You might see a pattern here. Haskellers **hate** copy paste programming, so they extract what is common.

If you take a look at what is common and different, you see only two differences:

- We use `+` and `*`
- We start from `0` and `1`

So a Haskeller would extract this functionality, and as this is a common pattern, we'd call it a `Foldable` type class instance. Code would look like this

```Haskell
data Tree a = Node (Tree a) (Tree a)
            | Leaf a
            | Empty

instance Foldable Tree where
  -- some code here

sum :: Num a => Tree a -> a
sum tree = foldl (\acc val -> acc + val) 0 tree

prod :: Num a => Tree a -> a
prod tree = foldl (\acc val -> acc * val) 1 tree
```

> ### Optional reading: cleaning up Haskell code
>
> Even though this is compilable Haskell code, and the program would work, you would never see
> Haskell code like this in the wild. Haskellers apply some concepts to make the source
> code even leaner to read; let me show you how:
>
> - Let's take a look at this expression:
>   - `sum tree = foldl (\acc val -> acc + val) 0 tree`
> - The type declaration is `sum :: Num a => Tree a -> a` so we know the function
>     - Requires `a` to implement the `Num` type class.
>     - Takes a `Tree` that contains values of the type `a`
>     - Returns a value of the type `a`
> - In Haskell you can "convert operators into functions" by putting parenthesis around them, so
>   - `\acc val -> acc + val` is equivalent to  `\acc val -> (+) acc val`
>   - The type for this accumulator function is `Num a => a -> a -> a`
> - As both parameters now have the same order, we can apply a concept called currying (i.e. omit the last parameters if they are the same), so
>   - `\acc val ->  (+) acc val` is equivalent to `\acc -> (+) acc`.
>   - The type for this accumulator function remains `Num a => a -> a -> a`
> - we curry it once more, so
>   - `\acc ->  (+) acc` is equivalent to `\ -> (+)`.
>   - The type for this accumulator function remains `Num a => a -> a -> a`
> - Calling a function with no parameters is the same as calling the function directly, so
>   - `\ -> (+)` is equivalent to `(+)`
>   - The type for this accumulator function remains `Num a => a -> a -> a`
> - Replacing this in the original declaration, we now we end up with
>   - `sum tree = foldl (+) 0 tree`
>   - The type declaration still is `sum :: Num a => Tree a -> a`
> - As the function's parameters are similar once again, we can omit the `tree` part, so
>   - `sum tree = foldl (+) 0 tree` is equivalent to `sum = foldl (+) 0`
>   - The type declaration still is `sum :: Num a => Tree a -> a`
>
> So a Haskeller would most likely end up with the following code, while maintaining the same types:
>
>
> ```Haskell
>data Tree a = Node (Tree a) (Tree a)
>            | Leaf a
>            | Empty
>
>instance Foldable Tree where
>  -- some code here
>
>sum :: Num a => Tree a -> a
>sum = foldl (+) 0
>
>prod :: Num a => Tree a -> a
>prod = foldl (*) 1
>```

>
> #### This has one important consequence when you are doing Haskell:
> In order to figure out what parameters a function requires, you need to look at it's type
declaration, and not at the implementation.
>
>So both the `sum` and the `product` take a `Tree` of `a`, and return an `a`, where `a` implements the `Num` type class. This is the reason why Haskellers care so much about type definitions.

## Back to the controversial `FTP`-proposal

Haskell works with a system they call `modules` (referred to as `namespaces` in other languages).

By default, Haskell applications import a module called `Prelude`, which contains a lot of handy helper functions, for example the `sum` function we mentioned in the beginning :

```Haskell
sum :: Num a => [a] -> a
sum = foldl (+) 0
```

Now, as Haskellers do not only want to use `sum` on a `list`, but also on any `Foldable` instance, they decided to change the type signature to this:

```Haskell
sum :: (Foldable t, Num a) => t a -> a
sum = foldl (+) 0
```
Because there exists a `Foldable` instance for a  `list`, we can use the "Foldable `sum`" function, and remove the `sum` function that only works on lists.

## So what is controversial about this proposal?

People come from different backgrounds. When you talk about a `list`, people new in Haskell think about a sequence, and they can imagine what is happening.

However, due to the new signature (i.e. the `Foldable` thing), people new to Haskell might have a hard time to get started with Haskell, because they need to learn about
the concept of `Foldable` first, so the barrier of entry is getting larger.

In my opinion, it might be a little harder to grasp at first, but if, as a beginner, you are willing to just accept a few things without knowing why they are like they are,
the barrier to entry shouldn't be much higher than before.

### UPDATE

I assumed I understood what all the fuss was about, but apparently I did not. Luckily, [@bitemyapp](https://twitter.com/bitemyapp) went the extra mile to explain while it was wrong:

Either and (,) in Haskell are not arbitrary

https://t.co/2yJ1NBjMvS
— Chris Allen (@bitemyapp) 20 oktober 2015

I'd suggest you to read his article, but I'll give you the recap here:

Next to a `Foldable`, we also have a `Functor`. A `Functor` is something that you can `map over`, a structure that contains zero, one or more values. An example in GHCI:

```Haskell
Prelude> let inc = (1 +)
Prelude> inc 5
6
Prelude> fmap inc [1,2,3]
[2,3,4]
Prelude> fmap inc (Just 5)
Just 6
Prelude> fmap inc Nothing
Nothing
Prelude> fmap inc (Right 4)
Right 5
Prelude> fmap inc (Left 3)
Left 3
```

Just think of this as a `map` or `select (C#)` statement. In the example above we have the following statements:

- `let inc = (1 +)`
  - is of the type `inc :: Num a => a -> a`, so it takes a `Num` instance, and adds `1` to it?
- `inc 5`
  - returns `6`
- `fmap inc [1,2,3]`
  - returns `[2,3,4]`
  - the container is a `List`, and the values in the list are `Num` instances.
  - the type signature for `fmap` is : `fmap (a->b) -> [a] -> [b]`
  - `fmap` takes a transformation function and a list, and returns a `List` containing the transformed values in the same order.
  - For a `list`, Haskell's `fmap` is equivalent to `map`, which is equivalent to a C# `select` statement.
  - In C#, `fmap` could be implemented for a list as `List<Tb> fmap<Ta,Tb>(Func<Ta,Tb> transform,List<Ta> list) => list.Select(transform).ToList()`.
  - `Bifunctors`:
    - The `Maybe` type is a type that either represents a value or nothing.
      - this type was introduced to avoid null checking in all of your code.
      - values are represented using `Just a` where a can be any value.
      - nothing is represented using `Nothing`.
      - when you want to change the value of a `Maybe`, you typically only want to change it, when it contains a value. If it does not contain a value, you just want to do nothing with it.
      - how do we change the value of something in a container when using Haskell? Exactly: using `fmap`
      - `fmap inc (Just 5)`
        - returns `Just 6`, so it applied the `inc` function to the value of the `Maybe`
      - `fmap inc Nothing`
        - returns `Nothing`, because it doesn't make any sense to apply changes to a "null value"
      - let's say we have a var called `maybeVal`, that has the type `Maybe Num`, so it is either `Nothing` or `Just x` where x is a number.
      - if we want to either increment the value if it's defined, or just return a `0` if it is not, we could do it like this:
      - `maybe 0 inc maybeVal`
        - if `maybeVal` is `Nothing` it uses the first argument : `0`
           - `maybe 0 inc Nothing` returns `0`
        - if `maybeVal` has a value (`Just 5`), it applies the `inc` function to the value and returns that value, i.e. `6`
          - `maybe 0 inc (Just 5)` returns `6`
        - `fmap` is the `Functor` implementation, `maybe` is the `Bifunctor` implementation.
    - the `Either` type
      - Now, avoiding `null` checks everywhere is fun and all, but what if you would like to return some kind of error message in case a value is not defined?
      - For this we have the `Either a b` type, that can return 2 different types:
        - It can `Left a`, where `Left a` is typically an error message
        - It can return a `Right b`, where `Right b` is similar to a `Just b`, so this contains the value.
        - Let's say we have a function to parse a `date` from a `string`. We want it to return either the date, or an error message.
          - this would be the type of the function: `parseDateFromString :: String -> Either Error Date`
          - this would be equivalent to `Either<Error,Date> parseDateFromString(String)`
          - in case there is a problem with the parsing we'd get return value like this: `Left (Error "Invalid date format; expected YYYY/MM/DD")`
          - in case there is no problem  with the parsing we'd get the value like this: `Right (Date 2015 10 20)`
        - What if we would like to print the year if it's a valid year, or display the error when it is not? Let's assume we have a value `eitherErrorOrDate`
          - we would call `either displayError printYear eitherErrorOrDate`
            - the type of `eitherErrorOrDate` would be `Either Error Date`
            - for now, just take my word for it: a type of `IO ()` means: `something that interacted with the outside world, but didn't return any value`
            - the type of the function `displayError` would be `Error -> IO ()`, so it takes an error, and implies a changed world when executed.
            - the type of the function `printYear` would be `Date -> IO ()`, so it takes an error, and implies a changed world when executed.

### Now what's wrong with the controversial FTP proposal:

In a `Maybe` or an `Either`, it makes sense that you only want to `map` to the `Just` value or the `Right` value.

Now, let's say you have a `Tuple`, and would map over this:

- A tuple has the type `(a,b)`
- So when you `fmap` `inc` over `(1,2)`, you'd expect a `(2,3)`, correct?
- Well, you don't : GHCI returns a `(1,3)`
- This is because a tuple can contain 2 different types, f.e. `("Hello",4)`
- As an `fmap` can only take one type as an input parameter, they decided to go for the second element, so `fmap inc ("Hello",4)` returns `("Hello", 5)`.
- This doesn't make sense, as the first element might be just as important in a tuple as the other, so this shouldn't have been a `Functor` in the first place.

Thank you Chris for taking the time to explain this!

gha_language: JavaScript


text:
Updating dependencies
=====================

This project uses [bower][bower] for package management of js and css libraries.

The installed dependencies are checked in to git as well, and can be found in
the ```bower_components/``` folder.

To update a depencency to a newer version, use bower:

    bower install packagename#version -S

(You might get prompted about conflicts, accept the new version and persist)

To find the name of an installed dependency, see ```/bower.json```.

Known issues:
-------------
Some of the packages does not contain minified versions, and in order to build
```dist/scripts_external.js```, these libraries had to be minified manually.
On upgrade these minified files will be lost, and stuff wil break.

This affects the following libraries:

- Leaflet.TileLayer.PouchDBCached
- esri2geo
- leaflet-sidebar
- togeojson
- wellknown
- CryptoJS
- jquery-touchswipe
- EasyButton

To re-create the minified versions for these, you have to use uglifyjs from the
command line. Install it with

    npm install forever -g

and, in order to re-create the minified version of esri2geo

    cd bower_components
    cd esri2geo
    uglifyjs esri2geo.js > esri2geo.min.js

###Audiojs
Audio js uses relative links to graphics and fallback flash, this breaks when
combining. Make sure to add these lines:

    audiojs.settings.imageLocation = "../bower_components/audiojs/audiojs/player-graphics.gif";
    audiojs.settings.swfLocation = '../bower_components/audiojs/audiojs/audiojs.swf';

to the bottom of ```bower_components/audiojs/audiojs/audio.min.js``` if updating this library

[bower]: http://bower.io

repository: delving/demonstratorer

repo_name: delving/demonstratorer


text:
CCLabelBMFontAnimated
=====================

CCLabelBMFontAnimated is a label class for Cocos2d-x, inheriting for LabelBMFont. The primary feature of this class is to easily enable the running of Cocos2d actions on the individual letters of a label.

Actions can be run on an individual letter, on all letters simultaneously, on each letter sequentially, or on each letter sequentially in reverse. When running actions sequentially, a duration can be specified.

There is also the option to get the label to remove itself on completion of the action (useful, for instance, if the action is a fly past, or animate out), and also the option to pass in a CallFunc action, to be executed when the full action has completed.

See the following YouTube video for an example of what can be done with this class: http://youtu.be/Ku8kq8CY_vk

Copyright (c) 2015 Steve Barnegren

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: Coody/CCLabelBMFontAnimated

repo_name: Coody/CCLabelBMFontAnimated


text:
A library for simulating rolling dice in FFG's Imperial Assault.

## Usage

A simple usage example:

```dart
import 'package:imperial_assault_dice/imperial_assault_dice.dart';

main() {
  var calculator = new DiceCalculator([new RedDie(), new YellowDie()], [new BlackDie()]);

  var result = calculator.Simulate(30);
  print(result);

  var redDie = new RedDie();
  print(redDie.roll());
}
```

## Features and bugs

Please file feature requests and bugs at the [issue tracker][tracker].

[tracker]: https://github.com/arranf/Imperial-Assault-Dice/issues

repository: arranf/Imperial-Assault-Dice

repo_name: arranf/Imperial-Assault-Dice


text:
---
type: rule
archivedreason: Merged with https://www.ssw.com.au/rules/do-you-use-indentation-for-readability
title: Do you use > and indentation to keep the context?
guid: 60f5de4c-c42c-41ff-8e48-3646b4347e31
uri: do-you-use-and-indentation-to-keep-the-context
created: 2009-03-31T02:23:50.0000000Z
authors:
- title: Adam Cogan
  url: https://ssw.com.au/people/adam-cogan
- title: Cameron Shaw
  url: https://ssw.com.au/people/cameron-shaw
- title: Paul Neumeyer
  url: https://ssw.com.au/people/paul-neumeyer
- title: Tiago Araujo
  url: https://ssw.com.au/people/tiago-araujo
related: []
redirects: []

---

Electronic communication can easily cause misunderstandings. Help the reader understand your message better by:

* Keeping the prior email in your reply
* When quoting text from someone else (e.g. The original email you are replying to, a web page, etc.), use the “>” and indentation. Your new text should be kept to the left. When quoting text on web pages, always include a link to the web page.
* Add numbers if the sender didn't
* Optionally, use a different text color in your reply

<!--endintro-->

This way you won't forget any questions in the original email.

::: greybox
Please change from X to Y
The program flow logic worries me a bit
Done. Sorry, this wasn't a final decision - I just put it there for testing purposes
:::

::: bad
Figure: Bad Example - there's too much information here

:::

::: greybox
     > 1. Please change from X to Y
Done, I made the changes - <add a link to the page or a screenshot>

     > 2. The program flow logic worries me a bit
Sorry, this wasn't a final decision - I just put it there for testing purposes
:::

::: good
Figure: Good Example - You can clearly see the context of each part of the reply

:::

**Note:** For those using mobile devices the indentation function is not available, try instead using 3 spaces to indent manually.

**Video:**  [Top 10+ Rules to Better Email Communication with Ulysses Maclaren](https://www.youtube.com/watch?v=LAqRokqq4jI)

branch_name: refs/heads/main


text:
# A collection of Ubuntu Scopes (DEPRECATED - ABANDONED)

**Public**
1. [Softpedia Linux RSS Scope](https://github.com/dofishswim/scopes/tree/master/softpedia)
2. [Euronews RSS Scope](https://github.com/dofishswim/scopes/tree/master/euronews)
3. [Vice News RSS Scope](https://github.com/dofishswim/scopes/tree/master/vicenews)

**Personal**
1. [Cryptik RSS Scope](https://github.com/dofishswim/scopes/tree/master/cryptik)

repository: dofishswim/scopes

repo_name: dofishswim/scopes


text:
# C# mysql connection over ssh

## What's this?

It's a proof of concept C# application that connects to a remote MySQL database over a port forwarded SSH connection.

It uses the mysql employee example database running in a docker instance (you can also manually set this up if you wish, but docker is generally faster and easier).

The example can read data from the remote DB and send back table updates to the MySQL server.

## How does it work?
- It starts up and makes an ssh connection with a port forward to the DB.
- kicks off the main application window.
- makes a MySQL connection over the SSH port forward
- creates a MySqlDataAdapter with a simple query
- Connects a DataGridView through a MySqlDataAdapter

## How to run this

### Machines
You need a linux box, or virtual linux box to run this, plus your development machine.

### Mysql setup

#### The easy way
The easiest way is to use docker to setup a running mysql DB with the mysql example employee database

On your remote system install docker, then pull the required mysql server docker file.

```bash
docker pull genschsa/mysql-employee
```

Now run the server.

```bash
docker run -d   --name mysql-employees   -p 53306:3306   -e MYSQL_ROOT_PASSWORD=college   -v $PWD/data:/var/lib/mysql   genschsa/mysql-employees
```

***Note: we are using port 53306 not to conflict with any other running mysql instances ***

#### The Manual way
Add the mysql employees sample data to your system, and add a user to access it.

### Server user setup
Add a user to your system that we can access over ssh

```bash
useradd -m CSAppWithSshDB
```

Set the users password.
```bash
passwd CSAppWithSshDB
```
You can set the password to whatever you like, but by default the code is expecting you to use "how23do44ssh67blanket"

### Changing credentials in the code
MySQL credentials are stored in the comms.db.MysqlConnectionParams class.
SSH connection credentials are stored in the comms.ssh.SshConnParams class.

## License
This example code is licensed under the MIT License.


text:
## User stories:
* User opens applications and is presented with a search box and an alternative to view all deals (not done)
* User can view list of hotels (done)
* User can see deals in a list view and map view (not done)
* User can filter hotels by controls provided at left side of screen (done)
* User can reset view (not done)

## Development process:
* Define stories (above)
* Refine functionality neccessary on backend side to fetch the data needed for the story
* Write tests then write functions
* Make sure tests pass
* Repeat on frontend
* After story is complete, publish and set version number
* Deploy to heroku

## Features
* View Deals in an appealing manner
* Filter results according to star rating, destination, and maximum rate.
* Application consumes Expedia API with a call from server-side

## General Use
* Visit homepage
* You will routed to deals page
* Scroll down to see deals
* Fill in filter details in left and view filtered results

## Meet The Engineers
* Author: Salah Alomari

## Work done:
### Files:
* client: contains all the app js and html files
** app/services: backend services
** app/filterView: Filter container template and controller
** app/listView: Hotel Deals page template and controller
** app/app.js: main app file, contains routing, http interceptors, and where the main modules are loaded
** index.html: main page
** styles: contains styling files
* server:
** specs: tests
** services: to handle REST http requests
** controllers: to handle client side requests and works as a hub between router and services
** config: middleware, router, helpers
** Gulpfile: builder
** Procfile: neccessary for heroku

### Design:
* The design was based on bootstrap, fontawesome, and bootswatch for themes
* I wanted to deliver a clean minimal design with a clean look and interactive options

gha_language: CSS


text:
---
date: "2022-09-17 07:12:09"
title: "Creating three international Skinny Guardian editions"
categories: ["web"]
sub: You can now view UK, US or Australian versions of the last 50 Guardian articles.
hide-from-twitter: false
twitter-note: "''"
---

[Skinny Guardian](https://www.skinnyguardian.xyz) was initially an experiment in getting Jekyll to publish a static site using external data, while producing a paper that I would find easy to read online. As I’m not particularly interested in US or Australian articles, I filtered them out.

However, it’s easy to grab a list of articles filtered by production office, so, in the interests of making it more useful, you can now read [UK](https://www.skinnyguardian.xyz), [Australian](https://www.skinnyguardian.xyz/au) and [US](https://www.skinnyguardian.xyz/us) editions.

The real challenge was figuring out a site structure and navigation that:

* allows you to easily choose an edition
* makes it clear which edition the article you’re reading belongs in
* presents a home page that lists articles rather than a choice of editions
* uses space efficiently on a mobile

I _think_ the flag navigation and choice of a default, UK edition works well. If you’ve got any feedback, just leave a comment.

repository: eklausme/saaze-paternoster

repo_name: eklausme/saaze-paternoster


text:
nodejs-request-promise-api
==========================
Here's an example of a promise-enabled Node.js API Proxy ready to be deployed in Apigee.

#### Why promises?
Node.js promises subject has been documented extensively by many tutorials online. So, it's out of the scope of this sample to explain the (why)[https://alexperry.io/node/2015/03/25/promises-in-node.html] here. However, I noticed there are few examples of Apigee API Proxies explained with working code. So, I decided to write rather a contrived example to be used as a reference for new developers coming to the platform. So, next time they need to write one, you don't have to start from scratch. Hope it helps!

#### Show me the code?
```javascript
var express = require('express')
    app = express(),
    request = require('request'),
    url = require('url'),
    promise = require('bluebird'), // you'll need bluebird or other module to convert callbacks to promises
    request = promise.promisify(require('request')); // promisify the request module

app.get('/*', function (req, res) {
  var query = url.parse(req.url).query; //get query params from url
  request('http://lyrics.wikia.com/api.php?' + query) // use promisified request module
    .then(function (response) { //this is way clean than using callbacks!
      res.json(JSON.parse(response.body));
    })
    .catch(function (err) {
      res.send(err);
    })
})
```

#### How can I deploy this API Proxy?

##### deploy with Deploy Now
Deploy this Node.js app to Apigee with a single click, click below:

##### deploy with apigeetool
The following command will deploy this Node.js App to Apigee.
`apigeetool deploynodeapp  -u $ae_username -p $ae_password -o testmyapi -e test -n music-nodejs-request-promise-api -d . -m app.js -b /music-nodejs-request-promise-api -v default -V -U`

#### How can I test this API Proxy?
Call this API by using this sample URL:
```
$ curl "http://testmyapi-test.apigee.net/music-nodejs-request-promise-api?action=lyrics&artist=radiohead&fmt=json"

Response:
{
  "artist": "Radiohead",
  "albums": [
    {
      "album": "Pablo Honey",
      "year": "1993",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Pablo%20Honey",
      "songs": [
        "You",
        "Creep",
        "How Do You?",
        "Stop Whispering",
        "Thinking About You",
        "Anyone Can Play Guitar",
        "Ripcord",
        "Vegetable",
        "Prove Yourself",
        "I Can't",
        "Lurgee",
        "Blow Out",
        "Creep (Clean)"
      ]
    },
    {
      "album": "Itch",
      "year": "1994",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Itch",
      "songs": [
        "Stop Whispering",
        "Thinking About You",
        "Faithless, The Wonder Boy",
        "Banana Co.",
        "Killer Cars",
        "Vegetable",
        "You",
        "Creep"
      ]
    },
    {
      "album": "My Iron Lung",
      "year": "1994",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20My%20Iron%20Lung",
      "songs": [
        "My Iron Lung",
        "The Trickster",
        "Lewis (Mistreated)",
        "Punchdrunk Lovesick Singalong",
        "Permanent Daylight",
        "Lozenge Of Love",
        "You Never Wash Up After Yourself",
        "Creep"
      ]
    },
    {
      "album": "The Bends",
      "year": "1995",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20The%20Bends",
      "songs": [
        "Planet Telex",
        "The Bends",
        "High And Dry",
        "Fake Plastic Trees",
        "Bones",
        "(Nice Dream)",
        "Just",
        "My Iron Lung",
        "Bullet Proof..I Wish I Was",
        "Black Star",
        "Sulk",
        "Street Spirit (Fade Out)"
      ]
    },
    {
      "album": "OK Computer",
      "year": "1997",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20OK%20Computer",
      "songs": [
        "Airbag",
        "Paranoid Android",
        "Subterranean Homesick Alien",
        "Exit Music (For A Film)",
        "Let Down",
        "Karma Police",
        "Fitter Happier",
        "Electioneering",
        "Climbing Up The Walls",
        "No Surprises",
        "Lucky",
        "The Tourist"
      ]
    },
    {
      "album": "No Surprises/Running From Demons",
      "year": "1997",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20No%20Surprises/Running%20From%20Demons",
      "songs": [
        "No Surprises",
        "Pearly*",
        "Melatonin",
        "Meeting In The Aisle",
        "Bishop's Robes",
        "A Reminder"
      ]
    },
    {
      "album": "Airbag/How Am I Driving?",
      "year": "1998",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Airbag/How%20Am%20I%20Driving?",
      "songs": [
        "Airbag",
        "Pearly*",
        "Meeting In The Aisle",
        "A Reminder",
        "Polyethylene (Parts 1 & 2)",
        "Melatonin",
        "Palo Alto"
      ]
    },
    {
      "album": "Kid A",
      "year": "2000",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Kid%20A",
      "songs": [
        "Everything In Its Right Place",
        "Kid A",
        "The National Anthem",
        "How To Disappear Completely",
        "Treefingers",
        "Optimistic",
        "In Limbo",
        "Idioteque",
        "Morning Bell",
        "Motion Picture Soundtrack"
      ]
    },
    {
      "album": "Amnesiac",
      "year": "2001",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Amnesiac",
      "songs": [
        "Packt Like Sardines In A Crushd Tin Box",
        "Pyramid Song",
        "Pulk/Pull Revolving Doors",
        "You And Whose Army?",
        "I Might Be Wrong",
        "Knives Out",
        "Morning Bell/Amnesiac",
        "Dollars & Cents",
        "Hunting Bears",
        "Like Spinning Plates",
        "Life In A Glasshouse"
      ]
    },
    {
      "album": "Hail To The Thief",
      "year": "2003",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Hail%20To%20The%20Thief",
      "songs": [
        "2 + 2 = 5 (The Lukewarm.)",
        "Sit Down. Stand Up. (Snakes & Ladders.)",
        "Sail To The Moon. (Brush The Cobwebs Out Of The Sky.)",
        "Backdrifts. (Honeymoon Is Over.)",
        "Go To Sleep. (Little Man Being Erased.)",
        "Where I End And You Begin. (The Sky Is Falling In.)",
        "We Suck Young Blood. (Your Time Is Up.)",
        "The Gloaming. (Softly Open Our Mouths In The Cold.)",
        "There There. (The Boney King Of Nowhere.)",
        "I Will. (No Man's Land.)",
        "A Punchup At A Wedding. (No No No No No No No No.)",
        "Myxomatosis. (Judge, Jury & Executioner.)",
        "Scatterbrain. (As Dead As Leaves.)",
        "A Wolf At The Door. (It Girl. Rag Doll.)"
      ]
    },
    {
      "album": "In Rainbows",
      "year": "2007",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20In%20Rainbows",
      "songs": [
        "15 Step",
        "Bodysnatchers",
        "Nude",
        "Weird Fishes/Arpeggi",
        "All I Need",
        "Faust Arp",
        "Reckoner",
        "House Of Cards",
        "Jigsaw Falling Into Place",
        "Videotape",
        "MK 1",
        "Down Is The New Up",
        "Go Slowly",
        "MK 2",
        "Last Flowers",
        "Up On The Ladder",
        "Bangers + Mash",
        "4 Minute Warning"
      ]
    },
    {
      "album": "The King Of Limbs",
      "year": "2011",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20The%20King%20Of%20Limbs",
      "songs": [
        "Bloom",
        "Morning Mr Magpie",
        "Little By Little",
        "Feral",
        "Lotus Flower",
        "Codex",
        "Give Up The Ghost",
        "Separator"
      ]
    },
    {
      "album": "Spectre",
      "year": "2015",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Spectre",
      "songs": [
        "Spectre"
      ]
    },
    {
      "album": "A Moon Shaped Pool",
      "year": "2016",
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20A%20Moon%20Shaped%20Pool",
      "songs": [
        "Burn The Witch",
        "Daydreaming",
        "Decks Dark",
        "Desert Island Disk",
        "Ful Stop",
        "Glass Eyes",
        "Identikit",
        "The Numbers",
        "Present Tense",
        "Tinker Tailor Soldier Sailor Rich Man Poor Man Beggar Man Thief",
        "True Love Waits"
      ]
    },
    {
      "album": "B-Sides",
      "year": null,
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20B-Sides",
      "songs": [
        "Inside My Head",
        "Million Dollar Question",
        "Yes I Am",
        "Coke Babies",
        "Maquiladora",
        "India Rubber",
        "How Can You Be Sure?",
        "Talk Show Host",
        "Bishop's Robes",
        "Molasses",
        "Lull",
        "How I Made My Millions",
        "The Amazing Sounds Of Orgy",
        "Trans-Atlantic Drawl",
        "Kinetic",
        "Fast-Track",
        "Cuttooth",
        "Worrywort",
        "Fog",
        "Paperbag Writer",
        "Where Bluebirds Fly",
        "Fog (Again)",
        "Gagging Order",
        "I Am A Wicked Child",
        "I Am Citizen Insane"
      ]
    },
    {
      "album": "Unreleased",
      "year": null,
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Unreleased",
      "songs": [
        "Big Boots",
        "The Chains",
        "Climbing Up A Bloody Great Hill",
        "Cut A Hole",
        "The Daily Mail",
        "Feeling Pulled Apart By Horses (AKA Reckoner Old Version)",
        "Follow Me Around",
        "Give It Up",
        "Happy Song",
        "I Froze Up",
        "Innocents Civilian",
        "I Promise",
        "I Want None Of This",
        "Lift",
        "Nobody Does It Better",
        "No Surprises Please",
        "Nothing Touches Me",
        "Phillipa Chicken",
        "The Present Tense",
        "Rattlesnake",
        "The Rip",
        "Sinking Ship",
        "Spooks",
        "Staircase",
        "Stupid Car",
        "Tell Me Why",
        "To Be A Brilliant Light",
        "Union City Blue",
        "Unravel"
      ]
    },
    {
      "album": "Other Songs",
      "year": null,
      "amazonLink": "http://www.amazon.com/exec/obidos/redirect?link_code=ur2&tag=wikia-20&camp=1789&creative=9325&path=external-search%3Fsearch-type=ss%26index=music%26keyword=Radiohead%20Other%20Songs",
      "songs": [
        "Cinnamon Girl (Neil Young Cover)",
        "Good Evening Mrs. Magpie",
        "Harry Patch (In Memory Of)",
        "Man-O-War",
        "Pop Is Dead",
        "Remyxomatosis",
        "Sit Down. Stand Up",
        "Supercollider",
        "The Butcher",
        "These Are My Twisted Words",
        "What Is It That You Say"
      ]
    }
  ]
}

```


text:
## The Psychology of Cycling
[link](https://www.youtube.com/watch?v=JKbiBNztErQ&list=WL&index=37)

- The goal is not peak performance, but prime cycling
- Riding at a consistently high level under the most challenging conditions
- The great ones are great because they can ride at a high level consistently
- The great ones are great when things aren't good--headwinds, alpine
- Can prime cycling be learned? Prime cycling is about developing skills
- What race are you competing in?
  - Competitive: Against others
  - Race against the course: The course is trying to crush you, if you can't win the course you can't win competitively
  - Mental race: When "why am I here" gets into your mind, you are starting to lose

#### Prime Cycling Framework

- Pain
- Emotions
- Focus
- Stress/Intensity
- Confidence
- Motivation

#### Motivation:  The determination and drive to achieve your goals.

- This is EVERYTHING.
- Effort and goals. Big goals mean "am I doing the work necessary." Lower your goals or raise your effort.
- The grind. No matter how much you love to ride, you get to the point where it's no longer fun. It's boring, it's tiring, it hurts. When most people get to the grind they stop. *The great cyclists, when they hit the grind, that's when it really starts to matter. That's what gonna make the difference between those who achieve their goals and those who don't. This is when you make the most deposits in that bank.*
- *When you're hurting the most, focus on why you're hurting, because your body is communicating very powerfully that it wants you to stop.*  This draws yourself further from the pain, and it focuses you on what you want to do. *Have a reason for why you're hurting out there.*
- Also, train in a group. You'll probably be better if you're with other people. Identify your greatest competitor, and think what they're doing that you aren't.
- Compete for the right reasons. *You want it because you want it. Hopefully you do it because you love it.*

#### Confidence: How strongly you believe in your ability to achieve your goals

- Most important mental factor. You can have all the ability in the world but if you don't believe in that ability, you're not going to force yourself. You will think that you'll crash at mile 80.
- Confidence is a skill you develop with practice. It's easy to stay positive, motivated, and confident when things are going well. When your body is surrendering, . Whenever you think there's nothing left, there's always something left. The body learns through adaptation to always keep something in reserve (ancient hunters still need to get home after killing game).
- Preparation. Every time you go for a ride, you are putting money in the bank. You want to put as much money as possible. Your goal is to get prepared. *I'm as prepared as I can be to achieve my goals.*
- Mental toolbox: Pull out all the tools necessary to fix this problem.
- Self-talk: Next time you go out on a ride, be aware of the things you tell yourself. "Keep going, keep going. I chose to do this, I'm going to make it to the top."

#### Intensity: Amount of physiological activity you feel before and during races

- We are physical beings. Mental stuff doesn't matter if your body physically cannot do it.
- Everybody has their own place. What is your ideal intensity? Being nervous burns fuel.
- Breathing. On a tough climb, when your body is dying, the one thing you have control over is your breathing.
- Shake out arms periodically. When you grip your handlebars tight, arms go up, shoulder goes up, center of gravity goes up, you become slower. Loosen your muscles and lower your intensity.
- Change position. When your body is rebelling, change something, move back in the seat, go to the drops, whatever. When you stay at the same position, your body will rebel, so change your intensity.
- Smile (hehe). For some reason smiling removes the tension in your body. We become conditioned to smiling. Smiling means we're happy. Smiling also releases endorphins, and it is hard to be something that is inconsistent with what our body is telling us. When smiling, your body tells us that things are okay.

#### Focus: Concentrate on things that help and avoid distractions that hurt performance

- Quality training. You cannot engage in quality training if you are not focused the entire time. You have to stay totally focused the entire time.
- Efficiency. Your body will perform at the highest level only when you're focused on doing it. Shifting between distraction/focus will mean a shift in performance.
- Keywords. When climbing, you have a tendency to get negative. "Breathe." "Calm." "Attack." If you're consistently thinking of something, you are doing it.
- 3 Ps:
  - Positive: Focus on positive things.
  - Process: What do I need to do to perform my best?
  - Present: What do I do NOW? You can't change the past but you can ruin the future by worrying about it.
- *What do I mean by concentration? I mean focusing totally on the business at hand and commanding yourself to do exactly what you want to do.*
- Last 100 meters of a sprint, there is no room to lose focus.

#### Emotions: Intense states that arise in response to situations that influence thoughts and behavior

- Common emotions in cycling: fear, frustration, anger, despair, but also excitement, joy, pride, inspiration. Emotions are two sides of the same coin--you can't experience the good ones unless you experience the bad ones.
- Cycling peels the onion away. After a long, hard ride, you are at your purest--good, bad, and ugly. It can be incredibly painful but it could be incredibly therapeutic.
- Emotions affect us psychologically and physiologically as well--can you ride home when you're angry, relative to despair?
- Emotional reactions to race situations--reacting to a flat, to cramps.
- *Whoever loses emotional control first loses.*
- Recognize "hot button" situations. Despair is not a good emotion at all but remind yourself that there is always something left. When I despair, I yell at myself to get angry so I won't be in despair. "This is when things start to fall apart, but they do come back."
- Keys to Emotional Mastery
  - Step back. Gear back, give yourself some distance from people. Take deep breaths, relax your muscles.
  - Figure out why you feel this emotion.
  - Find a solution. "I'll back off for the mean time."
- Emotions and nutrition. When I feel bad emotions, I might have a nutritional crisis. Usually this re- energizes your system.

#### Pain: Sensory and emotional experience of discomfort, distress, or agony

- If it wasn't hard, why do it?
- Pain is an instinctive mechanism to protect against threat to life.
- The pain we experience now is typically not going to kill us during a ride.
- Pain is physical and psychological. How we look at our pain influences how we experience pain.
- "What people have when they have cancer, it hurts more." "Pain? My injuries are worst." Honestly, it's physical discomfort. We can take it off once we get out of the bike.
- Interpretation of pain: normal, this means we're working hard. *If cycling wasn't hard, we wouldn't do it.*
- Pain is something we seek out every time we go on our bike.
- Relax: deep breathing, loosen muscles.
- Use the pain as information. Elite marathoners associate themselves to the pain.
- Generate positive thoughts and emotions. The next time you feel pain in your bike, connect positive emotions. You will feel less pain. Tell yourself: "I'm working hard, I'm achieving my goals."
- Inspiration and pride. "At cycling's core lies pain... it doesn't matter if you're sprinting for an Olympic medal, a town sign, a trailhead, or the rest stop. If you never confront pain, you're missing the essence of the sport."

### Q&A
- Technology means that you have tools in your mental toolbox. Technology might make you lose touch with your internal biological systems. You can't be totally wired in a ride, part of the experience is to figure out your body.
- If athletes can maintain their training, their speeds will still be maintainable.
- The only person who cares about your ride is YOU.

license: Unlicense

repository: daryllxd/lifelong-learning

gha_language: Elixir

gha_license_id: Unlicense

repo_name: daryllxd/lifelong-learning


text:
---
title: "Terminology"
description: "Don't get it? Don't sweat it. Read the definitions from our glossary."
icon: "ti-book"
draft: false
type: docs
---

**Customer** – A consumer, the customer of a merchant, the person making a payment.

**Merchant** – A customer of Paytrail. Runs the web application in which the Paytrail services are used. The merchant sells a product or service online to its customers.

**Paytrail Payment Service** – Service that allows customers to pay for purchases to the Merchant. Includes all popular payment methods in Finland.

**Paytrail Sales Channel** – A channel where multiple merchants can sell their products in one location (like an online marketplace or mall). This allows the customer to buy from several different merchants and make only one payment.

repository: eeturoponen/documentation

repo_name: eeturoponen/documentation


text:
---
layout: post
comments: true
title: Speak to your PC via your phone
image: /assets/posts/speak2pc.png
tags: [Technology, Geekery, Video]
---

Control your PC with your phone by voice.

To get voice control running on my Linux laptop proved to be a mess. Running voice control on my Android phone was a breeze. Connecting the two is rudimentary. So now I can talk to my phone while on stage and the right presentation pops up on my laptop that sits on the otheer side of the stage. Or any other creative scenario you may imagine.

Here is a video to show how this works:

{% include youtube.html id='XNkNfWF5Uk0' %}

Get the [instructions and code on Github](https://github.com/isene/speak2pc) and tweak it to suit your needs.

---
Link to this post: <https://isene.org/2020/09/Speak2PC.html>