text:
---
title: Enable TLS Authentication and Encrypt the Stored Data
summary: Learn how to enable TLS authentication and encrypt the stored data in a TiDB cluster.
category: how-to
aliases: ['/docs/dev/how-to/secure/enable-tls-between-components/']
---

# Enable TLS Authentication and Encrypt the Stored Data

This document introduces how to enable TLS authentication and encrypt the stored data in a TiDB cluster.

## Enable TLS Authentication

This section describes how to enable TLS authentication in a TiDB cluster. TLS authentication can be applied to the following scenarios:

- The **mutual authentication** between TiDB components, including the authentication among TiDB, TiKV, and PD; the authentication between TiDB Control and TiDB, between TiKV Control and TiKV, between PD Control and PD; the authentication between TiKV peers, and between PD peers. Once enabled, the mutual authentication applies to all components, rather than to part of the components.
- The **one-way** and **mutual authentication** between the TiDB server and the MySQL Client.

> **Note:**
>
> The authentication between the MySQL Client and the TiDB server uses one set of certificates, while the authentication among TiDB components uses another set of certificates.

## Enable mutual TLS authentication among TiDB components

1. Prepare certificates.

    It is recommended to prepare a server certificate for TiDB, TiKV, and PD separately. Make sure that these components can authenticate each other. The clients of TiDB, TiKV, and PD share one client certificate.

    You can use tools like `openssl`, `easy-rsa` and `cfssl` to generate self-signed certificates.

    If you choose `cfssl`, you can refer to [generating self-signed certificates](/generate-self-signed-certificates.md).

2. Configure certificates.

   To enable mutual authentication among TiDB components, configure the certificates of TiDB, TiKV, and PD as follows.

   - TiDB

        Configure in the configuration file or command line arguments:

        ```toml
        [security]
        # Path of file that contains list of trusted SSL CAs for connection with cluster components.
        cluster-ssl-ca = "/path/to/ca.pem"
        # Path of file that contains X509 certificate in PEM format for connection with cluster components.
        cluster-ssl-cert = "/path/to/tidb-server.pem"
        # Path of file that contains X509 key in PEM format for connection with cluster components.
        cluster-ssl-key = "/path/to/tidb-server-key.pem"
        ```

   - TiKV

        Configure in the configuration file or command line arguments, and set the corresponding URL to https:

        ```toml
        [security]
        # set the path for certificates. Empty string means disabling secure connections.
        ca-path = "/path/to/ca.pem"
        cert-path = "/path/to/tikv-server.pem"
        key-path = "/path/to/tikv-server-key.pem"
        ```

   - PD

        Configure in the configuration file or command line arguments, and set the corresponding URL to https:

        ```toml
        [security]
        # Path of file that contains list of trusted SSL CAs. If set, following four settings shouldn't be empty
        cacert-path = "/path/to/ca.pem"
        # Path of file that contains X509 certificate in PEM format.
        cert-path = "/path/to/pd-server.pem"
        # Path of file that contains X509 key in PEM format.
        key-path = "/path/to/pd-server-key.pem"
        ```

    After certificates are configured as above, mutual authentication among TiDB components is enabled.

    > **Note:**
    >
    > If you have enabled TLS in a TiDB cluster when you connect to the cluster using tidb-ctl, tikv-ctl, or pd-ctl, you need to specify the client certificate. For example:

    {{< copyable "shell-regular" >}}

    ```bash
    ./tidb-ctl -u https://<IP_ADDRESS>:10080 --ca /path/to/ca.pem --ssl-cert /path/to/client.pem --ssl-key /path/to/client-key.pem
    ```

    {{< copyable "shell-regular" >}}

    ```bash
    ./pd-ctl -u https://<IP_ADDRESS>:2379 --cacert /path/to/ca.pem --cert /path/to/client.pem --key /path/to/client-key.pem
    ```

    {{< copyable "shell-regular" >}}

    ```bash
    ./tikv-ctl --host="<IP_ADDRESS>:20160" --ca-path="/path/to/ca.pem" --cert-path="/path/to/client.pem" --key-path="/path/to/clinet-key.pem"
    ```

3. Configure Common Name.

    The Common Name is used for caller verification. In general, the callee needs to verify the caller's identity, in addition to verifying the key, the certificates, and the CA provided by the caller. For example, TiKV can only be accessed by TiDB, and other visitors are blocked even though they have legitimate certificates. It is recommended to mark the certificate user identity using `Common Name` when generating the certificate, and to check the caller's identity by configuring the `Common Name` list for the callee.

    - TiDB

        Configure in the configuration file or command line arguments:

        ```toml
        [security]
        cluster-verify-cn = [
            "TiDB-Server",
            "TiKV-Control",
        ]
        ```

    - TiKV

        Configure in the configuration file or command line arguments:

        ```toml
        [security]
        cert-allowed-cn = [
            "TiDB-Server", "PD-Server", "TiKV-Control", "RawKvClient1",
        ]
        ```

    - PD

        Configure in the configuration file or command line arguments:

        ```toml
        [security]
        cert-allowed-cn = ["TiKV-Server", "TiDB-Server", "PD-Control"]
        ```

4. Reload certificates.

    To reload the certificates and the keys, TiDB, PD, and TiKV reread the current certificates and the key files each time a new connection is created. Currently, you cannot reload the CA certificate.

## Enable TLS authentication between the MySQL client and TiDB server

Refer to [Use Encrypted Connections](/encrypted-connections-with-tls-protocols.md).

## Encrypt stored data

In a TiDB cluster, user data is stored in TiKV. Once you configure the encrypted storage feature in TiKV, the TiDB cluster encrypts this data. This section introduces how to configure the data encryption feature in TiKV.

1. Generate the token file.

    The token file stores the keys used to encrypt the user data and to decrypt the encrypted data.

    {{< copyable "shell-regular" >}}

    ```bash
    ./tikv-ctl random-hex --len 256 > cipher-file-256
    ```

    > **Note:**
    >
    > You can only use the hex-formatted token file. The file length must be 2 to the power of N, and is less than or equal to 1024.

2. Configure TiKV as follows.

    ```toml
    [security]
    # Storage path of the Cipher file.
    cipher-file = "/path/to/cipher-file-256"
    ```

> **Note:**
>
> When you import data into a cluster using [TiDB Lightning](/tidb-lightning/tidb-lightning-overview.md), if the storage encryption feature is enabled in the target cluster, the SST files generated by TiDB Lightning must be encrypted.

### Limitations

The limitations of the storage encryption feature are as follows:

- If the feature has not been enabled in the cluster before, you cannot enable this feature.
- If the feature is enabled in the cluster, you cannot disable this feature.
- You cannot enable the feature for some TiKV instances while disabling it for other instances in one cluster. You can only enable or disable this feature for all TiKV instances. This is because if you enable the encrypted storage feature, data are encrypted during data migration.


text:
# cufcq
http://cufcq.com

## Okay Sam, what is this?
Sam got really excited and remade http://cufcq.com in Python Tornado, with rethinkdb.

## Swiggity. What do I do?
Follow these instructions:

0. Install python dependencies (see `requirements.txt`)
1. `rethinkdb` in the folder, in a seperate terminal tab
2. `Python main.py` to run the site. If you have all dependencies installed, it should begin build the database
3. It should host! But it will be boring cuz theres no data in it.
4. `Python scraper.py` will scrape the office of planning and budget for data. This command cannot be called in `python3`. In 10 minutes you should have cloned the unorganized Office of planning and budget website. More specific options can be set to download one specific campus or yearterm.
5. `Python3 main.py --digest=20081-BD.csv` will digest that csv file. It takes about 1-2 seconds per file. Run `Python3 main.py --digest=ALL` to digest every csv file. This will take 5 minutes.
6. `Python3 main.py --cleanup` will associate data dependencies, and then build overtime and statistics for each document, tying relevant data together. This will take about 25 minutes.

### Quick Install:
Run `rethinkdb` in a seperate terminal tab. Then:
```
python scraper.py
python3 main.py --digest=ALL
python3 main.py --cleanup
```

After running all of this, you will have an identical and improved database comparable to the current setup. It can also have Colorado Springs and Denver data. All in under an hour.

## What are your plans for this? Why?
If this scq thing is gonna be successful, it needs some strong data already in it. Having the existing fcq data in proximity, and with a simmilar stack as to what we're building, this will give us a chance to superpower scq when it launches. This will also give us a chance to "Bake Two Cakes", if you will. :cake: Because cufcq and scq are simmilar stacks, whatever we find works well in one stack might also work well in the other. It also means we have two opportunities to law down a consistent set of css and javascript, and a consistent set of well-designed handlers and apis. Eventually, we can tie integrations between cufcq and scq, and the result will have a sexy and important "ratemyprofessors" feel to it. We'll need that. As developers, we shouldn't be afraid to tackle code :muscle:

## Isn't this feature creep?
Totes mcgotes it's feature creep. Which is why **I'm taking full responsibility for 100% of cufcq's work.** I've done this once before, and I'll do it again. I have this feature under control, and I can work on it speedily with my resources and experience.

## What else needs to be done?

#### Part 0: Database
* ~~Boilerplate~~
* ~~Scraper~~
* ~~Generator~~

#### Part 1: Data Fort Knox
* ~~Precomputed Data~~
  * ~~Associations~~
  * ~~Stats~~
  * ~~Chronology~~
* Handlers
* APIs

#### Part 2: Data Integrations
* Search
* Surveys
* Integrate

#### Part 3: Data Party Mansion
* Views
* Charts
* Styling

