text:
package com.example.maguoqing.androiddemo.activity;

import android.content.Context;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.maguoqing.androiddemo.R;
import com.example.maguoqing.androiddemo.base.BaseActivity;

import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

/**
 * Created by magq on 16/6/29.
 */
public class RXActivity extends BaseActivity {

    @ViewId(R.id.btn_start)
    private Button btnStart;

    @ViewId(R.id.tv_message)
    private TextView tvMessage;

    private Context mContext;

    @Override
    protected void setListeners() {

        btnStart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                click();
            }
        });
    }

    public void click() {
        Observable.create(new Observable.OnSubscribe<String>() {
            @Override
            public void call(Subscriber<? super String> subscriber) {
                subscriber.onNext("RXJava");
            }
        }).subscribeOn(Schedulers.io())
                .map(new Func1<String, String>() {
                    @Override
                    public String call(String s) {
                        return "HELLO" + s.toUpperCase();
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<String>() {
                    @Override
                    public void call(String s) {
                        tvMessage.setText(s);
                    }
                });
    }

    @Override
    protected void readIntent() {

    }

    @Override
    protected void initControls() {
        mContext = this;

    }

    @Override
    protected int getActivityLayout() {
        return R.layout.activity_rxjava;
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        ActivityCompat.finishAfterTransition(this);
    }
}


text:
// scalastyle:off println
package org.apache.spark.examples.graphx

// $example on$
import org.apache.spark.graphx.{Graph, VertexId}
import org.apache.spark.graphx.util.GraphGenerators
// $example off$
import org.apache.spark.sql.SparkSession

/**
 * An example use the Pregel operator to express computation
 * such as single source shortest path
 * Run with
 * {{{
 * bin/run-example graphx.SSSPExample
 * }}}
 */
object SSSPExample {
  def main(args: Array[String]): Unit = {
    // Creates a SparkSession.
    val spark = SparkSession
      .builder
      .appName(s"${this.getClass.getSimpleName}")
      .getOrCreate()
    val sc = spark.sparkContext

    // $example on$
    // A graph with edge attributes containing distances
    val graph: Graph[Long, Double] =
      GraphGenerators.logNormalGraph(sc, numVertices = 100).mapEdges(e => e.attr.toDouble)
    val sourceId: VertexId = 42 // The ultimate source
    // Initialize the graph such that all vertices except the root have distance infinity.
    val initialGraph = graph.mapVertices((id, _) =>
        if (id == sourceId) 0.0 else Double.PositiveInfinity)
    val sssp = initialGraph.pregel(Double.PositiveInfinity)(
      (id, dist, newDist) => math.min(dist, newDist), // Vertex Program
      triplet => {  // Send Message
        if (triplet.srcAttr + triplet.attr < triplet.dstAttr) {
          Iterator((triplet.dstId, triplet.srcAttr + triplet.attr))
        } else {
          Iterator.empty
        }
      },
      (a, b) => math.min(a, b) // Merge Message
    )
    println(sssp.vertices.collect.mkString("\n"))
    // $example off$

    spark.stop()
  }
}
// scalastyle:on println

redpajama_set_name: RedPajamaGithub


text:
package org.eclipse.bpmn2;

/**
 *
 * A representation of the model object 'Signal'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link org.eclipse.bpmn2.Signal#getName Name}

 *
{@link org.eclipse.bpmn2.Signal#getStructureRef Structure Ref}

 *

 *
 * @see org.eclipse.bpmn2.Bpmn2Package#getSignal()
 * @model extendedMetaData="name='tSignal' kind='elementOnly'"
 * @generated
 */
public interface Signal extends RootElement {
	/**
	 * Returns the value of the 'Name' attribute.
	 *
	 *
	 * @return the value of the 'Name' attribute.
	 * @see #setName(String)
	 * @see org.eclipse.bpmn2.Bpmn2Package#getSignal_Name()
	 * @model required="true" ordered="false"
	 *        extendedMetaData="kind='attribute' name='name'"
	 * @generated
	 */
	String getName();

	/**
	 * Sets the value of the '{@link org.eclipse.bpmn2.Signal#getName Name}' attribute.
	 *
	 *
	 * @param value the new value of the 'Name' attribute.
	 * @see #getName()
	 * @generated
	 */
	void setName(String value);

	/**
	 * Returns the value of the 'Structure Ref' reference.
	 *
	 *
	 * @return the value of the 'Structure Ref' reference.
	 * @see #setStructureRef(ItemDefinition)
	 * @see org.eclipse.bpmn2.Bpmn2Package#getSignal_StructureRef()
	 * @model ordered="false"
	 *        extendedMetaData="kind='attribute' name='structureRef'"
	 * @generated
	 */
	ItemDefinition getStructureRef();

	/**
	 * Sets the value of the '{@link org.eclipse.bpmn2.Signal#getStructureRef Structure Ref}' reference.
	 *
	 *
	 * @param value the new value of the 'Structure Ref' reference.
	 * @see #getStructureRef()
	 * @generated
	 */
	void setStructureRef(ItemDefinition value);

} // Signal


text:
package com.yahoo.tensorflowonspark

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types._
import org.apache.spark.{SparkConf, SparkContext}
import org.json4s._
import org.json4s.native.JsonMethods

/**
  * Spark application that infers from a TensorFlow SavedModel.
  */
object Inference {

  case class Config(export_dir: String = "",
                    input: String = "",
                    schema_hint: StructType = new StructType(),
                    input_mapping: Map[String, String] = Map.empty,
                    output_mapping: Map[String, String] = Map.empty,
                    output: String = "",
                    verbose: Boolean = false)

  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName("Inference")
    implicit val sc: SparkContext = new SparkContext(conf)
    val parser = new scopt.OptionParser[Config]("Inference") {
      opt[String]("export_dir").text("Path to exported saved_model")
        .action((x, conf) => conf.copy(export_dir = x))
      opt[String]("input").text("Path to input TFRecords")
        .action((x, conf) => conf.copy(input = x))
      opt[String]("schema_hint").text("schema hint (in StructType.simpleString format) for converting TFRecord features to Spark DataFrame types")
        .action{ case (schema, conf) => conf.copy(schema_hint = SimpleTypeParser.parse(schema)) }
      opt[String]("input_mapping").text("JSON mapping of input columns to input tensors")
        .action((x, conf) => conf.copy(input_mapping = JsonMethods.parse(x).values.asInstanceOf[Map[String, String]]))
      opt[String]("output_mapping").text("JSON mapping of output tensors to output columns")
        .action((x, conf) => conf.copy(output_mapping = JsonMethods.parse(x).values.asInstanceOf[Map[String, String]]))
      opt[String]("output").text("Path to write predictions").action((x, conf) => conf.copy(output = x))
      opt[Unit]("verbose").text("Print input dataframe sample with schema").action((_, conf) => conf.copy(verbose = true))
    }

    parser.parse(args, Config()) match {
      case Some(config) => run(sc, config)
      case None => System.exit(1)
    }
    sc.stop()
  }

  def run(implicit sc: SparkContext, config: Config) {

    implicit val spark: SparkSession = SparkSession.builder().getOrCreate()

    // load TFRecords as a Spark DataFrame (using a user-provided schema hint)
    val df = DFUtil.loadTFRecords(config.input, config.schema_hint)
    if (config.verbose) {
      df.show()
      df.printSchema()
    }

    // instantiate a TFModel pointing to an existing TensorFlow saved_model export
    // set up mappings between input DataFrame columns to input Tensors
    // and output Tensors to output DataFrame columns
    // Note: the output DataFrame column types will be inferred from the output Tensor dtypes
    val model = new TFModel().setModel(config.export_dir)
                              .setInputMapping(config.input_mapping)
                              .setOutputMapping(config.output_mapping)

    // transform the input DataFrame
    // Note: we're currently dropping input columns for simplicity, you can retrieve them as Tensors if needed.
    val predDF = model.transform(df)

    // write the predictions
    predDF.write.json(config.output)

    spark.stop()
  }
}


text:
$(document).on('click', '.modal a.image', function (e) {
  e.preventDefault();

  var selected_image_id = $(this).data('image');
  var selected_image_url = $(this).data('url')

  $(".image_id_input").val(selected_image_id);
  $('.image-preview').attr('src', selected_image_url);

  $.modal.close();
});

$(document).on('click', '.modal .pagination a', function(e) {
  e.preventDefault();

  $(".modal").load(this.href).open();
});

$('.choose-image-link').on('click', function(e) {
  e.preventDefault();
  $(this).modal();

  $("html, body").animate({ scrollTop: 0 }, "slow");
});


text:
using System.Runtime.InteropServices;

