text:
# SQLiteBrowser

A SQLite viewer that can have plugins to visualise specific data in BLOB fields.

## Plugins

The plugins inherit from [BlobInterface](application/include/blobinterface.h) that has several pure virtual methods.

* name: the name used in [plugins.ini](bin/plugins.ini) (see below)
* supportedTypes: List of types that plugin can process
* process: as the name implies, process the data.

## Configuration

The file [plugins.ini](bin/plugins.ini) contains the mapping between table/field couple to plugin(s). Sample:

```
[table_name]
field_name=plugin1,plugin1,plugin3
other_field=plugin1

[other_table]
field_name=...
...
```

Before showing the data of a field, it will be process by each plugin in the order they are defined in the setting file. (e.g. `field_name` in `table_name` will be transform as `output = plugin3(plugin2(plugin1(data)))`).

## Usage

* Launch the sofware
* File > Open database: will show the tables of the database on the left
* Double-click on a table: will show the content of this table on the right
* Double-click on a cell: if it's showing `BLOB`, process it as defined, else just show it directly.

repository: minirop/SQLiteBlobVisualiser

repo_name: minirop/SQLiteBlobVisualiser


text:
---
title: Animating objects
sidebar_position: 7
---

Animation is the process of making something move, or alternatively, of making something change over time.

The fundamental idea behind scripted animation is that a change needs to take place, and that change needs to be divided into increments over time. It’s easy to make something repeat in ActionScript, using a common looping statement. However, a loop will run through all its iterations before updating the display. To create scripted animation, you need to write ActionScript that performs some action repeatedly over time and also updates the screen each time it runs.

 ActionScript includes a simple mechanism that allows you to track the passage of time and update the screen accordingly—meaning you could write code that moves the ball a small amount each time, until it reaches its destination. After each move the screen would update, making the cross-Stage motion visible to the viewer.

From a practical standpoint, it makes sense to synchronize scripted animation with the SWF file’s frame rate (in other words, make one animation change each time a new frame displays or would display), since that defines how frequently Flash Player or AIR updates the screen. Each display object has an enterFrame event that is dispatched according to the frame rate of the SWF file—one event per frame. Most developers who create scripted animation use the enterFrame event as a way to create actions that repeat over time. You could write code that listens to the enterFrame event, moving the animated ball a certain amount each frame, and as the screen is updated (each frame), the ball would be redrawn in its new location, creating motion.

