text:
---
slug: /en/sql-reference/functions/
sidebar_position: 32
sidebar_label: Functions
---

# Functions

There are at least\* two types of functions - regular functions (they are just called “functions”) and aggregate functions. These are completely different concepts. Regular functions work as if they are applied to each row separately (for each row, the result of the function does not depend on the other rows). Aggregate functions accumulate a set of values from various rows (i.e. they depend on the entire set of rows).

In this section we discuss regular functions. For aggregate functions, see the section “Aggregate functions”.

\* - There is a third type of function that the ‘arrayJoin’ function belongs to; table functions can also be mentioned separately.\*

## Strong Typing

In contrast to standard SQL, ClickHouse has strong typing. In other words, it does not make implicit conversions between types. Each function works for a specific set of types. This means that sometimes you need to use type conversion functions.

## Common Subexpression Elimination

All expressions in a query that have the same AST (the same record or same result of syntactic parsing) are considered to have identical values. Such expressions are concatenated and executed once. Identical subqueries are also eliminated this way.

## Types of Results

All functions return a single return as the result (not several values, and not zero values). The type of result is usually defined only by the types of arguments, not by the values. Exceptions are the tupleElement function (the a.N operator), and the toFixedString function.

## Constants

For simplicity, certain functions can only work with constants for some arguments. For example, the right argument of the LIKE operator must be a constant.
Almost all functions return a constant for constant arguments. The exception is functions that generate random numbers.
The ‘now’ function returns different values for queries that were run at different times, but the result is considered a constant, since constancy is only important within a single query.
A constant expression is also considered a constant (for example, the right half of the LIKE operator can be constructed from multiple constants).

Functions can be implemented in different ways for constant and non-constant arguments (different code is executed). But the results for a constant and for a true column containing only the same value should match each other.

## NULL Processing

Functions have the following behaviors:

-   If at least one of the arguments of the function is `NULL`, the function result is also `NULL`.
-   Special behavior that is specified individually in the description of each function. In the ClickHouse source code, these functions have `UseDefaultImplementationForNulls=false`.

## Constancy

Functions can’t change the values of their arguments – any changes are returned as the result. Thus, the result of calculating separate functions does not depend on the order in which the functions are written in the query.

## Higher-order functions, `->` operator and lambda(params, expr) function

Higher-order functions can only accept lambda functions as their functional argument. To pass a lambda function to a higher-order function use `->` operator. The left side of the arrow has a formal parameter, which is any ID, or multiple formal parameters – any IDs in a tuple. The right side of the arrow has an expression that can use these formal parameters, as well as any table columns.

Examples:

```
x -> 2 * x
str -> str != Referer
```

A lambda function that accepts multiple arguments can also be passed to a higher-order function. In this case, the higher-order function is passed several arrays of identical length that these arguments will correspond to.

For some functions the first argument (the lambda function) can be omitted. In this case, identical mapping is assumed.

## SQL User Defined Functions