namespace CodeFiction.InfinityFiction.Structure.Structures.Dlg
{
    [StructLayout(LayoutKind.Explicit, Size = 8, CharSet = CharSet.Ansi)]
    public struct TransitionTrigger
    {
        [FieldOffset(0x0000)]
        public uint TransitionTriggerOffset;

        [FieldOffset(0x0004)]
        public uint TransitionTriggerLength;
    }
}


text:
package com.b2international.snowowl.snomed.core.domain;

import java.util.Set;

import com.b2international.snowowl.core.domain.TransactionContext;
import com.b2international.snowowl.core.events.Request;
import com.b2international.snowowl.core.request.IndexResourceRequestBuilder;
import com.b2international.snowowl.core.terminology.ComponentCategory;
import com.b2international.snowowl.core.terminology.TerminologyComponent;
import com.b2international.snowowl.snomed.common.SnomedRf2Headers;
import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet;
import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember;
import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry;
import com.b2international.snowowl.snomed.datastore.request.SnomedRequests;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;

/**
 * Represents a SNOMED CT relationship.
 *

 * Relationships returned by search requests are populated based on the expand parameters passed into the {@link IndexResourceRequestBuilder#setExpand(String)}
 * methods. The expand parameters can be nested allowing a fine control for the details returned in the resultset.
 *
 * The supported expand parameters are:
 *

 *

 *
{@code source()} - returns the source concept of the relationship

 *
{@code destination()} - returns the destination concept of the relationship

 *
{@code type()} - returns the concept representing the type of the relationship

 *
{@code members()} - returns the reference set members referencing this component

 *

 *
 * Expand parameters can be nested to further expand or filter the details returned.
 * For example the expand string:
 *
{@code source(expand(pt()))}, would return the source concept's preferred term as well.
 *
 * @see SnomedConcept
 * @see SnomedDescription
 * @see SnomedReferenceSet
 * @see SnomedReferenceSetMember
 */
@TerminologyComponent(
	name = "SNOMED CT Relationship",
	componentCategory = ComponentCategory.RELATIONSHIP,
	docType = SnomedRelationshipIndexEntry.class
)
public final class SnomedRelationship extends SnomedCoreComponent {

	private static final long serialVersionUID = -1131388567716570593L;

	public static final String TYPE = "relationship";

	/**
	 * Enumerates expandable property keys.
	 *
	 * @since 7.0
	 */
	public static final class Expand {
		public static final String SOURCE = "source";
		public static final String TYPE = "type";
		public static final String DESTINATION = "destination";
		public static final String CHARACTERISTIC_TYPE = "characteristicType";
		public static final String MODIFIER = "modifier";
	}

	/**
	 * @since 6.16
	 */
	public static final class Fields extends SnomedCoreComponent.Fields {

		public static final String SOURCE_ID = SnomedRf2Headers.FIELD_SOURCE_ID;
		public static final String DESTINATION_ID = SnomedRf2Headers.FIELD_DESTINATION_ID;
		public static final String RELATIONSHIP_GROUP = SnomedRf2Headers.FIELD_RELATIONSHIP_GROUP;
		public static final String TYPE_ID = SnomedRf2Headers.FIELD_TYPE_ID;
		public static final String MODIFIER_ID = SnomedRf2Headers.FIELD_MODIFIER_ID;
		public static final String CHARACTERISTIC_TYPE_ID = SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID;
		public static final String VALUE = SnomedRf2Headers.FIELD_VALUE;

		public static final String UNION_GROUP = SnomedRelationshipIndexEntry.Fields.UNION_GROUP;

		public static final Set<String> ALL = ImmutableSet.of(
			// RF2 fields
			ID,
			ACTIVE,
			EFFECTIVE_TIME,
			MODULE_ID,
			SOURCE_ID,
			DESTINATION_ID,
			VALUE,
			RELATIONSHIP_GROUP,
			UNION_GROUP,
			TYPE_ID,
			CHARACTERISTIC_TYPE_ID,
			MODIFIER_ID,
			// additional fields
			RELEASED);
	}

	private boolean destinationNegated;
	private Integer relationshipGroup;
	private Integer unionGroup;
	private SnomedConcept characteristicType;
	private SnomedConcept modifier;
	private SnomedConcept source;
	private SnomedConcept type;
	private SnomedConcept destination;
	private RelationshipValue value;

	public SnomedRelationship() {
	}

	public SnomedRelationship(String id) {
		setId(id);
	}

	@Override
	public String getComponentType() {
		return SnomedRelationship.TYPE;
	}

	/**
	 * @return
	 */
	@JsonProperty
	public String getSourceId() {
		return ifNotNull(getSource(), SnomedConcept::getId);
	}

	/**
	 * Returns the source concept of this relationship.
	 *
	 * @return
	 */
	public SnomedConcept getSource() {
		return source;
	}

	/**
	 * @return
	 */
	@JsonProperty
	public String getDestinationId() {
		return ifNotNull(getDestination(), SnomedConcept::getId);
	}

	/**
	 * Returns the destination concept of this relationship.
	 *
	 * @return
	 */
	public SnomedConcept getDestination() {
		return destination;
	}

	/**
	 * Returns the value associated with this relationship.
	 *
	 * @return
	 */
	@JsonProperty("value")
	public RelationshipValue getValueAsObject() {
		return value;
	}

	@JsonIgnore
	public boolean hasValue() {
		return (value != null);
	}

	/**
	 * @return
	 */
	@JsonIgnore
	public String getValue() {
		return ifNotNull(getValueAsObject(), RelationshipValue::toLiteral);
	}

	/**
	 * Checks whether the destination concept's meaning should be negated ({@code ObjectComplementOf} semantics in OWL2).
	 *
	 * @return {@code true} if the destination concept is negated, {@code false} if it should be interpreted normally
	 */
	public boolean isDestinationNegated() {
		return destinationNegated;
	}

	/**
	 * Returns the type identifier of this relationship.
	 *
	 * @return the relationship type identifier
	 */
	@JsonProperty
	public String getTypeId() {
		return ifNotNull(getType(), SnomedConcept::getId);
	}

	/**
	 * Returns the type concept of this relationship.
	 *
	 * @return
	 */
	public SnomedConcept getType() {
		return type;
	}

	/**
	 * Returns the relationship group number.
	 *
	 * @return the relationship group, or 0 if this relationship can not be grouped, or is in an unnumbered, singleton group
	 */
	public Integer getRelationshipGroup() {
		return relationshipGroup;
	}

	/**
	 * If multiple relationship destinations are to be taken as a disjunction, the relationships are assigned a common, positive union group number.
	 *
	 * @return the relationship union group, or 0 if this relationship is not part of a disjunction
	 */
	public Integer getUnionGroup() {
		return unionGroup;
	}

	/**
	 * Returns the characteristic type of the relationship.
	 *
	 * @return the relationship's characteristic type
	 */
	public SnomedConcept getCharacteristicType() {
		return characteristicType;
	}

	/**
	 * @return the characteristicType ID of the relationship
	 */
	public String getCharacteristicTypeId() {
		return ifNotNull(getCharacteristicType(), SnomedConcept::getId);
	}

	/**
	 * Returns the relationship's modifier value.
	 *
	 * @return the modifier of this relationship
	 */
	@JsonProperty
	public SnomedConcept getModifier() {
		return modifier;
	}

	/**
	 * @return the modifierId of the relationship.
	 */
	public String getModifierId() {
		return ifNotNull(getModifier(), SnomedConcept::getId);
	}

	/**
	 * @param source
	 */
	public void setSource(SnomedConcept source) {
		this.source = source;
	}

	/**
	 * @param sourceId
	 */
	@JsonIgnore
	public void setSourceId(String sourceId) {
		setSource(ifNotNull(sourceId, SnomedConcept::new));
	}

	/**
	 * @param destination
	 */
	public void setDestination(SnomedConcept destination) {
		this.destination = destination;
	}

	/**
	 * @param destinationId
	 */
	@JsonIgnore
	public void setDestinationId(String destinationId) {
		setDestination(ifNotNull(destinationId, SnomedConcept::new));
	}

	/**
	 * @param value
	 */
	@JsonProperty("value")
	public void setValueAsObject(final RelationshipValue value) {
		this.value = value;
	}

	/**
	 * @param literal
	 */
	@JsonIgnore
	public void setValue(final String literal) {
		setValueAsObject(RelationshipValue.fromLiteral(literal));
	}

	/**
	 * @param type
	 */
	public void setType(SnomedConcept type) {
		this.type = type;
	}

	/**
	 * @param typeId
	 */
	@JsonIgnore
	public void setTypeId(String typeId) {
		setType(ifNotNull(typeId, SnomedConcept::new));
	}

