text:
# Development Manual

## 1. Introduction

NULS smart contract is developed with Java, and it operates in NULS virtual machine. Not all Java features are applicable to contract development and the relevant restrictions are specified in section 3.

## 2. Development environment

### 2.1 Setup of JDK 8

### 2.2 Setup of IntelliJ IDEA

NULS smart contract adopts IntelliJ IDEA as development tool

### 2.3 NULS Smart Contract Development Tool

The main features provided by the NULS Smart Contract Development Tool:

* Create a new NULS smart contract Maven project
* Provide visual pages to compile, package, deploy contracts, call contracts, query contract related data

> [Documentation for building a NULS smart contract Development Tool](./s_tools.html)

## 3. NULS smart contract specifications and syntax

NULS smart contract syntax is a subset of Java syntax, with some restrictions

### 3.1 NULS smart contract specifications

> **_Main classes of contracts must implement contract interfaces. A smart contract can have a class implementing contract interface only; and other classes and interfaces provide functions for such contract._**

### 3.2 Keywords

Java key words are listed as follows and those not applicable for NULS smart contract will be marked

Access control

* public
* protected
* private

Key words and instantiated object of definition class, interface, abstract class, implementation interface and derivative class

* class
* interface
* abstract
* implements
* extends
* new

Key words of package

* import
* package

Key words of data type

* byte
* char
* boolean
* short
* int
* float
* long
* double
* void
* null
* true
* false

Conditional loops (process control)

* if
* else
* while
* for
* switch
* case
* default
* do
* break
* continue
* return
* instanceof

Error processing

* catch
* try
* finally
* throw
* throws

Modification method, class, property and variables

* static
* final
* super
* this
* native（not supported）
* strictfp（not supported）
* synchronized（not supported）
* transient（not supported）
* volatile（not supported）

other

* enum（not supported）
* assert（not supported）

### 3.3 Basic syntax

The following syntax is the same with Java and simply listed here under, with specific details referred to the relevant documents of Java

* Identifiers are consisted of character, underline, dollar sign or figure, beginning with character, underline or dollar sign
* Basic data type: byte short int long float double char boolean
* Reference data type: class, interface, array
* Arithmetic operators: + - * /%++ -
* Relational operator: > <> = <= ==! =
* Logical Operators: ! &| ^ && ||
* Bit operator: &| ^~>> << >>>
* Assignment operator: =
* Extension assignment operators: + = - = * = / =
* String link operator: +
* Conditional operators: ? :
* Process control sentence (if, switch, for, while, do...while)

### 3.4 Available class

NULS smart contract can be developed with the following class

* io.nuls.contract.sdk.Address
* io.nuls.contract.sdk.Block
* io.nuls.contract.sdk.BlockHeader
* io.nuls.contract.sdk.Contract
* io.nuls.contract.sdk.Event
* io.nuls.contract.sdk.Msg
* io.nuls.contract.sdk.Utils
* io.nuls.contract.sdk.MultyAssetValue
* io.nuls.contract.sdk.annotation.View
* io.nuls.contract.sdk.annotation.Required
* io.nuls.contract.sdk.annotation.Payable
* io.nuls.contract.sdk.annotation.JSONSerializable
* io.nuls.contract.sdk.annotation.PayableMultyAsset
* java.lang.Boolean
* java.lang.Byte
* java.lang.Short
* java.lang.Character
* java.lang.Integer
* java.lang.Long
* java.lang.Float
* java.lang.Double
* java.lang.String
* java.lang.StringBuilder
* java.math.BigInteger
* java.math.BigDecimal
* java.util.Collection
* java.util.List
* java.util.ArrayList
* java.util.LinkedList
* java.util.Map
* java.util.HashMap
* java.util.LinkedHashMap
* java.util.Set
* java.util.HashSet

### 3.5 Other restrictions

* Contract class can have one construction method. No restriction for other classes
* The maximum gas consumption for executing a contract method once is 10 million,  Make sure to optimize the contract code as much as possible.
* The maximum gas consumption for executing the method of the `@View` type once is 100 million,  Make sure to optimize the contract code as much as possible.

## 4. Nuls smart contract example

a simple contract

> **_Main classes of contract must implement contract interface, and other classes and interfaces provide functions for this contract_**

```java

package contracts.examples;

import io.nuls.contract.sdk.Contract;
import io.nuls.contract.sdk.annotation.Payable;
import io.nuls.contract.sdk.annotation.Required;
import io.nuls.contract.sdk.annotation.View;

public class SimpleStorage implements Contract {

    private String storedData;

    /**
     * Only when `@View` is added, the contract status will remain and it can be researched by such means
     */
    @View
    public String getStoredData() {
        return storedData;
    }

    /**
     * Only when `@Payable` is added, the amount can be transferred in
     */
    @Payable
    public void setStoredData(@Required String storedData) {
        this.storedData = storedData;
    }

    /**
     * The return value is automatically serialized by the VM in JSON format and returned as a JSON string.
     * Note: The object level must not exceed 3 layers. The more than 3 layers will call the object's toString method, and will not continue serialization.
     */
    @JSONSerializable
    public Map vJsonSerializableMap() {
        Map map = new HashMap();
        map.put("name", "nuls");
        map.put("url", "https://nuls.io");
        return map;
    }

}
```

In one contract project, it requires to introduce a jar package “contract-sdk.jar” which provides the class to get block and transaction details
The project has several classes and interfaces

When compiling, packaging and deploying the prepared contract onto the NULS chain, the virtual machine will implement the construction method of this contract to initialize it, and save the contract status onto the chain. The contract status is the member variables of contract class

After the contract is deployed, _**all public methods of contract class can be called**_ so as to read or modify the contract status

Explanatory comments

@JSONSerializable labels the method of @JSONSerializable, The return value is automatically serialized by the VM in JSON format and returned as a JSON string.

<b style="color:red">Note: The object level must not exceed 3 layers. The more than 3 layers will call the object's toString method, and will not continue serialization.</b>

@View labels the method of @View. After it is added, the contract status will remain and it can be researched by such means

@Payable labels the method of @Payable. Only when it is added, the amount can be transferred in

@PayableMultyAsset 标记@PayableMultyAsset的方法，才能在调用时候传入其他资产金额，支持同时转入多个其他资产

@Required labels the parameter of @Required. When it is added, there must be transfer-in value, _**If you do not want to pass parameters that are not marked with this annotation, you need to fill in 0 or null placeholder.**_

### Some contract examples on github