:::note
Another way to perform an action repeatedly over time is to use the Timer class. A Timer instance triggers an event notification each time a specified amount of time has past. You could write code that performs animation by handling the Timer class’s timer event, setting the time interval to a small one (some fraction of a second). For more information about using the Timer class, see [Controlling time intervals](/docs/development/core-actionscript-classes/working-with-dates-and-times#controlling-time-intervals) .
:::

In the following example, a circle Sprite instance, named `circle` , is created on the Stage. When the user clicks the circle, a scripted animation sequence begins, causing `circle` to fade (its `alpha` property is decreased) until it is completely transparent:

```actionscript
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;

// draw a circle and add it to the display list
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0x990000);
circle.graphics.drawCircle(50, 50, 50);
circle.graphics.endFill();
addChild(circle);

// When this animation starts, this function is called every frame.
// The change made by this function (updated to the screen every
// frame) is what causes the animation to occur.
function fadeCircle(event:Event):void
{
    circle.alpha -= .05;

    if (circle.alpha <= 0)
    {
        circle.removeEventListener(Event.ENTER_FRAME, fadeCircle);
    }

}

function startAnimation(event:MouseEvent):void
{
    circle.addEventListener(Event.ENTER_FRAME, fadeCircle);
}

circle.addEventListener(MouseEvent.CLICK, startAnimation);
```

When the user clicks the circle, the function `fadeCircle()` is subscribed as a listener of the `enterFrame` event, meaning it begins to be called once per frame. That function fades circle by changing its `alpha` property, so once per frame the circle’s alpha decreases by .05 (5 percent) and the screen is updated. Eventually, when the alpha value is 0 ( circle is completely transparent), the `fadeCircle()` function is removed as an event listener, ending the animation.

The same code could be used, for example, to create animated motion instead of fading. By substituting a different property for `alpha` in the function that is an `enterFrame` event listener, that property will be animated instead. For example, changing this line

```actionscript
    circle.alpha -= .05;
```

to this code

```actionscript
    circle.x += 5;
```

will animate the x property, causing the circle to move to the right across the Stage. The condition that ends the animation could be changed to end the animation (that is, unsubscribe the enterFrame listener) when the desired x coordinate is reached.

license: MIT

branch_name: refs/heads/main

extension: md

license_type: permissive


text:
# ExMeshCNN: An Explainable Convolutional Neural Network Architecture for 3D Shape Analysis

```
@inproceedings{exmeshcnn_kdd22,
title = {ExMeshCNN: An Explainable Convolutional Neural Network Architecture for 3D Shape Analysis},
author = {Kim, Seonggyeom and Chae, Dong-Kyu},
booktitle = {Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD)},
pages = {795--803},
year = {2022}
}
```

links
- [acm](https://dl.acm.org/doi/10.1145/3534678.3539463)

branch_name: refs/heads/master

gha_language: Jupyter Notebook

gha_license_id: MIT


text:
# US Tweets Dashboard for Sentiment Analysis

Shiny dashboard developed in R for sentiment analysis of US president and governors' tweets during the early stages of the pandemic.

## Description

This is a project developed for my Data Science's Master's (that's why it is in Spanish).

The idea is to be able to study interactively the relationship between the sentiment and the amount of tweets posted by the president of the US and the 50 governors thruought the early stages of the 2020 pandemic.
Some other variables are included like Dow Jones index or the dollar-to-euro value.

In order to do this +46.000 tweets were downloaded from the 1st of February to the 1st of June.

## Tabs

### Tweets

Here you can see the most negative and positive tweets by selecting a date interval and the political party (Democratic, Republican or President).

### Variables

In this tab it is possible to study the distribution of the tweet's sentiment of each political party.
It is also possible to visualize all the time series used in this project and how correlated they are through a correlation matrix.

### Evolution

Here it is possible to study the evolution of the average sentiment and number of tweets of each political party from February to June.
Some important events are showed in the plot such as President's impeachment or *"Black Monday"*.
There are two buttons that allow you to split the data between parties and/or apply some smoothing to the time series.

### Maps

In this tab you can check wheter a specific state's governor is Republican or Democratic.
Next to it another map shows the number of tweets or the average sentiment of each state's governor between two dates defined by the user.

## Usage

Clone the repository and run the app.R file.

All the required packages will be downloaded when you run the app if they aren't yet.


text:
#User Scenarios

##Developer
As a developer, I am interested in creating a website and app with a scalable scope that is easy to maintain and recycle functions/methods. I will use clear, clean, and consistent naming and syntax so other developers can understand the code and adapt it to their needs. I would like clear deliverables so I understand the client's expectations and what I need to produce as a product for the end-user.

##Client (freelancer/agency/business)
As a client, I am interested in a website and app service that is efficient and time saving. I would like the ability to screen customers and retain clear info from an end user.

##End User
As an end user, I am interested in a quick, pain-free process with an outstanding personalized experience that doesn't feel "sale-sy". I would like to enjoy the website and app quote process with a conversational feel to the questions I am asked and information I receive in return.

repository: alicialycan/desgn-worth

repo_name: alicialycan/desgn-worth


text:
# MultiDim Grid

A (future) efficient C++14 flatten multi dimensional container.

## Disclaimer

This is an ongoing work.
I would be glad to receive any contributions and remarks for improvements.

## Quick start

Just include the `multidim_grid.hpp` header in your project.

```c++
#include "multidim_grid.hpp"

#include <iostream>
#include <algorithm> // std::generate

int main() {
	// Create a 3D grid with 4x2x3 vertices
	multidim::Grid<float,4,2,3> grid;
	// grid behaves like a STL container and we can fill values with std::generate
	std::generate(grid.begin(), grid.end(), [](){ static float n{0.0f}; return n+=0.5f; } );
	// We have a pretty printer
	std::cout << grid << std::endl;
	// We can access efficiently to values from appropriate coordinates
	std::cout << "Grid[{2,0,2}] = " << grid[{2,0,2}] << std::endl;
}
```

Produces the output :

> Values : {0.5;1;1.5;2;2.5;3;3.5;4;4.5;5;5.5;6;6.5;7;7.5;8;8.5;9;9.5;10;10.5;11;11.5;12}
> Mapping index to coord :
> 0:{0;0;0;} 1:{1;0;0;} 2:{2;0;0;} 3:{3;0;0;} 4:{0;1;0;} 5:{1;1;0;} 6:{2;1;0;} 7:{3;1;0;} 8:{0;0;1;} 9:{1;0;1;} 10:{2;0;1;} 11:{3;0;1;} 12:{0;1;1;} 13:{1;1;1;} 14:{2;1;1;} 15:{3;1;1;} 16:{0;0;2;} 17:{1;0;2;} 18:{2;0;2;} 19:{3;0;2;} 20:{0;1;2;} 21:{1;1;2;} 22:{2;1;2;} 23:{3;1;2;} >

> Grid[{2,0,2}] = 7.5

## Motivations

Using nested C++ containers such as `std::vector<std::vector<std::vector<int>>>` does not offer an
efficient and generic solutions to manage multi-dimensional arrays.

[boost::multi_array](http://www.boost.org/doc/libs/1_59_0/libs/multi_array/doc/user.html) might be the closest solution but does not use a flatten storage nor stack memory based storage. Some conversions and informations are missing compared to `multidim::Grid`.

**MultiDim Grid** proposes a flat uni-dimensional array which offer a generic fast access between multi-dimension coordinates and flatten index.

## Features
- flatten storage for efficient contiguous memory access
- provide index to coordinates access with constant complexity
- provide coordinates to index access with  constant complexity
- `multidim::Grid` should behave like a C++ container as detailed in [C++ concept container](http://en.cppreference.com/w/cpp/concept/Container)
- efficient storages, such as statically-sized array, similar to C-style array

## Implementation details

- Uses static storage with `std::array`
- Uses variadic template parameters for dimensions size
- Uses compile-time computations with constexpr meta functions

## Notes

This project idea comes from a need in HPC and computational science for a multi-dimensional regular grid
class. Discussions on stack exchange can be found [here](https://stackoverflow.com/questions/31449433/generic-c-multidimensional-iterators) and [here](https://codereview.stackexchange.com/questions/97260/generic-multi-dimension-grid-array-class-in-c). Thanks to Barry for some great insights !

## License

MultiDimGrid is licensed under the terms of the MIT license.

repository: daviddoria/MultiDimGrid

repo_name: daviddoria/MultiDimGrid


text:
---
title: 'cloud-init Bootstrapping'
date: 2019-02-11T19:30:08+10:00
draft: false
weight: 4
summary: On first-boot servers receive bootstrap configurations via cloud-init.
---

Cloud vendors and popular distributions use `cloud-init` scripts to perform actions on first boot such as:

- supply a hostname
- supply a network config (beyond DHCP)
- configure the default user
- install additional repos and packages

We will leverage this strategy for a standard repeatable configuration of our Pi 4 leaving it in a well-known state amenable to further automation.

As a Raspberry Pi is a bare-metal device with no lights out management we will supply our `cloud-init` data using the ''nocloud' strategy. This is done by creating a small vfat parition on a USB flashdrive with a volume name of 'cidata'. On first boot, `cloud-init` searches for a mountable partition with a volume name of 'cidata' and if found, it will read well-known filenames found and use them as datasources for customization.

# Preparing the USB Flashdrive cidata volume
All we need is a VFAT formatted volume named 'cidata' that can be found and mounted at first boot.
We do this by using a USB flashdrive. You can use any thumbdrive to do this, it doesn't need to be expensive or have good performance. Here's an inexpensive [Sandisk 32GB Cruzer Fit USB flash drive](https://www.amazon.com/SanDisk-32GB-Cruzer-Flash-Drive/dp/B07MPCJDXS/ref=sr_1_20?keywords=sandisk+usb+thumb+drive+8gb&qid=1565535563&s=gateway&sr=8-20) only $5 on Amazon.

Reformat it, create a single 32MB (minimal size) VFAT volume named 'cidata'. You can use a tool such as `gparted` to do this simply and quickly. N.B. there should only be a single partition on the flash drive (this is important later when bootstrapping a new Pi 4 with USB3 root drive).

Copy the contents of the cloud directory into the root directory on the 'cidata' partition you created. The sections below describe the content in detail. When you boot for the first time, ensure the thumbdrive is in a USB3 slot and the microSD card has the modified Ubuntu image.

# Example Script content
### meta-data

The `meta-data` file contains [instance metadata](https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html) generally of interest to cloud operators. In our minimal pi 4 installation we will use it to create an instance-id and to set the hostname.

```
instance_id: marshall2019080901
local-hostname: dm1.pi
```

### network-config

We configure networking via `network-config`. Here we use v2 syntax which used the [netplan](https://netplan.io/) method of network configuration (preferred method in Ubuntu Bionic and later).

In the example below we set a static IP address, gateway and configure DNS. The `cloud-init` scripts take care of turning this into the appropriate `netplan` configuration files.

```
version: 2
ethernets:
  # opaque ID for physical interfaces, only referred to by other stanzas
  eth0:
    dhcp4: no
    addresses:
      - <IP_ADDRESS>/24  # private network for cluster
      - <IP_ADDRESS>/24     # static address on local network
    gateway4: <IP_ADDRESS>
    nameservers:
      search: [dm.local]
      addresses: [<IP_ADDRESS>,<IP_ADDRESS>]
```

### user-data
The instructions in `user-data` run late in the boot cycle, equivalent to `rc.local`. We use this file to set a password on the default 'ubuntu' account. We also tell `apt` to hold updates on kernel-related packages as the official Ubuntu repos will overwrite the pi 4 firmware we prepared for our image. Once pi 4 is officially supported we will be able to unhold these packages, but until then we are frozen with this kernel.

We also add an `apt` repository for Raspberry-Pi utilities such as the important `vcgencmd` (e.g. you can measure temperature via the command `vcgencmd measure_temp`).

Finally, we clone a simple git repository and use the script to set `dircolors` making our directory listings readable on a console.

```
#cloud-config
password: S3creTp@55w0rd?
chpasswd: { expire: False }
ssh_pwauth: True

# run commands
# default: none
# runcmd contains a list of either lists or a string
# each item will be executed in order at rc.local like level with
# output to the console
# - runcmd only runs during the first boot
# - if the item is a list, the items will be properly executed as if
#   passed to execve(3) (with the first arg as the command).
# - if the item is a string, it will be simply written to the file and
#   will be interpreted by 'sh'
#
# Note, that the list has to be proper yaml, so you have to quote
# any characters yaml would eat (':' can be problematic)
runcmd:
# hold kernel updates and rpi firmware distributed by Ubuntu, it's not pi 4 compatible yet
 - [ apt-mark, hold, linux-firmware-raspi2, linux-headers-4.15.0-1041-raspi2, linux-headers-raspi2, linux-image-4.15.0-1041-raspi2, linux-image-raspi2, linux-modules-4.15.0-1041-raspi2, linux-raspi2, linux-raspi2-headers-4.15.0-1041 ]
# install essential pi tools so you can run commands like 'vcgencmd measure_temp'
 - [ add-apt-repository, -y, "ppa:ubuntu-raspi2/ppa" ]
 - [ apt-get, install, -y, libraspberrypi-bin ]
 # Note: Don't write files to /tmp from cloud-init use /run/somedir instead.
 # Early boot environments can race systemd-tmpfiles-clean LP: #1707222.
 #
 # make directory listings legible and readable
 - [ git, clone, "https://github.com/huyz/dircolors-solarized", /home/ubuntu/dircolors-solarized ]
 - [ ln, -s, /home/ubuntu/dircolors-solarized/dircolors.ansi-universal, /home/ubuntu/.dircolors ]

```

## Bugs / Limitations
We must generate a new `cloud-init` datasource and copy it to the USB flasdrive for initial boot of each node.

## ToDo
- write templates for `network-config`, `user-data` and `meta-data`
- write a generator that can generate instances from templates using a simple datasource such as a `.csv` for variables


text:
# _{My-cat}_

#### _{A website dedicated to my cat -- Bella}, {08/04/2020}_

#### By _**{David Cole & Andrew Macauley}**_

## Description

_{This is a basic html webpage which utilized css styling}_

## Setup/Installation Requirements

* _in your web browser head to https://github.com/dcole505/my-cat_
* _click the green code drop down menu and copy the url_
* _Open a new terminal and type - git clone {url}_
* _Once the file is tranfered onto your local machine, open the my-cat.html file in your web browser._

## Known Bugs

_There are no known bugs at this time_

## Support and contact details

_For bugs or other issues please contact David Cole -<EMAIL_ADDRESS>
## Technologies Used

_The website was created using HTML, CSS, and GitHub_

### License

*Copyright <2020> <David Cole>

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: chloehellberg/my-cat

repo_name: chloehellberg/my-cat


text:
---
layout: engineering-education
status: publish
published: true
url: /laravel-8-collections/
title: Understanding Laravel 8 Collections
description: This tutorial will guide the reader on how to retrieve and manipulate data using Laravel collections. We will build a simple project to showcase the full power of this component.
author: odongo-albert
date: 2021-08-09T00:00:00-13:00
topics: []
excerpt_separator: <!--more-->
images:

  - url: /engineering-education/laravel-8-collections/hero.jpg
    alt: Understanding Laravel 8 Collections
---
The Laravel framework has numerous features that ease development. This article will focus on Laravel collections. We will build a simple project to showcase the full power of this component.
<!--more-->
### Table of contents
- [Prerequisites](#prerequisites)
- [Objectives](#objectives)
- [Defining Laravel collections](#defining-laravel-collections)
- [Creating Laravel collections](#creating-laravel-collections)
- [Eloquent ORM Collections](#eloquent-orm-collections)
- [Finding data](#finding-data)

### Prerequisites
To follow this article along, you need some basic knowledge of Laravel and PHP.

### Objectives
This tutorial will help you understand Laravel collections and how they can be implemented in a web project.

### Defining Laravel collections
Laravel collections can be regarded as modified versions of PHP arrays. They are located in the `Illuminate\Support\Collection` directory and provide a wrapper to work with data arrays.

We create Laravel collections using the following code snippet:

```php
//creating a test for collection for insights
public function collect(){
    //return the collection in uppercase
    return collect(['john', 'doe', null])->map(function ($test_name) {
        return strtoupper($test_name);
    })->reject(function ($test_name) {
        return empty($test_name);
    });
}
```

Output:

```bash
["JOHN", "DOE"] # output displayed on the browser
```

In the code snippet above, we used the `collect()` method to create a `Collection` instance from the defined array.

We then modified each element to uppercase and remove empty elements. Laravel collections allow us to use several methods to analyze data.

### Creating Laravel collections
We can create a Laravel collection using two major ways:

1. Using the `collect()` method:

```php
<?php
........................
//using the collect() helper
public function test_helper_collection(){
    $my_test_array=['john','doe'];
    return collect($my_test_array);
}
............................................

```

In the code above, we declared an array and passed it to the `collect()` helper method which then created the Laravel collection.

2. Using a `Collection` class instance.

```php
<?php
...........................................
//using the Collection instance
    public function test_collection_instance(){
        $my_test_array=['john','doe'];
        return new Collection($my_test_array);
}
..............................
```

In the code above, we instantiated the `Illuminate\Support\Collection` class and included our array. The class then converted the array to a collection.

### Eloquent ORM collections
ORM (Object Relational Mapping) is a database manipulation technique. Therefore, we will use the `Eloquent ORM` to return these data as a collection.

Let's create a simple database with dummy data and try to manipulate it using Laravel collections.

The first step is to edit our project's `environmental variables`, as shown below:

```bash
..............................................
DB_CONNECTION=mysql # we're using MySQL but you can modify it to meet your requirements
DB_HOST=<IP_ADDRESS>
DB_PORT=3306
DB_DATABASE=collections
DB_USERNAME=EnterYourUsername
DB_PASSWORD=EnterYourDBPassword
...............................................
```

Now, let's seed our `User` table as follows:

```bash
# create user seeder
php artisan make: seeder UserSeeder
```

Then edit the `database/seeders/userSeeder` as follows:

```php
<?php
............................................
/**
 * here, we are running the database seeds to create random users.
 *
 * @return void
 */
public function run()
{
    ................................................
    //
    DB::table('users')->insert([
        //generate random string name with 8 characters
        'name' => Str::random(8),
        //generate random string email with 6 characters
        'email' =><EMAIL_ADDRESS>        //hasing the password
        'password' => Hash::make('password'),
    ]);
}
.....................................
```

In the `database/seeders/DatabaseSeeder` file, add the following code:

```php
<?php
..............................................
/* When you run db: seed, this is the seeder run by default
*
* @return void
*/
public function run()
{
    // call UserSeeder upon seeding your database
    $this->call([
        UserSeeder::class,
    ]);
}
```

We can now seed the database by running the command below:

```bash
 php artisan db:seed

 # expected seeding output
Seeding: Database\Seeders\UserSeeder
Seeded:  Database\Seeders\UserSeeder (72.82ms)
Database seeding completed successfully.
# if you don't get this output, check if you have added the UserSeeder in the DatabaseSeeder call method
```

Since we've set up our logic, let's now query our database to return all users.

```php
 //get users from db
public function get_db_users(){
    dd(User::all());
}
```

Output:

![Collections Output](/engineering-education/laravel-8-collections/collection.png)

In the image above, the `lluminate\Database\Eloquent\Collection {#1210 ▶}` class returns a collection. We can therefore use different methods to analyze the data.

### Finding data
In this section, we will learn how to find data in a collection.

Some of the techniques that we can use are discussed below:

1. The `where()` method.
In this method, we filter a collection using the `key/value` pair.

Let's create a collection with data and filter it using the `where()` method.

```php
.................................................
  ///filter a collection using the where() method
public function apply_where_on_collections(){
    $collection = collect([
        ['Tutorial' => 'Laravel Collection', 'price' => 250],
        ['Tutorial' => 'Introduction to Laravel 8', 'price' => 140],
        ['Tutorial' => 'Laravel Cron Jobs', 'price' => 300],
        ['Tutorial' => 'Laravel Tests', 'price' => 400],
    ]);
    //filter to get a tutorial which costs $250.
    $filtered = $collection->where('price', 250);
    //return the result
    return $filtered->all();
}
........................................
```

Result:

```bash
[{"Tutorial":"Laravel Collection","price":250}]
```

2. The `contains()` method.
We use the `contains()` method to check whether a given item is available in a collection or not.

Let's look at the example below:

```php
<?php
..............................
//filter method to check item exisitence
public function apply_contains_on_collections(){
    $collection = collect([
        ['Tutorial' => 'Laravel Collection', 'price' => 250],
        ['Tutorial' => 'Introduction to Laravel 8', 'price' => 140],
        ['Tutorial' => 'Laravel Cron Jobs', 'price' => 300],
        ['Tutorial' => 'Laravel Tests', 'price' => 400],
    ]);
    //returns true/false
    dd($collection->contains('Tutorial','Laravel Collection'));
}
...............................................
```

Output:

```bash
True
```

In the example above, we checked whether an item exists in the collection and returned a boolean value depending on its availability.

### Conclusion
In this tutorial, we have learned how to use Laravel collections. We have also learned how to set up a database and retrieved data using a collection.

You can now use this knowledge to craft quality Laravel applications.

Happy coding!

### Further reading
- [Laravel collections](https://laravel.com/docs/8.x/collections)

---
Peer Review Contributions by: [Wanja Mike](/engineering-education/content/authors/michael-barasa/)

repository: mbuguac/engineering-education

gha_language: SCSS

repo_name: mbuguac/engineering-education


text:
---
title: "React and Morty"
cover: "https://unsplash.it/1280/900/?random?Morty"
author: "eduardolanda"
date: "2019-09-13"
category: "Tech"
tags:
  - React.js
  - Material-Ui
  - Axios
  - React-Reveal
---

Live project at [LIVE PROJECT LINK](http://reactandmorty.s3-website-us-west-2.amazonaws.com) by [@eduardolanda](https://github.com/eduardolanda).

This project was created using the Rick And Morty API, I used React.Js, Material-UI and Axios to retrieve the information.

Why did I create this project?

- I really like this TV show and wanted to created something with it.
- Next, I wanted to practice using Axios to get information from an API.
- Just for fun.

If you **want to change the design**, let me know and we may work together to make it happen.

I added pagination and some animation using React-Reveal

Here's an image of React and Morty in action:

![Drag Racing](https://imagesporfolio.s3-us-west-2.amazonaws.com/image3.png)

Let's make ideas real.

repository: eduardolanda/gatsbyeduardoportfolio

gha_language: JavaScript

repo_name: eduardolanda/gatsbyeduardoportfolio


text:
---
permalink: /projects/
title: "Projects"
---

Things I'm working on but haven't written about.

*   [L4-7 Nginx Loadbalancer for Kubernetes][nlb]
*   [Openwisp on Docker][openwisp]
*   [Rancher Kubernetes on KVM][rancher]
*   [Kubernetes on Bare Metal with Terraform][kbm]
*   [Deply PowerDNS with Terraform][pdns]
*   [Deploy OpenVPN with Terraform][tovpn]
*   [OpenVPN on Docker][ovpn]
*   [Freeradius on Docker][freerad]
*   [VYOS on Docker][vyos] on Dockerhub [@2stacks/vyos][vyos]
*   [Speed Detection with Python][carspeed]
*   [Blynk Interface for PhoBot][blynk]

[blynk]: http://www.2stacks.net/blynk-rover
[ovpn]: http://www.2stacks.net/docker-ovpn
[freerad]: http://www.2stacks.net/docker-freeradius
[tovpn]: http://www.2stacks.net/terraform-openvpn
[vyos]: https://cloud.docker.com/u/2stacks/repository/docker/2stacks/vyos
[rancher]: https://github.com/2stacks/rancher-kvm
[kbm]: https://github.com/2stacks/terraform-kbm
[pdns]: https://github.com/2stacks/terraform-powerdns
[openwisp]: https://github.com/2stacks/docker-openwisp
[nlb]: https://github.com/2stacks/terraform-nginx-lb
[carspeed]: https://github.com/2stacks/carspeed.py


text:
# MMM-IFTTT
[MagicMirror](https://magicmirror.builders/) Module for [IFTTT Maker](https://ifttt.com/maker) Web Based Notifications

![Screenshot](screenshot.png)

This module is intended to display immediate notifications of events from If-This-Then-That channels.
Notifications will show for a default of 60 seconds before disappearing. There is no on-screen history
of events.

## Module installation

Clone the module and npm install:

```bash
cd ~/MagicMirror/modules
git clone https://github.com/jc21/MMM-IFTTT.git
cd MMM-IFTTT
npm install
```

Add the module config to `~/MagicMirror/config/config.js`

```javascript
modules: [
    {
        module: 'MMM-IFTTT',
        position: 'lower_third',
        config: {

        }
    }
]
```

## Module Configuration Options

            Option
            Type
            Default
            Description

            displaySeconds
            Integer
            60
            Number of seconds to show a notification for

            fadeSpeed
            Integer
            3000
            Milliseconds fade transition speed

            size
            String
            large
            Text size, options are: small, medium, large, xlarge

## Setting up a IFTTT Maker Notification

### Making your mirror internet accessible

For this module to work, you will need to get dirty with your router, specifically with Port Forwarding.

I'm not going to go into detail here, there are plenty of [Google results](https://www.google.com.au/?gws_rd=ssl#q=router+port+forwarding)
 on the topic.

You will need to forward any port you nominate, to the local IP of your Magic Mirror on port 8080.

You will also need to set up a dynamic DNS hostname for your home network, I'm a [Duckdns](https://www.duckdns.org/)
 fan personally. Atlernatively you could look into a http forward solution like [ngrok](https://ngrok.com/).

### IFTTT Maker Recipes

Log in to [IFTTT](https://ifttt.com/) and create a new recipe. You can essentially choose any channel
 you want for the Trigger but for the Action channel you must select Maker.

There is only one Action, "Make a web request".

Action fields explained:

            Field
            Description
            Example

            URL
            Notification endpoint
            http://yourhouse.duckdns.org:8080/IFTTT

            Method
            HTTP Method, MUST be POST
            POST

            Content Type
            How the data is sent
            application/json

            Body
            The notification content, explained below

{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large"
}

The notification body JSON MUST contain the `message` item. If it doesn't, the endpoint will return a 400 error.
 All of the configuration options can also be passed with the JSON, which will override the config for
 that recipe only.

The `<<<{{From}}>>>` in the example above is a IFTTT wildcard field that you select in the Body section
 of the action. You can create any message you like that incorporates any wildcard. Stay away from fields that may
 contain HTML or links, they won't display well. These fields should be surrounded in `<<<` and `>>>` strings in
 order for the field to be escaped properly.

## Using additional modules

This module will send out notifications to other supported modules, if those options are included in the notification JSON.
The supported modules are:

#### [MMM-Pir-Sensor](https://github.com/paviro/MMM-PIR-Sensor)

IFTTT Module will automatically tell the Pir Sensor module to wakeup the monitor when a notification is received. No addition setup is required.

#### [MMM-PiLights](https://github.com/jc21/MMM-PiLights)

This additional module can display light sequences using a LED strip. An example of a notification that includes PiLights sequence:

```json
{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "pilights": "blue-pulse"
}
```

Or with iterations:

```json
{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "pilights": {
        "sequence": "blue-pulse",
        "iterations": 2
    }
}
```

#### [MMM-Sounds](https://github.com/jc21/MMM-Sounds)

This additional module can play audio sounds if your mirror supports it. An example of a notification that would play a Sound:

```json
{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "sound": "wobble.wav"
}
```

Or with a delay:

```json
{
    "message": "<<<{{From}}>>> tagged you in a Photo",
    "displaySeconds": 45,
    "size": "large",
    "sound": {
        "sound": "wobble.wav",
        "delay": 1000
    }
}
```

You may want to use the delay approach to manually align the sound you're using with the light sequence, or to time the wakeup of the screen as well.

## Testing the Mirror Endpoint

```bash
curl -X POST -H "Content-Type: application/json" \
    -d '{"message": "Your pizza is ready!"}' \
    "http://yourhouse.duckdns.org:8080/IFTTT"
```


text:
Pattern: Address of function parameter returned

Issue: -

## Description

Address of the function parameter becomes invalid after the function exits because function parameters are stored on the stack which is freed when the function exits. Thus the returned value is invalid.

## Further Reading

* [Common Weakness Enumeration (CWE) - 562](https://cwe.mitre.org/data/definitions/562.html)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
# PortMap
A responsive web map application template using [Bootstrap](https://getbootstrap.com/) and [Mapbox GL](https://www.mapbox.com/mapbox-gl-js/api/)

To get started you need to generate a Mapbox ID. Get your ID by creating a Mapbox account. Insert your Mapbox ID in assets/js/map.js on line 1.

## What it does:
* Layer tree allows the user to interactively organize and reposition map layers using [Mapbox-GL-JS-Layer-Tree](https://github.com/TheGartrellGroup/Mapbox-GL-JS-Layer-Tree)
* Layer Tree pulls feature symbology automatically via [Font Awesome](http://fontawesome.io/ )
* Supports drawing and editing using [Mapbox Draw API](https://github.com/mapbox/mapbox-gl-draw)
* User can calculate area and length of drawn features using [Mapbox Turf](https://www.mapbox.com/help/define-turf/)
* User can add labels directly to the map as a symbol layer using [Mapbox-GL-JS-Text-Markup](https://github.com/TheGartrellGroup/Mapbox-GL-JS-Text-Markup)
* User can easily find latitude and longitude by clicking on the map
* Global address search using the [mapbox-gl-geocoder](https://github.com/mapbox/mapbox-gl-geocoder)
* Search JSON Properties with autocomplete and zoom to feature
* Client side Print Export to PNG or PDF with legend: [Print/Export for Mapbox GL](https://github.com/TheGartrellGroup/Mapbox-GL-Print-Export-For-Port)
* Identify multiple features and view attributes in a modal
* Bookmark drop-down list
* Disclaimer modal
* Scale bar
* Not included in this repo: Save Views function allows the user to save Layer Tree configuration, Mapbox drawn features, Text Markups, and Zoom and Pitch. All plugins in this repo have code pre-built to work with the Save Views plugin: [Mapbox-GL-JS-save-view](https://github.com/TheGartrellGroup/Mapbox-GL-JS-save-view)

## Demo and Tutorial:
[Demo](https://cdettlaff.github.io./)

I created a [Tutorial](https://opensource.portofportland.io/portmap-tutorial.html) that shows you how to add data to PortMap, and make that data interactive.

## Quick Preview:

### Layer Tree
![layers](https://user-images.githubusercontent.com/17071327/114205473-2e94e080-990f-11eb-8ad0-64ace1f12af5.png)

### Identify Features
![identify](https://user-images.githubusercontent.com/17071327/114205484-30f73a80-990f-11eb-90f5-069a8e469fa4.png)

### Draw and Text
![draw](https://user-images.githubusercontent.com/17071327/114205491-32286780-990f-11eb-91e5-b4cb8d33bc8c.png)

### Search JSON with autocomplete
![search](https://user-images.githubusercontent.com/17071327/114205518-38b6df00-990f-11eb-88ba-1070afdd4f4b.png)

### Client Side Printing
![print](https://user-images.githubusercontent.com/17071327/114205528-3a80a280-990f-11eb-9586-afdbe6a943d7.png)

### Location Tools
![mobile](https://user-images.githubusercontent.com/17071327/114205505-348ac180-990f-11eb-8735-e084c86a7454.png)

repository: portofportlandgis/portmap

repo_name: portofportlandgis/portmap


text:
# Changelog

All notable changes to `doltlines-io/core` package will be listed in this file.

## 1.0.8 - 2021-05-24

- Upgrades dependencies

## 1.0.7 - 2021-05-20

- Extends Request Processing

## 1.0.6 - 2021-05-19

- Upgrades and removes some dependencies

## 1.0.5 - 2021-05-19

- Improves code using psalm errorLevel 1

## 1.0.4 - 2021-05-17

- Updates for packagist badge

## 1.0.3 - 2021-05-17

- Readme file updated for badges

## 1.0.2 - 2021-05-17

- Introduces automated test for github commits

## 1.0.1 - 2021-05-16

- Removes non php 7.0 compatible features

## 1.0.0 - 2021-05-16

- initial release

repository: dotlines-io/core

repo_name: dotlines-io/core


text:
# Merosss Local Broker Addon

This addon aims at implementing a full Meross Broker (both MQTT and HTTP components) within HomeAssistant.

The main advantage of running a local broker is that you can workaround the HTTP/MQTT limits imposed by the
Meross Cloud. This becomes particularly necessary when running an high number of Meross devices:
as Homeassistant aggressively polls device status, Meross Cloud team might ban HA users.

## Disclaimer

Meross does not officially support this integration, neither provides OpenSource/API specs.
This component, and all the others around the Meross python ecosystem, has been developed by applying
protocol inspection and guessing. Thus, expect this addon/component to be unstable: at any time Meross might
change their internals and break the logic within this addon.

## Features

Before installing this addon, it is important to understand **what this addon does** and **what it does not**.

To get there, know that Meross devices rely on a 3 tiers distributed architecture:

- Physical hardware devices (smart plugs/bulbs/power-strip/valves/...)
- Remote HTTP Api server
- Remote MQTT Api server

Each physical device connects to the MQTT server and sends/receives updates/commands to/from certain topics.
Users, via the Meross App, talks to the Meross HTTP server to register, login and enroll their Meross devices.
The Meross app, in turn, is also capable to talk to the physical devices via the MQTT server.

This addon re-implements both the MQTT and the HTTP API parts of the Meross ecosystem, allowing your Meross physical devices
to talk locally on the LAN to such components. This enables you to get rid of Meross limits as this local addon does not enforce any.

## Compatibility & tested environments

This addon has been tested on Homeassistant Docker environment, specifically on AMD64 VMWare virtual machine and on a
Raspberry PI 3 B+ (ARM arch). While it is possible to run it on embedded Homeassistand devices (raspberry PI, ODROID),
it is highly recommended to run it on X86/AMD64 CPU with at least 2 cores and 4Gb or RAM memory. Even though the
absorbed resources at runtime are much lower, the build phase of the Docker container requires high memory and CPU
power, as most of the software is compiled from scratch.

To give you an idea of what that means, consider that the installation phase on a **Raspberry Pi 3 B+ takes about
60 minutes** to complete, while only **3~5 minutes on a 4-cpu 4 Gb ram virtual machine**.

Run this addon on Intel NUC / X86 / AMD64 platform powered Homeassistant installations.

## Donate!

TBD

repository: tfergy/meross-homeassistant

repo_name: tfergy/meross-homeassistant


text:
---
layout: post
title:  BM25 Review Search
excerpt: There are numerous reviews available and it is not feasible to go through every one of them manually in order to obtain the information needed......
# categories: [HTML,Code]
---
There are numerous reviews available and it is not feasible to go through every one of them manually in order to obtain the information needed.

We have implemented a search engine using BM25 that will fetch the most relevant reviews to the given user query.

Okapi BM25 is a ranking function used to rank documents of the data set based on the relevance to a given query. It considers term frequency as well as document length. Given a query, it will assign a score to every document (review in this case). Larger score means the document is more relevant to the query, correspondingly, smaller score denotes less relevance.

We are fetching 5 most relevant reviews to the user query.


text:
# A Survey on Heterogeneous Graph Embedding: Methods, Techniques, Applications and Sources

## 1. Brief introduction and overview for Heterogeneous Graph Embedding method

Since heterogeneous graphs (HGs) is capable of composing different types of entities or heterogeneous information, it has been widely applied in bibliographic networks, social networks, and recommendation systems. Due to the ubiquity of HG data, how to learn embeddings of HG is a key research problem in various graph analysis applications, e.g., node/graph classification, node clustering, link prediction.

Heterogeneous graph embedding aims to learn a function $\Phi: \mathcal V \rightarrow \mathbb R^d$ that embeds the nodes $v\in \mathcal V$ in HG into a low-dimensional Euclidean space with $d \ll|\mathcal V|$.

Based on the user information in the heterogeneous graph, HG embedding methods can be categorized into four categories,

![category](overview.png)

- **Structure-preserved heterogeneous graph embedding.** Focusing on capturing and preserving the heterogeneous structures and semantics, e.g., the meta-path and meta-graph.
- **Attributeassisted heterogeneous graph embedding.** Focusing more on the node and edge attributes.
- **Dynamic heterogeneous graph embedding.** Different from static heterogeneous graph embedding, it focuses more on sequential modeling, which aims to capture the evolution of heterogeneous graphs.

## 2. Method Taxonomy

### 2.1 Structure-preserved HG embedding

The typical heterogeneous graph embedding methods include the link (edge), meta-path, and subgraph.

**(1) Link-based HG embedding**

Like TranX for knowledge graph embedding, [PME](https://dl.acm.org/doi/10.1145/3219819.3219986) treats each link type as a relation, and the nodes can be projected to different metric space, based on the relation-specific matrix. Thus, the distance function between nodes can be defined as follows:

$$
S_r(v_i,v_j)=w_{ij}||M_rh_i-M_rh_j||_2=\sqrt{(h_i-h_j)^TM_r^TM_r(h_i-h_j)}\tag{1}
$$

where $h_i$ and $h_j \in \mathbb R^{d\times 1}$ denote the node embeddings of node $i$ and node $j$, respectively. $M_r \in \mathbb R^{d\times d}$ is the projection matrix of relation $r$; and $w_{ij}$ represents the weight of link between node $i$ and node $j$; $M_r^TM_r\in \mathbb R^{d\times d}$ is the metric matrix of Mahalanobis distance.

Margin based triple loss function was applied for positive and negative samples:

$$
L=\sum_{r\in R}\sum_{(v-I,v_j)\in E_r}\sum_{(v_i,v_k)\notin E_r}[\xi +S_r(v_i,v_j)^2-S_r(v_i,v_k)^2]_+\tag{2}
$$

where $\xi$ denotes the margin, $E_r$ represents the positive links of relation $r$, and $[z]_+ = max(z, 0)$.

Besides, [EOE](https://dl.acm.org/doi/pdf/10.1145/3018661.3018723) and [HeGAN](https://dl.acm.org/doi/10.1145/3292500.3330970) uses below formulate to calculate the similarity,

$$
S_r(v_i,v_j)=\frac{1}{1+exp{-h_i^TM_rh_j}}\tag{3}
$$

Compared to distance and similarity calculation, [AspEM](https://arxiv.org/pdf/1803.01848.pdf) and [HEER](https://arxiv.org/pdf/1807.03490.pdf) aim to maximize the probability of existing links. The heterogeneous similarity function is defined as:

$$
S_r=\frac{exp(\mu_r^Tg_{ij})}{\sum_{\tilde i\in E_{\tilde ij}^r}exp(\mu_r^Tg_{\tilde ij})+\sum_{\tilde j\in E_{i\tilde j}}^rexp(\mu_r^Tg_{i\tilde j})}\tag{4}
$$

where $\mu_r\in \mathbb R^{d\times 1}$ is the embedding of relation $r$; $g_{ij}\in \mathbb R^{d\times 1}$ is the embedding of link between node $i$ and node $j$; $g_{ij}=h_i\odot h_j$ denotes the hadamard product; and $E_{\tilde ij}^r$ is the set of negative links, which indicates that there is no link between node $\tilde i$ and node $j$.  Maximizing Sr enlarges the closeness between the existing links and their corresponding types, thus capturing the heterogeneity of the graph.

Similar to TransE, [MELL](https://dl.acm.org/doi/fullHtml/10.1145/3184558.3191565) uses the equation ’head + relation = tail’ to learn the node embeddings for heterogeneous graph.

**(2)Path-based HG embedding**

Link-based methods can only capture the local structures of HG, i.e., the first-order relation. The higher-order relation contains more semantic information for HG embedding. Because the number of high-order relations is very large, in order to reduce complexity, meta-path based HG embedding methods were developed, which can be divided into two categories: random walk-based and hybrid relation-based.

- Random walk-based methods usually use meta-path to guide random walk on a HG, so that the generated node sequence contains rich semantic information not only from first-order relations but also from high-order relations. [Metapath2vec](https://ericdongyx.github.io/papers/KDD17-dong-chawla-swami-metapath2vec.pdf) is a typical work.

Guided by meta-path, Metapath2vec first generates heterogeneous node sequences via random walk. Then, like skip-gram, Metapath2vec predicts the context nodes $c_t$ probability distribution based on center node $v$.

$$
\arg\; \operatorname*{max}_{\theta} \sum_{v\in \mathcal V}\sum_{t\in \mathcal A}\sum_{c_t\in C_t(v)} logp(c_t|v;\theta)\\
p(c_t|v;\theta)=\frac{e^{h_{c_t}\cdot h_v}}{\sum_{\tilde v\in \mathcal V}e^{h_{\tilde v}\cdot h_v}}\tag{5}
$$

where $C_t(v)$ represents the context nodes of node $v$ with type $t$, $h_t, h_{C_t}$ represent the hiden vectors.

Like skip-gram Metapath2vec introduces a negative sampling strategy to reduce the computation,

$$
log \sigma(h_{c_t}\cdot h_v)+\sum_{q=1}^Q\mathbb E_{\tilde v^q ~ P(\tilde v)}[log\sigma(-h_{\tilde v^q}\cdot h_v)]\tag{6}
$$

where $\sigma(\cdot)$ is the sigmoid function, and $P(\tilde v)$ is the distribution in which the negative node $\tilde v^q$ is sampled for $Q$ times.

![metapath2vec](metapath2vec.png)

However, when choosing the negative samples, metapath2vec does not consider the types of nodes, i.e., different types of nodes are from the same distribution $P(\tilde v)$. It further designs metapath2vec++, which samples the negative nodes of the same type as the central node, i.e., $\tilde v_t^q ~ P(\tilde v_t)$.

- Hybrid relation-based methods use the combination of first-order relation and high-order relation (i.e., meta-path) to capture the heterogeneity of HG. HIN2vec is a typical work, which carries out multiple relation prediction tasks jointly to learn the embeddings of nodes and meta-paths.

The objective of [HIN2vec](https://dl.acm.org/doi/10.1145/3132847.3132953) is to predict whether two nodes are connected by a meta-path. As illustrated in Fig. 4, given two nodes $i$ and $j$, HIN2vec uses the following function to compute their similarity under the hybrid relation $r$:

$$
S_r(v_i,v_j)=\sigma(\sum W_I \overrightarrow i \odot W_J\overrightarrow j\odot f_{01}(W_R\overrightarrow r))\tag{7}
$$

where $\overrightarrow i, \overrightarrow j$, and $\overrightarrow r\in \mathbb R^{N\times 1}$ denote the one-hot vectors of nodes and relation, respectively; $W_I, W_J$ and $W_R\in \mathbb E^{d\times N}$ are the mapping matrices; and $f_{01}$ is a regularization function, which limits the embedding values between 0 and 1. The loss function is a binary cross-entropy loss:

$$
E_{ij}^r logS_r(v_i,v_j)+[1-E_{ij}^r]log[1-S_r(v_i,v_j)]\tag{8}
$$

where $E_{ij}^r$ denotes the set of positive links. In the relation set $R$, it contains not only the first-order structures (e.g., A-P relation) but also the high-order structures (e.g., A-P-A relation). Therefore, the node embeddings can capture different semantics.

![HIN2vec](HIN2vec.png)

Compared with random walk-based methods, hybrid relation-based methods can simultaneously integrate multiple meta-paths into heterogeneous graph embedding flexibly.

**(3) Subgraph-based HG embedding**

Inspired by metapath2vec, metagraph2vec uses meta graph-guided random walk to generate heterogeneous node sequence, then skip-gram was applied to learn node embeddings.

[DHNE](https://arxiv.org/pdf/1711.10146.pdf) is a typical hyperedge-based graph embedding method. In this paper, the author defines a hyperedge with three nodes $a, b$, and $c$, and considering the nodes in the hyperedge are indecomposable. Thus, a tuplewise similarity was designed to capture the structure features.

![hyperedge](DHNE_1.png)

The first layer of DHNE is an autoencoder, which is used to learn latent embeddings and preserve the second-order structures of the graph. The second layer is a fully-connected layer with embedding concatenated:

$$
L_{ijk}=\sigma(W_a^{(2)}h_i\oplus W_b^{(2)}h_j \oplus W_c^{(2)}h_k)\tag{9}
$$

where $L_{ijk}$ denotes the embedding of the hyperedge (nodes $i,j,k$); $h_i, h_j$ and $h_k \in \mathbb R^{d\times 1}$ are the embeddings of node $i, j$ and $k$ learn by the autoencoder. $W_a^{(2)}, W_b^{(2)}$ and $W_c^{(2)} \in \mathbb R^{d'\times d}$ are the transformation matrices for different node types. Finally, the third layer is used to calculate the indecomposability of the hyperedge,

$$
S_{ijk}=\sigma(W^{(3)}*L_{ijk}+b^{(3)})\tag{10}
$$

where $S_{ijk}$ denote the indecomposability of the hyperedge, $W^{(3)}\in \mathcal R^{1\times 3d'}$ and $b^{(3)}\in \mathcal R^{1\times 1}$ are the weight matrix and bias, respectively. A higher value of $S_{ijk}$ means these nodes are from the existing hyperedges, otherwise it should be small.

![DHNE](DHNE_2.png)

Since DHNE considers both first-order proximity and second-order proximity, the loss function joint tuplewise similarity (first-order proximity) and neighborhood structure similarity (second-order proximity) as the objective function,

$$
\begin{cases}
\mathcal L=L_1+\alpha \mathcal L_2\\
\mathcal L_1=-(R_{ijk}logS_{ijk}+(1-R_{ijk})log(1-S_{ijk}))\\
\mathcal L_2=\sum_t||sign(A_i^t)\odot(A_i^t-\hat A_i^t)||_F^2\\
X_i=\sigma(W^{(1)}*A_i+b^{(1)})\\
\hat A_i=\sigma(\hat W^{(1)}*X_i+\hat b^{(1)})\\
\end{cases}\tag{11}
$$

$\mathcal L_1$ is cross-entropy loss, $R_{ijk}$ is defined as 1 if there is a hyperedge between $i,j,k$ and 0 otherwise. $\mathcal L_2$ is a reconstruction error for neighborhood structure, which can be represented by autoencoder model. $X_i, \hat A_i$ are encoded vector and decode vector respectively. $t$ is the index for node types, $A$ is the adjacency matrix.

Compared with the structures of link and meta-path, subgraph (with two representative forms of meta-graph and hyperedge) usually contains much higher order structural and semantic information. However, one obstacle of subgraph-based heterogeneous graph embedding methods is the high complexity of the subgraph. How to balance the effectiveness and efficiency is required for practical subgraph-based heterogeneous graph embedding methods, which is worthy of further exploration.

### 2.2 Attribute-assisted HG embedding

Attribute-assisted heterogeneous graph embedding methods aim to encode the complex structures and multiple attributes to learn node embeddings.

**(1) Unsupervised HGNNs**

[HetGNN](https://dl.acm.org/doi/10.1145/3292500.3330961) is the representative work of unsupervised HGNNs. It consists of three parts: content aggregation, neighbor aggregation, and type aggregation. Content aggregation is designed to learn fused embeddings from different node contents, such as images, text, or attributes:

$$
f_1(v)=\frac{\sum_{i\in C_v}[\overrightarrow{LSTM}\{\mathcal {FC}(h_i)\}\oplus\overleftarrow{LSTM}\{\mathcal{FC}(h_i)\}]}{|C_v|}\tag{12}
$$

where $C_v$ is the type of node $v$'s attributes. $h_i$ is the $i-$th attributes of node $v$. A bi-directional Long Short-Term Memory (Bi-LSTM) is used to fuse the embeddings learned by multiple attribute encoder $\mathcal{FC}$.  Neighbor aggregation aims to aggregate the nodes with the same type by using a Bi-LSTM to capture the position information:

$$
f_2^t(v)=\frac{\sum_{v'\in N_t(v)}[\overrightarrow{LSTM}\{f_1(v')\}\oplus\overleftarrow{LSTM}\{f_1(v')\}]}{|N_t(v)|}\tag{13}
$$

where $N_t(v)$ is the first-order neighbors of node $v$ with type $t$. Type aggregation uses an attention mechanism to mix the embeddings of different types and produces the final node embeddings.

$$
h_v=\sum_{f_i\in \mathcal F(v)}\alpha^{v,i}f_i\\
\alpha^{v,i}=\frac{exp\{LeakyReLU(u^T{f_i\oplus f_1(v)})\}}{\sum_{f_j\in \mathcal F(v)}exp\{LeakyReLU(u^T{f_j\oplus f_1(v)})\}}\tag{14}
$$

where $\mathcal F(v)=\{f_1(v)\cup (f_2^t(v),t\in O_V)\}, h_v$ is the final embedding of node $v$. Finally, a heterogeneous skip-gram loss is used as the unsupervised graph context loss to update the node embeddings.

**(2) Semi-supervised HGNNs**

[Heterogeneous graph attention network (HAN)](https://arxiv.org/pdf/1903.07293.pdf) uses a hierarchical attention mechanism to capture both mode and semantic importance.

![HAN](HAN.png)

It consists of three parts: node-level attention, semanticlevel attention and prediction. Node-level attention aims to utilize self-attention mechanism to learn the importances of neighbors in a certain meta-path:

$$
\alpha_{ij}^m=\frac{exp(\sigma(a_m^T\cdot[h_i'||h_j']))}{\sum_{k\in \mathcal N_i^m}exp(\sigma(a_m^T\cdot [h_i'||h_k']))}\tag{15}
$$

where $\mathcal N_i^m$ is the neighors of node $i$ in meta-path $m, \alpha_{ij}^m$ is the weight of node $j$ to node $i$ under meta-path $m$. $||$ is concat operation. The node-level aggregation is defined as:

$$
h_i^m=\sigma (\sum_{j\in \mathcal N_{ij}^m}\alpha_{ij}^m\cdot h_j)\tag{16}
$$

where $h_m^i$ denotes the learned embedding of node $i$ based on meta-path $m$.

Because different meta-paths capture different semantic information of HG, a semantic level attention mechanism is designed to calculate the importance of meta-paths.

$$
w_{m_i}=\frac{1}{|\mathcal V|}\sum_{i\in \mathcal V}q^T\cdot tanh(W\cdot h_i^m+b)\tag{17}
$$

where $W \in \mathbb R^{d'\times d}$ and $b \in \mathbb R^{d'\times 1}$ denote the weight matrix and bias of the MLP, respectively. $q \in \mathbb R^{d'\times 1}$ is the semantic-level attention vector. Hence, the semantic-level aggregation is defined as,

$$
H=\sum_{i=1}^P\beta_{m_i}\cdot H_{m_i}\\
\beta_{m_i}=\frac{exp(w_{m_i})}{\sum exp(w_{m_i})} \tag{18}
$$

In order to prevent the node embeddings from being too large, HAN uses the softmax function to normalize $w_{m_i}$. $H\in \mathbb R^{N\times d}$ denotes the final node embeddings, which can be used in the downstream tasks, such as node clustering and link prediction.

There are two ways to solve the heterogeneity of attributes: one is to use different encoders or type-specific transformation matrices to map the different attributes into the same space. Another is to treat meta-path as a special edge to connect the nodes with the same type. Compared with shallow models, HGNNs has an obvious advantage in that they have the ability of inductive learning, i.e., learning embeddings for the out-of-sample nodes. Besides, HGNNs need smaller memory space because they only need to store model parameters. However, they still suffer from the huge time costing in inferencing and retraining.

### 2.3 Dynamic HG embedding

The dynamic heterogeneous graph embedding methods can be divided into two categories: incremental update and retrained update methods. The former learns the embedding of a new node in the next timestamp by utilizing existing node embeddings, while the latter will retrain the models in each timestamp.

**(1) Incremental HG embedding**

[DyHNE](https://ieeexplore.ieee.org/document/9091208) is an incremental update method based on the theory of matrix perturbation, which learns node embeddings while considering both the heterogeneity and evolution of HG. To ensure effectiveness, DyHNE preserves the meta-path based first- and second-order proximities. The first-order proximity requires two nodes connected by meta-path $m$ to have similar embeddings. And the second-order proximity indicates that the node embedding should be close to the weighted sum of its neighbor embeddings. Besides, DyHNE uses the perturbation of meta-path augmented adjacency matrices to naturally capture changes of the graph, which is an effective and efficient method.

**(2) Retrained HG embedding**

DyHATR aims to capture the temporal information through the changes of node embeddings in different timestamps. First, the node- and edge-level attention was design to learn the node embeddings under different timestamps.

$$
\alpha_{i,j}^{rt}=\frac{exp(\sigma(a_r^T\cdot[M_r\cdot h_i|| M_r\cdot h_j]))}{\sum_{k\in \mathcal N_i^{rt}}exp(\sigma(a_r^T\cdot[M_r\cdot h_i|| M_r\cdot h_j]))}\\
\beta_{i}^{rt}=\frac{exp(q^T\cdot \sigma(W\cdot h_i^{rt}+b))}{\sum_{r\in R}exp(q^T\cdot \sigma(W\cdot h_i^{rt}+b))}\tag{19}
$$

$\alpha_{i,j}^{rt}, \beta_{i}^{rt}$ are node-level attention and edge-level attention. $\mathcal N_i^{rt}$ represents the neighbors of node $i$ in edge type $r$ and timestamp $t$, $a_r$ is the attention vector in node-level attention, $q^T$ is the attention vector in edge-level attention. Furthermore, the node embeddings are fed into a RNN in the order of timestamps to capture the temporal information hidden in the changes of node embeddings.

![DyHATR](DyHATR.png)

### 2.4 Technique summary

Overall, the above methods can be generally divided into two categories: shallow model and deep model.

**(1) Shallow model**

- **Random walk-based:** Random walk is a classical method for graph representation. For instance, metapath2vec applies meta-path-guided random walk to capture the semantic information of nodes.
- **Decomposition-based:** Decomposition-based techniques aim to decompose HG into several sub-graphs and preserve the proximity of nodes in each sub-graph. PME decomposes the heterogeneous graph into some bipartite graphs according to the types of links and projects each bipartite graph into a relation-specific semantic space. Then, based on margin-based triple loss function to train the model.

**(2) Deep model**

- **Message passing-based:** The idea of the message passing-based method is to consider the message propagation in graphs, based on GNN to aggregate neighbors' information and capture node embedding. HetGNN uses bi-LSTM to aggregate the embedding of neighbors so as to learn the deep interactions among heterogeneous nodes.
- **Encoder-decoder-based:** Encoder-decoder-based techniques aim to design neural networks to learn node embedding. DHNE defines hyperedge, consist of three nodes, as the basic unit of the graph, then applies autoencoder to learn latent embeddings of nodes. Designing a non-linear tuplewise similarity to calculate the indecomposability of the hyperedge. And applying cross-entropy function and adjacency matrix reconstructed function to measure first-order proximity and second-order proximity respectively.
- **Adversarial-based:** In a homogeneous graph, the adversarial-based techniques only consider the structural information. [HeGAN](https://dl.acm.org/doi/10.1145/3292500.3330970) is the first to use GAN in heterogeneous graph embedding. It incorporates the multiple relations into the generator and discriminator so that the heterogeneity of a given graph can be considered.

Above all, the main methods can be summarized below:

| First category | Second category | Main idea | Complexity | Typical model |
| --- | --- | --- | --- | --- |
| Shallow model| Random walk-based | Based on a random walk to capture semantic information | Determined by random walk and skip-gram, both of which are linear with the number of nodes | Metapath2vec applies meta-path-guided random walk to capture the semantic information of nodes |
|  | Decomposition-based | Decompose HG into several sub-graphs and preserve the proximity of nodes in each sub-graph | Linear with the number of edges, which is higher than random walk | PME decomposes the heterogeneous graph into some bipartite graphs according to the types of links and projects each bipartite graph into a relation-specific semantic space. Then, based on margin-based triple loss function to train model |
| Deep model | Message passing-based | Consider the message propagation in graphs, based on GNN to aggregate neighbors' information and capture node embedding | Related to the number of nodes and node types | HetGNN uses bi-LSTM to aggregate the embedding of neighbors so as to learn the deep interactions among heterogeneous nodes |
|  | Encoder-decoder-based | Design neural networks to learn node embedding | Linear with the number of edges | DHNE defines hyperedge, consist of three nodes, as the basic unit of the graph, then apply autoencoder to learn latent embeddings of nodes. Designing a non-linear tuplewise similarity to calculate the indecomposability of the hyperedge. And applying cross-entropy function and adjacency matrix reconstructed function to measure first-order proximity and second-order proximity respectively |
|  | Adversarial-based | Utilize the game between generator and discriminator to learn robust node embedding | Related to the number of nodes and negative samples | HeGAN is the first to use GAN in heterogeneous graph embedding. It incorporates the multiple relations into the generator and discriminator so that the heterogeneity of a given graph can be considered |

## 3. Benchmarks and open-source tools

### 3.1 Benchmark datasets

There are some popular real world HG datasets, which can be divided into three categories: academic networks, business networks and film networks, such as [DBLP](http://dblp.uni-trier.de), [Aminer](https://www.aminer.cn), [Yelp](http://www.yelp.com/dataset challenge/), [Amazon](http://jmcauley.ucsd.edu/data/amazon), [IMDB](https://grouplens.org/datasets/movielens/100k/), [Douban](http://movie.douban.com/). The detailed statistical information was summarized in below Table.

![dataset](datasets.png)

### 3.2 Open-source code

Some related papers' source code was listed in Table 4.

![code](code.png)

Furthermore, there are some commonly used website about graph embedding,

- **[Stanford Network Analysis Project (SNAP)](http://snap.stanford.edu/).** It is a network analysis and graph mining library, which contains different types of networks and multiple network analysis tools.
- **[Microsoft TensorFlow2 GNN Library)](https://github.com/microsoft/tf2-gnn).** Implementation and example training scripts of various flavors of graph neural network in TensorFlow 2.0, contributed by Microsoft team.
- **[Papers with Code](https://paperswithcode.com/area/graphs).** Papers with Code is an open community to create a free and open resource with machine learning papers, code, and evaluation tables. The core team of Papers with Code is based in Facebook AI Research.
- **[HG Resources](https://github.com/BUPT-GAMMA/OpenHINE).** Created by [Shichuan group](http://shichuan.org/), GAMMA Lab, Beijing University of Posts and Telecommunications, this open-source toolkit provides implementations of many popular models for Heterogeneous Information Network Embedding, including DHNE, HAN, HeGAN, HERec, and so on.

### 3.3 Available tools

Some popular toolkits and platforms for heterogeneous graph research were listed below.

- **[Deep Graph Library (DGL)](https://www.dgl.ai/).** Deep Graph Library (DGL) is a Python package built for easy implementation of graph neural network model family.
- **[Pytorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/).** It is a geometric deep learning extension library for PyTorch. Specifically, it focuses on the methods for deep learning on graphs and other irregular structures.

## 4. Challenges and future directions

- **Preserving HG structures.** To exploit graph structure, the most typical method is meta-path, while it heavily relies on domain knowledge and handwork. So how to learn graph structure automatically and effectively, is still very challenging.
- **Capturing HG Properties.** Currently, the nodes and edges properties have not been fully considered, which may provide additional information for graph learning. Dynamic heterogeneous graph embedding is still facing big challenges.
- **Making HG embedding reliable.** Considering that most methods are black boxes, making HG embedding fair, robust, and explainable is important future work.

## 5. Conclusion

The typical methods for HG embedding can be summarized below,

![methods](methods.png)

- Most message passing-based methods have the inductive capability because they can update the node embeddings by aggregating neighborhood information. But they need additional labels to guide the training process.
- Most deep learning-based methods are proposed for HG with attributes or a specific application, while the shallow model-based methods are mainly designed for the use of structures.
- The emerging HGNNs can naturally integrate graph structures and attributes, so it is more suitable for the complex scenes and content.
- Shallow models are easy to parallel. But they are two-stage training, i.e., the embeddings are not relevant to the downstream tasks, and the memory cost is heavy. On the contrary, deep models are end-to-end training and require less memory space.
- Message passing-based techniques are good at encoding structures and attributes simultaneously and integrating different semantic information.
- Compared with message passing-based techniques, encoder-decoder-based techniques are weak in fusing information due to the lack of messaging mechanism. But they are more flexible to introduce different objective functions through different decoders.
- Adversarial-based methods prefer to utilize the negative samples to enhance the robustness of the embeddings. But the choice of negative samples has a huge influence on the performance, thus leading to higher variances.
- The complexity of the random walk technique consists of two parts: random walk and skip-gram, both of which are linear with the number of nodes.
- Decomposition technique needs to divide HGs into sub-graphs according to the type of edges, so the complexity is linear with the number of edges, which is higher than a random walk.
- Message passing technique mainly uses node-level and semantic-level attention to learn node embeddings, so its complexity is related to the number of nodes and node types.
- As for the encoder-decoder technique, the complexity of the encoder is related to the number of nodes, while the decoder is usually used to preserve the network structures, so it is linear with the number of edges.
- Adversarial technique needs to generate the negative samples for each node, so the complexity is related to the number of nodes and negative samples.

## Appendix

![symbols](symbols.png)

url: https://raw.githubusercontent.com/PrideLee/Machine-Learning-Notes/86130fdafcdc827b2b81e175ce62eaf37784f56a/Machine Learning/A Survey on Heterogeneous Graph Embedding: Methods, Techniques, Applications and Sources/readme.md

repository: PrideLee/Machine-Learning-Notes

repo_name: PrideLee/Machine-Learning-Notes


text:
# Cycle-analytics
This project provides both real-time and historical analysis of Barclays cycle stations (aka Borris bikes) within London.

The main structure is as follows:
* nodeApp - the NodeJS backend, which is split into 2 seperate node servers:
 * API for the front-end application
 * Task runner for the grabbing, storing & processing of cycle station data
* publicDataApp - the AngularJS frontend which acts as the MVC application

### Version
0.1 [WIP]

### Frameworks / Libraries used

Cycle Analytics makes use of multiple frameworks & libraries as shown below:

* [AngularJS]
 * [chart.js]
 * [ui.bootstrap]
 * [ngAnimate]
 * [angulartics]
* [Node.js]
 * [express]
 * [xml2js]
 * [mongoose]

### High level design

![HLD](http://cycleanalytics.io/assets/img/cycleanalytics.png)

### Development

Want to contribute? Feel free to submit a pull request.

### Additional links
* [Author's LinkedIn profile page](http://uk.linkedin.com/in/ryanmusselwhite/en) - shameless plug of my LinkedIn profile
* [Government public data API site](http://www.tfl.gov.uk/info-for/open-data-users/) - as well as the cycle data used within this platform there are many other types of data available
* [Official Barclays cycle hire page](https://web.barclayscyclehire.tfl.gov.uk/maps) - this page contains the official searching for docking stations with realtime information

### License

MIT Licence

repository: mussrya/Cycle-analytics

repo_name: mussrya/Cycle-analytics


text:
JS Flex Vertical Center
===========================

This JS plugin provides an easy way to vertically center an element in its parent. Even if the parents height changes after resizing the browser window, in a fluid or responsive layout for example.

Usage
-----

Simply include this file in your project (right before the closing body element `</body>`) like this:

<script defer src="js/flexverticalcenter.js"></script>

Then call the plugin on the element which needs to be vertically centered in it's parent.

        ...
        <script>
            (function(window, document, undefined) {
                window.flexVerticalCenter( document.getElementsByClassName('vertical-center'));
            })(window, document);
        </script>
    </body>

This will take the parents height, the elements own height and calculate the distance the element should have from the parents top to be vertically centered. This value is applied to the top margin of the element by default.

Note
----

The code is a modification of Paul Sprangers' "jQuery Flex Vertical Center" plugin (https://github.com/PaulSpr/jQuery-Flex-Vertical-Center), and by extension, Dave Rupert's FitText.js (http://fittextjs.com/)

Inline HTML elements such as A, Span and B cannot use a margin, so you'll need to add the following CSS as well: display: inline-block;


text:
# Show Radar Demo

An app that demos passing locations to another app using the [SHOW_RADAR](http://www.openintents.org/action/com-google-android-radar-show-radar/) intent.

repository: barbeau/show-radar-demo

repo_name: barbeau/show-radar-demo


text:
# readMeMaker

![licenseInformation](https://img.shields.io/apm/l/vim-mode)

## Table of Contents

- [Description](#Description)
- [Installation](#Installation)
- [Usage](#Usage)
- [Credits](#Credits)
- [License](#License)
- [Contributing](#Contributing)
- [Tests](#Tests)
- [Questions](#Questions)

## Description

Creates a readme file based on user input

## Installation

- run npm install
- run node ./index.js

## Usage

run node./index.js and follow the prompts on your screen. Your readme file will be placed in the 'output' directory. The readme file will be titled same as your projectname.
![how to use](./assets/readMeMaker.gif)

## Credits

sandyboon(https://github.com/sandyboon)

## License

Licensed under the MIT license.

## Contributing

Contribution to this project is not permitted at this moment.

## Tests

There are no tests at this moment.

## Questions

### Email : hidden

![repoOwnerImage](https://avatars1.githubusercontent.com/u/6444842?v=4)

repository: sandyboon/readMeMaker

repo_name: sandyboon/readMeMaker


text:
# Design Report

## Basic design
The project was from the inception conceived as a web application and interface.
The project is written in node.js and uses the `express` library for the backend.
The architecture is very simple, the game logic is accessed through an `express` based API and served up as web page.

## Test driven design

The project was developed with test driven development as a guiding principle. This means unit tests were written for any and all functions in the game logic at the same time as the functions themselves.

## Coding standard

This project uses the **JavaScript Standard Style**. This was done to enforce a consistent coding style, variable naming, indentation and spacing. This was also done to catch more bugs earlier as the standard forbids unused variables and prevents various other bug-inducing coding-habits. [**See More**](https://standardjs.com/rules.html#javascript-standard-style)

## Continuous Integration

The project uses CircleCI to run all the tests as soon as any changes are pushed to github.

## Code inspections

The decision was taken to use pair-programming during development. This was done to try and focus the teams resources effectively and to prevent typos, bugs and other such mistakes early on. [**See More**](https://collaboration.csc.ncsu.edu/laurie/Papers/XPSardinia.PDF) It was also decided to require all pull requests to be reviewed by two people before merging. This was to increase oversight and also to require someone from outside the pair to look over the code.

license: ISC

repository: KuwtC/TicTacToe

gha_license_id: ISC

repo_name: KuwtC/TicTacToe


text:
---
layout: post
title: tagging instead of "ideas"
disqus_identifier: a01aec80-3aa1-4f97-86e6-fa62c93f074e
tags: tags
excerpt: After writing up a few of the ideas that have been bouncing around in my head the past few days, I realized that these kinds of entries are basically short blog entries.
---

After writing up a few of the ideas that have been bouncing around in my head the past few days into a hardcoded "Ideas" page, I realized that these kinds of entries are basically short blog entries.  This is the kind of thing I'm supposed to be publishing, that someone might be interested in if they were a subscriber (if I had an RSS feed for this blog set up).  Instead of sticking ideas by themselves in their own corner, I should just implement tagging on this blog, create an `ideas` tag and make the ideas page show all the entries that have that tag.

repository: mosbasik/portfolio-jekyll

extension: markdown

repo_name: mosbasik/portfolio-jekyll


text:
---
layout: default
title: Upgrading
permalink: upgrading
---

{% include template-h1.html %}

## Upgrading

All our release are normally backward compatible to make it very easy for you to upgrade.

## Step 1 - Before Upgrading
Before upgrading:
- Make sure to read [release notes](https://github.com/zzzprojects/Bulk-Operations/releases)
- **NEVER** upgrade to production without testing in a development environment first

## Step 2 - NuGet Download

.NET Bulk Operations library is only available through NuGet

> PM> Install-Package Z.BulkOperations


text:
# ZfrCors

[![Build Status](https://travis-ci.org/zf-fr/zfr-cors.png?branch=master)](https://travis-ci.org/zf-fr/zfr-cors)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/zf-fr/zfr-cors/badges/quality-score.png?s=47504d5f5a04f88fb40aebbd524d9d241c2ae588)](https://scrutinizer-ci.com/g/zf-fr/zfr-cors/)
[![Coverage Status](https://coveralls.io/repos/zf-fr/zfr-cors/badge.png?branch=master)](https://coveralls.io/r/zf-fr/zfr-cors?branch=master)
[![Latest Stable Version](https://poser.pugx.org/zfr/zfr-cors/v/stable.png)](https://packagist.org/packages/zfr/zfr-cors)

ZfrCors is a simple ZF2 module that helps you to deal with Cross-Origin Resource Sharing (CORS).

## What is ZfrCors ?

ZfrCors is a Zend Framework 2 module that allow to easily configure your ZF 2 application so that it automatically
builds HTTP responses that follow the CORS documentation.

### Installation

Install the module by typing (or add it to your `composer.json` file):

```sh
$ php composer.phar require zfr/zfr-cors
```

Then, enable it by adding "ZfrCors" in your `application.config.php` file.

By default, ZfrCors is configured to deny every CORS requests. To change that, you need to copy
the [`config/zfr_cors.global.php.dist`](config/zfr_cors.global.php.dist) file to your `autoload` folder
(remove the `.dist` extension), and modify it to suit your needs.

## Documentation

### What is CORS ?

CORS is a mechanism that allows to perform cross-origin requests from your browser.

For instance, let's say that your website is hosted in the domain `http://example.com`.
By default, user agents won't be allowed to perform AJAX requests to another domain for security
reasons (for instance `http://funny-domain.com`).

With CORS, you can allow your server to reply to such requests.

You can find better documentation on how CORS works on the web:

 * [Mozilla documentation about CORS](https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS)
 * [CORS server flowchart](http://www.html5rocks.com/static/images/cors_server_flowchart.png)

### Event registration

ZfrCors registers the `ZfrCors\Mvc\CorsRequestListener` with the `MvcEvent::EVENT_ROUTE` event, with a priority
of -1. This means that this listener is executed AFTER the route has been matched.

### Configuring the module

As by default, all the various options are set globally for all routes:

- `allowed_origins`: (array) List of allowed origins. To allow any origin, you can use the wildcard (`*`) character. If
  multiple origins are specified, ZfrCors will automatically check the `"Origin"` header's value, and only return the
  allowed domain (if any) in the `"Allow-Access-Control-Origin"` response header. To allow any sub-domain, you can prefix
  the domain with the wildcard character (i.e. `*.example.com`). Please note that you don't need to
  add your host URI (so if your website is hosted as "example.com", "example.com" is automatically allowed.
- `allowed_methods`: (array) List of allowed HTTP methods. Those methods will be returned for the preflight request to
  indicate which methods are allowed to the user agent. You can even specify custom HTTP verbs.
- `allowed_headers`: (array) List of allowed headers that will be returned for the preflight request. This indicates
  to the user agent which headers are permitted to be sent when doing the actual request.
- `max_age`: (int) Maximum age (seconds) the preflight request should be cached by the user agent. This prevents the
  user agent from sending a preflight request for each request.
- `exposed_headers`: (array) List of response headers that are allowed to be read in the user agent. Please note that
  some browsers do not implement this feature correctly.
- `allowed_credentials`: (boolean) If true, it allows the browser to send cookies along with the request.

If you want to configure specific routes, you can add `ZfrCors\Options\CorsOptions::ROUTE_PARAM` to your route configuration:

```php
<?php

return [
    'zfr_cors' => [
        'allowed_origins' => ['*'],
        'allowed_methods' => ['GET', 'POST', 'DELETE'],
    ],
    'router' => [
        'routes' => [
            'readOnlyRoute' => [
                'type' => 'literal',
                'options' => [
                    'route' => '/foo/bar',
                    'defaults' => [
                        // This will replace allowed_methods configuration to only allow GET requests
                        // and only allow a specific origin instead of the wildcard origin
                        ZfrCors\Options\CorsOptions::ROUTE_PARAM => [
                            'allowed_origins' => ['http://example.org'],
                            'allowed_methods' => ['GET'],
                        ],
                    ],
                ],
            ],
            'someAjaxCalls' => [
                'type' => 'literal',
                'options' => [
                    'route' => '/ajax',
                    'defaults' => [
                        // This overrides the wildcard origin
                        ZfrCors\Options\CorsOptions::ROUTE_PARAM => [
                            'allowed_origins' => ['http://example.org'],
                        ],
                    ],
                ],
                'may_terminate' => false,
                'child_routes' => [
                    'blog' => [
                        'type' => 'literal',
                        'options' => [
                            'route' => '/blogpost',
                            'defaults' => [
                                // This would only allow `http://example.org` to GET this route
                                \ZfrCors\Options\CorsOptions::ROUTE_PARAM => [
                                    'allowed_methods' => ['GET'],
                                ],
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes' => [
                            'delete' => [
                                'type' => 'segment',
                                'options' => [
                                    'route' => ':id',
                                    // This would only allow origin `http://example.org` to apply DELETE on this route
                                    'defaults' => [
                                        \ZfrCors\Options\CorsOptions::ROUTE_PARAM => [
                                            'allowed_methods' => ['DELETE'],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
];
```

### Preflight request

If ZfrCors detects a preflight CORS request, a new HTTP response will be created, and ZfrCors will send the appropriate
headers according to your configuration. The response will be always sent with a 200 status code (OK).

Please note that this will also prevent further MVC steps from being executed, since all subsequent MVC steps are
skipped till `Zend\Mvc\MvcEvent::EVENT_FINISH`, which is responsible for actually sending the response.

### Actual request

When an actual request is made, ZfrCors first checks it the origin is allowed. If it is not, then a new response with
a 403 status code (Forbidden) is created and sent.

Please note that this will also prevent further MVC steps from being executed, since all subsequent MVC steps are
skipped till `Zend\Mvc\MvcEvent::EVENT_FINISH`, which is responsible for actually sending the response.

If the origin is allowed, ZfrCors will just add the appropriate headers to the request produced by `Zend\Mvc`.

### Security concerns

Don't use this module to secure your application! You must use a proper authorization module, like
[BjyAuthorize](https://github.com/bjyoungblood/BjyAuthorize), [ZfcRbac](https://github.com/ZF-Commons/ZfcRbac) or
[SpiffyAuthorize](https://github.com/spiffyjr/spiffy-authorize).

ZfrCors only allows to accept or refuse a cross-origin request.

### Custom schemes

Internally, ZfrCors uses `Zend\Uri\UriFactory` class. If you are using custom schemes (for instance if you are
testing your API with some Google Chrome extensions), you need to add support for those schemes by adding them to
the `UriFactory` config (please [refer to the doc](http://framework.zend.com/manual/2.2/en/modules/zend.uri.html#creating-a-new-custom-class-uri)).

### Example
To register the `chrome-extension` custom scheme in your API, simply add:

```php
UriFactory::registerScheme('chrome-extension', 'Zend\Uri\Uri');
```

to the `onBootstrap()` method in `module/Application/Module.php`. Do note that, if your IDE doesn't resolve this automatically, you should add the following `use` definition to the same file:

```php
use Zend\Uri\UriFactory;
```

Registering the `chrome-extension` custom scheme like this allows you to use Google Chrome extensions for testing your API.

repository: zf-fr/zfr-cors

gha_language: PHP

repo_name: zf-fr/zfr-cors


text:
# Bowling Challenge
[![Build Status](https://travis-ci.org/GeorgeSeeger/bowling-challenge.svg?branch=master)](https://travis-ci.org/GeorgeSeeger/bowling-challenge)

This program calculates a score for a bowling game

## Getting started

To use this program simply clone or fork this repo and add the following path to ```bowling.js``` for any html document you're using
```html
<script src='path/to/bowling.js'></script>
```

From there, you can create a new bowling game with
```JS
var bowling = new Bowling([a,r,r,a,y, ,o,f,S,c,o,r,e,s]);
```
and then the score will be returned with
```JS
bowling.score();
```

### Running my automated tests

Open the SpecRunner.html document in the base directory

An example of the tests would be
``` JavaScript
var bowling = new Bowling([10,0,10,0,10,0,10,0,10,0,10,0,10,0,10,0,10,0,10,10,10]);

//it should calculate 300 for a perfect game
bowling.score(); // 300
```

## Contributing

Don't bother :^)

## Authors
* **George Seeger** - [GeorgeSeeger](https://github.com/georgeseeger)

repository: GeorgeSeeger/bowling-challenge

repo_name: GeorgeSeeger/bowling-challenge


text:
<!--
order: 3
-->

# Messages

## Lock Tokens

`MsgLockTokens` can be submitted by any token holder via a `MsgLockTokens` transaction.

```go
type MsgLockTokens struct {
	Owner    sdk.AccAddress
	Duration time.Duration
	Coins    sdk.Coins
}
```

**State modifications:**

- Validate `Owner` has enough tokens
- Generate new `PeriodLock` record
- Save the record inside the keeper's time basis unlock queue
- Transfer the tokens from the `Owner` to lockup `ModuleAccount`.

## Begin Unlock of all locks

Once time is over, users can withdraw unlocked coins from lockup `ModuleAccount`.

```go
type MsgBeginUnlockingAll struct {
	Owner string
}
```

**State modifications:**

- Fetch all unlockable `PeriodLock`s that has not started unlocking yet
- Set `PeriodLock`'s unlock time
- Remove lock references from `NotUnlocking` queue
- Add lock references to `Unlocking` queue

## Begin unlock for a lock

Once time is over, users can withdraw unlocked coins from lockup `ModuleAccount`.

```go
type MsgBeginUnlocking struct {
	Owner string
	ID    uint64
}
```

**State modifications:**

- Check `PeriodLock` with `ID` specified by `MsgBeginUnlocking` is not started unlocking yet
- Set `PeriodLock`'s unlock time
- Remove lock references from `NotUnlocking` queue
- Add lock references to `Unlocking` queue

Note: If another module needs past `PeriodLock` item, it can log the details themselves using the hooks.


text:
# Readings

Because you will be collaborating with your team, structuring your communication and workflow will be important for efficiency and organization.

```{margin}
![Think Like a Data Scientist book cover](https://images.manning.com/360/480/resize/book/3/14e6612-b8c6-408c-9a69-1009f61e0d50/Godsey-TLDS-HI.png)
```
## Think like a data scientist

Read chapters 1 - 2 to help you get in the mindset of working on projects.

* [Login using UCSB NetID](http://uclibs.org/PID/432785)
* Then go to the [book link](https://learning.oreilly.com/library/view/think-like-a/9781633430273/)

## Team work and collaboration

Here are key readings for data science project organization, collaboration, and communication.

* _[Good enough practices in scientific computing](https://doi.org/10.1371/journal.pcbi.1005510)_
	Talks about overall project workflow. Everything from data management, programming, collaborating, organizing projects, tracking work, and writing manuscripts.
* _[Our path to better science in less time using open data science tools](https://doi.org/10.1038/s41559-017-0160)_
    Research reproducibility and collaboration case study in environmental science. Documentation, version control, team collaboration, and communication
* _[Creating and maintaining high‐performing collaborative research teams: the importance of diversity and interpersonal skills](https://doi.org/10.1890/130001)_
    Diversity and performance of research teams. Importance of interpersonal skills and team functioning


text:
---
title: "Taskwarrior - _get"
---

# \_get

The `_get` command is a [DOM](/docs/dom) accessor.
You can use this command to extract any piece of information stored by taskwarrior.
For example to obtain the description of task 12:

    $ task _get 12.description
    Buy some milk

You can specify multiple data items:

    $ task _get 12.description 12.project
    Buy some milk Kitchen

You can use UUIDs:

    $ task _get a360fc44-315c-4366-b70c-ea7e7520b749.description
    Buy some milk

The `_get` command makes it easy to map between ID and UUID:

    $ task _get 12.uuid
    a360fc44-315c-4366-b70c-ea7e7520b749
    $ task _get a360fc44-315c-4366-b70c-ea7e7520b749.id
    12

The `_get` command is a helper command, which means it is more useful for scripts and extensions than command line use.

See Also

- [DOM](/docs/dom)
- [`export`](/docs/commands/export) command

gha_language: CSS