text:
---
layout: engineering-education
status: publish
published: true
url: /introduction-to-virtual-environments-and-dependency-managers/
title: Introduction to Python Virtual Environments and Dependency Managers
description: A beginner's guide to virtual environments and dependency managers in Python. We will look at five of the most used dependency managers in Python.
author: adhinga-fredrick
date: 2021-05-20T00:00:00-12:00
topics: [Languages]
excerpt_separator: <!--more-->
images:

- url: /engineering-education/introduction-to-virtual-environments-and-dependency-managers/hero.png
  alt: Python Virtual Environment example
---
Virtual environments. What are they and what are they used for? This article will be a beginner's guide to virtual environments and dependency managers in Python. We will also look at five of the most used dependency managers in Python.
<!--more-->
From the [Python documentation](https://docs.python.org/3/library/venv.html):
> A virtual environment is an isolated Python environment where a project's dependencies are installed in a different directory from those installed in the system’s default Python path and other virtual environments.

Dependency managers are tools that enable easy management of a project's dependencies.

#### The problems solved by virtual environments
1. Managing projects with different dependencies. For example, when one project requires `Django==2.6` but another project requires `Django==3.0.6`.
2. Installation of Python packages and libraries.
3. Dependency resolution. This is where you specify the requirements for a particular project's sub-dependency to avoid installation problems.
4. Reproduction of environments. One machine can handling many projects in different environments.

### Prerequisites
This article assumes that the reader:
- Has some knowledge of Python programming language.
- Has Python installed on their machine.

### Overview
This article will look at the following most used virtual environments and dependency managers in Python, how to use them and their pros and cons.

1. [Venv](#1.-Venv)
2. [Virtualenv](#2.-Virtualenv)
3. [Pipenv](#3.-Pipenv)
4. [Conda](#4.-Conda)
5. [Poetry](#5.-Poetry)

### 1. Venv
[Venv](https://docs.python.org/3/library/venv.html) is a Python's module that is used to create light weight virtual environments. It is the default virtual environment module for **Python 3**. It is one of the easiest modules around for creating virtual environments.

#### Features
- Python 3's default virtual environment tool.
- It is a light weight module.
- Stores all dependencies in a Scripts folder or bin sub-folder (on linux).

#### Installation
Since Venv comes pre-installed in Python 3 or newer, there's no need to install it.

So, we will go ahead and create a virtual environment.

#### Creating a virtual environment
When working on Windows Command Prompt, use:

```bash
$ python3 -m venv venv
```

#### Activating the virtual environment
Before using the virtual environment, we need to activate it. This makes the current virtual environment you're working on to temporarily function as the default Python interpreter.

>**Tip**: Before activating your virtual environment, always make sure that you are working from your project's directory.

Activate your project's environment by running the following command:

```bash
$ cd venv\Scripts
$ activate.bat
```

On Windows PowerShell, use:

```bash
$ Activate.ps1
```

Once you've successfully activated your virtual environment, the path changes to something similar to the example below:

```bash
(venv) Project_path\venv\Scripts>
```

#### Configuring the virtual environment
After activating the virtual environment, you can now start installing modules and packages by using the great `pip install` command.

For example:

```bash
$ pip install Django
```

You can check the version of Pip you're using and directory with the following command:

```bash
$ pip -V
```

**Note**: It is a good practice to always work with a `requirements.txt` file for easy collaboration since it stores a list of all installed packages in your environment.

To create a `requirements.txt`, use:

```bash
$ python -m pip freeze > requirements.txt
```

#### Deactivating a virtual environment
After you finish with the environment, deactivate it by using:

```bash
$ deactivate.bat
```

#### Deleting the virtual environment
Since virtual environments are self-contained, when no longer needed, just delete the project's virtual environment directory (in this case `/venv` ).

#### 2. Virtualenv
**[Virtualenv](https://virtualenv.pypa.io/en/latest/)** is a third-party dependency manager tool used for creating and managing Python projects. It is the most used and most popular virtual environment module for the **Python 2**  language.

>**Note** virtual environments do not come as a native feature for Python 2.

#### The cons
- It cannot be upgraded using [pip](https://pip.pypa.io/en/stable/installing/).
- It cannot create and discover virtual environments for randomly installed Python versions.

#### Installation
In order to use Virtualenv, we first need to install it using the following command:

```bash
$ pip install virtualenv
```

#### Creating a virtual environment
To create a virtual environment, run the following command:

```bash
$ virtualenv venv
```

Use *venv* as the name of your project's virtual environment. To activate and deactivate the virtual environment, use the same commands as [Venv](#1.-Venv).

#### Installing dependencies
To install additional packages and libraries, use:

```bash
$ pip install <package name>
```

### 3. Pipenv
[Pipenv](https://pypi.org/project/pipenv/) is a package manager that is used to manage Python projects dependencies. It is good for the common typical workflow of using dependencies like `pip`, `requirements.txt`, etc.

Under the hood, Pipenv generally combines the use of pip and Virtualenv into a simple command-line tool.

#### Features
1. It automatically creates and manages a virtual environment for your projects.
2. It generates the `Pipfile.lock` file which helps in deterministic builds.
3. It adds and removes packages from a Pipfile as you install and uninstall packages.
4. It automatically locates you project by looking for a `Pipfile`.
5. Provides insights into your dependency graph. Try `pipenv graph`.
6. Smooth development workflow by loading `.env` files.

#### Installation
Before we use Pipenv, let's first install it. Run the following command on a terminal.

```bash
$ pip install pipenv
```

After running this, Pipenv will be installed on your machine. Here’s the part where we now say goodbye to `pip`. It has been a journey indeed!

#### Creating a virtual environment
After installation, we just need to install a Python module using Pipenv and **boom!**, we have a virtual environment.

```bash
$ pipenv install Django==2.0.13
```

The command above automatically creates a `Pipfile` and a `Pipfile.lock` file in your project's virtual environment. These files are where your project dependencies are saved.

If you wish to change the dependencies, you could change the default `Pipenv` configurations.

#### Activating the virtual environment
After creating our virtual environment, we can activate it by running the command below in the project directory.

```bash
$ pipenv shell
```

#### Uninstalling packages
You can uninstall a package from your project by running the following command:

```bash
$ pipenv uninstall Django
```

Here, you don’t need to specify the package version. The package is also removed from the `Pipfile` and `Pipfile.lock` file.

#### Deleting a virtual environment
For whatever reason you feel the need to remove a virtual environment, you can do that with Pipenv using the command below.

```bash
$ pipenv --rm
```

>**Note** that with Pipenv, you can specify the version of Python to use, using the command below:

```bash
$ pipenv --python path/to/python
```

>**Note**: You can get the specific Python version using [Pyenv](https://github.com/pyenv/pyenv).

### 4. Conda
**[Conda](https://conda.io/projects/conda/en/latest/index.html)** is a package management and environment management system that not only supports Python but also other languages like Ruby, Scala, R and C/C++. It is used to create, save, load and switch between environments in your local machine.

Conda comes pre-installed in [anaconda](https://www.anaconda.com/) and [miniconda](https://docs.conda.io/en/latest/miniconda.html).

#### Features
- You can [share](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#sharing-an-environment) environments.
- Finding and installing packages -  Since Conda is also an environment manager, you can set up another environment to run a different version of Python, without interfering with the environment that runs your usual version of Python.

#### Installation
Installing Conda is a bit different from other dependency managers. The easiest way to install it is by installing [Anaconda](https://docs.anaconda.com/anaconda/install/windows/) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) - a mini version of anaconda that contains only Conda and its dependencies.

### Creating an environment
To create a virtual environment using Conda, run the following command on a terminal.

```bash
$ conda create --venv
```

There are [several](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment) other ways of creating a conda environment that goes beyond the scope of this article.

#### Activating an environment
To activate an environment, run:

```bash
conda activate venv
```

Or you can run the following in the Anaconda prompt:

```bash
$ activate base
```

#### Deactivating an environment
To deactivate a virtual environment, run:

```bash
$ conda deactivate
```

### 5. Poetry
**[Poetry](https://python-poetry.org/docs/)** is popularly known as a very feature-rich Python tool for project dependency management. It comes wrapped with a powerful CLI for creating and managing Python projects.

#### Features
- It comes with a `pyproject.toml` file that contains a `tool.poetry` section that is composed of several sections like README.md, name, author, [etc](https://python-poetry.org/docs/pyproject/) for project documentation.
- It is faster than most virtual environment tools.
- It allows libraries declaration and auto updating of dependencies.

#### Installation
Unlike other project dependency tools, Poetry comes with a custom installer that isolates it from the rest of your system by seperating its dependencies.

Run the following command in the Windows Powershell.

>**Note**: This is the recommended way of installing `poetry` .

```bash
$ (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
```

>**Note**: Even though it is possible to install it using **pip**, it is not recommended as it causes more dependency conflicts with other packages.

#### Creating a virtual environment
To create a new virtual environment using Poetry, use:

```bash
$ poetry new venv
```

This will create a virtual environment directory structure like shown below:

```bash
venv
├── pyproject.toml
├── README.rst
├── venv
│   └── __init__.py
└── tests
    ├── __init__.py
    └── test_venv.py
```

#### Activating the environment
Activate the virtual environment by running:

```bash
$ poetry shell
```

or

```bash
$ source {path_to_venv}\Scripts\activate.bat
```

#### Adding dependencies
To add a new dependency, use the following command:

```bash
$ poetry add  <package name>
```

or

```bash
$ poetry install <package name>
```

#### Deactivate the environment
You can deactivate a virtual environment using either:

```bash
$ exit
```

This commands exits the virtual environment together with the powershell.

or

If you want to exit only the virtual environment, run the following command.

```bash
$ deactivate
```

### Conclusion
When creating virtual environments, always try to use **venv** as the environment name since it is a global convention that is easily available in ignore files like `.gitignore`.

It is generally a good practice to work with virtual environments as they save you hours of debugging common errors like the `No module error`. They also enable easy collaboration between developers.

Good luck on your future projects.

Happy coding!

---
Peer Review Contributions by: [Geoffrey Mungai](/engineering-education/authors/geoffrey-mungai/)

repository: mbuguac/engineering-education

gha_language: SCSS

repo_name: mbuguac/engineering-education


text:
# Installation
> `npm install --save @types/ion-rangeslider`

# Summary
This package contains type definitions for for Ion.RangeSlider (https://github.com/IonDen/ion.rangeSlider/).

# Details
 * Last updated: Fri, 04 May 2018
 * Dependencies: none
 * Global values: none

# Credits
These definitions were originally written by Sixin Li <https://github.com/sixinli>
and adapted by Karel van de Plassche <https://github.com/Karel-van-de-Plassche/>

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
PulseAudio Bluetooth User Service
=================================

**Author:** Justin Jereza

Bluetooth HSP/A2DP doesn't work properly on Linux because `module-bluetooth-policy` and `module-bluetooth-discover` are loaded into PulseAudio before a graphical session has been started.

Furthermore, systemd [cannot load unit files](https://www.freedesktop.org/software/systemd/man/systemctl.html#enable%20UNIT%E2%80%A6) located in `$XDG_CONFIG_HOME/systemd/user` if the filesystem is not available at the time pid 1 is started. An example of this is when it is located on a VDO volume separate from the root filesystem.

PulseAudio-Bluetooth solves this with minimal modification to the system configuration. This is done by using `$XDG_CONFIG_HOME/autostart` to reload the user systemd when a graphical session is started and getting PulseAudio into a state where `module-bluetooth-policy` and `module-bluetooth-discover` can be loaded/unloaded by starting/stopping/restarting the service with `systemctl --user`.

Possible Permanent Solutions
----------------------------

One option to fix this problem is to patch [upstream](https://cgit.freedesktop.org/pulseaudio/pulseaudio/) such that Bluetooth module loading is handled by `start-pulseaudio-x11` instead.

Another option is to have `pulseaudio.service` start after `graphical-session.target`. This target seems to be the most logical dependency since there is no generic unit available earlier than this that can guarantee that a graphical session is available. The downside to this approach is that PulseAudio is not completely independent of a graphical session unless a way can be found such that `pulseaudio.service`'s dependency on `graphical-session.target` is only active if a graphical session has indeed been started by the user. In this case, it seems this option is no better than just handling module loading in `start-pulseaudio-x11`.

A longer-term solution is to find out why Bluetooth breaks when the modules are loaded before a graphical session is available. Solving this will allow PulseAudio to function in a user session regardless of whether a graphical session has been started or not.

Prerequisites
-------------

Remove all `load-module` statements for `module-bluetooth-policy` and `module-bluetooth-discover` in `/etc/pulse/default.pa`. As an example, on EL8 you can comment out the entire `.ifexists` blocks for these modules. This is the only thing that needs to be done that, unfortunately, requires root permissions.

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

To install the files into the appropriate directories in `$XDG_CONFIG_HOME`, execute the following:

```sh
$ make install
```

Logout and log back in to get the modules loaded in the correct order.

Usage
-----

In case PulseAudio Bluetooth misbehaves, you can use the following command to attempt to fix it:

```sh
$ systemctl --user <start | stop | restart> pulseaudio-bluetooth.service
```

Verification
------------

To verify that the modules have been loaded properly, run `pactl list short modules`. There should only be one of each of `module-bluetooth-policy`, `module-bluetooth-discover`, and `module-bluez5-discover` on the list and they should be the last modules loaded.

Example of desired output:

```
0       module-device-restore
1       module-stream-restore
2       module-card-restore
3       module-augment-properties
4       module-switch-on-port-available
5       module-udev-detect
6       module-esound-protocol-unix
7       module-native-protocol-unix
8       module-default-device-restore
9       module-rescue-streams
10      module-always-sink
12      module-intended-roles
13      module-suspend-on-idle
14      module-systemd-login
15      module-position-event-sounds
16      module-role-cork
17      module-filter-heuristics
18      module-filter-apply
19      module-alsa-card        device_id="0" name="pci-0000_00_1f.3" card_name="alsa_card.pci-0000_00_1f.3" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
20      module-x11-publish      display=:0 xauthority=
21      module-x11-cork-request display=:0 xauthority=
22      module-x11-xsmp display=:0 xauthority= session_manager=local/unix:@/tmp/.ICE-unix/5255,unix/unix:/tmp/.ICE-unix/5255
23      module-bluetooth-policy
24      module-bluetooth-discover
25      module-bluez5-discover
```

Uninstallation
--------------

```sh
$ make uninstall
```

license: Unlicense


text:
# OAuth 2 Simplified
---

## Roles

### The Third-Party Application: "Client"

The client is the application that is attempting to get access to the user's account. It needs to get permission from the user before it can do so.

### The API: "Resource Server"

The resource server is the API server used to access the user's information.

### The Authorization Server

This is the server that presents the interface where the user approves or denies the request. In smaller implementations, this may be the same server as the API server, but larger scale deployments will often build this as a separate component.

### The User: "Resource Owner"

The resource owner is the person who is giving access to some portion of their account.

https://aaronparecki.com/oauth-2-simplified

---

gha_language: Java

gha_license_id: MIT


text:
# SuperGLU

Python ![](https://travis-matrix-badges.herokuapp.com/repos/GeneralizedLearningUtilities/SuperGLU/branches/master/1)

Java ![](https://travis-matrix-badges.herokuapp.com/repos/GeneralizedLearningUtilities/SuperGLU/branches/master/2)

Javascript ![](https://travis-matrix-badges.herokuapp.com/repos/GeneralizedLearningUtilities/SuperGLU/branches/master/3)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Main Generalized Learning Utilities (GLU) library for communicating data between different learning technologies and intelligent systems.

Adding unit tests and porting additional functionality from original closed-source version still being finalized.

Requires:

Technically Optional, But Important:
- lxml: At least if you want xml stuff to work

## Development

### Java Module
The corresponding code can be found within java_maven directory. The java build is powered by Apache Maven
and instructions can be found [here](java_maven/readme.md)

### Javascript Module
The corresponding code can be found within javascript_module directory. Instructions on how to build & test the module,
can be found [here](javascript_module/readme.md). The javascript build is powered by Webpack.

### Python Module
The corresponding code can be found within python_module directory.

repository: GeneralizedLearningUtilities/SuperGLU

gha_language: JavaScript

repo_name: GeneralizedLearningUtilities/SuperGLU


text:
# Newsletter

## Simple single page application for sharing news articles

## Functionality
* ## Two types of users - admin and regular
    * ### Admin
        * Creating articles
        * Editing Articles
    * ### Regular user
        * Writing comments
        * Replying to comments
        * Changing profile picture
        * Changing password and email

[LIVE DEMO](https://raw.githack.com/KirilVelichkov/Newsletter-Client/master/dist/index.html)

repository: KirilVelichkov/Newsletter-Client

repo_name: KirilVelichkov/Newsletter-Client


text:
---
layout: post
title: "Day 3 - Understanding Files and Buffers"
date: 2015-11-23 20:06:40 +0530
comments: true
categories: emacs
tags: #emacs, #30daychallenge, #day3
---
# The windows and the buffer.

I will touch upon one new topic and what I learned today. While writing my [Day 2](http://www.omps.in/blog/2015/11/14/day-2-the-real-estate/) article I learnt intersting usage of windows and frames (well, the one where we do our editing and writing stuff. It would be good to understand how opening emacs creates the frame and window within.)

We start emacs the same way we start our other application. (on Linux, by typing on the terminal window; on Windows and Mac, clicking on to the application icon.) When emacs starts up it usually display a special buffer name **GNU Emacs**. This contains information about emacs and links to common good stuff for begineers(in later days we will figure out how we can skip this)

It is good not to start multiple emacs session, instead just start once and do all the editing in the same sessions. In this way the emacs context accumlates valuable context, such as kill ring, registers, undo history, which helps a lot at advanced stages.

## Buffer

The text we are going to edit in emacs is called as buffers and is used to hold the files text. So everytime we visit a file, run dired, send message with 'C-x m' or ask for help, a buffer is used for holding the text of the message.

### Creating and selecting buffers

<colgroup>
<col  class="left" />

<col  class="left" />

<col  class="left" />
</colgroup>

Command Keybinding
Command
Description

C-x b BUFFER
switch-to-buffer
select of create a buffer

named BUFFER.

C-x 4 b BUFFER
switch-to-buffer-other-window
slect BUFFER in other

window.

C-x 5 b BUFFER
switch-to-buffer-other-frame
select BUFFER in other

frame.

C-x <LEFT>
previous-buffer
select the previous buffer

C-x <RIGHT>
next-buffer
select the next buffer

C-u M-g M-g

read num N and move to line N

C-u M-g g

in the most recent buffer

other than current

### Listing Buffers

<colgroup>
<col  class="left" />

<col  class="left" />

<col  class="left" />
</colgroup>

Command Keybinding
Command
Description

C-x C-b
list-buffer
List the exisitng buffers

Here is an example of a buffer list:

CRM Buffer                Size  Mode              File
. \* .emacs                3294  Emacs-Lisp        ~/.emacs
 %  **Help**                 101  Help
    search.c             86055  C                 ~/cvs/emacs/src/search.c
 %  src                  20959  Dired by name     ~/cvs/emacs/src/
-   **mail**                  42  Mail

%  HELLO                 1607  Fundamental       ~/cvs/emacs/etc/HELLO
%  NEWS                481184  Outline           ~/cvs/emacs/etc/NEWS
   **scratch**              191  Lisp Interaction
-   **Messages**            1554  Fundamental

\`.' in the first field indicates that this is the current buffer.
\`%' indicates a read-only buffer.
\`\*' indicates that the buffer is "modified".

The buffer \`\*Help\*' was made by a help request (\*note Help::); it is not visiting any file.
The buffer \`src' was made by Dired on the directory \`~/cvs/emacs/src/'.

### Killing

The buffers can simply be done by just pressing C-x k BUFFER or in the C-x C-b we can select the buffer by pressing k and then exectue it.

## Windows

<colgroup>
<col  class="left" />

<col  class="left" />
</colgroup>

Key Bindings
Description

'C-x 2'
To split the windows into 2 one above the another.

'C-x 3'
Split the windows side by side.

'C-x o'
to move around windows, or click in the window with the mouse click to have the focus on that window.

'C-M-v'
Scroll the next window.

'C-x 0'
Delete the selected window

'C-x 1'
Delete all windows except the select one.

'C-x 4 0'
Delete the selected window and kill the buffer showing in that window.

'C-x ^'
Make selected window taller.

'C-x }'
Make selected window wider

'C-x {'
Make selected window narrower

'C-x -'
Shrink window if buffer dont need so many lines.

'C-x +'
Make all window same height.

extension: markdown

gha_language: HTML


text:
# Redis::Socialgraph

Implements a simple social graph storage and retrieval using Redis. Every key
corresponds to a user ID (internal user ID, Facebook user ID, etc),
and the value is a list of their friends. Redis::Socialgraph exposes a simple
interface to loading this information into redis and common queries, like
mutual friends and friends-of-friends.

## Installation

Add this line to your application's Gemfile:

    gem 'redis-socialgraph'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install redis-socialgraph

## Usage

    require 'redis/socialgraph'

    friend_ids = Redis::Socialgraph.friend_ids(current_user.fbuid)
    > [150100454,<PHONE_NUMBER>, 5517425, 15500300, ... ]

    friend_of_friend_fbuids = Redis::Socialgraph.friends_of_friends_ids(current_user.fbuid)
    > [1036350018, 15508452,<PHONE_NUMBER>, ... ]

    # two users don't know each other, but could have friends in common
    mutual_friends = RedisSocialgraph.mutual_friends current_user.fbuid,
                                                     author.fbuid
    puts "You're connected to the author through: #{ mutual_friends.join(',') }"

    # for a list of user IDs (authors, renters, photographers, etc), return
    # a hash where the key is the user ID, and the value is a list of mutual
    # friends
    mutual_friends =
      Redis::Socialgraph.multiple_mutual_friends(current_user.fbuid, authors)
    mutual_friends.each do |user_id, mutual_friend_ids|
      puts "Connected to #{ user_id } through #{ mutual_friend_ids }"
    end

## Contributing

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

repository: CameraLends/redis-socialgraph

gha_language: Ruby

repo_name: CameraLends/redis-socialgraph


text:
### 4. Known and Unknown Environments

#### 4.1 What if we don't have a model of the environment?

One of the first things that will come to your head after reviewing the last tutorial is, but what's the point if
we need to have the dynamics of the environment? What if it is such a complex environment that it is just too hard
to model? Or better yet, what if we just don't know the environment? Can we still learn the best actions to take
in order to maximize long-term rewards?

And, the answer to that question is, of course, we can deal with unknown environments. Perhaps, this is the most exciting aspect of reinforcement learning; agents are capable of, through interaction only, learning the best sequence of actions
to take to maximize long-term reward.

#### 4.2 The need to explore

The fact that we do not have a map of the environment puts us in need to explore it. Before we were given a map or as
it is called in reinforcement learning, a model (MDP), but now, we are just dropped in the middle of a world with no
other guidance than our own experiences. The need for exploration comes with a price. We can no longer take a perfect
sequence of actions that maximize the long-term rewards from the very first time. Instead, we are now ensured to, at
least, fail a couple of times trying to understand the environment and attempting to reach better goals each time.

If you think about it, this puts us in a dilemma, as exploration has a cost associated with it, how much is it effective
to pay for it such that the long term rewards are maximized. For example, think about a young person graduating from college
at 20 and getting his/her first job. This person goes around in 3-4 different jobs early on, but later when he is 50 and
has accumulated experience in a specific field, it might no longer be beneficial to do a career change. It could be much
more effective to keep exploiting the experience he/she has gained. Even if there exists a possibility for higher reward on some
other field. Potentially, given the time left in his/her career, the price of learning a new set of skills might not benefit
the long term goals.

#### 4.3 What to learn?

There are two ways you could think of interacting with the world. At first, we could think of the value of taking actions in
given states. For example, we calculate the expectation of taking action 'a' when on the state 's', then do the same for all
possible state, action combinations. However, as we saw on previous lessons, if we had a model of the environment, we could
determine the exact best value for each state. So, how about learning the model of the environment and then using some of the algorithms on previous lectures to help us guide our decision making?

It turns out that these two ways are the most fundamental classes of algorithms in reinforcement learning. Model-Free methods
are those algorithms that learn straight the action selection. These methods are incredibly useful as they are
capable of learning best actions without any knowledge of the environment. However, they are very data hungry and it
requires lots of samples to get good results. Practically speaking, we cannot just let a bipedal robot fall 1,000,000 times
just for the sake of gaining experience. On the other side of the spectrum, Model-Based methods learn and use the model
of the environment in order to improve the action selection especially early on. Model-Based methods are much more data
efficient and for this reason, they are utilized more frequently on problems involving hardware such as robotics.

#### 4.4 What to do with what we learn?

We saw before that we will have to interact with the environment in order to learn. This obvious way of learning is
called "Online learning". In contrast, however, we could also collect the samples we get from our experience and
use that to further evaluate our actions. Intuitively we can think of how humans learn. When we interact with our
environment, we learn directly from our experiences with it, but also, after we have collected these experiences,
we use our memory to think about it and learn so more of what happened, what we did and how we could improve the
outcome if we are facing the same problem again. This way of learning is called "Offline learning", and it is also
used in reinforcement learning.

#### 4.5 Adding small randomness to your actions

Finally, there is some other important point often seen in reinforcement learning. The fact that we learn a good
policy does not imply that such policy should be always followed. What if there are some better actions we could
have taken? How do we ensure we always keep an eye on yet a better policy? In reinforcement learning, there are
two main classes of algorithms that address ways of learning while constantly striving for finding better policies.
One way is called off-policy, and it basically means that the actions taken by the agent are not necessarily always
those that we have determined as the best actions. We would then be updating the values of a policy as if we were
taking the actions of that policy when in fact we selected the action from another policy. We can also see off-policy
as having two different policies, one that determines the actions that we are selecting, and the other the one that
we use to evaluate our action selection. Conversely, we also have on-policy learning in which we learn and act on
top of the same policy. That is, we evaluate and follow the actions from the same policy.

#### 4.6 Exercises

In this lesson, we learned the difference between planning and reinforcement learning. We compared two styles
of doing reinforcement learning, one in which we learn to behave without trying to understand the dynamics
of the environment. And on the other hand, we learn to behave by simultaneously trying to learn the environment
so that our learning could become more and more accurate each time.

For this, we will look into a couple of algorithms for model-free reinforcement learning and we will also look
at an algorithm that tries to learn the model with each observation and become much more efficient with every
iteration.

Lesson 4 Notebook.

#### 4.7 Further Reading

  * [Reinforcement Learning: A Survey](https://www.cs.cmu.edu/~tom/10701_sp11/slides/Kaelbling.pdf)
  * [Algorithms for Sequential Decision Making](https://www.cs.rutgers.edu/~mlittman/papers/thesis-with-gammas.pdf)
  * [Shaping and policy search in Reinforcement learning](http://www.cs.ubc.ca/~nando/550-2006/handouts/andrew-ng.pdf)
  * [Dynamic Programming and Optimal Control](http://web.mit.edu/dimitrib/www/dpchapter.pdf)

repository: xadahiya/applied-reinforcement-learning

repo_name: xadahiya/applied-reinforcement-learning


text:
# nestor-api · [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ChauffeurPrive/nestor-api/blob/master/LICENSE) [![Workflow](https://github.com/ChauffeurPrive/nestor-api/workflows/ci/badge.svg?branch=master)](https://github.com/ChauffeurPrive/nestor-api/actions?query=workflow%3Aci+branch%3Amaster) [![codecov](https://codecov.io/gh/ChauffeurPrive/nestor-api/branch/master/graph/badge.svg)](https://codecov.io/gh/ChauffeurPrive/nestor-api)

Nestor-api is an API used to manage deployment of applications Kubernetes. It can be used with [nestor-cli](https://github.com/ChauffeurPrive/nestor-cli), a CLI tool consuming nestor-api.

## Installing

Python 3.7 or above.

Dependencies are managed by [Pipenv](https://github.com/pypa/pipenv).

```bash
pipenv sync # Add --dev to also install dev dependencies
```

## Configuration

> [Source](./nestor_api/config/config.py)

|                              Key | Default                | Unit | Comment                       |
| -------------------------------: | ---------------------- | ---- | ----------------------------- |
|             `NESTOR_CONFIG_PATH` |                        |      | Configuration path            |
|      `NESTOR_CONFIG_APPS_FOLDER` | `apps`                 |      | The application config folder |
| `NESTOR_CONFIG_PROJECT_FILENAME` | `project.yaml`         |      | The project config file       |
|           `NESTOR_PRISTINE_PATH` | `/tmp/nestor/pristine` |      | Pristine path                 |
|               `NESTOR_WORK_PATH` | `/tmp/nestor/work`     |      | Work path                     |


text:
Chatty-App
=================================================================

### Summary

A clean and simple Slack clone that allows multiple users to chat together in the same space. If users enter a link for an image or gif, the web app renders the content in the chat window. Functional restrictions were put in place if the logged username does not match the username in the input box, or if the input boxes do not contain text. Users also receive notifications when a username is changed, and when someone leaves or joins the chat room. Total number of participants is also recorded in a counter on the right side of the header.

The process was great practice for practicing the use of props and states between parent and child components, as well as visualizing proper use of components to encompass different parts of the HTML. Image link string search also allowed for regex practice.

Chatty_server subdirectory:
Simple Websocket server for the Chatty App. Processes new posts, changes in username, and outgoing notifications. Notifications include changes in username and whether a new socket joins or leaves the chat room.

### Showcases:

| React | JSX | WebSockets | Express | Regexp |

### Screenshots
![Users leaving and joining are recorded as notifications, so are name changes](https://github.com/dru1208/chatty-app/blob/master/docs/1.png?raw=true)
* Users leaving and joining are recorded as notifications, so are name changes
![User sends message, broadcasted to everyone](https://github.com/dru1208/chatty-app/blob/master/docs/2.png?raw=true)
* User sends message, broadcasted to everyone
![User links image, image is rendered on everyone's browser](https://github.com/dru1208/chatty-app/blob/master/docs/3.png?raw=true)
* User links image, image is rendered on everyone's browser
![User links gif, gif is rendered on everyone's browser](https://github.com/dru1208/chatty-app/blob/master/docs/4.png?raw=true)
* User links gif, gif is rendered on everyone's browser

### Dependencies

* React
* Webpack
* WebSockets
* [babel-loader](https://github.com/babel/babel-loader)
* [webpack-dev-server](https://github.com/webpack/webpack-dev-server)


text:
# [Match-Toy](https://match-toy.github.io)

[![Build Status](https://travis-ci.org/match-toy/match-toy.svg?branch=master)](https://travis-ci.org/match-toy/match-toy)
[![Test Coverage](https://api.codeclimate.com/v1/badges/b4ef038eea888a8a8cfb/test_coverage)](https://codeclimate.com/github/match-toy/match-toy/test_coverage)
[![Greenkeeper badge](https://badges.greenkeeper.io/match-toy/match-toy.svg)](https://greenkeeper.io/)
[![npm version](https://badge.fury.io/js/match-toy.svg)](https://badge.fury.io/js/match-toy)
[![Try match-toy on RunKit](https://badge.runkitcdn.com/match-toy.svg)](https://npm.runkit.com/match-toy)
> The pattern matching library for javascript.

[Match-Toy](https://match-toy.github.io) is a pattern matching library for javascript with a powerful DSL and support for a wide range of patterns. The best kick off is [read the tests](./src), there are tons of them covering all the cases. For complete documentation, please check out the [wiki](https://github.com/match-toy/match-toy/wiki). Another way is by examples:
- [Tic-tac-toe](https://match-toy.github.io/tic-tac-toe)
- [Other examples](./examples)

[Try it now](https://npm.runkit.com/match-toy).

## Installation
#### From NPM
```sh
$ npm install match-toy --save
```
Or yarn:
```sh
$ yarn add match-toy
```
Then import/require the module.
```javascript
const { match } = require('match-toy');
// or
import { match } from 'match-toy';
```

#### From CDN
Place the snippet into your html:
```html
<script src="https://cdn.jsdelivr.net/npm/match-toy/dist/bundle/index.min.js"></script>
```
For specific version append the desired version (on the format<EMAIL_ADDRESS>before the word `match-toy` just like this<EMAIL_ADDRESS>
This file is a bundle in the [UMD](https://github.com/umdjs/umd) format. In browser's environments, the module name is in camelcase and available on `window` scope.
```javascript
var myFunc = matchToy.match
                      .case('1', () => 'one')
                      .end()
```

See more in [examples](./examples).

## Usage
Most basic usage:
```javascript
import { match } from 'match-toy';

// Create a new pattern matching function
const convertOneToString = match
  .case('1', () => 'one')
  .end();

convertOneToString(1); // return 'one'
convertOneToString(2); // return undefined

// Create another one, but now we only need
// the value returned by the match
const one = match
  .case('1', () => 'one')
  .return(1); // using `return()` match runs immediately

one === 'one'; // true
```
See more about [usage](https://github.com/match-toy/match-toy/wiki/Usage) in depth.

### Built with
- [PEG.js](https://pegjs.org/)
- [Typescript](https://www.typescriptlang.org/)
- [Jest](https://facebook.github.io/jest/)
- [Rollup](https://rollupjs.org/)
- [Yarn](https://yarnpkg.com/en/)
- [Testcheck-js](https://github.com/leebyron/testcheck-js)

## Other nice projects and initiatives
Syntax proposals:
- https://github.com/tc39/proposal-pattern-matching
- https://github.com/eborden/JS-Pattern-Matching
- https://gist.github.com/bterlson/da8f02b95b484cd4f8d9

Other JavaScript libraries:
- https://codemix.github.io/flow-runtime/#/docs/pattern-matching
- https://github.com/HerringtonDarkholme/Pat-Mat
- https://github.com/natefaubion/sparkler
- https://github.com/bramstein/funcy
- https://github.com/FGRibreau/match-when
- https://github.com/z-pattern-matching/z
- https://github.com/dherman/pattern-match
- https://github.com/mcollina/bloomrun

## Contributing
- Improving or correcting the documentation.
- Translating.
- Finding bugs
- Sharing this project.
- PR are very welcome.

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Changelog
See [CHANGELOG](CHANGELOG.md) file for details.

repository: zbjornson/match-toy

repo_name: zbjornson/match-toy


text:
---
title: Prison Autominers
subtitle: An open source innovation for prison themed servers.
tags: [kotlin, programming, minecraft, spigot]
---

## What are Prison Autominers?
If you're familiar with prison themed MineCraft servers, please skip down to the next header. If you aren't familiar, let me explain. Prison servers are largely a grindfest, where-in players mine to level up through various alphabetically organized mine areas. More or less, prison servers are similar in theory to idle games, except instead of a complicated system it's just mining blocks in a square area and progressing further and further. There are more elements to this type of thing but generally that's the basic idea.

![prison-a-mine-example](file.png)

So, what you'll find is that most servers will offer an "AutoMiner" feature. Basically these are NPC characters that bring up a chest GUI which players use to interface with the AutoMiner. It's very abstracted, and in a lot of ways not tactile. Most players don't connect with the feature, and in the world of MineCraft server operations, everything needs to be monetized better by providing better experiences. Below, you'll find a GIF of a common AutoMiner plugin in operation.

![common-autominer-plugin-gif](file.png)

## So, What's the Solution?
More or less, using the NPC system that MineCraft provides, you can easily make a much more engaging, unique, player experience. Below you can find a GIF of the prototype plugin.

### The Miner GUI
![autominer-gui-gif](file.png)

### The Miner In Action
![autominer-gif](file.png)

## Features
The miner is ready for release, it needs some extra features that are noted below. **But guess what? The best part about this whole thing is, you can download it right ![here](spigot.com) on Spigot.** Stay tuned for the Spigot release.

* **Lightweight Performance**
* **Fully Configurable (including messages and GUI)**
* **Robustly Tested**
* **Configurable Skin Selector**
* **Configurable or Automatic Rank Upgrades**
* **Configurable Values for Miner Attributes**
* **Miner Pick Abilities (any vanilla abilities, or even CrazyEnchantments enchants!!!!)**
* **GUI Based Design with Intuitive Design**
* **Daily Time Added Configured Based on Rank**
* **MySQL / flatfile Support**
* **NPC driven Miner**
* **Full Support on my Discord**


text:
# Steps to install Pepipost PHP Code Library on Windows without IDE

This doc is dedicated to all terminal lovers who ❤ to code on terminal.

Below steps will help you in integrating this PHP code library on a Windows machine which doesn't have any IDE.

> Optional Note: This library will be sending HTTP calls to Pepipost server and hence if you're running any firewalls on your machine, then please whitelist the API base URL ```api.pepipost.com``` with ```port 443/80```

### Installation Steps

This code has dependencies over external libraries like UniRest. All dependencies are listed in the file ```composer.json```.

We are trying to cover each of the steps in this installation, which might make this doc a little lengther but the objective is to help you with the simpliest way of installation.

While Pepipost DX Team is defintely leading this library, but we want this to be more community driven. Your help is needed to realize this goal and to make sure we are building the right things in the right order. We ask that you create [issues](https://github.com/pepipost/pepipost-sdk-php/issues) and [pull requests](https://github.com/pepipost/pepipost-sdk-php/pulls) or simply upvote or comment on existing issues or pull requests to keep everyone updated.

We appreciate your continued support, thank you! Let's move ahead on the installation steps:

Step 1. Install [XAMPP](https://www.apachefriends.org/download.html). Skip this step, in case you already have the PHP installed.

Step 2. Install [COMPOSER](https://getcomposer.org/doc/00-intro.md#installation-windows).

![imgcomposer](http://app1.falconide.com/integration_imgs/windows_without_IDE/1.png)

  2.1. As soon as you download composer.exe file from the above link pop will appear below:

  ![installation](http://app1.falconide.com/integration_imgs/windows_without_IDE/2.png)

  2.2. Installation directory will be shown at the below:

  ![installation2](http://app1.falconide.com/integration_imgs/windows_without_IDE/3.png)

  2.3. Proxy URL if you want any, we don't want such for now so keeping blank

  ![installation3](http://app1.falconide.com/integration_imgs/windows_without_IDE/4.png)

  2.4. Last process will prompt for Ready to install

  ![installation4](http://app1.falconide.com/integration_imgs/windows_without_IDE/5.png)

  2.5. Downloading Procedure

  ![installation5](http://app1.falconide.com/integration_imgs/windows_without_IDE/6.png)

  2.6. Last Legacy installation Finish (Successfully installed)

  ![installtion6](http://app1.falconide.com/integration_imgs/windows_without_IDE/7.png)

3.  Open Command Prompt (CMD) &  check Composer version using ```Composer --version``` (command prompt)

 ![cmd](http://app1.falconide.com/integration_imgs/windows_without_IDE/8.png)

4.  Download zip or clone git repo from ![Pepipost Repository](https://github.com/pepipost/pepipost-sdk-php/archive/master.zip)

![dwnimg](http://app1.falconide.com/integration_imgs/windows_without_IDE/9.png)

5.  Unzip the downloaded zip to Fresh Directory at any location of your choice. (we will assume Dev has Directory at location Desktop)

![extract](http://app1.falconide.com/integration_imgs/windows_without_IDE/10.png)

7. Copy the path from address bar of window where you have unzipped the repository

![unzipp](http://app1.falconide.com/integration_imgs/windows_without_IDE/11.png)

8. Paste in CMD with ```cd copied\PATH\to\Directory```

![path](http://app1.falconide.com/integration_imgs/windows_without_IDE/12.png)

9. Once you had copied & successfully migrated to Unzipped Path

install composer using ```composer install``` these will install all the requirement for Building SDK

![composer](http://app1.falconide.com/integration_imgs/windows_without_IDE/14.png)

10. Download CURL (https://curl.haxx.se/docs/caextract.html) for windows

move **.pem** from downloads directory to the unzipped SDK folder.

![downloadcurl](http://app1.falconide.com/integration_imgs/windows_without_IDE/15.png)

11. As we have downloaded the Curl we need to add in our php.ini file

Open xampp Control panel -> config(php.ini) file shown below

![xampp](http://app1.falconide.com/integration_imgs/windows_without_IDE/16.png)

12. Add line ```**curl.cainfo = "PATH_TO/cacert.pem"**``` to php.ini file

![PEm file](http://app1.falconide.com/integration_imgs/windows_without_IDE/18.png)

13. Make a Sample file named **test.php** in the unzipped directory as shown below

![testfile](http://app1.falconide.com/integration_imgs/windows_without_IDE/20.png)

14. Open file with notepad (for simpliest debugging would like to recommend :: notepad++ (https://notepad-plus-plus.org/download/v7.5.8.html))

15. Copy and paste Simple Usage example from ![simpleUsage.php](https://github.com/hellovikram/pepipost-php/blob/feature_x/pepipost-sdk-php/simpleUsage.php) in **test.php**

16. Make changes in the file (replace/add your credentials available from panel)

   16.1. Get **api_key** from Panel
             replace line ```$apiKey = 'api-XX-key-XX-here'``` in SimpleUsage with ```$apiKey = 'api-key-from-panel refer the image below'```

   ![panel](http://app1.falconide.com/integration_imgs/windows_without_IDE/22.png)

   ![api_key](http://app1.falconide.com/integration_imgs/windows_without_IDE/23.png)

   16.2. Get **Sending Domain** from panel (should be verified/Active)
             replace ```$body->from->fromEmail =<EMAIL_ADDRESS>with ```$body->from->fromEmail = 'admin@domain-from-panel-refer-image-below```

   ![domain](http://app1.falconide.com/integration_imgs/windows_without_IDE/31.png)

   ![sendingdomain](http://app1.falconide.com/integration_imgs/windows_without_IDE/30.png)

17. Ready to Go..!
Save you File and open CMD -> cd Path\to\Unzipped\directory

Check Syntax by **C:\xampp\php\php.exe -l Path\to\Unzipped\directory\test.php**

**Syntax ok** will be prompted if everything is correct in your test.php file

Send your first mail now with **C:\xampp\php\php.exe Path\to\Unzipped\directory\test.php**

![success](http://app1.falconide.com/integration_imgs/windows_without_IDE/26.png)

18.Check your Email Inbox (please **mark as not spam** if it is found in spam)

![check1](http://app1.falconide.com/integration_imgs/windows_without_IDE/27.png)

![check2](http://app1.falconide.com/integration_imgs/windows_without_IDE/28.png)

19. Success :: You have Successfully Integrated Pepipost :smiley: .

repository: geniusdibya/pepipost-sdk-php

repo_name: geniusdibya/pepipost-sdk-php


text:
# Week 6

## React. SSR/SSG

Task should be based on the previous task.

### What should be done:

1. Create a separate branch for this task from the previous branch task.
2. Move your application to the server and enable server side rendering.
3. Hydrate your application on FE side.
4. Adopt Redux for SSR.
5. Add e2e tests for your application via cypress.

### Questions
You should be using Discord as the main mean of the communication.
Also we will try to collect your questions regarding the 6th Module using special form, which will be provided via the Discord with the 6th Module start. Questions will be collected in Module 06 section of the same spreadsheet. Please, check answers carefully before posting the question, may be your question has been answered already.
We will try to conduct a session for each module providing answers for some questions.

### Score
The task will be checked during cross-check and cross-code-review.
#### Cross-code-review process
1. Clone the repository you are going to review
2. Install all the required dependencies
3. Run linting using special command in package.json file, output should not produce any errors or warnings
4. Run tests using special command in package.json file, all tests should pass, test coverage should be shown after running all the tests
5. Review the code. Pay attention at the following "code smells": props drilling; large, complex components aka "god" components; direct DOM manipulation, etc.

When reviewing the code try pay attention at the following principles:
* Write code as simply as possible: KISS
* Avoid unnecessary repetition: DRY
* Delete what is not needed: YAGNI

We also need to mention the [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single-responsibility_principle) and other [SOLID](https://en.wikipedia.org/wiki/SOLID) principles
Please, check [this article](https://dmitripavlutin.com/7-architectural-attributes-of-a-reliable-react-component/) for reference
Last, but not least - check the presence of the comments. Ideally there shouldn't be any comments at all. Sometimes people just comment code which is not needed. So why not to remove it entirely? In case you will need to restore this code, you can always refer to the git history. And more - [comments are lies](https://blog.devgenius.io/code-should-be-the-one-version-of-the-truth-dont-add-comments-b0bcd8631a9a)
#### Cross-check process
Run app and check that the functionality is working (cross-check)

#### Points
Student can get 15 points if the following requirements are met:
1. Eslint should not show any errors or warnings.
2. All the functionality should work.
3. No console errors in browser.
4. E2E test coverage should be not less than 80%.

If at least one of the requirements is not completed, then the task is evaluated as **0 points**.

The score might be less, if:
1. Part of functionality doesn't work.
2. renderToPipeableStream method haven't been used.
2. Redux doesn't work.
3. E2E test coverage is below than 80%.

### Repository requirements

* the task should be done in **your personal private repository**
* in the repository create a branch from the **previous task** branch with the name of the task and work in the created branch
* the commits history should reflect the process of app creating [Commits requirements](https://docs.rs.school/#/git-convention?id=%D0%A2%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F-%D0%BA-%D0%B8%D0%BC%D0%B5%D0%BD%D0%B0%D0%BC-%D0%BA%D0%BE%D0%BC%D0%BC%D0%B8%D1%82%D0%BE%D0%B2) [RU]
* after finishing development it’s necessary to make Pull Request from app’s branch to `main` branch [Pull Request requirements](https://docs.rs.school/#/pull-request-review-process?id=%D0%A2%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F-%D0%BA-pull-request-pr) [RU]
* after completing the module, private repository should be exposed for cross-checks and cross-code-reviews for the duration of the next module (one week), after this week will end, repository should be made private again
**Do not merge Pull Request from the development branch to the `main` branch**

### Theory

SSR:
 - [Rendering types](https://dexlock.com/blog/frontend-rendering-ssg-vs-ssr-vs-csr-vs-isr/)
 - [React.renderToPipeableStream](https://beta.reactjs.org/reference/react-dom/server/renderToPipeableStream)
 - [React Hydration](https://beta.reactjs.org/reference/react-dom/client/hydrateRoot#hydrating-an-entire-document)
 - [Redux SSR](https://redux.js.org/usage/server-rendering)
 - [React SSR with Express.js](https://dev.to/juhanakristian/basics-of-react-server-side-rendering-with-expressjs-phd)

Cypress:
- [What is e2e testing?](https://circleci.com/blog/what-is-end-to-end-testing/)
- [How to write e2e tests](https://docs.cypress.io/guides/end-to-end-testing/writing-your-first-end-to-end-test)

Extra:
 - [NEXT.js](https://nextjs.org/)
 - [Remix](https://remix.run/)
 - [Gatsby.js](https://www.gatsbyjs.com/why-gatsby)

repository: rolling-scopes-school/tasks

repo_name: rolling-scopes-school/tasks


text:
name: Hadoop_in_Action
isbn13:<PHONE_NUMBER>191
isbn:<PHONE_NUMBER>
title: [Hadoop in Action](http://amzn.com/1935182196)
author: Chuck Lam
publisher: Manning
year: 2011
acquired: 2011-03-12
start: 2011-03-17
stop: 2011-05-25

I've been curious about Hadoop for some time.    I tried to
use a 50% off coupon to buy this title directly from the publisher's website,
but ended up buying the ebook instead of the paper book.  It's great to have the
ebook so I can do searches in the text, but I cannot read an entire book on my
computer screen; so I had to buy it one more time to get the printed version.

One of the drawbacks of books on bleeding edge technologies is that by the time
you read the book, the examples need to be tweaked to get them to work.  Things
like `CLASSPATH` have changed and sometimes the interfaces are not exactly the
same.  In the book, they talk about _older_ Hadoop interfaces that were in use
until version 0.18, and _newer_ ones that were introduced in 0.20.  They decided
to keep all the examples in the _old_ style since all of Hadoop understands them.
I'm using version 0.21 to play with it, which is pretty much all moved on to the
_new_ interfaces.

A lot of the examples deal more with the details of running a Hadoop MapReduce,
and less with powerful ways to use the MapReduce paradigm.  Maybe the chapter on
"Advanced MapReduce" will fill my need.

I had to stop reading it half-way through because I had to read
[_jQuery in Action_](#jQuery_in_Action) for work.  I will have to come back
to Hadoop at a later date.


text:
[![Build Status](https://travis-ci.org/ruff-drivers/gy-30.svg)](https://travis-ci.org/ruff-drivers/gy-30)

# Light Intensity Sensor Driver for Ruff

Light Intensity Sensor driver with I2C interface.

## Supported Engines

* Ruff: >=1.2.0 <1.6.0

## Supported Models

- [gy-30](https://rap.ruff.io/devices/gy-30)

## Installing

Execute following command and enter a **supported model** to install.

```sh
# Please replace `<device-id>` with a proper ID.
# And this will be what you are going to query while `$('#<device-id>')`.
rap device add <device-id>

# Then enter a supported model, for example:
# ? model: gy-30
# ? value (boolean) for argument "highResolution": (Y/n)
```

### Arguments

#### `highResolution`

A boolean indicates whether to use high resolution (1lx) mode, defaults to `true`, otherwise will use low resolution (4lx) mode.
The measurement time for high resolution mode is 180 ms, while for low resolution mode it's 24 ms.

## Usage

This driver provides you the illuminance of light sensor.

```js
$('#<device-id>').getIlluminance(function (error, value) {
    if (error) {
        console.error(error);
        return;
    }

    console.log('illuminance', value);
});
```

## API References

### Properties

#### `highResolution`

A boolean indicates whether to use high resolution (1lx) mode.

### Methods

#### `getIlluminance(callback)`

The callback gets error and value as its arguments.

- **callback:** the callback.

## Contributing

Contributions to this project are warmly welcome. But before you open a pull request, please make sure your changes are passing code linting and tests.

You will need the latest [Ruff SDK](https://ruff.io/) to install rap dependencies and then to run tests.

### Installing Dependencies

```sh
npm install
rap install
```

### Running Tests

```sh
npm test
```

## License

The MIT License (MIT)

Copyright (c) 2016 Nanchao Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: ShaolinZhang/HACKxFDU-CrisisProbingUAV

repo_name: ShaolinZhang/HACKxFDU-CrisisProbingUAV


text:
---
id: 1wWbjWNWOQygO2EaESEOeq
title: 'The FHIR Resource Object: The Core Building Block'
slug: the-fhir-resource-object-the-core-building-block
pub_date: '2018-05-17'
author: 5dsPZqJr4Qu2uww6KgYO0G
tags:
  - fhir
discovery_topic: discovery_topic/ehr-integrations
summary: >-
  To understand FHIR, you must understand the FHIR Resource Object. This entry
  will help explain its origins and intent with links to help.
lead: >-
  To understand FHIR, you must understand the Resource object. This entry will
  help explain its origins and intent, then provide links to expand your
  understanding.
related_guide: wSUz5LDXA4Uu42OqwQ8AM
related_entries:
  - 3lJNN0q4FWgqoYWGGWKGUg
  - 1t2mQms18kgiecSMeSeCCW
cta_ref: 4OCkYKXr2EEQSIcse0GQOq
---
First, a quote from the [FHIR website](http://www.hl7.org/fhir/):

> FHIR solutions are built from a set of modular components called "Resources". These resources can easily be assembled into working systems that solve real world clinical and administrative problems at a fraction of the price of existing alternatives. FHIR is suitable for use in a wide variety of contexts – mobile phone apps, cloud communications, EHR-based data sharing, server communication in large institutional healthcare providers, and much more.

At the core of FHIR's design is the concept of a Resource. Resources are essentially a structured model of a JSON or XML object. There are various resource categories, namely:

#### Clinical Resources
Models that describe clinical objects such as Medications, Diagnostics, Observations or other General objects.

#### Administrative Resources
Models that outline how clinical resources are attributed (Attribution), or are described (Entities), or are used to support workflows (Workflow).

#### Infrastructure Resources
Models that pertain to carrying specific data payloads such as documents, message headers specifying source and destinations, and more. Critically, there are four key model types described in this category:

* **Composition** — Allows combination of multiple resources into a single, complex and more descriptive object.
* **Query** — Defines a structure for requesting data elements via querying and an associated structure for returning responses.
* **Profiles** — Intended to be a self-descriptive way to define what models and extensions are supported by the specific implementation and the associated models. Also where model extensions can be specified to extend other models to support specific needs.
* **Value Sets** — Addresses one of the biggest challenges in healthcare. Different health systems use different value sets and the challenge with interoperability has exacerbated because of the differences. This model allows each implementation to specify the value sets in use to assure semantic interoperability.

Putting these various models together allows for the creation of most any clinical condition.

## Structure of any Resource

All resources follow a standard model with content and associated extensions being the only thing that changes from resource to resource, meaning while a Patient Resource and a Medication Resource both have the same general overall structure, the content within each describing the resource will be different and specific to that resource.

The general structure of any resource is as follows:

1. **Resource Type** — Identifies the specific resource model i.e. Patient, Medications, Allergies, etc.
2. **Human Readable summary section** — An XHTML section that provides a human readable version of the content within the message. Can be considered as a backup as well as a verification section.
3. **Identifier section** — A unique identifier URL for each resource identifying to be of a specific type e.g. Patient.
4. **Extension section** — Allows for the definition of any extensions that might be required to support specific clinical workflows e.g. clinical trial applicability. Can be inserted in any of sections to cover specific use cases and workflow needs.
5. **Contained Resources** — Other resources used in identification and transaction processing e.g. message header and the data object corresponding to the type identified earlier or images associated with the patient such as an avatar.
6. **Resource content** — The core content of the resource. In the case of a patient, it contains all relevant details about that patient such as name, address, phone, guardian or other contact info and so on. Each resource has a defined data model.
7. **Tags** — Typical tagging paradigm you're used to. For example, Security labels which can include ACLs, workflow specific functions, etc. This one is still murky, however, and should be considered under development.

Let's take a sample Resource Object and work our way through it. We'll lay out the individual sections and describe them, then finally put it all together in real syntax to see what the complete resource will look like.

We'll begin with an example Patient Resource.

### Resource Type

Every resource will start with its name. Given the Patient example, it will start with:

~~~javascript
"resourceType": "Patient"
~~~
{: .prettyprint .lang-js}

This sets the context of the data exchange and allows for appropriate parsing and other rules to be invoked.

### Human Readable Summary

Every resource has an associated tabular description of the contents of the message, thus making it human readable. The contents of this section are in XHTML format and will include all the `\n` (next line) characters. A sample human readable summary included in a patient message could look like this:

~~~javascript
  "text": {
      "status": "generated",
      "div": "

 \n

 \n

 \n
          Name	  \n
          John Samuel Appleseed ("John")	  \n

  \n

  \n
          Address	 \n
          1231 Evergreen Ave, #30, San Francisco, CA 90002	  \n

  \n

 \n
          Contacts	 \n
          Home: unknown. Work: (203) 5555 6473, Name: Bénédicte du Marché. Relationship: Partner. Phone: +33 (237) 998327	 \n

 \n

 \n
          Gender	 \n
          Male	 \n

 \n

 \n
          Birthdate	 \n
          1974-12-25	 \n

 \n

 \n
          Marital Status	 \n
          Married	 \n

 \n

 \n
          Multiple Birth Count	 \n
          3	 \n

  \n

 \n
          Id	 \n
          MRN: 12345 (Acme Healthcare)	 \n

 \n

 \n

 \n

"
    }
~~~
{: .prettyprint .lang-js}

Which could be easily parsed and made readable. In this case, the parsed / rendered content would look like this:

        Name
        John Samuel Appleseed ("John")

        Address
        1231 Evergreen Ave, #30, San Francisco, CA 90002

        Contacts
        Home: unknown. Work: (203) 5555 6473, Name: Bénédicte du Marché. Relationship: Partner. Phone: +33 (237) 998327

        Gender
        Male

        Birthdate
        1974-12-25

        Marital Status
        Married

        Multiple Birth Count
        3

        Id
        MRN: 12345 (Acme Healthcare)

The intent of this section is borrowed from the HL7 spec. The human readable version of the FHIR content serves two purposes:

1. Testing from a developer perspective is simplified as the developer now knows exactly what the message / transaction is *supposed* to communicate.
2. Overcoming errors in processing so even if the message gets garbled in processing, the human readable version is always available as a fallback for clinicians and others performing care.

Note that this narrative element in a resource is **not** mandatory. If you have do put one in, it **shall** reflect all the content needed for a human to understand the essential clinical and business information otherwise encoded within the resource. Note also that this generally will be difficult to generate. Epic, for example, has chosen to [drop this section](http://open.epic.com/Clinical/FHIR?whereTo=patient) from their spec for the time being. We expect a similar trend across various EHRs so practical deployments can (for the time being) safely skip this.

## Identifier section

In FHIR, every object is expected to have its own URI (universal resource identifier). All this implies is that every patient, in our context, will have their own URI, and potentially URL, with a unique identifier. Identifiers could include SSN (social security numbers), MRNs (medical record numbers), and any number of others. Multiple identifiers can be specified since it is defined as an array. In our context, this would look like the following.

~~~javascript
"identifier": [
    {
      "use": "usual",
      "label": "MRN",
      "system": "urn:oid:<IP_ADDRESS>.5<IP_ADDRESS>",
      "value": "12345",
      "period": {
        "start": "2001-05-06"
      },
      "assigner": {
        "display": "Acme Healthcare"
      }
    }
  ]

~~~
{: .prettyprint .lang-js}

## Extensions

This is healthcare after all. There are a million use cases that you can think of that requires "slightly" different definitions that what is already provided. Not to mention that since FHIR is supposed to be a **universal** standard, all of these must be taken into account as well. Hence the need for extensions.

Extensions can be tacked on to any Resource Object as long as they follow a specified format. The general format specified is as follows:

~~~javascript
"name" : {
  "extension: [
    {
      "url" : "https://{{url.defining.extension-profile.com/id}}",
      "valueCode" : "{{value}}"
     }]
  "text": "{{human readable value - this is optional}}"/>
}
~~~
{: .prettyprint .lang-js}

Let's take a couple of use cases.

### Marital Status

~~~javascript
"_maritalStatus": {"extension": [{
      "valueCode": "Common-law",
      "url": "http://fhir-endpoint.someorg.com/fhir/version1.0/marriage-extension#cl"
  }]}
~~~
{: .prettyprint .lang-js}

### Clinical Trials

Here's another extremely relevant example of a patient resource where you can see an extension specific to a clinical trial, including data elements such as trial status, profile with the trial status code, date, and the physician recording the results of the study.

~~~javascript
  "resource-type" : "Patient",
  "extension" : [
    {
      "url" : "http://fhir-endpoint.someorg.com/fhir/version1.0/Profile/clinical-trails#trial-status",
      "extension" : [
        {
          "url" : "http://fhir-endpoint.someorg.com/fhir/version1.0/Profile/clinical-trails#trial-status#trial-status-code",
          "valueCode" : "Started"
        },
        {
          "url" : "http://fhir-endpoint.someorg.com/fhir/version1.0/Profile/clinical-trails#trial-status#trial-status-date",
          "valueDate" : "2015-02-26"
        },
        {
          "url" : "http://fhir-endpoint.someorg.com/fhir/version1.0/Profile/clinical-trails#trial-status#trial-status-who",
          "valueResource" : {
            "reference" : "Practitioner/f6dbc2f3-d054-4dd7-84c1-5e675f8e50d7"
          }
        }
     ]
   }
  ],
  // ... other data for patient...
~~~
{: .prettyprint .lang-js}

## Contained Resources

Since FHIR is a request-based format, contained resources are a way to minimize the number of calls to address use cases where specific data elements need to be served up every time a request is made to a particular resource. An example would be if a patient avatar picture needs to be served up anytime a patient resource is returned. Note that this assumed that the request is valid and the request is authenticated and authorized before the response is served.

In this specific scenario, if the patient avatar image always has to be sent along with any patient resource request, then it would look something like this:

~~~javascript
  "contained": [
      {
          "resourceType": "Binary",
          "id": "pic1",
          "contentType": "image/gif",
          "content": "R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/[long encoded image]...jNEiaNMKAAAA7"
      },
      {
          "resourceType": "Organization",
          "id": "org3141",
          "text": {
              "status": "generated",
              "div": "
\n
Good Health Clinic<\/p>\n    <\/div>"
          },
          "identifier": [{
              "system": "urn:ietf:rfc:3986",
              "value": "2.16.840.1.113883.19.5"
          }],
          "name": "Good Health Clinic"
      }
  ]
~~~
{: .prettyprint .lang-js}

## Resource Content

The meat of the FHIR message. Every resource has a model associated with it that is different based upon the resource type in question. As you can imagine, in the context of a patient, the kind of information that needs to be shared includes date of birth, contact information, next of kin, address info etc. The sample below is pretty self explanatory.

~~~javascript
  "extension":
        {
            "url": "http://hl7.org/fhir/example-do-not-use#Patient.avatar",
            "valueResource": {
                "reference": "#pic1",
                "display": "Duck image"
            },
        },
  "name": [
    {
      "use": "official",
      "family": [
        "Chalmers"
      ],
      "given": [
        "Peter",
        "James"
      ]
    },
    {
      "use": "usual",
      "given": [
        "Jim"
      ]
    }
  ],
  "telecom": [
    {
      "use": "home"
    },
    {
      "system": "phone",
      "value": "(203) 5555 6473",
      "use": "work"
    }
  ],
  "gender": {
    "coding": [
      {
        "system": "http://hl7.org/fhir/v3/AdministrativeGender",
        "code": "M",
        "display": "Male"
      }
    ]
  },
  "birthDate": "1974-12-25",
  "deceasedBoolean": false,
  "address": [
    {
      "use": "home",
      "line": [
        "Evergreen Ave, #30"
      ],
      "city": "San Francisco",
      "state": "CA",
      "zip": "90002"
    }
  ],
  "_maritalStatus": {"extension": [{
      "valueCode": "ASKU",
      "url": "http://hl7.org/fhir/Profileiso-21090#nullFlavor"
  }]},
  "multipleBirthInteger": 3,
  "contained": [
      {
          "resourceType": "Binary",
          "id": "pic1",
          "contentType": "image/gif",
          "content": "R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/[long encoded image]aNMKAAAA7"
      },
      {
          "resourceType": "Organization",
          "id": "org3141",
          "text": {
              "status": "generated",
              "div": "
\n
Good Health Clinic<\/p>\n    <\/div>"
          },
          "identifier": [{
              "system": "urn:ietf:rfc:3986",
              "value": "2.16.840.1.113883.19.5"
          }],
          "name": "Good Health Clinic"
      }
  ],
  "contact": [
    {
      "relationship": [
        {
          "coding": [
            {
              "system": "http://hl7.org/fhir/patient-contact-relationship",
              "code": "partner"
            }
          ]
        }
      ],
      "name": {
        "family": [
          "du",
          "Marché"
        ],
        "_family": [
          {
            "extension": [
              {
                "url": "http://hl7.org/fhir/Profile/iso-21090#qualifier",
                "valueCode": "VV"
              }
            ]
          },
          null
        ],
        "given": [
          "Bénédicte"
        ]
      },
      "telecom": [
        {
          "system": "phone",
          "value": "+33 (237) 998327"
        }
      ]
    }
  ],
  "managingOrganization": {
    "reference": "Organization/1"
  },
  "active": true
~~~
{: .prettyprint .lang-js}

There are other elements of a resource such as tags, metadata, etc., which aren't quite as well defined.

Piecing together our discussion thus far, here's what the final Patient Resource showing the above sections will look like in aggregate.

~~~javascript
{
  "resourceType": "Patient",
  "text": {
    "status": "generated",
    "div": "
\n

\n
\n
\n
    	Name	\n John Samuel Appleseed ("John")	\n

\n
\n Address	\n
    Evergreen Ave, #30, San Francisco, CA 90002 	\n
\n
\n
    Contacts	\n Home: unknown. Work: (203) 5555 6473	\n

\n
\n Id	\n
MRN: 12345 (Acme Healthcare)	\n
\n

\n
\n
"
  },
  "identifier": [
    {
      "use": "usual",
      "label": "MRN",
      "system": "urn:oid:<IP_ADDRESS>.5<IP_ADDRESS>",
      "value": "12345",
      "period": {
        "start": "2001-05-06"
      },
      "assigner": {
        "display": "Acme Healthcare"
      }
    }
  ],
  "extension": [
        {
            "url": "http://hl7.org/fhir/example-do-not-use#Patient.avatar",
            "valueResource": {
                "reference": "#pic1",
                "display": "Duck image"
            }
        },
  "name": [
    {
      "use": "official",
      "family": [
        "Chalmers"
      ],
      "given": [
        "Peter",
        "James"
      ]
    },
    {
      "use": "usual",
      "given": [
        "Jim"
      ]
    }
  ],
  "telecom": [
    {
      "use": "home"
    },
    {
      "system": "phone",
      "value": "(203) 5555 6473",
      "use": "work"
    }
  ],
  "gender": {
    "coding": [
      {
        "system": "http://hl7.org/fhir/v3/AdministrativeGender",
        "code": "M",
        "display": "Male"
      }
    ]
  },
  "birthDate": "1974-12-25",
  "deceasedBoolean": false,
  "address": [
    {
      "use": "home",
      "line": [
        "Evergreen Ave, #30"
      ],
      "city": "San Francisco",
      "state": "CA",
      "zip": "90002"
    }
  ],
  "_maritalStatus": {"extension": [{
      "valueCode": "ASKU",
      "url": "http://hl7.org/fhir/Profileiso-21090#nullFlavor"
  }]},
  "multipleBirthInteger": 3,
  "contained": [
      {
          "resourceType": "Binary",
          "id": "pic1",
          "contentType": "image/gif",
          "content": "R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WA/...[long binary string]MKAAAA7"
      },
      {
          "resourceType": "Organization",
          "id": "org3141",
          "text": {
              "status": "generated",
              "div": "
\n
Good Health Clinic<\/p>\n    <\/div>"
          },
          "identifier": [{
              "system": "urn:ietf:rfc:3986",
              "value": "2.16.840.1.113883.19.5"
          }],
          "name": "Good Health Clinic"
      }
  ],
  "contact": [
    {
      "relationship": [
        {
          "coding": [
            {
              "system": "http://hl7.org/fhir/patient-contact-relationship",
              "code": "partner"
            }
          ]
        }
      ],
      "name": {
        "family": [
          "du",
          "Marché"
        ],
        "_family": [
          {
            "extension": [
              {
                "url": "http://hl7.org/fhir/Profile/iso-21090#qualifier",
                "valueCode": "VV"
              }
            ]
          },
          null
        ],
        "given": [
          "Bénédicte"
        ]
      },
      "telecom": [
        {
          "system": "phone",
          "value": "+33 (237) 998327"
        }
      ]
    }
  ],
  "managingOrganization": {
    "reference": "Organization/1"
  },
  "active": true
}

~~~
{: .prettyprint .lang-js}

## Summary

Some FHIR resources are still undefined and open to comment, such as Financial models, which will fall under the Administrative category of Resources. The above sections delve in a little bit more detail on the overall resource model and its constituent parts.

Every resource consists of the following:

* **Identifier section** — A unique identifier URL for each resource identifying the resource to be of a specific type e.g. patient. It is a required component.
* **Human Readable summary section** — An XHTML section that provides a human readable version of the content within the message. This can be considered as a backup as well as a verification section. It can be skipped unless you can ensure all data contained in the message is also represented here. It is an optional component.
* **Extension section** — Allows for the definition of any extensions that might be required to support specific clinical workflows e.g. clinical trial applicability. This can be inserted in any of the sections to cover specific use cases and workflow needs. This is required if resources include data elements / objects that are not part of the core FHIR models.
* **Contained Resources** — Other resources used in identification and transaction processing e.g. message header and the data object corresponding to the type identified earlier, such as images, that always need to be returned as part of the resource request. This is an optional element.
* **Metadata** — Such as version number of the resource. This is an optional element.
* **Resource content** — The core content of the resource. In the case of a patient, all relevant details about that patient such as name, address, phone, guardian or other contact info and so on. Each resource has a defined data model. This is a required element (otherwise why bother?).
* **Tags** — Such as security labels which can include ACLs, workflow specific functions, etc. This is optional. It is also under design.

While the FHIR spec is stabilizing, no doubt additions and subtractions are on the horizon. Stay tuned for updates.

gha_language: PHP


text:
In a future version, replies, likes, reposts, etc. of this post will be included if they are listed on the page.

```json
{
  "data": {
    "type": "entry",
    ...
    "like": [
      {
        "type": "cite",
        "author": {
          "type": "card",
          "name": "Thomas Dunlap",
          "photo": "https://s3-us-west-2.amazonaws.com/aaronparecki.com/twitter.com/9055c458a67762637c0071006b16c78f25cb610b224dbc98f48961d772faff4d.jpeg",
          "url": "https://twitter.com/spladow"
        },
        "url": "https://twitter.com/aaronpk/status/688518372170977280#favorited-by-16467582"
      }
    ],
    "comment": [
      {
        "type": "cite",
        "author": {
          "type": "card",
          "name": "Poetica",
          "photo": "https://s3-us-west-2.amazonaws.com/aaronparecki.com/twitter.com/192664bb706b2998ed42a50a860490b6aa1bb4926b458ba293b4578af599aa6f.png",
          "url": "http://poetica.com/"
        },
        "url": "https://twitter.com/poetica/status/689045331426803712",
        "published": "2016-01-18T03:23:03-08:00",
        "content": {
          "text": "@aaronpk @mozillapersona thanks very much! :)"
        }
      }
    ]
  }
}

```

repository: aaronpk/XRay

branch_name: refs/heads/main

repo_name: aaronpk/XRay


text:
---
layout: post
title: CNNs, RNNs, and LSTMs - Unraveling the Acronyms of Deep Learning
categories: ['AI', 'Machine Learning', 'LLM']
description: A deep dive into the world of convolutional neural networks, recurrent neural networks, and long short-term memory networks, key architectures in deep learning.
keywords: Deep Learning, CNNs, RNNs, LSTMs, Convolutional Neural Networks, Recurrent Neural Networks, Long Short-Term Memory
---
# CNNs, RNNs, and LSTMs: Unraveling the Acronyms of Deep Learning

- [Introduction](#introduction)
- [Convolutional Neural Networks (CNNs)](#convolutional-neural-networks-cnns)
- [Recurrent Neural Networks (RNNs)](#recurrent-neural-networks-rnns)
- [Long Short-Term Memory Networks (LSTMs)](#long-short-term-memory-networks-lstms)
- [Conclusion](#conclusion)

## Introduction
Deep learning is filled with acronyms – CNNs, RNNs, LSTMs, to name a few – each representing a different type of neural network architecture designed for specific types of tasks. In this article, we'll delve into these acronyms, exploring what they mean, how they work, and where they are used.

## Convolutional Neural Networks (CNNs)
CNNs are specialized kinds of neural networks designed to process data with a grid-like topology – for example, an image that can be thought of as a 2D grid of pixels. The "convolutional" in the name refers to mathematical convolution, a key operation in the working of these networks.

CNNs are composed of one or more convolutional layers, often followed by pooling layers, and then fully connected layers towards the end. The convolutional layers apply a series of filters to the input. These filters can detect low-level features like edges and curves, and as the data progresses through the network, higher-level features like shapes or objects.

CNNs have proven extremely effective for image-related tasks, such as image recognition, object detection, and semantic segmentation.

An RNN processes sequential data by maintaining a hidden state that captures information about the sequence up to the current element. This allows it to exhibit temporal dynamic behavior, making it suited for tasks like speech recognition, language modeling, and translation.

However, RNNs have a significant limitation: they struggle with long sequences, as the information about earlier elements in the sequence gets diluted by the time the network processes later elements. This problem, known as the vanishing gradient problem, led to the development of a variant of RNNs: Long Short-Term Memory networks.

## Long Short-Term Memory Networks (LSTMs)
LSTMs are a type of RNN designed to remember long-term dependencies in sequence data. They were introduced by Hochreiter and Schmidhuber in 1997 to combat the vanishing gradient problem.

LSTMs maintain a separate cell state that runs alongside the hidden state. This cell state acts as a "conveyor belt," allowing information to be carried along with minimal modification. Gates control the flow of information into and out of the cell state, enabling the LSTM to keep or discard information as needed.

LSTMs have been successful in a variety of tasks, such as text generation, machine translation, and even composing music.

## Conclusion
CNNs, RNNs, and LSTMs each serve a unique purpose in the realm of deep learning. CNNs excel at processing grid-like data, making them ideal for tasks involving images. RNNs and LSTMs, on the other hand, are designed for sequential data,```markdown
making them well-suited for tasks involving time series, text, or audio.

Understanding these different architectures and their applications is essential as we continue to push the boundaries of what's possible with deep learning. But remember, these are just the tip of the iceberg. The field is rapidly evolving, with new architectures and techniques emerging all the time.

In the upcoming articles, we will delve deeper into each of these architectures, exploring their inner workings, discussing their strengths and weaknesses, and examining how they can be applied to solve complex real-world problems. Stay tuned!


text:
# mysql2 gem compiled for wrong mysql client library

## Question

When try to connect to the mysql server through my rails application, I get the following error

    D:/Program_Files/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
    Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.0.27. (RuntimeError)

How can I rectify it?

## Answer

I had the same problem as you, or at least the symptom was the same.

Background: I was using Rails 3, the mysql2 gem, and MySQL community server version 5.5.21 (32-bit) installed locally on my Windows machine. I grabbed the client library (`libmysql.dll`) from the MySQL installation and copied it to my ruby installation's `bin` folder.

When I ran `bundle exec rake db:create`, I got the same error message as you and I thought "Hey, how can the client library be outdated when I got it from the latest MySQL release?"

There's a helpful message that is shown when you `gem install mysql2`. Unfortunately, if you install the gem with Bundler, Bundler eats the message. Here it is:

    =========================================================================
    You've installed the binary version of mysql2. It was built using MySQL
    Connector/C version 6.0.2. It's recommended to use the exact same version
    to avoid potential issues.

    At the time of building this gem, the necessary DLL files where available
    in the following download:

    http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

    And put lib\libmysql.dll file in your Ruby bin directory, for example
    C:\Ruby\bin

Following these instructions solved the problem for me.

[Referenced link](http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick)

repository: stackflow-io/stackflow

repo_name: stackflow-io/stackflow


text:
# Computer Vision Demo

----

## Contents

Notebooks are as follows:
1. train
1. lineage
1. deploy-predict
1. pipeline

----
## Useful Resources

* Computer vision demo: https://www.youtube.com/watch?v=Bx8r7GD1EKY&feature=youtu.be
* [Amazon SageMaker Developer Guide](https://docs.aws.amazon.com/sagemaker/latest/dg/whatis.html)
* [Amazon SageMaker Python SDK Documentation](https://sagemaker.readthedocs.io/en/stable/)

repository: EmilyWebber/amazon-sagemaker-examples

repo_name: EmilyWebber/amazon-sagemaker-examples


text:
# DRRG

## Introduction

[ALGORITHM]

```bibtex
@article{zhang2020drrg,
  title={Deep relational reasoning graph network for arbitrary shape text detection},
  author={Zhang, Shi-Xue and Zhu, Xiaobin and Hou, Jie-Bo and Liu, Chang and Yang, Chun and Wang, Hongfa and Yin, Xu-Cheng},
  booktitle={CVPR},
  pages={9699-9708},
  year={2020}
}
```

## Results and models

### CTW1500

|                              Method                              | Pretrained Model | Training set  |   Test set   | #epochs | Test size | Recall | Precision | Hmean |                                                                                Download                                                                                |
| :--------------------------------------------------------------: | :--------------: | :-----------: | :----------: | :-----: | :-------: | :----: | :-------: | :---: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| [DRRG](configs/textdet/drrg/drrg_r50_fpn_unet_1200e_ctw1500.py) |     ImageNet     | CTW1500 Train | CTW1500 Test |  1200   |    640    | 0.822 (0.791)  |   0.858 (0.862)  | 0.840 (0.825) | [model](https://download.openmmlab.com/mmocr/textdet/drrg/drrg_r50_fpn_unet_1200e_ctw1500_20211022-fb30b001.pth) \ [log](https://download.openmmlab.com/mmocr/textdet/drrg/20210511_234719.log) |

**Note:** We've upgraded our IoU backend from `Polygon3` to `shapely`. There are some performance differences for some models due to the backends' different logics to handle invalid polygons (more info [here](https://github.com/open-mmlab/mmocr/issues/465)). **New evaluation result is presented in brackets** and new logs will be uploaded soon.

repository: stjordanis/mmocr

repo_name: stjordanis/mmocr


text:
# `nix-eval`

### An evaluator for the nix language in Haskell

## Overview

This is an implementation of a nix language evaluator in Haskell.
Currently, it only does the pure part of evaluation; that is, the
generation of derivations, but not the realization of those
derivations.

## Why Write This?

There are a few reasons for this.

* It might provide the groundwork for a full nix implementation in
  Haskell.
* It should be considerably simpler and easier to read than the
  official C++ implementation. I'm endeavoring to use existing
  libraries as much as possible for things like internal data
  structures and built-in functions, and also attempting to document
  the code clearly.
* Writing evaluators and language implementations is fun, especially
  in Haskell. Also, since the evaluator is pure, there shouldn't be
  any need for IO (except at initialization for things like
  `builtins.currentSystem`).
* I've never written a lazy evaluator before. I'm sort of figuring
  things out as I go along, so this is a fun learning experience for
  me. In addition, figuring out how best to implement built-in
  functions and (perhaps) identifying techniques for optimization,
  sounds fun.

## Grammar

`nix-eval` does not attempt to evaluate the full nix grammar (as, for
instance, is expressed in the
[`hnix` library](https://github.com/jwiegley/hnix)) directly. Instead,
it defines a simpler grammar for nix, which is easier to evaluate:

```haskell
-- Found in src/Nix/Eval/Expressions.hs
data Expression
  = EConstant Constant
  | EVar Text
  | EListLiteral [Expression]
  | ENonRecursiveAttrs (HashMap Text Expression)
  | ERecursiveAttrs (HashMap Text Expression)
  | EAttrReference Expression Text
  | EBinaryOp Expression BinaryOp Expression
  | EUnaryOp UnaryOp Expression
  | ELambda Text Expression
  | EApply Expression Expression
  | EWith Expression Expression
```

For this reason, the library does not provide a parser for
human-written nix language: the parsing should be done by `hnix` (or
an equivalent) and then translated into the `nix-eval` grammar. For
example, `inherit (x) y z;` forms can be converted into `y = x.y; z =
x.z;`, etc. Even the `let` expression in nix can be viewed as
syntactic sugar for a `with` expression.

repository: adnelson/nix-eval

gha_language: Haskell

repo_name: adnelson/nix-eval


text:
# TimeDimensionValue

## Description

Contains identification of the TimeDimension and the value.

## Attributes

### Inherited

**timeValue** (*ObservationalTimePeriod*): The value of the time period.

**operator** (*string*): Indicates whether the specified value represents the exact time or time period, or whether the value should be handled as a range. A value of greaterThan or greaterThanOrEqual indicates that the value is the beginning of a range (exclusive or inclusive, respectively). A value of lessThan or lessThanOrEqual indicates that the value is the end of a range (exclusive or inclusive, respectively). In the absence of the oppositve bound being specified for the range, this bound is to be treated as infinite (e.g. any time period after the beginning of the provided time period for greaterThanOrEqual).

## Referenced By

[ComponentValue](ComponentValue.md) (as contains)


text:
# mule4docker

**mule4docker** is just an attempt to build a docker container with Mule4 runtime. Once the container has started, you can change a couple of configurations in your own mule app and copy it to apps directory (within container using volume mapping) to run them. The port remains same as long as the app is using Mule domain configurations for HTTP_Listener_Config.

Note: You will need to download the Mule4 runtime separately from [Mulesoft website](https://www.mulesoft.com/lp/dl/mule-esb-enterprise).

##  Repository Content
This repository includes the following:-
1. Dockerfile
2. A sample Mule4 application (with source embedded)
3. A sample Mule domain JAR Project (with source embedded)
   - Domain files are used for sharing resources (port number in this case) with all the mule applications deployed alongside.
   - In this Dockerfile, the Mule Domain Project has HTTP_Listener_Config set to port 8081 which has been exposed. Now all the applications hosted withing this container can share this same configuration (and hence port). The applications can be segregated by different **Path** value.

## DockerHub
If you just want to see it in action and skip all the nonsense below, the docker image is uploaded at [DockerHub](https://hub.docker.com/r/apurba/mule4docker).

Docker Pull Command
```bash
docker pull apurba/mule4docker
```

## Creating the docker image
1. Install [Docker Engine](https://docs.docker.com/engine/install/) (duh!)
2. Download the [Mule EE Runtime](https://www.mulesoft.com/lp/dl/mule-esb-enterprise) archive
2. Download **Dockerfile**, **hello-mule.jar** and **docker-mule-common-domain-app.jar** from this repository
4. Copy all 4 files in one directory
5. Make any necessary changes to the *Dockerfile* like:
   - Changing MULE_RUNTIME_ARCHIVE name based on your downloaded version
   - Changing MULE_RUNTIME_FOLDER name based on extracted folder name
   - Optional changes like - changing linux version from Alpine to Ubuntu
6. Open CLI / Command Prompt and navigate to the directory (with these files)
7. Use following command to build the docker image

```bash
docker build . -t apurbagiri/mule4docker
```

## Starting the container

```python
docker run -it --name mule4docker --rm -p 8081:8081 apurbagiri/mule4docker
```

## Push container to DockerHub

```bash
docker tag apurbagiri/mule4docker dockerid/container_name:versiontag
docker push dockerid/container_name:versiontag
```

## Contributing
Pull requests are welcome.

## DISCLAIMER
- This is just a basic Dockerfile to make Mule4 runtime up and running. By no means does it claim to be the best way to achieve this.
- This container could be a RAM hog.


text:
# The `lib/` folder

Genie makes it very easy to automatically load your existing Julia code (modules, files, etc) into the app, outside of the standard Genie MVC structure. You simply need to add your files and folders into the `lib/` folder.

---
**HEADS UP**

* If the `lib/` folder does not exist, just create it yourself: `julia> mkdir("lib")`
* Genie does not `include` the files placed within the `lib/` folder, but _recursively_ adds all the folders to the `LOAD_PATH` - so you can `include` the files yourself, as needed -- Genie/Julia will know were to find them in the LOAD_PATH.
* Files within `lib/` are not added to the `Revise` queue so they are not automatically reloaded by Genie if changed. If you make changes/add/remove files in `lib/` you need to restart the app or manually add them to be watched and reloaded by `Revise`. The reason being that the `lib/` folder is meant for legacy code. If you will actively develop the code, the recommended way is to use Genie's MVC structure, adding Models, Controllers, and Views as needed.

---


text:
# Cluster Essentials

## Overview

The `cluster-essentials` folder contains a chart with essential resources for the installation of all components in Kyma.
The `files` subfolder contains CustomResourceDefinitions (CRDs) of Kyma components.

repository: kyma-project/kyma

gha_language: Go

repo_name: kyma-project/kyma


text:
# ErrorBoundary

React component to catch JavaScript errors anywhere in their child component tree, log custom error, and display a fallback UI

- _Creates app log for server_

## Props:

**None**

## Installation

```javascript
// Local
import ErrorBoundary from "~Components/ErrorBoundary";

const ExampleComponent = () => (
  <ErrorBoundary>
    <p>Content wrapped by boundary</p>
  </ErrorBoundary>
);
```

## Actions:

**None**

repository: afbeals/CBRA

repo_name: afbeals/CBRA


text:
## Diagnostics
### Ln 1, Col 2
```marko
> 1 | <div aria-pressed="true">Click me</div>
    |  ^^^ Fix all of the following:
  ARIA attribute is not allowed: aria-pressed="true"
```

repository: marko-js/language-server

gha_language: TypeScript

repo_name: marko-js/language-server


text:
# bitbar-bitx
BitX plugin for BitBar

# Installation
Copy `bitx.60s.js` to your bitbar plugin dir. Modify filename as needed.

# Note
The file has to be executable.

repository: stephanIOA/bitbar-bitx

repo_name: stephanIOA/bitbar-bitx