	/**
	 * @param destinationNegated
	 */
	public void setDestinationNegated(final boolean destinationNegated) {
		this.destinationNegated = destinationNegated;
	}

	/**
	 * @param relationshipGroup
	 */
	public void setRelationshipGroup(final Integer relationshipGroup) {
		this.relationshipGroup = relationshipGroup;
	}

	/**
	 * @param unionGroup
	 */
	public void setUnionGroup(final Integer unionGroup) {
		this.unionGroup = unionGroup;
	}

	/**
	 * @param characteristicType
	 */
	public void setCharacteristicType(final SnomedConcept characteristicType) {
		this.characteristicType = characteristicType;
	}

	/**
	 * @param characteristicTypeId
	 */
	public void setCharacteristicTypeId(final String characteristicTypeId) {
		setCharacteristicType(ifNotNull(characteristicTypeId, SnomedConcept::new));
	}

	/**
	 * @param modifier
	 */
	public void setModifier(final SnomedConcept modifier) {
		this.modifier = modifier;
	}

	/**
	 * @param modifierId
	 */
	public void setModifierId(final String modifierId) {
		setModifier(ifNotNull(modifierId, SnomedConcept::new));
	}

	@Override
	public Request<TransactionContext, String> toCreateRequest(String containerId) {
		return SnomedRequests.prepareNewRelationship()
			.setActive(isActive())
			.setCharacteristicTypeId(getCharacteristicTypeId())
			.setDestinationId(getDestinationId())
			.setDestinationNegated(isDestinationNegated())
			.setRelationshipGroup(getRelationshipGroup())
			.setId(getId())
			.setModifierId(getModifierId())
			.setModuleId(getModuleId())
			.setSourceId(containerId)
			.setTypeId(getTypeId())
			.setUnionGroup(getUnionGroup())
			.setValue(getValueAsObject())
			.build();
	}

	@Override
	public Request<TransactionContext, Boolean> toUpdateRequest() {
		return SnomedRequests.prepareUpdateRelationship(getId())
			.setActive(isActive())
			.setCharacteristicTypeId(getCharacteristicTypeId())
			.setDestinationId(getDestinationId())
			// TODO: add setDestinationNegated(...) here?
			.setRelationshipGroup(getRelationshipGroup())
			// no setId(...) - SCTID should not be updated
			.setModifierId(getModifierId())
			.setModuleId(getModuleId())
			// no setSourceId(...) - source concept SCTID should not be updated
			.setTypeId(getTypeId())
			.setUnionGroup(getUnionGroup())
			.setValue(getValueAsObject())
			.build();
	}

	@Override
	public String toString() {
		return MoreObjects.toStringHelper(this)
			.add("id", getId())
			.add("effectiveTime", getEffectiveTime())
			.add("released", isReleased())
			.add("active", isActive())
			.add("moduleId", getModuleId())
			.add("sourceId", getSourceId())
			.add("destinationId", getDestinationId())
			.add("destinationNegated", isDestinationNegated())
			.add("value", getValue())
			.add("typeId", getTypeId())
			.add("relationshipGroup", getRelationshipGroup())
			.add("unionGroup", getUnionGroup())
			.add("characteristicTypeId", getCharacteristicTypeId())
			.add("modifierId", getModifierId())
			.toString();
	}
}


text:
import geocoder from 'node-geocoder';
import BaseLocation from './BaseLocation';

export default class DataScienceToolkitLocation extends BaseLocation {
  constructor(config) {
    super(config);

    this.setProvider(geocoder('datasciencetoolkit', 'http', this.get()));
  }

  /**
   * Geocode address and get latitude\longitude for it
   * @param {String} address
   * @returns {Promise}
   */
  geocode(address) {
    return this.getProvider().geocode(address);
  }

  /**
   * Reverse geocode to address
   * @param {Number} latitude
   * @param {Number} longitude
   * @returns {Promise}
   */
  reverse(latitude, longitude) {
    return this.getProvider().reverse({lat: latitude, lon: longitude});
  }
}


text:
package com.kwala.app.service;

import android.Manifest;
import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.kwala.app.service.endpoints.NetworkException;
import com.kwala.app.service.tasks.Task;
import com.kwala.app.service.tasks.location.UpdateLocationTask;
import com.kwala.app.service.tasks.matches.ListMatchesTask;

import pl.tajchert.nammu.Nammu;

/**
 * @author jacobamuchow@gmail.com
 */

public class LocationService extends Service implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
    private static final String TAG = LocationService.class.getSimpleName();

    private GoogleApiClient mGoogleApiClient;

    @Override
    public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);

        // Create an instance of GoogleAPIClient.
        if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(this)
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .addApi(LocationServices.API)
                    .build();

            if (!mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) {
                mGoogleApiClient.connect();
            }
        }

        return START_STICKY;
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onConnected(@Nullable Bundle bundle) {
        //TODO: ask for permission at appropriate time
        LocationRequest locationRequest = new LocationRequest();
        locationRequest.setInterval(30000);
        locationRequest.setFastestInterval(30000);
        locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

        if (Nammu.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
            LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, locationRequest, LocationService.this);
        }
    }

    @Override
    public void onConnectionSuspended(int i) {
        Log.d(TAG, "Google API connection suspended: " + i);
    }

    @Override
    public void onDestroy() {
        if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
            mGoogleApiClient.disconnect();
            mGoogleApiClient = null;
        }
        super.onDestroy();
    }

    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
        Log.d(TAG, "Google API connection failed: " + connectionResult.toString());
    }

    @Override
    public void onLocationChanged(Location location) {
        if (!UserData.getInstance().isLoggedIn()) {
            stopSelf();
            return;
        }

        Log.d(TAG, "onLocationChanged: " + location.getLatitude() + "," + location.getLongitude());

        new UpdateLocationTask(location.getLatitude(), location.getLongitude()).start(new Task.Callback<Void, NetworkException>() {
            @Override
            public void onSuccess(Void aVoid) {
                //TODO: show notification when match list changes
                Log.d(TAG, "update location success");

                //TODO: sync matches from location update endpoint instead of chaining
                new ListMatchesTask().start(new Task.Callback<Void, NetworkException>() {
                    @Override
                    public void onSuccess(Void aVoid) {
                        Log.d(TAG, "Matches list success");
                    }

                    @Override
                    public void onFailure(NetworkException e) {
                        Log.d(TAG, "Match list failure", e);
                    }
                });
            }

            @Override
            public void onFailure(NetworkException e) {
                Log.d(TAG, "update location failure", e);
            }
        });
    }
}


text:
/* Includes ------------------------------------------------------------------*/
#include "wifi.h"

/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
ES_WIFIObject_t    EsWifiObj;

/* Private functions ---------------------------------------------------------*/
/**
  * @brief  Initialiaze the LL part of the WIFI core
  * @param  None
  * @retval Operation status
  */
WIFI_Status_t WIFI_Init(void)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_RegisterBusIO(&EsWifiObj,
                           SPI_WIFI_Init,
                           SPI_WIFI_DeInit,
                           SPI_WIFI_Delay,
                           SPI_WIFI_SendData,
                           SPI_WIFI_ReceiveData) == ES_WIFI_STATUS_OK)
  {

    if(ES_WIFI_Init(&EsWifiObj) == ES_WIFI_STATUS_OK)
    {
      ret = WIFI_STATUS_OK;
    }
  }
  return ret;
}

/**
  * @brief  List a defined number of vailable access points
  * @param  APs : pointer to APs structure
  * @param  AP_MaxNbr : Max APs number to be listed
  * @retval Operation status
  */
WIFI_Status_t WIFI_ListAccessPoints(WIFI_APs_t *APs, uint8_t AP_MaxNbr)
{
  uint8_t APCount;
  WIFI_Status_t ret = WIFI_STATUS_ERROR;
  ES_WIFI_APs_t esWifiAPs;

  if(ES_WIFI_ListAccessPoints(&EsWifiObj, &esWifiAPs) == ES_WIFI_STATUS_OK)
  {
    if(esWifiAPs.nbr > 0)
    {
      APs->count = MIN(esWifiAPs.nbr, AP_MaxNbr);
      for(APCount = 0; APCount < APs->count; APCount++)
      {
        APs->ap[APCount].Ecn = (WIFI_Ecn_t)esWifiAPs.AP[APCount].Security;
        strncpy( (char *)APs->ap[APCount].SSID, (char *)esWifiAPs.AP[APCount].SSID, MIN (WIFI_MAX_SSID_NAME, WIFI_MAX_SSID_NAME));
        APs->ap[APCount].RSSI = esWifiAPs.AP[APCount].RSSI;
        memcpy(APs->ap[APCount].MAC, esWifiAPs.AP[APCount].MAC, 6);
      }
    }
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Join an Access Point
  * @param  SSID : SSID string
  * @param  Password : Password string
  * @param  ecn : Encryption type
  * @param  IP_Addr : Got IP Address
  * @param  IP_Mask : Network IP mask
  * @param  Gateway_Addr : Gateway IP address
  * @param  MAC : pointer to MAC Address
  * @retval Operation status
  */
WIFI_Status_t WIFI_Connect(
                             const char* SSID,
                             const char* Password,
                             WIFI_Ecn_t ecn)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_Connect(&EsWifiObj, SSID, Password, (ES_WIFI_SecurityType_t) ecn) == ES_WIFI_STATUS_OK)
  {
    if(ES_WIFI_GetNetworkSettings(&EsWifiObj) == ES_WIFI_STATUS_OK)
    {
       ret = WIFI_STATUS_OK;
    }

  }
  return ret;
}