## Seriously what the hell Sam how did you do this?
![alt tag](http://i.imgur.com/YdmGHYG.gif)

license: MIT

repository: cdsalazar/cufcq-new

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: cdsalazar/cufcq-new


text:
# Install OpenBlas in Ubuntu 18.04

### Introduction

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.

Please read the documentation on the OpenBLAS wiki pages: <http://github.com/xianyi/OpenBLAS/wiki>.

### Dependencies

Building OpenBLAS requires the following to be installed:

* GNU Make
* A C compiler, e.g. GCC or Clang
* A Fortran compiler (optional, for LAPACK)
* IBM MASS (optional, see below)

## Clone the OpenBLAS repository

```sh
git clone https://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
```

### Normal compile

```sh
make FC=gfortran -j`nproc`
```

Make sure that the directory containing `libopenblas.so` is in your shared library search path

```
export LD_LIBRARY_PATH=/opt/OpenBLAS/lib:$LD_LIBRARY_PATH
sudo sh -c "echo '/opt/OpenBLAS/lib' > /etc/ld.so.conf.d/openblas.conf"
source ~/.bashrc
sudo ldconfig
```

Notes

- OpenBLAS doesn't support g77. Please use gfortran or other Fortran compilers. e.g. `make FC=gfortran`

- When building in an emulator (KVM,QEMU etc.) make sure that the combination of CPU features exposed to the virtual environment matches that of an existing CPU to allow detection of the cpu model to succeed. (With qemu, this can be done by passing `-cpu host` or a supported model name at invocation)

Simply invoking `make` (or `gmake` on BSD) will detect the CPU automatically.
To set a specific target CPU, use `make TARGET=xxx`, e.g. `make TARGET=NEHALEM`.
The full target list is in the file `TargetList.txt`.

### Debug version

A debug version can be built using `make DEBUG=1`.

### Install to a specific directory (optional)

Use `PREFIX=` when invoking `make`, for example

```sh
make install PREFIX=your_installation_directory
```

The default installation directory is `/opt/OpenBLAS`.

The directory structure is:

```
.
├── bin
├── include
│   ├── cblas.h
│   ├── f77blas.h
│   ├── lapacke_config.h
│   ├── lapacke.h
│   ├── lapacke_mangling.h
│   ├── lapacke_utils.h
│   └── openblas_config.h
└── lib
    ├── cmake
    │   └── openblas
    │       ├── OpenBLASConfig.cmake
    │       └── OpenBLASConfigVersion.cmake
    ├── libopenblas.a -> libopenblas_haswellp-r0.3.4.dev.a
    ├── libopenblas_haswellp-r0.3.4.dev.a
    ├── libopenblas_haswellp-r0.3.4.dev.so
    ├── libopenblas.so -> libopenblas_haswellp-r0.3.4.dev.so
    ├── libopenblas.so.0 -> libopenblas_haswellp-r0.3.4.dev.so
    └── pkgconfig
        └── openblas.pc
```

## Supported CPUs and Operating Systems

Please read `GotoBLAS_01Readme.txt`.

## Usage

Statically link with `libopenblas.a` or dynamically link with `-lopenblas` if OpenBLAS was
compiled as a shared library.

### Setting the number of threads using environment variables

Environment variables are used to specify a maximum number of threads.
For example,

```sh
export OPENBLAS_NUM_THREADS=4
export GOTO_NUM_THREADS=4
export OMP_NUM_THREADS=4
```

The priorities are `OPENBLAS_NUM_THREADS` > `GOTO_NUM_THREADS` > `OMP_NUM_THREADS`.

If you compile this library with `USE_OPENMP=1`, you should set the `OMP_NUM_THREADS`
environment variable; OpenBLAS ignores `OPENBLAS_NUM_THREADS` and `GOTO_NUM_THREADS` when
compiled with `USE_OPENMP=1`.

### Setting the number of threads at runtime

We provide the following functions to control the number of threads at runtime:

```c
void goto_set_num_threads(int num_threads);
void openblas_set_num_threads(int num_threads);
```

If you compile this library with `USE_OPENMP=1`, you should use the above functions too.

### Replace system BLAS/updating APT OpenBLAS in Ubuntu/Debian

Ubuntu and Debian provides [alternatives mechanism](http://manpages.ubuntu.com/manpages/trusty/man8/update-alternatives.8.html) to comfortably replace BLAS and LAPACK libraries systemwide.

After successful build of OpenBLAS (with DYNAMIC_ARCH set to 1)

```sh
make clean
make DYNAMIC_ARCH=1
sudo make DYNAMIC_ARCH=1 install
```

One can redirect BLAS and LAPACK alternatives to point to source-built OpenBLAS First you have to install NetLib LAPACK reference implementation (to have alternatives to replace):

```sh
sudo apt install libblas-dev liblapack-dev
```

Then we can set alternative to our freshly-built library:

```sh
sudo update-alternatives --add /usr/lib/libblas.so.3 libblas.so.3 /opt/OpenBLAS/lib/libopenblas.so.0 41 \
   --slave /usr/lib/liblapack.so.3 liblapack.so.3 /opt/OpenBLAS/lib/libopenblas.so.0
```

Or remove redirection and switch back to APT-provided BLAS implementation order:

```sh
sudo update-alternatives --remove libblas.so.3 /opt/OpenBLAS/lib/libopenblas.so.0
```

### Specific instructions

To build from source the following packages are needed:

```sh
sudo apt-get install gcc gfortran python-dev libopenblas-dev liblapack-dev cython
```

To customize which BLAS is used, you can setup a `site.cfg` file. See the site.cfg.example file in the numpy source for the options you can set.

Note that Debian and Ubuntu package optimized BLAS libraries in a exchangeable way. You can install libraries such as ATLAS or OpenBLAS and change the default one used via the alternatives mechanism:

```sh
$ sudo apt-get install libopenblas-base libatlas3-base
$ update-alternatives --list libblas.so.3
/usr/lib/atlas-base/atlas/libblas.so.3
/usr/lib/libblas/libblas.so.3
/usr/lib/openblas-base/libopenblas.so.0

$ sudo update-alternatives --set libblas.so.3 /usr/lib/openblas-base/libopenblas.so.0
```

See /usr/share/doc/libatlas3-base/README.Debian for instructions on how to build optimized ATLAS packages for your specific CPU.

You can also use a library you built yourself by preloading it. This does not require administrator rights.

```sh
LD_PRELOAD=/path/to/libatlas.so.3 ./my-application
```

repository: hoangtnm/docs

gha_language: Shell

gha_license_id: MIT

repo_name: hoangtnm/docs


text:
With the migration to 1.3 these seem to have stopped working.  We're working to fix that.

# google-container-engine-dse
Google Deployment Manager scripts for deploying DataStax Enterprise (DSE) on Google Container Engine (GKE)

## Creating a Cluster

The [deploy.sh](deploy.sh) script wraps both the deploy cluster and deploy DataStax commands.  You will need gcloud installed and configured.  By default this will deploy a four node cluster.  To create a cluster simply run:

    ./deploy.sh

## Working with a Cluster

With the current configs, our cluster is always called cluster-clustername, so we can get credentials by running:

    gcloud container clusters get-credentials cluster-clustername

Now kubectl will be able to connect.  We can get the names of the nodes with the command:

    kubectl get pods

Once you get a pod's name, you can run the following.  Previous is especially useful in debugging as it shows the logs from the last container that attempted to run.

    kubectl logs datastax-opscenter-rc-5qjv6
    kubectl logs --previous datastax-opscenter-rc-5qjv6

To get the external IP of the OpsCenter machine (running on port 8888) use the following command.  You can then open a web browser to that ip and port to view OpsCenter.

    kubectl get services

To check your cluster is running from the command line you can run:

    kubectl exec datastax-node-0-n1yqu nodetool status

To get an interactive session to a node you can run:

    kubectl exec -it datastax-node-0-8yk87 /bin/bash

## Deleting a Cluster

The [https://cloud.google.com/](https://cloud.google.com/) interface currently has an issue deleting a cluster.  A workaround is provided in the [delete.sh](delete.sh) script.  To delete the cluster simply run:

    ./delete.sh

repository: ankurshukla/google-container-engine-dse

repo_name: ankurshukla/google-container-engine-dse


text:
# jEDI Development Kit Installation

<PageHeader />

## Overview

At the time of writing the current jEDIDK installation packages consist solely of a compressed file with directories and files. The directories are:

- bin
- lib
- jEDIparams
- Templates
- Scripts
- CSV
- Documentation

Additionally a sample jEDIdrivers.ini is provided to help get started with the configuration.

The bin and lib can be extracted on top of existing directories but specifically they must be recognized by the PATH, JBCOBJECTLIST and (depending on the operating system) LIBPATH / SHLIB_PATH / LD_LIBRARY_PATH.

In the case of Windows it is often necessary to include the lib directory in the PATH.

The other directories can usually be found by the jEDIDK based on settings in jEDIdrivers.ini but specifically the Scripts and Templates should be in the same location.

## License Key Request and Installation

The jEDI Driver Kit has its own license key requirement. To request a license key you must run jEDILicRequest on the machine requiring the license. This will generate a key and generated date which should be relayed to your sales or support contact or emailed to<EMAIL_ADDRESS>with a subject of "jEDI Development Kit license request".

A license key will be generated from that and should be installed thus:

```
jEDILicInstall <license_code>
```

Back to [jEDIJDK](./../README.md)

<PageFooter />

repository: josepheshaw/docs

repo_name: josepheshaw/docs


text:
# XWKWebViewProgressView

[![CI Status](http://img.shields.io/travis/papfish/XWKWebViewProgressView.svg?style=flat)](https://travis-ci.org/papfish/XWKWebViewProgressView)
[![Version](https://img.shields.io/cocoapods/v/XWKWebViewProgressView.svg?style=flat)](http://cocoapods.org/pods/XWKWebViewProgressView)
[![License](https://img.shields.io/cocoapods/l/XWKWebViewProgressView.svg?style=flat)](http://cocoapods.org/pods/XWKWebViewProgressView)
[![Platform](https://img.shields.io/cocoapods/p/XWKWebViewProgressView.svg?style=flat)](http://cocoapods.org/pods/XWKWebViewProgressView)

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

## Installation

XWKWebViewProgressView is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'XWKWebViewProgressView'
```
### Usage

---

```
XWKWebViewProgressView *progressView = [[XWKWebViewProgressView alloc] initWithFrame:CGRectMake(0, 64, 375, 2)];
[self.view addSubview:progressView];
[progressView setTrackTintColor:[UIColor lightGrayColor]];
[progressView setProgressTintColor:[UIColor redColor]];
[progressView setWebView:self.webView];
```

## Author

<EMAIL_ADDRESS>
## License

XWKWebViewProgressView is available under the MIT license. See the LICENSE file for more info.

repository: papfish/XWKWebViewProgressView

repo_name: papfish/XWKWebViewProgressView


text:
# Changelog for check_obelisk

## <IP_ADDRESS>

- Add support for checking multiple boards for temperature
- Add hashrate checks and performance data

## <IP_ADDRESS>

- Resolve hostnames to IP address before sending request to Obelisk to avoid bad request errors

## <IP_ADDRESS>

- Add support for temperature monitoring
- Add performance data output for temperature

license: Unlicense


text:
**My Messy TypeScript Learning Notes**

  Here will be first notes which i wrote by handwriting before. I will add them sooner.

**Some notes:**

  Javascript is Dynamically typed language. This means it has types, it is forgiving, great for web browser object model.
  Typescript is a superset of javascript. TS is rigid and promotes stability and maintainability. TS gets these advantages to javascript and extend javascript. Typescript checks errors on compiling time. But this is not break/stops the compilation. /ts file compiled and js file produced.

 Whenever in ts, we need to use annotations etc. we need type definition files. Usually most known libraries has own type definition files to install.
 You can install with `npm install @types/libraryName`.
 For all Nodes standart libraries we need to use `npm install @types/node`.

To install type script with using npm:

    // to install
    npm - install typescript
    // to initialize
    tcs --init
    // to watch changes and compile
    tsc -w

we can compile multiple `.ts` files into one `.js` file.

    tsc --outfile targetJSFile.js firstTSFile.ts secondTSFile.ts lastTSFile.ts

Also we can import other ts files into one main ts file, after that we only compile the main `.ts` file.

At the main ts file

    /// <reference path="firstTSFile.ts">
    /// <reference path="secondTSFile.ts">
    main ts file codes here

after that import process we can compile ``mainTSFile.ts``

    tsc mainTSFile.ts --outfile mainTSFile.js
 ---
 ---

 **Some headers form another course**
 - Understand basic types in TS
 - Function typing + annotations
 - Type definition files
 - Arrays in TS
 - Modules systems
 - Classes + Refresher on OOP
 - Projects
 ---

 **Types in TypeScript**
 - **Primitive Types**
   - number
   - boolean
   - void
   - undefined
   - string
   - symbol
   - null
 - **ObjectTypes**
   - functions
   - arrays
   - classes
   - objects

**Type Annotations:** Developer tells TypeScript the type

**Type Inference:** TypeScript guesses the type

**PS:** If at the same sentence (row) we declare a variable (with let, const) and initialization (with '=') TS guess the type of the variable and at the compiling use this knowledge. This is called **Inference** .
Use Inference as much as you can.

**Where to use Type Annotations:**
 - When functions returns the _**any**_ type and we need to clarify the value.
 - When we declare a variable on one line then initialize it later.
 - When we want a variable to have a type that can't be inferred.

---
---

**Sample types:**

    let aracMarka : string
    let userAge : number
    let userPasif : boolean
    let dersAdlari: any[] // array that elements are in any type
    let dersAdlari: string[] // array that elements are in string type
    let dersPuan: number[] // array that elements are in number type

**tuple types**

Tuples are list of vary types, for example write an object like this into tuple with TS:

    let address = {
                    streetName: 'Oreon street',
                    doorNumbre: 42,
                    isHouse: true
                    }

will be like:

    let address :[string, number, boolean]   // there are in order
    // updated structure is here below, instead of the writing above
    // type alias
    type Address = [string, number, boolean]; // not creating an array, just type alias

  while using tuples:

    let myAddress: address = ["Oreon street", 42, true];
    //or
    let myAddress: [string, number, boolean] = ["Oreon street", 42, true];
    //or with using type alias
    let myAddress: Address =  ["Oreon street", 42, true];

**enum types**

    enum Color {Gray, Green, Red, Blue, Maroon}
    let myColor : Color = Color.Green // directly values used
    console.log(myColor) // returns 1

**Note:** If any default value given to enum ``enum Color {Gray, Red=101, Blue, Maroon}`` next item takes sequential value. This means

     enum Color {Gray, Red=101, Blue, Maroon}
        let myColor : Color = Color.Blue
        console.log(myColor) // returns 102
Use  enum if all possible values are known. enum is a signal/note for other developers.

**void type**

Usually used on functions and means function doesn't return anything but can do some jobs.

    function sayHello():void {
        console.log('Hello!')
    }

**object type**

    let userData: {name: string, age: number} = {name: "John", age: 23}

**type alias**

     type myTypes = {
                    data: number[],
                    output: (isValidName: boolean)=> number[]
                    }

     let myObject: myTypes =  {
                               data: [3,8,2,12,9,67],
                               output: function(all:boolean):number[]{
                               return this.data;
                               }
                               }

**union types**

Using multiple types together as an option. Types separated with pipe (|).

    let myValue: number | string = "John"; // no error
    let myValue: number | string = 23; // no error

**never types**

If a function will never return anything an never exit by default (may exit by a thrown error), and not expected so.

    function neverReturns(): never {
        throw new Error('Error happens');
    }
**Nullable types**

First we should activate this ``strictNullChecks: true`` from  ``tsconfig.json``
    this makes types only nullable if type is null. As same if type is not null (assigned as number for example) you can not assign null. If we use ``tuple`` or ``union`` so no error will be thrown.

    let myType: number = 23;
    myTpe = null; // error

    let thatType: number | null = 23 ;
    thatType = null; // no error

**Function types**

    const myFunction: (i:number)=>void = (i:number)=>{
    // some code
    console.log('My number is' + i);
    // return nothing
    }
    // in here, annotation says function expects an argument which type is number. And function returns nothing.

**PS:** between : and = signs is annotation. After = sign is function itself.

**Object Destructuring With Annotations**

    const user = {
        name: 'John',
        age: 20,
        coords: {
                lat:0,
                lng:0
                },
        setAge(age: number): void{
                                    this.age= age;
                                    }
    }

    const {ageOfUser}:{age:number} = user;
    // ageOfUser is number
    const {coordOfUser: {lat, lng}:{coords: {lat:number, lng:number}} = user;
    // coordOfUser is object, coordOfUser.lat is number, coordOfUser.lng is number

**ES6 in TypeScript**

**Namespaces**
Namespaces creates a space separated from global.

    namespace MyMaths{
                       export function(){
                                        }
                        }

functions in namespaces should export, properties not. Every things in a namespace is special to it. Namespaces acting like objects.
We can use namespaces inside other namespaces, but inner ones need to be exported with ``export`` keyword!

While reaching namespaces properties etc. from outside we can use dot notation.

    nameSpaceName1.nameSpaceName2.property

If we want to use aliases for namespaces

 ``import allNameSpaces = nameSpaceName1.nameSpaceName2``

**Modules**

  *export default* -> if file imported with no referance but only path, all exported things imported
  functions, classes and properties can be export

  2 import types available

  - relative path, like: ``./path1/path2/filename``
  - absolute path, like: ``@path1/path2/filename`` // this points at node_modules folder by default

Like ES6 do

    import {exportedName1,exportedName2,...exportedNameN } from "./source/source/fileName"
    // above in paths .ts extension not required!

**Namespaces vs. Modules**

**Namespace**
- Organize application with JS Objects
- Can be split up over multiple files
- No module loader required
- Dependencies get difficult to manage in bigger applications

**Modules**
- Organize Applications with real Modules
- Can be split up over multiple files
- Module loader required
- Explicit dependency declaration

**Classes**

There is no this keyword. Constructor is not necessarily. Properties of a class may called fields. While extending a class the extended class needs a super() call in its own constructor method.

    class Person{
                Public | Private | Protected name: string
                //OR
                constructor (name:string) {
                                           this.name= "John"
                                            }
                aMethod():void{
                                console.log('Something...');
                                }
                }

    Modifiers
    Public   : Reached from every where, full access
    Private  : Just reached from inside this object (class)
    Protected: Reached from this object and its childs. Childs inherits everything

    extended classes can not overwrite  parent classes methods modifiers. They can still overwrite parent classeses methods.

- **static**: Used for both property and methods of the classes. This keyword serves properties and methods to usage from outside without creating instances.

- **abstract**: This keyword used with methods and classes. If used with classes these classes can not create instances. But can be extended to create new classes.
If used with methods these methods can not include any property or submethods. Extended classes should have this method. I not error thrown.

- **readonly**: Used with properties. We use this, if we want to read a property from outside but not to overwritten.

        public readonly name:string

**Singleton Class**

The class that only have one instance at the same time.

    class OnlyOne{
        private static instance:OnlyOne;
        provate constructor(public name: string){
                                                }
        static getInstance(){
            if(!OnlyOne.instance){
                                   OnlyOne.instance = new OnlyOne('thatOne');
                                    }
                                 return OnlyOne.instance
                             }
    }

    let wrong = new OnlyOne("New the one"); // throws an error
    let right = OnlyOne.getInstance(); // no error

**Interfaces**
Interface in TS is to standardize function inputs. They defines a custom type, describes the data, and the behaviour of the object to interacts with others. Interfaces used in compile time. They can't show up in compiled js file.
Interfaces are gatekeepers for generic functions parameters/arguments. This functions can accept any argument which can pass this interface filter.

Sample code:

      interface NamedPerson {
        firstName: string;
        age?:number; // this question mark means age is optional
        [anyPropertyName: string]: any; // if we dont know incoming property(parameter) name and we don't now type of the value of this property.
        greet2(lastName: string): void
      }

      function greet(person:NamedPerson) {
        console.log("Hello," +person.firstName);
      }

      function changeName(person: NamedPerson) {
        person.firstName = "Anna";
      }

      const person: NamedPerson = {
        name: "Max",
        age: 25,
        greet2(lastName: string){
            console.log("Hi, I am "+ this.firstName +" "+ lastName);
        }
      };

      greet(person);
      changeName(person);
      greet(person);
      person.greet2("Doe");

  // TS throws an error because interface guaranteed that input is as described. If not, on compile time error thrown. This is good to manage and standardize function inputs from one center.

  > We should correct person objects name property to firstName to compile properly.

  If we send object literal directly to function like:

    greet({name:"Anna", age:34})

  TS behave more strictly on this.
  We can add methods into interfaces. An interface could/should has all properties and methods function needs and also incoming argument/object has.

If a class want to implement this interface:

    class Person implements NamedPerson {
        firstName: string;
        greet3( lastName: string){
            console.log("Hi, I am "+ this.firstName +" "+ lastName);
        }
    }

in any ts file if we wish to use any interface from another ts file first import this interface than implement it on to a class like above. This makes TS to help us to apply interface on the place.

**IMPORTANT:** Interfaces itself doesn't get compiled. They are just used for compiling time checks for development . So you cant see interfaces in compiled js files. :)

**Interfaces VS Abstract Classess**
---

**Generics**
T and U generic names are used by convention. T is just the type of the parameter. And it is a kind of variable.

    function genericFuncion<T>(data: T) {
        return data;
     }
Generic functions tells TypeScript data will send with its type automatically or manually. This makes easy development while using this function.

    genericFunction<number>("just a string"); // TS thows an error here. Because we declared data is number type.
    // we should use number with <number> declaration

as we use generics TS warn us while using properties of data we sent. ```genericFunction("`this is text").length``` will give us 12 as same if we use ``` genericFunction(23).length ``` we will get an error from TS compiler.

We can use custom types with as like ``genericFunction<ACustomType>(data:ACustomType)``

**Built-in Generics**

- Arrays ```const testResults: Array<number> = [12.4,45.6,23]``` we can't push string into that array

**Arrays**

    function printAll<T>(args: T[]) {
    args.forEach( (element)=> console.log(element))
    }

    printAll<string>(["Apple","Banana"]);

These two usages are identical:

    var array: number[] = [1,2,3];
    var array2: Array<number> = [1,2,3];

If we are using arrays in an array which includes strings:

    const parentArray: string[][] = [['ford', 'toyota','chevy']];

**Generic Types**

    const echo2: <T>(data: T) => T = betterEcho;
Here is a generic type of function ``<T>(data: T) => T`` is type.

**Generic Classes**

    class SimpleMath<T> {
        baseValue: T;
        multiplyValue: T;
        calculate():number {
            return +this.baseValue * +this.multiplyValue;
            }
    }
    // usage is:
     const myMath = new SimpleMath<number>(); // T is number here!

after this setup you can use class as usual with more explicit. T letter is optional we can give ant name which match the rules of variable naming.

You can use Type of class with ``class SimpleMath<T extends number | string>``. By doing this  class can only be initiated with ``new SimpleMath<number>()`` or ``new SimpleMath<string>()`` . Without number and string type we've get an error (for example boolean).

We can describe a type with another character like ``U`` , so class will be

      class SimpleMath<T extends number, U extends string, >() {
          name: U
          baseValue: T;
          multiplyValue: T;
          calculate():number {
              return +this.baseValue * +this.multiplyValue;
              }
      }

Usage is ``const simpleMath = new SimpleMath<string, number>();``

**What this T letter means**
T is a kind of argument of generic class. All instantiations which typed like ``new SimpleMath<TYPE>`` TYPE may be number, string, boolean. Date etc., which type sent to the class, will be applied where T letter used. You can use any letter or word combination. You can use multiple (usually developers use 1 or 2 but not limited) generic types.

**Samples**

    class KeyValuePair<TKey, TValue>{
        public key: TKey,
        public value: TValue
    }

> Sample with an explanation

    function totalHeight(x: { length: number}, y: {length: number}): number {
        let total: number = x.length + y.length;
        return total;
    }

This function gets 2 parameters which each of them must be an object, which must have length property, which must be a number. And this function must return something, which must be a number.

**Decorators**

In tsconfig.json file ``"experimentalDecorators": true`` should set.
Decorators are functions with special signatures. Decorators can target classes, methods, properties and parameters.
If a decorator is going to be attached to a class, it will take only one argument.

    function logged(constructorFn: Function) {
        console.log(constructorFn);
    }

    @logged
    class Person {
        constructor() {
            console.log("Hi!")
        }

    }
The ``@`` sign gives a reference to class constructor.
The ``constructorFn`` is the target, and it targets to the constructor of class which is ``Function`` above.
The class's constructor function is ``function Person() { console.log("Hi!"")}`` so ``@logged`` logs to the console this.
This code prints on to the console is:

    function Person() {
        console.log("Hi!");
    }

> Multiple decorators can be added to the targets (classes, properties, methods or parameters)

    @ToDo
    @Validate
    @IsAlphaNumeric
    @RegEx
    class Person{
    //...
    }

**Factory**

 A director function which returns another function as a decorator.

    function logged(constructionFn: Function) {
        console.log(constructorFn)
        }

     @logged
     class Person {
        constructor() {
            console.log("Hi!")
        }
     }

    // Factory
    function logging(value: boolean) {
        return value ? logged : null;
    }

    @logging(true)
    class Car{

    }

**Method Decorator**

 to edit or change a behavior of a method inside a class. These decorators works on method, not class.

**Property Decorator**

**Parameter Decorator**

**JS Libraries with TypeScript**

- Jquery

    - in our ts file we can use ``declare var $: any;`` . This allows to use included jquery file inside html. But this is the bad way. Because typescript doesn't know anything about library.
  Instead of this, we are using declaration type script files with extension of ``.d.ts`` . These files automatically included compilation process by typescript. They are not compiled, they just used for telling TS to handle js libraries. You can find ready to use ``.d.ts`` files on the internet.
  TypeScripts read .d.ts files and learn how to use target js library.

  - Other alternative typings library

  - But more practical way is to install @types/jquery library with npm. And use jquery with any configuration needed.
  You can install other js libraries with same method. After installation just ``import "jQuery";`` in your ``.ts`` file.

**TypeScript WorkFlows**
 - Using tsc and tsconfig file
 - Gulp workflow
 - WebPack workflow
 -

**Source Maps**
- tsconfig.json option ``"sourceMap : true"`` makes debug mode active in browser. Thus, we can debug ``.ts`` files directly from inside browser. Browser knows ehere the sourcemap file from at the bottom line of js file ``//sourceMappingURL=orijinalJSfile.js.map``
SourceMap file matches ts file to js file line to line via line number.
So there are 4 same named files with different extensions,
    - ``fileName.ts`` TS file
    - ``fileName.d.ts`` Declaration files
    - ``fileName.js.map`` Source Maps file
    - ``fileName.js`` produced (compiled) js file

**system.js**
// system.js is old method for import-export things. We will cover this logic later.

**TS config file**

In our project directory at terminal

    tsc --init

creates a `tsconfig.json` file. In this file uncomment and change these two rows:

      "outDir": "./build",/* Redirect output structure to the directory. */
      "rootDir": "./src",/* Specify the root directory of input files. Use to control the output directory structure with --outDir. */

this change makes tsc automatically search for source files (ts files) in rootDir (which is ./src in our example) and export js files into outDir (which is ./build in our example). After the update in terminal `tsc` command do this compilation for us.
Additionally `tsc -w` (-w flag for watch) makes tsc watcher to any source file change in rootDir and compile it automatically.

**Sample Project Initiation /w Commands**
- mkdir "projectFolderName"
- mkdir "build"
- mkdir "src"
- npm init -y
- tsc --init
- npm install nodemon concurrently
- STEP: tsc configuration (tsconfig.json), change these lines.
    - "outDir": './build'
    - "rootDir": './src'
- STEP: package.json file changes
    -   Change this scripts part

    "scripts": {
                "start:build": "tsc -w",
                "start:run": "nodemon build/index.js",
                "start" :"concurrently npm:start:*"
                }

 `start:build` command runs `tsc -w` with **w**atch mode
 `start:run` command runs `nodemon build/index.js` as a first starting point of project
 `"start": "concurrently npm:start:*` runs all commands **concurrently** which starts with `start:*` (whatever after start:).    So tsc watching any change and compile if any, nodemon runs every time after compiling index.js, last start is doing this workflow concurrently.

 - run "npm start" command, you may get an error message in first time because index.js is not created, run second time and see what index.ts compiled into index.js and run.

**What is type assertion?**
In TypeScript, type assertion is a way to tell the compiler what is the type of a variable. Type assertion is used when the type of the target variable might not be known or the programmer knows better what is the actual type of it.
This makes a variables type to a type that only developer knows or creates which is not in default TS definitions. Usually new type is kind of Object like enum. But any type may be used. With enum,  saying to TS that variable will be one of this values.

repository: caglarorhan/typescript-notes

repo_name: caglarorhan/typescript-notes


text:
# Module 2

## Introduction
Now that you have implemented the Flutter app, you can move onto initializing your Amplify project.

At this point, you will need to have the Amplify CLI installed on your machine. Once installed, we will initialize Amplify at the root directory of our project, install the Amplify dependencies into our project, and ensure Amplify is properly configured during each run of our app.

## What You Will Learn
* Initialize a new Amplify project from the command line
* Add Amplify as a dependency for your project
* Initialize Amplify libraries at runtime

## Key Concepts
* Amplify CLI – The Amplify CLI allows you to create, manage, and remove AWS services directly from your terminal.
* Amplify Libraries – The Amplify libraries allow you to interact with AWS services from a web or mobile application.

## Implementation

If you have not already configured your Amplify CLI, be sure to run this:
``` bash
amplify configure
```
You will be guided through the configuration process. You can go Install and configure [here](https://docs.amplify.aws/cli/start/install#option-2-follow-the-instructions) for more information on configuring the CLI.

To create an Amplify project, you must initialize and configure the project at the root directory of your project.

**1.** Navigate to the root of your project:

``` bash
cd workshop_app
```
Verify that you are in the correct directory by running $ ls . Your output should list folders similar to below :

``` bash
➜  awsjs@f8ffc2296246 workshop_app % ls
README.md               build                   lib                     pubspec.yaml            workshop_app.iml
android                 ios                     pubspec.lock            test
```

**2.** Now initialize your project Amplify project by executing:
``` bash
amplify init
```
You should now be prompted with several questions on how to configure your project. If you press the Enter key for each question, it will give the default answer to each question, resulting in an output that should look similar to this:
``` bash
➜  photo_gallery git:(master) ✗ amplify init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project workshopapp
? Enter a name for the environment dev
? Choose your default editor: Visual Studio Code
? Choose the type of app that you\'re building flutter
Please tell us about your project
? Where do you want to store your configuration file? ./lib/
Using default provider  awscloudformation

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use default
```
After the CLI has finished crating your project in the cloud, you should get an output like this:
``` bash
✔ Successfully created initial AWS cloud resources for deployments.
✔ Initialized provider successfully.
Initialized your environment successfully.

Your project has been successfully initialized and connected to the cloud!
```

**3.** Next, we'll add auth to our amplify app, it's as simple as the below command with a couple of configuration items. Simply run :
``` bash
amplify add auth
```

Answer the questions as per below.
``` bash
 Do you want to use the default authentication and security configuration? Default configuration
 Warning: you will not be able to edit these selections.
 How do you want users to be able to sign in? Username
 Do you want to configure advanced settings? No, I am done.
 ```

**4.** To support events being sent from our application, we'll create an Amazon Pinpoint resource. Execute the following command :
``` bash
amplify add analytics
```

Answer the questions as per below.
``` bash
awsjs@f8ffc2296246 workshop_app % amplify add analytics
? Select an Analytics provider Amazon Pinpoint
? Provide your pinpoint resource name: workshopapp
Auth configuration is required to allow unauthenticated users, but it is not configured properly.
Adding analytics would add the Auth category to the project if not already added.
? Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated users to send analytics events? (we recommend you allow this when getting started) Yes
```

**5.** We're created an Amplify application configuration in our local environment, to get the Amplify CLI to create the requested AWS resources, we use the command :
``` bash
amplify push
```

Be sure to answer yes to continue.
``` bash
| Category  | Resource name       | Operation | Provider plugin   |
| --------- | ------------------- | --------- | ----------------- |
| Auth      | workshopapp702c5689 | Create    | awscloudformation |
| Analytics | workshopapp         | Create    | awscloudformation |
? Are you sure you want to continue? (Y/n) Y
```

**Congratulations, with your AWS resources successfully deployed, you're now ready to commence Module 3!**

[<- Module 1](../module1/README.md) || [Module 3 ->](../module3/README.md)

branch_name: refs/heads/main

gha_language: CSS


text:
---
name:
description:
order:
product-type:
product-state:
price:
product-description_markdown:
dimensions:
  width:
  height:
etsy-link:
image:
_comments:
  name: Add a title for the product. Don't include the type, e.g. T-shirt, in the name (this is added automatically).
  description: Add a meta description to help search engines index your product.
  product-type: Select type from the list.
  price: Enter without currency sign (in format of 10.00 or 12.34).
  product-description_markdown: Enter a description of the product (can copy across from Etsy).
  dimensions: Enter width and height for Art Prints only.
  width: Size in millimetres.
  height: Size in millimetres.
  etsy-link: Enter the link to the product page on Etsy.
  image: Upload an image (jpg) for the product.
  order: Enter the position you want the product to appear on the shop page. Lower numbers appear first. Use multiples of 10 for easy reordering.
---

repository: De-Mort/demort-website

gha_language: HTML

repo_name: De-Mort/demort-website


text:
---
layout: post
title: "More fun with AutoNBI"
date: 2015-04-13 08:05:53 +0100
comments: true
categories:
- NetInstall
- Python
---

Last time we saw our heroes, there was the unfuffilled promise of making small NetInstall sets. Now is the time to deliver on that promise. We're going to make a small NetInstall that will open up Terminal.app.

If you've not read the [previous post](http://grahamgilbert.com/blog/2015/04/12/building-custom-netinstalls-with-autonbi/) (and have got AutoNBI), go and do it now. I'll wait. All done? <!-- more -->

## Previously on 24

{% img /images/posts/2015-04-13/jack.gif %}

As mentioned in the previous post, we're aiming to have a small NetInstall set. Once you've made your NetInstall, open up ``NetInstall.dmg`` - you'll see a ``Packages`` directory. This is where the majority of the bulk in a NetInstall lives - the packages it actually installs. There is also a hidden ``BaseSystem.dmg`` which is what will load when your NetBoot the machine.

## I'm bored, can we make something please?

As I mentioned above, we're going to make a simple NetInstall that will open up a Terminal window. To do that, we're going to leverage something that Apple kindly left in the image for us - ``rc.imaging``. A bit of background - in ``/etc`` you'll find a series of ``rc.*`` files. One of those in a NetInstall is ``rc.install``, which will look for an ``rc.imaging`` file in a few places - one of those is ``/System/Installation/Packages/Extras`` - conveniently a location that Pepijn has made AutoNBI able to work with.

Somewhere on your Mac, make a directory called ``Packages`` and then inside that, make a directory called ``Extras``. Inside that directory we're going to create a file called ``rc.imaging`` with the following contents:

{% codeblock lang:bash Packages/Extras/rc.imaging %}
#!/bin/bash

/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal

/sbin/reboot
{% endcodeblock %}

And make sure it's executable:

``` bash
$ sudo chmod 755 Packages/Extras/rc.imaging
$ sudo chown root:wheel Packages/Extras/rc.imaging
```

And now to make the NetInstall:

```bash
$ sudo ./AutoNBI.py -s /Applications/Install\ OS\ X\ Yosemite.app -f Packages -d ~/Desktop -n MyNetInstall -e
```

The only change from last time is the ``-f`` option - this is the path to your ``Packages`` directory. I created my Packages directory in the same directory as AutoNBI.py - adjust the path if you made yours somewhere else.

{% img /images/posts/2015-04-13/netboot.png %}

You should now be able to boot off your tiny NBI (mine was 574MB) and have a bit of an explore. You'll notice that quite a bit is missing to achieve this tiny size - fortunately Pepijn has been working on getting Ruby and Python included in BaseSystem.dmg, so you have more scripting options when booted.

repository: poundbangbash/blog

extension: markdown

repo_name: poundbangbash/blog


text:
# Jupyter Kernel Mixing

This package provides a Jupyter Server extension that allows you to run local and remote
kernels side by side.

It does this by "mixing" the local and remote kernels together into a single collection
containing both.

This collection then keeps track of whether specific kernels were local or remote and
forwards any corresponding kernel requests accordingly.

## Installation

Install the `kernels-mixer` Python package using `pip`:

```sh
pip install kernels-mixer
```

## Setup

If you do not already have a Jupyter config file (e.g. `~/.jupyter/jupyter_lab_config.py`),
the first generate one with the following command:

```sh
jupyter lab --generate-config
```

The open your config file and add the following two lines to the end:

```py
import kernels_mixer
kernels_mixer.configure_kernels_mixer(c)
```

## Kernel Name Uniqueness

This extension expects that local and remote kernels have different names. If that is not
the case then the local kernel will override the remote kernel. For example, if there is
a local kernel named "python3", then any kernels in the remote kernel gateway named "python3"
will be hidden in favor of it.

When using this extension, it is recommended that the remote kernel gateway is set up to
add a prefix onto every kernel name in order to distinguish them from the local kernels.

Similarly, it is recommended that remote kernel display names are augmented to indicate
where they are running.

The default kernel gateway used with this extension is the regional GCP kernel gateway
hosted under `kernels.googleusercontent.com`, which ensures that both of those conditions
are followed.

repository: GoogleCloudPlatform/jupyter-extensions

gha_language: TypeScript

repo_name: GoogleCloudPlatform/jupyter-extensions


text:
# Java-DataBase-Connection

* In this I had done simple Java databases connection example with MySQL

## Steps to work with this project

 - Install ***Java*** in your machine.
 - Install ***Eclipse*** on you machine.
 - Click  this [link](https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar) , to download **MySQL Connector/J** 8.0.21 package

 - Click JRE System Libraries -> Build path -> Configure Build Path

![](./Images/1.png)

 - Click **Modulepath** on  Libraries

![](./Images/2.png)

 - Click **Add external JARs** on right

![](./Images/3.png)

 - Then select Mysql Connector/J which is download in step 3 and **click open**

![](./Images/4.png)

 - Finally click **Apply and Close**

 ![](./Images/5.png)

 Now open Secretes.java

 ```
final protected static String username = "";
final protected static String password = "";
```

Fill above credentials

  Now open student.sql and excute the SQL file in MySQL Server


text:
Yii2 Cloudwatch Logs Target
===========================

A Yii2 log target for AWS Cloudwatch Logs.

## Installation and Configuration

Install the package through [composer](http://getcomposer.org):

    composer require codemonauts/yii2-cloudwatch-logs

And then add this to your application configuration:

```php
<?php
return [
    // ...
    'components' => [
        // ...
        'log' => [
            'targets' => [
                [
                    'class' => \codemonauts\cloudwatchlogs\Target::class,
                    'region' => 'eu-west-1',
                    'logGroup' => '/webserver/production/my-craft',
                    'logStream' => 'instance-1', // omit for automatic instance ID
                    'levels' => ['error', 'warning', 'info', 'trace', 'profile'],
                    'logVars' => ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER'],
                    'key' => 'your-key', // omit for instance role
                    'secret' => 'your-secret', // omit for instance role
                ],
                // ...
            ],
        ],
```

## Configuration Options

 * (*string*) `$region` (required) The name of the AWS region e.g. eu-west-1
 * (*string*) `$logGroup` (required) The name of the log group.
 * (*string*) `$logStream` (optional) The name of the log stream. If omitted, it will try to determine the ID of the EC2 instance running on.
 * (*array*)  `$levels` (optional) Log level. Default by Yii2: ['error', 'warning', 'info', 'trace', 'profile']
 * (*array*)  `$logVars` (optional) Variables to log. Default by Yii2: ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER']
 * (*string*) `$key` (optional) Your AWS access key.
 * (*string*) `$secret` (optional) Your AWS secret.

## Rate limit
The Cloudwatch Logs API requires a sequence token to be send with the messages to a log stream. This token is returned after a transfer of messages to the log stream to be used at the next transfer. For multi-process systems this is hard to handle.

So AWS Cloudwatch Logs does not support multiple processes writing to the same log stream at the same time. Their official approach is to create a separate log stream for each process on each instance. But think of PHP-FPM with dynamic childs on several instances. This would end up in thousands of abandoned log streams in a log group after a while. Empty log streams are not deleted automatically and remain in the log groups. They do not cost anything, but make log groups very messy.

Our approach is to create only one log stream per instance. To be able to send log streams from multiple processes at the same time, the current sequence token of the log stream must be queried before each transmission. But the AWS Cloudwatch Log API has a rate limit of 60 requests per second for this type of request.

In order to avoid running into this rate limit, it is **highly advisable** to pass only those logs directly to Cloudwatch Logs that happen rarely and are important. For example Warnings and Errors.

In large infrastructures with many simultaneous processes with a high log load, it is still better to use file logging and the Cloudwatch Log Agent, as this is only a single process.

Maybe this will change in the future.

## Cloudwatch Logs Insights

If you want to parse the logs with Insights, then do something like this:

```
fields @timestamp, @message
| sort @timestamp desc
| limit 20
| parse '[*][*][*][*][*] *' as ip, userId, sessionId, logLevel, category, message
```

gha_language: PHP


text:
---
layout: archive
lang: en
ref: ros2_openmanipulator_x_applications
read_time: true
share: true
author_profile: false
permalink: /docs/en/platform/openmanipulator_x/ros2_applications/
sidebar:
  title: "OpenMANIPULATOR-X"
  nav: "openmanipulator_x"
product_group: openmanipulator_x
page_number: 18
---

# [[ROS 2] Applications](#ros-2-applications)

## [Master and Slave](#master-slave)

In this example, if the user is holding the master OpenManipulator, the slave OpenManipulator-X moves like master robot. Recording mode allows you to save the trajectory as you move the master OpenManipulator-X and play it back to the slave OpenManipulator.

### [Setup OpenManipulator-X](#setup-openmanipulator-x)
Since you need to control two OpenManipulators on one PC, use two U2D2s and two OpenManipulators to connect as shown below.

![](/assets/images/platform/openmanipulator_x/OpenManipulator_master_slave_connection.png)

![](/assets/images/platform/openmanipulator_x/OpenManipulator_master_slave.png)
#### Master OpenManipulator
Master OpenManipulator-X is a robot that is controlled by the user. This is easy to move because no torque is applied to dynamixel. DYNAMIXEL of master OpenManipulator-X sets the ID as below and the baudrate as 1000000bps.

|  Name   | DYNAMIXEL ID |
|:-------:|:------------:|
| Joint 1 |      1       |
| Joint 2 |      2       |
| Joint 3 |      3       |
| Joint 4 |      4       |
| Gripper |      5       |

#### Slave OpenManipulator
Slave OpenManipulator-X moves synchronously with Master OpenManipulator. DYNAMIXEL of slave OpenManipulator-X sets the ID as below and the baudrate as 1000000bps. This is the same as the default OpenManipulator-X setting.

|  Name   | DYNAMIXEL ID |
|:-------:|:------------:|
| Joint 1 |      11      |
| Joint 2 |      12      |
| Joint 3 |      13      |
| Joint 4 |      14      |
| Gripper |      15      |

### [Install Package](#install-package)
Run the following command in a terminal window.

``` bash
$ cd ~/robotis_ws/src/
$ git clone -b ros2 https://github.com/ROBOTIS-GIT/open_manipulator_applications.git
$ cd ~/robotis_ws && colcon build --symlink-install
```
If the catkin_make command has been completed without any errors, all the preparations are done.

### [Execute Example](#execute-example)

Run **the controller of slave OpenManipulator**. Open the other terminal window and enter the following command in the terminal.
`dynamixel_usb_port` is a parameter to set use port to connected with Dynamixel of slave OpenManipulator. It should be set **/dev/ttyUSB@** and it is different from use port of master OpenManipulator.

``` bash
$ ros2 launch open_manipulator_x_controller open_manipulator_x_controller.launch.py
```

{% capture warning_01 %}

**WARNING** :
Please check each joint position before running OpenMANIPULATOR-X. It might stop operation because of joint position out of range.
The picture on the below is showing you the ideal pose of OpenMANIPULATOR-X. Please adjust each joints along with the following picture when DYNAMIXEL torque isn't enabled.

{% endcapture %}

{{ warning_01 | markdownify }}

And Open the other terminal window and enter the following command in the terminal. This command is to run **the controller of master OpenManipulator**.
`usb_port` is a parameter to set use port to connected with Dynamixel of master OpenManipulator. It should be set **/dev/ttyUSB@** and it is different from use port of slave OpenManipulator.

If the master OpenManipulator-X controller has been launched successfully, the terminal will show the following message.

```
port_name and baud_rate are set to /dev/ttyUSB0, 1000000
Joint Dynamixel ID : 11, Model Name : XM430-W350
Joint Dynamixel ID : 12, Model Name : XM430-W350
Joint Dynamixel ID : 13, Model Name : XM430-W350
Joint Dynamixel ID : 14, Model Name : XM430-W350
Gripper Dynamixel ID : 15, Model Name :XM430-W350
[INFO] Succeeded to Initialise OpenManipulator-X Controller
```

And Open the other terminal window and enter the following command in the terminal. This command is to run **the controller of master OpenManipulator**.
`usb_port` is a parameter to set use port to connected with DYNAMIXEL of master OpenManipulator. It should be set **/dev/ttyUSB@** and it is different from use port of slave OpenManipulator.

``` bash
$ ros2 run open_manipulator_x_master_slave open_manipulator_x_master_slave
```

If the slave OpenManipulator-X controller has been launched successfully, the terminal will show the following message.

```
port_name and baud_rate are set to /dev/ttyUSB1, 1000000
Joint Dynamixel ID : 1, Model Name : XM430-W350
Joint Dynamixel ID : 2, Model Name : XM430-W350
Joint Dynamixel ID : 3, Model Name : XM430-W350
Joint Dynamixel ID : 4, Model Name : XM430-W350
Gripper Dynamixel ID : 5, Model Name :XM430-W350
```

So, you can see the following message in the terminal window. You can check the current control mode and robot status(joint angle, tool position).

```
-----------------------------
Control Your OpenManipulator!
-----------------------------
Present Control Mode
Master - Slave Mode
-----------------------------
1 : Master - Slave Mode
2 : Start Recording Trajectory
3 : Stop Recording Trajectory
4 : Play Recorded Trajectory
-----------------------------
Present Joint Angle J1: -0.170 J2: 0.367 J3: -0.046 J4: 0.959
Present Tool Position: 0.000
-----------------------------
```
There are four control modes. Please enter that number in the terminal.

1. Master-Slave Mode: Master robot and slave robot move synchronously.
2. Start Recording Trajectory: Master robot and slave robot move synchronously and the controller records the moving trajectory.
3. Stop Recording Trajectory: Ends the recording.
4. Play Recorded Trajectory: The trajectory recorded in the 2nd mode is reproduced only by the slave robot.

[OpenCR]: /docs/en/parts/controller/opencr10/
[OpenCR Manual]: /docs/en/parts/controller/opencr10/
[rc100]: /docs/en/parts/communication/rc-100/
[bt410]: /docs/en/parts/communication/bt-410/

[open_manipulator_msgs/GetJointPosition]: /docs/en/popup/open_manipulator_msgs_GetJointPosition/
[open_manipulator_msgs/GetKinematicsPose]: /docs/en/popup/open_manipulator_msgs_GetKinematicsPose/
[open_manipulator_msgs/SetJointPosition]: /docs/en/popup/open_manipulator_msgs_SetJointPosition/
[open_manipulator_msgs/SetKinematicsPose]: /docs/en/popup/open_manipulator_msgs_SetKinematicsPose/
[open_manipulator_msgs/SetActuatorState]: /docs/en/popup/open_manipulator_msgs_SetActuatorState/
[open_manipulator_msgs/SetDrawingTrajectory]: /docs/en/popup/open_manipulator_msgs_SetDrawingTrajectory/

[sensor_msgs/JointState]: /docs/en/popup/sensor_msgs_JointState_msg/
[open_manipulator_msgs/KinematicsPose]: /docs/en/popup/open_manipulator_msgs_KinematicsPose/
[open_manipulator_msgs/OpenManipulatorState]: /docs/en/popup/open_manipulator_msgs_OpenManipulatorState/
[std_msgs::String]: /docs/en/popup/std_msgs_string/

[task space]: /docs/en/popup/open_manipulator_coordinates/
[joint space]: /docs/en/popup/open_manipulator_coordinates/

repository: CUMTwh/emanual

repo_name: CUMTwh/emanual


text:
### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [0.8.1](https://github.com/as2network/lib/compare/0.8.0...0.8.1)

> 19 January 2021

- feat(packages): as2network utils [`#2`](https://github.com/as2network/lib/pull/2)
- 0.8.0 [`#1`](https://github.com/as2network/lib/pull/1)
- feat: changelog [`6f9db26`](https://github.com/as2network/lib/commit/6f9db26a549afa8fc2d113e3c67813e5e6fc7076)
- chore(repo): minor fixes [`faa46eb`](https://github.com/as2network/lib/commit/faa46eb1ce4cf03fa5d8d65ad3abfc7ff27140a5)
- docs(changelog): update [`f24f8d4`](https://github.com/as2network/lib/commit/f24f8d48a423c7edaacacabe471b79915a5cb2c0)

#### [0.8.0](https://github.com/as2network/lib/compare/0.7.0...0.8.0)

> 11 November 2020

- docs(changelog): release docs [`042e4be`](https://github.com/as2network/lib/commit/042e4bed181be1d5c1704b32992598b93aab9fa7)
- feat(docs): complete documentation [`88f6f45`](https://github.com/as2network/lib/commit/88f6f4549b139c072dd28acfcc9a4d49ce6d7c77)
- Delete package-lock.json [`1357d96`](https://github.com/as2network/lib/commit/1357d96ff47c903bc46d8965ae1bbe3e189b75dc)

#### [0.7.0](https://github.com/as2network/lib/compare/0.3.1...0.7.0)

> 10 November 2020

#### 0.3.1

> 12 November 2020

- fix(npm): fix issue with unpublished npm package [`#24`](https://github.com/as2network/lib/issues/24)
- feat(release): v0.7.0 [`3d8b355`](https://github.com/as2network/lib/commit/3d8b355c055c195aea0a81040376c29de23a6490)
- docs(changelog): release docs [`042e4be`](https://github.com/as2network/lib/commit/042e4bed181be1d5c1704b32992598b93aab9fa7)
- feat(docs): complete documentation [`88f6f45`](https://github.com/as2network/lib/commit/88f6f4549b139c072dd28acfcc9a4d49ce6d7c77)

gha_license_id: Unlicense


text:
+++
title = "ADB and Fastboot Errors"
date = "2016-02-04 08:29:03"
description = "(bootloader) Data size exceeds download buffer"
draft = false
+++

I ran into a couple interesting problems when I flashed a new ROM on a Nexus 6.  One involving adb sideload and another with fastboot (`flash-all.sh` provided by google to quickly flash the stock image)

>Note: Using Nexus 6 with Cyanogen Mod 12 (Lollipop) and Ubuntu 15.10

## Android Debug Bridge Protocol Fault ####

I installed`android-tools-adb` and `android-tools-fastboot` from the official Ubuntu repositories in order to connect to the phone.  I ran `adb devices` to identify the phone and then attempted to sideload an image.

I was met with `error: protocol fault (no status)`.  Uh oh.

```bash
$ adb devices
List of devices attached
<id of phone> sideload
$ adb sideload android.zip
error: protocol fault (no status)
```

Adb version `1.0.32` is required to communicate with Android 5.0 (or greater).  The offical Ubuntu repositories contain version `1.0.31`.

[Nicolas Bernaerts][adb-update] published a guide to updating adb on Ubuntu.  I ran the following commands to update adb.

```bash
$ adb version
Android Debug Bridge version 1.0.31
$ wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb
$ sudo mv adb /usr/bin/adb
$ sudo chmod +x /usr/bin/adb
$ adb version
Android Debug Bridge version 1.0.32
```

## Fastboot Remote Failure (data size exceeds download buffer) ####

Instead of flashing a new Cyanogen Mod image, I decided to flash [Google's factory image][nexus-factory] for the Nexus 6.  Google provides a handy tarball that contains all the files necessary to flash your phone and a handy shell script `flash-all.sh` which should flash all the image files.

![Tarball Contents](/assets/nexus-tarball.png)

When I ran the shell script I was met with a `(bootloader) Data size exceeds download buffer` error.  Uh oh.

```bash
$ ./flash-all.sh
...
sending 'system' (2048781 KB)...
(bootloader) Data size exceeds download buffer
FAILED (remote failure)
finished. total time: 0.940s
```

I extracted the contents of `image-shamu-mmb29q.zip` reveling `boot.img` `cache.img` `recovery.img` `system.img` and `userdata.img`.  I manually flashed each file in the following order while inside the bootloader:

>Running `fastboot flash userdata userdata.img` will wipe your phone

```bash
fastboot flash bootloader bootloader.img
fastboot reboot-bootloader
fastboot flash radio radio.img
fastboot reboot-bootloader
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot erase cache
fastboot flash cache cache.img
```

After I flashed each of the image files I booted into recovery and did a `factory data reset` and rebooted.

[nexus-factory]: https://developers.google.com/android/nexus/images
[adb-update]: http://bernaerts.dyndns.org/linux/74-ubuntu/328-ubuntu-trusty-android-adb-fastboot-qtadb

repository: sdwalsh/mirango-theme

repo_name: sdwalsh/mirango-theme


text:
The Puli Factory Component
==========================

[![Latest Stable Version](https://poser.pugx.org/puli/factory/v/stable.svg)](https://packagist.org/packages/puli/factory)
[![Total Downloads](https://poser.pugx.org/puli/factory/downloads.svg)](https://packagist.org/packages/puli/factory)
[![Dependency Status](https://www.versioneye.com/php/puli:factory/1.0.0/badge.svg)](https://www.versioneye.com/php/puli:factory/1.0.0)

**ATTENTION: This package is not maintained anymore.**

Latest release: [1.0.0-beta](https://packagist.org/packages/puli/factory#1.0.0-beta)

PHP >= 5.3.9

The [Puli] Factory Component contains a single interface [`PuliFactory`] for
creating Puli's [resource repository] and [discovery]. Implementations of this
class are typically generated with the [Puli CLI]. If you need specialized
service definitions, you should implement the interface by hand.

Read [Puli at a Glance] to learn more about Puli.

Authors
-------

* [Bernhard Schussek] a.k.a. [@webmozart]
* [The Community Contributors]

Installation
------------

Follow the [Getting Started] guide to install Puli in your project.

Documentation
-------------

Read the [Puli Documentation] to learn more about Puli.

Contribute
----------

Contributions to are very welcome!

* Report any bugs or issues you find on the [issue tracker].
* You can grab the source code at Puli’s [Git repository].

Support
-------

If you are having problems, send a mail to<EMAIL_ADDRESS>or shout out to
[@webmozart] on Twitter.

License
-------

All contents of this package are licensed under the [MIT license].

[Puli]: http://puli.io
[resource repository]: https://github.com/puli/repository
[discovery]: https://github.com/puli/discovery
[Puli CLI]: https://github.com/puli/cli
[Bernhard Schussek]: http://webmozarts.com
[The Community Contributors]: https://github.com/puli/factory/graphs/contributors
[Getting Started]: http://docs.puli.io/en/latest/getting-started.html
[Puli Documentation]: http://docs.puli.io/en/latest/index.html
[Puli at a Glance]: http://docs.puli.io/en/latest/at-a-glance.html
[issue tracker]: https://github.com/puli/issues/issues
[Git repository]: https://github.com/puli/factory
[@webmozart]: https://twitter.com/webmozart
[MIT license]: LICENSE
[`PuliFactory`]: http://api.puli.io/latest/class-Puli.Factory.PuliFactory.html

repository: puli/factory

repo_name: puli/factory


text:
# `@data` variables

The following `@data` variables are implemented by Handlebars and its builtin helpers.

## `@root`

Initial context with which the template was executed.

```handlebars
{{#each array}}<EMAIL_ADDRESS>{{/each}}
```

Unless explicitly modified, this value is consistent across all portions of the page rendering, meaning it can be used
within partials where depthed parameters are unable to reference their parent templates.

## `@first`

Set to true by the `each` helper for the first step of iteration.

```handlebars
{{#each array}} {{#if @first}} First! {{/if}} {{/each}}
```

## `@index`

Zero-based index for the current iteration step. Set by the `each` helper.

```handlebars
{{#each array}} {{@index}} {{/each}}
```

## `@key`

Key name for the current iteration step. Set by the `each` helper when iterating over objects.

```handlebars
{{#each array}} {{@key}} {{/each}}
```

## `@last`

Set to true by the `each` helper for the last step of iteration.

```handlebars
{{#each array}} {{#if @last}} Last :( {{/if}} {{/each}}
```

## `@level`

Assigned log level.

```js
template({}, { data: { level: Handlebars.logger.WARN } });
```

May be set to one of `Handlebars.logger.DEBUG` , `Handlebars.logger.INFO` , `Handlebars.logger.WARN` , or
`Handlebars.logger.ERROR`

When set, the logger will include in its output only messages with a log level of `Handlebars.logger.level` or higher.
The default value is `Handlebars.logger.ERROR`.

repository: handlebars-lang/docs

gha_language: JavaScript

repo_name: handlebars-lang/docs


text:
locker
==

A local synchronization library for an erlang applications.

Example usage:

```erlang
    locker:lock({some, term}),
    % do something
    locker:unlock({some, term}).
```

Functions brief:

* `lock/{1,2}` — wait for release of resource, then lock it (sync);
* `trylock/1` — tries to lock the resource; fails if the resource is already locked;
* `islocked/1` — returns true if the resource is locked by caller process, otherwise return false;
* `withlock/2` — executes a given function under captured lock;
* `lend/2` — if process-executor have captured lock, `lend` tries to pass ownership of locked resource
  to another process, which is identified by given PID.

You can obtain more information in sources: `src/locker.erl`


text:
robotc-tap
==========

[Test Anything Protocol](http://testanything.org/tap-version-13-specification.html) for [RobotC](http://robotc.net). Basically a bunch of unit test helper functions, that outputs to the debug stream.

# How To

1. Click [Download Zip](https://github.com/ArtskydJ/robotc-tap/archive/master.zip).
2. Copy the `tap.c` file to the directory that you want to test.
3. Create a unit test file, maybe `test.c`, or `run_Tests.c`.
4. In the file, write `#include "tap.c"`.
5. Use the [Functions](#functions) provided.
6. Compile and run your unit test file.

# Example

```c
#include "tap.c"

task main() {

	tTest("the test suite works");
		tOk(true);
		tNotOk(false, "not ok ever!");
		tEqual(17, 83-66, "83-56=17");
		tNotEqual(10, 100, "ten ain't a hundred!");
		tPass("oh yes");

	tTest("this is the second test");
		tFail("failing # TODO make this not fail");
		tFail("skipping # SKIP make this skip");

	tTest("the test suite works");
		tEqual(17, 17, "17=17");
		tEqual(10, 10, "ten ain't a hundred!");
		tPass("such win");
	tEnd(); //Only run this at the end
}
```

# Functions

For a quick and dirty namespace solution, internal global variables and functions start with "_", and user functions start with "t" (for test).

## `tTest(string msg)`

This starts a new set of tests, and resets some internal counters. This also ends the previous set of tests, if there was one.

Code:
```c
tTest("my function is awesome");
```
Output:
```
# my function is awesome
```

## `tOk(bool test, string message)`

This checks if `test` is `true`.

Code:
```c
tOk(bLcdBacklight, "the backlight is on");
```
Output:
```
ok 1 the backlight is on
```

## `tNotOk(bool test, string message)`

This checks if `test` is `false`.

Code:
```c
tNotOk(bLcdBacklight, "the backlight is off");
```
Output:
```
ok 2 the backlight is off
```

## `tEqual(int test, int expected, string message)`

This checks if `test` equals `expected`.

Code:
```c
tEqual(motor[MY_MOTOR], 127, "MY_MOTOR is running full speed.");
```
Output:
```
ok 3 MY_MOTOR is running full speed.
```

## `tNotEqual(int test, int unexpected, string message)`

This checks if `test` does not equal `unexpected`.

Code:
```c
tNotEqual(motor[MY_MOTOR2], 0, "MY_MOTOR is not still");
```
Output:
```
ok 4 MY_MOTOR2 is not still
```

## `tPass(string message)`

This is a test that always passes.

Code:
```c
tPass("yay this works")
```
Output:
```
ok 5 yay this works
```

## `tFail(string message)`

This is a test that always fails.

Code:
```c
tFail("that was predictable")
```
Output:
```
not ok 6 that was predictable
  ---
  got: 0
  expected: 1
  ...
```

## `tEnd(string message)`

This ends the *last* set of tests. Use `tTest()` to end any set that isn't last.

# License

[MIT](https://choosealicense.com/licenses/mit/)

repository: ArtskydJ/robotc-tap

repo_name: ArtskydJ/robotc-tap


text:
# Active Admin Editor

## This fork includes an update that allows carrierwave to be used for image uploads

This is a wysiwyg html editor for the [Active Admin](http://activeadmin.info/)
interface using [wysihtml5](https://github.com/xing/wysihtml5).

![screenshot](https://dl.dropbox.com/u/1906634/Captured/OhvTv.png)

[Demo](http://active-admin-editor-demo.herokuapp.com/admin/pages/new)

## Installation

Add the following to your `Gemfile`:

```ruby
gem 'active_admin_editor'
```

And include the wysiwyg styles in your `application.css`:

```scss
//= require active_admin/editor/wysiwyg
```

Then run the following to install the default intializer:

```bash
$ rails g active_admin:editor
```

## Usage

This gem provides you with a custom formtastic input called `:html_editor` to build out a wysihtml5 enabled input.
All you have to do is specify the `:as` option for your inputs.

**Example**

```ruby
ActiveAdmin.register Page do
  form do |f|
    f.inputs do
      f.input :title
      f.input :content, as: :html_editor
    end

    f.buttons
  end
end
```

## Uploads

The editor supports uploading of assets directly to an S3 bucket. Edit the initializer that
was installed when you ran `rails g active_admin:editor`.

```ruby
ActiveAdmin::Editor.configure do |config|
  config.s3_bucket = '<your bucket>'
  config.aws_access_key_id = '<your aws access key>'
  config.aws_access_secret = '<your aws secret>'
  # config.storage_dir = 'uploads'
end
```

Then add the following CORS configuration to the S3 bucket:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>Location</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
```

## Configuration

You can configure the editor in the initializer installed with `rails g
active_admin:editor` or you can configure the editor during
`ActiveAdmin.setup`:

```ruby
ActiveAdmin.setup do |config|
  # ...
  config.editor.aws_access_key_id = '<your aws access key>'
  config.editor.s3_bucket = 'bucket'
end
```

## Parser Rules

[Parser rules](https://github.com/xing/wysihtml5/tree/master/parser_rules) can
be configured through the initializer:

```ruby
ActiveAdmin::Editor.configure do |config|
  config.parser_rules['tags']['strike'] = {
    'remove' => 0
  }
end
```

Be sure to clear your rails cache after changing the config:

```bash
rm -rf tmp/cache
```

## Heroku

Since some of the javascript files need to be compiled with access to the env
vars, it's recommended that you add the [user-env-compile](https://devcenter.heroku.com/articles/labs-user-env-compile)
labs feature to your app.

1. Tell your rails app to run initializers on asset compilation

   ```ruby
   # config/environments/production.rb
   config.initialize_on_precompile = true
   ```
2. Add the labs feature

   ```bash
   heroku labs:enable user-env-compile -a myapp
   ```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

### Tests

Run RSpec tests with `bundle exec rake`. Run JavaScript specs with `bundle
exec rake konacha:serve`.

gha_language: Ruby


text:
This repository is a collection of simple USD projects. Each project
shows off a single feature or group of USD features.

## Structure summary

```
Folders
- concepts/
 - {CONCEPT_NAME}
  - README.md
  - cpp/
  - python/
  - usda/
- guides/
- tricks/
```

Each USD feature is in the "concepts" folder. Most features have a C++,
python, and USDA project folder where you can see how to author that
feature in each representation and how it actually looks when it gets
written in USD.

## How to view
If a concept folder is trying to show off a USD feature but it takes a
lot of code then the top-level README.md file is there to summarize the
important bits. It may also refer to other resources for where to read
more.

Lastly, source-code files may contain explanations for what is shown.
Each of these lines is marked with `XXX`.

## How to build
### C++
Unless a C++ project has specific instructions, every project compiles
and executes using the following commands:

```bash
cd {some_concept_cpp_folder}/build
USD_INSTALL_ROOT=/wherever/you/installed/USD/to cmake ..
make
./run_it
```

`USD_INSTALL_ROOT` typically defaults to `/usr/local/USD`
on Linux but your location may vary.
See [USD's build documentation](https://github.com/PixarAnimationStudios/USD#3-run-the-script) for details.

### Python
Python modules can always run using `python name_of_module.py`

## Folder Explanation
- `concepts` is where you'll find simple, single features shown by-example.
It will have C++, Python, and USDA example projects (whenever possible).
If you're the type that makes flashcards, you'll get the most mileage
here.
- `guides` contains articles of ideas and references that help a user
learn USD.
- `tricks` is a mixed bag of situations that come up in production and
general proof-of-concepts on how to do certain operations in USD. This
folder has projects that are too complex or niche to fit in `concepts`.
There's no defined structure for this folder.

## Studying
This repository exists mainly as a reference for USD source-code. That
said, if you want to treat as if this is a library of tutorials, here's
a recommended viewing order:

[add_comment](concepts/add_comment)

[set_kind](concepts/set_kind)

[specializes](concepts/specializes)

[uniquify_an_instance](tricks/uniquify_an_instance)

[asset_info](concepts/asset_info)

[userProperties](concepts/userProperties)

[world_bounding_box](concepts/world_bounding_box)

[relationship_forwarding](concepts/relationship_forwarding)

[variant_set_in_stronger_layer](tricks/variant_set_in_stronger_layer)

[variant_set_production_shot](tricks/variant_set_production_shot)

[specializes_glossary_example](tricks/specializes_glossary_example)

[specializes_a_practical_example](tricks/specializes_a_practical_example)

[specializes_as_a_fallback_mechanism](tricks/specializes_as_a_fallback_mechanism)

[purposes](concepts/purposes)

[reference_into_prim](tricks/reference_into_prim)

[stl_iteration](tricks/stl_iteration)

[stl_iteration2](tricks/stl_iteration2)

[orphaned_over](tricks/orphaned_over)

[variant_set_auto_selections](tricks/variant_set_auto_selections )

[copy_variant_set_to_prim](concepts/copy_variant_set_to_prim)

[enable_debugging](concepts/enable_debugging)

[profiling](guides/profiling_usd.md)

[usdview_auto_reloader](tricks/usdview_auto_reloader)

[variant_fallbacks](concepts/variant_fallbacks)

[registered_variant_selection_export_polices](guides/registered_variant_selection_export_polices)

[plugin_metadata](concepts/plugin_metadata)

[custom_resolver](concepts/custom_resolver)

[bound_material_finder](concepts/bound_material_finder)

[fast_export](tricks/fast_export)

[flatten_layer_stack](tricks/flatten_layer_stack)

[value_clips](concepts/value_clips)

[mesh_with_materials](concepts/mesh_with_materials)

[sdf_change_block](concepts/sdf_change_block)

[batch_namespace_edit](concepts/batch_namespace_edit)

[caching](concepts/caching)

[multi_payload](concepts/multi_payload)

[notices](concepts/notices)

[notice_send](concepts/notice_send)

There's also Anki deck for this repository, which you can download
[by clicking here](https://drive.google.com/file/d/1qx8N9wwL2ufviuWcQrY3zT2S6GN6nrg7/view?usp=sharing)

## Roadmap
See [This wiki page](https://github.com/ColinKennedy/USD-Cookbook/wiki)
for a list of planned topics that will be added in the future.

## Contributing
This repository is a constant WIP. If there's something that you'd like
to see written about, please suggest it as an issue so that I / others
can pick it up and work on it. Also, if you have something that you'd
like to contribute, please make a PR. Submissions are welcome!

## Disclaimer
But note: This repository may not actually show the best way to do
things in USD. It's just a collection of (my) personal findings. Also,
as Pixar comes out with new USD releases and learning resources, this
information may become out-of-date. Always prefer primary guides and
documentation over anything that you see here.

## Final Note
Tested with:
- CentOS 7.6
- USD 19.07
- cmake version 3.13.4
- make 3.82
- g++ 8.3.0

repository: jonntd/USD-Cookbook

repo_name: jonntd/USD-Cookbook


text:
---
title: Context Class
page_title: Context Class
description: Context Class
slug: datastorage-contextobject
tags: context,class
published: True
position: 0
---

# Context Class

The **Context** class represents a session with the SQLite database and allows you to perform CRUD operations on the data. It is an implementation of the well-known *Unit of Work* pattern and is a central place in all interactions with the database. The main responsibilities of the **Context** class at run time are:

* to materialize the raw data returned from the database as entity objects
* to track changes that were made to entity objects
* to transfer changes of the entity objects to the database
* to track objects that are bound to controls
* to handle concurrent requests to the database

## Context Class

The **Context** class constructor requires two parameters:

* *databaseName* (string): The name of database file.
* *location* (DatabaseLocation): The location of database file, this parameter is optional. The available values are:
	* **Local** (default): The database file is stored in isolated Local storage.
	* **Roaming**: The database file is stored in isolated Roaming folder.
	* **Temporary**: The database file is stored in isolated Temp folder.
	* **Fullpath**: The database file is specified by full path to location in any available isolated storage.

>If you specify full path in the *databaseName*, the *location* parameter should be **FullPath**.

	var context = new Context("CarsDB", DatabaseLocation.Roaming);

The **Context** class has methods for CRUD operatoins - See [this article]({%slug datastorage-crudoperationsoverview%}) for full description of these methods.

Here are the methods that keep the persistency in the database:

* **SaveChanges**(): Saves all changes made since the last call of this method. This methods should be called in order to persist current state of the tracked objects in the database.
* **SaveChangesAsync**(): Saves asynchronously changes made in the context. The return value is **void**.
* **CloseDatabase**(): Closes the database and releases all allocated resources.

You can use the **Context** class directly with composition in a custom class that provides some meaningful methods for CRUD operations or, of course, you can derive from it extending its functionality.

## Good to Know

The most important thing to keep in mind is that during its lifetime, the context object is associated with a concrete database, specified at the creation of the object and disposed by calling the **CloseDatabase**() context method. You should use only one global instance of **Context** class bound to a concrete database in order to work with actual data.

Never forget that all changes to the entity objects will be preserved in the context's cache until the **SaveChanges**() method is called. That means the developer should consider carefully when to call this method in order to persist changes to the real database.

It is important to take into account the context’s cache since it is the first place that is checked for requested data during CRUD operations and a central repository for all changes done between two calls of the **SaveChanges**() method. Good practice is to keep the time between two calls of this method short because, as more objects are loaded into memory, the memory consumption of the context may increase and this may cause performance issues.

If entity classes implement **INotifyPropertyChanged** interface, they are exclusively tracked in context cache and can be used for binding operations. The entity objects will live until the **CloseDatabase**() method of the context is called and their actual state will be retrieved from the context cache. The most important issue with these objects that developers should consider is tracking of their previous state in case of changes via binding to user controls. In this case, the entity objects in the context cache are changed automatically by the framework. According to the application workflow, the new state may not be accepted and the previous object's state will be required for explicit update operation in order to revert the changes. This is a typical scenario of "Cancel" operation after filling a form bound to entity object.

# See Also

 * [Overview]({%slug datastorage-entities-overview%})
 * [CRUD Operations Overview]({%slug datastorage-crudoperationsoverview%})
 * [Good Practices]({%slug datastorage-goodpractices%})

repository: telerik/uwp-docs

repo_name: telerik/uwp-docs


text:
# tmiMobileApp - Demo Prerequisites

## TrustMeInsurance WebApp setup
This [link](https://github.ibm.com/gsi-isv/ciam-demo.git) will take you to the TrustMeInsurance WebApp Github repository.

## Phone OR Android Studio Emulator
Make sure the phone or emulator size is in between 5.5 to 6.5 inches.
### [Install Android Studio](index.md#demo-pre-requisites)
### [Setup Emulator in Android Studio](index.md#demo-pre-requisites)

## IBM Security Verify Tenant
Click [here](https://www.ibm.com/account/reg/us-en/signup?formid=urx-30041) to get IBM Security Verify free trial

```

repository: SaloniRathi/tmiMobileApp

repo_name: SaloniRathi/tmiMobileApp


text:
# dadaist2

[![Dadaist2 logo](docs/img/dadaist2.png)](https://quadram-institute-bioscience.github.io/dadaist2/)

[![release](https://img.shields.io/github/v/release/quadram-institute-bioscience/dadaist2?label=github%20release)](https://github.com/quadram-institute-bioscience/dadaist2/releases)
[![version](
https://anaconda.org/bioconda/dadaist2/badges/version.svg)](https://bioconda.github.io/recipes/dadaist2/README.html)
[![Conda](https://anaconda.org/bioconda/dadaist2/badges/downloads.svg)](https://bioconda.github.io/recipes/dadaist2/README.html)
[![Build Status](https://www.travis-ci.com/quadram-institute-bioscience/dadaist2.svg?branch=master)](https://www.travis-ci.com/quadram-institute-bioscience/dadaist2)
[![Dadaist-CI](https://github.com/quadram-institute-bioscience/dadaist2/actions/workflows/blank.yml/badge.svg)](https://github.com/quadram-institute-bioscience/dadaist2/actions/workflows/blank.yml)

Standalone wrapper for [DADA2](https://benjjneb.github.io/dada2/index.html) package, to quickly generate a feature table and a
set of representative sequences from a folder with Paired End Illumina reads.

# [Documentation and tutorials](https://quadram-institute-bioscience.github.io/dadaist2)

Please check the [online documentation](https://quadram-institute-bioscience.github.io/dadaist2) and tutorials
for installation and usage notes.

## Authors
* Andrea Telatin, Quadram Institute Bioscience, UK
* Rebecca Ansorge, Quadram Institute Bioscience, UK
* Giovanni Birolo, University of Turin, Italy


text:
---
layout: post
title: Azure App Service Plans - How to temporarily disable App Services Plans?
author: Bernard Lim
date: 2021-08-13 00:01:12 +0830
subtitle: How to temporarily disable App Service Plans to save costs
header-mask: 0.2
tags:
  - Azure App Service
---

# Overview

The ease of deploying apps into the cloud is as easy as a few clicks. This could also mean a high chance of creeping costs that we might accidentally incur if we create too many resources (as it is almost too easy to create them) and forget to manage them properly.

One popular service will be the **App Services Plans** and **App Services**.

- App Service Plans comes in various plans, some are **free**, some are **chargeable**.
- In an App Service Plan, you can host apps, i.e. **App Services**.

### Key Distinction

- App Service Plans _types_ & _statuses_ **determines if it is chargeable**
- App Services _statuses_ **DO NOT have an impact on chargeability**, i.e. If an app is stopped, it will still be charged (if your plan is chargeable)!

**Hourly charges of the "Basic" App Service Plan:**
![App Services Pricing](/img/posts/2021-08-13-appservice-disable-temporarily-save-costs/appservice_pricing_1.png)

# Problem

What if you have a scenario where you have a number of apps hosted on an App Service Plan, which are currently not being used, and that you would want to temporarily stop them so that you will not be charged?

Currently Azure does not provide a "**Disable**" option. Only a "**Delete**" is provided.

![App Services Stop](/img/posts/2021-08-13-appservice-disable-temporarily-save-costs/appservice_delete.png)

This is one option if you permanently do not want to use your apps, but what if you just want to stop this temporarily?

Unlike VMs, as mentioned earlier, stopping the **App Services** in an **App Service Plan** will still mean you are being charged!

![App Services Stop](/img/posts/2021-08-13-appservice-disable-temporarily-save-costs/appservice_app_stop.png)

# Solution

In the **App Service Plan** tab, Use the "**Scale Up**" option to **scale down** to the "**Free Tier**" plan.

![App Services Scale Down](/img/posts/2021-08-13-appservice-disable-temporarily-save-costs/appservice_scale_down.png)

When the apps are ready to be used once more, scale back up to your preferred plan.

No deletion required. Simple, effective and saves unnecessary costs!

---


text:
# NYCTAXI-ANALYSIS
Bu proje New York Taksi verilerinin 2017 yılındaki kapsamlı analizini ele almaktadır.

In this document, I will walk through the analysis of New York City Taxi Data (with download link shown in Section II) using Python. 6 months of “Yellow” label data will be loaded and analyzed.

#GROUP MEMBERS

### 1-MELİH ALTAY  </br>
### 2-OĞUZHAN KANSU  </br>
### 3-HAMDİ SERDAR KARAGÖZLER  </br>
### 4-OĞUZHAN TAÇTAN  </br>
### 5-FEVZİ ÖZGÜR ORHON  </br>

## Furthermore, to deal with the large scale of data (4GB for 6 months in this case), a database is needed.
## Here I will use SQLAlchemy, which is a Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.

![location](https://user-images.githubusercontent.com/44877995/120295466-d1465b80-c2cf-11eb-8e67-d2f5f6ba2d47.JPG)

# Q1: Which regions have most pickups and drop-offs?

![popular_zones](https://user-images.githubusercontent.com/44877995/120296520-e1ab0600-c2d0-11eb-80d8-d4ffc6f9758d.JPG)
![brgh](https://user-images.githubusercontent.com/44877995/120296609-f7203000-c2d0-11eb-91fb-a35e55de4d30.JPG)

# Q2: When are the peak hours and off-peak hours for taking taxi?

![graphics](https://user-images.githubusercontent.com/44877995/120296741-17e88580-c2d1-11eb-802e-9f1e9ff8d87c.JPG)

# Q3: What are the differences between short and long distance trips of taking taxi?

![trips_analysis_graphic](https://user-images.githubusercontent.com/44877995/120296859-38184480-c2d1-11eb-874a-b8d58540b90d.JPG)

![zones](https://user-images.githubusercontent.com/44877995/120296964-52522280-c2d1-11eb-9490-5fc9d3057ce8.JPG)

repository: serdarkaragozler/NYCTAXI-ANALYSIS

repo_name: serdarkaragozler/NYCTAXI-ANALYSIS