text:
---
layout: docs
title: "Decline"
section: "extensions"
---

The [`decline`](http://ben.kirw.in/decline/) extension adds the ability of using `CronExpr` as
an option in the command line. To be able to use it add the following dependency to your classpath:

```scala
libraryDependencies ++= Seq(
  "com.github.alonsodomin.cron4s" %% "cron4s-decline" % "{{site.cron4sVersion}}",

  "com.monovore" %% "decline" % "{{site.declineVersion}}"
)
```

And now you will need some imports:

```scala mdoc:silent
import cron4s.CronExpr
import cron4s.decline._
import com.monovore.decline._
```

Now you can define options based on cron expressions:

```scala mdoc
val cronOpt = Opts.option[CronExpr]("frequency", "A cron expression")
```

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Hyloe's Book of Games

My NaNoGenMo entry for 2019 is 50,000 words of fictional (and hopefully playable) card games, generated by knitting together fragments of rules from existing games, particularly minor variants and hour rules. The games are bounded into four overlapping groups: trick-taking, climbing, melding and matching. As I found new rules I dropped them into one or more of those groups, each time attempting to spot any obvious contradictions or ambiguities in its interaction with other rules for that group, and to work around it accordingly.

The first edition is at https://kevan.org/nanogenmo/2019firstedition.html

Sample output:

>**Le Temple**
>
>_Le Temple (or La Bolle) is a classic French trick-taking game for three to five players where the led suit is weaker than the rest. It uses a standard 52 card pack. Remove 7s and 7s. Cards rank A, K, Q, J, 10, 9, 8, 6, 5, 4, 3, 2._
>
>**Setup**
>
>Each player is dealt six cards.
>
>Turn the top card of the deck to determine trump suit.
>
>**Play**
>
>The player to the dealer's left starts by leading any card. If the card led is not a trump, its suit is the **small** suit for the trick. Players need not follow suit.
>
>The trick is won by the highest trump, or if it contains no trump by the highest card not in the small suit (with the earliest card played breaking ties), or the highest small card if all cards were small. The winner of the trick leads the next trick.
>
>**Scoring**
>
>When all six tricks have been played each player loses 1 point per heart taken in tricks and loses an additional 9 if they took the 6 of clubs. Taking the 6 of diamonds doubles that player's score for the hand.
>
>When a player's score reaches -40 or lower the player with the highest score wins the game. If tied, the tied player who won a round latest in the game wins.

license: MIT


text:
---
title: Conditionally making search requests
mainTitle: Advanced
layout: main.pug
category: Advanced
withHeadings: true
navWeight: 7
editable: true
githubSource: docs/src/advanced/conditional-requests.md
---

> NOTE: this guide **has** been updated for v2

InstantSearch sends a request to Algolia servers on every keystroke, which means that it's fast and users will see updated results instantly. A request is also sent to show the initial results on an empty query. This is the original behavior since it warms up the network connection so subsequent requests will be done faster too.

However, there are cases in which you do not want to do extra network requests than strictly necessary, for example when you are using a custom backend, or when the initial results are never displayed.

## How it's made possible

InstantSearch is the UI part on top of a search client with a state managed by a [JavaScript Helper](https://github.com/algolia/algoliasearch-helper-js). These three layers are composable and can be interchanged to leverage the InstantSearch widgets system with different search clients.

The [search client](https://github.com/algolia/algoliasearch-client-javascript) that Algolia offers queries Algolia's backends whenever the user refines the search. It is possible to implement your own search client that queries your backend, which then queries Algolia's backend with the [Algolia search client](https://github.com/algolia/algoliasearch-client-javascript) on your server.

To create your own client, you will need to implement a given interface that receives and returns formatted data that InstantSearch can understand.

## Implementing a proxy

The way we will prevent searches to Algolia from happening in certain use cases is by making a proxy object around the `algoliasearch` client. This will then be passed to `ais-instant-search`:

```vue
<template>
  <ais-instant-search
    :search-client="searchClient"
    index-name="instant_search"
  >
    <ais-search-box />
    <ais-hits />
  </ais-instant-search>
</template>

<script>
import algoliasearch from 'algoliasearch/lite';

const algoliaClient = algoliasearch(
  'latency',
  '6be0576ff61c053d5f9a3225e2a90f76'
);

const searchClient = {
  async search(requests) {
    return algoliaClient.search(requests);
  },
  async searchForFacetValues(requests) {
    return algoliaClient.searchForFacetValues(requests);
  },
};

export default {
  data() {
    return {
      searchClient,
    };
  },
};
</script>
```

Functionally this is not any different from directly passing the created search client from the `algoliasearch` call, but what it empowers us is conditionally **not** calling the Algolia search request, and thus not doing the query.

## Mocking a search request

Since we don't want to do a request when the query is empty (`""`), we first need to detect it:

```javascript
const searchClient = {
  async search(requests) {
    if (requests.every(({ params: { query } }) => Boolean(query) === false)) {
      // here we need to do something else
    }
    return algoliaClient.search(requests);
  },
};
```

There can be multiple requests done in case a user for example clicks a hierarchical menu open. For now, this doesn't really have a big impact except that we have to make sure to check that every query is empty before we intercept the function call.

Then, we need to return a [formatted response](https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response). This is an array of objects of the same length as the `requests` array. At the bare minimum, each object needs to contain: `processingTimeMS`, `nbHits`, `hits` and `facets`:

```javascript
const searchClient = {
  async search(requests) {
    if (requests.every(({ params: { query } }) => Boolean(query) === false)) {
      return {
        results: requests.map(params => {
          return {
            processingTimeMS: 0,
            nbHits: 0,
            hits: [],
            facets: {},
          };
        }),
      };
    }
    return algoliaClient.search(requests);
  },
};
```

We can then build both together and get to a result like this:

```vue
<template>
  <ais-instant-search
    :search-client="searchClient"
    index-name="instant_search"
  >
    <ais-search-box />
    <ais-hits />
  </ais-instant-search>
</template>

<script>
import algoliasearch from 'algoliasearch/lite';

const algoliaClient = algoliasearch(
  'latency',
  '6be0576ff61c053d5f9a3225e2a90f76'
);

const searchClient = {
  async search(requests) {
    // change conditional if any of the other facets are faked"
    if (requests.every(({ params: { query } }) => Boolean(query) === false)) {
      return {
        results: requests.map(params => {
          // fake something of the result if used by the search interface
          return {
            processingTimeMS: 0,
            nbHits: 0,
            hits: [],
            facets: {},
          };
        }),
      };
    }
    return algoliaClient.search(requests);
  },
  async searchForFacetValues(requests) {
    return algoliaClient.searchForFacetValues(requests);
  },
};

export default {
  data() {
    return {
      searchClient,
    };
  },
};
</script>
```

<iframe src="https://codesandbox.io/embed/9o4qo147jw?module=%2Fsrc%2FApp.vue" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>

repository: DavidRouyer/vue-instantsearch

gha_language: JavaScript

gha_license_id: MIT

repo_name: DavidRouyer/vue-instantsearch


text:
Features include mute by default, blacklists, and an experimental music ducking feature.  More info at [mutetab.com](http://www.mutetab.com/new).

Installing from Source
----------------------

 * Visit `chrome://extensions/`
 * Ensure `Developer mode` is checked
 * Click `Load unpacked extension...`
 * Locate and select the directory with the `manifest.json` file in it

Hacking
-------

You must have [Node.js](http://nodejs.org/) installed to build the extension.

1. Install the dependencies: `npm install`
2. Build the extension from `src/js` into `build/js`:

  * Build once: `npm run build`

  * Build continuously as files change: `npm start`

The entry point for the extension's background page is `src/js/background.js`. It is responsible for communicating the list of open tabs to the client when requested.

The entry point for the extension's front-end is `src/js/client.jsx`. The client is written using [React](http://facebook.github.io/react/).

Both these files are bundled using [Browserify](http://browserify.org/) (running a JSX transform for the client scripts) into `build/js`. At runtime, the extension uses only files from `build` and `vendor`.

Tests
-----
Run the test suite by enabling the extension and going to chrome-extension://jopkojhkkeglfnolgoojbfdoimpnllfd/build/html/test.html. Note that running the tests will clear out your preferences and that you will need to click 'Restore defaults' or restart the extension before using it again. (There are some hidden settings that will cause the extension to behave abnormally.)

Licensing
---------

This code is licensed MIT.

The structure and UI started as a fork of [Chrome Fast Tab Switcher](https://github.com/BinaryMuse/chrome-fast-tab-switcher), which is Copyright (c) 2014 Michelle Tilley under the MIT license.

It also includes a large amount of [Streamkeys](https://github.com/berrberr/streamkeys) code (currently unused) which is Copyright (c) 2014 Alex Gabriel under the MIT license.


text:
# Books to scrapy
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](/LICENSE)

Learning how to use scrapy to download text data and images from the web.

## Project description

We will use [scrapy](https://scrapy.org) to download text data and images from [books.toscrape.com](http://books.toscrape.com), a demo website built for web scraping purposes, which contains data about 1000 books.

This repository is divided into six independent directories: one self-contained scrapy spider and five scrapy projects.

1. `01_simple_spider` contains a self-contained spider. When launched, it downloads book data (*title* and *price*) and crawls multiple web pages automatically.

2. `02_book_data_dict` is the simplest possible scrapy project. It downloads book data (*item number, title, price* and *star rating*) yielding a simple Python dictionary.

3. `03_book_data_item` downloads some book data (*item number, title, price, star rating, thumbnail path* and *detailed book url*), but it yields a **scrapy item** instead of a simple dictionary. Moreover the **start_requests** initialization method is used instead of the simpler **start_urls** attribute.

4. `04_book_data_item_loader` uses a **scrapy item loader** object to load the book data item. This syntax is more complex but allows more flexibility. For example, we can create an item taking data from multiple web pages.  Here we download *item number, title, price, star rating, thumbnail path, detailed book url, image_url* and *product description* for each book. In order to scrape the detailed book page, a secondary parse method has to be defined.

5. `05_book_images_thumbnails` downloads both text data and images. Here the images are downloaded following the thumbnail paths of the main page of the website. This project is slightly more complex as it has to use a scrapy item with predefined attributes together with the **default scrapy image pipeline**, which needs to be activated in `setting.py`. Thanks to the pipeline, images are automatically downloaded in the `images/full` directory, and named with a SHA1 hash of their urls (by default). In addition, the pipeline automatically creates thumbnails of the downloaded images in `images/thumb`, as specified in `settings.py`. In this example we are creating thumbnails of already small pictures (they were already thumbnails to begin with).

6. `06_book_images_renamed` is similar to the previous project, but this time we want to rename the downloaded images. To do this, we need to create a **custom scrapy pipeline** that inherits from the default image pipeline. Here the images are downloaded from the detailed book pages, so they have higher resolution. At every run, they are downloaded automatically in `images/full`. Moreover, thanks to the custom pipeline, the image names are changed from the default hash to the actual book title.

## Getting started

First of all, `fork` this repo and then `clone` your fork to have a local copy.

To use [scrapy](https://scrapy.org) you first need to install it. You can create this project's environment with

```
$ conda env create -f books-to-scrapy.yml
```
and then activate it with

```
$ conda activate books-to-scrapy
```

Alternatively, you can install scrapy directly by running

```
$ conda install -c conda-forge scrapy
```

Moreover, to download images you also need the pillow library, which can be installed with

```
$ conda install pillow
```

## A few notes about scrapy commands

Scrapy comes in with a few very useful command-line commands. To have a look at a list of these commands, simply run the command

```
$ scrapy
```

once scrapy is correctly installed. Every scrapy command starts with the `scrapy` keyword. Most of the time you have to be in the project root directory (the one with scrapy.cfg configuration file) to run these commands correctly.

#### 1. Create a new scrapy project

```
$ scrapy startproject <project_name>
```

#### 2. Create a new spider inside a project

```
$ scrapy genspider <spider_name> <url_domain>
```

#### 3. List of spiders in a project

```
$ scrapy list
```

#### 4. Run a self-contained spider

```
$ scrapy runspider <spider_script.py>
```

The spider will run with the implemented logic. By default, the crawled data will be printed to screen, but you can also specify an optional `--output filename.format` (for example `-o out.csv`) argument to save it to a file with the requested format. Scrapy automatically implement some output formats, such as `csv`, `json`, `jsonlines`, `xml` and `pickle`.

#### 5. Run a spider inside a project

```
$ scrapy crawl <spider_name>
```
Again, you can save the data with the `--output filename.format` optional argument.

## License

This project is licensed under the MIT License. Use it as you wish.

repository: wasilawanhh/books-to-scrapy

repo_name: wasilawanhh/books-to-scrapy


text:
![image](public/Logo_ThroughTheAges.png)

# Through the Ages

### Play the Game Here!
https://through-the-ages-d17de.firebaseapp.com/benchmark3

### Description

Through the Ages is a fast paced, arcade style action game developed by [Jakub Wlodek](https://github.com/jwlodek) , [Vincent Paladino](https://github.com/vpaladino778), and [Nicholas Pirrello](https://github.com/nspirrello) using the Phaser.js JavaScript game framework.

Through the Ages was a finalist in the 15th annual Stony Brook University Game Programming Competition.

The entry trailer video entered into the competition can be viewed on [youtube](https://www.youtube.com/watch?v=6PfNGvD3xWs).

### Controls

* A, D - Walk left, walk right
* W - Jump
* K - Throw spear
* P - Pause
* M - Return to main menu

### Gameplay

![](https://media.giphy.com/media/Rlf6vCyV9E0X6lSn0P/giphy.gif)

In Through the Ages you play as Gareth I, Gareth IV, Gareth XI, and Gareth XXV, all members of the noble house of Gareth, as he tries to keep himeself and his family safe while progressing through history. Your journey starts with Gareth I, as he struggles to collect the materials necessary to create fire. Once you have collected enough to make it through the stone ages, the timeline flashes forward to the middle ages, as Gareth IV fights to keep the forge alight in order to craft more impressive weapons and armor.

All along the way, Gareth and his ancestors are hounded by pterodactyls, killer pigeons, and robots. Do you have what it takes to survive Through The Ages?

Your goal in the game is to collect items and carry them back to your origin point. You may only carry one item at a time. Careful of the flying creatures! You only have 3 lives, and each life lasts for 5 enemy hits. You can fight back with your spear, but be careful, you are not the only one evolving - the enemies will get smarter (and more difficult) with each passing stage.

repository: jwlodek/Through-The-Ages

repo_name: jwlodek/Through-The-Ages


text:
# Chase API

Deploy as a flask app, and set the base URL (with protocol and trailing slash) as `api_base_url` in config.yml files as needed.

## Endpoint Documentation

### General

**`/`**

GET: List team and placefile links

### Team

**`/team`**

GET: List all current teams and references to their respective view-only endpoints
PUSH: Create a new team. Fails if team already exists with provided ID. Returns needed auth info back to user.

**`/team/{team-id}`**

GET: List all current team info (position, vehicle, status, etc.), with references to placefiles
PUT (auth req): Update default allowed attributes of team (speed, direction, refuel). Return updated status (same as GET, but with any extra handshake stuff required, and maybe without placefiles?).

**`/team/{team-id}/location`**

GET: Return just the team's location
PUT (auth req): Special endpoint for initial setting of location on setup (fails if location already present, unless `force=True`, which may be a cheat code/easter egg/admin thing)

**`/team/{team-id}/vehicle`**

GET: Return just the team's vehicle info
PUT (auth req): Special endpoint for initial setting of vehicle on setup (fails if vehicle already present, unless `force=True`, which may be a cheat code/easter egg/admin thing)

**`/team/{team-id}/points`**

GET: Return just the team's points
PUT (admin auth req): Special endpoint for admin to adjust point amount

**`/team/{team-id}/balance`**

GET: Return just the team's balance
PUT (admin auth req): Special endpoint for admin to adjust balance

**`/team/{team-id}/verify`**

PUT (auth req): Test if the login credentials provided are valid
- Fields
    - needs_setup (bool)
    - setup_step (str)
    - team_name (str)

### Placefile

(all the below are only GET, no auth)

**`/placefile`**

List links to all placefile endpoints (NOT content)

**`/placefile/lsr`**

List current LSR information, with link to content
Give an error if not loaded (see `/placefile/lsr/load`)

**`/placefile/lsr/content`**

("Content-type: text/plain")

The actual, dynamically generated LSR placefile.

**`/placefile/lsr/load`**

Admin-only, hidden endpoint taking start, end, and wfos arguments (which are then passed as sts, ets and wfos to IEM GeoJSON endpoint) and loaded raw contents into the database. Actual lsrs are munged dynamically as the simulation runs.

**`/placefile/team`**

Link to:

- Individual team reference points
- All team files

**`/placefile/team/current`**

Current location (with direction hint) of all teams information, with actual content at `./content` link

**`/placefile/team/tracks`**

Current location of all teams, but with trailing track markers at a configurable number of history steps. As above re: `./content`.

**`/placefile/team/history`**

Current and all prior locations of all teams. As above re:`./content`.

**Likewise**

- **`/placefile/team/{team-id}/current`**
- **`/placefile/team/{team-id}/tracks`**
- **`/placefile/team/{team-id}/history`**

### Vehicle

**`/vehicle`**

List all vehicles shown in the application, with detailed information

**`/vehicle/{vehicle-id}`**

List properties for the given vehicle.

### Admin

**`simulation/timings`**

The only admin GET, really...gets the timing information as needed to convert between archive and current time.

**`simulation/start`**

Used by the `run-case` backend script to update the batch of settings associated with the start of the chase.

**`simulation/config`**

API-based way to tweak a single setting in the database's main config. Use with caution.

Hint: to stop the running of the case, `PUT {"simulation_running": 0}`.

**`simulation/hazard_config`**

API-based way to tweak a single setting in the database's hazard config. Use with caution.

repository: MesoSim/chase

repo_name: MesoSim/chase


text:
Flask-Docker-Vagrant-Example
============================

Command 'vagrant up' will build the vm and do the following things:

1) Install docker. This is done by vagrant when docker is referenced as a
provisioner. The line in the Vagrantfile is

    config.vm.provision "docker"

2) Build docker image using the Dockerfile tagging the image with the name
skablam/flask. The line in the Vagrantfile is

    d.build_image "/vagrant", args: "-t=skablam/flask".

3) Run the a container using image skablam/flask, forwarding port 5000 in the
container to port 5000 in the vm, and sharing the folder /vagrant in the vm with
/code in the container. The line in the Vagrantfile is:

    d.run "flaskapp", image: "skablam/flask", args: "-p 5000:5000 -v
    /vagrant:/code"

The hello world Flask app can be amended on the host and it the changes
will automatically get picked up within the container because the code is in the
shared folder.

repository: Skablam/Flask-Docker-Vagrant-Example

gha_language: Shell

repo_name: Skablam/Flask-Docker-Vagrant-Example


text:
This repository contains experiments in translation-invariant analysis-synthesis from audio signals.
The problem is the following:

How to build a nonlinear representation of audio signals that provides a perceptually good reconstruction, under the constraint of invariance to translation ?

The code was written by Vincent Lostanlen, a PhD student of Stéphane
Mallat at the École normale supérieure, and is released as free software
under the MIT license.


text:
---
layout: post
title: "VSCode Tips"
feature-img: "assets/img/rainbow.jpg"
thumbnail: "assets/img/binary.jpg"
tags: [Software]
---

This post contains some of my favorite tips and tricks for working with VSCode. For even more, VSCode has [their own tips and tricks page](https://code.visualstudio.com/docs/getstarted/tips-and-tricks) that I recommend. Note that I try to keep this up-to-date, so the information should be good with roughly the latest version of VSCode. If something breaks my VSCode workflow, I update this page.

For example, a lot of [Python tools switched to extensions](https://github.com/microsoft/vscode-python/wiki/Migration-to-Python-Tools-Extensions) in 2022, and I have updated this page to include that.

<b>Table of Contents</b>
* TOC
{:toc}

# Hot Keys

## Command Palette

One of the most important things to be able to do in VSCode is to open the command palette. From there you can access all sorts of settings:

* Open the Command Palette: `CMD/CTRL + SHIFT + P`
  * You can use either the User Interface (`Preferences: Open Settings (UI)`) or edit the JSON directly `Preferences: Open Settings (JSON)`.
  * You can also jump to the settings or Command Palette by clicking on the settings wheel in the bottom left corner.

## Search

You can do `CMD/CTRL + P` to open up search.
* Just add `>` to the bar to make it the command palette.

## Autoformat

* Windows/Linux: `Alt + Shift + F`
* Mac: `Option + Shift + F`

## Clean up imports

* Windows/Linux: `Alt + Shift + O`
* Mac: `Option + Shift + O`

## Snippets

`Control + Spacebar` to open snippets
This makes it easy to do things like type `main` and get if `__name__ == 'main':`

## Jupyter

`Shift + enter` to run through Python interactive console

# Customizations

See [the previous post for my recommended VSCode customizations](https://jss367.github.io/software-customizations.html).

# Settings

User settings are not stored in the project. Instead, they are at:

* Windows: `C:\Users\Julius\AppData\Roaming\Code\User\settings.json`
* Mac: `~/Library/Application Support/Code/User/settings.json`

In the `launch.json` file, you can either use full paths or relative paths:

`"program": "/full/path/to/python_trainer.py"`,

or

`"program": "${file}"`,

## Don't write .pyc files

`PYTHONDONTWRITEBYTECODE=1`

## Applying Settings to a Single Language

You can specify that you only want some settings to apply to a single language like so:

```
    "[python]": {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": false,
        "editor.tabSize": 4,
        "editor.defaultFormatter": "ms-python.python"
    },
```

# Other

## Key bindings

`Ctrl + k` to open key bindings. From there many things are just one button, such as `z` for zen mode.

If you just hit `control + k` it brings up a list of key bindings, which you can customize.

Zen mode: `Ctrl+k z`
(So hold control and hit "k", then let go of both and hit "z"). Double tap "Esc" to escape.

## Extensions

#### Extensions to try

https://marketplace.visualstudio.com/items?itemName=jithurjacob.nbpreviewer

https://github.com/hediet/vscode-debug-visualizer/tree/master/extension

## Terminal

The built-in terminal is a wonderful idea. You can pull it up with control + '`', on either mac or windows. You can also pull it up from dragging up from the bottom of the screen.

## Debugging

To do multi-line debugging, all you have to do is hold down `shift` before you hit `return`.

## Code Completion

Control + Space to pull it up manually

## Workspace file

If you keep all your repos in a `git` folder like I do, I recommend putting your workspace file there (I call mine `workspace.code-workspace`). That way all the folders and paths are straightforward. Sometimes it will by default put them in `/Users/<username>/Library/Application Support/Code/Workspaces/<some_number>/workspace.json`. I don't use them there.

### Workspace File

You can include all your folders like this:
```
"folders": [
        {
            "path": "my_repo"
        },
        {
            "path": "my_monorepo/python_package_a"
        },
        {
            "path": "my_monorepo/python_package_b"
        },

    ],
```

You can also optionally included `"name"` if you want to change any of the names.

## launch.json

Writing `launch.json` files is very useful. It makes it easy to run files in different configurations, such as passing different arguments. Here's the default starting place:

```json
{
    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal"
},
```

Here's an example with arguments:

```json

{
   "name": "Python: Run New  Config",
   "type": "python",
   "request": "launch",
   "program": "/full/path/to/file.py",
   "console": "internalConsole",
   "justMyCode": false,
   "args": [
       "--config",
       "my_config",
       "--num_gpus",
       "2",

   ]
},

```

`justMyCode` is useful
- defaults to true
- restricts debugging to only the user-written code

You can also set your Python interpreter specifically for that run. You need something like the following:
* `"python": "/home/julius/miniconda3/envs/my_env/bin/python",`

#### Relative paths (cwd)

Part of your command will include a reference from where to start from. One way to do that is by using `cwd`.

* `"cwd": "${workspaceFolder}"` - start from the workplace folder
  * In a multi folder workspace, you'll need to identify the folder as well. It will look something like `"${workspaceFolder:my_repo}"`
* `"cwd": "${fileDirname}"` - start from the directory of the current file. This will change depending which file you want to have open, so I only recommend using it when you're running the current file (so you'll have `"program": "${file}",` as well)
* Note that you don't always need to include `cwd`. For example, you don't need it when running a module.

#### Running a module or a program

In the `launch.json` file, you can choose to run either a `"module"` or a `"program"`.

#### Debugging subprocesses

You can also debug subprocess in VSCode. All you need to do is add `"subProcess": true,` to your `launch.json`.

#### Location

`launch.json` files can be stored in different locations. Sometimes you might have one in `git/my_repo/.vscode/launch.json`. I generally try to avoid this. Instead of one for each repo, I would put them all in `git/.vscode/launch.json`.

## .env files
Go at top of directory. Can add environment variables, python path, etc.

It might look like this:
```
        {
            "name": "Python: My Module",
            "type": "python",
            "request": "launch",
            "module": "my_module",
            "justMyCode": true,
            "args": ["my_arg"],
            "env": {"PYTORCH_ENABLE_MPS_FALLBACK": "1"} # Add the env here
        }
```

- don't use quotes in variables names here

## Pylint Wrong Interpreter

Sometimes you have problems where Pylint seems to be using a different interpreter. Even if you select the correct interpreter and do it at the workspace level. I don't know what causes this, but here is how to fix it:

It could be caused by having something in

"pylint.interpreter": ["/Users/julius/opt/anaconda3/envs/all2/bin/python"],

## Other

if your linter can't see it but you can run the file

maybe it's a path that only works because of your .env file

Your linter doesn't use that. So when you run it, it will run, but not for pytest or your linter...
try to fix your linter by exporting the environment variables you want

As far as I understand it, the VSCode workspace setting `python.pythonPath` is not to be confused with the environment variable `$PYTHONPATH`.
`python.pythonPath` is the path to the Python interpreter used for debugging or running the code, while `$PYTHONPATH` is the environment variable which python uses to search for modules.
There are two different things going on here:
Where the computer looks for the python interpreter - `python.pythonPath`

And where that inpreter looks for packages - `$PYTHONPATH`

```
Host host101
  HostName juliushost101.localnetwork.internalnetwork.tld
  User root
  Port 2222
  IdentityFile ~/.ssh/id_rsa2 # you might have to do this
```
test it out like this: `ssh -F ~/config localhost`
You will need sshd in the container for this to work?

config can be
```
"program": "${file}"or"program": "/full/path/to/my/file.py"
"console": "integratedTerminal"or"console": "internalConsole"
```

command + / to multiline comment
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

## Testing

Sometimes the Discover Tests functionality fails, often for path issues. Remember, even if it fails you can always runs tests by doing `python -m pytest my_tests`

if discover tests fails, go to the terminal  - click on the output tab - and change it to Python Test Log

## Connecting to Remote Instances

I wrote [a guide on how to connect to remote instances](https://jss367.github.io/connecting-vscode-to-google-cloud-platform-instances.html). I recommend storing your config file at `~/.ssh/config`

## Troubleshooting

#### Environmental Variables

Sometimes environmental variables won't show up in VSCode. I've found that this can sometimes happen whe VSCode is launch from the application icon. If this is happening, you can open VSCode directly from the terminal with `code .` and it should have your environmental variables. If you still don't see them, make sure they are present in your terminal.

## To Try
* shift cmd M
* F8 or Shift F8 to cycle between errors

## Syncing Across Desktops

Here's what I recommend keeping in sync between machines:

![image](https://user-images.githubusercontent.com/3067731/210435699-e71ff120-cfc3-413c-b99c-f98215d79924.png)

gha_language: HTML


text:
Persistent Redux store for _Reasonaboutable_:tm: Offline-First applications, with first-class support for optimistic UI. Use with React, React Native, or as standalone state container for any web app.

_To get started, take a moment to read through the **[Offline Guide](#offline-guide)** to understand the architecture and tradeoffs behind Redux Offline, and for further context why Offline matters, read [this blog post](https://hackernoon.com/introducing-redux-offline-offline-first-architecture-for-progressive-web-applications-and-react-68c5167ecfe0)_

## Contents

* [Quick start](#quick-start)
* [Offline Guide](#offline-guide)
* [Configuration](#configuration)
* [Contributing](#contributing)
* [Miscellanea](#miscellanea)

## Full disclosure

This is a community maintained fork. The original repo can be found in [here](https://github.com/jevakallio/redux-offline).

Redux Offline is very, very new. If you find a bug, good job for being an early adopter! (And there will be issues.) If you find a problem, please submit an issue and I will get to them. 😇

## Quick start

##### 1. Install with npm (or [Yarn](https://yarnpkg.com))
```sh
npm install --save @redux-offline/redux-offline
```

##### 2. Add the `offline` [store enhancer](http://redux.js.org/docs/Glossary.html#store-enhancer) with `compose`
```diff

- import { applyMiddleware, createStore } from 'redux';
+ import { applyMiddleware, createStore, compose } from 'redux';
+ import { offline } from 'redux-offline';
+ import offlineConfig from 'redux-offline/lib/defaults';

// ...

const store = createStore(
  reducer,
  preloadedState,
-  applyMiddleware(middleware)
+  compose(
+    applyMiddleware(middleware),
+    offline(offlineConfig)
+  )
);
```

See [Configuration](#configuration) for overriding default configurations.

Looking for `createOfflineStore` from redux-offline 1.x? See migration instructions in the [2.0.0 release notes](https://github.com/redux-offline/redux-offline/releases/tag/v2.0.0).

##### 3. Decorate actions with offline metadata

```js
const followUser = userId => ({
  type: 'FOLLOW_USER_REQUEST',
  payload: { userId },
  meta: {
    offline: {
      // the network action to execute:
      effect: { url: '/api/follow', method: 'POST', body: { userId } },
      // action to dispatch when effect succeeds:
      commit: { type: 'FOLLOW_USER_COMMIT', meta: { userId } },
      // action to dispatch if network action fails permanently:
      rollback: { type: 'FOLLOW_USER_ROLLBACK', meta: { userId } }
    }
  }
});
```

Read the [Offline Guide](#offline-guide) to understand how effects are executed, and how the actions are dispatched.

##### 4. (React Native Android) Ask permission to read network status

If writing a native app for Android, you'll need to make sure to request the permission to access network state in your `AndroidManifest.xml`:

```xml
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

## Offline Guide

Making offline-friendly apps is not rocket science, but to make them work well involves dealing with finicky details around persisting state, resilience against flaky networks, optimistically updating user interface state, reliably reverting it back in case of failures, synchronising state in the background, and managing the evolution of the persistent state over long, long periods of time.

**Redux Offline** is a battle-tested offline-first architecture, and an _experimental_ library that implements it. To make use of the library, it'll be helpful to understand the architecture behind it.

### Progressive Web Apps

Redux Offline helps you with offline state management, but it **does not** automatically make your web site available offline. For caching assets (HTML pages, scripts, images, and other resources) your website needs to implement a ServiceWorker. To get started with PWAs and React, [this article provides great list of resources](https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-3-offline-support-and-network-resilience-c84db889162c) to begin with.

### Persistence is key
In order to be able to render meaningful content when the user opens your application offline, your application state needs to be persisted to disk.

Instead of reinventing the wheel, Redux Offline uses the excellent [redux-persist](https://github.com/rt2zz/redux-persist) library. Your Redux store is saved to disk on every change, and reloaded automatically on startup. By default, browser environments will use [IndexedDB](https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API) or WebSQL/localStorage fallbacks via [localForage](https://github.com/localForage/localForage), and [AsyncStorage](https://facebook.github.io/react-native/docs/asyncstorage.html) in React Native.

You can [configure every aspect of how your state is persisted](#configuration).

### That's all she wrote

Persisting and rehydrating state (which is a term we use for reading the state back from the disk and into our store) will get us **Read**-resilience. Our app will work offline as long as the user only wants to read from the state. We also want to support **Write**-resilience: The user should be able to do (some) actions while offline, and be able to safely assume that they will eventually be reconciled and sent to our backend.

In order to support Write-resilience, we will store all network-bound actions in a queue inside our store. Redux Offline creates a state subtree called `offline`, where among other internal state needed by the library, it manages an array called `outbox`.

To be able to perform the network-bound actions after we come back online, we need to store all necessary data to perform the action, and metadata about what should happen afterwards. Redux Offline understands the following metadata:
```diff
type OfflineAction = {
  type: string,
  payload: any,
+ meta: {
+   offline: {
+     effect: any,
+     commit: Action,
+     rollback: Action
+   }
+ }
```

* `meta.offline.effect` is any data you want to send to the reconciler
* `meta.offline.commit` action will be fired once the network effect has been successfully sent
* `meta.offline.rollback` action will be fired if the network effect **permanently** fails (does not count network-related failures, which will be automatically retried).

### Optimism will get you places

When the initial action has been dispatched, you can update your application state in your reducers as you normally would.

A common pattern for offline-friendly apps is to *optimistically update  UI state*. In practice, this means that as soon as user performs an action, we update the UI to look as if the action had already succeeded. This makes our applications resilient to network latency, and improves the perceived performance of our app.

When we optimistically update state, we need to ensure that if the action does permanently fail, the user is appropriately notified and the application state is rolled back. To allow you this opportunity, Redux Offline will fire the action you specified in `meta.offline.rollback`. If the rollback action does not have a payload, an error object returned by the effects reconciler will be set as the payload.

An example of an optimistic update:
```js
const action = userId => ({
  type: 'FOLLOW_USER',
  payload: { userId },
  meta: {
    offline: {
      effect: //...,
      rollback: { type: 'FOLLOW_USER_ROLLBACK', meta: { userId }}
     }
  }
});

// optimistically update the state, revert on rollback
const followingUsersReducer = (state, action) {
  switch(action.type) {
    case 'FOLLOW_USER':
      return { ...state, [action.payload.userId]: true };
    case 'FOLLOW_USER_ROLLBACK':
      return omit(state, [action.meta.userId]);
    default:
      return state;
  }
}
```

### A pessimist is never disappointed

Sometimes it's important that the user knows that the action actually went through, so you can't optimistically update your state until the effect has been executed. Or sometimes, in order to render the final UI state, you need some data from the server response. For these cases, you can use the `meta.offline.commit` action:

```js
const completeOrder = (orderId, lineItems) => ({
  type: 'COMPLETE_ORDER',
  payload: { orderId, lineItems },
  meta: {
    offline: {
      effect: //...,
      commit: { type: 'COMPLETE_ORDER_COMMIT', meta: { orderId }},
      rollback: { type: 'COMPLETE_ORDER_ROLLBACK', meta: { orderId }}
     }
  }
});

const ordersReducer = (state, action) {
  switch(action.type) {
    case 'COMPLETE_ORDER':
      return {
        ...state,
        submitting: {...state.submitting, [action.payload.orderId]: true
      };
    case 'COMPLETE_ORDER_COMMIT':
      return {
        ...state,
        receipts: { ...state.receipts, [action.meta.orderId]: action.payload },
        submitting: omit(state.submitting, [action.meta.orderId])
      };
    case 'COMPLETE_ORDER_ROLLBACK':
      return {
        ...state,
        error: action.payload,
        submitting: omit(state.submitting, [action.meta.orderId])
      };
    default:
      return state;
  }
}
```

### Executor of our will

The last part of the offline metadata is `meta.offline.effect`. This property can contain anything, and will be passed as-is to the effects reconciler.

The **effects reconciler** is a function that you pass to offline enhancer configuration, whose responsibility it is to take the effect payload, send it over the network, and return a Promise that resolves if sending was successful or rejects if the sending failed. The method is passed the full action as a second parameter:

```js
type EffectsReconciler = (effect: any, action: OfflineAction) => Promise<any>
```

The default reconciler is simply a paper-thin wrapper around [fetch](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) that rejects non-OK HTTP status codes, and assumes the response will be valid JSON.
```js
  const effectReconciler = ({url, ...opts}) =>
    fetch(url, opts).then(res => res.ok
      ? res.json()
      : Promise.reject(res.text().then(msg => new Error(msg)));
```
So the default effect format expected by the reconciler is something like:
```js
{
  type: 'ACTION',
  meta: {
    offline: {
      effect: { url: '/api/endpoint', method: 'POST'}
    }
  }
}
```

That said, you'll probably want to [use your own method](#change-how-network-requests-are-made) - it can be anything, as long as it returns a Promise.

### Is this thing even on?

A library that aims to support offline usage, it would be useful to know whether or not the device is online or offline. Unfortunately, network availability is not a binary "Yes" or "No": It can also be "Yes, but not really". The network receiver on your mobile device may report connectivity, but if you can't reach the remote server, are we really connected?

Redux Offline uses the browser [Network Information APIs](https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API) and React Native [NetInfo](https://facebook.github.io/react-native/docs/netinfo.html) to be notified when the device *thinks* it's online to orchestrate synchronisation and retries. The current reported online state is stored in your store state as boolean `state.offline.online` and can be used to display a network indicator in your app, if desired.

Sometimes, it's more reliable to check network connectivity by actually making sure you can exchange data with a remote server by periodically making a HEAD request, or keeping an open WebSocket connection with a heartbeat. This, too, [can be configured](#change-how-network-status-is-detected).

### Giving up is hard to do

Networks are flaky. Your backend could be down. Sometimes, when the moon is in waxing crescent and the sixth-degree leylines are obstructed by passing birds, things mysteriously fail. If you are processing your offline actions queue in serial, you will need a reliable mechanism to decide when to retry the requests, and when to give up to prevent blocking the rest of the queue from being flushed.

Building an offline-friendly app, you should never give up because a *network* connection failed. You *may* want to give up if the server reports a *server error*. And if the server tells you that your *request cannot be processed*, you need to give up immediately.

Modelled after this principle, the default discard strategy is:
* If server was not reached, always retry
* If server responded with HTTP `4xx` client error, always discard
* If server responded with HTTP `5xx` server error, retry with a decaying schedule configured by the [retry strategy](#change-how-network-requests-are-retried).

If your backend doesn't conform to this standard, or you've [changed the effects reconciler](#change-how-network-requests-are-made) to return errors that don't expose a HTTP `status` field, you'll want to [configure the error detection strategy](#change-how-irreconcilable-errors-are-detected), too.

When a message is discarded, the `meta.offline.rollback` action defined in the message metadata is fired, and you can respond accordingly.

### And if you don't at first succeed, try, try again

When a network request has failed, and you've [chosen not to discard the message](#giving-up-is-hard-to-do), you need to decide when to retry the request. If your requests are failing due to an overloaded backend, retrying too often will make the problem worse and effectively DDoS your own service. Never kick a man when he's down.

By default, we will always retry the first message in the queue when the [network detector](#is-this-thing-even-on) reports a change from offline to online. Otherwise, we will retry the request on a decaying schedule:
* After 1 seconds
* After 5 seconds
* After 15 seconds
* After 30 seconds
* After 1 minute
* After 3 minutes
* After 5 minutes
* After 10 minutes
* After 30 minutes
* After 1 hour

After these 10 timed attempts, if the message is still failing due to a server error, it will be discarded.

Retrying a request for this long may seem excessive, and for some use cases it can be. You can [configure the retry strategy](#change-how-network-requests-are-retried) to suit yours.

The reason the default behaviour is to desperately try to make the requests succeed is that we really, really want to avoid having to deal with conflict resolution...

## Configuration

### Configuration object

Redux Offline supports the following configuration properties:
```js
export type Config = {
  detectNetwork: (callback: NetworkCallback) => void,
  effect: (effect: any, action: OfflineAction) => Promise<*>,
  retry: (action: OfflineAction, retries: number) => ?number,
  discard: (error: any, action: OfflineAction, retries: number) => boolean|Promise<boolean>,
  defaultCommit: { type: string },
  defaultRollback: { type: string },
  persist: (store: any) => any,
  persistOptions: {},
  persistCallback: (callback: any) => any,
  persistAutoRehydrate: (config: ?{}) => (next: any) => any,
  offlineStateLens: (state: any) => { get: OfflineState, set: (offlineState: ?OfflineState) => any }
};
```

#### Passing configuration to the enhancer
The `offline` store enhancer takes the [configuration object](#configuration-object) as a final parameter:
```diff
+ import { offline } from 'redux-offline';
+ import defaultConfig from 'redux-offline/lib/defaults';

const store = createStore(
  reducer,
  preloadedState,
-  middleware
+  compose(middleware, offline(defaultConfig))
);
```

#### Overriding default properties
You can override any individual property in the default configuration:
```diff
import { offline } from 'redux-offline';
import defaultConfig from 'redux-offline/lib/defaults';

const customConfig = {
  ...defaultConfig,
  effect: (effect, _action) => Api.send(effect)
}

const store = createStore(
  reducer,
  preloadedState,
-  middleware
+  compose(middleware, offline(customConfig))
);
```

#### Only import what you need
The reason for default config is defined as a separate import is, that it pulls in the [redux-persist](https://github.com/rt2zz/redux-persist) dependency and a limited, but non-negligible amount of library code. If you want to minimize your bundle size, you'll want to avoid importing any code you don't use, and bring in only the pieces you need:

```diff
import { offline } from 'redux-offline';
import retry from 'redux-offline/lib/defaults/retry';
import discard from 'redux-offline/lib/defaults/discard';

const myConfig = {
  retry,
  discard,
  effect: (effect, action) => MyCustomApiService.send(effect, action),
  detectNetwork: (callback) => MyCustomPingService.startPing(callback),
  persist: (store) => MyCustomPersistence.persist(store)
};

const store = createStore(
  reducer,
  preloadedState,
-  middleware
+  compose(middleware, offline(myConfig))
 myConfig
);
```

### I want to...

#### Change how network requests are made

Probably the first thing you will want to do is to replace the default `fetch` effects handler. Do this by overriding `config.effect`:
```js
const config = {
  effect: (effect, action) => {
    console.log(`Executing effect for ${action.type}`);
    return MyApi.send(effect)
  }
}
```

The first parameter is whatever value is set in `action.meta.offline.effect`. The second parameter is the full action, which may be useful for context. The method is expected to return a Promise. The full signature of the effect handler is: `(effect: any, action: OfflineAction) => Promise<any>`.

#### Change how state is saved to disk

By default, persistence is handled by [redux-persist](https://github.com/rt2zz/redux-persist). The recommended way of customizing
persistence is to configure redux-persist. You can pass any valid configuration
to redux-persist by defining it `config.persistOptions`:
```js
const config = {
  persistOptions: { /*...*/ }
};
```

You can pass the callback for redux-persist as well. This function would be called when rehydration is complete. It's useful if you want to delay rendering until rehydration is complete. You can define it in `config.persistCallback`:
```js
const config = {
  persistCallback: () => { /*...*/ }
};
```

You can pass your persistAutoRehydrate method. For example in this way you can add a logger to the persistor.
```js
import { autoRehydrate } from 'redux-persist';

const config = {
  persistAutoRehydrate: () => autoRehydrate({log: true})
};
```

If you want to replace redux-persist entirely **(not recommended)**, you can override `config.persist`. The function receives the store instance as a first parameter, and is responsible for setting any subscribers to listen for store changes to persist it.
```js
const config = {
  persist: (store) =>
    store.subscribe(() => console.log(store.getState()))
  )
}
```

If you override `config.store`, you will also need to manage the rehydration of your state manually.

#### Change how network status is detected

To replace the default network status detector, override the `config.detectNetwork` method:
```js
const config = {
  detectNetwork: callback => MyCustomDetector.on('change', callback)
}
```

The function is passed a callback, which you should call with boolean `true` when the app gets back online, and `false` when it goes offline.

#### Change how irreconcilable errors are detected

Actions in the queue are by default discarded when a server returns
a HTTP `4xx` error. To change this, set override the `config.discard` method:
```js
const config = {
  discard: (error, action, retries) => error.permanent || retries > 10;
}
```

The method receives the Error returned by the effect reconciler, the action being processed, and a number representing how many times the action has been retried. If the method returns `true`, the action will be discarded; `false`, and it will be retried. The full signature of the method is `(error: any, action: OfflineAction, retries: number) => boolean`. Alternatively, you can return a Promise object that resolve to a boolean, allowing you to detect when to discard asynchronously (for example, doing a request to a server to refresh a token and try again).

#### Change how network requests are retried

By default, sending actions is retried on a decaying schedule starting with retries every few seconds, eventually slowing down to an hour before the last retry. These retry delays only apply to scenarios where the device reports being online but the server cannot be reached, or the server is reached but is responding with a non-permanent error.

To configure the retry duration, override `config.retry`:
```js
const config = {
  retry: (action, retries) => action.meta.urgent ? 100 : 1000 * (retries + 1)
}
```

The function receives the action and a number representing how many times the
action has been retried, and should reply with a number representing the amount
of milliseconds to wait until the next retry. If this method returns `null` or
`undefined`, the action will not be retried until the next time the app comes
online, is started, or you manually fire an `Offline/SEND` action.

#### Change how errors are handled

Granular error handling is not yet implemented. You can use discard/retry, and
if necessary to purge messages from your queue, you can filter `state.offline.outbox`
in your reducers. Official support coming soon.

#### Synchronise my state while the app is not open

Background sync is not yet supported. Coming soon.

#### Use an [Immutable](https://facebook.github.io/immutable-js/) store

The `offline` state branch created by Redux Offline needs to be a vanilla JavaScript object.
If your entire store is immutable you should check out [`redux-offline-immutable-config`](https://github.com/anyjunk/redux-offline-immutable-config) which provides drop-in configurations using immutable counterparts and code examples.
If you use Immutable in the rest of your store, but the root object, you should not need extra configurations.

[Contributions welcome](#contributing).

#### Choose where the offline middleware is added

By default, the offline middleware is inserted right before the offline store enhancer as part of its own middleware chain. If you want more control over where the middleware is inserted, consider using the alternative api, `createOffline()`.

```js
import { createOffline } from "@redux-offline/redux-offline";
const { middleware, enhanceReducer, enhanceStore } = createOffline(config);
const store = createStore(
  enhanceReducer(rootReducer),
  initialStore,
  compose(applyMiddleware(middleware), enhanceStore)
);
```

## Contributing

Improvements and additions welcome.

In lieu of a formal style guide, follow the included eslint rules, and use Prettier to format your code.

## Miscellanea

### Prior art

Redux Offline is a distillation of patterns discovered while building apps using previously existing libraries:

* Forbes Lindesay's [redux-optimist](https://github.com/ForbesLindesay/redux-optimist)
* Zack Story's [redux-persist](https://github.com/rt2zz/redux-persist)

Without their work, Redux Offline wouldn't exist. If you like the ideas behind Redux Offline, but want to build your own stack from lower-level components, these are good places to start.

### License

MIT

repository: sorodrigo/redux-offline

branch_name: refs/heads/develop

repo_name: sorodrigo/redux-offline


text:
This package is used for setting up your general layout as well as some
convenience wrappers for initializing all the required context providers within
`react-md`.

It is highly recommended to also check out the
[Configuring Your Layout](/guides/configuring-your-layout) guide for a more
in-depth example along with updating your layout to include a navigation tree
and a routing library.

repository: mlaursen/react-md

branch_name: refs/heads/main

gha_language: TypeScript

repo_name: mlaursen/react-md


text:
[![Build Status](https://travis-ci.org/vlsi/mat-calcite-plugin.svg?branch=master)](https://travis-ci.org/vlsi/mat-calcite-plugin)

MAT Calcite plugin
==================

About
-----
This plugin for [Eclipse Memory Analyzer](http://www.eclipse.org/mat) allows to query heap dump via SQL

While MAT does have a query language, it does NOT allow to join, sort and group results.
MAT Calcite plugin allows all the typical SQL operations (joins, filters, group by, order by, etc)

Query engine is implemented via [Apache Calcite](https://calcite.apache.org)
See [Calcite SQL reference](https://calcite.apache.org/docs/reference.html)

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

Requirements: Java 1.8+, Eclipse Memory Analyzer 1.8.0+

TL;DR: use the following update repository to install the latest released version: https://dl.bintray.com/vlsi/eclipse/updates/

To install Calcite SQL plugin, perform the following:
1. Open `Help`, `Install New Software...`
1. Click `Add`, it will open a `Add Repository` window
1. Type `Calcite SQL plugin site` to the `Name` field
1. Type `https://dl.bintray.com/vlsi/eclipse/updates/` to the `Location` field
1. Click `Ok`
1. All the checkboxes can be left by default (`Show only latest version`, `Group items by category`, ...)
1. Check `SQL for Memory Analyzer` category
1. Click `Next` (Available Software)
1. Click `Next` (Installation Details)
1. Accept License
1. Click `Finish` and restart MAT

Early access versions
---------------------

Development builds are pushed to https://dl.bintray.com/vlsi/eclipse-test/updates/ repository,
so you can preview the upcoming version right after the commit lands to the default branch.

Sample
------

Query that lists duplicate URLs:

```sql
select toString(file) file_str, count(*) cnt, sum(retainedSize(this)) sum_retained, sum(shallowSize(this)) sum_shallow
  from java.net.URL
 group by toString(file)
having count(*)>1
 order by sum(retainedSize(this)) desc
```

To get an explain plan, use "explain plan for select ...":

```
EnumerableSort(sort0=[$2], dir0=[DESC])
  View (expr#0..3=[{inputs}], expr#4=[1], expr#5=[>($t1, $t4)], proj#0..3=[{exprs}], $condition=[$t5])
    EnumerableAggregate(group=[{0}], cnt=[COUNT()], sum_retained=[$SUM0($1)], sum_shallow=[$SUM0($2)])
      View (expr#0=[{inputs}], expr#1=[0], expr#2=[GET_SNAPSHOT($t1)], expr#3=[GET_IOBJECT($t2, $t0)], expr#4=['file'], expr#5=[RESOLVE_REFERENCE($t3, $t4)], expr#6=[toString($t5)], expr#7=[TO_REFERENCE($t3)], expr#8=[retainedSize($t7)], expr#9=[shallowSize($t7)], file=[$t6], $f1=[$t8], $f2=[$t9])
        GetObjectIdsByClass (class=java.net.URL)
```

Join sample
-----------

```sql
 select u.this, retainedSize(s.this)
   from "java.lang.String" s
   join "java.net.URL" u
     on s.this = u.path
```

Here's execution plan:

```
View (expr#0..2=[{inputs}], expr#3=[retainedSize($t2)], this=[$t0], EXPR$1=[$t3])
  HashJoin (condition=[=($1, $2)], joinType=[inner])
    View (expr#0=[{inputs}], expr#1=[0], expr#2=[GET_SNAPSHOT($t1)], expr#3=[GET_IOBJECT($t2, $t0)], expr#4=[TO_REFERENCE($t3)], expr#5=['path'], expr#6=[RESOLVE_REFERENCE($t3, $t5)], this=[$t4], path=[$t6])
      GetObjectIdsByClass (class=java.net.URL)
    View (expr#0=[{inputs}], expr#1=[0], expr#2=[GET_SNAPSHOT($t1)], expr#3=[GET_IOBJECT($t2, $t0)], expr#4=[TO_REFERENCE($t3)], this=[$t4])
      GetObjectIdsByClass (class=java.lang.String)
```

Heap schema
-----------

    heap (default schema)
    +- java (sub-schema name)
       +- util (sub-schema name)
          +- HashMap (table name).
             This "table" would return all the instances of java.util.HashMap without subclasses
    +- instanceof
       +- java
          +- util
             +- HashMap (table name).
                This would return HashMap instances as well as subclass instances (e.g. LinkedHashMap)
    +- "java.util.HashMap" (table name)
       This can be used as alternative.
    +- native.ThreadStackFrames (table name)
       Returns thread stack traces and local variable info

### Each java class maps to a table. The table lists instances without subclasses
 For instance: "java.lang.Object", "java.lang.String"
 Note: you need to use double quotes to quote identifiers
 Note: it is assumed that classes sharing the same name have the same fields

 The fields become columns.

 The following special columns are added:

    this         | reference to current object

 Fields are available as MAP.get call:

    select path -- retrieve field as usual
         , this['path'] -- retrieve field via MAP get
         , this['@className']
         , this['@class']['@classLoader'] -- nested calls work as well
      from java.net.URL

 The following virtual properties are available via MAP.get:

    @shallow     | shallow heap size of referenced object
    @retained    | retained heap size for referenced object
    @class       | the same as `getClass()` in Java
    @className   | class name (the same as `getClass().getName()` in Java)

 The following virtual properties are available for `Class` instances via MAP.get:

    @super       | super class
    @classLoader | returns `ClassLoader` for a given class

 The following functions can be used to work with column which represents reference:

    getId        | internal object identifier for referenced object
    getAddress   | memory address for referenced object
    getType      | class name of referenced object
    toString     | textual representation of referenced object
    shallowSize  | shallow heap size of referenced object
    retainedSize | retained heap size for referenced object
    length       | length of referenced array
    getSize      | size of referenced collection, map or count of non-null elements in array
    getByKey     | extracts value for given string representation of key for referenced map
    getField     | obtains value of field with specified name for referenced object
    getStringContent | pretty prints object representation

 The following table functions are supported:

    getRetainedSet(ref)        | returns the set of retained objects
    getOutboundReferences(ref) | returns outbound references (name, this) pairs
    getInboundReferences(ref)  | returns inbound references (this)
    getValues(ref)             | returns all values of a Java collection
    getMapEntries(ref)         | unnests Map as (key, value) tuples

 These functions can be called in a following way:
```sql
select
 u.this, refs.name, refs.this reference
from
 java.net.URL u,
 lateral table(getOutboundReferences(u.this)) refs
```
 Another example:
```sql
select
 p.this, vals.key, vals."value"
from
 java.util.Properties p,
 lateral table(getMapEntries(p.this)) vals
```

 The following collection functions are also supported:

    asMap(ref)                 | converts Java Map to SQL MAP, so it can be used like asMap(ref)['key']
    asMultiSet(ref)            | converts Java Collection to SQL MULTISET type
    asArray(ref)               | converts Java references array to SQL ARRAY type
    asByteArray(ref)           | converts Java bytes array (bytes[]) to SQL ARRAY type
    asShortArray(ref)          | converts Java shorts array (short[]) to SQL ARRAY type
    asIntArray(ref)            | converts Java ints array (int[]) to SQL ARRAY type
    asLongArray(ref)           | converts Java longs array (long[]) to SQL ARRAY type
    asBooleanArray(ref)        | converts Java boolean array (boolean[]) to SQL ARRAY type
    asCharArray(ref)           | converts Java chars array (char[]) to SQL ARRAY type
    asFloatArray(ref)          | converts Java floats array (float[]) to SQL ARRAY type
    asDoubleArray(ref)         | converts Java doubles array (double[]) to SQL ARRAY type

 These functions can be called in a following way:
```sql
select
 p.this
from
 java.util.Properties p
where
 asMap(p.this)['java.vm.version'] is not null
```

 Another example:
```sql
select
 fpc.this,
 fp.fp_ref
from
 java.io.FilePermissionCollection fpc,
 unnest(asMultiSet(fpc.perms)) fp(fp_ref)
```

 Note, that SQL arrays are indexed starting with '1', so following example shows how to get first element of long[] arrays:
```sql
select
 asLongArray(all_long_arrays.this)[1] first_element
from
 "long[]" all_long_arrays
where
 length(all_long_arrays.this) > 0
```

 Array index could be extracted into the table by using the 'unnest ... with ordinality' clause:
```sql
select
    c.this,
    cs.index,
    cs.val
from
    java.util.GregorianCalendar c,
    unnest(asIntArray(c.stamp)) with ordinality cs(val, index)
```

Requirements
------------
Java 1.8 as a build JDK. The code should still be Java 1.7 compatible.
Memory Analyzer Tool 1.5 or higher

Building
--------

Eclipse plugin cannot depend on jars from maven repository.
It has to be a OSGi bundle, however Calcite is easier to reach via maven.
So we use two-phase approach: bundle the dependencies in a single jar, then use this jar in eclipse project.

1. Build dependencies.jar

    ```
    cd MatCalciteDependencies
    mvn install
    ```

    This will create a jar with all the dependencies in `dependencies/target` folder.
    You do not need to touch/move/copy the jar.

2. Build the plugin

    ```
    mvn install # from the top-level folder
    ```

    Note: this will copy `MatCalciteDependencies` to `MatCalcitePlugin/MatCalcitePlugin/target/dependency` so Eclipse can find it.

    The final repository (aka "update site") with the plugin will be created in `eclipse-repository/target/eclipse-repository-1.0.0-SNAPSHOT.zip`

Running
-------

It is not yet clear how to run the plugin via maven.
To launch via Eclipse, just open Eclipse project, double-click `plugin.xml`, then click `Launch an Eclipse application`.

Commandline mode
----------------

You can process a single SQL via command line as follows

    ./MemoryAnalyzer -application MatCalcitePlugin.execute <heap-dump.file> <query.file> <result.file>

Roadmap
-------

- enhance heap schema
- context menu support
- heap-related filtering operators (instance of, dominator of, etc)
- interoperation with mat queries (histogram, retained set, etc)
- support external data providers (e.g. allow to join heapdump objects with csv file)
- projection support (do not compute unnecessary columns)
- optimizer rules

License
-------
This library is distributed under terms of Apache 2 License

Author
------
Vladimir Sitnikov<EMAIL_ADDRESS>

repository: vlsi/mat-calcite-plugin

gha_language: Java

repo_name: vlsi/mat-calcite-plugin


text:
---
layout:     post
title:      Data fixes in database migrations
date:       2016-03-06
summary:
categories: [migrations]
---

By data fix I mean a change to records in a table, as opposed to a change to a table schema. And yesterday, data fixes in a migration broke my tests. Not broke as in "these tests failed when they should have passed", but broke as in "I couldn't run any tests at all until I found the magical rake task that sidestepped the migrations". (`rake db:schema:load` in case you were wondering.)

## Awkward bedfellows

The thing with migrations is that they need to run on *all* instances of your app database. This includes local development databases and test databases (which will be empty if you are not using fixtures).

Data fixes, on the other hand, assume that the database tables contain broken data to begin with. A data fix might do something like this, for example:

```rb
thailand_tax = Taxes.where(country: 'Thailand').first
thailand_tax.sales = 0.1
thailand_tax.save!
```

This is fine and dandy so long there is a tax record for Thailand, but if there isn't, you're going to get a `undefined method 'sales' for nil` error, killing your TDD flow.

Things could get even weirder if there are multiple instances of your app running, which might be the case if customers can install the app on their own network. In this case, writing a data fix requested by one customer as a data migration will lead to all of your other customers' data changing as well. Happy happy fun times.

## Data migrations in rake tasks

The standard way of implementing data fixes is as a rake task, which are only run when you run them. While this is exactly the flexibility we want, it can also be an operational risk. If on top of production you have separate QA and user acceptance testing environments that sync against production data, you'll to have run the task three times on three different boxes over ssh. That's three manual interventions to remember and three opportunities to make a mistake.

My team was recently in this situation and we dealt with it by adding a data fix step to the deployment pipeline that ran a special rake task, which we called `data_fix:run_by_continuous_integration`.


text:
Getting Started
===============

Clone this repository.  Then run `bundle install` to get all the dependencies installed.

To work on the project just run `bundle exec compass watch` and the css files will be compiled as they chage.

Tabs
====

Don't use tabs.  Use 2 spaces for line indentation.  Most editors will make spaces behave like tabs, ask one of the ZURBians if you need help setting this up.

Images
======

All images should be placed in `images/`.  In your stylesheets use `image-url` to reference images.  Image paths should be written from site's root `images/` directory.  For example:

```css
/* in sass/app.scss */
#myContainer {background-image: image-url('my-image.png'); }

/* in sass/examples/app.scss (code is the same) */
#myContainer {background-image: image-url('my-image.png'); }
```

Fonts
=====

All fonts should be placed in `fonts/`.  In your stylesheets use `font-url` to reference font files.  Font paths should be written from site's root fonts/` directory.  For example:

```css
/* in sass/app.scss */
@font-face { font-family: 'OpenSans'; src: font-url("OpenSans-Bold-webfont.eot"); }

/* in sass/examples/app.scss (code is the same) */
@font-face { font-family: 'OpenSans'; src: font-url("OpenSans-Bold-webfont.eot"); }
```

Deploying
=========

To deploy run `bundle exec rake deploy`.

If you just want to test to see that everything is orderly, run `bundle exec rake test`

repository: imclab/giving-tree-static

repo_name: imclab/giving-tree-static


text:
# Overview

The ChannelAdvisor API can be used to build a variety of applications,
including:

- A application to help manage your ChannelAdvisor account
- An application to pull data from ChannelAdvisor and display it in a custom
  Dashboard
- A tool to help automate the creation of new listings on ChannelAdvisor
- A tool to help monitor your ChannelAdvisor account for changes or errors
- And much more!


text:
# Dev tools

The exercises are designed such that, if you can correctly solve the Basic exercises every week, then you should be able to get a passing grade on the exams. If you additionally solve correctly the Intermediate exercises, then you should be able to get a very good grade on the exams. The Advanced exercises are for enthusiasts who want go beyond the standard material and get a black belt in Software Engineering. We will be happy to try and provide personalized feedback on your solutions to Advanced exercises if you wish, just contact the staff.

These exercises will help you get started with git and use it in a way that will maximize collaboration and minimize conflicts between developers.
This exercise set assumes you are familiar with `git init, add, commit, push, status` commands, and familiar with the command line and running `git` from the command line.
You will also learn how to debug better and use different tools available to you as a developer.

## Exercises

- The [quiz](quiz.md) will allow you to check how familiar you are with the course content.

- Basics
  - The [first exercise](commit-messages.md) will teach you about commits in general and how to write effective commit messages.
  - The [second exercise](java-basics.md) will teach (or refresh) you about the basics of compiling and debugging Java programs from the command line.
  - The [third exercise](git-flow) shows you how to effectively use the branching and merging model for collaborative software development.
  - The [fourth exercise](compiling-debugging-ide) shows you how to compile and debug Java projects using an Integrated Development Environment (IDE).

- Intermediate
  - The [fifth exercise](compiling-debuging-cplusplus.md) walks you through an example of C++ compilation and debugging to show you some command line tools available for C++ development.

- Advanced
  - The [sixth exercise](apis) will teach you how to access the GitHub API with via the command line and Python.

## Solutions

You can find the solutions [here](solutions), but please try to solve the exercises by yourself before peeking at the solutions.

### Note
Refer to the [git cheat sheet](https://education.github.com/git-cheat-sheet-education.pdf) to remember git commands!

repository: atappy/public

repo_name: atappy/public


text:
# A Shiny-based Classroom Experiment with Real-Time Results Presentation

## Overview

This is the repository for a simple classroom experiment that I
regularly use in one of the first classes of my introductory cost
accounting course. It might be helpful to construct similar experiments
and, of course, if someone is interested in replicating the results from
our runs in their own class.

The experiment tests whether providing marginal or full cost information
affects pricing decisions in a simple one product pricing problem.

This is the experimental treatment with marginal cost
information.

And this is the treatment with full cost
information.

In principle, both formats provide the same underlying information and
thus, pricing should not differ across the two treatments if our study
participants rationally extract all available information.

Under the full cost treatment, however, fix costs are being allocated to
units based on expected unit sales. Assuming that participants use
simple “cost plus” heuristics when setting their prices, this could
imply that they are less likely to set prices below $12 when receiving
the full cost treatment. Note that setting prices below $12 might very
well be rational when demand reacts elastically to price as the
increased unit sales can compensate for the loss in margin.

These are the results from our inital experimental run in 2019 as
presented by the real-time shiny result
app:

You can assess the [online version of our last experimental results here
(in German)](https://trr266.wiwi.hu-berlin.de/shiny/kore_croom_result).
All data form our four experimental runs that we did so far are included
in `data_completed_exp` folder. Some analysis code for the full sample
is contained in the `add_code` folder.

At least for our students, it seems as if, in line with some prior
literature, full cost accounting causes them to set higher prices. In
real life, this might imply the risk of loosing market share, eventually
pricing oneself out of the market.

## Replicating the analysis and reusing the code

The repository contains all the code that you need to set up the
experiment on your own shiny server. I have included an English language
version along with the original German language version that I run in
class.

If you want to re-run the exact same experiment in your class for
didactcial purposes and/or to replicate our findings, you can also
simply reach out and I can provide you access to our shiny server so
that you can run the experiment with your students.

If you want to use the code as a starting point for your own classroom
experiments, here are some remarks about the code.

  - The repository contains both shiny apps (`app_experiment_en.R` and
    `app_restults_en.R`) in one directory. Make sure to export them as
    two separate shiny apps in separate folders.
  - The file `croom_exp.sqlite3` contains an empty `SQLite` database to
    store the response data. The file `ìnit_sqlite_db.R` contains some
    code snippets that might be useful when working with the database.
  - When you want to use the real-time results feature, your result app
    needs to have access to the database file that the experiment app is
    writing to. When you are hosting this on your own shiny server this
    can be realized by the results app linking to the database file in
    the folder of the experiment app. If you plan to host your apps on a
    service like ‘shinyapps.io’ then this will most likely not be
    feasible. In this case, you might consider switching to an external
    database.
  - When running this in a large class, your students might experience
    “Too many users” errors from shiny as shiny has a limit of 100
    concurrent users for a given app. When running your own shiny server
    you can configure shiny to allow more users but my guess is that you
    will run into performance issues at some point. Another option (the
    one that I went with) is to ask students to be patient and hit
    ‘reload’.
  - Finally, I whipped all this up relatively quickly, so I cannot
    guarantee that the code is error free and runs exactly as
    advertised. Please get in touch when you encounter something odd.

This is it. Let me know your thoughts and I would be very happy to get
in touch if you are reusing the code for your own projects. In
particular, I would be interested in hearing about people that replicate
our experimental classroom result.

Enjoy\!


text:
# 108-2 NMLAB Final
## DPP - Decentralized Publishing Platform
- 電機四 b05901033 莊永松
- 電機四 b05901189 吳祥叡
- 電機三 b06901104 趙崇皓
## Prerequisites
Make sure the follwing npm packages are installed globally:
```
├──<EMAIL_ADDRESS>└──<EMAIL_ADDRESS>```
For browsers, you can use **Chrome** and **Firefox**. Make sure that **Metamask** is installed as a plugin in the browser.

## How to
### Starting a local blockchain
In the top level folder, start the ganache-cli:
```
> ganache-cli
```
A local blockchain network `http://<IP_ADDRESS>:8545` will be created.

Open another terminal (or you could use tmux), type the following commands:
```
> truffle compile
> truffle migrate
```
### Starting local client
Navigate to `client` folder, and type:
```
> yarn start
```
You can now go to `localhost:3000` to visit the webpage.

### Connecting Metamask to local network

After starting a local blockchain network and client webpage, we need to connect the browser's Metamask account (assuming you already have one) to the local blockchain network.

|Step|Snapshot|
|---|---|
|Open your browser, and click on the Metamask icon.|![img](./images/metamask1.png)|
|Click the dropdown list on the top. You should see a list of networks.|![img](./images/metamask2.png)|
|Choose **Custom RPC** and, and set RPC url to `http://<IP_ADDRESS>:8545/`(default), or the url ganache-cli specifies.|![img](./images/metamask3.png)|

### Importing accounts
After starting `ganache-cli`, you will have some spare accounts to use:

![img](./images/ganache-account.png)

Suppose we want the use account no. 9:

|Step|Snapshot|
|---|---|
|Click on Metamask and select the icon on the top-right. Click on **Import Account**.|![img](./images/account1.png)|
|Copy the private key of account you wish to use and paste it in Metamask.|![img](./images/account2.png)|
|Click **Import** and see account successfully loaded.|![img](./images/account3.png)|

### Setting up ipfs node
Currently, we have an ipfs node running on our own server. However, you can also run a ipfs node locally:
```
> docker run -it -p 4002:4002 -p 4003:4003 -p 5002:5002    -p9090:9090 ipfs/js-ipfs:latest
```
After starting your own ipfs node, you need to modify `IPFS_ADDRESS` in `client/src/constants.js`. Currently, it is set to our current server address. If you run locally, you need to set it to `<IP_ADDRESS>`.

### Features

- Modify account information (Account)
- Upload files (Upload)
    - Currently supports `.txt`, `.pdf`, and image filetypes.
    - Aside from the original file, the webpage will also upload a preview file (blurred image, truncated pdf file) to the ipfs node.
- Check user's uploaded files and files users donated to (MyFeeds).
    - You can download the full file by clicking **Download**.
- Browse all files on the chain (Market).
    - Currently supports filter by filename and filetype.
    - You can preview the file by clicking on the file card.
    - You can donate money to the author of the file.


text:
IceKing
=======

Icecast log file parser / database logging software.   It just parses your icecast log file and logs the details to a PostgreSQL database.
I created this little script as it was always a pain in the backside trying to calculate listener-hour statistics for the radio station I volunteer for, RaW (http://radio.warwick.ac.uk/).  The only open-source software for calculating listener-hours is a port of Webalizer that hasn't been updated for years and requires a complicated script to concatenate many icecast logs together, which fails often.  As long as you have a reliable database server, this script should make the calculations much easier.

Dependencies
============

* Python3
* Psycopg2

repository: jonty-comp/iceking

repo_name: jonty-comp/iceking


text:
---
layout: post
title: "Agents based Simulation - Zombies attack!"
description: "Multi-agents Simulation using C++"
category: articles
modified: 2014-04-08
tags: [C++,Qt,simulation,multi-agents]
category: projects
projects: true
---

## Goal

In this C++/Qt program, we try to show the consequencies of a possible zombies invasion. It's a agent-based simulation in which population protected by hunters try to survive against zombies.

This funny application of the C++ simualtion programming is a good way to work with severals patterns and smart agents oriented objects.

## How it looks ?

Zombies attack!

## GitHub

Our multi-agents simulation is Open Source and [can be found on GitHub there](https://github.com/Drusy/ZombiesAttack).

## We were 2 working on this project

- [Florian Rotagnon](https://github.com/k-yak)
- [Kévin Renella](https://github.com/Drusy)


text:
# neo4j-apoc

Dockerfile for Neo4j (v 4.0.0) with installed APOC Plugin (v <IP_ADDRESS>)

It has the same Options as the [official Neo4j-Image](https://hub.docker.com/_/neo4j/)

# Build

```sh
docker build -t neo4japoc:4.0.0 .
```

# Run

```sh
docker run --publish=7474:7474 --publish=7687:7687 --volume=/media/neo4j neo4japoc
```

Make sure that you allow apoc to run its procedures like this:

```
 docker run neo4japoc -e NEO4J_dbms_security_procedures_unrestricted=apoc.*
```


text:
## Synopsis

Behavior - Tag Engine in Q

## Motivation

This library is highly inspired by
  * http://www.chris-granger.com/2013/01/24/the-ide-as-data/

## Installation

It is developed and tested on Windows only at this moment.

Steps for installation and verification:

## Usage

TO be added.

## Tests

TO be added.

## Performance Tests

TO be added.

## TODO
1. Coding style check
2. Unit testing
3. Refactor code to use vector language style instead of procedure
4. More client APIs (Market data)
5. A market maker implementation
6. A member implementation (algo trading)
7. Performance Testing

## Change History

repository: stjordanis/btlib-bt

repo_name: stjordanis/btlib-bt


text:
# Read Repair

**Read Repair** (`read_repair.py`) is a tool that allows you to read an entire table with pagination to repair the data using read-repair.

## Requirements
The tool works on all Cassandra versions 2.0 and laters.

## Command Line Parameters

    $ python2 read_repair.py user password host keyspace table /path/to/cert.crt

     Options:
     |   user                  (user used connect to Cassandra)
     |   password              (password used connect to Cassandra)
     |   host                  (host to connect)
     |   keyspace              (keyspace where to run the script for read-repair)
     |   table                 (table where to run the script for read-repair)
     |   /path/to/cert.crt     (optional - public cert used connect to Cassandra)

> **Note**:  the cert is necessary only if the connection uses ssl.

## Basic Usage
**Read Repair** is run through a command-line interface, so all of the command options are made available there.

Run the Read Repair script on the keyspace `keyspace` and table `table`, using the `user` and `password` for authentification, connecting to `host`:

    $ python2 read_repair.py user password host keyspace table

Run the Read Repair script on the keyspace `keyspace` and table `table`, using the `user` and `password` for authentification, connecting to `host` using the certificate `/path/to/cert.crt`:

    $ python2 read_repair.py user password host keyspace table /path/to/cert.crt

repository: digitalis-io/cassandra-repair-blog

repo_name: digitalis-io/cassandra-repair-blog


text:
# HackYourFuture .NET Masterclass - Week 1

Here you can find all the materials you will need for Week 1.

#### [Slides](Slides1.pdf)

#### [Exercises](Exercises1.md)

#### [Solution](Solution/ThirtyOne)
An example solution to the exercises if you get stuck or fall behind. Try to make your own solution first, following the instructions above.

#### Video

### Homework
If you want your homework reviewed, you should create a repository under your own account and check in your solution in GitHub.
Since we are working on the same project throughout the class, you don't need to create a separate repository for each week, simply make a project repository.
When you have committed your solution, let teacher/mentors know in slack and we will review it.

### Additional reading

[Introduction to C#](https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/intro-to-csharp/)

[Introduction to OOP in C#](https://www.c-sharpcorner.com/UploadFile/mkagrahari/introduction-to-object-oriented-programming-concepts-in-C-Sharp/)

[Basic principles of OOP](https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727)


text:
# Bit-Sequence Buffer Encoding

This macro accepts a sequence of bit expressions from the public macros and
creates encoded `[T; N]` arrays from them. The public macros can then use these
encoded arrays as the basis of the requested data structure.

This is a complex macro that uses recursion to modify and inspect its input
tokens. It is divided into three major sections.

## Entry Points

The first section provides a series of entry points that the public macros
invoke. Each arm matches the syntax provided by public macros, and detects a
specific `BitStore` implementor name: `uN`, `Cell<uN>`, `AtomicUN`, or
`RadiumUN`, for each `N` in `8`, `16`, `32`, `64`, and `size`.

These arms then recurse, adding a token for the raw unsigned integer used as the
basis of the encoding. The `usize` arms take an additional recursion that routes
to the 32-bit or 64-bit encoding, depending on the target.

## Zero Extension

The next two arms handle extending the list of bit-expressions with 64 `0,`s.
The first arm captures initial reëntry and appends the zero-comma tokens, then
recurses to enter the chunking group. The second arm traps when recursion has
chunked all user-provided tokens, and only the literal `0,` tokens appended by
the first arm remain.

The second arm dispatches the chunked bit-expressions into the element encoder,
and is the exit point of the macro. Its output is an array of encoded memory
elements, typed as the initially-requested `BitStore` name.

The `0,` tokens remain matchable as text literals because they never depart
this macro: recursion within the same macro does not change the types in the
AST, while invoking a new macro causes already-known tokens to become opacified
into `:tt` whose contents cannot be matched. This is the reason that the macro
is recursive rather than dispatching.

## Chunking

The stream of user-provided bit-expressions, followed by the appended zero-comma
tokens, is divided into chunks by the width of the storage type.

Each width (8, 16, 32, 64) has an arm that munches from the token stream and
grows an opaque token-list containing munched groups. In syntax, this is
represented by the `[$([$($bit:tt,)+],)*];` cluster:

- it is an array
  - of zero or more arrays
    - of one or more bit expressions
    - each followed by a comma
  - each followed by a comma
- followed by a semicolon

By placing this array ahead of the bit-expression stream, we can use the array
as an append-only list (matched as `[$($elem:tt)*]`, emitted as
`[$($elem)* [new]]`) grown by munching from the token stream of unknown length
at the end of the argument set.

On each recursion, the second arm in zero-extension attempts to trap the input.
If it fails, then user-provided tokens remain; if it succeeds, then it discards
any remaining macro-appended zeros and terminates.

repository: clarfonthey/bitvec

repo_name: clarfonthey/bitvec


text:
# WIP cfstep-image-promotion
Promote Codefresh built Docker images to Docker registry.

Can promote to a new tag or promote to another Docker registry.

YAML Step
``` yaml
  PromoteImage:
    image: codefreshplugins/cfstep-image-promotion:latest
    environment:
      - IMAGE=codefresh/demochat # Replace with Candidate Docker image name
      - TAG=${{CF_BRANCH_TAG_NORMALIZED}} # Candidate tag
      - PROMOTE_TAG=release-candidate # Tag to promote
```

## Variable List

| ENVIRONMENT VARIABLE | DEFAULT | TYPE | REQUIRED | DESCRIPTION |
|----------------------------|----------|---------|----------|---------------------------------------------------------------------------------------------------------------------------------|
| CODEFRESH_API_URL | https://g.codefresh.io | string | No | Codefresh API URL |
| CF_API_KEY | null | string | Yes | Codefresh API Key (Supplied by Codefresh pipeline) |
| CF_BUILD_INITIATOR | null | string | Yes | Codefresh Build Initiator (Supplied by Codefresh pipeline) |
| CODEFRESH_USERNAME | CF_BUILD_INITIATOR | string | Yes | Codefresh Username (Supplied by Codefresh pipeline) |
| IMAGE | null | string | Yes | Name of Image to Promote |
| PROMOTE_IMAGE | IMAGE | string | Yes | Name of Promoted Image |
| PROMOTE_TAG | TAG | string | Yes | Tag of Promoted Image |
| REGISTRY | cfcr | string | Yes | Registry to promote image to |
| TAG | null | string | Yes | Tag of Image to Promote |


text:
---
search:
  boost: 4
---
# Dell FTOSv (OS10) / ftosv

Dell FTOSv (OS10) virtualized router/switch is identified with `vr-ftosv` or `vr-dell_ftosv` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format.

vr-ftosv nodes launched with containerlab comes up pre-provisioned with SSH and SNMP services enabled.

## Managing vr-ftosv nodes

!!!note
    Containers with FTOS10v inside will take ~2-4min to fully boot.
    You can monitor the progress with `docker logs -f <container-name>`.

Dell FTOS10v node launched with containerlab can be managed via the following interfaces:

=== "bash"
    to connect to a `bash` shell of a running vr-ftosv container:
    ```bash
    docker exec -it <container-name/id> bash
    ```
=== "CLI"
    to connect to the Dell FTOSv CLI
    ```bash
    ssh admin@<container-name/id>
    ```

!!!info
    Default user credentials: `admin:admin`

## Interfaces mapping
vr-ftosv container can have different number of available interfaces which depends on platform used under FTOS10 virtualization .qcow2 disk and container image built using [vrnetlab](../vrnetlab.md) project. Interfaces uses the following mapping rules (in topology file):

* `eth0` - management interface connected to the containerlab management network
* `eth1` - first data interface, mapped to first data port of FTOS10v line card
* `eth2+` - second and subsequent data interface

When containerlab launches vr-ftosv node, it will assign IPv4/6 address to the `eth0` interface. These addresses can be used to reach management plane of the router.

Data interfaces `eth1+` needs to be configured with IP addressing manually using CLI/management protocols.

## Features and options
### Node configuration
vr-ftosv nodes come up with a basic configuration where only `admin` user and management interfaces such as SSH provisioned.

#### Startup configuration
It is possible to make vMX nodes boot up with a user-defined startup-config instead of a built-in one. With a [`startup-config`](../nodes.md#startup-config) property of the node/kind user sets the path to the config file that will be mounted to a container and used as a startup-config:

```yaml
topology:
  nodes:
    node:
      kind: vr-ftosv
      startup-config: myconfig.txt
```

With this knob containerlab is instructed to take a file `myconfig.txt` from the directory that hosts the topology file, and copy it to the lab directory for that specific node under the `/config/startup-config.cfg` name. Then the directory that hosts the startup-config dir is mounted to the container. This will result in this config being applied at startup by the node.

Configuration is applied after the node is started, thus it can contain partial configuration snippets that you desire to add on top of the default config that a node boots up with.

repository: burnyd/containerlab

repo_name: burnyd/containerlab


text:
---
date: 2000-01-01T00:00:00+00:00
title: DRONE_USER_FILTER
author: bradrydzewski
aliases:
- /reference/server/drone-user-filter/
- /installation/reference/drone-user-filter/
---

Optional comma-separated list of accounts. Registration is limited to users in this list, or users that are members of organizations included in this list.

```
DRONE_USER_FILTER=octocat,spacheghost,github
```

If a user attempts to register and they are not a named user and not a member of a named organization, they will receive the following error:

> _Login Failed. User must be a member of an approved organization._

repository: drone/docs

gha_language: SCSS

gha_license_id: NOASSERTION

repo_name: drone/docs


text:
## Contributing to CEMU ##

### License ###

`CEMU` is placed under [license MIT](https://github.com/hugsy/cemu/LICENSE) which provides Open-Source access to the code and its use.

By contributing to `CEMU` code through the _Pull Requests_ mechanism, you accept to release the code written by you under the said license.

### Submitting a Patch ###

1. Fork `CEMU` repository (requires GitHub account). Sending a patch from the `patch` or `git diff --patch` commands is not accepted.
1. Write the changes in your local repo.
    * Respect the coding style (same indentation format, explicit names as possible)
    * Comment your code
1. Submit a pull request **ALWAYS against `dev`** (never `main` - which is reserved for stable code)
1. Contributors will review your patch. If it is approved, the change will be merged via the GitHub, and you will be seen as contributors. If it needs additional work, the repo owner will respond with useful comments.

repository: hugsy/cemu

gha_language: Python

repo_name: hugsy/cemu


text:
# covid-19-nigeria-data
Data repository containing data files for COVID-19 spread in Nigeria.

## Data
`data/covid_nigeria_state_data` contains daily count of cases for each state.
`data/covid_nigeria_total_data` contains total count of cases for the entire country per day.

## Endpoints
The data contained in these files are also [hosted](https://covid-19-nigeria-data.herokuapp.com) and are accessible via the endpoints below:
- `/` returns  both state and total count of cases for per day.
- `/states` returns daily count of cases for each state per day.
- `/total` returns total count of cases for the entire country per day.

To get more real-time granular data with time details, see [API COVID-19 Nigeria](https://api-covid-19-nigeria.herokuapp.com)

## Disclaimer
Data contained in these files are gotten from daily reports issued by the NCDC on their Twitter page and daily reports.


text:
![GitHub License](https://img.shields.io/badge/License-MIT%20License-blue.svg)
  # Team Profile Generator
  ## Table of Contents
  * [Project Description](#description)
  * [Installation](#installation)
  * [Usage](#usage)
  * [Contributors](#contributors)
  * [Tests](#tests)
  * [License](#license)
  * [Questions](#questions)

  ## Project Description
  The Team Profile Generator is a command-line application that takes information about an employee on a software engineering team and generates an HTML webpage with their info displayed. The user will be prompted with questions regarding their role, whether they are a Manager, Engineer, or Intern. At the end of each set of questions, the user will be prompted whether they want to add another member to the dream team.  If they choose not too, then they're done! Your dream team is ready to go!

  Below is an example of the generated HTML webpage:

  ![Team Profile Generator](./assets/images/team-profile-generator.PNG)

  ## Installation
  Before running the application, the user must execute the command "npm install" to install all of the required dependencies. Tests were also created for this application, so you'll also want to execute the command "npm install --save-dev jest" After both commands are ran, then you're all set!

  Below is an example of how the application is ran and the results:

  https://drive.google.com/file/d/1B6IJ9ZX5IyGxVu_BT_icXSCQauUgbhYP/view

  ## Usage
  In order to run this application, you will open the terminal where this application resides. Then you will want to run the command "node index.js" Once that command is ran, you'll first be prompted with questions for a Manager role. You'll then be prompted with a question whether you want to add another member to the team, whether it be another Manager, Engineer, or Intern. If Manager, Engineer, or Intern are selected, then you'll be prompted with their corresponding questions. If not, then you have the option to be finished building your team and a HTML webpage is generated.

  ## Contributors
  Please feel free to create pull requests. They will be reviewed before merging. If you would like to make any major changes, please open an issue to discuss these changes.

  ## Tests
  Jest is used to run all of the tests. As mentioned above, tests used for this application, were to ensure that the data returned from the class constructors and functions, were behaving as expected. There are tests for each type of employee (Employee, Manager, Engineer, and Intern). In order to run these tests, run the command "npm run test"

  ## License
    This project is licensed through MIT License

  ## Questions
  If you have any questions, please feel free to contact the owner of this repository. Their contact info is listed below:

  ###
  GitHub Username: dannyphan6

  GitHub Repository: https://github.com/dannyphan6

  Email Address<EMAIL_ADDRESS>