text:
# Code Standards / Style

- Use [Google's C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
- Use [Doxygen Style](http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html) comments.
    - Set `JAVADOC_AUTOBRIEF` configuration parameter to YES.
    - Prefer `@` style Doxygen commands.
    - All files must have `/** @file <name>` near the top of the file; generally `<name>` can be excluded.
    - Use JavaDoc style for comment blocks. Start with `/**` and end with `*/`.
    - Use `///<` to comment member variables.
    - Put your comments immediately before or after the commented element as much as possible.
    - Use Markdown format for descriptions instead of HTML.
    - Classes
        - If placed in front of the function it doesn't need a Doxygen command.
    - Functions
        - If placed in front of the function it doesn't need a Doxygen command.
    - Parameters
        - `@param <param name> <description>`
    - Exceptions
        - `@exception <name> <description>`
    - Return Values
        - `@return <name> <description>`

## Basic Style Guidance

- Formatting
    - Line length: TBD characters long...
    - Use spaces and not tabs for indentation.
    - Indentation should be consistent (i.e., 4 spaces)
    - Prefer no spaces inside `()` for conditionals.
    - Short conditional can be written on one line.
    - Use blocks for conditionals on multiple lines.
    - Use blocks for switch statement cases if needed.
    - Use blocks for loops.
    - Wrap returned values in `()` only when you would if it were used in an assignement statement, e.g., `x = ( value )` is not normal.
    - Do not add an extra level of indentation for namespaces.
- Comments
    - Start each file with a license boilerplate.
    - Use Doxygen style comments for C++.
    - Do not duplicate comments in `.hpp` files and `.cpp` files.
    - Classes, variables, and functions should be commented if there function/purpose is not obvious through their name.
    - Comment tricky, non-obvious code.
    - Do not describe **what** the code does (unless it will not be obvious to a developer), but describe **why** it does it.
- Includes
    - Use `#define` header guards
    - Order of includes: related headers, C library headers, C++ headers, other library's includes, your project includes.
    - Exception: with `cmake` it is not necessary to make header files be in direct decendant directories from the `src` directory.
- Naming
    - Be descriptive, and avoid abbreviations that are unfamiliar to almost all users.
    - Code file names
        - All lower case and include `_` or `-`.
        - Use `.cpp` for code files and `.hpp` for header files.
    - Type names, e.g., `MyType`
        - Classes, structs, aliases, enums, and type template parameters begin with a capital letter.
    - Variable names, e.g., `a_local_variable`
        - All lower case with underscores between words.
        - Classes with private member variables use a trailing underscore at the **end** or the name.
    - Constants
        - Start with the letter `k` and then are in camel case.
    - Function Names
        - Start with a capital and are camel case.
        - Accessors and mutators can use variable naming schemes.
    - Macro Names
        - All caps with underscores between words.
    - Enumeration Names
        - Like macros or like constants, i.e., start with `k`.
- Use namespaces to the extent practicable.
    - Do **not** use the `using` directive, e.g., `using namespace std`
    - Namespace names should be all lower case; top-level names should be based on the project name.
    - No need to repeat a namespace name, or a derivative, for a name within that namespace.
- Static Variables and Unnamed Namespaces
    - Place variables that do not need to be referenced outside of a file in an unnamed namespace or make them `static`.
- Classes
    - Constructors should not call virtual functions to avoid unforseen dispatch problems.
    - Avoid implicit conversions; use the `explicit` keyword. This avoids unanticipated type conversions. Copy and Move constructors do not need to be `explicit`.
    - If needed, support copying and moving; otherwise, disable these methods.
    - Use `struct` for data carrying objects (all elements are public by default); prefer `class` (all elements are private by default).
    - Prefer composition over inheritance. When inheritance is used make it public.
    - Make members private, unless they are `static const`.
    - Place public members first and group types of members. Prefer the order: `public`, `protected`, `private`.
- Non-member and Global Functions
    - Put non-member functions in a namespace.
    - Global functions should be used rarely.
    - Do not use a class as a surrogate for a namespace.
- Functions
    - Parameter order should be inputs and then outputs.
    - All input parameters passed by reference should be labeled `const`.
- Pointers
    - Prefer single, fixed owners of dynamically allocated objects; transfer ownership using smart pointers.
        - `std::unique_ptr` can be moved but not copied; it is destroyed when it goes out of scope.
        - `std::shared_ptr` can be moved and copied; it is destroyed when the last copy
- Local Variables
    - Place in narrowest scope possible.
    - Initialize variables where declared.
    - Declare variables as close as possible to where they are used first.
    - If possible, avoid instantiations within a loop.
- Casting
    - Use C++-style casts, e.g., `static_cast<float>( dbl_value )`. Avoid using C-style casts.
- Preincrement and Predecrement
    - Use the prefix for, e.g., `++i` with iterators.
- Const Correctness
    - Use `const` where appropriate.
    - Use `constexpr` where appropriate; for true constants or to ensure constant initialization.
    - Put `const` before the value it describes.
- Integer Types
    - use `<stdint.h>` and the explict integer types it describes, e.g., `int16_t` as much as possible.
    - For loop counters, etc., this does not matter as much.
- Macros
    - Avoid them and prefer inline functions.
- 0 and `nullptr`
    - Use 0 for integers, 0.0 for reals, `nullptr` for pointers, and '\0' for chars.
- `sizeof`
    - Prefer `sizeof(varname)` over `sizeof(type)`.
- Braced Initializer Lists
    - May be used, e.g., `Point p{1, 2};`

repository: usdot-jpo-ode/jpo-cvdp

repo_name: usdot-jpo-ode/jpo-cvdp


text:
# OSHA Monitor - Keeps an eye out for the workers

## General Idea
HiveOS allows notifications to Discord and Telegram but I am a simple person - I just want a text message if my worker goes offline. Hence, this project.

# Configuration File
Place this file at the root directory

## oshamonitor_config.json
- hiveos.bearer_token
    - You can create a static Authentication Token on the HiveOS website. When you first log in go to Account and then scroll down to fine Authentication token. Click "Generate new Personal API-token". After generated click "Show" and after authenticating, copy the token into this field.
- twilio.alert_recipient
    - This is the phone number you would like to be notified if your rig goes down. Format is "+\[CountryCode\]\[PhoneNumber_DigitsOnly\].
- twilio.twilio_number
    - This is the phone number you have set up in Twilio to send text messages from. Format is "+\[CountryCode\]\[PhoneNumber_DigitsOnly\].
- twilio.account_sid
    - This is your String Identifier (SID) for Twilio. Can be found on Twilio homepage after logging in. [More Details](https://www.twilio.com/docs/glossary/what-is-a-sid)
- twilio.auth_token
    - This is your Auth Token for Twilio. Can be found on the Twilio homepage after logging in. [More Details](https://support.twilio.com/hc/en-us/articles/223136027-Auth-Tokens-and-How-to-Change-Them)
- general.refresh_interval
    - This sets the frequency of the polling to check worker status. The number is the delay in milliseconds. IE: 5 seconds is 5000.
- general.end_monitoring_after_alert
    - This flag determines whether or not oshamonitor will continue running after alerting you that your system is offline. Main reason for setting this to true would be if you were concerned about not resolving the issue and the text messages costing you too much money. However, with a 60 second refresh interval an entire day of text messages would  cost you around $10 - not terrible.
```
    "hiveos": {
        "bearer_token": "your_hiveos_bearer_token"
    },
    "twilio": {
        "alert_recipient": "+1[your_number]",
        "twilio_number": "+1[your_twilio_number]",
        "account_sid": "your_account_sid",
        "auth_token": "your_auth_token"
    },
    "general" {
        "refresh_interval": "5000",
        "end_monitoring_after_alert": "false"
    }
```

# Important Notes
- Run `npm install` at the root level of this project to install the dependencies before first run.
- This currently is only set up to work for the first worker in your HiveOS account. It will ONLY monitor this one worker currently. I only have one worker so I have not implemented more workers at this point and likely will not.

license: MIT

repository: aaronschendel/oshamonitor

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: aaronschendel/oshamonitor


text:
A bank wanted a new feature to their online-banking mechanism to stop users from executing more transactions than allowed.
The bank would like to have a CAP limit of transactions per day for a user, so it won't be able to execute a transaction
if the limit is reached.

The transaction managing system was already implemented, so the bank hired a developer to add the CAP mechanism.

This is his solution:

```java
import java.util.HashSet;
import java.util.Set;

public class AccountManager {
  private static final int CAP = 100;
  private static final int WIN = 1000;
  private Set<Transaction> transactions = new HashSet<Transaction>();

  public synchronized void execute(Transaction trx) {
    if (transactions.size() >= CAP) {
      throw new IllegalStateException("Transactions limit reached! You have been
                                      caught !:(");
    } else {
      transactions.add(trx);
    }
  }

  public synchronized void check() {
    if (transactions.size() == WIN) {
      System.out.println("AccountManager HACKED!!! Yay :)");
    }
  }
}
```

```java
public class Transaction {
  public enum Type {
    DEPOSIT,
    WITHDRAW
  }

  private final Type type;
  private final long amount;

  public Transaction(Type type, long amount) {
    this.type = type;
    this.amount = amount;
  }

  public Type getType() {
    return type;
  }

  @Override
  public String toString() {
    return "Transaction [type=" + type + ", amount=" + amount + "]";
  }
}
```

He tested his code by running the following main:

```java
public class Main {
  public static void main(String args[]) {
    AccountManager manager = new AccountManager();
    for (int i = 0; i < 1000; i++) {
      manager.execute(new Transaction(Type.DEPOSIT, 1000));
    }
    manager.check();
  }
}
```

Running the main got him here:

```
Exception in thread "main" java.lang.IllegalStateException: Transactions limit reached! You have been caught! :(
```

This solution was sent to the bank, everyone was pleased with it.
 Your task is find a way to do the same.

If your hack is successful you should see "AccountManager HACKED!!! Yay :)" on your SYS_OUT.

Rules:
* only the Main class should be edited, your hack should only live there. Editing the other classes will not count as a valid solution.
* the solution is valid only if the message was printed by the AccountManager class in the check method.

repository: bmocanu/code-tryouts

branch_name: refs/heads/master

repo_name: bmocanu/code-tryouts


text:
# kubernetes-puppet
This is a Puppet Repository for Setting up a multi master multi worker node kubernetes cluster from scratch.
 You may need to add multiple nodes in that case just follow the steps as mentioned.
4. 1 Nginx load balancer to load balance the master API servers and also the Nginx ingress controllers running on worker nodes

To set up VMs using Terraform on GCP refer to https://github.com/bharatmicrosystems/gcp-terraform/tree/master/dev/kubernetes

Ensure the following:

1. All nodes can talk to each other on all ports,
2. User root from node02 and node03 can ssh into node01 passwordless
3. User root from puppet-master can ssh passwordless into master01.

In order to set that up passwordless ssh follow the below steps
```
# On source node
ssh-keygen -t rsa
cat /root/.ssh/id_rsa.pub
# On target node
vim /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config;
systemctl restart sshd
```
## Setup Puppet Master
SSH into the Puppet Master
```
sudo su -
yum install -y git
git clone https://github.com/bharatmicrosystems/kubernetes.git
cd kubernetes/puppet
sh -x master_setup.sh
```
This will setup the puppet master on the master node. You can then go to /etc/puppetlabs/code/environments/production/data/roles/k8smasterleader.yaml and setup the correct dashboard domain on the following section of the file instead of the default kubedashboard.example.com domain
```
profile::kubemasterleader::dashboardDomain: 'kubedashboard.example.com'
```
You can also modify the apps section of the yaml file to include additonal apps that you might want to run in the kubernetes cluster. This will ensure that Puppet manages the kubernetes manifests for the application and any update required because of any change in the source code. The manifest currently points to the github repository hosted by this project but you are free to modify it to include apps from any git repository. Please note that the yaml in the individual repository point to the example.com domain. You can fork the repo into another one and make changes to add your custom domain on which the apps need to run.
```
profile::kubeapps:
  ingress:
    gitUrl: 'https://github.com/bharatmicrosystems/kubernetes.git'
    directory: 'kubernetes/ingress'
```
## Setup Load Balancer
SSH into the masterlb node
```
sudo su -
yum install -y git
git clone https://github.com/bharatmicrosystems/kubernetes.git
cd kubernetes/puppet
sh -x agent_setup.sh loadbalancer
puppet agent -t
```
On the puppet master sign the masterlb certificate by running
```
puppetserver ca sign --certname masterlb
```
Then go back to the masterlb node and run the following
```
puppet agent -t
```
## Setup Kubernetes Master node
SSH into the master01 node
```
sudo su -
yum install -y git
git clone https://github.com/bharatmicrosystems/kubernetes.git
cd kubernetes/puppet
sh -x agent_setup.sh k8smasterleader
puppet agent -t
```
On the puppet master sign the master01 certificate by running
```
puppetserver ca sign --all
```
Then go back to the master01 node and run the following
```
puppet agent -t
```
SSH into the master02 and master03 nodes
```
sudo su -
yum install -y git
git clone https://github.com/bharatmicrosystems/kubernetes.git
cd kubernetes/puppet
sh -x agent_setup.sh k8smaster
puppet agent -t
```
On the puppet master sign the certificate by running
```
puppetserver ca sign --all
```
Then go back to the master02 and master03 nodes and run the following
```
puppet agent -t
```
SSH into the worker nodes
```
sudo su -
yum install -y git
git clone https://github.com/bharatmicrosystems/kubernetes.git
cd kubernetes/puppet
sh -x agent_setup.sh k8sworker
puppet agent -t
```
Go to puppet-master and sign the certificate
```
puppetserver ca sign --all
```
Go to node again
```
puppet agent -t
```
On the master01 node
```
kubectl get nodes
```
It should list all the master and agent nodes.

repository: bharatmicrosystems/kubernetes-puppet

repo_name: bharatmicrosystems/kubernetes-puppet


text:
---
published: true
title: How a 64k intro is made
tags: demoscene
---
> many people have interest in demoscene productions but have no idea how they are actually made. This is a braindump/post-mortem of our recent 64k intro Guberniya - [An intro to intros](http://www.lofibucket.com/articles/64k_intro.html)


text:
# Kubernetes (K8s) ConfigMap support

This package allows you to use [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/) objects in Kubernetes to
drive the update of [dynamic](../README.md#dynamic-json-flag-with-a-validator-and-notifier) `dflag` at runtime of your service.

## Semantics

The `Updater` is optionally split into two phases:

 * `Initialize()` - used on server startup which allows both `static` and `dynamic` flags to be updated from values
    stored in a `ConfigMap`
 * `Start()` - kicking off a an [`fsnotify`](https://github.com/fsnotify/fsnotify) Go-routine which watches for updates
   of values in the ConfigMap. To avoid races, this allows only to update `dynamic` flags.

Or you can do all at once `Setup()`

## Code example

```go
// First parse the flags from the command line, as normal.
flag.Parse()
// Setup watcher and start watching for change (including initial read)
u, err := configmap.Setup(flag.CommandLine, "/etc/dflag", logger)
if err != nil {
  logger.Fatalf("failed setting up: %v", err)
}
```

## In a nutshell

You define a ConfigMap with values for your flags.

```yaml
kind: ConfigMap
apiVersion: v1
metadata:
  creationTimestamp: 2016-09-09T09:14:38Z
  name: example-config
  namespace: default
data:
  example_my_dynamic_string: something
  example_my_dynamic_int: 20
  example_my_dynamic_json: |-
    {
      "policy": "allow",
      "rate": 50
    }
```

Then you just push it to your Kubernetes cluster:

```
# kubectl replace -f example.yaml
```

And all your jobs referencing this ConfigMap via a volume mount will see updates `dflag` updates to keys in your data. For an end to end example see [server_kube](../examples/server_kube).

Sample pod using a volume configmap:
```yaml
apiVersion: v1
kind: Pod
metadata:
  name: debug
spec:
  containers:
    - name: shell
      image: ubuntu:latest
      command: [ "/bin/bash" ]
      args: [ "-c", "while true; do date; sleep 60; done" ]
      volumeMounts:
        - name: config-volume
          mountPath: /etc/dflag
  volumes:
    - name: config-volume
      configMap:
        name: example-config
```

repository: airbnb/fortio

repo_name: airbnb/fortio


text:
---
title: "Blog Bite: How can the limitation of liability clause be drafted to be more effective?"
author<EMAIL_ADDRESS>tags: ["Liability","Mondaq","Learn","Canada (BC)"]
date: 2015-07-13 00:00:00
description: "This article posted on our partner site Mondaq.com uses case law to discuss the reach of limitation of liability clauses. For example, when a party to a project has a subcontractor who engages in neg..."
---

[This article posted on our partner site Mondaq.com](http://www.mondaq.com/canada/x/411990/Building+Construction/Limitation+of+Liability+Clauses+Are+They+Enforceable+and+Effective) uses case law to discuss the reach of limitation of liability clauses. For example, when a party to a project has a subcontractor who engages in negligent misrepresentation, the clause remains in effect to protect the party but not the subcontractor, who is held liable for full indemnities.

This comes to you as a part of Clausehound's exciting new collaboration with Mondaq!

repository: JaninaFe/clausehound-blog

gha_license_id: MIT

repo_name: JaninaFe/clausehound-blog


text:
# React Native Technical Interview

Wolox's base project for the React Native's team technical interview

Updated by: [Djmaam](https://marcosarrieta.dev).

### Objective

Build an app to display a list of books retrieved from the mocked API.
You must follow the instructions that have been shared to you to solve the exercise.

### Good luck!

![Splash Screen](./src/Assets/WBooks/Splash.jpg) ![Login Screen](./src/Assets/WBooks/Login.jpg)
![Library Screen](./src/Assets/WBooks/Library.jpg) ![BookDetails Screen](./src/Assets/WBooks/Book-Details.jpg)
![Wishlist Screen](./src/Assets/WBooks/Wishlist.jpg) ![Settings Screen](./src/Assets/WBooks/Settings.jpg)

### Setting up Environtment

To run the Local_API:

```shell
    npm install -g json-server
    json-server --watch db.json
```

Create or copy the file ./src/Configs/env.example.json to ./src/Configs/env.json.

Next, to start the app in Android run:

```shell
    cd android && ./gradlew clean && cd ..
    yarn android
    adb reverse tcp:3000 tcp:3000
```

To run in iOS:

```shell
    yarn ios
```

A list of the avaliable npm commands:

- Start development server: `yarn start`
- Run the Android app: `yarn android`
- Run the iOS app: `yarn ios`

The app environment configuration can be found in `./src/Configs/env.example.js`

##  About

This project is maintained and it was written by [Wolox](http://www.wolox.com.ar).

![Wolox](https://raw.githubusercontent.com/Wolox/press-kit/master/logos/logo_banner.png)

##  License

This project is available under the MIT [license](https://raw.githubusercontent.com/Wolox/wolmo-core-android/master/LICENSE.md).

    Copyright (c) Wolox S.A

    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: djmaam/WBooks-App

repo_name: djmaam/WBooks-App


text:
# Shape Fit Mathematically

This is a console program that try to fit small triangles, rectangles or circles into big container triangle, rectangle or circle, mathematically and writes these shapes into a svg file that can be shown on browser.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

### Prerequisites
You need to have compiler to compile code on your system that like:

```
g++ compiler v4.2.1 or higher
```

### Installing

On your terminal just write (for Linux and Mac)

```
make
```
or for Windows with MinGW compiler write

```
mingw32-make
```
After that it will compile all code and creates an executable program that name is MyProgram.
To start program and create .svg files that show shapes on browser type on your console

```
./MyProgram
```
## Author

* **Furkan Kalabalık** - *Initial work* - [programmer-furkan](https://github.com/programmer-furkan)

## License

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


text:
# xtal-shell

$hell.js helps with debugging web components, and for creating automated regression testing for applications built with them.

Although it may not appear this way at the moment, I believe the topic of automated regression tests will become an area where web components will shine quite brightly.  This library is intended to bring that day closer.  The reason I think this is that 1)  By relying on native features to create semantic markup, the path tests will be much less arbitrary, relying on less on class names used for styling, more on semantic tag names and id's that will likely  represent more of the stable business functionality.  The ability to define ID's within a component, that doesn't need to be unique for other components, will allow developers to specify the functionality of common tags (***cough***div***cough***) in a uniform, consistent way.

The immediate stumbling block is that there is no standard css selector for piercing Shadow DOM.

The approach we take is to define a syntax where there is one and only way to describe how to locate a node.  It should be easy to select a HTML Node with chrome dev tools (for example) and generate that unique path.

A noteworthy feature of the approach outlined here is that we will generate tests that err on the side of caution, i.e better to flag unexpected things, rather than assume everything is okay.   The path to elements will be very specific.  If the layout of a page changes in any significant way, unit tests built using these paths will need to be adjusted.

But as we will see, you can make one query that is quite specific, with a long path, followed by navigating around in the context of the original query.  So if the layout changes, it could cause that single long query to change, leaving the relative navigation afterwards unaffected.

You will need to include a reference to the file $hell.js in your web site.  It is advisable to not include this file (at least unconditionally) in production, simply because it adds a few KB to the footprint.

The JavaScript file $hell.js provides a static class $hell, which gets put into global scope.

From the dev tools / console tab of your (least) favorite browser, you can type certain "commands" to help you navigate and inspect the web components.

**$hell.ls** lists all the nodes in your current context.  When the page first loads, or is refreshed, the context will start out at document.body.

**$hell.cd(path)** allows you to move the context into children (or ancestors if you start the path with ..)

Paths look like directory paths (with the slash delimiter), and is limited to tag name, ID and/or index.  For example:

```JavaScript
$hell.cd('div/demo-snippet/iron-list#myID/div[7]')
```

**$hell.properties** lists the values of all the Polymer properties of the web component. It also outputs the constructor, allowing you to right click and jump to the code behind the web componnt.

**$hell.pwd** displays the current "directory" of your element context.

If you use the dreaded with statement, the syntax may look quite natural to command line enthusiasts:

```JavaScript
with($hell){
    cd('div');
    cd('demo-snippet/iron-list');
    pwd;
}
```

If you right-click on an element in Chrome (or Edge outside any shadow dom), this puts the element into a variable $0 available from the console.  You can get then get the full path to the element thusly:

```JavaScript
$hell.getFullPath($0);
```

You can also set the context, bypassing any cd steps:

$hell.$0 = $0

## Instructions to load.

Open a web site, any site, just  open a site.

For example, you tube (https://youtube.com)

Open the dev tools, go to the console window and type:

import('https://cdn.jsdelivr.net/npm/xtal-shell/$hell.js')

Now you can inspect / navigate the site as described above.

repository: bahrus/xtal-shell

gha_language: JavaScript

repo_name: bahrus/xtal-shell


text:
# AD.DatabaseManagementApi
C# framework for executing queued database management tasks.

![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/austindrenski/AD.DatabaseManagementApi?svg=true)

## Install from NuGet:
```Powershell
PM> Install-Package AD.DatabaseManagementApi
```
## Example:
The ```DbManagementController``` should be used wrapped in a ```using``` block. Services can be added to the controller by calling the ```Message(...)``` method. These services are added to the controller's queue and invoked consecutively when the controller's ```Invoke()``` method is called.

A service class inherits from ```DbManagementService```. The database work should be performed inside of the overridden ```Invoke()``` method. This method should return the number of records that were modified. This number will be written to the standard output.
### Console:
```C#
using System.Data.Entity
using AD.DatabaseManagementApi;

public static void Main()
{
    using (DbManagementController controller = new DbManagementController(new DbContext()))
    {
        // Add one service to the controller
        controller.Message("Execute first update service?", Service1());

        // Add a second service to the controller
        controller.Message("Execute second update service?", Service2());

        // Invoke the services
        controller.Invoke();
    }
}

public class Service1 : DbManagementService
{
    public ComtradeMetadataService(DbContext context) : base(context) { }

    protected override int Invoke()
    {
        // Add one record to the context
        Context.Table1.Add(...);

        // Return the number of records affected
        return 1;
    }
}

public class Service2 : Service1 { }

```
### Output:
```
Executing services at 12:00 PM. Please wait...

> Starting service 1 of 2 at 12:00 PM : Service1.
> Service1 completed with 1 record affected in 1 minute.

> Starting service 2 of 2 at 12:01 PM : Service2.
> Service2 completed with 1 record affected in 1 minute.

Completed 2 services in 2 minutes. Press enter to exit...
```


text:
[//]: # (title: Calling Java from Kotlin)

Kotlin is designed with Java interoperability in mind. Existing Java code can be called from Kotlin in a natural way,
and Kotlin code can be used from Java rather smoothly as well.
In this section, we describe some details about calling Java code from Kotlin.

Pretty much all Java code can be used without any issues:

```kotlin
import java.util.*

fun demo(source: List<Int>) {
    val list = ArrayList<Int>()
    // 'for'-loops work for Java collections:
    for (item in source) {
        list.add(item)
    }
    // Operator conventions work as well:
    for (i in 0..source.size - 1) {
        list[i] = source[i] // get and set are called
    }
}
```

## Getters and setters

Methods that follow the Java conventions for getters and setters (no-argument methods with names starting with `get`
and single-argument methods with names starting with `set`) are represented as properties in Kotlin. Such properties are
also called _synthetic properties_.
`Boolean` accessor methods (where the name of the getter starts with `is` and the name of the setter starts with `set`)
are represented as properties which have the same name as the getter method.

```kotlin
import java.util.Calendar

fun calendarDemo() {
    val calendar = Calendar.getInstance()
    if (calendar.firstDayOfWeek == Calendar.SUNDAY) { // call getFirstDayOfWeek()
        calendar.firstDayOfWeek = Calendar.MONDAY // call setFirstDayOfWeek()
    }
    if (!calendar.isLenient) { // call isLenient()
        calendar.isLenient = true // call setLenient()
    }
}
```

`calendar.firstDayOfWeek` above is an example of a synthetic property.

Note that, if the Java class only has a setter, it isn't visible as a property in Kotlin because Kotlin doesn't support
set-only properties.

## Java synthetic property references

> This feature is [Experimental](components-stability.md#stability-levels-explained). It may be dropped or changed at any time.
> We recommend that you use it only for evaluation purposes.
>
{type="warning"}

Starting from Kotlin 1.8.20, you can create references to Java synthetic properties. Consider the following Java code:

```java
public class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}
```

Kotlin has always allowed you to write `person.age`, where `age` is a synthetic property. Now, you can also
create references to `Person::age` and `person::age`. The same applies for `name`, as well.

```kotlin
val persons = listOf(Person("Jack", 11), Person("Sofie", 12), Person("Peter", 11))
    Persons
         // Call a reference to Java synthetic property:
        .sortedBy(Person::age)
         // Call Java getter via the Kotlin property syntax:
        .forEach { person -> println(person.name) }
}
```

### How to enable Java synthetic property references {initial-collapse-state="collapsed"}

To enable this feature, set the `-language-version 2.1` compiler option. In a Gradle project, you can do so
by adding the following to your `build.gradle(.kts)`:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
tasks
    .withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask<*>>()
    .configureEach {
        compilerOptions
            .languageVersion
            .set(
                org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1
            )
    }
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
tasks
    .withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask.class)
    .configureEach {
        compilerOptions.languageVersion
            = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1
}
```

</tab>
</tabs>

> Prior to Kotlin 1.9.0, to enable this feature you had to set the `-language-version 1.9` compiler option.
>
{type="note"}

## Methods returning void

If a Java method returns `void`, it will return `Unit` when called from Kotlin.
If by any chance someone uses that return value, it will be assigned at the call site by the Kotlin compiler
since the value itself is known in advance (being `Unit`).

## Escaping for Java identifiers that are keywords in Kotlin

Some of the Kotlin keywords are valid identifiers in Java: `in`, `object`, `is`, and other.
If a Java library uses a Kotlin keyword for a method, you can still call the method
escaping it with the backtick (`) character:

```kotlin
foo.`is`(bar)
```

## Null-safety and platform types

Any reference in Java may be `null`, which makes Kotlin's requirements of strict null-safety impractical for objects coming from Java.
Types of Java declarations are treated in Kotlin in a specific manner and called *platform types*. Null-checks are relaxed
for such types, so that safety guarantees for them are the same as in Java (see more [below](#mapped-types)).

Consider the following examples:

```kotlin
val list = ArrayList<String>() // non-null (constructor result)
list.add("Item")
val size = list.size // non-null (primitive int)
val item = list[0] // platform type inferred (ordinary Java object)
```

When you call methods on variables of platform types, Kotlin does not issue nullability errors at compile time,
but the call may fail at runtime, because of a null-pointer exception or an assertion that Kotlin generates to
prevent nulls from propagating:

```kotlin
item.substring(1) // allowed, throws an exception if item == null
```

Platform types are *non-denotable*, meaning that you can't write them down explicitly in the language.
When a platform value is assigned to a Kotlin variable, you can rely on the type inference (the variable will have an inferred
platform type then, as `item` has in the example above), or you can choose the type you expect (both nullable and non-null types are allowed):

```kotlin
val nullable: String? = item // allowed, always works
val notNull: String = item // allowed, may fail at runtime
```

If you choose a non-null type, the compiler will emit an assertion upon assignment. This prevents Kotlin's non-null variables from holding
nulls. Assertions are also emitted when you pass platform values to Kotlin functions expecting non-null values and in other cases.
Overall, the compiler does its best to prevent nulls from propagating far through the program although sometimes this is
impossible to eliminate entirely, because of generics.

### Notation for platform types

As mentioned above, platform types can't be mentioned explicitly in the program, so there's no syntax for them in the language.
Nevertheless, the compiler and IDE need to display them sometimes (for example, in error messages or parameter info),
so there is a mnemonic notation for them:

* `T!` means "`T` or `T?`",
* `(Mutable)Collection<T>!` means "Java collection of `T` may be mutable or not, may be nullable or not",
* `Array<(out) T>!` means "Java array of `T` (or a subtype of `T`), nullable or not"

### Nullability annotations

Java types that have nullability annotations are represented not as platform types, but as actual nullable or non-null
Kotlin types. The compiler supports several flavors of nullability annotations, including:

  * [JetBrains](https://www.jetbrains.com/idea/help/nullable-and-notnull-annotations.html)
(`@Nullable` and `@NotNull` from the `org.jetbrains.annotations` package)
  * [JSpecify](https://jspecify.dev/) (`org.jspecify.nullness`)
  * Android (`com.android.annotations` and `android.support.annotations`)
  * JSR-305 (`javax.annotation`, more details below)
  * FindBugs (`edu.umd.cs.findbugs.annotations`)
  * Eclipse (`org.eclipse.jdt.annotation`)
  * Lombok (`lombok.NonNull`)
  * RxJava 3 (`io.reactivex.rxjava3.annotations`)

You can specify whether the compiler reports a nullability mismatch based on the information from specific types of
nullability annotations. Use the compiler option `-Xnullability-annotations=@<package-name>:<report-level>`.
In the argument, specify the fully qualified nullability annotations package and one of these report levels:
* `ignore` to ignore nullability mismatches
* `warn` to report warnings
* `strict` to report errors.

See the full list of supported nullability annotations in the
[Kotlin compiler source code](https://github.com/JetBrains/kotlin/blob/master/core/compiler.common.jvm/src/org/jetbrains/kotlin/load/java/JvmAnnotationNames.kt).

### Annotating type arguments and type parameters

You can annotate the type arguments and type parameters of generic types to provide nullability information for them as well.

> All examples in the section use JetBrains nullability annotations from the `org.jetbrains.annotations` package.
>
{type="note"}

#### Type arguments

Consider these annotations on a Java declaration:

```java
@NotNull
Set<@NotNull String> toSet(@NotNull Collection<@NotNull String> elements) { ... }
```

They result in the following signature in Kotlin:

```kotlin
fun toSet(elements: (Mutable)Collection<String>) : (Mutable)Set<String> { ... }
```

When the `@NotNull` annotation is missing from a type argument, you get a platform type instead:

```kotlin
fun toSet(elements: (Mutable)Collection<String!>) : (Mutable)Set<String!> { ... }
```

Kotlin also takes into account nullability annotations on type arguments of base classes and interfaces. For example,
there are two Java classes with the signatures provided below:

```java
public class Base<T> {}
```

```java
public class Derived extends Base<@Nullable String> {}
```

In the Kotlin code, passing the instance of `Derived` where the `Base<String>` is assumed produces the warning.

```kotlin
fun takeBaseOfNotNullStrings(x: Base<String>) {}

fun main() {
    takeBaseOfNotNullStrings(Derived()) // warning: nullability mismatch
}
```

The upper bound of `Derived` is set to `Base<String?>`, which is different from `Base<String>`.

Learn more about [Java generics in Kotlin](java-interop.md#java-generics-in-kotlin).

#### Type parameters

By default, the nullability of plain type parameters in both Kotlin and Java is undefined. In Java, you can specify it
using nullability annotations. Let's annotate the type parameter of the `Base` class:

```java
public class Base<@NotNull T> {}
```

When inheriting from `Base`, Kotlin expects a non-nullable type argument or type parameter.
Thus, the following Kotlin code produces a warning:

```kotlin
class Derived<K> : Base<K> {} // warning: K has undefined nullability
```

You can fix it by specifying the upper bound `K : Any`.

Kotlin also supports nullability annotations on the bounds of Java type parameters. Let's add bounds to `Base`:

```java
public class BaseWithBound<T extends @NotNull Number> {}
```

Kotlin translates this just as follows:

```kotlin
class BaseWithBound<T : Number> {}
```

So passing nullable type as a type argument or type parameter produces a warning.

Annotating type arguments and type parameters works with the Java 8 target or higher. The feature requires that the
nullability annotations support the `TYPE_USE` target (`org.jetbrains.annotations` supports this in version 15 and above).
Pass the `-Xtype-enhancement-improvements-strict-mode` compiler option to report errors in Kotlin code that uses
nullability which deviates from the nullability annotations from Java.

> Note: If a nullability annotation supports other targets that are applicable to a type in addition to the `TYPE_USE` target, then
> `TYPE_USE` takes priority. For example, if `@Nullable` has both `TYPE_USE` and `METHOD` targets, the Java method
> signature `@Nullable String[] f()` becomes `fun f(): Array<String?>!` in Kotlin.
>
{type="note"}

### JSR-305 support

The [`@Nonnull`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/Nonnull.html) annotation defined
in [JSR-305](https://jcp.org/en/jsr/detail?id=305) is supported for denoting nullability of Java types.

If the `@Nonnull(when = ...)` value is `When.ALWAYS`, the annotated type is treated as non-null; `When.MAYBE` and
`When.NEVER` denote a nullable type; and `When.UNKNOWN` forces the type to be [platform one](#null-safety-and-platform-types).

A library can be compiled against the JSR-305 annotations, but there's no need to make the annotations artifact (e.g. `jsr305.jar`)
a compile dependency for the library consumers. The Kotlin compiler can read the JSR-305 annotations from a library
without the annotations present on the classpath.

[Custom nullability qualifiers (KEEP-79)](https://github.com/Kotlin/KEEP/blob/master/proposals/jsr-305-custom-nullability-qualifiers.md)
are also supported (see below).

#### Type qualifier nicknames

If an annotation type is annotated with both
[`@TypeQualifierNickname`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/meta/TypeQualifierNickname.html)
and JSR-305 `@Nonnull` (or its another nickname, such as `@CheckForNull`), then the annotation type is itself used for
retrieving precise nullability and has the same meaning as that nullability annotation:

```java
@TypeQualifierNickname
@Nonnull(when = When.ALWAYS)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyNonnull {
}

@TypeQualifierNickname
@CheckForNull // a nickname to another type qualifier nickname
@Retention(RetentionPolicy.RUNTIME)
public @interface MyNullable {
}

interface A {
    @MyNullable String foo(@MyNonnull String x);
    // in Kotlin (strict mode): `fun foo(x: String): String?`

    String bar(List<@MyNonnull String> x);
    // in Kotlin (strict mode): `fun bar(x: List<String>!): String!`
}
```

#### Type qualifier defaults

[`@TypeQualifierDefault`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/meta/TypeQualifierDefault.html)
allows introducing annotations that, when being applied, define the default nullability within the scope of the annotated
element.

Such annotation type should itself be annotated with both `@Nonnull` (or its nickname) and `@TypeQualifierDefault(...)`
with one or more `ElementType` values:

* `ElementType.METHOD` for return types of methods
* `ElementType.PARAMETER` for value parameters
* `ElementType.FIELD` for fields
* `ElementType.TYPE_USE` for any type including type arguments, upper bounds of type parameters and wildcard types

The default nullability is used when a type itself is not annotated by a nullability annotation, and the default is
determined by the innermost enclosing element annotated with a type qualifier default annotation with the
`ElementType` matching the type usage.

```java
@Nonnull
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
public @interface NonNullApi {
}

@Nonnull(when = When.MAYBE)
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE_USE})
public @interface NullableApi {
}

@NullableApi
interface A {
    String foo(String x); // fun foo(x: String?): String?

    @NotNullApi // overriding default from the interface
    String bar(String x, @Nullable String y); // fun bar(x: String, y: String?): String

    // The List<String> type argument is seen as nullable because of `@NullableApi`
    // having the `TYPE_USE` element type:
    String baz(List<String> x); // fun baz(List<String?>?): String?

    // The type of `x` parameter remains platform because there's an explicit
    // UNKNOWN-marked nullability annotation:
    String qux(@Nonnull(when = When.UNKNOWN) String x); // fun baz(x: String!): String?
}
```

> The types in this example only take place with the strict mode enabled; otherwise, the platform types remain.
>See the [`@UnderMigration` annotation](#undermigration-annotation) and [Compiler configuration](#compiler-configuration) sections.
>
{type="note"}

Package-level default nullability is also supported:

```java
// FILE: test/package-info.java
@NonNullApi // declaring all types in package 'test' as non-nullable by default
package test;
```

#### @UnderMigration annotation

The `@UnderMigration` annotation (provided in a separate artifact `kotlin-annotations-jvm`) can be used by library
maintainers to define the migration status for the nullability type qualifiers.

The status value in `@UnderMigration(status = ...)` specifies how the compiler treats inappropriate usages of the
annotated types in Kotlin (e.g. using a `@MyNullable`-annotated type value as non-null):

* `MigrationStatus.STRICT` makes annotation work as any plain nullability annotation, i.e. report errors for
the inappropriate usages and affect the types in the annotated declarations as they are seen in Kotlin
* `MigrationStatus.WARN`: the inappropriate usages are reported as compilation warnings instead of errors,
but the types in the annotated declarations remain platform
* `MigrationStatus.IGNORE` makes the compiler ignore the nullability annotation completely

A library maintainer can add `@UnderMigration` status to both type qualifier nicknames and type qualifier defaults:

```java
@Nonnull(when = When.ALWAYS)
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
@UnderMigration(status = MigrationStatus.WARN)
public @interface NonNullApi {
}

// The types in the class are non-null, but only warnings are reported
// because `@NonNullApi` is annotated `@UnderMigration(status = MigrationStatus.WARN)`
@NonNullApi
public class Test {}
```

>The migration status of a nullability annotation is not inherited by its type qualifier nicknames but is applied
>to its usages in default type qualifiers.
>
{type="note"}

If a default type qualifier uses a type qualifier nickname and they are both `@UnderMigration`, the status
from the default type qualifier is used.

#### Compiler configuration

The JSR-305 checks can be configured by adding the `-Xjsr305` compiler flag with the following options (and their combination):

* `-Xjsr305={strict|warn|ignore}` to set up the behavior for non-`@UnderMigration` annotations.
Custom nullability qualifiers, especially
`@TypeQualifierDefault`, are already spread among many well-known libraries, and users may need to migrate smoothly when
updating to the Kotlin version containing JSR-305 support. Since Kotlin 1.1.60, this flag only affects non-`@UnderMigration` annotations.

* `-Xjsr305=under-migration:{strict|warn|ignore}` to override the behavior for the `@UnderMigration` annotations.
Users may have different view on the migration status for the libraries:
they may want to have errors while the official migration status is `WARN`, or vice versa,
they may wish to postpone errors reporting for some until they complete their migration.

* `-Xjsr305=@<fq.name>:{strict|warn|ignore}` to override the behavior for a single annotation, where `<fq.name>`
is the fully qualified class name of the annotation. May appear several times for different annotations. This is useful
for managing the migration state for a particular library.

The `strict`, `warn` and `ignore` values have the same meaning as those of `MigrationStatus`,
and only the `strict` mode affects the types in the annotated declarations as they are seen in Kotlin.

> Note: the built-in JSR-305 annotations [`@Nonnull`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/Nonnull.html),
>[`@Nullable`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/javax/annotation/Nullable.html) and
>[`@CheckForNull`](https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/CheckForNull.html) are always enabled and
>affect the types of the annotated declarations in Kotlin, regardless of compiler configuration with the `-Xjsr305` flag.
>
{type="note"}

For example, adding `-Xjsr305=ignore -Xjsr305=under-migration:ignore -Xjsr305=@org.library.MyNullable:warn` to the
compiler arguments makes the compiler generate warnings for inappropriate usages of types annotated by
<EMAIL_ADDRESS>and ignore all other JSR-305 annotations.

The default behavior is the same to `-Xjsr305=warn`. The
`strict` value should be considered experimental (more checks may be added to it in the future).

## Mapped types

Kotlin treats some Java types specifically. Such types are not loaded from Java "as is", but are _mapped_ to corresponding Kotlin types.
The mapping only matters at compile time, the runtime representation remains unchanged.
 Java's primitive types are mapped to corresponding Kotlin types (keeping [platform types](#null-safety-and-platform-types) in mind):

| **Java type** | **Kotlin type**  |
|---------------|------------------|
| `byte`        | `kotlin.Byte`    |
| `short`       | `kotlin.Short`   |
| `int`         | `kotlin.Int`     |
| `long`        | `kotlin.Long`    |
| `char`        | `kotlin.Char`    |
| `float`       | `kotlin.Float`   |
| `double`      | `kotlin.Double`  |
| `boolean`     | `kotlin.Boolean` |

Some non-primitive built-in classes are also mapped:

| **Java type** | **Kotlin type**  |
|---------------|------------------|
| `java.lang.Object`       | `kotlin.Any!`    |
| `java.lang.Cloneable`    | `kotlin.Cloneable!`    |
| `java.lang.Comparable`   | `kotlin.Comparable!`    |
| `java.lang.Enum`         | `kotlin.Enum!`    |
| `java.lang.annotation.Annotation`   | `kotlin.Annotation!`    |
| `java.lang.CharSequence` | `kotlin.CharSequence!`   |
| `java.lang.String`       | `kotlin.String!`   |
| `java.lang.Number`       | `kotlin.Number!`     |
| `java.lang.Throwable`    | `kotlin.Throwable!`    |

Java's boxed primitive types are mapped to nullable Kotlin types:

| **Java type**           | **Kotlin type**  |
|-------------------------|------------------|
| `java.lang.Byte`        | `kotlin.Byte?`   |
| `java.lang.Short`       | `kotlin.Short?`  |
| `java.lang.Integer`     | `kotlin.Int?`    |
| `java.lang.Long`        | `kotlin.Long?`   |
| `java.lang.Character`   | `kotlin.Char?`   |
| `java.lang.Float`       | `kotlin.Float?`  |
| `java.lang.Double`      | `kotlin.Double?`  |
| `java.lang.Boolean`     | `kotlin.Boolean?` |

Note that a boxed primitive type used as a type parameter is mapped to a platform type:
for example, `List<java.lang.Integer>` becomes a `List<Int!>` in Kotlin.

Collection types may be read-only or mutable in Kotlin, so Java's collections are mapped as follows
(all Kotlin types in this table reside in the package `kotlin.collections`):

| **Java type** | **Kotlin read-only type**  | **Kotlin mutable type** | **Loaded platform type** |
|---------------|----------------------------|-------------------------|--------------------------|
| `Iterator<T>`        | `Iterator<T>`        | `MutableIterator<T>`            | `(Mutable)Iterator<T>!`            |
| `Iterable<T>`        | `Iterable<T>`        | `MutableIterable<T>`            | `(Mutable)Iterable<T>!`            |
| `Collection<T>`      | `Collection<T>`      | `MutableCollection<T>`          | `(Mutable)Collection<T>!`          |
| `Set<T>`             | `Set<T>`             | `MutableSet<T>`                 | `(Mutable)Set<T>!`                 |
| `List<T>`            | `List<T>`            | `MutableList<T>`                | `(Mutable)List<T>!`                |
| `ListIterator<T>`    | `ListIterator<T>`    | `MutableListIterator<T>`        | `(Mutable)ListIterator<T>!`        |
| `Map<K, V>`          | `Map<K, V>`          | `MutableMap<K, V>`              | `(Mutable)Map<K, V>!`              |
| `Map.Entry<K, V>`    | `Map.Entry<K, V>`    | `MutableMap.MutableEntry<K,V>` | `(Mutable)Map.(Mutable)Entry<K, V>!` |

Java's arrays are mapped as mentioned [below](java-interop.md#java-arrays):

| **Java type** | **Kotlin type**  |
|---------------|------------------|
| `int[]`       | `kotlin.IntArray!` |
| `String[]`    | `kotlin.Array<(out) String>!` |

>The static members of these Java types are not directly accessible on the [companion objects](object-declarations.md#companion-objects)
>of the Kotlin types. To call them, use the full qualified names of the Java types, e.g. `java.lang.Integer.toHexString(foo)`.
>
{type="note"}

## Java generics in Kotlin

Kotlin's generics are a little different from Java's (see [Generics](generics.md)).
When importing Java types to Kotlin, the following conversions are done:

* Java's wildcards are converted into type projections:
  * `Foo<? extends Bar>` becomes `Foo<out Bar!>!`
  * `Foo<? super Bar>` becomes `Foo<in Bar!>!`

* Java's raw types are converted into star projections:
  * `List` becomes `List<*>!` that is `List<out Any?>!`

Like Java's, Kotlin's generics are not retained at runtime: objects do not carry information about actual type arguments
passed to their constructors. For example, `ArrayList<Integer>()` is indistinguishable from `ArrayList<Character>()`.
This makes it impossible to perform `is`-checks that take generics into account.
Kotlin only allows `is`-checks for star-projected generic types:

```kotlin
if (a is List<Int>) // Error: cannot check if it is really a List of Ints
// but
if (a is List<*>) // OK: no guarantees about the contents of the list
```

## Java arrays

Arrays in Kotlin are invariant, unlike Java. This means that Kotlin won't let you assign an `Array<String>` to an `Array<Any>`,
which prevents a possible runtime failure. Passing an array of a subclass as an array of superclass to a Kotlin method is also prohibited,
but for Java methods this is allowed through [platform types](#null-safety-and-platform-types) of the form `Array<(out) String>!`.

Arrays are used with primitive datatypes on the Java platform to avoid the cost of boxing/unboxing operations.
As Kotlin hides those implementation details, a workaround is required to interface with Java code.
There are specialized classes for every type of primitive array (`IntArray`, `DoubleArray`, `CharArray`, and so on) to handle this case.
They are not related to the `Array` class and are compiled down to Java's primitive arrays for maximum performance.

Suppose there is a Java method that accepts an int array of indices:

``` java
public class JavaArrayExample {
    public void removeIndices(int[] indices) {
        // code here...
    }
}
```

To pass an array of primitive values, you can do the following in Kotlin:

```kotlin
val javaObj = JavaArrayExample()
val array = intArrayOf(0, 1, 2, 3)
javaObj.removeIndices(array)  // passes int[] to method
```

When compiling to the JVM bytecode, the compiler optimizes access to arrays so that there's no overhead introduced:

```kotlin
val array = arrayOf(1, 2, 3, 4)
array[1] = array[1] * 2 // no actual calls to get() and set() generated
for (x in array) { // no iterator created
    print(x)
}
```

Even when you navigate with an index, it does not introduce any overhead:

```kotlin
for (i in array.indices) { // no iterator created
    array[i] += 2
}
```

Finally, `in`-checks have no overhead either:

```kotlin
if (i in array.indices) { // same as (i >= 0 && i < array.size)
    print(array[i])
}
```

## Java varargs

Java classes sometimes use a method declaration for the indices with a variable number of arguments (varargs):

``` java
public class JavaArrayExample {

    public void removeIndicesVarArg(int... indices) {
        // code here...
    }
}
```

In that case you need to use the spread operator `*` to pass the `IntArray`:

```kotlin
val javaObj = JavaArrayExample()
val array = intArrayOf(0, 1, 2, 3)
javaObj.removeIndicesVarArg(*array)
```

## Operators

Since Java has no way of marking methods for which it makes sense to use the operator syntax, Kotlin allows using any
Java methods with the right name and signature as operator overloads and other conventions (`invoke()` etc.)
Calling Java methods using the infix call syntax is not allowed.

## Checked exceptions

In Kotlin, all [exceptions are unchecked](exceptions.md), meaning that the compiler does not force you to catch any of them.
So, when you call a Java method that declares a checked exception, Kotlin does not force you to do anything:

```kotlin
fun render(list: List<*>, to: Appendable) {
    for (item in list) {
        to.append(item.toString()) // Java would require us to catch IOException here
    }
}
```

## Object methods

When Java types are imported into Kotlin, all the references of the type `java.lang.Object` are turned into `Any`.
Since `Any` is not platform-specific, it only declares `toString()`, `hashCode()` and `equals()` as its members,
so to make other members of `java.lang.Object` available, Kotlin uses [extension functions](extensions.md).

### wait()/notify()

Methods `wait()` and `notify()` are not available on references of type `Any`. Their usage is generally discouraged in
favor of `java.util.concurrent`. If you really need to call these methods, you can cast to `java.lang.Object`:

```kotlin
(foo as java.lang.Object).wait()
```

### getClass()

To retrieve the Java class of an object, use the `java` extension property on a [class reference](reflection.md#class-references):

```kotlin
val fooClass = foo::class.java
```

The code above uses a [bound class reference](reflection.md#bound-class-references). You can also use the `javaClass` extension property:

```kotlin
val fooClass = foo.javaClass
```

### clone()

To override `clone()`, your class needs to extend `kotlin.Cloneable`:

```kotlin
class Example : Cloneable {
    override fun clone(): Any { ... }
}
```

Don't forget about [Effective Java, 3rd Edition](https://www.oracle.com/technetwork/java/effectivejava-136174.html),
Item 13: *Override clone judiciously*.

### finalize()

To override `finalize()`, all you need to do is simply declare it, without using the `override` keyword:

```kotlin
class C {
    protected fun finalize() {
        // finalization logic
    }
}
```

According to Java's rules, `finalize()` must not be `private`.

## Inheritance from Java classes

At most one Java class (and as many Java interfaces as you like) can be a supertype for a class in Kotlin.

## Accessing static members

Static members of Java classes form "companion objects" for these classes. You can't pass such a "companion object"
around as a value but can access the members explicitly, for example:

```kotlin
if (Character.isLetter(a)) { ... }
```

To access static members of a Java type that is [mapped](#mapped-types) to a Kotlin type, use the full qualified name of
the Java type: `java.lang.Integer.bitCount(foo)`.

## Java reflection

Java reflection works on Kotlin classes and vice versa. As mentioned above, you can use `instance::class.java`,
`ClassName::class.java` or `instance.javaClass` to enter Java reflection through `java.lang.Class`.
Do not use `ClassName.javaClass` for this purpose because it refers to `ClassName`'s companion object class,
which is the same as `ClassName.Companion::class.java` and not `ClassName::class.java`.

For each primitive type, there are two different Java classes, and Kotlin provides ways to get both. For
example, `Int::class.java` will return the class instance representing the primitive type itself,
corresponding to `Integer.TYPE` in Java. To get the class of the corresponding wrapper type, use
`Int::class.javaObjectType`, which is equivalent of Java's `Integer.class`.

Other supported cases include acquiring a Java getter/setter method or a backing field for a Kotlin property, a `KProperty` for a Java field, a Java method or constructor for a `KFunction` and vice versa.

## SAM conversions

Kotlin supports SAM conversions for both Java and [Kotlin interfaces](fun-interfaces.md).
This support for Java means that Kotlin function literals can be automatically converted
into implementations of Java interfaces with a single non-default method, as long as the parameter types of the interface
method match the parameter types of the Kotlin function.

You can use this for creating instances of SAM interfaces:

```kotlin
val runnable = Runnable { println("This runs in a runnable") }
```

...and in method calls:

```kotlin
val executor = ThreadPoolExecutor()
// Java signature: void execute(Runnable command)
executor.execute { println("This runs in a thread pool") }
```

If the Java class has multiple methods taking functional interfaces, you can choose the one you need to call by
using an adapter function that converts a lambda to a specific SAM type. Those adapter functions are also generated
by the compiler when needed:

```kotlin
executor.execute(Runnable { println("This runs in a thread pool") })
```

> SAM conversions only work for interfaces, not for abstract classes, even if those also have just a single
abstract method.
>
{type="note"}

## Using JNI with Kotlin

To declare a function that is implemented in native (C or C++) code, you need to mark it with the `external` modifier:

```kotlin
external fun foo(x: Int): Double
```

The rest of the procedure works in exactly the same way as in Java.

You can also mark property getters and setters as `external`:

```kotlin
var myProperty: String
    external get
    external set
```

Behind the scenes, this will create two functions `getMyProperty` and `setMyProperty`, both marked as `external`.

## Using Lombok-generated declarations in Kotlin

You can use Java's Lombok-generated declarations in Kotlin code.
If you need to generate and use these declarations in the same mixed Java/Kotlin module,
you can learn how to do this on the [Lombok compiler plugin's page](lombok.md).
If you call such declarations from another module, then you don't need to use this plugin to compile that module.

repository: JetBrains/kotlin-web-site

repo_name: JetBrains/kotlin-web-site


text:
---
uid: StopAndStartAnEDSAdapter
---

# Stop and start an EDS adapter

By default, when Edge Data Store starts, all currently configured EDS adapter instance are started and remain running until the product shuts down.

## Stop an EDS adapter

To stop an EDS adapter instance:

1. Open a tool capable of making HTTP requests.

1. Run a POST command to the following endpoint, replacing `<adapterId>` with the adapter instance to stop and `<port_number>` with the port specified for EDS:

    ```http
    http://localhost:<port_number>/api/v1/administration/<adapterId>/Stop
    ```

    Example **Stop the OpcUa1 adapter** using curl or EdgeCmd and the default port:

    ## [curl](#tab/tabid-1)

    ```bash
    curl -d "" http://localhost:5590/api/v1/Administration/OpcUa1/Stop
    ```

    ## [EdgeCmd](#tab/tabid-2)

    ```
    edgecmd -cid <ComponentID> stop
    ```
    ***

    An HTTP status 204 message indicates success.

## Start an EDS adapter

To start an EDS adapter instance:

1. Open a tool capable of making HTTP requests.

1. Run a POST command to the following endpoint, replacing `<adapterId>` with the adapter instance to start and `<port_number>` with the port specified for EDS:

    ```http
    http://localhost:<port_number>/api/v1/administration/<adapterId>/Start
    ```

    Example **Stop the Modbus1 adapter** using curl or EdgeCmd and the default port:

    ## [curl](#tab/tabid-1)

    ```bash
    curl -d "" http://localhost:5590/api/v1/Administration/Modbus1/Start
    ```

    ## [EdgeCmd](#tab/tabid-2)

    ```
    edgecmd -cid <ComponentID> start
    ```
    ***

    An HTTP status 204 message indicates success.

repository: osisoft/Edge-Data-Store-Docs

repo_name: osisoft/Edge-Data-Store-Docs


text:
# Pb
This is a library that allows you to embed a podcast in your web page.

## Features
- Provide a podcast URL, see a podcast rendered
- Total library size is `~4.5kb`
- Optionally provide a limit to the number of episodes displayed
- Each episode has its own audio player

__Note:__ To parse the RSS/podcast/XML feed into usable JSON, the podcast is loaded through [Narro](https://www.narro.co) (using a simple pass of the [rss-parser](https://github.com/rbren/rss-parser#readme) library). This avoids bloating the client library with an RSS parser.

## Usage
1. Create an element on your page with the class `pb-embed` and attribute `data-feed="<podcast-url-here>"`.
2. Include the `bundle.js` either in your own compiled js or as a `script` tag before the `body` closing tag.
3. Optionally, provide your own styling of the embed (see `./example/example.css`).
4. Optionally, provide an attribute of `data-limit="<some number>"` to limit the number of episodes displayed.

## Methods
~~~js
// Initialize all nodes with class 'pb-embed' on the page
pb.init();

// Initialize an embedded feed inside a given DOM node
var node = document.querySelector('#myId');
var embed = pb.createEmbed(node);

// Initialize an embedded feed inside a given DOM node, with a feed URL
var feed = 'http://mypodcast.com/feed.xml';
embed = pb.createEmbed(node, feed);

// Reload a given feed/embed
embed.reload();
~~~

### Example
See [https://github.com/NarroApp/Pb/tree/master/example](https://github.com/NarroApp/Pb/tree/master/example)

~~~html
<div class="pb-embed" data-feed="http://on.narro.co/foobar" data-limit="5">
</div>
~~~

Working usage: [https://narroapp.github.io/Pb/](https://narroapp.github.io/Pb/)

repository: NarroApp/Pb

repo_name: NarroApp/Pb


text:
# Snapshot

Snapshot is an off-chain gasless multi-governance client with easy to verify and hard to contest results.

**[Documentation](https://docs.snapshot.org)**

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

## License

[MIT](LICENSE).

repository: pancakeswap/snapshot

branch_name: refs/heads/develop

gha_language: Vue

repo_name: pancakeswap/snapshot


text:
---
title: bioassayR - Introduction and Examples
keywords:
last_updated: Sun Mar  6 18:25:41 2016
---
Authors: Tyler Backman, Thomas Girke

Last update: 06 March, 2016

Alternative formats of this tutorial:
[`.Rmd HTML`](http://girke.bioinformatics.ucr.edu/manuals/vignettes/bioassayR/bioassayR.html),
[`.Rmd Source`](http://girke.bioinformatics.ucr.edu/manuals/vignettes/bioassayR/bioassayR.Rmd),
[`.R Source`](http://girke.bioinformatics.ucr.edu/manuals/vignettes/bioassayR/bioassayR.R),
[`PDF Slides`](http://biocluster.ucr.edu/~tbackman/chem_workshop/ht_screen.pdf)

## Introduction

*bioassayR* is a tool for cross-target analysis of biological screening data. It allows users to store, organize, and
systematically analyze data from a large number of small molecule bioactivity experiments of heterogenous design.
Users have the option of supplying their own bioactivity
data for analysis, or downloading a database from the authors website (<http://chemmine.ucr.edu/bioassayr>) pre-loaded with bioactivity data sourced from NCBI PubChem BioAssay (Backman, et al., 2011; Wang, et al., 2012).
The pre-loaded database contains the results of thousands of bioassay experiments, where small molecules were screened against a defined biological target.
*bioassayR* allows users to leverage these data as a reference to
identify small molecules active against a protein or organism of interest, identify target selective compounds that may be useful as drugs or chemical genomics probes, and identify and compare the activity profiles of small molecules.

The design of bioassayR is based around four distinct objects, each which
is optimized for investigating bioactivity data in different ways.
The *bioassay* object stores activity data for a single assay, and also acts as
a gateway for importing new activity data, and editing the data for a single assay.
The *bioassayDB* object uses a SQL database to store and query thousands of
assays, in a time-efficient manner. Often users will wish to further investigate
a set of compounds or assays identified with a *bioassayDB* query by pulling
them out into a *bioassaySet* object. The *bioassaySet*
object stores activity data as a compound vs assay matrix, and can be created
from a list of assay ids or compounds of interest. Lastly, the *perTargetMatrix*
is a matrix of compounds vs targets, where replicates (assays hitting the same
target) from a *bioassaySet* object are summarized into a single value.
This internally uses a sparse matrix
to save system memory, while allowing the user to leverage R language matrix features to
further investigate these data.

repository: np-completed/manuals

repo_name: np-completed/manuals


text:
# Accordion

Accordions contain creation flows and allow lightweight editing of an element.

An accordion is a lightweight container that may either stand alone or be connected to a larger surface,
such as a card.

## Simple accordion

{{"demo": "pages/components/accordion/Simple.js"}}

## Performance

The content of Accordions is mounted by default even if the accordion is not expanded. This default behavior has server-side rendering and SEO in mind.

## Accessibility

(WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#accordion)

For optimal accessibility we recommend setting id and aria-controls on the AccordionSummary. The Accordion will derive the necessary aria-labelledby and id for the content region of the accordion.

repository: riipen/ui

repo_name: riipen/ui


text:
# GraphQL-with-Kafka
GraphQL With Kafka

In this example , We are able to acheive following:

1.	Read message from Kafka queue, convert this message to event and pass it to the GraphQL subscriber.
2.	Explore about Subscriptions in GraphQL.
3.	Integration of posting events on Kafka Queue, consumption of events from Kafka Queue as Flux (Reactor-Kafka), and redirection of events to subscriber.

Steps to test this :
1. Bring the Kafka up , post the message on "test" topic.
2. Launch GraphqlPubSubLauncher as java application
3. Launch http://localhost:8085/graphiql
4. Hit below Quey

subscription {
  getNotifications(filter: {exchangeCode: ["NSE", "ABC"]}) {
    eventSummaryText
    eventSubject
    eventInsertDate
  }
}

5. Verify the message is delivered at client end.


text:
---
title: AEM Modernization Tools
description: AEM Modernization Tools
exl-id: d541fae0-6386-403f-99c9-373dc978ad13
---
# AEM Modernization Tools {#aem-moderization-tools}

The AEM Modernization tools provides a suite of utilities which can be used to convert legacy AEM features to the modern and supported capabilities of AEM as a Cloud Service.

## Introduction {#introduction}

AEM Modernization Tools allow for the easy conversion of:

* Static templates to editable templates
* Design configurations to policies
* Foundation Components to Core Components
* Classic UI to Touch-Enabled UI

>[!NOTE]
>AEM Modernize Tools are a community effort and are not supported or warrantied by Adobe.

See **[Introducing AEM Modernization Tools](https://opensource.adobe.com/aem-modernize-tools/)** to learn more about planning, configuration, and  development for AEM Modernization suite of tools.

## Installation and Implementing AEM Modernization Tool Suite {#installing-implementing}

See **[Git Resource: AEM Modernize Tools Suite](https://github.com/adobe/aem-modernize-tools)** to learn about installation and implementation.

gha_language: SCSS


text:
# Project 3 - *Yelp*

**Yelp** is a Yelp search app using the [Yelp API](http://www.yelp.com/developers/documentation/v2/search_api).

Time spent: **12** hours spent in total

## User Stories

The following **required** functionality is completed:

- [X] Table rows for search results should be dynamic height according to the content height.
- [X] Custom cells should have the proper Auto Layout constraints.
- [X] Search bar should be in the navigation bar (doesn't have to expand to show location like the real Yelp app does).

The following **optional** features are implemented:

- [X] Search results page
   - [X] Infinite scroll for restaurant results.
   - [X] Implement map view of restaurant results.
- [X] Implement the restaurant detail page.

The following **additional** features are implemented:

- [X] Uses **current location** to get relevant search results
- [X] Explore a **restaurant's menu** from within the app
- [X] **Call a business** from within the app
- [X] Read a **review highlight** from within the app
- [X] Tap to **get directions** to a business
- [X] Map all search results; **tap a pin on the map** to segue to business details view
- [X] Multiple navigation controllers with **Tab Bar**
- [X] List of **categories** to search from (static table view controller)
- [X] Pull-to-refresh (useful if your location has changed!)
- [X] **Sort** by distance or rating
- [X] **Filter** by multiple distance levels
- [X] Search bars are connected to Yelp Search API (not limited to searching table view cells; can search for any local business)
- [X] Search terms and filters persist between relaunches, **using NSUserDefaults**
- [X] App Icon resembles the real Yelp app
- [X] Launch screen resembles the real Yelp app
- [X] Navigation bars, buttons, icons, and theme **resembles the real Yelp app**

## Video Walkthrough

Here's a walkthrough of implemented user stories:

[<img src='http://img.tejen.net/a32dddb791eefd513aedb61d74afe7aa.gif' title='Video Walkthrough' width='' alt='Video Walkthrough' />](http://x.tejen.net/bgb)

GIF created with [LiceCap](http://www.cockos.com/licecap/).

## Notes

Shakeel repairs EVERYTHING, not just iPhones... LOL

Auto Layouts became much easier as I got the hang of it. One pro-tip we should have learned offically is the fact that you can Control+Drag from one storyboard element to another in order to relate both of them in a new Auto Layout constraint... for me, this was an essential technique, since there were occasions when an element couldn't "see" another element in drop-down menus when setting new constraints the "proper" way.

## License

    Copyright ©2016 Tejen Hasmukh Patel

    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: tejen/codepath-yelp

repo_name: tejen/codepath-yelp


text:
# Calodon suaveolens (Scop.) P. Karst., 1881 SPECIES

#### Status
SYNONYM

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

#### Published in
Revue mycol. , Toulouse 3(9): 20 (1881)

#### Original name
Hydnum suaveolens Scop., 1772

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Thelephorales/Bankeraceae/Hydnellum/Hydnellum suaveolens/ Syn. Calodon suaveolens/README.md

repo_name: mdoering/backbone


text:
---
layout: post
published: true
title: 'User Defined Value Types Bug'
date: '2021-09-29'
author: Solidity Team
category: Security Alerts
---

On September 28th, 2021, Harry Altman ([@haltman-at](https://github.com/haltman-at)) of Truffle
discovered a bug in user defined value types.

The bug has no influence on the correctness of Solidity contracts, but contracts compiled with
Solidity 0.8.8 that use the new feature are unnecessarily wasteful and might have problems with
tooling or contract upgrades.

The bug exists only in Solidity 0.8.8 and is fixed in 0.8.9.

We assigned the bug a severity of "very low".

## Storage Layout of User Defined Value Types

The compiler did not correctly compute the storage layout of user defined value types based on types
that are shorter than 32 bytes. It would always use a full storage slot for these types, even if the
underlying type is shorter. A user defined value type in 0.8.8 should have the same data
representation as its underlying type in all aspects with the exception of storage layout.

Types shorter than 32 bytes can share a storage slot with other values if there is enough space. For
example:

```solidity
pragma solidity =0.8.8;

type MyInt128 is int128;

contract WastefulStorageLayout {
    // slot 0
    MyInt128 a;
    // slot 1
    MyInt128 b;
}

contract PackedStorageLayout {
    // slot 0
    int128 a;
    // slot 0
    int128 b;
}
```

You can verify this by running `solc --storage-layout Contract.sol`.

## Impact

Solidity tries to guarantee that the storage layout of contracts remains consistent across releases.
This allows for certain kind of upgrade patterns to exist that may use different Solidity versions.
Since user defined value types should behave exactly as the underlying type, Solidity 0.8.8
introduced inconsistent storage layout for contracts with short user defined value types as state
variables. The Solidity 0.8.9 release corrects the layout. Be extra careful when upgrading from a
contract that was compiled with 0.8.8, and that uses short user defined value types, to a version
higher than 0.8.9.

repository: ethereum/solidity-blog

gha_language: HTML

repo_name: ethereum/solidity-blog


text:
---
layout: post
title: Project Adam: Building an Efficient and Scalable Deep Learning Training System.
description:
category: big-data
tags: machine-learning
comments: true
---

Takeaways from *Project Adam: Building an Efficient and Scalable Deep Learning Training System, Chilimbi et al, OSDI, 2014.*

### Problem.

Large Scale Deep Learning. Learning a model is essentially calculating a set of parameters (weights w) iteratively (multiple epochs) to reduce error.

Project Adam tackles this by implementing a scalable distributed deep learning training system using commodity servers. The key principles used are a ground-up system design, effective partitioning of data and compute, making everything asynchronous (as the DNNs tolerate inconsistencies), and heavy system optimization.

### Architecture.

- Data Serving machines that serve input
- Model Training machines that asynchronously update the shared model (i.e. parameters).
- Global Parameter Server (PS) that store parameters.
	- PS controllers.
	- PS nodes.

### Features.

Data Serving.

- Augment pre-transformed training data.
- Pre-cache training data to be served next to the model training machines.

Model Training.

- Vertically partition the model across the various model training machines.
- Multi-threading the model updates for different images on each training machine.
- Each thread has an associated NUMA-aware context (weights and activations) and scratch buffer.
- Local model updates (across threads) are updated in a lock-free asynchronous manner.
- A uniform interface for both local- and remote- data copy. The interface accepts a data pointer which is handed over locally (avoids memory copy) or copied (the data being pointed to) remotely.
- Model partitioning is done so the working set for each partition fits in L3 cache. Also optimized modules are used for column- or row-major operations.
- Need for straggler mitigation is evaded by allowing threads to work on multiple images in parallel and ending an epoch based on the threshold of input images (randomized order) processed.
- Batching of parameter updates from model training machines to parameter server machines is done. Batched weight updates for several machines are sent in case of convolutional layers as the volume of weights is low due to sharing. Batched activations and error gradients are sent in case of fully connected layers so as to reduce network volume. This also results in offloading compute as the weights are calculated at parameter servers.

### Global Parameter Server.

- Model parameters are divided as 1MB shards and several shards are bucketed equally among several PS machines for load balancing.
- Parameter updates are opportunistically batched so that sufficient contiguity in updates relieves L3 cache pressure.
- NUMA-aware localization for operations on each shard is done and lock-free data structures and memory allocation mechanism is used.
- Asynchronous write-back of updated parameters is done. This also helps folding several updates into the latest single update.
- Fault tolerance is achieved via replication of each parameter shard to three machines. The PS controller manages assignment of parameter shard replicas and is itself fault tolerant as it is in a Paxos cluster. Heartbeats within and across PS machines and controllers are used for liveness monitoring.


text:
# Review It Yourself iOS

## 1⃣ You can find the application on the iOS store: link will be added here soon.

![](riyDemo.gif)

## 1⃣ Contributor

 [Angel Buenrostro](https://github.com/angelbuenrostro)

[](https://github.com/angelbuenrostro)

| [  ](https://github.com/angelbuenrostro)
| [  ](https://www.linkedin.com/in/angel-buenrostro-258820127) |

[![Build Status][travis-image]][travis-url]
[![License][license-image]][license-url]
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/EZSwiftExtensions.svg)](https://img.shields.io/cocoapods/v/LFAlertController.svg)
[![Platform](https://img.shields.io/cocoapods/p/LFAlertController.svg?style=flat)](http://cocoapods.org/pods/LFAlertController)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Project Overview

1⃣ You can find the deployed project at [To be added after passing Apple Store Review](URL).

1⃣ [Trello Board](https://trello.com/b/vZ0hvT9Q/labs-13-how-to)

1⃣ [Product Canvas](https://docs.google.com/document/d/175olB_zZ7dd4bmDLb2WfAMQfk81Ej3lKhnXlmTIpP5A/edit#)

1⃣ [UX Design files](https://projects.invisionapp.com/share/P4S6N4XWEC7#/screens/365137488)

Review It Yourself is a web and iOS application that serves as a central hub for diy instructions on a myriad of topics. Users can create, search and follow their favorite diy-ers and projects. No longer do they need to search various video sites, blogs, etc to find what they're looking for, it's all in one place on How-To.

### Features

-    Profile Creation through Google Sign-In
-    Read all RIY post information

### Authentication API here

Google sign-in was implemented as the authentication API for this application. Users are prompted to use their google accounts when first opening the app then on subsequent visits the app reads saved login information and automatically logs the user into their account and directs them to the home tab bar screen.

## Requirements

-   iOS 12.2
-   Xcode 10
-   Cocoa Pods

## Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a [code of conduct](./CODE_OF_CONDUCT.md). Please follow it in all your interactions with the project.

### Issue/Bug Request

    ## Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a [code of conduct](./code_of_conduct.md). Please follow it in all your interactions with the project.

### Issue/Bug Request

 **If you are having an issue with the existing project code, please submit a bug report under the following guidelines:**
 - Check first to see if your issue has already been reported.
 - Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
 - Create a live example of the problem.
 - Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes,  where you believe the issue is originating from, and any potential solutions you have considered.

### Feature Requests

We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.

### Pull Requests

If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.

Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.

#### Pull Request Guidelines

- Ensure any install or build dependencies are removed before the end of the layer when doing a build.
- Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
- Ensure that your code conforms to our existing code conventions and test coverage.
- Include the relevant issue number, if applicable.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.

### Attribution

These contribution guidelines have been adapted from [this good-Contributing.md-template](https://gist.github.com/PurpleBooth/b24679402957c63ec426).

## Documentation

See [Backend Documentation](https://github.com/labs13-how-to/backend) for details on the backend of our project.

[swift-image]: https://img.shields.io/badge/swift-3.0-orange.svg
[swift-url]: https://swift.org/
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics
[codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad
[codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com

gha_language: Swift


text:
---
layout: post
title: 'RethinkDB challenge: find a bug, get a job'
tags:
- announcements
---

# The challenge

Follow the [installation instructions][install] to set up the server. Then, in
a language of your choice, write an automated fuzzer that sends randomized
traffic to the database server with the purpose of discovering a crash. The
fuzzer can use `rethinkdb admin` to reshard or replicate the database, one or
more rethinkdb clients to send randomized queries, direct TCP access to send
faulty traffic to the server, or a combination of approaches. We will consider
all candidates whose fuzzer manages to expose a server crash.
<!--more-->

[install]: /docs/install/

# The job

- Make the tests better. We'll give you an EC2 budget large enough to build
  something cool. You'll develop continuous integration tools with ability to
  spin up new machines to quickly test a branch with one command, and anything
  else awesome that you can dream up.
- Write good benchmarks and presentation tools. We want to run a single command
  that tells us whether we made RethinkDB faster or slower and generates useful
  graphs that we can put on the website.
- Come up with clever ways to test arcane code paths.  A sage affects ten
  thousand things without looking at ten thousand things.
- You'll get to work on a technically sophisticated product with smart people,
  and have the freedom to build awesome software.

# About you

- You love and understand Unix tools (Bash, at least some C, and at least one
  modern scripting language, preferably Python).
- You can't stand letting manual processes go un-automated.
- You get very, very nervous when you see untested code paths.
- You're extremely pragmatic. `shipping > bikeshedding`.
- You must be willing to relocate to the SF Bay Are (or already here!). We're
  located in Mountain View, CA, and currently cannot accept telecommuters.

# Getting started

You're welcome to drop by and ask for help on how to use the server as you're
writing the fuzzer. Go to [rethinkdb.com/community][community] and get in touch
via IRC or Google Groups.

[community]: /community

# Submission

Create a publicly accessible GitHub project that contains the source code of
the fuzzer and the instructions on how to run it. Then, create a [GitHub
issue][] with information on the crash exposed by the fuzzer.  In the issue,
specify that it's submitted in response to this challenge and link to the
fuzzer's GitHub url. Make sure to include contact information in your GitHub
profile.

[GitHub issue]: https://github.com/rethinkdb/rethinkdb/issues

repository: gokaygurcan/www

extension: markdown

repo_name: gokaygurcan/www


text:
# Variables

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Accessing variables](#accessing-variables)
- [Global](#global)
- [The task object (current)](#the-task-object-current)
- [Local Variables (local & meta)](#local-variables-local-&-meta)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Sometimes it is not enough to hard code behaviors into your tasks,
sometimes you want behavior to depend on a previous response,
or change some texts according to randomization.
In order to achieve these behaviors you can use variables.

We will first describe variables that are common across all tasks, and are always available - these are the `global` and `current` variables.
Then we will get down to variables variables that are available only in specific contexts - such as the `data` and `meta` variables.

### Accessing variables
There are many ways to use variables within the PI tasks.
You can learn about them in their respective documentation, check out [conditions](mixer.html#conditions) and [templates](templates.html).
In addition, some of the variables can be accessed directly from your JavaScript, in cases that this is possible it will be mentioned in the description of the variable.

### Global
The PI tasks expose one central object that serves as the hub of all of you tasks.
The [task objects][current] get automatically registered on the `global` object, so that you can access them all from here.
In addition, you can register any data that you want shared between your tasks onto `global`.
This options is useful in various cases of branching, as well as when you want a common theme to appear in multiple tasks.

The following snippet sets `global.value` to 123, and `global.variable` to [1,2,3].

```javascript
API.addGlobal({
    value: 123,
    variable: [1,2,3]
})
```

It may sometimes be handy to access `global` directly as `window.piGlobal`.
Note that this allows you to access task objects as well.

```javascript
window.piGlobal.greeting = 'Hello world';
console.log(window.piGlobal);
```

### The task object (current)
[current]: #the-task-object-current

Each PI task creates an object that holds information regarding that task.
The object is automatically updated with data from within the tasks (such as question answers or other logs).
The task object can be changed manually as well.
You can extend it however you like using `API.addCurrent`:

```javascript
API.addCurrent({
    value: 123,
    variable: [1,2,3]
});
```

While a task is running, its task object is available as `current`.
Even when the task is not active it is available from within the [`global`](#global) object, as `global.<taskName>`,
where `<taskName>` stands for the [task name](../manager/API.html#tasks) as defined within the task manager.

For your convenience, here is a table describing some of the data available within the different task objects.

Task    | Description
------- | -----------
miTime     | The task object holds all trial logs: `current.logs`.
miQuest | The task object holds all questions: `current.questions`.

### Local Variables (local & meta)
The variables that we've discussed so far are relevant for whole tasks or even whole studies.
We now approach variables that have a narrower scope: they have to do with specific elements within your task.
These variables are called *Data* and *Meta*.

The *Data* variables allow you to manually set useful information into each element.
Their behaviour is described fully within as part of element [inheritance](./inheritance.html#data).

The *Meta* variables hold some meta information regarding this element that is auto-generated by the mixer.
In particular it holds two properties: `

Property    | Description
----------- | -----------
number      | The serial number for this element within the sequence (i.e. 3 if this is the third element to be presented).
outOf       | An attempt to estimate how many elements are in the sequence overall. This number cannot be fully trusted as the number of elements may be dynamically generated and depend on various variables not yet determined.

The naming convention for these variables is `<elementName>Data` and `<elementName>Meta` respectively.
For example, for tasks they appear as `tasksData` and `tasksMeta`.

The elementNames for the various tasks are as follows:

Task        | elementName | Object names
----------- | ----------- | ------------
miManager   | tasks       | tasksData, tasksMeta
miQuest     | pages       | pagesData, pagesMeta
            | questions   | questionsData, questionsMeta
miTime    | trial       | trialData, trialMeta
            | stimulus    | stimulusData, stimulusMeta
            | media       | mediaData, mediaMeta

repository: minnojs/minno-quest

repo_name: minnojs/minno-quest


text:
# [Based on Start Bootstrap - Resume](https://startbootstrap.com/template-overviews/resume/)

Resume based on Start Bootstrap's repo with minor tweaks and adjustments to have my web resume online and working.

#### Gulp Tasks

- `gulp` the default task that builds everything
- `gulp dev` browserSync opens the project in your default browser and live reloads when changes are made
- `gulp css` compiles SCSS files into CSS and minifies the compiled CSS
- `gulp js` minifies the themes JS file
- `gulp vendor` copies dependencies from node_modules to the vendor directory

You must have npm and Gulp installed globally on your machine in order to use these features.


text:
# MovieMania

Companion code for the Packt "Rapid Angular" course.

## Requirements
You need to have node and npm installed.
Bower needs to be installed globally

## Getting started

From a command line:

### Clone repository

```
  git clone https://github.com/matiboy/moviemania.git
  cd moviemania
```

### Install node depencies

```
  npm install
```

### Install bower dependencies
```
  bower install
```

repository: PacktPublishing/Introducing-AngularJS

path: /Section 5/README.md

repo_name: PacktPublishing/Introducing-AngularJS


text:
# vk-login

App that can log into VK and look for friends by name

## Bringing up

1. Clone this project and go to the directory
```bash
git clone https://github.com/stupina/vk-login.git && cd vk-login
```

2. Add file "env_file" to the our root directory. Add to params to file:
```bash
DB_NAME=db_name
DB_HOST=db_service_name_from_docker_compose_file
DB_PORT=db_external_port_from_docker_compose_file
APP_SECRET_KEY=app_secret_key
FLASK_APP=main.py
ID=app_id
SECRET=private_key
```

3. Bring up the app
```bash
docker-compose up -d
```

4. Browse to [link](http://<IP_ADDRESS>:5000) to see the app in action.

repository: stupina/vk-login

repo_name: stupina/vk-login


text:
# maybe-crazy things to do with SVG in drupal 8
## presented at DrupalCon Seattle, 2019

This presentation was made in reveal.js. If you would simply like to view it, you can download the repo and open the index.html file in a browser.

If you would like to run this on your localhost you can install reveal.js according to the instructions here: reveal.js(http://revealjs.com/).


text:
# Section_4 Connecting to a node

Connection and work with the blockchain is performed using the utility `cleos`. Before executing this instruction, make sure that the log file `nodeosd` stops the flow of new information and that its text does not contain error messages. The `cleos` utility requires for its work a running service for saving private keys `keosd`. The `keosd` service runs on the user's computer. One of the options to launch `keosd/cleos` is to launch them in the form of a Docker container. For this you need:

**4.1 Start the `keosd` service**
Start the `keosd` service and connect it to the Docker network where `nodeos` is running:
```
sudo docker run -ti -d --name keosd --net cyberway-net cyberway/cyberway:stable /opt/cyberway/bin/keosd
```

**4.2 Start the `cleos` service**
Assign alias to run `cleos` in the container` keosd`:
```
alias cleos='sudo docker exec -ti keosd cleos --url http://nodeosd:8888 '
```

**4.3 Check connection to blockchain**
Check successful connection to blockchain. To do this, execute the command:
```
cleos get info
```
The connection is considered successful if no errors occurred during the execution of the command.

**4.4 Create storage**
Create storage for private keys:
```
cleos wallet create --file wallet.pass
```
In case of stopping the use of storage, the service `keosd` automatically blocks it. After this, the vault can be unlocked using the command:
```
cleos wallet unlock --password 'sudo docker exec -ti keosd cat wallet.pass'
```

**4.5 Import the private key**
Import the private key with the command:
```
cleos wallet import --private-key <private-key>
```