text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico" />
<title>Attributes - Android SDK | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../../assets/css/default.css" rel="stylesheet" type="text/css">

<link href="../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">

          	Quicknav
			      Quicknav

                  Design

Develop

Distribute

Links

Google Play Developer Console

Android Developers Blog

About Android

Android Sites

Android.com

Android Developers

Android Open Source Project

      <form onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../')"
onkeyup="return search_changed(event, false, '../../../../')" />
      </form>

        close

Get Started

Style

Patterns

Building Blocks

Downloads

Videos

Training

API Guides

Reference

Tools

Get the SDK

Google Services

Google Play

Publishing

Promoting

App Quality

Spotlight

Open Distribution

Results

Loading...

Training

API Guides

Reference

Tools

Google Services

to top

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.app

  android.app.admin

  android.app.backup

  android.appwidget

  android.bluetooth

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.display

  android.hardware.input

  android.hardware.location

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.effect

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.service.dreams

  android.service.notification

  android.service.textservice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.v13.app

  android.support.v4.accessibilityservice

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.database

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.media

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.view

  android.support.v7.widget

  android.support.v8.renderscript

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http

  org.apache.http.auth

  org.apache.http.auth.params

  org.apache.http.client

  org.apache.http.client.entity

  org.apache.http.client.methods

  org.apache.http.client.params

  org.apache.http.client.protocol

  org.apache.http.client.utils

  org.apache.http.conn

  org.apache.http.conn.params

  org.apache.http.conn.routing

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.conn.util

  org.apache.http.cookie

  org.apache.http.cookie.params

  org.apache.http.entity

  org.apache.http.impl

  org.apache.http.impl.auth

  org.apache.http.impl.client

  org.apache.http.impl.conn

  org.apache.http.impl.conn.tsccm

  org.apache.http.impl.cookie

  org.apache.http.impl.entity

  org.apache.http.impl.io

  org.apache.http.io

  org.apache.http.message

  org.apache.http.params

  org.apache.http.protocol

  org.apache.http.util

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

Pack200.Packer

Pack200.Unpacker

Classes

Attributes

Attributes.Name

JarEntry

JarFile

JarInputStream

JarOutputStream

Manifest

Pack200

Exceptions

JarException

      fullscreen
      Use Tree NavigationUse Panel Navigation

Summary:

  Nested Classes

  | Fields

  | Ctors

  | Methods

  | Inherited Methods

| [Expand All]

  Added in API level 1

    public

    class

Attributes

    extends Object

      implements

        Cloneable

        Map<K, V>

        java.lang.Object

               ↳

        java.util.jar.Attributes

Class Overview

The Attributes class is used to store values for manifest entries.
 Attribute keys are generally instances of Attributes.Name. Values
 associated with attribute keys are of type String.

Summary

Nested Classes

      <nobr>

        class</nobr>
      Attributes.Name
      The name part of the name/value pairs constituting an attribute as
 defined by the specification of the JAR manifest.

Fields

          <nobr>
          protected

          Map<Object, Object></nobr>
          map
          The Attributes as name/value pairs.

Public Constructors

        <nobr>

            </nobr>

        <nobr>
        Attributes()</nobr>

Constructs an Attributes instance.

        <nobr>

            </nobr>

        <nobr>
        Attributes(Attributes attrib)</nobr>

Constructs an Attributes instance obtaining keys and values from
 the parameter attrib.

        <nobr>

            </nobr>

        <nobr>
        Attributes(int size)</nobr>

Constructs an Attributes instance with initial capacity of size
 size.

Public Methods

        <nobr>

            void</nobr>

        <nobr>
        clear()</nobr>

Removes all key/value pairs from this Attributes.

        <nobr>

            Object</nobr>

        <nobr>
        clone()</nobr>

Creates and returns a copy of this Object.

        <nobr>

            boolean</nobr>

        <nobr>
        containsKey(Object key)</nobr>

Determines whether this Attributes contains the specified key.

        <nobr>

            boolean</nobr>

        <nobr>
        containsValue(Object value)</nobr>

Determines whether this Attributes contains the specified value.

        <nobr>

            Set<Entry<Object, Object>></nobr>

        <nobr>
        entrySet()</nobr>

Returns a set containing map entries for each of the key/value pair
 contained in this Attributes.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object obj)</nobr>

Determines if this Attributes and the parameter Attributes are equal.

        <nobr>

            Object</nobr>

        <nobr>
        get(Object key)</nobr>

Returns the value associated with the parameter key.

        <nobr>

            String</nobr>

        <nobr>
        getValue(String name)</nobr>

Returns the string associated with the parameter name.

        <nobr>

            String</nobr>

        <nobr>
        getValue(Attributes.Name name)</nobr>

Returns the value associated with the parameter Attributes.Name
 key.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

Returns the hash code of this Attributes.

        <nobr>

            boolean</nobr>

        <nobr>
        isEmpty()</nobr>

Determines whether this Attributes contains any keys.

        <nobr>

            Set<Object></nobr>

        <nobr>
        keySet()</nobr>

Returns a Set containing all the keys found in this Attributes.

        <nobr>

            Object</nobr>

        <nobr>
        put(Object key, Object value)</nobr>

Stores key/value pairs in this Attributes.

        <nobr>

            void</nobr>

        <nobr>
        <a href="../../../../reference/java/util/jar/Attributes.html#putAll(java.util.Map<?, ?>)">putAll(Map<?, ?> attrib)</nobr>

Stores all the key/value pairs in the argument in this Attributes.

        <nobr>

            String</nobr>

        <nobr>
        putValue(String name, String value)</nobr>

Stores the value value associated with the key name in this
 Attributes.

        <nobr>

            Object</nobr>

        <nobr>
        remove(Object key)</nobr>

Deletes the key/value pair with key key from this Attributes.

        <nobr>

            int</nobr>

        <nobr>
        size()</nobr>

Returns the number of key/value pairs associated with this Attributes.

        <nobr>

            Collection<Object></nobr>

        <nobr>
        values()</nobr>

Returns a collection of all the values present in this Attributes.

  [Expand]

Inherited Methods

From class

  java.lang.Object

        <nobr>

            Object</nobr>

        <nobr>
        clone()</nobr>

Creates and returns a copy of this Object.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object o)</nobr>

Compares this instance with the specified object and indicates if they
 are equal.

        <nobr>

            void</nobr>

        <nobr>
        finalize()</nobr>

Invoked when the garbage collector has detected that this instance is no longer reachable.

        <nobr>

            final

            Class<?></nobr>

        <nobr>
        getClass()</nobr>

Returns the unique instance of Class that represents this
 object's class.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

Returns an integer hash code for this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        notify()</nobr>

Causes a thread which is waiting on this object's monitor (by means of
 calling one of the wait() methods) to be woken up.

        <nobr>

            final

            void</nobr>

        <nobr>
        notifyAll()</nobr>

Causes all threads which are waiting on this object's monitor (by means
 of calling one of the wait() methods) to be woken up.

        <nobr>

            String</nobr>

        <nobr>
        toString()</nobr>

Returns a string containing a concise, human-readable description of this
 object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait()</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis, int nanos)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

From interface

  java.util.Map

        <nobr>
            abstract

            void</nobr>

        <nobr>
        clear()</nobr>

Removes all elements from this Map, leaving it empty.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        containsKey(Object key)</nobr>

Returns whether this Map contains the specified key.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        containsValue(Object value)</nobr>

Returns whether this Map contains the specified value.

        <nobr>
            abstract

            Set<Entry<K, V>></nobr>

        <nobr>
        entrySet()</nobr>

Returns a Set containing all of the mappings in this Map.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        equals(Object object)</nobr>

Compares the argument to the receiver, and returns true if the
 specified object is a Map and both Maps contain the same mappings.

        <nobr>
            abstract

            V</nobr>

        <nobr>
        get(Object key)</nobr>

Returns the value of the mapping with the specified key.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        hashCode()</nobr>

Returns an integer hash code for the receiver.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        isEmpty()</nobr>

Returns whether this map is empty.

        <nobr>
            abstract

            Set<K></nobr>

        <nobr>
        keySet()</nobr>

Returns a set of the keys contained in this Map.

        <nobr>
            abstract

            V</nobr>

        <nobr>
        put(K key, V value)</nobr>

Maps the specified key to the specified value.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        <a href="../../../../reference/java/util/Map.html#putAll(java.util.Map<? extends K, ? extends V>)">putAll(Map<? extends K, ? extends V> map)</nobr>

Copies every mapping in the specified Map to this Map.

        <nobr>
            abstract

            V</nobr>

        <nobr>
        remove(Object key)</nobr>

Removes a mapping with the specified key from this Map.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        size()</nobr>

Returns the number of mappings in this Map.

        <nobr>
            abstract

            Collection<V></nobr>

        <nobr>
        values()</nobr>

Returns a Collection of the values contained in this Map.

Fields

        protected

        Map<Object, Object>

        map

  Added in API level 1

The Attributes as name/value pairs. Maps the attribute names (as
 Attributes.Name) of a JAR file manifest to arbitrary values. The
 attribute names thus are obtained from the Manifest for
 convenience.

Public Constructors

        public

      Attributes
      ()

  Added in API level 1

Constructs an Attributes instance.

        public

      Attributes
      (Attributes attrib)

  Added in API level 1

Constructs an Attributes instance obtaining keys and values from
 the parameter attrib.

Parameters

          attrib
          The attributes to obtain entries from.

        public

      Attributes
      (int size)

  Added in API level 1

Constructs an Attributes instance with initial capacity of size
 size.

Parameters

          size
          Initial size of this Attributes instance.

Public Methods

        public

        void

      clear
      ()

  Added in API level 1