/**
  * @brief  This function retrieves the WiFi interface's MAC address.
  * @retval Operation Status.
  */
WIFI_Status_t WIFI_GetMAC_Address(uint8_t  *mac)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_GetMACAddress(&EsWifiObj, mac) == ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  This function retrieves the WiFi interface's IP address.
  * @retval Operation Status.
  */
WIFI_Status_t WIFI_GetIP_Address (uint8_t  *ipaddr)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(EsWifiObj.NetSettings.IsConnected)
  {
    memcpy(ipaddr, EsWifiObj.NetSettings.IP_Addr, 4);
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Disconnect from a network
  * @param  None
  * @retval Operation status
  */
WIFI_Status_t WIFI_Disconnect(void)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;
  if( ES_WIFI_Disconnect(&EsWifiObj)== ES_WIFI_STATUS_OK)
  {
      ret = WIFI_STATUS_OK;
  }

  return ret;
}

/**
  * @brief  Ping an IP address in the network
  * @param  ipaddr : array of the IP address
  * @retval Operation status
  */
WIFI_Status_t WIFI_Ping(uint8_t* ipaddr, uint16_t count, uint16_t interval_ms)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_Ping(&EsWifiObj, ipaddr, count, interval_ms) == ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Configure and start a client connection
  * @param  type : Connection type TCP/UDP
  * @param  name : name of the connection
  * @param  location : Client address
  * @param  port : Remote port
  * @param  local_port : Local port
  * @retval Operation status
  */
WIFI_Status_t WIFI_OpenClientConnection(uint32_t socket, WIFI_Protocol_t type, const char* name, char* location, uint16_t port, uint16_t local_port)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;
  ES_WIFI_Conn_t conn;

  conn.Number = socket;
  conn.RemotePort = port;
  conn.LocalPort = local_port;
  conn.Type = (type == WIFI_TCP_PROTOCOL)? ES_WIFI_TCP_CONNECTION : ES_WIFI_UDP_CONNECTION;
  conn.RemoteIP[0] = location[0];
  conn.RemoteIP[1] = location[1];
  conn.RemoteIP[2] = location[2];
  conn.RemoteIP[3] = location[3];
  if(ES_WIFI_StartClientConnection(&EsWifiObj, &conn)== ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Close client connection
  * @param  type : Connection type TCP/UDP
  * @param  name : name of the connection
  * @param  location : Client address
  * @param  port : Remote port
  * @param  local_port : Local port
  * @retval Operation status
  */
WIFI_Status_t WIFI_CloseClientConnection(void)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;
  if(ES_WIFI_StopClientConnection(&EsWifiObj, 0)== ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Configure and start a Server
  * @param  type : Connection type TCP/UDP
  * @param  name : name of the connection
  * @param  port : Remote port
  * @retval Operation status
  */
WIFI_Status_t WIFI_StartServer(uint32_t socket, WIFI_Protocol_t protocol, const char* name, uint16_t port)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;
  ES_WIFI_Conn_t conn;
  conn.Number = socket;
  conn.LocalPort = port;
  conn.Type = (protocol == WIFI_TCP_PROTOCOL)? ES_WIFI_TCP_CONNECTION : ES_WIFI_UDP_CONNECTION;
  if(ES_WIFI_StartServerSingleConn(&EsWifiObj, &conn)== ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Stop a server
  * @retval Operation status
  */
WIFI_Status_t WIFI_StopServer(uint32_t socket)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_StopServerSingleConn(&EsWifiObj)== ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}
/**
  * @brief  Send Data on a socket
  * @param  pdata : pointer to data to be sent
  * @param  len : length of data to be sent
  * @retval Operation status
  */
WIFI_Status_t WIFI_SendData(uint8_t socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *SentDatalen)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

    if(ES_WIFI_SendData(&EsWifiObj, socket, pdata, Reqlen, SentDatalen, 10000) == ES_WIFI_STATUS_OK)
    {
      ret = WIFI_STATUS_OK;
    }

  return ret;
}

/**
  * @brief  Receive Data from a socket
  * @param  pdata : pointer to Rx buffer
  * @param  *len :  pointer to length of data
  * @retval Operation status
  */
WIFI_Status_t WIFI_ReceiveData(uint8_t socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *RcvDatalen)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_ReceiveData(&EsWifiObj, socket, pdata, Reqlen, RcvDatalen, 10000) == ES_WIFI_STATUS_OK)
  {
    ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Customize module data
  * @param  name : MFC name
  * @param  Mac :  Mac Address
  * @retval Operation status
  */
WIFI_Status_t WIFI_SetOEMProperties(const char *name, uint8_t *Mac)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_SetProductName(&EsWifiObj, (uint8_t *)name) == ES_WIFI_STATUS_OK)
  {
    if(ES_WIFI_SetMACAddress(&EsWifiObj, Mac) == ES_WIFI_STATUS_OK)
    {
      ret = WIFI_STATUS_OK;
    }
  }
  return ret;
}

/**
  * @brief  Reset the WIFI module
  * @retval Operation status
  */
WIFI_Status_t WIFI_ResetModule(void)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_ResetModule(&EsWifiObj) == ES_WIFI_STATUS_OK)
  {
      ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Restore module default configuration
  * @retval Operation status
  */
WIFI_Status_t WIFI_SetModuleDefault(void)
{
  WIFI_Status_t ret = WIFI_STATUS_ERROR;

  if(ES_WIFI_ResetToFactoryDefault(&EsWifiObj) == ES_WIFI_STATUS_OK)
  {
      ret = WIFI_STATUS_OK;
  }
  return ret;
}

/**
  * @brief  Update module firmware
  * @param  location : Binary Location IP address
  * @retval Operation status
  */
WIFI_Status_t WIFI_ModuleFirmwareUpdate(const char *location)
{
  return WIFI_STATUS_NOT_SUPPORTED;
}

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
TEST (message, keepalive_serialization)
{
	nano::keepalive request1;
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		request1.serialize (stream, false);
	}
	auto error (false);
	nano::bufferstream stream (bytes.data (), bytes.size ());
	nano::message_header header (error, stream);
	ASSERT_FALSE (error);
	nano::keepalive request2 (error, stream, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (request1, request2);
}

TEST (message, keepalive_deserialize)
{
	nano::keepalive message1;
	message1.peers[0] = nano::endpoint (boost::asio::ip::address_v6::loopback (), 10000);
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		message1.serialize (stream, false);
	}
	nano::bufferstream stream (bytes.data (), bytes.size ());
	auto error (false);
	nano::message_header header (error, stream);
	ASSERT_FALSE (error);
	ASSERT_EQ (nano::message_type::keepalive, header.type);
	nano::keepalive message2 (error, stream, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (message1.peers, message2.peers);
}

TEST (message, publish_serialization)
{
	nano::network_params params;
	nano::publish publish (std::make_shared<nano::send_block> (0, 1, 2, nano::keypair ().prv, 4, 5));
	ASSERT_EQ (nano::block_type::send, publish.header.block_type ());
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		publish.header.serialize (stream, false);
	}
	ASSERT_EQ (8, bytes.size ());
	ASSERT_EQ (0x52, bytes[0]);
	ASSERT_EQ (0x41, bytes[1]);
	ASSERT_EQ (params.protocol.protocol_version, bytes[2]);
	ASSERT_EQ (params.protocol.protocol_version, bytes[3]);
	ASSERT_EQ (params.protocol.protocol_version_min (false), bytes[4]);
	ASSERT_EQ (static_cast<uint8_t> (nano::message_type::publish), bytes[5]);
	ASSERT_EQ (0x00, bytes[6]); // extensions
	ASSERT_EQ (static_cast<uint8_t> (nano::block_type::send), bytes[7]);
	nano::bufferstream stream (bytes.data (), bytes.size ());
	auto error (false);
	nano::message_header header (error, stream);
	ASSERT_FALSE (error);
	ASSERT_EQ (params.protocol.protocol_version_min (false), header.version_min ());
	ASSERT_EQ (params.protocol.protocol_version, header.version_using);
	ASSERT_EQ (params.protocol.protocol_version, header.version_max);
	ASSERT_EQ (nano::message_type::publish, header.type);
}