[NULS Contract Sample Collection](https://github.com/nuls-io/nuls-contracts)

[NULS Contract Sample - NRC20](https://github.com/CCC-NULS/NRC20-Token)

[NULS Contract Sample - NRC721](https://github.com/MIMIEYES/NULS-NRC721-baselib)

[NULS Contract Sample - POCM](https://github.com/CCC-NULS/pocm-contract)

## 5. NULS Contract SDK

Contract SDK provides several classes to be convenient for contract development:

### io.nuls.contract.sdk.Address

```java
public class Address {

    private final String address;

    public Address(String address) {
        valid(address);
        this.address = address;
    }

    /**
     * Get the available balance of the address
     *
     * @return BigInteger
     */
    public native BigInteger balance();

    /**
     * Get the total balance of the address
     *
     * @return BigInteger
     */
    public native BigInteger totalBalance();

    /**
     * 合约向该地址转账(NULS, 可锁定)
     *
     * @param value         转账金额（多少Na）
     * @param lockedTime    锁定时间（单位秒，若锁定1分钟，则填入60）
     */
    public native void transferLocked(BigInteger value, long lockedTime);

    /**
     * 合约向该地址转账(NULS)
     *
     * @param value
     */
    public void transfer(BigInteger value) {
        this.transferLocked(value, 0);
    }

    /**
     * 合约向该地址转账指定的资产(可锁定)
     *
     * @param value          转账金额
     * @param assetChainId   资产链ID
     * @param assetId        资产ID
     * @param lockedTime     锁定时间（单位秒，若锁定1分钟，则填入60）
     */
    public native void transferLocked(BigInteger value, int assetChainId, int assetId, long lockedTime);

    /**
     * 合约向该地址转账指定的资产
     *
     * @param value          转账金额
     * @param assetChainId   资产链ID
     * @param assetId        资产ID
     */
    public void transfer(BigInteger value, int assetChainId, int assetId) {
        this.transferLocked(value, assetChainId, assetId, 0);
    }

    /**
     * 获取该地址指定资产的可用余额
     *
     * @param assetChainId   资产链ID
     * @param assetId        资产ID
     * @return
     */
    public native BigInteger balance(int assetChainId, int assetId);

    /**
     * 获取该地址指定资产的总余额
     *
     * @param assetChainId   资产链ID
     * @param assetId        资产ID
     * @return
     */
    public native BigInteger totalBalance(int assetChainId, int assetId);

    /**
     * Contract method to call the address
     *
     * @param Method name
     * @param Method signature
     * @param Parameters
     * @param value  Incidental currency (in Na)
     */
    public native void call(String methodName, String methodDesc, String[][] args, BigInteger value);

	/**
     * Call the contract method of this address with a return value(String)
     *
     * @param Method name
     * @param Method signature
     * @param Parameters
     * @param value  Incidental currency (in Na)
     * @return return value after calling the contract
     */
    public native String callWithReturnValue(String methodName, String methodDesc, String[][] args, BigInteger value);

    /**
     * 调用该地址的合约方法并带有返回值(String)
     *
     * @param methodName        方法名
     * @param methodDesc        方法签名
     * @param args              参数
     * @param value             转入资产数量
     * @param multyAssetValues  转入的其他资产
     * @return 调用合约后的返回值
     */
    public native String callWithReturnValue(String methodName, String methodDesc, String[][] args, BigInteger value, MultyAssetValue[] multyAssetValues);

    /**
     * Verify the address
     *
     * @param address
     * @see io.nuls.kernel.utils.AddressTool#validAddress(String)
     */
    private native void valid(String address);

    /**
     * Verify that the address is a contract address
     *
     */
    public native boolean isContract();

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Address address1 = (Address) o;
        return address != null ? address.equals(address1.address) : address1.address == null;
    }

    @Override
    public int hashCode() {
        return address != null ? address.hashCode() : 0;
    }

    @Override
    public String toString() {
        return address;
    }

}
```

### io.nuls.contract.sdk.Block

```java
public class Block {

    /**
     * Given block’s head
     *
     * @param blockNumber
     * @return
     */
    public static native BlockHeader getBlockHeader(long blockNumber);

    /**
     * Current block’s head
     *
     * @return
     */
    public static native BlockHeader currentBlockHeader();

    /**
     * Newest block’s head
     *
     * @return
     */
    public static native BlockHeader newestBlockHeader();

    /**
     * Given block’s hash
     *
     * @param blockNumber
     * @return
     */
    public static String blockhash(long blockNumber) {
        return getBlockHeader(blockNumber).getHash();
    }

    /**
     *
     * CCurrent block’s miner address
     *
     * @return
     */
    public static Address coinbase() {
        return currentBlockHeader().getPackingAddress();
    }

    /**
     *
     * Current block’s No.
     *
     * @return
     */
    public static long number() {
        return currentBlockHeader().getHeight();
    }

    /**
     *
     * Current block’s time stamp
     *
     * @return
     */
    public static long timestamp() {
        return currentBlockHeader().getTime();
    }

}
```

### io.nuls.contract.sdk.BlockHeader

```java
public class BlockHeader {

    private String hash;
    private long time;
    private long height;
    private long txCount;
    private Address packingAddress;
    private String stateRoot;

    public String getHash() {
        return hash;
    }

    public long getTime() {
        return time;
    }

    public long getHeight() {
        return height;
    }

    public long getTxCount() {
        return txCount;
    }

    public Address getPackingAddress() {
        return packingAddress;
    }

    public String getStateRoot() {
        return stateRoot;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BlockHeader that = (BlockHeader) o;

        if (time != that.time) return false;
        if (height != that.height) return false;
        if (txCount != that.txCount) return false;
        if (hash != null ? !hash.equals(that.hash) : that.hash != null) return false;
        if (packingAddress != null ? !packingAddress.equals(that.packingAddress) : that.packingAddress != null)
            return false;
        return stateRoot != null ? stateRoot.equals(that.stateRoot) : that.stateRoot == null;
    }

    @Override
    public int hashCode() {
        int result = hash != null ? hash.hashCode() : 0;
        result = 31 * result + (int) (time ^ (time >>> 32));
        result = 31 * result + (int) (height ^ (height >>> 32));
        result = 31 * result + (int) (txCount ^ (txCount >>> 32));
        result = 31 * result + (packingAddress != null ? packingAddress.hashCode() : 0);
        result = 31 * result + (stateRoot != null ? stateRoot.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "BlockHeader{" +
                "hash='" + hash + '\'' +
                ", time=" + time +
                ", height=" + height +
                ", txCount=" + txCount +
                ", packingAddress=" + packingAddress +
                ", stateRoot='" + stateRoot + '\'' +
                '}';
    }

}
```

### io.nuls.contract.sdk.Contract

```java
/**
 *  Contract interface, implemented by contract class
 */
public interface Contract {

    /**
     * Directly transfer to the contract, this method will be called, no action is done by default.
     * Prerequisite: you need override this method and mark the `@Payable` annotation.
     */
    default void _payable() {
    }

    /**
     * 直接向合约转账其他资产，会触发这个方法，默认不做任何操作
     * 前提: 若合约地址支持直接转账其他资产，需重载这个方法，并且标记`@PayableMultyAsset`注解
     */
    default void _payableMultyAsset() {
    }

    /**
     * 1. This method is triggered when the consensus node reward address is the contract address, and the parameter is the block reward address detail two-dimensional array data. eg. [[address, amount], [address, amount], ...]
     * 2. This method is triggered when the deposit address is a contract address. The parameters are the contract address and the reward amount two-dimensional array data. eg. [[address, amount]]
     * Prerequisite: you need override this method and mark the `@Payable` annotation.
     */
    default void _payable(String[][] args) {
    }

}
```

### io.nuls.contract.sdk.Event

```java
/**
* Event interface, implemented by event class
*/
public interface Event {
}
```

### io.nuls.contract.sdk.Msg

```java
public class Msg {

    /**
     * Remaining gas
     *
     * @return
     */
    public static native long gasleft();

    /**
     * sender of the contract
     *
     * @return
     */
    public static native Address sender();

    /**
     * sender public key of the contract
     *
     * @return sender public key of the contract
     */
    public static native String senderPublicKey();

    /**
     * The number of Nuls transferred by the contract sender to the contract address, the unit is Na, 1Nuls = 1 billion Na
     *
     * @return
     */
    public static native BigInteger value();

    /**
     * 合约发送者转入合约地址的其他资产列表
     *
     */
    public static native MultyAssetValue[] multyAssetValues();

    /**
     * Gas price
     *
     * @return
     */
    public static native long gasprice();

    /**
     * Contract address
     *
     * @return
     */
    public static native Address address();

}
```

### io.nuls.contract.sdk.MultyAssetValue

```java
public class MultyAssetValue {

    private BigInteger value;
    private int assetChainId;
    private int assetId;

    public MultyAssetValue() {
    }

    public MultyAssetValue(BigInteger value, int assetChainId, int assetId) {
        this.value = value;
        this.assetChainId = assetChainId;
        this.assetId = assetId;
    }

    public BigInteger getValue() {
        return value;
    }

    public void setValue(BigInteger value) {
        this.value = value;
    }

    public int getAssetChainId() {
        return assetChainId;
    }

    public void setAssetChainId(int assetChainId) {
        this.assetChainId = assetChainId;
    }

    public int getAssetId() {
        return assetId;
    }

    public void setAssetId(int assetId) {
        this.assetId = assetId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MultyAssetValue that = (MultyAssetValue) o;

        if (assetChainId != that.assetChainId) return false;
        if (assetId != that.assetId) return false;
        if (!value.equals(that.value)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = value.hashCode();
        result = 31 * result + assetChainId;
        result = 31 * result + assetId;
        return result;
    }
}
```

### io.nuls.contract.sdk.Utils

```java
public class Utils {

    private Utils() {
    }

    /**
     *  Check conditions; if conditions are not met, it will roll back.
     *
     * @param expression
     */
    public static void require(boolean expression) {
        if (!expression) {
            revert();
        }
    }

    /**
     * Check conditions; if conditions are not met, it will roll back
     *
     * @param expression
     * @param errorMessage
     */
    public static void require(boolean expression, String errorMessage) {
        if (!expression) {
            revert(errorMessage);
        }
    }

    /**
     * Terminate implementation and restore status
     */
    public static void revert() {
        revert(null);
    }

    /**
     * Terminate implementation and restore status
     *
     * @param errorMessage
     */
    public static native void revert(String errorMessage);

    /**
     * Send events
     *
     * @param event
     */
    public static native void emit(Event event);

	/**
     * @param seed a private seed
     * @return pseudo random number (0 ~ 1)
     */
    public static float pseudoRandom(long seed) {
        int hash1 = Block.currentBlockHeader().getPackingAddress().toString().substring(2).hashCode();
        int hash2 = Msg.address().toString().substring(2).hashCode();
        int hash3 = Msg.sender() != null ? Msg.sender().toString().substring(2).hashCode() : 0;
        int hash4 = Long.valueOf(Block.timestamp()).toString().hashCode();

        long hash = seed ^ hash1 ^ hash2 ^ hash3 ^ hash4;

        seed = (hash * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
        return ((int) (seed >>> 24) / (float) (1 << 24));
    }

    /**
     * @return pseudo random number (0 ~ 1)
     */
    public static float pseudoRandom() {
        return pseudoRandom(0x5DEECE66DL);
    }

    /**
     *
     * Please note that this is the SHA-3 FIPS 202 standard, not Keccak-256.
     *
     * @param src source string (hex encoding string)
     * @return sha3-256 hash (hex encoding string)
     */
    public static native String sha3(String hexString);

    /**
     *
     * Please note that this is the SHA-3 FIPS 202 standard, not Keccak-256.
     *
     * @param bytes source byte array
     * @return sha3-256 hash (hex encoding string)
     */
    public static native String sha3(byte[] bytes);

    /**
     * [Testnet]verify signature data(ECDSA)
     *
     * @param data(hex encoding string)
     * @param signature(hex encoding string)
     * @param pubkey(hex encoding string)
     * @return verify result
     */
    public static native boolean verifySignatureData(String data, String signature, String pubkey);

    /**
     * [Testnet]Generate a random seed with a specific algorithm based on the cutoff block height and the number of original seeds
     *
     * @param endHeight the cutoff block height
     * @param seedCount the number of original seeds
     * @param algorithm Hash algorithm identifier
     * @return After the original seed byte array is merged, the hash algorithm is used to get a 32-bit hash byte array, which is then converted into BigInteger(new BigInteger(byte[] bytes)).
     */
    public static native BigInteger getRandomSeed(long endHeight, int seedCount, String algorithm);

    /**
     * [Testnet]Generate a random seed using the `SHA3-256`hash algorithm based on the cutoff block height and the number of original seeds.
     *
     * @param endHeight the cutoff block height
     * @param seedCount the number of original seeds
     * @return After the original seed byte array is merged, the `SHA3-256` hash algorithm is used to get the 32-bit hash byte array, which is then converted into BigInteger(new BigInteger(byte[] bytes)).
     */
    public static BigInteger getRandomSeed(long endHeight, int seedCount) {
        return getRandomSeed(endHeight, seedCount, "SHA3");
    }

    /**
     * [Testnet]Generate a random seed with a specific algorithm based on the block height range
     *
     * @param startHeight the starting block height
     * @param endHeight   the cutoff block height
     * @param algorithm   Hash algorithm identifier
     * @return After the original seed byte array is merged, the hash algorithm is used to get a 32-bit hash byte array, which is then converted into BigInteger(new BigInteger(byte[] bytes)).
     */
    public static native BigInteger getRandomSeed(long startHeight, long endHeight, String algorithm);

    /**
     * [Testnet]Generate a random seed with the `SHA3-256` hash algorithm based on the block height range
     *
     * @param startHeight the starting block height
     * @param endHeight   the cutoff block height
     * @return After the original seed byte array is merged, the `SHA3-256` hash algorithm is used to get the 32-bit hash byte array, which is then converted into BigInteger(new BigInteger(byte[] bytes)).
     */
    public static BigInteger getRandomSeed(long startHeight, long endHeight){
        return getRandomSeed(startHeight, endHeight, "SHA3");
    }

    /**
     * [Testnet]Get a collection of raw seeds based on the cutoff block height and the number of original seeds
     *
     * @param endHeight the cutoff block height
     * @param seedCount the number of original seeds
     * @return returns a collection of original seeds, the element is a BigInteger (new BigInteger(byte[] bytes)))
     */
    public static native List<BigInteger> getRandomSeedList(long endHeight, int seedCount);

    /**
     * [Testnet]Get a collection of raw seeds based on the block height range
     *
     * @param startHeight the starting block height
     * @param endHeight   the cutoff block height
     * @return returns a collection of original seeds, the element is a BigInteger (new BigInteger(byte[] bytes)))
     */
    public static native List<BigInteger> getRandomSeedList(long startHeight, long endHeight);

    /**
     * command to call other modules on the chain
     *
     * @see <a href="https://docs.nuls.io/zh/NULS2.0/vm-sdk.html">Detailed documentation for calling the command</a>
     * @param cmdName
     * @param args
     * @return depending on the return type of the registration command, it can return a string, an array of strings, a two-dimensional array of strings
     */
    public static native Object invokeExternalCmd(String cmdName, String[] args);

    /**
     * Convert an object to a json string
     * Note: If the object contains complex objects, the serialization depth must not exceed level 3
     *
     * @param obj
     * @return Json string
     */
    public static native String obj2Json(Object obj);

    /**
      * Create contract internally
      * @param salt The factors involved in calculating the new contract address
      * @param codeCopy specifies the contract template
      * @param args deployment parameters
      * @return the deployed contract address
      */
    public static String deploy(String[] salt, Address codeCopy, String[] args) {
        require(codeCopy.isContract(), "not contract address");
        String finalSalt = encodePacked(salt);
        int argsLength = 0;
        if (args != null) {
            argsLength = args.length;
        }
        String[] arr = new String[args.length + 2];
        arr[0] = codeCopy.toString();
        arr[1] = finalSalt;
        for (int i = 0; i < argsLength; i++) {
            arr[2 + i] = args[i];
        }
        return (String) Utils.invokeExternalCmd("createContract", arr);
    }

    /**
     * String array encoding
     */
    public static String encodePacked(String[] args) {
        return (String) Utils.invokeExternalCmd("encodePacked", args);
    }

    /**
      * Calculate the contract address
      * @param salt The factors involved in calculating the new contract address
      * @param codeHash the hash value of the contract code
      * @param sender contract deployer
      * @return contract address
      */
    public static String computeAddress(String[] salt, String codeHash, Address sender) {
        String finalSalt = encodePacked(salt);
        return (String) Utils.invokeExternalCmd("computeAddress", new String[]{finalSalt, codeHash, sender.toString()});
    }

    /**
      * Get the hash value of the contract code
      * @param codeAddress contract address
      * @return the hash value of the contract code
      */
    public static String getCodeHash(Address codeAddress) {
        require(codeAddress.isContract(), "not contract address");
        return (String) Utils.invokeExternalCmd("getCodeHash", new String[]{codeAddress.toString()});
    }
}
```

### io.nuls.contract.sdk.annotation.Payable

`@Payable` labels the method of `@Payable`. Only when it is added, the amount can be transferred in

```java
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Payable {
}
```

### io.nuls.contract.sdk.annotation.PayableMultyAsset

`@PayableMultyAsset` 标记`@PayableMultyAsset`的方法，才能在调用时候转入其他资产，支持同时转入多个其他资产

```java
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PayableMultyAsset {
}
```

### io.nuls.contract.sdk.annotation.Required

`@Required` labels the parameter of `@Required`. When it is added, there must be transfer-in value, _**If you do not want to pass parameters that are not marked with this annotation, you need to fill in 0 or null placeholder.**_

```java
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Required {
}
```

### io.nuls.contract.sdk.annotation.View

`@View` labels the method of `@View`. After it is added, the contract status will remain and it can be researched by such means

```java
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface View {
}
```

### io.nuls.contract.sdk.annotation.JSONSerializable

`@JSONSerializable` labels the method of @JSONSerializable, the return value is automatically serialized by the VM in JSON format and returned as a JSON string.

<b style="color:red">Note: The object level must not exceed 3 layers. The more than 3 layers will call the object's toString method, and will not continue serialization.</b>

```java
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface JSONSerializable {
}
```

## 6. Main RPC interface of smart contract

In the NULS 2.0 module `NULS-API`, we provide most of the commonly used APIs. Please refer to the Smart Contracts section of this document.

[NULS-API_JSONRPC](./i_nuls-api_JSONRPC.html)

[NULS-API_RESTFUL](./i_nuls-api_RESTFUL.html)

## 7. Some instructions for the delivery of smart contract method parameters

If the methods of smart contract include the parameter of  `array type`, please use the following method to transfer parameters
> Refer to the [vote contract](https://github.com/nuls-io/nuls-contracts/blob/master/vote/io/nuls/vote/contract/VoteContract.java#L26) code for the `create` method

```json
{
  "sender": "NsdtydTVWskMc7GkZzbsq2FoChqKFwMf",
  "password": "",
  "contractAddress": "NseLt14NacjTDhXaTXUdrk6VF7aEwtW4",
  "gasLimit": 200000,
  "price": 1,
  "value":<PHONE_NUMBER>0,
  "methodName": "create",
  "methodDesc": "",
  "remark": "",
  "args": [
     "Test voting 1",
     "Voting contract 1",
     [
       "Option 1",
       "Option 2",
       "Option 3"
     ],
<PHONE_NUMBER>056,<PHONE_NUMBER>056, false, 300, false
   ]
}
```

repository: nuls-io/devsite

repo_name: nuls-io/devsite


text:
# Slot: sequence_feature_relationship_subject

URI: [biolink:sequence_feature_relationship_subject](https://w3id.org/biolink/vocab/sequence_feature_relationship_subject)

## Domain and Range

[SequenceFeatureRelationship](SequenceFeatureRelationship.md) ->  REQ [GenomicEntity](GenomicEntity.md)

## Parents

 *  is_a: [subject](subject.md)

## Children

 *  [exon to transcript relationship➞subject](exon_to_transcript_relationship_subject.md)
 *  [gene to gene product relationship➞subject](gene_to_gene_product_relationship_subject.md)
 *  [transcript to gene relationship➞subject](transcript_to_gene_relationship_subject.md)

## Used by

 * [SequenceFeatureRelationship](SequenceFeatureRelationship.md)

repository: biolink/biolinkml

branch_name: refs/heads/master

extension: md

gha_language: Python

license_type: permissive

repo_name: biolink/biolinkml


text:
# Switching from Gulp to webpack

https://www.valentinog.com/blog/from-gulp-to-webpack-4-tutorial/

copy from https://www.valentinog.com/blog/from-gulp-to-webpack-4-tutorial/

## Switching from Gulp to Webpack: configuring the project

To start, create a new directory to hold the project’s files:

1. mkdir from-gulp-to-webpack

Also, create some directories for the source assets:

1. cd from-gulp-to-webpack
2. mkdir -p src/{img,_scss}

and initialize package.jsonby running:

1. npm init -y

Next up install webpack and webpack-cli:

1. npm i webpack webpack-cli --save-dev

To use webpack within our NPM scripts add two scripts inside package.json:

1. "scripts": {
2.   "build": "webpack --mode production",
3.   "watch": "webpack --watch --mode development"
4. }

and we’re good to go!

**NOTE**: the *build* script builds the assets in a single shot. To continuously re-compile the assets on file saving run the *watch* script instead

## Switching from Gulp to Webpack: generating an HTML file from a template, minimizing the markup

First, **webpack is not like Gulp**. It was born aiming specifically at Javascript.

That means webpack doesn’t know how to handle other files than js.

That’s where **loaders** comes in to play.

Think of webpack loaders as of “transformers”.

To correctly **process HTML** files, Webpacks needs two additional components: **html-webpack-plugin** and **html-loader**.

Add them to the project with:

1. npm i html-webpack-plugin html-loader --save-dev

Now create a new file named webpack.config.js and add a base configuration:

```js
const HtmlWebPackPlugin = require("html-webpack-plugin");

module.exports = {
  module: {
    rules: [
      {
        test: /\.html$/,
        use: [{ loader: "html-loader", options: { minimize: true } }]
      }
    ]
  },
  plugins: [
    new HtmlWebPackPlugin({
      template: "src/index.html",
      filename: "./index.html"
    })
  ]
};
```

Most important things to know about the Webpack configuration file are:

1. **entry**: (optional) it’s our main Javascript file where all of the application’s code gets imported
2. **output**: (optional) it’s the resulting Javascript file, bundled by Webpack
3. **module and rules**: it’s the place where you configure the loaders
4. **plugins**: it’s the place where you configure which plugins Webpack will use

With this in place we are ready to generate our first HTML file. But first we need a template as a starting point.

Create ./scr/index.html:

alongside with a dummy Javascript file, ./scr/index.js:

1. console.log(`I've been required by Webpack`);

Now run your first build with:

1. npm run build

and right after Webpack finishes, check out the **dist** directory.

You should see the **resulting HTML file**, **minimized**. Also, if you open said file inside the browser you’ll see the expected output:

The message “I’ve been required by Webpack” should appear inside the console.

With Webpack there’s no need to include your Javascript inside the HTML file: the bundle will be automatically injected inside  <script></script>.

## Switching from Gulp to webpack: optimizing images

**Optimizing images** is paramount in modern web development. You don’t want to serve a 250KB image over a mobile connection.

You should already know about gulp-imagemin which is the image optimization module for Gulp.

Things are a bit different in webpack and to optimize images you have to make use of two loaders: [img-loader](https://www.npmjs.com/package/img-loader) and [url-loader](https://webpack.js.org/loaders/url-loader/).

To start, pull the dependencies inside your project:

1. npm i img-loader url-loader file-loader --save-dev

The **img-loader** is the actual loader responsible for optimizing images. But the **url-loader** comes first inside the chain. It’s configured so any image below a specified limit will become a **Base64 URL**.

Loading images as a Base64 URL has its own benefits: the browser does not have to load the image externally.

Anyway, you may wonder why I installed **file-loader**. Well, it is a fallback. If the image size is above the configured limit Webpack will load the image straight away.

Enough talking.

To test things out add two images to the previous HTML template. You can download some PNG from the internet and save them inside ./src/img/respectively as big-image.png and small-image.png:

Then let’s update the webpack configuration by adding the loaders:

```js
const HtmlWebPackPlugin = require("html-webpack-plugin");

module.exports = {
  module: {
    rules: [
      {
        test: /\.html$/,
        use: [{ loader: "html-loader", options: { minimize: true } }]
      },
      {
        test: /\.(png|jpe?g)/i,
        use: [
          {
            loader: "url-loader",
            options: {
              name: "./img/[name].[ext]",
              limit: 10000
            }
          },
          {
            loader: "img-loader"
          }
        ]
      }
    ]
  },
  plugins: [
    new HtmlWebPackPlugin({
      template: "src/index.html",
      filename: "./index.html"
    })
  ]
};
```

Run the build again with:

1. npm run build

and two things will happen:

1. the bigger image will be optimized
2. the smaller one will be inlined inside the HTML as a Base64 URL

## Switching from Gulp to webpack: compiling SASS to CSS, adding vendor prefixes to CSS

I don’t know whether some developer is writing plain CSS right now or not. But as for me writing **SASS** is the norm.

Does anybody write pure CSS out there?

Long story short a SASS file can’t be directly interpreted by browsers so you have to transform it to common CSS. Also, you may want to add vendor prefixes to ensure that (almost) all the browsers will understand your CSS.

That means in plain english:

1. take the SASS file and compile it to CSS
2. take the CSS and add vendor prefixes

With Gulp I had to resort to some kind of magic to make things work in sequence.

With webpack it’s a matter of adding some loaders.

Yet you have to extract the CSS to a file because webpack won’t do that by default.

This is a bit weird at first but I promise you’ll get used to it.

Let’s pull in the dependencies with:

1. npm i css-loader sass-loader postcss-loader node-sass mini-css-extract-plugin --save-dev

Also, the webpack configuration needs some changes:

```js
const HtmlWebPackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  module: {
    rules: [
      {
        test: /\.html$/,
        use: [{ loader: "html-loader", options: { minimize: true } }]
      },
      {
        test: /\.(png|jpe?g)/i,
        use: [
          {
            loader: "url-loader",
            options: {
              name: "./img/[name].[ext]",
              limit: 10000
            }
          },
          {
            loader: "img-loader"
          }
        ]
      },
      {
        test: /\.scss$/,
        use: [
          MiniCssExtractPlugin.loader,
          "css-loader",
          "postcss-loader",
          "sass-loader"
        ]
      }
    ]
  },
  plugins: [
    new HtmlWebPackPlugin({
      template: "src/index.html",
      filename: "./index.html"
    }),
    new MiniCssExtractPlugin({
      filename: "[name].css",
      chunkFilename: "[id].css"
    })
  ]
};
```

Now create a SASS file inside ./src/_scss/main.scss:

Import the style in ./src/index.js:

1. console.log(`I've been required by Webpack`);
2. import style from "./_scss/main.scss";

Create a file named postcss.config.js inside ./src/_scss/:

```js
module.exports = {
  plugins: [require("autoprefixer")]
};
```

finally open up package.json and configure the browsers list:

`"browserslist": ["last 2 versions"]`

Now run the build again with:

1. `npm i -D autoprefixer`//otherwise throw error

2. ```
   npm install file-loader --save-dev
   ```

3. https://chriscourses.com/blog/loading-fonts-webpack

4. >此处绝望，fontawesome 的path一直报错
   >
   >ERROR in ./src/scss/main.scss (./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/sass-loader/lib/loader.js!./src/scss/main.scss)
   >    Module not found: Error: Can't resolve './webfonts/fa-solid-900.svg' in '/Users/pliu089/Documents/personal/work-info/projects/gulp-to-webpack/src/scss'
   >     @ ./src/scss/main.scss (./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/sass-loader/lib/loader.js!./src/scss/main.scss) 7:68959-68997
   >
   >找不到原因，有点心累。

5. npm run build

and you’ll see that:

1. the SASS file gets compiled to CSS
2. the vendor prefixes gets added to the CSS

Also there’s no need to include the CSS inside the HTML file: it’s automagically injected inside a <link></link>tag.

Open up index.html inside your browser and fire up the console: you’ll see how the CSS works out of the box:

![Switching from Gulp to Webpack: compiling SASS to CSS, producing the minified version, adding vendor prefixes to CSS](https://www.valentinog.com/blog/wp-content/uploads/2017/10/webpack-vendor-prefixes-postcss.png)

So far, so good.

## Switching from Gulp to webpack: transpiling Javascript with Babel

![Switching from Gulp to Webpack: transpiling Javascript with Babel](https://www.valentinog.com/blog/wp-content/uploads/2017/10/from-gulp-to-webpack-babel.png)

First time I heard about “**transpiling**” I thought it was a joke. It is not.

Transpiling is the act of taking some **modern Javascript** syntax to make it understandable by older browsers.

In other words if you fancy using ES6 and friends you must first compile your code with **Babel**.

Take this example:

1. (() => {
2.   const IAmES6 = `I must be transpiled by Babel`;
3.   console.log(IAmES6);
4. })();

It won’t run everywhere. And that’s when Babel comes in to play. It can convert the above code into something meaningful for every browser.

[**webpack can transpile** our code with Babel](https://www.valentinog.com/blog/webpack-4-tutorial/#webpack_4_transpiling_Javascript_ES6_with_Babel). But it needs some loaders.

You can find the instruction for transpiling ES6 with Babel [here](https://www.valentinog.com/blog/webpack-4-tutorial/#webpack_4_transpiling_Javascript_ES6_with_Babel).

## Switching from Gulp to Webpack: watching files and re-compiling on save

We already have a mechanism for watching files and re-compiling on save. It’s the *watch* script inside package.json:

1. "scripts": {
2.   "build": "webpack --mode production",
3.   "watch": "webpack --watch --mode development"
4. }

This is fine but we can do it better. With the [webpack Dev Server](https://webpack.js.org/configuration/dev-server/).

So what the webpack Dev Server does exactly?

It takes only 3 lines of configuration to have a development server up and running. Once configured, you’ll run a npm script and Webpack will launch your application/website inside a browser.

To set up Webpack Dev Server install the package with:

1. npm i webpack-dev-server --save-dev

Open up package.json , add the *start* script (you can also get rid of the watch script):

1. "scripts": {
2.   "start": "webpack-dev-server --open --mode development",
3.   "build": "webpack --mode production"
4. }

save and close the file.

Now, by running

1. npm start

webpack Dev Server will launch your application inside the browser.

Also, every time you save a file after a modification Webpack Dev Server will **automagically refresh** the browser’s window.

It is fantastic, isn’t it?

## What now? Should you switch all your projects from Gulp to Webpack?

Are you comfortable with Gulp? Stick with it.

Do you need a modern module bundler? Do you need code splitting?

Give [webpack a try](https://www.valentinog.com/blog/webpack-4-tutorial/). You won’t regret it.

As for me, a Webpack configuration [like this one](https://github.com/valentinogagliardi/www.valentinog.com/blob/master/webpack.config.js) is better than writing [Javascript for Gulp](https://github.com/valentinogagliardi/www.valentinog.com/blob/aeaf3de09753f5b66ef5611f0b0e14aa1868a02d/gulpfile.js).

At the end of the day it’s a matter of personal preferences. As almost everything within the Javascript realm. I don’t want to persuade you.

Be aware that React, VueJS, and a lot of other projects use webpack as the default module bundler. Laravel made the switch from Gulp to Webpack too. **Ignoring Webpack won’t be an option** if you want to stay ahead.

## Switching from Gulp to Webpack: resources for learning Webpack

![Switching from Gulp to Webpack: resources for learning Webpack](https://www.valentinog.com/blog/wp-content/uploads/2017/10/webpack-logo-on-white-bg.png)

The webpack ecosystem is **huge**. It is almost impossible to cover everything inside a single article. As soon as you finish up reading, go check the following resources:

[Webpack documentation](https://webpack.github.io/)

[Webpack Academy by Sean Larkin](https://webpack.academy/)

[Webpack for Everyone by Jeffrey Way](https://laracasts.com/series/webpack-for-everyone)

Thanks for reading!

license: MIT

url: https://raw.githubusercontent.com/phoebeliu/work2018/669b982ba9d2cd4f70284fc62e73838c92815000/Switching from Gulp to webpack.md

path: /Switching from Gulp to webpack.md

filename: Switching from Gulp to webpack.md

gha_language: JavaScript

gha_license_id: MIT


text:
# Team Pandemonium

This project uses a neural network to generate a beatmap for a given song.  The model is trained on beatmaps that are of expert difficulty and are highly rated within the www.beatsaver.com community.

## Getting Started
Before you can run this project, you will need to install some programs and dependencies.

### Installing necessary programs
1. Python 3 or higher:  Python 3 is necessary to run another program that we use: Jupyter Notebook.  Python 3 can be found at https://python.org/downloads/

2. Jupyter Notebook:  The project is written in .ipynb files.  To open these files, you'll need Jupyter Notebook.  You can install this at https://jupyter.org/install

3. PIP:  PIP is a python package manager.  It is necessary to easily install the dependencies of this project.  You can find out how to install PIP at https://pip.pypa.io/en/stable/installing/

4. FFmpeg:  FFmpeg is a tool used within the project.  Please go to https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg and follow the instructions written to install this.

### Installing dependencies
After cloning the repository, you may install the necessary dependencies by navigating to the the top directory (that contains the 'requirements.txt' file) and run:
```pip install -r requirements.txt```

### Demo
Now that you have everything set up, you can start the demo.  The demo of this project can be found in the subdirectory named 'Demo'.  There is a file in there (demo.ipynb) that contains a walkthrough of the project.  Going through this demo and running the code will give you a better understanding of the project.

gha_language: Jupyter Notebook


text:
## Prerequisites

* Install [Tizen Studio](https://developer.tizen.org/development/tizen-studio/download) IDE or only CLI tools.
* [Create a Tizen certificate profile](https://developer.tizen.org/development/training/.net-application/getting-certificates/creating-certificates)
* Create a `config.xml` file with Tizen app configuration. See [Configuring Applications](https://developer.tizen.org/development/tizen-studio/web-tools/configuring-your-app/configuration-editor).

### Required Tizen privileges

ZombieBox requires the following privileges to work:

* `http://tizen.org/privilege/application.launch`
* `http://tizen.org/privilege/download`
* `http://tizen.org/privilege/filesystem.read`
* `http://tizen.org/privilege/notification`
* `http://tizen.org/privilege/tv.inputdevice`
* `http://tizen.org/privilege/tv.audio`
* `http://tizen.org/privilege/power`
* `http://developer.samsung.com/privilege/productinfo`
* `http://tizen.org/privilege/system`
* `http://tizen.org/feature/network.ethernet`
* `http://tizen.org/feature/network.wifi`

## Configuration

Platform build scripts are configured with this properties in application config file.

```js
platforms: {
	tizen: {
		widget: '/path/to/config.xml',
		tizenToolsDir: '/path/to/tizen-studio/tools/ide/bin',
		securityProfile: 'security profile name',
		sdbDir: '/path/to/tizen-studio/tools/',
		iconPath: '/path/to/custom/icon.png'
	}
}
```

`tizenToolsDir` and `sdbDir` can be omitted if `tizen` and `sdb` binaries are available in `$PATH`.

### `securityProfile`

Name of Tizen security profile.

Find installed certificates with:
```bash
tizen security-profiles list
```

### Building and installing application

Use ZombieBox CLI to build application:

```bash
npx zb build tizen
```

`zombiebox-platform-tizen` exposes two additional commands to CLI: `install` and `launch`

#### Installation

```bash
npx zb tizen install [device]
npx zb tizen install --device <IP_ADDRESS>
```

Installs `.wgt` file that was build with `zb build`.

`device` parameter can be omitted if it's already connected to sdb and only one device is connected at the time.

#### Running

```bash
npx zb tizen launch [device]
npx zb tizen launch --device <IP_ADDRESS>
```

Launches application with id from `config.xml`.

`device` parameter can be omitted if it's already connected to sdb and only one device is connected at the time.

### Troubleshooting

#### There is no profile.

If Tizen tools can't find the profile application was built with:

```
Starting package
-----------------------------------------------------

There is no profile.
-----------------------------------------------------
Finished package
```

Verify `default.profiles.path` points to a correct `profile.xml` file:

```bash
tizen cli-config -l
```

Or update it as necessary

```bash
tizen cli-config default.profiles.path=/Your/Tizen/workspace/.metadata/.plugins/org.tizen.common.sign/profiles.xml
```

repository: interfaced/zombiebox-platform-tizen

repo_name: interfaced/zombiebox-platform-tizen


text:
# Contribute to Gut

There's a killer feature missing? A bug found a way in? The documentation is insufficient? Any contribution is welcome, please get a look at
[my contribution guidelines](https://github.com/quilicicf/Docs/blob/master/contribution/main.md).

For the more code-specific things:

1. Git
   1. Create an issue on this repository, so we can discuss your contribution
   2. Fork this repository
   3. Hack on a separate topic branch created from the latest `master` and named following the [branch naming convention](../README.md#branch-naming)
   4. Commit and push the topic branch
   5. Every behaviour modification should be reported in the specs, you can ask me to do that if you find it boring though
   6. Make a pull request
2. Code style
   1. Please configure your IDE to use the `.eslintrc` file for formatting
   2. Please favor immutable variables and pure functions where applicable
3. Other
   1. Always let me know by issue before contributing so that we don't work on the same topic and waste time
   2. You don't know how or don't have the time to contribute? Sharing your ideas in issues is already contributing and appreciated!

Thank you for helping out!

repository: quilicicf/Gut

gha_language: TypeScript

repo_name: quilicicf/Gut


text:
  detect.location •
  watch.user

-------

# `watch.user`

[![Twitter: @KrauseFx](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/KrauseFx/watch.user/blob/master/LICENSE)

## Disclaimer

`watch.user` is not intended to be used in production. It's a proof of concept to highlight a privacy loophole that can be abused by iOS apps. Apps shouldn't use this. The goal is to close this loophole and give its users better privacy controls for the iPhone camera access.

## What does `watch.user` demonstrate?

Most users often granted camera access to an app a while ago (e.g. a messaging app or any news-feed-based app). Those apps can easily track the users face, take pictures, or live stream their front and back camera, without the user's consent.

- Get access to the raw front and back camera of an iPhone/iPad any time your app is running (in the foreground)
- Using the built-in iOS 11 Vision framework, a developer can very easily parse facial features in real-time like the eyes, mouth, and the face frame.
- Use the front and the back camera to know what your user is doing right now and where the user is located based on image data
- Upload random frames of the video stream to your web service, and run a proper face recognition software, which enables you to
  - Find existing photos of you on the internet
  - Learn how the user looks like and create a 3d model of the user's face (literally)
- Estimate the mood of the user based on what you show in your app (e.g. news feed of your app)
- Detect if the user is on their phone alone, or watching together with a second person
- With the recent innovation around faster internet connections, faster processors and more efficient video codecs, a user probably notice if you live stream their camera onto the internet (e.g. while they sit on the toilet)
- Recording stunning video material from bathrooms around the world, using both the front and the back camera, while the user scrolls through your feed

## Proposal

The MacBook has an elegant solution, where a small LED turns on whenever an app accesses the camera.

- Offer a way to grant temporary access to the camera
- Show an icon in the status bar that the camera is active, and force the status bar to be visible whenever an app accesses the camera
- Add an LED to the iPhone's camera (both sides) that can't be worked around by sandboxed apps

TODO: insert Radar here

## About the demo

The demo will show you an innocent, random text, this could be anything, a feed to scroll view, a book to read, an in-app browser.

The point of the demo is to show how an app can take pictures of you while you use it, once you give it camera permission.

Chances are, you say:

> Oh, obviously, I never grant camera permission

However, the point is, that if you use a messaging service, like Messenger, WhatsApp, Telegram or anything else, chances are high you already granted permission to access both your image library ([detect.location](https://github.com/KrauseFx/detect.location)), and your camera.

## License

This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.

Special thanks to [Pawel Chmiel](https://github.com/PChmiel), who built the foundation this project is based on with [VisionFaceDetection](https://github.com/DroidsOnRoids/VisionFaceDetection)

Special thanks to [Soroush](https://twitter.com/khanlou) for the idea to build a demo app for this.


text:
# Skywire Visor Monitor

This program store the number of available Skywire visors in world over the time.

## Installation

You have to install crystal for your operating system: https://crystal-lang.org/docs/installation/

## Set environment variables

    export APP_DB_HOST=localhost
    export APP_DB_NAME=skywirevisor_development
    export APP_DB_PASSWORD=skywirevisor_development
    export APP_DB_PORT=28015
    export APP_DB_TABLE_NAME=visors_metrics
    export APP_DB_USER=skywirevisor_development
    export APP_TICK_TIME_SECOND=10
    export APP_TRACKER_PATH="/visors"
    export APP_TRACKER_URI="https://uptime-tracker.skywire.skycoin.com"

## Usage

    shards build --production

## Development

### Launch RethinkDB administration tool

First of all, you need a RethinkDB datastore: https://rethinkdb.com/docs/install/.

You can deploy an instance on cloud provider like AWS or Compose: https://rethinkdb.com/docs/paas/

1. With *docker*

    __replace *rethinkdb* by your docker instance name__

        xdg-open "http://$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' rethinkdb):8080"

2. With a local RethinkDB instance

        xdg-open "http://localhost:8080"

3. With a remote instance of RethinkDB

        xdg-open "https://my.domain.com:8080"

### Configure the database

    r.db('rethinkdb').table('users').insert({id: 'skywirevisor_development', password: 'skywirevisor_development'});
    r.dbCreate('skywirevisor_development');
    r.db('skywirevisor_development').grant('skywirevisor_development', {read: true, write: true, config: true});

## Contributing

1. Fork it (<https://github.com/fenicks/skywire-visor-monitor/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [fenicks](https://github.com/fenicks) Christian Kakesa - creator, maintainer

repository: christiankakesa/skywire-visor-monitor

repo_name: christiankakesa/skywire-visor-monitor


text:
# Reserve a Para ID

To connect to any relay chain, you must first reserve a Para ID for your parathread that will
become a parachain. It is called Para ID, because the same ID can be seen as its parachain ID or
parathread ID, depending on your current chain to relay-chain connection state. To do this, you need
to have sufficient amount of the currency on the network to
reserve the ID. This is 20 "units" on the testnets. Check for the amount on your relay chain.
The relay chain is responsible for allotting all Para IDs (they can no longer
be user selected) and will be simply the increment starting at `2000` for all chains connecting
that are not "systems parachains" that use a different method to obtain the Para ID.

The easiest way to reserve your Para ID is via the
[Polkadot-JS Apps](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F<IP_ADDRESS>%3A9944#/parachains/parathreads)
under the _Network_ -> **Parachains** subpage, click on **Parathreads** tab and use the
**+ ParaId** button.

![ParaID Reservation Screenshot](../../assets/img/paraid-reserve.png)

> You will need to connect to a relay chain to submit this extrinsic! In testnets, your Parachain
> ID will be 2000 for your first parathread registration.

Note that the account used to register the Para ID must also be the origin for using this
Para ID. Once you submit this extrinsic successfully (you must see a sucessful `registrar.Reserved`
event with your `paraID`), you can now launch your parachain or parathread using this reserved ID.

repository: hupsuni/cumulus-workshop

repo_name: hupsuni/cumulus-workshop


text:
---
layout: post
title: Memories
categories: blog
tags: ['human-behaviour']
excerpt: 'A quick note on memories'
date: May 13, 2017

author: self

---

When I was about 8 years old, one evening I got a severe deep cut on
one of my legs. My father provided me with first aid and dressed up
the wound. A few hours later I was running around with the bandage
somehow managing to hold on to my leg, not that I cared much about it.

As the wound healed and left a scar behind it, I would show it off
very proudly whenever a chance presented itself. I was always able
to locate the scar without having to look at it. But, as the years
passed by, the frequency with which I spoke about it decreased along
with my ability to be able to find it in my sleep. Today, the scar is
barely visible and I am not certain if it was the left leg or the
right. Probably the right leg.

Memories feel very similar. We distinctly remember the events related
to a memory and every little detail, including the people, the place
and the time. We often reflect on the important memories. Very
frequently. But as the years roll on, the details start to get hazy
and we can't point out the minute details quite as efficiently. Surely
with some digging and retrospection the details start coming back to
us, but it takes a little more effort on our part and a tad bit longer
the next time we try reminiscing upon a certain memory. Over time, we
think about it less often and eventually it gets muddled up with the
forgotten sands to an extent that we are unable to point out the
difference anymore.

I used this analogy recently to explain what a memory is and how it
plays tricks on us and felt the need to write it down.

As I bend down to search for the wound I got years ago, I finally
manage to find it hidden under the hair that grows on top of it
now. But it is on my left leg.

gha_language: HTML


text:
# unikv

(sub project of apiles)

Simple KV memory middleware library (for Golang).

## Installation

```bash
go get github.com/apiles/unikv
```

## Usage

First import packages:

```go
import (
    "github.com/apiles/unikv"
    _ "github.com/apiles/unikv/drivers"
)
```

Note that `github.com/apiles/unikv/drivers` contains all the available drivers.

You can specify that with importing `github.com/apiles/unikv/memory` or something.

Available drivers:

| name   | address                          |
| ------ | -------------------------------- |
| memory | `github.com/apiles/unikv/memory` |
| redis  | `github.com/apiles/unikv/redis`  |

Then you need to specify an `unikv.yml`. An example is included in [docs/unikv.yml](docs/unikv.yml).

Note that unikv will look it up in the current work directory. You can also specify it by setting the environment varaible `UNIKV_CONFIGURE`.

Then you can see this example:

```go
func main() {
    ns := unikv.NewNamespace("hello")
    bucket, err := ns.NewBucket("new")
    defer bucket.Close()
    if err != nil {
        panic(err)
    }
    bucket.PutString("hello", "world")
    bucket.PutInt("new", 1234)
    bucket.Put("c", true)
    var c bool
    bucket.Get("c", &c)
    value, _ := bucket.GetString("hello")
    in, _ := bucket.GetInt("new")
    fmt.Println(value, in, c)
}
```

## API Docs

Go to <https://pkg.go.dev/github.com/apiles/unikv>.

## UniKVd

See <docs/unikvd-protocol.md>.

repository: apiles/unikv

repo_name: apiles/unikv


text:
# Mascarade Deck Builder

This tool automatically creates a deck of cards, from the cards available, for playing a game of Mascarade.

## How To Use

Open index.html in a modern web browser.

1. Select the number of players playing.
2. Select how many extra (non-player) cards you want in the middle of the table.
3. Select how many cards to graveyard should have if the Necromancer card is in play.
4. Choose additional deck options.
5. Optionally remove certains cards from the game.
5. Click "Generate" to create a deck of cards that matches your requirements.

You may also click on one of the pre-defined scenarios for those recommended deck layouts.

## Support This Project

Find this tool useful? Like to see it continually supported?

I am a self-employed software developer who built this in my free time.
Unfortunately, I can't work on stuff like this all the time as I have to make money to eat and live.
With your support, I can continue working on this and other great tools for Kerbal Space Program that everyone can benefit from!

Please click the "Donate" link on the web app to support this project! Thanks!

## License

Mascarade and Mascarade Expansion are Copyright (c) 2014 REPOS PRODUCTION.
All rights reserved.

Mascarade Deck Builder is Copyright (c) 2015, Gary Court.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

repository: garycourt/mascarade-deck-builder

repo_name: garycourt/mascarade-deck-builder


text:
---
layout: default
title: Dependencies
nav_order: 1
has_children: false
parent: Build from source
grand_parent: Install
has_toc: false
---
# Dependencies

This section lists the dependencies you need before installing BibExplorer from source:

* C++17
* CMake 3.14 or higher
* OpenGL
* Curl

Instructions: Linux/Ubuntu/GCC

Check your GCC version

```bash
g++ --version
```

The output should be something like

```console
g++-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
```

If you see a version before GCC-8, update it with

```bash
sudo apt update
sudo apt install gcc-8
sudo apt install g++-8
```

To update to any other version, like GCC-9 or GCC-10:

```bash
sudo apt install build-essential
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install g++-10
```

Once you installed a newer version of GCC, you can link it to `update-alternatives`. For instance, if you have GCC-7 and GCC-10, you can link them with:

```bash
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
```

You can now use `update-alternatives` to set you default `gcc` and `g++`:

```bash
update-alternatives --config g++
update-alternatives --config gcc
```

Check your CMake version:

```bash
cmake --version
```

If it's older than CMake 3.14, update it with

```bash
sudo apt upgrade cmake
```

or download the most recent version from [cmake.org](https://cmake.org/).

[Later](#build-the-examples) when running CMake, make sure you are using GCC-8 or higher by appending the following options:

```bash
-DCMAKE_C_COMPILER=/usr/bin/gcc-8 -DCMAKE_CXX_COMPILER=/usr/bin/g++-8
```

Install OpenGL / GLFW3:

```bash
sudo apt-get install libglfw3-dev
```

Install curl:

```bash
sudo apt install curl
sudo apt-get install libcurl4-gnutls-dev
```

Install OpenSSL:

```bash
sudo apt-get install libssl-dev
```

Instructions: Mac Os/Clang

Check your Clang version:

```bash
clang --version
```

The output should be something like

```console
Apple clang version 11.0.0 (clang-1<IP_ADDRESS>)
```

If you see a version before Clang 11, update XCode in the App Store or update clang with homebrew.

Check your CMake version:

```bash
cmake --version
```

If it's older than CMake 3.14, update it with

```bash
sudo brew upgrade cmake
```

or download the most recent version from [cmake.org](https://cmake.org/).

If the last command fails because you don't have [Homebrew](https://brew.sh) on your computer, you can install it with

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```

or you can follow the instructions in [https://brew.sh](https://brew.sh).

Download GLFW3 from https://www.glfw.org

Install OpenSSL:

```bash
brew install openssl
```

Instructions: Windows/MSVC

* Make sure you have a recent version of [Visual Studio](https://visualstudio.microsoft.com)
* Install [Git](https://git-scm.com/download/win)
* Install [CMake](https://cmake.org/download/)
* Install [GLFW3](https://www.glfw.org)

Install [VCPKG](https://github.com/microsoft/vcpkg):

```bash
git clone https://github.com/microsoft/vcpkg
> .\vcpkg\bootstrap-vcpkg.bat
```

Install [libcurl](https://curl.haxx.se/download.html):

```bash
vcpkg install curl
```

Some other small dependencies, like header-only libraries, if not found, will be download at compile-time by the build script. You can see these dependencies in [source/CMakeLists.txt](https://github.com/alandefreitas/bibexplorer/blob/master/source/CMakeLists.txt).

<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

repository: alandefreitas/bibexplorer

repo_name: alandefreitas/bibexplorer


text:
# Ice - Secure Ether Vault Dapp

Ice is self-addressed, single-delivery, block-locked ether vault dapp. This is the repository for the solidity contracts used in ice.

You can access the dapp interface at [beta.cubic.blue](http://beta.cubic.blue)

## Getting Started

To use these contracts you must be able to compile and deploy them using a solidity compiler or the integrated web IDE [remix.](http://remix.ethereum.org)

## Authors

* **David Akers** - *Cubic Lead* - [davidmichaelakers](https://github.com/davidmichaelakers)

## License

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

repository: CubicContracts/ice

repo_name: CubicContracts/ice


text:
---
layout: post
title:  "7. Introducing Ranked Retrieval"
date:   2020-02-17
author: Romance
categories: IR
---
# Introducing Ranked Retrieval

### Boolean Retrieval

- Thus far, our queries have all been Boolean
  - Documents either match or don't
- Good for expert users with precise understanding of their needs and the collection
  - Also good for applications : applications can easily consume 1000s of results
- **Not good for the majority of users**
  - Most users incapable of writing Boolean queries (or they are, but they think it's too much work)
  - Most users don't want to wade through 1000s of results
    - This is particularly true of web search

### Problem with Boolean Search : Feast or Famine

- Boolean queries often result in either **too few** ($\approx0$) or **too many** (1000s) results
- example
  - Query 1 : "stanford user dlink 650" → 200,000 hits
  - Query 2 : "stanford user dlink 650 no card found" → 0 hit
- It takes skill to come up with a query that produces a manageable number of hits
  - AND gives too few; OR gives too many

### Ranked Retrieval Models

:  Boolean Retrieval의 단점 보완

- **Ranked Retrieval model** returns an **ordering** over the (top) documents in the collection with respect to a query
- **Free text queries** : Rather than a query language of operators and expressions (and, or, not...), the user's query is just **one or more words** in a human language

### Feast or Famine : not exist in Ranked Retrieval

- When a system produces a ranked result set, large result sets are not a issue
  - Indeed, the size of the result set is not an issue
  - we just show the top k results
  - we don't overwhelm the user

### Scoring as the basis of Ranked Retrieval

- We wish to return in order the documents most likely to be **useful** to the searcher
- How can we rank-order the documents in the collection with respect to a query?
  - Assign a **score** - say in [0, 1] - to each document
- This score measures how well document and query **"match"**
  - 즉, "query와 document의 유사도"

### Query-Document Matching Scores

- we need a way of assigning a score to a query/document pair

- Let's start with a one-term query

  - If the query term docs not occur in the document : score should be 0

  - **The more frequent** the query term in the document, **the higher the score** should be

### 정리

- Boolean Retrieval : 사용하기도 어렵고,  시스템 결과로 나오는 document의 수가 너무 많거나 너무 적다.
- 이러한 불편성을 해소하는 Ranked Retrieval
  - Free text queries에 적합
  - 사용자가 원하는 만큼의 문서를 보면 되어, 시스템 결과로 나오는 document의 수에 따라 만족도가 달라지지 않음

출처 : stanford IR 강의(https://www.youtube.com/watch?v=ZrNmCtSrL48&list=PLaZQkZp6WhWwoDuD6pQCmgVyDbUWl_ZUi&index=7)

path: /_posts/2020-02-17-7 Introducing Ranked Retrieval.md


text:
Since this `glicol_synth` crate is now design to consider standalone usage as a Rust audio library, in each node there are some changes to note.

The most important thing is to differ two cases: if it has clock, if it has sidechain.

The clock is important in Glicol. In the original `dasp_graph` crate, there is no way to stop double processing.

Example:
```
~source: sin 60;
out_a: ~source >> mul 0.5;
out_b: ~source >> delayn 30 >> mul 0.3;
```

Without a clock, when processing `out_b`, the source `sin` node will already pass the current phase, because the `process()` method inside `sin` has been called once in `out_a`. This calling will move its internal phase forward already.

The solution is to create a dummy clock to each node.

repository: remaininlight/glicol

branch_name: refs/heads/main

repo_name: remaininlight/glicol


text:
# Installing Logstash

## Ensuring Linux is up to date

First of all, you should [make sure Linux is up to date](Ensuring-Linux-is-up-to-date.md).

## Downloading Installation Files
The next step is [downloading installation files](Downloading-installation-files.md).

## Installing Logstash
Jump into the chosen installation folder:

`cd /var/opt/elastic/install`

Execute the installation file.

Ubuntu/Debian:

`sudo dpkg -i logstash-X.X.X.deb`

Red Hat/CentOS:

`sudo rpm -i logstash-X.X.X.rpm`

## Setting up the service for automatic start

Now the information about services must be **reloaded** and the new service must be **enabled**.

`sudo /bin/systemctl daemon-reload`

`sudo /bin/systemctl enable logstash.service`

## Starting the service

After the installation is done, the service must be started.

Ubuntu/Debian:

`sudo service logstash start`

Red Hat/CentOS:

`sudo systemctl start logstash`

## Checking the service

During troubleshooting, it can be necessary to check the status of the service.

Ubuntu/Debian:

`sudo service logstash status`

Red Hat/CentOS:

`sudo systemctl status logstash`

Using CURL:

`sudo curl -XGET "localhost:9600"`

## Stopping the service

In case of maintenance, it can be necessary to stop the service.

Ubuntu/Debian:

`sudo service logstash stop`

Red Hat/CentOS:

`sudo systemctl stop logstash`

## Installing Logstash Plugins

There are 4 kinds of Logstash plugins:
* Input Plugins
* Filter Plugins
* Output Plugins
* Codec Plugins

Installed Logstash plugins should be up to date before installing new ones.

### Update existing plugins
Run the following command (as root):
**Debian based systems**
`/etc/default/logstash/bin/logstash-plugin update`

**Red Hat based systems**
`/usr/share/logstash/bin/logstash-plugin update`

:warning:**Important Notes**
* Sometimes as new versions of Logstash are released the directory changes. Currently, August 16, 2021 for Logstash 7.14.0, the full command is this one: `/usr/share/logstash/bin/logstash-plugin update`
* If you don't know where the file is located, you can run: `find / -name logstash-plugin`

<br>

### Installing other need plugins
It is mandatory to install Filter-Range plugin.

To do so run the following command (as root):
**Debian based systems**
`/etc/default/logstash/bin/logstash-plugin install logstash-filter-range`

**Red Hat based systems**
`/usr/share/logstash/bin/logstash-plugin install logstash-filter-range`

### Other plugins that might be needed
In some cases, like when using Elasticsearch is in AWS environments, __output-amazon_es__ plugin must also be installed:

To do so run the following command (as root):
**Debian based systems**
`/etc/default/logstash/bin/logstash-plugin install logstash-output-amazon_es`

**Red Hat based systems**
`/usr/share/logstash/bin/logstash-plugin install logstash-output-amazon_es`

## Relevant information
Everything you need to know about Logstash Plugins can be found in [Logstash Official Page](https://www.elastic.co/guide/en/logstash/current/index.html).

gha_language: Shell


text:
# Upgrade Guide

This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md).

## 4.0.0

Drops support of Node.js 10, upgrades to `readable-stream@4` ([`082b8d6`](https://github.com/Level/level-ws/commit/082b8d6)) and uses classes which means `new` is now required. If you previously did:

```js
const WriteStream = require('level-ws')
const ws = WriteStream(db)
```

You must now do:

```js
const WriteStream = require('level-ws')
const ws = new WriteStream(db)
```

## 3.0.0

This release drops support of legacy runtime environments ([Level/community#98](https://github.com/Level/community/issues/98)):

- Node.js 6 and 8
- Internet Explorer 11
- Safari 9-11
- Stock Android browser (AOSP).

## 2.0.0

Dropped node 9 and upgraded to [`readable-stream@3`](https://github.com/nodejs/readable-stream#version-3xx).

## 1.0.0

Dropped support for node 0.10, 0.12, 2, 3, 4 and 5.

---

The API only exports a single function and no longer patches `levelup`.

So if you previously did:

```js
var ws = require('level-ws')
var db = ws(level('DB'))
var stream = db.createWriteStream()
```

You should now do:

```js
var WriteStream = require('level-ws')
var db = level('DB')
var stream = WriteStream(db)
```

---

The parameters to the stream constructor were flipped.

So if you previously did:

```js
var WriteStream = require('level-ws').WriteStream
var db = level('DB')
var stream = WriteStream({ type: 'del' }, db)
```

You should now do:

```js
var WriteStream = require('level-ws')
var db = level('DB')
var stream = WriteStream(db, { type: 'del' })
```

---

The behavior of `maxBufferLength` was changed. Previously all write operations exceeding `maxBufferLength` in the same tick were dropped. Instead the stream is now paused until a batch has been flushed and unpaused once the batch has been completed.

---

`WriteStream#destroySoon()` was removed.

---

Internally `this.writable` and `this.readable` were removed. However, `this.writable` still exists due to inheritance, but `this.readable` is now `undefined`.

---

Default `'utf8'` encoding was removed and also per stream encodings. However, it's still possible to specify encodings for individual entries. This means if you previously relied on per stream encodings, you must specify this in calls to `.write()`:

```js
writeStream.write({
  key: new Buffer([1, 2, 3]),
  value: { some: 'json' },
  keyEncoding: 'binary',
  valueEncoding : 'json'
})
```

repository: Level/level-ws

repo_name: Level/level-ws


text:
# fplib
Functional programming goodies for Python. Inspired by [PyMonad](https://github.com/fnl/pymonad),
[monet.js](https://monet.github.io/monet.js/), and [Scalaz](https://github.com/scalaz/scalaz).

# Todos
  - [x] Tests for all Monoid instances.
  - [x] Tests for all Functor, Applicative, and Monad instances.
  - [x] Complete Maybe interace (getOrElse, filter, orElse, ...).
  - [ ] Complete List interface (take, drop, takeWhile, ...).
  - [x] Add Monad transformers.
  - [ ] Add extra monad classes: MonadPlus, MonadZero, MonadState, MonadWrite, etc.
  - [ ] Add extra monads: Pairs, Either, Writer, Free, Continuation.
  - [ ] Define convenience monad functions: sequence, when, join, etc.
  - [ ] Add Kleisli stuff: composition, filterM, mapM, foldM, etc.
  - [ ] Add Traversable and Foldable classes.
  - [ ] Co stuff: CoFunctors, CoMonads, CoApplicatives
  - [ ] General categorical stuff: Adjoints, Natural transformations, Yoneda, Bifunctors.

repository: ppedemon/fplib

repo_name: ppedemon/fplib


text:
# OBO Metadata Ontology (OMO)

The OBO Metadata Ontology (OMO) specifies terms that are used to annotate ontology terms for all OBO ontologies. The ontology was developed as part of Information Artifact Ontology (IAO) before.

gha_language: Makefile


text:
roboot
====
####Scaffolding for Robot Framework

Directory Structure
----
* tests:  This is where your test cases resides.
* env: Execution environment configuration files.
* lib: Test libraries written in Java/Python/etc.
* res: Resource directory, keep your keywords, variables.
* docs: You can document necessary xpaths, id, etc.
* scripts: Necessary helper scripts.

Installation
----
```
python setup.py install
```

Usage
----
```
roboot init test-project
```

License
---
MIT License

Copyright (c) 2016 Akash Shende

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

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

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


text:
## BTGisterPost (modded) for XCode 5

Credits to original developer LogikBlitz for the plugin from which this project is forked.

His version of the plugin made for Xcode 5 did not seem to work correctly (posted all gists anonymously and occasionally crashed, for me at least) so I converted his original Xcode4 version of the project to use ARC and added the necessary DVTCompatibility UUIDs for Xcode 5. It seems to work fine on my machine. Results may vary.

I have not tested on Xcode 6 but assuming there haven't been too many changes it should work fine there also. Add the necessary DVTCompatibilityUUIDs to the info.plist file (run "defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID" to find it).

## What is this

A small plug-in for Xcode 5 that allows for posting of Gist's directly from Xcode.

### Getting started

I have attached a plugin binary in the releases page and that is probably the easiest version to get it.

Alternatively, you can also build the plug-in directly from the source:
* Clone this repository.
* Open the project in Xcode 5+
* Build the solution -- the plug-in will automatically be installed to `~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/`
*   Hopefully you get no errors during build
* Restart Xcode for the plug-in to be activated.

#### How to use the plug-in
In Xcode the plug-in will add a new menu-point in the `edit` menu: `Post Gist To Github`.
Alternatively you can also use the shortcut `⌥ + c` i.e. `(option + c)`
to trigger the plug-in.
It will use the currently selected text to create a gist.
If no text is selected all text in the current open document will be converted into a gist.

##### GitHub user credentials.
To post a gist the plug-in requires a **username*** and **password** to a valid GitHub account. Your information is not in any way used for anything else but creating Gist's. If you have any concerns feel free to check the source.

### Uninstall
To uninstall the plug-in simply delete it from the folder where it resides:
`~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/BTGisterPost.xcplugin`

### Dependencies
The plug-in uses a modified version of [UAGithubEngine](https://github.com/owainhunt/uagithubengine) for GitHub communication. It is included within the source files.

### Contributions
If you would like to contribute to the plug-in, simply fork the project and submit a pull request. See [GitHub help](https://help.github.com/articles/fork-a-repo)

### License
The MIT License (MIT)

Copyright (c) 2013 Thomas Blitz

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: pranav-prakash/BTGisterPost

repo_name: pranav-prakash/BTGisterPost


text:
# [200. Number of Islands][enTitle]

**Medium**

Given a 2d grid map of  *'1'* s (land) and  *'0'* s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.

Example 1:

```
Input:
11110
11010
11000
00000

Output: 1

```

Example 2:

```
Input:
11000
11000
00100
00011

Output:3

```
# [200. 岛屿数量][cnTitle]

**中等**

给定一个由  *'1'* （陆地）和  *'0'* （水）组成的的二维网格，计算岛屿的数量。一个岛被水包围，并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。

**示例 1:**

```
输入:
11110
11010
11000
00000

输出: 1

```

**示例 2:**

```
输入:
11000
11000
00100
00011

输出:3

```

# 算法思路

# 测试用例
```
200. Number of Islands 200. 岛屿数量 Medium
Solution.numIslands
Solution.numIslands2
---
[["1","1","1","1","0"],["1","1","0","1","0"],["1","1","0","0","0"],["0","0","0","0","0"]]

=1
---
[["1","1","0","0","0"],["1","1","0","0","0"],["0","0","1","0","0"],["0","0","0","1","1"]]

=3
---
[]

=0

```

[enTitle]: https://leetcode.com/problems/number-of-islands/
[cnTitle]: https://leetcode-cn.com/problems/number-of-islands/

repository: philippzhang/leetcodeLearnJava

gha_language: Java

repo_name: philippzhang/leetcodeLearnJava


text:
# Conditionals

If statements check some conditions and go to some branch of code i.e other memory locations.

This can also reduce speed so for omtimization.

== -> check queality , this has been overloaded by function

```c++
#include <iostream>

int main()
{
    int x = 5;
    if (x == 5)
    {
        std::cout << "Yes this is equal to five" << std::endl;
    }
    std::cout << "Hello World!\n";
}
```

```c++
#include <iostream>

int main()
{
    int x = 5;
    if (x == 5)
    {
        std::cout << "Yes this is equal to five" << std::endl;
    }
    else if (x == 6)
    {
        std::cout << "Yes this is equal to six" << std::endl;
    }
    else {
        std::cout << "Yes this is equal to other than 5 or 6" << std::endl;
    }
    std::cout << "Hello World!\n";
}
```

Lets see what a namespace is.It solves the problem of name conflict.

Like there may be same name of functions so we can tell compiler using namespace.

repository: Arslan-Z/cplusplusCHERNO

repo_name: Arslan-Z/cplusplusCHERNO


text:
---
slug: /poscreators/middleware-doc/germany
title: Introduction
---

This appendix expands on the General Part's information by adding details specific to the German market. This additional information is provided only where applicable. The remaining chapters, for which there is no further information required, were omitted.

Please note that this information is only complete when combined with the General part. To implement the Middleware, users should get themselves familiar with the general information first and then refer to the country-specific details listed here.

repository: fiskaltrust/interface-doc

repo_name: fiskaltrust/interface-doc


text:
---
title: Announcing Fluxo 1.0, a Kanban Dashboard for Trello
date: 2015-05-05 07:16:00.000000000 +02:00
tags:
  - DashBoards
  - Fluxo
  - Kanban
  - Personal
  - Trello
permalink: "/2015/05/05/announcing-fluxo-1-0-a-kanban-dashboard-for-trello/"
---

Now that’s a great milestone Hugo but can you tell me what’s new in this release?

-Almost nothing, but let’s turn the clock back a week…

About a week ago on my way to work I started to notice how my Kanban dashboard had some trouble loading. Naturally I opened up the developer tools in Chrome and noticed a lot of “429 Too Many Requests” errors. (The Trello api has a Rate Limit that you can read about here [http://help.trello.com/article/838-api-rate-limits](http://help.trello.com/article/838-api-rate-limits) )

That’s odd, it can’t be that many people using Fluxo at this time in the morning I thought to myself, and then it hit me. Someone had probably hijacked my Trello application key because I was using Trello’s own Client.js with the key and it was all stored on GitHub in a public repo.

From Trello’s on how to use their Client.js documentation:

```html
<head>
  <!-- ...  -->
  <!-- The client library requires jQuery  -->
  <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
  <script src="https://api.trello.com/1/client.js?key=substitutewithyourapplicationkey"></script>
  <!-- ...  -->
</head>
```

I remember thinking that this client side key exposure could cause some issues the first time I started to use it but I hadn't thought about it ever since.

Anyways I decided to do a complete rewrite and use a server side OAuth solution instead. And last Friday I actually finished it.

To sum it up Fluxo now uses a server side OAuth solution and I also added a 5 minute caching on all requests to prevent hitting the Rate Limit of 300 requests per 10 seconds.

This time no keys are stored in the repo, a lesson I’ve learned the hard but funny way,

Hugo


text:
# Raymond Changelog

### Raymond 1.1.0 _(June 15, 2015)_

- Permits templates references with lowercase versions of struct fields.
- Adds `ParseFile()` function.
- Adds `RegisterPartialFile()`, `RegisterPartialFiles()` and `Clone()` methods on `Template`.
- Helpers can now be struct methods.
- Ensures safe concurrent access to helpers and partials.

### Raymond 1.0.0 _(June 09, 2015)_

- This is the first release. Raymond supports almost all handlebars features. See https://github.com/aymerick/raymond#limitations for a list of differences with the javascript implementation.

repository: chatkit/drone-slack

gha_language: Go

repo_name: chatkit/drone-slack


text:
# MATRIX

MATRIX is an MPC Test Automation Framework developed by [Bar Ilan University Cryptography Research Group](http://crypto.biu.ac.il/).
It automates the tedious process of deploying, running, monitoring and summarizing results.
It uses AWS or Scaleway to provision servers(instances), and can be used internally on a local host or in a container deployment. A [paper](https://eprint.iacr.org/2018/751) featuring MATRIX was prensented in ACM-CCS18

The system requires a management computer (Manager) - a computer that centralized all the execution.
The Manager executes all the experiment phases, starting from install the experiment up to analyse it's results.
The Manager is a stand alone workstation and it's not part of the workstations that participate in the experiment.

In order to use all MATRIX capabilities, a cloud account is required.
MATRIX uses two cloud providers(CP):
1. AWS
2. Scaleway - for ARM computing resources

To create account at AWS:
* Sign up for [AWS](https://portal.aws.amazon.com/billing/signup#/start).
* Define your [credentials](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html) at the Manager computer.

To create account at Scaleway:
* Sign up for [Scaleway](https://www.scaleway.com/)

MATRIX uses two services of AWS:
1. Spot instances - The execution of the protocols is done by deploy spot instances. All the instances have the same AMI(Amazon Machine Image).
In most cases we are using a custom AMI that contains [libscapi](https://github.com/cryptobiu/libscapi). AMI are defined per region.
If you are executing an experiment on two different regions(locations), you will need to copy the AMI to the requested regions.
More on AMI can be found [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html).
2. Elasticsearch service - The analysis done by Elasticsearch (ES). All the results are uploaded and stored at ES.
Information on ES can be found [here](https://www.elastic.co/). We are also using the built in [Kibana](https://www.elastic.co/products/kibana)
plugin to visualize our results.

## Installation
MATRIX runs under python 3.5 and uses [fabric](https://github.com/fabric/fabric), [fabric3](https://pypi.python.org/pypi/Fabric3/1.10.2) and [openpyxl](https://openpyxl.readthedocs.io/en/stable/).
Matrix tested on these OSs:
* Ubuntu 16.04.3/18.04.1 LTS
* CentOS 7.3
* Arch Linux

To install Python 3 and pip under Ubuntu 16.04/18.04 :

`sudo apt-get install python3 python3-pip`

To install under CentOS 7.3:

`sudo yum install python35u.x86_64 python35u-pip.noarch`

To install under Arch Linux:

`pacman -S python python-pip`

After You installed Python 3 and pip3 you will need to install the modules MATRIX uses. To install this three modules use pip3

`pip3 install --user openpyxl 'fabric<2.0' fabric3 boto3 colorama certifi elasticsearch scaleway-sdk`

**NOTE**: on some computers the following error may appear: `locale.Error: unsupported locale setting`
To fix it, run:
1. `sudo apt-get clean && sudo apt-get update && sudo apt-get install -y locales`
2. `locale-gen en_US.UTF-8`

After the modules installed, clone this repository to install MATRIX on your system.

## MATRIX Modules

### Deployment

After config file was created, You will need to deploy your images(instances). MATRIX supports three different deployments:
1. Local deployment
2. Servers deployment
3. AWS deployment

#### Local Deployment

To deploy MATRIX locally set `regions` parameter to `local` at the config [file](../master/ProtocolsConfigurations/Config_BMR.json)

#### AWS Deployment

After you created your AWS account and set your credentials, you will need a key to deploy your instances.
Detailed explanation can be found [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html).
After you created your key, change this line at [fabfile.py](../master/ExperimentExecute/fabfile.py):

- set the correct location and name of your AWS key `env.key_filename = ['%s/Keys/matrix.pem' % Path.home()]`

### Execution

The execution module supports these operations:
1. Pre process - Operations that need to be done before the protocol executed like installation of library.
2. Install - Install the experiment.
3. Update - Update the current experiment if change was done to his code.
4. Execute - execute the protocol.
5. Results - Collect the results file from the images and analyse them. For more details see ExperimentReport section.
6. analyse - analyse the results from given directory.

### Reporting

MATRIX analyse four parameters:

1. CPU runtime (milliseconds)
2. RAM usage (GB) - Will be added in future release
3. Sent bytes (bytes) - Will be added in future release
4. Received bytes (bytes) - Will be added in future release

The report module analyse the results files that was taken from the images by number of parties parameter.
If you want to analyse by different parameter use the Elasticsearch option.

MATRIX uses a header class logger [API](../master/Reporting/MatrixMeasurement.h).
The logging is done at the protocol code. The logger generate logs files that uploaded to [Elasticsearch](https://www.elastic.co/) server.
To use MATRIX logger class, just include `MatrixMeasurement.h` to your main class.

To measure task:
```
#include "MatrixMeasurement.h"
...
int main(int argc, char* argv[])
{
    MatrixMeasurement matrixLogger(argc,argv,vector<string>{"offline","online"}, numberOfIterations);
...
    matrixLogger.startSubTask("offline", iterationIdx);
    offline.run();
    matrixLogger.endSubTask("offline", iterationIdx);
...
}

```

## MATRIX Configurations

### GlobalConfigurations

In order to connect to the instances MATRIX uses a file that contains the AWS keys and security groups.
For each region in AWS you need to create an entry in the global configuration file.
Sample configuration file can be found [here](../master/GlobalConfigurations/regions.json)

### ProtocolsConfigurations
MATRIX uses configuration file to set it execution. The configuration file is written in [json](https://en.wikipedia.org/wiki/JSON) format.
Each configuration file has the following fields:
* protocol - Name of protocol
* CloudProviders - for eac cloud provider we need to create a unique entry. each entry contains these fields:
    * numOfParties - number of instances to create.
    * instanceType
    * spotPrice - relevant only to AWS. For detailed explanation about spot instances, use this [link](https://aws.amazon.com/ec2/spot/)
    * git:
        * gitAddress - Git  repository path. MATRIX will clone the repository into all target servers, configure, make and install.
        If installation of other libraries is needed to be done, see pre-process section of MATRIX for details.
        * gitBranch - The branch the protocol uses.

* executableName - The name of the executable to execute
* preProcessTask - ID of the pre process task that required. Not relevant to all of the protocols.
The available pre process tasks that defines in MATRIX can be found in this [script](../master/ExperimentExecute/pre_process.py)
* Configurations - List of configurations to run. Each configuration is a set of CLI arguments to the executable.
The arguments are separated between them by '@'. Party ID is added automatically
* numOfRepetitions - How Many times MATRIX will execute the protocol
* numOfInternalRepetitions - How many times the protocol will be executed on single run.
* isPublished - Indicate if the protocol was published.
* isExternal - Indicate if the protocol external to libscapi library
* regions - AWS regions to execute the protocol.
* workingDirectory - The directory of the protocol and the data related to the protocol.
* resultsDirectory - Directory to copy to the results files from the servers. The directory is local directory at the MATRIX system computer.
* emails - MATRIX will send notifications to this email addresses. Multiple email addresses are supported
* institute - Research Group identifier
* coordinatorConfig - If coordinator exists in the protocol, the configuration for him will described here.
The configuration need to be in the same format of 'configurations' field
* coordinatorExecutable - The name of the coordinator executable

### MATRIX Usage

In order to receive easy access to the MATRIX system, MATRIX uses basic CLI. To run the CLI run: `python3 main.py`

For bugs/features requests open an issue or send mail to<EMAIL_ADDRESS>

repository: nitrieu/MATRIX

repo_name: nitrieu/MATRIX


text:
sentry-kubernetes
=================

Errors and warnings in Kubernetes often go unnoticed by operators. Even when they are checked they are hard to read and understand in the context of what else is going on in the cluster. `sentry-kubernetes` is a small container you launch inside your Kubernetes cluster that will send errors and warnings to Sentry where they will be cleanly presented and intelligently grouped. Typical Sentry features such as notifications can then be used to help operation and developer visibility.

Create a new project on [Sentry](http://sentry.io/) and use your DSN when launching the `sentry-kubernetes` container:

    kubectl run sentry-kubernetes \
      --image getsentry/sentry-kubernetes \
      --env="DSN=$YOUR_DSN"

---

Events are grouped in Sentry:

![1](/1.png)

---

They come with useful tags for filtering, and breadcrumbs showing events that occurred prior to the warning/error:

![2](/2.png)

---

And include all of the extra data attached to the event:

![3](/3.png)

repository: gianrubio/sentry-kubernetes

repo_name: gianrubio/sentry-kubernetes


text:
## Service Runtime

The Service Runtime allows you to interact with the machine environment where the current role is running. Please note that these commands will only work if your code is running in a worker role inside the Azure emulator or in the cloud.

The **isAvailable** method lets you determine whether the service runtime endpoint is running on the local machine.  It is good practice to enclose any code that
uses service runtime in the isAvailable callback.

```JavaScript
azure.RoleEnvironment.isAvailable(function(error, available) {
  if (available) {
    // Place your calls to service runtime here
  }
});
```

The **getConfigurationSettings** method lets you obtain values from the role's .cscfg file.

```Javascript
azure.RoleEnvironment.getConfigurationSettings(function(error, settings) {
  if (!error) {
    // You can get the value of setting "setting1" via settings['setting1']
  }
});
```

The **getLocalResources** method lets you find the path to defined local storage resources for the current role.  For example, the DiagnosticStore
resource which is defined for every role provides a location for runtime diagnostics and logs.

```Javascript
azure.RoleEnvironment.getLocalResources(function(error, resources) {
  if(!error){
    // You can get the path to the role's diagnostics store via
    // resources['DiagnosticStore']['path']
  }
});
```

The **getCurrentRoleInstance** method lets you obtain information about endpoints defined for the current role instance:

```JavaScript
azure.RoleEnvironment.getCurrentRoleInstance(function(error, instance) {
  if (!error && instance['endpoints']) {
    // You can get information about "endpoint1" such as its address and port via
    // instance['endpoints']['endpoint1']['address'] and instance['endpoints']['endpoint1']['port']
  }
});
```

The **getRoles** method lets you obtain information about endpoints in role instances running on other machines:

```Javascript
azure.RoleEnvironment.getRoles(function(error, roles) {
  if(!error){
    // You can get information about "instance1" of "role1" via roles['role1']['instance1']
  }
});
```

repository: Azure/azure-sdk-for-node

repo_name: Azure/azure-sdk-for-node