Removes all key/value pairs from this Attributes.

        public

        Object

      clone
      ()

  Added in API level 1

Creates and returns a copy of this Object. The default
 implementation returns a so-called "shallow" copy: It creates a new
 instance of the same class and then copies the field values (including
 object references) from this instance to the new instance. A "deep" copy,
 in contrast, would also recursively clone nested objects. A subclass that
 needs to implement this kind of cloning should call super.clone()
 to create the new instance and then create deep copies of the nested,
 mutable objects.

Returns

a copy of this object.

        public

        boolean

      containsKey
      (Object key)

  Added in API level 1

Determines whether this Attributes contains the specified key.

Parameters

          key
          The key to search for.

Returns

true if the key is found, false otherwise.

        public

        boolean

      containsValue
      (Object value)

  Added in API level 1

Determines whether this Attributes contains the specified value.

Parameters

          value
          the value to search for.

Returns

true if the value is found, false otherwise.

        public

        Set<Entry<Object, Object>>

      entrySet
      ()

  Added in API level 1

Returns a set containing map entries for each of the key/value pair
 contained in this Attributes.

Returns

a set of Map.Entry's

        public

        boolean

      equals
      (Object obj)

  Added in API level 1

Determines if this Attributes and the parameter Attributes are equal. Two Attributes instances are equal if they
 contain the same keys and values.

Parameters

          obj
          the object with which this Attributes is compared.

Returns

true if the Attributes are equal, false
         otherwise.

        public

        Object

      get
      (Object key)

  Added in API level 1

Returns the value associated with the parameter key.

Parameters

          key
          the key to search for.

Returns

Object associated with key, or null if key does not
         exist.

        public

        String

      getValue
      (String name)

  Added in API level 1

Returns the string associated with the parameter name.

Parameters

          name
          the key to obtain the value for.

Returns

the string associated with name, or null if name is not a
         valid key.

        public

        String

      getValue
      (Attributes.Name name)

  Added in API level 1

Returns the value associated with the parameter Attributes.Name
 key.

Parameters

          name
          the key to obtain the value for.

Returns

the String associated with name, or null if name
         is not a valid key.

        public

        int

      hashCode
      ()

  Added in API level 1

Returns the hash code of this Attributes.

Returns

the hash code of this object.

        public

        boolean

      isEmpty
      ()

  Added in API level 1

Determines whether this Attributes contains any keys.

Returns

true if one or more keys exist, false otherwise.

        public

        Set<Object>

      keySet
      ()

  Added in API level 1

Returns a Set containing all the keys found in this Attributes.

Returns

a Set of all keys.

        public

        Object

      put
      (Object key, Object value)

  Added in API level 1

Stores key/value pairs in this Attributes.

Parameters

          key
          the key to associate with value.

          value
          the value to store in this Attributes.

Returns

the value being stored.

Throws

            ClassCastException
            when key is not an Attributes.Name or value is not
                a String.

<A NAME="putAll(java.util.Map<?, ?>)">

        public

        void

      putAll
      (Map<?, ?> attrib)

  Added in API level 1

Stores all the key/value pairs in the argument in this Attributes.

Parameters

          attrib
          the associations to store (must be of type Attributes).

        public

        String

      putValue
      (String name, String value)

  Added in API level 1

Stores the value value associated with the key name in this
 Attributes.

Returns

the value being stored.

        public

        Object

      remove
      (Object key)

  Added in API level 1

Deletes the key/value pair with key key from this Attributes.

Parameters

          key
          the key to remove.

Returns

the values associated with the removed key, null if not
         present.

        public

        int

      size
      ()

  Added in API level 1

Returns the number of key/value pairs associated with this Attributes.

Returns

the size of this Attributes.

        public

        Collection<Object>

      values
      ()

  Added in API level 1

Returns a collection of all the values present in this Attributes.

Returns

a collection of all values present.

  Except as noted, this content is licensed under Apache 2.0.
  For details and restrictions, see the
  Content License.

    Android 4.4 r1 —

    About Android  |
    Legal  |
    Support


text:
package me.nlighten.backend.db.dao;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.NoResultException;

import me.nlighten.backend.db.dao.exception.DAOException;
import me.nlighten.backend.db.dao.exception.DAOMessageException;
import me.nlighten.backend.db.model.Course;

/**
 * The Class CourseDAO.
 *
 * @author Lubo
 */