Custom functions from lambda expressions can be created using the [CREATE FUNCTION](../statements/create/function.md) statement. To delete these functions use the [DROP FUNCTION](../statements/drop.md#drop-function) statement.

## Executable User Defined Functions
ClickHouse can call any external executable program or script to process data.

The configuration of executable user defined functions can be located in one or more xml-files. The path to the configuration is specified in the [user_defined_executable_functions_config](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_defined_executable_functions_config) parameter.

A function configuration contains the following settings:

-   `name` - a function name.
-   `command` - script name to execute or command if `execute_direct` is false.
-   `argument` - argument description with the `type`, and optional `name` of an argument. Each argument is described in a separate setting. Specifying name is necessary if argument names are part of serialization for user defined function format like [Native](../../interfaces/formats.md#native) or [JSONEachRow](../../interfaces/formats.md#jsoneachrow). Default argument name value is `c` + argument_number.
-   `format` - a [format](../../interfaces/formats.md) in which arguments are passed to the command.
-   `return_type` - the type of a returned value.
-   `return_name` - name of retuned value. Specifying return name is necessary if return name is part of serialization for user defined function format like [Native](../../interfaces/formats.md#native) or [JSONEachRow](../../interfaces/formats.md#jsoneachrow). Optional. Default value is `result`.
-   `type` - an executable type. If `type` is set to `executable` then single command is started. If it is set to `executable_pool` then a pool of commands is created.
-   `max_command_execution_time` - maximum execution time in seconds for processing block of data. This setting is valid for `executable_pool` commands only. Optional. Default value is `10`.
-   `command_termination_timeout` - time in seconds during which a command should finish after its pipe is closed. After that time `SIGTERM` is sent to the process executing the command. Optional. Default value is `10`.
-   `command_read_timeout` - timeout for reading data from command stdout in milliseconds. Default value 10000. Optional parameter.
-   `command_write_timeout` - timeout for writing data to command stdin in milliseconds. Default value 10000. Optional parameter.
-   `pool_size` - the size of a command pool. Optional. Default value is `16`.
-   `send_chunk_header` - controls whether to send row count before sending a chunk of data to process. Optional. Default value is `false`.
-   `execute_direct` - If `execute_direct` = `1`, then `command` will be searched inside user_scripts folder specified by [user_scripts_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_scripts_path). Additional script arguments can be specified using whitespace separator. Example: `script_name arg1 arg2`. If `execute_direct` = `0`, `command` is passed as argument for `bin/sh -c`. Default value is `1`. Optional parameter.
-   `lifetime` - the reload interval of a function in seconds. If it is set to `0` then the function is not reloaded. Default value is `0`. Optional parameter.

The command must read arguments from `STDIN` and must output the result to `STDOUT`. The command must process arguments iteratively. That is after processing a chunk of arguments it must wait for the next chunk.

**Example**

Creating `test_function` using XML configuration.
File `test_function.xml` (`/etc/clickhouse-server/test_function.xml` with default path settings).
```xml
<functions>
    <function>
        <type>executable</type>
        <name>test_function_python</name>
        <return_type>String</return_type>
        <argument>
            <type>UInt64</type>
            <name>value</name>
        </argument>
        <format>TabSeparated</format>
        <command>test_function.py</command>
    </function>
</functions>
```

Script file inside `user_scripts` folder `test_function.py` (`/var/lib/clickhouse/user_scripts/test_function.py` with default path settings).

```python
#!/usr/bin/python3

import sys

if __name__ == '__main__':
    for line in sys.stdin:
        print("Value " + line, end='')
        sys.stdout.flush()
```

Query:

``` sql
SELECT test_function_python(toUInt64(2));
```

Result:

``` text
┌─test_function_python(2)─┐
│ Value 2                 │
└─────────────────────────┘
```

Creating `test_function_sum` manually specifying `execute_direct` to `0` using XML configuration.
File `test_function.xml` (`/etc/clickhouse-server/test_function.xml` with default path settings).
```xml
<functions>
    <function>
        <type>executable</type>
        <name>test_function_sum</name>
        <return_type>UInt64</return_type>
        <argument>
            <type>UInt64</type>
            <name>lhs</name>
        </argument>
        <argument>
            <type>UInt64</type>
            <name>rhs</name>
        </argument>
        <format>TabSeparated</format>
        <command>cd /; clickhouse-local --input-format TabSeparated --output-format TabSeparated --structure 'x UInt64, y UInt64' --query "SELECT x + y FROM table"</command>
        <execute_direct>0</execute_direct>
    </function>
</functions>
```

Query:

``` sql
SELECT test_function_sum(2, 2);
```

Result:

``` text
┌─test_function_sum(2, 2)─┐
│                       4 │
└─────────────────────────┘
```

Creating `test_function_sum_json` with named arguments and format [JSONEachRow](../../interfaces/formats.md#jsoneachrow) using XML configuration.
File `test_function.xml` (`/etc/clickhouse-server/test_function.xml` with default path settings).
```xml
<functions>
    <function>
        <type>executable</type>
        <name>test_function_sum_json</name>
        <return_type>UInt64</return_type>
        <return_name>result_name</return_name>
        <argument>
            <type>UInt64</type>
            <name>argument_1</name>
        </argument>
        <argument>
            <type>UInt64</type>
            <name>argument_2</name>
        </argument>
        <format>JSONEachRow</format>
        <command>test_function_sum_json.py</command>
    </function>
</functions>
```

Script file inside `user_scripts` folder `test_function_sum_json.py` (`/var/lib/clickhouse/user_scripts/test_function_sum_json.py` with default path settings).

```python
#!/usr/bin/python3

import sys
import json

if __name__ == '__main__':
    for line in sys.stdin:
        value = json.loads(line)
        first_arg = int(value['argument_1'])
        second_arg = int(value['argument_2'])
        result = {'result_name': first_arg + second_arg}
        print(json.dumps(result), end='\n')
        sys.stdout.flush()
```

Query:

``` sql
SELECT test_function_sum_json(2, 2);
```

Result:

``` text
┌─test_function_sum_json(2, 2)─┐
│                            4 │
└──────────────────────────────┘
```

Executable user defined functions can take constant parameters configured in `command` setting (works only for user defined functions with `executable` type).
File `test_function_parameter_python.xml` (`/etc/clickhouse-server/test_function_parameter_python.xml` with default path settings).
```xml
<functions>
    <function>
        <type>executable</type>
        <name>test_function_parameter_python</name>
        <return_type>String</return_type>
        <argument>
            <type>UInt64</type>
        </argument>
        <format>TabSeparated</format>
        <command>test_function_parameter_python.py {test_parameter:UInt64}</command>
    </function>
</functions>
```

Script file inside `user_scripts` folder `test_function_parameter_python.py` (`/var/lib/clickhouse/user_scripts/test_function_parameter_python.py` with default path settings).

```python
#!/usr/bin/python3

import sys

if __name__ == "__main__":
    for line in sys.stdin:
        print("Parameter " + str(sys.argv[1]) + " value " + str(line), end="")
        sys.stdout.flush()
```

Query:

``` sql
SELECT test_function_parameter_python(1)(2);
```

Result:

``` text
┌─test_function_parameter_python(1)(2)─┐
│ Parameter 1 value 2                  │
└──────────────────────────────────────┘
```

## Error Handling

Some functions might throw an exception if the data is invalid. In this case, the query is canceled and an error text is returned to the client. For distributed processing, when an exception occurs on one of the servers, the other servers also attempt to abort the query.

## Evaluation of Argument Expressions

In almost all programming languages, one of the arguments might not be evaluated for certain operators. This is usually the operators `&&`, `||`, and `?:`.
But in ClickHouse, arguments of functions (operators) are always evaluated. This is because entire parts of columns are evaluated at once, instead of calculating each row separately.

## Performing Functions for Distributed Query Processing

For distributed query processing, as many stages of query processing as possible are performed on remote servers, and the rest of the stages (merging intermediate results and everything after that) are performed on the requestor server.

This means that functions can be performed on different servers.
For example, in the query `SELECT f(sum(g(x))) FROM distributed_table GROUP BY h(y),`

-   if a `distributed_table` has at least two shards, the functions ‘g’ and ‘h’ are performed on remote servers, and the function ‘f’ is performed on the requestor server.
-   if a `distributed_table` has only one shard, all the ‘f’, ‘g’, and ‘h’ functions are performed on this shard’s server.

The result of a function usually does not depend on which server it is performed on. However, sometimes this is important.
For example, functions that work with dictionaries use the dictionary that exists on the server they are running on.
Another example is the `hostName` function, which returns the name of the server it is running on in order to make `GROUP BY` by servers in a `SELECT` query.

If a function in a query is performed on the requestor server, but you need to perform it on remote servers, you can wrap it in an ‘any’ aggregate function or add it to a key in `GROUP BY`.

## Related Content

- [User-defined functions in ClickHouse Cloud](https://clickhouse.com/blog/user-defined-functions-clickhouse-udfs)

repository: housepower/ClickHouse

repo_name: housepower/ClickHouse


text:
---
author: "Adam Presley"
date: 2008-09-13T18:36:00Z
tags: ["family"]
title: "Ceramic Pig Painting Fun!"
slug: "ceramic-pig-painting-fun"
---

Just wanted to post up a couple of pictures of what Maryanne and the
girls worked on today. We had gone to [Hobby Lobby](http://hobbylobby.com/) to find some
craft-ie kind of stuff for the kids to do, and came across a neat
ceramic paint set. It contains three ceramic pigs, going from small to
large, and five or six paint colors. It's neat because it just gives you
the pigs, paint, brushes, and lets you be as creative as you wish to
be!

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Mosquitto

Master: [![Build Status](https://travis-ci.org/sansible/mosquitto.svg?branch=master)](https://travis-ci.org/sansible/mosquitto)
Develop: [![Build Status](https://travis-ci.org/sansible/mosquitto.svg?branch=develop)](https://travis-ci.org/sansible/mosquitto)

* [ansible.cfg](#ansible-cfg)
* [Installation and Dependencies](#installation-and-dependencies)
* [Tags](#tags)
* [Settings](#settings)
* [Examples](#examples)

This roles installs Oracle, tested on Mosquitto 1.4.x.

## ansible.cfg

This role is designed to work with merge "hash_behaviour". Make sure your
ansible.cfg contains these settings

```INI
[defaults]
hash_behaviour = merge
```

## Installation and Dependencies

This role has no dependencies.

To install run `ansible-galaxy install sansible.mosquitto` or add this to your
`roles.yml`

```YAML
- name: sansible.mosquitto
  version: v1.0
```

and run `ansible-galaxy install -p ./roles -r roles.yml`

## Tags

This role uses two tags: **build** and **configure**

* `build` - Installs Mosquitto.
* `configure` - Configures Mosquitto.

## Settings

```YAML
mosquitto:
  # Whether to install mosquitto_pub and _sub cmds
  install_clients: false
  version: 1.4.*
  aws:
    enabled: yes
    region: eu-west-1
    # List of files that need to be copied and secured from S3
    # These should be things like TLS files
    s3_files:
     - bucket: config-bucket
       path: /mosquitto/tls/ca.crt
       dest: /etc/mosquitto/certs/ca.crt
       mode: "0600"
     - bucket: config-bucket
       path: /mosquitto/tls/server.crt
       dest: /etc/mosquitto/certs/server.crt
       mode: "0600"
     - bucket: config-bucket
       path: /mosquitto/tls/server.key
       dest: /etc/mosquitto/certs/server.key
       mode: "0600"
  # All key/value pairs under mosquitto.settings will be added to
  # `/etc/mosquitto/conf.d/mosquitto.local.conf`
  settings:
    allow_anonymous: "true"
    persistence: "true"
  user_list:
    # Format is username: password, passwords must be generated using mosquitto_passwd
    # mosquitto.settings.password_file must be defined if you want to enable users
    user_one: hash
    user_two: hash

```

## Examples

To simply install Mosquitto:

```YAML
- name: Install Mosquitto
  hosts: sandbox

  roles:
    - name: sansible.mosquitto
```

Overriding some settings:

```YAML
- name: Install Mosquitto with alternate port
  hosts: sandbox

  roles:
    - name: sansible.mosquitto
      mosquitto:
        settings:
          port: 8000
```

To set up with a password file:

```YAML
- name: Install Mosquitto with username/password file
  hosts: sandbox

  roles:
    - name: sansible.mosquitto
      mosquitto:
        settings:
          allow_anonymous: "false"
          password_file: /etc/mosquitto/passwd
        user_list:
          user_one: hash
          user_two: hash
```
This will create a password file with the username/password hash mosquitto.users_list.
Note that the mosquitto.settings.password_file variable must be set.

Passwords should be hashes generated by the mosquitto_passwd utility

license: MIT

repository: morbidick/ansible-role-mosquitto

repo_name: morbidick/ansible-role-mosquitto


text:
# Ising-Model-CUDA
The evolution of an Ising model, in CUDA, in two dimensions for a given number of steps 𝑘. The Ising model (/ˈaɪsɪŋ/; German: [ˈiːzɪŋ]), named after the physicist Ernst Ising, is a mathematical model of ferromagnetism in statistical mechanics. The model consists of discrete magnetic dipole moments of atomic “spins” that can be in one of two states (+1 or −1). The spins are arranged in a square lattice with periodic boundary conditions, allowing each spin to interact with its neighbors. The dipole moments update in discrete time steps according to the majority of the spins within the 3 × 3 window centered to each lattice point. Windows centered on the edge lattice points wrap around to the other side (known as toroidal or periodic boundary conditions).

## Validate Results

To validate the results of all versions run:

```sh
make all
```

To validate a specific version(e.g. "V1") run:

```sh
make V1
```
## Cleaning

For cleaning:
```sh
make clean
```

## Benchmarking

To benchmark v0 run:

```sh
make benchmark_v0
```

To benchmark v1 run:

```sh
make benchmark_v1
```
To benchmark v2 run:

```sh
make benchmark_v2
```
To benchmark v3 run:

```sh
make benchmark_v3
```

repository: nikospd/Ising-Model-CUDA

repo_name: nikospd/Ising-Model-CUDA


text:
# Web site analytics

Over the last 15 years, tools that track activity on your website have become very common and very sophisticated. For example, here is a country of origin report from [Woopra](https://www.woopra.com/) concerning my research website (parrt: walk through woopra live app):

These tools can tell you way more than just which pages were accessed most frequently. They can tell you about search terms, browsers, languages, and so on.

**Q**. How the heck does this work? How does Woopra know about my little research website?

## Background

When a browser visits a particular web page, we know that it opens a socket to the server associated with that URL and fetches the HTML (or other data). From there, it renders the HTML visually. It turns out there are a number of HTML tags that actually require the browser to "secretly" fetch data from the same or other servers. Image tags are the most obvious example. In order to display an image, the browser has to fetch that file.

### Which servers does CNN contact?

Using a channel snooper (a proxy), I captured the following histogram of hosts contacted by a **single** visit to the cnn.com home page.

```
  25 	www.cnn.com
   6 	i.cdn.turner.com
   5 	download.cdn.mozilla.net
   4 	z.cdn.turner.com
   2 	widgets.outbrain.com
   2 	hpr.outbrain.com
   2 	131788053.log.optimizely.com
   1 	www.googletagservices.com
   1 	vrt.outbrain.com
   1 	secure-us.imrworldwide.com
   1 	metrics.cnn.com
   1 	log.outbrain.com
   1 	i2.cdn.turner.com
   1 	fast.fonts.net
   1 	facebook.com
   1 	data.cnn.com
   1 	consent.truste.com
   1 	connect.facebook.net
   1 	cdn.optimizely.com
   1 	cdn.livefyre.com
   1 	cdn.krxd.net
   1 	cdn.gigya.com
   1 	cdn.clicktale.net
   1 	b.scorecardresearch.com
   1 	a.visualrevenue.com
```

You can see a lot of weird stuff in there, much of it for ads. For example, Facebook and clicktale. Clicktale's website claims "*Clicktale reveals consumer behavior, needs and intent at every touchpoint of the digital conversation, delivering insights to delight customers and create more value.*"

### A toy example

In order to learn the mechanics, consider the following simple webpage with a reference to an image on another site. This HTML file would presumably be on some server xyz.com:

The HTML asks the browser to display a simple image:

Your browser makes **two** web requests, one to xyz.com to get the page itself and **another** to www.antlr.org for the image.

Using the inspector in Google Chrome on [pageimg.html](pageimg.html), we can see that this page fetches the icon:

Any page on the Internet that references this image would notify my antlr.org server every time a browser visited that page. Now imagine that the image is an invisible 1x1 image and you can see how it could be hidden in lots of websites. Antlr.org could then track references to pages all over the net.   The amount we can track from this image reference depends on how much information we add to the `img` tag URL. Here we are not adding anything but typically JavaScript is used to collect all sorts of information and pass it to the tracking server through URL parameters or cookies (more on this later).

### Exercise

Work with a partner on this. One person makes an html page called `t.html` that references a URL on your partner's computer via an `img` tag:

```html
<html>
<body>
<img src="http://PARTNER_IP_ADDRESS:5000/track">
</body>
</html>
```

You can view that file with `open t.html` from a mac command line. You are doing this from **your** laptop, not your partners.

The partner has to have a flask server running with URL `/track` available (in perhaps `server.py`):

```python
from flask import Flask
import netifaces as ni
ip = ni.ifaddresses('en0')[ni.AF_INET][0]['addr']

app = Flask(__name__)

@app.route("/track")
def trackme():
    return ""

app.run(host=ip)
```

When that server starts up you will see something like the following:

```bash
$ python server.py
 * Running on http://<IP_ADDRESS>:5000/ (Press CTRL+C to quit)
...
```

where `<IP_ADDRESS>` is the partner's computer's IP address.  Pay attention to this because that is the IP address that the HTML file's `img` tag should reference on your laptop. The HTML file is on another person's computer.

Every time you refresh the browser on your laptop, your partner should see a log entry such as the following appear on their screen:

```
<IP_ADDRESS> - - [17/Sep/2017 12:42:05] "GET /track HTTP/1.1" 200 -
```

where perhaps the `<IP_ADDRESS>` is the IP address of your laptop (the one showing the `t.html` file), not the laptop running the server.

### What is JavaScript?

Modern tracking mechanisms use more than simple `img` tags--they use JavaScript code. JavaScript is an object-oriented programming language (that has similar syntax to Java but is oh so very different in semantics) that executes within your browser. Unlike Python, which we can run from the commandline or from within the development environment, JavaScript is typically stored as part of an HTML page and sent from a server back to a browser. The browser displays the HTML page and executes the JavaScript code.

**Exercise**. Try to get the following two simple JavaScript-based pages working in your browser. Play around with the JavaScript, such as changing the string in the `alert` function call.

Here's a simple [example](alertjs.html) that pops up a dialog box when you visit the page but doesn't show anything in the page itself.

```html
<html>
<body>
  <script>
    alert('Hello, World!')
  </script>
</body>
</html>
```

And here's a [web page](domjs.html) that contains no HTML as static data. Instead a JavaScript program creates the HTML on-the-fly in the browser. I.e., no HTML body tags (other than the JavaScript) is sent from the server.

```html
<html>
<body>
  <script>
  document.body.innerHTML = "<h1>Hi from "+location.pathname+"</h1>"
  </script>
</body>
</html>
```

If you do a "Save As...", you will get the page as you see here, not an actual HTML file with `h1` tags etc... The JavaScript is creating the HTML on the fly.  What that means is that doing a fetch with Python, such as `requests.get(...)`, will yield the JavaScript and not the page you see when you visit in the browser.

On the other hand, if you open the developer tools (in Chrome), you can view the HTML generated by the JavaScript and find out all sorts of things about the display page:

Of course, you can also see the source code by clicking on the `Sources` tab.

There is also an amazing JavaScript debugger.

## Tracking mechanism

Okay, let's look at web analytics tracking for real now using two commercial web analytics tools, Woopra and Google analytics.

Every page for which I want tracking, I include the following snippet, which you can see by asking for page source on any of my `antlr.org` pages:

```html
<!-- Start of Woopra Code -->
<script>
(function(){
    var t,i,e,n=window,o=document,a=arguments,s="script",
    r=["config","track","identify","visit","push","call","trackForm",
    "trackClick"],c=function(){
    ...
})("woopra");
woopra.config({
    domain: 'antlr.org'
});
woopra.track();
</script>
<!-- End of Woopra Code -->
```

This is JavaScript code that contacts Woopra every time this code executes, which is every time the browser loads this page.

I also use Google analytics, which has different looking code but same mechanism:

```html
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'xxxxxxxxx', 'auto');
  ga('send', 'pageview');
</script>
```

The URL buried in there is the contact address: `www.google-analytics.com/analytics.js`. The JavaScript adds lots of parameters that get sent to the target URL. These identify the page name and lots of information about the browser, operating system, etc. of the user.

Ok, in a nutshell, web tracking works when a website developer includes a bit of JavaScript code from a tracking company, such as Woopra. The snippet of code contacts the tracking company upon each page view in a browser. Website owners can then go to the dashboard at the tracking company and look at a summary.

## Homebrew web analytics

**Exercise**. Let's build our own web analytics server, a more sophisticated version of the exercise we did above.  To make it respond to requests for `localhost` and your laptops actual IP address, change the `run()` command to be:

```python
app.run(host='<IP_ADDRESS>')
```

Ok, so we need a server that answers:

* `http://<IP_ADDRESS>:5000/track.gif?page=...` Any page with an image reference to this URL will notify our server.
* `http://<IP_ADDRESS>:5000/dashboard` If we go to this URL in a browser, we should see a histogram of the page views.

(Our flask servers by default pop up at URL `http://<IP_ADDRESS>:5000`.)

For the purposes of this exercise, you can use this [directory of files](https://github.com/parrt/msds692/tree/master/notes/code/webanalytics/static). Put that `static` directory in the same directory as your Python code.  For example, the `static/index.html` file looks like:

```html
<html>
<body>
A fake home page with <a href="anotherpage.html">link to some other page</a>.

<img src="http://<IP_ADDRESS>:5000/track.gif?page=index.html">
</body>
</html>
```

If you open that file in a browser, the `img` tag will contact our server, indicating that somebody has accessed page `index.html`.  Recall that the browser makes another socket connection to some remote server for each image tag.

Here is a starter kit for your `server.py` file:

```python
from flask import Flask
from flask import request
import netifaces as ni
ip = ni.ifaddresses('en0')[ni.AF_INET][0]['addr']
print("This machines IP address is "+ip)

app = Flask(__name__)

@app.route("/track.gif")
def track():
    # get the 'page' request argument (google it)
    page = ...
    if len(page)>0:
        print("Visit to page "+page)
    # return the result of calling app.send_static_file on 'images/shim.gif'

app.run(host='<IP_ADDRESS>')
```

Once you think you have your server going, open your browser on the local file `static/index.html`. You should see `Visit to page index.html` as output from the running server. Try it a few times and click on the link to `anotherpage.html`. You should see different output in the server console.

Now, add a `dashboard` function to your server that is triggered when someone visits URL `http://<IP_ADDRESS>:5000/dashboard`.

```
@app.route("/dashboard")
def dashboard():
    ...
```

To keep track of the page views, use a `Counter` object initialized as a global variable:

```python
pageviews = Counter()
```

You will have to modify `track()` so that it updates `pageviews`. The `dashboard()` function can then create and return an HTML table string that shows the histogram such as:

The HTML looks like:

```html
<table>
<tr><th>Count</th><th>Page name</th></tr>
<tr><td>3</td><td>index.html</td></tr>
<tr><td>6</td><td>anotherpage.html</td></tr>
</table>
```

If you want, you can `pip install html` and then use the `HTML` object to create the HTML table. For example, here is how I started creating my HTML page using the package:

```python
page = HTML()
t = page.table()
r = t.tr
r.th("Count")
r.th("Page name")
...
```

The [solution](https://github.com/parrt/msds692/blob/master/notes/code/webanalytics/server.py) is available.

### Going further

If you are a more advanced programmer, you can improve the functionality of the server by adding parameters to the tracking `img` tag that include the referring page automatically, instead of manually as it's done now (using JavaScript). You can look up on the web how to get access to the page, the browser, the language, even the size of the user screen. All of this can be passed as arguments to the image reference. Your tracking function must then record this in addition to the page name. Your `Counter` object used previously, that tracked page name to count, is still useful but you should add another `Counter` for each parameter you pass, such as user agent (browser). Then you should modify your dashboard to include that information as well.

Next, you can modify the HTML files so they reference your actual IP address instead of <IP_ADDRESS>. Give those files to another person and have them load the files in their browser. You should see their requests as output from your server and your dashboard should reflect that when you refresh.

gha_license_id: MIT


text:
# Quick Start of Speech-to-Text
Several shell scripts provided in `./examples/tiny/local` will help us to quickly give it a try, for most major modules, including data preparation, model training, case inference, and model evaluation, with a few public datasets (e.g. [LibriSpeech](http://www.openslr.org/12/), [Aishell](http://www.openslr.org/33)). Reading these examples will also help you to understand how to make it work with your data.

Some of the scripts in `./examples` are not configured with GPUs. If you want to train with 8 GPUs, please modify `CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7`. If you don't have any GPU available, please set `CUDA_VISIBLE_DEVICES=` to use CPUs instead. Besides, if an out-of-memory problem occurs, just reduce `batch_size` to fit.

Let's take a tiny sampled subset of [LibriSpeech dataset](http://www.openslr.org/12/) for instance.

- Go to the directory

    ```bash
    cd examples/tiny
    ```
    Notice that this is only a toy example with a tiny sampled subset of LibriSpeech. If you would like to try with the complete dataset (would take several days for training), please go to `examples/librispeech` instead.
- Source env
    ```bash
    source path.sh
    ```
    **Must do this before you start to do anything.**
    Set `MAIN_ROOT` as project dir. Using the default `deepspeech2` model as `MODEL`, you can change this in the script.
- Main entry point
    ```bash
    bash run.sh
    ```
    This is just a demo, please make sure every `step` works well before the next `step`.

More detailed information is provided in the following sections. Wish you a happy journey with the *DeepSpeech on PaddlePaddle* ASR engine!

## Training a model
The key steps of training for the Mandarin language are the same as that of the English language and we have also provided an example for Mandarin training with Aishell in `examples/aishell/local`. As mentioned above, please execute `sh data.sh`, `sh train.sh` and `sh test.sh` to do data preparation, training, and testing correspondingly.

## Evaluate a Model
To evaluate a model's performance quantitatively, please run:
```bash
CUDA_VISIBLE_DEVICES=0 bash local/test.sh
```
The error rate (default: word error rate; can be set with `error_rate_type`) will be printed.

We provide two types of CTC decoders: *CTC greedy decoder* and *CTC beam search decoder*. The *CTC greedy decoder* is an implementation of the simple best-path decoding algorithm, selecting at each timestep the most likely token, thus being greedy and locally optimal. The [*CTC beam search decoder*](https://arxiv.org/abs/1408.2873) otherwise utilizes a heuristic breadth-first graph search for reaching near-global optimality; it also requires a pre-trained KenLM language model for better scoring and ranking. The decoder type can be set with the argument `decoding_method`.

branch_name: refs/heads/develop

gha_language: Python


text:
# Configure PHP Version

`$ athena php <bdd|unit|lint|browser|api> <args...> --php-version=<version>`

To see all available versions, set `--php-version`, in any command, without any value.

Internally we check the `docker/` folder, to see if there's a docker image for <version>.

`$ athena php bdd my-tests/ my-tests/athena.json --browser=firefox --php-version=7.0`

## Available Versions

```bash
$ athena php bdd my-tests/ my-tests/athena.json --browser=firefox --php-version
...

[FATAL] --php-version must be set to one of the available versions: php5.6, php7.0
```

# Disable XDebug

XDebug slows your application considerably, therefore in an environment, such as CI, or simply, in case you are in a hurry and the tests are taking too long, it might help switching XDebug off.

Set `ATHENA_DISABLE_DEBUG=1` environment variable.

# External Grid Hub and/or Proxy

When `browser` and `bdd --browser=<browser>` is run, it will try to automatically link with a running Grid Hub or/and Proxy Server.

In case --skip-hub or/and --skip-proxy exists, the link will not be performed.

For performing a link with another running container, you can optionally
specify --link-hub=<container_name> and/or --link-proxy=<container_name>.

# Unit Tests In Parallel

```bash
$ athena php unit my-tests/ --parallel=<number> [<paratest-options>...]
```

```bash
$ athena php unit my-tests/ --parallel=2
```

## All Available Options

```bash
$ athena php unit my-tests/ --parallel --help
...

Usage:
  paratest [options] [--] [<path>]

Arguments:
  path                                   The path to a directory or file containing tests. (default: current directory)

Options:
  -p, --processes=PROCESSES              The number of test processes to run. [default: 5]
  -f, --functional                       Run methods instead of suites in separate processes.
      --no-test-tokens                   Disable TEST_TOKEN environment variables. (default: variable is set)
  -h, --help                             Display this help message.
      --coverage-clover=COVERAGE-CLOVER  Generate code coverage report in Clover XML format.
      --coverage-html=COVERAGE-HTML      Generate code coverage report in HTML format.
      --coverage-php=COVERAGE-PHP        Serialize PHP_CodeCoverage object to file.
  -m, --max-batch-size=MAX-BATCH-SIZE    Max batch size (only for functional mode). [default: 0]
      --filter=FILTER                    Filter (only for functional mode).
      --whitelist=WHITELIST              Directory to add to the coverage whitelist.
      --phpunit=PHPUNIT                  The PHPUnit binary to execute. (default: vendor/bin/phpunit)
      --runner=RUNNER                    Runner or WrapperRunner. (default: Runner)
      --bootstrap=BOOTSTRAP              The bootstrap file to be used by PHPUnit.
  -c, --configuration=CONFIGURATION      The PHPUnit configuration file to use.
  -g, --group=GROUP                      Only runs tests from the specified group(s).
      --exclude-group=EXCLUDE-GROUP      Don't run tests from the specified group(s).
      --stop-on-failure                  Don't start any more processes after a failure.
      --log-junit=LOG-JUNIT              Log test execution in JUnit XML format to file.
      --colors                           Displays a colored bar as a test result.
      --testsuite[=TESTSUITE]            Filter which testsuite to run
      --path=PATH                        An alias for the path argument.
```

Once the option --parallel is set, under hood paratest will replace phpunit.

repository: athena-oss/plugin-php

gha_language: PHP

repo_name: athena-oss/plugin-php


text:
# Messages

[Middleware]: ../../middleware/README.md "Middleware"
[Aggregate]: ../Aggregate/README.md "Aggregate"
[Saga]: ../Saga/README.md
[Projection]: ../Projection/README.md
[Receptor]: ../EventReceptor/README.md

All messages flowing thru the system are loosely typed objects with a minimal set of required fields:

* `type: string` - command or event type. for commands it's recommended to name it as a call to action (i.e. "createUser"), while for events it should describe what happened in a past tense (i.e. "userCreated").
* `payload: any` - command or event data
* `context: object` - key-value object with information on context (i.e. logged in user ID). context must be specified when a command is being triggered by a user action and then it's being copied to events, sagas and subsequent commands

Other fields are used for message routing and their usage depends on the flow:

* `aggregateId: string|number|undefined` - unique aggregate identifier
* `aggregateVersion: number`
* `sagaId: string|number|undefined`
* `sagaVersion: number`

## Commands

* sent to [CommandBus][Middleware] manually
* being handled by [Aggregates][Aggregate]
* may be enqueued by [Sagas][Saga]

Command example:

```json
{
  "type": "signupUser",
  "aggregateId": null,
  "payload": {
    "profile": {
      "name": "John Doe",
      "email"<EMAIL_ADDRESS>    },
    "password": "test"
  },
  "context": {
    "ip": "<IP_ADDRESS>",
    "ts":<PHONE_NUMBER>154
  }
}
```

## Events

* produced by [Aggregates][Aggregate]
* persisted to [EventStore][Middleware]
* may be handled by [Projections][Projection], [Sagas][Saga] and [Event Receptors][Receptor]

Event example:

```json
{
  "type": "userSignedUp",
  "aggregateId": 1,
  "aggregateVersion": 0,
  "payload": {
    "profile": {
      "name": "John Doe",
      "email"<EMAIL_ADDRESS>    },
    "passwordHash": "098f6bcd4621d373cade4e832627b4f6"
  },
  "context": {
    "ip": "<IP_ADDRESS>",
    "ts":<PHONE_NUMBER>154
  }
}
```

repository: snatalenko/node-cqrs

gha_language: JavaScript

repo_name: snatalenko/node-cqrs


text:
---
layout: post
title: "Subversion with Certificate-based Authentication"
tags: ["subversion", "svn", "certificate", "authentication", "p12", "pem", "crt", "key", "configuration"]
---

<div class="message">
Sometimes it is fashionable to move against the trend, such as using Subversion rather than Git. In order to keep the thing going, it requires a bit of black magic. Therefore, I will be explaining how to use Subversion with certificate based authentication to access your super secure server.
</div>

# Installing Subversion

This should make easy using brew from a Mac.

{% highlight bash %}
$ brew search subversion
{% endhighlight %}

It is important to make sure the version of Subversion installed is compatible with the subversion installed on the server. Subversion 1.7 and 1.8 (1.9 is the latest stable version but I can't really speak for it) are proven to be working interchangeably, source code checked in using 1.6 may not be easily upgraded.

# Certificate Conversion

A certificate is used in subversion server to verify client's identify.

Typically a certificate ([.p12](https://en.wikipedia.org/wiki/X.509) or [.pem](https://en.wikipedia.org/wiki/X.509)) should be assigned to you for this purpose, and it can be converted back and forth to other certificate formats using [openssl](https://www.openssl.org/) (more on the conversion in the next section).

In case you don't know what p12 and pem are, p12 is a certificate format which is fully encrypted and password protected. While pem certificate is just like p12 containing both public key and private key, but also root certificates.

Now, it is jolly good that you have your p12 with you. But a lot of times, you need more than just p12. In this case, a pem file is also required. As a quick guide, I have listed most common commands used to convert certificates.

### Convert p12 to pem

{% highlight bash %}
$ openssl pkcs12 -nodes -clcerts -in cert.p12 -out cert.pem
{% endhighlight %}

### Convert p12 to pem (with password)

{% highlight bash %}
$ openssl pkcs12 -in cert.p12 -out cert.pem
{% endhighlight %}

### Extract certificate from p12

{% highlight bash %}
$ openssl pkcs12 -nokeys -in cert.p12 -out cert.crt
{% endhighlight %}

### Extract key from p12

{% highlight bash %}
$ openssl pkcs12 -nocerts -in cert.p12 -out cert.key
{% endhighlight %}

### Generate p12 from cert and key

{% highlight bash %}
$ openssl pkcs12 -export -in foo.cert -inkey foo.key -out foo.p12
{% endhighlight %}

### Convert pem to p12

{% highlight bash %}
$ openssl pkcs12 -export -in original.pem -out new.p12
{% endhighlight %}

### Change p12 password

{% highlight bash %}
$ openssl pkcs12 -in original.p12 -nodes -clcerts -out temp.pem
$ openssl pkcs12 -export -in temp.pem -out new.p12
{% endhighlight %}

# Configure Subversion to Use Certificate-based Authentication

After installation, Subversion will create a directory structure like the following in home directory.

{% highlight bash %}
.subversion
├── README.txt
├── auth
│   ├── svn.simple
│   ├── svn.ssl.client-passphrase
│   ├── svn.ssl.server
│   └── svn.username
├── config
└── servers
{% endhighlight %}

In `servers` file, the following configurations are needed for the extra authentication.

{% highlight bash %}
[groups]
lemoncake = repo.lemoncake.com

[lemoncake]
ssl-authority-files = path/to/pem
ssl-client-cert-file = path/to/p12
ssl-client-cert-password = superpassword
# http-proxy-host = www.proxy.lemoncake.com
# http-proxy-port = 80
{% endhighlight %}

First of all, a `group` needs to be added with URL to the source control server.

Then in the group definition, a list of detailed settings (including cert and password) are required, with optional settings such as proxy.


text:
One of Polynote's most interesting features is its support for polyglot notebooks, where cells within the same notebook
can be written in different languages.

Variables can also be shared across languages, as all execution is done within a single process.

### Execution state in Polynote

We hinted [previously](basic-usage.md#the-symbol-table-and-input-scope) that the way Polynote handles cell execution
is a little special.

As a reminder, the kernel keeps track of all the symbols defined by a cell execution. These symbols are part
of the cell's state, which is made available to downstream cells (those below the cell in question) when they in turn
are executed.

Polynote stores these symbols, alongside their types and other information, in a Scala-based format. Symbols defined by
and provided to other languages are wrapped (and unwrapped) appropriately.

!!!info ""
    For more details, how this works under the hood, examples of going from Python to Scala,
    and information about its limitations and caveats, check out the [Python documentation](python.md).

### Polyglot example

Continuing our example notebook from [before](basic-usage.md), here's a trivial example (note that the bottom cell has
Python selected in the language drop-down).

![Accessing a Scala variable from Python](images/simple-py-interop.png)

The `foo` and `bar` Scala variables can be accessed directly in Python, because they represent primitive
types (`:::scala Int`s in this case). This also works the other way 'round, from Python to Scala, in much the same way.

### Use Case: Plotting Scala data with Matplotlib

!!!tip "Real-world usage at Netflix"
    This example notebook illustrates a contrived version of a common use-case at Netflix. [Our recommendation and
    personalization infrastructure is heavily JVM-based](https://www.slideshare.net/FaisalZakariaSiddiqi/ml-infra-for-netflix-recommendations-ai-nextcon-talk),
    and Algorithm Engineers and Scientists want to interface with our platform in order to, for example:

    - [transform data in a type-safe way using Scala](https://portal.klewel.com/watch/webcast/scala-days-2019/talk/12/)
    - [access Model Lifecycle data](https://www.usenix.org/conference/opml20/presentation/cepoi)
    - [generate features based on online data snapshots](https://netflixtechblog.com/distributed-time-travel-for-feature-generation-389cccdd3907)

    Once they get the data, they'd like to analyze and visualize it using the Python tools they are familiar with, such
    as [pandas](https://pandas.pydata.org/) and [matplotlib](https://matplotlib.org/).

A more complex example of a more typical usage can be found in the `examples/` folder in
[`Plotting Scala data with Matplotlib.ipynb`](https://github.com/polynote/polynote/blob/master/docs/examples/Plotting%20Scala%20data%20with%20Matplotlib.ipynb)
which is reproduced below.

We'll go over this example in detail.

![Plotting Scala data with matplotlib through Python](images/plotting-scala-matplotlib.png)

#### A direct approach using primitives

This notebook takes a direct approach to polyglot development. By crossing language boundaries using primitive data
structures, you don't need to worry about the details of language-specific data structures or implementations.

Let's go over this notebook, which consists of two cells. The first, a Scala cell, prepares some data, while the second,
a Python cell, plots it.

!!!example "Scala cell"
    ```scala
    val colors = Array("red", "green", "blue")
    val n = 750
    val flattenedLength = colors.length * n * 2 // 2 for x and y
    val data = (0 until flattenedLength).map(_ => Math.random()).toArray // converted to Array for Python interop
    ```

This cell generates an `:::scala Array[Double]` that is a flattened representation of data in three dimensions - `color`,
`x`, and `y`.

This data is then fed into the Python cell to be plotted:

!!!example "Python cell"
    ```python
    import matplotlib.pyplot as plt
    from numpy.random import rand

    fig, ax = plt.subplots()

    for color in colors:
        # since data is just a 1-D array we need to split it up to fit the matplotlib example
        x = data[:n]
        data = data[n:]
        y = data[:n]
        data = data[n:]

        scale = 200.0 * rand(n)
        ax.scatter(x, y, c=color, s=scale, label=color,
                   alpha=0.3, edgecolors='none')

    ax.legend()
    ax.grid(True)

    plt.show()
    ```

This cell steps through the `data` array and, for each `color`, unflattens the `x` and `y` data for plotting (note that
both `data` and `color` are Scala variables accessed directly from Python).

#### Can we do better?

This is pretty straightforward, but you might have noticed that the interchange values between the two languages are
`:::scala Array`s, rather than the more idiomatic (for Scala) `:::scala Seq`s. You might also notice that it was pretty
unnatural to flatten `data` like we did.

The reason for this is that it's easier to interchange between Scala and Python using primitives and basic structures
like Arrays.

!!!info ""
    You might not realize it, but when you work with Scala there's all sorts of stuff going on behind the scenes,
    such as implicits, or encoded Java method names (like `$colon$colon()`).

    Python doesn't know about this, so when we interact with a Scala object from Python we see it in all its gory details:

    ![What a Seq looks like when viewed from Python](images/python-scala-seq.png){: width=50% }

However, with a little Scala knowledge we can rewrite the plotting code to be more idiomatic, at the expense of having
to do (a bit) more work in Python to massage the data.

#### A more idiomatic implementation

First, we'll use some more idiomatic code to generate our point data:

```scala
case class Point(x: Double, y: Double, color: String)
val colors = Seq("red", "green", "blue")
val n = 750
val idiomaticData = for {
    color <- colors
    n     <- (0 to n)
} yield Point(Math.random(), Math.random(), color)
```

Wow, a `:::scala case class` AND a `:::scala for` expression? This is surely extremely idiomatic Scala code.
Not an `:::scala Array` in sight!

Let's inspect `idiomaticData` for a moment.

![Inspecting the value of idiomaticData using Polynote's inspection tools](images/inspecting-idiomaticData.gif)

!!!info "Inspecting and Visualizing Data"
    This image showcases using the [Quick Inspector](kernel-pane.md#quick-inspector) and [Viz cells](visualization-and-viz-cells.md)
    to easily inspect values within a notebook.

Now that we've taken a look at `idiomaticData` and seen that it's a `:::scala Seq[Point]`, we can delete the Viz cell and
start working with it using Python.

Since we're no longer working with primitives, we need to do a little data preparation. We'll build a `:::python list`,
iterate over `idiomaticData`, and extract values from `Point`.

We want to end up with a simple 2D-Array we can use with `matplotlib`.

```python
data = []
for idx in range(0, idiomaticData.length()):
    point = idiomaticData.apply(idx)
    data.append([point.x(), point.y(), point.color()])
```

There are two things of note here.

First, we need to manually iterate through the collection, generating an index which we can pass into the
[`:::scala apply(idx: Int): A`](https://www.scala-lang.org/api/2.12.0/scala/collection/Seq.html#apply(idx:Int):A)
method of the `Seq` to select elements from it.

Second, we'll access the `:::scala case class` members using the member accessor methods as usual, but note that with
Python we need to specify `()`, as in `:::python point.x()`, since of course in Python parentheses are always required,
even for nullary functions (ones that have no arguments).

At this point, the `data` variable is a nice `:::python list` of `:::python list`s, and we can easily turn it into a
Pandas DataFrame:
```python
import pandas as pd

df = pd.DataFrame(data=data, columns=['x', 'y', 'color'])
```

Note that we have to manually specify the column names here. A more advanced example might extract the fields from
`:::scala Point` and pass them into Python, but we'll pass on that for now.

Now that our data is a Pandas DataFrame we can manipulate it as usual. For example, we can add a `scale` column to it:

```python
import numpy as np

df['scale'] = np.random.uniform(1, 200, df.shape[0])
```

Finally, we can plot our DataFrame in the familiar way.

```python
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

groups = df.groupby("color")
for name, group in groups:
    ax.scatter(group.x, group.y, c=group.color, s=group.scale, label=name,
               alpha=0.3, edgecolors='none')

ax.legend(loc="upper right")
ax.grid(True)

plt.show()
```

That's it! This notebook can be found in the `examples/` folder as well, in
[`Plotting Scala data with Matplotlib (Idiomatic).ipynb`](https://github.com/polynote/polynote/blob/master/docs/examples/Plotting%20Scala%20data%20with%20Matplotlib%20(Idiomatic).ipynb).
You can see a screenshot below.

![Plotting Scala data with matplotlib through Python, idiomatically](images/plotting-scala-matplotlib-idiomatic.png)

Next, read about [using Spark with Polynote](spark.md).

repository: polynote/polynote

gha_language: Jupyter Notebook

repo_name: polynote/polynote


text:
## E-Book

The CoE CLI command packages up the documentation and associated help files as a single e-book that can be distributed a PDF file. This approach allows offline consumption of the documentation and ordering of the content to help the reader consume the content.

### Quick Start

1. Change to the coe-cli docs folder

```bash
cd coe-cli/docs
```

2. Build the required docker image

```bash
docker build -t cli-mdbook .
```

2. Create the e-book using PowerShell

```bash
npm run ebook
```

### Understand the Concepts

The generated e-book approach has the following main components

1. A cover page [ebook-cover.png](../images/ebook-cover.png) image and table of contents are automatically as first pages of the e-book

2. A [index.txt](../index.txt) file that controls the reading order of the content

3. The e-book style sheet [book.css](../book.css)

4. Prism.js stylesheet [prism.css](../prism.css) and JavaScript [prism.js](../prism.js) required for formatting of the code samples

5. **build.sh** shell script to create the PDF document

#### E-Book Update

To update this e-book with new content you will need access to docker to generate new versions of the pdf file using the following steps

1. Change to the docs folder

```bash
cd coe-cli/docs
```

2. Build e-book generation docker image

```bash
docker build -t cli-mdbook .
```

3. Generate a new version of the e-book using PowerShell and the docker image created above.

```powershell
npm run ebook
```

4. The script will generate a file named **Power Platform CoE Toolkit Command Line Interface.pdf** in the docs folder

Notes:
- If you are building an e-book for a branch that is not the main branch you can specify the path to the git hub repository e.g.

```bash
coe ebook generate \
    -r https://github.com/microsoft/coe-starter-kit/tree/coe-cli/coe-cli/docs
```

#### Spell Check Process

The [build.sh](../build.sh) makes use of [mdspell](https://www.npmjs.com/package/markdown-spellcheck) to spell check the markdown files using US english (en-US).

The mdspell node application is installed inside the [cli-mdbook docker image](../dockerfile) and executed by the [build.ps1](../build.ps1). If you need to add an exclusion for a work you can add changes to [.spelling](../.spelling) file. Each word or phrase should be on a separate line.

#### Grammar Checks

The [LanguageTool](https://languagetool.org/) writing assistant uses the Java bases command line tool inside the docker image to perform duplication, grammar and typographical checks using en-US. The language tool integration is implemented in [grammar.js](../grammar.js). The [grammar-ignore.txt](../grammar-ignore.txt) file contains a list of rules that will be ignored.

#### E-Book Customization

The [ebook.ts](../../src/commands/ebook.ts) controls the process of

1. Parsing the markdown files

2. Combining the markdown files into a single HTML file

3. Updating references between files and within a markdown file

4. Adding links between files

5. Referencing links to non markdown links to reference the GitHub project

repository: microsoft/coe-starter-kit

branch_name: refs/heads/main

gha_language: TypeScript

gha_license_id: NOASSERTION

repo_name: microsoft/coe-starter-kit


text:
# Synopsis
_A short introduction to the module's purpose_

The signal processing module is used to convert the data acquired by the lidar into a data product.

This module has two main functions, which are interfacing with PC (the External Controller) and data processing.
 - Interfacing with PC includes the ability to be reprogrammed and the ability to receive commands, which it can then send off to various modules. These tasks can be accomplished with either a DSP, MCU, or an FPGA, based on the decisions of the designer (2, 3, 4). This aspect of the Control Module is what connects it to the rest of the lidar system, and a protocol must be set up for all peripheral modules to be able to receive and understand the signals sent to them by the Internal Controller.
- Data processing involves the ability to collect and manipulate data sent by the Detector Module into useful information which can be used to determine various parameters such as wind speed and direction. In order to accomplish this, an FPGA or DSP can be used, but an FPGA would be favoured, both for its ability to be reprogrammed and its strong parallel computing capabilities. Whichever device is used must, at the very least, be able to handle an FFT with a 50 MHz bandwidth, meaning the clock speed must be at least 100 MHz.

N.B. this module is optional; it could be replaced by storing level 0 or raw data (e.g., spectral) data and then converting it to another level (e.g. line-of-sight wind speeds) externally or later. For more information about wind lidar data levels, see Figure 4.3 of [DOI: 10.5281/zenodo.2478051](https://doi.org/10.5281/zenodo.2478051).

# Glossary of Terms

_A list of terms that are specific to this module_

1. DSP: Digital Signal Processor

2. FFT: Fast Fourier Transform

3. FPGA: Field Programmable Gate Array

4. MCU: Microcontroller

5. GUI: Graphical User Interface

6. PC: Personal Computer (a system with a processor, operating system, inputs and outputs, as well as a programmable GUI)
# Interfaces
_How the module is linked to other parts of the OpenLidar architecture_

# Safety
_A list of possible safety issues related to the module and suggestions for mitigating any possible risks_

# FAQ
## This module is...
_A list of things that do belong to the module_

## This module is not...
_A list of things that are not part of the module. Use issues, etc. for evidence_

## Other questions
_Relevant questions in an FAQ format_

# Documentation
_How a specific implementation of this module should be documented. It should be adjusted for each module as required._

The following documentation is required (marked with a star) or suggested.
- **High Level Overview** discusses the main functions of the module and its constituent components.
- **Contacts** information about the contact person or organzation responsible for this module.
- **Design Space** discusses the operating conditions for the module.
- **Detailed Information** discusses the details of the module, including suggestions that may be implemented to accomplish its roles in the lidar system.
- **Interfaces** discusses how the module is connected to other parts of the OpenLidar architecture.
- **Safety** includes all applicable safety information
- **References** provide links to articles and other relevant information.

# Known examples of this module
_A list of projects or products that have implemented this module_


text:
# Generate RockMaker plate reports

## Features

- Reads config file
- Reads command-line arguments
- Queries the database to get the plates registered per month (or year), the number of times each has been imaged, plus more
- Writes the query result to a spreadsheet (.xlsx)
- Emails the spreadsheet as an attachment to the recipient email addresses defined in the config file

## Installing dependencies

```bash
pip install --user XlsxWriter
pip install --user python-tds
```

## Configuration

Copy the file config.example.cfg to config.cfg and customise it to use your own database credentials and email settings.

## Running

```bash
python rmaker_plates_to_xlsx.py month 2018 01
```

repository: KarlLevik/db-reports

repo_name: KarlLevik/db-reports


text:
# Contributing

* In lieu of a formal guideline, please try to mimic the existing code style
* Please make use of the included ESLint and EditorConfig settings
* Add a unit test for new/changed rules
* Format Git commit messages according to [AngularJS conventions][cc]
* The repository is [commitizen-friendly][], please use `git cz` to make it easy format the commit messages properly
* When creating a new rule, please add it to [index.js][], document it (see
  [docs][]) and update the [Rules][] section in the `README`

If in doubt, file an issue first.

Thanks!

[cc]: https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md
[commitizen-friendly]: https://github.com/commitizen/cz-cli
[docs]: docs/rules
[index.js]: index.js
[rules]: README.md#rules

repository: alecxe/eslint-plugin-protractor

repo_name: alecxe/eslint-plugin-protractor


text:
# Memorabilia
Memorabilia is an augmented reality iOS app for creating virtual experiences in real world spaces that are customizable with personal media, such as photos, videos, songs and texts. The goal is to create a virtual Memory Palace in a familiar place to help users save memories with spatial relevance or to assist them with daily tasks, specially people with neurocognitive disorders.

This application was developed as a graduation project in Computer Engineering at PUC-Rio.

## Contributors
[@andremelloalves](https://github.com/andremelloalves)

## License
MIT © 2020 André Mello Alves

repository: andremelloalves/Memorabilia

repo_name: andremelloalves/Memorabilia


text:
---
layout: post
title: "Ifan's Sanguine Aura"
date: 2020-01-19
sources: [CDA.0]
tags: [wizard, level2, enchantment, proposed, arcane]
---

**2nd-level enchantment**

**Casting Time**: 1 action

**Range**: Self

**Components**: V, S

**Duration**: Concentration, up to 1 minute

You are surrounded by a 10 foot aura of fine red mist as you cast this spell. On your turn, every hostile creature within the mist loses 3 hit points, healing you for 3 hp. In the presence of blood (for example, [*grave warden's mantle*](https://argentdragonsclaw.github.io/Codex-d-Annwn/spells/grave-wardens-mantle)) the damage and healing doubles.

**Most Similar Spell(s)**: [*vampiric touch*](https://thebombzen.com/grimoire/spells/vampiric-touch)

repository: ArgentDragonsClaw/Codex-d-Annwn

extension: markdown

repo_name: ArgentDragonsClaw/Codex-d-Annwn


text:
# 12_EatDaBurger

## Table of Contents

- [Description](#Description)
- [Installation](#Installation)
- [Usage](#Usage)
- [License](#License)
- [Contribution](#Contribution)
- [Tests](#Tests)
- [Questions](#Questions)

## Description

It is a web application that allows you to create/add burgers to the list in the database and then update them to be eaten.

## Screenshots

![Deployed app](./public/assets/img/DA.png)

## Installation

you need to install express, mysql, and express-handlebars.

## Usage

you would go to the website and then type in the burger that you want to add to the list and the click the devour button if you want to eat it.

## License

![MIT](https://img.shields.io/badge/license-MIT-brightgreen)

## Contributing

You don't need to contrubute but if you want to you can email me.

## Tests

none

## Questions

- GitHub Username: [LoganPippin](github.com/LoganPippin)
- Email<EMAIL_ADDRESS>


text:
---
layout: default
---

# 1996-02-02 - Re: Your mail

## Header Data

From: Alan<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 9377c65b28cf987f63be93648b0ac45661b2fdd104ac2f3dbc4d25cae55f1e37

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-02-02 20:55:23 UTC

Raw Date: Sat, 3 Feb 1996 04:55:23 +0800

## Raw message

```
{% raw  %}From: Alan<EMAIL_ADDRESS>Date: Sat, 3 Feb 1996 04:55:23 +0800
To<EMAIL_ADDRESS>Subject: Re: Your mail
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

>re: Virus site (http://www.xcitement.com/virus/) reports error 404 - no
>such file...

To make matters worse, the code on the site was poorly written so that web wacker choked when I tried to download the site.

I guess the Grays captured the site.

{% endraw %}
```

## Thread

+ Return to [February 1996](/archive/1996/02)

+ Return to "[Alan <alano@teleport.com>](/authors/alan_alano_at_teleport_com_)"

+ 1996-02-02 (Sat, 3 Feb 1996 04:55:23 +0800) - Re: Your mail - _Alan<EMAIL_ADDRESS>


text:
# ExternalTaskApiClient written in Python

This is an ExternalTaskApiClient written in Python.

### Requirements

- pipenv >= `2018.10.13`
- Python 3.7.x

### Setup/Installation

Install all Dependencies

```bash
pipenv install
```

## Install from pypi.org

Install package with pip:

```bash
pip install external_task_api_client
```

Install package with pipenv:

```bash
pipenv install external_task_api_client
```

## Test the Setup

Please use the integration test, we provided:

```bash
pipenv run python -m unittest test_external_task_client.py
```

Additionally, this needs a running instance of ExternalTaskTest BPMN-Process.

You have to terminate the process manually.


text:
# CredDump
Simple CLI app to dump all credentials from the Windows Credential Manager

Credential Management native wrappers blatenly stolen from https://github.com/LiquidHg/kraken

When run it will dump the stored credentials to the screen (a JSON object per line)

repository: DBHeise/CredDump

repo_name: DBHeise/CredDump


text:
Bolsocoin integration/staging tree

What is Bolsocoin?
----------------

Bolsocoin is a fork version of Litecoin.
 - subsidy starts in 1488 coins
 - 30 seconds block targets
 - subsidy halves after 10k blocks
 - subsidy fixed in 5 coins after 50k blocks
 - ~842 million total coins

License
-------

Bolsocoin is released under the terms of the MIT license. See `COPYING` for more
information or see http://opensource.org/licenses/MIT.

Why 1488 ?
-------------------

Bolsocoin aims to be the first alt-right community crypto-currency.

Development ?
------------------

Just submit your Pull Request.

**This is ALPHA release. Bugs are expected**

Supporting imageboards:
------------------

[Dogolachan](https://dogolachan.org/b/)

Useful links:
------------------
[Block Explorer](http://niobio.dogolachan.org:3001)

[Web Wallet](http://niobio.dogolachan.org)

Active pools:
------------------
http://niobio.dogolachan.org:8181

http://altcoin.mine-pool.ro/


text:
# Express Request Rate Limitter

Node.js ExpressJs configurable requests rate limitter middlewear on Redis.
This is very handy for API's. This middlewear calculates requests per minue and gives Rate-Limit headers for each type of request method: GET, POST, PUT, DELETE
If limit is reached, it will send HTTP 429 Too May requests response (http://httpstatusdogs.com/429-too-many-requests)
Rate limit applies to req.user if any, or to IP as a fallback.

  - X-Rate-Limit-Limit: Maximum limit for given method
  - X-Rate-Limit-Remaining: Remaining requests count
  - X-Rate-Limit-Reset: When this limit will be reset, timestamp unix epoch

## Installation
```sh
npm install express-req-rate-limitter-redis --save
```

Create Redis client somehow
```javascript
var redis_client = redis.createClient({
    host: REDIS_HOST,
    port: REDIS_PORT
  })
```

In app.js file of express application, write require module
```javascript
var requestLimitter = require('express-req-rate-limitter-redis')(redis_client)
```

Then after app.set functions write this line
```javascript
app.use(requestLimitter)
```
That's it!

# Options
You can configure default limits, by profiding second parameter in this part
```sh
.. require('express-req-rate-limitter-redis')(redis_client, options)
```
options object should contain these fields.
* calcRpsEachNseconds: 300,
* TimeFrameInMinutes: 1,
*  maxUserRequestLimitPerTimeFrame: {
    *  POST: 50,
    *  GET: 300,
    *  PUT: 50,
    *  DELETE: 50
    *  }

### calcRpsEachNseconds
> this parameter controls how often should RPS be calculated and printed to console log. By Default after each 300 requests will print current RPS load of server.

### TimeFrameInMinutes
> This parameter controls limit time-frame. By default limits apply to 1 minute. If you want to extend limit window to 15 minues, just set this to 15.

### maxUserRequestLimitPerTimeFrame
> This object contains limits for each type of http request. Adjust it upon your needs.


text:
## SuperHeroes
Here are the routes to manipulate `Super Heroes`,
a token must be passed in all queries, it may be passed as a `json` with the `token` property, in the `query` or as `x-access-token`.

### POST /ListSuperHero
output:
```
{
  "name": "<SuperHero name>",
  "alias": "<SuperHero secret identity>",
  "protection_area": {
    "name": "<Area name>",
    "lat": <latitude of the area>,
    "long": <logintude of the area>,
    "radius": <radius of the protection area>
  }
  "super_powers": [<List of SuperPowers names>]
}
```

No hero with such name output:
```
{
    "error": "<error message>",
    "success": false
}
```

### POST /ListSuperHeroes

The `input` information can be used to paginate the list of heroes , the maximum number of heroes listed is 100, more then that and only 100 heroes are returned.

input: [may be empty]
```
{
    skipt: <number of users to skip>,
    limit: <max number of users to return>
}
```

output:
```
{
  total_count: <total number of users>,
  heroes: [<list of SuperHeroes>]
}
```

### POST /AddSuperHero [admin]
input:
```
{
  "name": "<SuperHero name>",
  "alias": "<SuperHero secret identity>",
  "protection_area": {
    "name": "<Area name>",
    "lat": <latitude of the area>,
    "long": <logintude of the area>,
    "radius": <radius of the protection area>
  }
  "super_powers": [<List of SuperPowers names>]
}
```
output:
```
{
    "success": <bool>,
    "error": "<error message if an error occurred>",
}
```

### POST /UpdateSuperHero [admin]
input, name is the only mandatory property
```
{
  "name": "<SuperHero name>",
  "alias": "<SuperHero secret identity>",
  "protection_area": {
    "name": "<Area name>",
    "lat": <latitude of the area>,
    "long": <logintude of the area>,
    "radius": <radius of the protection area>
  }
  "super_powers": [<List of SuperPowers names>]
}
```

output:
```
{
    "success": <bool>,
    "error": "<error message if an error occurred>",
}
```

### POST /DeleteSuperHero [admin]
input:
```
{
    "name": "<SuperHeroName>"
}
```

output:
```
{
    "success": <bool>,
    "error": "<error message if an error occurred>",
}
```


text:
Pattern: Missing use of `++`/`--`

Issue: -

## Description

By convention, for better readability, incrementing an integer variable by 1 is recommended to be done using the `++` operator.
This rule spots expressions like `i += 1` and `i -= 1` and proposes to change them into `i++` and `i--`.

## Further Reading

* [Revive - increment-decrement](https://revive.run/r#increment-decrement)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
# Structure of the FTP site

This file provides an overview of the structure of the FTP site.

### Top level of the site

At the top level of the site, ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/, there are a number of files and directories.

Files present in ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/:
 - README files: These provide information on a variety of topics related to this FTP site and the data it contains.
 - CHANGELOG file: This file records alterations made to this FTP site.
 - current.tree file: This file lists all directories and files currently present on this FTP site.

Directories present in ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/:
- changelog_details
- data
- data_collections
- historical_data
- phase1
- phase3
- pilot_data
- release
- technical

These directories and described in the next section of this file.

### Directories

#### changelog_details

This directory contains a series of files detailing the changes made to the FTP site over time.

#### data

The data directory formerly housed data generated during the 1000 Genomes Project. The data that was previously located here has been integrated into data_collections and is present under ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/1000_genomes_project/data. Further information on this move can be found in ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data/README_data_has_moved.md.

#### data_collections

The data_collections directory contains directories for various collections of data, typically generated by different projects. Among the data collections is the **1000 Genomes Project** data.

For each collection of data, within the directory for that collection, README and index files provide information on the collection. Under each collection directory, there is a data directory, under which files are organised by population and then sample. Further information can be found in ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/README_data_collections.md.

#### historical_data

This directory was created during a rearrangement of the FTP site in September 2015. It houses README and index files that were formerly present at the toplevel of this site, including dedicated index directories. Further information is available in ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/historical_data/README_historical_data.md.

#### phase1

This directory contains data that supports the publications associated with phase 1 of the 1000 Genomes Project.

#### phase3

This directory contains data that supports the publications associated with phase 3 of the 1000 Genomes Project.

#### pilot_data

This directory contains data that supports the publications associated with the pilot phase of the 1000 Genomes Project.

#### release

The release directory contains dated directories which contain analysis results sets plus README files explaining how those data sets were produced.

Originally, the date in release subdirectory names was the date on which the given release was made. Thereafter, the release subdirectory dates were based on the date in the name of the corresponding YYYYMMDD.sequence.index file. In future, the date in the directory name will be chosen in a manner appropriate to the data and the nature of the release.

Examples of release subdirectories are:
- ftp://ftp.1000genomes.ebi.ac.uk/release/2008_12/
- ftp://ftp-trace.ncbi.nih.gov/1000genomes/release/2008_12/

In cases where release directories are named based on the date of the YYYYMMDD.sequence.index, the SNP calls, indel calls, etc. in these directories are based on alignments produced from data listed in the  YYYYMMDD.sequence.index file.

For example, the directory
ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20100804/
contains the release versions of SNP and indel calls based on the
ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/historical_data/former_toplevel/sequence_indices/20100804.sequence.index
file.

#### technical

The technical directory contains subdirectories for other data sets such as simulations, files for
method development, interm data sets, reference genomes, etc..

An example of data stored under technical is ftp://ftp.1000genomes.ebi.ac.uk/technical/simulations/.

***WARNING: ftp://ftp.1000genomes.ebi.ac.uk/technical/working/***

The working directory under technical contains data that has experimental (non-public release) status
and is suitable for internal project use only. Please use with ***caution***.

### Further information

Should you require further assistance in navigating the FTP site, please contact<EMAIL_ADDRESS>


text:
# kd.js

a collection of ui widgets and other nice things.

```
npm i kd.js
```

# usage

```js
var main = new kd.View;
main.appendToDomBody();

var input = new kd.InputView;
var form = new kd.View;

form.addSubView(input);
form.addSubView(new kd.ButtonView({
  title: 'i\'m a button. type in your name and click on me',
  callback: function () {
    alert('sup ' + input.getValue())
  }
}));

var tabs = new kd.TabView({
  hideHandleCloseIcons: true,
  paneData: [
    {
      title: 'tab1',
      partial: 'that\'s me, tab1'
    },
    {
      title: 'form',
      view: form
    }
  ]
});

main.addSubView(tabs);
```

# example

Type `make example` and go to http://localhost:3000/example. This also starts a `watchify` process, so any changes you make in `example/index.js` will be recompiled on the spot.

# development

To watch `lib` and build standalone umd package into `dist` folder upon changes, type: `make development-dist`

If you want to recompile each coffee individually into `build` folder, type: `make development`

Since `package.json` exposes only `build` folder; if you are bundling kd.js with browserify, second method (along with a `npm link`) might be a better option.

# license

mit

repository: cansirin/kd

repo_name: cansirin/kd


text:
AMO Tools Suite [![](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ORNL-AMO/amo-tools-suite/blob/develop/LICENSE.txt)
---------------

AMO Tools Suite is a cross-platform collection of calculations and tools to support industrial equipment modeling.


text:
#jquery.inputfit.js
Plugin that makes value of the input fit into the input, see the [demo](http://vxsx.github.io/jquery.inputfit.js/)
Plugin fits text by changing the font-size, so you should set min and
max font-size values. If you don't specify max font-size, plugin assumes current font-size
is maximum.

Requires

*  jquery 1.6.2 or higher (why wouldn't you use latest anyway)

Default options

``` javascript
minSize : 10
maxSize : false
```

Using:

``` html
<input type="text" name="younameit" id="input">
<script type="text/javascript">
    $('input').inputfit();
</script>
```

Note
-------
I just needed this functionality for our company's project, it works
alright with some potential tweaking in *all* browsers (IE6+, CHR, SAF,
FF3+, O10+ etc.). Please, file an issue if something is broken, I
promise I'll look in to it)

TODO:
-----

* fix jumps in some cases

License
-------

The MIT License

Copyright (c) 2013 Vadim Sikora

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.


text:
---
aliases: Pronouns – When to Use Them
---

## Pronouns – When to Use Them

How do I decide whether or not to use a pronoun?

### Description

When we talk or write, we use pronouns to refer to people or things without always having to repeat the noun or name. Usually, the first time we refer to someone in a story, we use a descriptive phrase or a name. The next time we might refer to that person with a simple noun or by name. After that we might refer to him simply with a pronoun as long as we think that our listeners will be able to understand easily to whom the pronoun refers.

> Now there was **a man from the** **Pharisees whose name was Nicodemus, a Jewish leader**. **This man** came to Jesus at night. Jesus replied and said to **him** … (John 3:1, 2a, 3a ULT)

In John 3, Nicodemus is first referred to with noun phrases and his name. Then he is referred to with the noun phrase “this man.” Then he is referred to with the pronoun “him.”

Each language has its rules and exceptions to this usual way of referring to people and things.

* In some languages, the first time something is referred to in a paragraph or chapter, it is referred to with a noun rather than a pronoun.
* The main character is the person whom a story is about. In some languages, after a main character is introduced in a story, he is usually referred to with a pronoun. Some languages have special pronouns that refer only to the main character.
* In some languages, marking on the verb helps people know who the subject is. (See [Verbs](figs-verbs.md).) In some of these languages, listeners rely on this marking to help them understand who the subject is. Speakers will use a pronoun, noun phrase, or proper name only when they want either to emphasize or to clarify who the subject is.

#### Reasons This Is a Translation Issue

* If translators use a pronoun at the wrong time for their language, readers might not know about whom the writer is talking.
* If translators too frequently refer to a main character by name, listeners of some languages might not realize that the person is a main character, or they might think that there is a new character with the same name.
* If translators use pronouns, nouns, or names at the wrong time, people might think that there is some special emphasis on the person or thing to which it refers.

### Examples From the Bible

The example below occurs at the beginning of a chapter. In some languages it might not be clear to whom the pronouns refer.

> Then Jesus entered into the synagogue again, and there was a man who had a withered hand. Some people watched **him** closely to see if **he** would heal **him** on the Sabbath so that they might accuse **him**. (Mark 3:1-2 ULT)

In the example below, two men are named in the first sentence. It might not be clear whom “he” in the second sentence refers to.

> Now after some days had passed, **King Agrippa** and Bernice came down to Caesarea to pay their respects to **Festus**. After **he** had been there for many days, Festus presented to the king the things concerning Paul. (Acts 25:13-14)

Jesus is the main character of the book of Matthew, but in the verses below he is referred to four times by name. This may lead speakers of some languages to think that Jesus is not the main character. Or it might lead them to think that there is more than one person named Jesus in this story. Or it might lead them to think that there is some kind of emphasis on him, even though there is no emphasis.

> At that time **Jesus** went on the Sabbath day through the grainfields. **His** disciples were hungry and began to pluck heads of grain and eat them. But when the Pharisees saw that, they said to **Jesus**, “See, your disciples do what is unlawful to do on the Sabbath.” But **Jesus** said to them, “Have you never read what David did, when he was hungry, and the men who were with him?” Then **Jesus** left from there and went into their synagogue. (Matthew 12:1-3,9 ULT)

### Translation Strategies

(1) If it would not be clear to your readers to whom or to what a pronoun refers, use a name or a noun.<br>
(2) If repeating a noun or name would lead people to think that a main character is not a main character, or that the writer is talking about more than one person with that name, or that there is some kind of emphasis on someone when there is no emphasis, use a pronoun instead.

### Examples of Translation Strategies Applied

(1) If it would not be clear to your readers to whom or to what a pronoun refers, use a name or a noun.

> Again **he** walked into the synagogue, and a man with a withered hand was there. Some Pharisees watched **him** to see if **he** would heal the man on the Sabbath. (Mark 3:1-2)
>
> > Again **Jesus** walked into the synagogue, and a man with a withered hand was there. Some Pharisees watched **Jesus** to see if **he** would heal the man on the Sabbath.

(2) If repeating a noun or name would lead people to think that a main character is not a main character, or that the writer is talking about more than one person with that name, or that there is some kind of emphasis on someone when there is no emphasis, use a pronoun instead.

> At that time **Jesus** went on the Sabbath day through the grainfields. **His** disciples were hungry and began to pluck heads of grain and eat them. But when the Pharisees saw that, they said to **Jesus**, “See, your disciples do what is unlawful to do on the Sabbath.” But **Jesus** said to them, “Have you never read what David did, when he was hungry, and the men who were with him?” Then **Jesus** left from there and went into their synagogue. (Matthew 12:1-3,9 ULT)

This may be translated as:

> > At that time **Jesus** went on the Sabbath day through the grainfields. **His** disciples were hungry and began to pluck heads of grain and eat them. But when the Pharisees saw that, they said to **him**, “See, your disciples do what is unlawful to do on the Sabbath.” But **he** said to them, “Have you never read what David did, when he was hungry, and the men who were with him?” Then **he** left from there and went into their synagogue.

repository: mandolyte/uw-obsidian

repo_name: mandolyte/uw-obsidian