text:
DELIMITER $$

DROP PROCEDURE IF EXISTS `DROP_EMPTY_TABLES_FROM` $$
CREATE PROCEDURE `DROP_EMPTY_TABLES_FROM`(IN schema_target VARCHAR(128))
BEGIN
  DECLARE table_list TEXT;
  DECLARE total      VARCHAR(11);

  SELECT
    GROUP_CONCAT(`TABLE_NAME`),
    COUNT(`TABLE_NAME`)
  INTO
    table_list,
    total
  FROM `information_schema`.`TABLES`
  WHERE `TABLE_SCHEMA` = schema_target
    AND `TABLE_ROWS`   = 0;

  IF table_list IS NOT NULL THEN
    SET @drop_tables = CONCAT("DROP TABLE ", table_list);

    PREPARE stmt FROM @drop_tables;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
  END IF;

  SELECT total AS affected_tables;
END $$

DELIMITER ;


text:
This directory contains the Docker source for Jenkins master and slaves for AeroGear Digger.

## Why another image?

OpenShift Jenkins Docker images use "source to image" approach for customizing Jenkins plugins and configuration.
We make use of the "source to image" so that any changes made to the Jenkins configuration and plugins would be persisted.

For base image source code and documentation please refer to https://github.com/openshift/jenkins

## Building

S2I build is required in order to install new plugins and configuration
Install s2i build tool from: https://github.com/openshift/source-to-image/releases/tag/v1.1.3
Build openshift jenkins image with our modifications on your local machine

    cd jenkins2-centos
    docker build . -t aerogear/jenkins-2-centos7-s2i

Execute s2i build command:

    s2i build . aerogear/jenkins-2-centos7-s2i aerogear/jenkins-2-centos7

For release builds, publish image to Docker Hub:

    docker push aerogear/jenkins-2-centos7

## Versions

To use different OS or Jenkins versions please use different base images when executing `s2i build`.
Available images here: <https://github.com/openshift/jenkins>

## Development

Sample development workflow

1. Apply changes in the Jenkins instance

Change Jenkins configuration and pipelines definitions as you wish.

2. Update repository

If you would like to change Jenkins pipeline definition, update corresponding `jenkinsfile` in repository.

For internal Jenkins configuration we would need to make changes on a Jenkins instance using the UI,
then extract the configuration and update it manually.

3. Extracting jenkins configuration

```
    oc project {jenkins project}
    oc rsh {jenkins-pod}
    cat /var/lib/jenkins/configuration.xml
```

Then, copy configuration into the repository ([`configuration.xml.tpl`](./configuration/configuration.xml.tpl)) and build new image.

## Jenkins Slaves `Dockerfile`s

Jenkins Kubernetes plugin slaves:

-  [android-slave](./android-slave)

### Build

We are using s2i technology to for building mobile jenkins slaves. During the s2i build, a specific version of the Android SDK is installed and the user is asked to confirm all required licenses.

The android slave extends the openshift/jenkins-slave-base-centos7
Any change in s2i dockerfile would require an image build.

    cd android-slave directory
    docker build -t aerogear/jenkins-android-slave-s2i

If no changes are needed, pull the base s2i image from docker

```
docker pull docker.io/aerogear/android-sdk-sti

```

To include the android-sdk, download the required sdk, install and accept the license agreement
The following script is an example of downloading the sdk installation

    ```
    wget --output-document=android-sdk.tgz --quiet https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
    tar xzf android-sdk.tgz

    android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools,tools,build-tools-25.0.0,android-25,addon-google_apis_x86-google-21,extra-android-support,extra-google-google_play_services

    ```
Now execute the s2i build, assuming we are using the base image (docker.io/aerogear/android-sdk-sti i.e. no changes were needed)
This will build the final image with the android sdk version that was installed

    ```
    s2i build <directory-where-sdk-has-been-installed> docker.io/aerogear/android-sdk-sti aerogear/jenkins-android-slave:<version>

    ```

For release builds, publish the image to the openshift internal registry - please refer to this link for more info
https://docs.openshift.com/container-platform/3.3/dev_guide/managing_images.html

redpajama_set_name: RedPajamaGithub


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.belocraft.network;

import com.belocraft.models.Move;
import com.belocraft.models.Player;
import com.belocraft.models.World;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonStructure;

/**
 *
 * @author Eugene
 */
public class Network implements INetwork {

    private Socket socket;
    private RemoteProcess remote;

    public Network(RemoteProcess remoteProcess) {
        this.remote = remoteProcess;
    }

    public Boolean connect(String adress, int port)
    {
        System.out.println("try connect to server");

         try {
                this.socket = new Socket(adress, port);
                System.out.println("connect successful");
            return true;
            } catch (IOException ex) {
                Logger.getLogger(Network.class.getName()).log(Level.SEVERE, null, ex);
                System.out.println("connect fail");
            return false;
            }
    }

    @Override
    public PlayerContext readSocket() {

        String incomeJson = null;

        try {
            InputStream inputStream = socket.getInputStream();
            int avalible = inputStream.available();
            byte buf[] = new byte[avalible];
            inputStream.read(buf, 0, avalible);
            incomeJson = new String(buf);

        } catch (IOException ex) {
            Logger.getLogger(Network.class.getName()).log(Level.SEVERE, null, ex);
            remote.setGameOver(true);
        }

        if (incomeJson == null || incomeJson.equals("")) {
            return null;
        }

        InputStream is
                = new ByteArrayInputStream(incomeJson.getBytes(Charset.defaultCharset()));

        JsonReader reader = Json.createReader(is);

        JsonStructure js = reader.read();
        JsonObject jo = (JsonObject) js;

        float position_x = (float) jo.getJsonNumber("x").doubleValue();

        Player player = new Player(position_x);

        Player[] players = new Player[1];
        players[0] = player;

        PlayerContext pc = new PlayerContext(player, new World(players));

        Boolean game_over = jo.getBoolean("game_over");
        if (game_over) {
            pc.setGameOver();
        }

        return pc;
    }

    @Override
    public void writeSocket(Move move) {

        String direction;

        switch (move.getDirection()) {
            case left:
                direction = "left";
                break;
            case right:
                direction = "right";
                break;
            default:
                direction = "none";
                break;
        }

        JsonObject value = Json.createObjectBuilder()
                .add("direction", direction)
                .build();

        try {
            socket.getOutputStream().write(value.toString().getBytes());
        } catch (IOException ex) {
            Logger.getLogger(Network.class.getName()).log(Level.SEVERE, null, ex);
            remote.setGameOver(true);
        }
    }

}


text:
//
//  CDAWiFiTypes.h
//  CDAWiFi
//
//  Created by Alsey Coleman Miller on 2/28/15.
//  Copyright (c) 2015 ColemanCDA. All rights reserved.
//

/*!
 * @typedef CWErr
 *
 * @abstract Error codes corresponding to the CWErrorDomain domain.
 *
 * @constant CDAWiFiNoErr
 * Success.
 *
 * @constant CDAWiFiEAPOLErr
 * EAPOL-related error.
 *
 * @constant CDAWiFiInvalidParameterErr
 * Parameter error.
 *
 * @constant CDAWiFiNoMemoryErr
 * Memory allocation failed.
 *
 * @constant CDAWiFiUnknownErr
 * Unexpected error condition encountered for which no error code exists.
 *
 * @constant CDAWiFiNotSupportedErr
 * Operation not supported.
 *
 * @constant CDAWiFiInvalidFormatErr
 * Invalid protocol element field detected.
 *
 * @constant CDAWiFiTimeoutErr
 * Operation timed out.
 *
 * @constant CDAWiFiUnspecifiedFailureErr
 * Access point did not specify a reason for authentication/association failure.
 *
 * @constant CDAWiFiUnsupportedCapabilitiesErr
 * Access point cannot support all requested capabilities.
 *
 * @constant CDAWiFiReassociationDeniedErr
 * Reassociation was denied because the access point was unable to determine that an association exists.
 *
 * @constant CDAWiFiAssociationDeniedErr
 * Association was denied for an unspecified reason.
 *
 * @constant CDAWiFiAuthenticationAlgorithmUnsupportedErr
 * Specified authentication algorithm is not supported.
 *
 * @constant CDAWiFiInvalidAuthenticationSequenceNumberErr
 * Authentication frame received with an authentication sequence number out of expected sequence.
 *
 * @constant CDAWiFiChallengeFailureErr
 * Authentication was rejected because of a challenge failure.
 *
 * @constant CDAWiFiAPFullErr
 * Access point is unable to handle another associated station.
 *
 * @constant CDAWiFiUnsupportedRateSetErr
 * Interface does not support all of the rates in the basic rate set of the access point.
 *
 * @constant CDAWiFiShortSlotUnsupportedErr
 * Association denied because short slot time option is not supported by requesting station.
 *
 * @constant CDAWiFiDSSSOFDMUnsupportedErr
 * Association denied because DSSS-OFDM is not supported by requesting station.
 *
 * @constant CDAWiFiInvalidInformationElementErr
 * Invalid information element included in association request.
 *
 * @constant CDAWiFiInvalidGroupCipherErr
 * Invalid group cipher requested.
 *
 * @constant CDAWiFiInvalidPairwiseCipherErr
 * Invalid pairwise cipher requested.
 *
 * @constant CDAWiFiInvalidAKMPErr
 * Invalid authentication selector requested.
 *
 * @constant CDAWiFiUnsupportedRSNVersionErr
 * Invalid WPA/WPA2 version specified.
 *
 * @constant CDAWiFiInvalidRSNCapabilitiesErr
 * Invalid RSN capabilities specified in association request.
 *
 * @constant CDAWiFiCipherSuiteRejectedErr
 * Cipher suite rejected due to network security policy.
 *
 * @constant CDAWiFiInvalidPMKErr
 * PMK rejected by the access point.
 *
 * @constant CDAWiFiSupplicantTimeoutErr
 * WPA/WPA2 handshake timed out.
 *
 * @constant CDAWiFiHTFeaturesNotSupportedErr
 * Association was denied because the requesting station does not support HT features.
 *
 * @constant CDAWiFiPCOTransitionTimeNotSupportedErr
 * Association was denied because the requesting station does not support the PCO transition time required by the AP.
 *
 * @constant CDAWiFiReferenceNotBoundErr
 * No interface is bound to the CWInterface object.
 *
 * @constant CDAWiFiIPCFailureErr
 * Error communicating with a separate process.
 *
 * @constant CDAWiFiOperationNotPermittedErr
 * Calling process does not have permission to perform this operation.
 *
 * @constant CDAWiFiErr
 * Generic error, no specific error code exists to describe the error condition.
 */
/* Error codes corresponding to the CDAWiFiErrorDomain domain. */
typedef enum
{
    CDAWiFiNoError                                      = 0,
    CDAWiFiEAPOLError									= 1,
    CDAWiFiInvalidParameterError						= -3900,
    CDAWiFiNoMemoryError								= -3901,
    CDAWiFiUnknownError                                 = -3902,
    CDAWiFiNotSupportedError							= -3903,
    CDAWiFiInvalidFormatError							= -3904,
    CDAWiFiTimeoutError                                 = -3905,
    CDAWiFiUnspecifiedFailureError                      = -3906,
    CDAWiFiUnsupportedCapabilitiesError                 = -3907,
    CDAWiFiReassociationDeniedError                     = -3908,
    CDAWiFiAssociationDeniedError						= -3909,
    CDAWiFiAuthenticationAlgorithmUnsupportedError      = -3910,
    CDAWiFiInvalidAuthenticationSequenceNumberError     = -3911,
    CDAWiFiChallengeFailureError						= -3912,
    CDAWiFiAPFullError                                  = -3913,
    CDAWiFiUnsupportedRateSetError                      = -3914,
    CDAWiFiShortSlotUnsupportedError					= -3915,
    CDAWiFiDSSSOFDMUnsupportedError                     = -3916,
    CDAWiFiInvalidInformationElementError				= -3917,
    CDAWiFiInvalidGroupCipherError                      = -3918,
    CDAWiFiInvalidPairwiseCipherError					= -3919,
    CDAWiFiInvalidAKMPError                             = -3920,
    CDAWiFiUnsupportedRSNVersionError					= -3921,
    CDAWiFiInvalidRSNCapabilitiesError                  = -3922,
    CDAWiFiCipherSuiteRejectedError                     = -3923,
    CDAWiFiInvalidPMKError                              = -3924,
    CDAWiFiSupplicantTimeoutError						= -3925,
    CDAWiFiHTFeaturesNotSupportedError                  = -3926,
    CDAWiFiPCOTransitionTimeNotSupportedError			= -3927,
    CDAWiFiReferenceNotBoundError						= -3928,
    CDAWiFiIPCFailureError                              = -3929,
    CDAWiFiOperationNotPermittedError					= -3930,

    /* Generic error, no specific error code exists to describe the error condition. */
    CDAWiFiGenericError									= -3931,
} CDAWiFiError;

