text:
# CloudPDF PHP

PHP wrapper for the [CloudPDF API](https://cloudpdf.io/developers/api-docs) - an cloud-based PDF management service.

## Installation

Install the package with:

    composer require cloudpdf/api

To use the bindings, load it via Autoload

```php
require_once('vendor/autoload.php');
```

## Usage

### Table of Contents

- [Authentication](#authentication)
- [Account Info](#account-info)
- [Documents](#documents)
- [Webhooks](#webhooks)

### Authentication

Get the API key for your project from your CloudPDF Dashboard → Settings → API Keys.

```php
$config = array(
  'apiKey' => 'YOUR API KEY',
  'cloudName' => 'YOUR CLOUD NAME',
  'signingSecret' => 'YOUR SIGNING SECRET'
);

$cloudpdf = new CloudPDF\Client($config);
```

### Account Info

Return info about the Account associated with this API key.

```php
$cloudpdf->account()
```

### Documents

#### Create a Document

Before you can upload a PDF to CloudPDF you must create a new document.

The server will return a pre-signed Amazon upload URL where you can [upload your PDF file](#upload-file) using a PUT request.

After uploading the file you must [notify our server](#upload-file-completed) that the upload is finished and we will process the PDF by our PDF engine.

```php
$cloudpdf.createDocument([
  "name" => "your_document_name.pdf",
  "description" => "Description of your document",
  "tags" => ["tag1", "tag2"],
  "defaultPermissions" => [
    "download" => "Allowed",
    "search" => true,
    "selection" => false,
    "info" => ["email", "phone"]
  ]
])
```

##### Options

- `name`: The name of the PDF you want to upload (`string`)
- `description`: Description of the PDF you want to upload (`string`)
- `parentId`: The ID of the folder you want to create the document in (`string`)
- `tags`: Set tags on the document to easily filter and search documents later (`array`)
- `defaultPermissions`: Set the default permissions for this document. You can find all parameters in te [API docs](https://cloudpdf.io/developers/api-docs#create-document). If none are given we use the default permissions of the organization. You can change the default permissions of the organization in the Dashboard → Settings → Upload Settings. (`object`)

#### Get a Document

```php
$cloudpdf.getDocument("DOCUMENT ID")
```

#### Update a Document

```php
$cloudpdf.updateDocument("DOCUMENT ID", [
  "name" => "your_document_name.pdf",
  "description" => "Description of your document",
  "tags" => ["tag1", "tag2"],
  "defaultPermissions" => [
    "download" => "Allowed",
    "search" => true,
    "selection" => false,
    "info" => ["email", "phone"]
  ]
])
```

##### Options

- `name`: The name of the PDF you want to upload (`string`)
- `description`: Description of the PDF you want to upload (`string`)
- `parentId`: The ID of the folder you want to create the document in (`string`)
- `tags`: Set tags on the document to easily filter and search documents later (`array`)
- `defaultPermissions`: Set the default permissions for this document. You can find all parameters in te [API docs](https://cloudpdf.io/developers/api-docs#update-document). If none are given we use the default permissions of the organization. You can change the default permissions of the organization in the Dashboard → Settings → Upload Settings. (`object`)

#### Delete a Document

```php
$cloudpdf.deleteDocument("DOCUMENT ID")
```

#### Upload file

After you [create a document](#create-a-document) you will receive an Amazon signed URL where you can upload your PDF file using a PUT request. We suggest to upload the file directly from the clients browser to spare your server load. Below you find an example using axios in typescript.

When the file upload is finished you must [notify our server](#upload-file-completed).

```typescript
import axios from 'axios';

axios.put(signedUploadURL, file, {
  headers: {
    "Content-Type": "application/pdf"
  },
  onUploadProgress: (e) => {
    //  Show progress
    const percentComplete = Math.round((e.loaded * 100) / e.total);
    console.log(percentComplete);
  },
});
```

#### Upload file completed

After uploading your file to Amazon S3 you must notify our server on this endpoint that the upload is complete. On a successful request the status of the document will change from "WaitingUpload" to "Processing".

You can poll the [GET endpoint](#get-a-file) for status updates or [use a webhook](#webhooks) to find out if your document has completed processing by our PDF engine.

```php
$cloudpdf.uploadDocumentFileComplete("DOCUMENT ID", "FILE ID", ["uploadCompleted" => true])
```

#### Get a file

```php
$cloudpdf.getDocumentFile("DOCUMENT ID", "FILE ID")
```

### Webhooks

Webhooks are used to notify your system of specific CloudPDF events.

#### Create a Webhook

```php
$cloudpdf.createWebhook([
  "name" => "Webhook 1",
  "url" => "https://urltotrigger.com/",
  "events" => ["document.created"],
  "headers" => [
    "Authorization" => "Bearer secret"
  ]
])
```

##### Options

- `name`: The name of your webhook for your own reference (`string`)
- `url`: The URL that the webhook should trigger on a event (`string`)
- `secret`: Optional secret that you can use to secure the webhook endpoint (`string`)
- `events`: An array of events. Possible values are: document.created, document.updated, collection.created, collection.updated, tracker.new, lead.new, file.processed (`array`)
- `headers`: Object of header keys and values that will be sent as request header on the webhook request (`object`)

#### Get a Webhook

```php
$cloudpdf.getWebhook("WEBHOOK ID")
```

#### Update a Webhook

```php
$cloudpdf.updateWebhook("WEBHOOK ID", [
  "name" => "Webhook 1",
  "url" => "https://urltotrigger.com/",
  "events" => ["document.created"],
  "headers" => [
    "Authorization" => "Bearer secret"
  ]
])
```

##### Options

- `name`: The name of your webhook for your own reference (`string`)
- `url`: The URL that the webhook should trigger on a event (`string`)
- `secret`: Optional secret that you can use to secure the webhook endpoint (`string`)
- `events`: An array of events. Possible values are: document.created, document.updated, collection.created, collection.updated, tracker.new, lead.new, file.processed (`array`)
- `headers`: Object of header keys and values that will be sent as request header on the webhook request (`object`)

#### Delete a Webhook

```php
$cloudpdf.deleteWebhook("WEBHOOK ID")
```

#### List all Webhooks

```php
$cloudpdf.listWebhooks()
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cloudpdf-io/cloudpdf-php.

## License

The repository is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

repository: cloudpdf-io/cloudpdf-php

repo_name: cloudpdf-io/cloudpdf-php


text:
# Alphabet-Daily-Tasks
A repository for solutions to the daily tasks in the [\*\*AlphaBet\*\* server](https://alphabetcommunity.tech).

## Repository layout
The repository is organized in folders, each with a name of the year the tasks are from. In those folders, there is a folder for each language. In those folders there are files for the corresponding tasks.
Example:
```console
2021
|---java
    |---Day0101.java
|---clojure
    |---day0101.clj
```

## Naming conventions
The name of a file should be in the format `(day|Day)date.ext` where:
* `(day|Day)` is either `day` or `Day` depending on the language's naming conventions;
* `date` is the date in `mmdd` format;
* `ext` is the extension for the language.
Example: `Day0104.java`, `day0106.clj`

## Contribution
If you want to add a solution of yours, follow the layout and naming conventions of the repository. Make a branch with your name and create a pull request. Your code should be runnable right away and should print the answers to the test cases provided in a somewhat readable way:
This output won't be accepted:
```console
0 2 198 false false true "zkkov" "Svool dliow!"
```
This output will be accepted:
```console
0 2 198
false false true
"zkkov" "Svool dliow!"
```
This output won't be accepted:
```console
0
2
198
false
false
true
"zkkov"
"Svool dliow!"
```
This output will be accepted:
```console
0
2
198
-----
false
false
true
-----
"zkkov"
"Svool dliow!"
```
---
Make a comment at the top with your Discord name and discriminator (e.g. `Loading BG#7962`). If there is already a solution in the same language for the same day, add something to the name to make it different (e.g. `Day0101_2.java`). Filenames like `Day0101_hubvoiernvapmv.java` won't be accepted. If you can't use Git, DM me (`Loading BG#7962`) with the file and I'll add it.

## Other repositories
[Gauravsingh#6969's repo](https://github.com/gauravsingh5/tasks) for Python and C++.

repository: LoadingBG/Alphabet-Daily-Tasks

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: LoadingBG/Alphabet-Daily-Tasks


text:
---
layout: default
---

# 1994-09-02 - More signs that key escrow is coming

## Header Data

From<EMAIL_ADDRESS>(Timothy C. May)

To<EMAIL_ADDRESS>(Lucky Green)

Message Hash: 51b59463d5fc26e8b162b339c10f42849b1c2ee5302c438f3e3719ebd4d3ec8f

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-09-02 07:59:25 UTC

Raw Date: Fri, 2 Sep 94 00:59:25 PDT

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Timothy C. May)
Date: Fri, 2 Sep 94 00:59:25 PDT
To<EMAIL_ADDRESS>(Lucky Green)
Subject: More signs that key escrow is coming
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Things seem awfully quiet on the list the past 24 hours....

Lucky Green wrote:

> This RFP contains the final specs for a new multimedia architecture the
> cable companies intend to deploy.
...
> ".c<IP_ADDRESS>.1  Security System Objectives:
>  The Offeror shall specify [..] whether it is possible to hide information
> in the digital signature number of which the signer would be unaware, which
> could conceal information. "
>
> Such as parts of the key?

This sounds like it's a concern about subliminal channels in the
DSS/DSA signatures, a la the concerns raised by Gus Simmons last year.
I don't know what the use would be, unless it's concern (by whom?)
that viewing preferences could be back-propagated.

> and under .c<IP_ADDRESS>    Privacy:
> " It should be possible to manage encryption keys and provide them to law
> enforcement agencies on demand."

Well, this definitely fits with other signs that the Feds have been
"jawboning" with various industry groups. Key escrow, or "GAK."

If they're putting this kind of thing into their spec plans, somebody
has "suitably incentivized" them to.

--Tim May

--
..........................................................................
Timothy C. May         | Crypto Anarchy: encryption, digital money,
<EMAIL_ADDRESS>     | anonymous networks, digital pseudonyms, zero
408-688-5409           | knowledge, reputations, information markets,
W.A.S.T.E.: Aptos, CA  | black markets, collapse of governments.
Higher Power: 2^859433 | Public Key: PGP and MailSafe available.
"National borders are just speed bumps on the information superhighway."

{% endraw %}
```

## Thread

+ Return to [September 1994](/archive/1994/09)

+ Return to<EMAIL_ADDRESS>(Lucky Green)](/authors/shamrock_at_netcom_com_lucky_green_)"
+ Return to "[solman@MIT.EDU](/authors/solman_at_mit_edu)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1994-09-02 (Thu, 1 Sep 94 23:21:36 PDT) - [Cabel TV's new specs require leaky encryption](/archive/1994/09/c23e7c88e48ca9fd3990e6a484ab052941c1c359e9c3a60ae130af8f74c93bb6) -<EMAIL_ADDRESS>(Lucky Green)_
  + 1994-09-02 (Fri, 2 Sep 94 00:59:25 PDT) - More signs that key escrow is coming -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1994-09-02 (Fri, 2 Sep 94 06:38:45 PDT) - [Re: Cabel TV's new specs require leaky encryption](/archive/1994/09/4b508756e7eed403c1616d80d479052690c58273cbaa9e697fcc785721207893) -<EMAIL_ADDRESS>

license: MIT

gha_license_id: MIT


text:
# Developer guide

This guide describes how to setup a development environment for building and running

- Nextclade CLI executable
- Nextalign CLI executable
- Nextclade Web and Nextclade WebAssembly module

## Developing locally

### Nextclade CLI and Nextalign CLI

Nextclade CLI and Nextalign CLI are written in Rust. The usual `rustup` & `cargo` workflow can be used:

```bash
# Clone Nextclade git repository
git clone https://github.com/nextstrain/nextclade
cd nextclade

# Install Rustup, the Rust version manager (https://www.rust-lang.org/tools/install)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add Rust tools to the $PATH
export PATH="$PATH:$HOME/.cargo/bin"

# [Linux only] install openssl and pkgconfig. Example for Ubuntu:
sudo apt-get update
sudo apt-get install --yes libssl-dev pkg-config

# Prepare dotenv file with default values
cp .env.example .env

# Build Nextclade and use it to download a dataset to ./data_dev/
# In later commands, a dataset is expected to be in ./data_dev/, refer to Nextclade dataset information
# (https://docs.nextstrain.org/projects/nextclade/en/stable/user/datasets.html#download-a-dataset)
cargo run --bin=nextclade -- dataset \
  get --name=sars-cov-2 \
  --output-dir=data_dev/

# Build and run Nextclade in debug mode (convenient for development, fast to build, slow to run, has debug info)
# Refer to the user documentation for explanation of Nextclade CLI flags (https://docs.nextstrain.org/projects/nextclade/en/stable/)
cargo run --bin=nextclade -- run \
  data_dev/sequences.fasta \
  --input-dataset=data_dev/ \
  --output-fasta='out/nextclade.aligned.fasta' \
  --output-tsv='out/nextclade.tsv' \
  --output-tree='out/nextclade.tree.json' \
  --in-order \
  --include-reference

# Build Nextclade in release mode (slow to build, fast to run, no debug info)
cargo build --release --bin=nextclade

# Run Nextclade release binary
./target/release/nextclade run \
  data_dev/sequences.fasta \
  --input-dataset=data_dev/ \
  --output-fasta='out/nextclade.aligned.fasta' \
  --output-tsv='out/nextclade.tsv' \
  --output-tree='out/nextclade.tree.json' \
  --in-order \
  --include-reference

# Add -v flags to increase verbosity of output
# nextclade run ... -vv

# To build Nextalign, replace 'nextclade' with 'nextalign'
# cargo build --release --bin=nextalign

```

### Nextclade Web

Nextclade Web is a React Typescript application, which relies on Nextclade WebAssembly (wasm) module to perform the computation.
The WebAssembly module shares the algorithms Rust code with Nextclade CLI. So building Nextclade Web involves 2 steps: building WebAssembly module and building the app itself.

Install Node.js version 14+ (latest LTS release is recommended), by either downloading it from the official website: https://nodejs.org/en/download/, or by using [nvm](https://github.com/nvm-sh/nvm). We don't recommend using Node.js from the package manager of your operating system, and neither from conda or other sources.

Let's build the WebAssembly module:

<details>
<summary>Show extra requirements for macOS</summary>

For macOS, you will also have to install llvm:

```bash
brew install llvm
```

Furthermore, you will need to set the following environment variables before invoking `yarn wasm-prod`:

```bash
export CC=/opt/homebrew/opt/llvm/bin/clang
export AR=/opt/homebrew/opt/llvm/bin/llvm-ar
```
</details>

```bash
# Clone Nextclade git repository
git clone https://github.com/nextstrain/nextclade
cd nextclade

# Install Rustup, the Rust version manager (https://www.rust-lang.org/tools/install)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add Rust tools to the $PATH
export PATH="$PATH:$HOME/.cargo/bin"

# Prepare dotenv file with default values
cp .env.example .env

# Install wasm-pack
cargo install wasm-pack
cargo install wasm-opt

cd packages_rs/nextclade-web

# Install dependency packages
yarn install

# Run wasm-pack to build the WebAssembly module in release mode
yarn wasm-prod

# Alternatively, to build in debug mode (much much slower to run, but more debug info)
# yarn wasm-dev

```

The WebAssembly module and accompanying Typescript code should have been generated into `packages_rs/nextclade-web/src/gen/`,
and now the web app should be able to find it.

Let's build build and run the web app (it's convenient to do it in a separate terminal instance from WebAssembly module build):

```bash
# Build and run web app in dev mode
cd packages_rs/nextclade-web
yarn install
yarn dev
```

Open `http://localhost:3000/` in the browser. Code changes should trigger rebuild and fast refresh of the app.

The optimized production version of the web app can be built with

```bash
yarn prod:build
yarn prod:serve
```

Open `http://localhost:8080/` in the browser.

The resulting files should be available under `packages_rs/nextclade-web/.build/production/web`. They can be served by any static webserver or static file hosting (`https://clades.nextstrain.org` uses AWS S3 + Cloudfront). `yarn prod:serve` is just an example of a simple webserver that serves files locally.

### Linting (static analysis)

#### Linting Rust code

Rust code is linted with [Clippy](https://github.com/rust-lang/rust-clippy):

```bash
cargo clippy
```

Automatic fixes can be applied using:

```bash
cargo clippy --fix
```

Clippy is configured in `clippy.toml` and in `.cargo/config.toml`.

For routine development, it is recommended to configure your text editor to see the Rust compiler and linter errors.

##### In [VSCode](https://code.visualstudio.com/):

Make sure you have ["Rust Analyzer" extension](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) (and not deprecated "Rust" extension), and configure it to use clippy: hit Ctrl+Shit+P, then find "Preferences: Open user settings (JSON)", then add:

```
"rust-analyzer.check.command": "clippy",
```

Now the warnings and errors will be shown as yellow and red squiggles.  Sometimes there will be a link in the bottom of the tooltip to apply a "Quick fix" for this particular mistake. And there is also a light bulb in the editor to do the same.

You can disable the pesky inline type hints (for all languages) by adding this to your preferences JSON:

```
"editor.parameterHints.enabled": false,
"editor.inlayHints.enabled": "off",
```

An extension ["Error lens"](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) allows to see error and warning text inline in the editor.

##### In Intellij CLion:

In main menu, "File | Settings | Languages & Frameworks | Rust | External Linters", set "External tool" to "Clippy" and check the checkbox "Run external linter to analyze code on the fly".

#### Linting Typescript and JavaScript

The web app is linted using [eslint](https://github.com/eslint/eslint) and [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html) as a part of development command, but the same lints also be run separately:

```bash
cd packages_rs/nextclade-web
yarn lint
```

The `eslint` configuration is in `.eslintrc.js`. `tsc` configuration is in `tsconfig.json`.

### Formatting (code style)

```bash
cargo fmt --all
```

```bash
cd packages_rs/nextclade-web
yarn format:fix
```

## Trying custom datasets locally

### Prepare and serve datasets locally

- Build a fresh dataset directory as described in the [nextstrain/nextclade_data](https://github.com/nextstrain/nextclade_data) repo. At the time of writing it simply means to run `./scripts/rebuild` and to observe the `data_output/` created, containing the dataset files and associated index files
- Serve datasets directory locally using any static file server. [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) should be enabled on the server. For example, using `serve` package from NPM:
  ```bash
  npx serve@latest --cors --listen=tcp://<IP_ADDRESS>:27722 data_output/
  ```
  In this example, files should be available at
  ```
  http://localhost:27722/
  ````
  in particular, you should be able to download `index_v2.json` using

  ```bash
  curl http://localhost:27722/index_v2.json
  ```
  or when navigating to this address in the browser.

### Temporarily use custom dataset server with Nextclade CLI

Run the usual `dataset list` and dataset `get commands`, with an additional flag:

```
--server=http://localhost:27722
```

This will tell Nextclade to use the local server for dataset queries.

### Temporarily use custom dataset server with Nextclade Web

Add the `dataset-server` URL parameter with value set to URL of the custom dataset server:

```url
https://clades.nextstrain.org?dataset-server=http://example.com
```

Local URLs should also work:

```url
https://clades.nextstrain.org?dataset-server=http://localhost:27722
```

> ⚠The linked resources should be available for fetching by a web browser on the client machine. Make sure [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is enabled on your file server as well as that all required authentication (if any) is included into the file URL itself.

> ⚠The URLs might get quite complex, so don't forget to [encode the special characters](https://en.wikipedia.org/wiki/Percent-encoding), to keep the URLs valid.

### Permanently configure Nextclade CLI and Nextclade Web to use custom dataset server

Open `.env` file in the root of the project (if you don't have it, create it based on `.env.example`) and set the `DATA_FULL_DOMAIN` variable to the address of your local dataset server. In the example above it would be:

```
DATA_FULL_DOMAIN=http://localhost:27722
```

Rebuild Nextclade CLI and it will use this address by default for all dataset requests (without need for the additional `--server` flag).

Rebuild Nextclade Web and it will use this address by default for all dataset requests (without need for the additional `dataset-server` URL parameter).

Note that this address will be baked into the CLI binaries or into the Web app permanently. Switch to the default value and rebuild to use the default dataset server deployment again.

Any network location can be used, not only localhost.

The same mechanism is used during CI builds for master/staging/production environments, to ensure they use their corresponding dedicated dataset server.

## Maintenance

There are 2 release targets, which are released and versioned separately:

- CLI (Nextclade CLI and Nextalign CLI are released together)
- Web application

### Versioning

Nextclade project tries hard to adhere to [Semantic Versioning 2.0.0](https://semver.org/)

### Releasing new CLI version

- Checkout the branch and commit you want to release. Theoretically, you can release any commit, but be nice and stick to releases from master.
- If you are making a stable release, make sure to fill the CHANGELOG.md and commit changes to your branch. Pay particular attention to headings: CI will extract the text between the two first `##` headings, in a very silly way, and will use this text as release notes on GitHub Releases.
- Make sure there are no uncommitted changes.
- Follow comments in the script `./scripts/releases` on how to install dependencies for this script.
- Run `./scripts/releases cli <bump_type>`, where `bump_type` signifies by how much you want to increment the version. It should be one of: `major`, `minor`, `patch`, `rc`, `beta`, `alpha`. Note that `rc`, `beta` and `alpha` will make a prerelease, that is - marked as "prerelease" on GitHub Releases and not overwriting "latest" tags on DockerHub.
- Verify the changes the script applied:
  - versions are bumped as you expect in all Cargo.toml and Cargo.lock files.
  - a local commit created on branch `release-cli` with a message containing the version number that you expect
- The script will ask if you want to push the changes. This is the last step. If you agree, then the changes will be pushed to GitHub and CI will start a build. You can track it [here](https://app.circleci.com/pipelines/github/nextstrain/nextclade). If you refuse this step, you can still push later.

### Releasing new Web version

- There are 3 websites exist, for master, staging and release environments. They map to master, staging and release git branches. Pick an environment you want to deploy the new version to and checkout the corresponding branch.
- If you are deploying to release, make sure to fill the CHANGELOG.md and commit changes to your branch. Pay particular attention to headings: CI will extract the text between the two first `##` headings, in a very silly way, and will use this text as release notes on GitHub Releases.
- Make sure there are no uncommitted changes.
- Follow comments in the script `./scripts/releases` on how to install dependencies for this script.
- Run `./scripts/releases web <bump_type>`, where `bump_type` signifies by how much you want to increment the version. It should be one of: `major`, `minor`, `patch`, `rc`, `beta`, `alpha`. It is advised against releasing `rc`, `beta`, `alpha` to release environment.

If you want to deploy the same version to multiple environments, then release to one environment (on one branch) and then promote it to other environments: manually fast-forward other branch(es) to this commit and push.

repository: nextstrain/nextclade

gha_language: Rust

repo_name: nextstrain/nextclade


text:
---
layout: post
title: "Getting More Out of Deferreds"
date: 2012-04-01 06:29
comments: true
categories:
---

# Getting More Out of Deferreds

When jQuery [introduced deferreds and promises in the 1.5 release](http://rmurphey.com/blog/2010/12/25/deferreds-coming-to-jquery/), it gave jQuery users a new and much-improved way of dealing with the asynchronicity of JavaScript; with deferreds, it's possible to attach callbacks to asynchronous operations like XHRs after the operation has already begun:

{% codeblock lang:javascript %}
	function makeRequest(url) {
		return $.ajax({url : url });
	}

	var req = makeRequest('my-content.html');

	req.then(successCallbackFn, errorCallbackFn);
	req.then(anotherSuccessCallbackFn);
{% endcodeblock %}

Both promises and deferreds give you the ability to react to the outcome of an operation, either now if the operation has already "resolved"; or later, when the operation is finally resolved. Since their arrival in jQuery and the arrival of a handy [Underscore implementation](https://github.com/wookiehangover/underscore.Deferred), I've seen lots of code incorporating them.

## Creating your own deferreds

## Working with maybe-asynchronous operations

## Pre-processing the result of an async operation

repository: rmurphey/blog-octopress

extension: markdown

repo_name: rmurphey/blog-octopress


text:
# Using SimpleContent with Simple Auth and NoDb

This sample uses [cloudscribe SimpleAuth](https://github.com/joeaudette/cloudscribe.Web.SimpleAuth) which is best suited for projects where only one or a few people need to be able to login. Users are pre-configured in the simpleauth-settings.json file, and project settings are configured in the simplecontent-settings.json file. The sample uses NuGet packages for cloudscribe SimpleContent and cloudscribe SimpleAuth. A good way to setup your own site is to use this sample. You can publish it from Visual Studio as it is or you can customize it by adding your own code and/or projects.

This sample uses [NoDb](https://github.com/joeaudette/NoDb) file system storage for content and data. NoDb is a "No Database" file system storage, it is also a "NoSql" storage system.

You can login to the sample with admin as the username and admin as the password

Be sure to update the credentials in the simpleauth-settings.json file before deployment.

If you have questions or just want to be social, say hello in our gitter chat room. I try to monitor that room on a regular basis while I'm working, but if I'm not around you can leave  message.

### Publishing

Note that the .csproj settings are configured to exclude the nodb_storage folder from publishing. That folder is where the data is stored, so we generally don't want to overwrite production data when we redeploy. However for the first deployment you should add this folder manually.

[![Join the chat at https://gitter.im/joeaudette/cloudscribe](https://badges.gitter.im/joeaudette/cloudscribe.svg)](https://gitter.im/joeaudette/cloudscribe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

gha_language: C#


text:
# JHU/APL pubgeo
JHU/APL is committed to advancing the state of the art in geospatial computer vision by advocating for public data sets
and open source software. For more information on this and other efforts, please visit [JHU/APL](http://www.jhuapl.edu/pubgeo.html).

## annote
>annote is a Matlab based framework for labeling imagery

#### Matlab Requirements
* Minimim Version:
 * R2014b

* Toolboxes
 * image_toolbox

###  Usage

     >> SceneCat

>See help.html for more info

SceneCat is a baseline implementation of the annote framework

repository: pubgeo/AnnoteGeo

repo_name: pubgeo/AnnoteGeo


text:
# Back-End

# WATER MY PLANTS - Build Week
## Table of Contents
- **[Overview](#overview)**

- **[API Endpoints](#api-endpoints)**

- **[Credits](#credits)**

## Overview
This database allows users to register, login, and add their houseplants as plant objects to make it easy to track when to water which plant.
## API Endpoints
### Authentication
Method | Endpoint | Body (required) | Body (optional) | Notes
| ----- | ----------------- | -------------------- | --------------------- | ------------------ |
POST | /api/signup | username (string), password (string), phoneNumber (10-digit string) | N/A | Creates a new user object in the database. On success, returns message "sign up successful" and newUser object with id and username. |
POST | /api/login |  username (string), password (string) | N/A | Logs in users who already exist in the database. On success, returns message "login successful" and JSON Web Token. If unregistered users try to log in, returns "invalid username or password" |
### Users
Method | Endpoint | Body (required) | Body (optional) | Notes
| ----- | ----------------- | -------------------- | --------------------- | ------------------ |
PUT | /api/users/:id | either password (string), or phoneNumber (10-digit string); or both | N/A | Updates the user with this id, and returns message "user updated successfully". |
### Plants
Method | Endpoint | Body (required) | Body (optional) | Notes
| ----- | ----------------- | -------------------- | --------------------- | ------------------ |
GET | /api/plants | N/A | N/A | Returns all the plants associated with this registered user |
GET | /api/plants/:id |  N/A | N/A | Returns plant object associated with this id |
POST | /api/plants | nickname (string), species (string), h2oFrequency (string) | image (string of the url) | Creates new plant object and returns it. |
PUT | /api/plants/:id |  at least one of the optional properties | nickname (string), species (string), h2oFrequency (string), or image (string of the url) | Updates the plant with this id, returns message "plant updated" |
DELETE | /api/plants/:id | N/A | N/A | Deletes the plant with this id from the database, returns message "plant deleted" |

## Credits
### Project Manager
Vick Javariz: https://github.com/javavick
### User Interface
Teagan Keith: https://github.com/Teagankeith
### Frontend
Ben Simpson: https://github.com/TheTechSurgeon

Rachele Edwards: https://github.com/berachele
### Backend
Katya Pavlopoulos: https://github.com/kp1129

Wesley Ruedebusch: https://github.com/wesley-ruedebusch

repository: TheTechSurgeon/Back-End

repo_name: TheTechSurgeon/Back-End


text:
# Document Uploads
## Overview
### Objective
Create a document upload workflow that abstracts away the process of uploading, verifying, and converting a document.

### Background
Although VA.gov is moving many forms online the site often needs supporting scanned documents or the ability to send PDFs of our forms to other systems within the VA.

## Contacts
### VA:
VA Business Owner: N/A
### DSVA:
- Product Owner: Andrea Schneider ([Andrea.Schneider@va.gov](mailto:Andrea.Schneider@va.gov))
### Ad Hoc:
- Sprint Team: Apps Team 1 / Unicorns ([#unicorns-team](https://dsva.slack.com/archives/C5AGLBNRK))
- Product Manager: Mark Greenburg ([mark.greenburg@adhocteam.us](mailto:mark.greenburg@adhocteam.us))
### EVSS:
 - Michael Walker (Insignia / EVSS Sustainment): ([Michael.Walker10@va.gov](mailto:Michael.Walker10@va.gov))

## Keywords
Document Upload, EVSS documents, upload attachments, attachment upload, attach files

### Current Status
- Claims Status and 526EZ (Disability Compensation) utilize document upload support and are ultimately sent to the EVSS document upload service
- Some other applications leverage document upload support but ultimately send documents to non-EVSS APIs
  - Pensions/Burials, HCA, Preneed, VICv2

More information on the current design (specific to endpoints that utilize the EVSS documents service) can be found [here](./document_upload_workflow.md)

## Testing
Testing this feature is somewhat difficult because it's isn't a standalone feature but rather a part of larger forms / applications. Several upload pages can be found in the 526 v2 form flow, which you can find out how to test [here](/Products/Disability/Disability%20526EZ/21-526EZ.md).

## Error Handling
Please see [upload processing section](./document_upload_workflow.md#syncronous-pre-upload-processing) of the engineering design doc

## API Calls & Dependencies
Document uploads for specific applications / form typically have separate `vets-api` endpoints:
- Claim Status: `claim_attachments`
- HCA v2: `hca_attachments`
- Preneed: `preneed_attachments`
- VICv2: `profile_photo_attachments`, `supporting_documentation_attachments`
- 526: `upload_supporting_evidence`

With the exception of the upstream service that documents are ultimately submitted to (e.g., for Claims Status that would be the EVSS Documents Service), the dependencies and call flow are basically the same. I.e., uploads are submitted to vets-api, which processes & validates them and stores them in S3. At some later point, these documents can be retrieved and submitted to whatever service needs them.

Here's a sample diagram:
![Document Upload Sequence Diagram](./file_upload_sequence.png "Document Upload Sequence Diagram")

## Open Issues & Future Work
[Future Work Ideas](./document_upload_workflow.md#future-work)

Currently, bugs are not being tracked centrally but rather within the applications that each individual file uploader is embedded.

## Monitoring & Service Level Objectives
**Availability:** Should not exceed 5% 5xx error rates (as a percent of all requests) for more than 5 consecutive minutes [Link](https://github.com/department-of-veterans-affairs/devops/blob/55354cd6cc325bb4a9672576006cbda14c0a7488/ansible/deployment/config/prometheus/rules/application.rules#L6)

**Latency:**
  - `claim_documents`, `claim_attachments`: Percent of requests served in under 10 seconds should not drop to or below 95% for more than 5 consecutive minutes [Link](https://github.com/department-of-veterans-affairs/devops/blob/55354cd6cc325bb4a9672576006cbda14c0a7488/ansible/deployment/config/prometheus/rules/application.rules#L24)
  - All others: Percent of requests served in under 2 seconds should not drop to or below 95% for more than 5 consecutive minutes [Link](https://github.com/department-of-veterans-affairs/devops/blob/55354cd6cc325bb4a9672576006cbda14c0a7488/ansible/deployment/config/prometheus/rules/application.rules#L15)

**Incident Response:** Each critical availability / latency issue (per above) should be acknowledged within 15 minutes of a triggered alert [Link](https://github.com/department-of-veterans-affairs/devops/blob/2913da3512a65a8cb988ad189235794ed1067299/terraform/modules/pagerduty_team/main.tf#L21)


text:
### Machine Learning Employee Turnover Prediction

Employee Turnover Rate is the measurement of the number of employees who leave an organization during a specified time period, typically one year.

Note: It's also applicable to sub departments in an organization.

Accuracy of the trained/tested models -

Achieved higest accuracy with Random forests

![image](https://user-images.githubusercontent.com/13360641/111073345-55c0e380-8504-11eb-8318-0f4a2c69bf0f.png)

LinkedIn - https://www.linkedin.com/in/tejasta/

Email Id -<EMAIL_ADDRESS>

Blogs - https://tejasta.medium.com/

branch_name: refs/heads/main


text:
# Simple Golang CloudNative App

This is a sample sample repo will explain how you build simple golang app locally , contanairze it and deploy into a Kubernetes cluster. You can check GitHub actions for sample PR builds and CI builds.

 In the second part I propose Ideal workflow for CI/CD piplene.

## Fixes

*Changing quote v3 import -> [make quote v3 as a named import · lkravi/golang@1bcbb58 · GitHub](https://github.com/lkravi/golang/commit/1bcbb58eb0785d30b5bde4602f4cddb433d41fbf)*

Changing localhost to multicast -> [making localhost to multicast, to serve all incoming requests instead… · lkravi/golang@e1c47c4 · GitHub](https://github.com/lkravi/golang/commit/e1c47c44b2389aa73c1ea8a5dce78181bf1ef105)

Changing Docker file to multi-stage build -> https://github.com/lkravi/golang/commit/8354e996bd2870ae2420e1219c64bd117bdb348a

## Test Golang app locally

```
go mod init github.com/lkravi/golang
go mod tidy
go build -o golang-test
./golang-test
```

This will bring up the web-server on port 8000. You can check your browser

## Build Docker Image

We are using multi-stage docker build as we don't need to include build dependencies in to running container.

```
docker build . -t golang-test

#Check docker container locally
docker run -p 8000:8000 golang-test
```

## Deploying to Kubernates Cluster

You can find sample yaml files for kubernates deployment inside the /k8s directory.

```
kubectl apply -f k8s/deployment.yaml

#Check your service locally using port-forwading
kubectl port-forward service/golang-test-service 8000:80
```

------------------------

##

# Ideal CI/CD Pipeline

![Alt text](/doc_img/ci-cd-ideal.png?raw=true "Ideal CI/CD Pipleline")

## 01 - PR build and CI build on merge

* Run Unit tests
* Static code analysis
  - SonarQube
    - Inspection of code quality to perform review to detect code smells, security vulnerabilities and bugs.
  - Fortify / CheckMarks
    - Static application security testing tool for scan security vulnerabilities.
  - Lint Tools
    - Lint tool used to check for programmatic and stylistic errors.
* Build failure notifications / JIRA ticket upgrade etc.
* Build artefacts on merge builds. tag them as snapshot/dev and upload to artefact repository.
* Deploy that artefact to development environment.

Pull requests merged after quality gate checks and code review approvals.

## 02 - Release branch builds

* Run Unit tests
* Static code analysis
  - Refer step #1 for more detail
* Dynamic code analysis
  - Fortify Webinspect / App Spider
    - Dynamic application security testing tool that identifies application vulnerabilities in deployed web application and services.
* Build artefacts on merge builds, tag them with correct version (git tags) and upload to artefact repository.
* Artefact analysis
  - Twistlock / Trivy / Clair
    - Vulnerability scanners for container images.
  - Nexus IQ
    - Policy violations, Security Issues, License analysis
* Deploy that artefacts to Test Environment.

When feature completed or when development branch needed to work on next release changes. we need to create a release branch.
Release branch builds will create versioned artefact which can promote across Test, UAT, Production based on verification success.

## 03 - Continuous deployment

* Deploy to Staging and Production on demand using push button deployments.
  - Promote artefacts to Staging/UAT and Production environments using continuous deployment mechanisms.
    - Can use specialised tools like GitOPS (Flux, ArgoCD), GoCD for continuous deployment.
    - Use Infrastructure as code scripts to maintain environment states/resources.

Deployment artefacts are configured to take environment variable based parameters/ k8s cluster based secrets and config maps to support different environment configurations.

![Alt text](/doc_img/k8-cluster.png?raw=true "Ideal CI/CD Pipleline")

* Application configurations are stored in config maps.
* Application sensitive information stored in cluster secrets.
* Each pods have health-check routes and deployments configured Kubernates pod health-checks.
* Ingress proxy(nginx, traefik) is configured to handle and route external requests to correct services.
  - In this setup TLS termination happen in Load Balancer level.
  - However based on the requirement if we need to manage our own cert-manager and TLS termination inside the cluster. It can be done using a tool like jetstack cert manager.
* RABC configured to control resources changes/ unauthorised access to cluster.
* Rolling released based deployment ensure zero outage deployments.

## Additional Notes

SonarCloud : https://sonarcloud.io/summary/overall?id=lkravi-golang

Docker Image : [Docker Hub](https://hub.docker.com/r/lkravi/golang-test/tags)

repository: lkravi/golang

branch_name: refs/heads/develop

gha_language: Go

repo_name: lkravi/golang


text:
# Step 6. Using the OpenStack CLI

It should also be possible to SSH to the VM itself to get access to the local set of CLI tools (and the configuration files and application components.).

CLI access is restricted to the admin; however, once within the CLI you can execute OpenStack CLI command as either admin or another user (note use of the "openrc" file later in this step).

Let’s use the CLI to launch a second VM (e.g. cli_vm).
To access the CLI (you can do this either from a terminal on your laptop or via the graphical interface of the VM itself):

```bash
ssh<EMAIL_ADDRESS># password Cisco!Devnet
source ./openrc           	# configures access to CLI as demo
nova boot --flavor m1.tiny --image cirros --nic net-name=private_network cli_vm	#launch VM
```
This should result in a second VM, named “cli_vm” being started, and output similar to the following in the CLI:

![](/posts/files/openstack-install/images/image-step7-1.png)

The OpenStack component used to launch the VM was “nova”. The OpenStack component used to interact with the network is “neutron”. From the CLI, to see the same public and public networks we saw previously via the Horizon UI, use the command “neutron net-list”.

```bash
neutron net-list
```

![](/posts/files/openstack-install/images/image-step7-2.png)

As promised previously, let's have a look where the credentials we have been using are stored.

```bash
cat /home/osdev/openrc
```
![](/posts/files/openstack-install/images/image-step7-3.png)

To see the docker containers that are running, execute the command:

```bash
docker ps -a
```
![](/posts/files/openstack-install/images/image-step7-4.png)

To get into any container and inspect, execute the command:

```bash
docker exec -it <container_name> bash
```

For example, to enter the Nova compute container, execute the following command:
```bash
docker exec -it nova_compute bash
```

The configuration for OpenStack components can generally be found at "/etc/< component-name >/< component-name >.conf" (e.g. /etc/nova/nova.conf).

```bash
cat /etc/nova/nova.conf | more
```

![](/posts/files/openstack-install/images/image-step7-5.png)

Note the location of the log file is specified in this file as well (e.g. log_dir =/var/log/kolla/nova).
So to see Nova compute logs inside the nova compute container, execute the following command:
```bash
tail -n 100 /var/log/kolla/nova/nova-compute.log
```

![](/posts/files/openstack-install/images/image-step7-6.png)

To exit the Nova compute container, type exit

```bash
exit
```

#### Kolla First steps

The OpenStack environment running in the VM was built and deployed using Kolla. To see the Kolla code, log into the VM as the osdev user (password Cisco!Devnet). ~vagrant/kolla is the git checkout of the kolla code used to build the Docker containers in which OpenStack is running (Note: use sudo to cd into the directory if there are permission issues). ~vagrant/kolla/tools has various utilities which can be used to bring down, remove, rebuild, or redeploy the Docker containers which deliver OpenStack. In addition, there is a Docker registry running on the VM (on TCP port 4000) which is used to store the built Docker containers. /etc/kolla has the configuration files which were used to configure Kolla and the OpenStack services delivered by Kolla. You have full root level access so can further configure and explore as needed for your purposes.

VirtualBox was selected for this demo because it is freely available and provides good cross-platform support. Because VirtualBox does not support nested virtualization Kolla has already been configured to use QEMU without KVM when bringing up VMs in the OpenStack cloud running inside of VirtualBox. This will impose a performance impact in comparison to using KVM-accelerated QEMU as is more typical with OpenStack, but the OpenStack guest VMs should still be performant enough to use for experimentation and learning.

That concludes this lab. You have completed the installation of OpenStack, including verifying access and exploring a bit using both the Horizon UI and the CLI.

### Welcome to OpenStack. Now feel free to explore on your own!

repository: maitrenem/openstack-kolla

repo_name: maitrenem/openstack-kolla


text:
# Accessories for the 3D Sets Landy

Aug 1, 2023 by [Mike Thomas](https://github.com/mikepthomas),
Updated August 10, 2023

Printing Upgrades and Accessories for the [3D Sets Landy](https://3dsets.com/product/model-3-landy-4x4-pickup/)

---

## Table of contents

1. [Rock Sliders and Grill](#rock-sliders-and-grill)
1. [Car Hauler](#car-hauler)
1. [Street Accessory](#street-accessory)
1. [Storage Box](#storage-box)

## Rock Sliders and Grill

![3D Sets Landy Rock Sliders and Grill](https://3dsets.com/wp-content/uploads/2021/12/PB170056-1-scaled-1-3-900x675.jpg)

> Image © 2022 [3D Sets](https://3dsets.com/)

| Item                        | Quantity | Material                                                  | Printed | Notes |
| --------------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Fan                         | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Grill with light protection | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)   |   :x:   |       |
| Rock Slider A - left        | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)   |   :x:   |       |
| Rock Slider A - right       | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)   |   :x:   |       |

## Car Hauler

![3D Sets Car Hauler](https://3dsets.com/wp-content/uploads/2022/06/img-599-900x600.jpeg)

> Image © 2022 [3D Sets](https://3dsets.com/)

### Sourcing Parts

#### Motion

| Item                                     | Quantity | Received | Notes |
| ---------------------------------------- | -------- | -------- | ----- |
| Ball Bearing 10x15x4 mm - 6700RS         | 8        | 100      |       |
| Rubber tires - OD: 90-100mm, ID: 46-48mm | 4        | 4        |       |
| Shock/Coil springs - 55-75mm             | 4        | 4        |       |

#### Fasteners

| Item       | Quantity | Received | Notes |
| ---------- | -------- | -------- | ----- |
| M2x6 SHCS  | 80       | 200      |       |
| M2x8 SHCS  | 4        | 50       |       |
| M2x10 SHCS | 5        | 100      |       |
| M2x12 SHCS | 24       | 50       |       |
| M3x6 BHCS  | 4        | 39       |       |
| M3x8 BHCS  | 16       | 91       |       |
| M3x10 BHCS | 40       | 100      |       |
| M3x12 BHCS | 18       | 147      |       |
| M3x16 BHCS | 26       | 135      |       |
| M3x20 BHCS | 1        | 25       |       |
| M3x6 SHCS  | 4        | 10       |       |
| M3 nuts    | 13       | 42       |       |
| M5x12 SHCS | 1        | 10       |       |

### Printing Parts

### Chassis 1

| Item                      | Quantity | Material                                                  | Printed | Notes |
| ------------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Chassis - front           | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis Connector - front | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Pole                      | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Chassis 2

| Item              | Quantity | Material                                                  | Printed | Notes |
| ----------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Chassis - center  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis Connector | 2        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Chassis 3

| Item              | Quantity | Material                                                  | Printed | Notes |
| ----------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Chassis - rear    | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis Connector | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Chassis 4

| Item                  | Quantity | Material                                                  | Printed | Notes |
| --------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Chassis - front left  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis - front right | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis - rear left   | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Chassis - rear right  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Truss 1

| Item                     | Quantity | Material                                                          | Printed | Notes |
| ------------------------ | -------- | ----------------------------------------------------------------- | :-----: | ----- |
| Side Truss - front left  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |
| Side Truss - front right | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |
| Side Insert - stripes    | 2        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |

**_NOTE:_** Stripes on the Side Insert can be achieved by making a Filament Change (M600) at layer 12.

### Truss 2

| Item                 | Quantity | Material                                                  | Printed | Notes |
| -------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Front Strut - left   | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Front Strut - right  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Front Truss - center | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Front Truss - left   | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Front Truss - right  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Truss 3

| Item                       | Quantity | Material                                                          | Printed | Notes |
| -------------------------- | -------- | ----------------------------------------------------------------- | :-----: | ----- |
| Side Truss - rear left     | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |
| Side Truss - rear right    | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |
| Side Insert Rear - stripes | 2        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |

**_NOTE:_** Stripes on the Side Insert can be achieved by making a Filament Change (M600) at layers 9 & 12.

### Fender 1

| Item                | Quantity | Material                                                  | Printed | Notes |
| ------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Fender - left       | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)   |   :x:   |       |
| Side Truss - center | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Fender 2

| Item                | Quantity | Material                                                  | Printed | Notes |
| ------------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Fender - right      | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)   |   :x:   |       |
| Side Truss - center | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Rear Bumper 1

| Item                | Quantity | Material                                                         | Printed | Notes |
| ------------------- | -------- | ---------------------------------------------------------------- | :-----: | ----- |
| Light - left        | 1        | [BasicFil PETG (Clear)](printer-filament.md#basicfil-petg-clear) |   :x:   |       |
| Light - right       | 1        | [BasicFil PETG (Clear)](printer-filament.md#basicfil-petg-clear) |   :x:   |       |
| Rear Bumper - left  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)        |   :x:   |       |
| Rear Bumper - right | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)        |   :x:   |       |

**_NOTE:_** Indicator and Brake lights can be added by making a Filament Change (M600) at layers 47 & 49.

### Rear Bumper 2

| Item          | Quantity | Material                                                          | Printed | Notes |
| ------------- | -------- | ----------------------------------------------------------------- | :-----: | ----- |
| Licence Plate | 1        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |

**_NOTE:_** Text can be added to the Licence Plate by making a Filament Change (M600) at layer 23.

### Floor

| Item                 | Quantity | Material                                             | Printed | Notes |
| -------------------- | -------- | ---------------------------------------------------- | :-----: | ----- |
| Floor - center front | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |
| Floor - front left   | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |
| Floor - front right  | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |
| Floor - center rear  | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |
| Floor - rear left    | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |
| Floor - rear right   | 1        | [eSun PLA (Wood)](printer-filament.md#esun-pla-wood) |   :x:   |       |

### Axle 1

| Item              | Quantity | Material                                                | Printed | Notes |
| ----------------- | -------- | ------------------------------------------------------- | :-----: | ----- |
| Axle Arm A        | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Arm B - left | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Arm C        | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Shaft        | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Axle Washer       | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Ball Joint        | 4        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |

### Axle 2

| Item               | Quantity | Material                                                | Printed | Notes |
| ------------------ | -------- | ------------------------------------------------------- | :-----: | ----- |
| Axle Arm A         | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Arm B - right | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Arm C         | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |
| Axle Shaft         | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Axle Washer        | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Ball Joint         | 4        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |

### Wheels

There is a choice of 2 different wheel styles.

| Item                | Quantity | Material                                                          | Printed | Notes |
| ------------------- | -------- | ----------------------------------------------------------------- | :-----: | ----- |
| Wheel I - Inner     | 4        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |
| Wheel I - Outer     | 4        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |
| Wheel I - wheel Hub | 4        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black)           |   :x:   |       |
| Wheel G - inner Rim | 4        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |
| Wheel G - outer Rim | 4        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver)         |   :x:   |       |

### Hitch

| Item            | Quantity | Material                                                  | Printed | Notes |
| --------------- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Hitch Cardan A  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Hitch Cardan B  | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |
| Pole Attachment | 1        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Spare Wheel

| Item              | Quantity | Material                                                | Printed | Notes |
| ----------------- | -------- | ------------------------------------------------------- | :-----: | ----- |
| Spare Wheel Mount | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |

### Storage Box

| Item              | Quantity | Material                                                | Printed | Notes |
| ----------------- | -------- | ------------------------------------------------------- | :-----: | ----- |
| Storage Box       | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Storage Box Cover | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |

### Loading Ramps

| Item | Quantity | Material                                                  | Printed | Notes |
| ---- | -------- | --------------------------------------------------------- | :-----: | ----- |
| Ramp | 2        | [eSun ABS+ (Silver)](printer-filament.md#esun-abs-silver) |   :x:   |       |

### Road Car Pad

| Item                 | Quantity | Material                                                | Printed | Notes |
| -------------------- | -------- | ------------------------------------------------------- | :-----: | ----- |
| Road Car Pad - front | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Road Car Pad - rear  | 2        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |

### Landy Rear Bumper

| Item               | Quantity | Material                                                | Printed | Notes |
| ------------------ | -------- | ------------------------------------------------------- | :-----: | ----- |
| Rear Bumper        | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Rear frame end     | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Trailer Hitch      | 1        | [eSun ABS+ (Black)](printer-filament.md#esun-abs-black) |   :x:   |       |
| Trailer Hitch Lock | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)     |   :x:   |       |

## Street Accessory

![3D Sets Street Accessory](https://3dsets.com/wp-content/uploads/2023/03/IMG_0015-900x600.jpg)

> Image © 2022 [3D Sets](https://3dsets.com/)

| Item              | Quantity | Material                                                          | Printed | Notes |
| ----------------- | -------- | ----------------------------------------------------------------- | :-----: | ----- |
| Road Block Mini   | 3        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red)               |   :x:   |       |
| Road Block Mini   | 3        | [eSun ABS+ (Cold White)](printer-filament.md#esun-abs-cold-white) |   :x:   |       |
| Traffic Cone Mini | 4        | [eSun ABS+ (Orange)](printer-filament.md#esun-abs-orange)         |   :x:   |       |

**_NOTE:_** Stripes on the Traffic Cone can be achieved by making a Filament Change (M600) at layers 73, 113, 166 & 206.

## Storage System

![3D Sets Storage System](https://3dsets.com/wp-content/uploads/2021/12/image-2-3-900x600.jpeg)

> Image © 2022 [3D Sets](https://3dsets.com/)

### Sourcing Parts

#### Misc

| Item                                         | Quantity | Received | Notes                                        |
| -------------------------------------------- | -------- | -------- | -------------------------------------------- |
| 3mm Hardboard 600x320                        | 2        | 4        |                                              |
| 3mm Hardboard 600x270                        | 2        | 4        |                                              |
| 3mm Hardboard 284x320                        | 2        | 4        |                                              |
| Textile strap 40-45 mm wide, 125-130 cm long | 1        | 2        | Have 50mm wide, will modify the mount to fit |

#### Fasteners

| Item       | Quantity | Received | Notes |
| ---------- | -------- | -------- | ----- |
| M3x8 BHCS  | 4        | 91       |       |
| M3x12 BHCS | 58       | 147      |       |

### Printing Parts

| Item                          | Quantity | Material                                            | Printed | Notes |
| ----------------------------- | -------- | --------------------------------------------------- | :-----: | ----- |
| Click-On Corner top left 4 A  | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Click-On Corner top right 4 A | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Click-On Corner top left 4 B  | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Click-On Corner top right 4 B | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner top right 3            | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Connector                     | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner bottom left 1          | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner bottom right 1         | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner bottom left 2          | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner bottom right 2         | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner top left 3             | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Corner top right 3            | 1        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Side Handle                   | 2        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |
| Tyre Support                  | 4        | [eSun ABS+ (Red)](printer-filament.md#esun-abs-red) |   :x:   |       |

**_NOTE:_** I have [modified the 3D Sets Side Handle](https://github.com/mikepthomas/3dprinting/blob/main/Designs/3D%20Sets%20Storage%20System%20Handle/3mm%20Side%20Handle%202pcs.stl) to accept a wider strap as I already have a 50mm strap that is wider than the one in the BOM. Shared with permission.

gha_language: TypeScript


text:
# Ejuice Calculator

This is a simple Node webapp that serves up an Ejuice Calculator--this project came about because:
* I quit smoking and started vaping. I make my own juice because I enjoy it and I'm cheap.
* I wanted a browser-based mixing calculator that allowed me to mix by weight.
* None of the other calculators I have found are FOSS.

Currently, the app saves configuration in a cookie--I know this isn't ideal, but I'm new to Node and am just learning my way around. I intend to rewrite the app with user-authentication, which will allow the saving of custom recipes as I have time.

Most of the backend is based on [a great tutorial from scotch.io](https://scotch.io/tutorials/easy-node-authentication-setup-and-local)

repository: cyberoptics/ejuice-calc

repo_name: cyberoptics/ejuice-calc


text:
  Pokedex Project

  Technology   |
  Project   |
  Installation and execution   |
  How to contribute   |
  License

## :robot: Technology

This project was developed with the following technologies:

- [JavaScript](https://www.javascript.com)

## :book: Dependencies

This project was developed with the following facilities:

- [RESTful Pokémon API](https://pokeapi.co/)

## 💻 Project

The application was made in pure Javascript for object of studies using The RESTful Pokémon API, HTML, CSS and Javascript.

## 🚀 Installation and execution

1. Open your computer's terminal. If it is in Windows it can be the CMD or Powershell.
2. Change the current working directory to the location where you want to have the module code saved on your computer.
3. Clone this repository by running:
 `git clone https://github.com/lncitador/poke-purejs-dex.git`;
4. Enter the folder running through the terminal: `cd poke-purejs-dex`;
5. Run `yarn` to install the project's facilities;
6. Run `yarn dev` to start the development server.

## 🤔 How to contribute

- Fork this repository;
- Create a branch with your feature: `git checkout -b my-feature`;
- Commit your changes: `git commit -m 'feat: My new feature'`;
- Push to your branch: `git push origin my-feature`.

After the merge of your pull request is done, you can delete your branch.

## :memo: Licença

This project is under the MIT license. See the archive [LICENSE](LICENSE.md) for more details.

repository: lncitador/poke-purejs-dex

repo_name: lncitador/poke-purejs-dex


text:
[ManifestVersion](assetlink://Packages/com.passivepicasso.thunderkit/Editor/Core/Paths/Components/ManifestVersion.cs) can only be executed in the context of a Pipeline with an assigned Manifest.

## Context

* Can only be used in PipelineJobs that execute on Manifests or in ManifestDatum StagingPaths

## Remarks

When executed within the context of a Pipeline with an assigned Manifest, the ManifestVersion component will retrieve and return the value of the Manifest's ManifestIdentity.Version

repository: Therzok/ThunderKit

repo_name: Therzok/ThunderKit


text:
---
layout: post
title: Contract Jobs in Air-India Express last date 28th Aug 2015
date: 2015-08-17 20:50
comments: true
tags:  ContractJob  Coordinator  Manager  Officer  Public-Sector  Supervisor
archive: false
---
Air India Charters Limited invites applications from Indian Citizens (wherever domiciled) fulfilling
the requirements for the following posts, on fixed term contract basis :

- Dy Chief of Operations : 01 post
- Chief Manager In-flight services : 01 post
- Dy Chief Manager In-flight Services : 01 post
- Manager Flight Operations : 02 posts
- Manager Scheduling - (Cockpit crew & Cabin Crew) : 01 post
- Dy.Manager – Scheduling (Cockpit & Cabin Crew scheduling) : 01 post
- Co-ordinator Flight Operations and Dispatch : 01 post
- Operating / Cabin Crew Scheduling Officer : 01 post
- Clerical Staff : 02 posts
- Dy. Chief of Finance : 01 post
- Supervisor Finance : 01 post
- Officer - HR : 01 post
- Manager – IR : 01 post
- Dy. Chief of Commercial [Revenue Management] : 01 post
- Station Co-ordinator : 06 posts

**How to Apply** :  Application in the prescribed format should be send within 15 days (published on 12/08/2015 i.e. last date is 28/08/2015) to should be submitted online at Air India Express website on or before 01/09/2015 only.

Please visit <http://www.airindiaexpress.in/data/ADVTwebGeneral%20July2015.pdf>  for details and application format.

repository: anchalrani/getopportunity

repo_name: anchalrani/getopportunity


text:
---
title: Opcode MoveLogDisregard
searchTitle: Lua Opcode MoveLogDisregard
weight: 1
hidden: true
menuTitle: Opcode MoveLogDisregard
---
## MoveLogDisregard

This represents a MoveLogDisregard opcode
```lua
Opcode.MoveLogDisregard
```

repository: xackery/eqquestapi

repo_name: xackery/eqquestapi


text:
FORMAT: 1A

# FeedHenry Intercom Connector
[![Dependency Status](https://img.shields.io/david/feedhenry-templates/fh-connector-intercom-cloud.svg?style=flat-square)](https://david-dm.org/feedhenry-templates/fh-connector-intercom-cloud)

The FeedHenry Intercom Connector. For more information on Intercom see: [https://github.com/silentrob/node-intercom](https://github.com/silentrob/node-intercom).

# Group Intercom Connector API

# Intercom [/cloud/intercom]

User info

## Intercom [POST]

Login to Intercom and retrieve user information

+ Request (application/json)
    + Body
        {
          "user"<EMAIL_ADDRESS>        }

+ Response 200 (application/json)
    + Body
            {
              "ok": "true"
            }

gha_language: JavaScript


text:
---
layout: post
title: Meiqi Final Project's argument
author: meiqi
published: true
---

In this post, I will discuss my argument of my Final Research Project, based on the argument elements we have discussed in class, as well as Semenza's 6 types of Arguments.

## Claim
In the United States, white collars and upper level jobs are tend to be owned by white people; blue collars and basic workers are tend to be colored people, especially black people.
## Reason
Amoung the large populations, white people get larger percent of amount get educated, whereas colored people get less educated.
## Evidence
Book "Gender, Race and Ethnicity in the Workplace" shows that Blue-Collar Women in traditional male jobs: recondering the glass ceilig by Jeanie Ahearn Greene.
## Warrant
The book is professional scholarly published, and job market equalness issue does exsit and need improvement. This study is going to reveal the fact of the job marketing in the U.S. based on different races

gha_language: CSS


text:
# Message translation

You're also able to translate your message to another language with Validation.
The only thing one must do is to define the param `translator` as a callable that
will handle the translation overwriting the default factory:

```php
Factory::setDefaultInstance(
    (new Factory())->withTranslator('gettext')
);
```

The example above uses `gettext()` but you can use any other callable value, like
`[$translator, 'trans']` or `you_custom_function()`.

After that, if you call `getMessage()`, `getMessages()`, or `getFullMessage()`,
the message will be translated.

repository: Respect/Validation

gha_language: PHP

repo_name: Respect/Validation


text:
---
layout: post
title: "8 week yoga therapy course for stress, anxiety and depression"
permalink: /archives/2021/01/8-week-yoga-therapy-course-for-stress-anxiety-and-depression.html
commentfile: 2021-01-21-8-week-yoga-therapy-course-for-stress-anxiety-and-depression
category: around_town
date: 2021-01-21 10:00:00
image: "/assets/images/2021/sammie-yoga-jan.jpg"
excerpt: |
    Mindfulness and therapeutic yoga are well known to help reduce and better manage stress, anxiety and depression. This evidence-based 8-week yoga therapy course combines specific yoga therapy techniques and mindfulness with research from the fields of psychotherapy and neuroscience.
---

Mindfulness and therapeutic yoga are well known to help reduce and better manage stress, anxiety and depression. This evidence-based 8-week yoga therapy course combines specific yoga therapy techniques and mindfulness with research from the fields of psychotherapy and neuroscience.

Developed by The Minded Institute and delivered by qualified local Yoga Therapist Sammie Mason, this course aims to:

- Provide self-regulation techniques to better manage stress, anxiety and depression on a day to day basis helping to improve your mental health
- Enhance the functioning of the nervous system to improve well-being
- Improve self-awareness through the practice of mindfulness
- Promote the elimination of negative habitual patterns of thought and behaviour helping to improve your mental health on a long term basis

Each two-hour class is suitable for all levels and includes a weekly theme, breath practice, mindful activity, relaxation, meditation, reflection and discussion. During each session, we will investigate how the mind, body and brain work together from a scientific perspective and teach you how to use practices that will promote well-being in all aspects of yourself.

During the first two weeks of the course, we focus on regulating breath as a mode to alter the functioning of your nervous system so that you can manage stress with greater ease.  From weeks 3 to 5, we concentrate on the relationship between body and mood and in weeks 6 to 8 we focus specifically on the mind.

To complement the class, a comprehensive manual and eight associated recordings will be shared to guide individual practice, which coincides with each week of the course.

Classes will be via Zoom from 7:30 pm - 9:30 pm on Thursday evenings, starting from February  11th 2021.

For further details  or to express your interest contact Sammie on:

-  [loveyogalondon<EMAIL_ADDRESS>- [www.loveyogalondon.co.uk](http://www.loveyogalondon.co.uk)
- [themindedinstitute.com/yoga-therapist/samantha-mason](https://themindedinstitute.com/yoga-therapist/samantha-mason/)

#### Notes:

- The Minded Institute is a world leader in yoga therapy and mindfulness programs for those with mental health and chronic physical health problems. [www.themindedinstitute.com](http://www.themindedinstitute.com)
- Sammie Mason is a qualified Yoga Therapist for Mental Health and Chronic Physical conditions.  She is an experienced British Wheel of Yoga Teacher with over 15 years of experience, as well as a specialist Pregnancy Yoga Teacher. In addition to running the Minded 8-Week Yoga Therapy Course for Stress, Anxiety & Depression, she also provides a range of therapeutic yoga workshops and one-to-one yoga therapy.

repository: pmahnke/stmgrts

gha_language: HTML

repo_name: pmahnke/stmgrts


text:
## require-inject-scope - Inject scoped variables when requiring a file.

[![NPM](https://nodei.co/npm/require-inject-scope.png?mini=true)](https://nodei.co/npm/require-inject-scope/)

[![Build Status](https://travis-ci.org/ralphv/require-inject-scope.svg?branch=master)](https://travis-ci.org/ralphv/require-inject-scope)
[![Coverage Status](https://coveralls.io/repos/github/ralphv/require-inject-scope/badge.svg?branch=master)](https://coveralls.io/github/ralphv/require-inject-scope?branch=master)

* [What is it?](#what-is-it)
* [Getting started](#getting-started)
* [Usage](#usage)
* [License](#License)
* [Changelog](#Changelog)

## What is it

The built in `require` of Node.js does not have a way to allow you to inject scoped variables.
The variables `module`, `exports`, `__dirname`, `__filename`... are available in the context of a required file but there is no easy way to provide your own variables.

Many developers will revert to using either globally defined variables or using singleton variables like `globals`, but neither of these are best practices.

This library allows you to inject your own variables to the context of the required file.

## Getting started

    $ npm install --save require-inject-scope

## Usage

require this library as early as possible in your own code.

```javascript
require("require-inject-scope");
```

require will work normally as expected.

When you need to inject variables into a scope, instead of calling `require` with one parameter which
is the `path`, you call it using an array with exactly two elements.
The first element is the standard `path` and the second element will be an object having properties as variable names to inject and their values.

This is most useful when creating a plugin architecture where you want to provide the plugins a list of defined variables without requiring your plugins to require them manually.

example:

```javascript
require(["./sample.js", {"$config":configObject, "$helper": helperObject}]);
```

The file sample.js will have the two variables `$config` and `$helper` defined in its scope similar to the standard available variables.

### License

require-inject-scope is licensed under the [MIT](https://github.com/ralphv/require-inject-scope/raw/master/LICENSE).

### Changelog

* 1.0.0: Initial version

repository: ralphv/require-inject-scope

repo_name: ralphv/require-inject-scope


text:
Here is short HOWTO to maintain and troubleshoot GKE and cryptonodes.

You may also use [official doc](https://cloud.google.com/kubernetes-engine/docs/troubleshooting) to troubleshoot GKE cluster.

We assume kubectl default context is configured correctly to connect to the required cluster.

### Diagnose and troubleshooting
Locate required pods
```bash
# get namespaces list
kubectl get ns
# get pods list per namespace dev-eth-0
kubectl -n dev-eth-0 get pod
```
Check pod logs (`-f` to follow)
```bash
kubectl -n dev-eth-0 logs -f dev-eth0-parity-0 --tail=10
```
Check pod info to troubleshoot startup problems, liveness check problems, etc:
```bash
kubectl -n dev-eth-0 describe pod dev-eth0-parity-0
```
Restart pod in case of hung
```bash
kubectl -n dev-eth-0 delete pod dev-eth0-parity-0
```
Check allocated disk size
```bash
kubectl -n dev-eth-0 get pvc
```
Shell exec to container to check/troubleshoot from inside
```bash
kubectl -n dev-eth-0 exec -it dev-eth0-parity-0 bash
```

Get blockchain-specific logs
* parity
```bash
kubectl -n dev-eth-0 exec -it dev-eth0-parity-0 bash
tail -f parity.log
```
* bitcoind
```bash
kubectl -n dev-btc-0 exec -it  dev-btc0-bitcoind-0 bash
tail -f debug.log
```

Get current block count
* parity, look after `Syncing` word
```bash
kubectl -n dev-eth-0 logs --tail=10 dev-eth0-parity-0
```

* bitcoind
```bash
kubectl -n dev-btc-0 exec -it  dev-btc0-bitcoind-0 bash
bitcoin-cli -datadir=/data getblockcount
```

Get peers count
* parity, look before `peers` word
```bash
kubectl -n dev-eth-0 logs --tail=10 dev-eth0-parity-0
```
* bitcoind, it should be 8+ connections
```bash
kubectl -n dev-btc-0 exec -it  dev-btc0-bitcoind-0 bash
bitcoin-cli  -datadir=/data -getinfo|grep connections
```
### Upgrade cryptonode version
Let's assume you need to upgrade parity from `v2.5.8-stable` to `v2.5.10-stable`. Here is what you need to do:
* update `values-parity.yaml` you used before to deploy parity or create new `values-parity.yaml` file with following content
```yaml
image:
  repository: parity/parity
  tag: v2.5.10-stable
```
* upgrade parity helm release in the cluster, we use release named `dev-eth0` in example below
```bash
cd blockchain-kubernetes
helm upgrade dev-eth0 charts/parity/ --reuse-values --force --atomic --values values-parity.yaml
```

### Snapshot disk with blockchain
Let's assume you need to snapshot disk from pod `dev-eth0-parity-0` in namespace `dev-eth-0`. First we need to find what disk is actually used by this pod
```bash
kubectl -n dev-eth-0 describe pod dev-eth0-parity-0
```
Check output for Volumes, my case is
```yaml
Volumes:
  parity-pvc:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  parity-pvc-dev-eth0-parity-0
    ReadOnly:   false
```
We get `ClaimName: parity-pvc-dev-eth0-parity-0`, now we need to find corresponding `PersistentVolume`:
```bash
kubectl -n dev-eth-0 describe pvc parity-pvc-dev-eth0-parity-0
```
Check output for Volumes, my case is
```yaml
Volume:        pvc-d0846f83-df05-11e9-8a31-42010a8001be
```
And now we need to get disk name from PV
```bash
kubectl describe pv pvc-d0846f83-df05-11e9-8a31-42010a8001be
```
Check output for `Source`
```yaml
Source:
    Type:       GCEPersistentDisk (a Persistent Disk resource in Google Compute Engine)
    PDName:     gke-baas0-fff79c5e-dyn-pvc-d0846f83-df05-11e9-8a31-42010a8001be
```
We get `gke-baas0-fff79c5e-dyn-pvc-d0846f83-df05-11e9-8a31-42010a8001be`, that's the name of disk we need to snapshot.
You may use [official doc](https://cloud.google.com/compute/docs/disks/create-snapshots) to create snapshot, here is quick example command to do so
```bash
gcloud compute disks snapshot gke-baas0-fff79c5e-dyn-pvc-d0846f83-df05-11e9-8a31-42010a8001be --snapshot-names=dev-eth0-parity
```
It may be better to stop blockchain node [to get consistent snapshot with high probability](https://cloud.google.com/compute/docs/disks/snapshot-best-practices). Here is how you can do it for example with eth node:
```bash
kubectl -n dev-eth-0 scale statefulset dev-eth0-parity --replicas=0
```
Wait 1 minute and then create the snapshot. Use following command to start node again:
```bash
kubectl -n dev-eth-0 scale statefulset dev-eth0-parity --replicas=1
```
You may need to convert your snapshot to an image, for example to share the image
```bash
gcloud compute images create parity-2019-10-16 --source-snapshot=dev-eth0-parity
```
### Provision cryptonode with pre-existing image
When you have someone who shared pre-synced cryptonode disk image with you, you can create a new disk from this image and use it with your cryptonode, and here is how.
* (optional) copy disk image to your project
```bash
gcloud compute images create parity-2-5-5-2019-10-16 --source-image=parity-2-5-5-2019-10-16 --source-image-project=<SOURCE-PROJECT>
```
Now we have two options - single zone disk or regional disk, choose one
#### Single zone disk
* just create SSD disk from the image, pay attention to zone, it must be the same as your GKE cluster
```bash
gcloud compute disks create parity-0 --type pd-ssd --zone us-central1-b  --image=parity-2-5-5-2019-10-16 --image-project=<SOURCE-PROJECT>
```
#### Regional disk
Due to `Creating a regional disk from a source image is not supported yet.` we need to perform this task with intermediate steps
* create single zone standard disk from the image
```bash
gcloud compute disks create parity-tmp --type pd-standard --zone us-central1-b  --image=parity-2-5-5-2019-10-16 --image-project=<SOURCE-PROJECT>
```
* create a snapshot from disk we just created. We can then create regional disk from snapshot it the corresponding region
```bash
gcloud compute disks snapshot parity-tmp --snapshot-names=parity-2-5-5-2019-10-16 --storage-location=us-central1 --zone us-central1-b
```
* remove standard disk, we don't need it
```bash
gcloud compute disks delete parity-tmp --zone us-central1-b
```
* create regional SSD disk from the snapshot, use same `replica-zones` as your GKE cluster
```bash
gcloud compute disks create parity-0 --type pd-ssd --region us-central1 --replica-zones=us-central1-c,us-central1-b --source-snapshot=parity-2-5-5-2019-10-16
```
#### Attaching disk to cryptonode pod
Now we need to create [PersistentVolume in Kubernetes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)(PV) and use this PV with [PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) we already have.
* adjust [pv.yaml](pv.yaml)(1 zone disk) or [pv-r.yaml](pv-r.yaml)(regional disk) with your disk name, zones etc. In this manual we assume you have required storage classes already from cryptonode deployment.
* create PV via following command, use one of them:
```bash
kubectl create -f pv.yaml
# or
kubectl create -f pv-r.yaml
```
* shutdown cryptonode:
```bash
kubectl -n prod-eth-0 scale statefulset prod-eth0-parity --replicas=0
```
let it some time to shutdown, you can monitor it with `kubectl -n prod-eth-0 get pod -w` usually

* replace existing PVC by a copy with another disk name `parity-0`, I use `parity-pvc-prod-eth1-parity-0` PVC in `prod-eth-1` namespace in the example below:
```bash
# backup just in case
kubectl -n prod-eth-1 get pvc parity-pvc-prod-eth1-parity-0 -o yaml > parity-pvc-prod-eth1-parity-0.yaml
kubectl -n prod-eth-1 get pvc parity-pvc-prod-eth1-parity-0 -o json|jq '.spec.volumeName="parity-0"'| kubectl -n prod-eth-1 replace --force -f -
```
* start cryptonode up and check logs
```bash
kubectl -n prod-eth-0 scale statefulset prod-eth0-parity --replicas=1
kubectl -n prod-eth-0 get pod -w
kubectl -n prod-eth-0 logs -f prod-eth0-parity-0
```

repository: blockchain-etl/blockchain-kubernetes

branch_name: refs/heads/dev

gha_language: Smarty

repo_name: blockchain-etl/blockchain-kubernetes


text:
## BMS External Services

In this repo you can find services use can use in your project

### Energy Consumption Chart

The first service can be included in your project, using an iframe. It will show the energy consumption in a graphical chart for a specific building which runs under GAIA project.

```markdown
<iframe src="http://bms.gaia-project.eu/services/#/page/chart/{{building-id}}/{{SparkworksToken}}/{{step}}/{{from}}/{{to}}" width="1500"  height="400" frameBorder="0"></iframe>

{{step}} can be day|month|hour|5min
{{from}} must be in 'd-m-YYYY' for example 6-1-2016 (that means January 6, 2016)
{{to}}  must be in 'd-m-YYYY' for example 6-1-2016 (that means January 6, 2016)

repository: GAIA-project/BMS-ExternalServices

repo_name: GAIA-project/BMS-ExternalServices


text:
# Project 1 - Flicks

Flicks shows the latest movies currently playing in theaters. The app utilizes the Movie Database API to display images and basic information about these movies to the user.

Time spent: 16.5 hours spent in total

## User Stories

The following **required** functionality is completed:

* [X] User can **scroll through current movies** from the Movie Database API
* [X] Layout is optimized with the [ViewHolder](http://guides.codepath.com/android/Using-an-ArrayAdapter-with-ListView#improving-performance-with-the-viewholder-pattern) pattern.
* [X] For each movie displayed, user can see the following details:
  * [X] Title, Poster Image, Overview (Portrait mode)
  * [X] Title, Backdrop Image, Overview (Landscape mode)

The following **optional** features are implemented:

* [X] Display a nice default [placeholder graphic](http://guides.codepath.com/android/Displaying-Images-with-the-Picasso-Library#configuring-picasso) for each image during loading.
* [X] Improved the user interface through styling and coloring.

The following **bonus** features are implemented:

* [X] Allow user to view details of the movie including ratings and popularity within a separate activity or dialog fragment.
* [X] When viewing a popular movie (i.e. a movie voted for more than '7' stars) the video should show the full backdrop image as the layout.  Uses [Heterogenous ListViews](http://guides.codepath.com/android/Implementing-a-Heterogenous-ListView) or [Heterogenous RecyclerView](http://guides.codepath.com/android/Heterogenous-Layouts-inside-RecyclerView) to show different layouts.
* [X] Allow video trailers to be played in full-screen using the YouTubePlayerView.
    * [X] Overlay a play icon for videos that can be played.
    * [X] More popular movies should start a separate activity that plays the video immediately.
    * [X] Less popular videos rely on the detail page should show ratings and a YouTube preview.
* [X] Apply the popular [Butterknife annotation library](http://guides.codepath.com/android/Reducing-View-Boilerplate-with-Butterknife) to reduce boilerplate code. As a current Android app developer, this is not that helpful as expected.
* [X] Apply rounded corners for the poster or background images using [Picasso transformations](https://guides.codepath.com/android/Displaying-Images-with-the-Picasso-Library#other-transformations)
* [ ] Replaced android-async-http network client with the popular [OkHttp](http://guides.codepath.com/android/Using-OkHttp) networking libraries.

The following **additional** features are implemented:

* [ ] 1 hour try to make the list remain the same position after roattion or any other configuration changed, but failed.

## Video Walkthrough

Here's a walkthrough of implemented user stories:

<img src='http://i.imgur.com/9imLA4o.gif' title='Project 1- Flicks' />

GIF created with [Gif Maker - Gif Editor](https://play.google.com/store/apps/details?id=com.kayak.studio.gifmaker&hl=zh_HK).

## Notes

Describe any challenges encountered while building the app.

* I adjust the criteria to 7 since almost all the now-playing movies has average vote higher than 5.

## Open-source libraries used

- [Android Async HTTP](https://github.com/loopj/android-async-http) - Simple asynchronous HTTP requests with JSON parsing
- [Picasso](http://square.github.io/picasso/) - Image loading and caching library for Android
- [Android Support 7- RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html) - Better ListView
- [RoundedImageView](https://github.com/vinc3m1/RoundedImageView) - Transform an image's border integrated with Picasso usage
- [Gson](https://github.com/google/gson) - A Java serialization/deserialization library that can convert Java Objects into JSON and back.
- [Android Asynchronous Http Client](http://loopj.com/android-async-http/) - A Callback-Based Http Client Library for Android
- [ButterKnife](http://jakewharton.github.io/butterknife/) - Field and method binding for Android views
- [YouTubeAndroidPlayerApi](https://developers.google.com/youtube/android/player/) - Play Youtube vedio in app

## License

    Copyright [2017] [Flicks]

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


text:
---
layout: post
title: "working with active record part 2"
description: ""
category: "Learning Notes"
tags: [RubyOnRails]
---

## Database Locking

### Optimistic Locking 樂觀

* detecing and resolving collisions if they occur
* infrequent collisions

#### implementation

* add *lock_version* column
```
class AddLockVersionToTimeSheets < ActiveRecord::Migration
	def change
		add_column :timesheets, :lock_version, :integer, default: 0
	end
end
```

* the first instance will win the update(save method returns true), the second will raises *ActiveRecord::StaleObjectError*

#### hangle the error
```
def update
	timesheet = Timesheet.find(params[:id])
	timesheet.update(params[:timesheet])
	# update success, redirect to somewhere
rescue
	flash[:error] = "Timesheet was modified while you were editing it." # show error msg to user
	redirect_to [:edit, timesheet] # redirect back to edit method
end
```

### Pessimistic Locking 悲觀

* implemented at database level
* add FOR UPDATE clause to SELECT statment
* other statment will be blocked
* lock is released after transaction is commited
* theoretically, lock would not be released until the connection is terminated or times out

### Considerations

* as web application, optimistic locking is better
* rails is single thread, using pessimistic locking cause rails waits and ignoring other request

## Where Clauses

### Basics

```
# using Hash
Product.where(sku: params[:sku]) # sku = params[:sku]
Product.where(sku: [9400, 9500, 9600]) # sku in (9400, 9500, 9600)
# using statement
Product.where('descrption like ? and color = ?', "%#{terms}%", color)
Product.where('sku in (?)', selected_skus)
# where.not
Article.where.not(title: 'Rails 3')
Article.where.not(title: ['Rails 3', 'Rails 5'])
```

### Bind Variables

* use hash key instead of question mark
* more readable
* use same bind variable at once

```
Produce.where("name = :name AND sku = :sku AND created_at > :date", name: "Space Toilet", sku: 80800, date: '2009-01-01')
Message.where("subject LIKE :foo OR body LIKE :foo", foo: '%woah%')
```

### Boolean Conditions

* Active Record handles the differences of boolean values in all databases(1/0, T/F, or Y/N)

```
Timesheet.where('submitted = ?', true)
```

### Nil Conditions

```
>> User.where('email = ?', nil) # not works
User Load (xx.x ms) SELECT * FROM users WHERE (email = NULL)
>> User.where(:email => nil) # works
User Load (xx.x ms) SELECT * FROM users WHERE (users.email IS NULL)
```

## Order Clauses

### basics

```
Timesheet.order('created_at desc')
Timesheet.order(:created_at) # default is ascending order
Timesheet.order(created_at: :desc) # new in Rails 4
```

### random ordering

```
# MySQL
Timesheet.order('RAND()')
# Postgres
Timesheet.order('RANDOM()')
# Microsoft SQL Server
Timesheet.order('NEWID()') # uses random uuids to sort
# Oracle
Timesheet.order('dbms_random.value').first
```

## Limit(number) and Offset(number)

* limit: limit on the number of rows to return from the query
* offset: must be chained to *limit*, specifies the number of rows to skip

```
Timesheet.limit(10).offset(10)
```

## Select clauses
## From tables
## exists?

```
User.exists?(1)
User.exists?(login: "mack")
User.exists?(id: [1, 3, 5])
User.where(login: "mack").exists?
```

### extending

* specifies one or many modules with methods that will extend the scope with additional methods

```
module Pagination
	def page(number)
		# statement
	end
end

scope = Model.all.extending(Pagination)
scopepage(params[:page])
```

### Group
### Having
### includes

???

### Joins

```
Buyer.select('buyers.id, count(carts.id), as cart_count').
	joins('left join carts on carts.buyer_is = buyers.id').
	group('buyers.id')
```

### none

* return a empty ActiveRecord::Relation without quering database

```
def visible
	case role
	when :reviewer
		Post.published
	when :bad_user
		Post.none
	end
end

posts = current_user.visible.where(name: params[:name])
```

### readonly

* change the returned instance to readonly
* you can change attributes, but cannot save

```
c = Comment.readonly.first
c.body = "Keep it clean!"
c.save # => ActiveRecord::ReadOnlyRecord: ActiveRecord::ReadOnlyRecord
```

### references

### reorder

* replace any defined order

```
Member.order('name DESC').reorder(:id)
# => SELECT "members".* FROM "members" ORDER BY "members"."id" ASC

Member.order('name DESC').reorder(:id).order(:name)
# order is appendded to query
# => SELECT "members".* FROM "members" ORDER BY "members"."id" ASC,  "members".name ASC
```

### reverse_order

```
Member.order(:name).reverse_order
# => SELECT "members".* FROM "members" ORDER BY "members".name DESC
```

### uniq / distinct

```
User.select(:login).uniq
# => SELECT DISTINCT login FROM "users"
```

### unscope

* remove an unwanted relation

```
Member.order('name DESC').unscope(:order)
# => SELECT "members".* FROM "members"
Member.where(name: "Tyrion", active: true).unscope(where: :name)
# => equal to Member.where(active: true)
```

* *unscope* accepts:
	* :from, :group, :having, :includes, :joins, :limit, :lock, :offset, :order, :readonly, :select, :where

### arel_table

For cases in which you want to generate custom SQL yourself through Arel, you may use the *arel_table* method to gain access to the table for the class.


text:
# V1alpha1StorageVersionStatus

API server instances report the versions they can decode and the version they encode objects to when persisting objects in the backend.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**common_encoding_version** | **str** | If all API server instances agree on the same encoding storage version, then this field is set to that version. Otherwise this field is left empty. API servers should finish updating its storageVersionStatus entry before serving write operations, so that this field will be in sync with the reality. | [optional]
**conditions** | [**list[V1alpha1StorageVersionCondition]**](V1alpha1StorageVersionCondition.md) | The latest available observations of the storageVersion's state. | [optional]
**storage_versions** | [**list[V1alpha1ServerStorageVersion]**](V1alpha1ServerStorageVersion.md) | The reported versions per API server instance. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

repository: kubernetes-client/python

gha_language: Python

repo_name: kubernetes-client/python