text:
# A TensorFlow Implementation of Character Level Neural Machine Translation Using the Quasi-RNN

In [Bradbury et al., 2016](https://arxiv.org/abs/1611.01576) (hereafter, the Paper), the authors introduce a new neural network model which they call the Quasi-RNN. Basically, it tries to benefit from both CNNs and RNNs by combining them. The authors conducted three experiments to evaluate the performance of the Q-RNN. Character level machine translation is one of them. After the Paper was published, some enthusiasts tried to reproduce the experiments as the authors didn't disclose their source codes. Now I'm happy to be one of them. To my best knowledge, this is the first TensorFlow implementation of character level machine translation based on the Paper.

## Requirements
  * numpy >= 1.11.1
  * sugartensor >= <IP_ADDRESS>
  * nltk >= 3.2.2 (only for calculating the bleu score)

## Some notes on implementation

Overall, we tried to follow the instructions in the Paper. Some major differences are as follows.

* The Paper set the maximum sequence length to 300 characters, but we changed it to 150 due to the limitation of our single gpu (GTX 1080 8GB).
* We applied a greedy decoder at the inference phase, not the beam search.
* We didn't reverse source sentences because simply we didn't like the idea :) (We know in some papers it worked well, though.)

## Work Flow

* STEP 1. Download [IWSLT 2016 German–English parallel corpus](https://wit3.fbk.eu/download.php?release=2016-01&type=texts&slang=de&tlang=en) and extract it to `corpora/` folder.
* STEP 2. Run `prepro.py` to make training / test data.
* STEP 3. Run `train.py`.
* STEP 4. Run `eval.py` to get the results for the test sentences.

Or if you'd like to use the pretrained model,

* Download the [output files](https://drive.google.com/open?id=0B0ZXk88koS2KcU5vTjlhcFpwQUk) of STEP 3, then place them to `data/` folder.
* Download the [pre-trained model files](https://drive.google.com/open?id=0B0ZXk88koS2KcUtFblFiai1BM0k), then place them to `asset/train/` folder.
* Run eval.py.

## Evaluation & Results

As shown in the Paper, we trained for 10 epochs with `train.tags.de-en` files and evaluated with `TED.tst2014.de-en` files. We obtained the Bleu Score of 10.1254874522. The details are available in `results.txt`.

repository: chagge/quasi-rnn

repo_name: chagge/quasi-rnn


text:
# MoonGen Guide

Tip when configuring devices
local dev = device.config{dropEnable = false}
--- dropEnable optional (default = true) Drop packets directly if no RX descriptors are available
but sometimes NIC doesn't support this.

82540EM doesn't support Hardware-timestamping

function mod.sleepMillis(t) in libmoon.lua
--- Delay by t milliseconds. Note that this does not sleep the actual thread;
--- the time is spent in a busy wait loop by DPDK.

license: MIT

repository: stevelorenz/build-vnf

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: stevelorenz/build-vnf


text:
# Migration from v0.x

## FAQ

### Woah - the API is way different! Does that mean 1.0 is completely different, I’ll have to learn the basics all over again, and migrating will be practically impossible?

I’m glad you asked! The answer is no. The core concepts haven’t changed.
You will notice that the API provides more flexibility, but this has a cost.
We have been making lower-level components, abstracting less complexity.

### What motivated such large change?

Material-UI was started [3 years ago](https://github.com/callemall/material-ui/commit/28b768913b75752ecf9b6bb32766e27c241dbc46).
The ecosystem has evolved a lot since then, we have also learned a lot.
[@nathanmarks](https://github.com/nathanmarks/) started an ambitious task, rebuilding Material-UI from the **ground-up**
taking advantage of this knowledge to address long-standing issues. To name some of the major changes:
- New styling solution using CSS-in-JS (better [customization](/customization/overrides) power, better performance)
- New [theme handling](/customization/themes) (nesting, self-supporting, etc.)
- Blazing fast documentation thanks to [Next.js](https://github.com/zeit/next.js)
- Way better [test coverage](/guides/testing) (99%+, run on all the major browsers, [visual regression tests](https://www.argos-ci.com/callemall/material-ui))
- Full [server-side rendering](/guides/server-rendering) support
- Wide range of [supported browsers](/getting-started/supported-platforms)

Curious to learn more about it? You can checkout our [Q&A on with the v1 version](http://<IP_ADDRESS>:3000/discover-more/roadmap#q-amp-a-with-the-v1-version).

### Where should I start in a migration?

1. Start by installing the v1.x version of Material-UI along side the v0.x version.
[Yarn](https://github.com/yarnpkg/yarn) provides an alias feature to do so:
```sh
yarn add material-ui@latest
yarn add material-ui-next@npm:material-ui@next
```
then
```js
import FlatButton from 'material-ui/FlatButton'; // v0.x
import Button from 'material-ui-next/Button'; // v1.x
```
2. Run [the migration helper](https://github.com/callemall/material-ui/tree/v1-beta/packages/material-ui-codemod) on your project.
3. After that, you are free to migrate one component instance at the time.

## Components

### Flat Button

```diff
-import FlatButton from 'material-ui/FlatButton';
+import Button from 'material-ui-next/Button';

-<FlatButton />
+<Button />
```

### Raised Button

```diff
-import RaisedButton from 'material-ui/RaisedButton';
+import Button from 'material-ui-next/Button';

-<RaisedButton />
+<Button raised />
```

### To be continuated…

You successfully migrated your app and wish to help the community?
Please help us! We have an open issue in order to finish this migration guide [#7195](https://github.com/callemall/material-ui/issues/7195). Any pull request is welcomed 😊.

repository: lawlessnut/material-ui

repo_name: lawlessnut/material-ui


text:
---
layout: post
title:  "Orchestration, part 2: securing and operating Swarm"
date:   2017-03-13
author: "@jpetazzo"
tags: [linux,operations,landing]
categories: intermediate
terms: 0
---

This lab is longer than the other ones. It is designed
to follow the part 1 ("from Compose to Swarm") but can
also be done independently (it provides jump-start
instructions if you want to skip part 1).

You will learn about the security features of Swarm:
secrets, cluster locking, network encryption, and more.

You will also see how to implement logging, metrics,
and will given a galore of tips and tricks to operate
Swarm.

We recommend that you open two tabs or two windows
for that lab: one for the materials, another for
the Play-With-Docker environment.

Links:

- [Introduction](http://jpetazzo.github.io/orchestration-workshop/)
  (recommended reading)
- [Part 2](http://jpetazzo.github.io/orchestration-workshop/#part-2)
- [Play-With-Docker](http://play-with-docker.com/) environment

extension: markdown

gha_language: SCSS


text:
# html_starter
HTML5 Starter Kit

v 1.0

HTML 5 stater kit using sass.

Derek Bell

[Lucid Web Design](http:lucid.com.au)

### Thanks to:

* HTML5 Boilerplate  [https://html5boilerplate.com](https://html5boilerplate.com)

* Mina Markham's Sassy Starter [https://minamarkham.github.io/sassy-starter](https://minamarkham.github.io/sassy-starter)

* Gulp JS [http://gulpjs.com/](http://gulpjs.com/)

* Yarn [https://yarnpkg.com/](https://yarnpkg.com/)


text:
Prediction models for propositional logical tasks
=======

propositional reasoning models implemented as part of the Bachelor project by Julian Giessl in 2019.

## Prerequisites

Python 3.5
Libraries: ccobra version 0.16.0 , (pandas, numpy)

## Models

Several models have been implemented:
- Logic model:
 choses responces for a given task according to normal propositional logic.
- MFA model:
 choses responces for a task according to the most frequent response to that task.
- Recommender model:
 choses responses for a task based upon previous responses (to similar tasks) of the participants.

## Files

data_structures.py contains a tree data structure for the premises, with which the truth value
of a premise can be calculated according to the truth values of the variables.
Furthermore it contains the classification tags for the model.

task_processor.py contains two components.
First is a task processor class, with which the input data is parsed.
I.e. the premises get parsed into a tree-data-structure and feature vectors, describing the premises,
are constructed. Furthermore the possible answers are classified.
Secondly it contains predictor classes, with which the predictions are calculated based upon the logic
of the corresponding model.

In mfa_model.py the most frequent answers to the the tasks are calculated by pre-training the model
on a data-set. Model chooses the most frequent answers given as a response.

In logic_model.py the TaskProcessor the LogicPredictor classes are initialized for a strict logical
model. The model chooses the answer according to strict formal logic.
All the calculations are done in task_processor.py.

In model.py the TaskProcessor and the Predictor classes are initialized for the model. The model chooses
the responses based upon previous answers of the participants (basicly a recommender system). The calculations are done in
task_processor.py.

repository: CognitiveComputationLab/cogmods

gha_language: Python

gha_license_id: MIT

repo_name: CognitiveComputationLab/cogmods


text:
## Bookfindr

![Design preview for Bookfindr](./src/images/preview.png)

## Overview

Bookfindr lets users search and organize their favorite books. The app fetches books from the [Google Books API](https://developers.google.com/books/) persist shelf data in local stoarge. A future enhancement will use Firebase for data storage.

[Try the Demo](https://bookfindr.netlify.com/)

## Motivation

This project is originally a pre-work solo-project of the [Chingu](https://www.chingu.io/) voyage program. But it has evolved into a robust application with series of iteration in the past months.

## Technologies used

- React v16.13.1
- Styled Components
- Google Books API

## Features

This is a basic MVP. Most of the intended features are still in development.

- [x] Accessibilty
- [x] Error handling
- [x] Responsiveness
- [x] Advanced search
- [ ] Error logging
- [x] Navigation - Next link
- [x] Navigation - Previous link
- [x] Book shelf
- [ ] Theming
- [ ] PWA
- [ ] Others :roll_eyes:

## Setup

To run the app, clone this repo, and install it locally using:

```
$ npm install
$ npm start

```

## Contributing

Thanks for your interest in contributing! There are many ways to contribute to this project. Get [started here](CONTRIBUTING.md).

## License

This project is open source and available under the [MIT License](LICENSE.md).

repository: krebeDev/bookfindr

gha_language: JavaScript

gha_license_id: NOASSERTION

repo_name: krebeDev/bookfindr


text:
# Webhook events

Events are messages that will be sent to your server as HTTP `POST` requests if you create a webhook subscription for
the type of event and a relevant resource you have access to is updated.
Events will not contain any personally identifiable information.

For example, an event may describe a change in the status of a transfer you have made.

To acknowledge that you have successfully processed an event, make sure your server answers with a `2xx`-series HTTP status
code within 5 seconds. Otherwise, we will consider the delivery attempt as having failed and will later try to resend the
message.

We will attempt to redeliver messages at increasing intervals over a two week period. We will try at most 25 times to do this.

## Event HTTP requests

Event HTTP request bodies have a type-specific structure.
Events using version 2 of our type schema will contain a common base structure with additional event-specific details.
Each event type is described in detail later in this section.

Event HTTP requests also contain the following custom headers:

### Signature header `X-Signature`

> TransferWise public key for production environment:

```
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvO8vXV+JksBzZAY6GhSO
XdoTCfhXaaiZ+qAbtaDBiu2AGkGVpmEygFmWP4Li9m5+Ni85BhVvZOodM9epgW3F
bA5Q1SexvAF1PPjX4JpMstak/QhAgl1qMSqEevL8cmUeTgcMuVWCJmlge9h7B1CS
D4rtlimGZozG39rUBDg6Qt2K+P4wBfLblL0k4C4YUdLnpGYEDIth+i8XsRpFlogx
CAFyH9+knYsDbR43UJ9shtc42Ybd40Afihj8KnYKXzchyQ42aC8aZ/h5hyZ28yVy
Oj3Vos0VdBIs/gAyJ/4yyQFCXYte64I7ssrlbGRaco4nKF3HmaNhxwyKyJafz19e
HwIDAQAB
```
> TransferWise public key for sandbox environment:

```
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwpb91cEYuyJNQepZAVfP
ZIlPZfNUefH+n6w9SW3fykqKu938cR7WadQv87oF2VuT+fDt7kqeRziTmPSUhqPU
ys/V2Q1rlfJuXbE+Gga37t7zwd0egQ+KyOEHQOpcTwKmtZ81ieGHynAQzsn1We3j
wt760MsCPJ7GMT141ByQM+yW1Bx+4SG3IGjXWyqOWrcXsxAvIXkpUD/jK/L958Cg
nZEgz0BSEh0QxYLITnW1lLokSx/dTianWPFEhMC9BgijempgNXHNfcVirg1lPSyg
z7KqoKUN0oHqWLr2U1A+7kqrl6O2nx3CKs1bj1hToT1+p4kcMoHXA7kA+VBLUpEs
VwIDAQAB
```

> How to verify signatures (in Java):

```java
public boolean verifySignature(String encodedPublicKey, String signature, String payload) {
  X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(Base64.getMimeDecoder().decode(encodedPublicKey));
  KeyFactory keyFactory = KeyFactory.getInstance("RSA");
  PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);

  Signature sign = Signature.getInstance("SHA1WithRSA");
  sign.initVerify(publicKey);
  sign.update(payload.getBytes());

  byte[] signatureBytes = Base64.getDecoder().decode(signature);

  return sign.verify(signatureBytes);
}
```

Each outgoing webhook request is signed.
Although event payloads do not contain any sensitive information, you may want to
verify if the request is coming from TransferWise (however this is optional).
We advise you not to process any requests where signature appears to be forged.

Each `POST` request includes the `X-Signature` header, which contains the message-specific signature.

### Delivery ID header `X-Delivery-Id`

Each outgoing notification is assigned a unique delivery UUID.

### Test notification header `X-Test-Notification`

This header is present with the value `true` if the notification is a test message.

Test messages can be sent to verify callback URLs when subscriptions are being set up.

## Event payload

> Basic event payload:

```json
{
  "data": {},
  "subscription_id": "db463333-3333-3333-3333-185d1ee81585",
  "event_type": "...",
  "schema_version": "2.0.0",
  "sent_at": "2019-10-14T12:43:37Z"
}
```

All events share same high-level payload structure.
Depending on the `event_type`, the only object that differs between events is `data`.

Field           | Description                                     | Format
---------       | -------                                         | -----------
data            | Object with information about updated resource  | Object
subscription_id | ID of the subscription that triggered the event | UUID
event_type      | Type of event, which defines `data` object      | Integer
schema_version  | The event representation semantic version       | String
sent_at         | Timestamp when update happened                  | Timestamp

## Transfer status change event

> Example event:

```json
{
  "data": {
    "resource": {
      "id": 99330022,
      "profile_id": 11121314,
      "account_id":<PHONE_NUMBER>,
      "type": "transfer"
    },
    "current_state": "processing",
    "previous_state": "incoming_payment_waiting",
    "occurred_at": "2019-10-14T12:43:37Z"
  },
  "subscription_id": "db463333-3333-3333-3333-185d1ee81585",
  "event_type": "transfers#state-change",
  "schema_version": "2.0.0",
  "sent_at": "2019-10-14T12:43:37Z"
}
```

Event type: `transfers#state-change`

This event will be triggered every time a transfer's status is updated. Each event contains a timestamp.
As we do not guarantee the order of events, please use `data.occured_at` to reconcile the order.

If you would like to subscribe to transfer state change events, please use `transfers#state-change`
when creating your subscription.

### Schema version `2.0.0` (latest)

Field                       | Description                                   | Format
---------                   | -------                                       | -----------
data.resource.id            | ID of the transfer that got updated           | String
data.resource.profile_id    | ID of the profile that owns the transfer      | Integer
data.resourceI.account_id   | ID of transfer's recipient                    | Integer
data.resource.type          | Type of the resource that was updated         | String
data.current_state          | Newly acquired state of the resource, possible values are same as [transfer statuses](#payouts-guide-track-transfer-status) | String
data.previous_state         | Previous state of the resource, possible values are same as [transfer statuses](#payouts-guide-track-transfer-status) | String
data.occured_at             | Timestamp when the update happened            | Timestamp

## Transfer issue event

> Example event:

```json
{
  "data": {
    "resource": {
      "id": 99330022,
      "profile_id": 11121314,
      "account_id":<PHONE_NUMBER>,
      "type": "transfer"
    },
    "active_cases": ["deposit_amount_less_invoice"]
  },
  "subscription_id": "db463333-3333-3333-3333-185d1ee81585",
  "event_type": "transfers#active-cases",
  "schema_version": "2.0.0",
  "sent_at": "2019-10-14T12:43:37Z"
}
```

Event type: `transfers#active-cases`

This event will be triggered every time a transfer's list of active issues is updated.
Issues indicate potential problems with transfer processing.

If you would like to subscribe to transfer active issue events, please use `transfers#active-cases` when creating
your subscription.

### Schema version `2.0.0` (latest)

Field                       | Description                                   | Format
---------                   | -------                                       | -----------
data.resource.id            | ID of the transfer that got updated           | String
data.resource.profile_id    | ID of the profile that owns the transfer      | Integer
data.resourceI.account_id   | ID of transfer's recipient                    | Integer
data.resource.type          | Type of the resource that was updated         | String
data.active_cases           | List of ongoing issues related to the transfer| String

## Balance deposit event

> Example event:

```json
{
  "data": {
    "resource": {
      "id": 99887766,
      "type": "balance-account",
      "profile_id": 11121314
    },
    "amount": 50.00,
    "currency": "EUR",
    "transaction_type": "credit",
    "post_transaction_balance_amount": 150,
    "occurred_at": "2019-10-14T12:43:37Z"
  },
  "subscription_id": "db463333-3333-3333-3333-185d1ee81585",
  "event_type": "balances#credit",
  "schema_version": "2.0.0",
  "sent_at": "2019-10-14T12:43:37Z"
}
```

Event type: `balances#credit`

This event will be triggered every time a balance account is credited.

Please note: This event is not currently delivered to application subscriptions.

If you would like to subscribe to balance credit events, please use `balances#credit` when creating your subscription.

**Schema version `2.0.0` (latest)**

Field                     | Description                                         | Format
---------                 | -------                                             | -----------
subscriptionId            | ID of subscription that triggers this notification  | String
profileId                 | ID of the profile that owns the balance             | Integer
amount                    | Deposit amount                                      | Decimal
currency                  | Currency of the balance that got updated            | String
eventType                 | Type of update                                      | String

repository: Droidzzzio/api-docs

repo_name: Droidzzzio/api-docs


text:
# micrograd

![awww](puppy.jpg)

A tiny Autograd engine (with a bite! :D). Implements backpropagation over a dynamically built DAG and a small neural networks library on top of it with a PyTorch-like API. Both are currently about 50 lines of code each.

The amusing part is that the DAG only allows individual scalar values, so e.g. we chop up each neuron into all of its individual tiny adds and multiplies. In particular, the current library only supports scalars and three operations over them: (+,*,relu), but these are actually enough to build up an entire deep neural net doing binary classification as the demo notebook shows. It's just a lot of nodes :)

Potentially useful for educational purposes. See the notebook for demo.

repository: achoora/micrograd

repo_name: achoora/micrograd


text:
---
title: MDL Talent Hub Global New Year 2019 Chess Tournament #1
date: 2018-12-18
short_description: MDL Talent Hub invites you to forget your worries by competing in our online chess tournament next month!
image: gif/mdl-2019-newyear-chess-tournament-1.gif
next_article: /en/2019-01-01-mdl-android-wallet-open-beta-release
prev_article: /en/2018-12-10-mdl-talent-hub-is-sustainable
lan: en
categories: ["News"]
show_in_top: show
---

## MDL Talent Hub Global New Year 2019 Chess Tournament #1

Upset about crypto prices or global instabilities? MDL Talent Hub invites you to forget your worries by competing in our chess tournament next month!

This year the MDL Global Chess Tournament is celebrating all of the world’s New Year’s starting in early January and ending just after the lunar Year of the Pig arrives. We’ll be sending the official dates and instructions for setting up games as soon as enough players join, so sign up among the first 20 to make sure you get into the tournament.

Prizes for the champions will of course be MDL tokens! We've allocated a total of 155,000 MDL in prizes for the top 10 players and will be adding an extra 1550 MDL into the pool for everyone who joins. That means if the maximum 100 people join, we’ll be giving about $6200* USD worth of MDL to the top player, and plenty more to others. Here is how that situation would look:

<center>

| place |       %       |   prize     |         |
|-------|---------------|-------------|---------|
|  1st  | 40% of reward | 124,000 MDL | 6,200$* |
|  2nd  | 20% of reward | 62,000  MDL | 3,100$* |
|  3rd  | 10% of reward | 31,000  MDL | 1,550$* |
|  4th  |  5% of reward | 15,500  MDL | 775$*   |
|  5th  |  3% of reward | 9,300   MDL | 465$*   |
|  6th  |  2% of reward | 6,200   MDL | 310$*   |
|  7th  |  1% of reward | 3,100   MDL | 155$*   |
|  ...  |  1% of reward | 3,100   MDL | 155$*   |
|  10th |  1% of reward | 3,100   MDL | 155$*   |

</center>

There is also a prize of 8% each for the two players who win Most Interesting Match, decided with input from the community. We hope you'll take some inspiration from AlphaZero and its new mind-boggling style of play to try out an unusual opening or take more chances.

https://www.youtube.com/watch?v=wui0YweevtY

If you haven't tried lichess, download the app or go to lichess.org to set up an account so you can record your matches.

Since the Global New Year Chess Tournament starts as soon as we have enough players, be sure to sign up early, and look out for our official announcement in Telegram. Once it starts the competition will continue until the final is played on the third day of the Chinese New Year, this February 8th. Make sure you have a Lichess account, [fill the form](https://docs.google.com/forms/d/e/1FAIpQLSf4dooMruWkNZjJ8heKMxA3m9myVQ1ce4RafH5AyFD8JA-UJA/viewform) and join our MDL Games community on Telegram!

https://t.me/mdlgamesandtournaments

*This estimate is based on current MDL token prices. The actual value in US dollars will be determined by the free market exchange of MDL at the time.

repository: MDLlife/blog

gha_language: CSS

repo_name: MDLlife/blog


text:
[![Latest Stable Version](https://poser.pugx.org/alcea/yii2-prism-syntax-highlighter/v/stable.svg)](https://packagist.org/packages/alcea/yii2-prism-syntax-highlighter) [![Total Downloads](https://poser.pugx.org/alcea/yii2-prism-syntax-highlighter/downloads.svg)](https://packagist.org/packages/alcea/yii2-prism-syntax-highlighter) [![Latest Unstable Version](https://poser.pugx.org/alcea/yii2-prism-syntax-highlighter/v/unstable.svg)](https://packagist.org/packages/alcea/yii2-prism-syntax-highlighter) [![License](https://poser.pugx.org/alcea/yii2-prism-syntax-highlighter/license.svg)](https://packagist.org/packages/alcea/yii2-prism-syntax-highlighter)
# This package is no longer maintained

## YII2 Prism Syntax Highlighter
Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s used in thousands of websites, including some of those you visit daily.

#How to install?

### 1. Use composer
```php
composer require alcea/yii2-prism-syntax-highlighter "~1"
```

### 2. or, edit require section from composer.json
```
"alcea/yii2-prism-syntax-highlighter": "~1"
```

### 3. or, clone from GitHub
```
git clone https://github.com/alceanicu/yii2-prism-syntax-highlighter
```

#How to use?

```php
<?php

use alcea\yii2PrismSyntaxHighlighter\PrismSyntaxHighlighter;

PrismSyntaxHighlighter::widget([
    'theme' => PrismSyntaxHighlighter::THEME_DEFAULT,
    'languages' => ['php', 'php-extras', 'css'],
    'plugins' => ['copy-to-clipboard']
]);

$md = <<<MD_FILE
'''js
$(document).on('focusout', 'input[name="test"]', function(event) {
	event.preventDefault();
	// do ...
});
'''
MD_FILE;

echo Markdown::process($md, 'gfm-comment');
```

### PrismJs page http://prismjs.com/download.html


text:
---
layout: post
title: Dealing with change preventers
bigimg: /img/image-header/yourself.jpeg
tags: [Refactoring]
---

In this article, we will learn how to deal with change preventers. All information of this artice is the content of the course [Java Refactoring: Best Practices](https://app.pluralsight.com/library/courses/java-refactoring-best-practices/table-of-contents).

Let's get started.

## Table of contents
- [Defining Change Preventers](#defining-change-preventers)
- [Changes to the Project](#changes-to-the-projects)
- [Divergent Change](#divergent-change)
- [Solution sprawl and Shotgun surgery](#solution-sprawl-and-shotgun-surgery)
- [Parallel Inheritance Hierarchies](#parallel-inheritance-hierarchies)
- [Wrapping up](#wrapping-up)

## Defining Change Preventers

Change Preventers means when code change in one place forces we to change code in many other places. Refactoring is difficult, adding a new feature is also difficult, and we don't want that for obvious reasons. So, this is the list of change preventers that we need to know:
- Divergent change
- Solution sprawl and shotgun survey
- parallel inheritance hierarchies

## Changes to the Project

For example:

```java
public class SimpleCurrencyConverter {
    private String currencyTo;

    public SimpleCurrencyConverter() {}

    public SimpleCurrencyConverter(String currencyTo) {
        this.currencyTo = currencyTo;
    }

    public double convert(double price) {
        if (currencyTo.equalsIgnoreCase("EUR")) {
            return price * 0.9;
        } else if (currencyTo.equalsIgnoreCase("CAD")) {
            return price * 1.35;
        } else {
            throw new IllegalArgumentException("Unrecognized currency: " + currencyTo);
        }
    }
}
```

We can realize that currency rates change over time and having hard-coded values in our conversion method isn't a very good idea. So our colleagues made some changes and we now pull up to date exchange rates from a web service. So, we have:

```java
public class SimpleCurrencyConverter {

    public double convert(double price) {
        String rates = getCurrencyRate("USD");
        if (currencyTo.equalsIgnoreCase("EUR")) {
            return price * getRate(rates, "EUR");
        } else if (currencyTo.equalsIgnoreCase("CAD")) {
            return price * getRate(rates, "CAD");
        } else {
            throw new IllegalArgumentException("Unrecognized currency: " + currencyTo);
        }
    }

    private double getRate(String rates, String currencyTo) {
        return Double.valueOf(rates.substring(rates.lastIndexOf(currencyTo)).substring(5, 9));
    }

    public String getCurrencyRate(String baseCurrency) {
        HttpClient httpClient = new Builder().build();
        HttpRequest request = HttpRequest.newBuilder()
                                         .uri(URI.create("https://api.exchangeratesapi.io/latest?base=" + baseCurrency))
                                         .build();

        HttpResponse<String> response = null;
        try {
            response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
        } catch(IOException | InterruptedException e) {
            e.printStackTrace();
        }

        return response.body();
    }
}
```

## Divergent Change

Divergent change means we have to make several changes in the same class for different reasons. So, we have one class, one thing we want to change or add, but we end up changing code in multiple places.

1. Divergent change issues

    - Requires more typing.

    - Requires additional knowledge of what to change where.

2. How to fix Divergent change

    Typical ways to fix this are extract method or extract class.

    ![](../img/refactoring/change-preventers/solutions-divergent-change.png)

3. Benefits that we archieved for solving divergent change

    - Reduces code duplication.

    - Simplifies maintaince.

4. Example about divergent change

    Now, we have a new requirement about displaying the currency rates in a side UI widget. But our methods doesn't do printing, it does the conversion and returns the value, and that's used at checkout.

    ```java
    public class SimpleCurrencyConverter {

        private String currencyTo;

        public SimpleCurrencyConverter() {}

        public SimpleCurrencyConverter(String currencyTo) { this.currencyTo = currencyTo; }

        public double converter(double price) {
            if (currencyTo.equalsIgnoreCase("EUR")) {
                return price * 0.9;
            } else if (currencyTo.equalsIgnoreCase("CAD")) {
                return price * 1.35;
            } else {
                throw new IllegalArgumentException("Unrecognized currency: " + currencyTo);
            }
        }

        public double convertWithWebService(double price) {
            String rates = getCurrencyRate("USD");

            if (currencyTo.equalsIgnoreCase("EUR")) {
                return price * getRate(rates, "EUR");
            } else if (currencyTo.equalsIgnoreCase("CAD")) {
                return price * getRate(rates, "CAD");
            } else {
                throw new IllegalArgumentException("Unrecognized currency: " + currencyTo);
            }
        }

        // ...
    }
    ```

    But we want to display rates all the time, so here's an entirely possible scenario. Somebody will copy this entire method, changes the return type to void, and slightly changes the implementation, so that it prints the rates.

    ```java
    public class Converter {

        // ...

        public void printUsdRateFor(double price) {
            String rates = getCurrencyRate("USD");

            if (currencyTo.equalsIgnoreCase("EUR")) {
                System.out.println(getRate(rates, "EUR"));
            } else if (currencyTo.equalsIgnoreCase("CAD")) {
                System.out.println(getRate(rates, "CAD"));
            } else {
                throw new IllegalArgumentException("Unrecognized currency: " + currencyTo);
            }
        }
    }
    ```

    The problem is that when we need to add a new currency, we now have to update two places. If we have to support British pounds, we now need to remember to update two places. Otherwise, we'll get an exception. We could try and place this if-else logic into a single method that returns a value, and then call this method from both of these methods. That's one option, but in our case things can be even simpler. This was very careless copy-pasting, so we can simply remove this entire conditional logic and print the rate by using the ```getRate()``` method.

    ```java
    public class Converter {

        // ...

        public void printUsdRateFor(String currencyTo) {
            String rates = getCurrencyRate("USD");
            System.out.println(getRate(rates, currencyTo));
        }

        private double getRate(String rates, String currencyTo) {
            return Double.valueOf(rates.substring(rates.lastIndexOf(currencyTo)).substring(5, 9));
        }

        public String getCurrencyRate(String baseCurrency) {
            HttpClient httpClient = newBuilder().build();
            HttpRequest request = HttpRequest.newBuilder()
                                            .uri(URI.create("https://api.exchangerateapi.io/latest?base=" + baseCurrency))
                                            .build();

            HttpResponse<String> response = null;
            try {
                response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
            } catch(IOException | InterruptException e) {
                e.printStackTrace();
            }

            return response.body();
        }
    }
    ```

    This ```Converter``` class not only does the conversion, it's also an expert in making HTTP calls. That's a lot of responsiblity to bear, especially if we change the web service or we need HTTP functionality elsewhere. So we're going to apply Extract class.

    So, we take all the HTTP code and move it to a dedicated class. Now we have a class that knows how to talk over HTTP.

    ```java
    public class HttpHelper {

        public String getCurrencyRate(String baseCurrency) {
            HttpClient httpClient = newBuilder().build();
            HttpRequest request = HttpRequest.newBuilder()
                                            .uri(URI.create("https://api.exchangerateapi.io/latest?base=" + baseCurrency))
                                            .build();

            HttpResponse<String> response = null;
            try {
                response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
            } catch(IOException | InterruptException e) {
                e.printStackTrace();
            }

            return response.body();
        }
    }
    ```

    Then, in ```Converter``` class, we create ```HttpHelper``` object to invoke the ```getCurrencyRate()``` method.

    ```java
    public class Converter {

        // ...

        private HttpHelper httpHelper;

        // ...

        public void printUsdRateFor(String currencyTo) {
            String rates = this.httpHelper.getCurrencyRate("USD");
            System.out.println(getRate(rates, currencyTo));
        }

    }
    ```

## Solution sprawl and Shotgun surgery
1. Solution sprawl

    Solution sprawl is observed when we see code that is responsible for a single feature is spread across multiple classes. It means a solution is broken into multiple classes or places.

    It is bad because the below is what happens when we have a solution sprawl.

    ![](../img/refactoring/change-preventers/solution-sprawl.png)

    We make a change to a class and we think we're done, so we compile and run, and suddenly we get a NullPointerException or some other exceptions. We debug and find out that the code we changed is coupled in a non-obvious way with code in another class. Both must always be modified together in order to work. So we do that, compile and run again, and we still hit an exception. And the scenario repeats until we find all the places that need to be updated. This process of performing multiple changes in many places to update a single thing is called shotgun surgery.

2. Shotgun surgery

    Unlike with divergent change where changes happen in a single class, shotgun surgery happens when we have to update something and we have to do it in multiple classes or multiple modules.

    Solution sprawl and shotgun surgery address the same problem. The only difference is that we become aware of a solution sprawl by observing it while we become aware of a shotgun surgery by doing it. In other words, a solution sprawl leads to shotgun surgery.

    For our purposes, we're going to use these two terms interchangeably.

    Shotgun surgery issues:
    - Difficult to remember all the interconnected places --> difficult to maintaince, especially if we are new the project and unaware of a lot of things.

    - New team members are likely to make a mistake by forgetting to update one of the places --> causes a lot of bugs.

    How to fix solution sprawl
    - Consolidate the responsibility in a single class. It might be as simple as moving the responsibility and functionality to an existing class, but that may not make sense.

        ![](../img/refactoring/change-preventers/solution-combine-into-one.png)

        So in that case, create a new class and move all code from different classes to that one place.

    Benefits archieved:
    - Reduced posibility of mistakes (and bugs).

## Parallel Inheritance Hierarchies

When we have to create a subclass for a class which makes we create another subclass somewhere else, then that is the parallel inheritance hierarchy's code.

This is what it looks like. We have two tree hierarchies. We add a subclass in one tree, but then we need to add another subclass to the second tree. This does not sound too bad if we have just a few subclasses, but this starts to hurt as the number of our child classes grows.

![](../img/refactoring/change-preventers/parallel-inheritance-hierarchy.png)

It can be said that this code smell is a special case of shotgun surgery. One change that affects multiple places and forces us to do maintaince all over the place. And thus, the issue with this code smell is very similar as well.
- Making changes becomes harder as the hierarchies grow --> difficult and slow maintaince.

One way to deal with this is to merge class hierarchies.

![](../img/refactoring/change-preventers/refactoring-parallel-inheritance-hierarchy-1.png)

We move the functionality of one hierarchy into another, essentially apply the move method refactoring.

![](../img/refactoring/change-preventers/refactoring-parallel-inheritance-hierarchy-2.png)

Then deleting the empty classes.

![](../img/refactoring/change-preventers/refactoring-parallel-inheritance-hierarchy-3.png)

This is likely to result in another code smell, the large class. So our classes would have several responsibilities, so that's too bad. But if there's no other way, that is the lesser evil, and sometimes that's what we have to do in programming. Not choosing the best way, but choosing the least evil way.

Depending on what or how our parallel trees are structured and coupled, it may be possible to refactor them by applying either the visitor pattern or the bridge pattern, but

To give us a better feeling of what this could look like in our code, we could have a lot more information in each of our products. For example, their calorie count or country of origin, and because our imaginary online shop has grown substantially, it needs to have JSON and XML representation of each product that it could send over the wire somewhere for some reasons.

![](../img/refactoring/change-preventers/ex-parallel-inheritance-hierarchy.png)

And with every new product, we would get two new classes for JSON and XML representation. So this is what kind of maintaince hell we would be looking at with this code smell.

## Wrapping up
- Classes should be highly coherent to avoid diverent change.

- Solutions should be consolidated to avoid Solution Sprawls.

- Avoid parallel inheritance.

Refer:

[Java Refactoring: Best Practices](https://app.pluralsight.com/library/courses/java-refactoring-best-practices/table-of-contents)

[https://aboullaite.me/cdi-20-java-se/](https://aboullaite.me/cdi-20-java-se/)

[https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#weld-se](https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#weld-se)

[http://www.mastertheboss.com/jboss-frameworks/cdi/building-a-cdi-2-standalone-java-application](http://www.mastertheboss.com/jboss-frameworks/cdi/building-a-cdi-2-standalone-java-application)


text:
---
layout: demopagenew
title: Languages of India - Spark NLP Demos & Notebooks
seotitle: 'Spark NLP: Languages of India - John Snow Labs'
subtitle: Run 300+ live demos and notebooks
full_width: true
permalink: /languages_india
key: demo
nav_key: demo
article_header:
  type: demo
license: false
mode: immersivebg
show_edit_on_github: false
show_date: false
data:
  sections:
    - secheader: yes
      secheader:
        - subtitle: Languages of India - Live Demos & Notebooks
          activemenu: languages_india
      source: yes
      source:
        - title: NER Model for Hindi+English
          id: ner_model_hindi_english
          image:
              src: /assets/images/NER_Model_for_Hindi_English.svg
          excerpt: This model shows how Places an Organizations can be detected in mixed Hindi+English texts.
          actions:
          - text: Live Demo
            type: normal
            url:  https://demo.johnsnowlabs.com/public/NER_HINDI_ENGLISH/
          - text: Colab
            type: blue_btn
            url: https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/NER_HINDI_ENGLISH.ipynb
        - title: Recognize Entities in Bengali
          id: recognize_entities_in_bengali
          image:
              src: /assets/images/Flag_of_Bangladesh.png
          excerpt: Recognize Persons, Locations, Organizations and Misc entities using an out of the box pretrained Deep Learning model and GloVe word embeddings (glove_840b_300d).
          actions:
          - text: Live Demo
            type: normal
            url:  https://demo.johnsnowlabs.com/public/NER_BN
          - text: Colab
            type: blue_btn
            url:  https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/NER.ipynb
        - title: Translate text from Marathi to English
          id: translate_text_from_marathi_to_english
          image:
              src: /assets/images/Translate_text_from_Marathi_to_English.svg
          excerpt: Translate text from Marathi to English using pre-trained Deep Learning pipeline
          actions:
          - text: Live Demo
            type: normal
            url:  https://demo.johnsnowlabs.com/public/INDIAN_TRANSLATION_MARATHI/
          - text: Colab
            type: blue_btn
            url: https://githubtocolab.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/TRANSLATION_PIPELINES_MODELS.ipynb
        - title: Translate text from Punjabi to English
          id: translate_text_from_punjabi_to_english
          image:
              src: /assets/images/Translate_text_from_Punjabi_to_English.svg
          excerpt: Translate text from Punjabi to English using pretrained Deep Learning pipeline
          actions:
          - text: Live Demo
            type: normal
            url:  https://demo.johnsnowlabs.com/public/INDIAN_TRANSLATION_PUNJABI/
          - text: Colab
            type: blue_btn
            url: https://githubtocolab.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/TRANSLATION_PIPELINES_MODELS.ipynb
        - title: Urdu news classifier
          id: urdu_news_classifier
          image:
              src: /assets/images/Urdu_news_classifier.svg
          excerpt: This demo shows how to classify Urdu news into different categories, such as Science, Entertainment, etc.
          actions:
          - text: Live Demo
            type: normal
            url: https://demo.johnsnowlabs.com/public/CLASSIFICATION_UR_NEWS/
          - text: Colab
            type: blue_btn
            url: https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/CLASSIFICATION_UR_NEWS.ipynb
        - title: Lemmatizer for Languages of India
          id: lemmatizer_languages_india
          image:
              src: /assets/images/Lemmatizer_for_Languages_of_India.svg
          excerpt: This demo shows how to lemmatize documents of Indian languages.
          actions:
          - text: Live Demo
            type: normal
            url: https://demo.johnsnowlabs.com/public/LEMMATIZER_INDIAN/
          - text: Colab
            type: blue_btn
            url: https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Public/2.Text_Preprocessing_with_SparkNLP_Annotators_Transformers.ipynb
---

repository: JohnSnowLabs/spark-nlp

gha_language: Scala

repo_name: JohnSnowLabs/spark-nlp


text:
![Announcement](http://demo.hocza.com/github/laravel-announcement/laravel-announcement.png)
# Laravel Announcement

A package that simplifies the management of site-wide announcements. With "Laravel Announcement" you can display auto-expiring announcements.

## Installation

1- `composer require laravelhungary/announcement`
- plz note that the package use `predis/predis` for all of its operation.

2- Add the followings to `config/app.php`

```php
'providers' => [
    ...

    LaravelHungary\Announcement\PackageServiceProvider::class,
],

'aliases' => [
    ...

    'Announce' => LaravelHungary\Announcement\Facades\Announce::class,
]
```

3- run `php artisan vendor:publish` and you will get

```shell
/config/announcement.php
/views/vendor/announcement/alert.blade.php
/Events/NewAnnouncement.php
/components/Announcement-bootstrap.vue
/components/Announcement-sweetalert.vue
```

4- That's it.

> if you need to broadcast the announcements through something like web-sockets please check [Event Broadcasting](https://laravel.com/docs/5.3/broadcasting)

## Usage

### Normal
#### Create Announcement
`Announce::create($title, $message, $type, $ttl);`

Params
* `title` a short message.

> For example: Breaking news!

* `message` A bit longer message.

> For example: Our servers are under a DDoS attack. We are trying hard to mitigate it.

* `type` Type of the announcement.

> For example: success,info,danger,warning (or anything you would like to use) , Default is: info

* `ttl` When should the announcement expire. [Time to live] in seconds.

> Default is: 60 seconds

#### Display of Announcements

put `{!! Announce::display() !!}` anywhere you want your announcement to be visible.

===

### Broadcasting
#### Create Announcement
`Announce::broadcast($title, $message, $type, $ttl, $transition, $channel_name);`

Params
* `title`,`message`,`type`,`ttl` same as the [normal](#normal) announcement

* `transition` what is animation type you want.

> For example: fade , bounce, etc... [Check Vue Transition](http://vuejs.org/guide/transitions.html#CSS-Transitions) , Default is: fade

* `channel_name` change it to override the config value "dont forget to also change it in the component file"

> Default is: public-announcement-channel

#### Display of Announcements
- note that the package doesnt care what driver you use `pusher` or `socket.io` , it will just work 🍺.
- we also use **VueJs 2**, but if you want to use something else then ignore the below and you are free to build your own.

1- put `Vue.component('my-announcement', require('./components/Announcement-bootstrap.vue'));` into your **app.js** file

2- put `<my-announcement></my-announcement>` anywhere you want this announcement to show up. For example: your **layout.blade.php** file

>  if you want to use something like `Animate.css` follow [Custom Transition Classes](https://vuejs.org/v2/guide/transitions.html#Custom-Transition-Classes)

Package Maintainers
---
* Jozsef Hocza [@hocza](https://github.com/hocza)
* Muah [@ctf0](https://github.com/ctf0)

Buy us a coffee :)
---

repository: laravelhungary/announcement

gha_language: PHP

repo_name: laravelhungary/announcement


text:
# ZXing-CSharp-MicroQR-Detector
Micro QR Code detection for ZXing .NET

Referenced Projects:
ZXing "Zebra Corssing" for Java
https://github.com/zxing/zxing

ZXing "Zebra Corssing" for .Net
http://zxingnet.codeplex.com/

Micro QR Code Encoder/Decoder for ZXing by TUPUNCO
https://github.com/tupunco/ZXing-CSharp

The projects above provided the bases for the Micro QR Code Detector feature enhancement.

Micro QR Code Detection:

The Micro QR Code Encoder/Decoder for ZXing by TUPUNCO was branched from Zebra Crossing .NET in 2007.  This branch was no longer compatible with the latest set of code from ZXing .NET.  These two projects have been merged together so that the latest branch of ZXing Crossing .NET is used as the bases and the Micro QR Code Encoder/Decoder from TUPUNCO is merged into it.

I consider the merge performed imperfect at present.  I have not yet had a chance to switch over everything to use the newest methods of ZXing .NET however this task will be completed as I continue with this project.  The merge as imperfect as it is works correctly so that all the features of Micro QR code Encoder/Decoder work as they worked in the previous version and all of the previous features of ZXing .NET continue to work.

The feature I developed on top of TUPUNCO Micro QR Code Encoder/Decoder is a Micro QR Code detector.  This was a fun challenges to design a method to get the correct bits from the barcode based on the single finder pattern that is returned.  A lot of the existing code for both QR Code and Data Matrix were refactored to provide the methods needed to detect a Micro QR code.  There are still a lot of optimizations that can be added to this code however I wanted to push out this feature into "the community" so that it could be extended/refactored if desired.

QR Code is trademarked by Denso Wave, inc.

http://www.qrcode.com/en/codes/microqr.html

repository: GordonCox/ZXing-CSharp-MicroQR-Detector

repo_name: GordonCox/ZXing-CSharp-MicroQR-Detector


text:
Slack API Models
================

JS model objects for the Slack API objects.

There are two flavors:
* [Slack](slack): objects directly representing [Slack API Types](https://api.slack.com/types)
* [Intermediary](intermediary): objects that are used in this library, but which don't exist in the Slack API Types

repository: Qlwentt/walle

repo_name: Qlwentt/walle


text:
---
layout: post
title: Jessica's review on self-organized cell migration published in Development
picture: /assets/img/posts/20210406_JessicaReview.jpg
published: true
---
Big congratulations to **Jessica** on leading the write-up of this insightful review on self-organized cell migration. The idea for this review originated during the first lockdown in Austria about one year ago - one year later, being in our third (or forth?) lockdown, it's great to see it published!
Thanks to all the constructive feedback from reviewers and colleagues that helped us to improve the paper, and particularly to Katherine Brown, editor at Development, for making this publishing experience really enjoyable!

If you want to know more about self-organized cell migration, check out Jessica's review [here](https://dev.biologists.org/content/148/7/dev191767): "Self-organized cell migration across scales – from single cell movement to tissue formation."


text:
## [Unreleased]

## ['4.0.13'] - 2018-11-01

### Fixed
- Crash: http://crashes.to/s/311ed77eeee

## [4.0.12] - 2018-10-13

### Changed
- Redesign of query screen

### Fixed
- Crash: http://crashes.to/s/3d26037ebf1

## [4.0.11] - 2018-09-14

### Added
- SSH tunnel support

### Changed
- Redesign of connection editing form

## [4.0.10] - 2018-09-08

### Changed
- Update Fabric libraries

### Fixed
- Landscape lock screen: https://gitlab.com/devlife-apps/connect2sql/issues/11
- Crash: http://crashes.to/s/a5ca59edd6f
- Spanish QuickKeys

## [4.0.9] - 2018-09-04

### Added
- Spanish (es) translation

### Fixed
- Crash: http://crashes.to/s/3cfd4558aaa

## [4.0.8] - 2018-09-03

### Added
- Don't attempt to lookup all databases when database set

### Fixed
- Crash: http://crashes.to/s/de660f491cc

## [4.0.7] - 2018-08-27

### Added
- Beta link to menu

## [4.0.6] - 2018-08-27

### Added
- Cancel server graph when backgrounded.

### Fixed
- Upgrade support libraries for current target.
- Resolve http://crashes.to/s/107437021a3


text:
# Description:
* Demo Java 8 maven project showcasing Spring boot, Spring cloud GCP Spanner, Pub/Sub and Stackdriver tracing and logging.
* Its deployable to gae-standard 1st generation which uses Java8 and Jetty 9
* It demos distributed tracing, co-relating logs in cases where one request spawns multiple requests across multiple micro services
* It also demos integration with GCP Spanner DB using Spring cloud GCP

# Prerequisites
1. Install Java 8 JDK
2. Set up a project in GCP through https://cloud.google.com/ or gcloud CLI
3. Enable billing

# Building
mvnw clean install

# Running locally:

1. Change spring active profile in appengine-web.xml file to dev_local
2. Copy spring-boot-gcp-demo-251616-80aae1c91d25.json to a local directory and update the path
under application-dev_local.properties file
3. Run using the following commands:
set JAVA_HOME=C:\dev\Java\jdk1.8.0_211
Set PATH=%JAVA_HOME%\bin;%PATH%
set JAVA_OPTS=-Xms2g -Xmx2g
cd C:\dev\projects\gcp\spring-boot-gcp-java8-appengine-1st-g-standard-war-demo
mvnw clean install appengine:run

### NOTE: You can also run by Importing project into Intellij IDE and running the GcpDemoApplication class as a Java application

# Testing locally:
* List all available REST endpoints
  * curl -i http://localhost:8080
* List orders
  * curl -i http://localhost:8080/orders

# Deploying to google app engine:
./mvnw appengine:deploy

# Sample curl requests
curl -i http://localhost:8080/orders

curl -i -XPOST \
-H "Content-Type: application/json" \
-d '{"firstName":"Larry","lastName":"Grooves","customerId":"53a2e699-0205-4546-aae6-8fc903c478c7","orderDate":"2019-10-10T18:06:48.526+0000"}' \
http://localhost:8080/orders

curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"message": "Hello"}' \
http://localhost:8080/greet

curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"message": "Hello"}' \
http://localhost:8080/greetAsync

# Submitting a request and getting trace Id back
curl -i -XPOST \
-H "Content-Type: application/json" \
-d '{"firstName":"Larry","lastName":"Grooves","customerId":"53a2e699-0205-4546-aae6-8fc903c478c7","orderDate":"2019-10-10T18:06:48.526+0000"}' \
https://spring-boot-gcp-demo-251616.appspot.com/orders

HTTP/2 201
set-cookie: JSESSIONID=node0piy6x6ldeidw14trhe11h2axe3.node0; Path=/
expires: Thu, 01 Jan 1970 00:00:00 GMT
content-type: text/plain;charset=utf-8
x-cloud-trace-context: 46dc8f6388fadba0d182970fbf88d792;o=1
date: Tue, 10 Sep 2019 20:38:42 GMT
server: Google Frontend
content-length: 36
alt-svc: quic=":443"; ma=2592000; v="46,43,39"

9b2c6a02-119d-4f1a-b781-de6ccad32689

Advanced search entry in stackdriver logviewer
(trace="projects/spring-boot-gcp-demo-251616/traces/46dc8f6388fadba0d182970fbf88d792")

# Forcing a trace Id:
curl -i -XPOST \
-H "Content-Type: application/json" \
-H "X-Cloud-Trace-Context: 105445aa7843bc8bf206b120001000" \
-d '{"firstName":"My","lastName":"Nyugen","customerId":"53a2e698-0205-4546-aae6-8fc903c478c7","orderDate":"2019-10-10T18:06:48.526+0000"}' \
https://spring-boot-gcp-demo-251616.appspot.com/orders
##  Note: This wont work for some reason, the passed in X-Cloud-Trace-Context does not get used

# Issues
 * force a trace Id wont work, the passed in X-Cloud-Trace-Context does not get used, instead a new X-Cloud-Trace-Context gets used and returned
 * when deployed to app engine standard, its takes upto 30 seconds to start an instances since all instances get shutdown when no requests come in
   for certain period of time
# Todos
 * Add maven profiles for running with and without embedded tomcat by removing tomcat starter from spring boot web starter
   and adding servlet api dependency
     <!-- Include Servlet API -->
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
         <version>3.1.0</version>
         <scope>provided</scope>
       </dependency>
    based of demo project here
    https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard

 ## Please ignore this exception while on startup, it does not affect application

 2019-09-12 14:17:35.006 ERROR [orders-service,,,] 660 --- [           main] i.g.i.ManagedChannelOrphanWrapper        : *~*~*~ Channel ManagedChannelImpl{logId=1, target=logging.googleapis.com:443} was not shutdown properly!!! ~*~*~*
     Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.

 java.lang.RuntimeException: ManagedChannel allocation site
 	at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.<init>(ManagedChannelOrphanWrapper.java:94)
 	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:52)
 	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:43)
 	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:514)
 	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:223)
 	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:164)
 	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:156)
 	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:157)
 	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:122)
 	at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:132)
 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:61)
 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:55)
 	at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:510)
 	at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:129)
 	at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:109)
 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
 	at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:498)


text:
# Legal

### Corporate

HackerBay, Inc. is a US C Corporation incorporated in Delaware. Our registered address in the United States is 16192 Coastal Highway, Lewes, DE, 19958, County of Sussex.

Employer Identification Number for HackerBay Inc is 38-4042380

### Contracts
If you need to request legal resources, including contract review, third party license review, legal advice or guidance, please submit all requests through email at<EMAIL_ADDRESS>
Please be sure to include sufficient detail regarding your request, including time-sensitive deadlines, relevant documents, and background information necessary to respond.

### Chat Channel
Feel free to use the `#legal` chat channel in Slack for general legal questions.

## Company Policies

* [Anti-harassment](/general/anti-harassment/README.md)

repository: rajat-np/Employee-Handbook

repo_name: rajat-np/Employee-Handbook


text:
    Enrollment

  A web app written using Flask:

## Contents
- [Installing](#-installing)

## Installing
All the dependencies are listed in the requirements.txt file. The application is written in Python 3, in order to
install the dependencies, execute:

    pip install -r requirements.txt

branch_name: refs/heads/develop

gha_language: HTML


text:
# Custom Jenkins Setup

## Requirements

* You have installed Java Runtime Environment 8.
* You have installed Jenkins v 2.60.3 or higher running on Linux. We've tested with debian-stretch.
* A Jenkins user with administration rights.
* Your Jenkins instance has access to [github.com][github].

## Docker

Most of the tools project "Piper" uses to build, test, and deploy your application are available as out-of-the-box Docker images. You don't need to manually install them on your Jenkins server or Jenkins nodes, nor care for updates. Instead, these are automatically pulled from *hub.docker.com*.

Install Docker if you haven't installed it, yet. To install the newest version of Docker, see [Docker Community Edition][docker-install].
**Note:** We've tested on Docker 18.09.6.

If your Jenkins server already runs as Docker container, make sure the tools container can run on the Docker host. Extend the Docker call in the following way:

```
docker run ...  -v /var/run/docker.sock:/var/run/docker.sock ...
```

## Plugins

Project "Piper" requires a set of plugins installed on your Jenkins server. This set may evolve in the future. Make sure that all plugins of the appropriate versions are installed.

The Cx server repository contains an [up-to-date list][devops-cxs-plugins] of the required plugins. To ease the installation, download the list with the following command and use the [Jenkins client][jenkins-doc-client]:

```
curl -o plugins.txt https://raw.githubusercontent.com/SAP/devops-docker-cx-server/master/jenkins-master/plugins.txt
```

On the Jenkins server, run the following command with a user that has administration rights:

```
cat plugins.txt | awk '{system("java " "-jar jenkins-cli.jar -s http://localhost:8080 -auth ${ADM_USER}:${ADM_PASSWD} install-plugin " $1)}'
```

## Shared Library

Shared libraries extending the Jenkins pipeline are defined within the Jenkins system configuration. A library is defined by a link to its source repository and an appropriate version identifier. To add the project "Piper"s library, execute the following steps:

1. Open the Jenkins UI under `http://<jenkins-server-address>:<http-port>`, login with administration privileges, and choose **Manage Jenkins > Configure System**.

    ![Configure System](../images/JenkinsHomeMenuManageConfig.png "Configure System")

1. Scroll down to section **Global Pipeline Libraries** and choose the **Add** button. A new library is created.

    ![Add Library](../images/JenkinsConfigSystemLibrary-Add.png "Add Library")

1. For **Library Name**, enter `piper-lib-os`.

1. For **Default Version**, enter the branch or tag you want to consume (e.g. `master` or `v0.1`).

1. For **Retrieval Method**, choose **Modern SCM**.

1. For **Source Code Management**, choose **Git**.

1. For **Project Repository**, enter the GitHub URL of the project Piper shared library `https://github.com/SAP/jenkins-library`.

    ![Library Setup](../images/JenkinsConfigSystemLibrary-Edit.png "Library Setup")

1. Save your changes.

**Result:** The library is available as `piper-lib-os`. To use it by any pipeline, add the following line to its `Jenkinsfile`:

```groovy
@Library('piper-lib-os') _
```

When the pipeline is launched, Jenkins downloads the corresponding library as source and compiles it before the pipeline is processed.

## User Permission Issue

Your native Jenkins installation defines the user `jenkins` as a service user. If it doesn't exist, it is created. In this case, the user ID is the next free number determined by `/etc/passwd` - probably starting from `100`.
In contrast, the official [Jenkins Docker image][jenkins-docker-image] defines the user `jenkins` with the user ID `1000` as a service user inside the container.
So, the service user ID of your native Jenkins server most likely differs from the user ID of the official Jenkins Docker image.

This could have impacts.

Project "Piper" runs many pipeline steps as Docker images. If a Docker container is created, the Jenkins Docker plugin passes the Jenkins user and group ID as a process owner into the Docker container.
Binding a folder from the host machine into the container - used to exchange files between steps - results in file permission issues, if the user inside the container doesn't have rights for the folder on the host machine or vice versa.

Although you won't face this issue with images of project "Piper" , some 3rd-party Docker images follow this convention and expect to be executed under userid `1000`, like [node.js][dockerhub-node], which is used by a set of additional steps.

If you face such a [user permission issue][piper-issue-781], choose between the following options:

- Change the ID of your Jenkins service user to `1000`.

- [Create your own images][docker-getstarted] and solve the permission issues by removing the file system restrictions. Adjust the configuration accordingly, for example, adjust the `npmExecute` step of your project's YAML:

```
  npmExecute:
    dockerImage: 'my-node:8-stretch'
```

- Set up a namespace. The user permission [issue 781][piper-issue-781] of the project "Piper" repository describes how to set up a Linux kernel user namespace to prevent the mismatch of user IDs. **Note:** This solution is experimental and should be well-considered.

[github]: https://github.com
[docker-install]: https://docs.docker.com/install
[dockerhub-node]: https://hub.docker.com/_/node/
[docker-getstarted]: https://docs.docker.com/get-started/
[jenkins-doc-client]: https://jenkins.io/doc/book/managing/cli/
[jenkins-docker-image]: https://github.com/jenkinsci/docker/
[piper-library-pages]: https://sap.github.io/jenkins-library
[piper-issue-781]: https://github.com/SAP/jenkins-library/issues/781

[devops-docker-images]: https://github.com/SAP/devops-docker-images
[devops-cxs-plugins]: https://github.com/SAP/devops-docker-cx-server/blob/master/jenkins-master/plugins.txt

repository: SAP/jenkins-library

gha_language: Go

repo_name: SAP/jenkins-library


text:
# [Unity SystemInfo Table](https://mvi.github.io/UnitySystemInfoTable/)

Crowdsourced [table](https://mvi.github.io/UnitySystemInfoTable/) of system capabilities from different devices

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](http://makeapullrequest.com) [![GitHub](https://img.shields.io/github/license/mvi/UnitySystemInfoTable)](https://github.com/mvi/UnitySystemInfoTable/blob/master/LICENSE)

Unity provides the [SystemInfo](https://docs.unity3d.com/ScriptReference/SystemInfo.html) API which allows you to find out the capabilities of the device you're running on. Knowing which devices support what is important when making technical decisions about what you can use on your target devices on new projects.

The Unity SystemInfo Table project is intended to allow Unity developers to contribute to a shared table so we can map out what common devices support.

## How to contribute

1. Download the [CopySystemInfo](https://github.com/mvi/UnitySystemInfoTable/blob/main/CopySystemInfo.cs) MonoBehaviour into a Unity project (ideally on a relatively new Unity version)
2. Add CopySystemInfo to a game object in a scene that gets built
3. Build and run the project on your target device
4. There are now two options:
    1. On Desktop or Mobile, the SystemInfo json text is automatically copied to the clipboard
    2. On all platforms, the SystemInfo json will be written to the console log
5. Create a new .json file and paste in the SystemInfo json
6. Double check that the json file is valid and contains no personal information (the copy code automatically removes device name and unique identfier, but you may want to double check)
7. Create a pull request with your json file in the /input folder

repository: silasary/UnitySystemInfoTable

branch_name: refs/heads/main

repo_name: silasary/UnitySystemInfoTable


text:
# Backend Architecture

![alt text](./BasicCSharpBackend.png "Basic C# Backend Architecture")

Controllers/ASP.NET Core:
- Call Façades and transform results in HTTP Responses.

Façades:

To avoid the façade-must-call-service-that-must-call-store rule, I like to put
non-repetitive logic directly on the façade. If something repeat we can promote it to a "Service".

- Validate authentication/authorization
- Validate input
- Orchestrate Services or Do the logic
- MUST Commit the transaction (only façades commit)
  - As o side-effect is generated before the commit is called, we can easily generate what-if. Useful for tests.

Services

- Do the logic
- NEVER validate authentication/authorization
- NEVER commit
- Must be composable/orchestratable (not a real word) by Façades

UoW (implement three interfaces)

- Implement generic store/repository:
  - IQueryable<T> get<T>()
  - T getById<T>(id)
  - Pagination<T> paginate<T>(pagination)
  - void insert<T>(T item)
  - Task<T> insertReturn<T>(T item)  <- task only finished after commit (dangerous but usefull)
  - void update<T>(T item)
  - Task<T> updateReturn<T>(T item)  <- task only finished after commit (dangerous but usefull)
  - void delete(T item)

- Implement domain event dispatcher
  - Task Raise(EventArgs)

- Implement ISaveChanges
  - Task Commit()

Most important method:
 - Generate an EntityCreate, EntityUpdated, EntityDeleted for each operation (same order they happened)
 - Dispatch all events (same order they happened) to "Sync Handlers"
   - "Sync Handlers" typically increase the semantic of events (when "Due Date" is changed send email to responsible". This handler NEVER send the email, just tell that an email must be sent.)
 - Open Transaction
   - Send entities commands to the DB
   - Save persisted events to the DB
   - Commit Transaction
   - Send messages to the queue
     - Preferably using "Claim Check Patern" (https://www.enterpriseintegrationpatterns.com/patterns/messaging/StoreInLibrary.html)
     - "Async Handlers" do the actual work. That email is sent here.

I understand that the most polemic part here is: "why saving the messages in the DB if we have a queue?"

Normally people do:

```
uow.Commit();
Queue.Dispatch(events);
```

Of course that in 99.999% of the cases, everything works, but when the "Dispatch" fails, the messages are lost. If this is OK, so this solution is fine.

If this is not OK, we need something better:
 - or we put DB and Queue in "distributed transaction";
   - in this case, how you backup/restore the system? Not easy.
 - or we persist everything in the DB.

The second is easier and scale much better (we can have multiple tables, partitioned tables to guarantee O(1) etc...)

The second point would be: "If we persisting messages in the DB, why even use a queue?"

The answer is: First because it is better. In the 99.99% of the cases, we never touch the "message table" so it is not onerous. Second, we may have non-persisted/it-doesnt-matter-if-we-lose-the-message messages (alert the user through Websocket that something happened, for example).

More:
"Life beyond Distributed Transactions: an Apostate’s Opinion"
http://www-db.cs.wisc.edu/cidr/cidr2007/papers/cidr07p15.pdf

## Considerations when processing messages

All of this is, of course, possible using queue servers in general, but...

Another advantage of having the messages in the DB is to uniformally process messages using different messages servers. If you plan to send e-mail using a specific gateway that supports batches, you can easily get all email-messages, batch them, and send them (using transactions). Not something easily done in some queue servers.

Another advantage is that is very easy to implement poisonous-message handling (https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/poison-message-handling) when handling the message inside a transaction. It is very easy to append a metadata and or "remove" the message from a queue (https://www.enterpriseintegrationpatterns.com/patterns/messaging/InvalidMessageChannel.html).

Another point is, if you plan to use a SAGA (http://udidahan.com/2009/04/20/saga-persistence-and-event-driven-architectures) you are going to need a store anyway.

# REST and Testing

I like to test the REST API in two ways.

 - Integration tests actually calling the API using stubs where appropriate.
   - Avoid as MUCH as possible mocks.
   - Allow the application to be configured in a "test mode".
   - Use "Property Based Testing" (https://www.codit.eu/blog/property-based-testing-with-c)
     - Some endpoints behave like "collections", so I test them like collections.
       - If an item is not in the list and I insert it; it must be in the list.
       - etc...
     - Some endpoints behave like "state machines", so I test them like state machines.
       - If an item is in state X, and I can transition to state Y, and I do it; it must now be in state Y.
       - etc...
 - Normal Unit tests
   - I dislike the approach of testing if the controller calls the correct method of the façade using mocks, for example. In my experience, this generates a lot of useless tests that just cement the implementation.
   - Pure functional methods (no global/db/outside reads and no side effects) must be tested using Unit Test, of course.

# Extensions Methods and Monads

Monads are very useful, but generally is too thick to C# developers. I like to mix their gain with a still-looks-like-c# code using extension methods. Mainly on top of the Task class.

So instead of

```
Task<Either<int,InvalidArgumentException>> doSomethingAsync(int value)
{
  ...
}

var result = (await doSomethingAsync(0)).map(x => x, err => 0);
```

Which does not looks natural C#. I prefer (even for non IO methods) to treat Task<T>/ValueTask<T> as the Either monad. It has a .Result and a .Exception. We lose the guarantees of the Either monad, but that is ok.

```
// non async example
ValueTask<int> doSomething(int value)
{
  ...
  if(...)
    return new InvalidArgumentException().AsValueTask(); // <- we never throw
  ...
  return value.AsValueTask();
}

var result = await doSomething(0)
  .whenOk(x => x) // <- unecessary, off course
  .WhenErr(err => 0);
```
# to ORM or to not ORM: that is th question

It is undeniable that ORMs help. But sometimes you struggle with their limitations (not optimal pagination, geospatial query, hierarchical column, graph queries, fulltext search etc...). In these cases I prefer to use a SQL builder directly.

QueryBuilder
https://github.com/sqlkata/querybuilder

I like to discriminate commands and queries, so inside the queries part of the application, I definitely prefer to use a querybuilder.

We can avoid problems with magic-string with "nameof" (https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof).

# Logging

In 80% of the scenarios, Seq+Serilog is more than enough.

Seq
https://datalust.co/seq

In more complex settings I would go with https://opentracing.io,https://opentelemetry.io.

# Stackoverflow Answers

## C# and .NET

### UnitOfWork, Repository Database Connection Issue
about IoC container Unity
https://stackoverflow.com/questions/39954586/unitofwork-repository-database-connection-issue/40418462#40418462

### Why does 'unbox.any' not provide a helpful exception text the way 'castclass' does?
about how the .NET JIT works
https://stackoverflow.com/questions/39914845/why-does-unbox-any-not-provide-a-helpful-exception-text-the-way-castclass-do/40073409#40073409

### Cancel Specific Task using CancellationToken
How TPL works
https://stackoverflow.com/questions/35816146/cancel-specific-task-using-cancellationtoken/35817808#35817808

repository: xunilrj/sandbox

repo_name: xunilrj/sandbox


text:
# Working with React 15

If you are wanting to use Enzyme with React 16, but don't already have React 16 and react-dom
installed, you should do so:

```bash
npm i --save<EMAIL_ADDRESS><EMAIL_ADDRESS>```

React-addons-test-utils is now part of react-dom/test-utils.

Next, to get started with enzyme, you can simply install it with npm:

```bash
npm i --save-dev enzyme
```

And then you're ready to go!  In your test files you can simply `require` or `import` enzyme:

ES6:
```js
import { shallow, mount, render } from 'enzyme';

const wrapper = shallow(<Foo />);
```

ES5:
<!-- eslint no-var: 0 -->
```js
var enzyme = require('enzyme');

var wrapper = enzyme.shallow(<Foo />);
```

repository: blitzpick/enzyme

repo_name: blitzpick/enzyme


text:
# Lottery

Ask the user to press any key.

Display any 3 random space-separated digits between 0-9 e.g. `6 2 7`.

If any of them is `7`, output `"Congratulations!"`.

Else, output `"Try again! Better luck next time."`.

Repeat. [See Variants](./programming/02-lottery.md#variants).

## Variants

1. Only show congratulations if at least two of the generated numbers are `7`.

2. Only show congratulations if all three of the generated numbers are `7`.

3. Only show congratulations if all three of the generated numbers are even numbers e.g. `0`, `2`, `4` or `6`.

4. Only show congratulations if all three of the generated numbers are odd numbers e.g. `1`, `3`, `5` or `7`.


text:
# crypto-markets

[![](https://img.shields.io/github/workflow/status/soulmachine/crypto-crawler-rs/CI/main)](https://github.com/soulmachine/crypto-crawler-rs/actions?query=branch%3Amain)
[![](https://img.shields.io/crates/v/crypto-markets.svg)](https://crates.io/crates/crypto-markets)
[![](https://docs.rs/crypto-markets/badge.svg)](https://docs.rs/crypto-markets)
==========

Fetch trading markets from a cryptocurrency exchange.

## Example

```rust
use crypto_markets::{fetch_markets, MarketType};

fn main() {
    let markets = fetch_markets("Binance", MarketType::Spot).unwrap();
    println!("{}", serde_json::to_string_pretty(&markets).unwrap())
}
```

repository: hooops/crypto-crawler-rs

repo_name: hooops/crypto-crawler-rs


text:
# Reddit simple clone app by using kotlin and AAC

[![Kotlin](https://kotlin.link/awesome-kotlin.svg)](https://kotlinlang.org/)
[![Kotlin Version](https://img.shields.io/badge/kotlin-1.3.72-blue.svg)](http://kotlinlang.org/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

### Clean Architecture Description and Implementation

This project uses MVVM with RxJava, androidx and android lifecycle components ViewModel, LiveData and Room to display a list of topics from [Reddit API](https://www.reddit.com/reddits.json) using Retrofit . Selecting a topic will display a topic detail page .

After bring the topics from the Api , the results will be saved in local DB using Room , the repository will achieve the Single source of truth with the help of RxJava to combine multible resources , which will send the data to the Viewmodel where will be data Transformation and get the final result in Livedata objects and send it to the View.

The Idea behind using local DB to achieve 3 things:

1 - to make the user expirience better when the user open the app by showing few results and refresh the list from the API.

2 - make it easier to transfer the data between the fragments and activities without the need of creating Parcelable objects.

3 - help updating data like in our example (up vote , down vote)

### Package Details
**App:** Contain the Apiservices , RoomDB and Application class
* **Data:** Contain the listing Data Access object (DAO) to do all the local DB queries , and the listing repository where we achieve the single source of truth
* **DI:** Contain the DI modules
* **Dialogs :** Contain all the bottom sheet dialogs that we have in our example (add new topic and confirm clear the draft)
* **Utils:** Contain helpers for many purposes (like image rendering and fragment navigation) to avoid boilerplate in the code

### Frameworks and Libraries

* Architecture components with ViewModel and LiveData  , Room
* RxJava for async processing
* Gson for Json Parsing
* Koin for dependency injection
* AndroidX for Jetpack components
* Glide for Image Loading

repository: MohammedMokresh/Reddit-Clone

gha_language: Kotlin

repo_name: MohammedMokresh/Reddit-Clone


text:
# Destructuring ES6
> http://exploringjs.com/es6/ch_destructuring.html#ch_destructuring
> _Destructuring_  is a convenient way of extracting multiple values from data stored in (possibly nested) objects and Arrays. It can be used in locations that receive data (such as the left-hand side of an assignment). How to extract the values is specified via patterns (read on for examples).

## Object destructuring

Destructuring objects:

```js
const obj = { first: 'Jane', last: 'Doe' };
const {first: f, last: l} = obj; // Renombrando la extracción
    // f = 'Jane'; l = 'Doe'

// {prop} is short for {prop: prop}
const {first, last} = obj;
    // first = 'Jane'; last = 'Doe'
```

## Array destructuring

Array destructuring (works for all iterable values):

```js
const iterable = ['a', 'b'];
const [x, y] = iterable;
    // x = 'a'; y = 'b'
```

Destructuring helps with processing return values:

```js
const [all, year, month, day] =
    /^(\d\d\d\d)-(\d\d)-(\d\d)$/
    .exec('2999-12-31');
```

### Where can destructuring be used?

Destructuring can be used in the following locations (I’m showing Array patterns to demonstrate; object patterns work just as well):

```js
// Variable declarations:
const [x] = ['a'];
let [x] = ['a'];
var [x] = ['a'];

// Assignments:
[x] = ['a'];

// Parameter definitions:
function f([x]) { ··· }
f(['a']);
```

You can also destructure in a  `for-of`  loop:

```js
const arr = ['a', 'b'];
for (const [index, element] of arr.entries()) {
    console.log(index, element);
}
// Output:
// 0 a
// 1 b
```

### More Array destructuring features

#### Elision

Elision lets you use the syntax of Array “holes” to skip elements during destructuring:

```js
const [,, x, y] = ['a', 'b', 'c', 'd']; // x = 'c'; y = 'd'
```

#### Rest operator (`...`)

The  _rest operator_  lets you extract the remaining elements of an iterable into an Array. If this operator is used inside an Array pattern, it must come last:

```js
const [x, ...y] = ['a', 'b', 'c']; // x='a'; y=['b', 'c']
```

[The spread operator](http://exploringjs.com/es6/ch_parameter-handling.html#sec_spread-operator)  has exactly the same syntax as the rest operator – three dots. But they are different: the former contributes data to Array literals and function calls, whereas the latter is used for destructuring and extracts data.

If the operator can’t find any elements, it matches its operand against the empty Array. That is, it never produces  `undefined`  or  `null`. For example:

```js
const [x, y, ...z] = ['a']; // x='a'; y=undefined; z=[]
```

The operand of the rest operator doesn’t have to be a variable, you can use patterns, too:

```js
const [x, ...[y, z]] = ['a', 'b', 'c'];
    // x = 'a'; y = 'b'; z = 'c'
```

The rest operator triggers the following destructuring:

```js
[y, z] = ['b', 'c']
```

### You can assign to more than just variables

If you assign via destructuring, each assignment target can be everything that is allowed on the left-hand side of a normal assignment.

For example, a reference to a property (`obj.prop`):

```js
const obj = {};
({ foo: obj.prop } = { foo: 123 });
console.log(obj); // {prop:123}
```

Or a reference to an Array element (`arr[0]`):

```js
const arr = [];
({ bar: arr[0] } = { bar: true });
console.log(arr); // [true]
```

You can also assign to object properties and Array elements via the rest operator (`...`):

```js
const obj = {};
[first, ...obj.prop] = ['a', 'b', 'c'];
    // first = 'a'; obj.prop = ['b', 'c']
```

If you  _declare_  variables or define parameters via destructuring then you must use simple identifiers, you can’t refer to object properties and Array elements.
<!--stackedit_data:
eyJoaXN0b3J5IjpbLTE2NDgwMDI1ODddfQ==
-->


text:
# JinaD Client

You can use `JinaDClient` or (for your async
code) feel free to use `AsyncJinaDClient` which makes all following code awaitables.

## Check if remote server is alive

```python
from daemon.clients import JinaDClient

client = JinaDClient(host=HOST, port=PORT)
assert client.alive
```

or,

```python
from daemon.clients import AsyncJinaDClient

client = AsyncJinaDClient(host=HOST, port=PORT)
assert await client.alive
```

## Get the status of the remote server

```python
from daemon.clients import JinaDClient

client = JinaDClient(host=HOST, port=PORT)
client.status
```

```json
{
  "jina" {
    "jina": "2.0.11",
    ...
  },
  "envs": {
    ...
  },
  "workspaces": {
    ...
  },
  "peas": {
    ...
  },
  "pods": {
    ...
  }
  "flows": {
    ...
  }
}
```

repository: VenusTokyo/jina

repo_name: VenusTokyo/jina


text:
# Development

Quorum By ConsenSys builds binaries for both Mac and Linux. As a result, development must take place on a Mac OS environment.

## Docker

Install:
We rely on Docker for Mac, which you can install at https://docs.docker.com/install/

Config:

- REQUIRED: `Add /var/folders to Preferences > File Sharing`
- OPTIONAL: `Preferences > Advanced, Memory: Increase from 2 GB to 4 GB
> NOTE: Parrallel build are more resource intensive and might require this step

## Binaries

On a Mac machine, install required binaries for all projects:

`$> brew install berkeley-db leveldb libsodium maven haskell-stack go node`

You will also need java: `brew cask install java`

Install the Glasgow Haskell Compiler: `stack setup`

# Building

To clean, make tarballs, containers, and run tests:
```
$> make all
```
To make tarballs and containers:
```
$> make qbc
```
To build the qbc tarball, run:
```
$> make BUILDS=linux-64 qbc-tarballs
```
> Note: To speed up the build you can add the -j [jobs] flag to the make command

### Build Targets:

By default, the build process will generate linux-64 and darwin-64 binaries.  You can override this modifying the BUILDS variable:
```
make BUILDS=linux-64 all
```
The following build targets have been tested:
- linux-64
- darwin-64

# Testing

Run:
```
$> make test
```

# Release

Make sure the version is correct in config.mk.

Run:
```
$> make BINTRAY_USER=<YOUR USERNAME> BINTRAY_KEY=<YOUR KEY> release
```

Once the process has run:
* Update the download links and the Docker image versions in the README.
* Increase the version in the Makefile.
* Commit and push changes.

repository: NandyShi/qbc

repo_name: NandyShi/qbc


text:
# 🎓 IFN505: Analysis of Programs

[![Travis CI](https://travis-ci.org/brendo/ifn505.svg?branch=master)](https://travis-ci.org/brendo/ifn505)

Practical exercises from QUT's unit [IFN505: Analysis of Programs](https://www.qut.edu.au/study/unit?unitCode=IFN505).

In an attempt to keep myself accountable, I'm aiming to commit all programming related exercises from the tutorials to this repository.

Exercises will most likely be completed using Javascript, but because Python interests me, I'll likely flip between the two languages.

If you spot an error, let me know, I am learning after all 😊


text:
#A pastoral letter from the Lord Bishop of Meaux to the new Catholicks of his diocess exhorting them to keep their Easter, and giving them necessary advertisements against the false pastoral letters of their ministers : with reflections upon the pretended persecution / translated out of French, and publish'd with allowance. Lettre pastorale. English#

##Bossuet, Jacques Bénigne, 1627-1704.##
A pastoral letter from the Lord Bishop of Meaux to the new Catholicks of his diocess exhorting them to keep their Easter, and giving them necessary advertisements against the false pastoral letters of their ministers : with reflections upon the pretended persecution / translated out of French, and publish'd with allowance.
Lettre pastorale. English
Bossuet, Jacques Bénigne, 1627-1704.

##General Summary##

**Links**

[TCP catalogue](http://www.ota.ox.ac.uk/tcp/)  •
[HTML](http://tei.it.ox.ac.uk/tcp/Texts-HTML/free/A28/A28845.html)  •
[EPUB](http://tei.it.ox.ac.uk/tcp/Texts-EPUB/free/A28/A28845.epub) •
[Page images (Historical Texts)](https://data.historicaltexts.jisc.ac.uk/view?pubId=eebo-12494943e&pageId=eebo-12494943e-62475-1)

**Availability**

This keyboarded and encoded edition of the
	       work described above is co-owned by the institutions
	       providing financial support to the Early English Books
	       Online Text Creation Partnership. This Phase I text is
	       available for reuse, according to the terms of Creative
	       Commons 0 1.0 Universal. The text can be copied,
	       modified, distributed and performed, even for
	       commercial purposes, all without asking permission.

**Major revisions**

1. __2006-06__ __TCP__ *Assigned for keying and markup*
1. __2006-06__ __Apex CoVantage__ *Keyed and coded from ProQuest page images*
1. __2007-06__ __Ali Jakobson__ *Sampled and proofread*
1. __2007-06__ __Ali Jakobson__ *Text and markup reviewed and edited*
1. __2008-02__ __pfs__ *Batch review (QC) and XML conversion*

##Content Summary##

#####Front#####
A PASTORAL LETTER FROM The Lord Biſhop of MEAƲX. TO THE NEW CATHOLICKS OF HIS DIOCESS, Exhorting the
#####Body#####

1. A PASTORAL LETTER FROM The Lord Biſhop of MEAƲX TO THE NEW CATHOLICKS OF HIS DIOCESS.

#####Back#####

1. A Catalogue of Books Printed for Henry Hills, Printer to the King's moſt Excellent Majeſty, for his Houſhold and Chappel, 1686. And are to be Sold next door to his Houſe in Black-fryers, at Mr. Richard Cheeſe's.

**Types of content**

  * Oh, Mr. Jourdain, there is **prose** in there!

There are 32 **ommitted** fragments!
 @__reason__ (32) : illegible (14), duplicate (18)  •  @__resp__ (14) : #APEX (14)  •  @__extent__ (32) : 1 letter (10), 2 letters (2), 1 page (18), 1 word (1), 3 letters (1)

**Character listing**

|Text|string(s)|codepoint(s)|
|---|---|---|
|Latin-1 Supplement|éè|233 232|
|Latin Extended-A|ſ|383|
|Latin Extended-B|Ʋ|434|
|General Punctuation|•—†|8226 8212 8224|
|Geometric Shapes|▪◊|9642 9674|
|CJKSymbolsandPunctuation|〈〉|12296 12297|

##Tag Usage Summary##

###Header Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__author__|2||
|2.|__availability__|1||
|3.|__biblFull__|1||
|4.|__change__|5||
|5.|__date__|8| @__when__ (1) : 2008-09 (1)|
|6.|__edition__|1||
|7.|__editionStmt__|1||
|8.|__editorialDecl__|1||
|9.|__extent__|2||
|10.|__idno__|6| @__type__ (6) : DLPS (1), STC (2), EEBO-CITATION (1), OCLC (1), VID (1)|
|11.|__label__|5||
|12.|__langUsage__|1||
|13.|__language__|1| @__ident__ (1) : eng (1)|
|14.|__listPrefixDef__|1||
|15.|__note__|8||
|16.|__notesStmt__|2||
|17.|__p__|11||
|18.|__prefixDef__|2| @__ident__ (2) : tcp (1), char (1)  •  @__matchPattern__ (2) : ([0-9\-]+):([0-9IVX]+) (1), (.+) (1)  •  @__replacementPattern__ (2) : http://eebo.chadwyck.com/downloadtiff?vid=$1&page=$2 (1), https://raw.githubusercontent.com/textcreationpartnership/Texts/master/tcpchars.xml#$1 (1)|
|19.|__projectDesc__|1||
|20.|__pubPlace__|2||
|21.|__publicationStmt__|2||
|22.|__publisher__|2||
|23.|__ref__|2| @__target__ (2) : https://creativecommons.org/publicdomain/zero/1.0/ (1), http://www.textcreationpartnership.org/docs/. (1)|
|24.|__seriesStmt__|1||
|25.|__sourceDesc__|1||
|26.|__title__|5||
|27.|__titleStmt__|2||

###Text Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__argument__|1||
|2.|__closer__|1||
|3.|__dateline__|1||
|4.|__desc__|32||
|5.|__div__|3| @__type__ (3) : text (1), letter (1), publishers_advertisement (1)|
|6.|__g__|316| @__ref__ (316) : char:V (19), char:EOLhyphen (284), char:punc (12), char:EOLunhyphen (1)|
|7.|__gap__|32| @__reason__ (32) : illegible (14), duplicate (18)  •  @__resp__ (14) : #APEX (14)  •  @__extent__ (32) : 1 letter (10), 2 letters (2), 1 page (18), 1 word (1), 3 letters (1)|
|8.|__head__|2||
|9.|__hi__|441||
|10.|__item__|13||
|11.|__label__|13||
|12.|__list__|1||
|13.|__note__|72| @__place__ (72) : margin (72)|
|14.|__p__|43||
|15.|__pb__|60| @__facs__ (60) : tcp:62475:1 (1), tcp:62475:2 (2), tcp:62475:3 (2), tcp:62475:4 (2), tcp:62475:5 (2), tcp:62475:6 (2), tcp:62475:7 (2), tcp:62475:8 (2), tcp:62475:9 (2), tcp:62475:10 (2), tcp:62475:11 (2), tcp:62475:12 (2), tcp:62475:13 (2), tcp:62475:14 (2), tcp:62475:15 (2), tcp:62475:16 (2), tcp:62475:17 (2), tcp:62475:18 (2), tcp:62475:19 (2), tcp:62475:20 (2), tcp:62475:21 (2), tcp:62475:22 (2), tcp:62475:23 (2), tcp:62475:24 (2), tcp:62475:25 (2), tcp:62475:26 (2), tcp:62475:27 (2), tcp:62475:28 (2), tcp:62475:29 (2), tcp:62475:30 (2), tcp:62475:31 (1)  •  @__rendition__ (1) : simple:additions (1)  •  @__n__ (55) : 1 (1), 2 (1), 3 (1), 4 (1), 5 (1), 6 (1), 7 (1), 8 (1), 9 (1), 10 (1), 11 (1), 12 (1), 13 (1), 14 (1), 15 (1), 16 (1), 17 (1), 18 (1), 19 (1), 20 (1), 21 (1), 22 (2), 23 (2), 24 (3), 25 (3), 26 (2), 27 (2), 28 (2), 29 (2), 30 (2), 31 (2), 32 (2), 33 (2), 34 (2), 35 (2), 36 (2), 37 (2)|
|16.|__salute__|1||
|17.|__seg__|1| @__rend__ (1) : decorInit (1)|
|18.|__signed__|2||
|19.|__trailer__|1||


text:
![](docs/resource/img/logo-en.png)
---
[![license](https://img.shields.io/badge/license-mit-brightgreen.svg?style=flat)](https://github.com/Tencent/bk-base/blob/master/LICENSE.txt)
[![Release Version](https://img.shields.io/badge/release-3.2.19-brightgreen.svg)](https://github.com/Tencent/bk-base/releases)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/bk-base/pulls)

English | [简体中文](README.md)

> **Note**: The `master` branch may be in an *unstable or even broken state* during development.
Please use [releases](https://github.com/tencent/bk-base/releases) instead of the `master` branch in order to get stable binaries.

BK-BASE is a basic platform focusing on the field of operation and maintenance, creating a one-stop, low-threshold basic service. By simplifying the collection and acquisition of operation and maintenance data, improving the efficiency of data development, assisting operation and maintenance personnel in real-time operation and maintenance decision-making, and assisting the digital and intelligent transformation of enterprise operation systems.

## Overview
* [Design Philosophy](docs/overview/design_en.md)
* [Architecture Design](docs/overview/architecture_en.md)
* [Code Directory](docs/overview/code_framework_en.md)

## Features
* One-stop, Low-barrier Development
* Integrating Multiple Types of Data Sources
* Unified Diversified Data Query
* Full Link Data Tracing Management

## Getting Started
* [Download and Compile (In Chinese)](docs/install/source_compile.md)
* [Installation and Deployment (In Chinese)](docs/install/installation.md)

## Support
- [User Guide(in Prepare)](https://bk.tencent.com/docs)
- [BK forum](https://bk.tencent.com/s-mart/community)

## BlueKing Community

- [BK-CI](https://github.com/Tencent/bk-ci)：BlueKing Continuous Integration is a continuous integration and continuous delivery system that can easily present your R & D process to you.
- [BK-BCS](https://github.com/Tencent/bk-bcs): BlueKing Container Service is an orchestration platform for microservices based on container technology.
- [BK-CMDB](https://github.com/Tencent/bk-cmdb): BlueKing Configuration Management DataBase (BlueKing CMDB) is an enterprise level configuration management platform for assets and applications.
- [BK-PaaS](https://github.com/Tencent/bk-PaaS): BlueKing PaaS is an open development platform that allows developers to create, develop, deploy and manage SaaS applications quickly and easily.
- [BK-SOPS](https://github.com/Tencent/bk-sops): BlueKing Standard OPS (SOPS) is a light-weighted SaaS product in the Tencent BlueKing product system designed for the orchestration and execution of tasks through a graphical interface.

## Contributing

- Please read [Contributing](docs/overview/CONTRIBUTING_EN.md) for the branch management, issue and pr specifications of BK-BASE.
- [Tencent Open Source Incentive Program](https://opensource.tencent.com/en/contribution) encourages the participation and contribution of developers. We look forward to having you join it.

## License
BK-BASE is based on the MIT license. Please refer to [LICENCE](LICENSE.txt) for details.

repository: Tencent/bk-base

repo_name: Tencent/bk-base


text:
# **Book Shelves**

##### A project built with React
#
##### By [Sam Peppard](https://github.com/sampeppard)
#
![screenshot of project main page](img/demo-screenshot.JPG)

----
### **Description**

A basic React project which allows a user to search for a book and add to, move between or remove books from a series of three shelves. The shelves are "Currently Reading", "Want To Read" and "Read" respectively.

This is project created for Udacity's React Fundamentals Nanodegree course. This App is collecting and showing books that you want to read, are currently reading or have alread read. Also it provides a search functionality which allows to search books from a BooksAPI book library.

This project were created based on provided starter template.

----
### **Specifications**
| _Behavior_ | _Input_ | _Output_ |
|:---------------------------------------------------------------------:|:---------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------:|
| Find a book | Enter Keywords: Artificial Intelligence | Result: Books with "Artificial Intelligence" in title |
| Add a book to shelves | Select Shelf: "Currently Reading" | Result: Book now on "Currently Reading" shelf |
| Move book between shelves | Select Shelf: "Read" | Result: Book is now on "Read" shelf |

----
### **Setup/Installation Requirements**

If editing or running locally:

##### 1. First, make sure the following is installed on your machine

##### 2. make sure you have npm installed - check link below for installation

https://nodejs.org/en/download/

###### then

#### Clone this repository: https://github.com/sampeppard/book-shelves.git

```git clone https://github.com/sampeppard/book-shelves.git```

#### OPEN project folder ('book-shelves') in Code Editor of choice

* Run following commands from command line
* ```npm install``` or ```yarn install```
* ```npm start``` or ```yarn start``` to start the project on a development server

----

### **Known Bugs**

No known bugs.

----
### **Support and contact details**

For comments or questions, please email<EMAIL_ADDRESS>
----
### **Technologies Used**

* HTML
* JavaScript
* Webpack.js
* React
* Babel
* yarn
* npm

----
### **License**

MIT

repository: sampeppard/book-shelves

repo_name: sampeppard/book-shelves