text:
# Self-healing (aka Rebuild)

In DAOS, if the data is replicated with multiple copies on different
targets, once one of the targets fails, it's data will be rebuilt
on the other targets automatically, so the data redundancy will not be
impacted due to the target failure. In future versions, DAOS will also support
Erasure Coding to protect the data; then the rebuild process might be
updated accordingly.

## Rebuild Detection

When a target failed, it should be detected promptly and
notify the pool (Raft) leader, and then the leader will exclude
the target from the pool and trigger the rebuild process
immediately.

### Current status and long-term goal

Currently, since the raft leader can not exclude the target
automatically, the sysadmin has to manually exclude the target
from the pool, which then triggers the rebuild.

In the future, the leader should be able to detect the target failure
promptly and then trigger the rebuild automatically by itself,
without the help of the sysadmin.

## Rebuild process

The rebuild is divided into 2 phases, scan and pull.

 Any target
that receives this RPC will start to scan its object table
to determine the objects lost data redundancy on the faulty
target. If it does, send their IDs and related metadata
to the rebuild targets(rebuild initiator). As for how to choose
the rebuild target for faulty target, it will be described in
placement/README.md

### Pull

Once the rebuild initiators get the object list from the scanning
target, it will pull the data of these objects from other
replicas and then write data locally. Each target will report
its rebuild status, rebuilding objects, records, is_finished?
etc, to the pool leader. Once the leader learned all of targets
finished its scanning and rebuilding phase, it will notify all targets
the rebuild has finished, and they can release all of the resources
held during the rebuild process.

**Rebuild Protocol**
![../../docs/graph/Fig_059.png](../../docs/graph/Fig_059.png "Rebuild Protocol")

The figure above is an example of this process:
There are five objects in the cluster: object A is 3-way replicated,
object B, C, D and E are 2-way replicated. When target-2 failed,
target-0, which is the Raft leader, broadcasted the failure to all
surviving targets to notify them to enter the degraded mode and scan:

- Target-0 found that object D lost a replica and calculated out target-1 is
the rebuild target for D, so it sent object D's ID and its metadata to
target-1.
- Target-1 found that object A lost a replica and calculated out target-3 is
the rebuild target for A, so it sent object A's ID and its metadata to
target-3.
- Target-4 found objects A and C lost replicas and it calculated out target-3
is the rebuild target for both objects A and C, so it sent IDs for objects A
and C and their metadata to target-3.
- After receiving these object IDs and their metadata, target-1 and target-3
can compute out surviving replicas of these objects, and rebuild these objects
by pulling data from these replicas.

### Multiple pool and targets rebuild

In a large-scale storage cluster, multiple failures might occur
when a rebuild from a previous failure is still in progress. In this
case, DAOS should neither simultaneously handle these failures, nor
interrupt and reset the earlier rebuilding progress for later
failures. Otherwise, the time consumed for rebuilds for each failure
might grow significantly and rebuilds may never end if new failures
overlap with ongoing rebuilds. So for multiple failures, these rules
are applied

- If the rebuild initiator fails during rebuild, then the object shards
being rebuilt on the initiator should be ignored, which will be handled
by next rebuild.
- If rebuild initiator can not fetch the data from other replicas due to
the failure, it will switch to other replicas if available.
- A target in rebuild does not need to re-scan its objects or reset rebuild
progress for the current failure if another failure has occurred.
- When there are multiple failures, if the number of failed targets from
different domains exceeds the fault tolerance level, there could be
unrecoverable errors and applications could suffer from data loss. In this
case, upper layer stack software could see errors while sending I/O to the
object that could have missing data.

The following figure is an example of this protocol.

**Multi-failure protocol**
![../../docs/graph/Fig_061.png](../../docs/graph/Fig_061.png "Multi-failure protocol")

- In this example, object A is 2-way replicated, object B, C and D are 3-way
replicated.
- After failure of target-1, target-2 is the initiator of rebuilding object B,
it is pulling data from target-3 and target-4; target-3 is the initiator of
rebuilding object C, it is pulling data from target-0 and target-2.
- Target-3 failed before completing rebuild for target-1, so rebuild of object
C should be abandoned at this point, because target-3 is the initiator of it.
The missing data redundancy of object C will be reconstructed while rebuilding
target-3.
- Because target-3 is also contributor of rebuilding object B, based on the
protocol, the initiator of object B, which is target-2, should switch to
target-4 and continue rebuild of object B.
- Rebuild process of target-1 can complete after finishing rebuild of object B.
By this time, object C still lost a replica. This is quite understandable,
because even if two failures have no overlap, object C will still lose the
replica on target-3.
- In the process of rebuilding target-3, target-4 is the new initiator of
rebuilding object C.

If there are multiple pools being impacted by the failing
target, these pools can be rebuilt concurrently.

## I/O during rebuild

If there are concurrent writes during rebuild, the rebuild protocol should
guarantee that new writes will never be lost. Those writes should be either
directly stored in the new object shard or pulled to the new object shard
by the rebuild initiator. And also fetch should be guarantee to get the
correct data. To achieve these, these protocols are applied

1. Fetch will always skip the rebuilding target.
2. Update can complete only if updates of all the object shards have
successfully completed.
- If any of these updates failed, the client will infinitely retry until
it succeeds, or there is a pool map change which shows the target failed.
In the second case, the client will switch to the new pool map, and send
the update to the new destination, which is the rebuild target of this object.
3. There are no synchronization between normal I/O and rebuild process, so during
rebuild process, the data might be written duplicately by rebuild initiator and
normal I/O.

## Rebuild resource throttle

During rebuild process, the user can set the throttle to guarantee
the rebuild will not use more resource than the user setting. The
user can only set the CPU cycle for now. For example, if the user set
the throttle to 50, then the rebuild will at most use 50% of CPU
cycle to do rebuild job. The default rebuild throttle for CPU cycle
is 30.

## Rebuild status

As described earlier, each target will report its rebuild status to
the pool leader by IV, then the leader will summarize the status of
all targets, and print out the whole rebuild status by every 2 seconds,
for example these messages.

```
Rebuild [started] (pool 8799e471 ver=41)
Rebuild [scanning] (pool 8799e471 ver=41, toberb_obj=0, rb_obj=0, rec= 0, done 0 status 0 duration=0 secs)
Rebuild [queued] (419d9c11 ver=2)
Rebuild [started] (pool 419d9c11 ver=2)
Rebuild [scanning] (pool 419d9c11 ver=2, toberb_obj=0, rb_obj=0, rec= 0, done 0 status 0 duration=0 secs)
Rebuild [pulling] (pool 8799e471 ver=41, toberb_obj=75, rb_obj=75, rec= 11937, done 0 status 0 duration=10 secs)
Rebuild [completed] (pool 419d9c11 ver=2, toberb_obj=10, rb_obj=10, rec= 1026, done 1 status 0 duration=8 secs)
Rebuild [completed] (pool 8799e471 ver=41, toberb_obj=75, rb_obj=75, rec= 13184, done 1 status 0 duration=14 secs)
```

There are 2 pools being rebuilt (pool 8799e471 and pool 419d9c11,
note: only first 8 letters of the pool uuid are shown here).

```
The 1st line means the rebuild for pool 8799e471 is started, whose pool map version is 41.
The 2nd line means the rebuild for pool 8799e471 is in scanning phase, and no objects & records are being rebuilt yet.
The 3rd line means a rebuild job for pool 419d9c11 is being queued.
The 4th line means the rebuild for pool 419d9c11 is started, whose pool map version is 2.
The 5th line means the rebuild for pool 419d9c11 is in scanning phase, and no objects & records are being rebuilt yet.
The 6th line means the rebuild for pool 8799e471 is in pulling phase, and there are 75 objects to be rebuilt(toberb_obj=75), and all of them are rebuilt(rb_obj=75), but records rebuilt for these objects are not finished yet(done 0) and only 11937 records (rec = 11937) are rebuilt.
The 7th line means the rebuild for pool 419d9c11 is done (done 1), and there are totally 10 objects and 1026 records are rebuilt, which costs about 8 seconds.
The 8th line means the rebuild for pool 8799e471 is done (done 1), and there are totally 75 objects and 13184 records are rebuilt, which costs about 14 seconds.
```

During the rebuild, if the client query the pool status to the pool leader,
which will return its rebuild status to client as well.

```C
struct daos_rebuild_status {
	/** pool map version in rebuilding or last completed rebuild */
	uint32_t		rs_version;
	/** Time (Seconds) for the rebuild */
	uint32_t		rs_seconds;
	/** errno for rebuild failure */
	int32_t			rs_errno;
	/**
	 * rebuild state, DRS_COMPLETED is valid only if @rs_version is non-zero
	 */
	union {
		int32_t			rs_state;
		int32_t			rs_done;
	};

	/* padding of rebuild status */
	int32_t			rs_padding32;

	/* Failure on which rank */
	int32_t			rs_fail_rank;
	/** # total to-be-rebuilt objects, it's non-zero and increase when
	 * rebuilding in progress, when rs_state is DRS_COMPLETED it will
	 * not change anymore and should equal to rs_obj_nr. With both
	 * rs_toberb_obj_nr and rs_obj_nr the user can know the progress
	 * of the rebuilding.
	 */
	uint64_t		rs_toberb_obj_nr;
	/** # rebuilt objects, it's non-zero only if rs_state is completed */
	uint64_t		rs_obj_nr;
	/** # rebuilt records, it's non-zero only if rs_state is completed */
	uint64_t		rs_rec_nr;

	/** rebuild space cost */
	uint64_t		rs_size;
};
```

## Rebuild failure

If the rebuild is failed due to some failures, it will be aborted, and the
related message will be shown on the leader console. For example:

```
Rebuild [aborted] (pool 8799e471 ver=41, toberb_obj=75, rb_obj=75, rec= 11937, done 1 status 0 duration=10 secs)
```

## Rebuilding with Checksums

During a rebuild, the server being rebuilt will act as a DAOS Client in the
sense that it will read the data and checksum from a replica server and verify
the integrity of the data before it uses it for the rebuild. If corrupted data
is detected, then the read will fail, and the replica server will be notified of
the corruption. The rebuild will then attempt to use a different replica.

A checksum iov parameter is available for the object list and object fetch task
API's. This is for rebuild to provide memory that the checksums can be packed
into. Otherwise, rebuild would have to recalculate the checksums while writing
to the local VOS instance. If insufficient memory is allocated in the buffer,
the iov_len will be set to the required capacity and the checksums packed into
the buffer is truncated.

The following describes "touch points" of the life of a checksum for rebuild.
The client task APIs and packing/unpacking info is included here because
rebuild is the primary user of these APIs with checksums.