TEST (message, confirm_ack_serialization)
{
	nano::keypair key1;
	auto vote (std::make_shared<nano::vote> (key1.pub, key1.prv, 0, std::make_shared<nano::send_block> (0, 1, 2, key1.prv, 4, 5)));
	nano::confirm_ack con1 (vote);
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream1 (bytes);
		con1.serialize (stream1, false);
	}
	nano::bufferstream stream2 (bytes.data (), bytes.size ());
	bool error (false);
	nano::message_header header (error, stream2);
	nano::confirm_ack con2 (error, stream2, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (con1, con2);
	ASSERT_EQ (header.block_type (), nano::block_type::send);
}

TEST (message, confirm_ack_hash_serialization)
{
	std::vector<nano::block_hash> hashes;
	for (auto i (hashes.size ()); i < nano::network::confirm_ack_hashes_max; i++)
	{
		nano::keypair key1;
		nano::block_hash previous;
		nano::random_pool::generate_block (previous.bytes.data (), previous.bytes.size ());
		nano::state_block block (key1.pub, previous, key1.pub, 2, 4, key1.prv, key1.pub, 5);
		hashes.push_back (block.hash ());
	}
	nano::keypair representative1;
	auto vote (std::make_shared<nano::vote> (representative1.pub, representative1.prv, 0, hashes));
	nano::confirm_ack con1 (vote);
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream1 (bytes);
		con1.serialize (stream1, false);
	}
	nano::bufferstream stream2 (bytes.data (), bytes.size ());
	bool error (false);
	nano::message_header header (error, stream2);
	nano::confirm_ack con2 (error, stream2, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (con1, con2);
	std::vector<nano::block_hash> vote_blocks;
	for (auto block : con2.vote->blocks)
	{
		vote_blocks.push_back (boost::get<nano::block_hash> (block));
	}
	ASSERT_EQ (hashes, vote_blocks);
	// Check overflow with max hashes
	ASSERT_EQ (header.count_get (), hashes.size ());
	ASSERT_EQ (header.block_type (), nano::block_type::not_a_block);
}

TEST (message, confirm_req_serialization)
{
	nano::keypair key1;
	nano::keypair key2;
	auto block (std::make_shared<nano::send_block> (0, key2.pub, 200, nano::keypair ().prv, 2, 3));
	nano::confirm_req req (block);
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		req.serialize (stream, false);
	}
	auto error (false);
	nano::bufferstream stream2 (bytes.data (), bytes.size ());
	nano::message_header header (error, stream2);
	nano::confirm_req req2 (error, stream2, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (req, req2);
	ASSERT_EQ (*req.block, *req2.block);
}

TEST (message, confirm_req_hash_serialization)
{
	nano::keypair key1;
	nano::keypair key2;
	nano::send_block block (1, key2.pub, 200, nano::keypair ().prv, 2, 3);
	nano::confirm_req req (block.hash (), block.root ());
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		req.serialize (stream, false);
	}
	auto error (false);
	nano::bufferstream stream2 (bytes.data (), bytes.size ());
	nano::message_header header (error, stream2);
	nano::confirm_req req2 (error, stream2, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (req, req2);
	ASSERT_EQ (req.roots_hashes, req2.roots_hashes);
	ASSERT_EQ (header.block_type (), nano::block_type::not_a_block);
	ASSERT_EQ (header.count_get (), req.roots_hashes.size ());
}

TEST (message, confirm_req_hash_batch_serialization)
{
	nano::keypair key;
	nano::keypair representative;
	std::vector<std::pair<nano::block_hash, nano::root>> roots_hashes;
	nano::state_block open (key.pub, 0, representative.pub, 2, 4, key.prv, key.pub, 5);
	roots_hashes.push_back (std::make_pair (open.hash (), open.root ()));
	for (auto i (roots_hashes.size ()); i < 7; i++)
	{
		nano::keypair key1;
		nano::block_hash previous;
		nano::random_pool::generate_block (previous.bytes.data (), previous.bytes.size ());
		nano::state_block block (key1.pub, previous, representative.pub, 2, 4, key1.prv, key1.pub, 5);
		roots_hashes.push_back (std::make_pair (block.hash (), block.root ()));
	}
	roots_hashes.push_back (std::make_pair (open.hash (), open.root ()));
	nano::confirm_req req (roots_hashes);
	std::vector<uint8_t> bytes;
	{
		nano::vectorstream stream (bytes);
		req.serialize (stream, false);
	}
	auto error (false);
	nano::bufferstream stream2 (bytes.data (), bytes.size ());
	nano::message_header header (error, stream2);
	nano::confirm_req req2 (error, stream2, header);
	ASSERT_FALSE (error);
	ASSERT_EQ (req, req2);
	ASSERT_EQ (req.roots_hashes, req2.roots_hashes);
	ASSERT_EQ (req.roots_hashes, roots_hashes);
	ASSERT_EQ (req2.roots_hashes, roots_hashes);
	ASSERT_EQ (header.block_type (), nano::block_type::not_a_block);
	ASSERT_EQ (header.count_get (), req.roots_hashes.size ());
}


text:
package org.apache.rave.portal.model.impl;

import org.apache.rave.model.Languages;
import org.apache.rave.model.PlayerSpeciality;

import java.io.Serializable;

/**
 * Created by fhenandez on 16/09/14.
 */
public class PlayerSpecialityImpl implements PlayerSpeciality, Serializable {

    private Long entityId;
    private String name;
    private Languages lang;

    @Override
    public Long getEntityId() {
        return entityId;
    }

    @Override
    public void setEntityId(Long entityId) {
        this.entityId = entityId;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public Languages getLang() {
        return lang;
    }

    @Override
    public void setLang(Languages lang) {
        this.lang = lang;
    }
}


text:
(function() {
  var AbstractParser, ParseGeneric, _,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  _ = require("lodash");

  AbstractParser = require("./abstract");

  module.exports.Generic = ParseGeneric = (function(_super) {
    __extends(ParseGeneric, _super);

    function ParseGeneric() {
      this.weigth = 0;
    }

    ParseGeneric.prototype.parse = function(file, content, fuzzy) {
      var lines, stack;
      stack = [];
      lines = content.split("\n");
      _.forEach(lines, (function(_this) {
        return function(line, i) {
          var d, token, tokens, _i, _len, _results;
          tokens = line.trim().split(" ");
          _results = [];
          for (d = _i = 0, _len = tokens.length; _i < _len; d = ++_i) {
            token = tokens[d];
            if (!_this.ignores(token)) {
              _results.push(stack.push({
                type: "generic",
                value: token,
                line: i + 1
              }));
            } else {
              _results.push(void 0);
            }
          }
          return _results;
        };
      })(this));
      return stack;
    };

    ParseGeneric.prototype.ignores = function(token) {
      return token.match(/^\s+$/);
    };

    ParseGeneric.prototype.registers = function(mime, extension) {
      return true;
    };

    return ParseGeneric;

  })(AbstractParser);

}).call(this);


text:
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;

namespace localisation{
	public class LocaleEntriesWindow : EditorWindow {
		Dictionary<SystemLanguage, LanguageFile> langFileCache;
		SystemLanguage[] languages;
		Dictionary<string, GUILocaleRow> entries;

		[MenuItem("Window/LocaleEntriesEditor")]
		static void createLocaleEntriesWindow(){
			LocaleEntriesWindow window = EditorWindow.GetWindow<LocaleEntriesWindow>();
			window.Show();
			window.initialize();
		}

		void initialize(){
			List<LanguageFile> currentLanguages = Locale.instance.languages;
			languages = new SystemLanguage[currentLanguages.Count];
			langFileCache = new Dictionary<SystemLanguage, LanguageFile>();
			for (int i = 0; i < currentLanguages.Count; i++) {
				languages[i] = currentLanguages[i].language;
				langFileCache.Add(languages[i], currentLanguages[i]);
			}
			entries = new Dictionary<string, GUILocaleRow>();

			string key,value;
			foreach(KeyValuePair<SystemLanguage, LanguageFile> langLangFileKVP in langFileCache){
				foreach(LanguageFileEntry langFileEntry in  langLangFileKVP.Value.entries){
				 	key = langFileEntry.key;
					value = langFileEntry.value;
					if (entries.ContainsKey(key)){
						if (entries[key].values.ContainsKey(langLangFileKVP.Key))
							Debug.LogError("something wrong, probably you have duplicates for "
							               + langLangFileKVP.Key +" language");
						else
							entries[key].values.Add(langLangFileKVP.Key, value);
					} else {
						GUILocaleRow localeRow = new GUILocaleRow();
						localeRow.key = key;
						localeRow.values = new Dictionary<SystemLanguage, string>();
						localeRow.values.Add(langLangFileKVP.Key, value);
						entries.Add(key,localeRow);
					}
				}
			}

		}