@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class CourseDAO extends GenericDAO<Course> {

  /**
   * Load by id.
   *
   * @param graphName the graph name
   * @param id the id
   * @return the course
   * @throws DAOException the DAO exception
   */
  public Course loadById(String graphName, Long id) throws DAOException {
    try {
      return (Course) getEm().createNamedQuery(Course.LOAD_BY_ID).setParameter("id", id)
          .setHint("javax.persistence.loadgraph", getEm().getEntityGraph(graphName))
          .getSingleResult();
    } catch (NoResultException nre) {
      return null;
    } catch (Exception e) {
      throw new DAOException(DAOMessageException.COULD_NOT_FIND_OBJECT_BY_ID, e);
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.lang.jsgraphql.psi;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface GraphQLObjectField extends GraphQLNamedElement {

  @Nullable
  GraphQLValue getValue();

  @NotNull
  GraphQLIdentifier getNameIdentifier();

}


text:
package org.apache.shardingsphere.underlying.common.database.type;

import org.apache.shardingsphere.underlying.common.database.metadata.DataSourceMetaData;

import java.util.Collection;

/**
 * Database type.
 */
public interface DatabaseType {

    /**
     * Get database name.
     *
     * @return database name
     */
    String getName();

    /**
     * Get alias of JDBC URL prefixes.
     *
     * @return Alias of JDBC URL prefixes
     */
    Collection<String> getJdbcUrlPrefixAlias();

    /**
     * Get data source meta data.
     *
     * @param url URL of data source
     * @param username username of data source
     * @return data source meta data
     */
    DataSourceMetaData getDataSourceMetaData(String url, String username);
}


text:
import * as merge from "deepmerge";
import fileUrl = require("file-url");
import * as path from "path";
import * as phantom from "phantom";
import * as request from "request";

declare var window: any;
declare var recurly: any;
declare var $: any;

/**
 * Can be used to mock Recurly.js functionality during automated testing.
 */
export class RecurlyJsMock {

  /**
   * Spins up a headless browser instance, creates a Recurly.js compliant form,
   * inputs the desired data and returns the Recurly.js token.
   *
   * @param publicApiKey The public API key of the Recurly account to be used
   * @param logLevel The desired log level. Can be debug, info, warn or error.
   * @param details The payment information to be used to fill out the form
   */
  public static getTokenSingleRun(
    publicApiKey: string,
    logLevel: LogLevel = LogLevel.Error,
    details?: PaymentDetails): Promise<RecurlyToken> {

    return new Promise<RecurlyToken>(async (resolve, reject) => {

      /*
       * The PhantomJs instance has to be run with web security turned off in order
       * to allow accessing iframe contents.
       */
      const instance = await phantom.create(
        ["--web-security=no"],
        { logLevel: RecurlyJsMock.getLogLevelConfiguration(logLevel) }
      );
      const page = await instance.createPage();

      /*
       * Listen for callbacks from client JS. This is used to detect when Recurly.js
       * has finished processing payment information and the token is ready to
       * be collected.
       */
      await page.on("onCallback", async (data: Callback) => {
        switch (data.status) {
          case "success":
            resolve(data.token);
            await instance.exit();
            break;
          case "error":
            reject(data.err);
            await instance.exit(1);
            break;
          default:
            reject();
            await instance.exit(2);
            break;
        }
      });

      /*
       * Listen to resource requested events for debugging purposes.
       */
      await page.on("onResourceRequested", (requestData) => {
        instance.logger.debug("Requesting", requestData.url);
      });

      /*
       * Load the html form.
       */
      const status = await page.open(fileUrl(path.resolve(__dirname, "recurlyJsMock.html")));
      instance.logger.debug(status);

      /*
       * Load required JS libraries.
       */
      await page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js");
      await page.includeJs("https://js.recurly.com/v4/recurly.js");

      /*
       * Configure Recurly.js
       */
      await page.evaluate((key) => {
        recurly.configure({
          publicKey: key
        });
      }, publicApiKey);

      const content = await page.property("content");
      instance.logger.debug(content);

      // Listen for Recurly.js
      await page.evaluate(() => {

        // On form submit, we stop submission to get the token
        $("form").on("submit", function(event) {
          // Prevent the form from submitting while we retrieve the token from Recurly
          event.preventDefault();

          const form = this;
          // Now we call recurly.token with the form. It goes to Recurly servers
          // to tokenize the credit card information, then injects the token into the
          // data-recurly="token" field above
          recurly.token(form, (err, token) => {
            let result: Callback;
            if (err) {
                result = { status: "error", err };
            } else {
                result = { status: "success", token };
            }
            window.callPhantom(result);
          });
        });
      });

      /*
       * Fill out form and submit
       */
      await page.evaluate((paymentDetails: PaymentDetails) => {
        $("#number iframe").first().contents().find("input").first().val(paymentDetails.cardData.number);
        $("#month iframe").first().contents().find("input").first().val(paymentDetails.cardData.month);
        $("#year iframe").first().contents().find("input").first().val(paymentDetails.cardData.year);
        $("#first_name").val(paymentDetails.cardData.firstName);
        $("#last_name").val(paymentDetails.cardData.lastName);
        $("#address1").val(paymentDetails.address1);
        $("#city").val(paymentDetails.city);
        $("#country").val(paymentDetails.country);
        $("#postal_code").val(paymentDetails.postalCode);
        $("form").submit();
      }, RecurlyJsMock.mergeWithDefaults(details));

    });

  }

  /**
   * Returns the Recurly.js token without running a headless browser.
   *
   * @param publicApiKey The public API key of the Recurly account to be used
   * @param logLevel The desired log level. Can be debug, info, warn or error.
   * @param details The payment information to be used
   */
  public static getTokenAPICall(
    publicApiKey: string,
    logLevel: LogLevel = LogLevel.Error,
    details?: PaymentDetails): Promise<RecurlyToken> {

    if (details == null) {
      details = {};
    }

    return new Promise<RecurlyToken>((resolve, reject) => {
      const url = "https://api.recurly.com/js/v1/token";
      const data = RecurlyJsMock.mergeWithDefaults(details);
      const formData = {
        address1: data.address1 ? data.address1 : "",
        address2: data.address2 ? data.address2 : "",
        city: data.city ? data.city : "",
        country: data.country ? data.country : "",
        cvv: data.cardData.cvv ? data.cardData.cvv : "",
        first_name: data.cardData.firstName ? data.cardData.firstName : "",
        key: publicApiKey,
        last_name: data.cardData.lastName ? data.cardData.lastName : "",
        month: data.cardData.month ? data.cardData.month : "",
        number: data.cardData.number ? data.cardData.number : "",
        phone: data.phone ? data.phone : "",
        postal_code: data.postalCode ? data.postalCode : "",
        state: data.state ? data.state : "",
        vat_number: data.vatNumber ? data.vatNumber : "",
        year: data.cardData.year ? data.cardData.year : ""
      };
      request.post({ url, formData }, (err, res, body) => {
        if (err || res.statusCode !== 200) {
          reject(err);
        } else {
          body = JSON.parse(body);
          // Recurly API fails to respond with proper error code
          if (body.hasOwnProperty("error")) {
            reject(body.error);
          } else {
            resolve(body);
          }
        }
      });
    });
  }

  private static getLogLevelConfiguration(logLevel: LogLevel): string {
    switch (logLevel) {
      case LogLevel.Debug:
        return "debug";
      case LogLevel.Info:
        return "info";
      case LogLevel.Warn:
        return "warn";
      case LogLevel.Error:
        return "error";
      default:
        return "error";
    }
  }

  private static mergeWithDefaults(details: PaymentDetails): PaymentDetails {
    const defaults: PaymentDetails = {
      address1: "Street 1",
      cardData: {
        cvv: 123,
        firstName: "John",
        lastName: "Doe",
        month: 10,
        number: "4111 1111 1111 1111",
        year: 20
      },
      city: "Vienna",
      country: "AT",
      postalCode: "1080"
    };
    RecurlyJsMock.deleteUndefinedProperties(details);
    if (!details) {
      return defaults;
    } else {
      return merge(defaults, details);
    }
  }

  /**
   * Deletes undefined values from given details recursively including nested objects.
   */
  private static deleteUndefinedProperties(obj: any) {
    Object.keys(obj).forEach((key) => {
      if (obj[key] && typeof obj[key] === "object") {
        RecurlyJsMock.deleteUndefinedProperties(obj[key]);
      } else if (obj[key] == null) {
        delete obj[key];
      }
    });
    return obj;
  }

  public startDaemon(publicApiKey: string, logLevel: LogLevel = LogLevel.Error): Promise<boolean> {
    throw new Error("Not implemented.");
  }

  public stopDaemon(): Promise<boolean> {
    throw new Error("Not implemented.");
  }

  public getToken(details: PaymentDetails): Promise<boolean> {
    throw new Error("Not implemented.");
  }

}

interface Callback {
  status: string;
  err?: any;
  token?: {
    id: string;
  };
}

export interface RecurlyToken {
  id: string;
}

interface RecurlyError {
  name: string;
  code: string;
  message: string;
  fields?: string[];
}

export enum LogLevel {
  Debug = 0,
  Info = 1,
  Warn = 2,
  Error = 3
}

/**
 * Payment data handled by Recurly.js.
 *
 * @see https://dev.recurly.com/docs/getting-started-1#section-card-data
 * @see https://dev.recurly.com/docs/getting-started-1#section-billing-address
 */
export interface PaymentDetails {
  address1?: string;
  address2?: string;
  cardData?: {
    cvv?: number;
    firstName?: string;
    lastName?: string;
    month?: number;
    number?: string;
    year?: number;
  };
  city?: string;
  country?: string;
  phone?: string;
  postalCode?: string; // ISO 3166-1 alpha-2 country code
  state?: string;
  vatNumber?: string;
}


text:
package reactivemongo.core.iteratees

import play.api.libs.iteratee._
import play.api.libs.iteratee.Enumeratee.CheckDone
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{ Failure, Success }
import scala.util.control.NonFatal

object CustomEnumeratee {
  trait RecoverFromErrorFunction {
    def apply[E, A](throwable: Throwable, input: Input[E], continue: () => Iteratee[E, A]): Iteratee[E, A]
  }
  object RecoverFromErrorFunction {
    object StopOnError extends RecoverFromErrorFunction {
      def apply[E, A](throwable: Throwable, input: Input[E], continue: () => Iteratee[E, A]): Iteratee[E, A] =
        Error(throwable.getMessage(), input)
    }
    object ContinueOnError extends RecoverFromErrorFunction {
      def apply[E, A](throwable: Throwable, input: Input[E], continue: () => Iteratee[E, A]): Iteratee[E, A] =
        continue()
    }
  }
  def stopOnError[E]: Enumeratee[E, E] = recover(RecoverFromErrorFunction.StopOnError)
  def continueOnError[E]: Enumeratee[E, E] = recover(RecoverFromErrorFunction.ContinueOnError)
  def recover[E](ƒ: RecoverFromErrorFunction)(implicit ec: ExecutionContext): Enumeratee[E, E] = {
    new Enumeratee[E, E] {
      def applyOn[A](it: Iteratee[E, A]): Iteratee[E, Iteratee[E, A]] = {
        def step(it: Iteratee[E, A])(input: Input[E]): Iteratee[E, Iteratee[E, A]] = input match {
          case in @ (Input.El(_) | Input.Empty) =>
            val next: Future[Iteratee[E, Iteratee[E, A]]] = it.pureFlatFold[E, Iteratee[E, A]] {
              case Step.Cont(k) =>
                val n = k(in)
                n.pureFlatFold[E, Iteratee[E, A]] {
                  case Step.Cont(k) => Cont(step(n))
                  case _ => Done(n, Input.Empty)
                }
              case other => Done(other.it, in)
            }.unflatten.map({ s =>
              s.it
            }).recover({
              case e: Throwable =>
                ƒ(e, in, () => Cont(step(it)))
            })
            Iteratee.flatten(next)
          case Input.EOF =>
            Done(it, Input.Empty)
        }
        Cont(step(it))
      }
    }
  }
}

object CustomEnumerator {
  private[iteratees] def intermediatePromise[A](future: Future[A])(implicit ec: ExecutionContext) = {
    val promise = Promise[A]()
    future.onComplete {
      case Success(s) =>
        promise.success(s)
      case Failure(f) =>
        promise.failure(f)
    }
    promise.future
  }

  class SEnumerator[C](zero: C)(next: C => Option[Future[C]], cleanUp: C => Unit)(implicit ec: ExecutionContext) extends Enumerator[C] {

    def apply[A](iteratee: Iteratee[C, A]): Future[Iteratee[C, A]] = {

      def loop(current: C, iteratee: Iteratee[C, A]): Future[Iteratee[C, A]] = {
        iteratee.fold {
          case step @ Step.Cont(ƒ) => {
            next(current) match {
              case Some(future) => {
                future.flatMap { nnx => loop(nnx, ƒ(Input.El(nnx))) }
              }
              case None =>
                val it = ƒ(Input.Empty)
                cleanUp(current)
                Future.successful(it)
            }
          }
          case Step.Done(a, e) =>
            val done = Done(a, e)
            cleanUp(current)
            Future.successful(done)

          case Step.Error(msg, e) =>
            val error = Error(msg, e)
            cleanUp(current)
            Future.successful(error)
        }
      }

      iteratee fold {
        case Step.Cont(ƒ) =>
          loop(zero, ƒ(Input.El(zero)))
        case Step.Done(a, e) =>
          val done = Done(a, e)
          Future.successful(done)
        case Step.Error(msg, e) =>
          val error = Error(msg, e)
          Future.successful(error)
      }

    }
  }
  object SEnumerator {
    def apply[C](zero: C)(next: C => Option[Future[C]])(implicit ec: ExecutionContext) = new SEnumerator(zero)(next, _ => ())
  }

  /*
   * Until the bug #917 of play is fixed (and so, when Scala SI-6932 is fixed).
   * See
   *   * https://issues.scala-lang.org/browse/SI-6932 and
   *   * https://play.lighthouseapp.com/projects/82401/tickets/917-bug-in-iteratee-library-with-large-amount-of-data#ticket-917-1
   *
   */
  class StateEnumerator[Chunk](zero: Future[Option[Chunk]])(nextChunk: Chunk => Future[Option[Chunk]])(implicit ec: ExecutionContext) extends Enumerator[Chunk] {
    def apply[A](i: Iteratee[Chunk, A]): Future[Iteratee[Chunk, A]] = {
      val promise = Promise[Iteratee[Chunk, A]]
      def inloop(step: Future[Option[Chunk]], iteratee: Iteratee[Chunk, A]): Unit = {
        iteratee.fold {
          case Step.Cont(f) => {
            val future = step.map {
              case Some(state) =>
                (Some(state), f(Input.El(state)))
              case None =>
                (None, f(Input.EOF))
            }
            future.onSuccess {
              case (state, iteratee) =>
                if (state.isDefined)
                  inloop(nextChunk(state.get), iteratee)
                else
                  promise.success(iteratee)
            }
            future.onFailure {
              case e => promise.failure(e)
            }
            future.map(_._2)
          }
          case Step.Done(a, e) => {
            val finalIteratee = Done(a, e)
            promise.success(finalIteratee)
            Future.successful(finalIteratee)
          }
          case Step.Error(msg, e) => {
            val finalIteratee = Error(msg, e)
            promise.success(finalIteratee)
            Future.successful(finalIteratee)
          }
        }
      }
      inloop(zero, i)
      promise.future
    }
  }

  object StateEnumerator {
    def apply[Chunk](zero: Future[Option[Chunk]])(nextChunk: Chunk => Future[Option[Chunk]])(implicit ec: ExecutionContext): Enumerator[Chunk] =
      new StateEnumerator(zero)(nextChunk)
  }
}


text:
package com.fernandocejas.android10.sample.data.exception;

/**
 * Exception throw by the application when a User search can't return a valid result.
 */
public class UserNotFoundException extends Exception {
  public UserNotFoundException() {
    super();
  }
}


text:
<?php
/***********************************************************
  ..

  Reference:
  http://agiletoolkit.org/doc/ref

==ATK4===================================================
   This file is part of Agile Toolkit 4
    http://agiletoolkit.org/

   (c) 2008-2013 Agile Toolkit Limited <info@agiletoolkit.org>
   Distributed under Affero General Public License v3 and
   commercial license.

   See LICENSE or LICENSE_COM for more information
=====================================================ATK4=*/
class SMliteException extends BaseException {}    // used if obsolete function is called


text:
AutoMessage is the third plugin EVER developed for Glydar and currently give you the ability to write custom automated messages from the console to the players chat (Actually not yet since chat packets haven't been implemented.)

Here you can see the config file:
```
#-------------------------#
# AutoMessage config file #
#    By: Puharesource     #
#-------------------------#

prefix: 'AutoMessage> '
interval: 60
write-to-console: true
testmessage:
    - 'This is a test message'
    - 'This is another test message'
    - 'This is a third test message'
```

### Updates
I'll try to keep on updating this plugin for as long as Glydar exists, ofc if something comes up I might not be able to but, atm I'll be updating it all the time.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Enterprise.Invoicing.Common
{
    public class SessionHelper
    {
        /// <summary>
        /// 当前SessionID
        /// </summary>
        public static string SessionId { get { return HttpContext.Current.Session.SessionID; } }
        // Methods
        public static void Add(string strSessionName, string strValue)
        {
            HttpContext.Current.Session[strSessionName] = strValue;
            HttpContext.Current.Session.Timeout = 20;
        }

        public static void Add(string strSessionName, string strValue, int iExpires)
        {
            HttpContext.Current.Session[strSessionName] = strValue;
            HttpContext.Current.Session.Timeout = iExpires;
        }

        public static void Adds(string strSessionName, string[] strValues)
        {
            HttpContext.Current.Session[strSessionName] = strValues;
            HttpContext.Current.Session.Timeout = 20;
        }

        public static void Adds(string strSessionName, string[] strValues, int iExpires)
        {
            HttpContext.Current.Session[strSessionName] = strValues;
            HttpContext.Current.Session.Timeout = iExpires;
        }

        public static void Del(string strSessionName)
        {
            HttpContext.Current.Session[strSessionName] = null;
            HttpContext.Current.Session.Remove(strSessionName);
        }

        public static void Clear()
        {
            HttpContext.Current.Session.Clear();
            HttpContext.Current.Session.RemoveAll();
        }

        public static string Get(string strSessionName)
        {
            if (HttpContext.Current.Session[strSessionName] == null)
            {
                return "";
            }
            return HttpContext.Current.Session[strSessionName].ToString();
        }

        public static string[] Gets(string strSessionName)
        {
            if (HttpContext.Current.Session[strSessionName] == null)
            {
                return null;
            }
            return (string[])HttpContext.Current.Session[strSessionName];
        }

        public static object GetSession(string name)
        {
            return HttpContext.Current.Session[name];
        }

        public static void SetSession(string name, object val)
        {
            //HttpContext.Current.Session.Remove(name);
            //HttpContext.Current.Session.Add(name, val);
            HttpContext.Current.Session[name] = val;
        }
    }

}


text:
import mock
import os
import os.path
import tempfile
import unittest
import tests

from deployd.common.config import Config
from deployd.common.types import DeployStatus, OpCode, DeployStage
from deployd.types.ping_response import PingResponse

class TestConfigFunctions(tests.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.dirname = tempfile.mkdtemp()
        env_filename = os.path.join(cls.dirname, "variables")
        lines = ['env1 = \"test1\"\n',
                 'env2 =   \'test2\'\n',
                 'env3 = test3\n']

        with open(env_filename, 'w') as f:
            f.writelines(lines)

        config_reader = mock.Mock()
        config_reader.get = mock.Mock(return_value="/tmp")
        cls.config = Config(config_reader=config_reader)

    def test_get_target(self):
        deploy_goal = {}
        deploy_goal['deployId'] = '123'
        deploy_goal['stageName'] = 'beta'
        deploy_goal['envName'] = 'pinboard'
        deploy_goal['deployStage'] = DeployStage.SERVING_BUILD
        ping_response = {'deployGoal': deploy_goal, 'opCode': OpCode.NOOP}

        response = PingResponse(jsonValue=ping_response)
        self.config.update_variables(DeployStatus(response))
        self.assertEqual(os.environ['DEPLOY_ID'], '123')
        self.assertEqual(os.environ['ENV_NAME'], 'pinboard')
        self.assertEqual(os.environ['STAGE_NAME'], 'beta')
        self.assertEqual(self.config.get_target(), '/tmp/pinboard')

if __name__ == '__main__':
    unittest.main()


text:
This repository is the companion source code for the Livestax Pet Finder Tutorial which can be found [here](https://github.com/livestax/tutorials).

## Usage

This app is completely static, so you can just use a tool such as "simplehttpserver" to serve the assets.

## Contributing

We'd love to get contributions from you!
For instructions on how to get set up quickly, follow the installation instructions below.
Once you're up and running, take a look at the [Contribution Document](https://github.com/livestax/tutorial-pet-finder/blob/master/CONTRIBUTING.md) to see how to get your changes merged in.

### Installation

1. [Fork then] clone the repository
  * `git clone git@github.com:livestax/tutorial-pet-finder-history.git`
2. Install the dependencies
  * `npm install`
3. Start the server
  * `npm start`
4. Open the app in the browser
  * `http://127.0.0.1:4000`

## License

Code released under the MIT license. Docs released under Creative Commons.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibMinecraft.Model.Items
{
    /// <summary>
    /// A Diamond Pickaxe item (ID = 278)
    /// </summary>
    /// <remarks></remarks>
    public class DiamondPickaxeItem : PickaxeItem
    {
        /// <summary>
        /// The ID for this Item (278)
        /// </summary>
        /// <remarks></remarks>
        public override short ItemID
        {
            get { return 278; }
        }
    }
}


text:
var webpack = require('webpack');
var plugins = [new webpack.DefinePlugin({'define.amd': false, 'process.browser': true})]

var externals = [{
  "bluebird": {
    root: "Promise",
    commonjs2: "bluebird",
    commonjs: "bluebird",
    amd: "bluebird"
  },
  "lodash": {
    root: "_",
    commonjs2: "lodash",
    commonjs: "lodash",
    amd: "lodash"
  },
  "knex": {
    root: "Knex",
    commonjs2: "knex",
    commonjs: "knex",
    amd: "knex"
  },
  "inflection": "inflection"
}]

module.exports = {

  output: {
    library: 'Bookshelf',
    libraryTarget: 'umd'
  },

  externals: externals,

  plugins: plugins

};


text:
CREATE TABLE `ttable` (
  `pk` bigint(20) NOT NULL AUTO_INCREMENT,
  `cbool` tinyint(1) DEFAULT NULL,
  `cint` int(11) DEFAULT NULL,
  `cfloat` float DEFAULT NULL,
  `cnumeric` decimal(10,2) DEFAULT NULL,
  `cstring` varchar(100) DEFAULT NULL,
  `cdate` date DEFAULT NULL,
  `cdatetime` datetime DEFAULT NULL,
  `cguid` varchar(36) DEFAULT NULL,
  `cbytes` varbinary(1000) DEFAULT NULL,
  PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `ttable_c` (
  `c_bool` tinyint(1) DEFAULT NULL,
  `c_int` int(11) DEFAULT NULL,
  `c_float` float DEFAULT NULL,
  `c_numeric` decimal(10,2) DEFAULT NULL,
  `c_string` varchar(100) DEFAULT NULL,
  `c_datetime` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DELIMITER //
CREATE PROCEDURE `sp_query`(cbool BOOLEAN, cint int, cfloat float, cnumeric NUMERIC(10,4), cdate date, cdatetime datetime)
BEGIN
   SELECT cbool, cint, cfloat, cnumeric, cdate, cdatetime;
END//
DELIMITER ;

DELIMITER //
CREATE PROCEDURE `sp_exec`(cint int)
BEGIN
   UPDATE ttable SET cdatetime = NOW() WHERE cint = cint;
END//
DELIMITER ;

DELIMITER //
CREATE PROCEDURE `sp_exec_inout`(IN cint int, INOUT cfloat float, OUT cdatetime datetime)
BEGIN
  SET cdatetime = NOW();
	SET cfloat = cfloat * cint;
END//
DELIMITER ;


text:
package router

import (
	"bytes"
	"encoding/gob"
	"fmt"
	"log"
	"time"
)

const GossipInterval = 30 * time.Second

type Gossip interface {
	// specific message from one peer to another
	// intermediate peers relay it using unicast topology.
	GossipUnicast(dstPeerName PeerName, buf []byte) error
	// send a message to every peer, relayed using broadcast topology.
	GossipBroadcast(buf []byte) error
}

type Gossiper interface {
	OnGossipUnicast(sender PeerName, msg []byte) error
	OnGossipBroadcast(msg []byte) error
	// Return state of everything we know; gets called periodically
	Gossip() []byte
	// merge in state and return "everything new I've just learnt",
	// or nil if nothing in the received message was new
	OnGossip(buf []byte) ([]byte, error)
}

type GossipChannel struct {
	ourself  *LocalPeer
	name     string
	hash     uint32
	gossiper Gossiper
}

func (router *Router) NewGossip(channelName string, g Gossiper) Gossip {
	channelHash := hash(channelName)
	channel := &GossipChannel{router.Ourself, channelName, channelHash, g}
	router.GossipChannels[channelHash] = channel
	return channel
}

func (router *Router) SendAllGossip() {
	for _, channel := range router.GossipChannels {
		channel.SendGossipMsg(channel.gossiper.Gossip())
	}
}

func (router *Router) SendAllGossipDown(conn Connection) {
	for _, channel := range router.GossipChannels {
		protocolMsg := channel.gossipMsg(channel.gossiper.Gossip())
		conn.(ProtocolSender).SendProtocolMsg(protocolMsg)
	}
}

func (router *Router) handleGossip(payload []byte, onok func(*GossipChannel, PeerName, []byte, *gob.Decoder) error) error {
	decoder := gob.NewDecoder(bytes.NewReader(payload))
	var channelHash uint32
	if err := decoder.Decode(&channelHash); err != nil {
		return err
	}
	channel, found := router.GossipChannels[channelHash]
	if !found {
		return fmt.Errorf("[gossip] received unknown channel with hash %v", channelHash)
	}
	var srcName PeerName
	if err := decoder.Decode(&srcName); err != nil {
		return err
	}
	if err := onok(channel, srcName, payload, decoder); err != nil {
		return err
	}
	return nil
}

func deliverGossipUnicast(channel *GossipChannel, srcName PeerName, origPayload []byte, dec *gob.Decoder) error {
	var destName PeerName
	if err := dec.Decode(&destName); err != nil {
		return err
	}
	if channel.ourself.Name == destName {
		var payload []byte
		if err := dec.Decode(&payload); err != nil {
			return err
		}
		return channel.gossiper.OnGossipUnicast(srcName, payload)
	} else {
		return channel.relayGossipUnicast(destName, origPayload)
	}
}

func deliverGossipBroadcast(channel *GossipChannel, srcName PeerName, origPayload []byte, dec *gob.Decoder) error {
	var payload []byte
	if err := dec.Decode(&payload); err != nil {
		return err
	}
	if err := channel.gossiper.OnGossipBroadcast(payload); err != nil {
		return err
	}
	return channel.relayGossipBroadcast(srcName, origPayload)
}

func deliverGossip(channel *GossipChannel, srcName PeerName, _ []byte, dec *gob.Decoder) error {
	var payload []byte
	if err := dec.Decode(&payload); err != nil {
		return err
	}
	if newBuf, err := channel.gossiper.OnGossip(payload); err != nil {
		return err
	} else if newBuf != nil {
		channel.SendGossipMsg(newBuf)
	}
	return nil
}

func (c *GossipChannel) SendGossipMsg(buf []byte) {
	protocolMsg := c.gossipMsg(buf)
	c.ourself.ForEachConnection(func(_ PeerName, conn Connection) {
		conn.(ProtocolSender).SendProtocolMsg(protocolMsg)
	})
}

func (c *GossipChannel) gossipMsg(buf []byte) ProtocolMsg {
	return ProtocolMsg{ProtocolGossip, GobEncode(c.hash, c.ourself.Name, buf)}
}

func (c *GossipChannel) GossipUnicast(dstPeerName PeerName, buf []byte) error {
	return c.relayGossipUnicast(dstPeerName, GobEncode(c.hash, c.ourself.Name, dstPeerName, buf))
}

func (c *GossipChannel) GossipBroadcast(buf []byte) error {
	return c.relayGossipBroadcast(c.ourself.Name, GobEncode(c.hash, c.ourself.Name, buf))
}

func (c *GossipChannel) relayGossipUnicast(dstPeerName PeerName, msg []byte) error {
	if relayPeerName, found := c.ourself.Router.Routes.Unicast(dstPeerName); !found {
		c.log("unknown relay destination:", dstPeerName)
	} else if conn, found := c.ourself.ConnectionTo(relayPeerName); !found {
		c.log("unable to find connection to relay peer", relayPeerName)
	} else {
		conn.(ProtocolSender).SendProtocolMsg(ProtocolMsg{ProtocolGossipUnicast, msg})
	}
	return nil
}

func (c *GossipChannel) relayGossipBroadcast(srcName PeerName, msg []byte) error {
	if srcPeer, found := c.ourself.Router.Peers.Fetch(srcName); !found {
		c.log("unable to relay broadcast from unknown peer", srcName)
	} else {
		protocolMsg := ProtocolMsg{ProtocolGossipBroadcast, msg}
		for _, conn := range c.ourself.NextBroadcastHops(srcPeer) {
			conn.SendProtocolMsg(protocolMsg)
		}
	}
	return nil
}

func (c *GossipChannel) log(args ...interface{}) {
	log.Println(append(append([]interface{}{}, "[gossip "+c.name+"]:"), args...)...)
}


text:
from measurements import startup
from metrics import cpu
from metrics import startup_metric

class SessionRestore(startup.Startup):
  """Performs a measurement of Chromium's Session restore performance.

  This test is meant to be run against a generated profile.
  This test inherits support for the --warm or --cold command line options -
  see startup.py for details.
  """

  def __init__(self, action_name_to_run = ''):
    super(SessionRestore, self).__init__(action_name_to_run=action_name_to_run)
    self.close_tabs_before_run = False
    self._cpu_metric = None

  def CustomizeBrowserOptions(self, options):
    super(SessionRestore, self).CustomizeBrowserOptions(options)
    options.AppendExtraBrowserArgs([
        '--restore-last-session'
    ])

  def CanRunForPage(self, page):
    # No matter how many pages in the pageset, just perform one test iteration.
    return page.page_set.pages.index(page) == 0

  def RunNavigateSteps(self, page, tab):
    # Overriden so that no page navigation occurs.
    pass

  def ValidatePageSet(self, page_set):
    # Reject any pageset that contains more than one WPR archive.
    wpr_archives = {}
    for page in page_set:
      if not page.is_local:
        wpr_archives[page_set.WprFilePathForPage(page)] = True

    if len(wpr_archives.keys()) > 1:
      raise Exception("Invalid pageset: more than 1 WPR archive found.: " +
          ', '.join(wpr_archives.keys()))

  def DidStartBrowser(self, browser):
    self._cpu_metric = cpu.CpuMetric(browser)
    self._cpu_metric.Start(None, None)

  def MeasurePage(self, page, tab, results):

    tab.browser.foreground_tab.WaitForDocumentReadyStateToBeComplete()
    # Record CPU usage from browser start to when all pages have loaded.
    self._cpu_metric.Stop(None, None)
    self._cpu_metric.AddResults(tab, results, 'cpu_utilization')

    startup_metric.StartupMetric().AddResults(tab, results)

    # TODO(jeremy): Measure time to load - first, last and frontmost tab here.


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\States */

$this->title = $state->name.'- Add New City';
$this->params['breadcrumbs'][] = ['label' => 'Active Countries', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $state->country->name, 'url' => ['viewstates', 'country_id' => $state->country->id]];
$this->params['breadcrumbs'][] = $this->title;
?>

						<?php $form = ActiveForm::begin(); ?>

							<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

								<?= Html::submitButton('Create', ['class' =>'btn btn-success']) ?>

						<?php ActiveForm::end(); ?>


text:
static void addMd5(Profile *profile, const QString &path)
{
	QCryptographicHash hash(QCryptographicHash::Md5);

	QFile f(path);
	f.open(QFile::ReadOnly);
	hash.addData(&f);
	f.close();

	profile->addMd5(hash.result().toHex(), path);
}

ImageDownloader::ImageDownloader(Profile *profile, QSharedPointer<Image> img, QString filename, QString path, int count, bool addMd5, bool startCommands, QObject *parent, bool loadTags, bool rotate, bool force, Image::Size size, bool postSave, bool forceExisting)
	: QObject(parent), m_profile(profile), m_image(std::move(img)), m_fileDownloader(false, this), m_filename(std::move(filename)), m_path(std::move(path)), m_loadTags(loadTags), m_count(count), m_addMd5(addMd5), m_startCommands(startCommands), m_writeError(false), m_rotate(rotate), m_force(force), m_postSave(postSave), m_forceExisting(forceExisting)
{
	setSize(size);
}

ImageDownloader::ImageDownloader(Profile *profile, QSharedPointer<Image> img, QStringList paths, int count, bool addMd5, bool startCommands, QObject *parent, bool rotate, bool force, Image::Size size, bool postSave, bool forceExisting)
	: QObject(parent), m_profile(profile), m_image(std::move(img)), m_fileDownloader(false, this), m_loadTags(false), m_paths(std::move(paths)), m_count(count), m_addMd5(addMd5), m_startCommands(startCommands), m_writeError(false), m_rotate(rotate), m_force(force), m_postSave(postSave), m_forceExisting(forceExisting)
{
	setSize(size);
}

ImageDownloader::~ImageDownloader()
{
	if (m_reply != nullptr) {
		m_reply->deleteLater();
	}
}

bool ImageDownloader::isRunning() const
{
	return m_reply != nullptr && m_reply->isRunning();
}

void ImageDownloader::setSize(Image::Size size)
{
	if (size == Image::Size::Unknown) {
		const bool getOriginals = m_profile->getSettings()->value("Save/downloadoriginals", true).toBool();
		const bool hasSample = m_image->url(Image::Size::Sample).isEmpty();
		if (getOriginals || !hasSample) {
			m_size = Image::Size::Full;
		} else {
			m_size = Image::Size::Sample;
		}
	} else {
		m_size = size;
	}
}

void ImageDownloader::setBlacklist(Blacklist *blacklist)
{
	m_blacklist = blacklist;
}

void ImageDownloader::save()
{
	// Always load details if the API doesn't provide the file URL in the listing page
	const QStringList forcedTokens = m_image->parentSite()->getApis().first()->forcedTokens();
	const bool needFileUrl = forcedTokens.contains("*") || forcedTokens.contains("file_url");

	// If we use direct saving or don't want to load tags, we directly save the image
	const int globalNeedTags = needExactTags(m_profile->getSettings());
	const int localNeedTags = m_filename.needExactTags(m_image->parentSite(), m_profile->getSettings());
	const int needTags = qMax(globalNeedTags, localNeedTags);
	const bool filenameNeedTags = needTags == 2 || (needTags == 1 && m_image->hasUnknownTag());
	const bool blacklistNeedTags = m_blacklist != nullptr && m_image->tags().isEmpty();
	if (!blacklistNeedTags && !needFileUrl && (!m_loadTags || !m_paths.isEmpty() || !filenameNeedTags)) {
		loadedSave(Image::LoadTagsResult::Ok);
		return;
	}

	log(QStringLiteral("Not enough information to directly load the image (from blacklist: %1 / from file url: %2 / from filename tags: %3/%4)").arg(blacklistNeedTags).arg(needFileUrl).arg(filenameNeedTags).arg(needTags), Logger::Info);
	connect(m_image.data(), &Image::finishedLoadingTags, this, &ImageDownloader::loadedSave);
	m_image->loadDetails();
}

int ImageDownloader::needExactTags(QSettings *settings) const
{
	int need = 0;

	// Check external log files
	const auto logFiles = getExternalLogFiles(settings);
	for (auto it = logFiles.constBegin(); it != logFiles.constEnd(); ++it) {
		need = qMax(need, Filename(it.value().value("content").toString()).needExactTags(nullptr, settings));
		if (need == 2) {
			return need;
		}
	}

	// Check commands
	static const QStringList settingNames {
		"Exec/tag_before",
		"Exec/image",
		"Exec/tag_after",
		"Exec/SQL/before",
		"Exec/SQL/tag_before",
		"Exec/SQL/image",
		"Exec/SQL/tag_after",
		"Exec/SQL/after",
	};
	for (const QString &setting : settingNames) {
		const QString value = settings->value(setting, "").toString();
		if (value.isEmpty()) {
			continue;
		}

		need = qMax(need, Filename(value).needExactTags(nullptr, settings));
		if (need == 2) {
			return need;
		}
	}

	// Check Exiftool metadata
	for (const auto &pair : getMetadataExiftool(settings)) {
		need = qMax(need, Filename(pair.second).needExactTags(nullptr, settings));
		if (need == 2) {
			return need;
		}
	}

	#ifdef WIN_FILE_PROPS
		// Check Windows Property System
		for (const auto &pair : getMetadataPropsys(settings)) {
			need = qMax(need, Filename(pair.second).needExactTags(nullptr, settings));
			if (need == 2) {
				return need;
			}
		}
	#endif

	return need;
}

void ImageDownloader::abort()
{
	m_image->abortTags();
	if (m_reply != nullptr && m_reply->isRunning()) {
		m_reply->abort();
	}
}

void ImageDownloader::loadedSave(Image::LoadTagsResult result)
{
	disconnect(m_image.data(), &Image::finishedLoadingTags, this, &ImageDownloader::loadedSave);

	// Detect error when loading an image's tags
	if (result != Image::LoadTagsResult::Ok) {
		emit saved(m_image, makeResult({ "" }, Image::SaveResult::DetailsLoadError));
		return;
	}

	// Get the download path from the image if possible
	if (m_paths.isEmpty()) {
		m_paths = m_image->paths(m_filename, m_path, m_count);

		// If we still don't have any paths, that means the filename is invalid
		if (m_paths.isEmpty()) {
			log(QStringLiteral("No path could be generated for filename: '%1'").arg(m_filename.format()), Logger::Error);
			emit saved(m_image, makeResult({ "" }, Image::SaveResult::Error));
			return;
		}

		// Use a random temporary file if we need the MD5 or equivalent
		if (m_filename.needTemporaryFile(m_image->tokens(m_profile))) {
			const QString tmpDir = !m_path.isEmpty() ? m_path : m_profile->tempPath();
			m_temporaryPath = tmpDir + QDir::separator() + QUuid::createUuid().toString().mid(1, 36) + ".tmp";
		}
	}

	// Directly use the image path as temporary file  if possible
	if (m_temporaryPath.isEmpty()) {
		m_temporaryPath = m_paths.first() + ".tmp";
	}

	// Check if the image is blacklisted
	if (m_blacklist != nullptr) {
		const QStringList &detected = m_blacklist->match(m_image->tokens(m_profile));
		if (!detected.isEmpty()) {
			log(QStringLiteral("Image contains blacklisted tags: '%1'").arg(detected.join("', '")), Logger::Info);
			emit saved(m_image, makeResult(m_paths, Image::SaveResult::Blacklisted));
			return;
		}
	}

	// Try to save the image if it's already loaded or exists somewhere else on disk
	if (!m_force) {
		// Check if the destination files already exist
		bool allExists = true;
		for (const QString &path : qAsConst(m_paths)) {
			if (!QFile::exists(path)) {
				allExists = false;
				break;
			}
		}
		if (allExists) {
			log(QStringLiteral("File already exists: `%1`").arg(m_paths.first()), Logger::Info);
			if (m_addMd5) {
				for (const QString &path : qAsConst(m_paths)) {
					addMd5(m_profile, path);
				}
			}
			emit saved(m_image, makeResult(m_paths, Image::SaveResult::AlreadyExistsDisk));
			return;
		}

		// If we don't need any loading, we can return already
		Image::SaveResult res = m_image->preSave(m_temporaryPath, m_size);
		if (res != Image::SaveResult::NotLoaded && (res != Image::SaveResult::AlreadyExistsDeletedMd5 || !m_forceExisting)) {
			QList<ImageSaveResult> preResult {{ m_temporaryPath, m_size, res }};

			if (res == Image::SaveResult::Saved || res == Image::SaveResult::Copied || res == Image::SaveResult::Moved || res == Image::SaveResult::Shortcut || res == Image::SaveResult::Linked) {
				preResult = afterTemporarySave(res);
			}

			emit saved(m_image, preResult);
			return;
		}
	}

	m_url = m_image->url(m_size);

	if (m_url.isEmpty()) {
		log(QStringLiteral("Image without URL found for '%1'").arg(m_paths.first()), Logger::Warning);
		emit saved(m_image, makeResult(m_paths, Image::SaveResult::NetworkError));
		return;
	}

	log(QStringLiteral("Loading and saving image from `%1` in `%2`").arg(m_url.toString(), m_paths.first()));
	loadImage();
}

void ImageDownloader::loadImage()
{
	connect(&m_fileDownloader, &FileDownloader::success, this, &ImageDownloader::success, Qt::UniqueConnection);
	connect(&m_fileDownloader, &FileDownloader::networkError, this, &ImageDownloader::networkError, Qt::UniqueConnection);
	connect(&m_fileDownloader, &FileDownloader::writeError, this, &ImageDownloader::writeError, Qt::UniqueConnection);

	// Delete previous replies for retries
	if (m_reply != nullptr) {
		m_reply->deleteLater();
	}

	// Load the image directly on the disk
	Site *site = m_image->parentSite();
	m_reply = site->get(site->fixUrl(m_url.toString()), Site::QueryType::Img, m_image->parentUrl(), QStringLiteral("image"), m_image.data());
	m_reply->setParent(this);
	connect(m_reply, &NetworkReply::downloadProgress, this, &ImageDownloader::downloadProgressImage);

	// Create download root directory
	const QString rootDir = m_temporaryPath.section(QDir::separator(), 0, -2);
	if (!QDir(rootDir).exists() && !QDir().mkpath(rootDir)) {
		log(QStringLiteral("Impossible to create the destination folder: %1.").arg(rootDir), Logger::Error);
		emit saved(m_image, makeResult(m_paths, Image::SaveResult::Error));
		return;
	}

	// If we can't start writing for some reason, return an error
	if (!m_fileDownloader.start(m_reply, m_temporaryPath)) {
		emit saved(m_image, makeResult(m_paths, Image::SaveResult::Error));
		return;
	}
}

void ImageDownloader::downloadProgressImage(qint64 v1, qint64 v2)
{
	if (m_image->fileSize() == 0 || m_image->fileSize() < v2 / 2) {
		m_image->setFileSize(v2, currentSize());
	}

	emit downloadProgress(m_image, v1, v2);
}

Image::Size ImageDownloader::currentSize() const
{
	return m_tryingSample ? Image::Size::Sample : m_size;
}

QList<ImageSaveResult> ImageDownloader::makeResult(const QStringList &paths, Image::SaveResult result) const
{
	const Image::Size size = currentSize();

	QList<ImageSaveResult> res;
	for (const QString &path : paths) {
		res.append({ path, size, result });
	}
	return res;
}

void ImageDownloader::writeError()
{
	emit saved(m_image, makeResult(m_paths, Image::SaveResult::Error));
}

void ImageDownloader::networkError(NetworkReply::NetworkError error, const QString &msg)
{
	if (error == NetworkReply::NetworkError::ContentNotFoundError) {
		QSettings *settings = m_profile->getSettings();
		ExtensionRotator *extensionRotator = m_image->extensionRotator();

		const bool sampleFallback = settings->value("Save/samplefallback", true).toBool();
		const bool shouldFallback = m_size == Image::Size::Full && sampleFallback && !m_image->url(Image::Size::Sample).isEmpty();
		const QString newExt = extensionRotator != nullptr ? extensionRotator->next() : QString();

		if (m_rotate && !newExt.isEmpty()) {
			m_url = setExtension(m_image->url(m_size), newExt);
			log(QStringLiteral("Image not found. New try with extension %1 (%2)...").arg(newExt, m_url.toString()));
			m_image->setUrl(m_url);
			loadImage();
		} else if (shouldFallback && !m_tryingSample) {
			m_url = m_image->url(Image::Size::Sample);
			m_tryingSample = true;
			log(QStringLiteral("Image not found. New try with its sample (%1)...").arg(m_url.toString()), Logger::Warning);
			m_image->setUrl(m_url);
			loadImage();
		} else {
			m_tryingSample = false;
			log(QStringLiteral("Image not found."));
			emit saved(m_image, makeResult(m_paths, Image::SaveResult::NotFound));
		}
	} else if (error != NetworkReply::NetworkError::OperationCanceledError) {
		// "HostNotFoundError" might be caused by network loss, so we emit a blocking "Error" instead
		if (error == NetworkReply::NetworkError::HostNotFoundError || msg.contains("unreachable")) {
			log(QStringLiteral("Host '%1' not found for the image: `%2`: %3 (%4)").arg(m_reply->url().host(), m_image->url().toString().toHtmlEscaped()).arg(error).arg(msg), Logger::Error);
			emit saved(m_image, makeResult(m_paths, Image::SaveResult::Error));
			return;
		}

		log(QStringLiteral("Network error for the image: `%1`: %2 (%3)").arg(m_image->url().toString().toHtmlEscaped()).arg(error).arg(msg), Logger::Error);
		emit saved(m_image, makeResult(m_paths, Image::SaveResult::NetworkError));
	}
}

void ImageDownloader::success()
{
	// Handle network redirects
	const QUrl redirect = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
	if (!redirect.isEmpty()) {
		m_url = redirect;
		loadImage();
		return;
	}

	emit saved(m_image, afterTemporarySave(Image::SaveResult::Saved));
}

QList<ImageSaveResult> ImageDownloader::afterTemporarySave(Image::SaveResult saveResult)
{
	QSettings *settings = m_profile->getSettings();

	const QString multipleFiles = settings->value("Save/multiple_files", "copy").toString();
	const Image::Size size = currentSize();

	m_image->setSavePath(m_temporaryPath, size);

	// Load size if necessary
	if (m_image->size(size).isEmpty()) {
		QImageReader reader(m_temporaryPath);
		QSize imgSize = reader.size();
		if (imgSize.isValid()) {
			m_image->setSize(imgSize, size);
		}
	}

	// Resize image if necessary
	bool maxWidthEnabled = settings->value("ImageSize/maxWidthEnabled", false).toBool();
	bool maxHeightEnabled = settings->value("ImageSize/maxHeightEnabled", false).toBool();
	QSize resizeBox = m_image->size(size);
	if (!resizeBox.isEmpty() && (maxWidthEnabled || maxHeightEnabled)) {
		int maxWidth = settings->value("ImageSize/maxWidth", 1000).toInt();
		if (maxWidthEnabled && resizeBox.width() > maxWidth) {
			resizeBox.setWidth(maxWidth);
		}
		int maxHeight = settings->value("ImageSize/maxHeight", 1000).toInt();
		if (maxHeightEnabled && resizeBox.height() > maxHeight) {
			resizeBox.setWidth(maxHeight);
		}
		if (resizeBox != m_image->size(size)) {
			QImage img(m_temporaryPath);
			img = img.scaled(resizeBox, Qt::KeepAspectRatio, Qt::SmoothTransformation);
			img.save(m_temporaryPath, m_image->extension().toStdString().c_str());
		}
	}

	if (!m_filename.format().isEmpty()) {
		m_paths = m_image->paths(m_filename, m_path, m_count);
	}

	QString suffix;
	#ifdef Q_OS_WIN
		if (saveResult == Image::SaveResult::Shortcut) {
			suffix = ".lnk";
		}
	#endif

	QFile tmp(m_temporaryPath + suffix);
	bool moved = false;

	QList<ImageSaveResult> result;
	for (const QString &file : qAsConst(m_paths)) {
		const QString path = file + suffix;

		// Don't overwrite already existing files
		if (QFile::exists(file) || (!suffix.isEmpty() && QFile::exists(path))) {
			log(QStringLiteral("File already exists: `%1`").arg(file), Logger::Info);
			if (suffix.isEmpty() && m_addMd5) {
				addMd5(m_profile, file);
			}
			result.append({ path, size, Image::SaveResult::AlreadyExistsDisk });
			continue;
		}

		const QString dir = path.section(QDir::separator(), 0, -2);
		if (!QDir(dir).exists() && !QDir().mkpath(dir)) {
			log(QStringLiteral("Impossible to create the destination folder: %1.").arg(dir), Logger::Error);
			result.append({ path, size, Image::SaveResult::Error });
			continue;
		}

		if (!moved) {
			if (!tmp.rename(path)) {
				log(QStringLiteral("Error renaming from `%1` to `%2`").arg(tmp.fileName(), path), Logger::Error);
				result.append({ path, size, Image::SaveResult::Error });
				continue;
			} else {
				moved = true;
			}
		} else if (multipleFiles == "link") {
			#ifdef Q_OS_WIN
				bool ok = tmp.link(path + ".lnk");
			#else
				bool ok = tmp.link(path);
			#endif
			if (!ok) {
				log(QStringLiteral("Error creating link from `%1` to `%2`").arg(tmp.fileName(), path), Logger::Error);
				result.append({ path, size, Image::SaveResult::Error });
				continue;
			}
		} else {
			if (!tmp.copy(path)) {
				log(QStringLiteral("Error copying from `%1` to `%2`").arg(tmp.fileName(), path), Logger::Error);
				result.append({ path, size, Image::SaveResult::Error });
				continue;
			}
		}

		result.append({ path, size, saveResult });
		if (m_postSave) {
			m_image->postSave(path, size, saveResult, m_addMd5, m_startCommands, m_count);
		}
	}

	if (!moved) {
		tmp.remove();
	}

	return result;
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _typeof2 = require('babel-runtime/helpers/typeof');

var _typeof3 = _interopRequireDefault(_typeof2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _kefir = require('kefir');

var _kefir2 = _interopRequireDefault(_kefir);

var _isomorphicFetch = require('isomorphic-fetch');

var _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch);

var _index = require('../index');

var _buildPathForStore = require('../utils/buildPathForStore');

var _buildPathForStore2 = _interopRequireDefault(_buildPathForStore);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = function (addr) {
	var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
	return function (MyFragment) {
		var _class, _temp, _initialiseProps;

		var beforeGetData = options.beforeGetData,
		    afterGetData = options.afterGetData,
		    onlyLocalModificators = options.onlyLocalModificators,
		    onGetError = options.onGetError,
		    getErrorData = options.getErrorData,
		    onSetError = options.onSetError,
		    setErrorData = options.setErrorData,
		    onSet = options.onSet,
		    debounceForSet = options.debounceForSet,
		    debounceForGet = options.debounceForGet,
		    onlyServerModificators = options.onlyServerModificators;

		return _temp = _class = function (_Fragment) {
			(0, _inherits3.default)(HttpConnector, _Fragment);

			function HttpConnector() {
				var _ref;

				(0, _classCallCheck3.default)(this, HttpConnector);

				for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
					args[_key] = arguments[_key];
				}

				var _this = (0, _possibleConstructorReturn3.default)(this, (_ref = HttpConnector.__proto__ || Object.getPrototypeOf(HttpConnector)).call.apply(_ref, [this].concat(args)));

				_initialiseProps.call(_this);

				_this.debounceForSetStream = _kefir2.default.stream(function (emitter) {
					_this.debounceForSetEmitter = emitter;
				}).onValue(_this.kefirOnValueForSet);

				if (debounceForSet) {
					if (typeof debounceForSet === 'number') {
						_this.debounceForSetStreams = _kefir2.default.stream(function (emitter) {
							_this.debounceForSetEmitters = emitter;
						}).debounce(debounceForSet).onValue(_this.kefirOnValueForSet);
					} else if ((typeof debounceForSet === 'undefined' ? 'undefined' : (0, _typeof3.default)(debounceForSet)) === 'object') {
						_this.debounceForSetStreams = {};
						_this.debounceForSetEmitters = {};

						Object.keys(debounceForSet).forEach(function (key) {
							_this.debounceForSetStreams[key] = _kefir2.default.stream(function (emitter) {
								_this.debounceForSetEmitters[key] = emitter;
							}).debounce(debounceForSet[key]).onValue(_this.kefirOnValueForSet);
						});
					}
				}

				if (debounceForGet) {
					if (typeof debounceForGet === 'number') {
						var cachePath = null;
						_this.debounceForGetStreams = _kefir2.default.stream(function (emitter) {
							_this.debounceForGetEmitters = emitter;
						}).scan(function (acc, next) {
							var prevPath = acc.path;
							if (!cachePath) {
								prevPath = (0, _buildPathForStore2.default)(prevPath);
							}
							cachePath = (0, _buildPathForStore2.default)(next.path, prevPath);
							var newAcc = (0, _extends3.default)({}, acc, {
								path: cachePath
							});
							return newAcc;
						}).debounce(debounceForGet).onValue(_this.getDataFromServer);
					} else if ((typeof debounceForGet === 'undefined' ? 'undefined' : (0, _typeof3.default)(debounceForGet)) === 'object') {
						_this.debounceForGetStreams = {};
						_this.debounceForGetEmitters = {};

						Object.keys(debounceForGet).forEach(function (key) {
							var cachePath = null;

							_this.debounceForGetStreams[key] = _kefir2.default.stream(function (emitter) {
								_this.debounceForGetEmitters[key] = emitter;
							}).scan(function (acc, next) {
								var prevPath = acc.path;
								if (!cachePath) {
									prevPath = (0, _buildPathForStore2.default)(prevPath);
								}
								cachePath = (0, _buildPathForStore2.default)(next.path, prevPath);
								var newAcc = (0, _extends3.default)({}, acc, {
									path: cachePath
								});
								return newAcc;
							}).debounce(debounceForGet[key]).onValue(function () {
								cachePath = null;
								_this.getDataFromServer.apply(_this, arguments);
							});
						});
					}
				}
				return _this;
			}

			(0, _createClass3.default)(HttpConnector, [{
				key: 'init',
				value: function init() {
					return new MyFragment();
				}
			}, {
				key: 'getDataFromServer',
				value: function getDataFromServer(args) {
					var _this2 = this;

					var path = args.path,
					    isStream = args.isStream;

					if (this.dataNotFoundPaths.length || this.data.dataNotFoundPaths.length) {
						if (beforeGetData !== undefined && beforeGetData !== null) {
							this.data.setData(beforeGetData, null, null, { method: this.onDataNotFound });
						}

						var pathForServer = path;
						if (!isStream) {
							pathForServer = (0, _buildPathForStore2.default)(path);
						}

						(0, _isomorphicFetch2.default)(addr, {
							method: 'POST',
							body: JSON.stringify({
								method: 'getStore',
								args: [pathForServer]
							}),
							headers: {
								'Content-Type': 'application/json'
							}
						}).then(function (res) {
							return res.json();
						}).then(function (res) {
							var data = res;

							if (afterGetData) {
								data = (0, _extends3.default)({}, data, afterGetData);
							}

							_this2.data.setData(data, null, null, { method: _this2.onDataNotFound }).then(function () {
								_this2.data.setData(null, null, { clearPaths: true }, { method: _this2.onDataNotFound });
							});
						}).catch(function (err) {
							if (!getErrorData && typeof onGetError !== 'function') {
								console.error(err);
							}

							if (getErrorData) {
								_this2.data.setData(getErrorData, null, null, { method: _this2.onDataNotFound });
							}

							if (typeof onGetError === 'function') {
								onGetError.bind(_this2.data)(err);
							}
						});
					}
				}
			}, {
				key: 'afterInit',
				value: function afterInit() {
					this.data.getDataFromServer = this.getDataFromServer.bind(this);
				}
			}, {
				key: 'setData',
				value: function setData(value, path, setDataOptions, info) {
					var clearPaths = void 0;
					if (setDataOptions) {
						clearPaths = setDataOptions.clearPaths;
					}

					if (clearPaths) {
						this.dataNotFoundPaths = [];
						this.data.dataNotFoundPaths = [];
					}

					var fragmentName = this.constructor.name;
					var innerFragmentName = this.data.constructor.name;

					var callingFragment = void 0;
					var callingModificator = void 0;
					if (info) {
						callingFragment = info.fragment;
						callingModificator = info.modificator;
					}

					var callingFragmentName = void 0;
					if (callingFragment instanceof _index.Fragment) {
						callingFragmentName = callingFragment.constructor.name;
					}

					var isCallOfThis = callingFragmentName === fragmentName || callingFragmentName === innerFragmentName;

					var callingModificatorName = void 0;
					if (callingModificator) {
						callingModificatorName = callingModificator.name;
					}

					var isIgnore = false;
					if (onlyLocalModificators && callingModificatorName) {
						isIgnore = onlyLocalModificators.find(function (v) {
							return v === callingModificatorName;
						});
					}

					if (isCallOfThis || isIgnore) {
						return this.original.setData(value, path, setDataOptions, info);
					}

					if (debounceForSet) {
						if (this.debounceForSetEmitters) {
							if (typeof debounceForSet === 'number') {
								this.debounceForSetEmitters.emit({ value: value, path: path, setDataOptions: setDataOptions, info: info });
							} else if ((typeof debounceForSet === 'undefined' ? 'undefined' : (0, _typeof3.default)(debounceForSet)) === 'object') {
								if (callingModificatorName && debounceForSet[callingModificatorName]) {
									this.debounceForSetEmitters[callingModificatorName].emit({
										value: value,
										path: path,
										setDataOptions: setDataOptions,
										info: info
									});
								} else if (this.debounceForSetEmitter) {
									this.debounceForSetEmitter.emit({ value: value, path: path, setDataOptions: setDataOptions, info: info });
								}
							}
						}
					} else if (this.debounceForSetEmitter) {
						this.debounceForSetEmitter.emit({ value: value, path: path, setDataOptions: setDataOptions, info: info });
					}

					var isOnlyServer = false;
					if (callingModificatorName && onlyServerModificators) {
						isOnlyServer = onlyServerModificators.find(function (v) {
							return v === callingModificatorName;
						});
					}

					if (isOnlyServer) {
						return this.data;
					}

					return this.original.setData(value, path, setDataOptions, info);
				}
			}, {
				key: 'onDataNotFound',
				value: function onDataNotFound(path, info) {
					if (debounceForGet) {
						if (this.debounceForGetEmitters) {
							if (typeof debounceForGet === 'number') {
								this.debounceForGetEmitters.emit({ path: path, isStream: true });
							} else if ((typeof debounceForGet === 'undefined' ? 'undefined' : (0, _typeof3.default)(debounceForGet)) === 'object') {
								var callingComponentName = void 0;
								if (info && info.component) {
									callingComponentName = info.component.name;
								}

								if (callingComponentName && debounceForGet[callingComponentName]) {
									this.debounceForGetEmitters[callingComponentName].emit({ path: path, isStream: true });
								} else {
									this.getDataFromServer({ path: path });
								}
							}
						}
					} else {
						this.getDataFromServer({ path: path });
					}
				}
			}]);
			return HttpConnector;
		}(_index.Fragment), _initialiseProps = function _initialiseProps() {
			var _this3 = this;

			this.kefirOnValueForSet = function (args) {
				var value = args.value,
				    path = args.path,
				    setDataOptions = args.setDataOptions,
				    _args$info = args.info,
				    info = _args$info === undefined ? {} : _args$info;

				var localInfo = {};
				var notEmpty = false;
				if (info.server) {
					notEmpty = true;
					localInfo.server = info.server;
				}
				if (info.component) {
					notEmpty = true;
					localInfo.component = info.component.name;
				}
				if (info.modificator) {
					notEmpty = true;
					localInfo.modificator = info.modificator.name;
				}
				if (info.fragment) {
					notEmpty = true;
					localInfo.fragment = info.fragment.constructor.name;
				}
				if (info.method) {
					notEmpty = true;
					localInfo.method = info.method.name;
				}

				(0, _isomorphicFetch2.default)(addr, {
					method: 'POST',
					body: JSON.stringify({
						method: 'setStore',
						args: [value, path, setDataOptions, notEmpty ? localInfo : null]
					}),
					headers: {
						'Content-Type': 'application/json'
					}
				}).then(function (res) {
					return res.json();
				}).then(function (res) {
					if (typeof onSet === 'function') {
						onSet.bind(_this3.data)({ value: value, path: path, options: setDataOptions, info: info, resultat: res });
					}
				}).catch(function (err) {
					if (!setErrorData && typeof onSetError !== 'function') {
						console.error(err);
					}

					if (setErrorData) {
						_this3.data.setData(setErrorData, null, null, { method: _this3.setData });
					}

					if (typeof onSetError === 'function') {
						onSetError.bind(_this3.data)(err);
					}
				});
			};
		}, _temp;
	};
}; // eslint-disable-line


text:
'use strict';
(function (root, factory) {
    if (typeof exports === 'object') {
        module.exports = factory();
    } else if (typeof define === 'function' && define.amd) {
        define(['savory'], factory);
    } else {
        factory();
    }
}(this, function () {
    // load main controller
    var Interface = require('./controllers/Interface.js'),
        _ = require('./plugins/utils.js');

    /**
     * Savory constructor
     * @constructor
     * @param {object} config - configuration object
     */
    function Savory(/*obj*/config){

        // prevent reinitializing
        if (window._savory) {
            return window._savory;
        }

        var config = config || {};

        if (window.savoryConfig) {
            config = _.merge(config, window.savoryConfig);
        }

        this.config = config;
        this['interface'] = new Interface();

        // Exposing savory public interface
        this.api = this['interface']['public'];

        // exec onReady callback
        window.savoryConfig.callbacks.onReady(this);
        // save itself data just in case
        window._savory = this;
    }

    /**
     * Remove all elements and events related to module
     *
     * @this Savory
     * @method
     */
    Savory.prototype.destroy = function(){

        this['interface'].destroy();

        window._savory = null;
        delete window._savory;
        if (window.savory) {
            window.savory = null;
            delete window.savory;
        }

        return null;
    };

    // Expose Savory constructor
    window.Savory = Savory.bind(Savory);

    // Autoinit
    if (window.savoryConfig.autoInit) {
        // if Savory script tag inserted in head
        if (!document.body) {
            window.onload = function(){
                if (window.onload && typeof window.onload === 'function') {
                    window.onload();
                }
                window.savory = new Savory();
            }
        } else { // or in bottom of body
            window.savory = new Savory();
        }
    }

    return Savory;
}));