text:
---
title: "Filter and sort a dynamically created table with Vanilla JavaScript"
date: 2019-08-25
tags:
  [
    Filter,
    Sort,
    ES6,
    Dynamic Table,
    Higher Order Functions,
    Vanilla JavaScript,
    Bootstrap,
    HTML5,
    CSS3,
    git,
    GitHub,
  ]
excerpt: "This mini Vanilla JS project is about dynamically creating a table, which is filterable and sortable. We managed to perform these operations by resorting to several amazing JavaScript higher-order functions."
---

Here is the [demo](https://alitursucular.github.io/filter-and-sort-dynamically-created-table-with-vanilla-javascript-demo/) and [GitHub repository](https://github.com/alitursucular/filter-and-sort-dynamically-created-table-with-vanilla-javascript-demo).

**Overview**

This mini Vanilla JS project is about dynamically creating a table, which is filterable and sortable. We managed to perform these operations by resorting to several amazing JavaScript higher-order functions.

From time to time, I enjoy dealing with this kind of projects because these kinds of functions are always handy when we are dealing with a larger project (as they are being part of it). Besides, once we shift our focus to mini-projects, we generally practice & improve our skills, discover extended use cases and produce our code in various forms. Before we jump into the code, let's list what we have in this mini Vanilla JS project:

- Dynamically creating a table using `order.js` as our data source.
- Making our table filterable
- Making our table sortable
- Informative _speech bubbles_ with some cool effects.
- Handling error & flashing `thead` on hover

_Note: This mini-project mainly focuses on JavaScript rather than the layout. We included Bootstrap, Font Awesome and several media queries just to have a clean UI. We will not be discussing those since it is not in the scope._

**Code Breakdown**

After creating our basic layout, let's continue with our data source, `order.js`. We have data in JSON format as if it's being fetched from an external source. In order to use our table data, we export the module, then import in `index.js` file.

Our _order.js_:

```javascript
export const orders = [
  {
    "orderId":<PHONE_NUMBER>601,
    "purchasedOn": "2019-06-05",
    "customerName": "Ralph Clark",
    "subtotal": "£200",
    "status": "pending"
  },
  ...
  ...
  ...
  {
    "orderId":<PHONE_NUMBER>620,
    "purchasedOn": "2019-01-21",
    "customerName": "Georgina Thompson",
    "subtotal": "£309",
    "status": "completed"
  }
];
```

And we import it as:

```javascript
import { orders } from "./orders.js";
```

> The static import statement is used to import bindings which are exported by another module. Imported modules are in strict mode whether you declare them as such or not. The import statement cannot be used in embedded scripts unless such script has a type="module".

As it is stated in [documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import), we include the _type_ to our script tag in HTML:

```javascript
<script type="module" src="js/index.js" />
```

**Speech Bubbles:**

Before we jump into the table creation, let's take a look at how we manage speech bubbles. We have two speech bubbles on our page. Their only responsibility is to point out an action that the user can take. The one points to the input field (on the left) only swings. However, the one on the right has two _EventListener_ s attached, _mouseover_ and the _mouseout_. Once mouseover event is triggered, we simply add a class to the _thead_ element of our table. This class makes a flash effect over _thead_ twice to inform users that they can sort those columns. Both swing and flash effects are coded in pure _CSS_ with the help of _@keyframes_.

**Creating Table:**

```javascript
orders.forEach(order => {
  const values = Object.values(order);
  let row = tbody.insertRow(-1);
  row.className = "order";

  for (const value of values) {
    let cell = row.insertCell();
    switch (value) {
      case "pending":
        cell.className = "text-warning order-item";
        break;
      case "processing":
        cell.className = "text-info order-item";
        break;
      case "completed":
        cell.className = "text-success order-item";
        break;
      default:
        cell.className = "order-item";
    }
    cell.innerHTML = value;
  }
});
```

The logic of the above code is as follows:

1. Loop through the imported data,
2. Make an array of values from each order (remember, each order has 5 key/value pairs),
3. Insert a new row to tbody as the last row and give a class name of _order_,
4. Loop through values of the current order, insert a cell for each, add their classes and, finally set the content.

Along with the logic, there is also a _switch statement_ in the for/of statement. That statement is responsible for the addition of proper UI classes. Since we know all _status types_ of orders, we style them accordingly. Lastly, other than Bootstrap text classes, we add an _order_ class for each row and _order-item_ class for each cell. These classes will be used in filter and sort functions.

**Filter Function:**

```javascript
let filterInput = document.querySelector(".filter-input");
const order = document.querySelectorAll(".order");

filterInput.addEventListener("keyup", () => {
  let criteria = filterInput.value.toUpperCase().trim();
  let j = 0;

  order.forEach(data => {
    thead.style.opacity = "1";
    err.style.display = "";
    speechBubbleRight.style.visibility = "";
    if (data.innerText.toUpperCase().indexOf(criteria) > -1) {
      data.style.display = "";
    } else {
      data.style.display = "none";
      j++;
      if (j === order.length) {
        thead.style.opacity = "0.2";
        err.style.display = "flex";
        speechBubbleRight.style.visibility = "hidden";
      }
    }
  });
});
```

The logic of the filter function is as follows:

1. Get the input element and every row that has order class within the HTML,
2. Convert to uppercase and remove white spaces,
3. Add an EventListener to the input and execute the filter function,
4. For each row: get innerHTML, convert to uppercase and look for a match (index) of the given input,
5. Add style of _display: none;_ for each mismatch. (We will use the help of this class in sort too)
6. If nothing matches, display the error message and hide the speech bubble on the right. (Since there is nothing to be sorted).
7. Reset these helper styles to defaults on each iteration.

**Sort Function:**

```javascript
let sortDirection;

th.forEach((col, idx) => {
  col.addEventListener("click", () => {
    sortDirection = !sortDirection;
    /** Remember:
     * We obtained all tr elements that has 'order' class before!
     * However, querySelectorAll returns a NodeList, not an Array.
     * While forEach method can be used on NodeLists, filter method cannot.
     * This is why we preferred to make this conversion below; where we actually need an array to filter.
     * Note: NoteList is very similar to array and easy to convert.
     **/
    const rowsArrFromNodeList = Array.from(order);
    const filteredRows = rowsArrFromNodeList.filter(
      item => item.style.display != "none"
    );

    filteredRows
      .sort((a, b) => {
        return a.childNodes[idx].innerHTML.localeCompare(
          b.childNodes[idx].innerHTML,
          "en",
          { numeric: true, sensitivity: "base" }
        );
      })
      .forEach(row => {
        sortDirection
          ? tbody.insertBefore(row, tbody.childNodes[tbody.length])
          : tbody.insertBefore(row, tbody.childNodes[0]);
      });
  });
});
```

For some reason, I enjoyed coding this sort function very much. Almost every approach on the internet is based on comparing one row after another in for and while loops (including w3schools). However, my approach was to chain _sort_ and _forEach()_ methods to get the desired output. Let's go over the function:

1. We have a _click_ EventListener for each _th_ element, so we would know which column to sort, (thanks to the _idx_ parameter)
2. On each click, we reverse the sort direction with the help of _sortDirection boolean_,
3. We make an array of rows that has 'order' class and whose style is NOT 'none'. (This is because the user may have filtered before and, wants to sort afterward).
4. Here comes the combined power of _sort_ and _localeCompare_. We pass a and b parameters as if they are two elements to be compared in the selected column. LocaleCompare accepts two strings to be compared. Therefore, we access the actual values for that row and return the result. It is important to note that, we added a couple more parameters to the localeCompare to have a proper working sort function. (`"en", { numeric: true, sensitivity: "base" }`).
5. Lastly, chained _forEach()_ method loops through each sorted row and inserts them one after another by moving the current node to a new position (depending on the sortDirection we set above).

_See my other posts: [Spotify Playlists Quiz with React](https://alitursucular.github.io/spotify-playlists-quiz-with-react/)_ and _[Fetching data from a RESTful API using Fetch API with React](https://alitursucular.github.io/fetching-api-data-with-reactjs/)_

**Further Developments**

- **Multiple filter arguments:** Our filter function looks for the exact match of the given input. For now, it is not a problem since our data set consists of only 15 rows. However, it can get messy. Let's assume that we need the id of customer James, who spent £380. Our best approach would be to type either _James_ or _£380_. Searching by James will return only 2 rows and, it easy to see which row has £380 in subtotal. However, what if our data set had thousands of rows and hundreds of customers named James? Since our algorithm doesn't accept multiple arguments, our code is not the most ideal code to be used in huge data sets.
- **Sort icons:** Depending on ascending/descending, the general sort icon could be changed to a directional icon.
- **Sort type:** Rather than clicking on table headers, we could place dropdown buttons to easily select the sort type. By doing so, we could create more / custom sorting options for each column.
- **Error messages:** As it is discussed above, we currently inform the user with _No results were found..._ error text. Along with doing so, we can also add a helper function, which provides suggestions. (For example: _Did you mean 'James' ?_ or _Try again with shorter filter text_ etc.)
- **Fetching data:** Basically, this could be one of the best improvements for this project. In real life, we get data from external sources. To achieve that, the first step would be to use a _fake online REST API for testing and prototyping_ service such as [JSONPlaceholder](https://jsonplaceholder.typicode.com/). Once we successfully implement it, we can create our own REST microservice as a second step.

Here are several references and great reads related to this project:

- [HTMLCollection, NodeList and array of objects](https://hackernoon.com/htmlcollection-nodelist-and-array-of-objects-da42737181f9)
- [Content Security Policy Reference](https://content-security-policy.com/)
- [Looping through objects in JavaScript](https://zellwk.com/blog/looping-through-js-objects/)
- [JavaScript Array sort() Method (w3schools.com)](https://www.w3schools.com/jsref/jsref_sort.asp)
- [String.prototype.localeCompare()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)
- [How TO - Sort a Table (w3schools.com)](https://www.w3schools.com/jsref/jsref_sort.asp)
- [YouTube - Build A Filterable List With Vanilla JavaScript](https://www.youtube.com/watch?v=G1eW3Oi6uoc)
- [Bubbly](https://leaverou.github.io/bubbly/)

Thank you for reading! Your thoughts and comments are always welcome.

Here is the [demo](https://alitursucular.github.io/filter-and-sort-dynamically-created-table-with-vanilla-javascript-demo/).

Here is the [GitHub repository](https://github.com/alitursucular/filter-and-sort-dynamically-created-table-with-vanilla-javascript-demo).


text:
# clj-cpustat

A cross-platform cpu statistics gathering library.

Add this dependency to your project.

[![Clojars Project](http://clojars.org/net.info9/clj-cpustat/latest-version.svg)](http://clojars.org/net.info9/clj-cpustat)

Require it as:
````
(ns playground
  (:require [cpustat.core :as cpustat]))
````

And have fun:
````
=> (cpustat/info)
...
=> (cpustat/start-cpustat 5 #(println %))
...
=> (cpustat/stop-cpustat)
````

## API Documentation

Check out the the [API docs here](http://tmarble.github.io/clj-cpustat/doc/)

## Platform Requirements

* Linux
  * Please ensure you have **mpstat** installed (in the [**systat**](https://packages.debian.org/jessie/sysstat) package)
* Mac
  * Currently the system tool **iostat** is used to give *average* CPU usage (see below for going further...)
* Windows
  * Alas Windows is currently not supported :(

## Notes

There are many, many features not implemented.

The big challenge is that several solutions depend on
native, third party libraries and often required elevated permissions.
It is essential that any proposals for elaborating performance
counters (on non Linux platforms) have a clear install/setup
procedure and do not expose unnecessary security risks.

Code that interacts with the system can sometimes
lack a certain elegance... Suggestions on improvements
are welcome!

* Per processor stats for Mac OS X
  * Requires [third party libraries](http://superuser.com/questions/27954/command-to-get-usage-per-cpu-core) and elevated privilege
* Stats for Windows
  * There doesn't seem to be even a basic CPU performance logging tool which
    doesn't require GUI configuration and/or elevated privilege. Here are
    some (maybe) helpful references:
  * https://technet.microsoft.com/en-us/library/cc788038.aspx
  * http://www.instantfundas.com/2012/03/how-to-record-cpu-and-memory-usage-over.html
  * http://stackoverflow.com/questions/9097067/get-cpu-usage-from-windows-command-prompt
* TODO: Target ClojureScript
  * The code should be written using *.cljc features
  * And supported on popular JavaScript server implementations (e.g. node)

## Copyright and license

Copyright © 2015 Tom Marble

Licensed under the [MIT](http://opensource.org/licenses/MIT) [LICENSE](LICENSE)

license: MIT

repository: tmarble/clj-cpustat

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: tmarble/clj-cpustat


text:
# NOIA ERC-20 Token Smart Contract

## Testing

Run tests with `npm test` command

## Deployment

1. Recheck token name and symbol in NOIAToken.sol (lines 14, 15).
2. Deploy token smart contract using `truffle migrate` or manually by using some other tool (for example https://myetherwallet.com)

## Token functionality

* NOIA Token is ERC20 token

* Token decimal count is *18*

* Tokens can be minted using `mint()` function.

* Tokens cannot be minted to zero address (0x0)

* Tokens can be minted only by token contract owner.

* Maximum token amount is limited to *1 000 000 000* tokens

* Token supports smart-contract notification when tokens are transfered to smart-contract address. Subscription to notifications is performed by calling `register()` function on token contract. To unsubscribe from notifications smart-contract must call `unregister()` function on token contract. Smart-contract must implement `ITokenReceiver` interface to receive notifications.

* Token burning is enabled only after all *1 000 000 000* tokens are minted

* Token burning can only be performed by `burnAddress` account which can be set using `setBurnAddress()` function

* `setBurnAddress()` can be called only by token contract owner

* Token supports token recovery if somebody, accidentially, transfers tokens to the token contract address. Owner can call `recoverTokens(ERC20Basic token, address to, uint256 amount)` function where:
  * `token` - token contract address
  * `to` - the address where tokens will be transfer
  * `amount` - amount of tokens to recover

branch_name: refs/heads/main


text:
# λοιπός, ή, όν.

<!-- Status: S3=Needs2ndReview -->
<!-- Lexica used for edits: BDAG, FFM, LN, A-S -->

## Word data

* Strongs: G30620.

* Alternate spellings:

* Principle Parts:

* Part of speech:

[Pronoun indefinite](http://ugg.readthedocs.io/en/latest/pronoun_indefinite.html),
[Determiner quantifier](http://ugg.readthedocs.io/en/latest/determiner_quantifier.html).

* Instances in the New Testament: 49.

* All Scriptures cited: No.

## Etymology:

[λείπω](../G35880/01.md): to leave, to lack, to be wanting.

* LXX/Hebrew glosses:

* Time Period/Ancient Authors:

* Related words:

* Antonyms for all senses:

* Synonyms for all senses:

## Senses:

### Sense  1.0:

#### Definition:

used to indicate the other part of a group of something, used to indicate the remainder or what is left of something

#### Glosses:

the rest, the remaining, the other

#### Explanation:

#### Citations:

; [αἱ](../G35880/01.md) λοιπαὶ [παρθένοι](../G39330/01.md)
; "the other virgins," (ULT): [Matt 25:11](mat 25:11),

; [τοὺς](../G35880/01.md) λοιποὺς [ἀποστόλους](../G06520/01.md)
; "the rest of the apostles," (ULT):[Acts 2:37](act 2:37),

[Rom 1:13](rom 1:13), [Matt 22:6](mat 22:6), [Mark 16:13](mrk 16:13), [Luke 24:10](luk 24:10),

; [οἱ](../G35880/01.md) λοιποὶ [οἱ](../G35880/01.md) [ἐν](../G17220/01.md) [τῇ](../G35880/01.md) [νήσῳ](../G35200/01.md); "the rest of the people on the island," (ULT):[Acts 28:9](act 28:9),

[1Thess 4:13](1th 4:13), [Rev 2:24](rev 2:24),

; [οἱ](../G35880/01.md) λοιποὶ [τῶν](../G35880/01.md) [ἀνθρώπων](../G04440/01.md)
; "The rest of mankind," (ULT):[Rev 9:20](rev 9:20),

[Rev 3:2](rev 3:2)

### Sense  1.1:

#### Definition:

used to indicate other things

#### Glosses:

other thing

#### Explanation:

In the plural "other things"

#### Citations:

[Mark 4:19](mrk 4:19)

### Sense  2.0:

#### Definition:

used as an indicator of time

#### Glosses:

for the future, for the rest, from now on, finally from now on, for the future, for the rest, finally

#### Explanation:

neuter singular, adverbially, of time, of fact, or of a conclusion

#### Citations:

### Sense  2.1:

#### Definition:

for the future, henceforth

#### Glosses:

from now on, for the future, henceforth

#### Explanation:

from now on, also henceforth, or as finally (compare Acts 27:20 and Eph 6:10), or reproachfully (as in Mark 14:41)

#### Citations:

; [καθεύδετε](../G25180/01.md) [τὸ](../G35880/01.md) λοιπὸν
; "Are you still sleeping," (ULT): [Mark 14:41](mrk 14:41),

; [τὸ](../G35880/01.md) λοιπὸν
; "from now on," (ULT): [1Cor 7:29](1co 7:29),

; [τὸ](../G35880/01.md) λοιπὸν, [ἐκδεχόμενος](../G15510/01.md)
; "Since that time, he is waiting," (ULT): [Heb 10:13](heb 10:13),

; λοιπὸν [περιῃρεῖτο](../G40140/01.md) [ἐλπὶς](../G16800/01.md) [πᾶσα](../G39560/01.md)
; "from then on all hope . . . was abandoned," (ULT): [Acts 27:20](act 27:20),

; λοιπὸν [ἀπόκειταί](../G06060/01.md) [μοι](../G14730/01.md) [ὁ](../G35880/01.md) [τῆς](../G35880/01.md) [δικαιοσύνης](../G13430/01.md) [στέφανος](../G47350/01.md)
; "Now the crown of righteousness has been reserved for me," (ULT): [2Tim 4:8](2ti 4:8),

[Gal 6:17](gal 6:17),

; [τοῦ](../G35880/01.md) λοιποῦ
; "Finally," (ULT): [Eph 6:10](eph 6:10)

### Sense  2.2:

#### Definition:

besides, moreover, for the rest

#### Glosses:

besides, moreover, for the rest

#### Explanation:

#### Citations:

[Phil 3:1](php 3:1), [4:8](php 4:8), [1Cor 1:16](1co 1:16),  [4:2](1co 4:2), [1Thess 4:1](1th 4:1).

repository: mandolyte/uw-obsidian

repo_name: mandolyte/uw-obsidian


text:
# XPopupWindow, an enhanced PopupWindow using Kotlin

![Travis](https://img.shields.io/badge/build-passing-brightgreen.svg)

[中文版](https://github.com/XuDeveloper/XPopupWindow/blob/master/docs/README-ZH.md)

XPopupWindow is an open source library implemented in the Kotlin language, which further encapsulates and enhances the system's PopupWindow for ease of use.  It provides some extra useful features like flexibly setting the popup position, adjusting the popup animations and so on. This can help you create a Android popup more easily and reliable.

## Donation(Buy me a cup of lemon tea :smile:)

| 微信 |支付宝 |
| ---- | ---- |
| ![](https://github.com/XuDeveloper/XPopupWindow/blob/master/art/wechat.jpeg)      | ![](https://github.com/XuDeveloper/XPopupWindow/blob/master/art/alipay.jpeg) |

## Licenses

```license
Copyright [2018] XuDeveloper

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

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

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

repository: XuDeveloper/XPopupWindow

repo_name: XuDeveloper/XPopupWindow


text:
Landing Portfolio Webpage
#### {Brief description of application}, {Date of current version}
Portfolio to get me into the job market, MOnday July 14 2020 ::
By: Alvin Ngunjiri Maina
## Description
This website is created to give a reflection of myself as an upcoming web developer. It serves to provide viewers with the informations concerning me as a new programmer in the field. It also shows the track that i have taken to create some simple projects with their live links. This portfolio website contains all about me. It is sectioned namely name,about,skills, project and contact
## Setup/Installation Requirements
* copy the repository link
* Open a new tab in your local machine
* Paste the link on the new tab
* Click enter to run
* clone the the repository link to have it in your local machine
## Technologies Used
* HTML
* CSS
## Support and contact details
EMAIL<EMAIL_ADDRESS>### License
* MIT - https://opensource.org/licenses/MIT

Copyright © 2020.All rights reserved

repository: alvinngunjiri/POrtfolio

repo_name: alvinngunjiri/POrtfolio


text:
# Fake News Challenge
Here is the final project for NLP course.

Our work include several parts:

1. Data preprocessing
2. Conventional Machine Learning Method
3. Seq2seq Attention model
4. TextCNN and Siamese Network
5. Others (e.g. Related work in the competition, future work)

### 1. Data preprocessing

We provide several data preprocessing methods: BoW (Bag of words), TF-IDF, word2vec, doc2vec.

Each py file produce  x_1 (doc representation) x_2 (title representation) and y (label).

These data can output as spy-data, which can be used in the model.

### 2. Conventional Machine Learning
We provide py file to classify the instances by Conventional Machine Learning (e.g. SVM, Random Forest), the codes are implemented on sklearn.
Environments requirements:
sklearn
numpy

### 3. Seq2seq Attention model

The codes is generally base on one attention based sequence-to-sequence model (https://github.com/abisee/pointer-generator) with his pretrained model. To use the code to generate summary of the text. Run:
python3 run_summarization.py --mode=decode --data_path=/path/to/chunked/val_* --vocab_path=/path/to/vocab --log_root=/path/to/a/log/directory --exp_name=myexperiment
Environments requirements:
tensorflow (1.2.1)
numpy

### 4. TextCNN and Siamese Network

The codes of TextCNN with Siamese Network are our novel work, the construction of CNN refered conventional TextCNN (https://github.com/dennybritz/cnn-text-classification-tf), we extend the Siamese structure for our purpose.

Main_v5 is the newest version till now.

Before using, you need to add raw data into fnc_data folder, and implement word2vec bin file named vector100.bin in the root folder.

Moreover, tensorflow (1.3.0 & 1.4.1 are supported, but either under 1.0 or 1.6 causes some minor conflicts), word2vec and numpy package.

''*_FineGrain": means 3-class fine grain classification (Specific relation of "related")

"*_FullDoc" : means use full documents word2vec matrix as x_1

Default: classification of related/unrelated, use attention based title to replace full documents.

### 5. Others
The detail step of UCL's work are in folder: ./UCL_Repeat/README.md
Environments requirements:
Python 3.5
Tensorflow 0.12.1
Scipy
Numpy


text:
# Gimmick - Component/Entity System framework for ActionScript

Gimmick is the fast and simple CES framework for ActionScript3 (and js in future)

Main goals of "Gimmick" development:
* Fast and ease CES framework
* Smart and rapid filtration of entities by their components `getEntities(ComponentType1, ..., ComponentTypeN)`
* Homogeneity of components in memory
* Operations with parallel systems( [ActionScript Workers support](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Worker.html) )

##Links
* [Gimmick-Examples](https://github.com/MerlinDS/Gimmick-Examples)
* [Gimmick API](http://gimmick.merlinds.com/)
* For more documentation see *[Wiki](https://github.com/MerlinDS/Gimmick/wiki)*
* To see all [tasks, create bug or leave proposal, please visit:
[https://github.com/MerlinDS/Gimmick/issues](https://github.com/MerlinDS/Gimmick/issues)

If you are interested feel free to ask questions:
* [Twitter - MerlinDS](https://twitter.com/MerlinDs)
* Email -<EMAIL_ADDRESS>* [Blog](http://merlinds.com)

##Simple Example
VelocityComponent and PositionComponent.

    public class VelocityComponent extends Component
    {
        public var x:Number;
        public var y:Number;

        public function VelocityComponent(x:Number, y:Number)
        {
            this.x = x;
            this.y = y;
        }
    }

    public class PositionComponent extends Component
    {
        public var x:Number;
        public var y:Number;

        public function PositionComponent(x:Number, y:Number)
        {
            this.x = x;
            this.y = y;
        }
    }

Update entity position by velocity with MovementSystem

    public class MovementSystem extends IEntitySystem
    {

        private var _entities:IEntities;

        public function initialize():void
        {
            //For quick iterations through entities use pre initialized of entities collection
            _entities = Gimmick.getEntities(VelocityComponent, PositionComponent);
        }

        public function dispose():void
        {
            _entities.dispose();
            _entities = null;
        }

        public function tick(time:Number):void
        {
            /*
            * Collection can be created in body of tick method,
            * but in this case iteration through entities will be slower.
            * var entities:IEntities = Gimmick.getEntities(VelocityComponent, PositionComponent);
            */
            for(_entities.begin(); !_entities.end(); _entities.next())
            {
                var entity:IEntity = entities.current;
                entity.get(PositionComponent).x += entity.get(VelocityComponent).x * time;
                entity.get(PositionComponent).y += entity.get(VelocityComponent).y * time;
            }
        }
        //... implementation of other methods from  IEntitySystem interface
    }

Or with EntityProcessingSystem

    public class MovementSystem extends IEntityProcessingSystem
    {

        public function process(entity:IEntity, entities:IEntities):void
        {
            entity.get(PositionComponent).x += entity.get(VelocityComponent).x * this.time;
            entity.get(PositionComponent).y += entity.get(VelocityComponent).y * this.time;
        }

        public function get targetEntities():IEntities
        {
            //initialize entities collection for future iterations in process method
            return Gimmick.getEntities(VelocityComponent, PositionComponent);
        }
    }

Usage (Main class of the application):

    public  class Application extends Sprite
    {

        private var _entity:IEntity;

        public function Application()
        {
            this.addEventListener(Event.ADD_TO_STAGE, this.addToStageHandler);
            super();
        }

        private function addToStageHandler(event:Event):void
        {
            this.removeEventListener(Event.ADD_TO_STAGE, this.addToStageHandler);
            //Initialize Gimmick
            Gimmick.initialize();//Can be initialized with external managers
            Gimmick.addSystem(new MovementSystem());
            Gimmick.activateSystem(MovementSystem);
            //Create new entity
            _entity = Gimmick.createEntity("Some entity");
            _entity.add(new VelocityComponent(2, 4));
            _entity.add(new PositionComponent(0, 0));
            //start game loop
            this.stage.addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
        }

        private function enterFrameHandler(event:Event):void
        {
            //Update Gimmick, update all in scope systems
            Gimmick.tick();
            //Will trace new position of entity
            trace(_entity.get(PositionComponent).x, _entity.get(PositionComponent).y);
        }

    }

More Examples you can found in [Gimmick-Examples](https://github.com/MerlinDS/Gimmick-Examples)

##License

The MIT License (MIT)

Copyright (c) 2015 Andrew Salomatin (MerlinDS)

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

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

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

repository: MerlinDS/Gimmick

repo_name: MerlinDS/Gimmick


text:
Programmers can write safety and liveness specifications in P as monitors or `spec` machines.
`spec` machines are monitor state machines or observer state machines that observe a set of events during the execution of the system and
assert the desired correctness specifications based on these observations.

!!! info "Machines vs Spec Machine"

    Syntactically, machines and spec machines in P **are very similar in terms of the state machine structure**. But, they have some key differences:

    - `spec` machines in P are **observer machines** (imagine runtime monitors), they observe a set of events in the execution of the system and based on these observed events (may keep track on local state) assert the desired global safety and liveness specifications.
    - Since `spec` machines are observer machines, they **cannot have any side effects** on the system behavior and hence, `spec` machines cannot perform `send`, `receive`, `new`, and `annouce`.
    - `spec` machines are **global machines**, in other words, there is only a single instance of each monitor created at the start of the execution of the system. We currently do not support dynamic creation of monitors. Hence, `spec` machines cannot use `this` expression.
    - `spec` machines are **synchronously composed** with the system that it is monitored. The way this is achieved is: each time there is a `send` or `announce` of an event during the execution of a system, all the monitors or specifications that are observing that event are executed synchronously at that point. Another way to imagine this is: just before `send` or `annouce` of an event, we deliver this event to all the monitors that are observing the event and **synchronously** execute the monitor at that point.
    - Finally, `spec` machines can have `hot` and `cold` annotations on their states to model liveness specifications.

???+ note "P Spec Machine Grammar"

    `specMachineDecl : spec iden observes eventsList statemachineBody ;`

    As mentioned above, syntactically, the P `spec` machines are very similar to the [P state machines](statemachines.md). The main difference being the `observes` annotation that specifies the list of events being observed (monitored) and also the `hot` and `cold` annotations on the states of a liveness specification.

**Syntax:** `spec iden observes eventsList statemachineBody ;`

`iden` is the name of the spec machine, `eventsList` is the comma separated list of events observed by the spec machine and the `statemachineBody` is the implementation of the specification and its grammar is similar to the [P state machine](statemachines.md).

#### Safety specification

``` kotlin linenums="1"
/*******************************************************************
ReqIdsAreMonotonicallyIncreasing observes the eRequest event and
checks that the payload (Id) associated with the requests sent
by all concurrent clients in the system is always globally
monotonically increasing by 1
*******************************************************************/
spec ReqIdsAreMonotonicallyIncreasing observes eRequest {
    // keep track of the Id in the previous request
    var previousId : int;
    start state Init {
        on eRequest do (req: tRequest) {
            assert req.rId > previousId,
            format ("Request Ids not monotonically increasing, got {0},
            previously seen Id was {1}", req.rId, previousId);
            previousId = req.rId;
        }
    }
}
```

The above specification checks a very simple global invariant that all `eRequest` events that are being sent by clients in the system have a globally monotonically increasing `rId`.

#### Liveness specification

``` kotlin linenums="1" hl_lines="13"
/**************************************************************************
GuaranteedProgress observes the eRequest and eResponse events,
it asserts that every request is always responded by a successful response.
***************************************************************************/
spec GuaranteedProgress observes eRequest, eResponse {
    // keep track of the pending requests
    var pendingReqs: set[int];
    start state NopendingRequests {
        on eRequest goto PendingReqs with (req: tRequest){
            pendingReqs += (req.rId);
        }
    }
    hot state PendingReqs {
        on eResponse do (resp: tResponse) {
            assert resp.rId in pendingReqs,
                format ("unexpected rId: {0} received, expected one of {1}", resp.rId, pendingReqs);
            if(resp.status == SUCCESS)
            {
                pendingReqs -= (resp.rId);
                if(sizeof(pendingReqs) == 0) // requests already responded
                    goto NopendingRequests;
            }
        }
        on eRequest goto PendingReqs with (req: tRequest){
            pendingReqs += (req.rId);
        }
    }
}
```

The above specification checks the global liveness property that every event `eRequest` is eventually followed by a corresponding successful `eResponse` event. The key idea is that the system satisfies a liveness specification if at the end of the execution the monitor is not in a **hot** state (line 13). The programmers can use `hot` annotation on states to mark them as intermediate or error states. Hence, properties like `eventually something holds` or `every event X is eventually followed by Y` or `eventually the system enters a convergence state`, all such properties can be specified by marking the intermediate state as `hot` states and the checker checks that all the executions of the system eventually end in a non-hot state. If there exists an execution that fails to come out of a hot state eventually then it is flagged as a potential liveness violation.

Details about the importance of liveness specifications is described [here](../advanced/importanceliveness.md). For several examples of liveness properties, please check the specifications in the tutorial examples.

repository: p-org/P

gha_language: C#

gha_license_id: MIT

repo_name: p-org/P


text:
pype
====

*Curly bracket-indented python for command line oneliners.*

Runs everywhere python runs - even on Windows! Only 1 file, and works on python 2.3 - 3.4.

![Pype Usage in Terminal](https://raw.githubusercontent.com/ircflagship2/pype/githubresources/terminal-animation.gif)

About
-----
`pype` makes it easy to use python in a typical unix command line pipe. `pype` exposes
each line on `stdin` as the variable `_`, and lets you write a function to manipulate it:

```shell
$ echo "hello world" | pype 'print _.upper()'
HELLO WORLD
```

To make it easier to write one-liners, `pype` allows you to use curly brackets for indentation.
Additionally, pype will by default convert input to ints and floats if applicable. Let's calculate the square of the even numbers between 1 and 5:

```shell
$ seq 1 5 | pype 'if _%2 == 0 { print _*_ }'
4
16
```

Install
-------

`pype` is a very short, hacky little script (and is defintely not suitable for production
environments at this point). It has very few dependencies, which are all available in
python 2.6, so hopefully, you can just download it and run it as-is!

#### Install with pip

```
pip install pypecli
```

#### Manual Install

Copy & paste-installer for the brave. Modify `PYPE_INSTALL_PATH` and `PYPE_RC_FILE` as required:

```shell
PYPE_INSTALL_PATH="$HOME/bin" && \
PYPE_RC_FILE="$HOME/.bashrc" && \
mkdir -p "$PYPE_INSTALL_PATH" && \
wget -O "$PYPE_INSTALL_PATH/pype" "https://raw.githubusercontent.com/ircflagship2/pype/master/pype" && \
echo "alias pype=\"python $PYPE_INSTALL_PATH/pype\"" >> $PYPE_RC_FILE && \
source $PYPE_RC_FILE
```

#### Install on Windows

Due to a known bug, it's not recommended to use `python setup.py install` on Windows. Download the `pype` file, rename it `pype.py` and add it to somewhere on your `PATH`. Then call it using `pype.py` instead of `pype`, e.g.:

```shell
c:\>dir | pype.py --collect "_.sort(); for l in _: print l"
```

Advanced Functionality and More Examples
----------------------------------------

#### Calling pype

List all files/folders in `/` in uppercase:

```shell
$ ls / | pype 'print _.upper()'
```

Pype is just a single python file, so you can the same by just pointing to the pype python file:

```shell
$ ls / | python ~/my_scripts/pype 'print _.upper()'
```

#### If...else statements

Print files/folders containing the character *s* in uppercase, the rest in lowercase:

```shell
$ ls / | pype "if 's' in _ { print _.upper() } else { print _.lower() }"
```

#### --before and --after

Do something cummulative using `--before` and `--after`. Let's count all
folders/files containing an *s*

```shell
$ ls / | pype --before "l = []" --after 'print len(l)' "if 's' in _: l.append(_)"
```

While `pype` auto-imports a handful of often-used imports, the `--before` argument is
useful if you need to include additional libraries:

```shell
$ ls / | pype --before "import json" "print json.dumps( { 'stdin' : _, 'upper' : _.upper() } )"
```

#### --collect

When doing something cummulative, it's often easier to use the `--collect` flag, to collect all input into an array (stored as `_`). Let's calculate the average of an input list of numbers:

```shell
$ seq 10 21 | pype -c "print sum(_) / float(len(_))"
```

#### --except

By default, pype will print a bunch of debug information to `stderr` when an unhandled exception is raised. You can define a custom, global exception handler with the `--exception` option. The exception is available as the variable `e`:

```shell
$ ls / | pype --except "err(e)" "_ + 1" # print error messages to stderr
$ ls / | pype --except pass "_ + 1" # quit silently on errors
```

#### --debug

Print the properly indented source code executed, together with verbose input
and output information using the `--debug` flag. Also useful to get an idea
of how pype works:

```shell
$ ls / | pype --before "l = []" --after 'print len(l)' "if 's' in _: l.append(_)" --debug
```

#### --no-convert

To make life easier, `pype` will convert input to integers and floats if possible. You can disable this behaviour, and ensure all input is strings by setting the --no-convert flag:

```shell
echo "1\n2.2\ntest" | pype -c --no-convert "print _"
```

#### --no-trim

`pype` trims `_` using `str.rstrip` by default. This is generally easier to work with, as `print`,
`out()` and `err()` will add a newline character to output. You can disable this
behaviour if you need the stdin input unmodified. You'll likely want to use
`sys.stdout.write()` and `sys.stderr.write()` instead of `print`, `out` and `err`, as the
`sys` methods do not add an extra newline.

```shell
$ ls / | pype --no-trim "sys.stdout.write( _.upper() )"
```

#### Outputting to stdout and stderr

Instead of using `print`, you may use the included `out(obj)` (alias of `print`)
and `err(obj)` functions for outputting to respectively `stdout` and `stderr`.
If you prefer, these functions are also aliased as `stdout(obj)` and `stderr(obj)`.

```shell
$ ls / | pype "if 's' in _ { out(_) } else { err(_) }" >stdout.log 2>stderr.log
```

Code reuse and defaults
-------------

Regularily used imports or functions can be added to `~/.pype` . This is a
regular python file that will be included in all pype scripts. For instance, adding the
content below to `~/.pype` will allow you to run
`seq 1 5 | pype 'printtwice( math.sqrt( _ ) )` without errors:

```python
import math

def printtwice(out):
	print out
	print out
```

Issues
------

Issues and pull requests are gladly accepted. The biggest known problem is that the conversion
between curly-bracketed and whitespace-indented python is entirely untested, and likely to fail for
anything more complex than very simple oneliners, like the ones in these examples.

Contributors
------------

- [Jens Kristian Geyti](http://www.github.com/jkgeyti)

repository: kollaam/pype

repo_name: kollaam/pype


text:
# IBM Db2 Event Store Streaming Connector for Kafka

*Questions about this material*? Reach me on Twitter [@Loic Julien](https://twitter.com/loicjulien)

The IBM Db2 Event Store is an in-memory database optimized for event-driven data processing and analysis. [Download the free developer edition or the enterprise edition](https://www.ibm.com/us-en/marketplace/db2-event-store)

In order to run our Open Source Apache Kafka Connector, follow the steps below:

## Pre-requisites
```
Install sbt at the version 0.13.16
git clone git@github.com:IBMProjectEventStore/db2eventstore-kafka.git
cd db2eventstore-kafka
```

check your sbt version with:
```
sbt sbtVersion
```
Output:
...
[info] kafkaQueue/*:sbtVersion
[info] 	0.13.16
[info] dataLoad/*:sbtVersion
[info] 	0.13.16
[info] eventStream/*:sbtVersion
[info] 	0.13.16
[info] db2eventstoreKafka/*:sbtVersion
[info] 	0.13.16

## Compile
```
sbt clean
sbt compile
```

## Package
```
sbt package assembly
```

## Start Sequence when using the built-in internal kafka broker
1. Run the Db2 Event Store Streaming Connector
2. Run the Data Generator
This order isn't necessary if using an external kafka broker

## Run the Db2 Event Store Streaming Connector

This connector could be run standalone, without the generator described in the section *Run the Data Generator*. However, the JSON sent to the queue currently needs to comply with the format described in the section Underlying Json format.

### Run command
Once you have run sbt package assembly, you can run the following command, after updating the eventStore option to point to a running Db2 Event Store service.

```
sbt "eventStream/run -localBroker true -kafkaBroker localhost:9092 -topic estopic -eventStore 9.30...:18730;9.30....:1101,9.30....:1101,9.30....:1101 -database TESTDB -user admin  -password password -metadata sensor -streamingInterval 5000 -batchSize 1000 -trustStoreLocation <trustStore file location> -trustStorePassword <trstStore password> -keyStoreLocation <keyStore file location> -keyStorePassword <keyStore password> -clientPluginName <plugin name>"
```

*Options*
- localBroker [Boolean]- true to use of an internal, single node, Kafka broker. False to use an externally configured Broker
- kafkaBroker [String]- Location of the Kafka broker, pass in "localhost:9092" for a local setup or the ip:port location for an external setup
- topic [String]- The Kafka topic to be used for the stream
- eventStore [String]- The IP configuration for the IBM Db2 Event Store
- database [String]- The Db2 Event Store Database to create or use
- user [String]- The Db2 Event Store user name to use
- password [String]- The Db2 Event Store password to use
- metadata [String]- The type of metadata for this IoT device, for instance "sensor" or "appliance" or "weatherstation"
- streamingInterval [Long]- The Long value defining the length of the Apache Spark streaming window, in milliseconds
- batchSize [Int] - The size of the batch to send to the IBM Db2 Event Store
- trustStoreLocation [String] - The trust store file location for Event Store SSL connections
- trustStorePassword [String] - The trust store password for Event Store SSL connections
- keyStoreLocation [String] - The key store file location for Event Store SSL connections
- keyStorePassword [String] - The key store password for Event Store SSL connections
- clientPluginName [String] - The client plugin name for Event Store SSL connections

## Run the Data Generator

The data generator is there to help generate some data. The generated data includes a type, a timestamp, a payload value.

### Internal Kafka Broker
This example comes pre-packaged with an internal broker. However, you can also connect it to an external Kafka cluster. Set the argument localBroker accordingly
- true for having the streaming connector create an internal Broker
- false for connecting the streaming connector to an external Broker

### Run command
```
sbt "dataLoad/run -localBroker true -kafkaBroker localhost:9092 -tableName sensor -topic estopic -group group -metadata sensor -metadataId 238 -batchSize 1000"
```

*Options*
- localBroker [Boolean]- true to use of an internal, single node, Kafka broker. False to use an externally configured Broker
- kafkaBroker [String]- Location of the Kafka broker, pass in "localhost:9092" for a local setup or the ip:port location for an external setup
- tableName [String] - The table name that will be created within the IBM Db2 Event Store where you can use the form [<schemaName>.]<table name> when if schemName is not provided the default schemaName will be the userid
- topic [String]- The Kafka topic to be used for the stream
- group [String]- The Kafka group to be used for the stream
- metadata [String]- The type of metadata for this simulated IoT device, for instance "sensor" or "appliance" or "car", ...
- metadataId [Long]- The Long value that can identify this IoT device, for instance "238" or "002" or ...
- batchSize [Int]- The size of the batch that will be sent to the Kafka queue. It can be as small as 1.

### Underlying Json format
The current format generated for this sample generator is a JSON string, like this:
```
s"""{"table":"${tableName}", "payload":{"id": ${numRec}, "${metadata}": ${metadataId}, "ts":${System.currentTimeMillis()}, "value":${value}}}"""
```
- numRec is a sequence that will restart at -0- each time the generator is restarted

## IBM Db2 Event Store Table definition

The table created in the event store follows the format below. It is designed to support a payload from an IoT device of type "metadata" that sends a value at a frequent interval.

```
val tableDefinition = TableSchema(tableName, StructType(Array(
  StructField("id", LongType, nullable = false),
  StructField(s"${metadata}", LongType, nullable = false),
  StructField("ts", LongType, nullable = false),
  StructField("value", LongType, nullable = false)
)),
  shardingColumns = Seq("ts", s"${metadata}"),
  pkColumns = Seq("ts", s"${metadata}"))
val indexDefinition = IndexSpecification("IndexDefinition", tableDefinition, equalColumns = Seq(s"${metadata}"), sortColumns = Seq(SortSpecification("ts", ColumnOrder.AscendingNullsLast)), includeColumns = Seq("value"))
```

## IBM Db2 Event Store supported queries

Any type of queries could be run against the IBM Db2 Event Store. However, the definition above is such that it will allow for running subsecond range predicate queries (such as the one below), as an index is defined on the ts and the metadata columns
```
SELECT value, ts from ${tableName} where ${metadata}=${metadataId} and ts>=${timestampStartValueinMS} and ts<=${timestampEndValueinMS}
```

[@Loic Julien](https://twitter.com/loicjulien), [IBM Db2 Event Store](https://www.ibm.com/products/db2-event-store)

gha_language: Scala


text:
# Restful API proxy for Exchange Web Services (EWS)

This repository contains the sources of our EWS proxy. The proxy is currently used by our following products:

- Office Calendars for Confluence

This proxy also aims to stick as closely as possible to the data format that the Microsoft Graph API uses, to make it easy to support both Graph & EWS at the same time.

## Background

![image](https://user-images.githubusercontent.com/2111803/33890249-f4298e4c-df52-11e7-804e-67c68fbcc762.png)
It's necessary to proxy the SOAP XML requests to the Exchange server, as it does not support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). Due to this restriction, connecting to EWS from the browser is not possible, so proxying the requests is (currently) the only option.

## Installation

To use the proxy locally, you have two options:
- Run the proxy from source
- Use the provided binaries

### Running from source

Just clone the repository and execute the following commands (you'll need NodeJS to run the proxy)

`
npm install
`

`
npm run build
`

`
node ./dist/app.js
`

### Running from binaries

Just download the binary file from the releases page for your OS. It comes bundled with all dependencies, so you can just run it without installing anything else first.

## Commandline Options

You can use the following commandline options to customize some behaviour:

### Use a different port than default (3000)
`
--port=1234
`

### Use a different secret than default (recommended)
`
--secret=somelongsecret
`

### Enable debug logging
`
--verbose
`

## Security

As the proxy calls EWS on behalf of each individul user, it obviously needs to handle user credentials. Unfortunately, on-premise Exchange installations only support NTLM & basic auth.

We understand security is a critical concern for our customers, so we provide the source of our proxy for everyone to see. We are not storing credentials in any form, they are just used for the sole purpose of accessing EWS.

As this may be a dealbreaker for certain industries, it it possible to self-host the proxy. We provide a possibility to change the proxy URL in our products that use this proxy. Please<EMAIL_ADDRESS>us to discuss specifics, we can help you setup the proxy in your environment and enable features like SSL.

You can also decide to test everything using our proxy and decide to run the proxy on your own for production usage.

## Coming up next

- We will be providing a docker image / VM for quick installation
- We will also provide a detailed guide for manual installation

repository: yasoonOfficial/yasoon-ews-proxy

gha_language: JavaScript

repo_name: yasoonOfficial/yasoon-ews-proxy


text:
I obviously wrote it in php using codeigniter.  There are a few good tutorials out there, but let me add my own ten cents to the pile!!\n
 So the first spot is the controller.  I created a controller called Feed.  I also could have just created a method under my Blog controller, but I find this is a little bit neater code.

    function index()
    {
        $this->load->helper('inflector');
            $this->load->helper('xml');
        $this->load->helper('text');
        $this->load->model('Blog_model', 'blog');

        $data['entries'] = $this->blog->get_last_ten_entries();
        $this->load->view('rss', $data);

    }

This loads the required CI helpers, as well as by Blog Model.  Notice that I am using a custom method in my model to retrieve the last ten entries.  I am reusing the same method that populated my main blog page.

The first thing to remember regarding the xml page that you define in your view is opening the xml using the echo statement.  The syntax would otherwise confuse the compiler.  After that we just use pure XML and insert our dynamic data with php short tags.  Surprisingly enough, that is it!


text:
# Service Provider

A simplified angies list where a user can list services for other users to request review and comment on or can be a standard user to request services to be completed by a service provider

## Installation

Fork and clone this repo install dependencies with

```bash
$bundle install
```

## Usage

to play around with the app use

```bash
$rails s
```

migrate the database with

```bash
$rails db:migrate
```

open the HTML in the browser.
create an account
add a service or request one
if a user provides a service they can view their dashboard to complete
and see all reviews/comments left by other users

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

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

repository: RTEYL/ServiceProvider

gha_language: Ruby

repo_name: RTEYL/ServiceProvider


text:
[![CircleCI](https://circleci.com/gh/Microsoft/PowerBI-visuals-TimeBrush/tree/master.svg?style=svg)](https://circleci.com/gh/Microsoft/PowerBI-visuals-TimeBrush/tree/master)

# Time Brush -- PowerBI

This is the PowerBI visual version of the Time Brush.

> This visual is currently in beta testing and is undergoing active development.

## Usage
* Fork this repo
* Install [node.js 6+](https://nodejs.org)
* Install [yarn](https://yarnpkg.com/)
* Run `yarn && yarn test` in the `../timebrush` directory.
* Run `yarn && yarn test` in this directory.
    * This will generate a `pbiviz` file in the `dist\powerbi` directory, which can then be imported into PowerBI.

repository: katua/PowerBI-visuals-TimeBrush

repo_name: katua/PowerBI-visuals-TimeBrush


text:
# django-db-multitenant

Provides a simple multi-tenancy solution for Django based on the concept
of having a **single tenant per database**.

This application is still experimental, but is being used in
production by the author. Contributions and discussion are welcome.

**Latest Version:** v0.1.3, September 10, 2016 ([changelog](CHANGELOG.md))

## Background

Multi-tenancy is the ability to support multiple distinct datasets from
the same application server.  Each dataset usually maps to a customer
(the tenant) and is partially or fully partitioned from all other tenant
data.

Among the possible approaches are:

* **Isolated approach**: Separate database per tenant.
* **Semi-isolated approach**: Shared database, separate namespaces (postgres schemas)
  or table names/prefix per tenant.
* **Shared approach**: Single database for all tenants.  Each table has a column
  identifying the tenant for that row of data.

This application implements a variation of the **isolated approach**:

* Each tenant has its **own database**, however
* Other **connection details are shared** (such as password, database user).

django-db-multitenant makes it possible (even easy) to take a Django application
designed for a single tenant and use it with multiple tenants.

## Operation

The main technique is as follows:

1. When a request first arrives, determine desired the tenant from the ``request`` object,
   and save it in thread-local storage.
2. Later in the request, when a database cursor is accquired, issue an SQL
   ``USE <tenant database name>`` for the desired tenant.

Step 1 is accomplished by implementing a [mapper class](https://github.com/mik3y/django-db-multitenant/blob/master/db_multitenant/mapper.py).
Your mapper takes a request object and returns a database name, using whatever logic you
like (translate hostname, inspect a HTTP header, etc).  The mapper result is saved in
thread-local storage for later use.

Step 2 determines whether the desired database has already been selected, and is skipped if
so.  This is implemented using a
[thin database backend wrapper](https://github.com/mik3y/django-db-multitenant/blob/master/db_multitenant/db/backends/mysql/base.py),
which must be set in ``settings.DATABASES`` as the backend.

## Usage

### 1. Install

Install ``django-db-multitenant`` (or add it to your setup.py).

```
$ pip install django-db-multitenant
```

### 2. Implement a mapper

You must implement a sublcass of [db_multitenant.mapper](https://github.com/mik3y/django-db-multitenant/blob/master/db_multitenant/mapper.py)
which determines the database name and cache prefix from the request.

Some examples:

* A [simple mapper](https://gist.github.com/mik3y/5959322), which uses a portion of the hostname
  directly as the database name.
* A [Redis-backed mapper](https://gist.github.com/mik3y/5959282), which looks up the tenant
  using the hostname, throwing a 404 if unrecognized.

### 3. Update settings.py

Set the multitenant mapper by specifying the full dotted path to your implementation:

```python
MULTITENANT_MAPPER_CLASS = 'myapp.mapper.TenantMapper'
```

Install the multitenant middleware as the *first* middleware.

```python
MIDDLEWARE_CLASSES = (
    'db_multitenant.middleware.MultiTenantMiddleware',
    ) + MIDDLEWARE_CLASSES
```

Change your database backend to the multitenant wrapper:

```python
DATABASES = {
    'default': {
        'ENGINE': 'db_multitenant.db.backends.mysql',
        'NAME': 'devnull',
    }
```

*Note*: Due to a current limitation, the named database must exist.  It may
be empty and read-only.

Optionally, add the multitenant helper ``KEY_FUNCTION`` to your cache definition,
which will cause cache keys to be prefixed with the value of
``mapper.get_cache_prefix``:

```python
CACHES = {
  'default' : {
    'LOCATION': '<IP_ADDRESS>:11211',
    'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
    'KEY_FUNCTION': 'db_multitenant.cache.helper.multitenant_key_func'
    }
}
```

**South Support**

If you use South, add the following to settings:

```python
SOUTH_DATABASE_ADAPTERS = {
    'default': 'south.db.mysql'
}
```

**Management Commands**: In order to use management commands (like syncdb)
with the correct tenant, inject this little hack in your settings:

```python
from db_multitenant.utils import update_from_env
update_from_env(database_settings=DATABASES['default'],
    cache_settings=CACHES['default'])
```

You can then export ``$TENANT_DATABASE_NAME`` and ``TENANT_CACHE_PREFIX``
on the command line:

```
$ TENANT_DATABASE_NAME=example.com ./manage.py syncdb
```

That's it.  Because django-db-multitenant does not define any models, there's
no need to add it to ``INSTALLED_APPS``.

## Advantages and Limitations

There is no one-size-fits-all solution for a data modeling problem such
as multi-tenancy (see 'Alternatives').

#### Advantages

* Compatibility: Your Django application doesn't need any awareness of
  multi-tenancy.  Database-level tools (such as ``mysqldump``) just work.
* Isolation: One tenant, one database means there's no intermingling of
  tenant data.
* Simplicity: Your application schemas don't need to be cluttered with
  'Tenant' foreign key relationships.
* Should work well with Django 1.6 connection persistence and connection
  pooling.

#### Limitations

* Unorthodox.  Django does not expect this kind of dynamic database
  connection tinkering, and there could be unexpected bugs.
* Limited isolation.  Since the same DB credentials are used for all
  tenants, bugs in the mapper (or anywhere else in the app) could
  cause data corruption.
* A valid database still needs to be specified in ``settings.DATABASE``
  for use when the connection is first established (this should be fixed
  eventually).
* MySQL-only (this should be fixed eventually).
* Overhead: requests may add up to one extra query (the ``USE <dbname>`` statement).

## Alternatives and Further Reading

* [django-tenant-schemas](https://github.com/bcarneiro/django-tenant-schemas) implements a semi-isolated approach using postgres schemas (and inspired this project, as well as the 'Overview' section above).

## Credits and License

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

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

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

repository: agutierrezdapda/django-db-multitenant

repo_name: agutierrezdapda/django-db-multitenant


text:
genieacs-gui
============

A fork of the GUI front end for GenieACS built with Ruby on Rails.

Customized changes:

-> the MAC address in the Devices tab is coming from a virtual parameter that should be called "VirtualParameters.MACAddress"

Virtual parameter
=================

MACAddress

let m = declare(
  "InternetGatewayDevice.DeviceInfo.X_MACAddress",
  {value: Date.now()});

if (m.size) {
  return {writable: false, value: [m.value[0], "xsd:string"]};
};

repository: mwallraf/genieacs-gui

repo_name: mwallraf/genieacs-gui


text:
# Implementation 2( *Deliverable-06* )

## 1. Introduction
E-Kitchen is a take-away app that allows staff and students who are pressed for time to have a great meal without going to the restaurant. We support several languages that make sure both foreigners and locals are well served. Users can order their meal at the restaurant opening time and got the meal in the place they gave.
* Github: https://github.com/CS386-Team2/MobileApp
* Trello: https://trello.com/b/6AiM2ym4/cs386team2project
## 2. Implemented requirements
1. Register Feature
* Link to the card on Trello:https://trello.com/b/6AiM2ym4/cs386team2project
* Name of who implemented:Hao Liu
* Link to the pull request on GitHub:https://github.com/CS386-Team2/MobileApp/pull/1
* Name of who reviewed and approved the pull request:Kehan Cao

2. LogIn Feature
* Link to the card on Trello:https://trello.com/b/6AiM2ym4/cs386team2project
* Name of who implemented:Zhibang Qin
* Link to the pull request on GitHub:https://github.com/CS386-Team2/MobileApp/pull/2
* Name of who reviewed and approved the pull request:Kehan Cao

3. Order System Feature
* Link to the card on Trello:https://trello.com/b/6AiM2ym4/cs386team2project
* Name of who implemented:YunSong Wang
* Link to the pull request on GitHub:https://github.com/CS386-Team2/MobileApp/pull/3
* Name of who reviewed and approved the pull request:Kehan Cao

4. Revise all the source code
* Link to the card on Trello:https://trello.com/b/6AiM2ym4/cs386team2project
* Name of who implemented:Kehan Cao
* Link to the pull request on GitHub:https://github.com/CS386-Team2/MobileApp/pull/4/
* Name of who reviewed and approved the pull request:Kehan Cao

## 3. Demo
https://youtu.be/41-MQSzkRMc
Since we don't succeed in writing code for some functions, the software are not updated generally. But we will keep trying to complete these functions and improve our user interface throughout the course. All team members are committed to figure out these problems we have met.

## 4. Code quality
Our Policies are:
* Follow coding standards
* Minimize cyclomatic complexity
* Minimize repetition rate
* Best Practices
* Maximum coverage
* The fastest response time
* Maximize resource utilization
* Minimize the number of vulnerabilities
* Minimize the number of errors

The definition of good code is our conventions:
The code logic should be straightforward and there will be no defects; minimize the call with other parts to make it easy to maintain; handle error codes according to layered inspection; optimize performance.

Practices adopted:
* Special treatment:
  Identify the hidden dangers in the current code and choose a good plan to execute
* Regular inspection:
  Step by step to ensure the quality of the code

## 5. Lessons learned
* Programming = coding, testing and debugging. Each of them is important when developing a software. But first of all, we need to write code in a good style so that it is easy for us to test and debug the code we are implementing.
* Code in good quality makes the sofeware more powerful and useful. We have to show beautiful and clean code to make the code have fewer bugs. Also, doing this can make it easy to maintain the software and improve team productivity.
* users are the most important part in out software development. Therefore, it's our responsibility to make the software friendly to our users including user interface, functions and use experiences.
* If we continue to develop the sofeware, we need to make user interface more beautiful. It maybe difficult for us to succeed in doing this but we will do our best to try it. Moreover, we need to improve our funtions since it looks a bit simple and crude now.

gha_language: Java


text:
# Awesome WebXR
Compilation of links for WebXR demos, frameworks, editors and more (WebVR / WebAR)

Feel free to submit PRs with more links!

## Impressive demos

- Hello WebXR from Mozilla: https://mixedreality.mozilla.org/hello-webxr/
- TRACK: https://demos.littleworkshop.fr/track
- Inside Music: https://experiments.withgoogle.com/webvr/inside-music/view/
- WebVR Experiments with Google: https://experiments.withgoogle.com/collection/webvr
- Streetmix 3D: https://kfarr.github.io/streetmix3d/
- IK Multiplayer avatars: https://avatars.exokit.org/
- Curated list of WebXR demos: https://metaverse.website/

## Hand Tracking

- Finger Tracking on Oculus Quest https://github.com/stewdio/vr-hands
- Handy.js makes defining and using custom hand shapes in WebXR a snap: https://github.com/stewdio/handy.js
- Three.js VR Haptics: https://threejs.org/examples/webxr_vr_haptics.html
- Unity WebXR plugin : https://github.com/Rufus31415/Simple-WebXR-Unity#simple-hand-tracking

## Frameworks

- A-Frame: https://aframe.io/
- Three.js: https://threejs.org/examples/#webxr_vr_rollercoaster
- React 360: https://facebook.github.io/react-360/
- RiftSketch: https://github.com/brianpeiris/RiftSketch
- Babylon.js: https://github.com/BabylonJS/Babylon.js
- JanusWeb: https://github.com/jbaicoianu/janusweb
- Microsoft MRTK (Mixed Reality Toolkit) : https://github.com/Rufus31415/Simple-WebXR-Unity#mrtk

## GUI-based editors

- Amazon Sumerian: https://aws.amazon.com/sumerian/
- Godot: https://godotengine.org/article/release-candidate-godot-3-3-rc-6
- RemixVR (live-coding environment): https://github.com/teliportme/remixvr
- Three.js Editor: https://threejs.org/editor/
- Spoke from Mozilla: https://hubs.mozilla.com/spoke
- Nunustudio: https://nunustudio.org/
- PlayCanvas: https://developer.playcanvas.com/en/tutorials/webvr-lab/
- Blender (3D model creation): https://www.blender.org/
- Blender plugin for WebXR export: https://github.com/feiss/blender-addons-for-webxr
- Unity: https://unity.com/
- Unity WebXR export plugin: https://github.com/MozillaReality/unity-webxr-export
- Unity WebXR lightweight plugin : https://github.com/Rufus31415/Simple-WebXR-Unity
- Three.js live coding environment: https://twitter.com/mrdoob/status/1263498538316636162
- Wonderland: https://wonderlandengine.com

## Game Demos

- FlappyBird VR, Barista Simulator and more games: https://constructarca.de/
- Moonrider: http://moonrider.xyz/ Source: https://github.com/supermedium/moonrider
- JS13K WebXR Games: https://js13kgames.com/entries/2019/26
- Quake 3D http://media.tojicode.com/q3bsp/
- Elfland Glider: https://elfland-glider.surge.sh/
- VR Planets: https://travisbarrydick.github.io/vr-planets/dist/

## Communities

- Poly from Google: https://poly.google.com/
- Hubs by Mozilla: https://hubs.mozilla.com/#/
- HoloDevelopers : https://join.slack.com/t/holodevelopers/shared_invite/zt-5d6fsq82-m3vHQGYBAvJfjtAR6_wBSA

## Audio visualizations

- https://classes.marpi.pl/resonate/

## Painting / Drawing

- VARTISTE (Image Editor): https://zach-geek.gitlab.io/vartiste/index.html

## Presentation software

- FrameVR https://www.framevr.io/

## Browsers

- Firefox Reality: https://mixedreality.mozilla.org/firefox-reality/

## Tutorials

- Codelab AR with WebXR: https://codelabs.developers.google.com/codelabs/ar-with-webxr/#1
- Deep dive into AR technology: https://vas3k.com/blog/augmented_reality/
- A-Frame School: https://aframe.io/aframe-school/#/

## Components

- Model Viewer: https://github.com/google/model-viewer
- A-Frame Components: https://www.npmjs.com/search?q=keywords:aframe-component
- 45+ 3D formats model viewer : https://rufus31415.github.io/sandbox/3d-viewer/

## By platform:

- Demos for Quest https://sidequestvr.com/#/webvr

## Studios

- Marpi: https://www.marpi.studio/
- Supermedium: https://supermedium.com/

## Free 3D Models

- https://usdzshare.com
- http://threedscans.com/
- https://www.si.edu/openaccess

license: Unlicense

repository: msurguy/awesome-webxr

gha_license_id: Unlicense

repo_name: msurguy/awesome-webxr


text:
# dev-util/desktop-file-utils

### emacs
Execute the `elisp-compile misc/desktop-entry-mode.el` command to compile and install an Emacs major mode for `.desktop` files editing, which provides basic support with syntax highlighting and validation.

This flag should be enabled if there is a need to edit `.desktop` files using an Emacs editor.

repository: filakhtov/gentoo-use-docs

repo_name: filakhtov/gentoo-use-docs


text:
0x11. What happens when you type holbertonschool.com in your browser and press Enter

[![Contributors][contributors-shield]][contributors-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]

[![Twitter Wilder](https://img.shields.io/twitter/follow/WildsRincon?label=Wilder_Rincon&style=social)](https://twitter.com/WildsRincon)

## Background Context

Being a Full-Stack Software Engineer means you’re comfortable interacting with any layer of the stack.

A way to easily assess this is to simply ask an engineer to explain how a software system works. They can have a general overview of the flow or can choose to dig deep in a certain area.

Let’s practice by exploring the infrastructure side (network, servers, security…) of the question.

## Requirements

### General :minidisc:

- You can post your blog post on the platform of your choice, LinkedIn or Medium are good ones
- A README.md file, at the root of the folder of the project, is mandatory

## More Info :boom:

### Manual QA Review

It is your responsibility to request a review for your blog from a peer before the project’s deadline. If no peers have been reviewed, you should request a review from a TA or staff member.

## Task :notebook:

### Mandatory :heavy_check_mark:
- What happens when...

### Advanced :red_circle:
- Everything's better with a pretty diagram
- Contribute!

## Contributors :busts_in_silhouette:
[@Wilder Rincón - Github](https://github.com/wildcox80)

[contributors-shield]: https://img.shields.io/github/contributors/wildcox80/holberton-system_engineering-devops.svg?style=plastic
[contributors-url]: https://github.com/wildcox80/holberton-system_engineering-devops/graphs/contributors
[license-shield]: https://img.shields.io/github/license/wildcox80/holberton-system_engineering-devops.svg?style=plastic
[license-url]: https://github.com/wildcox80/holberton-system_engineering-devops/blob/master/LICENSE.md
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=plastic&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/wildsrincon


text:
Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management
================================================================================
**Shilpa Nair has just graduated in the year 2015. She went to apply for Trainee position in a National News Television located in Noida, Delhi. When she was in the last year of graduation and searching for help on her assignments she came across Tecmint. Since then she has been visiting Tecmint regularly.**

![Linux Interview Questions on RPM](http://www.tecmint.com/wp-content/uploads/2015/06/Linux-Interview-Questions-on-RPM.jpeg)

Linux Interview Questions on RPM

All the questions and answers are rewritten based upon the memory of Shilpa Nair.

> “Hi friends! I am Shilpa Nair from Delhi. I have completed my graduation very recently and was hunting for a Trainee role soon after my degree. I have developed a passion for UNIX since my early days in the collage and I was looking for a role that suits me and satisfies my soul. I was asked a lots of questions and most of them were basic questions related to RedHat Package Management.”

Here are the questions, that I was asked and their corresponding answers. I am posting only those questions that are related to RedHat GNU/Linux Package Management, as they were mainly asked.

### 1. How will you find if a package is installed or not? Say you have to find if ‘nano’ is installed or not, what will you do? ###

> **Answer** : To find the package nano, weather installed or not, we can use rpm command with the option -q is for query and -a stands for all the installed packages.
>
>     # rpm -qa nano
>     OR
>     # rpm -qa | grep -i nano
>
>     nano-2.3.1-10.el7.x86_64
>
> Also the package name must be complete, an incomplete package name will return the prompt without printing anything which means that package (incomplete package name) is not installed. It can be understood easily by the example below:
>
> We generally substitute vim command with vi. But if we find package vi/vim we will get no result on the standard output.
>
>     # vi
>     # vim
>
> However we can clearly see that the package is installed by firing vi/vim command. Here is culprit is incomplete file name. If we are not sure of the exact file-name we can use wildcard as:
>
>     # rpm -qa vim*
>
>     vim-minimal-7.4.160-1.el7.x86_64
>
> This way we can find information about any package, if installed or not.

### 2. How will you install a package XYZ using rpm? ###

> **Answer** : We can install any package (*.rpm) using rpm command a shown below, here options -i (install), -v (verbose or display additional information) and -h (print hash mark during package installation).
>
>     # rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm
>
>     Preparing...                          ################################# [100%]
>     Updating / installing...
>        1:peazip-1.11-1.el6.rf             ################################# [100%]
>
> If upgrading a package from earlier version -U switch should be used, option -v and -h follows to make sure we get a verbose output along with hash Mark, that makes it readable.

### 3. You have installed a package (say httpd) and now you want to see all the files and directories installed and created by the above package. What will you do? ###

> **Answer** : We can list all the files (Linux treat everything as file including directories) installed by the package httpd using options -l (List all the files) and -q (is for query).
>
>     # rpm -ql httpd
>
>     /etc/httpd
>     /etc/httpd/conf
>     /etc/httpd/conf.d
>     ...

### 4. You are supposed to remove a package say postfix. What will you do? ###

> **Answer** : First we need to know postfix was installed by what package. Find the package name that installed postfix using options -e erase/uninstall a package) and –v (verbose output).
>
>     # rpm -qa postfix*
>
>     postfix-2.10.1-6.el7.x86_64
>
> and then remove postfix as:
>
>     # rpm -ev postfix-2.10.1-6.el7.x86_64
>
>     Preparing packages...
>     postfix-2:3.0.1-2.fc22.x86_64

### 5. Get detailed information about an installed package, means information like Version, Release, Install Date, Size, Summary and a brief description. ###

> **Answer** : We can get detailed information about an installed package by using option -qa with rpm followed by package name.
>
> For example to find details of package openssh, all I need to do is:
>
>     # rpm -qi openssh
>
>     [root@tecmint tecmint]# rpm -qi openssh
>     Name        : openssh
>     Version     : 6.8p1
>     Release     : 5.fc22
>     Architecture: x86_64
>     Install Date: Thursday 28 May 2015 12:34:50 PM IST
>     Group       : Applications/Internet
>     Size        : 1542057
>     License     : BSD
>     ....

### 6. You are not sure about what are the configuration files provided by a specific package say httpd. How will you find list of all the configuration files provided by httpd and their location. ###

> **Answer** : We need to run option -c followed by package name with rpm command and it will list the name of all the configuration file and their location.
>
>     # rpm -qc httpd
>
>     /etc/httpd/conf.d/autoindex.conf
>     /etc/httpd/conf.d/userdir.conf
>     /etc/httpd/conf.d/welcome.conf
>     /etc/httpd/conf.modules.d/00-base.conf
>     /etc/httpd/conf/httpd.conf
>     /etc/sysconfig/httpd
>
> Similarly we can list all the associated document files as:
>
>     # rpm -qd httpd
>
>     /usr/share/doc/httpd/ABOUT_APACHE
>     /usr/share/doc/httpd/CHANGES
>     /usr/share/doc/httpd/LICENSE
>     ...
>
> also, we can list the associated License file as:
>
>     # rpm -qL openssh
>
>     /usr/share/licenses/openssh/LICENCE
>
> Not to mention that the option -d and option -L in the above command stands for ‘documents‘ and ‘License‘, respectively.

### 7. You came across a configuration file located at ‘/usr/share/alsa/cards/AACI.conf’ and you are not sure this configuration file is associated with what package. How will you find out the parent package name? ###

> **Answer** : When a package is installed, the relevant information gets stored in the database. So it is easy to trace what provides the above package using option -qf (-f query packages owning files).
>
>     # rpm -qf /usr/share/alsa/cards/AACI.conf
>     alsa-lib-1.0.28-2.el7.x86_64
>
> Similarly we can find (what provides) information about any sub-packge, document files and License files.

### 8. How will you find list of recently installed software’s using rpm? ###

> **Answer** : As said earlier, everything being installed is logged in database. So it is not difficult to query the rpm database and find the list of recently installed software’s.
>
> We can do this by running the below commands using option –last (prints the most recent installed software’s).
>
>     # rpm -qa --last
>
> The above command will print all the packages installed in a order such that, the last installed software appears at the top.
>
> If our concern is to find out specific package, we can grep that package (say sqlite) from the list, simply as:
>
>     # rpm -qa --last | grep -i sqlite
>
>     sqlite-<IP_ADDRESS>-1.fc22.x86_64                 Thursday 18 June 2015 05:05:43 PM IST
>
> We can also get a list of 10 most recently installed software simply as:
>
>     # rpm -qa --last | head
>
> We can refine the result to output a more custom result simply as:
>
>     # rpm -qa --last | head -n 2
>
> In the above command -n represents number followed by a numeric value. The above command prints a list of 2 most recent installed software.

### 9. Before installing a package, you are supposed to check its dependencies. What will you do? ###

> **Answer** : To check the dependencies of a rpm package (XYZ.rpm), we can use switches -q (query package), -p (query a package file) and -R (Requires / List packages on which this package depends i.e., dependencies).
>
>     # rpm -qpR gedit-3.16.1-1.fc22.i686.rpm
>
>     /bin/sh
>     /usr/bin/env
>     glib2(x86-32) >= 2.40.0
>     gsettings-desktop-schemas
>     gtk3(x86-32) >= 3.16
>     gtksourceview3(x86-32) >= 3.16
>     gvfs
>     libX11.so.6
>     ...

### 10. Is rpm a front-end Package Management Tool? ###

> **Answer** : No! rpm is a back-end package management for RPM based Linux Distribution.
>
> [YUM][1] which stands for Yellowdog Updater Modified is the front-end for rpm. YUM automates the overall process of resolving dependencies and everything else.
>
> Very recently [DNF][2] (Dandified YUM) replaced YUM in Fedora 22. Though YUM is still available to be used in RHEL and CentOS, we can install dnf and use it alongside of YUM. DNF is said to have a lots of improvement over YUM.
>
> Good to know, you keep yourself updated. Lets move to the front-end part.

### 11. How will you list all the enabled repolist on a system. ###

> **Answer** : We can list all the enabled repos on a system simply using following commands.
>
>     # yum repolist
>     or
>     # dnf repolist
>
>     Last metadata expiration check performed 0:30:03 ago on Mon Jun 22 16:50:00 2015.
>     repo id                                                                           repo name                                                                                status
>     *fedora                                                                           Fedora 22 - x86_64                                                                                44,762
>     ozonos                                                                            Repository for Ozon OS                                                                                61
>     *updates                                                                          Fedora 22 - x86_64 - Updates
>
> The above command will only list those repos that are enabled. If we need to list all the repos, enabled or not, we can do.
>
>     # yum repolist all
>     or
>     # dnf repolist all
>
>     Last metadata expiration check performed 0:29:45 ago on Mon Jun 22 16:50:00 2015.
>     repo id                                                                         repo name                                                                                status
>     *fedora                                                                         Fedora 22 - x86_64                                                                             enabled: 44,762
>     fedora-debuginfo                                                                Fedora 22 - x86_64 - Debug                                                                     disabled
>     fedora-source                                                                   Fedora 22 - Source                                                                             disabled
>     ozonos                                                                          Repository for Ozon OS                                                                         enabled:     61
>     *updates                                                                        Fedora 22 - x86_64 - Updates                                                                   enabled:  5,018
>     updates-debuginfo                                                               Fedora 22 - x86_64 - Updates - Debug

### 12. How will you list all the available and installed packages on a system? ###

> **Answer** : To list all the available packages on a system, we can do:
>
>     # yum list available
>     or
>     # dnf list available
>
>     ast metadata expiration check performed 0:34:09 ago on Mon Jun 22 16:50:00 2015.
>     Available Packages
>     0ad.x86_64                               0.0.18-1.fc22                   fedora
>     0ad-data.noarch                          0.0.18-1.fc22                   fedora
>     0install.x86_64                          2.6.1-2.fc21                    fedora
>     0xFFFF.x86_64                            0.3.9-11.fc22                   fedora
>     2048-cli.x86_64                          0.9-4.git20141214.723738c.fc22  fedora
>     2048-cli-nocurses.x86_64                 0.9-4.git20141214.723738c.fc22  fedora
>     ....
>
> To list all the installed Packages on a system, we can do.
>
>     # yum list installed
>     or
>     # dnf list installed
>
>     Last metadata expiration check performed 0:34:30 ago on Mon Jun 22 16:50:00 2015.
>     Installed Packages
>     GeoIP.x86_64                            1.6.5-1.fc22                     @System
>     GeoIP-GeoLite-data.noarch               2015.05-1.fc22                   @System
>     NetworkManager.x86_64                   1:1.0.2-1.fc22                   @System
>     NetworkManager-libnm.x86_64             1:1.0.2-1.fc22                   @System
>     aajohan-comfortaa-fonts.noarch          2.004-4.fc22                     @System
>     ....
>
> To list all the available and installed packages on a system, we can do.
>
>     # yum list
>     or
>     # dnf list
>
>     Last metadata expiration check performed 0:32:56 ago on Mon Jun 22 16:50:00 2015.
>     Installed Packages
>     GeoIP.x86_64                             1.6.5-1.fc22                    @System
>     GeoIP-GeoLite-data.noarch                2015.05-1.fc22                  @System
>     NetworkManager.x86_64                    1:1.0.2-1.fc22                  @System
>     NetworkManager-libnm.x86_64              1:1.0.2-1.fc22                  @System
>     aajohan-comfortaa-fonts.noarch           2.004-4.fc22                    @System
>     acl.x86_64                               2.2.52-7.fc22                   @System
>     ....

### 13. How will you install and update a package and a group of packages separately on a system using YUM/DNF? ###

> Answer : To Install a package (say nano), we can do,
>
>     # yum install nano
>
> To Install a Group of Package (say Haskell), we can do.
>
>     # yum groupinstall 'haskell'
>
> To update a package (say nano), we can do.
>
>     # yum update nano
>
> To update a Group of Package (say Haskell), we can do.
>
>     # yum groupupdate 'haskell'

### 14. How will you SYNC all the installed packages on a system to stable release? ###

> **Answer** : We can sync all the packages on a system (say CentOS or Fedora) to stable release as,
>
>     # yum distro-sync      [On CentOS/RHEL]
>     or
>     # dnf distro-sync      [On Fedora 20 Onwards]

Seems you have done a good homework before coming for the interview,Good!. Before proceeding further I just want to ask one more question.

### 15. Are you familiar with YUM local repository? Have you tried making a Local YUM repository? Let me know in brief what you will do to create a local YUM repo. ###

> **Answer** : First I would like to Thank you Sir for appreciation. Coming to question, I must admit that I am quiet familiar with Local YUM repositories and I have already implemented it for testing purpose in my local machine.
>
> 1. To set up Local YUM repository, we need to install the below three packages as:
>
>     # yum install deltarpm  python-deltarpm  createrepo
>
> 2. Create a directory (say /home/$USER/rpm) and copy all the RPMs from RedHat/CentOS DVD to that folder.
>
>     # mkdir /home/$USER/rpm
>     # cp /path/to/rpm/on/DVD/*.rpm /home/$USER/rpm
>
> 3. Create base repository headers as.
>
>     # createrepo -v /home/$USER/rpm
>
> 4. Create the .repo file (say abc.repo) at the location /etc/yum.repos.d simply as:
>
>     cd /etc/yum.repos.d && cat << EOF > abc.repo
>     [local-installation]name=yum-local
>     baseurl=file:///home/$USER/rpm
>     enabled=1
>     gpgcheck=0
>     EOF

**Important**: Make sure to remove $USER with user_name.

That’s all we need to do to create a Local YUM repository. We can now install applications from here, that is relatively fast, secure and most important don’t need an Internet connection.

Okay! It was nice interviewing you. I am done. I am going to suggest your name to HR. You are a young and brilliant candidate we would like to have in our organization. If you have any question you may ask me.

**Me**: Sir, it was really a very nice interview and I feel very lucky today, to have cracked the interview..

Obviously it didn’t end here. I asked a lots of questions like the project they are handling. What would be my role and responsibility and blah..blah..blah

Friends, by the time all these were documented I have been called for HR round which is 3 days from now. Hope I do my best there as well. All your blessings will count.

Thankyou friends and Tecmint for taking time and documenting my experience. Mates I believe Tecmint is doing some really extra-ordinary which must be praised. When we share ours experience with other, other get to know many things from us and we get to know our mistakes.

It enhances our confidence level. If you have given any such interview recently, don’t keep it to yourself. Spread it! Let all of us know that. You may use the below form to share your experience with us.

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

via: http://www.tecmint.com/linux-rpm-package-management-interview-questions/

作者：[Avishek Kumar][a]
译者：[译者ID](https://github.com/译者ID)
校对：[校对者ID](https://github.com/校对者ID)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译，[Linux中国](https://linux.cn/) 荣誉推出

[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/
[2]:http://www.tecmint.com/dnf-commands-for-fedora-rpm-package-management/

url: https://raw.githubusercontent.com/mousycoder/TranslateProject/5a078ed4770c650a2fdc78eab7798b37ae4a8df4/sources/tech/20150623 Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management.md

repository: mousycoder/TranslateProject

repo_name: mousycoder/TranslateProject


text:
# 데이터 통신공학 Summary

3학년 2학기 수업 때 수강한 데이터 통신 공학 코스 내용을 간단히 정리했습니다.

## 1. Network Models

- TCP , IP
- OSI models

## 2. Intro to Physical Layer

- Data & Signal

- Analogue & Digital

- Periodic Analog Signals

    - Periods, Frequency, Phases..
    - Simple Analogue Signals & Composite Analogue Signals

- **Nonperiodic Digital Signals**

    1) Bit Rate

    2) Two ways to transmit the Digital Signals : Baseband & Broadband

        1) **Baseband transmission**
            - two cases
                1. wide bandwidth
                    - Transmission Available without any converison
                2. limited bandwidth
                    - Lowpass channel (Approximate to Analogue)

        2) **Broadband Transmission**
            - Bandpass
            - Modulation
                - Digital Signal -> (Carrier) -> Composite Analogue Signal -> Digital signal

 *Lowpass and Bandpass*

    4) Transmission Impairment
        -  dB
        - SNR
        - SNRdB

    5) Data Rate Limit
        - Nyquist Bitrate
        - Bitrate with noises

## 3. Digital Transmission

-   **Digital(Data) to Digital(Signal) Conversion**

    *How Can We Represent DIGITAL DATA with DIGITAL SIGNAL?*
    - Line Coding

        1.  Examples : NRZ, RZ, Manchester etc

        2. Problems
            - Baseline Wandering
            - DC components
            - Synchronization

    - Block Coding

- **Analogue(Signal) to Digital(Data) Conversion**

    - PCM
        - Sampling Analogue Signal

- Transmission : Paralell or Serial

## 4. Analogue Transmission

- Digital Data to Analogue Signal

(When *Bandpass* Channel is Available!)

- Broadband modulation
    - ASK, FSK, QAM etc

- Analogue Signal (low pass) to Smaller Analogue Signal(band pass)
    - AM, FM etc

## 5. In Real Life, Usually It's Limited Bandwidth :-(

- Solution : Several Low Bandwidth Channels into One Channel with Large Bandwith

    - Multiplexing
        1. For Efficiency
        2. Multiple Signals across single link
        3. Example : WDM, FDM, TDM

    - Spectrum Spreading
        1. For Privacy and Anti-jamming
        2. FHSS
        3. DSSS - Spreading Code

## 6. Switching
- Circuit
    - Physical Layer (Resource Reservation)
- Packet
    - Datagram(Routing table) : Network Layer
    - Virtual- Circuit (Switching Table): Data-Link Layer

    *Virtual Circuit*

- Message

## 7. Data Link Layer

- DLC
    - Framing
- Multiple Access Resolution
    - Random Access (Data Link Layer)
        - ALOHA, CSMA, CSMA/CA, CSMA/CD


text:
 DCP - SCORE CARD 2021 ✨✨✨

 Welcome to the Repo Officially!!..🙌👏

## Total Number Of PR's : 52
## Total Number of Contributors : 14

Name : Siddhi Bhanushali

Github : https://github.com/siddhi-244

Number of PR's : 5

Projects Done : Bubble Sort (Level 1) | Selection Sort (Level 1) | Binary Search (Level 1) | Linear Search (Level 1) | All Array Indices (Level 1) |

Points : 50

Name : Manasi Chibber

Github : https://github.com/Manasi2001

Number of PR's : 15

Projects Done : Water Jug Problem (Level 3) | Tic Tac Toe Game (Level 3) | N Queens (Level 1) | Knight's Tour (Level 2) | Hamiltonian Cycyle (Level 2) | Cryptarithmetic Problem (Level 2) | Graph Colouring Problem (Level 2) | Subset Sum (Level 1) | 8 Puzzle Problem using A Star Algorithm (Level 3) | 8 Puzzle Problem using BSF (Level 3) | Average Calculator (Level 1) | Bad String (Level 0) | Binary Numbers (Level 1) | Bitwise AND (Level 1) | BST Level Order Traversal (Level 1) |

Points : 305

Name : Thejaswin S

Github : https://github.com/thejaswin123

Number of PR's : 2

Projects Done : Heap Sort (Level 1) | Shell Sort (Level 1) |

Points : 20

Name : Abhishek Sharma

Github : https://github.com/abhisheks008

Number of PR's : 3

Projects Done : Determining DNA Health (Level 3) | Predicting House Prices (Level 3) | Find Angle MBC (level 2) |

Points : 100

Name : Dhruv Varshney

Github : https://github.com/dhruv-varshney

Number of PR's : 2

Projects Done : Sudoku Solver (Level 2) | Fibonacci Series (Level 1) |

Points : 30

Name : Shiwansh Raj

Github : https://github.com/photon149

Number of PR's : 3

Projects Done : Caesar Cipher (Level 1) | Reverse Cipher (Level 0) | Complex Number to Polar Coordinates (Level 1) |

Points : 25

Name : Pushpit Jain

Github : https://github.com/pushpit-J19

Number of PR's : 9

Projects Done : Palindrome Check with Recursion (Level 1) | Expression Tree Evaluation (Level 2) | Infix To Postfix Conversion (Level 2) | Segment Tree Creation (Level 2) | Segment Tree Update Query (Level 2) |  Segment Tree Range Sum Query (Level 2) | Binary Tree to DLL (Level 2) | Lowest Common Ancestor Binary Tree (Level 2) | Lowest Common Ancestor Binary Search Tree (Level 2) |

Points : 170

Name : Nantha Kumar

Github : https://github.com/nknantha

Number of PR's : 3

Projects Done : Singly Linked List (Level 3) | Doubly Linked List (Level 3) | Linked Queue (Level 2) |

Points : 100

Name : Ritika Chand

Github : https://github.com/RC2208

Number of PR's : 3

Projects Done : Transposition Cipher (Level 1) | Insertion Sort (Level 1) | Brute Forcing The Caesar Cipher (Level 1)|

Points : 30

Name : Rajpurohit Vijesh

Github : https://github.com/AlexAdvent

Number of PR's : 1

Projects Done : Merge Sort (Level 1) |

Points : 10

Name : Sanjay NT

Github : https://github.com/SANJAY-NT

Number of PR's : 1

Projects Done : Array Operations (Level 1) |

Points : 10

Name : Ayushi Shrivastava

Github : https://github.com/ayushi424

Number of PR's : 1

Projects Done : Mobile Price Range Classification (Level 3) |

Points : 40

Name : Neha Jha

Github : https://github.com/neha030

Number of PR's : 1

Projects Done : Quick Sort (Level 1) |

Points : 10

Name : Nallani Durg Sai

Github : https://github.com/DurgaSai-16

Number of PR's : 1

Projects Done : Vigenere Cipher (Level 2) |

Points : 20


text:
# Log Package

This package is a drop-in replacement for seelog that allows you to add a source and context to your logging messages.

## Usage

Set log.Source at the start of your program. This will prefix all log messages with @source:

```
log.Source = "foo"
log.Infof("found it: %s", xyz)
```

outputs:

```
@foo found it: xyz
```

When you want to report a topic for every log message, create a new context and use that as your logger:

```
log.Source = "foo"
clog := log.NewContext("myid")
clog.Debugf("received request: %s", xyz)
```

outputs:

```
@foo #myid received request: xyz
```

You can also create sub-contexts:

```
sublog := clog.NewContext("process")
sublog.Debugf("doing something")
```

outputs:

```
@foo #myid #process doing something
```

gha_license_id: NOASSERTION


text:
# Coltricia parvula J.R. Sharma & J.E. Wright, 1997 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
in Wright, Mycotaxon 61: 419 (1997)

#### Original name
Coltricia pusilla J.R. Sharma & J.E. Wright, 1992

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Hymenochaetales/Hymenochaetaceae/Coltriciella/Coltriciella pusilla/ Syn. Coltricia parvula/README.md

repo_name: mdoering/backbone


text:
---
layout: post
title: "Spam Karma"
categories:
- general
date: 2005-05-13 00:00
comments: true
---

Yesterday night I was making a comment and found that I'd been blacklisted as a spammer — on my own blog! I un-blacklisted myself, but it was clear that Spam Karma (the plugin I use to stem the flow of comment spam) was having some issues. I took a look at the Spam Karma page, and it confirmed that I needed to upgrade to version 2.0, which I've now done.

I found a few of legitimate posts that were in the digest (and Phil emailed to let me know his comment had been swallowed), so I've tried to manually enter the ones I've found. However, there may be others which have already disappeared into the black hole — if so, I can only apologise. Let me know if you have any more problems leaving comments, but it should be back to normal now.

repository: bsag/blog-octo

repo_name: bsag/blog-octo