		Vector2 scrollPosition;
		GUILayoutOption keyColumnWidth = GUILayout.Width(100);
		GUILayoutOption langColumnWidth = GUILayout.Width(200);
		string newStringValue;
		void OnGUI(){
			scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

			EditorGUILayout.BeginHorizontal();
			EditorGUILayout.LabelField("key", keyColumnWidth);
			for (int i = 0; i < languages.Length; i++) {
				EditorGUILayout.LabelField(languages[i].ToString(), langColumnWidth);
			}
			EditorGUILayout.EndHorizontal();

			foreach(KeyValuePair<string, GUILocaleRow> kvp in entries){
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.LabelField(kvp.Key, keyColumnWidth);
				for (int i = 0; i < languages.Length; i++) {
					EditorGUI.BeginChangeCheck();
					newStringValue = EditorGUILayout.TextField(kvp.Value.values[languages[i]],langColumnWidth);
					if (EditorGUI.EndChangeCheck()){
						kvp.Value.values[languages[i]]=newStringValue;
						langFileCache[languages[i]].updateKey(kvp.Key, newStringValue);
						EditorUtility.SetDirty(langFileCache[languages[i]]);
					}
				}
				EditorGUILayout.EndHorizontal();
			}

			EditorGUILayout.EndScrollView();
		}

		struct GUILocaleRow{
			public string                             key;
			public Dictionary<SystemLanguage, string> values;
		}
	}
}


text:
package org.epctagcoder.option.SGTIN.partitionTable;

import java.util.ArrayList;
import java.util.List;

import org.epctagcoder.exception.EPCParseException;
import org.epctagcoder.option.TableItem;

public class SGTINPartitionTableList {
	static final private List<TableItem> list = new ArrayList<>();

	static {
		list.add( new TableItem(0, 40, 12,  4, 1) );
		list.add( new TableItem(1, 37, 11,  7, 2) );
		list.add( new TableItem(2, 34, 10, 10, 3) );
		list.add( new TableItem(3, 30,  9, 14, 4) );
		list.add( new TableItem(4, 27,  8, 17, 5) );
		list.add( new TableItem(5, 24,  7, 20, 6) );
		list.add( new TableItem(6, 20,  6, 24, 7) );
	}

	public SGTINPartitionTableList() {

	}

	public TableItem getPartitionByL(Integer index) {
		TableItem tableItem = null;
		for (TableItem item : list) {
			if (item.getL()==index) {
				tableItem = item;
				break;
			}
		}
		return tableItem;
	}

	public TableItem getPartitionByValue(int index) throws EPCParseException {
		if(index < 0 || index >= list.size()) {
			String message = "Partition value %d is not within expected range (0 - %d)";
			throw new EPCParseException(String.format(message, index, list.size() - 1));
		}

		return list.get(index);
	}

}


text:
package net.john;

import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.List;

/**
 * Created by john on 12/12/16.
 */
public class App {

    public static void main(String[] args) {
        CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
        String urlBase = "http://localhost:8080/";

        try {
            StreetFighter streetFighter = new StreetFighter(urlBase);
            List<String> strongers = streetFighter.getStrongerFighters();

            System.out.println("Invictos del torneo:");
            for (String stronger : strongers) {
                System.out.println(stronger);
            }
        } catch (StreetFighterException e) {
            System.out.println("Error: " + e.getMessage());
        }

    }

}


text:
The **Create Class** command creates a new class in the schema. *NOTE: If a cluster with the same name exists in the database will be used as default cluster.*

## Syntax

```sql
CREATE CLASS <class> [EXTENDS <super-class>] [CLUSTER <clusterId>*] [CLUSTERS <total-cluster-number>] [ABSTRACT]
```

Where:
- **class** is the class name to create. The first character must be alphabetic and others can be any alphanumeric characters plus underscore _ and dash -.
- **super-class**, optional, is the super-class to extend
- **clusterId** can be a list separated by comma (,)
- **total-cluster-number** is the number of clusters to create. Default is 1. Since 2.1.
- **ABSTRACT** set the class as abstract in the Object Oriented meaning, so no instances of this class can be created

By default OrientDB creates 1 cluster per class with the same name of the class in lowercase. If you work with multiple cores, we suggest to use multiple clusters to improve concurrency on insert. To change the number of clusters you can set the property ```minimumclusters``` at [database level](SQL-Alter-Database.md) or you can use the `CLUSTERS <total-cluster-number>` syntax (since 2.1).

## Cluster selection strategy
OrientDB, by default, inherits the cluster selection by the [database](SQL-Alter-Database.md). By default is round-robin, but you can always change it after creation with [alter class command](SQL-Alter-Class.md). The supported strategies are:
- **default**, uses always the Class's ```defaultClusterId``` property. This was the default before 1.7
- **round-robin**, put the Class's configured clusters in a ring and returns a different cluster every time restarting from the first when the ring is completed
- **balanced**, checks the records in all the clusters and returns the smaller cluster. This allows the cluster to have all the underlying clusters balanced on size. On adding a new cluster to an existent class, the new empty cluster will be filled before the others because more empty then the others. In distributed configuration when configure clusters on different servers this setting allows to keep the server balanced with the same amount of data. Calculation of cluster size is made every 5 or more seconds to avoid to slow down insertion

## See also
- [alter class](SQL-Alter-Class.md)
- [drop class](SQL-Drop-Class.md)
- [create cluster](SQL-Create-Cluster.md)
- [SQL commands](SQL.md)
- [Console commands](Console-Commands.md)

## Examples

Create the class 'Account':
```sql
CREATE CLASS Account
```

Create the class 'Car' that extends 'Vehicle':
```sql
CREATE CLASS Car extends Vehicle
```

Create the class 'Car' with clusterId 10:
```sql
CREATE CLASS Car CLUSTER 10
```

## Abstract class

Create the class 'Person' as [ABSTRACT](Concepts.md#abstract-class):
```sql
CREATE CLASS Person ABSTRACT
```


text:
require 'google/protobuf'

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file("google/ads/googleads/v10/enums/lead_form_desired_intent.proto", :syntax => :proto3) do
    add_message "google.ads.googleads.v10.enums.LeadFormDesiredIntentEnum" do
    end
    add_enum "google.ads.googleads.v10.enums.LeadFormDesiredIntentEnum.LeadFormDesiredIntent" do
      value :UNSPECIFIED, 0
      value :UNKNOWN, 1
      value :LOW_INTENT, 2
      value :HIGH_INTENT, 3
    end
  end
end

module Google
  module Ads
    module GoogleAds
      module V10
        module Enums
          LeadFormDesiredIntentEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v10.enums.LeadFormDesiredIntentEnum").msgclass
          LeadFormDesiredIntentEnum::LeadFormDesiredIntent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v10.enums.LeadFormDesiredIntentEnum.LeadFormDesiredIntent").enummodule
        end
      end
    end
  end
end


text:
package com.intellij.codeInsight.daemon.impl.quickfix;

import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;

import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_11;

public class PatchMethodParametersTest extends LightQuickFixParameterizedTestCase {
  @Override
  protected String getBasePath() {
    return "/codeInsight/daemonCodeAnalyzer/quickFix/patchMethodParams";
  }

  @Override
  protected @NotNull LightProjectDescriptor getProjectDescriptor() {
    return JAVA_11;
  }
}


text:
-------------------------------------------------------------------------------
-- <copyright company="Sherlock">
--     Copyright 2013 Sherlock. Licensed under the Apache License, Version 2.0.
-- </copyright>
-------------------------------------------------------------------------------

CREATE PROCEDURE [Tests].[MarkTestAsReadyForExecution]
    @id INT
AS
    IF NOT EXISTS(
        SELECT *
        FROM [Tests].[Test]
        WHERE [pk_TestId] = @id)
    BEGIN
        RAISERROR
            (
                N'An entry for a test with id %d does not exist',
                11,
                1,
                @id
            )
        RETURN
    END

    BEGIN TRANSACTION

        UPDATE [Tests].[Test]
        SET
            [IsReadyForExecution] = 1
        WHERE [pk_TestId] = @id

        IF @@ERROR <> 0
        BEGIN
            ROLLBACK

            RAISERROR
                (
                    'Failed to update test with ID %d.',
                    11,
                    1,
                    @id
                )
            RETURN
        END

    COMMIT
RETURN 0


text:
using System;
using System.Linq;
using System.Collections.Generic;
using NeuroSpeech.UIAtoms;
using NeuroSpeech.UIAtoms.DI;
using System.Text;
using UIAtomsDemo.Services;
using Xamarin.Forms;
using System.Collections.Specialized;

namespace UIAtomsDemo.Controls
{

    public class MenuList : Xamarin.Forms.ListView {

        public MenuList()
        {

            this.ItemSelected += MenuList_ItemSelected;

            var menuService = DependencyService.Get<MenuService>();

            this.SetBinding(MenuItemsProperty, new Binding("Menus") { Source = menuService });
        }

        private void MenuList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
                return;
            Services.MenuItem mi = e.SelectedItem as Services.MenuItem;
            mi?.Click();
            SelectedItem = null;
        }

        #region Property MenuItems

        /// <summary>
        /// Bindable Property MenuItems
        /// </summary>
        public static readonly BindableProperty MenuItemsProperty = BindableProperty.Create(
          "MenuItems",
          typeof(IEnumerable<Services.MenuItem>),
          typeof(MenuList),
          null,
          BindingMode.OneWay,
          // validate value delegate
          // (sender,value) => true
          null,
          // property changed, delegate
          (sender,oldValue,newValue) => ((MenuList)sender).OnMenuItemsChanged(oldValue,newValue),

          // property changing delegate
          // (sender,oldValue,newValue) => {}
          null,
          // coerce value delegate
          // (sender,value) => value
          null,
          // create default value delegate
          // () => Default(T)
          null
        );

        /// <summary>
        /// On MenuItems changed
        /// </summary>
        /// <param name="oldValue">Old Value</param>
        /// <param name="newValue">New Value</param>
        protected virtual void OnMenuItemsChanged(object oldValue, object newValue)
        {
            INotifyCollectionChanged ince = oldValue as INotifyCollectionChanged;
            if (ince != null) {
                ince.CollectionChanged -= Ince_CollectionChanged;
            }
            ince = newValue as INotifyCollectionChanged;
            if (ince != null) {
                ince.CollectionChanged += Ince_CollectionChanged;
            }

            Ince_CollectionChanged(null, null);
        }

        private void Ince_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (MenuItems != null)
            {
                UIAtomsApplication.Instance.TriggerOnce(UpdateCollection);
            }
        }

        private void UpdateCollection() {
            var cats = MenuItems.GroupBy(x => x.Category).ToList();
            if (cats.Count() == 1)
            {
                if (string.IsNullOrWhiteSpace(cats.First().Key))
                {
                    this.IsGroupingEnabled = false;
                    this.ItemsSource = MenuItems;
                    return;
                }
            }
            this.IsGroupingEnabled = true;
            this.GroupDisplayBinding = new Binding("Key");
            this.ItemsSource = cats;
        }

        /// <summary>
        /// Property MenuItems
        /// </summary>
        public IEnumerable<Services.MenuItem> MenuItems
        {
            get
            {
                return (IEnumerable<Services.MenuItem>)GetValue(MenuItemsProperty);
            }
            set
            {
                SetValue(MenuItemsProperty, value);
            }
        }
        #endregion

    }

}


text:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Philly Chix - Philadelphia Area LinuxChix Chapter</title>
<link REL="StyleSheet" href="/cstyle.css" type="text/css">

<?php include("../header.php"); ?>

Meeting #8

No Picture

Thursday Feburary 15, 2004

Attendees: Elizabeth Krumbach, Margaret Leber, Erin Mulder, Gwen Patton

Topic: General *nix discussion, Java.

<?php include("../footer.php"); ?>


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for /var/www/source/hca_draft/src/HealthCareAbroad/InstitutionBundle/Form</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

/var/www/source/hca_draft/src/HealthCareAbroad /

InstitutionBundle /

Form

(Dashboard)

Code Coverage

Lines

Functions and Methods

Classes and Traits

      Total

58.90%

129 / 219

54.17%

26 / 48

40.00%

6 / 15

       ListType

27.27%

9 / 33

44.44%

4 / 9

50.00%

1 / 2

       Transformer

43.33%

13 / 30

33.33%

2 / 6

0.00%

0 / 2

       InstitutionDetailType.php

100.00%

13 / 13

100.00%

2 / 2

100.00%

1 / 1

       InstitutionDoctorFormType.php

0.00%

0 / 14

0.00%

0 / 3

0.00%

0 / 1

       InstitutionDoctorSearchFormType.php

0.00%

0 / 9

0.00%

0 / 2

0.00%

0 / 1

       InstitutionInvitationType.php

100.00%

8 / 8

100.00%

3 / 3

100.00%

1 / 1

       InstitutionListType.php

0.00%

0 / 19

0.00%

0 / 5

0.00%

0 / 1

       InstitutionMedicalCenterType.php

100.00%

14 / 14

100.00%

4 / 4

100.00%

1 / 1

       InstitutionTreatmentFormType.php

100.00%

12 / 12

100.00%

3 / 3

100.00%

1 / 1

       InstitutionTreatmentProcedureFormType.php

85.71%

18 / 21

66.67%

2 / 3

0.00%

0 / 1

       InstitutionType.php

83.33%

10 / 12

66.67%

2 / 3

0.00%

0 / 1

       InstitutionUserChangePasswordType.php

91.30%

21 / 23

50.00%

1 / 2

0.00%

0 / 1

       InstitutionUserInvitationType.php

100.00%

11 / 11

100.00%

3 / 3

100.00%

1 / 1

Legend

     Low: 0% to 35%
     Medium: 35% to 70%
     High: 70% to 100%

     Generated by PHP_CodeCoverage 1.2.2 using PHP 5.3.10-1ubuntu3.2 and PHPUnit 3.7.1 at Tue Oct 9 16:19:45 PHT 2012.


text:
package com.wavefront.agent;

import com.google.common.util.concurrent.RateLimiter;
import com.google.common.util.concurrent.RecyclableRateLimiter;

import com.wavefront.agent.api.ForceQueueEnabledAgentAPI;
import com.wavefront.api.agent.Constants;
import com.wavefront.ingester.StringLineIngester;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.Timer;
import com.yammer.metrics.core.TimerContext;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.ws.rs.core.Response;

/**
 * @author Andrew Kao (andrew@wavefront.com)
 */
public class PostPushDataTimedTask implements Runnable {

  private static final Logger logger = Logger.getLogger(PostPushDataTimedTask.class.getCanonicalName());

  private static final int MAX_SPLIT_BATCH_SIZE = 50000; // same value as default pushFlushMaxPoints

  private List<String> points = new ArrayList<>();
  private final Object pointsMutex = new Object();
  private final List<String> blockedSamples = new ArrayList<>();

  private final String pushFormat;
  private final Object blockedSamplesMutex = new Object();

  /**
   * Warn about exceeding the rate limit no more than once per 10 seconds (per thread)
   */
  private final RateLimiter warningMessageRateLimiter = RateLimiter.create(0.1);

  /**
   * Print summary once a minute
   */
  private final RateLimiter summaryMessageRateLimiter = RateLimiter.create(0.017);

  /**
   * Write a sample of blocked points to log once a minute
   */
  private final RateLimiter blockedSamplesRateLimiter = RateLimiter.create(0.017);
  private final RecyclableRateLimiter pushRateLimiter;

  private final Counter pointsReceived;
  private final Counter pointsAttempted;
  private final Counter pointsQueued;
  private final Counter pointsBlocked;
  private final Counter permitsGranted;
  private final Counter permitsDenied;
  private final Counter permitsRetried;
  private final Counter batchesAttempted;
  private final Timer batchSendTime;

  private long numApiCalls = 0;

  private UUID daemonId;
  private String handle;
  private final int threadId;
  private long pushFlushInterval;
  private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
  private static int pointsPerBatch = MAX_SPLIT_BATCH_SIZE;
  private static int memoryBufferLimit = MAX_SPLIT_BATCH_SIZE * 32;
  private boolean isFlushingToQueue = false;

  private ForceQueueEnabledAgentAPI agentAPI;

  static void setPointsPerBatch(int newSize) {
    pointsPerBatch = Math.min(newSize, MAX_SPLIT_BATCH_SIZE);
    pointsPerBatch = Math.max(pointsPerBatch, 1);
  }

  static void setMemoryBufferLimit(int newSize) {
    memoryBufferLimit = Math.max(newSize, pointsPerBatch);
  }