/*!
 * @typedef CWPHYMode
 *
 * @abstract Type describing the IEEE 802.11 physical layer mode.
 *
 * @constant CDAWiFiPHYModeNone
 *
 * @constant CDAWiFiPHYMode11a
 * IEEE 802.11a physical layer mode.
 *
 * @constant CDAWiFiPHYMode11b
 * IEEE 802.11b physical layer mode.
 *
 * @constant CDAWiFiPHYMode11g
 * IEEE 802.11g physical layer mode.
 *
 * @constant CDAWiFiPHYMode11n
 * IEEE 802.11n physical layer mode.
 *
 * @constant CDAWiFiPHYMode11ac
 * IEEE 802.11ac physical layer mode.
 */
typedef enum
{
    CDAWiFiPHYModeNone		= 0,
    CDAWiFiPHYMode11a		= 1,
    CDAWiFiPHYMode11b		= 2,
    CDAWiFiPHYMode11g		= 3,
    CDAWiFiPHYMode11n		= 4,
    CDAWiFiPHYMode11ac      = 5,
} CDAWiFiPHYMode;

/*!
 * @typedef CWInterfaceMode
 *
 * @abstract Wi-Fi interface operating modes returned by -[CWInterface interfaceMode].
 *
 * @constant CDAWiFiInterfaceModeNone
 * Interface is not in any mode.
 *
 * @constant CDAWiFiInterfaceModeStation
 * Interface is participating in an infrastructure network as a non-AP station.
 *
 * @constant CDAWiFiInterfaceModeIBSS
 * Interface is participating in an IBSS network.
 *
 * @constant CDAWiFiInterfaceModeHostAP
 * Interface is participating in an infrastructure network as an access point.
 */
typedef enum
{
    CDAWiFiInterfaceModeNone			= 0,
    CDAWiFiInterfaceModeStation			= 1,
    CDAWiFiInterfaceModeIBSS			= 2,
    CDAWiFiInterfaceModeHostAP			= 3,
} CDAWiFiInterfaceMode;

/*!
 * @typedef CWSecurity
 *
 * @abstract Wi-Fi security types.
 *
 * @constant CDAWiFiSecurityNone
 * Open System authentication.
 *
 * @constant CDAWiFiSecurityWEP
 * WEP security.
 *
 * @constant CDAWiFiSecurityWPAPersonal
 * WPA Personal authentication.
 *
 * @constant CDAWiFiSecurityWPAPersonalMixed
 * WPA/WPA2 Personal authentication.
 *
 * @constant CDAWiFiSecurityWPA2Personal
 * WPA2 Personal authentication.
 *
 * @constant CDAWiFiSecurityDynamicWEP
 * Dynamic WEP security.
 *
 * @constant CDAWiFiSecurityWPAEnterprise
 * WPA Enterprise authentication.
 *
 * @constant CDAWiFiSecurityWPAEnterpriseMixed
 * WPA/WPA2 Enterprise authentication.
 *
 * @constant CDAWiFiSecurityWPA2Enterprise
 * WPA2 Enterprise authentication.
 *
 * @constant CDAWiFiSecurityUnknown
 * Unknown security type.
 */
typedef enum
{
    CDAWiFiSecurityNone                 = 0,
    CDAWiFiSecurityWEP                  = 1,
    CDAWiFiSecurityWPAPersonal          = 2,
    CDAWiFiSecurityWPAPersonalMixed     = 3,
    CDAWiFiSecurityWPA2Personal         = 4,
    CDAWiFiSecurityPersonal             = 5,
    CDAWiFiSecurityDynamicWEP           = 6,
    CDAWiFiSecurityWPAEnterprise        = 7,
    CDAWiFiSecurityWPAEnterpriseMixed   = 8,
    CDAWiFiSecurityWPA2Enterprise       = 9,
    CDAWiFiSecurityEnterprise           = 10,
    CDAWiFiSecurityUnknown              = INTMAX_MAX,
} CDAWiFiSecurity;

/*!
 * @typedef CWIBSSModeSecurity
 *
 * @abstract IBSS security types used in -[CWInterface startIBSSModeWithSSID:security:channel:password:error:].
 *
 * @constant CDAWiFiIBSSModeSecurityNone
 * Open System authentication.
 *
 * @constant CDAWiFiIBSSModeSecurityWEP40
 * WEP security.
 *
 * @constant CDAWiFiIBSSModeSecurityWEP104
 * WPA Personal authentication.
 */
typedef enum
{
    CDAWiFiIBSSModeSecurityNone         = 0,
    CDAWiFiIBSSModeSecurityWEP40		= 1,
    CDAWiFiIBSSModeSecurityWEP104       = 2,
} CDAWiFiIBSSModeSecurity;

/*!
 * @typedef CWChannelWidth
 *
 * @abstract Channel width values returned by -[CWChannel channelWidth].
 *
 * @constant CDAWiFiChannelWidthUnknown
 * Unknown channel width.
 *
 * @constant CDAWiFiChannelWidth20MHz
 * 20MHz channel width.
 *
 * @constant CDAWiFiChannelWidth40MHz
 * 40MHz channel width.
 *
 * @constant CDAWiFiChannelWidth80MHz
 * 80MHz channel width.
 *
 * @constant CDAWiFiChannelWidth160MHz
 * 160MHz channel width.
 */
typedef enum
{
    CDAWiFiChannelWidthUnknown	= 0,
    CDAWiFiChannelWidth20MHz	= 1,
    CDAWiFiChannelWidth40MHz	= 2,
    CDAWiFiChannelWidth80MHz	= 3,
    CDAWiFiChannelWidth160MHz	= 4,
} CDAWiFiChannelWidth;

/*!
 * @typedef CWChannelBand
 *
 * @abstract Channel band values returned by -[CWChannel channelBand].
 *
 * @constant CDAWiFiChannelBandUnknown
 * Unknown channel band.
 *
 * @constant CDAWiFiChannelBand2GHz
 * 2.4GHz channel band.
 *
 * @constant CDAWiFiChannelBand5GHz
 * 5GHz channel band.
 */
typedef enum
{
    CDAWiFiChannelBandUnknown	= 0,
    CDAWiFiChannelBand2GHz		= 1,
    CDAWiFiChannelBand5GHz		= 2,
} CDAWiFiChannelBand;

/*!
 * @typedef CWCipherKeyFlags
 *
 * @abstract Cipher key flags used in -[CWInterface setWEPKey:flags:index:error:].
 *
 * @constant CDAWiFiCipherKeyFlagsNone
 * Open System authentication.
 *
 * @constant CDAWiFiCipherKeyFlagsUnicast
 * Cipher key will be used for unicast packets.
 *
 * @constant CDAWiFiCipherKeyFlagsMulticast
 * Cipher key will be used for multicast packets.
 *
 * @constant CDAWiFiCipherKeyFlagsTx
 * Cipher key will be used for packets sent from the interface.
 *
 * @constant CDAWiFiCipherKeyFlagsRx
 * Cipher key will be used for packets received by the interface.
 */
typedef enum
{
    CDAWiFiCipherKeyFlagsNone			= 0,
    CDAWiFiCipherKeyFlagsUnicast		= (1UL << 1),
    CDAWiFiCipherKeyFlagsMulticast		= (1UL << 2),
    CDAWiFiCipherKeyFlagsTx				= (1UL << 3),
    CDAWiFiCipherKeyFlagsRx				= (1UL << 4),
} CDAWiFiCipherKeyFlags;

/*!
 * @typedef CWKeychainDomain
 *
 * @abstract Keychain domain types used by CoreWLAN keychain methods.
 *
 * @constant CDAWiFiKeychainDomainNone
 * No keychain domain specified.
 *
 * @constant CDAWiFiKeychainDomainUser
 * The user keychain domain. If iCloud Keychain is enabled, the iCloud keychain is the user keychain.
 *
 * @constant CDAWiFiKeychainDomainSystem
 * The system keychain domain.
 */
typedef enum
{
    CDAWiFiKeychainDomainNone       = 0,
    CDAWiFiKeychainDomainUser       = 1,
    CDAWiFiKeychainDomainSystem     = 2,
} CDAWiFiKeychainDomain;

/*!
 * @typedef CWEventType
 *
 * @abstract Wi-Fi event types used in -[CWWiFiClient startMonitoringEventWithType:error:].
 *
 * @constant CWEventTypeNone
 * No event type specified.
 *
 * @constant CWEventTypePowerDidChange
 * Posted when the power state of any Wi-Fi interface changes.
 *
 * @constant CWEventTypeSSIDDidChange
 * Posted when the current SSID of any Wi-Fi interface changes.
 *
 * @constant CWEventTypeBSSIDDidChange
 * Posted when the current BSSID of any Wi-Fi interface changes.
 *
 * @constant CWEventTypeCountryCodeDidChange
 * Posted when the adopted country code of any Wi-Fi interface changes.
 *
 * @constant CWEventTypeLinkDidChange
 * Posted when the link state for any Wi-Fi interface changes.
 *
 * @constant CWEventTypeLinkQualityDidChange
 * Posted when the RSSI or transmit rate for any Wi-Fi interface changes.
 *
 * @constant CWEventTypeModeDidChange
 * Posted when the operating mode of any Wi-Fi interface changes.
 *
 * @constant CWEventTypeScanCacheUpdated
 * Posted when the scan cache of any Wi-Fi interface is updated with new scan results.
 *
 * @constant CWEventTypeUnknown
 * Unknown event type.
 */
typedef enum
{
    CDAWiFiEventTypeNone                     = 0,
    CDAWiFiEventTypePowerDidChange           = 1,
    CDAWiFiEventTypeSSIDDidChange            = 2,
    CDAWiFiEventTypeBSSIDDidChange           = 3,
    CDAWiFiEventTypeCountryCodeDidChange     = 4,
    CDAWiFiEventTypeLinkDidChange            = 5,
    CDAWiFiEventTypeLinkQualityDidChange     = 6,
    CDAWiFiEventTypeModeDidChange            = 7,
    CDAWiFiEventTypeScanCacheUpdated         = 8,
    CDAWiFiEventTypeUnknown                  = INTMAX_MAX
} CDAWiFiEventType;


