text:
# Togglate

[![Build Status](https://travis-ci.org/melborne/togglate.png?branch=v0.1.0)](https://travis-ci.org/melborne/togglate)

  Togglate is a tool for creating a base text of translation, in which original texts are embeded in a form of comments.

## Installation

Add this line to your application's Gemfile:

    gem 'togglate'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install togglate

## Usage

See `togglate` command.

## Contributing

1. Fork it ( http://github.com/melborne/togglate/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

repository: melborne/togglate

repo_name: melborne/togglate


text:
## Description:
The first step is to establish basic network connectivity for your router/gateway.
This will allow you to connect to the installation server on the distribution network,
from which you can install the routing software needed in later steps.
Your router needs three network interfaces:

- the loopback interface (lo; which is used for network connections within the gateway)
- the interface connected to the distribution network (eth1)
- the interface connected to your network (eth0).

Each interface needs an address, netmask and broadcast address.
It is important that you specify the correct netmask and broadcast address!

D4-router.lab-2 expected configuration:

    lo   - loopback

    eth0 - internal network
      Network:    <IP_ADDRESS>/29
      IP-Address: <IP_ADDRESS>
      Netmask:    <IP_ADDRESS>
      Broadcast:  <IP_ADDRESS>

    eth1 - external network
      Network:    <IP_ADDRESS>/26
      IP-Address: <IP_ADDRESS>
      Netmask:    <IP_ADDRESS>
      Broadcast:  <IP_ADDRESS>
      Gateway:    <IP_ADDRESS>

## Implementation:

- Login to D4-router.lab-2 as root
- Copy /etc/network/interfaces to /etc/network/interfaces.change.0002
- Open /etc/network/interfaces in vi and add the following contents:

~~~
auto lo eth0 eth1

iface lo inet loopback

iface eth0 inet static
  address <IP_ADDRESS>
  netmask <IP_ADDRESS>
  broadcast <IP_ADDRESS>

iface eth1 inet static
  address <IP_ADDRESS>
  netmask <IP_ADDRESS>
  broadcast <IP_ADDRESS>
  gateway <IP_ADDRESS>
~~~

Save file and run `ifup lo eth0 eth1`

## Verification:
- Should be able to ping <IP_ADDRESS> from D4-router.lab-2
- Restart router
- Should be able to ping <IP_ADDRESS> from D4-router.lab-2

## Backout:
  None needed

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
layout: page
title: Lean Prover Zulip Chat Archive
permalink: archive/113488general/56247localnotationforfinn1.html
---

## [general](index.html)
### [local notation for fin (n+1)](56247localnotationforfinn1.html)

#### [Johan Commelin (May 24 2018 at 10:38)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019139):
How do I make the following work?
```lean
local notation ` [n] ` := fin (n+1)
```
I need this notation a lot, and all the explicit `fin (n+1)`'s are driving me crazy. Plus all the off-by-one errors that creep into my code...

#### [Kevin Buzzard (May 24 2018 at 10:40)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019201):
hmm

#### [Kevin Buzzard (May 24 2018 at 10:40)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019204):
`[n]` already means something else

#### [Kevin Buzzard (May 24 2018 at 10:40)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019208):
Oh -- I think that the n in quotes is a literal n

#### [Kevin Buzzard (May 24 2018 at 10:41)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019213):
so at the very least you'll want `` ` [ ` n ` ] ` ``

#### [Kevin Buzzard (May 24 2018 at 10:41)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019219):
but I am not sure how over-riding already-used notation works

#### [Johan Commelin (May 24 2018 at 10:45)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019343):
Thanks, it is working now. I didn't know about the existing notation; but using `local notation` I can override it just fine (-;

#### [Kevin Buzzard (May 24 2018 at 10:58)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019774):
```lean
variable (n : ℕ)
#check [n] -- list ℕ
```

#### [Kevin Buzzard (May 24 2018 at 10:58)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019779):
you just broke list ;-)

#### [Kevin Buzzard (May 24 2018 at 10:58)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019780):
at least locally

#### [Kevin Buzzard (May 24 2018 at 10:58)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019783):
of course, this might be clever :-)

#### [Kevin Buzzard (May 24 2018 at 10:59)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127019795):
although given your smiley convention I think I would have recommended `` ` (-; ` n ` ;-) ` ``

#### [Johan Commelin (May 24 2018 at 11:07)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020026):
Hmm, but I guess that the `local` prefix means that I am still safe. I'm not using lists...

#### [Patrick Massot (May 24 2018 at 11:16)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020289):
Johan, there are plenty of brackets available. See how I use brackets for commutators in https://github.com/PatrickMassot/lean-scratchpad/blob/master/src/support.lean#L115 for instance

#### [Kevin Buzzard (May 24 2018 at 11:16)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020333):
But `[n]` is standard in this game, isn't it?

#### [Patrick Massot (May 24 2018 at 11:16)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020336):
Sure. `[a, b]` for commutators is also standard

#### [Kevin Buzzard (May 24 2018 at 11:16)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020337):
CS : "overloading is bad"; Math "but we do it so well!"

#### [Patrick Massot (May 24 2018 at 11:17)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020344):
But waiting for CS people to change their notation for lists won't help

#### [Kevin Buzzard (May 24 2018 at 11:17)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020345):
I don't think Johan should even make the notation local

#### [Kevin Buzzard (May 24 2018 at 11:17)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020348):
I think Lean should just infer which notation is being used

#### [Kevin Buzzard (May 24 2018 at 11:17)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020350):
it has an elaborator, right?

#### [Patrick Massot (May 24 2018 at 11:17)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020351):
Sometimes it does

#### [Patrick Massot (May 24 2018 at 11:19)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020406):
Sean, I meant: "sometimes it infers which notation is being used", not "sometimes it has an elaborator"...

#### [Sean Leather (May 24 2018 at 11:20)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020458):
Patrick: Aww, I liked the latter interpretation better.

#### [Kevin Buzzard (May 24 2018 at 11:25)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020591):
Man, that would be a pretty crazy Lean 4 development

#### [Kevin Buzzard (May 24 2018 at 11:25)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020594):
"we removed the elaborator to encourage users to write better code"

#### [Kevin Buzzard (May 24 2018 at 11:25)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020596):
the metamath approach

#### [Patrick Massot (May 24 2018 at 11:26)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020637):
This time we are happy Mario isn't working on Lean 4

#### [Sean Leather (May 24 2018 at 11:26)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127020640):
Slogan: How To Be Lean: Elaborate It Yourself!

#### [Reid Barton (May 24 2018 at 20:18)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041620):
I wish there was something between `notation` and `local notation`, so that modules could export notation without forcing every downstream client to see it.
For example, something like notation which is tied to the current namespace, so that it is only visible when that namespace is open.

#### [Reid Barton (May 24 2018 at 20:18)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041638):
(I think that exact idea is probably not very good, but something of that flavor.)

#### [Mario Carneiro (May 24 2018 at 20:22)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041848):
This is exactly how lean 2 notation used to work. Why it changed, I don't know, and I'm not clear on whether to expect this to be different in lean 4.

#### [Mario Carneiro (May 24 2018 at 20:24)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041932):
I think that lean 3 notation is not handled very well at all, this is why I avoid all notation overloading in mathlib

#### [Johan Commelin (May 24 2018 at 20:25)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041951):
Hmmm, ok. Does that mean that my `local notation` for `fin (n+1)` is dangerous?

#### [Mario Carneiro (May 24 2018 at 20:25)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127041964):
A local notation is fine, assuming you never use lists in that file

#### [Mario Carneiro (May 24 2018 at 20:26)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127042026):
but global notations require global coordination

#### [Johan Commelin (May 24 2018 at 20:26)](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/local%20notation%20for%20fin%20%28n%2B1%29/near/127042033):
Ok, understood


text:
# Wish API

API server for wish-list management, built in Rust. Very much a work in progress, "forked" from: (FuzzyWuzzie/wysh)[https://github.com/FuzzyWuzzie/wysh]

repository: hamaluik/wish-api

repo_name: hamaluik/wish-api


text:
# AppRTC-iOS

## Project setup

Install [XcodeGen](https://github.com/yonaskolb/XcodeGen) and [cocoapods](https://cocoapods.org/), then run `./setup_xcode_project.sh`.

## Source code directories

+ [https://webrtc.googlesource.com/src/+/master/examples/objc/](https://webrtc.googlesource.com/src/+/master/examples/objc/)

repository: XueshiQiao/AppRTC-iOS

repo_name: XueshiQiao/AppRTC-iOS


text:
---
layout: post
title: "[System Design] Concepts"
description: ""
comments: true
keywords: ""
---

TODO:
1. SOAP b.s. REST v.s. RPC
2. user quota: You can use user quotas to limit the amount of disk space or the number of files that a user can use. like in linux, quotecheck  on a filesystem to limit user/group
3. cloud data storage service:
>  a. s3 over HDFS;
> 1. Simply put, S3 is **elastic**, HDFS is not.
> 2. **SLA** S3’s availability and durability is far superior to HDFS’.
> 3. **data integrity**, big data system with HDFS's **atomic rename feature** support atomic writes: output of a job is observed by the readers inan "all of nothing" fashion. S3 don't have data integrity support, -> requiring complicated application logic to guarantee data integrity
> -- <cite> https://databricks.com/blog/2017/05/31/top-5-reasons-for-choosing-s3-over-hdfs.html</cite>

4. on-premise sw
5. **Off the shelf software** are standardised software applications that are mass-produced, available to the general public, and fit for immediate use. They are designed for a broad range of customers, offering a comprehensive set of features to streamline operations.

6. Zookeeper:

7. Minimum viable product(MVP)
8. Know one consensus algorithm.
9. etcd: etcd cannot be stored in memory(ram) they can only be persisted in disk storage, whereas redis can be cached in ram and can also be persisted in disk. etcd does not have various data types. It is made to store only kubernetes objects. But redis and other key-value stores have data-type flexibility.

9. battle-tested:redis,
10. JWT:
    1. signature method: HS256 (HMAC with SHA-256), RS256
    2. SingleFactorAuthentication(UserName+Password)
    3. MultiFactorAuthentication(UP + OTP(One-Time Password))

11. Authentication Server
$$
12. interview能怎么简单怎么来，但是工作中，要前瞻性

   10mins: Bussiness(UseCases)/Common Sense
   10mins: Constraints
   10mins: Architecture
   10mins: API design
   10mins: DB Choice
   10mins: Data Model

13. disagree with design:
    1.  fundmentally not work, from theory not work
    2.  I don't know what's the best solution, but I don't think this is the best.

14. logical partition: physical partition:
   more traffic server can redirect a req to spare server

15. reverse proxy: A reverse proxy server is a type of proxy server that typically sits **behind the firewall** in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.

The difference between a forward and reverse proxy is subtle but important. A simplified way to sum it up would be to say that a forward proxy sits in front of a client and ensures that no origin server ever communicates directly with that specific client. On the other hand, a reverse proxy sits in front of an origin server and ensures that no client ever communicates directly with that origin server.

##  proxy:
### Forward Proxy
1. **collapsed forwarding**: forward proxy: combine the same req into one
2. can **hide** the identity of the client from the server by sending requests on behalf of the client.
3. used to cache data, filter requests, log requests, or transform requests (by adding/removing headers, encrypting/decrypting, or compressing a resource).
### reverse proxy
1.  can be used for caching, load balancing, anonymizing the servers, or routing requests to the appropriate servers.
2.

### Pagination
but the parameter nextPageToken will allow you to page through multiple rows.

### Server capacity estimation

server: 1000 QPS -> more than 1 server, needs partitions,
1k - 10k QPS:  1M(read-only)

DB server: Storage: 1 MySQL Server: 100GB
Assuming a high-end server has 144GB of memory,
Btree level3: 50GB,
      level4: TB

### UUID discussion
e.g. twitterId
1. encode creation time in ID:
   a. bits for epoch time
   b. bits for the auto-increasing seq num:
      We can reset our auto incrementing sequence every second. For **fault tolerance**and better performance, we can have **two database** servers to generate auto-incrementing keys for us, one generating **even numbered keys** and the other generating **odd numbered keys.**

   50 years: -> 5 * 86400 * 365 -> 1.6B ->

# System Optimization:
https://sre.google/sre-book/addressing-cascading-failures/

### Cache:
   1. Slow Startup by Cold Caching

      In steady-state operation with a warm cache, only a few cache misses occur, but when the cache is completely empty, 100% of requests are costly.
      mploy caches to keep a user’s state in RAM.

   2.  It’s a good idea to ensure that all clusters carry nominal load and that the caches are kept warm.

#### cache invalidation:
###### write through:
write to cache and DB simultaneously
pros: 1. data consistency. 2. nothing lost upon crash
cons: higher latency, double write

###### write-around:
write to DB, bypass the cache;
for the pattern, only write, but not re-read

###### write-back:
data to cache alone, completion is confirmed to clinet immediately
write back understand an interval
pros: for low-latency and high-throughput write-intensive app
cons: data loss of crash


text:
# Theme Inheritance <Badge type="warning" text="beta" />

## Concepts

To introduce this section, let’s start with some basic concepts:

- **Atomic theme**：that is the parent theme, implemented entirely from scratch, like the default theme.
- **Derived theme**：that is the child theme, created based on parent theme.

::: tip
For now theme inheritance doesn’t support high-order inheritance, that means, a derived theme cannot be inherited.
:::

## Usage

Suppose you want to create a theme inherited from the default theme, you only need to configure the [extend](./option-api.md#extend) option in your theme configuration:

```js
module.exports = {
  extend: '@mdpress/theme-default'
}
```

## Inheritance Strategy

All the capabilities of the parent theme will be `"passed"` to the child theme. For file-level conventions, child theme can override it by creating a file with the same name in the same location. For some theme configuration options, such as [globalLayout](./option-api.md#globallayout), child theme can override it by the same name configuration.

The [file-level conventions](./writing-a-theme.md#directory-structure) are as follows:

- **Sandbox Components**，that is the React components under `theme/sandbox`.
- **Components**，that is the React components under `theme/components`.
- **Global Style and Palette**，that is `index.styl` and `palette.styl` under `theme/styles`.
- **HTML Template**, that is `dev.html` and `ssr.html` under `theme/templates`.
- **Theme-Level App Enhancement File**，that is `theme/enhanceApp.js`

For theme configuration, the configuration options that can be overrode by child theme are as follows:

- [devTemplate](./option-api.md#devtemplate)
- [ssrTemplate](./option-api.md#ssrtemplate)
- [globalLayout](./option-api.md#globallayout)

Theme configuration options that cannot be overrode by child theme:

- [extend](./option-api.md#extend)

Theme configuration options requiring special treatment:

- [plugins](./option-api.md#plugins)：See [Override Plugins](#override-plugins)。

## Override Plugins

For [plugins](./option-api.md#plugins) in the parent theme, the child theme cannot override it intuitively, but the options of plugin can be overrode by creating plugin configuration with the same name.

For example, if the parent theme has the following configuration:

```js
// parentThemePath/index.js
module.exports = {
  plugins: [
    ['@mdpress/search', {
      searchMaxSuggestions: 5
    }]
  ]
}
```

The child theme can edit the options of plugin in the following ways:

```js
// themePath/index.js
module.exports = {
  plugins: [
    ['@mdpress/search', {
      searchMaxSuggestions: 10
    }]
  ]
}
```

Child theme can even disable it:

```js
// themePath/index.js
module.exports = {
  plugins: [
    ['@mdpress/search', false]
  ]
}
```

::: warning
You shouldn’t need to do this unless you know for sure that disabling plugins in parent themes won’t cause problems.
:::

## Override Components

You may want to override the same-name components in the parent theme. By default, when the components in the parent theme use relative paths to reference other components, you will not be able to do this because you cannot edit the code of the parent theme at runtime.

MdPress achieves this requirement in a clever way, but there is a requirement for the parent theme - **All components must use the `@theme` alias to refer to other components**.

For example, if you are developing an atomic theme with the following structure:

::: file
theme
├── components
│   ├── `Home.js`
│   ├── `Navbar.js`
│   └── `Sidebar.js`
├── layouts
│   ├── `404.js`
│   └── `Layout.js`
├── package.json
└── index.js
:::

Then, in any React components on the theme, **you should access the theme root directory through `@theme`**:

```jsx
import Navbar from<EMAIL_ADDRESS>// ...
```

On this premise, when you create a `Navbar` component in the same place in the child theme

::: file
theme
└── components
    └── `Navbar.js`
:::

<EMAIL_ADDRESS>will automatically map to the Navbar component in the child theme, and when you remove the component<EMAIL_ADDRESS>will automatically restore to the Navbar component in the parent theme.

This way, you can "tamper" with some part of an atomic theme.

<!-- textlint-disable en-capitalization -->

::: tip
1. You’d better override the component based on the code of the corresponding component in the parent theme.
2. When developing theme locally, you need to manually restart the dev server when a component is created or removed.
:::

<!-- textlint-enable -->

## Access Parent Theme

You can use `@parent-theme` to access the root path of the parent theme. The following example shows creating a layout component with the same name in a child theme and using slots in the parent theme.

```jsx
// themePath/components/Foo.js
import ParentLayout from<EMAIL_ADDRESS>import Foo from<EMAIL_ADDRESS>
export default function Layout(){
  return <ParentLayout>
             <Foo/>
         </ParentLayout>
}
```

repository: docschina/mdpress

gha_language: JavaScript

gha_license_id: MIT

repo_name: docschina/mdpress


text:
---
title: Logic App Builtin Async Handling
date: 2021-01-29T11:37:56-06:00
author: gerryw1389
layout: single
classes: wide
permalink: /2021/01/la-builtin-async-handling/
categories:
  - Azure
tags:
  - Cloud
  - Azure-LogicApps
---
<!--more-->

### Description:

Follow this guide to create Wrapper Logic Apps to introduce [Async communications](https://docs.microsoft.com/en-us/azure/architecture/patterns/async-request-reply#solution) for Azure Functions.

UPDATE 2021-05: I would skip this post and read about [my Durable Functions post](https://automationadmin.com/2021/05/azure-durable-functions) instead. I feel like this may work but it was back when I was first trying to solve a problem I have recently solved with Durable Functions so I would just do that instead. Keeping this here in case someone would rather do this.

### To Resolve:

1. Create a [Function App](https://automationadmin.com/2020/11/azure-function-python-http-template) in python with a `time.sleep(6)`, call it `sleep`

   - Using the template [here](https://github.com/gerryw1389/python/blob/main/scripts/azure-function-template/ReadJSON/__init__.py), add a line before the return that sleeps the app for a few seconds.

2. Create a logic app called `Async`

   - Trigger = Http request
   - Json structure = Paste in the same as the function app, in my case:

   ```json
   {
      "name": "gerry",
      "car": "mustang",
      "birth": {
      "city": "fort worth",
      "state": "Texas"
      }
   }
   ```

   - Action: Function App
     - Request body: `$body` from trigger

   - Action: Response
     - Status Code = 200
     - Headers: Content-Type - application/json
     - Body: `$body` from function `sleep`
   - On the Response action, select the ellipses to go to Settings. Turn `Asynchronous Response` toggle to on.

3. Create a logic app called `Controller`

   - Trigger = Reoccurance to whenever you want
   - Action: Logic App => Async
     - The inputs will auto show up as `city`, `state`, `car`, and `name`. Just fill them in with dummy data.

4. Run and you will get a response! It should take 6 seconds if you did `time.sleep(6)` in step 1. This proves that you can wrap a Logic App around a semi-long running Function App and take advantage of Async HTTP. I have not tested if this goes beyond the [3.9 minutes which will cause it to fail](https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-limits-and-config?tabs=azure-portal#http-request-limits).

   ```json
   [
      {
      "response": "Hello, gerry.\n\nYou chose dodge.\n\nYour birth city is fort worth in the state of tx",
      "date_time": "2020-12-09-21-13-26"
      }
   ]
   ```

branch_name: refs/heads/main


text:
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

**Expected behavior**

**Actual behavior**

**Steps to reproduce**

**Minimal yet complete reproducer code (or URL to code)**

**BuilT version**

**Python version (e.g. `python -version`)**


text:
Creating Projects Based on Templates
==

The creation of new projects can further be streamlined through the use of project templates. This is somewhat similar to leveraging reference projects (see [Creating Projects Based on Previous Projects](creating_project_based_on_prev_proj.md)). However, in this case you do not use an **.sdlproj* file, but an **.sdltlp* template file, which contains settings such as the selection of TMs (i.e. the translation provider configuration), termbases, task settings, source / target languages, etc.

While reference projects are mainly used when you need to handle update projects based on previous projects, project templates help streamline the creation of multiple similar projects, e.g. when a customer requires a specific project structure.

Create a Project Programmatically Based on a Template
--

Start by implementing a function called ```CreateBasedOnTemplate```. Use the [ProjectTemplateReference](../../api/projectautomation/Sdl.ProjectAutomation.Core.ProjectTemplateReference.yml) class to create a project template object. For this, you just need to provide the full name and path of the **.sdltpl* project template file:

# [C#](#tab/tabid-1)
```cs
string templateFile = @"c:\temp\project_template.sdltpl";
ProjectTemplateReference template = new ProjectTemplateReference(templateFile);
```
***

In the next step use the [FileBasedProject](../../api/projectautomation/Sdl.ProjectAutomation.FileBased.FileBasedProject.yml) class to create the new project. As parameters, you need to provide the project information (which we will retrieve through a separate helper function) and the project template object. Finally, apply the  [Save](../../api/projectautomation/Sdl.ProjectAutomation.FileBased.FileBasedProject.yml#Sdl_ProjectAutomation_FileBased_FileBasedProject_Save) method to persist the project in an **.sdlproj* file.
While the project template contains settings such as the source / target languages, translation providers, task settings, etc., some variable options still need to be configured, i.e. the:

* Project name
* Project due date
* Project location (i.e. the project files folder)

Below you see an example of how to configure the above settings:

# [C#](#tab/tabid-2)
```cs
ProjectInfo info = new ProjectInfo();

info.Name = "Project based on Template";
info.DueDate = DateTime.Now.AddDays(3);
string localProjectFolder = string.Format(
    CultureInfo.CurrentCulture,
    "{0){1}{2}{1}Projects{1}{3}",
    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString(),
    Path.DirectorySeparatorChar, Versioning.Versions.StudioDocumentsFolderName,
    info.Name);
info.LocalProjectFolder = localProjectFolder;

return info;
```
***

Putting it All Together
--

The two complete functions should now look as shown below:

# [C#](#tab/tabid-3)
```cs
public void CreateBasedOnTemplate()
{
    #region "GetTemplate"
    string templateFile = @"c:\temp\project_template.sdltpl";
    ProjectTemplateReference template = new ProjectTemplateReference(templateFile);
    #endregion

    #region "TemplateBasedProject"
    FileBasedProject newProject = new FileBasedProject(this.GetInfoForTemplateProject(), template);
    newProject.Save();
    #endregion
}
```
***

# [C#](#tab/tabid-4)
```cs
public ProjectInfo GetInfoForTemplateProject()
{
    #region "TemplateProjectInfo"
    ProjectInfo info = new ProjectInfo();

    info.Name = "Project based on Template";
    info.DueDate = DateTime.Now.AddDays(3);
    string localProjectFolder = string.Format(
        CultureInfo.CurrentCulture,
        "{0){1}{2}{1}Projects{1}{3}",
        Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString(),
        Path.DirectorySeparatorChar, Versioning.Versions.StudioDocumentsFolderName,
        info.Name);
    info.LocalProjectFolder = localProjectFolder;

    return info;
    #endregion
}
```
***

See Also
--
[Setting the Project Information](setting_the_project_information.md)

[Configuring the Project Properties](configuring_the_project_properties.md)

[Project Configuration](project_configuration.md)

repository: icmoldovan/studio-api-docs

repo_name: icmoldovan/studio-api-docs


text:
# narrow-git-ls

- Plugin for [narrow](https://atom.io/packages/narrow).
- Provide `git ls` files as item.

![narrow-git-ls](https://raw.githubusercontent.com/t9md/t9md/2f54f7689c534b6cdfcadda28c584d01524ffbc2/img/atom-narrow/provider-git-ls.gif)

## Keymaps

No default keymap.
Set keymap in your `keymap.cson` by yourself.
This is my keymap

```coffeescript
'atom-text-editor.vim-mode-plus:not(.insert-mode)':
  'ctrl-p': 'narrow:git-ls'
```

## Known issue

[works only in `text-editor` scope](https://github.com/t9md/atom-narrow/issues/259)


text:
# Lecture 3a:  A few comments after Lecture3 :

- miniconda install peculiarities:

  - the installation directory cannot be moved to a new location (even
    if you edit the new $PATH location). The reason is the **#!** line
    in many scripts are hardcoded (and we also found some conda issues)

  - The installation of miniconda (or anaconda) cannot handle a space
    in the directory name. The solution we came up with was a symbolic
    link. For example, if we have a user "Peter 1" on a Mac, we fix this
    as follows:
```
    cd  /Users
    sudo ln -s "Peter 1"  Peter_1
    cd Peter_1
    bash Miniconda....
```

- The ubuntu "*add account*" System Settings method does not allow the Username to contain spaces.
The **adduser** command has similar restrictions, so the following command would fail:
```
	sudo adduser "space man"
```

- ursa accounts are using **/bin/tcsh** as login shell, not
  **/bin/bash**, which is commonly the default on most Unix (Mac too) systems.
  This means you should add your modified command
  search path in the .cshrc file:

```
	setenv PATH  $HOME/miniconda3/bin:$PATH
```
instead of the bash variant
```
	export PATH=$HOME/miniconda3/bin:$PATH
```
and aliases are added without the **=** sign. For example:
```
	alias i ipython
	alias j "jupyter notebook"
	alias dth "ls -lt | head"
```
instead of the bash variant
```
	alias i=ipython
	alias j="jupyter notebook"
	alias dth="ls -lt | head"
```


text:
> Developed with [Giuseppe Marino](https://github.com/giuseppe16180)

## Hold and modify

The [HAM6](https://en.wikipedia.org/wiki/Hold-And-Modify) method allows to store images with 2^12 colors by using only 6 bits per pixel (instead of 12) and a palette with 16 colors, 12 bits each.

When displaying a pixel, the first 2 bits are used to determine what to do with the remaining 4 bits:
- `00` means that the other 4 bits should be used to access the palette
- `01` means that the green and blue channel are the same as the previous pixel, while the red channel is interpreted as true color from the remaining four bits
- `10` and `01` act just like the last one, changing the green and the blue channel respectively

The method only describes how to display the image, it doesn't take care of its creation.

### Usage

This implementation simulates this behaviour by limiting the colors that can be used, but doesn't output a 6 bpp image.
For each pixel, each of the four methods is executed (`00`, `01`, `10` and `11`). Whichever gives the smaller error is chosen, in a greedy way.

```matlab
h = ham6(img);
figure; imshow(h);
```

![](rgb.png)
 RGB | ![](ham6.png)
 HAM6
:----:|:----:

repository: francescotorregrossa/hold-and-modify

repo_name: francescotorregrossa/hold-and-modify


text:
# Cash Calculator - Team Bahen

## Description

The Cash Caclulator enables illiterate adults to work large numbers that they may otherwise be unable to deal with.
Illiterate people often have issues reading long multi-digit numbers, but they don't have an issue counting money.
Therefore, there are two key goals as part of this application. The first is that it should provide them an unlimited amount
of currency that they can use to do math with, and the second goal is that over time it will teach them to associate the numeral with
the cash value.

## Key Features
 * Use the app with Kenyan currency
 * Convert images of currency to a numeric representation
 * Clear the screen to start over
 * Perform addition
 * Perform subtraction
 * Perform multiplication
 * Use memory mode to review and modify your calculations
 * Convert a number into images of currency
 * Choose a different currency when the app is opened
 * Use the app with Pakistani currency

## Instructions

### Getting Started

#### Option 1: Installation on an Android device
  1. Download the apk on your device: https://github.com/csc301-winter-2020/team-project-18-my-oral-village/raw/readme-d2/deliverables/CashCalculator-Week3.apk
  2. Follow these instructions to enable APK installs on your device: https://www.expressvpn.com/support/vpn-setup/enable-apk-installs-android/
  3. Install the APK by opening it via a file explorer on your phone

#### Option 2: Use a web-based Android emulator that is already preconfigured with the application

https://appetize.io/app/ajk9nndhbr9747h9tdxqnju2z8?device=nexus5&scale=100&orientation=landscape&osVersion=8.1

### Using the features

 * Use the app with Kenyan currency
   1. Open the app
   2. Tap the hand icon
   3. Kenyan currency is displayed in the scrollbar at the bottom of the screen

 * Convert images of currency to a numeric representation
   1. Tap on a denomination at the bottom of the screen
   2. Observe that the number in the top right corner is updated to reflect what is now on the counting table

 * Clear the screen to start over
   1. Tap on a denomination at the bottom of the screen
   2. Observe that the number in the top right corner is updated to reflect what is now on the counting table
   3. Tap the handshake icon at the bottom left to clear the screen and reset the number to 0

 * Perform addition
   1. Tap on a 500 KES note (number should show 500 in the top right)
   2. Swipe from the right side of the screen towards the left side
   3. Tap on a 100 KES note and a 50 KES note (number should show 150 in the top right)
   4. Tap the addition button at the top left of the screen
   5. The result should now equal KES 650

 * Perform subtraction
   1. Clear the screen
   2. Tap on a 500 KES note (number should show 500 in the top right)
   3. Swipe from the left side of the screen towards the right side of the screen
   4. Tap on a 100 KES note and a 50 KES note (number should show 150 in the top right)
   5. Tap the subtraction button at the top left of the screen
   6. The result should now equal KES 350

 * Perform multiplication
   1. Clear the screen
   2. Tap on a 500 KES note (number should show 500 in the top right)
   3. Swipe from the top of the screen towards the bottom of the screen
   4. Tap on a 1 KES coin twice
   5. Tap the multiplication button at the top left of the screen
   6. The result should now equal KES 1000

 * Use memory mode to review and modify your calculations
   1. Clear the screen
   2. Tap on a 500 KES note (number should show 500 in the top right)
   3. Swipe from the right side of the screen towards the left side
   4. Tap on a 100 KES note and a 50 KES note (number should show 150 in the top right)
   5. Swipe from the top of the screen towards the bottom of the screen
   6. Tap on a 1 KES coin twice
   7. Tap the multiplication button at the top left of the screen
   8. The result should now equal KES 800 (result of 500 + 150 * 2)
   9. Tap the highway icon at the bottom left of the scren
   10. Tap the bridge at the bottom right of the screen twice
   11. Tap the 1 KES coin once
   12. Tap the bridge at the bottom right of the screen once
   13. The result should now be recalculated and display KES 950 (result of 500 + 150 * 3)

 * Convert a number into images of currency
   1. Clear the screen
   2. Swipe from the bottom of the counting table (wooden background) to the top of the screen
   3. Tap the number `5` twice
   4. Tap the green checkmark
   5. Observe the currency representation of the numeral

 * Choose a different currency when the app is opened and use the app with Pakistani currency
   1. Close the app (if already opened)
   2. Open the app
   3. Tap the Kenyan flag
   4. Tap the Pakistani flag

 ## Development requirements
   1. Download and install Android Studio: https://developer.android.com/studio
   2. `git clone https://github.com/csc301-winter-2020/team-project-18-my-oral-village.git`
   3. Open the `android-app` directory of the repo in android studio
   4. When running the app inside an emulator for the first time, follow the walkthrough in Android Studio

 ## Deployment and Github Workflow

 Typical workflow to deliver on a task:
  1. Create a personal branch
  2. Develop whatever you need on this branch
  3. Push your branch to the repository
  4. Open a Pull Request (PR)
  5. Assign a reviewer
  6. Work with the reviewer until the PR is in a good state
  7. Merge the PR assuming that all checks have passed (One approved review, branch is up-to-date with master, the build/tests have passed)

  We use GitHub Actions as our CI system. We chose it because it is already built into GitHub and doesn't require a third-party service.
  We use GitHub Actions in three ways. The first scenario is to build and test PRs before they are merged. The second scenario is to
  build an APK of the app when there is a change in the master branch. The third scenario is to generate javadocs when there is a change
  in the master branch.

 ## Licenses

We're still working with our partner to come to a decision on a license. The most likely decision will be MIT or BSD as it would be best to give people
freedom to do what they want with the code without restrictions.

gha_language: Java


text:
# goemail
Send email in golang

## Overview
This demo shows how to send emails in golang, which is usually needed to send alarm emails.

## Tips
The codes in the demo are easy to read.

So, what I want to talk about here are some tips when filling in the *sender information* and configuring your *email-setting*.
I will take [gmail](https://mail.google.com/mail) for example.

You can surely fill in *PASSWD* in [mymem.go](https://github.com/seafooler/goemail/blob/master/libofm/mymem.go) with your true passwd. However, it's unsafe.

Instead, you can set an [App password](https://support.google.com/accounts/answer/185833) and replace the *PASSWD* in mymem.go with it:

* Step1: Turn on your [2-step verification](https://support.google.com/accounts/answer/185839)
* Step2: Generate your 16-bit App passwords, and fill in the *PASSWD* with it.

## License
MIT (see [LICENSE](https://github.com/orcaman/concurrent-map/blob/master/LICENSE) file)

repository: seafooler/goemail

repo_name: seafooler/goemail


text:
# vscode-ts-decorators
Snippets for writing TypeScript decorators in VisualCode with ease.

[![Version](https://vsmarketplacebadge.apphb.com/version/semagarcia.vscode-ts-decorators.svg)](https://marketplace.visualstudio.com/items?itemName=semagarcia.vscode-ts-decorators)
[![Installs](https://vsmarketplacebadge.apphb.com/installs-short/semagarcia.vscode-ts-decorators.svg)](https://marketplace.visualstudio.com/items?itemName=semagarcia.vscode-ts-decorators)

## How use snippets?
When the extension is installed, open the source TypeScript file where you'll code your new TS decorator.

All snippets starts with the prefix "ts-dec", so, when you write this selector (and depending on how your editor is configured), a list of snippets will appear:

![List of snippets](https://github.com/semagarcia/vscode-ts-decorators/raw/master/screenshots/screenshot-1.png)

Then, select the snippet you want, and it will be appear ready to be filled:

![Snippet inserted](https://github.com/semagarcia/vscode-ts-decorators/raw/master/screenshots/screenshot-2.png)

The snippet is developed to facilitate your work as much as possible, so, once the snippet has been inserted in your code, the cursor will be placed in the name, to give you the possibility of naming it.

## Feedback
Please send any feedback or suggestions to @semagarcia (Twitter) or create an issue on the [issue section](https://github.com/semagarcia/vscode-ts-decorators/issues) in GitHub.

## Contributions
This is an open source project and you can feel free to contribute.

repository: semagarcia/vscode-ts-decorators

repo_name: semagarcia/vscode-ts-decorators


text:
# Polyporus igniarius var. scaber Berk., 1839 VARIETY

#### Status
SYNONYM

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

#### Published in
Ann. Mag. nat. Hist. , Ser. 1 3: 324 (1839)

#### Original name
Polyporus igniarius var. scaber Berk., 1839

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Hymenochaetales/Hymenochaetaceae/Phellinus/Phellinus rimosus/ Syn. Polyporus igniarius scaber/README.md

repo_name: mdoering/backbone


text:
# pdv-react-native-offline-queue

This package is a simple solution for handling actions or requests with redux while the app is in an offline state by queueing these, and dispatching them once connectivity is re-established. **Works perfect with react-native**

Motivation: Provide a better user experience.

- [Installation](#installation)
- [Usage](#usage)
- [Compatibility](#compatibility)
- [Additional Configuration](#additional-configuration)

## Installation

`yarn add pdv-react-native-offline-queue`

`npm install --save pdv-react-native-offline-queue`

## Usage

Get up and running in 4 easy steps:

### Step 1: Add the react-native-offline-queue reducer to your combine reducers

Either import the `{ reducer as offline }` from `pdv-react-native-offline-queue` and add it to the `combineReducers` or require it like so (whatever floats your boat):

```javascript
import { combineReducers } from "redux";

export default combineReducers({
  offline: require("pdv-react-native-offline-queue").reducer,
  yourOtherReducer: require("~App/yourOtherReducer").reducer,
});
```

### Step 2: Add the offlineMiddleware

```javascript
import { offlineMiddleware } from "pdv-react-native-offline-queue";

const composeStoreWithMiddleware = applyMiddleware(offlineMiddleware())(
  createStore
);
```

**Note** that this queue is not persisted by itself. One should provide a persistence config by using e.g. `redux-persist` to keep the offline queue persisted.

### Step 3: Declare the actions to be queued

#### With `reduxsauce`

```javascript
import { createReducer, createActions } from 'reduxsauce'
import { markActionsOffline } from 'pdv-react-native-offline-queue'

const { Types, Creators } = createActions({
    requestBlogs: null,
    createBlog: ['blog'],
})

markActionsOffline(Creators, ['createBlog'])
...
```

#### Without

```javascript
import { markActionsOffline } from 'pdv-react-native-offline-queue'

const Creators = {
  createBlog: blog => ({
    type: 'CREATE_BLOG',
    blog,
  }),
}

markActionsOffline(Creators, ['createBlog'])
...
```

Last but not least...

### Step 4: Monitor the connectivity and let the library know.

```javascript
import { OFFLINE, ONLINE } from "pdv-react-native-offline-queue";

if (appIsConnected) {
  dispatch({ type: ONLINE });
} else {
  dispatch({ type: OFFLINE });
}
```

Works perfect with React Native's `NetInfo`

```javascript
import { put, take, call } from "redux-saga/effects";
import NetInfo from "@react-native-community/netinfo";
import { OFFLINE, ONLINE } from "pdv-react-native-offline-queue";

function* startWatchingNetworkConnectivity() {
  const channel = eventChannel((emitter) => {
    NetInfo.isConnected.addEventListener("connectionChange", emitter);
    return () =>
      NetInfo.isConnected.removeEventListener("connectionChange", emitter);
  });
  try {
    while (true) {
      const isConnected = yield take(channel);
      if (isConnected) {
        yield put({ type: ONLINE });
      } else {
        yield put({ type: OFFLINE });
      }
    }
  } finally {
    channel.close();
  }
}
```

**Android**

If react native's `NetInfo` is intended to be used, for android don't forget to add the following to the `AndroidManifest.xml` :

```xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

Inspired by redux-queue-offline(mathieudutour)

Developed by Krzysztof Ciombor

## Compatibility

### with `redux-saga`

If you are using `redux-sagas` for http requests and want to fire your redux actions normally, but suspend(queue) sagas, for Step 2, do the following instead:

```javascript
import { applyMiddleware } from "redux";
import createSagaMiddleware from "redux-saga";
import {
  offlineMiddleware,
  suspendSaga,
  consumeActionMiddleware,
} from "pdv-react-native-offline-queue";

const middleware = [];

middleware.push(offlineMiddleware());
const suspendSagaMiddleware = suspendSaga(createSagaMiddleware());
middleware.push(suspendSagaMiddleware);
middleware.push(consumeActionMiddleware());

applyMiddleware(...middleware);
```

It is **IMPORTANT** that the `consumeActionMiddleware` is placed last, so you can allow the previous middlewares to react first before eventually getting consumed.

## Additional Configuration

Additional configuration can be passed with `offlineMiddleware()`, such as adding additional triggers that will trigger the offline queue to dispatch its actions:

```javascript
...
import { REHYDRATE } from 'redux-persist'

applyMiddleware(offlineMiddleware({
    additionalTriggers: REHYDRATE,
}))
...
```

## Contributing

Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org) code of conduct.

## License

Original work copyright 2020.

Read [LICENSE](LICENSE) for details.

The development of this package was inspired by the original project developed by [RobPando](https://github.com/kickstartcrew/redux-offline-queue)


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

### Description

Certificate.Verify in crypto/x509 in Go 1.18.x before 1.18.1 can be caused to panic on macOS when presented with certain malformed certificates. This allows a remote TLS server to cause a TLS client to panic.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/MrKsey/AdGuardHome

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
[![Lint and Test](https://github.com/Pondorasti/remark-replace-img-ext/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/Pondorasti/remark-replace-img-ext/actions/workflows/main.yaml)
[![NPM](https://img.shields.io/npm/v/@pondorasti/remark-replace-img-ext.svg)](https://www.npmjs.com/package/@pondorasti/remark-replace-img-ext)
[![NPM Downloads](https://img.shields.io/npm/dm/@pondorasti/remark-replace-img-ext)](https://www.npmjs.com/package/@pondorasti/remark-replace-img-ext)
[![Size](https://img.shields.io/bundlephobia/minzip/@pondorasti/remark-replace-img-ext.svg)](https://bundlephobia.com/result?p=@pondorasti/remark-replace-img-ext)

# remark-replace-img-ext

[**remark**](https://github.com/remarkjs/remark) plugin to prefix relative image paths with an absolute URL.

## Installation

```
npm install @pondorasti/remark-replace-img-ext
```

## Usage

### Source
```js
const html = require("remark-html")
const remark = require("remark")
const imgLinks = require("@pondorasti/remark-replace-img-ext")

remark()
  .use(imgLinks, { absolutePath: "https://cdn.domain.com/" })
  .use(html)
  .process("![Screenshot](images/screenshot.png)", (err, file) => {
    if (err) throw err
    console.log(String(file))
  })
```

### Yields
```html
<p><img src="https://cdn.domain.com/images/screenshot.png" alt="Screenshot"></p>
```

## API
### `remark.use(imgLinks[, options])`
* `options.absolutePath` (**required**) - the absolute path that will be prepended to the begging of image links.

## Contributions
If you are interested in contributing to this project, please open an issue with a description of what you would like to add.

## License
[MIT](LICENSE) © [Alexandru Turcanu](https://github.com/Pondorasti)

repository: tennox/remark-replace-img-ext

repo_name: tennox/remark-replace-img-ext


text:
# acCRISPR: An activity-correction method for improving CRISPR screen accuracy

acCRISPR is a tool developed in Python 3 for analyzing genome-wide CRISPR screens to identify essential genes for growth as well as significant hits for stress tolerance by removing low-activity sgRNA based on an activity cutoff. acCRISPR optimizes library activity and coverage to improve hit calling and screen accuracy.

## System requirements
acCRISPR can be implemented on any desktop computer running macOS or Linux. The tool has been tested on Linux: Ubuntu 20.04.

## Dependencies
acCRISPR requires Python version 3.6 or higher and the following Python libraries to be installed:
- `numpy (>=1.18.1)`
- `scipy (>=1.4.1)`
- `matplotlib (>=3.4.2)`
- `statsmodels (>=0.12.0)`

## Installation
Steps:
1. Clone this repository: `git clone https://github.com/ianwheeldon/acCRISPR.git`
2. Navigate to acCRISPR directory: `cd acCRISPR`
3. Install the Python package: `pip install .`

Provided all dependencies have already been installed, acCRISPR installation usually takes only about 1-2 mins. After executing the above steps, installation of the package can be confirmed by launching Python3 on the terminal and running `import acCRISPR`. If this results in no error, the package was installed correctly.

## Running acCRISPR on example datasets

*(Note: For the purposes of acCRISPR implementation, 'FS' denotes fitness score when analyzing growth screen data and tolerance score when analyzing stress tolerance screen data)*

acCRISPR implementation on 3 example datasets has been demonstrated here. The first two examples, pertaining to analysis of stress tolerance screen data in *Yarrowia lipolytica*, have been provided for the purposes of testing the source code by users on an external sample dataset (pH 3 dataset in Example 1) and an internal dataset (1500mM NaCl dataset in Example 2). Example 3 (*Y. lipolytica* Cas12a growth screening dataset) is used to demonstrate the use of acCRISPR to perform essential gene analysis for a given screening dataset.

### Example 1: Implementation on the pH 3 dataset from *Yarrowia lipolytica* tolerance screens

Navigate to the directory containing source code: `cd src/acCRISPR`

Copy test input files into this directory: `cp ../../example_data/pH3/*.tab .`

acCRISPR can be run for the original/uncorrected sgRNA library using the following command (run time ~ 7-10 mins):
```
python3 run_acCRISPR.py --counts pH3_counts_final.tab --replicate_info pH3_rep_file.tab --cov 6 --significance 2-tailed --output_prefix pH3_no_cutoff
```
The input files used in the above example can be found in the `pH3` directory within `example_data`.

- `--counts` is used to specify the file containing raw sgRNA counts for all replicates of each sample used in the screening experiment. The first and second columns specify the guide identifiers and associated gene names respectively, and the subsequent columns contain information on raw counts for each sgRNA in each sample replicate.
- `--replicate_info` contains information for mapping replicates to samples. The names of replicates in this file and their order should exactly match the column headers (for replicates) and their order (from left to right) in the file specified by `--counts`. If different controls are used for determining CS & FS, this file should contain 4 unique sample names - `Control_CS`, `Treatment_CS`, `Control_FS` & `Treatment_FS`. However, if a common control sample is used for both CS & FS estimation, only 3 unique sample names are needed - `Control`, `Treatment_CS` & `Treatment_FS`.
- `--cov` is used to provide the coverage (avg. no. of sgRNA per gene) of the original library, rounded off to the nearest integer. In the given example, the original library contains 46395 unique sgRNA targeting 7854 genes in the genome. Hence, the library coverage would be 5.91, which can be rounded off to 6.
- `--output_prefix` specifies the prefix for output file names (eg. after running the above command, the names of output files generated by acCRISPR would start with "pH3_no_cutoff").

For brief information on all input parameters to acCRISPR: `python3 run_acCRISPR.py -h`

If CS and FS of sgRNA have been pre-calculated, CS & FS (i.e., log2-fc) calculation can be skipped and the file containing CS & FS values can be provided directly as input to acCRISPR. In order to skip log2-fc calculation, the parameter `--skip_log2fc_calc` needs to be `True`.
```
python3 run_acCRISPR.py --skip_log2fc_calc --CS_FS_file CS_FS_values.tab --cov 6 --significance 2-tailed --output_prefix pH3_no_cutoff
```
In the above command, the filename specified for the parameter `--CS_FS_file` (i.e., `CS_FS_values.tab`) should contain CS and FS values of sgRNA. This file should be in the same format as `pH3_no_cutoff_guide_CS_FS.tab` found in the directory `pH3_no_cutoff` within `example_results`.

To run acCRISPR on the example pH 3 dataset with a CS-corrected library at a threshold of 5.0 & providing raw sgRNA counts as input, the `--cutoff` parameter should be set to 5.0, as in the command below:
```
python3 run_acCRISPR.py --counts pH3_counts_final.tab --replicate_info pH3_rep_file.tab --cov 6 --cutoff 5.0 --significance 2-tailed --output_prefix pH3_5.0
```
Alternatively, acCRISPR can be implemented for a corrected library by skipping CS & FS calculation from raw counts and providing CS & FS of sgRNA from the original/uncorrected library as input instead of the raw counts file. For the given example dataset, once acCRISPR has been implemented with the uncorrected library, it generates a file named `pH3_no_cutoff_guide_CS_FS.tab`, which can be provided as input to generate results at a threshold of 5.0 using the `--CS_FS_file` parameter. In addition, the parameter `--skip_log2fc_calc` needs to be `True`.
```
python3 run_acCRISPR.py --skip_log2fc_calc --CS_FS_file pH3_no_cutoff_guide_CS_FS.tab --cov 6 --cutoff 5.0 --significance 2-tailed --output_prefix pH3_5.0
```

acCRISPR provides the following output files:

- A TAB delimited file containing CS and FS of sgRNA in the corrected library (if a CS threshold is provided & `--skip_log2fc_calc` is `True`) or uncorrected library (if no CS threshold is provided). The file contains 4 columns - sgRNA ID, associated gene name, CS & FS. (If a CS threshold is provided but `--skip_log2fc_calc` is `False`, 2 separate files containing CS & FS of uncorrected and corrected libraries are output.)
- A TAB delimited file containing (uncorrected or corrected, depending on whether a threshold is provided) FS of all genes covered by the library. The file contains 2 columns - gene name & gene FS.
- A TAB delimited file containing raw and corrected p-values of all genes. The file contains 4 columns - gene name, gene FS, raw p-value and corrected p-value.*
- A PNG file showing the null distribution plot and corresponding null distribution parameters (mean & S.D.), as well as the number of sgRNA used per pseudogene to create this null distribution.*
- A text file containing information about the number of significant genes, average coverage of the uncorrected/corrected library, and the value of ac-coefficient.*

*Since the algorithm for hit identification by acCRISPR involves random sampling, the null distribution S.D. and hence, the p-values of genes and no. of significant genes would vary slightly with each run of the tool.

Output files obtained from runs on this example dataset with the uncorrected and corrected (threshold = 5.0) libraries can be found in `pH3_no_cutoff` and `pH3_cutoff_5.0` directories respectively (within the directory `example_results`).

### Example 2: Implementation on the 1500 mM NaCl tolerance screening dataset from *Y. lipolytica*

From the `acCRISPR` home directory, navigate to the directory containing source code: `cd src/acCRISPR`

Copy test input files into this directory: `cp ../../example_data/1500NaCl/*.tab .`

To run acCRISPR on this dataset with a CS-corrected library at a threshold of 1.5 & a 2-tailed test, use the following command:
```
python3 run_acCRISPR.py --counts 1500NaCl_counts_final.tab --replicate_info 1500NaCl_rep_file.tab --cov 6 --cutoff 1.5 --significance 2-tailed --output_prefix 1500NaCl_1.5
```

Output files obtained from this run can be found in the `1500NaCl_cutoff_1.5` directory (within the directory `example_results`).

### Example 3: Implementation on the Cas12a growth screening dataset from *Y. lipolytica*

The raw Cas12a library has an average coverage of 7, when rounded off to the nearest integer. This dataset is used for essential gene identification and hence, a 1-tailed test will need to be performed in this case.

From the `acCRISPR` home directory, navigate to the directory containing source code: `cd src/acCRISPR`

Copy test input files into this directory: `cp ../../example_data/Cas12a/*.tab .`

To run acCRISPR on this dataset with a CS-corrected library at a threshold of 0.5, use the following command:
```
python3 run_acCRISPR.py --counts Cas12a_counts_final.tab --replicate_info Cas12a_rep_file.tab --cov 7 --cutoff 0.5 --output_prefix Cas12a_0.5
```

Output files obtained from this run can be found in the `Cas12a_cutoff_0.5` directory (within the directory `example_results`).

## Scripts for library design and sequencing read processing
Custom MATLAB scripts that were used for the design of the CRISPR-Cas9 and -Cas12a libraries in *Y. lipolytica* and processing of Illumina sequencing reads to generate sgRNA abundance for both Cas9 and Cas12a screens can be found within four separate subdirectories in `MATLAB_scripts_genome_wide_CRISPR_screens_Y_lipolytica`. Each subdirectory contains a detailed `instructions_for_use.txt` file that the user is encouraged to read before implementing the scripts.

## Citation
If you use acCRISPR, please cite the following article:-

Ramesh, A., Trivedi, V., Lee, S. et al. acCRISPR: an activity-correction method for improving the accuracy of CRISPR screens. Commun Biol 6, 617 (2023). https://doi.org/10.1038/s42003-023-04996-8

repository: ianwheeldon/acCRISPR

repo_name: ianwheeldon/acCRISPR


text:
  PIP: PIP-0010
  Title: 50% Inflation Reduction
  Type: Protocol
  Impact: Hard-Fork
  Author: Herman Schoenfeld <herman@sphere10.com>
  Comments-URI: https://discord.gg/sJqcgtD  (channel #pip-0010)
  Status: Proposed
  Created: 2018-01-01

## Summary

A 50% reduction in the PASC inflation schedule is proposed. This change can be introduced immediately by changing a single line-of-code with minimal impact to existing ecosystem.

## Motivation

Due to the negative impact of mining centralization, the PascalCoin ecosystem has experienced stunted adoption. By some estimates, PascalCoin's user-base is half the size it would have been without the centralization. It follows from Metcalf's law that the PASC price is the square-root of what it would have been without the centralization.  This PIP intends to compensate the existing ecosystem for the damage it has incurred. Additionaly, in combination with other [PIPs][1] that resolve centralization, this change is intended to kick-start the interest PascalCoin had before the centralization. Another motivating factor is that this change can only be introduced within the next 5 months cleanly and without requiring to carry 2 separate inflation equations in perpetuity.

## Specification

PascalCoins are currently issued as miner rewards at 100 per block. Every four years (an epoch), this reward is halved. The halving continues until a minimum of 1 PASC is reached, at which point 1 PASC is minted for every block (tail-emission). The proposal here is to change the epoch period from four years to two. This will result in 50% inflation reduction with virtually 0 impact to the existing network and code.

### Code Changes

Change constant
```pascal
    CT_NewLineRewardDecrease: Cardinal = 420480;
```

to
```pascal
    CT_NewLineRewardDecrease: Cardinal = 210240;
```

No other changes will be required if this is activated **on or before** block 210240.

### Formal Proofs

Definitions
```
    let InitialReward = the initial miner reward (currently 100)
    let BlocksPerEpoch = the number of blocks before reward halves (currently 420480 which is ~4 years)
    let TailEmission = the minimum reward
```

The determine which epoch a random block ```x``` belongs to, use this equation
```
(1)    let Epoch(x) = x div BlocksPerEpoch
```

noting that the first epoch is 0, second 1 and so on.

To calculate the reward for any block x, prior to tail emission
```
(2)    let BlockReward(x) = InitialReward / 2^Epoch(x)
```

Tail-emission begins on the first block ```y``` such that ```BlockReward(y) < 1```. After y, ```TailEmission``` is rewarded on every block. Thus the general form of (2) is
```
(3)     BlockReward(x) = MAX( InitialReward / 2^Epoch(x), TailEmission)
```

To calculate the last epoch before tail emission begins, use
```
(4)     LastEpoch = FLOOR( LOG2( BlockReward ) )
```

To calculate the block number where tail emission starts
```
(5)     TailStart = (LastEpoch + 1) * BlocksPerEpoch
```

To measure the supply up and until tail emission
```
(6)     TotalSupply = SUM(i=0..LastEpoch) InitialReward / 2^i * BlocksPerEpoch
```

For the current protocol,
```
    InitialReward = 100
    BlocksPerEpoch = 420480   ; ~4 years
    LastEpoch = 6
    Total Supply = 83,439,000
```

For the new protocol (assuming this change activated in epoch 0),
```
    InitialReward = 100
    BlocksPerEpoch = 210240  ; ~2 years
    LastEpoch = 6
    Total Supply = 41 719 500.0
```

The inflation change is thus
```
    (New Total Supply) / (Old Total Supply)
```

which 50%.

## Rationale

Other approaches to modify inflation were considered but deemed undesirable since they alter consensus rules that have already been applied in the existing blockchain/safebox data. This would burdon all future protocol implementations with the legacy algorithm in order to verify the existing full blockchain. This approach avoids this burden and is the most elegant and simple way to achieve the same outcome.

## Backwards Compatibility

This change requires a hard-fork activation but is low-impact since the PascalCoin blockchain is currently is still in epoch 0 (and will continue to be for ~5 months). The effects of this proposal emerge on and after epoch 1 (block 210241). It is recommended that if an inflation schedule change is made, it is made in epoch 0 or never at all.

## Links

1. [PIP-0009 RandomHash: GPU & ASIC Resistant Hash Algorithm][1]

[1]: https://github.com/PascalCoin/PascalCoin/blob/master/PIP/PIP-0009.md

repository: iceMongus/PascalCoin

repo_name: iceMongus/PascalCoin


text:
<img src="https://framp.me/frappe/img/frappe.svg" alt="Frappe" width="150"/>

# Frappe

Frappe is a library for defining UI components based on time and events.

Frappe is for you if:

 - You like declarative programming
 - You like defining small components and compose them into bigger applications
 - You like your state to be close to where you need it (locally stateful programming)

If you have some doubts, please consult the [documentation](https://framp.me/frappe/docs/).

*Code snippets are not available in the documentation right now, but you can find relevant tests right after every function's implementation in the [code](https://github.com/framp/frappe/blob/mast@framp/frappe/core.ts)*

## Setup

To get started, you may want to install the library, [React](https://reactjs.org/) and [Parcel](https://parceljs.org/).

```bash
mkdir frappe-test && cd frappe-test
npm i @framp/frappe react react-dom parcel
```

You can execute the React based examples with this [index.html](https://github.com/framp/frappe/blob/master/examples/index.html), using [Parcel](https://parceljs.org/) and saving the code in `index.tsx`.

```bash
curl https://raw.githubusercontent.com/framp/frappe/master/examples/index.html > index.html
curl https://raw.githubusercontent.com/framp/frappe/master/tsconfig.json > tsconfig.json
parcel index.html
```

You can also use this [JSFiddle](https://jsfiddle.net/framp/onr01tmz/).

## Straws

The main building block in Frappe is called `Straw`.

A `Straw` has inputs and an output, exactly like a function, and it will be called multiple time during a normal run of your application.

It can return any type of data: Numbers, Strings, Objects, Arrays, React components.

It's implemented as a function which accepts 3 parameters `val`, `time`, `event` and returns an array containing a `next Straw` and a result.

```jsx
import { of } from '@framp/frappe'
const double = of((val, time, event) => [double, val*2])
const [nextStraw, result] = double(4, 0, null)
assert.equal(result, 8)
const [nextNextStraw, nextResult] = nextStraw(5, 1000, null)
assert.equal(nextResult, 10)
```

After the first call to your `Straw`, `nextStraw` will be called in place of your original `Straw`: this enables us to modify its behaviour in the next calls.

In this example our `Straw double` is returning itself for the next call, so this `Straw` will behave identically in all its runs.
In this case we can replace `of` with `fn`, which will automatically return the same `Straw` for us.

```jsx
import { of, fn } from '@framp/frappe'
const double = fn((val, time, event) => val*2)
const tripleThenDoubleForever = of((val, time, event) => [double, val*3])
const [nextStraw, result] = tripleThenDoubleForever(4, 0, null)
assert.equal(result, 12)
const [nextNextStraw, nextResult] = nextStraw(5, 1000, null)
assert.equal(nextResult, 10)
```

- `val` is a value passed to the `Straw`, it can be anything.
- `time` is a number representing how much time passed since the beginning of the computation.
- `event` is an object that describe an event (if it happened).

You can use `time` to return time dependent results.

```jsx
import { fn } from '@framp/frappe'
const oneSecondAfter = fn((val, time, event) => time+1000)
const [nextStraw, result] = oneSecondAfter(null, 0, null)
assert.equal(result, 1000)
const [nextNextStraw, nextResult] = nextStraw(null, 1000, null)
assert.equal(nextResult, 2000)
```

By checking the `event` parameter, you can react to events happening in the system.

```jsx
import { of } from '@framp/frappe'
const onButtonClick = fn((val, time, event) => event.type === 'click')
const [nextStraw, result] = onButtonClick(null, 0, null)
assert.equal(result, false)
const [nextNextStraw, nextResult] = nextStraw(null, 1000, { type: 'click', ref: 'button'})
assert.equal(nextResult, true)
```

## Running a Straw

As we saw in the introduction, running a `Straw` means calling it as a function and reading its result.

If you want to run a `Straw` twice, you should use the `nextStraw` being returned for the second call.

This simple pattern can be used to alter the behaviour of your `Straw` over executions - and even to store state.

```jsx
import { of, run, accumState } from '@framp/frappe'
const sumAll = (state = 0) => of((val, time, event) => [sumAll(state+val), state+val])
const results = run(sumAll(), [1,2,3,4,5])
assert.equal(results, [1,3,6,10,15)
const sumAll2 = accumState((a, b) => a + b, 0) //equivalent to sumAll()
```

The main advantage of this approach over global stores, is that state is kept locally and can be accessed easily and in a controlled way by composing `Straws` where you need them (more in the next section).

The main advantage over a mutable state approach (like `setState` in React) is control and predictability, which derives from modelling state changes as a fold operation over a set of values.

## Composition

`Straws` can be composed together using `compose`; each `Straw` will send its result down to the next `Straw` as the `val` parameter.
`time` and `event` will stay the same for all the `Straws`.

```jsx
import { fn, accum compose, run } from '@framp/frappe'
const double = fn(val => val*2)
const plus1 = fn(val => val+1)
const sumAll = accum((a, b) => a + b, 0)
const results = run(compose(double, plus1, sumAll), [1,2,3,4,5])
assert.equal(results, [(1+1)*2,(3+1)*2,(6+1)*2,(10+1)*2,(15+1)*2)
```

If you want to run `Straws` in parallel on the same value you can use `fanout`.

```jsx
import { fn, fanout run } from '@framp/frappe'
const double = fn(val => val*2)
const plus1 = fn(val => val+1)
const results = run(fanout(double, plus1), [1,2,3,4,5])
assert.equal(results, [[2,2], [4,3], [6,4], [8,5], [10,6]])
```

With this primitives we can compose `Straws`, from tiny functions to complex applications.

## React

A `Straw` returning a React element can be rendered using `ReactRunner`.

```jsx
import React from 'react'
import { render }  from 'react-dom'
import { fn, ReactRunner, timeStrategy } from '@framp/frappe'
const app = fn((val, time, event) => (
  <div>
    <span>{time} ms passed</span>
    <span>{event ? `An ${event.type} event happened!` : ''}</span>
  </div>))
const options = {
  verbose: true,
  updateStrategies: [
    timeStrategy(1000), // Refresh every second
  ]
}
render(
  <ReactRunner straw={app} options={options} />,
  document.getElementById('app')
)
```

With `ReactRunner` you can also easily inject a Frappe based application inside an existing React application.

By default `ReactRunner` will only re-render when an event is emitted.

If you want your application to re-render more frequently you can use `timeStrategy` or `animationFrameStrategy`.

*In the future, `Straws` will be able to let `ReactRunner` know when they need to be called, making strategies obsolete.*

For the sake of brevity, we will assume in the following examples a file `index.tsx` which run our application.

```jsx
import React from 'react'
import { render }  from 'react-dom'
import { fn, ReactRunner, animationFrameStrategy } from '@framp/frappe'
import app from './app'

const options = {
  verbose: true,
  updateStrategies: [
    animationFrameStrategy // Refresh after every repaint
  ]
}
render(
  <ReactRunner straw={app} options={options} />,
  document.getElementById('app')
)
```

## Events

You can listen to events happening in the system with `on`.

`on` accepts an Object with optional `type`, `ref` and `id` and it will return the event when

```jsx
import React from 'react'
import { fn, on, listenOn, compose, fanout } from '@framp/frappe'

const button = listenOn({ type: 'click' }, fn(() => (<button>Magic</button>)))
const listener = on({ type: 'click', ref: button })

const render = fn(([button, click], time, event) => (
  <div>
    <p>{button}</p>
    <code>{click && click.type}</code>
  </div>
))
export default compose(render, fanout(button, listener))
```

`ref` (and `id`) can be anything, even a reference to a `Straw`!

An event Object will look this:
```jsx
{
  type: "click",
  ref: Straw,
  id: null,
  data: SyntheticEventFromReact
}
```

`listenOn` is being used to tell React we care about clicks;

*In the future, Frappe will be able to parse the calls to on and automatically handle setting up event listeners for you, making `listenOn` obsolete.*

## Time and Events utilities

Frappe provides a few utilities to generate useful `Straws` to deal with time and events.

`beforeTime(100)`, `afterTime(100)` work with times; they will return `true` before or after enough time has passed since they were run.

`betweenTimes(100,200)` combines the previous functions and will return `true` when inside the range of specified times.

`beforeEven({ type: "click" })`, `afterEvent({ type: "click" })` work with events; they will return `true` before or after a certain event happened, since they were run.

`betweenEvents({ type: "click", ref: 'a' }, { type: "click", ref: 'b'  })` similarly combines the previous functions and returns `true` after the first event and before the second one.

Let's check out an example!

```jsx
import React from 'react'
import { fn, on, listenOn, betweenEvents, compose, fanout, when, restartWhen, afterTime } from '@framp/frappe'

const buttonStart = listenOn({ type: 'click' }, fn(() => (<button>Start</button>)))
const buttonStop = listenOn({ type: 'click' }, fn(() => (<button>Stop</button>)))
const start = { type: 'click', ref: buttonStart }
const stop = { type: 'click', ref: buttonStop }

const showIsOn = betweenEvents(start, stop)
const color = when(showIsOn, compose(fn(passed => passed ? '#76B8A6' : '#700d00'), afterTime(2000)))
const renderShow = fn(([show, backgroundColor]) =>
  (<div style={({
    width: 100,
    height: 100,
    backgroundColor,
    animation: 'spin 4s linear infinite',
    display: show ? 'block' : 'none'
  })} />))
const magicShow = restartWhen(on(stop), compose(renderShow, fanout(showIsOn, color)))

const renderApp = fn(([buttonStart, buttonStop, magicShow, click], time, event) => (
  <div>
    <h1>Magic Show</h1>
    <p>{buttonStart} {buttonStop}</p>
    {magicShow}
  </div>
))
export default compose(renderApp, fanout(buttonStart, buttonStop, magicShow))
```

When we press on Start (and before we press on Stop), renderShow will be rendered.

Two seconds after starting, the color of the div will change.

`restartWhen` is being used after every `stop` event to reset the `Straw` to its original function.

## Asynchronous actions

We can plug asynchronous actions in our event system using `promise`.

`promise` accepts a Promise returning function and it returns a `Straw` that will call your code and emit a `promise-resolve` or a `promise-error`.

```jsx
import React from 'react'
import { fn, when, hold, promise, on, listenOn, compose, fanout } from '@framp/frappe'

const kittyRequest = promise(() =>
  fetch(
    'http://api.giphy.com/v1/gifs/random?tag=funny+cat&rating=g&api_key=dc6zaTOxFJmzC&limit=1'
  )
    .then(res => res.json())
    .then(res => res.data.image_url)
)

const button = listenOn({ type: 'click' }, fn(() => <button>New Kitty</button>))
const kittyImage = hold(
  on({ type: 'promise-resolve', ref: kittyRequest }, v => v.data)
)
const fireKittyRequest = when(on({ type: 'click', ref: button }), kittyRequest)

const render = fn(([button, kittyImage]) => (
  <div>
    <h1>It's a kitty!</h1>
    <div>{button}</div>
    <p>{kittyImage ? <img src={kittyImage} /> : ':('}</p>
  </div>
))

export default compose(
  render,
  fanout(button, kittyImage, fireKittyRequest)
)
```

## Straw utilities
Frappe provides some handy utilities for dealing with `Straws`.

`when` will accept an even number of `Straws`, logically paired up in `condition` and `action`.
The first `action` whose `condition` returned a truthy value, will be returned.

```jsx
import { run, when } from '@framp/frappe'
const ageCheck = when(
  fn(v => v < 18),
  constant('minor'),
  fn(v => v === 18),
  constant('18'),
  fn(v => v > 18),
  constant('adult')
)
asserts.deepEqual(run(ageCheck), [15, 13, 18, 20, 18], ['minor', 'minor', '18', 'adult', '18'])
```

`hold` will remember the last time a `Straw` returned a truthy value and keep returning that value until the `Straw` start returning a truthy value again.
If you need more advanced functionalities, you can use `holdWhen`, which will accept a predicate to establish whether the value need to be held or not.

```jsx
import { run, hold, holdWhen, id} from '@framp/frappe'
const results = run(hold(id), [null, 1, null, 2, 3, 4])
asserts.deepEqual(results, [null, null, null, 2, 2, 4],)
const resultsWhen = run(holdWhen((acc, val) => val % 2 === 0, id), [null, 1, null, 2, 3, 4],
asserts.deepEqual(resultsWhen, [null, null, null, 2, 2, 4])
```

`take` will run a `Straw` only a limited number of times and return `null` afterwards.
It's especially useful when you want to fire off things once.

```jsx
import { run, hold, holdWhen, id} from '@framp/frappe'
const results = run(hold(id), [null, 1, null, 2, 3, 4])
asserts.deepEqual(results, [null, null, null, 2, 2, 4],)
const resultsWhen = run(holdWhen((acc, val) => val % 2 === 0, id), [null, 1, null, 2, 3, 4],
asserts.deepEqual(resultsWhen, [null, null, null, 2, 2, 4])
```

## Data storage

As we saw before we can use `Straws` to store state.

`dynamicArray` and `dynamicMap` can be used to store data using events as inputs.

By providing an `add Straw`, a `dynamicArray` or map can understand when it needs to treat its `val` as input and store another element in the Array.
By providing a `remove Straw`, a `dynamicArray` can read the event `id` property to delete the element at index `id`.

```jsx
import React from 'react'
import { listenOn, hold, on, fn, compose, fanout, dynamicArray } from '../src'

// 1. O-Ren Ishii
// 2. Vernita Green
// 3. Budd
// 4. Elle Driver
// 5. Bill

const input = listenOn({ type: 'input' }, fn(() => <input />))
const submit = listenOn({ type: 'click' }, fn(() => <button>Kill</button>))
const inputText = on({ type: 'input', ref: input }, event => event.data.target.value)
const list = compose(
  dynamicArray({
    add: on({ type: 'click', ref: submit }),
    remove: on({ type: 'click', ref: 'delete-button' })
  }),
  hold(inputText)
)

const render = fn(([input, submit, list], time, event, emit) => (
  <div>
    <h1>Death List Five</h1>
    <div>
      {input} {submit}
    </div>

    <div>
      <ol>
        {list.map((el, id) => (
          <li key={id}>
            <span>{el}</span>
            <span>

              <button
                onClick={emit({ type: 'click', ref: 'delete-button', id })}
              >
                X
              </button>
            </span>
          </li>
        ))}
      </ol>
    </div>
  </div>
))

export default compose(
  render,
  fanout(input, submit, list)
)
```

There is a fourth parameter being passed to every `Straw`, `emit`.

`emit` is a function that accept an event Object and returns a callback that will accept more data.

The data passed in the callback will be set as the `data` property in the emitted event.

## Conclusions

That's all folks!

I hope you enjoyed this tour of Frappe and you'll want to build something with it.

You can have a look at the [examples](https://github.com/framp/frappe/tree/master/examples) for more or at the [documentation](https://framp.me/frappe/docs/) for more details.

There are a lot of features to build and a lot of room for improvements.
If you're interested in contributing, check out the [Contributors Guidelines](https://github.com/framp/frappe/blob/master/CONTRIBUTORS.md)

repository: framp/frappe

repo_name: framp/frappe


text:
---
external help file: MSFT_Printer_v6.0.cdxml-help.xml
Module Name:
online version:
schema: 2.0.0
---

# Rename-Printer

## SYNOPSIS
Renames the specified printer.

## SYNTAX

### UNNAMED_PARAMETER_SET_1
```
Rename-Printer [-PrinterName] <String> [-NewName] <String> [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>]
 [-Confirm] [-WhatIf] [<CommonParameters>]
```

### UNNAMED_PARAMETER_SET_2
```
Rename-Printer [-NewName] <String> [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf]
 [<CommonParameters>]
```

## DESCRIPTION
The Rename-Printer cmdlet renames the specified printer on a computer.
You can specify the printer to rename by using either a printer object retrieved by the Get-Printer cmdlet, or by specifying a printer name.

You cannot use wildcard characters with Rename-Printer.
You can use Rename-Printer in a Windows PowerShell remoting session.

You need administrator credentials to run Rename-Printer.

## EXAMPLES

### Example 1: Rename a printer
```
PS C:\> Rename-Printer -Name "Microsoft XPS Document Writer" -NewName "MXDW"
```

This command renames the Microsoft XPS Document Writer printer name as MXDW.

### Example 2: Rename a printer by using a printer object
```
PS C:\>$Printer = Get-Printer -Name "Microsoft XPS Document Writer"
PS C:\> Rename-Printer -InputObject $Printer -NewName "MXDW"
```

The first command gets a printer named Microsoft XPS Document Writer by using Get-Printer.
The command stores the result in the $Printer variable.

The second command renames the printer in $Printer as MXDW.

## PARAMETERS

### -CimSession
Runs the cmdlet in a remote session or on a remote computer.
Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet.
The default is the current session on the local computer.

```yaml
Type: CimSession[]
Parameter Sets: (All)
Aliases: Session

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PrinterName
Specifies the name of the printer to rename.

```yaml
Type: String
Parameter Sets: UNNAMED_PARAMETER_SET_1
Aliases: Name

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue, ByPropertyName)
Accept wildcard characters: False
```

### -NewName
Specifies the new name of the printer.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue, ByPropertyName)
Accept wildcard characters: False
```

### -ThrottleLimit
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
The throttle limit applies only to the current cmdlet, not to the session or to the computer.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer
This cmdlet accepts one printer object.

## OUTPUTS

### This cmdlet produces no output.

## NOTES

## RELATED LINKS

[Add-Printer]()

[Remove-Printer]()

[Get-Printer]()

[Set-Printer]()


text:
---
layout: "post"
title: "Office Fabric UI - React/Redux (Part 2 of 5)"
date: "2017-01-02"
description: ""
feature_image: ""
tags: [fabric-ui, react, add-in]
---

This is the second of five posts going over the Office Fabric UI React library and Redux. The entire project is on [github](https://github.com/gunjandatta/sprest-fabric-react-redux).

<!--more-->

1. [Introduction and Project Creation](https://dattabase.com/blog/office-fabric-ui-reactredux-part-1-5)
2. Core Configuration/Files (This Post)
3. [Office UI Fabric Dialog](https://dattabase.com/blog/office-fabric-ui-reactredux-part-3-5)
4. [Office UI Fabric Panel](https://dattabase.com/blog/office-fabric-ui-reactredux-part-4-5)
5. [Office UI Fabric Details List](https://dattabase.com/blog/office-fabric-ui-reactredux-part-5-5)

### Folder Structure

The folder structure of the project will be:
* actions - The available actions for the application.
* components - The application components.
* data - The data source for the components.
* reducers - Handlers for the actions.
* store - The redux store.

### File Structure

The file structure of the core project files will be:
* src/actions/actionTypes.ts - Enumerator to store the available actions.
* src/actions/\[name\]Actions.ts - Available actions for the \[name\] component/module.
* src/components/\[name\] - Application components.
* src/data/\[name\]Data.ts - CRUD operations for the \[name\] component/module.
* src/reducers/index.ts - The root reducer, to reference the available reducers.
* src/reducers/initialState.ts - The default values of the application states.
* src/reducers/\[name\]Reducer.ts - Handler for the \[name\]Actions.js functions.
* src/store/configureStore.ts - The redux store.
* src/index.tsx - The javascript entry point of the application.
* index.html - The html entry point of the application.

### Entry Points

#### index.html

The base html of the project.

```
<html>
    <head>
        <title>Office Fabric UI React/Redux Demo</title>
    </head>
    <body>
        <div id="app"></div>
        <script src="./dist/bundle.js"></script>
    </body>
</html>

```

#### index.tsx

##### Imported Libraries

- \[react\] React - The react library.
- \[react-dom\] render - Method to render the component to the DOM.
- \[react-redux\] Provider - Attaches the store to the react container components.
- configureStore - Method to create/configure the store.

```
import * as React from "react";
import {render} from "react-dom";
import {Provider} from "react-redux";
import configureStore from "./store/configureStore";

const store = configureStore();

render(
    <Provider store={store}>
        {/* TO DO - Create the dashboard component */}
    </Provider>,
    document.getElementById("app")
);

```

### Configure the Store

The store will contain the component states, and is the first thing we will setup.
* Folder: ./src/store
* Filename: configureStore.ts

#### Code

##### Imported Libraries

- \[redux\] createStore - Method to create the store.
- \[redux\] applyMiddleware - Method to add redux plugins.
- rootReducers - Reference to the available reducers in the application.
- \[redux-thunk\] - The redux-thunk plugin.

```
import {createStore, applyMiddleware} from "redux";
import rootReducer from "../reducers";
import thunk from "redux-thunk";

export default function configureStore(initialState?:any) {
    return createStore(
        rootReducer,
        initialState,
        applyMiddleware(thunk)
    );
}

```

#### rootReducer

The rootReducer is a reference to the available reducers in the application. This will be the next thing to setup.

### Create Default Values for the Application States

Since the store contains the available states of the application, the default values will be defined and referenced by various reducers.
* Folder: ./src/reducers
* Filename: initialState.js

#### Code

```
export default {
    /* TO DO - Define default state values */
};

```

### Configure the Reducers

The rootReducers is referenced by the store for all available reducers.
* Folder: ./src/reducers
* Filename: index.ts

#### Code

##### Imported Libraries

\[redux\] combineReducers - Method to combine the available reducers.

```
import {combineReducers} from "redux";

const rootReducer = combineReducers({
    /* TO DO - Create reducers */
});

export default rootReducer;

```

#### Template \[name\]Reducer.ts

```
import ActionTypes from "../actions/actionTypes"
import initalState from "./initialState";

export default function [name]Reducer(state = initalState.[Name], action) {
        // Check the requested action
    switch(action.type) {
                // See if this action is handled by this reducer
        case ActionTypes.[ActionType]:
                        // Return a copy of the state
                        return Object.assign(
                            {},
                            state,
                            // The updated state
                            { [key]: action.[key] }
                        );

                // Return the state if this reducer doesn't handle the requested action
        default:
            return state;
    }
}

```

### Configure the Actions

Since we haven't created anything, there really isn't much setup required for actions other than the actionTypes enumerator. This is recommended to reduce "developer error" when typing in "static" values.
* Folder: ./src/actions
* Filename: actionTypes.ts

#### Code

```
const ActionTypes = {
    /* TO DO - Define Actions */
};

export default ActionTypes;

```

#### Templates

##### Synchronous Actions

```
import ActionTypes from "./actionTypes";

export function [action]() {
    return {
        type: ActionTypes.[Action],
        // The data to return
        [data]
    };
}

```

##### Asynchronous Actions

```
import ActionTypes from "./actionTypes";
import [Name] from "../data/[name]Data";

export function [action]() {
    // Return the dispatch function
    return function(dispatch) {
        // Execute the asynchronouse method
        return [Name].get().then(data => {
            dispatch({
                type: ActionTypes.[Action],
                // The data to return
                data
            });
        });
    }
}

```

### Conclusion

This ends part two of the blog post. The next post will go create the navigation and dialog components of the application.

repository: gunjandatta/blog

gha_language: SCSS

repo_name: gunjandatta/blog


text:
# Natural Questions Models
[Google's Natural Questions dataset](https://ai.google.com/research/NaturalQuestions) constists of about 100k real search queries from Google with the respective, relevant passage from Wikipedia. Models trained on this dataset work well for question-answer retrieval.

## Usage

```python
from sentence_transformers import SentenceTransformer, util
model = SentenceTransformer('nq-distilbert-base-v1')

query_embedding = model.encode('How many people live in London?')

#The passages are encoded as [ [title1, text1], [title2, text2], ...]
passage_embedding = model.encode([['London', 'London has 9,787,426 inhabitants at the 2011 census.']])

print("Similarity:", util.cos_sim(query_embedding, passage_embedding))
```

Note: For the passage, we have to encode the Wikipedia article title together with a text paragraph from that article.

## Performance
The models are evaluated on the Natural Questions development dataset using MRR@10.

| Approach       |  MRR@10 (NQ dev set small) |
| ------------- |:-------------: |
| nq-distilbert-base-v1 | 72.36 |
| *Other models* | |
| [DPR](https://huggingface.co/transformers/model_doc/dpr.html) | 58.96 |

repository: UKPLab/sentence-transformers

gha_language: Python

repo_name: UKPLab/sentence-transformers


text:
# Racoon
A movie collection web application used Spring MVC, MongoDB,Tomcat, Hibernate and AngularJS

Introduction
----
We want to build a movie collection web application that allows users to make their personal movie wishlists.
The system consists of four components:

1. Scrapy web crawler

   Our goal is to crawl 100,000 movies titles from IMDb in the past 30 years, from 1986 to 2016.

2. Restful API
    * getTopMovies: get top N apps from MongoDB
    * getRecomMovies: get M recommended apps from MongoDB
    * getMovieByID: get a single app from MongoDB, searching by movie name
    * APIs for create, update, get and delete a movie

3. Movie Recommender

4. Front-end implementation

Plan
----

### Todo List
- [x] Web crawler
- [ ] Set up Spring framework
- [ ] Implement a restful API
- [ ] Front-end implementation

### Time Schedule
We take _June, 2016_ as the __1st stage__ with the __primary__ goal of __prototyping__ our application following the development guild lines mentioned below. Here's the tentative timeline.

| Stage | Start  | End | Goals |
| ------------- | ------------- | ------------- | ------------- |
| 1 | 05/24/16  | 05/30/16  | Project Selection, Plan Discussion, and Proposal Draft Writing |
| 2 | 06/01/16  | 06/04/16  | Web Crawler With Scrapy |
| 3 | 06/05/16  | 06/11/16  | Building Java Web Application Using Hibernate With Spring |
| 4 | 06/12/16  | 06/18/16  | Implementation Restful APIs |
| 5 | 06/19/16  | 06/25/16  | Use Angular JS for the front end |
| 6 | 06/26/16  | 07/02/16  | User Manual Writing Video Presentation Making and Deploy on Heroku.|

## Team Members
| | | |
|:--:|:--:|:--:|
|![Likun Du](https://avatars1.githubusercontent.com/u/14044346?v=3&u=aeffbb5aa243d1f6cb6d2059a3eacd6c7b319743&s=140)|![icemintt](http://hdn.xnimg.cn/photos/hdn421/20131128/1910/p/m3w230h230q85lt_h_large_9QG5_def800002ef6113e.jpg)|![Simon Wang](http://hdn.xnimg.cn/photos/hdn421/20110808/0950/p/m3w306h230q85lt_h_large_GKwq_69100002f6f22f75.jpg)|
|[Likun Du](https://github.com/begdor)|[icemintt](https://github.com/icemintt)|[Simon Wang](https://github.com/AssassinW)|

## Resource
- [BitTiger Project: AppStore - Crawler](https://slack-files.com/T0GUEMKEZ-F0J4G9QTT-274d3bc97e)

## License
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).

Owner
-----

@team: Racoon

license: ISC

repository: begdor/Racoon

repo_name: begdor/Racoon


text:
---
layout: single
permalink: /starting/
title: 'Starting from the Bottom'
---

ESLINT + PRETTIER + HEROKU

[From myself](https://aaroncaraway.github.io/dailylog-11-27-20/)

When using AWS from a new user, don't forget to [create a new access key](https://help.bittitan.com/hc/en-us/articles/115008255268-How-do-I-find-my-AWS-Access-Key-and-Secret-Access-Key-)

```console
$ pip3 install --upgrade pip
$ pip3 install jupyter
```

Need for BrowserJournal

```console
$ pip3 install pytz
```

OMG DO NOT FORGET THE NEED FOR A LINTER, YO
Also the big key (after installing Prettier and ESLint)

```javascript
"editor.formatOnSave": true
```

read more [here](https://hackernoon.com/write-beautiful-and-consistent-javascript-code-using-eslint-prettier-and-vscode-760837fdef89)

# HOW TO START ANY PROJECT

1. [Secure your env var, yo](https://medium.com/codait/environment-variables-or-keeping-your-secrets-secret-in-a-node-js-app-99019dfff716)
   aka KEEP YOUR SECRETS SECRET (still not totally sure I'm doing this right!?)

PROTIP: Any time you change your .env file, you MUST restart the server
PROTIP 2: All Create React Apps need `REACT_APP_` as a prefix to env variables

[More about env var](https://medium.com/@trekinbami/using-environment-variables-in-react-6b0a99d83cf5)
[Even more about it](https://create-react-app.dev/docs/adding-custom-environment-variables)

(search terms for self environment variables process.env process.ENV)