text:
---
title: 'API Keys'
eleventyNavigation:
  parent: API
  key: API Keys
  order: 1
---
# API Keys
Manage your API keys to authenticate your requests and start running tests using the WebPageTest API.

WebPageTest requires an API key to submit any test using the API. If you don't provide an API key when trying to run a test, the API will return an error. Each account receives separate keys for interacting with the API.

## Signing Up for the API
To get started with WebPageTest API, you'll need to first [create an account](https://app.webpagetest.org/ui/entry/wpt/signup?enableSub=true&utm_source=docs&utm_medium=docs&utm_campaign=apidocs&utm_content=account) and purchase a subscription plan.

If you already have an account, go to [**My Account**](https://app.webpagetest.org/ui/wpt/myAccount) on WebPageTest and purchase a subscription plan by clicking on **+ API Subscription Plan**. Once you complete your purchase, you'll be able to generate the API key and start testing using the WPT API.

:::note
We currently offer 4 subscription plans (billed monthly or annually) based on the total test runs you wish to run in a month. All our subscription plans offer the same features and capabilities. You can read more about account, tests, and billing or payment questions [here](http://docs.webpagetest.org/api/faqs).

For Custom Enterprise plans where you want to run more than 20,000 tests per month, please [contact us](https://www.product.webpagetest.org/contact).
:::

## Obtaining your keys
Once created, your API keys are always available in your [account dashboard](https://app.webpagetest.org/ui/wpt/myAccount), under **API Consumers**.

To create a new key, select the **+ New API Key** button and enter the a name for the application you'll be using the key for, so you can easily identify which key is used in which context.

For your security, API keys are hidden by default in your dashboard, and can be revealed by selecting the **View** link.

:::caution
Currently, we only support one user account to sign in and set up your account to purchase the WebPageTest API. However, you can generate up to 30 keys for multiple use cases and teams, from a single WebPageTest API account. You can generate a new key by selecting the **+ New API Key** button.

We have plans to support adding multiple users and defining roles in the future.
:::

## Keeping your keys secret and safe
Your API keys are directly tied to your account and can be used to submit tests, which impact your billing. You should plan to keep them secret and safe, just as you would with any account password. Only share your key with the people who absolutely need access and make sure to keep your keys out of any version control system. We recommend storing them in a password manage or secrets management system.

If a key is compromised, you can either choose to delete the key altogether or regenerate the key to start fresh. Both options are available to you in [your account dashboard](https://app.webpagetest.org/ui/wpt/myAccount).

repository: scottjehl/webpagetest-docs

repo_name: scottjehl/webpagetest-docs


text:
# Plagegeister

## Main Goal
Navigate your army of slimy ghosts through the lines of heroes to consume all the crop.

## Screenshots
![Cover image](https://github.com/3m5-GameJam-4/plagegeister/blob/lars-dev/Assets/UI/Sprites/background.png)
![Image shows gameplay scene](https://github.com/3m5-GameJam-4/plagegeister/blob/lars-dev/external-resources/screenshots/screenshot-2.png)

## About The Game Jam
The random topics for this game jam were:
* flying into something
* collaborate
* wave of imigration

All three topics should be integrated into the final game.

## Controls
The game was made for three players. One is playing the operator. He is observing the other two players from his own screen. Depending on the score, he is able to spawn new mobs of slimy ghosts.
* New mob for player 1: Keyboard key 1
* New mob for player 2: Keyboard key 2

The other two players can control mobs with common gamepads. They are looking on another screen. From their perspective they cannot see the nasty heros.
* The left analog stick is used to navigate the active mob.
* The L1 key is used to switch to the previous mob.
* The R1 key is used to switch to the next mob.

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# HTML Lists, Control Flow with JS, and the CSS Box Model
## HTML Lists:
### HTML provides us with three different types to use lists:

- **Ordered**:

`<ol>`
The ordered list is created with
the `<ol>` element.

`<li>`
Each item in the list is placed
between an opening `<li>` tag
and a closing `</li>` tag. (The li
stands for list item.)
- **Unordered**:

`<ul>`
The unordered list is created
with the `<ul>` element.
- **Definition**:

`<dl>`
The definition list is created with
the `<dl>` element and usually
consists of a series of terms and
their definitions.
Inside the `<dl>` element you will
usually see pairs of `<dt>` and
`<dd>` elements.
`<dt>`
This is used to contain the term
being defined (the definition
term).
`<dd>`
This is used to contain the
definition.

## CSS Box:
- How we use it:

Control the dimensions of your boxes:By useing `width`,  `height`, `min-width`, `max-width`, `min-height`, `max-height`.

Create borders around boxes: By useing : `border-width`, `border-style` , `border-color`, .

Set margins and padding for boxes, By useing: `padding`, `margin`.

Show and hide boxes, By useing: `display`, `hidden`, `visible`.

![Box](img/Box.PNG)

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

## JS:

### QUOTES:

Sometimes you will want to use a double or single quote mark within a string.
![Quotes](img/quotes.PNG)

## COMPARING TWO EXPRESSIONS

let cop=(4+3) > (7+0)

## Logical Operators:

```
| Operator | Description | Comparing                   |
| ---------| ------------| --------------------------- |
|    &&    |    and      | (x < 10 && y > 1) is true   |
|    ||    |    or       | 	(x == 5 || y == 5) is false|
|    !=    |    not      | !(x == y) is true           |
```
## IF .. ELSE Statements:

```
if(condition){
    code;
}else{
    another code;
}
```
##  Switch Statements:

```
switch(level){
    case "one":
        title="level 1";
        break;

    case "two":
        title="level 2";
        break;

    default:
        title=" ";
        break;
}

```

## Checking Equality & Existence:

![Checking Equality & Existence](img/CQAE.PNG)

## Loops:

![Loops](img/loops.PNG)

branch_name: refs/heads/main


text:
# gaslog
A simple sql database to track distance and fuel over time.

## Requirements
1. sqlite3
  * Perhaps you might like DB Browser for SQLite http://sqlitebrowser.org/
2. Your own data;
  * Write your odometer reading on your gas receipt.

## Examples

!["Graph of total price per fill-up"](https://github.com/dualcells/gaslog/blob/master/samples/plot_cost_date.png "Graph of total price per fill-up")

!["Graph of odometer readings over time"](https://github.com/dualcells/gaslog/blob/master/samples/plot_dist_date.png "Graph of odometer readings over time")

!["Graph of total litres per fill-up"](https://github.com/dualcells/gaslog/blob/master/samples/plot_fill_date.png "Graph of total litres per fill-up")

### TODO:
  * Add python scripts to create graphs.
  * Add select statement to show distance travelled per interval.

repository: dualcells/gaslog

repo_name: dualcells/gaslog


text:
Another simple challenge, right!
![Bandit4](https://github.com/sreekesari-vangeepuram/overthewire/blob/master/overthewire/bandit/bandit4/level4-%3Elevel5.png)

By following the `Level Goal` of Bandit Level 4 → Level 5;
we got the password of user[bandit5] as shown below.

```
bandit4@bandit:~$ ls
inhere
bandit4@bandit:~$ cd inhere/
bandit4@bandit:~/inhere$ ls
-file00  -file01  -file02  -file03  -file04  -file05  -file06  -file07  -file08  -file09
bandit4@bandit:~/inhere$ cat ./*
�/`2ғ�%��rL~5�g��� �������p,k�;��r*��	�.!��C��J	�dx,�e�)�#��5��
                                                                       ��p��V�_���ׯ�mm������h!TQO�`�4"aל�߂phT��,�Ai�4�ו$����I&������c���?��r�l$�?h�9('���!y�e�#�x�O��=��ly���~��A�f����-E�{���m�����ܗMkoReBOKuIDDepwhWk7jZC0RTdopnAYKh
�T�?�i��j��îP�F�l�n��J����{��@�e�0$�in=��_b�5FA�P7sz��gNbandit4@bandit:~/inhere$
bandit4@bandit:~/inhere$ strings ./*
!TQO
koReBOKuIDDepwhWk7jZC0RTdopnAYKh
bandit4@bandit:~/inhere$
```

New command `strings` is used here to solve this challenge. Let's see where it's used and how it's used;
```
$ strings --help
Usage: strings [option(s)] [file(s)]
 Display printable strings in [file(s)] (stdin by default)
 The options are:
  -a - --all                Scan the entire file, not just the data section [default]
  -d --data                 Only scan the data sections in the file
  -f --print-file-name      Print the name of the file before each string
  -n --bytes=[number]       Locate & print any NUL-terminated sequence of at
  -<number>                   least [number] characters (default 4).
  -t --radix={o,d,x}        Print the location of the string in base 8, 10 or 16
  -w --include-all-whitespace Include all whitespace as valid string characters
  -o                        An alias for --radix=o
  -T --target=<BFDNAME>     Specify the binary file format
  -e --encoding={s,S,b,l,B,L} Select character size and endianness:
                            s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
  -s --output-separator=<string> String used to separate strings in output.
  @<file>                   Read options from <file>
  -h --help                 Display this information
  -v -V --version           Print the program's version number
strings: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 srec symbolsrec verilog tekhex binary ihex plugin
Report bugs to <https://bugs.archlinux.org/>
```

From the challenge statement: `The password for the next level is stored in the only human-readable file in the inhere directory`!

So, generally `strings` command is used when we deal with files which are not in human-readable format such as binary.

COOL, right!

Hope you've learnt something new from this [if you don't know this before/didn't strike for to during the start].

Now, let's use the password `koReBOKuIDDepwhWk7jZC0RTdopnAYKh` to log into the remote-machine as `bandit5`.

**Warning: Please, first try Level 5 -> Level 6! Otherwise it's useless to simply cpy-pst the command[s]/password[s].

repository: sreekesari-vangeepuram/overthewire

gha_language: Shell

gha_license_id: MIT

repo_name: sreekesari-vangeepuram/overthewire


text:
---
title: "Manifesto For a Century"
date: 2022-08-01
draft: false
garden_tags: ["programming"]
summary: " "
status: "seeding"
---

Nothing better than to start this blog sharing this beautiful manifesto written by members of the [Handmade](https://handmade.network/) community.
If you want to become a good software engineer, this community is a necessity. It goes against the current mainstream of software development.

_(As a sidenote, John Carmack, the legendary programmer who created the Doom game series, [shared on twitter](https://twitter.com/id_aa_carmack/status/1322363255222902784) that he endorses these ideas)._

> ## Handmade Manifesto
>

>
> ### Computers are amazing.
> Computers have changed our lives for the better. They allow us to learn, connect with each other, and express ourselves in amazing new ways. And every year computers get more powerful, less expensive, and more accessible - computers today can do things we hardly dreamed of twenty years ago.
>
> ### So why is software so terrible?
> Why do web pages take ten seconds to load? Why do apps mess up scrolling? Why does your phone battery still die so quickly? And why does each update somehow make the problem worse?
>
> And why do we all use huge frameworks that no one understands? Why do our projects take several minutes to compile? Why do we have to restart our language servers every twenty minutes? And why does everyone think this is fine?
>
> ### We made it terrible.
> Not necessarily you or me, not necessarily anyone in particular. But we, the software development community, made it terrible through our thoughtless behavior. We ignored the hardware. We glued together libraries so we didn't have to learn. We built layers on top of layers, until no one knew how anything worked.
>
> But worst of all: we put our own desires above the user's.
>
> You may have learned that programming is about classes, monads, or type systems. You may have been taught to keep your code clean and pretty, abstract and future-proof. None of that matters when the end result is garbage.
>
> ### But there is another way.
> Some of us aren't satisfied with the current state of software. We think that wheels need to be reinvented. We like looking under the hood, understanding what others take for granted. We remember how software used to be, and know how much potential there is to make it better. We fight against the status quo, because we know how things could be.
>
> This is what Handmade means. It's not a technique or a language or a management strategy. It's not a library or a framework or a paradigm. It's an idea. The idea that we can build software that works with the computer, not against it. The idea that the user matters more than the programmer. The idea that sometimes a small group can do more than an army of software engineers, and do it better.
>
> You don't need a degree, a dissertation, or a decade of experience. You don't need an expensive computer or a certificate. All you need is an open mind and a sense of curiosity. We'll help you with the rest.
>
> ### Will you join us?
> Will you build your software by hand?
>
> _Written by Ben Visness and the Handmade community. Original by Andrew Chronister._


text:
# Flexform's Versatile Furniture Enhances Projects Worldwide

Published at: **2019-11-04T03:30:00+00:00**

Author: ****

Original: [ArchDaily](https://www.archdaily.com/925431/flexforms-versatile-furniture-enhances-projects-worldwide)

Architectural design of a space and the furniture chosen to fill it can work together to define a room's function, set a certain vibe, and make a statement. While an architect or designer may want specific furniture to create a certain look at the time of design completion, versatility is also important over the course of a building's life. Not only do the needs of building programs and inhabitants shift over time, but owners of commercial and public spaces often want the ability to react to both aesthetic and social trends to keep up-to-date.
The design of a space, including its furniture, must reflect its intended use and function, which involves an understanding not only of good design, but also of the social and cultural influences present in any given location. Furniture that is stylish, yet timeless and functional, should be the goal for a long-lasting and flexible design. Well-designed furniture can adapt to multiple uses and types of spaces over time, as well as different locations and cultures worldwide. A notable Italian furniture design company, Flexform, has utilized many of these design principles in the company’s portfolio of contemporary style furniture. Originally the handmade crafts of the Galimberti brothers in 1959, ‘Flexform di Galimberti’s’ early success led the company to expand and grow - allowing many of these timeless pieces to be incorporated into the fabric of international architecture.

          Bulgari Resort, Dubai

The Bulgari Resort Dubai was designed as a "destination within a destination," blending Mediterranean charm with Middle-Eastern sophistication. The luxury hotel's decor features many furniture pieces designed by Antonio Citterio, including Feel Good bar stools, Groundpiece sofas, and Dany coffee tables.

          Hotel Lutetia, Paris

Paris' legendary Hotel Lutetia is part of the renowned "Leading Hotels of the World" chain. Jean-Michel Wilmotte's sophisticated renovation and interior design of the hotel's Bar Joséphine retains its original charm, incorporating Citterio-designed Guscio sofas and Feel Good armchairs.

          "Nove by Citterio," Munich

"Nove by Citterio" is a six-floor office building designed by the Antonio Citterio Patricia Viel architectural firm which has achieved LEED Platinum sustainability certification. The spaces' elegant finishes are achieved through the use of rich materials, Guscio sofas and armchairs, Feel Good armchairs, and Tris occasional tables.

          Soori High Line Apartments, New York

Located in the heart of the chic West Chelsea neighborhood of New York near the famous High Line park, prestigious Soori High Line Apartments feature luxurious, resort-class interiors and rich detailing. Antonio Citterio's Wing sofa, A.B.C.D. armchair, Eden Plus bed, and Isabel dining chairs round out the elegant furnishings for SCDA Architects' design.

          Nidapark Istinye Project, Istanbul

The Istinye neighborhood is one of the most historic in Turkey's capital and home to the Nidapark Istinye residential complex, boasting spectacular sea views. Apartments feature a unique combination of Flexform and Flexform Mood furniture, such as Lifesteel sofa, Lysandre armchairs, Giano console, and Crono armchairs.

          Four Seasons at Burj Alshaya, Kuwait

The sleek and stylish Four Seasons at Burj Alshaya in Kuwait City is a prestigious backdrop for the city's elite business and social scenes. Antonio Citterio's Guscioalto Soft and Feel Good Soft armchairs are displayed in the hall and lounge.

          Bulgari Hotel, Shanghai

The Bulgari Hotel in Shanghai aims to set a new standard of luxury for the cosmopolitan city, its design creating a bridge between past and future. The Antonio Citterio Patricia Viel design blends Bulgari's Italian sophistication with Shanghai's rich culture. Furniture designed by Citterio on display in the project includes Morgan barstools, Morgan armchairs, Feel Good armchairs, and Gelsomina armchairs.

          Treasure Garden, Taiwan

In the Taichung district of Taiwan, Treasure Garden provides elegant residences and common spaces designed in a geometric, Italian-inspired style, located at a prime location within the city.

          Los Altos Hill, California Residence

A majestic modern home set among the greenery of Los Altos, California, this private residence features a spacious, light-filled living room furnished with some of Flexform's best-selling pieces. The Groundpiece sofa, Guscio armchairs, a Jiff dining table, Tindari ottomans, and more create a sophisticated design.

          Cape Town Residence

In this Cape Town tree house home, the Groundpiece sofa, Guscio armchair, and Feel Good ottoman and dining chairs create a stylish, yet comfortable and airy feel in the midst of a jungle-like setting.

          Mexico City Residence

This private home in Mexico City designed by Jaime Micha Balas + Jacobo Micha Mizrahi Studio is luxurious, elegant, and comfortable thanks to the Cestone seating system, Cestone sofa, Groundpiece coffee table, and Vienna side tables.

          Miami Residence

Warm and sophisticated, this light-filled Miami penthouse designed by Brazilian architect Andrea Chicharo incorporates the Groundpiece seating system, Lifesteel chaise longue, Soft Dream sofa, and Crono settees.

          Ibiza Residence

This home in Ibiza is hidden in a quiet village among natural vegetation and its interior design reflects the natural tones and textures of its surroundings. The interior design, curated by Terraza Balear, is populated by the Adda seating system, Happy armchairs, Feel Good ottoman, Soffio table, and Isabel chairs.

          Ikema Island, Japan Residence

The centerpiece of this modern home located on Ikema Island in Japan is the Lifesteel sectional sofa designed by Antonio Citterio.

          Sanlorenzo 460 Explorer Yacht

The Explorer 460 is a superyacht designed for exploring the world in safety and comfort. A nautically-inspired design lends elegance, warmth, and luxury to the space, furnished with the Lifesteel seating system, Grandemare sofa, and a Paul armchair all designed by Antonio Citterio.

        News via Flexform.

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
# Classes
A class is a thing that represents a single idea.
### Defining a class
To declare a class we use the `class` keyword:
```cpp
class MyClass {
    // ??? fill it with useful stuff
};
```
It's important to not forget the semi-column after the closing curly brace of the class.
### Defining a more useful class
In the lasts chapters we created a program to output the average of notes. But who has theses notes?
The answer is a student. So let's create one:
```cpp
class Student {
public: // without this line, we would not be able to access stuff inside here from outside.
    std::string name;
    std::vector<double> notes;
    double average() {
        return std::accumulate(notes.begin(), notes.end(), 0.0) / notes.size();
    }
};
```
We can now create a new student:
```cpp
// in main...
Student you;
you.name = "Your cool name";
you.notes.push_back(100.0);
double yourAverageNote = you.average(); // 100% because you are wonderful
```


text:
# database_checker
Checks that you can connect to your database and reports errors.
Supported methods:
 * PDO
 * MySQLi
 * MySQLnd

## usage
 1) update your endpoint details for `$host`, `$username`, `$password`, and `$database_name`

 2) copy database_checker.php to your webserver

 3) navigate to yourserveraddress.com/database_checker.php

license: ISC


text:
# CurrencyConverter

The application contains a list of the various currency rate conversion against top most base currency which is continuously updating the rates at every second of interval.
User can change the base currency after clicking on any of the items in a list and it will be automatically shifted to the topmost position in the list and will become the
base currency against the other currency values.

# Demo
![CurrencyConverter](screenshots/currency_converter.gif)

## Languages, libraries and tools used

* __[Kotlin](https://developer.android.com/kotlin)__
* __[RxJava](https://github.com/ReactiveX/RxJava)__
* __[Koin](https://github.com/InsertKoinIO/koin)__
* __[Coil](https://coil-kt.github.io/coil/getting_started/)__
* __[Android Material Design](https://material.io/components/)__
* __[Android Architecture Components](https://developer.android.com/topic/libraries/architecture/index.html)__
* __[Instrumented Unit Testing](https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests)__

## Set Up

Clone the repository and import the project in Android Studio.You can also try the demo app
[Currency_Converter_debug.apk](https://github.com/yash786agg/CurrencyConverter/blob/master/demo_apk/Currency_Converter_debug.apk)
available in the demo_apk folder.

## Build it

You can [build and run](https://developer.android.com/studio/run) the project using the Android
Studio/Gradle. You need an android [emulator](https://developer.android.com/studio/run/emulator)
or a [real device](https://developer.android.com/studio/run/device) to test the build.

# Prerequisites
* __Android Studio 3.5.3__
* __Gradle version 3.5.3__
* __Kotlin version 1.3.61__
* __Android Device with USB Debugging Enabled__

# Built With

* __[Android Studio](https://developer.android.com/studio/index.html)__ - The Official IDE for Android
* __[Kotlin](https://developer.android.com/kotlin)__ - Language used to build the application
* __[Gradle](https://gradle.org)__ - Build tool for Android Studio

Thanks for reading this repo. Be sure to click ★ below to recommend this repo if you found it helpful. It means a lot to me.

For more about programming, follow me on [Medium](https://medium.com/@yash786agg)

Also, Let’s become friends on [Linkedin](http://bit.ly/24t4EVI)


text:
# Delete Ticket

To Delete a ticket with particular TicketId.

**URL** : `/deleteTicket`

**Method** : `DELETE`

**Data constraints**

```json
{
    "ticketId":"[Integer]"
}
```

**Data examples**

```json
{
    "ticketId":"53"
}
```

## Success Responses

**Condition** : If ticket exists and deletion is successfull.

**Code** : `200 OK`

**Content example** : Response will reflect the corresponding TicketId of the booking with a confirmation message of ticket being booked.

```json
{
    "status": 200,
    "message": "Deleted Successfully !!"
}
```

## Error Response

**Condition** : If provided data is invalid, e.g. a name contains integer or date is not in correct format or the maximum quota for the timming is exceeded.

**Code** : `400 BAD REQUEST`

**Code** : `404 RESOURCE NOT FOUND` If the Ticket id is valid but is not found.

**Content example** :

```json
{
    "status": 404,
    "error": "No such TicketId Found!!"
}
```

```json
{
    "status": 400,
    "error": "Invalid Ticket Id"
}
```

## Notes

* 500 status code will be thrown if an unknown error occurs.


text:
# Say Hi to Marvin

Marvin is Slack bot written in Go that allows Slack users to use Slash Commands to fetch a list of Github Issues that match a specific criteria.  We use a service called Waffle (http://waffle.io) that allows us to view our Issues in a kanban style board.  Each lane on Waffle has a corresponding label within Github issues.  We use these labels to keep track of which stage each issue is in across our entire company.

Example:

type `/backlog RepoName` into Slack and it will display the current backlog items for that project.

or `/readyforqa RepoName` and you’ll see all the items currently in progress.

![](https://dl.dropboxusercontent.com/s/l984qm2t9j2yfao/D3D7D390-F586-4C72-BA54-45251A252C1D-5045-00009A0112DCB887.gif?dl=0)

`/assigned * GithubName` will fetch all tasks assigned to that user under the specified organization.
or
```/assigned RepoName GitHub```  Will fetch all tasks assigned to that user under that repo.

# Running Locally

Setup your go environment and make sure you have the `$GOPATH` variable defined as well as include `$GOPATH/bin` in your `$PATH`.

Pull down the latest source code from Github for Marvin and after you should be able to see the files under `$GOPATH/src` directory

```
go get github.com/RobotsAndPencils/marvin
```

Create the `config.json` and `github.json` files and put your specific slack and github information into it. Save these files in the `$GOPATH/src/github.com/RobotsAndPencils/marvin` directory.

## config.json

```
{
        "domain": "YOUR SLACK DOMAIN HERE",
        "port": 4444,
        "webhookpath": "RNP SLACK WEBHOOKPATH HERE"
}
```

**domain** is the subdomain of the slack url used by your company. For example it would be the `mycompany` part of `mycompany.slack.com`

**webhookpath** This will need to be set up in Slack's incoming webhooks integration. If the integration has already been set up you can find the value in Slack settings: `Integrations > Configured Integrations > Incoming WebHooks > #channel > Webhook URL`. Where `#channel` is the slack channel that the webhook is set up to post to.

## github.json

```
{
        "owner": "YOUR GITHUB ID HERE",
        "personalAccessToken": "YOUR GITHUB ACCESS TOKEN HERE"
}
```

**owner** is the userid or organization id that you want to use that has access to all of the repos you want the bot to be able to query.

**personalAccessToken** can be found by going to `settings/profile` on github.com and selecting `Generate New Token` from the `Personal Access Token` tab.

Then, you can run/test the programs locally after initializing

```
make init
make run
make test
```

To test, use a web posting tool like `Postman` to sent a POST to `http://localhost:4444/slack` with `x-www-form-urlencoded` with at least a `command` and `text` parameters. For example:

```
command /assigned
text myrepository somelogin
```

This should, by default, output information in the default channel you set up when you created the Incoming Webhook.

# Deploying to Heroku

The app can be easily deployed to Heroku, but you need to set up a few config variables to make it work. First, you need to set `BUILDPACK_URL` to be

```
https://github.com/kr/heroku-buildpack-go.git
```

Then, set `GITHUB_CONFIG` variable to the following JSON with your variables replaced:

```
{
	"owner": "YOUR ORG NAME",
  	"personalAccessToken" : "PERSONAL ACCESS TOKEN WITH ACCESS TO ALL REPOS OF ORG"
}
```
Your Org Name should be substituted by your organization name, that you want to be able to run the queries for.

The personal access token should be from a user with read access to all of the repos in your org. Don't give it too much power. Create one of these in your `Personal Settings > Applications > Personal Access Tokens` section of your GitHub settings.

Then, you need to set `MARVIN_CONFIG` to json like the following:

```
{
	"domain": "SLACK DOMAIN - EVERYTHING BEFORE .slack.com",
	"webhookpath" : "INCOMING WEBHOOK PATH AFTER /services/"
}
```

The webhook path is everything after the /services/ in an incoming webhook that you've created. It'll look like three randomized strings of characters with slashes between.

Make sure you also update your GoDeps. `godep save`, then commit the changes to your git repo.

Also, you need to create an Incoming Webhook integration and use the end part of the webhook path for parts of the configuration above.

# Acknowledgements

This code is heavily influenced by: `https://github.com/trinchan/slackbot` with only slight divergences. The incoming webhook was changed to a post, and the configuration can come from either the environment or files on disk.

# License

The MIT License (MIT)

Copyright (c) 2015, Robots and Pencils

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.


text:
# pipe

[![Actions Status](https://github.com/variantdev/pipe/workflows/Go/badge.svg)](https://github.com/variantdev/pipe/actions?query=workflow%3AGo)

`pipe` is a fork of the awesome [go-pipe](https://github.com/go-pipe/pipe) with a few enhancements:

- Support for Go modules
- Support for Go `context.Context` for timeout, cancellation and deadline
- Tested compatibility with macOS(ore more concretely unit tests to ensure it's working on macOS)
- Exec logger for recording executed commands and context propagation for e.g. tracing and metering (See the OpenTelemetry example)

## Usage

```go
// `p` is basically the following shell script rewritten in Go:
//
// #!/usr/bin/env sh
// PIPE_NEW_VAR=new
// echo $PIPE_OLD_VAR $PIPE_NEW_VAR
// PIPE_NEW_VAR=after
// go run a-go-app-prints-PIPE_NEW_VAR
// echo hello | sed s/l/k/g
//
p := pipe.Script(
    pipe.SetEnvVar("PIPE_NEW_VAR", "new"),
    pipe.System("echo $PIPE_OLD_VAR $PIPE_NEW_VAR"),
    pipe.SetEnvVar("PIPE_NEW_VAR", "after"),
    func(s *pipe.State) error {
        count := 0
        prefix := "PIPE_NEW_VAR="
        for _, kv := range s.Env {
            if strings.HasPrefix(kv, prefix) {
                count++
            }
        }
        if count != 1 {
            return fmt.Errorf("found %d environment variables", count)
        }
        return nil
    },
     pipe.Line(
        pipe.Print("hello"),
        pipe.Exec("sed", "s/l/k/g")
    )
)

// output contains everything written to stdout by running the script
output, err := pipe.Output(p)

// combimed contains everything written to stdout and stderr by running the script
combined, err := pipe.CombinedOutput(p)

// errs contains everything written to stderr by running the script
output, errs, err := pipe.DividedOutput(p))

// Cancellation with low-level API
started := time.Now()
s := pipe.NewState(nil, nil)

if err := s(p); err != nil {
  // when the script failed to initialize
}

ch := make(chan error)
go func() {
    ch <- s.RunTasks()
}()
time.Sleep(100 * time.Millisecond)
s.Kill()

err := <-ch

if err.Error() == "explicitly killed" {
  // When the script
} else {
  // When the script succeeded
}

// context.Context support
started := time.Now()
// ctx, cancel := context.WithDeadline(context.Background(), ...)
// ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 100 * time.Millisecond)
s := pipe.NewState(nil, nil)

if err := s(p); err != nil {
  // when the script failed to initialize
}

ch := make(chan error)
go func() {
    ch <- s.Run(ctx)
}()

// `cancel()` to cancel

// If not `cancel()`ed, this may be an `explicitly killed` error due to the timeout
err := <-ch

if err.Error() == "context canceled" {
  // The script is cancelled
} else if err.Error() == "context deadline exceeded"
  // The script is timed out
} else {
  // The script succeeded
}
```

See [gopkg.in/pipe.v2](https://gopkg.in/pipe.v2) for the upstream documentation and usage details.

## Why you'd want to choose this over go-pipe?

`go-pipe` seemed the best option above all the options existed at the time of writing this, but it lacked the following things I wanted:

- Support for Go modules
- Support for Go `context.Context` for timeout, cancellation and deadline
- Tested compatibility with macOS(ore more concretely unit tests to ensure it's working on macOS)
- Exec logger for recording executed commands and context propagation for e.g. tracing and metering (See the OpenTelemetry example)

This project just adds them without (mostly) keeping the same API as `go-pipe`. I'm very eager to submit pull requests to `go-pipe/pipe` if it makes sense but until then I'll use this as a better alternative to `go-pipe` for my specific use-cases.

## Alternatives

For shell scripting in Go, and more concretely "replacing bash scripts with Go apps", I've considered following alternatives.

- https://github.com/ebuchman/go-shell-pipes, 2015, supports pipelines built from only slices-of-strings and only `exec.Cmd`s
- https://github.com/codeskyblue/go-sh, 2013-2019, `exec.Cmd`-like API with command-chaining and sessions
- https://github.com/go-pipe/pipe, 2014, [blog(2013)](https://blog.labix.org/2013/04/15/unix-like-pipelines-for-go), Go-native DSL for shell scripting and pipelining, supports `State.Kill` for cancellation, has ability to add custom DSL functions
- https://github.com/mattn/go-pipeline, 2017-, [blog(2015)](https://mattn.kaoriya.net/software/lang/go/20151030131242.htm), supports pipelines built from only slices-of-strings, best for capturing output/combimed output given commands(slices-of-strings)
- https://github.com/b4b4r07/go-pipe, 2019-, runs multiple `exec.Cmd`s in a pipeline and capture the output as bytes.Buffer
- https://github.com/urjitbhatia/gopipe, 2016-, stream-filter like API for Go, not exactly for shell scripting
- https://github.com/spatialcurrent/go-pipe, 2019-, RX-like API for Go
- https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html, vanilla Go os/exec, versatile but lots of boilterplate
- https://github.com/progrium/go-basher, GO API for embedded bash


text:
## New stuff:

Getting set up:

```
# install dependencies:
# linux (note: not tested yet)
sudo apt-get install arp-scan redis

# mac
brew install arp-scan redis

# Allow arp-scan to run via sudo without a pw (warning: may be a security hole!)
  1. Run `sudo visudo`
  2. Add this line the the end of the file: `ALL ALL=(root) NOPASSWD: /usr/local/bin/arp-scan`
    * Note this may be different on linux

# install server:
npm install
npm run build
npm run prod
```

# Raspberry Pi (Raspbian):

* Install https://www.raspberrypi.org/downloads/raspbian/ on the Pi
* Install Redis
  * See https://habilisbest.com/install-redis-on-your-raspberrypi
  * Note you'll need tcl to run `make test`: `sudo apt-get install tcl`
* Install apt-get dependencies: `sudo apt-get -y install arp-scan git`
* Install Node: (from https://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/ )
  * `curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -`
  * `sudo apt install -y nodejs`
* Install and run the server
  * `npm install`
  * `npm run build`
  * `ETHERNET_INTERFACE=wlan0 npm run prod`

# Rumblr - API

This project was originally based off the CBRumblrAPI project here: https://github.com/ComboStudio/CBRumblrAPI

The projects have diverged significantly though, and I don't think much, if any, of the CBRumblrAPI code is actually being used. For posterity, below is the CBRumblrAPI README:

Rumblr - entrance music for your office Sonos.

## Welcome

Welcome to the Rumblr API repo! If you've just stumbled across this repo, it might be worth noting that this is the server-side for a project called Rumblr. Please note that you'll need a bit of a technical understanding to get this all set up - but there's a comprehensive step-by-step guide to doing so over on this blog.

## Things to note

* **The server needs to be running on the same network as the client device AND the Sonos for this to work!** Yeah, it's far from ideal, but the Sonos bits require a bit of tunnel-y magic I haven't got round to trying yet. Would love to see any implementation of this, however!

* This doesn't support multiple Sonos systems particularly well. The way the script's written is simply to pick whichever the first Sonos the system comes across and use that (simpy because we've only got one in our studio...!). If you have a Sonos IP you'd like to specifically connect to, you can set the environment variable SONOS_IP to the IP of the system and override. **Note: Make sure it's a valid IP, otherwise the connection will hang.**

* The server logic itself is written in ES6 in the /lib folder. When *npm run build* is run, it'll run babel and compile the code to /build.

## Starting the server

Easy as pie - just download, open Terminal, navigate to the folder and run the following:

	npm install

	npm run build

	npm run prod

**Note:** If you're setting up the full experience, **[head over here](https://github.com/ComboStudio/CBRumblr)** and finish the rest of the setup for iOS!

## People who did this

We're a [tiny product studio called Combo](https://www.combostudio.co) from London who love making gnarly digital products just like this (or alternatively, absolutely nothing like this).

Interested in working with us? Sweet, our mailboxes are wide open. Drop us a line on [sam@combostudio.co](mailto:sam@combostudio.co).

## License

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: jpollard-cs/CBRumblrAPI

gha_language: JavaScript

repo_name: jpollard-cs/CBRumblrAPI


text:
---
layout: single
title: Day 3 - Arcade button midi controller
date: 2015-04-15 00:03
categories: YearOfMaking
---

![](/public/uploads/2015/10004109_624352320998246_1060490778_n.jpg)

Made with the VHS laser cutter. I will be using a [Arduino Leonardo](http://arduino.cc/en/Main/arduinoBoardLeonardo) to make these buttons into a [midi controller](https://en.wikipedia.org/wiki/MIDI). This midi controller will be used with [Open Sound Control](https://en.wikipedia.org/wiki/Open_Sound_Control) to control the LEDS and lighting effects on the outside of my dome project (Pocket Universe). I am waiting on my order of [micro switches from aliexpress](https://talk.hackspace.ca/t/im-buying-microswitches-for-arcade-buttons-do-you-want-any/1799?u=funvill)

gha_language: SCSS


text:
![DerpyBot Avatar](http://i.imgur.com/p999E1u.png)

# DerpyBot

[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/franciscog/DerpyBot/blob/master/LICENSE)

A Plug.dj Bot using [plugAPI](https://github.com/plugCubed/plugAPI)

[List of commands](#commands)

## Requirements

1. Node >= 4.0.0

## Installation

_Note_ - Windows 10 users may need to `npm install --global --production windows-build-tools` first

1. `npm install`
2. Create a new app in Firebase and export the service account credentials as json, rename it to `serviceAccountCredentials.json` and place it inside the private folder. It's in the Permissions settings somewhere. Firebase Console for your project -> Permissions -> Service Accounts -> Create Service Account, then follow the steps, give it "project -> editor" permissions, then download and rename the JSON it provides.
3. Create `settings.js`, see [README.md in /private](private/README.md) for more details, replacing each variable with your credentials and place that inside the `private` folder as well
4. `node index`

## Thanks

- [anjanms/DubAPI](https://github.com/anjanms/DubAPI) by [@anjanms](https://github.com/anjanms)
- [NitroGhost/dubbot-starter](https://github.com/NitroGhost/dubbot-starter) by [@NitroGhost](https://github.com/NitroGhost)
- And most important, [coryshaw1/SteveBot](https://github.com/coryshaw1/SteveBot) by [@coryshaw1](https://github.com/coryshaw1)

# Commands

# List of commands can be found [here](http://franciscog.com/DerpyBot/commands/)

<details>
  <summary>Want to contribute?</summary>

# Contributing

Fork this repo
Create Pull Requests

DerpyBot uses Firebase for its database so I need to grant you access. I've setup a development database in there that contributors will solely be using for now. Please DM me in Chillout Mixer's Discord channel with your email so that I can add you to the project. You'll need to download a json account credentials file.

I'll provide you with the firebase url

You'll also need your own of the following API keys:

- [SoundCloud](https://developers.soundcloud.com/)
- [YouTube Data Api](https://developers.google.com/youtube/v3/getting-started)

Both are just used to get data for the currently playing song

---

I'm slowly converting everything into async/await functions so here's something about the firebase calls in `repo.js`

With async/await you need to try/catch errors but I don't want to have a bunch of try/catches everywhere because that
will get unruly so this is what I'm doing:

in `repo.js` all of the functions should (eventually) by `async` and do not put any try/catch inside of them. You should allow them to throw errors and put your try/catches in the modules that is calling them.

TODO:

- I want to remove all of the `db` that is being passed around as arguments everywhere and have all db interactions go
  through `repo.js` (not sure why I didn't do that a long time ago)
- convert everything to TypeScript and follow [SOLID principles and Repository + Data Mapper pattern](https://dev.to/remojansen/implementing-the-onion-architecture-in-nodejs-with-typescript-and-inversifyjs-10ad)
- covnert to ES6 modules (export/import instead of require)
  </details>

repository: FranciscoG/Derpybot-plugdj

repo_name: FranciscoG/Derpybot-plugdj


text:
# kegg_to_mesh

API vs XML read? ---> 600mb in memory or stream read with look aheads?
http requests are slow but the search efford is left to the server

## Mesh Descriptor Record

Structure:
    Headings --- (also called "main headings" or "descriptors") represent concepts found in the biomedical literature.
    SubHeadings (also called qualifiers) are attached to MeSH headings to describe a specific aspect of a concept
    Supplementary Concept Records are terms in a separate thesaurus from the Medical Subject Headings.
    These are primarily substance terms, but also include some protocols, some virus terms and rare disease terms. These terms are updated daily.

MESH APIs

// tree info
https://meshb.nlm.nih.gov/api/tree/children/---> TREE IDENTIFIER <---

//descriptor details ---> terms <---
https://id.nlm.nih.gov/mesh/lookup/details?descriptor=---> DESCRIPTOR ID <---

MeSH headings are organized in a "tree" with 16 main branches:

A. Anatomy
B. Organisms
C. Diseases
D. Chemicals and Drugs
E. Analytical, Diagnostic and Therapeutic Techniques and Equipment
F. Psychiatry and Psychology
G. Phenomena and Processes
H. Disciplines and Occupations
I. Anthropology, Education, Sociology and Social Phenomena
J. Technology, Industry, Agriculture
K. Humanities
L. Information Science
M. Named Groups
N. Health Care
V. Publication Characteristics
Z. Geographicals

### TODO

get the descriptor json for each descriptor
find the descriptor label ---> check if it match environ
if yes
    get the descriptor details
    get the terms labels
    get the descriptor tree number
    get the children of the branch with that tree number
    check if they have children
    repeat till exausted
if no
    go to next descriptor

get descriptor details by descriptor id

gha_language: TypeScript


text:
---
title: Understanding Data-Binding's generated code and How does Android Data-Binding compiler work
date: "2017-02-28T23:46:37.121Z"
cover: cover-android-databinding.png
categories: "TECHNOLOGY / ANDROID"
---

This post isn't for who want to learn how to use Android data-binding or getting to know the basis concept. I suggest you go directly to [Google Documentation](https://developer.android.com/topic/libraries/data-binding/index.html) as a great starting point, which helps you integrate data-binding easily, a number of example code as well as other cool stuffs you can achieve when decided to apply it for your project. After having some experiences with data-binding, you guys may curious about what happen under the hood, how Google make tradditional XML files are able to combine with data-binding, how can xml interact with java code, and how its compiler give us the magic. This topic intent to expose a big picture about data-binding mechanism, and a deeply look into what happen underlying. So, developers will have a deeper understand which help them use data-binding in the right way, take advantage of data-binding power to build the great app.

-----

Recently, data-binding is a hottest android trend, which make developer life easier. Plenty of developers move to data-binding because of its beauty. But honestly, data-binding brings us a lot of troubles. Although, data-binding concept is pretty simple: "Yay! define a ViewModel class and try to match it to layout.xml, and we don't care about UI anymore, our data go straight into UI in a magic way." Really fast, really simple, but nothing is a bullet-silver. When something goes wrong, when your data suddenly cannot go to UI, when compiler raise a plenty of error messages and you really don't know what it means. What can we do!

-----

I have to face with these data-binding issue a lot and use a variety of tricks to get over. And I think, there is no way but take a look at data-binding code, find out how it works and I wouldn't have to deal with these issues anymore. Let's clone this Repository from Google and read code together [Data-Binding Repository](https://android.googlesource.com/platform/frameworks/data-binding/)

### Part 1: Data-binding flow, Obsevable pattern mechanism and what data-binding's generated-code means

 **To remember the code on higher layer, which we use in our application to play with data-binding, I created a simplest set of component as an example.**
1. Create a simple R.layout.activity_main
```xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="viewModel"
            type="com.example.main.MainViewModel" />

    </data>

    <TextView android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@{ viewModel.text }" />

</layout>
```
2. Create a simple MainActivity
```java
public class MainActivity extends AppCompatActivity {

    @Inject
    MainViewModel mViewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityMainBinding bind = DataBindingUtil.setContentView(this, R.layout.activity_main);
        bind.setViewModel(mViewModel);
    }
}
```
3. Create MainViewModel
```java
public class MainViewModel extends BaseObservable  {

    public final ObservableField<String> text = new ObservableField<>();

    public MainViewModel() {
    }

}
```

-----

**After compile the project, here are the new files we got from data-binding:**

1.  activity_main-layout.xml *(in data-binding-info folder)*
```xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Layout layout="activity_main" absoluteFilePath="/home/framgia/Projects/harpa-crista/harpacrista/android/app/src/main/res/layout/activity_main.xml"
    directory="layout"
    isMerge="false" modulePackage="com.harpacrista">
    <Variables declared="true" name="viewModel" type="com.example.main.MainViewModel">
        <location endLine="8" endOffset="51" startLine="6" startOffset="8" />
    </Variables>
    <Imports name="View" type="android.view.View">
        <location endLine="10" endOffset="42" startLine="10" startOffset="8" />
    </Imports>
    <Targets>
        <Target tag="layout/activity_main_0" view="TextView">
            <Expressions>
                <Expression attribute="android:text" text=" viewModel.text ">
                    <Location endLine="16" endOffset="41" startLine="16" startOffset="8" />
                    <TwoWay>false</TwoWay>
                    <ValueLocation endLine="16" endOffset="39" startLine="16" startOffset="24" />
                </Expression>
            </Expressions>
            <location endLine="16" endOffset="44" startLine="14" startOffset="4" />
        </Target>
    </Targets>
</Layout>
```

2. An shorter activity_main.xml version *(in data-binding-layout-out folder)*
```xml
<?xml version="1.0" encoding="utf-8"?>

<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:tag="layout/activity_main_0" />

```

3. And ActivityMainBinding.java, this is our main actor, where most of the magic happens.
```java
public class ActivityMainBinding extends android.databinding.ViewDataBinding  {

    private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;
    private static final android.util.SparseIntArray sViewsWithIds;
    static {
        sIncludes = null;
        sViewsWithIds = null;
    }
    // views
    private final android.widget.TextView mboundView0;
    // variables
    private com.example.main.MainViewModel mViewModel;
    // values
    // listeners
    // Inverse Binding Event Handlers

    public ActivityMainBinding(android.databinding.DataBindingComponent bindingComponent, View root) {
        super(bindingComponent, root, 2);
        final Object[] bindings = mapBindings(bindingComponent, root, 1, sIncludes, sViewsWithIds);
        this.mboundView0 = (android.widget.TextView) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x4L;
        }
        requestRebind();
    }

    @Override
    public boolean hasPendingBindings() {
        synchronized(this) {
            if (mDirtyFlags != 0) {
                return true;
            }
        }
        return false;
    }

    public boolean setVariable(int variableId, Object variable) {
        switch(variableId) {
            case BR.viewModel :
                setViewModel((com.example.main.MainViewModel) variable);
                return true;
        }
        return false;
    }

    public void setViewModel(com.example.main.MainViewModel viewModel) {
        updateRegistration(0, viewModel);
        this.mViewModel = viewModel;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.viewModel);
        super.requestRebind();
    }
    public com.example.main.MainViewModel getViewModel() {
        return mViewModel;
    }

    @Override
    protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
        switch (localFieldId) {
            case 0 :
                return onChangeViewModel((com.example.main.MainViewModel) object, fieldId);
            case 1 :
                return onChangeTextViewMode((android.databinding.ObservableField<java.lang.String>) object, fieldId);
        }
        return false;
    }
    private boolean onChangeViewModel(com.example.main.MainViewModel viewModel, int fieldId) {
        switch (fieldId) {
            case BR._all: {
                synchronized(this) {
                        mDirtyFlags |= 0x1L;
                }
                return true;
            }
        }
        return false;
    }
    private boolean onChangeTextViewMode(android.databinding.ObservableField<java.lang.String> textViewModel, int fieldId) {
        switch (fieldId) {
            case BR._all: {
                synchronized(this) {
                        mDirtyFlags |= 0x2L;
                }
                return true;
            }
        }
        return false;
    }

    @Override
    protected void executeBindings() {
        long dirtyFlags = 0;
        synchronized(this) {
            dirtyFlags = mDirtyFlags;
            mDirtyFlags = 0;
        }
        com.example.main.MainViewModel viewModel = mViewModel;
        java.lang.String textViewModel = null;
        android.databinding.ObservableField<java.lang.String> textViewModel1 = null;

        if ((dirtyFlags & 0x7L) != 0) {

                if (viewModel != null) {
                    // read viewModel.text
                    textViewModel1 = viewModel.text;
                }
                updateRegistration(1, textViewModel1);

                if (textViewModel1 != null) {
                    // read viewModel.text.get()
                    textViewModel = textViewModel1.get();
                }
        }
        // batch finished
        if ((dirtyFlags & 0x7L) != 0) {
            // api target 1

            android.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView0, textViewModel);
        }
    }
    // Listener Stub Implementations
    // callback impls
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;

    public static ActivityMainBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {
        return inflate(inflater, root, attachToRoot, android.databinding.DataBindingUtil.getDefaultComponent());
    }
    public static ActivityMainBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {
        return android.databinding.DataBindingUtil.<ActivityMainBinding>inflate(inflater, com.harpacrista.R.layout.activity_main, root, attachToRoot, bindingComponent);
    }
    public static ActivityMainBinding inflate(android.view.LayoutInflater inflater) {
        return inflate(inflater, android.databinding.DataBindingUtil.getDefaultComponent());
    }
    public static ActivityMainBinding inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {
        return bind(inflater.inflate(com.harpacrista.R.layout.activity_main, null, false), bindingComponent);
    }
    public static ActivityMainBinding bind(android.view.View view) {
        return bind(view, android.databinding.DataBindingUtil.getDefaultComponent());
    }
    public static ActivityMainBinding bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {
        if (!"layout/activity_main_0".equals(view.getTag())) {
            throw new RuntimeException("view tag isn't correct on view:" + view.getTag());
        }
        return new ActivityMainBinding(bindingComponent, view);
    }
    /* flag mapping
        flag 0 (0x1L): viewModel
        flag 1 (0x2L): viewModel.text
        flag 2 (0x3L): null
    flag mapping end*/
    //end
}
```

-----

As we can see above, from our activity_main.xml, data-binding generate for us 3 extra files: an `activity_main-layout.xml`, an shorter version `activity_main.xml` and an `ActivityMainBinding.java`. From there, we can have a first look at  generated code from xml layout.
Basically, an xml layout with outter tag` <Layout></Layout>` is different from the normal one. If the normal layout xml was used directly by android application, and sit in res/layout folder inside apk package, then xml layout with outter tag `<Layout></Layout>` was used indirectly. The compiler search through app layout folder to compile any file with outter tag `<Layout></Layout>` into the shorter version of activity_main.xml. And this version xml look exactly like the normal layout xml, which we gonna write if we don't go on data-binding way.

So, bassically, xml layout with data-binding is just a special version of the normal one, data-binding give them some lexical and grammar and force them rewrite normal layout in this way. Xml file cannot be understood by Android Framework, It's only understandable by data-binding compiler, and help compiler know where and how the data from ViewModel can map to View. Finally, compiler translate xml file into normal version, which is put inside apk beside activity_main-layout.xml and ActivityMainBinding.java

We can imagine that the original xml file contains 2 part: the normal part and the binding-part. Normal part is exactly the code we gonna write without binding. The binding-part is the code that help compiler able to generate java code, which is a nicely bridge between UI and Data.

activity_main-layout.xml *(in data-binding-info folder)*  contains the binding-part. Just like its name, this file is the information about binding ability of the layout. Look at this file again. Outer tag is still `<layout>` tag, but It's not like before.
```xml
<Layout layout="activity_main" absoluteFilePath="/home/framgia/android/app/src/main/res/layout/activity_main.xml"
    directory="layout" isMerge="false" modulePackage="com.harpacrista">
    ...
</Layout>
```
layout="activity_main" attribute indicate this file is the binding-part of acitivity_main.xml, which currently located at "/home/framgia/android/app/src/main/res/layout/activity_main.xml".
Inside `<Layout>` tag, no doubt, there are `<Variables>` tag  and `<Import>` tag. Because we define/improve this before to setViewModel, and reference to some class in layout.
```xml
<Variables declared="true" name="viewModel" type="com.example.main.MainViewModel">
        <location endLine="8" endOffset="51" startLine="6" startOffset="8" />
</Variables>
<Imports name="View" type="android.view.View">
        <location endLine="10" endOffset="42" startLine="10" startOffset="8" />
</Imports>
```
They also contains location information. I don't know why compiler need to save this location of Variable/Import, maybe its used for trace back or something like that.
And this is most important info in this file, `<Target>` tag tell compiler where the ViewModel should map to View,  binding type is one-way or two-way, location of View, location of value in View,
```xml
 <Targets>
        <Target tag="layout/activity_main_0" view="TextView">
            <Expressions>
                <Expression attribute="android:text" text=" viewModel.text ">
                    <Location endLine="16" endOffset="41" startLine="16" startOffset="8" />
                    <TwoWay>false</TwoWay>
                    <ValueLocation endLine="16" endOffset="39" startLine="16" startOffset="24" />
                </Expression>
            </Expressions>
            <location endLine="16" endOffset="44" startLine="14" startOffset="4" />
        </Target>
    </Targets>
```
We have a list of `<Target>` tags here. Remember we can have many View/ViewGroup in layout, but only View/ViewGroup contains data-binding expression are appeared here. And `<Expression>` tag inside `<Target>` tag is represent for data-binding expression in View. For example:
- Data-binding expression
     `android:visibility="@{ viewModel.isVisible ? View.VISIBLE : View.INVISIBLE }"`
will be compiled to

                <Expression attribute="android:visibility"
                            text=" viewModel.isVisible ? View.VISIBLE : View.INVISIBLE ">
                        <Location endLine="29" endOffset="88" startLine="29" startOffset="12" />
                        <TwoWay>false</TwoWay>
                        <ValueLocation endLine="29" endOffset="86" startLine="29" startOffset="34" />
                </Expression>

- Data-binding expression
   `android:text="@{ viewModel.text }"`
  will be compiled to

            <Expression attribute="android:text" text=" viewModel.text ">
                    <Location endLine="23" endOffset="45" startLine="23" startOffset="12" />
                    <TwoWay>false</TwoWay>
                    <ValueLocation endLine="23" endOffset="43" startLine="23" startOffset="28" />
            </Expression>

Pay attention to `<Expression attribute="android:text" text=" viewModel.text ">` . This is the bridge between View and ViewModel, what we are looking. Variable text in ViewModel now connect to android:text attribute in TextView. This is what we are expected. But from this xml information file to java code is still in mistery. Let' go to ActivityMainBinding.java.

-----

ActivityMainBinding.java is the subclass of ViewDataBinding, and developers are able to setViewModel into Layout here. It looks like java version of xml layout that I show you above. Each of View/ViewGroup tag in xml layout is a variable in this class. For example

```xml
<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="@{ viewModel.text }"
            />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="@{ viewModel.isVisible ? View.VISIBLE : View.INVISIBLE }"
            />
    </LinearLayout>
```
wil turn to

```java
public class ActivityMainBinding extends android.databinding.ViewDataBinding  {

    private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;
    private static final android.util.SparseIntArray sViewsWithIds;
    static {
        sIncludes = null;
        sViewsWithIds = null;
    }
    // views
    private final android.widget.LinearLayout mboundView0;
    private final android.widget.TextView mboundView1;
    private final android.widget.Button mboundView2;
    ...
}
```
And if you specify a id for a View in layout, this private field will become public field, and you can you use it immediately without call findViewById()

```java
// views
    private final android.widget.LinearLayout mboundView0;
    private final android.widget.Button mboundView2;
    public final android.widget.TextView tvTest;
```

That's convenient! Access to arbitrary View in layout is easier than ever. The variable name is same as android:id. In case of android:id with underscore convention, that name turn to camelCase, such as:  `android:id="@+id/tv_test"` -> `public final android.widget.TextView tvTest;`
`<variable>` tag definitely become variable in java class, which pretty familiar with us through setViewModel method. By the way, I want to mention Obsevable pattern when talking to ViewModel. Observable pattern is the key thing, make View got updated whenever ViewModel has changed, and ViewModel receive new data automatically when user interract with View. There are full of Obsevable types that cover whole of java data type:

    ObservableArrayList
    ObservableArrayMap
    ObservableBoolean
    ObservableByte
    ObservableChar
    ObservableDouble
    ObservableField
    ObservableFloat
    ObservableInt
    ObservableLong
    ObservableParcelable
    ObservableShort

This set of classes is pretty similar and simple. All extend from BaseObservable, contain only one variable, one getter and one setter. setter check whether new value is different from the old value or not, if new value is set then notifyChange() would be called, and Views will receive the update. But, **How notifyChange() affect to Views?**
To answer above question, I'll try to explain it as simple as I can with this simple case:
- **Expected:** We change isShowView variable in ViewModel to false,  View in actiivty_main.xml become invisible.
- **What happens underlying:**
    - When we setViewModel to ActivityMainBinding, updateRegistration was called to create the "bridge" between ViewModel and View
    - I'll show you what the "bridge" looks like

```java
    /**
     * Method object extracted out to attach a listener to a bound Observable object.
     */
    private static final CreateWeakListener CREATE_PROPERTY_LISTENER = new CreateWeakListener() {
        @Override
        public WeakListener create(ViewDataBinding viewDataBinding, int localFieldId) {
            return new WeakPropertyListener(viewDataBinding, localFieldId).getListener();
        }
    };

    ....

     private static class WeakPropertyListener extends Observable.OnPropertyChangedCallback
            implements ObservableReference<Observable> {
        final WeakListener<Observable> mListener;

        public WeakPropertyListener(ViewDataBinding binder, int localFieldId) {
            mListener = new WeakListener<Observable>(binder, localFieldId, this);
        }

        @Override
        public WeakListener<Observable> getListener() {
            return mListener;
        }

        @Override
        public void addListener(Observable target) {
            target.addOnPropertyChangedCallback(this);
        }

        @Override
        public void removeListener(Observable target) {
            target.removeOnPropertyChangedCallback(this);
        }

        @Override
        public void onPropertyChanged(Observable sender, int propertyId) {
            ViewDataBinding binder = mListener.getBinder();
            if (binder == null) {
                return;
            }
            Observable obj = mListener.getTarget();
            if (obj != sender) {
                return; // notification from the wrong object?
            }
            binder.handleFieldChange(mListener.mLocalFieldId, sender, propertyId);
        }
    }

    ...

     private static class WeakListener<T> extends WeakReference<ViewDataBinding> {
        private final ObservableReference<T> mObservable;
        protected final int mLocalFieldId;
        private T mTarget;

        public WeakListener(ViewDataBinding binder, int localFieldId,
                ObservableReference<T> observable) {
            super(binder);
            mLocalFieldId = localFieldId;
            mObservable = observable;
        }

        public void setTarget(T object) {
            unregister();
            mTarget = object;
            if (mTarget != null) {
                mObservable.addListener(mTarget);
            }
        }
    }
```

- mListener variable in `WeakPropertyListener` keep a weak reference to `MainDataBinding` , `setTarget` method in  `WeakListener` will be called that bind `ViewModel` to `MainDataBinding`
- From there, change `isShowView` variable in `ViewModel` will call notifyCallback(), which notify on `mNotifier`

```java
private void notifyCallbacks(T sender, int arg, A arg2, int startIndex, int endIndex, long bits) {
        long bitMask = 1L;

        for(int i = startIndex; i < endIndex; ++i) {
            if((bits & bitMask) == 0L) {
                this.mNotifier.onNotifyCallback(this.mCallbacks.get(i), sender, arg, arg2);
            }

            bitMask <<= 1;
        }

    }

```

- And `mNotifier` is also `WeakPropertyListener`. So, change `isShowView` on `ViewModel` will notify `WeakPropertyListener`, here is the place where `isShowView` affect to View and make it invisible. `executeBindings()` on `ActivityMainBinding` take the value and map to corresponding View on UI.

```java
@Override
    protected void executeBindings() {
        long dirtyFlags = 0;
        synchronized(this) {
            dirtyFlags = mDirtyFlags;
            mDirtyFlags = 0;
        }
        com.example.main.MainViewModel viewModel = mViewModel;
        int isVisibleViewModelVI = 0;
        boolean isVisibleViewModel = false;
        java.lang.String textViewModel = null;
        android.databinding.ObservableBoolean isVisibleViewModel1 = null;
        android.databinding.ObservableField<java.lang.String> textViewModel1 = null;

        if ((dirtyFlags & 0xfL) != 0) {

            if ((dirtyFlags & 0xbL) != 0) {

                    if (viewModel != null) {
                        // read viewModel.isVisible
                        isVisibleViewModel1 = viewModel.isVisible;
                    }
                    updateRegistration(1, isVisibleViewModel1);

                    if (isVisibleViewModel1 != null) {
                        // read viewModel.isVisible.get()
                        isVisibleViewModel = isVisibleViewModel1.get();
                    }
                    if((dirtyFlags & 0xbL) != 0) {
                        if (isVisibleViewModel) {
                            dirtyFlags |= 0x20L;
                        } else {
                            dirtyFlags |= 0x10L;
                        }}

                    // read viewModel.isVisible.get() ? View.VISIBLE : View.INVISIBLE
                    isVisibleViewModelVI = (isVisibleViewModel) ? (android.view.View.VISIBLE) : (android.view.View.INVISIBLE);
            }
            if ((dirtyFlags & 0xdL) != 0) {

                    if (viewModel != null) {
                        // read viewModel.text
                        textViewModel1 = viewModel.text;
                    }
                    updateRegistration(2, textViewModel1);

                    if (textViewModel1 != null) {
                        // read viewModel.text.get()
                        textViewModel = textViewModel1.get();
                    }
            }
        }
        // batch finished
        if ((dirtyFlags & 0xbL) != 0) {
            // api target 1

            this.mboundView2.setVisibility(isVisibleViewModelVI);
        }
        if ((dirtyFlags & 0xdL) != 0) {
            // api target 1

            android.databinding.adapters.TextViewBindingAdapter.setText(this.tvTest, textViewModel);
        }
    }
```

- We can see above code. Whenever ViewModel change their value, It will notify on `executeBindings()` method, this method rely on this value and execute an action on View, such as
 `this.mboundView2.setVisibility(isVisibleViewModelVI);`
 `  android.databinding.adapters.TextViewBindingAdapter.setText(this.tvTest, textViewModel);`
 - This is why we have to write @BindingAdapter and @BindingMethod to execute an action on View, e.g: recyclerView.setAdapter(), viewPager.setOnPageChange(), ...
 - However, Android already create a large of built-in BindingAdapters and BindingMethod, so developer most of time just reuse it. We only have to write our own code in special case or in the case Android still haven't support yet. In this case, `isShowView` is false equivalent to View.INVISIBLE that make View.setVisibility(View.INVISIBLE). That's all.
 - Before go to the next section, I would like to show you the data-binding built-in adapters. Keep using these and don't reinvent the wheel. I've seen so many developer abuse @BindingAdapter to rewrite what are already out there. What's a waste!

![](https://viblo.asia/uploads/1155b1c5-44e6-4a49-a7d3-6ad466f62522.png)

 ### Part 2. How does data-binding compiler generate code

 Did you clone official data-binding git repository as I give you above ? [Data-Binding Repository](https://android.googlesource.com/platform/frameworks/data-binding/)
 After understand how generated code work to bring us data-binding ability between View and ViewModel, in this section, we will find out the way compiler generate that magic code.
 Pay attention to 2 modules: `compiler` and `compilerCommon`. We mostly look around there.
 - The heart of compiler is `ProcessDataBinding` class inside `compiler.android.databinding.annotationprocessor`. This class take responsibility for run a list of process step one by one.

```java
         mProcessingSteps = Arrays.asList(
                new ProcessMethodAdapters(),
                new ProcessExpressions(),
                new ProcessBindable()
        );
```

- We go to the first process step - ProcessMethodAdapters. This class suppose to be search in all of current classes in project for which classes, which methods are annotated by following annotations: `@BindingAdapter`, `@Untaggable`, `@BindingMethods`, `@BindingConversion`, `@InverseBindingAdapter`, `@InverseBindingMethods`. And save all of them in SetterStore, which should be used later in executeBinding as we discuss above. During compile time, this information from annotation processor will be saved into file, that locate at `setter_store.bin`

```java
@Override
    public boolean onHandleStep(RoundEnvironment roundEnv,
            ProcessingEnvironment processingEnvironment, BindingBuildInfo buildInfo) {
        L.d("processing adapters");
        final ModelAnalyzer modelAnalyzer = ModelAnalyzer.getInstance();
        Preconditions.checkNotNull(modelAnalyzer, "Model analyzer should be"
                + " initialized first");
        SetterStore store = SetterStore.get(modelAnalyzer);
        clearIncrementalClasses(roundEnv, store);

        addBindingAdapters(roundEnv, processingEnvironment, store);
        addRenamed(roundEnv, store);
        addConversions(roundEnv, store);
        addUntaggable(roundEnv, store);
        addInverseAdapters(roundEnv, processingEnvironment, store);
        addInverseMethods(roundEnv, store);

        try {
            store.write(buildInfo.modulePackage(), processingEnvironment);
        } catch (IOException e) {
            L.e(e, "Could not write BindingAdapter intermediate file.");
        }
        return true;
    }

    ...

    public void write(String projectPackage, ProcessingEnvironment processingEnvironment)
            throws IOException {
        GenerationalClassUtil.writeIntermediateFile(processingEnvironment,
                projectPackage, projectPackage +
                        GenerationalClassUtil.ExtensionFilter.SETTER_STORE.getExtension(), mStore);
    }

    ...

    public enum ExtensionFilter {
        BR("-br.bin"),
        LAYOUT("-layoutinfo.bin"),
        SETTER_STORE("-setter_store.bin");
        private final String mExtension;
        ExtensionFilter(String extension) {
            mExtension = extension;
        }

        public boolean accept(String entryName) {
            return entryName.endsWith(mExtension);
        }

        public String getExtension() {
            return mExtension;
        }
    }
```

- The second step is ProcessExpressions. This process step looking for all of xml files in projects and parse xml file support data-binding which have `<layout></layout>` outter tag. Split this file into 2 files as I mention in section 1: `activity_main.xml` (normal layout) and `activity_main-layout.xml` (contains binding info). `LayoutBinder` class is most interesting, it use layoutBundle (from XmlParser) to calculate expression, location and target in  `activity_main-layout.xml`.

```java
@XmlAccessorType(XmlAccessType.NONE)
    @XmlRootElement(name="Layout")
    public static class LayoutFileBundle implements Serializable, FileScopeProvider {
        @XmlAttribute(name="layout", required = true)
        public String mFileName;
        @XmlAttribute(name="modulePackage", required = true)
        public String mModulePackage;
        @XmlAttribute(name="absoluteFilePath", required = true)
        public String mAbsoluteFilePath;
        private String mConfigName;

        // The binding class as given by the user
        @XmlAttribute(name="bindingClass", required = false)
        public String mBindingClass;

        // The location of the name of the generated class, optional
        @XmlElement(name = "ClassNameLocation", required = false)
        private Location mClassNameLocation;
        // The full package and class name as determined from mBindingClass and mModulePackage
        private String mFullBindingClass;

        // The simple binding class name as determined from mBindingClass and mModulePackage
        private String mBindingClassName;

        // The package of the binding class as determined from mBindingClass and mModulePackage
        private String mBindingPackage;

        @XmlAttribute(name="directory", required = true)
        public String mDirectory;
        public boolean mHasVariations;

        @XmlElement(name="Variables")
        public List<VariableDeclaration> mVariables = new ArrayList<VariableDeclaration>();

        @XmlElement(name="Imports")
        public List<NameTypeLocation> mImports = new ArrayList<NameTypeLocation>();

        @XmlElementWrapper(name="Targets")
        @XmlElement(name="Target")
        public List<BindingTargetBundle> mBindingTargetBundles = new ArrayList<BindingTargetBundle>();

        @XmlAttribute(name="isMerge", required = true)
        private boolean mIsMerge;

        ...

    }
```

```java
 public LayoutBinder(ResourceBundle.LayoutFileBundle layoutBundle) {
        try {
            Scope.enter(this);
            mExprModel = new ExprModel();
            mExpressionParser = new ExpressionParser(mExprModel);
            mBindingTargets = new ArrayList<BindingTarget>();
            mBundle = layoutBundle;
            mModulePackage = layoutBundle.getModulePackage();
            HashSet<String> names = new HashSet<String>();
            // copy over data.
            for (ResourceBundle.VariableDeclaration variable : mBundle.getVariables()) {
                addVariable(variable.name, variable.type, variable.location, variable.declared);
                names.add(variable.name);
            }

            for (ResourceBundle.NameTypeLocation userImport : mBundle.getImports()) {
                mExprModel.addImport(userImport.name, userImport.type, userImport.location);
                names.add(userImport.name);
            }
            if (!names.contains("context")) {
                mExprModel.builtInVariable("context", "android.content.Context",
                        "getRoot().getContext()");
                names.add("context");
            }
            for (String javaLangClass : sJavaLangClasses) {
                mExprModel.addImport(javaLangClass, "java.lang." + javaLangClass, null);
            }
            // First resolve all the View fields
            // Ensure there are no conflicts with variable names
            for (BindingTargetBundle targetBundle : mBundle.getBindingTargetBundles()) {
                try {
                    Scope.enter(targetBundle);
                    final BindingTarget bindingTarget = createBindingTarget(targetBundle);
                    if (bindingTarget.getId() != null) {
                        final String fieldName = LayoutBinderWriterKt.
                                getReadableName(bindingTarget);
                        if (names.contains(fieldName)) {
                            L.w("View field %s collides with a variable or import", fieldName);
                        } else {
                            names.add(fieldName);
                            mExprModel.viewFieldExpr(bindingTarget);
                        }
                    }
                } finally {
                    Scope.exit();
                }
            }

            for (BindingTarget bindingTarget : mBindingTargets) {
                try {
                    Scope.enter(bindingTarget.mBundle);
                    for (BindingTargetBundle.BindingBundle bindingBundle : bindingTarget.mBundle
                            .getBindingBundleList()) {
                        try {
                            Scope.enter(bindingBundle.getValueLocation());
                            bindingTarget.addBinding(bindingBundle.getName(),
                                    parse(bindingBundle.getExpr(), bindingBundle.isTwoWay(),
                                            bindingBundle.getValueLocation()));
                        } finally {
                            Scope.exit();
                        }
                    }
                    bindingTarget.resolveTwoWayExpressions();
                    bindingTarget.resolveMultiSetters();
                    bindingTarget.resolveListeners();
                } finally {
                    Scope.exit();
                }
            }
            mSortedBindingTargets = new ArrayList<BindingTarget>(mBindingTargets);
            Collections.sort(mSortedBindingTargets, COMPARE_FIELD_NAME);
        } finally {
            Scope.exit();
        }
    }
```

- And third step is ProcessBindable. This process generate BR class, which how binding property id, e.g: BR.text, BR.item, BR.isShowView, ...
- Finally, you might wonder where the important class like MainDataBinding is created. I don't know why Google wrote it in Kotlin but It's at DataBinderWriter.kt and LayoutBinderWriter.kt. You guys can explore these files a little bit.

### Conclusion
I hope you guys can read until the end of topic, because this topic is pretty complex and difficult especially with newcomer to MVVM world, so you guys may feel hard when reading. Data-binding isn't easy too use and even harder to understand. But I do believe when we actually understand the code behind, nothings are in mistery since we know what data-binding looks like. After go through some projects that use data-binding, I can see the bugs related to data-binding are really hard to trace and resolve, and developes take a lot of time on it. Through this topic, we're not affraid to go deeper into generated-code to find bugs. Having knowledge about compiler help us write in the best way, not tricky way.
Please drop a comment below to let me know which part of topic you guys aren't able to understand, and I will try my best to update, to make this topic more useful. Thanks for your time!

repository: chau-bao-long/my-blog

repo_name: chau-bao-long/my-blog


text:
##GetWordTextView

A TextView that can get word in it's content by click,and you can set HighlightText also.
(Support English and Chinese)

![](capture/capture.gif)

##Usage

###Add GetWordTextView to your layout:
```html
  <me.solidev.library.GetWordTextView xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/english_get_word_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        app:highlightColor="@color/colorAccent"
        app:highlightText="that"
        app:language="English"
        app:selectedColor="@color/colorPrimary" />
```
- highlightText:HighlightText
- highlightColor:HighlightText'color
- selectedColor:Clicked word's background
- language:Content's language

###Set Text and Listener in your code
```html
        mEnglishGetWordTextView = (GetWordTextView) findViewById(R.id.english_get_word_text_view);
        mEnglishGetWordTextView.setText("A view that can get every word inside,it's very helpful view!");
        mEnglishGetWordTextView.setOnWordClickListener(new GetWordTextView.OnWordClickListener() {
            @Override
            public void onClick(String word) {
                showToast(word);
            }
        });
```

##TODO
Mixed support for English and Chinese

##Contact & Help

- blog: http://www.jianshu.com/users/6725c8e8194f
- weibo: http://weibo.com/xljiepeng
- email<EMAIL_ADDRESS>

##License
```html
Copyright (C) 2016 [_SOLID](https://github.com/burgessjp)

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: burgessjp/GetWordTextView

gha_language: Java

repo_name: burgessjp/GetWordTextView


text:
# bytesutil

[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](LICENSE)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/lithdew/bytesutil)
[![Discord Chat](https://img.shields.io/discord/697002823123992617)](https://discord.gg/HZEbkeQ)

Utilities for reducing memory allocations in Go w/ 100% unit test coverage.

- Zero-allocation conversion between string and byte slice.
- Zero-allocation signed/unsigned variable integer encoding/decoding.
- Zero-allocation signed/unsigned 64-bit/32-bit/16-bit integer encoding/decoding.
- Extend slice to a sufficient length.

repository: forkkit/bytesutil

repo_name: forkkit/bytesutil


text:
# Node Rest

## Installation

```sh
npm install
```

## Usage

```sh
node index.js
```

And it is ready on `http://localhost:3000` :)

Enjoy!

## License

[MIT](https://github.com/fdaciuk/licenses/blob/master/MIT-LICENSE.md) © Fernando Daciuk

repository: fdaciuk/node-rest

repo_name: fdaciuk/node-rest


text:
# Custom Error Response Exception

## Structure

`CustomErrorResponseException`

## Fields

| Name | Type | Tags | Description |
|  --- | --- | --- | --- |
| `error_description` | `String` | Required | - |
| `caught` | `String` | Required | - |
| `exception` | `String` | Required | - |
| `inner_exception` | `String` | Required | - |

## Example (as JSON)

```json
{
  "error description": null,
  "caught": "Error in CatchInner caused by calling the ThrowInner method.",
  "Exception": "In catch block of Main method.",
  "Inner Exception": "AppException: Exception in ThrowInner method."
}
```


text:
---
layout: post
title: "Friday 04.19.19 -  CrossFit"
teaser: "A.
 B.  "
date: 2019-04-19 00:00:00
categories: wodup
tags: wods friday
header: no
---

A.

For Time:
– 100/75 Calories of Assault Bike
– 30 Deadlifts @ 84/52 kg

Calorie Assault Bike:

Men – 100 cal

Women – 75 cal

Maintain pace on the bike – break the deadlifts into 2-4 sets with short rest.

B.

Within 15 minutes:

Power Clean + Squat Clean + Hang Squat Clean + Push Jerk
– 7 sets of
Rest as needed

View on WodUp

#### Compare to other Fridays
{: .t60 }

{% include list-posts tag='friday' entries='5' %}

branch_name: refs/heads/gh-pages


text:
# Breast-Cancer

### The dataset for this project has been taken from Kaggle.
### I have used Google Colab to execute the code

#### The main purpose of the project is to predict Breast Cancer using different models and compare the performance of several models

____________________________________________________________________________________________________________________________________
#### The project consists of visualization using a pie chart and histogram

#### The models that have been used are-
    i) Dummy Classifier
    ii) Support Vector Classifier
    iii) Passive Aggressive Classifier
    iv) Logistic Regression
    v) Perceptron
    vi) Random Forest Classifier

#### The project compares these models using accuracy score and uses a bar chart to visualize and compare the accuracy scores of the models

repository: eshannaik/Breast-Cancer

repo_name: eshannaik/Breast-Cancer


text:
Sugar is all about making C# development a little bit sweeter
=============================================================

This is a set of C# extension methods (compatible with C# 3.5+) that make the language a bit more friendly. It's not a "Utility Belt" per se - just some object extenstions "designed to increase developer happiness".

These extensions are what I use in the WebMatrix videos on Tekpub.

How To Install It?
------------------
Drop the code file into your app and change it as you wish.

How Do You Use It?
------------------
Have a look in the files - see what's there. Strings, Dates, Regex, File IO and Validations - stuff you write every day.

repository: jonwingfield/sugar

extension: markdown

repo_name: jonwingfield/sugar


text:
//[astronomy](../../index.md)/[io.github.cosinekitty.astronomy](index.md)/[searchHourAngle](search-hour-angle.md)

# searchHourAngle

fun [searchHourAngle](search-hour-angle.md)(body: [Body](-body/index.md), observer: [Observer](-observer/index.md), hourAngle: [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html), startTime: [Time](-time/index.md), direction: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) = +1): [HourAngleInfo](-hour-angle-info/index.md)

Searches for the time when the center of a body reaches a specified hour angle as seen by an observer on the Earth.

The *hour angle* of a celestial body indicates its position in the sky with respect to the Earth's rotation. The hour angle depends on the location of the observer on the Earth. The hour angle is 0 when the body's center reaches its highest angle above the horizon in a given day. The hour angle increases by 1 unit for every sidereal hour that passes after that point, up to 24 sidereal hours when it reaches the highest point again. So the hour angle indicates the number of hours that have passed since the most recent time that the body has culminated, or reached its highest point.

This function searches for the next time a celestial body reaches the given hour angle after the date and time specified by startTime. To find when a body culminates, pass 0 for hourAngle. To find when a body reaches its lowest point in the sky, pass 12 for hourAngle.

Note that, especially close to the Earth's poles, a body as seen on a given day may always be above the horizon or always below the horizon, so the caller cannot assume that a culminating object is visible nor that an object is below the horizon at its minimum altitude.

On success, the function reports the date and time, along with the horizontal coordinates of the body at that time, as seen by the given observer.

#### Return

The time when the body reaches the hour angle, and the horizontal coordinates of the body at that time.

## Parameters

| | |
|---|---|
| body | The Sun, Moon, any planet other than the Earth, or a user-defined star that was created by a call to [defineStar](define-star.md). |
| observer | A location on or near the surface of the Earth where the observer is located. |
| hourAngle | An hour angle value in the range [0, 24) indicating the number of sidereal hours after the body's most recent culmination. |
| startTime | The date and time at which to start the search. |
| direction | The direction in time to perform the search: a positive value searches forward in time, a negative value searches backward in time. The function throws an exception if direction is zero. |

repository: cosinekitty/astronomy

gha_language: C

repo_name: cosinekitty/astronomy


text:
---
layout: post
title:  "Point Differential Plays and Rulings"
date:   2014-08-03
author: "Bruce Maurer"
---

Play: Home team scores on the TD and Try to go up 30 - 0 with 24 seconds left on
the GC in the 4th QT. The R winds the GC when he marks the ball ready prior to
the KO. The Home Team does not KO. Time Expires on the GC. Ruling. Game Over,
Home Team wins 30 - 0. Since the Game Clock starts when the R marks the ball
ready, the Home Team does not have to KO.

Play: Home team is winning 49 - 0 at half time. Both the HT and VT HC's get
together at halftime & agree to shorten the Varsity Game Quarters -- reducing
them from 12 minutes to 8 minutes in the second half. Since the HC's have
reduced the quarter length, they ask the Crew not to apply the new OHSAA Point
Differential Rule. Ruling: Apply the Point Differential Rule in the 2nd half.
Good Communication by the Crew -- explain to both HC's that the Point
Differential Rule will be applied, then ask them if they still want to shorten
the 3rd & 4th Quarters.

repository: paulghaddad/ohsaafb

gha_language: HTML

repo_name: paulghaddad/ohsaafb


text:
//[sdk](../../../index.md)/[com.swedbankpay.mobilesdk](../index.md)/[PaymentOrder](index.md)/[paymentToken](payment-token.md)

# paymentToken
[androidJvm]
Content
@(value = paymentToken)

val [paymentToken](payment-token.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? = null
More info

A payment token to use for this payment.

You must also set [PaymentOrderPayer.payerReference](../-payment-order-payer/payer-reference.md) to use a payment token; the payerReference must match the one used when the payment token was generated.

repository: SwedbankPay/swedbank-pay-sdk-android

gha_language: Kotlin

repo_name: SwedbankPay/swedbank-pay-sdk-android


text:
# [Jest](http://facebook.github.io/jest/) [![Build Status](https://travis-ci.org/facebook/jest.svg?branch=master)](https://travis-ci.org/facebook/jest) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/8n38o44k585hhvhd/branch/master?svg=true)](https://ci.appveyor.com/project/Daniel15/jest/branch/master) [![npm version](https://badge.fury.io/js/jest-cli.svg)](http://badge.fury.io/js/jest-cli)

Painless JavaScript Testing

- **Adaptable**: Jest uses Jasmine assertions by default and Jest is modular, extendible and configurable.

- **Sandboxed and Fast**: Jest virtualizes JavaScript environments, provides browser mocks and runs tests in parallel across workers.

- **Snapshot Testing**: Jest can [capture snapshots](http://facebook.github.io/jest/docs/tutorial-react.html#snapshot-testing) of React trees or other serializable values to write tests quickly and it provides a seamless update experience.

## Getting Started

<generated_getting_started_start />
Before you install Jest, you can try out a real version of Jest through [repl.it](https://repl.it). Just edit your test and hit the run button!

Install Jest with `yarn` or `npm` by running `yarn add -D jest` or `npm install --save-dev jest`. Let's get started by writing a test for a hypothetical `sum.js` file:

```javascript
module.exports = (a, b) => a + b;
```

Create a directory `__tests__/` with a file `sum-test.js` or name it `sum.test.js` or `sum.spec.js` and put it anywhere in your project:

```javascript
test('adds 1 + 2 to equal 3', () => {
  const sum = require('../sum');
  expect(sum(1, 2)).toBe(3);
});
```

Add the following to your `package.json`:

```js
"scripts": {
  "test": "jest"
}
```

Run `yarn test` and Jest will print this message: `PASS __tests__/sum-test.js`. You just successfully wrote your first test using Jest!

**You are ready to use Jest! Here are some more resources to help you get started:**

* Read the [API Documentation](https://facebook.github.io/jest/docs/api.html) to learn about all available assertions, ways of writing tests and Jest specific APIs.
* [Jest Configuration](https://facebook.github.io/jest/docs/configuration.html).
* [Example Code](https://github.com/facebook/jest/tree/master/examples/getting_started).
* [Migration from other test runners](https://facebook.github.io/jest/docs/migration-guide.html).
* Introductory guide at [Plotly Academy](https://academy.plot.ly/react/6-testing) that walks you through testing a React and Redux application.
* The [React](https://github.com/facebook/react/tree/master/src/renderers/shared/stack/reconciler/__tests__), [Relay](https://github.com/facebook/relay/tree/master/src/container/__tests__) and [react-native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) repositories have excellent examples of tests written by Facebook engineers.

**...or watch a video to get started with Jest:**

  Video by Kent C. Dodds hosted by Egghead.

### Babel Integration

If you'd like to use [Babel](http://babeljs.io/), it can easily be enabled: `yarn add -D babel-jest babel-polyfill`.

Don't forget to add a [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) file in your project's root folder. For example, if you are using ES2015 and [React.js](https://facebook.github.io/react/) with the [`babel-preset-es2015`](https://babeljs.io/docs/plugins/preset-es2015/) and [`babel-preset-react`](https://babeljs.io/docs/plugins/preset-react/) presets:

```js
{
  "presets": ["es2015", "react"]
}
```

You are now set up to use all ES2015 features and React specific syntax.

*Note: If you are using a more complicated Babel configuration, using Babel's `env` option,
keep in mind that Jest will automatically define `NODE_ENV` as `test`.
It will not use `development` section like Babel does by default when no `NODE_ENV` is set.*

### React, React Native and Snapshot Testing

Check out the [React tutorial](https://facebook.github.io/jest/docs/tutorial-react.html) and the [React Native tutorial](https://facebook.github.io/jest/docs/tutorial-react-native.html) to get started with React or React Native codebases. You can use React's test renderer (`yarn add -D react-test-renderer`) to capture snapshots with Jest's snapshot feature and the `toMatchSnapshot` matcher:

```js
import renderer from 'react-test-renderer';
test('Link renders correctly', () => {
  const tree = renderer.create(
    <Link page="http://www.facebook.com">Facebook</Link>
  ).toJSON();
  expect(tree).toMatchSnapshot();
});
```

and it will produce a snapshot like this:

```js
exports[`Link renders correctly 1`] = `
<a
  className="normal"
  href="http://www.facebook.com"
  onMouseEnter={[Function]}
  onMouseLeave={[Function]}>
  Facebook
</a>
`;
```

On subsequent test runs, Jest will compare the stored snapshot with the rendered output and highlight differences. If there are differences, Jest will ask you to fix your mistake and can be re-run with `-u` or `--updateSnapshot` to update an outdated snapshot.
<generated_getting_started_end />

## API & Configuration

* [API Reference](http://facebook.github.io/jest/docs/api.html)
* [Configuration](http://facebook.github.io/jest/docs/configuration.html)

gha_license_id: NOASSERTION