text:
(function($ , undefined) {

	//var $ = require('jquery');

	// SPINNER CONSTRUCTOR AND PROTOTYPE

	var Spinner = function (element, options) {
		this.$element = $(element);
		this.options = $.extend({}, $.fn.spinner.defaults, options);
		this.$input = this.$element.find('.spinner-input');
		this.$element.on('keyup', this.$input, $.proxy(this.change, this));

		if (this.options.hold) {
			this.$element.on('mousedown', '.spinner-up', $.proxy(function() { this.startSpin(true); } , this));
			this.$element.on('mouseup', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
			this.$element.on('mouseout', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
			this.$element.on('mousedown', '.spinner-down', $.proxy(function() {this.startSpin(false);} , this));
		} else {
			this.$element.on('click', '.spinner-up', $.proxy(function() { this.step(true); } , this));
			this.$element.on('click', '.spinner-down', $.proxy(function() { this.step(false); }, this));
		}

		this.switches = {
			count: 1,
			enabled: true
		};

		if (this.options.speed === 'medium') {
			this.switches.speed = 300;
		} else if (this.options.speed === 'fast') {
			this.switches.speed = 100;
		} else {
			this.switches.speed = 500;
		}

		this.lastValue = null;

		this.render();

		if (this.options.disabled) {
			this.disable();
		}
	};

	Spinner.prototype = {
		constructor: Spinner,

		render: function () {
			this.$input.val(this.options.value);
//			this.$input.attr('maxlength',(this.options.max + '').split('').length);
		},

		change: function () {
			var newVal = this.$input.val();

//			if(newVal/1){
//                this.options.value = newVal;
////				this.options.value = newVal/1;
//			}else{
//				newVal = newVal.replace(/[^0-9]/g,'');
//				this.$input.val(newVal);
//                this.options.value = newVal;
//			}
            this.formatValue(newVal);
			this.triggerChangedEvent();
		},

        formatValue: function (newVal) {
            switch(this.$input.data('toggle')) {
                case 'integer':
                    if(newVal/1) {
                    }else{
                        newVal = newVal.replace(/[^0-9]/g,'');
                    }
                    this.$input.val(newVal/1);
                    this.options.value = newVal/1;
                    break;
                case 'float':
                    if(newVal/1){
                    }else{
                        newVal = newVal.replace(/[^0-9\.]/g,'')
                    }
                    this.$input.val(newVal);
                    this.options.value = newVal;
                    break;
            }
        },

		stopSpin: function () {
			clearTimeout(this.switches.timeout);
			this.switches.count = 1;
			this.triggerChangedEvent();
		},

		triggerChangedEvent: function () {
			var currentValue = this.value();
			if (currentValue === this.lastValue) return;

			this.lastValue = currentValue;

			// Primary changed event
			this.$element.trigger('changed', currentValue);

			// Undocumented, kept for backward compatibility
			this.$element.trigger('change');
		},

		startSpin: function (type) {

			if (!this.options.disabled) {
				var divisor = this.switches.count;

				if (divisor === 1) {
					this.step(type);
					divisor = 1;
				} else if (divisor < 3){
					divisor = 1.5;
				} else if (divisor < 8){
					divisor = 2.5;
				} else {
					divisor = 4;
				}

				this.switches.timeout = setTimeout($.proxy(function() {this.iterator(type);} ,this),this.switches.speed/divisor);
				this.switches.count++;
			}
		},

		iterator: function (type) {
			this.step(type);
			this.startSpin(type);
		},

		step: function (dir) {
			var curValue = this.options.value;
			var limValue = dir ? this.options.max : this.options.min;

			if ((dir ? curValue < limValue : curValue > limValue)) {
				var newVal = curValue + (dir ? 1 : -1) * this.options.step;

				if (dir ? newVal > limValue : newVal < limValue) {
					this.value(limValue);
				} else {
					this.value(newVal);
				}
			}
		},

		value: function (value) {
			if (!isNaN(parseFloat(value)) && isFinite(value)) {
				value = parseFloat(value);
				this.options.value = value;
				this.$input.val(value);
				return this;
			} else {
				return this.options.value;
			}
		},

		disable: function () {
			this.options.disabled = true;
			this.$input.attr('disabled','');
			this.$element.find('button').addClass('disabled');
		},

		enable: function () {
			this.options.disabled = false;
			this.$input.removeAttr("disabled");
			this.$element.find('button').removeClass('disabled');
		}
	};

	// SPINNER PLUGIN DEFINITION

	$.fn.spinner = function (option,value) {
		var methodReturn;

		var $set = this.each(function () {
			var $this = $(this);
			var data = $this.data('spinner');
			var options = typeof option === 'object' && option;

			if (!data) $this.data('spinner', (data = new Spinner(this, options)));
			if (typeof option === 'string') methodReturn = data[option](value);
		});

		return (methodReturn === undefined) ? $set : methodReturn;
	};

	$.fn.spinner.defaults = {
		value: 1,
		min: 1,
		max: 999,
		step: 1,
		hold: true,
		speed: 'medium',
		disabled: false
	};

	$.fn.spinner.Constructor = Spinner;

	// SPINNER DATA-API

	$(function () {
		$('body').on('mousedown.spinner.data-api', '.spinner', function (e) {
			var $this = $(this);
			if ($this.data('spinner')) return;
			$this.spinner($this.data());
		});
	});

})(window.jQuery);


text:
import { Meteor } from 'meteor/meteor';

import { hasPermission, getUsersInRole } from '../../../authorization';

Meteor.publish('livechat:agents', function() {
	if (!this.userId) {
		return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' }));
	}

	if (!hasPermission(this.userId, 'view-l-room')) {
		return this.error(new Meteor.Error('error-not-authorized', 'Not authorized', { publish: 'livechat:agents' }));
	}

	const self = this;

	const handle = getUsersInRole('livechat-agent').observeChanges({
		added(id, fields) {
			self.added('agentUsers', id, fields);
		},
		changed(id, fields) {
			self.changed('agentUsers', id, fields);
		},
		removed(id) {
			self.removed('agentUsers', id);
		},
	});

	self.ready();

	self.onStop(function() {
		handle.stop();
	});
});


text:
//using iayos.flashcardapi.DomainModel.Models;

//namespace iayos.flashcardapi.Domain.Interactor.Application
//{
//	public interface ICreateApplicationValidator
//	{
//		void ThrowOnInsufficientPermissions(UserModel agent);

//		void ThrowOnInvalidApplicationName(string applicationName);
//	}
//}


text:
package org.kaaproject.kaa.server.admin.client.mvp.place;

import org.kaaproject.kaa.server.admin.client.util.Utils;

import com.google.gwt.place.shared.Prefix;

public class GeneralPropertiesPlace extends AbstractPropertiesPlace {

    public GeneralPropertiesPlace() {
    }

    @Override
    public boolean equals(Object obj) {
        return obj != null && (obj instanceof GeneralPropertiesPlace);
    }

    @Prefix(value = "genProps")
    public static class Tokenizer extends AbstractPropertiesPlace.Tokenizer<GeneralPropertiesPlace> {
        @Override
        public GeneralPropertiesPlace getPlace(String token) {
            return new GeneralPropertiesPlace();
        }
    }

    @Override
    public String getName() {
        return Utils.constants.generalSettings();
    }
}


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from django.conf import settings
from django.contrib import admin

from lizard_apps import models

def get_image_tag(app):
    if app.icon:
        return '<img src="{}{}" />'.format(settings.MEDIA_URL, app.icon)
    else:
        return '-'

class ApplicationAdmin(admin.ModelAdmin):
    list_display = ['name', 'url']
    readonly_fields = ['image_tag']

    def image_tag(self, obj):
        return get_image_tag(obj)

    image_tag.allow_tags = True
    image_tag.short_description = 'Preview'

class ApplicationScreenInline(admin.TabularInline):
    model = models.ApplicationScreen
    readonly_fields = ['image_tag']
    verbose_name = 'Application'
    verbose_name_plural = 'Applications'
    extra = 1

    def image_tag(self, obj):
        return get_image_tag(obj.application)

    image_tag.allow_tags = True
    image_tag.short_description = 'Preview'

class ScreenAdmin(admin.ModelAdmin):
    inlines = [ApplicationScreenInline]

admin.site.register(models.Application, ApplicationAdmin)
admin.site.register(models.Screen, ScreenAdmin)


text:
#ifndef __R0P7734_H
#define __R0P7734_H

#undef DEBUG
#define CONFIG_CPU_SH7734	1
#define CONFIG_R0P7734		1
#define CONFIG_400MHZ_MODE	1
/* #define CONFIG_533MHZ_MODE	1 */

#define CONFIG_BOARD_LATE_INIT
#define CONFIG_SYS_TEXT_BASE 0x8FFC0000

#define CONFIG_CMD_PING
#define CONFIG_CMD_MII
#define CONFIG_CMD_SDRAM
#define CONFIG_CMD_ENV

#define CONFIG_BAUDRATE		115200
#define CONFIG_BOOTDELAY	3
#define CONFIG_BOOTARGS		"console=ttySC3,115200"

#define CONFIG_VERSION_VARIABLE
#undef  CONFIG_SHOW_BOOT_PROGRESS

/* Ether */
#define CONFIG_SH_ETHER 1
#define CONFIG_SH_ETHER_USE_PORT (0)
#define CONFIG_SH_ETHER_PHY_ADDR (0x0)
#define CONFIG_PHYLIB
#define CONFIG_PHY_SMSC 1
#define CONFIG_BITBANGMII
#define CONFIG_BITBANGMII_MULTI
#define CONFIG_SH_ETHER_SH7734_MII (0x00) /* MII */
#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
#ifndef CONFIG_SH_ETHER
# define CONFIG_SMC911X
# define CONFIG_SMC911X_16_BIT
# define CONFIG_SMC911X_BASE (0x84000000)
#endif

/* I2C */
#define CONFIG_CMD_I2C
#define CONFIG_SH_SH7734_I2C	1
#define CONFIG_HARD_I2C			1
#define CONFIG_I2C_MULTI_BUS	1
#define CONFIG_SYS_MAX_I2C_BUS	2
#define CONFIG_SYS_I2C_MODULE	0
#define CONFIG_SYS_I2C_SPEED	100000 /* 100 kHz */
#define CONFIG_SYS_I2C_SLAVE	0x50
#define CONFIG_SH_I2C_DATA_HIGH	4
#define CONFIG_SH_I2C_DATA_LOW	5
#define CONFIG_SH_I2C_CLOCK		500000000
#define CONFIG_SH_I2C_BASE0		0xFFC70000
#define CONFIG_SH_I2C_BASE1		0xFFC7100

/* undef to save memory	*/
#define CONFIG_SYS_LONGHELP
/* Monitor Command Prompt */
/* Buffer size for input from the Console */
#define CONFIG_SYS_CBSIZE		256
/* Buffer size for Console output */
#define CONFIG_SYS_PBSIZE		256
/* max args accepted for monitor commands */
#define CONFIG_SYS_MAXARGS		16
/* Buffer size for Boot Arguments passed to kernel */
#define CONFIG_SYS_BARGSIZE	512
/* List of legal baudrate settings for this board */
#define CONFIG_SYS_BAUDRATE_TABLE	{ 115200 }

/* SCIF */
#define CONFIG_SCIF_CONSOLE	1
#define CONFIG_SCIF			1
#define CONFIG_CONS_SCIF3	1

/* Suppress display of console information at boot */
#undef  CONFIG_SYS_CONSOLE_INFO_QUIET
#undef  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
#undef  CONFIG_SYS_CONSOLE_ENV_OVERWRITE

/* SDRAM */
#define CONFIG_SYS_SDRAM_BASE	(0x88000000)
#define CONFIG_SYS_SDRAM_SIZE	(128 * 1024 * 1024)
#define CONFIG_SYS_LOAD_ADDR	(CONFIG_SYS_SDRAM_BASE + 16 * 1024 * 1024)

#define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE)
#define CONFIG_SYS_MEMTEST_END	 (CONFIG_SYS_MEMTEST_START + 100 * 1024 * 1024)
/* Enable alternate, more extensive, memory test */
#undef  CONFIG_SYS_ALT_MEMTEST
/* Scratch address used by the alternate memory test */
#undef  CONFIG_SYS_MEMTEST_SCRATCH

/* Enable temporary baudrate change while serial download */
#undef  CONFIG_SYS_LOADS_BAUD_CHANGE

/* FLASH */
#define CONFIG_FLASH_CFI_DRIVER 1
#define CONFIG_SYS_FLASH_CFI
#undef  CONFIG_SYS_FLASH_QUIET_TEST
#define CONFIG_SYS_FLASH_EMPTY_INFO
#define CONFIG_SYS_FLASH_BASE	(0xA0000000)
#define CONFIG_SYS_MAX_FLASH_SECT	512

/* if you use all NOR Flash , you change dip-switch. Please see Manual. */
#define CONFIG_SYS_MAX_FLASH_BANKS	1
#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }

/* Timeout for Flash erase operations (in ms) */
#define CONFIG_SYS_FLASH_ERASE_TOUT	(3 * 1000)
/* Timeout for Flash write operations (in ms) */
#define CONFIG_SYS_FLASH_WRITE_TOUT	(3 * 1000)
/* Timeout for Flash set sector lock bit operations (in ms) */
#define CONFIG_SYS_FLASH_LOCK_TOUT	(3 * 1000)
/* Timeout for Flash clear lock bit operations (in ms) */
#define CONFIG_SYS_FLASH_UNLOCK_TOUT	(3 * 1000)

/*
 * Use hardware flash sectors protection instead
 * of U-Boot software protection
 */
#undef  CONFIG_SYS_FLASH_PROTECTION
#undef  CONFIG_SYS_DIRECT_FLASH_TFTP

/* Address of u-boot image in Flash (NOT run time address in SDRAM) ?!? */
#define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_FLASH_BASE)
/* Monitor size */
#define CONFIG_SYS_MONITOR_LEN	(256 * 1024)
/* Size of DRAM reserved for malloc() use */
#define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
#define CONFIG_SYS_BOOTMAPSZ	(8 * 1024 * 1024)

/* ENV setting */
#define CONFIG_ENV_IS_IN_FLASH
#define CONFIG_ENV_OVERWRITE	1
#define CONFIG_ENV_SECT_SIZE	(128 * 1024)
#define CONFIG_ENV_SIZE		(CONFIG_ENV_SECT_SIZE)
#define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)
/* Offset of env Flash sector relative to CONFIG_SYS_FLASH_BASE */
#define CONFIG_ENV_OFFSET	(CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE)
#define CONFIG_ENV_SIZE_REDUND	(CONFIG_ENV_SECT_SIZE)

/* Board Clock */
#if defined(CONFIG_400MHZ_MODE)
#define CONFIG_SYS_CLK_FREQ 50000000
#else
#define CONFIG_SYS_CLK_FREQ 44444444
#endif
#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ
#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ
#define CONFIG_SYS_TMU_CLK_DIV      4

#endif	/* __R0P7734_H */


text:
@interface DictionaryObject : NSObject <NSCopying>
@property (nonatomic, strong) NSMutableDictionary *fields;

- (id) initWithDictionary:(NSDictionary *)dictionary;

@end


text:
/*
Package zen ...
zen is a elegant and lightweight webframe for go backend development
*/
package zen


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vita.Entities.Logging;
using Vita.Entities.Utilities;

namespace Vita.Entities.Model.Construction {
  // key expansion methods
  public partial class EntityModelBuilder {
    private List<EntityKeyInfo> _keysInExpansion;

    // Some keys may contain members that are entity references;
    private void ExpandEntityKeyMembers() {
      _keysInExpansion = new List<EntityKeyInfo>();
      var allKeys = Model.Entities.SelectMany(e => e.Keys).ToList();
      foreach(var key in allKeys)
        if(!ExpandKey(key))
          return;
      _keysInExpansion.Clear();
      CheckErrors();
    }

    private void SetKeyNames() {
      foreach(var ent in Model.Entities)
        foreach(var key in ent.Keys)
          if(string.IsNullOrWhiteSpace(key.ExplicitDbKeyName))
            key.Name = key.ConstructKeyName();
          else
            key.Name = key.ExplicitDbKeyName;

    }

    private bool ExpandKey(EntityKeyInfo key) {
      if(key.IsExpanded())
        return true;
      if(_keysInExpansion.Contains(key)) {
        Log.LogError($"Cannot expand key/index {key.GetFullRef()}, ran into key circular reference.");
        return false;
      }
      try {
        _keysInExpansion.Add(key);
        if(key.KeyType.IsSet(KeyType.ForeignKey))
          return ExpandForeignKey(key);
        ExpandRegularKey(key);
      } finally {
        _keysInExpansion.Remove(key);
      }
      key.HasIdentityMember = key.ExpandedKeyMembers.Any(m => m.Member.Flags.IsSet(EntityMemberFlags.Identity));
      return true;
    }

    // regular, non-foreign key
    private bool ExpandRegularKey(EntityKeyInfo key) {
      key.ExpandedKeyMembers.Clear();
      if(!ExpandRefMembers(key.KeyMembers.Select(km => km.Member).ToList()))
        return false;
      if(!ExpandRefMembers(key.IncludeMembers))
        return false;
      // Key members
      foreach(var km in key.KeyMembers) {
        var member = km.Member;
        if(member.Kind == EntityMemberKind.EntityRef)
          key.ExpandedKeyMembers.AddRange(member.ReferenceInfo.FromKey.ExpandedKeyMembers);
        else
          key.ExpandedKeyMembers.Add(km);
      } //foreach km
      // include members
      foreach(var member in key.IncludeMembers) {
        if(member.Kind == EntityMemberKind.EntityRef) {
          key.ExpandedIncludeMembers.AddRange(member.ReferenceInfo.FromKey.ExpandedKeyMembers.Select(km => km.Member));
        } else
          key.ExpandedIncludeMembers.Add(member);
      } //foreach km
      return true;
    }//method

    private bool ExpandRefMembers(IList<EntityMemberInfo> members) {
      var refMembers = members.Where(m => m.Kind == EntityMemberKind.EntityRef).ToList();
      foreach(var refM in refMembers) {
        var fromKey = refM.ReferenceInfo.FromKey;
        if(fromKey.IsExpanded())
          continue;
        if(!ExpandForeignKey(fromKey))
          return false;
      } //foreach member
      return true;

    }//method

    //FK expansion is a special case - we expand members from target expanded members (of target PrimaryKey)
    private bool ExpandForeignKey(EntityKeyInfo key) {
      var refMember = key.OwnerMember;
      var nullable = refMember.Flags.IsSet(EntityMemberFlags.Nullable);
      var isPk = refMember.Flags.IsSet(EntityMemberFlags.PrimaryKey);
      var refInfo = refMember.ReferenceInfo;
      // check/expand ToKey
      if(!refInfo.ToKey.IsExpanded())
        if(!ExpandKey(refInfo.ToKey))
          return false;
      var toKeyMembers = refInfo.ToKey.ExpandedKeyMembers;
      var propRef = refMember.Entity.EntityType.Name + "." + refMember.MemberName;
      // Check if we have explicitly specified names in ForeignKey attribute
      string[] fkNames = null;
      if(!string.IsNullOrEmpty(refInfo.ForeignKeyColumns)) {
        fkNames = refInfo.ForeignKeyColumns.SplitNames(',', ';');
        if(fkNames.Length != toKeyMembers.Count) {
          Log.LogError($"Invalid KeyColumns specification in property {propRef}: # of columns ({fkNames.Length}) " +
            $" does not match # of columns ({toKeyMembers.Count}) in target primary key.");
          return false;
        }
      }
      // build members
      for(var i = 0; i < toKeyMembers.Count; i++) {
        var targetMember = toKeyMembers[i].Member;
        string fkMemberName = (fkNames == null) ? refMember.MemberName + "_" + targetMember.MemberName : fkMemberName = fkNames[i];
        var memberType = targetMember.DataType;
        //If reference is nullable, then force member to be nullable too - and flip c# type to nullable
        if(nullable && (memberType.IsValueType || memberType.IsEnum)) {
          //CLR type is not nullable - flip it to nullable
          memberType = ReflectionHelper.GetNullable(memberType);
        }
        var fkMember = key.Entity.GetMember(fkMemberName);
        // if member exists, it is declared explicitly, or maybe it is part of another FK
        if(fkMember != null) {
          // check it matches the type
          if(fkMember.DataType != memberType) {
            Log.LogError($"Property {propRef}: underlying foreign key column '{fkMemberName}' already exists - " +
              $"it is declared explicitly (or is a part of another key) and its type {fkMember.DataType} does not match foreign key column type {memberType.Name}.");
            return false;
          }
        } else {
          //create new column member
          fkMember = new EntityMemberInfo(key.Entity, EntityMemberKind.Column, fkMemberName, memberType);
          fkMember.ExplicitDbTypeSpec = targetMember.ExplicitDbTypeSpec;
        }
        fkMember.Flags |= EntityMemberFlags.ForeignKey;
        if(targetMember.Size > 0)
          fkMember.Size = targetMember.Size;
        if(targetMember.Flags.IsSet(EntityMemberFlags.AutoValue)) {
          fkMember.Flags |= EntityMemberFlags.AutoValue;
        }
        fkMember.ForeignKeyOwner = refMember;
        if(nullable)
          fkMember.Flags |= EntityMemberFlags.Nullable;
        if(isPk)
          fkMember.Flags |= EntityMemberFlags.PrimaryKey;
        //copy old names
        if(key.OwnerMember.OldNames != null)
          fkMember.OldNames = key.OwnerMember.OldNames.Select(n => n + "_" + targetMember.MemberName).ToArray();
        key.ExpandedKeyMembers.Add(new EntityKeyMemberInfo(fkMember, false));
      }//foreach targetMember
      return true;
    }

  }
}


text:
describe 'GH-769', site: true do
  before do
    File.write('content/index.md', 'Index!')
    File.write('content/donkey.md', 'Donkey! [<%= @item.parent.identifier %>]')

    File.open('nanoc.yaml', 'w') do |io|
      io << 'string_pattern_type: legacy' << "\n"
      io << 'data_sources:' << "\n"
      io << '  -' << "\n"
      io << '    type: filesystem' << "\n"
      io << '    identifier_type: legacy' << "\n"
    end

    File.write('Rules', <<EOS)
  compile '*' do
    filter :erb
    write item.identifier + 'index.html'
  end

  layout '/foo.*', :erb
EOS
  end

  it 'finds the parent if the parent is root' do
    site = Nanoc::Int::SiteLoader.new.new_from_cwd
    site.compile

    expect(File.read('output/donkey/index.html')).to eql('Donkey! [/]')
  end
end


text:
<?xml version='1.0' encoding='utf-8'?>
<resources>
  <string name="app_desc">Enkel og omfattende SSH-klient med åpen kildekode.</string>
  <string name="service_desc">Opprettholder SSH-tilkoblinger og innlastede offentlige nøkler</string>
  <string name="title_hosts_list">Verter</string>
  <string name="title_pubkey_list">Offentlige nøkler</string>
  <string name="title_port_forwards_list">Portvideresending</string>
  <string name="title_host_editor">Rediger vert</string>
  <string name="title_help">Hjelp</string>
  <string name="title_colors">Farger</string>
  <string name="resolve_connect">Koble til</string>
  <string name="resolve_entropy">Samle entropi</string>
  <string name="menu_insert">Legg til vert</string>
  <string name="menu_delete">Slett vert</string>
  <string name="menu_preferences">Innstillinger</string>
  <string name="help_intro">Velg en overskrift nedenfor for mer informasjon om et bestemt emne.</string>
  <string name="help_about">Om ConnectBot</string>
  <string name="help_keyboard">Tastatur</string>
  <string name="pubkey_generate">Generer</string>
  <string name="pubkey_import">Importer</string>
  <string name="pubkey_delete">Slett nøkkel</string>
  <string name="pubkey_gather_entropy">Samler entropi</string>
  <string name="pubkey_touch_prompt">Berør denne boksen for å samle tilfeldige tall: %1$d%% ferdig</string>
  <string name="pubkey_touch_hint">Beveg fingeren over boksen nedenfor for å sikre vilkårlighet ved generering av nøkkel.</string>
  <string name="pubkey_generating">Genererer nøkkelpar...</string>
  <string name="pubkey_copy_private">Kopier privat nøkkel</string>
  <string name="pubkey_copy_public">Kopier offentlig nøkkel</string>
  <string name="pubkey_list_empty">Trykk \"Meny\" for å opprette\neller importere nøkkelpar.</string>
  <string name="pubkey_unknown_format">Ukjent format</string>
  <string name="pubkey_change_password">Endre passord</string>
  <string name="pubkey_list_pick">Hent fra /sdcard</string>
  <string name="pubkey_import_parse_problem">Feil ved innlasting av privat nøkkel</string>
  <string name="pubkey_unlock">Frigjør nøkkel</string>
  <string name="pubkey_failed_add">Feil passord for nøkkel \'%1$s\'. Autentisering mislyktes.</string>
  <string name="pubkey_memory_load">Last inn i minne</string>
  <string name="pubkey_memory_unload">Last ut av minne</string>
  <string name="pubkey_load_on_start">Last nøkkel ved start</string>
  <string name="pubkey_confirm_use">Godkjenn før bruk</string>
  <string name="portforward_list_empty">Trykk \"Meny\" for å opprette\nportvideresending.</string>
  <string name="portforward_edit">Rediger videresendte porter</string>
  <string name="portforward_delete">Slett videresendte porter</string>
  <string name="prompt_nickname">Kallenavn:</string>
  <string name="prompt_nickname_hint_pubkey">Min arbeidsnøkkel</string>
  <string name="prompt_source_port">Kildeport:</string>
  <string name="prompt_destination">Mål:</string>
  <string name="prompt_old_password">Tidligere passord:</string>
  <string name="prompt_password">Passord:</string>
  <string name="prompt_again">(en gang til)</string>
  <string name="prompt_type">Type:</string>
  <string name="prompt_password_can_be_blank">NB: passord kan stå tomt</string>
  <string name="prompt_bits">Bits:</string>
  <string name="prompt_pubkey_password">Passord for nøkkel \'%1$s\'</string>
  <string name="prompt_allow_agent_to_use_key">Godta ekstern vert til\nå bruke nøkkel \'%1$s\'?</string>
  <string name="host_verification_failure_warning_header">ADVARSEL: EKSTERN VERT IDENTIFIKASJON HAR BLITT ENDRET!</string>
  <string name="host_verification_failure_warning">DET KAN VÆRE UGLER I MOSEN!\nNoen kan lytte på deg akkurat nå (et mellommann-angrep)!\nMen det er også mulig at vertsnøkkelen har blitt endret.</string>
  <string name="prompt_host_disconnected">Vert har koblet fra.\nLukk sesjon?</string>
  <string name="prompt_continue_connecting">Er du sikker på at\ndu vil koble til?</string>
  <string name="host_authenticity_warning">Kan ikke bekrefte integriteten til \'%1$s\'.</string>
  <string name="host_fingerprint">Nøkkelfingeravtrykk til vert %1$s er %2$s</string>
  <string name="alert_passwords_do_not_match_msg">Passordene er ikke like!</string>
  <string name="alert_wrong_password_msg">Feil passord!</string>
  <string name="alert_key_corrupted_msg">Privat nøkkel ser ut til å være korrupt!</string>
  <string name="alert_sdcard_absent">SD-kortet er ikke satt inn!</string>
  <string name="button_add">Legg til</string>
  <string name="button_change">Endre</string>
  <string name="button_generate">Generer nøkkel</string>
  <string name="button_resize">Endre størrelse</string>
  <string name="alert_disconnect_msg">Mistet tilkobling</string>
  <string name="msg_copyright">Copyright © 2007-2008 Kenny Root http://the-b.org/, Jeffrey Sharkey http://jsharkey.org/</string>
  <string name="pref_emulation_category">Terminalemulering</string>
  <string name="pref_emulation_title">Etterligningsmodus</string>
  <string name="pref_emulation_summary">Etterligningsmodus for terminal for PTY-tilkoblinger</string>
  <string name="pref_scrollback_title">Husk skjermtekst</string>
  <string name="pref_scrollback_summary">Mengde skjermtekst som skal beholdes i minnet for hvert konsollvindu</string>
  <string name="pref_ui_category">Brukergrensesnitt</string>
  <string name="pref_rotation_title">Rotasjonsretning</string>
  <string name="pref_rotation_summary">Hvordan rotasjonsretning endres når tastatur skyves inn/ut</string>
  <string name="pref_fullscreen_title">Full skjerm</string>
  <string name="pref_fullscreen_summary">Gjem statuslinje mens du er i konsoll</string>
  <string name="pref_memkeys_title">Lagre nøkler</string>
  <string name="pref_memkeys_summary">Husk opplåste nøkler helt til programmet avsluttes</string>
  <string name="pref_update_title">Se etter oppdateringer</string>
  <string name="pref_update_summary">Angi hyppigheten for å se etter oppdateringer til ConnectBot</string>
  <string name="pref_conn_persist_title">Oppretthold forbindelser</string>
  <string name="pref_conn_persist_summary">Oppretthold forbindelser selv når programmet kjører i bakgrunnen</string>
  <string name="pref_keymode_title">Hurtigtaster for mapper</string>
  <string name="pref_keymode_summary">Velg hvordan Alt- og Skift-tasten skal brukes for \'/\' og Tab</string>
  <string name="pref_camera_title">Snarvei til kamera</string>
  <string name="pref_camera_summary">Velg hvilken snarvei som skal benyttes når kameraknapp trykkes</string>
  <string name="pref_keepalive_title">Hold skjerm våken</string>
  <string name="pref_keepalive_summary">Unngå at skjermen slås av når du jobber konsoll</string>
  <string name="pref_wifilock_title">Hold Wi-Fi aktiv</string>
  <string name="pref_wifilock_summary">Hindre Wi-Fi å koble fra når en økt er aktiv</string>
  <string name="pref_bumpyarrows_title">Vibrerende piler</string>
  <string name="pref_bumpyarrows_summary">Vibrer når pilkommandoer sendes med styrekule; nyttig for trege forbindelser</string>
  <string name="pref_bell_category">Terminalklokke</string>
  <string name="pref_bell_title">Varselklokke</string>
  <string name="pref_bell_volume_title">Klokkevolum</string>
  <string name="pref_bell_vibrate_title">Vibrere med bjelle</string>
  <string name="pref_bell_notification_title">Bakgrunnsvarsling</string>
  <string name="pref_bell_notification_summary">Vis varsling når en terminal i bakgrunnen gir et klokkevarsel.</string>
  <string name="list_keymode_right">Bruk knapper på høyre side</string>
  <string name="list_keymode_left">Bruk knapper på venstre side</string>
  <string name="list_keymode_none">Deaktiver</string>
  <string name="list_pubkeyids_none">Ikke bruk nøkler</string>
  <string name="list_pubkeyids_any">Bruk en vilkårlig ulåst tast</string>
  <string name="list_update_daily">Daglig</string>
  <string name="list_update_weekly">Ukentlig</string>
  <string name="list_update_never">Aldri</string>
  <string name="hostpref_nickname_title">Kallenavn</string>
  <string name="hostpref_color_title">Fargeinndeling</string>
  <string name="hostpref_fontsize_title">Skriftstørrelse (pt)</string>
  <string name="hostpref_pubkeyid_title">Bruk offentlig nøkkel som godkjenning</string>
  <string name="hostpref_authagent_title">Bruk SSH auth-agent</string>
  <string name="hostpref_postlogin_title">Kommandoer etter innlogging</string>
  <string name="hostpref_postlogin_summary">Kommandoer som kjøres på tilkoblet tjener etter vellykket autentisering</string>
  <string name="hostpref_compression_title">Komprimering</string>
  <string name="hostpref_compression_summary">Dette kan hjelpe på trege nettverk</string>
  <string name="hostpref_wantsession_title">Start skallsesjon</string>
  <string name="hostpref_wantsession_summary">Deaktiver denne innstillingen og benytt denne kun for portvideresending</string>
  <string name="hostpref_stayconnected_title">Oppretthold forbindelse</string>
  <string name="hostpref_stayconnected_summary">Forsøk å koble til på nytt ved frakobling</string>
  <string name="hostpref_delkey_title">DEL-knapp</string>
  <string name="hostpref_delkey_summary">Tastekode som sendes når DEL trykkes</string>
  <string name="hostpref_encoding_title">Tegnkoding</string>
  <string name="hostpref_encoding_summary">Tegnkoding for verten</string>
  <string name="hostpref_connection_category">Tilkoblingsinnstillinger</string>
  <string name="hostpref_username_title">Brukernavn</string>
  <string name="hostpref_hostname_title">Vert</string>
  <string name="hostpref_port_title">Port</string>
  <string name="bind_never">Aldri tilkoblet</string>
  <string name="bind_minutes">%1$s minutt siden</string>
  <string name="bind_hours">%1$s timer siden</string>
  <string name="bind_days">%1$s dager siden</string>
  <string name="console_copy_done">Kopierte %1$d bytes til utklippstavle</string>
  <string name="console_copy_start">Trykk og dra, eller\nbruk styrekule for å\nvelge område å\nkopiere fra</string>
  <string name="console_menu_close">Lukk</string>
  <string name="console_menu_copy">Kopier</string>
  <string name="console_menu_paste">Lim inn</string>
  <string name="console_menu_portforwards">Portvideresending</string>
  <string name="console_menu_resize">Tving størrelse</string>
  <string name="console_menu_urlscan">URL-søk</string>
  <string name="button_yes">Ja</string>
  <string name="button_no">Nei</string>
  <string name="portforward_local">Lokal</string>
  <string name="portforward_remote">Ekstern</string>
  <string name="portforward_dynamic">Dynamisk (SOCKS)</string>
  <string name="portforward_pos">Opprett portvideresending</string>
  <string name="portforward_done">Vellykket oppretting av portvideresending</string>
  <string name="portforward_problem">Mislyktes å opprette portvideresending. Bruker du porter under 1024, eller er denne porten allerede tatt?</string>
  <string name="portforward_menu_add">Legg til portvideresending</string>
  <string name="hint_userhost">bruker\@vert</string>
  <string name="list_format_error">Use the format %1$s</string>
  <string name="format_username">brukernavn</string>
  <string name="format_hostname">vertsnavn</string>
  <string name="format_port">port</string>
  <string name="list_menu_pubkeys">Behandle offentlige nøkler</string>
  <string name="list_menu_sortcolor">Sorter etter farge</string>
  <string name="list_menu_sortname">Sorter etter navn</string>
  <string name="list_menu_settings">Innstillinger</string>
  <string name="list_host_disconnect">Koble fra</string>
  <string name="list_host_edit">Rediger vert</string>
  <string name="list_host_portforwards">Rediger portvidersendinger</string>
  <string name="list_host_delete">Slett vert</string>
  <string name="list_host_empty">Bruk hurtigtilkoblingsboksen\nunder for å koble til en vert.</string>
  <string name="list_rotation_default">Forvalg</string>
  <string name="list_rotation_land">Tving landskap</string>
  <string name="list_rotation_port">Tving portrett</string>
  <string name="list_rotation_auto">Automatisk</string>
  <string name="list_camera_ctrlaspace">Ctrl+A og mellomrom</string>
  <string name="list_camera_ctrla">Ctrl+A</string>
  <string name="list_camera_esc">Esc</string>
  <string name="list_camera_esc_a">Esc+A</string>
  <string name="list_camera_none">Ingen</string>
  <string name="list_delkey_backspace">Tilbaketast</string>
  <string name="list_delkey_del">Slett</string>
  <string name="delete_message">Er du sikker på at du vil slette \'%1$s\'?</string>
  <string name="delete_pos">Ja, slett</string>
  <string name="delete_neg">Avbryt</string>
  <string name="wizard_agree">Godta</string>
  <string name="wizard_next">Neste</string>
  <string name="wizard_back">Tilbake</string>
  <string name="terminal_no_hosts_connected">Ingen verter tilkoblet for øyeblikket</string>
  <string name="terminal_connecting">Kobler til %1$s:%2$d via %3$s</string>
  <string name="terminal_sucess">Verifiserte vert \'%1$s\' sin nøkkel: %2$s</string>
  <string name="terminal_failed">Verifisering av vertsnøkkelen feilet.</string>
  <string name="terminal_using_s2c_algorithm">Algoritme fra tjener til klient: %1$s %2$s</string>
  <string name="terminal_using_c2s_algorithm">Algoritme fra klient til tjener: %1$s %2$s</string>
  <string name="terminal_using_algorithm">Bruker algoritme: %1$s %2$s</string>
  <string name="terminal_auth">Forsøker å autentisere</string>
  <string name="terminal_auth_pass">Forsøker \'passord\'-autentisering</string>
  <string name="terminal_auth_pass_fail">Autentiseringsmetode \'passord\' feilet</string>
  <string name="terminal_auth_pubkey_any">Forsøker \'publickey\'-autentisering med lagrede offentlige nøkler</string>
  <string name="terminal_auth_pubkey_invalid">Valgt offentlig nøkkel er ugyldig, forsøk å velge en annen nøkkel i vertsvinduet.</string>
  <string name="terminal_auth_pubkey_specific">Forsøker \'publickey\'-autentisering med angitt offentlig nøkkel</string>
  <string name="terminal_auth_pubkey_fail">Autentisering med \'publickey\' og nøkkel \'%1$s\' mislyktes</string>
  <string name="terminal_auth_ki">Forsøker \'keyboard-interactive\' autentisering</string>
  <string name="terminal_auth_ki_fail">Autentiseringsmetoden \'keyboard-interactive\' mislyktes</string>
  <string name="terminal_auth_fail">[Din vert støtter ikke autentiseringsmetodene \'password\' eller \'keyboard-interactive\'.]</string>
  <string name="terminal_no_session">Sesjonen vil ikke bli startet grunnet vertsinnstillinger.</string>
  <string name="terminal_enable_portfoward">Aktiver portvideresending: %1$s</string>
  <string name="local_shell_unavailable">Feil! Lokalt skall er utilgjengelig på denne telefonen.</string>
  <string name="notification_text">%1$s ønsker din oppmerksomhet.</string>
  <string name="upgrade">Ny versjon</string>
  <string name="upgrade_pos">Ja, oppgrader</string>
  <string name="upgrade_neg">Ikke akkurat nå</string>
  <string name="no">Nei</string>
  <string name="with_confirmation">Med bekreftelse</string>
  <string name="yes">Ja</string>
  <string name="exceptions_submit_message">Det ser ut som ConnectBot hadde et problem forrige gang den kjørte. Vil du sende en feilrapport til utviklerne av ConnectBot?</string>
  <string name="menu_colors_reset">Tilbakestill</string>
  <string name="app_is_running">ConnectBot kjører</string>
  <string name="color_red">rød</string>
  <string name="color_green">grønn</string>
  <string name="color_blue">blå</string>
  <string name="color_gray">grå</string>
</resources>


text:
id: third-party
title: Checking third-party code
permalink: /docs/third-party.html
prev: type-annotations.html
next: running.html
---

Most real JavaScript programs depend on third-party libraries.
To handle this, Flow supports the concept of a "Library Definition"
(or "libdef" for short).

# Library Definitions

Often you will want to use libraries and code that you didn't write -- such as
npm packages. For these circumstances, Flow supports the concept of a
"libdef" which allows you to describe the interface and types of the library
seperate from the library and without needing to add types to or change the
library itself.

It's always possible to write a libdef file yourself if you need to, but for
public libraries we recommend using [flow-*typed*](https://github.com/flowtype/flow-typed/).
flow-*typed* is a community-run project that organizes and shares existing,
high-quality libdefs for popular libraries.

If you can't find the libdef you need there, consider writing one and then
contributing it back so that the next person who needs it can benefit!

Note that if a 3rd party library is present in your project that isn't itself
typed, Flow will treat it just like any other untyped JS file in your project:
It and all imports from it will be marked as `any` by default. This is the only
place in Flow where `any` is ever injected in to your program by Flow.

# Using flow-*typed*

Using the [flow-*typed*](https://github.com/flowtype/flow-typed/) project for npm
projects is pretty straightforward. First, make sure you have the `flow-typed`
CLI installed:

```bash
$> npm install -g flow-typed
```

Then, from within your project directory, run `flow-typed install` after running
`npm install`:

```bash
$> npm install
$> flow-typed install
```

The `flow-typed install` command will do the following:

1. Read your `package.json` to identify the dependencies of your project
1. For each dependency, look in the flow-*typed* repo for a compatible libdef.
1. For each dependency:
  * **If a compatible libdef is found**, download it into the
     `<PROJECT_ROOT>/flow-typed/` directory.
  * **If no compatible libdef is found** and the library does not come with types,
     generate a stub libdef so that you can go fill in the types yourself. Don't
     forget to contribute your work back up to flow-*typed* when you're done :)

Since libdefs can be improved over time, **we recommend that you commit all
libdefs into version control.** This ensures that all developers working in your
project's repository have a consistent and predictable set of types. It is good
to periodically run `flow-typed update` to check and see if there have been any
improvements or bug fixes made to the libdefs you've installed for your project.

## Writing custom library definition files

Library definition files ("libdefs") define the type interface to a library
separately from the actual code of the library. You never need to change library
code to use a library definition, but your code will be typechecked against the
types declared in the libdef.

For libdefs of public libraries, consider using and contributing to
[flow-*typed*](https://github.com/flowtype/flow-typed/). If you have private
libraries or just want to write your own libdefs, here is the workflow for doing
so:

* Do not change the library files or add `@flow` to them
* Add one or more libdefs for your libraries in to the
  "`<PROJECT_ROOT>/flow-typed/`" directory of your project. Flow recognizes this
  directory as special by default and interprets it as a directory that contains
  libdef files.

If you need to customize the directory where libdefs are stored in your project,
you can do so by adding a `[libs]` configuration to your .flowconfig file:

```
[libs]
my-custom-libdefs-directory/
```

## Example: Writing a custom libdef

To illustrate this workflow, we'll start with the [lodash](https://lodash.com)
library. Let's say we have a simple file in our project using lodash:

**main.js**

```js +line_numbers
// @flow

import _ from "lodash";

var pizzas = [
  { title: 'Margherita', vegetarian: true },
  { title: 'Pepperoni', vegetarian: false },
  { title: 'Four cheese', vegetarian: true },
  { title: 'Hawaiian', vegetarian: false },
];

function vegetarianPizzas() {
  return _.ffind(pizzas, {vegetarian: true});
}
```

Running `flow` will produce no errors:

```bash
$> flow
Found 0 errors
```

If you look closely at our example, though, you'll notice there is a bug! We've
misspelled `find` as `ffind` on line 13.

The problem here is that Flow doesn't know anything about the lodash library
since it is untyped (i.e. its code lacks `@flow` comments). To fix this we need
a libdef file for lodash -- so let's write one ourselves:

**flow-typed/lodash.js**

```js
declare module "lodash" {
  declare module.exports: {
    find<T>(list: Array<T>, properties: Object): T;
  };
}
```

Here we've written a file that contains a `declare module` statement.
`declare module` inside a libdef tells Flow about the interface defined by a
module of the given name.

Within the body of this statement, we have another statement:
`declare module.exports: ...`. This is how we explain to Flow what the type of
the `module.exports` object inside this module should be. In this case, we say
that it is an object type with one `find` method.

Everything after the `:` in "`declare module.exports: ...`" is just a normal type
annotation, so you can read more about type annotations
[here](type-annotations.html).

Now we can run flow again and see that Flow gives us an error as we'd expect:

```bash
$> flow
main.js:13
 13:   return _.ffind(pizzas, {vegetarian: true});
                ^^^^^ property `ffind`. Property not found in
 13:   return _.ffind(pizzas, {vegetarian: true});
              ^ object type

Found 1 error
```

If we fix the typo in our code and run Flow again, we'll see that the Flow
error goes away:

```bash
$> flow
Found 0 errors
```

For more information about `declare` statements in libdefs, see the reference
guide on [declarations](declarations.html).


text:
FactoryGirl.define do
  factory :newsletter do
  end
end


text:
id: 5a24c314108439a4d403617e
title: Add Event Listeners
challengeType: 6
isHidden: false
isRequired: false
forumTopicId: 301377
---

## Description

The componentDidMount() method is also the best place to attach any event listeners you need to add for specific functionality. React provides a synthetic event system which wraps the native event system present in browsers. This means that the synthetic event system behaves exactly the same regardless of the user's browser - even if the native events may behave differently between different browsers.
You've already been using some of these synthetic event handlers such as onClick(). React's synthetic event system is great to use for most interactions you'll manage on DOM elements. However, if you want to attach an event handler to the document or window objects, you have to do this directly.

## Instructions

Attach an event listener in the componentDidMount() method for keydown events and have these events trigger the callback handleKeyPress(). You can use document.addEventListener() which takes the event (in quotes) as the first argument and the callback as the second argument.
Then, in componentWillUnmount(), remove this same event listener. You can pass the same arguments to document.removeEventListener(). It's good practice to use this lifecycle method to do any clean up on React components before they are unmounted and destroyed. Removing event listeners is an example of one such clean up action.

## Tests

```yml
tests:
  - text: <code>MyComponent</code> should render a <code>div</code> element which wraps an <code>h1</code> tag.
    testString: assert((() => { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.find('div').children().find('h1').length === 1; })());
  - text: A keydown listener should be attached to the document in <code>componentDidMount</code>.
    testString: assert((() => { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const didMountString = mockedComponent.instance().componentDidMount.toString(); return new RegExp('document\.addEventListener(.|\n|\r)+keydown(.|\n|\r)+this\.handleKeyPress').test(didMountString); })());
  - text: The keydown listener should be removed from the document in <code>componentWillUnmount</code>.
    testString: assert((() => { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const willUnmountString = mockedComponent.instance().componentWillUnmount.toString(); return new RegExp('document\.removeEventListener(.|\n|\r)+keydown(.|\n|\r)+this\.handleKeyPress').test(willUnmountString); })());
  - text: Once the component has mounted, pressing <code>enter</code> should update its state and the rendered <code>h1</code> tag.
    testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const beforeState = mockedComponent.state(''message''); const beforeText = mockedComponent.find(''h1'').text(); const pressEnterKey = () => { mockedComponent.instance().handleKeyPress({ keyCode: 13 }); return waitForIt(() => { mockedComponent.update(); return { state: mockedComponent.state(''message''), text: mockedComponent.find(''h1'').text()}; });}; const afterKeyPress = await pressEnterKey(); assert(beforeState !== afterKeyPress.state && beforeText !== afterKeyPress.text); }; '

```

## Challenge Seed

```jsx
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: ''
    };
    this.handleEnter = this.handleEnter.bind(this);
    this.handleKeyPress = this.handleKeyPress.bind(this);
  }
  // change code below this line
  componentDidMount() {

  }
  componentWillUnmount() {

  }
  // change code above this line
  handleEnter() {
    this.setState({
      message: this.state.message + 'You pressed the enter key! '
    });
  }
  handleKeyPress(event) {
    if (event.keyCode === 13) {
      this.handleEnter();
    }
  }
  render() {
    return (
      <div>
        <h1>{this.state.message}</h1>
      </div>
    );
  }
};
```

### After Test

```js
ReactDOM.render(<MyComponent />, document.getElementById('root'))
```

## Solution

```js
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: ''
    };
    this.handleKeyPress = this.handleKeyPress.bind(this);
    this.handleEnter = this.handleEnter.bind(this);  }
  componentDidMount() {
    // change code below this line
    document.addEventListener('keydown', this.handleKeyPress);
    // change code above this line
  }
  componentWillUnmount() {
    // change code below this line
    document.removeEventListener('keydown', this.handleKeyPress);
    // change code above this line
  }
  handleEnter() {
    this.setState({
      message: this.state.message + 'You pressed the enter key! '
    });
  }
  handleKeyPress(event) {
    if (event.keyCode === 13) {
      this.handleEnter();
    }
  }
  render() {
    return (
      <div>
        <h1>{this.state.message}</h1>
      </div>
    );
  }
};
```


text:
package com.github.nicktgn.mvp_sample.ui;

import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.github.nicktgn.mvp.MvpBundle;
import com.github.nicktgn.mvp.MvpFragment;
import com.github.nicktgn.mvp_sample.R;
import com.github.nicktgn.mvp_sample.models.NotebooksProvider;
import com.github.nicktgn.mvp_sample.presensters.NotebookPresenter;
import com.noveogroup.android.log.Logger;
import com.noveogroup.android.log.LoggerManager;

import butterknife.Bind;
import butterknife.BindDimen;
import butterknife.BindString;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;

/**
 * A simple {@link Fragment} subclass.
 */
public class NotebookFragment extends MvpFragment<NotebookPresenter.NotebookView, NotebookPresenter>
										implements NotebookPresenter.NotebookView,
														NotebookPresenter.NotebookCtx{

	private static final Logger logger = LoggerManager.getLogger(MainActivity.class.getName());

	@Bind(R.id.add_new_note_btn) View mAddNoteBtn;
	@Bind(R.id.notes_list_empty_view) View mNotesListEmptyView;
	@Bind(R.id.notes_list) RecyclerView mNotesList;

	@BindString(R.string.default_note_name) String defaultNoteName;
	@BindString(R.string.default_notebook_name) String defaultNotebookName;
	@BindDimen(R.dimen.notes_grid_spacing) int notesGridSpacing;

	private NotesListAdapter mAdapter;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
									 Bundle savedInstanceState) {
		// Inflate the layout for this fragment
		View v = inflater.inflate(R.layout.fragment_notebook, container, false);

		ButterKnife.bind(this, v);

		final StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
		mNotesList.setLayoutManager(layoutManager);
		mNotesList.addItemDecoration(new SpacesItemDecoration(notesGridSpacing));

		mAdapter = new NotesListAdapter(getContext());
		mNotesList.setAdapter(mAdapter);

		setHasOptionsMenu(true);

		return v;
	}

	@Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		logger.d("adding actions");
		// Inflate the menu items for use in the action bar
		inflater.inflate(R.menu.menu_notebook, menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
			case R.id.action_new_note:
				presenter.createNote(defaultNoteName);
				return true;
		}

		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onDestroyView() {
		super.onDestroyView();
		ButterKnife.unbind(this);
	}

	@Override
	protected NotebookPresenter createPresenter() {
		return new NotebookPresenter(this, NotebooksProvider.getInstance());
	}

	@OnClick(R.id.add_new_note_btn)
	public void onAddNewNote(View view) {
		presenter.createNote(defaultNoteName);
	}

	@Override
	public String getDefaultNotebookTitle() {
		return defaultNotebookName;
	}

	public class EventShowNotebookTitle{
		public String title;
		public EventShowNotebookTitle(String title){
			this.title = title;
		}
	}

	public class EventOpenNote{
		public NoteFragment noteView;
		public EventOpenNote(NoteFragment noteView){
			this.noteView = noteView;
		}
	}

	@Override
	public void showTitle(String title) {
		EventBus.getDefault().post(new EventShowNotebookTitle(title));
	}

	@Override
	public void showNotes(int numNotes) {
		if(numNotes == 0){
			mNotesList.setVisibility(View.GONE);
			mNotesListEmptyView.setVisibility(View.VISIBLE);
		}
		else {
			mNotesListEmptyView.setVisibility(View.GONE);
			mNotesList.setVisibility(View.VISIBLE);

			// update the number of notebooks in the list and let the adapter do the rest
			mAdapter.update(numNotes);
			mAdapter.notifyDataSetChanged();
		}
	}

	@Override
	public void gotoNoteView(MvpBundle noteModel) {
		EventBus.getDefault().post(new EventOpenNote(getMvpFragment(NoteFragment.class, noteModel)));
	}

	public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
		private int space;

		public SpacesItemDecoration(int space) {
			this.space = space;
		}

		@Override
		public void getItemOffsets(Rect outRect, View view,
											RecyclerView parent, RecyclerView.State state) {
			outRect.left = space;
			outRect.bottom = space;

			if(parent.getChildLayoutPosition(view) / 2 == 0){
				outRect.top = space;
			}
			if(parent.getChildLayoutPosition(view) % 2 == 1){
				outRect.right = space;
			}

		}
	}

	class NotesListAdapter extends RecyclerView.Adapter<NotesListAdapter.SimpleViewHolder> {

		// view holder can act as a presenter's "subview" and implement its
		// interfaces to present each piece of data designated for this "subview"
		public class SimpleViewHolder extends RecyclerView.ViewHolder
			implements NotebookPresenter.NoteView,
			View.OnClickListener{

			public int index;

			@Bind(R.id.title_txt) TextView title;
			@Bind(R.id.content_txt) TextView content;

			public SimpleViewHolder(View itemView) {
				super(itemView);

				ButterKnife.bind(this, itemView);

				itemView.setOnClickListener(this);
			}

			@Override
			public void onClick(View view) {
				presenter.openNote(index);
			}

			@Override
			public void showTitle(String title) {
				this.title.setText(title);
			}

			@Override
			public void showContent(String content) {
				this.content.setText(content);
			}
		}

		private Context mContext;
		private int mCount;

		public NotesListAdapter(Context context) {
			this.mContext = context;
		}

		public void update(int count){
			mCount = count;
		}

		@Override
		public SimpleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
			View view = LayoutInflater.from(parent.getContext())
				.inflate(R.layout.item_note, parent, false);
			return new SimpleViewHolder(view);
		}

		@Override
		public void onBindViewHolder(final SimpleViewHolder viewHolder, final int position) {
			viewHolder.index = position;

			// every time this adapter is called to present a list item view,
			// just call presenter to present this list item as "subview" and
			// presenter will provide all necessary data to the viewHolder
			// (if it implements "subview" interface)
			presenter.presentSubView(viewHolder, position);
		}

		@Override
		public int getItemCount() {
			return mCount;
		}

	}
}


text:
namespace _09.ArithmeticalExpressions
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    public class ArithmeticalExpressions
    {
        public static void Main()
        {
        }
    }
}


text:
@interface ABI42_0_0UMNativeModulesProxy : NSObject <ABI42_0_0RCTBridgeModule>

- (instancetype)initWithModuleRegistry:(ABI42_0_0UMModuleRegistry *)moduleRegistry;

@end


text:
package com.gs.dao.impl.hbase;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.HTableInterface;

public final class HBasePool {
	private static HBasePool instance = null;
	private static HConnection connection = null;
	private static Configuration conf;

	public Configuration getConf() {
		return conf;
	}

	private HBasePool() throws ZooKeeperConnectionException {
		Configuration conf = new Configuration();
		conf.set("hbase.zookeeper.property.clientPort", "2181");
		conf.set("hbase.zookeeper.quorum", "localhost");
		conf.set("hbase.master", "localhost:60000");
		this.conf = conf;
		connection = HConnectionManager.createConnection(conf);
	}

	protected synchronized static HBasePool getInstance()
			throws ZooKeeperConnectionException {
		if (instance == null) {
			instance = new HBasePool();
		}
		return instance;
	}

	protected HTableInterface getTable(String tableName) throws IOException {
		return connection.getTable(tableName);
	}
}


text:
@protocol APIDataManagerDelegate <NSObject>

@required

@optional
- (void)didCompleteGettingDataFromAPI:(NSArray *)gourmetArray;
- (void)didFailGettingDataFromAPI:(NSError *)error;

@end

@interface APIDataManager : NSObject

@property (weak, nonatomic) id <APIDataManagerDelegate> delegate;
@property (strong, nonatomic) NSArray *gourmetArray;

+ (instancetype)defaultManager;
- (void)getDataFromAPI:(NSString *)urlString;

@end


text:
package controller;

import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import model.expression.Expression;

/**
 * Methods for model
 */
public interface ControllerToModelInterface {
    public List<Turtle> getActiveTurtles();
//    public void setActiveTurtle (List<String> turtleIds);
    public Map<String, Expression> getDefinedFunction();
    public Map<String, Expression> getRunningFunction ();
    public Map<String, Expression> getGlobalVariables();
    public Map<String, Map<String, Expression>> getLocalVariables();

    //Turtle queries function call
    public void clearScreen();
    public void xCor();
    public void yCor();
    public void heading();
    public void isPenDown();
    public void isShowing();
    public void penColor ();
    public void turtleShape ();
    public void id();

    //other
    public ResourceBundle getLanguageMessages();

    public void addColorIndex (ColorIndex index);

    public Workspace getCurrentWorkspace ();
}


text:
var fs = require('fs')
var request = require('request')

var COUNTER = 0
var COUNTERFAIL = 0
var COUNTERCONNECT = 0
var listPath = '/tmp/urlist5.txt'

function loadList (path) {
  var list = null
  var s
  // read if exists
  if (fs.existsSync(path)) {
    s = fs.readFileSync(path, 'utf8')
  } else {
    s = null
  }
  // split lines if file loaded
  if (s !== null) {
    list = s.split('\n').map((line) => {
      return line.toLowerCase().trim() // lower case and trim items
    })
    // make unique in case there are duplicates
    list = list.filter((value, index, self) => {
      return self.indexOf(value) === index
    })
    // remove if starts with '#' (=> line is a comment)
    list = list.filter((line) => {
      if (line) {
        if (line[0] !== '#') {
          return true
        }
      }
      return false
    })
    return list
  }
  return null
}

function elapsedMilliSecondsSince (start) {
  var end = process.hrtime() // get the current time

  // calculate elased seconds and convert to nanoseconds
  var ns = Math.abs(end[0] - start[0]) * 1e9

  // calculate total elapsed nanoseconds
  ns = ns + Math.abs(end[1] - start[1])

  return ns / 1e6 // convert to milliseconds
}

// GO
var urlist = loadList(listPath)
console.log('URLs in list: ' + urlist.length)
var start = process.hrtime() // get the current time
urlist.forEach((u, index, array) => {
  var qs = { url: u }
  var server = 'http://127.0.0.1:7171/'

  var nodeOut = (5 * 60 + 1) * 1000 // timeout + 1 sec
  request({url: server, qs: qs, timeout: nodeOut}, (err, res, b) => {
    if (err) { // No valid GET reply
      COUNTERFAIL = COUNTERFAIL + 1
      if (err.connect === true) {
        // this error occurs if the socket can't connect to the server
        COUNTERCONNECT = COUNTERCONNECT + 1
      }
    } else {
      COUNTER = COUNTER + 1
    }
    if (COUNTER + COUNTERFAIL === urlist.length) {
      console.log('Used URL list: ' + listPath)
      console.log('Timeout parameter: ' + nodeOut)
      console.log('Sucess: ' + COUNTER)
      console.log('Failure: ' + COUNTERFAIL)
      console.log('Connection: ' + COUNTERCONNECT)
      console.log(elapsedMilliSecondsSince(start))
    }
  })
})
console.log('requests made in ' + elapsedMilliSecondsSince(start))


text:
Code in `dknn.py` shows how to reproduce one of the results from the
following paper, using the MNIST dataset. It can be
adapted to use other datasets and any attack supported by CleverHans.
The LSH backend used in the paper is FALCONN.

**Deep k-Nearest Neighbors: Towards Confident, Interpretable and Robust Deep Learning**
*Nicolas Papernot, Patrick McDaniel*

Deep neural networks(DNNs) enable innovative applications of machine learning
like image recognition, machine translation, or malware detection. However, deep
learning is often criticized for its lack of robustness in adversarial
settings(e.g., vulnerability to adversarial inputs) and general inability to
rationalize its predictions. In this work, we exploit the structure of deep
learning to enable new learning-based inference and decision strategies that
achieve desirable properties such as robustness and interpretability. We take a
first step in this direction and introduce the Deep k-Nearest Neighbors(DkNN).
This hybrid classifier combines the k-nearest neighbors algorithm with
representations of the data learned by each layer of the DNN: a test input is
compared to its neighboring training points according to the distance that
separates them in the representations. We show the labels of these neighboring
points afford confidence estimates for inputs outside the model's training
manifold, including on malicious inputs like adversarial examples--and therein
provides protections against inputs that are outside the models understanding.
This is because the nearest neighbors can be used to estimate the nonconformity
of, i.e., the lack of support for, a prediction in the training data. The
neighbors also constitute human-interpretable explanations of predictions. We
evaluate the DkNN algorithm on several datasets, and show the confidence
estimates accurately identify inputs outside the model, and that the
explanations provided by nearest neighbors are intuitive and useful in
understanding model failures.


text:
import docsUrl from '../docsUrl';

module.exports = {
  meta: {
    type: 'suggestion',
    docs: {
      url: docsUrl('no-default-export'),
    },
    schema: [],
  },

  create(context) {
    // ignore non-modules
    if (context.parserOptions.sourceType !== 'module') {
      return {};
    }

    const preferNamed = 'Prefer named exports.';
    const noAliasDefault = ({ local }) =>
      `Do not alias \`${local.name}\` as \`default\`. Just export ` +
      `\`${local.name}\` itself instead.`;

    return {
      ExportDefaultDeclaration(node) {
        context.report({ node, message: preferNamed });
      },

      ExportNamedDeclaration(node) {
        node.specifiers.forEach(specifier => {
          if (specifier.type === 'ExportDefaultSpecifier' &&
              specifier.exported.name === 'default') {
            context.report({ node, message: preferNamed });
          } else if (specifier.type === 'ExportSpecifier' &&
              specifier.exported.name === 'default') {
            context.report({ node, message: noAliasDefault(specifier) });
          }
        });
      },
    };
  },
};


text:
package org.apache.asterix.external.feed.message;

import org.apache.asterix.common.messaging.AbstractApplicationMessage;
import org.apache.asterix.external.feed.management.FeedId;
import org.apache.hyracks.api.job.JobId;

public class FeedPartitionStartMessage extends AbstractApplicationMessage {

    private static final long serialVersionUID = 1L;
    private final FeedId feedId;
    private final JobId jobId;

    public FeedPartitionStartMessage(FeedId feedId, JobId jobId) {
        this.feedId = feedId;
        this.jobId = jobId;
    }

    @Override
    public ApplicationMessageType getMessageType() {
        return ApplicationMessageType.FEED_PROVIDER_READY;
    }

    public FeedId getFeedId() {
        return feedId;
    }

    public JobId getJobId() {
        return jobId;
    }
}


text:
import numpy as np
from efficientroutes.model import Bicyclist, Route, Trip

bicyclist = Bicyclist()

routes = {}
for way in ['third', 'fifth', 'eighth']:
    routeData = np.recfromcsv('../data/fifth_to_hutchinson_via_' + way + '.csv')

    stopLocations = []
    for i, device in enumerate(routeData['traffic_control']):
        if device != '':
            stopLocations.append(routeData['distance'][i])

    routes[way] = Route(routeData['distance'],
            routeData['elevation'], routeData['speed_limit'],
            stopLocations=np.array(stopLocations))

for k, v in routes.items():
    trip = Trip(bicyclist, v)
    trip.solve()
    string = '{} route stats:'.format(k.capitalize())
    print "=" * len(string)
    print string
    print "=" * len(string)
    trip.stats()

    fig = trip.plot()
    fig.suptitle('Via {}'.format(k.capitalize()))
    fig.set_figheight(8.0)
    fig.savefig('../data/fith-to-hutchinson-via-' + k + '.png', dpi=200)
    fig.show()


text:
{% extends 'replica/dashboard/base.html' %}
{% load core_tags %}{% load dash %}

{% block page %}main dashboard{% endblock %}

{% block content %}

 Scheduled Posts

				{% render_upcoming 100 user %}

 Ideas

				{% render_ideas 100 user %}

 Browse by Month

				{% render_dashboard_months user %}

 Browse by Topic

			{% render_topics 100 user False %}

				{% block breadcrumb %}{% endblock %}

			{% block EntryContent %}{% endblock %}

		{% if is_paginated %}
			{% include "replica/dashboard/includes/_pagination.html" %}
		{% endif %}

{% endblock %}


text:
package org.apache.camel.processor.routingslip;

import java.util.concurrent.TimeUnit;

import javax.naming.Context;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.util.jndi.JndiContext;

public class RoutingSlipWithExceptionTest extends ContextTestSupport {

    protected static final String ANSWER = "answer";
    protected static final String ROUTING_SLIP_HEADER = "destinations";
    protected MyBean myBean = new MyBean();
    private MockEndpoint endEndpoint;
    private MockEndpoint exceptionEndpoint;
    private MockEndpoint exceptionSettingEndpoint;
    private MockEndpoint aEndpoint;

    public void testNoException() throws Exception {
        endEndpoint.expectedMessageCount(1);
        exceptionEndpoint.expectedMessageCount(0);
        aEndpoint.expectedMessageCount(1);

        sendRoutingSlipWithNoExceptionThrowingComponent();

        assertEndpointsSatisfied();
    }

    public void testWithExceptionThrowingComponentFirstInList() throws Exception {
        endEndpoint.expectedMessageCount(0);
        exceptionEndpoint.expectedMessageCount(1);
        aEndpoint.expectedMessageCount(0);

        sendRoutingSlipWithExceptionThrowingComponentFirstInList();

        assertEndpointsSatisfied();
    }

    public void testWithExceptionThrowingComponentSecondInList() throws Exception {
        endEndpoint.expectedMessageCount(0);
        exceptionEndpoint.expectedMessageCount(1);
        aEndpoint.expectedMessageCount(1);

        sendRoutingSlipWithExceptionThrowingComponentSecondInList();

        assertEndpointsSatisfied();
    }

    public void testWithExceptionSettingComponentFirstInList() throws Exception {
        endEndpoint.expectedMessageCount(0);
        exceptionEndpoint.expectedMessageCount(1);
        aEndpoint.expectedMessageCount(0);

        sendRoutingSlipWithExceptionSettingComponentFirstInList();

        assertEndpointsSatisfied();
    }

    public void testWithExceptionSettingComponentSecondInList() throws Exception {
        endEndpoint.expectedMessageCount(0);
        exceptionEndpoint.expectedMessageCount(1);
        aEndpoint.expectedMessageCount(1);

        sendRoutingSlipWithExceptionSettingComponentSecondInList();

        assertEndpointsSatisfied();
    }

    private void assertEndpointsSatisfied() throws InterruptedException {
        MockEndpoint.assertIsSatisfied(5, TimeUnit.SECONDS, endEndpoint, exceptionEndpoint, aEndpoint);
    }

    protected void sendRoutingSlipWithExceptionThrowingComponentFirstInList() {
        template.sendBodyAndHeader("direct:start", ANSWER, ROUTING_SLIP_HEADER,
                "bean:myBean?method=throwException,mock:a");
    }

    protected void sendRoutingSlipWithExceptionThrowingComponentSecondInList() {
        template.sendBodyAndHeader("direct:start", ANSWER, ROUTING_SLIP_HEADER,
                "mock:a,bean:myBean?method=throwException");
    }

    protected void sendRoutingSlipWithNoExceptionThrowingComponent() {
        template.sendBodyAndHeader("direct:start", ANSWER, ROUTING_SLIP_HEADER,
                "mock:a");
    }

    protected void sendRoutingSlipWithExceptionSettingComponentFirstInList() {
        template.sendBodyAndHeader("direct:start", ANSWER, ROUTING_SLIP_HEADER,
                "mock:exceptionSetting,mock:a");
    }

    protected void sendRoutingSlipWithExceptionSettingComponentSecondInList() {
        template.sendBodyAndHeader("direct:start", ANSWER, ROUTING_SLIP_HEADER,
                "mock:a,mock:exceptionSetting");
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        endEndpoint = resolveMandatoryEndpoint("mock:noexception", MockEndpoint.class);
        exceptionEndpoint = resolveMandatoryEndpoint("mock:exception", MockEndpoint.class);
        exceptionSettingEndpoint = resolveMandatoryEndpoint("mock:exceptionSetting", MockEndpoint.class);
        aEndpoint = resolveMandatoryEndpoint("mock:a", MockEndpoint.class);

        exceptionSettingEndpoint.whenAnyExchangeReceived(new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.setException(new Exception("Throw me!"));
            }
        });

        Object lookedUpBean = context.getRegistry().lookup("myBean");
        assertSame("Lookup of 'myBean' should return same object!", myBean, lookedUpBean);
    }

    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();
        answer.bind("myBean", myBean);
        return answer;
    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                from("direct:start").
                        doTry().
                        routingSlip(ROUTING_SLIP_HEADER).to("mock:noexception").
                        doCatch(Exception.class).
                    to("mock:exception");
            }
        };
    }

    public static class MyBean {
        public MyBean() {
        }

        public void throwException() throws Exception {
            throw new Exception("Throw me!");
        }
    }
}


