text:
---
title: Filter out premium Medium articles
description: Using a console script to alter the content on a webpage
pubDate: 2019-04-08T12:00-0400
tags:
  - Console Scripting
  - Dev Tools
  - JavaScript
---

Medium has received a lot of flack recently for their push to monetize the platform. And while I don't fault them for moving some of their best articles behind a pay wall, I have no interest in subscribing to their platform.

There is still a lot of high-quality free content on Medium, but you have to navigate around all of the premium content that the platform is pushing.

I wanted to write a console script that would do that filtering work for me.

## Reach for the stars

On Medium, premium articles can be identified on the homepage by their ★ icon. Using the inspector, you can see that the star is an `svg` element nested in a `span` with the class `svgIcon--star`. Bingo!

Now, using the handy `querySelectorAll`-esque selector `$$`, we can find all the stars on the page. Our console script starts out like this:

```js
$$('span.svgIcon--star')
```

Now that we've selected all stars, we need to iterate over them. Since we need to do something for every item in our iterable, we'll use `forEach`:

```js
$$('span.svgIcon--star').forEach(star => {
  // Hide parent element
})
```

Now that we're iterating over the stars, we need to find and hide the appropriate parent element. To do this, we'll use a neat `Element` method called `closest`.

## Finding a parent with `closest`

You may be familiar with the `querySelector` method, which starts with a given element and then searches down the DOM tree and returns the first match.

`closest` works the same way, but in reverse. It starts with an element, then travels **up** the DOM tree. This makes it the perfect method for starting with an element and looking for a specific parent.

Using the inspector again, we can see that articles outside the featured section are `div`s with the class `streamItem`. Using `closest`, we'll grab those elements:

<!-- ```js/1 -->
```js
$$('span.svgIcon--star').forEach(star => {
  star.closest('.streamItem') // Hide element
})
```

I had never used the `closest` method before and was glad to find it. As always, [I read up about it on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) before using it.

We've selected the correct parent element; now we need to hide it.

## Hiding an element

Removing an element in JavaScript is more difficult than it should be. There is no `remove` method on the global `Element`. Instead, you need to jump up to the parent element and then use `removeChild`. The normal strategy looks like this:

```js
const element = document.querySelector('.remove-me')

element.parentElement.removeChild(element)
```

I think this pattern is annoying and try to avoid it whenever possible. But we could use it in our instance by first creating a variable to reference the element to be removed:

```js
// Option 1 - Remove element
$$('span.svgIcon--star').forEach(star => {
  const article = star.closest('.streamItem')
  article.parentElement.removeChild(article)
})
```

This is your best option if you need to remove the element from the DOM.

My preferred method leaves the element in the DOM and applies CSS styles to hide it from view. We'll set the article element's `display` style to `'none'`:

<!-- ```js/2 -->
```js
// Option 2 - Hide element
$$('span.svgIcon--star').forEach(star => {
  star.closest('.streamItem').style.display = 'none'
})
```

Unless you **need** to remove and element from the DOM, the simpler solution is to just hide the element.

## Save for later

Chrome has a handy feature in the "Sources" tab called snippets. Here you can save bits of code for use later.

I created a snippet title "Medium" and saved the above code. Now when I want to filter out premium articles, I just need to run that snippet with command + enter.

## Read on

Now the next time I want to find an article to read on Medium, I can run the snippet and filter out premium articles.

For a more reusable solution, we could turn this snippet into a browser extension, but that's the topic of another article.

gha_language: Astro


text:
Ti=Privacy

EU "Model Clauses" - in five languages=[Wx/eu/europa/eur-lex/Privacy/ModelClauses/]

French - CNIL Recommendations=[Wx/fr/cnil/Guides_practiques/CNIL-Guide_Avocats/Sec/]

Simple form of Privacy Policy=[Wx/com/moynihanpartners/PrivacyPolicy/Form/]

Seattle Municipal Privacy Principles=[Wx/gov/seattle/murray/privacy/Form/]

Automattic Privacy Policy: =[G/Automattic-PrivacyPolicy-CmA/]

ICAAN Privacy Policy (2012): =[G/ICAAN-ModelPrivacyPolicy-EN-CmA/]

OpenGov.org privacy policy: =[G/OpenGovFoundation-CmA/PrivacyPolicy/0.md]

EU GDPR Law and Sketch of Privacy Policy: =[G/EU-GDPR-Law-CmA/]

license: MIT

repository: Sjord/Cmacc-Org

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: Sjord/Cmacc-Org