  public void addPoint(String metricString) {
    pointsReceived.inc();
    synchronized (pointsMutex) {
      this.points.add(metricString);
    }
  }

  public void addPoints(List<String> metricStrings) {
    pointsReceived.inc(metricStrings.size());
    synchronized (pointsMutex) {
      this.points.addAll(metricStrings);
    }
  }

  public int getBlockedSampleSize() {
    synchronized (blockedSamplesMutex) {
      return blockedSamples.size();
    }
  }

  public void addBlockedSample(String blockedSample) {
    synchronized (blockedSamplesMutex) {
      blockedSamples.add(blockedSample);
    }
  }

  public void incrementBlockedPoints() {
    this.pointsBlocked.inc();
  }

  public long getAttemptedPoints() {
    return this.pointsAttempted.count();
  }

  public long getNumPointsQueued() {
    return this.pointsQueued.count();
  }

  public long getNumPointsToSend() {
    return this.points.size();
  }

  public boolean getFlushingToQueueFlag() {
    return isFlushingToQueue;
  }

  public long getNumApiCalls() {
    return numApiCalls;
  }

  public UUID getDaemonId() {
    return daemonId;
  }

  @Deprecated
  public PostPushDataTimedTask(String pushFormat, ForceQueueEnabledAgentAPI agentAPI, String logLevel,
                               UUID daemonId, String handle, int threadId, RecyclableRateLimiter pushRateLimiter,
                               long pushFlushInterval) {
    this(pushFormat, agentAPI, daemonId, handle, threadId, pushRateLimiter, pushFlushInterval);
  }

  public PostPushDataTimedTask(String pushFormat, ForceQueueEnabledAgentAPI agentAPI,
                               UUID daemonId, String handle, int threadId, RecyclableRateLimiter pushRateLimiter,
                               long pushFlushInterval) {
    this.pushFormat = pushFormat;
    this.daemonId = daemonId;
    this.handle = handle;
    this.threadId = threadId;
    this.pushFlushInterval = pushFlushInterval;
    this.agentAPI = agentAPI;
    this.pushRateLimiter = pushRateLimiter;

    this.pointsAttempted = Metrics.newCounter(new MetricName("points." + handle, "", "sent"));
    this.pointsQueued = Metrics.newCounter(new MetricName("points." + handle, "", "queued"));
    this.pointsBlocked = Metrics.newCounter(new MetricName("points." + handle, "", "blocked"));
    this.pointsReceived = Metrics.newCounter(new MetricName("points." + handle, "", "received"));
    this.permitsGranted = Metrics.newCounter(new MetricName("limiter", "", "permits-granted"));
    this.permitsDenied = Metrics.newCounter(new MetricName("limiter", "", "permits-denied"));
    this.permitsRetried = Metrics.newCounter(new MetricName("limiter", "", "permits-retried"));
    this.batchesAttempted = Metrics.newCounter(
        new MetricName("push." + String.valueOf(handle) + ".thread-" + String.valueOf(threadId), "", "batches"));
    this.batchSendTime = Metrics.newTimer(new MetricName("push." + handle, "", "duration"),
        TimeUnit.MILLISECONDS, TimeUnit.MINUTES);
    this.scheduler.schedule(this, pushFlushInterval, TimeUnit.MILLISECONDS);
  }

  @Override
  public void run() {
    long nextRunMillis = this.pushFlushInterval;
    try {
      List<String> current = createAgentPostBatch();
      batchesAttempted.inc();
      if (current.size() == 0) {
        return;
      }
      if (pushRateLimiter == null || pushRateLimiter.tryAcquire(current.size())) {
        if (pushRateLimiter != null) this.permitsGranted.inc(current.size());

        TimerContext timerContext = this.batchSendTime.time();
        Response response = null;
        try {
          response = agentAPI.postPushData(
              daemonId,
              Constants.GRAPHITE_BLOCK_WORK_UNIT,
              System.currentTimeMillis(),
              pushFormat,
              StringLineIngester.joinPushData(current));
          int pointsInList = current.size();
          this.pointsAttempted.inc(pointsInList);
          if (response.getStatus() == Response.Status.NOT_ACCEPTABLE.getStatusCode()) {
            if (pushRateLimiter != null) {
              this.pushRateLimiter.recyclePermits(pointsInList);
              this.permitsRetried.inc(pointsInList);
            }
            this.pointsQueued.inc(pointsInList);
          }
        } finally {
          numApiCalls++;
          timerContext.stop();
          if (response != null) response.close();
        }

        if (points.size() > memoryBufferLimit) {
          // there are going to be too many points to be able to flush w/o the agent blowing up
          // drain the leftovers straight to the retry queue (i.e. to disk)
          // don't let anyone add any more to points while we're draining it.
          logger.warning("[FLUSH THREAD " + threadId + "]: WF-3 Too many pending points (" + points.size() +
              "), block size: " + pointsPerBatch + ". flushing to retry queue");
          drainBuffersToQueue();
          logger.info("[FLUSH THREAD " + threadId + "]: flushing to retry queue complete. " +
              "Pending points: " + points.size());
        }
      } else {
        this.permitsDenied.inc(current.size());
        // if proxy rate limit exceeded, try again in 250..500ms (to introduce some degree of fairness)
        nextRunMillis = 250 + (int) (Math.random() * 250);
        if (warningMessageRateLimiter.tryAcquire()) {
          logger.warning("[FLUSH THREAD " + threadId + "]: WF-4 Proxy rate limit exceeded " +
              "(pending points: " + points.size() + "), will retry");
        }
        synchronized (pointsMutex) { // return the batch to the beginning of the queue
          points.addAll(0, current);
        }
      }
    } catch (Throwable t) {
      logger.log(Level.SEVERE, "Unexpected error in flush loop", t);
    } finally {
      scheduler.schedule(this, nextRunMillis, TimeUnit.MILLISECONDS);
    }
  }

  /**
   * Shut down the scheduler for this task (prevent future scheduled runs)
   */
  public void shutdown() {
    scheduler.shutdown();
  }

  public void drainBuffersToQueue() {
    try {
      isFlushingToQueue = true;
      // roughly limit number of points to flush to the the current buffer size (+1 blockSize max)
      // if too many points arrive at the proxy while it's draining, they will be taken care of in the next run
      int pointsToFlush = points.size();
      while (pointsToFlush > 0) {
        List<String> pushData = createAgentPostBatch();
        int pushDataPointCount = pushData.size();
        if (pushDataPointCount > 0) {
          agentAPI.postPushData(daemonId, Constants.GRAPHITE_BLOCK_WORK_UNIT,
              System.currentTimeMillis(), Constants.PUSH_FORMAT_GRAPHITE_V2,
              StringLineIngester.joinPushData(pushData), true);

          // update the counters as if this was a failed call to the API
          this.pointsAttempted.inc(pushDataPointCount);
          this.pointsQueued.inc(pushDataPointCount);
          if (pushRateLimiter != null) {
            this.permitsDenied.inc(pushDataPointCount);
          }
          numApiCalls++;
          pointsToFlush -= pushDataPointCount;
        } else {
          break;
        }
      }
    } finally {
      isFlushingToQueue = false;
    }
  }

  private void logBlockedPoints() {
    if (blockedSamplesRateLimiter.tryAcquire()) {
      List<String> currentBlockedSamples = new ArrayList<>();
      if (!blockedSamples.isEmpty()) {
        synchronized (blockedSamplesMutex) {
          // Copy this to a temp structure that we can iterate over for printing below
          currentBlockedSamples.addAll(blockedSamples);
          blockedSamples.clear();
        }
      }
      for (String blockedLine : currentBlockedSamples) {
        logger.info("[" + handle + "] blocked input: [" + blockedLine + "]");
      }
    }
  }

  private List<String> createAgentPostBatch() {
    List<String> current;
    int blockSize;
    synchronized (pointsMutex) {
      blockSize = Math.min(points.size(), pointsPerBatch);
      current = points.subList(0, blockSize);
      points = new ArrayList<>(points.subList(blockSize, points.size()));
    }
    if (summaryMessageRateLimiter.tryAcquire()) {
      logger.info("[" + handle + "] (SUMMARY): points attempted: " + getAttemptedPoints() +
          "; blocked: " + this.pointsBlocked.count());
    }
    logBlockedPoints();
    logger.fine("[" + handle + "] (DETAILED): sending " + current.size() + " valid points" +
        "; points in memory: " + points.size() +
        "; total attempted points: " + getAttemptedPoints() +
        "; total blocked: " + this.pointsBlocked.count() +
        "; total queued: " + getNumPointsQueued());
    return current;
  }
}