text:
package facebook4j.management;

import javax.management.*;
import javax.management.openmbean.*;
import java.util.Iterator;

/**
 * Dynamic version of APIStatisticsMBean that wraps an APIStatisticsOpenMBean.
 * Provides a tabular view of method stats. This MBean can only run on JDK 1.5+
 *
 * @author Nick Dellamaggiore (nick.dellamaggiore <at> gmail.com)
 * @since Twitter4J 2.2.1
 */
public class APIStatisticsOpenMBean implements DynamicMBean {
    // metadata
    private static final String[] ITEM_NAMES = {"methodName", "callCount", "errorCount", "totalTime", "avgTime"};
    private static final OpenType[] ITEM_TYPES =
            {SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG};
    private static final String[] ITEM_DESCRIPTIONS =
            {"The method name",
                    "The number of times this method has been called",
                    "The number of calls that failed",
                    "The total amount of time spent invoking this method in milliseconds",
                    "The average amount of time spent invoking this method in milliseconds"};
    private final CompositeType METHOD_STATS_TYPE;

    private final APIStatisticsMBean API_STATISTICS;
    private final TabularType API_STATISTICS_TYPE;

    public APIStatisticsOpenMBean(APIStatistics apiStatistics) {
        API_STATISTICS = apiStatistics;

        try {
            METHOD_STATS_TYPE =
                    new CompositeType("method statistics", "method statistics",
                            ITEM_NAMES, ITEM_DESCRIPTIONS, ITEM_TYPES);

            String[] index = {"methodName"};
            API_STATISTICS_TYPE = new TabularType("API statistics",
                    "list of methods",
                    METHOD_STATS_TYPE,
                    index);
        } catch (OpenDataException e) {
            throw new RuntimeException(e);
        }
    }