text:
This is a Haxe port of the libGDX Texture Packer, which packs image assets into
texture atlases for efficient rendering. libGDX is released under the Apache 2
license; see it on [GitHub](https://github.com/libgdx/libgdx) for more
information and a full list of contributors. hxpk is a full port and includes
all features of the original, including whitespace removal, alpha bleed
correction, and more. You can read more about the original on the [libGDX GitHub
wiki](https://github.com/libgdx/libgdx/wiki/Texture-packer).

[Note: the following section isn't fully implemented yet!]

hxpk can also be used to create textures from in-memory BitmapDatas at runtime.
In other words, you can generate images after a program has started (for
example, using the svg library to rasterize an SVG at an appropriate resolution
for the current device) and then create a texture atlas from those images.

hxpk currently requires OpenFL and uses BitmapData for image processing.

Using hxpk
----------

You can run hxpk with:

    haxelib run hxpk

If no other arguments are supplied, usage instructions will be displayed.

Settings
--------

When run from the command line, if the input directory contains subdirectories,
hxpk will recursively parse all of those as well. Each subdirectory will be
packed onto the same set of pages.

Each directory can have a pack.json file in it, which is a JSON file containing
packing settings. pack.json files that are deeper in the path will take
precedence, and if none are found, the defaults will be used.

Check the [libGDX GitHub
wiki](https://github.com/libgdx/libgdx/wiki/Texture-packer) for a full
description of what can go in a settings file.

Building
--------

If you downloaded hxpk from source, you'll have to first build the command line
tool. To do so, simply navigate to the hxpk directory and run

    haxe build.hxml

repository: bradparks/hxpk

repo_name: bradparks/hxpk


text:
# Management / Boosters

## Get all boosters

```shell
curl "https://phrenzi.com/api/management/boosters" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -d '{
    "start": "2018-03-01",
    "end": "2018-03-28"
    }'

```

> The above command returns array of `Booster` objects:

```json
{
  "boosters": [
    {
      "id": "4a4bd792-d962-4304-bafd-4faccfd5be89",
      "title": "Dummy Title",
      "date": "2018-04-01",
      "start_time": 56686,
      "finished_by": "end_time",
      "end_time": 56888,
      "point": 100,
      "status": "scheduled",
      "booster_type": "task",
      "task_desc": null,
      "redeem_count": 0
    },
    {
      "id": "a9bd28d9-a7a2-44e4-8752-88a154783f1f",
      "title": "Dummy Title",
      "date": "2018-04-03",
      "start_time": 39600,
      "end_time": 72000,
      "host_point": 100,
      "invitee_point": 100,
      "unlimited": true,
      "status": "scheduled",
      "booster_type": "invitation",
      "number_of_invitation_sent": 0,
      "number_of_invitation_redeemed": 0,
      "number_of_invitation_not_redeemed": 0,
      "number_of_host": 0,
      "number_of_invitee": 0
    }
  ]
}
```

This endpoint authenticated by `Access Token`, and Staff-ID Request Header, staff should be manager staff, and retrieves all boosters within range.

### HTTP Request

`GET http://phrenzi.com/api/management/boosters`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

This API support pagination. please refer to Link Response Header section

### Query Parameters

Parameter | Required | Description
--------- | ----------- | ----------
start | Y | start range of query, format: 'YYYY-MM-DD'
end | Y | end range of query, format: 'YYYY-MM-DD'
page | N | the page results of all transactions
per_page | N | the number of transaction record return per page by api, default to be 20

## Get booster

```shell
curl "https://phrenzi.com/api/management/boosters/0cb43edf-4623-4086-99a0-50554af32baa" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
```

> The above command returns `Booster` objects:

```json
{
  "booster": {
    "id": "0cb43edf-4623-4086-99a0-50554af32baa",
    "title": "Dummy Title",
    "date": "2018-03-30",
    "start_time": 39600,
    "finished_by": "end_time",
    "end_time": 72000,
    "point": 100,
    "status": "actived",
    "booster_type": "check_in",
    "redeem_count": 0
  }
}

```

This endpoint authenticated by `Access Token`, and Staff-ID Request Header, staff should be manager staff, and retrieves booster with stats

### HTTP Request

`GET http://phrenzi.com/api/management/boosters/:booster_id`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

### Response Parameters

For CheckIn Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'check_in'
start_time | start time of booster
end_time | if finished_by is 'end_time', would be present here. End time of booster
finished_by | either 'end_time' or 'quantity'
quantity | if finished_by is 'quantity', would be present here. The maximum time for redemption.
title | Title of booster
point | redemption point
redeem_count | number of redemption so far

For Task Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'task'
start_time | start time of booster
end_time | if finished_by is 'end_time', would be present here. End time of booster
finished_by | either 'end_time' or 'quantity'
quantity | if finished_by is 'quantity', would be present here. The maximum time for redemption.
title | Title of booster
point | redemption point
redeem_count | number of redemption so far

For Invitation Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'invitation'
start_time | start time of booster
end_time | end time of booster
host_point | redemption point as a host
invitee_point | redemption point as a invitee
unlimited | either true or false
title | Title of booster
invitation_limit | if unlimited is false, would be present here. Maximum of Invitaiton host can sent
number_of_invitation_sent | number of invitation sent out
number_of_invitation_redeemed | number of invitation that have been redeemed
number_of_invitation_not_redeemed | number of invitation that have not been redeemed
number_of_host | number of host
number_of_invitee | number of invitee

For Tiered Check In Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'tiered_check_in'
finished_by | 'end_time' or 'quantity'
start_time | start time of booster
end_time | if finished_by is end_time, specify end time of booster
quantity | if finished_by is quantity, specify quantity here
point | redemption point as for check-in
enable_invitation | enable or not invitation feature
host_point | redemption point as a host
invitee_point | redemption point as a invitee
unlimited | either true or false
title | Title of booster
invitation_limit | if unlimited is false, would be present here. Maximum of Invitaiton host can sent
number_of_invitation_sent | number of invitation sent out
number_of_invitation_redeemed | number of invitation that have been redeemed
number_of_invitation_not_redeemed | number of invitation that have not been redeemed
number_of_host | number of host
number_of_invitee | number of invitee

For Target Amount Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'target_amount'
start_time | start time of booster
end_time | End time of booster
point | redemption point
target_amount | target_amount that patron purchase to redeem the point
title | Title of booster
redeem_count | number of redemption so far
number_of_redeemed_player | number of redeemed player so far

For Credit Booster

Parameter | Description
--------- | ----------- | ----------
date | date of booster
booster_type | should be 'credit'
start_time | start time of booster
end_time | End time of booster
cash_back | cash back percentage, for instance 3.5% cash back, value is 3.5
title | Title of booster
redeem_count | number of redeemed so far

## Create Boosters

```shell
curl "https://phrenzi.com/api/management/booster" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -X POST \
  -d '{
    "booster_type": "check_in",
    "date": "2018-03-01",
    "start_time": 39600,
    "finished_by": "end_time",
    "end_time": 79200,
    "point": 100,
    "title": "CheckIn and Play"
    }'
```

> if okay, return status coce 200 and `Booster` objects:

``` json
{
  "booster": {
    "id": "0d028b17-e0c7-47ee-a951-3884b39e0603",
    "title": "CheckIn and Play",
    "date": "2018-04-01",
    "start_time": 46800,
    "finished_by": "end_time",
    "end_time": 54000,
    "point": 100,
    "status": "scheduled",
    "booster_type": "check_in",
    "redeem_count": 0
  }
}
```

> if invalid, return status coce 422 and object:

``` json
{
  "errors": [
    "Date can't be blank"
  ]
}
```

This endpoint authenticated by `Access Token` ( using Staff-ID Request Header, staff should be manager staff ) and create Booster

### HTTP Request

`POST http://phrenzi.com/api/management/boosters`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

### Query Parameters

For CheckIn Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'check_in'
start_time | Y | start time of booster, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required. end_time of booster, it's second to the begining of the day
finished_by | Y | either 'end_time' or 'quantity'
quantity | N | if finished_by is 'quantity', required. the maximum time for redemption.
title | Y | Title of booster
point | Y | redemption point

For Task Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'task'
start_time | Y | start time of booster, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required. end_time of booster, it's second to the begining of the day
finished_by | Y | either 'end_time' or 'quantity'
quantity | N | if finished_by is 'quantity', required. the maximum time for redemption.
title | Y | Title of booster
point | Y | redemption point

For Invitation Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'invitation'
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
host_point | Y | redemption point as a host
invitee_point | Y | redemption point as a invitee
unlimited | Y | either true or false
title | Y | Title of booster
invitation_limit | N | if unlimited is false, then required. maximum of Invitaiton host can sent

For Tiered Check In Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'tiered_check_in'
finished_by | Y | should be 'end_time' or 'quantity'
start_time | Y | start time of booster template, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required, specify end_time of booster template, it's second to the begining of the day
quantity | N | if finished_by is 'quantity', required, quantity of booster that can redeemed
point | Y | check-in point
enable_invitation | Y | true or false
host_point | N | if enable_invitation, required, redemption point as a host
invitee_point | N | if enable_invitation, required, redemption point as a invitee
unlimited | N | if enable_invitation, required, either true or false
title | Y | Title of booster template
invitation_limit | N | if unlimited is false, then required. maximum of Invitaiton host can sent

For Target Amount Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'target_amount'
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
point | Y | redemption point
target_amount | Y | target_amount that patron purchase to redeem the point
title | Y | Title of booster

For Credit Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
booster_type | Y | should be 'credit'
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
cash_back | Y | cash_back of sales
title | Y | Title of booster

## Create Booster From Booster Template

```shell
curl "https://phrenzi.com/api/management/boosters/from_booster_template" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -X POST \
  -d '{
    "id": "4e92881c-6aa8-47c7-afb2-00bddb909c32",
    "date": "2018-03-01"
    }'
```

> if okay, return status coce 200 and `Booster` objects:

``` json
{
  "booster": {
    "id": "0d028b17-e0c7-47ee-a951-3884b39e0603",
    "title": "CheckIn and Play",
    "date": "2018-03-01",
    "start_time": 46800,
    "finished_by": "end_time",
    "end_time": 54000,
    "point": 100,
    "status": "scheduled",
    "booster_type": "check_in",
    "redeem_count": 0
  }
}
```

> if invalid, return status coce 422 and object:

``` json
{
  "errors": [
    "Date can't be blank"
  ]
}
```

This endpoint authenticated by `Access Token` ( using Staff-ID Request Header, staff should be manager staff ) and create Booster from existing booster_template id

### HTTP Request

`POST http://phrenzi.com/api/management/boosters/from_booster_template`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

### Query Parameters

Parameter | Required | Description
--------- | ----------- | ----------
id | Y | booster template's id
date | Y | booster scheduled date

## Update Booster

```shell
curl "https://phrenzi.com/api/management/boosters/a635683c-87d3-4531-a5b5-f58d44d053b8" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -X PATCH \
  -d '{
    "date": "2018-03-01",
    "start_time": 39600,
    "finished_by": "end_time",
    "end_time": 79200,
    "point": 100,
    "title": "CheckIn and Play"
    }'
```

> if okay, return status code 200 and returns `Booster` object:

```json
{
  "booster": {
    "id": "a635683c-87d3-4531-a5b5-f58d44d053b8",
    "title": "CheckIn and Play",
    "date": "2018-04-01",
    "start_time": 39600,
    "finished_by": "end_time",
    "end_time": 79200,
    "point": 100,
    "status": "scheduled",
    "booster_type": "check_in",
    "redeem_count": 0
  }
}
```

> if invalid, return status coce 422 and object:

``` json
{
  "errors": [
    "Date can't be blank"
  ]
}
```

This endpoint authenticated by `Access Token` ( using Staff-ID Request Header, staff should be manager staff ) and update Booster

### HTTP Request

`PATCH http://phrenzi.com/api/management/boosters/:booster_id`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

### Query Parameters
For CheckIn Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
start_time | Y | start time of booster, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required. end_time of booster, it's second to the begining of the day
finished_by | Y | either 'end_time' or 'quantity'
quantity | N | if finished_by is 'quantity', required. the maximum time for redemption.
title | Y | Title of booster
point | Y | redemption point

For Task Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
start_time | Y | start time of booster, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required. end_time of booster, it's second to the begining of the day
finished_by | Y | either 'end_time' or 'quantity'
quantity | N | if finished_by is 'quantity', required. the maximum time for redemption.
title | Y | Title of booster
point | Y | redemption point

For Invitation Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
host_point | Y | redemption point as a host
invitee_point | Y | redemption point as a invitee
unlimited | Y | either true or false
title | Y | Title of booster
invitation_limit | N | if unlimited is false, then required. maximum of Invitaiton host can sent

For Tiered Check In Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
finished_by | Y | should be 'end_time' or 'quantity'
start_time | Y | start time of booster template, it's second to the begining of the day
end_time | N | if finished_by is 'end_time', required, specify end_time of booster template, it's second to the begining of the day
quantity | N | if finished_by is 'quantity', required, quantity of booster that can redeemed
point | Y | check-in point
enable_invitation | Y | true or false
host_point | N | if enable_invitation, required, redemption point as a host
invitee_point | N | if enable_invitation, required, redemption point as a invitee
unlimited | N | if enable_invitation, required, either true or false
title | Y | Title of booster template
invitation_limit | N | if unlimited is false, then required. maximum of Invitaiton host can sent

For Target Amount Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
point | Y | redemption point
target_amount | Y | target_amount that patron purchase to redeem the point
title | Y | Title of booster

For Credit Booster

Parameter | Required | Description
--------- | ----------- | ----------
date | Y | date of booster
start_time | Y | start time of booster, it's second to the begining of the day
end_time | Y | end_time of booster, it's second to the begining of the day
cash_back | Y | cash bach of sales
title | Y | Title of booster

*NOTED:*

* If booster status is 'actived', nothing can be updated
* booster_type can not been changed

## Delete Booster

```shell
curl "https://phrenzi.com/api/management/booster/a635683c-87d3-4531-a5b5-f58d44d053b8" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -X DELETE
```

> If success, return 200 status code with empty response.

> If failed, return 406 status code with error message:

```
{
  "errors": [
    "can not delete booster that is already been actived"
  ]
}
```

This endpoint authenticated by `Access Token` ( using Staff-ID Request Header, staff should be manager staff ) and delete Booster

### HTTP Request

`DELETE http://phrenzi.com/api/management/boosters/:booster_id`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

## Stop Booster

```shell
curl "https://phrenzi.com/api/management/boosters/a635683c-87d3-4531-a5b5-f58d44d053b8/stop" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token" \
  -H "X-Staff-Id: 828055eb-a94d-4f71-aa90-110d5b747468" \
  -X PATCH
```

> If success, return 200 status code with empty response.

> If failed, return 406 status code with error message:

```
{
  "errors": [
    "can not stop booster that is not active"
  ]
}
```

This endpoint authenticated by `Access Token` ( using Staff-ID Request Header, staff should be manager staff ) and stop Booster

### HTTP Request

`PATCH http://phrenzi.com/api/management/boosters/:booster_id/stop`

This API require Staff-Id Request Header. please refer to Staff-Id Request Header section

repository: Phrenzi/slate

repo_name: Phrenzi/slate


text:
---
metaTitle: "Bash - File Transfer using scp"
description: "scp transferring file, scp transferring multiple files, Downloading file using scp"
---

# File Transfer using scp

## scp transferring file

To transfer a file securely to another machine - type:

```bash
scp file1.txt tom@server2:$HOME

```

This example presents transferring `file1.txt` from our host to `server2`'s user `tom`'s home directory.

## scp transferring multiple files

`scp` can also be used to transfer multiple files from one server to another. Below is example of transferring all files from `my_folder` directory with extension `.txt` to `server2`. In Below example all files will be transferred to user `tom` home directory.

```bash
scp /my_folder/*.txt tom@server2:$HOME

```

## Downloading file using scp

To download a file from remote server to the local machine - type:

```bash
scp tom@server2:$HOME/file.txt /local/machine/path/

```

This example shows how to download the file named `file.txt` from user `tom`'s home directory to our local machine's current directory.

#### Syntax

- scp /some/local/directory/file_name user_name@host_name:destination_file_path
- scp user_name@host_name:origin_file_path /some/local/directory

repository: haifenghuang/generate

repo_name: haifenghuang/generate


text:
![VisualRecognition](README_Images/VisualRecognition.png)

## Visual Recognition
Bluemix Mobile Starter for Visual Recognition in Java

[![](https://img.shields.io/badge/bluemix-powered-blue.svg)](https://bluemix.net)
[![](https://img.shields.io/badge/platform-android-lightgrey.svg?style=flat)](https://developer.android.com/index.html)

### Table of Contents
* [Summary](#summary)
* [Requirements](#requirements)
* [Configuration](#configuration)
* [Run](#run)
* [License](#license)

### Summary
The Bluemix Mobile Starter for Watson Visual Recognition showcases the Visual Recognition service from Watson and gives you integration points for each of the Bluemix Mobile services.

### Requirements
* A [Bluemix](http://bluemix.net) Account
* [Android Studio](https://developer.android.com/studio/index.html) and [Gradle](https://gradle.org/gradle-download/)
* A [Bluemix Account](https://www.bluemix.net/)

### Configuration
* Open the project in Android Studio and perform a Gradle Sync.
* Your unique Visual Recognition Api Key has been injected into your application so no further config is needed.

### Run
* You can now build and run the application from Android Studio!

![VisualRecognitionAndroid](README_Images/VisualRecognitionAndroid.png) ![VisualRecognitionAndroidClicked](README_Images/VisualRecognitionAndroidClicked.png)

The application allows you to perform Visual Recognition on user-selected images. You can take a photo from the application or select a photo from your gallery to start the Visual Recognition process. Tap the Tags to see the certainty score for the image.

> **Note:** If you have probelems getting the camera to work properly, make sure you have accepted appropriate permissions and are using the most up to date version of Google Play Services. You will need to re-create an emulator to pick up updates after downloading.

### License
This package contains code licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 and may also view the License in the LICENSE file within this package.

repository: kbrkkn/Uygulama-Android

repo_name: kbrkkn/Uygulama-Android


text:
The so-called "extended APIs" by [Shlomi Fish](http://www.shlomifish.org/)
for Website Meta Language:

- http://www.shlomifish.org/open-source/projects/website-meta-language/

Contains one library used by Shlomi Fish’s homepage.

To install, do cd xhtml/1.x; bash Install.bash

repository: thewml/wml-extended-apis

repo_name: thewml/wml-extended-apis


text:
[![CircleCI](https://circleci.com/gh/tetratelabs/getenvoy.svg?style=svg&circle-token=323ca83723d7e1ed662772385cfdeed5f704c370)](https://circleci.com/gh/tetratelabs/getenvoy)
[![Build](https://github.com/tetratelabs/getenvoy/workflows/build/badge.svg)](https://github.com/tetratelabs/getenvoy)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)

# GetEnvoy

**GetEnvoy is spread across multiple repos. For more details head over to [GetEnvoy.io](https://getenvoy.io/github).**

The GetEnvoy project is a collection of tooling focused on building, distributing, deploying and maintaining a fleet of Envoys.

repository: awesomegolang/getenvoy

repo_name: awesomegolang/getenvoy


text:
# Sitemap

## Community
* [Conferences](./community/conferences.md) - Information about past Vue conferences
* [Meetups](./community/meetups.md) - Where to find meetups, tips on how to organise a local meetup
* [Media](./community/social-media.md) - Popular Vue communities such as chats, forums and social platforms
* [Diversity](./community/diversity.md) - Diversity and inclusion in Vue.js
* [Job Market](./community/job-market.md) - How to find job with Vue.js and related topics
* [Adopting Vue at work](./community/adopt-vue-at-work.md) - How to pitch Vue at your workplace

## Learning
* [Official Documentation](./learning/official-documentation.md) - All the official Vue docs, listed on one place
* [How to learn Vue](./learning/how-to-learn-vue.md) - Tips on how to learn Vue if coming from other technologies
* [Vue 3](./community/vue-3.md) - Vue 3 learning resources and plugins
* [Learning platforms](./learning/learning-platforms.md) - Learning platforms that also offer Vue.js video courses
* [Video Courses](./learning/courses.md) - Popular Vue video courses
* [Books](./learning/books.md) - Books about Vue development
* [Blogs](./learning/blogs.md) - Popular Vue related blogs.
* [Podcasts](./learning/podcasts.md) - Vue podcasts or single episodes talking about Vue
* [Frequently Asked Questions](./learning/faq.md) - Answers to most common questions asked by Vue developers
* [Tips from Mentors](./learning/tips-from-mentors.md) - How Vue experts began with Vue, tips on how to learn
* [Workshops](./learning/workshops.md) - What are Vue workshops and where to find them

## Ecosystem
* [Editors and Tools](./ecosystem/editors-and-tools.md) - List of popular code editors and setups for Vue development
* [UI Libraries](./ecosystem/ui-libraries.md) - Pros and Cons of the most popular Vue UI libraries
* [Handling Forms](./ecosystem/forms.md) - Libraries for handling forms with Vue
* [Boilerplates](./ecosystem/boilerplates.md) - Vue boilerplates
* [Client-Server Communication](./ecosystem/client-server-communication.md) - How to use Vue with REST, GraphQL or websockets
* [Documentation platforms](./ecosystem/documentation.md) - Generating and maintaining documentation for Vue projects
* [Hosting](./ecosystem/hosting.md) - Where to host your Vue apps
* [i18n](./ecosystem/i18n.md) - Internationalization (i18n) for Vue
* [Mobile Apps](./ecosystem/mobile-apps.md) - PWA, native and hybrid mobile applications
* [Desktop Apps](./ecosystem/desktop-apps.md) - Building Desktop Apps with Vue
* [Nuxt](./ecosystem/nuxt.md) - Overview of Nuxt.js and its ecosystem
* [Server Side Rendering](./ecosystem/server-side-rendering.md) - Available tools for SSR
* [Static Site Generators](./ecosystem/static-site-generators.md) - Technologies to create static sites like landing pages or blogs
* [Build Tools](./ecosystem/build-tools.md) - Build tools used across Vue ecosystem
* [Projects worth mentioning](./ecosystem/projects-worth-mentioning.md) - Important Vue projects that don't fit in other categories.
* [Legacy Packages](./ecosystem/legacy.md) - Outdated or deprecated Vue packages and features
* [Contributing](./ecosystem/contributing.md) - Notes on contributing to the ecosystem

repository: dobromir-hristov/vuecommunity

repo_name: dobromir-hristov/vuecommunity


text:
{#include readme-header /}

Also for picocli applications the dev mode is supported. When running dev mode, the picocli application is executed and on press of the Enter key, is restarted.

As picocli applications will often require arguments to be passed on the commandline, this is also possible in dev mode via:
```shell script
{buildtool.cli} {buildtool.cmd.dev} {#if buildtool.cli == 'gradle'}--quarkus-args{#else}-Dquarkus.args={/if}='help'
```

repository: nebrass/quarkus

branch_name: refs/heads/main

repo_name: nebrass/quarkus


text:
##About Tabminder
Tabminder is a simple Chrome extension designed to make me more mindful of browsing distracting sites.
I use [StayFocusd](https://chrome.google.com/webstore/detail/laankejkbhbdhmipfmgcngdelahlfoji) to manage
the total time I waste online, but I wanted a tool to remind to spend my daily quotas wisely and help prevent
distracted browsing from going too far in the first place. Tabminder prevents quick visits to Reddit, Twitter,
and Hacker News from turning into work-sucking time vortexes by providing a gentle reminder every few minutes.
Open a distracting tab, and Tabminder starts counting down from your preset time limit. When time's up, it will
prompt you to close the tab or restart the timer. This is just annoying enough to intercept distracted browsing,
but not so strict that it prevents you from taking a break once in a while. (You deserve it, right?)

##How to use Tabminder
Tabminder is my first Chrome extension, so there will be bugs. If you're lucky enough to find one, please
[report it](https://github.com/ecmendenhall/Tabminder/issues) and I'll try to fix it.

To download the current version of Tabminder, visit the project repository [on GitHub](https://github.com/ecmendenhall/Tabminder).
For more information on how to configure the extension, please see its [project page](http://ecmendenhall.github.com/Tabminder/).

##License
This code is released under an MIT license. For all the details, see the included file 'LICENSE.md'.
The Tabminder extension uses styles from [Twitter Bootstrap](http://twitter.github.com/bootstrap/)
and icons from [Glyphicons](http://glyphicons.com/).

repository: ecmendenhall/Tabminder

repo_name: ecmendenhall/Tabminder


text:
Code samples for talk on debugging node.js applications given at the Node.js in the wild meetup on Apr 17, 2013.

Slides available at [http://life.neophi.com/danielr/files/DebuggingNodejsApplications.pdf](http://life.neophi.com/danielr/files/DebuggingNodejsApplications.pdf)

To run the sample code:

    git clone https://github.com/NeoPhi/debugging.git
    cd debugging
    npm install
    # see src/* for per file instructions

Copyright (c) 2013 Daniel Rinehart. This software is licensed under the MIT License.

repository: NeoPhi/debugging

repo_name: NeoPhi/debugging


text:
# check-file-age

## Description

Monitor file age and size for script monitoring.

## Synopsis
```
check-file-age -w 240 -W 10 -c 600 -C 0 -f /path/to/filename
```

## Installation

First, build this program.

```
go get github.com/mackerelio/go-check-plugins
cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-file-age
go install
```

Or you can use this program by installing the official Mackerel package. See [Using the official check plugin pack for check monitoring - Mackerel Docs](https://mackerel.io/docs/entry/howto/mackerel-check-plugins).

Next, you can execute this program :-)

```
check-file-age -w 240 -W 10 -c 600 -C 0 -f /path/to/filename
```

## Setting for mackerel-agent

If there are no problems in the execution result, add a setting in mackerel-agent.conf .

```
[plugin.checks.fileage-sample]
command = ["check-file-age", "-w", "240", "-W", "10", "-c", "600", "-C", "0", "-f", "/path/to/filename"]
```

## Usage
### Options

```
  -f, --file=           monitor file name
  -w, --warning-age=    warning if more old than (default: 240)
  -W, --warning-size=   warning if file size less than
  -c, --critical-age=   critical if more old than (default: 600)
  -C, --critical-size=  critical if file size less than (default: 0)
  -i, --ignore-missing  skip alert if file doesn't exist
```

## For more information

Please execute `check-file-age -h` and you can get command line options.

## Other

- inspired by [check_file_age.pl](https://github.com/nagios-plugins/nagios-plugins/blob/master/plugins-scripts/check_file_age.pl)

repository: mackerelio/go-check-plugins

gha_language: Go

repo_name: mackerelio/go-check-plugins


text:
# Golang: Introduction to Race Conditions for the Web Engineer

Go provides a first-class primitive for concurrenncy called a Goroutine. Goroutines allow end users to easily spawn concurrent tasks and synchronize those tasks. Since Goroutines are so foundational to the language most non-trivial programs end up exposing the engineer to concurrent programming.  While go does provide some tools for preventing [race conditions](https://en.wikipedia.org/wiki/Race_condition#Data_race), it is still ultimately up to the end user to verify that their program is safe for concurrent execution ([thread-safe](https://en.wikipedia.org/wiki/Thread_safety)).  This post explains what concurrency is in the context of web programming, what data races are, why they are tricky to detect, and how they can be detected using go's `-race` detector.  At the end of it the reader should understand how to define a data race, how to write a test to exercise a concurrent function and how to analyze the test using the `-race` detector!

## Concurrent Web Service

A concurrent web service (in this case webserver) is able to service a number of client connections at the same time.  For the purposes of this article we are talking about concurrency with regard to the clients.
Go's concurrency model coupled with its built in HTTP frameworks make very compelling for cost effective, performant web services.  This makes it popular with traditional web language communities (ruby, python, php) and creates an environment where many experienced web engineers are thrown into concurrent programming environment, resulting in race conditions and bugs.

In order to illustrate concurrency, consider a web server that is not concurrent.  It accepts a single request processes it until finished and then waits for another request.  If a client makes a request while a current request is in flight they are either dropped or queued.  This is a synchronous system with respect to the clients, meaning it can onnly process a single request at a time:

Traditional web environments act just like this, but instead of running a single script they start multiple single scripts!  In [Apache](https://httpd.apache.org/docs/2.4/mod/prefork.html) and other environments (unicorn, [uwsgi](https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#adding-concurrency-and-monitoring)) this means specifying a number of processes to start (the concurrency level) and then each one of those is able to handle connections as they come in (worker pool).  While this model is easy to reason about an insulates engineers from the complexities of concurrency it does mean that concurrent connections scale linearly with respect to hardware resources (ie processes):

The image above shows a synchronous service with multiple instances enabling concurrency with respect to clients. One thing that is interesting here is that if the concurrency level is greater than the total number of instances the service becomes saturated (it has reached capacitity because it has more requests than servers able to handle those requests) at which point connections either queue or are dropped.

What we didn't discuss here are asynchronous runtimes like node.js that support multiple concurrent requests but can guarantee that only a single statement executes at any moment removing the possibility of data-races.  In this case concurrency is handled in the runtime instead of from the webserver orchestrating processes.

## Concurrency In Go

In go, concurrency is achieved through [Goroutines](https://gobyexample.com/goroutines). Goroutines are just normal functions executed concurrently by using the `go` statement!

## Go HTTP concurrency

The builtin [go HTTP](https://golang.org/pkg/net/http/) server [invokes each incoming HTTP request using a Goroutine](https://eli.thegreenplace.net/2019/on-concurrency-in-go-http-servers/#appendix-where-net-http-goes-concurrent).  Concurrency with respect to the client connection is the default which means all HTTP code is concurrent and needs to be safe.

## In practice

What this means in practice is close attention needs to be paid whenever shared memory is accessed inside of an http handler (ie goroutine). In order to remove boilerplate and focus on identifying the data race the test below is executing `go func()` directly instead of going through HTTP handlers.  Since HTTP handlers are executed inside of `go` statements this should be equivalent:

```
package main

import (
        "fmt"
        "testing"
)

func Test_RaceCondition(t *testing.T){

        m := make(map[string]string)

        for i := 0; i < 5; i++ {
                go func() {
                        kv := fmt.Sprintf("hi_%d", i)
                        m[kv] = kv
                }()
        }
}
```

### Undefined Behavior
One of the challenges of race conditions are that they result in undefined behavior.  The code below executes the race condition test listed above using 5 goroutines, and it "passes":

```
for i := 0; i < 5; i++ {
```

```
$ go test -run Test_RaceCondition
PASS
ok      github.com/dm03514/test 0.019s
```

This test execution randomly got lucky, for whatever reason there were no interleaving of writes `m[kv] = kv`.  Even though it says `PASS` there is still a race condition.

Increasing the concurrency to 50 and re-running the test reliably triggers the race condition:

```
$ go test -run Test_RaceCondition
fatal error: concurrent map writes
fatal error: concurrent map writes

goroutine 20 [running]:
runtime.throw(0x113bf62, 0x15)
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/panic.go:617 +0x72 fp=0xc00003df00 sp=0xc00003ded0 pc=0x102aa32
runtime.mapassign_faststr(0x11112c0, 0xc0000962a0, 0xc0000f0010, 0x4, 0x1)
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/map_faststr.go:291 +0x40f fp=0xc00003df68 sp=0xc00003df00 pc=0x101138f
github.com/dm03514/test.Test_RaceCondition.func1(0xc0000a0088, 0xc0000962a0)
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:15 +0xbd fp=0xc00003dfd0 sp=0xc00003df68 pc=0x10f0d9d
runtime.goexit()
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc00003dfd8 sp=0xc00003dfd0 pc=0x10570a1
created by github.com/dm03514/test.Test_RaceCondition
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x6e

...

goroutine 67 [runnable]:
github.com/dm03514/test.Test_RaceCondition.func1(0xc0000a0088, 0xc0000962a0)
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13
created by github.com/dm03514/test.Test_RaceCondition
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x6e

goroutine 23 [running]:
runtime.throw(0x113bf62, 0x15)
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/panic.go:617 +0x72 fp=0xc00003f700 sp=0xc00003f6d0 pc=0x102aa32
runtime.mapassign_faststr(0x11112c0, 0xc0000962a0, 0xc0000180b8, 0x5, 0x1)
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/map_faststr.go:291 +0x40f fp=0xc00003f768 sp=0xc00003f700 pc=0x101138f
github.com/dm03514/test.Test_RaceCondition.func1(0xc0000a0088, 0xc0000962a0)
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:15 +0xbd fp=0xc00003f7d0 sp=0xc00003f768 pc=0x10f0d9d
runtime.goexit()
        /usr/local/Cellar/go/1.12.7/libexec/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc00003f7d8 sp=0xc00003f7d0 pc=0x10570a1
created by github.com/dm03514/test.Test_RaceCondition
        /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x6e
exit status 2
FAIL    github.com/dm03514/test 1.017s
```

### Race detector
Go provides a built in tool called the race dector that helps to identify race conditions.  While `-race` should be used it can result in false negatives because it needs to observe concurrent accesses. For example, if a test suite passed in `-race` flag but doesn't spawn go routines than there's nothing the race detector can do.  In the case of the race condition above the race detector works perfectly.  Even at 5 concurrent requests its able to detect the race condition:

```
for i := 0; i < 5; i++ {
```

```
$ go test -run Test_RaceCondition -race
==================
WARNING: DATA RACE
Read at 0x00c00001a160 by goroutine 7:
  github.com/dm03514/test.Test_RaceCondition.func1()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:14 +0x3c

Previous write at 0x00c00001a160 by goroutine 6:
  github.com/dm03514/test.Test_RaceCondition()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:12 +0xb8
  testing.tRunner()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:865 +0x163

Goroutine 7 (running) created at:
  github.com/dm03514/test.Test_RaceCondition()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x94
  testing.tRunner()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:865 +0x163

Goroutine 6 (running) created at:
  testing.(*T).Run()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:916 +0x65a
  testing.runTests.func1()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:1157 +0xa8
  testing.tRunner()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:865 +0x163
  testing.runTests()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:1155 +0x523
  testing.(*M).Run()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:1072 +0x2eb
  main.main()
      _testmain.go:42 +0x222
==================
==================
WARNING: DATA RACE
Write at 0x00c000086330 by goroutine 9:
  runtime.mapassign_faststr()
      /usr/local/Cellar/go/1.12.7/libexec/src/runtime/map_faststr.go:202 +0x0
  github.com/dm03514/test.Test_RaceCondition.func1()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:15 +0xd8

Previous write at 0x00c000086330 by goroutine 7:
  runtime.mapassign_faststr()
      /usr/local/Cellar/go/1.12.7/libexec/src/runtime/map_faststr.go:202 +0x0
  github.com/dm03514/test.Test_RaceCondition.func1()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:15 +0xd8

Goroutine 9 (running) created at:
  github.com/dm03514/test.Test_RaceCondition()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x94
  testing.tRunner()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:865 +0x163

Goroutine 7 (finished) created at:
  github.com/dm03514/test.Test_RaceCondition()
      /Users/danielmican/go/src/github.com/dm03514/test/main_test.go:13 +0x94
  testing.tRunner()
      /usr/local/Cellar/go/1.12.7/libexec/src/testing/testing.go:865 +0x163
==================
--- FAIL: Test_RaceCondition (0.00s)
    testing.go:809: race detected during execution of test
FAIL
exit status 1
FAIL    github.com/dm03514/test 0.535s
```

Whereas previously the test could pass with 5 concurrency from random bad luck, the race detector is able to record the accesses to the shared memory and see that those accesses are coming from 2 separate go routines!

### Fixing the Data Race

The final step is to fix the Data race.  One way of doing this is to use primitives (mutex) to ensure that only a single goroutine is able to write to the map at a time.

```
package main

import (
        "fmt"
        "testing"
        "sync"
)

func Test_RaceCondition(t *testing.T){
        m := make(map[string]string)
        mu := sync.Mutex{}

        for i := 0; i < 500; i++ {
                go func() {
                        kv := fmt.Sprintf("hi_%d", i)
                        mu.Lock()
                        m[kv] = kv
                        mu.Unlock()
                }()
        }
}
```

```
$ go test -run Test_RaceCondition
PASS
ok      github.com/dm03514/test 1.755s
```

Even at 500! concurrency the code is now safe because it guarantees that no concurrent accesses can be performed on the map.

  This comes at the cost of reasoning about concurrent correctness and data races.  On top of this, many of the popular web environments, have runtimes and deployment models that remove the need.  Careful consideration must be given to concurrent memory accesses and shared memory when programming in go.  It's critically important to understanding: "Will this code be executing concurrently?" and if so "Is this code thread-safe"?  Once this is understood go provides great testing utilities (`-race`) to help gain confidence in concurrent correctness.  In addition to `-race` I have also had a ton of success detecting race conditions using a Structured analysis technique named [`Candidates & Contexts`](https://medium.com/dm03514-tech-blog/golang-candidates-and-contexts-a-heuristic-approach-to-race-condition-detection-e2b230e70d08#0783).

license: Unlicense

gha_license_id: Unlicense


text:
# Laravel Boolean SoftDeletes

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
[![Quality Score][ico-code-quality]][link-code-quality]
[![Total Downloads][ico-downloads]][link-downloads]

This package is designed for high-load applications and optimizes queries with soft deletes by utilizing a boolean field for indexing, which is more efficient than using unique timestamps.

## Install

Via Composer

``` bash
$ composer require tenantcloud/laravel-boolean-softdeletes
```

Add `Webkid\LaravelBooleanSoftdeletes\SoftDeletesBoolean` trait to models with soft deletes.

Then create and run migration to add soft delete boolean field
```php
Schema::table('users', function (Blueprint $table) {
    $table->boolean('is_deleted')->default(0)->index();
});
```

If you want to use this package for existing project you can use built-in command
```dotenv
php artisan softdeletes:migrate
```

Also you can change default column name `is_deleted` to any other by setting static property `IS_DELETED`of certain model

Versions compatibility
``` bash
For Laravel 5 - laravel-boolean-softdeletes 0.1.2
For Laravel 6 - laravel-boolean-softdeletes 1.0.0
For Laravel 7 - laravel-boolean-softdeletes 2.0.0
For Laravel 8 - laravel-boolean-softdeletes 3.*
For Laravel 9 - laravel-boolean-softdeletes 4.*
For Laravel 10 - laravel-boolean-softdeletes 5.*
```

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security

If you discover any security related issues, please email<EMAIL_ADDRESS>instead of using the issue tracker.

## Credits

- [Ivan Kolodiy][link-author]
- [All Contributors][link-contributors]

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/packagist/v/tenantcloud/laravel-boolean-softdeletes.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/tenantcloud/laravel-boolean-softdeletes/master.svg?style=flat-square
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/tenantcloud/laravel-boolean-softdeletes.svg?style=flat-square
[ico-code-quality]: https://img.shields.io/scrutinizer/g/tenantcloud/laravel-boolean-softdeletes.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/tenantcloud/laravel-boolean-softdeletes.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/tenantcloud/laravel-boolean-softdeletes
[link-travis]: https://travis-ci.org/tenantcloud/laravel-boolean-softdeletes
[link-scrutinizer]: https://scrutinizer-ci.com/g/tenantcloud/laravel-boolean-softdeletes/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/tenantcloud/laravel-boolean-softdeletes
[link-downloads]: https://packagist.org/packages/tenantcloud/laravel-boolean-softdeletes
[link-author]: https://github.com/ivankolodii
[link-contributors]: ../../contributors

repository: tenantcloud/laravel-boolean-softdeletes

gha_language: PHP

repo_name: tenantcloud/laravel-boolean-softdeletes


text:
![The Art of Travel](https://images.blinkist.com/images/books/5b39b299b238e10007ffd9bf/1_1/470.jpg)
# The Art of Travel
*Alain De Botton*

>The Art of Travel (2002) is an unorthodox guide to traveling. Unlike conventional travel guides, Alain de Botton’s book is more of a philosophical globe-trotter’s handbook, exploring the reasons behind our urge to discover new places and offering some general tips for making travel more enjoyable.

# What’s in it for me? Learn how to get the most out of your next travel adventure.

When you’re stuck in the office, finishing up yet another stressful day at work, you’ve doubtless fantasized about being somewhere else – in a hammock, perhaps, sipping a margarita and listening to the gentle crash of turquoise waves against fine, white sandy beaches.

Fantasizing about tropical islands is common enough – almost as common as the feeling of disappointment that such islands often inspire in real life. Instead of pristine beaches and relaxation, a trip to the tropics often means crowds, mosquitoes and sunburn. Indeed, the idea of travel is usually a great deal more enjoyable than the reality of it.

But, as these blinks explain, it doesn’t have to be this way.

By taking greater pleasure in little things, be it the miracle of air travel or the beauty of nature, we can find more enjoyment in our travels. From tips on how to appreciate the details of the things around you to reassuring anecdotes about the adventures (and misadventures) of past travelers, these blinks will give you a philosophical perspective on an activity, the enjoyability of which is often taken for granted.

You’ll also learn

- how Britain became an exciting travel destination;

- which art critic recommends “word painting”; and

- why you should appreciate clouds.

# Dreams of travel are often quite different from actual trips, in part because you can't travel away from yourself.

Human life is often one long quest for happiness, and the means to this often elusive end are myriad. Some turn to money; others, to love. Still others seek happiness and meaning in travel.

But the reality of travel often has little in common with the vague fantasies that first inspire one to hit the road, a disparity that’s nicely captured in *A Rebours*, a French novel written by Joris-Karl Huysmans in 1884.

The book’s protagonist, the Duke of Esseintes, is a recluse and a misanthrope; he despises the society of his local village and spends his days holed up in his room, reading classic literature.

But his reading inspires him to reenter the world. The duke reads Charles Dickens, whose vivid descriptions of foggy London fill him with a longing to see the famous city. Soon, he packs his bags and sets forth.

While still in Paris, to kill time before his train leaves for the first leg of the trip to London, the protagonist enters an English bookstore and purchases a London guidebook. Still full of his London enthusiasm, he then goes to an English tavern, teeming with swarthy British maids and smelling of beer and meat.

But all this premature Britishness takes the wind out of the duke’s sails. When the time comes to board the train to London, he is utterly worn out. So, instead of facing the inconveniences of train travel – dashing to the station, finding a porter, sleeping in a compartment, standing in lines – he returns home, never to embark on another journey again for the rest of his days.

The disappointments of travel certainly aren’t limited to fiction, and they affect people in the twenty-first century as much as they did those in the nineteenth.

For starters, travel isn’t the best way to escape from your problems, because wherever you go – well, there you’ll be.

The author once went to Barbados. He’d been looking forward to an escape from his day-to-day routine, some time to relax and release. But when he got there, he couldn’t simply relax and enjoy the gorgeous scenery or the scrumptious fresh fruit; rather, he felt melancholic and anxious, just as he had back home in London.

Actual travel is usually far less glamorous than the dreams one has of it. But traveling still has a world of wonders to reveal – it’s just about adjusting our modern approach to it.

#

*“It seems we may best be able to inhabit a place when we are not faced with the additional challenge of having to be there.”*

# Air travel can amaze us, shift our perspective and teach us to appreciate clouds.

Charles Baudelaire, the nineteenth-century French poet, greatly admired large ships. He found it fantastic and delightful that such a bulky craft could breeze, with swiftness and efficiency, from one continent to another.

The frigates and steamships of centuries past may be impressive enough, but modern means of transportation are even more mind-boggling.

Air travel isn’t merely amazing; it also affords an opportunity to – quite literally – shift your perspective.

If Baudelaire thought the graceful floating of a big boat was impressive, imagine what he would have thought had he witnessed the takeoff of a Boeing 747. Or, better yet, if he’d experienced the rush and excitement of being inside the plane as it leaves the ground.

This moment is enough to break through the indifference of even the most seasoned traveler. During takeoff, as we literally leave the earth, we’re reminded of our ability to experience similar moments of change in our own lives.

And then, as we fly higher, we watch as factories, houses and cars become smaller and smaller. This is a psychologically healing experience, showing us what all our human ailments and ambitions truly are: tiny. From up here, even your country may begin to seem relatively insignificant.

But the plane rises higher, until we’re flying amid a strange landscape of cotton mountains and snowy fields. We’re among the clouds.

Clouds get a bad rap down on Earth; they impose shade and discharge rain. But, when you’re right up next to them, their beauty becomes undeniable, as does their three-dimensionality.

Historically speaking, we’ve got a rare view, one that would have fascinated painters of the past, such as Leonardo da Vinci and Nicolas Poussin.

Baudelaire would have definitely been envious. Though his view of the clouds was earthbound, he still wrote effusively about them. In one of his poems, the narrator declares “I love the clouds / the clouds that pass by / over there / over there / those lovely clouds!”

# Exoticism, which promises an escape from the drudgery of home, draws us to travel.

Once, the author went to Amsterdam. Though not exactly a far-flung travel destination, the city was, for the author, undeniably foreign. He found himself delighting in seemingly mundane things, such as the signs at the airport. The Dutch language’s double vowels and the unfamiliar fonts provided confirmation of an exciting fact: the author was in a strange land – a place that, to him, was exotic.

The urge to discover unfamiliar cultures has long lured travelers abroad. And one of the promises held out by these cultures – namely, an escape from the familiar drudgery of the day-to-day – inheres in the umbrella term *exoticism*.

Exoticism has been around for a while. Back in the nineteenth century, the word “exotic” was usually used in reference to countries in and around the Middle East – or, as this area was then called, the Orient. And, back then, the Orient was referenced quite a lot.

In 1813, Lord Byron wrote a very popular poem, “The Giaour,” which, set in Turkey, relates the tale of a Muslim woman, Leila, who belongs to the harem of a man named Hassan. After falling in love with a non-Muslim (a giaour), Leila is drowned in the sea by Hassan.

In 1829, French author Victor Hugo wrote a series of popular poems called “Les Orientales,” set in the eastern Mediterranean. And, a few years later, French painter Eugène Delacroix traveled to Morocco and took to calling himself an African.

This European enthusiasm for all things “oriental” even shaped Continental spaces. Indeed, in 1833, the massive Luxor Obelisk was taken from the Luxor Temple in Egypt, and transported on the appropriately named barge *Louqsor* all the way to Cherbourg, France. From there, it was brought to Paris, and, to this day, it marks the towering center of the city’s Place de la Concorde.

Exoticism promises an escape from drudgery and boredom. And of all the malcontented authors of the nineteenth century, few were as disaffected and fed up with bourgeois pieties as Gustave Flaubert, who lived in Rouen, France.

 Flaubert imagined the Orient as an escape from this tedium, a fantasy reflected in his 1839 novel *Les Mémoires d’un Fou*, whose protagonist wastes his youth daydreaming about Egypt.

Flaubert even got to live out his fantasies. When he was 24, he inherited the family fortune, which allowed him to escape Rouen and travel to Egypt, where he satisfied his hunger for exotic cultures and exotic women.

# Travel used to be about exploration, but modern travelers must learn to ask questions.

Once, while visiting Madrid, the author was suddenly overwhelmed by a feeling of lassitude. He took to his bed, where he would have remained had the hotel’s cleaning lady not repeatedly interrupted his sleep. In the end, he decided that he might as well go look at the city.

The aimless fatigue that drove the author to seek refuge in his bed is a rather common symptom of travel; however, it’s also a rather new one.

Travelers of yore didn’t have time for torpidness because travel used to be about exploration.

For example take Alexander von Humboldt, a German explorer who traveled to South America in 1799.

His trip had a clear purpose: to record facts. And if he wasn’t busy doing that, he was developing experiments that would assist his future recording of facts.

During the voyage, he hardly had a spare minute. He systematically recorded variations in sea temperature; he learned to estimate the ship’s location with the help of his sextant and the stars; and he retrieved unclassified species of sea life from a net dangling overboard.

Once the ship was anchored off the coast of New Andalusia, Humboldt’s fervent fact recording raged on. He recorded temperature and atmospheric pressure; he measured and sketched plant life; he communicated with the local people and recorded facts about their way of life.

In short, Humboldt was busy – something that modern travelers usually aren’t.

Today, there’s no need to explore because, thanks to people like Humboldt, the world has already been explored. And it’s this fact, perhaps, that led to the author’s bout of lethargy; he had nothing to be excited about.

In Madrid, the author visited the Royal Basilica of San Francisco el Grande. But the dry facts offered by the guidebook left him cold. What did he care that the frescoes were painted in the nineteenth century? So he tried seeing things from a fresh perspective by asking his own questions.

What first drove people to build churches? Why don’t all churches follow the same design? Why did the architects who designed this church become so successful?

Such questions can rekindle the curiosity that guidebooks often extinguish.

# Vacations often involve nature, the beneficial effects of which we can learn to prolong.

William Wordsworth, the British Romantic poet, was a vehement critic of city life. The pollution, the traffic, the unsightly buildings – these things, he believed, could have nothing but a detrimental effect on one’s inner well-being.

Many would agree with Wordsworth today. So it’s no surprise that people often choose to vacation in the natural world, where they can heal and relax.

In Wordsworth’s view, nature is beneficial to both body and mind, improving the hardiness of the former and the purity of the latter.

While visiting England’s Lake District, the author couldn’t help but agree. Though it was raining, the author felt relaxed as he hiked through a dense oak forest, with the raindrops pattering on the canopy overhead.

The oaks seemed eternally patient, slowly absorbing nutrients and water through their roots, season after season. According to Wordsworth, humans have a lot to learn from nature, which gives us many such examples of patience and endurance. Among the oaks, the author felt calmer as he let go of life’s daily worries.

But what about when you leave the forest and reenter the city? Won’t this calm be blasted away?

Well, Wordsworth prolonged the benefits of nature by storing up “spots in time.”

He explained this concept to his sister in a letter from 1790. In that year, he hiked through the Swiss Alps, and the spectacular views – of the gorge of Gondo, of Lake Maggiore – made a profound impression on him. These views, he wrote his sister, would comfort him for the rest of his days.

As indeed they did. Decades later, Wordsworth continued to write of the Alps in his poems. These precious moments, suspended in the amber of memory, were “spots in time” – happy recollections of times past that could dispel present sadness.

Modern-day travelers can benefit from this same technique. Look upon a beautiful view and really take it in. Then, whenever the stresses of city life become too much, you can recall this moment of peace and, hopefully, relax as you relaxed back then.

# Nature’s beauty can inspire spiritual feelings, and the Bible encourages contemplating it.

Gorgeous natural landscapes often appear to have been constructed by some great and incomprehensible force, so it’s perhaps unsurprising that the natural world often inspires deep spiritual feelings.

The author certainly felt inklings of a divine presence while traveling in Egypt and exploring the mountains of southern Sinai. The deep canyons and valleys and the towering granite mountains, all more than 400 million years old, were undeniably awe-inspiring.

It’s almost certain that the men who wrote the Bible had a similar experience, for this landscape is the backdrop of many episodes in the holy book. In the Book of Exodus, for instance, God watches over a group of discontented Israelites, who, frustrated by a food shortage in Sinai, grapple with the temptation to worship foreign gods.

Indeed, natural beauty has often been cited as a testament to a holy presence. For instance, Ralph Waldo Emerson, the nineteenth-century scholar and critic, once wrote that nature’s purpose was “to stand as the apparition of God.”

For this reason, perhaps, many biblical tales encourage the contemplation of nature.

The *Book of Job* tells the story of a rich, happy and devout man – Job. However, within a short period, his flocks of sheep are stolen or slain and a raging storm kills his firstborn son. Job’s friends insist that some sin must have incurred this string of misfortunes. But Job knows he’s innocent.

Grief-stricken, Job asks God what he did to deserve such hardship. In response, God tells Job to contemplate the natural world. Nature, God seems to be saying, is greater than the individual; it has laws of its own, laws which might seem mysterious and harsh to humankind, but which, like the inscrutable edicts of God, have a profound logic.

# Art can deepen our appreciation of landscapes, both foreign and domestic.

If Vincent van Gogh had never picked up a paintbrush and palette and committed to canvas scenes from Provence, France, the author probably wouldn’t have ever traveled there.

Many people have had similar experiences – only longing to see Spain after watching the films of Pedro Almodóvar or only developing an enthusiasm for highway overpasses after looking at the photography of Andreas Gursky.

Indeed, art is a great way to gain an appreciation of foreign landscapes.

It’s easy to lose sight of the world’s beauty. Often, the urge to travel dies as soon as it arises; what, after all, could another country have to offer? We’ve been around the block too many times to think we might see something new.

Well, if you feel this way, it might mean you need to look closer, which is precisely what the lens of an artist’s canvas can help you do.

Great art offers a new perspective, a way of seeing a place that suddenly fills it with life and interest.

For example, in pre-eighteenth-century Britain, the English countryside was considered tedium incarnate – a barren, flat expanse of nothing much. If given a choice between Britain and the Mediterranean, travelers chose the latter every time.

This preference was encouraged by the time-honored tradition of art. In the ancient Roman poems of Virgil and Horace and in the paintings of seventeenth-century painters such as Nicolas Poussin and Claude Lorrain, Italy – and the Italian cities of Rome and Naples in particular – were immortalized.

But then, in the eighteenth century, British artists began depicting their homeland.

James Thomson wrote a poem called “The Seasons,” which celebrated English scenery. It inspired other poets, such as Stephen Duck and John Clare, to do the same. In the meantime, the British painters Thomas Gainsborough and Richard Wilson also began depicting the English countryside.

These new perspectives had a palpable effect. Soon enough, tourists were thronging to the Lake District and the Scottish Highlands.

# Drawing and writing can focus our attention when we’re traveling.

Have you ever observed the habits of tourists? They tend to spend little time actually looking at historic monuments or breathtaking landscapes; rather, with a camera or phone, they snap a few photos and move abruptly on to the next mandatory sight.

But, if one doesn’t take the time to truly observe things, what is the point of travel?

The nineteenth-century art critic John Ruskin had great faith in the power of drawing to enhance aesthetic appreciation. He believed that drawing is a way for people to take external beauty and internalize it.

During his childhood, Ruskin was so overcome by the beauty of grass that he wanted to eat it – an impractical fantasy that he was able to realize later on in life by more artistic means. Instead of literally eating the grass, he “ingested” it by spending hours drawing blade after minute blade.

Unlike snapping a photograph, which takes no time at all, the time-consuming process of drawing invites us to ask questions. How, for instance, does that tree’s trunk attach to its roots, and why are some leaves a different shade of green from others?

Drawing encourages us to observe our surroundings with a keener eye, and appreciate them more.

Writing – which John Ruskin sometimes referred to as “word painting” – has a similar effect; it can help us absorb and appreciate what’s around us.

Ruskin didn’t approve of the lazy habit of sending home hastily written letters. Usually, such letters say little, offering cursory descriptions of the pretty landscapes or the chilly weather. It’s better to ask tougher questions and seek finer details. Why, for instance, is one lake prettier than another? What other object might it resemble? Does it stand out for reasons other than its mere size?

Writing prods us into paying close attention to every detail, and it’s this state of focus that will help us appreciate where we are.

#

*“Note the exquisite effect of the golden leaves scattered on the blue sky, and the horse-chestnut, dark against them in stars.”* – John Ruskin

# Final summary

The key message in these blinks:

**Traveling, while having its share of pitfalls, can bring great pleasure. Flights can help us shift our perspectives and can remind us of the uplifting moments life has to offer. Looking at art is an excellent way to learn to appreciate landscapes, and traveling in nature can bring peace of mind, especially if we draw and write about what we see. Wherever you are, it’s important to pay attention to the details – that’s the surest way to find enjoyment in your surroundings.**

Actionable advice:

**Take a trip around your bedroom.**

If traveling to exotic lands sounds a bit daunting, you can take a tip from the eighteenth-century French author Xavier de Maistre, who once traveled through his sleeping chamber and wrote about the experience. If you truly pay attention, you’re sure to discover parts of your room that you either never noticed, forgot about or failed to fully appreciate. For example, even people whose rooms afford a spectacular view rarely take the time to properly enjoy it. Receptivity and curiosity aren’t only helpful abroad; they’ll serve you equally well at home.

**Got feedback?**

We’d sure love to hear what you think about our content! Just drop an email to<EMAIL_ADDRESS>with the title of this book as the subject line and share your thoughts!

**Suggested** **further** **reading:*****Notes from a Small Island *****by Bill Bryson**

American-born author Bill Bryson wrote *Notes from a Small Island *(1995) as he was preparing to leave the small Yorkshire village in which he’d lived for 20 years, and head back to the United States. Before departing, he decided to bid a fond adieu to his adopted country, Great Britain. This travelogue documents his farewell tour of a country whose landscape, culture, mores and wonderful eccentricities he’d come to love so dearly.

Source: [The Art of Travel by Alain De Botton](https://www.blinkist.com/en/nc/daily/reader/the-art-of-travel-en/)

url: https://raw.githubusercontent.com/byteshiva/Blinkist-Daily-Scraper/a63ef764c8ba22ef56a2e7117b367154b7d5f3fb/blinks/2018/20180803-The Art of Travel-Alain De Botton.md

repository: byteshiva/Blinkist-Daily-Scraper

gha_language: Jupyter Notebook

repo_name: byteshiva/Blinkist-Daily-Scraper


text:
### IFileSystemFileAttribute

 IFileSystemFileAttribute is interface for setting file attributes. (Click here)

```csharp
/// <summary>
/// File system that set file attribute.
/// </summary>
public interface IFileSystemFileAttribute : IFileSystem, IFileAttributeOption
{
    /// <summary>
    /// Set <paramref name="fileAttribute"/> on <paramref name="path"/>.
    /// </summary>
    /// <param name="path"></param>
    /// <param name="fileAttribute"></param>
    /// <param name="option">(optional) operation specific option; capability constraint, a session, security token or credential. Used for authenticating, authorizing or restricting the operation.</param>
    /// <exception cref="FileNotFoundException"><paramref name="path"/> is not found</exception>
    /// <exception cref="DirectoryNotFoundException"><paramref name="path"/> is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.</exception>
    /// <exception cref="IOException">On unexpected IO error</exception>
    /// <exception cref="SecurityException">If caller did not have permission</exception>
    /// <exception cref="ArgumentNullException"><paramref name="path"/> is null</exception>
    /// <exception cref="ArgumentException"><paramref name="path"/> contains only white space, or contains one or more invalid characters</exception>
    /// <exception cref="NotSupportedException">The <see cref="IFileSystem"/> doesn't support browse</exception>
    /// <exception cref="UnauthorizedAccessException">The access requested is not permitted by the operating system for the specified path, such as when access is Write or ReadWrite and the file or directory is set for read-only access.</exception>
    /// <exception cref="PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters.</exception>
    /// <exception cref="InvalidOperationException">If <paramref name="path"/> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc.</exception>
    /// <exception cref="ObjectDisposedException"></exception>
    void SetFileAttribute(string path, FileAttributes fileAttribute, IOption option = null);
}
```

 IFileSystemFileAttributeAsync is async interface for setting file attributes. (Click here)

```csharp
/// <summary>
/// File system that set file attribute.
/// </summary>
public interface IFileSystemFileAttributeAsync : IFileSystem, IFileAttributeOption
{
    /// <summary>
    /// Set <paramref name="fileAttribute"/> on <paramref name="path"/>.
    /// </summary>
    /// <param name="path"></param>
    /// <param name="fileAttribute"></param>
    /// <param name="option">(optional) operation specific option; capability constraint, a session, security token or credential. Used for authenticating, authorizing or restricting the operation.</param>
    /// <exception cref="FileNotFoundException"><paramref name="path"/> is not found</exception>
    /// <exception cref="DirectoryNotFoundException"><paramref name="path"/> is invalid. For example, it's on an unmapped drive. Only thrown when setting the property value.</exception>
    /// <exception cref="IOException">On unexpected IO error</exception>
    /// <exception cref="SecurityException">If caller did not have permission</exception>
    /// <exception cref="ArgumentNullException"><paramref name="path"/> is null</exception>
    /// <exception cref="ArgumentException"><paramref name="path"/> contains only white space, or contains one or more invalid characters</exception>
    /// <exception cref="NotSupportedException">The <see cref="IFileSystem"/> doesn't support browse</exception>
    /// <exception cref="UnauthorizedAccessException">The access requested is not permitted by the operating system for the specified path, such as when access is Write or ReadWrite and the file or directory is set for read-only access.</exception>
    /// <exception cref="PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters.</exception>
    /// <exception cref="InvalidOperationException">If <paramref name="path"/> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc.</exception>
    /// <exception cref="ObjectDisposedException"></exception>
    Task SetFileAttributeAsync(string path, FileAttributes fileAttribute, IOption option = null);
}
```

IFileSystem**.SetFileAttribute(path, attributes)** sets file attributes on file or directory at path.

```csharp
IFileSystem filesystem = new FileSystem("");
filesystem.SetFileAttribute("C:/Temp/File.txt", FileAttributes.ReadOnly);
```


text:
Description: CLI gem for 2017 NBA draft picks

-  A cli for the 2017 NBA draft from getting basic draft data from http://www.cbssports.com/nba/news/2017-nba-draft-picks-complete-results-full-list-of-players-selected-highlights-grades/ and more details on each player from http://www.nba.com/draft/2017/prospects/[PLAYERNAME]

user types nba-draft-2017

A list of options appears prompting the user to list the draft, see a player's stats and details, see player's' by NBA team, or see player's by former college or Country.

List draft
1. Markelle Fultz from Washington to 76ers
2. Lonzo Ball from UCLA to Lakers
etc

player details (What is a player?)
PLAYERNAME
  round:_ pick:_
  drafted as:
  Height
  Weight
  STATS
   PPG:
   ASG:
   RBG:
   etc.

players by NBA team
ask user for input
for input = 'Warriors'
Rd. 2 Pick: 38 Jordan Bell from Oregon
(list all players that team drafted)
ask user if they want to see more player(s) details

players by Former team
ask user for input
for input = Washington
Rd. 1 Pick 1 Markelle Fultz to 76ers
(list all players that were on team and drafted into the NBA)
ask user if they want to see more player(s) details


text:
# SQL injection test

We are trying to see if this particular SQL injection works with your code.

We want to turn on logging to see what query is being executed. Logon to your mysql server. Enter the following commands:
```
SET GLOBAL general_log_file = "/var/log/mysql/query.log";
SET GLOBAL general_log = 'OFF';
```
Now your log file can be tailed from the above location.

Run the code by typing:
```
php injection-test.php
```

repository: pkandathil/sql-injection-test

repo_name: pkandathil/sql-injection-test


text:
## Overview

```js
// A simple Action

'use strict'
const ActionHero = require('actionhero')

module.exports = class MyAction extends ActionHero.Action {
 constructor () {
   super()
   this.name = 'randomNumber'
   this.description = 'I am an API method which will generate a random number'
   this.outputExample = {randomNumber: 0.1234}
 }

 async run (api, data) {
   data.response.randomNumber = Math.random()
 }
}
```

The core of ActionHero is the Action framework, and **actions** are the basic units of work.  All connection types from all servers can use actions.  This means that you only need to write an action once, and both HTTP clients and websocket clients can consume it.

The goal of an action is to read `data.params` (which are the arguments a connection provides), do work, and set the `data.response` (and `data.response.error` when needed) values to build the response to the client.

You can create you own actions by placing them in a `./actions/` folder at the root of your application.  You can use the generator with `actionhero generate action --name=myAction`

You can also define more than one action per file if you would like, to share common methods and components (like input parsers).

```js
// A Combound Action with Shared Inputs//

var commonInputs = {
  email: {
    required: true,
    validator: function(param){
      if( email.indexOf('@') > 0 ){
        return true;
      }else{
        return new Error('that is not a valid email address');
      }
    },
  },
  password: {
    required: true,
    validator: function(param){
      if(param.length < 4){
        return new Error('password should be at least 3 letters long');
      }else{
        return true;
      }
    },
    formatter: function(param){
      return String(param);
    },
  }
};

// the actions

exports.userAdd = {
  name: 'userAdd',
  description: 'I add a user',
  inputs: commonInputs,
  run: function(api, data, next){
    // your code here
    next(error);
  }
};

exports.userDelete = {
  name: 'userDelete',
  description: 'I delete a user',
  inputs: commonInputs,
  run: function(api, data, next){
    // your code here
    next(error);
  }
}
```

## Versions

ActionHero supports multiple versions of the same action.  This will allow you to support actions/routes of the same name with upgraded functionality.

* actions optionally have the `action.version` attribute.
* a reserved param, `apiVersion` is used to directly specify the version of an action a client may request.
* if a client doesn't specify an `apiVersion`, they will be directed to the highest numerical version of that action.

You can optionally create routes to handle your API versioning:

*As a note, if a client accessing ActionHero via routes does not provide an apiVersion and it is explicitly defined in the route, the highest number will not be assigned automatically, and will be seen as a routing error.*

```js
exports.routes = {
  all: [
    // creates routes like \`/api/myAction/1/\` and \`/api/myAction/2/\`
    // will also default \`/api/myAction\` to the latest version
    { path: '/myAction/:apiVersion', action: 'myAction' },

    // creates routes like \`/api/1/myAction/\` and \`/api/2/myAction/\`
    // will also default \`/api/myAction\` to the latest version
    { path: '/:apiVersion/myAction', action: 'myAction' },
  ]
};
```

## Options

The complete set of options an action can have are:

```js
exports.action = {
  // the action's name (the \`exports\` key doesn't matter)
  name: 'randomNumber',
  // the description
  description: 'I am an API method which will generate a random number',
  // a hash of all the inputs this action will accept
  // any inputs provided to the action not in this hash will be stripped
  inputs: {
    multiplier: {
      required: false,
      validator: function(param, connection, actionTemplate){ if(param < 0){
        return 'must be > 0' }else{ return true; }
      },
      formatter: function(param, connection, actionTemplate){
        return parseInt(param);
      },
      default:   function(param, connection, actionTemplate){
        return 1;
      },
    }
  },
  // any middlewares to apply before/after this action
  // global middleware will be applied automatically
  middleware: [],
  // an example response
  outputExample: { randomNumber: 123 },
  // you can choose to block certain servers from using this action
  blockedConnectionTypes: ['webSocket'],
  // how should this action be logged?
  logLevel: 'warning',
  // (HTTP only) if the route for this action includes an extension (like .jpg), should the response MIME be adjusted to match?
  matchExtensionMimeType: true,
  // should this action appear within \`api.documentation.documentation\`
  toDocument: true,

  run: function(api, data, next){
    var error = null;

    data.response.randomNumber = Math.random() * data.params.multiplier;
    next(error);
  }
}
```

## Inputs

```js
action.inputs = {
  // a simple input
  // defaults assume required = false
  minimalInput: {}
  // a complex input
  multiplier: {
    required: true,
    validator: function(param, connection, actionTemplate){
      if(param < 0){ return 'must be > 0'; }else{ return true; }
    },
    formatter: function(param, connection, actionTemplate){
      return parseInt(param);
    },
    default:   function(param, connection, actionTemplate){
      return 1;
    },
  },
  // a schema input
  schemaInput: {
    required: true,
    default: {},
    schema: {
      nestedInput: {
        required: true,
        default: 1,
        validator: function(param, connection, actionTemplate){
          if(param < 0){ return 'must be > 0'; }else{ return true; }
        },
        formatter: function(param, connection, actionTemplate){
          return parseInt(param);
        },
      },
      otherInput: {},
    }
  }
};
```

The properties of an input are:

* `required` (boolean)
  * Default: `false`
* `formatter = function(param, connection, actionTemplate)`
  * will return the new value of the param
  * Default: The parameter is not reformatted
* `default = function(param, connection, actionTemplate)`
  * will return the default value of the param
  * you can also have a static assignment for `default` father than a function, ie: `default: 123`
  * Default: Parameter has no default value
* `validator = function(param, connection, actionTemplate)`
  * should return true if validation passed
  * should return an error message if validation fails which will be returned to the client
  * Default: Parameter is always valid
* `schema` (object)
  * optional nested inputs definition
  * accept `object` similar to regular input
  * nested input also have properties: `required`, `formatter`, `default` and `validator`

You can define `api.config.general.missingParamChecks = [null, '', undefined]` to choose explicitly how you want un-set params to be handled in your actions.  For example, if you want to allow explicit `null` values in a JSON payload but not `undefined`, you can now opt-in to that behavior.  This is what `action.inputs.x.required = true` will check against.

Since all properties of an input are optional, the smallest possible definition of an input is: `name : {}`.  However, you should usually specify that an input is required (or not), ie: `{`name: {required: false}`}`.

The methods `default`, `formatter`, and `validator` have the api object set as `this` within their scopes.  This means that you can define common formatters within middleware and reference them in each action.

The methods are applied in this order:

* `default()`
* `formatter()`
* `validator()`
* `required()`

Here's an example...

```js
moneyInCents: {
  required:  true,
  default:   function(p){ return 0; },
  formatter: function(p){ return parseFloat(p); },
  validator: function(p){
    if(isNaN(parseFloat(p)){ return new Error('not a number'); }
    if(p < 0){ return new Error('money cannot be negative'); }
    else{ return true; }
  }
}
```

Formatters and Validators can also be named method names. For example, you might have an action like:

```js
exports.cacheTest = {
  name: 'cacheTest',
  description: 'I will test the internal cache functions of the API',
  outputExample: {},

  inputs: {
    key: {
      required: true,
      formatter: [
         function(s){ return String(s); },
         'api.formatter.uniqueKeyName' // <----------- HERE
      ]
    },
    value: {
      required: true,
      formatter: function(s){ return String(s); },
      validator: function(s){
        if(s.length < 3){ return '\`value\` should be at least 3 letters long'; }
        else{ return true; }
      }
    },
  },

  run: function(api, data, next){
    // ...
  }
};
```

You can define `api.formatter.uniqueKeyName` elsewhere in your project, like this initializer:

```js
module.exports = {
  initialize: function(api, next){
    api.formatter = {
      uniqueKeyName: function(key){
        return key + '-' + this.connection.id;
      }
    };

    next();
  },
};
```

Example schema input:

```js
exports.addUser = {
  name: 'api/addUser',
  description: 'I add user',

  firstName: { required: true },
  lastName: { required: false },
  username: { required: true },
  address: {
    required: false,
    schema: {
      country: {
        required: true,
        default: 'USA'
      },
      state: { required: false },
      city: {
        required: true,
        formatter: (val) => \`City:\${val}\`,
        validator: (val) => val.length > 10,
      }
    }
  }
  run: () => {},
}
```

## The Data Object

The `data` object passed into your action captures the state of the connection at the time the action was started.  Middleware preProcessors have already fired, and input formatting and validation has occurred.  Here are the properties of the `data` object.

```js
data = {
  connection: connection,
  action: 'randomNumber',
  toProcess: true,
  toRender: true,
  messageCount: 123,
  params: { action: 'randomNumber', apiVersion: 1 },
  actionStartTime: 123,
  response: {},
}
```

The goal of most actions is to do work and then modify the value of `data.response`, which will eventually be sent down to the client.

You can also modify properties of the connection by accessing `data.connection`, IE changing the response header for a HTTP request.

If you don't want your action to respond to the client, or you have already sent data to the client (perhaps you already rendered a file to them or sent an error HTTP header), you can set `data.toRender = false;`

If you are certain that your action is only going to be handled by a web server, then a connivence function has been provided to you via `data.connection.setHeader()`. This function is a proxy to the Node HTTP Response setHeader function and allows you to set response headers without having to drill into the `data.connection.rawConnection` object. Please be aware, the `data.connection.setHeader()` function will only be available if your action is being handled by a web server. Other server types will throw an exception. See Servers: Customizing the Connection for more details.

## Middleware

You can create middlware which would apply to the connection both before and after an action.  Middleware can be either global (applied to all actions) or local, specified in each action via `action.middleware = []`.  Supply the `names` of any middleware you want to use.

You can learn more about middleware here.

## Notes

* Actions are asynchronous, and require in the API object, the `data` object, and the callback function.  Completing an action is as simple as calling `next(error)`.  If you have an error, be sure that it is a `new Error()` object, and not a string.
* The metadata `outputExample` is used in reflexive and self-documenting actions in the API, available via the `documentation` verb (and /api/ showDocumenation action).
* You can limit how many actions a persistent client (websocket, tcp, etc) can have pending at once with `api.config.general.simultaneousActions`
* `actions.inputs` are used for both documentation and for building the whitelist of allowed parameters the API will accept.  Client params not included in these whitelists will be ignored for security. If you wish to disable the whitelisting you can use the flag at `api.config.general.disableParamScrubbing`. Note that Middleware preProcessors will always have access to all params pre-scrubbing.
* `matchExtensionMimeType` is currently only used by the `web` server, and it indicates that if this action is successfully called by a client with `connection.extension` set, the headers of the response should be changed to match that file type.  This is useful when creating actions that download files.
* ActionHero strives to keep the `data.connection` object uniform among various client types, and more importantly, present `data.params` in a homogeneous way.  You can inspect `data.connection.type` to learn more about the connection.  The gory details of the connection (which vary on its type) are stored in `data.connection.rawConnection` which will contain the websocket, tcp connection, etc.  For web clients, `{`data.connection.rawConnection = {req: req, res: res}`}` for example.
  * You can learn more about some of the `rawConnection` options by learning how to send files from actions.

You can learn more about handling HTTP verbs and file uploads here and TCP Clients and Web-Socket Clients

repository: jtallar/HoH-Web

gha_language: JavaScript

repo_name: jtallar/HoH-Web


text:
---
layout: default
---

# 1995-01-05 - Re: Remailer postage

## Header Data

From<EMAIL_ADDRESS>(Russell Nelson)

To<EMAIL_ADDRESS>Message Hash: d257569a0a6d6fb45873c77dc221f902a4fcc35f1a278240c1744d471d8255de

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-01-05 19:14:40 UTC

Raw Date: Thu, 5 Jan 95 11:14:40 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Russell Nelson)
Date: Thu, 5 Jan 95 11:14:40 PST
To<EMAIL_ADDRESS>Subject: Re: Remailer postage
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

   From<EMAIL_ADDRESS>   Date: Thu, 5 Jan 1995 13:02:57 -0500 (EST)

   I am concerned about the ethics of having a paymailer feed into the free
   remailer soup - how would their operators react if I'm effectively making money
   (no matter how little) off of them?

There is no ethical problem.  How do they know someone isn't making
money off them already?  If they haven't considered that, they should.

--
-russ<EMAIL_ADDRESS>  http://www.crynwr.com/crynwr/nelson.html
Crynwr Software   | Crynwr Software sells packet driver support | ask4 PGP key
11 Grant St.      | +1<PHONE_NUMBER> (9201 FAX)  | What is thee doing about it?
Potsdam, NY 13676 | What part of "Congress shall make no law" eludes Congress?

{% endraw %}
```

## Thread

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

+ Return to<EMAIL_ADDRESS>(Doug Barnes)](/authors/db_at_tadpole_com_doug_barnes_)"
+ Return to "[jpb@gate.net](/authors/jpb_at_gate_net)"
+ Return to "[Jurgen Botz <jbotz@orixa.mtholyoke.edu>](/authors/jurgen_botz_jbotz_at_orixa_mtholyoke_edu_)"
+ Return to<EMAIL_ADDRESS>(Russell Nelson)](/authors/nelson_at_crynwr_com_russell_nelson_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1995-01-05 (Thu, 5 Jan 95 11:11:06 PST) - [Remailer postage](/archive/1995/01/40299ae8ffe664e75939132d7da925a70c4547144b2cc7d43bd77eccefbdd2c4) -<EMAIL_ADDRESS>  + 1995-01-05 (Thu, 5 Jan 95 11:14:40 PST) - Re: Remailer postage -<EMAIL_ADDRESS>(Russell Nelson)_
  + 1995-01-05 (Thu, 5 Jan 95 11:50:51 PST) - [Re: Remailer postage](/archive/1995/01/76ba68403cd4a5c9be639dee1b79f59a385be0f7c49892c442888c8e12071b28) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1995-01-05 (Thu, 5 Jan 95 13:03:52 PST) - [Re: Remailer postage](/archive/1995/01/9d4dd00cff5c14fb8c34205c12d900598690a98f42f833736f4481d94eab86d2) -<EMAIL_ADDRESS>(Doug Barnes)_
    + 1995-01-05 (Thu, 5 Jan 95 13:49:56 PST) - [Re: Remailer postage](/archive/1995/01/97aeec06cbd78b776765593a91e73101050c0cbbeaf6c39c452bb3af058a9936) -<EMAIL_ADDRESS>(Timothy C. May)_
      + 1995-01-06 (Thu, 5 Jan 95 16:27:39 PST) - [Re: Remailer postage](/archive/1995/01/413f7aaac09ff19cfea9c05f5108ee2b1234c0b8cb24ca674a52dc70d1562a33) -<EMAIL_ADDRESS>(Russell Nelson)_
  + 1995-01-11 (Tue, 10 Jan 95 19:08:46 PST) - [Re: Remailer postage](/archive/1995/01/9552f14e0caa4190a9d7ce5cb5650ac36b01eb05e080f31f2cb570bff35c2b86) - _Jurgen Botz<EMAIL_ADDRESS>