### Rebuild Touch Points

- migrate_fetch_update_(inline|single|bulk) - the rebuild/migrate functions that
  write to vos locally must ensure that the checksum is also written. These must
  use the csum iov param for fetch to get the checksum, then unpack the csums
  into iod_csum.
- obj_enum.c is relied on for enumerating the objects to be rebuilt. Because the
  fetch_update functions will unpack the csums from fetch, it will also unpack
  the csums for enum, so the unpacking process in obj_enum.c will simply copy
  the csum_iov to the io (dc_obj_enum_unpack_io) structure in
  **enum_unpack_recxs()** and then deep copy to the mrone (migrate_one)
  structure in **migrate_one_insert()**.

### Client Task API Touch Points

- **dc_obj_fetch_task_create**: sets csum iov to daos_obj_fetch_t args. These
  args are set to the rw_cb_args.shard_args.api_args and accessed through an
  accessor function (rw_args2csum_iov) in cli_shard.c so that rw_args_store_csum
  can easily access it. This function, called from dc_rw_cb_csum_verify, will
  pack the data checksums received from the server into the iov.
- **dc_obj_list_obj_task_create**: sets csum iov to daos_obj_list_obj_t args.
  args.csum is then copied to obj_enum_args.csum in dc_obj_shard_list(). On enum
  callback (dc_enumerate_cb()) the packed csum buffer is copied from the rpc
  args to obj_enum_args.csum (which points to the same buffer as the caller's)

### Packing/unpacking checksums

When checksums are packed (either for fetch or
object list) only the data
checksums are included. For object list, only checksums for data that is inlined
is included. During a rebuild, if the data is not inlined, then the rebuild
process will fetch the rest of the data and also get the checksums.

- ci_serialize() - "packs" checksums by appending the struct to an iov and then
  appending the checksum info buffer to the iov. This puts the actual checksum
  just after the checksum structure that describes the checksum.
- ci_cast() - "unpacks" the checksum and describing structure. It does this by
  casting an iov's buffer to a dcs_csum_info struct and setting the csum_info's
  checksum pointer to point to the memory just after the structure. It does not
  copy anything, but really just "casts". To get all dcs_csum_infos, a caller
  would cast the iov, copy the csum_info to a destination, then move to the next
  csum_info(ci_move_next_iov) in the iov. Because this process modifies the iov
  structure it is best to use a copy of the iov as a temp structure.

repository: daos-stack/daos

gha_language: C

repo_name: daos-stack/daos


text:
## Description

This is a simple, no-fuss generator for OpenXML (aka XLSX) files. No formatting or styles included -- just raw content with a few basic datatypes supported. Produced output is tested to be compatible with:

- Open Office 3.2 series (Linux, Mac, Windows)
- Neo Office 3.2 series (Mac)
- Microsoft Office 2007 (Windows)
- Microsoft Office 2010 (Windows)
- Microsoft Office 2008 for Mac (versions 12.2.5 or above)
- Microsoft Excel Viewer (Windows)

iWork's Numbers does not appear to support the inline string storage model used by this gem. Apple may release a fix for this eventually, but for now, I have avoided the more common shared string table method as it cannot be implemented in linear time.

## Sample

    serializer = SimpleXlsx::Serializer.new("test.xlsx") do |doc|
      doc.add_sheet("People") do |sheet|
        sheet.add_row(%w{DoB Name Occupation})
        sheet.add_row([Date.parse("July 31, 1912"),
                       "Milton Friedman",
                       "Economist / Statistician"])
      end
    end

## License

See attached LICENSE for details.

## Credits

- Built by [Harvest](http://www.getharvest.com). Want to work on projects like this? [We’re hiring](http://www.getharvest.com/careers)!
- Concept and development by [Dee Zsombor](http://primalgrasp.com).

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: Ruby

gha_license_id: MIT

license_type: permissive


text:
---
title:  Let Your Light Shine
date:  16/07/2018
---

**Testimony**: Matt. 5:16

“Christ has made provision that His church shall be a transformed body, illumined with the light of heaven, possessing the glory of Immanuel. It is His purpose that every Christian shall be surrounded with a spiritual atmosphere of light and peace. There is no limit to the usefulness of one who, putting self aside, makes room for the working of the Holy Spirit upon the heart and lives a life wholly consecrated to God.”1

“Thus it will ever be when the Spirit of God takes possession of the life. Those whose hearts are filled with the love of Christ, will follow the example of Him who for our sake became poor, that through His poverty we might be made rich. Money, time, influence—all the gifts they have received from God’s hand, they will value only as a means of advancing the work of the gospel. Thus it was in the early church; and when in the church of today it is seen that by the power of the Spirit the members have taken their affections from the things of the world, and that they are willing to make sacrifices in order that their fellow men may hear the gospel, the truths proclaimed will have a powerful influence upon the hearers.”2

“The indwelling of the Spirit will be shown by the outflowing of heavenly love. The divine fullness will flow through the consecrated human agent, to be given forth to others.”3

“Christ does not bid His followers strive to shine. He says, Let your light shine. If you have received the grace of God, the light is in you. Remove the obstructions, and the Lord’s glory will be revealed. The light will shine forth to penetrate and dispel the darkness. You cannot help shining within the range of your influence.”4

**React**

`How do we receive the grace of God so that His light will be in us? What kinds of things can we do on campus or in the workplace to let our light shine before others?`

_Yolanda Pugh, Tallahassee, Florida, USA_

repository: Adventech/sabbath-school-lessons

branch_name: refs/heads/stage

repo_name: Adventech/sabbath-school-lessons


text:
Please make sure that all your commits are squashed into one commit. Also test that the logger works.

## Workflow
- Fork the project.
- Make your changes.
- **Test it.** This is very important to prevent breakage.
- Squash your commits into one.
- Pull request.

Thanks for contributing!

repository: mackncheesiest/KeyDebouncer

repo_name: mackncheesiest/KeyDebouncer


text:
# InvoiceMerchantOrder

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | Order ID used by the merchant’s shopping cart |
**items** | [**List<InvoiceItem>**](InvoiceItem.md) | Array of items (in the shopping cart) |

gha_language: Java


text:
# gh-gpg-import

Import a GitHub user's published GPG keys to your local keyring.

## Install

```
gh extension install speshak/gh-gpg-import
```

## Usage

Import a user's public GPG keys into your keyring:

```
gh gpg-import $GITHUB_USERNAME
```

Import the GitHub web-flow GPG key

```
gh gpg-import github-webflow
```

repository: speshak/gh-gpg-import

branch_name: refs/heads/main

repo_name: speshak/gh-gpg-import


text:
---
title: Template Selection
description: Zen Cart Template Selection
category: admin_pages
weight: 10
---

This page allows you to select the template which is used when
displaying pages on your storefront.

For more information, see the [template FAQs](/user/template/).


text:
Cjmx has two main states -- connected to a JVM and disconnected.  The commands available are sensitive to the current connectivity state.

## Global Commands

 - help [topic] - Gets help for the specified topic
 - format - Changes the output format of commands
 - exit - Exits cjmx

## Disconnected Commands

When cjmx is not connected to a JVM, the following commands are available:

 - jps - Lists all local Java Virtual Machines
 - connect - Connects to a local Java Virtual Machine

## Connected Commands

Once cjmx is connected to a JVM, the following commands are available:

 - names - List MBean names
 - describe - Describe MBean information
 - select - Get MBean attributes
 - invoke - Invoke MBean operations

Each action has a prefix command and a postfix command.  The postfix form is preferred as it offers better tab completion.  Both forms are documented in the detailed help for the command.

repository: pchiusano/cjmx

repo_name: pchiusano/cjmx


text:
---
title: Reconstruction of the Cape Florida
tags:
  - Apr 1996
---

Reconstruction of the Cape Florida Lighthouse continues. [Photos] [In the South Miami Neighbors.]

Newspapers: **Miami Morning News or The Miami Herald**

Page: **N/A**, Section: **N/A**


text:
# URLSearchParams, the Fetch API, and Content-Type bug

This sample project demonstrates the bug caused by using a polyfilled `URLSearchParams` object in a *Fetch API* request.

When the following are true:
1. The `URLSearchParams` object has been polyfilled.
2. A *POST* request is made using the *Fetch API*.
3. The *POST* request's body is set to an instance of the polyfilled `URLSearchParams` object.
4. The *POST* request's `Content-Type` header has NOT been set manually.

The fetch request should set the `Content-Type` to `application/x-www-form-urlencoded` but instead chooses `text/plain`
which causes the request to be misunderstood by servers checking this header.

## Demo

This demo site has been published at
[urlsearchparams-bug.nialto.workers.dev](https://urlsearchparams-bug.nialto.workers.dev/).

Visiting the site with a browser that does not require the polyfill (such as Google Chrome and Safari on a mac) will
log messages to the console reflecting the expected behaviour. The correct `URLSearchParams` object will be returned
and the sample *POST* request will have used the correct `Content-Type` header of `application/x-www-form-urlencoded`.

However, visiting the site with a browser that does require the polyfill (such as Safari on iOS or the iOS Simulator)
will log messages to the console indicating a mysterious `o` type instead of the expected `URLSearchParams`, and the
sample *POST* request will have used the incorrect `Content-Type` header of `text/plain`.

repository: tobyaherbert/urlsearchparams-bug

repo_name: tobyaherbert/urlsearchparams-bug


text:
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]

Best-README-Template

    An awesome README template to jumpstart your projects!

    Explore the docs »

    View Demo
    ·
    Report Bug
    ·
    Request Feature

## Table of Contents

* [About the Project](#about-the-project)
  * [Built With](#built-with)
* [Getting Started](#getting-started)
  * [Prerequisites](#prerequisites)
  * [Installation](#installation)
* [Usage](#usage)
* [Roadmap](#roadmap)
* [Contributing](#contributing)
* [Contact](#contact)

## About The Project

[![Product Name Screen Shot][product-screenshot]](https://example.com)

I've tried web scrapping with Python before. But it was very slow. So I made one using Go.

Here's why I used Go:
* Super Fast! It utilizes multiprocessing through goroutines.(It's amazing)
* I am looking for jobs and I wanted to scrappe jobs from indeed. com

### Built With
This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
* Go
* Echo

## Usage
Screenshots

## Roadmap

See the [open issues](https://github.com/othneildrew/Best-README-Template/issues) for a list of proposed features (and known issues).

## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.

1. Fork the Project
2. Create your Branch
3. Commit your Changes
4. Push to the Branch
5. Open a Pull Request

## Contact

Jiun Kim -
Project Link: [https://github.com/jiun0507](https://github.com/jiun0507)

[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=flat-square
[contributors-url]: https://github.com/othneildrew/Best-README-Template/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=flat-square
[forks-url]: https://github.com/othneildrew/Best-README-Template/network/members
[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=flat-square
[stars-url]: https://github.com/othneildrew/Best-README-Template/stargazers
[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=flat-square
[issues-url]: https://github.com/othneildrew/Best-README-Template/issues
[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=flat-square
[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/othneildrew
[product-screenshot]: images/screenshot.png


text:
# Angular dialogs
## An easy-to-use AngularJS service for using dialogs.
Pure AngularJS component for using dialogs.
This service has been tested using Twitter Bootstrap 3.3.5, AngularJS 1.5.5 and Angular-UI-Bootstrap 2.5.0.

## Content
+ [Getting Started](#getting-started)
+ [Examples](#examples)
+ [Supported types of dialogs](#supported-types-of-dialogs)
+ [Available options](#available-options)
+ [Changelog](#changelog)

## Getting Started
+ Install with bower (comming soon), `bower install angular-dialogs --save`

+ Or download the [production version][min] or the [development version][max] for JavaScript files, and the [production version][min2] or the [development version][max2] for the CSS stylesheets.

[min]: https://raw.githubusercontent.com/fikipollo/angular-dialogs/master/dist/angular-dialogs.js
[max]: https://raw.github.com/mgcrea/jquery-bootstrap-affix/master/dist/angular-bootstrap-affix.js
[min2]: https://raw.githubusercontent.com/fikipollo/angular-dialogs/master/dist/angular-dialogs.min.css
[max2]: https://raw.githubusercontent.com/fikipollo/angular-dialogs/master/dist/angular-dialogs.css

In your web page:

```html
<link rel="stylesheet" href="/lib/bootstrap.min.css">
<link rel="stylesheet" href="/lib/angular-dialogs.min.css">

<script type="text/javascript" src="/lib/angular.min.js"></script>
<script type="text/javascript" src="/lib/ui-bootstrap-tpls.min.js"></script>
<script type="text/javascript" src="/lib/angular-dialogs.min.js"></script>

<script type="text/javascript" src="app.js"></script>
```

And in your app.js:
```javascript
var app = angular.module('myApp', ['ang-dialogs']);
```

## Examples
A simple example of the usage would be:

```javascript
var app = angular.module('myApp', ['ang-dialogs']);
app.controller('myController', function ($dialogs) {
	this.foo = function(){
		$dialogs.showInfoDialog("This is a dialog!", {
			title: "Hello world!",
			closeTimeout: 10
		});
	}
}
```

You can find a bunch of more complete examples here.

## Supported types of dialogs
This service includes some predefined dialogs that you can use, however many options are available for customizing your dialogs.
As a general rule, for showing a dialog, you should call to the corresponding function (depending on the type of dialog to show). This functions accept two parameters: the __message__ that will be displayed in the body of the dialog, and some __options__ that help you to change the default behaviour (an object, optional).
```javascript
$dialogs.showTypeOfDialog("My message", {option1:"value1", option2:"value2"})
```

#### Default dialogs
A simple dialog with a message, no colors.
```javascript
$dialogs.showDefaultDialog("AngularJS rocks!", {title: "Hello"});
```

#### Confirmation dialogs
A Yes/No dialog with a message. Many options are available to change the default appearance (e.g. the text for the buttons), and a callback function can be specified which will be executed when the user chooses an option.
```javascript
$dialogs.showConfirmationDialog("Please confirm", {
	title: "Are you sure?",
	callback: function(option){
			alert("Selected option was '" + option + "'");
	}
});
```

#### Success dialogs
A simple success message. Again, using options you can change the default appearance and behaviour (e.g. an auto-close countdown).
```javascript
$dialogs.showSuccessDialog("The process finished successfully.", {
	closeTimeout: 10
});
```

#### Info dialogs
A dialog showing some useful information.
```javascript
$dialogs.showInfoDialog("This is an important message.", {
	buttonCloseText : 'OK, I understand.'
});
```

#### Wait dialogs
A wait dialog with an animated loading icon. These dialogs do not show any button by default (but could be added). You can programmatically close them using the _closeDialog_ function (see below).
```javascript
$dialogs.showWaitDialog("Loading your data...", {
	title: "Your request is being processed.",
	icon: "glyphicon glyphicon-time"
});

//Close the dialog after 10 seconds
setTimeout(function(){
	$dialogs.closeDialog(); //This will close the last opened dialog
}, 3000);
```

#### Warning dialogs
A dialog showing some warning information.
```javascript
$dialogs.showWarningDialog("It's time to go home"});
```

#### Error dialogs
A dialog showing error messages. Using the available options you can change the default appearance and behaviour (e.g. adding a "Report" button that could send the error message to the developers).
```javascript
$dialogs.showErrorDialog("An error occurred. Please send the report.", {
	title: "Damn it, error detected!",
	reportButton: true,
	reportButtonHandler: function(){
		foo();
		alert("Your report has been sent. Thanks!");
	}
});
```

#### Other dialogs
If none of the previous functions fits to you, you can open a dialog using the following function:
```javascript
$dialogs.showMessage(message, options);
```

# Available options
These are the available options that you can use for customizing your dialogs. All options are optional and default values will be used if not present.

 - **messageType** (string): accepted values are: "default" "info" "confirmation" "success" "warn" "error" and "wait". The type of message. This option is predefined depending on the function that you use for showing the dialog (e.g. if you use _showErrorDialog_, the type would be _error_).

 - **title** (string): the title for the dialog.

 - **callback** (function): the function that is executed when the dialog is closed. The function is called using the selected option (button) pressed by the user.
 ```javascript
  callback: function(option){
		if(option === "ok"){
			foo();
		}else{
			foo2();
		}
	}
```
 - **logMessage** (string): a custom message to print at the JavaScript console. Depending on the type of message, the message will be printed using different outputs (error console, log, etc.). By default the log message will be the same message shown in the dialog body.

 - **button** (boolean): show or hide the buttons (OK, Cancel or Close). Default _true_ for most types of dialogs.
 - **reportButton**  (boolean): show or hide the "Send report" button. Default _false_.

 - **reportButtonHandler** (function): the function to be called when pressing the report button.
 - **buttonReportText** (string): The text shown in the report button.
 - **buttonOkText** (string): The text shown in the OK button.
 - **buttonCancelText** (string): The text shown in the Cancel button.
 - **buttonCloseText** (string): The text shown in the Close button.

 - **spin** (boolean): display a spinning icon (ideal for waiting dialogs). Default: true for waiting dialogs, false for other types.

 - **icon** (string): icon showed in the dialog title. Use a Bootstrap valid glyphicon class (e.g. "glyphicon glyphicon-time").

 - **closable** (boolean): determines if the dialog should be closed when clicking in the backdrop. Default: false.

 - **closeTimeout** (number): number of **seconds** to wait until auto-close  the dialog. Default: undefined (i.e. disabled).

## Changelog
### v0.93
* Added auto-close for dialogs (countdown)
* New options for customizing the text for buttons.
* Handler for the report button
* Improved examples
* Improved documentation

### v0.92
* Close dialogs -> close most recent dialogs, close by id or close by type
* Added spinning icon for wait dialog

### v0.91
* Wait dialogs and spinning icons

### v0.9
* First public version.
* Supports different types of dialogs: default, confirmation, success, info, warning and error dialogs.
* Supports some configurations: title, message, icon, buttons,...

repository: siddmegadeth/angular-dialogs

repo_name: siddmegadeth/angular-dialogs


text:
# Image Classifier

Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smartphone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall application architecture. A large part of software development in the future will be using these types of models as common parts of applications.

In this project, you'll train an image classifier to recognize different species of flowers. You can imagine using something like this in a phone app that tells you the name of the flower your camera is looking at. In practice, you'd train this classifier, then export it for use in your application. We'll be using this dataset of 102 flower categories.

When you've completed this project, you'll have an application that can be trained on any set of labelled images. Here your network will be learning about flowers and end up as a command line application. But, what you do with your new skills depends on your imagination and effort in building a dataset.

# Requirements
 ## Programming language
  - [Python (v3.7)](https://www.python.org/)

 ## Packages
  - [Numpy](https://numpy.org)
  - [Pandas](https://pandas.pydata.org/)
  - [MatplotLib](https://matplotlib.org/)
  - [PIL(Python Imaging Library)](https://pillow.readthedocs.io/en/stable/reference/Image.html)
  - [JSON(Javascript Object Notation)](https://www.json.org/json-en.html)
  - [Pytorch(v0.4.0)](https://pytorch.org/docs/0.4.0/)

  The best and recommended option to get all packages and python programming language is to download and install Anaconda [here](https://www.anaconda.com/distribution/).   Anaconda comes preinstalled with [Conda](https://conda.io/en/latest/); an open-source package manager that helps you find and install packages.

  To manage(install, update, remove, etc..) all packages directly except Pytorch , please reference these Conda commands [here](https://conda.io/projects/conda/en/latest/commands.html).

  All except Pytorch does not come preinstall with Anaconda or can't be managed directly with Conda.

  **After successfully downloading and installing Anaconda:**
  - Go to [PyTorch's site](https://pytorch.org/) and find the *QUICK START LOCALLY* section.
  - Specify the appropriate configuration options for your particular environment.
  - Run the presented command in the terminal to install Pytorch.

# Viewing the Jupyter Notebook
As specified under *Accessing Individual Folders of the Repository* [here](https://github.com/Besong/Data-Science-Portfolio/blob/master/README.md/), it is very much better to work and view the jupyter notebook using [jupyter nbviewer](https://nbviewer.jupyter.org/). This simply requires you to cut and paste the path of the notebook on the website.

Alternatively, read through *Accessing Individual Folders of the Repository* [here](https://github.com/Besong/Data-Science-Portfolio/blob/master/README.md/) to clone the project locally.

Using the command `jupyter notebook` on the command line, open jupyter notebook and locate project notebook and run it.

# Command Line Application
- Train a new network on a dataset with `train.py`
  - Basic Usage : `python train.py data_dir`
  - Prints out current epoch, training loss, validation loss, and validation accuracy as the network trains
  - Options:
    - Set directory to save checkpoints: `python train.py data_dir --save_dir save_dir`
    - Chose architecture(densenet121, vgg16 and vgg19 available): `python train.py data_dir --arch "vgg16"`
    - Set hyperparameters: `python train.py dat_dir --learning_rate 0.001 --hidden_units 512 --epochs 20`
    - Use GPU for training: `python train.py data_dir --gpu`

- Predict flower name from an image with predict.py along with the probability of that name. That is, you'll pass in a single image `/path/to/image` and return the flower name and class probability.
  - Basic Usage : `python predict.py /path/to/image checkpoint`
  - Options:
    - Return top **K** most likely classes: `python predict.py input checkpoint --top_k 3`
    - Use a mapping of categories to real names: `python predict.py input checkpoint --category_names cat_to_name.json`
    - Use GPU for inference: `python predict.py input checkpoint --gpu`

# Json File
For the network to print out the name of he flower, a *.json* file is required.  By using a *.json* file, the data can be sorted into folders with numbers, with those numbers corresponding to specific names specified in the *.json file*

# Data
The data used for this project are a flower database, not provided in this repository as it is larger than what gihub allows. But, you can create your database and train the model on them to use with with your own projects.

***Structure the data in folders and proportions respectively as follows:***
- train(70%)
- test(20%)
- validate(10%).

Inside each folder, there should be folders bearing a specific number which corresponds to a specific category; clarified in the json file. E.g, if we have an image *r.jpg* and it is a rose, it could be in a path like this */train/4/r.jpg* and the json file would be like this *{..., 4:"rose", ...}*.

Make sure to include alot of photos for each category(more than 10) with different angles, lightening conditions inorder for the network to generalizee better.

# Working with train.py
As you can see in the *Command Line Application* Heading of this *Readme*, training the model is performed when the *train.py* python file is executed, with its optional multiple hyperparameters.

***Here are some hints on choosing the right hyperparameters to take note when training the model:***

- **Number of epochs:** Increasing the number of epochs, causes the accuracy of the network on the training set to get better and better. However, picking large numbers of epochs won't generalize  the network well, i.e, it won't perform well on the test images rather it will on the training images.
- **Learning rate:** Choose the appropriate learning rate for the network to converge steadily to a small error without overshoting, thus reaching greater accuracy.
- **Architecture for model used:** Vgg16 or Vgg19 takes a shorter time to train compared to Densenet121. However, Densenet  works best with images.
- **GPU:** Becuase of the network use of complex deep convolutional neural network, the training process is impossible to be done by your desktop or laptop. In order to train your network on your local machine efficiently, you have three options:
    1. **Cuda.** If you have an NVIDIA GPU then you can install CUDA from [here](https://developer.nvidia.com/cuda-downloads). With Cuda you will be able to train your model, however the process will still be time consuming.

    2. **Cloud Services.** [AWS](https://aws.amazon.com/) or [Google Cloud](https://cloud.google.com/) are a few of many paid cloud services that lets you train you models.

    3. **Google Colab.** [Google Colab](https://colab.research.google.com/notebooks/welcome.ipynb#recent=true) gives you free access to a tesla K80 GPU for 12 hours at a time. Once 12 hours have ellapsed you can just reload and continue!. The only limitation is that you have to upload the data to Google Drive and if the dataset is massive, you may run out of space.

# Working with predict.py
Once the model is trained, then normal CPU can be used for the *predict.py python file* and you will have an answer within seconds.

The *checkpoint.pth file* contains the information of the network trained to recognise 102 different species of flowers. It has been trained with specific hyperparameters, thus if you don't set them right, the network will fail. In order to have a prediction for an image located in the path */path/to/image* using my pretrained model, you can simply type `python predict.py /path/to/image checkpoint.pth`

# Authors
- **Besong** - Initial work
- **Udacity** - Final Project of the AI with Python Nanodegree

Full Curriculum for Nanodegree is available [here](https://www.udacity.com/course/ai-programming-python-nanodegree--nd089)

repository: Besong/Data-Science-Portfolio

repo_name: Besong/Data-Science-Portfolio


text:
# docker-stacks-fake

**The offical** is https://hub.docker.com/r/jupyter/base-notebook/.

The Image provided by [the Official](https://github.com/jupyter/docker-stacks) may work fine for you. But it seems too large for me.  So I change the base image to alpine.


text:
# Thank you

* [Ioan Chiriac](https://github.com/ichiriac):
  Creator of [php-parser](https://github.com/glayzzle/php-parser), without which this utility wouldn't be possible.
* [Rubens Mariuzzo](https://github.com/rmariuzzo):
  Creator of [php-array-parser](https://github.com/rmariuzzo/php-array-parser), which is the starting point of this package.

repository: bartvanraaij/php-array-reader

gha_language: JavaScript

repo_name: bartvanraaij/php-array-reader


text:
# Simple Icons

Free SVG icons for popular brands, started by [Dan Leech](https://twitter.com/bathtype). [See them all on one page at **simpleicons.org**](https://simpleicons.org). Contributions, corrections & requests can be made on GitHub.

## Usage

Icons can be downloaded as SVGs directly from [our website](https://simpleicons.org/) - simply click the icon you want, and the download should start automatically.

### Node Usage

The icons are also available through our npm package. To install, simply run:

```
$ npm install simple-icons
```

The API can then be used as follows:

```javascript
const simpleIcons = require('simple-icons');

console.log(simpleIcons['Google+']);

/*
{
    title: 'Google+',
    hex: 'DC4E41',
    source: 'https://developers.google.com/+/branding-guidelines',
    svg: '<svg aria-labelledby="simpleicons-googleplus-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>'
}
*/
```

repository: DoronBrayer/simple-icons

branch_name: refs/heads/develop

repo_name: DoronBrayer/simple-icons


text:
# Build fleet-ui docker image

This a 'builder' image to build [purpleworks/fleet-ui](https://github.com/purpleworks/fleet-ui.git). If you forked the repo, change the Dockerfile's ENV FLEETUIREPO to reference your forked repo.

## Quick start

	docker pull xuwang/docker-fleetui-builder
	docker run --rm  -v /var/run/docker.sock:/var/run/docker.sock xuwang/docker-fleetui-builder:latest

  The result image is called _fleet-ui:latest_ which you can run in a container, or tag and push to a dockerhub.

## Run the fleet-ui on CoreOS

Here is an example of how to [Run fleet-ui on CoreOS.](https://github.com/xuwang/coreos-docker-dev/blob/master/README-fleet-ui.md)

## Build it yourself

If you want to build everything yourself, clone the builder repo from [docker-fleetui-builder](https://github.com/xuwang/docker-fleetui-builder).
Make any changes you want to put in builder image in Dockerfile, and you can also override the default fleet-ui repository and fleetclt version in build.sh.
After the customization:

	./build.sh

It builds two images. The first one is _fleet-ui-builder_, and then the script calls it to build _fleet-ui_.

## How does it work

The builder Dockerfile creates an isolated docker enviromment, with the software packages and docker daemon installed. The result
image is called _fleet-ui-builder_ which, when run, will build _fleet-ui_ docker image. _fleet-ui_ image is the one you will run or push to your dockerhub account to share.

The builder environment includes:

* golang 1.4
* npm, ruby, gem etc.
* docker from Debian/Wheezy release
* fleetctl 0.9.1
* fleet-ui binary compiled from repo defined at the top of the Dockerfile

The builder image can be removed when you are sure you have a good fleet-ui image:

	docker rmi fleet-ui-builder:latest

## Troubleshoot

If you have problem with the fleet-ui, you can debug your build environment by run the builder image:

	docker run --rm -i -t fleet-ui-builder bash

The fleet-ui source code downloaded by Go is located at /gopath directory:

![fleet-ui src tree](https://github.com/xuwang/docker-fleetui-builder/blob/master/images/fleet-ui-src.png "fleet-ui src tree")

Then you can manually run steps in the builder Dockerfile for troubleshooting issues.

repository: xueshanf/docker-fleetui-builder

gha_language: Shell

repo_name: xueshanf/docker-fleetui-builder


text:
---
title: Product Types
description: Zen Cart Product Types Admin Page
category: admin_pages
weight: 20
---

This page allows you to view and edit product types.

What are the product-type options for in the Admin area?

When you go to the Admin > Catalog > Categories/Products you have a list of your categories. Beside the New Product button is a pulldown menu. Whatever product type you select from this menu before clicking New Product is the type of product you will create.

Each product type collects certain kinds of information relevant to that product. Each product type has a different display of content in the store (ie: music shows a bit different than other products, and also allows the attaching of MP3 clips in the media manager, etc - all of which are displayed on the music product automagically, but not on a T-Shirt, for example).

In the Admin > Catalog > Product Types menu, there is a listing of product types. For each product type, you can

- select the default settings for entry of new products of that type
- choose how fields are displayed

This capability to set defaults and appearance on a per product type basis is provided through the [Layout Settings](/user/admin_pages/catalog/product_types_edit_layout) screen.

If you are a developer, see [technical information on product types](/dev/code/product_types).

repository: AmoureuseDesetoiles/documentation

repo_name: AmoureuseDesetoiles/documentation


text:
LibphonenumberAPI - A web server based on Googles phone number library.
=============
The aim of this project is to provide a web server that allows user to send GET and POST request
across a web server to access Googles libphonenumber API.

### How to initilize the library?
#### NPM Install
Use the node package manager to install the necessary node modules

```sh
$> npm install
```
#### Starting the server
To start the server  run the node.js server.

```sh
$> node app.js
```
#### Sending GET request
GET request can be made directly through the url.Try the following url.
```sh
http://localhost:3000/api/phonenumbers/parse/text/Seneca%20Phone%20Number%20416-491-5050
```
#### Making a POST request
POST request can be made through third party plug ins like POSTMAN.
Try posting the following
```sh
http://localhost:3000/api/phonenumbers/parse/
```

repository: buttersnipps/libphonenumberAPI

repo_name: buttersnipps/libphonenumberAPI


text:
a69 downloader
==============

This script fits the following very simple structure (customizable)

        BASEURL/palco.php?id=NUMBER&directory=annunci/TYPE/NAME&currentPic=1
            /                          /  \
           /                          /    \
      ../NAME/EVERYTHING.jpg         /     ...(etc)
                                    /
                                 (next: currentPic=2)
                                       \
                                        \
                                     (next: currentPic=3)

As you can see, it is enough to increase the *selector*
`currentPic`, but doing so we cannot know if we reached the last
one. When you ask for a picture that does not exist, maybe you get no
error, but you will get another page that can resemble to the one where
you find images you want... Even if you can identify a wrong page and so
stop increasing the counter for `currentPic`, in this way you make a
request to the site you can avoid; and since surfing the site it's
impossible to select a `currentPic` greater than the number of existing
images, you leave a clue to the webmaster saying a bot surfed in the
site. This could be a problem, especially if you want to get a lot of
these pages, resulting in a great number of wrong requests!

The NUMBER and the NAME must be given from the command line, e.g.

    $ ./a69.sh 25043 maon

You can collect NUMBER and NAME automatically of course, or just select
them by hand... As usually customization is up to you.

repository: shintakezou/miscellanea

repo_name: shintakezou/miscellanea


text:
# Sequence Component

The Sequence Component is a standalone application that can load scripts and become a Sequencer.
The Sequence Component application and its arguments are described @ref[here](../../apps/sequencer-app.md).

The Sequence Component is written in Scala to provide integration with the CSW Component Framework and Services. Since component
developers do not need to modify Sequence Component code, there is no Java version.

The Sequence Component registers itself with the Location Service when started. This allows the Sequence Manager to
find the Sequence Component and send it commands. Sequence Component is started with a Subsystem and an optional name.
While the Subsystem for a Sequence Component identifies to which subsystem the Sequence Component belongs, a Sequence
Component can load Scripts for any subsystem, and therefore become a Sequencer for any subsystem.  For example, if for
some reason the IRIS Sequence Component is not reachable, an IRIS Script can be loaded into an ESW Sequence Component
and it can then be used as the IRIS Instrument Sequencer.

The following table describes the registration of a Sequence Component in the Location Service

| Subsystem | Name | Registered Location |
|:---------:|:----:|:-------------------:|
| ESW | (none) | ESW.ESW_77 |
| ESW | primary |  ESW.primary |

Note that CSW always capitalizes a subsystem when it is displayed. Arguments can be entered as lowercase.

The Sequence Component provides framework code to support the loading and unloading of Scripts and a few other
useful capabilities.

| Message | Description |
|:-------:|:----------|
| LoadScript| Load a script in the Sequence Component to create a Sequencer. Takes a subsystem and observing mode as arguments. |
| UnloadScript|Unloads a loaded script returning a Sequence Component. |
| Restart | Unloads and reloads a script causing initialization of state. |
| GetStatus | Returns the Location of the Sequence Component's loaded Sequencer |

For more details on the messages handled by the Sequence Component see [here]($github.base_url$/esw-ocs/esw-ocs-api/jvm/src/main/scala/esw/ocs/api/actor/messages/SequenceComponentMsg.scala)

## Sequence Component Technical Design

This section will be updated with the Sequence Component technical design information in a future release.

repository: scala-steward/esw

gha_license_id: NOASSERTION

repo_name: scala-steward/esw


text:
# Building Documentation

A basic python environment with packages listed below is enough to build the docs.

```aidl
pip install nbsphinx
pip install sphinx_rtd_theme
```

##Run makefile

```aidl
make html
```

Outputs to `build/html/index.html`

repository: dillon-cullinan/clx

repo_name: dillon-cullinan/clx


text:
  Tundra

The comprehensive template engine for Nodejs.

Tundra is a small, fast, customizable and easy to use template engine. It perfectly integrates with any back-end made in Js, even pure Nodejs.

## Features

* Easy to learn and lightweight.

* Standard library with useful functions.

* Customizable syntax.

* Inheritance capabilities.

* Reusable code blocks.

And **much** more...

## Code snippets

```html
{{ print_variable }}

{! print_variable_without_escaping_it !}

{# comment #}

{% var code_inside_this_tags = true %}

~{{ escape_template_tags }}

@require(imported_view.html)

@spread(hello)

{[ spread hello ]}
{[ endspread ]}

@extends(parent_view.html)

{[ block name ]}
    {[ parent block_name ]}
{[ endblock ]}
```

## Example

Rendering a view in pure Nodejs web server is this simple:

```js
var http = require('http');
var Tundra = require('tundrajs');
var view = new Tundra();

http.createServer((req, res) => {
    view.render(res, '<p>{{ msg }}<p>', {
        msg: 'Hello World!',
    });

    res.end();
}).listen(8080);
```

## Tests

To run the test suite, follow these steps:

1. Open your terminal and move to your Tundra folder.

2. Run `npm update --save-dev` to install the dependencies.

3. Run `npm test`.

## Documentation

The documentation is available at the [wiki page](https://github.com/Usbac/tundra/wiki).

* [General usage](https://github.com/Usbac/tundra/wiki/General)

* [Standard library](https://github.com/Usbac/tundra/wiki/Standard-library)

* [Syntax](https://github.com/Usbac/tundra/wiki/Syntax)

* [View inheritance](https://github.com/Usbac/tundra/wiki/Syntax)

## VSC Extension

There's a syntax highlighting extension of Tundra available for Visual Studio Code, download it here:

### [Tundra - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=usbac.tundra)

## Contributing

Any contribution or support to this project in the form of a issue, pull request or message will be highly appreciated. ❤

You can read more about it [right here](CONTRIBUTING.md). Don't be shy :)

## License

Tundra is open-source software licensed under the [MIT license](https://github.com/Usbac/Tundra/blob/master/LICENSE).

repository: Usbac/tundra

repo_name: Usbac/tundra


text:
---
layout: page
title: Joining Votes and topics
date: 2016-08-28 12:49:19 -0700
position: 11
---

## Goals

Topics

id

title

description

Votes

id

topic_id

Because there is an explicit relationship between a topic and its votes, we need to specify that. In this step, we'll explicitly declare the relationship between votes and topics.

# Steps

## Step 1: Teach the Topic model about Votes

Open the file `web/models/topic.ex`, and add a line after `timestamps` that says `has_many :votes, TestApp.Vote`. Then remove the line that says `field :topic_id, :integer`. That section of code should look like this when you're done:

```
schema "topics" do
  field :description, :string
  field :title, :string

  timestamps

  has_many :votes, TestApp.Vote, on_delete: :delete_all
end
```

## Step 2: Teach the Vote model about Topics
Edit the schema block of `web/models/vote.ex` so that it looks like this:

```
  schema "votes" do
    timestamps
    belongs_to :topic, TestApp
  end
```

## Step 3: Play around with Topics and Votes in `iex`

First, make sure you've made at least one topic on the site.

Next, open an iex console in a terminal window:
```
iex -S mix
```
Expected result:
```
iex -S mix
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Compiled web/models/topic.ex
Compiled web/models/vote.ex
Compiled web/controllers/topic_controller.ex
Interactive Elixir (1.2.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
```
The lines that start with `Compiled` may be different in your output.

At the console, try the following things

See how many topics exist:
```
iex(1)> TestApp.Repo.aggregate(TestApp.Topic, :count, :id)
```

It should give you something like this:
```
[debug] QUERY OK db=8.1ms queue=2.2ms
SELECT count(t0."id") FROM "topics" AS t0 []
1
```

Save the first topic into a variable:
```
my_topic = TestApp.Repo.one(TestApp.Topic)
```
my_topic here could have been any variable name, but we'll stick with my_topic for consistency.

Change the title of that topic to something else:
```
TestApp.Topic.changeset(my_topic, %{title: "Edited in the console"}) |> TestApp.Repo.update
```
Here we've introduced a powerful bit of syntax, the `|>`, or pipe operator. It takes the output of the preceding command and sends it to the next command. Here, you create a changeset, or a list of the changes you'd like to make in the first half of the line, and then the second half, sent those changes to the database.

Add a vote to that topic:
```
TestApp.Vote.changeset(%TestApp.Vote{}, %{topic_id: my_topic.id}) |> TestApp.Repo.insert
```

Here, we create a `Vote` changeset, and since we're creating it, we initalize it with `%TestApp.Vote{}`, and add the topic id. Then, we pipe that to the database with `TestApp.Repo.insert`.

See how many votes that topic has:

```
iex(6)> my_topic = my_topic |> TestApp.Repo.preload(:votes)
iex(7)> my_topic.votes |> length
```

Remove a vote from that topic:

```
[vote | _rest] = my_topic.votes
TestApp.Repo.delete!(vote)
```

## Explanation
`has_many` and `belongs_to`:

In Phoenix, relationships between models are called associations.
Associations (usually) come in pairs.
A topic will have many votes so we put `has_many :votes` in the topic model.
When you ask a topic for its votes, you get a list of votes for that topic.
A vote is for a particular topic, so we put `belongs_to :topic` in the vote model.
When you ask a vote for its topic, you get the topic for that vote.
It can still be important to clean up after yourself! `on_delete: :delete_all` on `has_many :votes` means when a Topic gets destroyed, all the votes that correspond to it will be destroyed, too. Without dependent :destroy, those votes would live on the database forever.

extension: markdown


text:
# Dictyosporium intermedium Subram. SPECIES

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hyphomycetes (New Delhi) 478 (1971)

#### Original name
Dictyosporium intermedium Subram.

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
---
title: "Branching off another branch in git"
date: "2019-01-15"
---

A git workflow problem recently surfaced on my team. We branched (let's call it branch B) off a branch (branch A) to keep working before A went into master.

To keep branch A & B up to date with master, we rebased master onto both A & B. This created conflicts between A & B when A went to master.

What would have worked a lot better was rebasing master only onto A, and rebase A onto B, like so:

![An ideal workflow for branching off branches in git ](http://static1.squarespace.com/static/554569a4e4b0b68214c1f5d9/55457b34e4b0fca745eb358d/5c3dfa66758d469a54f90d3c/1547565680739/Screenshot+2019-01-15+10.13.54.png.54.png?format=original)

If you follow the above flow, you’ll get a clean merge of B once A is on master.

repository: ianmcnally/ianmcnallydotme

repo_name: ianmcnally/ianmcnallydotme


text:
# React Questions

### What is the Virtual DOM and what does React use it for?

The Virtual DOM is an abstraction of the DOM where corresponding properties are copied to a Javascript object. The Virtual DOM is much lighter than the actual DOM and is quicker to update. React (also Vue.js) uses the Virtual DOM to make comparisons between the Virtual DOM and the DOM to determine if its necessary to update the DOM therefore preventing unnecessary updates to the actual DOM.

### Why does React require the key property to be specified for certain components?

In React, the key property is used as the index of the specified component, further defining the component-to-DOM Element relation.  It is important the key always remains unique. Without the key property your React app could suffer from performance issues due to unnecessary re-renders.

### What's wrong with the ReactJS code below?
#### this.setState({ score: this.state.score - 1 })

this.state is always equal to the state last rendered and should not be trusted to hold the correct immediate state. It is best to use the prevState arg passed by this.setState. Ex. this.setState((prevState) => {})

### What is a higher order component? Provide some examples.

Higher order components are a technique to reuse component logic without repeating code. Components that share same functionality can be extended from a higher order component to create composition and reusable code. One example is using a high order component to manage users authentication state and sharing that functionality among other components without having to repeat code.

### What is the difference between a presentational and a container component?

Most often, React high order components are used to separate presentational components from container components.

### In a React/Redux application, where do you make API requests to the backend?

In a React/Redux application where state functionality is separated in actions, reducers and views, the most appropriate place to make API requests would be in an action.

### Why is immutability important in React/Redux applications?

### Describe some strategies to improve the performance of React components.

Prevent unnecessary rerenders. Make sure children components are given a proper index.

### Describe some strategies to speed up webpack build times during development and production.

### Describe some tools, strategies and plugins to make webpack builds smaller.

### What is the purpose of the yarn.lock and package-lock.json files?

In order to get consistent installs across machines, Yarn and NPM need more information than the dependencies you configure in your package.json. Yarn / NPM needs to store exactly which versions of each dependency were installed.

### What happens if you don't handle a rejected promise in NodeJs? How can you debug this issue?

(node:48446) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:48446) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To debug unhandled rejections you can create a listener using `process.on('unhandledRejection')` to observer unhandled rejections.

• Always handle promise rejections. Listen to unhandled rejection events for crash reporting. And always use errors to reject promises in order to get stack traces!
• Always handle the error event for streams!
• Wrap JSON.parse() and any Sync() function in a try-catch block or inside a Promise. Well, in general any function that can throw errors.

### What happens if you don't handle the 'error' event in a NodeJs stream?

### Can JSON.parse() crash your application?

JSON.parse() should be wrapped in a try-catch block or inside a Promise to prevent your app from crashing. If the input string passed to the JSON.parse() function is not proper JSON the output will throw an error.

### Describe a way to handle a CPU-intensive task in NodeJs.

Node.js is single-threaded and therefore can pose a problem when running CPU-intensive tasks. To handle CPU-intensive tasks, Node has the ability to spawn multiple child processes by setting up a queue and a pool of workers.

### What happens when you invoke the following function?
#### async function() { return "hello" }

Async function generates a function that returns a promise.

function () { return new Promise(r => r("hello")) }

### How do you evaluate two promises in parallel in an async function?

### What are the main differences between a regular function and an arrow function?

repository: ryanpowszok/react-quiz

repo_name: ryanpowszok/react-quiz


text:
---
layout: post
title: "Raspberry Pi as NAS with Samba"
date: 2014-01-12 15:58
comments: false
tags: [raspberry, crashplan, samba, deluged, torrent, nas]
image:
  feature: background.jpg
---
This year I've bought a [Raspberry Pi](http://www.raspberrypi.org/). I've wanted to play with it for a long time, but it was one of these things you keep delaying as I wasn't sure what to use it for. After moving to London, and given that my NAS died, I found myself in need of a replacement, one that allowed me to install [Crashplan](http://www.code42.com/crashplan/) on it if possible (for cloud backup).

<!-- more -->

A commercial NAS unit was a no go even if they had support for Crashplan: they are quite expensive and my experience with Lacie units has not been the best. Having a desktop on 24/7 to manage backups would allow me to install Crashplan on it, but it seemed a waste of cpu and electricity. And here is when Raspberry Pi came to save the day: it can be used as a low power PC, but it has enough RAM and CPU to work as NAS and provide some other services. Low power consumption (some estimates are £5-10 per year) and my files are safe. Success!

As I write this I have my Raspberry Pi connected to 1 Tb storage, using [Samba](http://www.samba.org/) to allow access to the files across the network and backing up all my data via Crashplan. It can even serve videos to my TV via [DLNA](http://www.dlna.org/). It is not complex to do, but it required browsing a few articles online and putting together some information. In this post I summarise the steps on how to achieve this. I apologise in advance as the post has no images, which makes it a bit dry, but hopefully it is easy to follow.

# Requirements

To follow these steps you need:

* Raspberry Pi B with 8 Gb SD card. Take the B model as it has 512Mb of RAM (and you WILL need them). Also buy the SD card they sell, as it has the default operating system (Raspbian) preloaded. It saves time and problems.
* Seagate Backup Plus (1 Tb). This hard drive doesn't require an external power cable, it only uses 1 USB cable to connect it to the Raspberry unit, which makes it convenient.
* Power supply for Raspberry Pi. They sell one in their shop, but you can also use any mini USB power supply you have that follows their specifications.
* HDMI cable. To connect Raspberry Pi to a monitor during the initial setup.
* USB keyboard. For the first configuration steps.
* Network cable. You will have one USB port taken by the HD, so it's better to keep the other free for a keyboard and connect the Raspberry to the network by cable.

Once you have all the pieces, you can start. I have added references to the sources where I found how to set up the Raspberry in each section, but if you get stuck check [Stack Exchange](http://raspberrypi.stackexchange.com/) as they have a forum dedicated to Raspberry with a lot of useful information.

# Setup of Raspberry Pi

Raspberry has a helpful [guide to set up](http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf) the unit. If you bought the SD card with NOOBS preinstalled then you can skip the few first steps and go straight to the part talking about the first boot.

Basically, select Raspbian (the recommended OS for Raspberry, [Debian](http://www.debian.org/) based) and wait for it to be installed. It will take a while. Then you will be prompted to restart the unit. After rebooting Raspbian will automatically load a configuration menu, in which we will tweak some options:

* Option 1, expand filesystem. It is not needed in NOOBS but run it just in case
* Option 2, set a new password for the user pi. Given that we will log via ssh, you need this
* Option 8, in advanced options make sure that ssh is enabled. I also overclocked the unit (middle option) as it will be running quite a few services.

Once you are done, exit and reboot the unit. Then log into it and install [avahi](http://en.wikipedia.org/wiki/Avahi_(software)):

```bash
sudo apt-get install avahi-daemon
```

This will allow us to ssh to the Raspberry via the hostname *raspberrypi.local*, removing the need to keep track of its ip. Once installed, reboot again the unit and try to log into it via ssh:

```bash
ssh<EMAIL_ADDRESS>```

This is the recommended way to connect to the Raspberry Pi. You can remove the HDMI cable and the keyboard from the unit and use ssh from now on to operate on it.

Here is [another guide](http://www.howtogeek.com/138281/the-htg-guide-to-getting-started-with-raspberry-pi/) that can help you by covering areas that may not be clear.

# Raspberry as NAS

After setting our Raspberry Pi, we will turn it into a NAS system using Samba, so we can copy files across the network. This requires the external HD to be connected to the unit. There are a couple of step by step [guides](http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/) [available](http://www.makeuseof.com/tag/turn-your-raspberry-pi-into-a-nas-box/) which can help you through the process. The guides also mention how to use a second hard drive for local data redundancy. I only use one HD by now, but it can be a recommended step to ensure you don't lose data.

As per the guides, the HD is left in NTFS. It is slower than EXT4, but allows us to connect it to a Windows machine directly in case of need. To be able to use that filesystem we need some extra packages, installed via:

```bash
sudo apt-get install ntfs-3g
```

## Mounting the HD

The external hard drive (if you only use one) will be recognised as **/dev/sda1** by Raspbian. We need to mount it permanently in our filesystem. I chose to mount it in the folder */media/hd1*, by doing the following:

```bash
sudo mkdir /media/hd1
sudo mount -t auto /dev/sda1 /media/hd1
```
This creates the folder, and mounts the external HD into it. We now need to tell the system to mount the unit every time it boots. Edit *fstab*:

```bash
sudo nano /etc/fstab
```

and add the following line at the bottom:

```
/dev/sda1 /media/hd1 auto noatime 0 0
```

Save and you can restart the Raspberry Pi to check that the disk is mounted at */media/hd1*.

## Samba

We use a specific folder in the HD for our Samba share, so we can isolate the shared folder from other files we may want to store in the disk.

```bash
sudo mkdir /media/hd1/share
```

Install Samba, do a backup of the default configuration and edit it by running:

```bash
sudo apt-get install samba samba-common-bin
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
sudo nano /etc/samba/smb.conf
```

In the config file, uncomment the line:

```
security = user
```

and add at the bottom of the file:

```
[Share]
comment = My share
path = /media/hd1/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
```

I also took a page of this [guide](https://calomel.org/samba_optimize.html) on optimising Samba and replaced the *socket options* in the file by:

```
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
```

with the aim of improving performance.

The next step is creating a user that can access the share when connecting via the network. I created a user called *nas*, typing the password I chose when prompted:

```
useradd nas -m -G users
passwd nas
smbpasswd -a nas
```

Restart Samba:

```
service samba restart
```

and you should be able to access the share in your network by using the user *nas* and its credentials.

# Crashplan

Crashplan is my tool of choice for remote backups, sending the data in our NAS to the cloud. We will run it as a headless client, which means that we run the service in Raspberry but the client, which we use to configure the backup options, runs in another computer and connects via the network.

The service is a Java application, which means that we have to install the *jvm* into Raspberry Pi. Given that the Oracle implementation is much better than the OpenJDK one, the first step is to purge OpenJDK and install Oracle's Java, ensuring it is the default choice in the system:

```
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo apt-get install oracle-java7-jdk
sudo update-alternatives --list java
sudo update-alternatives —config java
```

At this point, we can follow the steps in [this guide](http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/) to install Crashplan in our Raspberry.  The guide also install Java 8, we skip that and go straight to point 8. I summarise the steps in here as a quick reference.

First [Download](http://www.crashplan.com/consumer/download.html?os=Linux) Crashplan for Linux, copy it to the Raspberry (via scp) and extract it there. Then run the installer:

```
sudo Crashplan-install/install.sh
```

Accept the license and select the default locations for the installation. Then you need to patch [libjtux](http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libjtux.so) and [md5 library](http://www.jonrogers.co.uk/wp-content/uploads/2012/05/libmd5.so) by downloading the linked files and copying them to */usr/local/crashplan/*.

You also need to install *libjna* for Java:
```
sudo apt-get install libjna-java
```

Once done, edit */usr/local/crashplan/bin/CrashPlanEngine* and find the line that begins with *FULL_CP=*, around the start case, and edit it so it looks like:

```
FULL_CP="/usr/share/java/jna.jar:$TARGETDIR/lib/com.backup42.desktop.jar:$TARGETDIR/lang"
```

The last step is to run the Crashplan engine at boot time by editing */etc/rc.local* and adding on the line above *exit 0*:

```
/usr/local/crashplan/bin/CrashPlanEngine start
```

Restart the unit and if everything worked when you run:
```
/usr/local/crashplan/bin/CrashPlanEngine status
```
you should see the service is running.

There is [a comment](http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/#comment-97) in the above guide that shows how to modify the swap to point to another file. There are two good reasons for this. First of all, the default swap in Raspberry is not much, and Raspbian may kill processes heavy in RAM when running low on memory, increasing the swap will avoid it killing Crashplan on a whim. Secondly, Java may do heavy use of the swap and thus shorten the life of the SD card by doing many writes to it, which we can fix by moving the swap to our external disk. I created a swap file in the external hd by following the instructions:

```
dd if=/dev/zero of=/media/hd1/swapfile bs=1M count=1024
mkswap /media/hd1/swapfile
chown root:root /media/hd1/swapfile
chmod 0600 /media/hd1/swapfile
swapon /media/hd1/swapfile
sudo apt-get purge dphys-swapfile
```

Then we apply this change on each boot by editing */etc/fstab* and adding to the bottom (to ensure the disk that contains the swap is mounted first):
```
/media/hd1/swapfile swap swap defaults 0 0
```

Restart the Raspberry and execute *free*. You should see a swap of 1Gb.

I won't enter into detail on how to connect a headless client as the [official guide](http://support.code42.com/CrashPlan/Latest/Configuring/Configuring_A_Headless_Client) explains it perfectly. Just remember that you will need to run the tunnel every time you connect via the client, and the tunnels timeout from time to time.

Now configure Crashplan to backup the files in */media/hd1/share* to their cloud and you are done.

There is an optional last step you can follow. The settings above should ensure that Crashplan is not killed by Raspbian, but this may happen. To fix this without us having to ssh into the box every day, I've added a *cronjob* that restarts the Raspberry every day at 2 am. If you are not a *crontab* expert you can see how to do this [in this stack exchange](http://raspberrypi.stackexchange.com/questions/2150/how-do-i-reboot-at-a-specific-time) question, just replace the *0,8* by a *2*. In my case 2am is not a time when I will be using the NAS, so a restart should not be an issue and it will ensure that any services that were killed are restarted accordingly.

# Torrents

We have a NAS backed up in the cloud. Given that it will be running 24/7, we can try to squeeze it a bit more by adding a torrent client to the box. That way you can download you latest Linux distro without having to keep your desktop on all night, Raspberry rakes care about it. There is a guide on how to [install deluge](http://www.howtogeek.com/142044/how-to-turn-a-raspberry-pi-into-an-always-on-bittorrent-box/) as a headless server, which we can then access via a remote client or a web interface.

To start, we install *deluged* and we run it so it creates the default config files:
```bash
sudo apt-get install deluged
sudo apt-get install deluge-console
deluged
```

Wait for a couple of minutes so all the files are created, and then kill the process:
```bash
sudo pkill deluged
```

Now we backup the authentication file and edit it to add a new user:
```bash
cp ~/.config/deluge/auth ~/.config/deluge/auth.old
nano ~/.config/deluge/auth
```

There you can add a user in the format *user:password:10*. The user and password don't need to match any existing user, they are the credentials you will use to remotely connect to the server via the client. Now we start the service again and we enter into the console:

```bash
deluged
deluge-console
```

In the console we run the following commands to allow for remote connections to the service:
```
config -s allow_remote True
config allow_remote
exit
```

And to apply the new configuration we restart the service:

```bash
sudo pkill deluged
deluged
```

The last step is to run *deluged* at boot time by editing */etc/rc.local* and adding on the line above *exit 0*:

```
/usr/bin/deluged
```

I won't explain how to connect via the client as the guide linked above has a complete explanation, with images, and it is quite straightforward. I just recommend you to only download 1 torrent at once and to set the destination folder for all the torrents to a path inside the *samba share*, so you can access it from the network. Just make sure Crashplan doesn't backup that folder. As we have plenty of memory in use in this Raspberry I've not installed the web interface as I thought it was of little benefit and we can use that RAM for other things.

# DLNA

Given the amount of storage in the NAS, we will probably keep plenty of photos and videos in it. We can install a [DLNA](http://www.dlna.org/) compliant server in our Raspberry that will index all the media files in our share and make them available to any DLNA compatible device: smartphones, laptops or TVs. We do this by installing *minidlna*, an open source implementation of the protocol.

The process, taken from [this guide](http://www.raspberrypi.org/phpBB3/viewtopic.php?t=16352), is extremely simple. Be aware that the guide does many other things we already took care of, just skip them and scroll down to the part that says *install minidlna*. In your Raspberry run:

```bash
sudo apt-get install minidlna
sudo update-rc.d minidlna defaults
```

With this minidlna is installed and ready to run when rebooting the unit. Modify the configuration by editing */etc/minidlna.conf* (as root). In the config, look for the following sections and update accordingly:

```
media_dir=A,/media/hd1/share/Music
media_dir=V,/media/hd1/share/Video
media_dir=P,/media/hd1/share/Photos

db_dir=/media/hd1/dlna

log_dir=/media/hd1/dlna
```

The media folders are an example, set them accordingly as per your *share* folder structure. The other two entries store minidlna metadata and logs in the external hd so we have enough room for them.

Restart the service via:

```
sudo service minidlna force-reload
```

And wait for the service to index all the files. It is quite fast, depending on how many media files you own, but until a file is indexed you won't be able to access it.

# Conclusion

You are done, you have a NAS with full cloud backup, torrenting capabilities and that can act as a media centre and show videos or photos in your TV. Congratulations! Enjoy it as much as I do enjoy mine :)

repository: pvillega/old-blog-source

repo_name: pvillega/old-blog-source


text:
# Snapper

### Haskell library for compressing / decompressing [snappy](http://google.github.io/snappy) encoded data.

[![Build Status](https://api.travis-ci.com/icicle-lang/snapper.svg?branch=master)](https://travis-ci.com/icicle-lang/snapper)

This package is much the same as the existing
[snappy](http://hackage.haskell.org/package/snappy) package on Hackage.
The main difference being that it includes the whole Snappy C++ library
so that it does not need to be install via `brew` or similar.

## API

Because of the way Snappy is used in the Hadoop ecosystem (i.e. small
length prefixed blocks) we don't have a need for anything fancier than
functions over a strict `ByteString`.

```hs
compress :: Strict.ByteString -> Strict.ByteString

decompress :: Strict.ByteString -> Maybe Strict.ByteString
```

repository: icicle-lang/snapper

repo_name: icicle-lang/snapper


text:
# Request Bin Client

[![codecov](https://codecov.io/gh/jaebradley/request-bin/branch/master/graph/badge.svg)](https://codecov.io/gh/jaebradley/request-bin)
[![Build Status](https://travis-ci.org/jaebradley/request-bin.svg?branch=master)](https://travis-ci.org/jaebradley/request-bin)
[![npm version](https://badge.fury.io/js/request-bin.svg)](https://badge.fury.io/js/request-bin)

[![NPM](https://nodei.co/npm/request-bin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request-bin/)

### Introduction
[Request Bin](requestb.in) is a pretty useful service (I've used it to test webhooks, for example) and it's [API](https://github.com/Runscope/requestbin/wiki/API) is relatively straight-forward, to boot!

Currently, there's a Request Bin client via the [`requestbin` NPM package](https://github.com/fvdm/nodejs-requestbin), however, it has a callback-based API while this client is `Promise`-based.

### Installation
Install via the [NPM package](https://www.npmjs.com/package/request-bin)

`npm install request-bin`

### API

#### `createBin`
* Creates a bin and returns a `Promise` containing bin details
* Takes an optional `isPrivate` parameter - the default value is `false`

```javascript
import { RequestBinClient } from 'request-bin';

// Prints public bin details
RequestBinClient.createBin().then(binDetails => console.log(binDetails));

// Prints private bin details
RequestBinClient.createBin(true).then(binDetails => console.log(binDetails));
```

#### `getBin(binId)`
* Returns a `Promise` containing bin details for a given `binId`

```javascript
import { RequestBinClient } from 'request-bin';

const binId = 'someBinId';

// Prints bin's details
RequestBinClient.getBin(binId).then(binDetails => console.log(binDetails));
```

#### `getRequests(binId)`
* Returns a `Promise` containing for HTTP request details for a specific bin

```javascript
import { RequestBinClient } from 'request-bin';

const binId = 'someBinId';

// Prints bin's requests details
RequestBinClient.getRequests(binId).then(requestsDetails => console.log(requestsDetails));
```

#### `getRequest(binId, requestId)`
* Returns a `Promise` containing details for a specific HTTP request made against a specific bin

```javascript
import { RequestBinClient } from 'request-bin';

const binId = 'someBinId';
const requestId = 'someRequestId';

// Prints request details for a specific request in a bin
RequestBinClient.getRequest(binId, requestId).then(requestDetails => console.log(requestDetails));
```

repository: jaebradley/request-bin

repo_name: jaebradley/request-bin


text:
# PSEasyAutolayouts

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

## Usage

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

## Requirements

## Installation

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

```ruby
pod "PSEasyAutolayouts"
```

## Author

Dahiri Farid<EMAIL_ADDRESS>
## License

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

repository: dahiri-farid/PSEasyAutolayouts

repo_name: dahiri-farid/PSEasyAutolayouts


text:
# Sample

The sample implements basic pipeline
```
FFmpeg input -> FFmpeg VAAPI decode -> OpenVINO™ inference
```
directly calling FFmpeg/libav and OpenVINO™ interfaces, without any dependency on Intel® Deep Learning Streamer (Intel® DL Streamer).
This sample demonstrates zero-copy buffer sharing FFmpeg->VAAPI->OpenVINO™, but it's not
optimized for performance. For more optimized version with multi-stream and batching support
please refer to sample `decode_resize_inference`.

## Build and Run

Use cmake build system or run the following script

```sh
./build_and_run.sh INPUT_VIDEO [MODEL]
```

repository: dlstreamer/dlstreamer

repo_name: dlstreamer/dlstreamer


text:
---
layout: post
status: publish
published: true
title: ZEND PHP 5 Certification Study Guide
author: SunSparc
author_login: SunSparc
author_email<EMAIL_ADDRESS>author_url: http://bluesunhosting.com/
wordpress_id: 309
wordpress_url: http://uphpu.org/2007/03/01/zend-php-5-certification-study-guide/
date: '2007-03-01 10:02:24 -0600'
date_gmt: '2007-03-01 16:02:24 -0600'
categories:
- Reviews
tags: []
---

I recently picked up a copy of the "ZEND PHP 5 Certification Study Guide" by php|architect.  I have not yet finished it, however thus far I have liked it enough to want to tell other people about it.

The book is around 250 pages long (short by most standards).  To this point I have found that this book is a good way to brush up on things I already knew and learn some things that I did not.  I am personally using the book to help me study for the PHP 5 certification.  However, certification or not, it is turning out to be an excellent tool for honing my skills.  It has the added benefit of showing me areas that I need to work on as well as indicating to myself how much about PHP I really know.

I would recommend this book to the PHP programmer of any level.

repository: uphpu/uphpu-website

gha_language: HTML

repo_name: uphpu/uphpu-website


text:
---
name: New Block Proposal
about: 'Anyone can propose a new block, component or layout for RDS. However, priority
  is for the Carleton community. '
title: ''
labels: ''
assignees: ''

---

## New block proposal

 For the best success, submissions should follow the proposal template below. You don't need to answer every question. But the expectations are to submit at least one answer per section

### Block purpose

- What is the block trying to accomplish?
- What are the expected user benefits/use cases?

### What problem is the block solving
- What is the problem? Executive summary in a paragraph (tweet).
- What are the main pain points?
- What happens if this block does not get created?

### Existing blocks
- Are there existing blocks that are close in functionality or solve a similar problem.
- Is it possible to solve the issue by extending an existing block? Create a new variant? Is it unique?
- Have you considered extending or adding features to an existing block

### Promote reuse
- Do you see this block being needed or used on multiple sites? It should have a use case in at least 2 unique web properties.

### UX familiarity
- Does this pattern exist in the wild? Include links to any examples.
- Do you have links to other sites solving this issue?

### Details
- Proposed block name/handle

If you have them.. attach images or include links to any examples, research or code to support your proposal, if available. A mockup - can be a simple wireframe or full design (bas

repository: ravendesignsystem/rds

gha_language: Twig

repo_name: ravendesignsystem/rds


text:
# dsub

dsub is a class that builds upon .NET's built-in SerialPort class. It adds functionality to deal with multi-threading, error-handling, etc.

It is based on what I've learned from Jan Axelson's book [Serial Port Complete Second Edition](http://janaxelson.com/spc.htm) and the sample applications available on her website. If you're interested in learning more about Serial Ports and/or using them in .NET, I highly recommend checking out her book and website.

dsub uses SerialPort.ReadLine(), so it's required that any data being received has a defined "end of transmission" character, such as a carriage return or line feed. If you have a situation where there isn’t a defined end of transmission character, then dsub won’t work.

## Getting Started

To use dsub, just add the [ComPort class](/Dsub/ComPort.cs) to an existing application.

## Compatibility

dsub targets .NET Framework 4.7 / C# 7.0. As a result, it's compatible with Windows 7, 8.1 and 10.

If you need compatibility with older versions of Windows, you can use the [net40 branch](https://github.com/swvincent/dsub/tree/net40) which targets .NET Framework 4.0. The code is a little messier but it provides the same functionality as the master branch.

## Example Application

The GUI application that’s included will read data from the selected serial port and display it in a grid. If a field delimiter is specified, it will use that to break up the data into separate columns in the grid. At the bottom of the screen, you can enter text to be sent. There is also a textbox where errors will be displayed. The application implements all the features of dsub so it provides a good example of how to use it.

## License

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

## Acknowledgments

* [Jan Axelson's Serial Port Central](http://janaxelson.com/serport.htm) contains lots of great information.
* [Com Ports - Technical Information](https://www.developerfusion.com/article/22/com-ports-technical-information/) was used as a reference for several serial port settings.
* [Kean](http://www.kean.com.au/) provided valuable feedback on an error message.

repository: swvincent/dsub

repo_name: swvincent/dsub


text:
# Entanglement

Entanglement is the process of moving, copying, and linking domain objects
in such a way that their relationships are impossible to discern.

This bundle provides move, copy, and link functionality.  Achieving a state of
entanglement is left up to the end user.

## Services implement logic

Each method (move, copy, link) is implemented as a service, and each service
provides two functions: `validate` and `perform`.

`validate(object, parentCandidate)` returns true if the `object` can be
move/copy/linked into the `parentCandidate`'s composition.

`perform(object, parentObject)` move/copy/links the `object` into the
`parentObject`'s composition.

## Actions implement user interactions

Actions are used to expose move/copy/link to the user.  They prompt for input
where necessary, and complete the actions.


text:
# Procedure

### Abstract

The procedure is an abstraction to span time.

Asynchronous code is the source of procedures:

- Timeout callbacks.
- Consequence/promise callbacks.
- Asynchronous callbacks.
- Semi-asynchronous callbacks.
- Subprocesses.
- Workers.

All entities producing by-products and executed non-linearly could be spanned by procedures. Tracking procedures helps to find problems in source code, gives a higher level of control of code execution. The concept of the procedure has broad application.

![Procedure example](../../img/Intro.png)

The procedure can have an associated object, associated routine, and wait timer. The procedure has several states. The procedure resides in one or another namespace. The narrowest is thread namespace. Procedures can be organized in a hierarchy.

![Procedure example in Windows](../../img/WindowsActionsTitled.png)

Another well-known example is Windows action. Windows action is a interruptible and cancelable procedure of system-level.

### Lifespan and states

The procedure has several state automata.

Procedure lifespan is:

- Created( inited )
- Begun
- Ended( finited )

Created is the initial state and ended is the end state of the automata.

![Procedure life span](../../img/ProcedureLifeSpan.png)

After the procedure is ended, there is no transition back.

Also, the procedure can be active or inactive.

![Procedure activation](../../img/ProcedureActivation.png)

Inactive is the initial state. Multiple transitions in both directions are possible.

Also, some procedures could expose the procedure control interface to control their execution.

![Procedure control](../../img/ProcedureControl.png)

Interruptible procedures allow to pause or resume them. Cancellable procedures allow to cancel them. Routines `_.time.out` and `setTimeout` are examples of cancellable procedures.

![Namespaces](../../img/StateTransitions.png)

Above, you may see a diagram illustrating the transition between states. Call of `_.time.begin` creates, initializes, and begins procedure `timeOut1`. Activation of the procedure takes place 50us. Activation triggered by running callback of the timer, and after the callback is run, the procedure transits from `active` to `inactive` state after what it transits from `begun` to `ended` state. After getting in `ended` state procedure is removed from the register and is not available anymore.

### Associated object and associated routine

The procedure can have an associated routine. Running of associated routine transits the procedure from the inactive state to the active state. In the case of routine, it is its callback. There is no associated routine in the case of the subprocess. If a procedure is cancellable either interruptible, then it can have more then a single associated routine, one per each control transition.

The procedure can have an associated object. In the case of time, routine call associated object is the timer. In the case of consequence/promise method call, it could be that consequence/promise.

### Stack of active procedures

For tracking procedures activation in a semi-asynchronous code, the stack is useful. For truly asynchronous code, this stack is always going to have precisely one element because process activation cant happens while the current process is active. For semi-asynchronous code, its depth could vary.

![Active procedures stack](../../img/ActiveStack.png)

On the diagram above you may see that activation of the callback of `_.time.out` adds element on the top of the stack of active procedures, and deactivation removes it.

Don't confuse the stack with parenting of procedures.

### Namespaces and persistence

The procedure can exist in different namespaces:

- Threat namespace.
- Process namespace.
- System namespace.
- Global namespace.

The namespace of the next level includes the namespace of the previous. Each level has its own lifespan.

![Namespaces](../../img/Namespaces.png)

The most narrow lifespan is a thread. It exists while thread runs. Process namespace includes threads namespaces. Procedures of this level exist beyond a single thread. System procedure exists even after the end of the process in which it was created. Global procedures exist beyond the local machine in the cloud.

### Hierarchy and parenting

The procedure can produce another procedure. The first one becomes the parent of the second ( child ). That relation could be accounted for too.

![Namespaces](../../img/UnixProcessTree.png)

Logic behind parenting procedures could be similar to logic behind processes tree in unix.

### Implementation

Procedures in our implementation often have wait timer, which is required to hold exiting from the application if such procedure were not yet finished. Wait timer is a timer with infinity time out which exists while the procedure exists. In release build, we store all procedures in map with source path as key. The source path is the location where that process was created. Associated object and associated routine are stored in the procedure's structure.

Procedure activation tracking and the stack of active procedures are implemented. Procedure control is not implemented. Namespaces except for thread namespace and persistent procedures are not implemented. In our implementation, not each asynchronous callback has its own corresponding procedure.

### Application

The concept of the procedure has broad application. In the next paragraphs, few such are described.

Definition of very abstract pause/resume/cancel interface, homogenous across the application.

Managing a bunch of subtasks that could be in states: started/finished/paused. For example, test routines of test suite or tasks of continuous software development tools. If such a process is interrupted by a failure of any kind it is desirable to continue from the last running task, not from the beginning.

To determine the path to the current source file without tracing stack if `__dirname` is not available.

To monitor load and progress.

To expose events related procedure managing.

To hold exiting from the process procedure in the queue.

### Summary

- The procedure is an abstraction that makes the application more manageable and helps to find design problems.
- The procedure can be an active/inactive state.
- The procedure can be in the started/finished state. If the procedure is cancelable, it also can be in the canceled state. If the procedure is interruptible, it also can be in a paused/resumed state.
- Persistent procedures allow to continue application from point it was interrupted.
- Persistent procedures exist in the system, either global namespace.
- Procedures can be organized in a hierarchy.

repository: Wandalen/wProcedure

repo_name: Wandalen/wProcedure


text:
# (WARNING: REPO MOVED)

This repository has been moved to its own github organization repository https://github.com/peg-org where new development is occuring in conjunction of some
great php-gtk developers (as anybody who wants to join). This repository will be kept here for historical reasons, but once all people who starred and watched this
is watching the new repo https://github.com/peg-org/peg-src, this one may be deleted so pleas star and watch the new repo :)

peg
===

An extensible php extension code generator, that creates code binding C/C++ libraries.

repository: wxphp/peg

repo_name: wxphp/peg


text:
# IowaWildRedditBot
Reddit bot to post and update game threads to /r/IowaWild

**Setup Virtual Environment**

```
make init
```

or

```
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

For Windows Users:

```
python3 -m venv venv
./venv/bin/Scripts/activate
pip install -r requirements.txt
```
### Pre-Commit Hook

If you can run `make` the the `make init` will setup the pre-commit hook for you. Otherwise run:

`git config core.hooksPath .githooks`

### Run tests

#### Run Unit and Linting

From the root of your project, run:

```
tox
```

#### Unit

From the root of the project, run:

```
tox -e pytest
```

This will run unit tests and give you a coverage report of lines and branches.

### Run lint

From the root of the project, run:

```
tox -e pylint
```

repository: GarageParty/IowaWildRedditBot

gha_language: Python

repo_name: GarageParty/IowaWildRedditBot