    public MBeanInfo getMBeanInfo() {
        OpenMBeanInfoSupport info;
        OpenMBeanAttributeInfoSupport[] attributes = new OpenMBeanAttributeInfoSupport[5];
        OpenMBeanConstructorInfoSupport[] constructors = new OpenMBeanConstructorInfoSupport[1];
        OpenMBeanOperationInfoSupport[] operations = new OpenMBeanOperationInfoSupport[1];
        MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

        int attrIdx = 0;
        attributes[attrIdx++] =
                new OpenMBeanAttributeInfoSupport("callCount",
                        "Total number of API calls",
                        SimpleType.LONG, true, false, false);

        attributes[attrIdx++] =
                new OpenMBeanAttributeInfoSupport("errorCount",
                        "The number of failed API calls",
                        SimpleType.LONG, true, false, false);

        attributes[attrIdx++] =
                new OpenMBeanAttributeInfoSupport("averageTime",
                        "Average time spent invoking any API method",
                        SimpleType.LONG, true, false, false);

        attributes[attrIdx++] =
                new OpenMBeanAttributeInfoSupport("totalTime",
                        "Average time spent invoking any API method",
                        SimpleType.LONG, true, false, false);

        attributes[attrIdx++] =
                new OpenMBeanAttributeInfoSupport("statisticsTable",
                        "Table of statisics for all API methods",
                        API_STATISTICS_TYPE, true, false, false);

        constructors[0] = new OpenMBeanConstructorInfoSupport(
                "APIStatisticsOpenMBean",
                "Constructs an APIStatisticsOpenMBean instance",
                new OpenMBeanParameterInfoSupport[0]);

        OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
        operations[0] = new OpenMBeanOperationInfoSupport(
                "reset",
                "reset the statistics",
                params,
                SimpleType.VOID,
                MBeanOperationInfo.INFO);

        info = new OpenMBeanInfoSupport(this.getClass().getName(),
                "API Statistics Open MBean", attributes, constructors,
                operations, notifications);

        return info;
    }

    public synchronized TabularDataSupport getStatistics() {
        TabularDataSupport apiStatisticsTable = new TabularDataSupport(API_STATISTICS_TYPE);

        Iterator<? extends InvocationStatistics> itr = API_STATISTICS.getInvocationStatistics().iterator();
        while (itr.hasNext()) {
            InvocationStatistics methodStats = itr.next();
            Object[] itemValues = {methodStats.getName(),
                    methodStats.getCallCount(),
                    methodStats.getErrorCount(),
                    methodStats.getTotalTime(),
                    methodStats.getAverageTime()};

            try {
                CompositeData result = new CompositeDataSupport(METHOD_STATS_TYPE,
                        ITEM_NAMES,
                        itemValues);
                apiStatisticsTable.put(result);
            } catch (OpenDataException e) {
                throw new RuntimeException(e);
            }

        }

        return apiStatisticsTable;
    }

    public void reset() {
        API_STATISTICS.reset();
    }

    public Object getAttribute(String attribute)
            throws AttributeNotFoundException, MBeanException, ReflectionException {
        if (attribute.equals("statisticsTable")) {
            return (TabularData) getStatistics();
        } else if (attribute.equals("callCount")) {
            return API_STATISTICS.getCallCount();
        } else if (attribute.equals("errorCount")) {
            return API_STATISTICS.getErrorCount();
        } else if (attribute.equals("totalTime")) {
            return API_STATISTICS.getTotalTime();
        } else if (attribute.equals("averageTime")) {
            return API_STATISTICS.getAverageTime();
        }
        throw new AttributeNotFoundException("Cannot find " + attribute + " attribute ");
    }

    public AttributeList getAttributes(String[] attributeNames) {
        AttributeList resultList = new AttributeList();
        if (attributeNames.length == 0)
            return resultList;
        for (int i = 0; i < attributeNames.length; i++) {
            try {
                Object value = getAttribute(attributeNames[i]);
                resultList.add(new Attribute(attributeNames[i], value));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return (resultList);
    }

    public Object invoke(String actionName, Object[] params, String[] signature)
            throws MBeanException, ReflectionException {
        if (actionName.equals("reset")) {
            reset();
            return "Statistics reset";
        } else {
            throw new ReflectionException(new NoSuchMethodException(
                    actionName), "Cannot find the operation " + actionName);
        }
    }

    public void setAttribute(Attribute attribute)
            throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException,
            ReflectionException {
        throw new AttributeNotFoundException(
                "No attributes can be set in this MBean");
    }

    public AttributeList setAttributes(AttributeList attributes) {
        return new AttributeList();
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Hql.Ast.ANTLR.Tree;

namespace Core.Dados.NH.Entidades
{
    public interface IEntidade
    {
        long Id { get; set; }
    }
}


text:
@interface CYIdentificationController : UIViewController

@end