text:
layout: post
title:  Runtime Components
categories: PRODUCT_OVERVIEW
weight: 300
parent: terminology.html
---

{% summary %}GigaSpaces runtime components {% endsummary %}

# GigaSpaces Runtime and Administration Components

# Processing Unit Container

{% comment %}
=====================================

        Runtime and Administration Components

======================================
{% endcomment %}

{% comment %}
-------------------------------------------------
          Processing Unit Container
-------------------------------------------------
{% endcomment %}

{% anchor Processing Unit Container %}

{% section %}
{% column width=70% %}

A container that hosts a [Processing Unit](./terminology---basic-components.html#Processing Unit).

{% sub %}Key sentence: The Processing Unit can run only inside a hosting Processing Unit Container.{% endsub %}
{% endcolumn %}
{% column width=25% %}
{% align center %}
![term_puc.gif](/attachment_files/term_puc.gif)

{% sub %}**A Processing Unit Container**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

# Types of Processing Unit Containers

{% comment %}
----------------------------
          IPUC
----------------------------
{% endcomment %}

{% section %}
{% column width=50% %}

#### Integrated Processing Unit Container

A container that runs the Processing Unit inside an IDE (e.g. IntelliJ IDEA, Eclipse).

{% sub %}Key sentence: The integrated processing unit container enables to run the Processing Unit inside your IDE for testing and debugging purposes.{% endsub %}

{% endcolumn %}
{% column width=30% %}
{% align center %}

![term_ipuc.gif](/attachment_files/term_ipuc.gif)

{% sub %}**An Integrated Processing Unit Container running a Processing Unit**{% endsub %}
{% sub %}**inside an IDE**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

{% comment %}
----------------------------
          GSC
----------------------------
{% endcomment %}

{% anchor SGPUC %}

{% section %}
{% column width=50% %}

#### Service Grid Processing Unit Container (AKA SLA Driven Container)

A Processing Unit Container which runs within a [Grid Service Container](#GSC).
It enables running the processing unit within a [service grid](#Service Grid), which provides self-healing and SLA capabilities to components deployed on it.
{% endcolumn %}
{% column width=30% %}
{% align center %}

![term_gscnet.gif](/attachment_files/term_gscnet.gif)

{% sub %}**A Service Grid Processing Unit Container running a Processing Unit**{% endsub %}
{% sub %}**inside an IDE**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

{% whr %}

{% comment %}
-------------------------------------------------
          Service Grid
-------------------------------------------------
{% endcomment %}

{% anchor Service Grid %}

{% section %}
{% column width=50% %}

# Service Grid

A set of [GigaSpaces Containers (GSC)](#gsc) managed by a [GigaSpaces Manager](#gsm).
The containers host various deployments of [Processing Units](./terminology---basic-components.html#Processing Unit) and [Data Grids](./terminology---data-grid-topologies.html).
Each container can be run on a separate physical machine.

{% sub %}Key sentence: A set of managed containers hosting Processing Unit Deployments{% endsub %}
{% endcolumn %}
{% column width=30% %}

{% align center %}
![term_empty_service_grid.gif](/attachment_files/term_empty_service_grid.gif)

{% sub %}**A Service Grid composed of a Grid Service Manager which manages 3 Grid Service Containers**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

{% comment %}
----------------------------
          GSC
----------------------------
{% endcomment %}

{% anchor GSC %}

{% section %}
{% column width=50% %}

#### GigaSpaces Container (GSC)

A [Service Grid](#Service Grid) component which hosts [Processing Unit](./terminology---basic-components.html#Processing Unit) instances.
A machine can run one or more [GSC](#gsc) processes. Each GSC communicates with a manager component [GSM](#gsm). The GSC receives requests to start/stop a processing unit instance, and sends information about the machine which runs it (OS, processor architecture, current memory and CPU stats), the software installed on it and the status of processing unit instances currently running on it.

{% sub %}Key sentence: A set of managed containers hosting different Processing Unit Instances{% endsub %}
{% endcolumn %}
{% column width=30% %}
{% align center %}
![term_gsc.jpg](/attachment_files/term_gsc.jpg)

{% sub %}**GigaSpaces Container**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

{% comment %}
-------------------------------------------------
          Grid Service Manager
-------------------------------------------------
{% endcomment %}

{% anchor GSM %}

{% section %}
{% column width=50% %}

#### GigaSpaces Manager (GSM)

The [GSM](#gsm) is a [Service Grid](#Service Grid) component which manages a set of [GigaSpaces Containers (GSC)](#gsc).
A GSM has an API for deploying/undeploying processing units. When a GSM is instructed to deploy a Processing Unit, it finds an appropriate, available GSC and tells that GSC to run an instance of that processing unit. It then continuously monitors that processing unit instance to verify that it's alive, and that the SLA is not breached.

{% sub %}Key sentence: A GSM manages all the running containers in the network and deploys processing units to them.{% endsub %}
{% endcolumn %}
{% column width=30% %}
{% align center %}
![term_gsm.gif](/attachment_files/term_gsm.gif)

{% sub %}**Grid Service Manager**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}

{% comment %}
-------------------------------------------------
          Management UI
-------------------------------------------------
{% endcomment %}

{% anchor Management UI %}

{% section %}
{% column width=50% %}

#### Management UI

The GigaSpaces Management Center, also known as the GigaSpaces UI or GS-UI.
A monitoring, management and deployment console.

Enables the user to view and interact with the runtime components running in the network.

{% endcolumn %}
{% column width=30% %}
{% align center %}
![term_management_ui.gif](/attachment_files/term_management_ui.gif)

{% sub %}**Management UI Console**{% endsub %}
{% endalign %}

{% endcolumn %}
{% endsection %}


text:
wifi
====
core.py - Wifi Data Acquisition & Transmission Core

tcp.py - Effieciently handle connection to TCP server. This module is only
called after the route to the host is clear and data is ready to be sent.

wifi_transmitter.py - Standard data acquisition loop

config.py - Provides access to system-wide configuration directives. Please note that a
change to the values listed here will be applied after the software reset.

redpajama_set_name: RedPajamaGithub


text:
package cloud_watch

import . "github.com/jagregory/cfval/schema"

var comparisonOperator = EnumValue{
	Description: "Alarm Comparison Operator",

	Options: []string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanThreshold", "LessThanOrEqualToThreshold"},
}


text:
require File.expand_path("helper", File.dirname(__FILE__))
require "lint/value_types"

class TestCommandsOnValueTypes < Test::Unit::TestCase

  include Helper::Client
  include Lint::ValueTypes

  def test_del
    r.set "foo", "s1"
    r.set "bar", "s2"
    r.set "baz", "s3"

    assert_equal ["bar", "baz", "foo"], r.keys("*").sort

    assert_equal 1, r.del("foo")

    assert_equal ["bar", "baz"], r.keys("*").sort

    assert_equal 2, r.del("bar", "baz")

    assert_equal [], r.keys("*").sort
  end

  def test_del_with_array_argument
    r.set "foo", "s1"
    r.set "bar", "s2"
    r.set "baz", "s3"

    assert_equal ["bar", "baz", "foo"], r.keys("*").sort

    assert_equal 1, r.del(["foo"])

    assert_equal ["bar", "baz"], r.keys("*").sort

    assert_equal 2, r.del(["bar", "baz"])

    assert_equal [], r.keys("*").sort
  end

  def test_randomkey
    assert r.randomkey.to_s.empty?

    r.set("foo", "s1")

    assert_equal "foo", r.randomkey

    r.set("bar", "s2")

    4.times do
      assert ["foo", "bar"].include?(r.randomkey)
    end
  end

  def test_rename
    r.set("foo", "s1")
    r.rename "foo", "bar"

    assert_equal "s1", r.get("bar")
    assert_equal nil, r.get("foo")
  end

  def test_renamenx
    r.set("foo", "s1")
    r.set("bar", "s2")

    assert_equal false, r.renamenx("foo", "bar")

    assert_equal "s1", r.get("foo")
    assert_equal "s2", r.get("bar")
  end

  def test_dbsize
    assert_equal 0, r.dbsize

    r.set("foo", "s1")

    assert_equal 1, r.dbsize
  end

  def test_flushdb
    r.set("foo", "s1")
    r.set("bar", "s2")

    assert_equal 2, r.dbsize

    r.flushdb

    assert_equal 0, r.dbsize
  end

  def test_flushall
    redis_mock(:flushall => lambda { "+FLUSHALL" }) do |redis|
      assert_equal "FLUSHALL", redis.flushall
    end
  end

  def test_migrate
    redis_mock(:migrate => lambda { |*args| args }) do |redis|
      options = { :host => "localhost", :port => 1234 }

      assert_raise(RuntimeError, /host not specified/) do
        redis.migrate("foo", options.reject { |key, _| key == :host })
      end

      assert_raise(RuntimeError, /port not specified/) do
        redis.migrate("foo", options.reject { |key, _| key == :port })
      end

      default_db = redis.client.db.to_i
      default_timeout = redis.client.timeout.to_i

      # Test defaults
      actual = redis.migrate("foo", options)
      expected = ["localhost", "1234", "foo", default_db.to_s, default_timeout.to_s]
      assert_equal expected, actual

      # Test db override
      actual = redis.migrate("foo", options.merge(:db => default_db + 1))
      expected = ["localhost", "1234", "foo", (default_db + 1).to_s, default_timeout.to_s]
      assert_equal expected, actual

      # Test timeout override
      actual = redis.migrate("foo", options.merge(:timeout => default_timeout + 1))
      expected = ["localhost", "1234", "foo", default_db.to_s, (default_timeout + 1).to_s]
      assert_equal expected, actual
    end
  end
end


text:
package azgo

import (
	"encoding/xml"
	"reflect"

	log "github.com/sirupsen/logrus"
)

// NodeVersionDetailInfoType is a structure to represent a node-version-detail-info ZAPI object
type NodeVersionDetailInfoType struct {
	XMLName           xml.Name `xml:"node-version-detail-info"`
	BuildTimestampPtr *int     `xml:"build-timestamp"`
	NodeNamePtr       *string  `xml:"node-name"`
	NodeUuidPtr       *string  `xml:"node-uuid"`
	VersionPtr        *string  `xml:"version"`
}

// NewNodeVersionDetailInfoType is a factory method for creating new instances of NodeVersionDetailInfoType objects
func NewNodeVersionDetailInfoType() *NodeVersionDetailInfoType {
	return &NodeVersionDetailInfoType{}
}

// ToXML converts this object into an xml string representation
func (o *NodeVersionDetailInfoType) ToXML() (string, error) {
	output, err := xml.MarshalIndent(o, " ", "    ")
	if err != nil {
		log.Errorf("error: %v", err)
	}
	return string(output), err
}

// String returns a string representation of this object's fields and implements the Stringer interface
func (o NodeVersionDetailInfoType) String() string {
	return ToString(reflect.ValueOf(o))
}

// BuildTimestamp is a 'getter' method
func (o *NodeVersionDetailInfoType) BuildTimestamp() int {
	r := *o.BuildTimestampPtr
	return r
}

// SetBuildTimestamp is a fluent style 'setter' method that can be chained
func (o *NodeVersionDetailInfoType) SetBuildTimestamp(newValue int) *NodeVersionDetailInfoType {
	o.BuildTimestampPtr = &newValue
	return o
}

// NodeName is a 'getter' method
func (o *NodeVersionDetailInfoType) NodeName() string {
	r := *o.NodeNamePtr
	return r
}

// SetNodeName is a fluent style 'setter' method that can be chained
func (o *NodeVersionDetailInfoType) SetNodeName(newValue string) *NodeVersionDetailInfoType {
	o.NodeNamePtr = &newValue
	return o
}

// NodeUuid is a 'getter' method
func (o *NodeVersionDetailInfoType) NodeUuid() string {
	r := *o.NodeUuidPtr
	return r
}

// SetNodeUuid is a fluent style 'setter' method that can be chained
func (o *NodeVersionDetailInfoType) SetNodeUuid(newValue string) *NodeVersionDetailInfoType {
	o.NodeUuidPtr = &newValue
	return o
}

// Version is a 'getter' method
func (o *NodeVersionDetailInfoType) Version() string {
	r := *o.VersionPtr
	return r
}

// SetVersion is a fluent style 'setter' method that can be chained
func (o *NodeVersionDetailInfoType) SetVersion(newValue string) *NodeVersionDetailInfoType {
	o.VersionPtr = &newValue
	return o
}


text:
namespace Google.Cloud.Container.V1.Snippets
{
    // [START container_v1_generated_ClusterManager_SetMasterAuth_async]
    using Google.Cloud.Container.V1;
    using System.Threading.Tasks;

    public sealed partial class GeneratedClusterManagerClientSnippets
    {
        /// <summary>Snippet for SetMasterAuthAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task SetMasterAuthRequestObjectAsync()
        {
            // Create client
            ClusterManagerClient clusterManagerClient = await ClusterManagerClient.CreateAsync();
            // Initialize request argument(s)
            SetMasterAuthRequest request = new SetMasterAuthRequest
            {
                Action = SetMasterAuthRequest.Types.Action.Unknown,
                Update = new MasterAuth(),
                Name = "",
            };
            // Make the request
            Operation response = await clusterManagerClient.SetMasterAuthAsync(request);
        }
    }
    // [END container_v1_generated_ClusterManager_SetMasterAuth_async]
}


text:
module.exports = {
    env: {
        'embertest': true,
        'mocha': true
    },
    globals: {
        server: false,
        expect: false,
        fileUpload: false,

        // ember-power-select test helpers
        selectChoose: false,
        selectSearch: false,
        removeMultipleOption: false,
        clearSelected: false
    }
};


text:
var expect = require('chai').expect;
var request = require('request');

var config = require('../../lib/configuration');
var calls = require('../testFiles/calls');

var serverUrl = 'http://localhost:' + config.port;

describe('updateLocation', function() {

    it('should answer with ACK to simple update location request', function(done) {
        var updateData = calls.locationUpdateCall();

        var options = {
            url: serverUrl + '/v1/UpdateLocation',
            method: 'POST',
            json: updateData
        };

        request(options, function (error, response, body) {
            expect(error).to.be.null;

            expect(response.statusCode).to.equal(200);
            expect(body.MiataruResponse).to.equal('ACK');
            expect(body.MiataruVerboseResponse).to.match(/><\)\)\).>/);

            done();
        });
    });

    it('should answer with error on empty locationUpdate request', function(done) {
        var options = {
            url: serverUrl + '/v1/UpdateLocation',
            method: 'POST',
            json: {}
        };

        request(options, function (error, response, body) {
            expect(error).to.be.null;
            expect(response.statusCode).to.equal(400);

            done();
        });
    });

    it('should answer with error on crippled locationUpdate request', function(done) {
        var options = {
            url: serverUrl + '/v1/UpdateLocation',
            method: 'POST',
            json: {
                MiataruLocation: 'foo'
            }
        };

        request(options, function (error, response, body) {
            expect(error).to.be.null;
            expect(response.statusCode).to.equal(400);

            done();
        });
    });

    it('should answer with a method not supported error (405)', function(done) {
        var options = {
            followRedirect: false,
            url: serverUrl + '/v1/UpdateLocation',
            method: 'GET'
        };

        request.get(options,function (error, response, body) {
            expect(error).to.be.null;
            expect(response.statusCode).to.equal(405);
            done();
        });
    });

    it('should answer with a not found error (404)', function(done) {
        var options = {
            followRedirect: false,
            url: serverUrl + '/foobar',
            method: 'GET'
        };

        request(options,function (error, response, body) {
            expect(error).to.be.null;
            expect(response.statusCode).to.equal(404);
            done();
        });
    });

});


text:
require 'zenodo/oauth2/client'
require 'zenodo-client'

class SnapshotsController < ApplicationController
  before_filter :find_resource
  before_filter :auth_resource, only: [:mint_doi_confirm, :mint_doi, :new, :create, :export_preview, :export_submit, :destroy]
  before_filter :check_resource_permitted_for_ro, only: [:new, :create]
  before_filter :find_snapshot, only: [:show, :mint_doi_confirm, :mint_doi, :download, :export_preview, :export_submit, :destroy]
  before_filter :doi_minting_enabled?, only: [:mint_doi_confirm, :mint_doi]
  before_filter :zenodo_oauth_client
  before_filter :zenodo_oauth_session, only: [:export_submit]

  include Seek::BreadCrumbs
  include Zenodo::Oauth2::SessionHelper
  include Seek::ExternalServiceWrapper

  def create
    @snapshot = @resource.create_snapshot
    flash[:notice] = "Snapshot created"
    redirect_to polymorphic_path([@resource, @snapshot])
  end

  def show
  end

  def new
  end

  def download
    @content_blob = @snapshot.content_blob
    send_file @content_blob.filepath,
              :filename => @content_blob.original_filename,
              :type => @content_blob.content_type || "application/octet-stream"
  end

  def mint_doi_confirm
  end

  def mint_doi
    wrap_service('DataCite', polymorphic_path([@resource, @snapshot])) do
      if @snapshot.mint_doi
        flash[:notice] = "DOI successfully minted"
        redirect_to polymorphic_path([@resource, @snapshot])
      else
        flash[:error] = @snapshot.errors.full_messages
        redirect_to polymorphic_path([@resource, @snapshot])
      end
    end
  end

  def export_preview
  end

  def export_submit # Export AND publish
    access_token = @oauth_session.access_token

    metadata = params[:metadata].delete_if { |k,v| v.blank? }

    wrap_service('Zenodo', polymorphic_path([@resource, @snapshot]), rescue_all: true) do
      if @snapshot.export_to_zenodo(access_token, metadata) && @snapshot.publish_in_zenodo(access_token)
        flash[:notice] = "Snapshot successfully exported to Zenodo"
        redirect_to polymorphic_path([@resource, @snapshot])
      else
        flash[:error] = @snapshot.errors.full_messages
        redirect_to polymorphic_path([@resource, @snapshot])
      end
    end
  end

  def destroy
    if @snapshot.has_doi?
      flash[:error] = "You cannot delete a snapshot that has a DOI."
      redirect_to polymorphic_path([@resource, @snapshot])
    else
      @snapshot.destroy
      flash[:notice] = "Snapshot successfully deleted"
      redirect_to polymorphic_path(@resource)
    end
  end

  private

  def find_resource # This is hacky :(
    resource, id = request.path.split('/')[1, 2]
    @resource = resource.singularize.classify.constantize.find(id)
  end

  def auth_resource
    unless is_auth?(@resource, :manage)
      flash[:error] = "You are not authorized to manage snapshots of this resource."
      redirect_to polymorphic_path(@resource)
    end
  end

  def check_resource_permitted_for_ro
    unless @resource.permitted_for_research_object?
      flash[:error] = "You may only create snapshots of publicly accessible resources."
      redirect_to polymorphic_path(@resource)
    end
  end

  def find_snapshot
    @snapshot = @resource.snapshots.where(snapshot_number: params[:id]).first
    if @snapshot.nil?
      flash[:error] = "Snapshot #{params[:id]} doesn't exist."
      redirect_to polymorphic_path(@resource)
    end
  end

  def doi_minting_enabled?
    unless Seek::Config.doi_minting_enabled
      flash[:error] = "DOI minting is not enabled."
      redirect_to polymorphic_path([@resource, @snapshot])
    end
  end

end


text:
#ifndef _IMAGE_H
#define _IMAGE_H

#include "condor_common.h"
#include "machdep.h"

#define NAME_LEN 64
typedef unsigned long RAW_ADDR;
typedef int BOOL;

const int MAGIC = 0xfeafea;
const int COMPRESS_MAGIC = 0xfeafeb;
const int SEG_INCR = 25;
const int  MAX_SEGS = 200;
const int ALT_HEAP_SIZE = 20*1024*1024;	// 20MB
const int RESERVED_HEAP = 1024*1024*1024; // 1GB

class Header {
public:
	void Init();
	void IncrSegs() { n_segs += 1; }
	int	N_Segs() { return n_segs; }
	RAW_ADDR AltHeap() { return alt_heap; }
	void AltHeap(RAW_ADDR loc) { alt_heap = loc; }
	void Display();
	int Magic() { return magic; }
	void ResetMagic();
private:
	int		magic;
	int		n_segs;
	RAW_ADDR	alt_heap;
	char	pad[ 1024 - 2 * sizeof(int) - NAME_LEN - sizeof(RAW_ADDR)];
};

class SegMap {
public:
	void Init( const char *name, RAW_ADDR core_loc, long len, int prot );
	ssize_t Read( int fd, ssize_t pos );
	ssize_t Write( int fd, ssize_t pos );
	ssize_t SetPos( ssize_t my_pos );
	BOOL Contains( void *addr );
	char *GetName() { return name; }
	RAW_ADDR GetLoc() { return core_loc; }
	long GetLen() { return len; }
	void MSync();
	void Display();
private:
	char		name[14];
	off_t		file_loc;
	RAW_ADDR	core_loc;
	long		len;
	int			prot;		// segment protection mode
};

typedef enum { STANDALONE, REMOTE } ExecutionMode;

class Image {
public:
	void Save();
	int	Write();
	int Write( int fd );
	int Write( const char *name );
	int Read();
	int Read( int fd );
	int Read( const char *name );
	void Close();
	void Restore();
	char *FindSeg( void *addr );
	void Display();
	void RestoreSeg( const char *seg_name );
	void RestoreAllSegsExceptStack();
	void SetFd( int fd );
	void SetRelocatable( int truth );
	void SetIwd( const char *iwd );
	char *GetIwd( void );
	void SetFileName( const char *ckpt_name );
	void SetMode( int syscall_mode );
	void MSync();
#if defined(COMPRESS_CKPT)
	void *FindAltHeap();
#endif
	ExecutionMode	GetMode() { return mode; }
	size_t			GetLen()  { return len; }
	int				GetFd()   { return fd; }
protected:
	RAW_ADDR	GetStackLimit();
	void AddSegment( const char *name, RAW_ADDR start, RAW_ADDR end,
			int prot );
	void SwitchStack( char *base, size_t len );
	char	*file_name;
	Header	head;
	SegMap	map[ MAX_SEGS ];
	ExecutionMode	mode;	// executing in standalone/remote mode
	BOOL	valid;		// initialized and ready to write ckpt file or restore
	int		fd;		// descriptor pointing to ckpt file
	char m_iwd[_POSIX_PATH_MAX]; // the initial working directory of the program
	int m_relocatable;	// should I use the previous or current working dir?
	ssize_t	pos;	// position in ckpt file of seg currently reading/writing
	size_t	len;	// size of our ckpt file
};

/* We would like to access the global image from elsewhere. */
extern Image MyImage;

void RestoreStack();

extern "C" void Checkpoint( int, int, void * );

extern "C" {
	void ckpt();
	void restart();
	void init_image_with_file_name( const char *ckpt_name );
	void init_image_with_file_descriptor( int ckpt_fd );
	void init_image_with_iwd( char *iwd );
	void init_image_relocatable( int truth );
	void _condor_prestart( int syscall_mode );
	void Suicide();
}

#define DUMP( leader, name, fmt ) \
	printf( "%s%s = " #fmt "\n", leader, #name, name )

#include "condor_fix_setjmp.h"

long data_start_addr();
long data_end_addr();
long stack_start_addr();
long stack_end_addr();
BOOL StackGrowsDown();
int JmpBufSP_Index();
void ExecuteOnTmpStk( void (*func)() );
void patch_registers( void  *);
#if defined(Solaris)
     int find_map_for_addr(caddr_t addr);
     int num_segments( );
     int segment_bounds( int seg_num, RAW_ADDR &start, RAW_ADDR &end,
	int &prot );
     void display_prmap();
	 extern "C" int open_ckpt_file( const char *name,
								   int flags, size_t n_bytes );
#endif
#if defined(LINUX)
extern "C" {
     int find_map_for_addr(long addr);
     int num_segments( );
     int segment_bounds( int seg_num, RAW_ADDR &start, RAW_ADDR &end,
	int &prot );
     void display_prmap();
     unsigned long find_correct_vm_addr(unsigned long, unsigned long, int);
};
#endif

#define JMP_BUF_SP(env) (((long*)(env))[JmpBufSP_Index()])

#endif


text:
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Trello clone</title>
  <base href="/">

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapse" aria-expanded="false">
          Toggle navigation

        </button>
        Trello clone

Dashboard (current)


text:
#include "stdafx.h"
#include "SimulatorService.h"

/*static*/ const CString CSimulatorWf::FileMonikerDN4TokenResponse(LPCTSTR szClientId)
{
	CString strMonikerName;
	strMonikerName.Format(TOKEN_RESPONSE_USER_ENV_FMT, szClientId);

	static CString strResult;
	// das PathUnExpandEnvStrings() ist die RICHTIGE funktion NUR sie funktioniert NICHT???
	// if (FALSE == ::PathUnExpandEnvStringsW(L"%appdata%\\client_secret_<ClientId>.TokenResponse-user", szExpand, _countof(szExpand))) // %APPDATA%, %USERPROFILE%, %cticlientappdata%
	if (0 == ::ExpandEnvironmentStrings((LPCTSTR)strMonikerName, strResult.GetBufferSetLength(MAX_PATH), MAX_PATH))
	{
		const DWORD dwLastError = ::GetLastError();
		HRESULT hr = HRESULT_FROM_WIN32(dwLastError);
		_ASSERT(FALSE); // das kann nach menschlichem ermessen NICHT fehlschlagen
	}

	strResult.ReleaseBuffer();
	return strResult;
}

/*static*/ HRESULT CSimulatorWf::GetTokenServerByDisplayName(LPCTSTR szDisplayName, oAuthLib::IAuthorize** ppAuthorize)
{
	BIND_OPTS2 bo;
	bo.cbStruct = sizeof(BIND_OPTS2);
	bo.grfFlags = 0;
	bo.grfMode = STGM_READ | STGM_CONVERT;
	bo.dwTickCountDeadline = 0;
	bo.dwTrackFlags = 0;
	// (default) wir binden die DLL klasse als DLLSurrogat, CLSCTX_LOCAL_SERVER eintragen
	// zum debuggen der klasse hier CLSCTX_ALL oder gleich CLSCTX_INPROC_SERVER eintragen
	//   jetzt kann man einfach beliebige breakpoints in der oAuthapplication setzen.
	//   Hinweis: Application terminiert nicht mehr!!! (es loest ja keiner mehr den lock)
	bo.dwClassContext = CLSCTX_LOCAL_SERVER;
	bo.locale = LOCALE_USER_DEFAULT;
	bo.pServerInfo = NULL;
	return ::CoGetObject(szDisplayName, &bo, IID_PPV_ARGS(ppAuthorize));
}

IMPLEMENT_DYNCREATE(CSimulatorPing, CoAuthServiceCall)

HRESULT CSimulatorPing::Init(LPCTSTR szClientId)
{
	return __super::Init(_T("GET"), _T("http://simulatorauthserver.appspot-1310.com/ping"));
}

/*virtual*/ HRESULT CSimulatorPing::GetTokenServer(oAuthLib::IAuthorize** ppAuthorize)
{
	const CString strMonikerName = CSimulatorWf::FileMonikerDN4TokenResponse(_T("SimulatorClientId"));
	return CSimulatorWf::GetTokenServerByDisplayName(strMonikerName, ppAuthorize);
}

#ifdef AUTHORIZATION_SERVER_SUPPORT_JSON
/*virtual*/ void CSimulatorPing::onSucceeded(web::json::value& result)
{
	TRACE1("  result: %s\n", result[_T("result")].as_string().c_str());
}
#else
/*virtual*/ void CSimulatorPing::onSucceeded()
{
	MSXML2::IXMLDOMDocument2Ptr spXML(m_spRequest->responseXML);
	TRACE1("  result: %ls\n", (BSTR)spXML->documentElement->xml);
}
#endif


text:
<?php declare(strict_types=1);

namespace GraphQL\Tests\Regression;

use GraphQL\GraphQL;
use GraphQL\Utils\BuildSchema;
use PHPUnit\Framework\TestCase;

/**
 * @see https://github.com/webonyx/graphql-php/issues/467
 */
class Issue467Test extends TestCase
{
    public function testInputObjectValidation(): void
    {
        $schemaStr = '
input MsgInput {
  msg: String
}

type Query {
  echo(msg: MsgInput): String
}

schema {
    query: Query
}
';

        $query = '
query echo ($msg: MsgInput) {
          echo (msg: $msg)
}';
        $variables = ['msg' => ['my message']];

        $schema = BuildSchema::build($schemaStr);
        $result = GraphQL::executeQuery($schema, $query, null, null, $variables);

        $expectedError = 'Variable "$msg" got invalid value ["my message"]; Field "0" is not defined by type "MsgInput".';
        self::assertCount(1, $result->errors);
        self::assertEquals($expectedError, $result->errors[0]->getMessage());
    }
}


text:
Codesnips

        Deleted User

    No Codesnips yet, why don't you create one?


text:
#include <stdlib.h>
#include <string.h>

#include "qemu_common.h"

#include "bson.h"
#include "color.h"

int qemu_load_md_filter(int index, struct bitarray** bits)
{
    struct bson_kv value1, value2;
    struct bson_info* bson = bson_init();

    while (bson_readf(bson, index) == 1)
    {
        if (bson_deserialize(bson, &value1, &value2) != 1)
            break;

        if (strcmp(value1.key, "type") != 0)
        {
            fprintf_light_red(stderr, "Document missing 'type' field.\n");
            break;
        }

        if (strcmp(value1.data, "metadata_filter") == 0)
        {
            fprintf_light_yellow(stdout, "-- Deserializing a bitarray record "
                                         "--\n");
            if (bson_deserialize(bson, &value1, &value2) != 1)
                return EXIT_FAILURE;

            if (strcmp(value1.key, "bitarray") == 0)
            {
                *bits = bitarray_init_data((uint8_t*) value1.data,
                                           value1.size);
                return EXIT_SUCCESS;
            }
            else
            {
                fprintf_light_red(stderr, "Unexpected field in MD record.\n");
                break;
            }
        }
    }

    return EXIT_FAILURE;
}

void qemu_parse_header(uint8_t* event_stream, struct qemu_bdrv_write* write)
{
    write->header = *((struct qemu_bdrv_write_header*) event_stream);
}


text:
[![Android Gems](http://www.android-gems.com/badge/liaohuqiu/android-ActionQueue.svg?branch=master)](http://www.android-gems.com/lib/liaohuqiu/android-ActionQueue)

ActionQueue allows you run action one by one.

#### Import

Repositories:

```groovy
allprojects {
    repositories {
        mavenCentral()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
        jcenter()
    }
}
```

Add to dependencies:

```groovy
compile 'in.srain.cube:action-queue:1.0.1'
```

#### Usage

* create actions

    ```java
    String[] messageList = new String[]{
            "message 1",
            "message 2",
            "message 3",
    };
    for (int i = 0; i < messageList.length; i++) {
        String message = messageList[i];
        PopDialogAction action = new PopDialogAction(message);
        mActionQueue.add(action);
    }
    ```

* process action

    ```java
    class PopDialogAction extends ActionQueue.Action<String> {

        public PopDialogAction(String badge) {
            super(badge);
        }

        @Override
        public void onAction() {
            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
            Dialog dialog = builder.setMessage(getBadge()).show();
            // notify action is done, and next aciton will be executed
            dialog.setOnDismissListener(mOnDismissListener);
        }
    }
    ```

* notify when action is done

    ```java
    DialogInterface.OnDismissListener mOnDismissListener = new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mActionQueue.notifyActionDoneThenTryToPopNext();
        }
    };
    ```

* LICENSE: MIT


text:
import * as React from 'react';
import ButtonBase from '../ButtonBase/ButtonBase';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';

export interface TabsTypeMap<P = {}, D extends React.ElementType = typeof ButtonBase> {
  props: P & {
    action?: React.Ref<TabsActions>;
    centered?: boolean;
    children?: React.ReactNode;
    indicatorColor?: 'secondary' | 'primary' | string;
    onChange?: (event: React.ChangeEvent<{}>, value: any) => void;
    orientation?: 'horizontal' | 'vertical';
    ScrollButtonComponent?: React.ElementType;
    scrollButtons?: 'auto' | 'desktop' | 'on' | 'off';
    TabIndicatorProps?: Partial<React.HTMLAttributes<HTMLDivElement>>;
    textColor?: 'secondary' | 'primary' | 'inherit' | string;
    value: any;
    variant?: 'standard' | 'scrollable' | 'fullWidth';
    width?: string;
  };
  defaultComponent: D;
  classKey: TabsClassKey;
}

declare const Tabs: OverridableComponent<TabsTypeMap>;

export type TabsClassKey =
  | 'root'
  | 'flexContainer'
  | 'scroller'
  | 'fixed'
  | 'scrollable'
  | 'centered'
  | 'scrollButtons'
  | 'scrollButtonsDesktop'
  | 'indicator';

export interface TabsActions {
  updateIndicator(): void;
  updateScrollButtons(): void;
}

export type TabsProps<
  D extends React.ElementType = TabsTypeMap['defaultComponent'],
  P = {}
> = OverrideProps<TabsTypeMap<P, D>, D>;

export default Tabs;


text:
import assert from "assert";
import {Apis, ChainConfig} from "gxbjs-ws";
import { FetchChain, ChainStore } from "../../lib";

var coreAsset;

describe("ChainStore", () => {
    // Connect once for all tests
    before(function() {
        /* use wss://bitshares.openledger.info/ws if no local node is available */
        return Apis.instance("ws://127.0.0.1:8090", true).init_promise.then(function (result) {
            coreAsset = result[0].network.core_asset;
            ChainStore.init();
        });
    });

    // Unsubscribe everything after each test
    afterEach(function() {
        ChainStore.subscribers = new Set();
        ChainStore.clearCache();
    });

    after(function() {
        ChainConfig.reset();
    });

    describe("Subscriptions", function() {

        it("Asset not found", function() {
            return new Promise( function(resolve) {
                ChainStore.subscribe(function() {
                    assert(ChainStore.getAsset("NOTFOUND") === null)
                    resolve()
                })
                assert(ChainStore.getAsset("NOTFOUND") === undefined)
            })
        })

        it("Asset by name", function() {
            return new Promise( function(resolve) {
                ChainStore.subscribe(function() {
                    assert(ChainStore.getAsset(coreAsset) != null)
                    resolve()
                })
                assert(ChainStore.getAsset(coreAsset) === undefined)
            })
        })

        it("Asset by id", function() {
            return new Promise( function(resolve) {
                ChainStore.subscribe(function() {
                    assert(ChainStore.getAsset("1.3.0") != null)
                    resolve()
                })
                assert(ChainStore.getAsset("1.3.0") === undefined)
            })
        })

        it("Object by id", function() {
            return new Promise( function(resolve) {
                ChainStore.subscribe(function() {
                    assert(ChainStore.getAsset("2.0.0") != null)
                    resolve()
                })
                assert(ChainStore.getAsset("2.0.0") === undefined)
            })
        })

    })
        //     ChainStore.getAccount("not found")
        //
        //     ChainStore.unsubscribe(cb)
        //     // return FetchChain("getAccount", "notfound")
        //     let cb = res => console.log('res',res)
        //     // })
        // })

})


text:
"use strict";
const utils = require("./utils");

function delay(ms) {
  if (typeof ms !== "number") {
    throw new TypeError("ms is not a valid number");
  }

  return new Promise((resolve) => setTimeout(resolve, ms));
}

utils.defineConstructorHelper("delay", delay);


text:
<form @submit.prevent="insertTable">
    <label>
        {{$parent.locale["row count"]}}
        <input type="number" style="width: 60px" maxlength="2" min="2" max="10" v-model="rows">
    </label>
    <label>
        {{$parent.locale["column count"]}}
        <input type="number" style="width: 60px" maxlength="2" min="2" max="10" v-model="cols">
    </label>

    <button type="submit">{{$parent.locale.save}}</button>
</form>


text:
package com.fkeglevich.rawdumper.controller.feature;

import android.os.Handler;
import android.os.Looper;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;

import com.fkeglevich.rawdumper.activity.ActivityReference;
import com.fkeglevich.rawdumper.activity.KeyEventData;
import com.fkeglevich.rawdumper.camera.action.listener.AutoFocusResult;
import com.fkeglevich.rawdumper.camera.async.TurboCamera;
import com.fkeglevich.rawdumper.camera.data.CaptureSize;
import com.fkeglevich.rawdumper.camera.data.DataRange;
import com.fkeglevich.rawdumper.camera.data.FocusMode;
import com.fkeglevich.rawdumper.camera.data.ManualFocus;
import com.fkeglevich.rawdumper.camera.data.PreviewArea;
import com.fkeglevich.rawdumper.camera.feature.Feature;
import com.fkeglevich.rawdumper.camera.feature.FocusFeature;
import com.fkeglevich.rawdumper.camera.feature.WritableFeature;
import com.fkeglevich.rawdumper.camera.helper.PreviewHelper;
import com.fkeglevich.rawdumper.ui.TouchFocusView;
import com.fkeglevich.rawdumper.ui.UiUtil;
import com.fkeglevich.rawdumper.util.event.EventListener;

import static com.fkeglevich.rawdumper.ui.TouchFocusView.STROKE_WIDTH_DP;

/**
 * TODO: Add class header
 * <p>
 * Created by Flávio Keglevich on 28/10/17.
 */

public class TouchFocusMeteringAreaController extends FeatureController
{
    private final TouchFocusView focusView;
    private final ActivityReference reference;
    private final Handler uiHandler;
    private FocusFeature focusFeature;
    private boolean enabled = true;
    private PreviewArea lastTouchArea = null;
    private Feature<CaptureSize> previewFeature;

    private final AutoFocusResult autoFocusResult = new AutoFocusResult()
    {
        @Override
        public void autoFocusDone(final boolean success)
        {
            uiHandler.post(() -> focusView.setMeteringArea(lastTouchArea,
                    success ? TouchFocusView.FOCUS_METERING_SUCCESS : TouchFocusView.FOCUS_METERING_FAIL));
        }
    };
    private final EventListener<KeyEventData> keyListener;

    TouchFocusMeteringAreaController(View clickArea, TouchFocusView focusView, ActivityReference reference)
    {
        this.focusView = focusView;
        this.reference = reference;
        this.uiHandler = new Handler(Looper.getMainLooper());
        this.focusFeature = null;

        clickArea.setOnTouchListener((v, event) ->
        {
            if(enabled && event.getAction() == MotionEvent.ACTION_DOWN)
            {
                if (focusFeature != null)
                    performFocusOrExposureLock(v, (int)event.getX(), (int)event.getY(), shouldAutoFocus());

                v.performClick();
            }
            return false;
        });
        keyListener = eventData ->
        {
            if (enabled && eventData.keyCode == KeyEvent.KEYCODE_FOCUS)
            {
                if (focusFeature != null)
                {
                    if (lastTouchArea == null)
                    {
                        CaptureSize captureSize = previewFeature.getValue();
                        double scale = PreviewHelper.calculateVerticalScale(captureSize.getWidth(), captureSize.getHeight(), clickArea.getWidth(), clickArea.getHeight());
                        int w = clickArea.getWidth(), h = (int) (clickArea.getHeight() * scale);
                        performFocusOrExposureLock(clickArea, w / 2, h / 2, shouldAutoFocus());
                    } else
                        performFocusOrExposureLock(clickArea, lastTouchArea.getX(), lastTouchArea.getY(), shouldAutoFocus());
                }
            }
        };
    }

    private void performFocusOrExposureLock(View v, int x, int y, boolean autoFocus)
    {
        CaptureSize captureSize = previewFeature.getValue();
        double scale = PreviewHelper.calculateVerticalScale(captureSize.getWidth(), captureSize.getHeight(), v.getWidth(), v.getHeight());
        int w = v.getWidth(), h = (int)(v.getHeight() * scale);
        if (y < h)
        {
            int touchSize = UiUtil.dpToPixels(36, focusView.getContext());
            lastTouchArea = PreviewArea.createTouchArea(w, h, x, y, touchSize).fix(UiUtil.dpToPixels(STROKE_WIDTH_DP, v.getContext()));
            if (autoFocus)
            {
                drawMeteringArea();
                focusFeature.cancelAutoFocus();
                focusFeature.startAutoFocus(lastTouchArea, autoFocusResult);
            }
            else
            {
                if (focusFeature.setMeteringArea(lastTouchArea))
                    drawMeteringArea();
            }
        }
    }

    @Override
    protected void setup(TurboCamera camera)
    {
        previewFeature = camera.getPreviewFeature();
        focusFeature = (FocusFeature) camera.getListFeature(FocusMode.class);
        WritableFeature<ManualFocus, DataRange<ManualFocus>> manualFocusFeature = camera.getRangeFeature(ManualFocus.class);

        if (focusFeature.isAvailable())
            focusFeature.getOnChanging().addListener(eventData ->
            {
                cleanFocus();
                focusFeature.cancelAutoFocus();
            });

        if (manualFocusFeature.isAvailable())
            manualFocusFeature.getOnChanging().addListener(eventData ->
            {
                if (!eventData.parameterValue.equals(ManualFocus.DISABLED))
                    cleanFocus();
            });
        reference.onKeyDown.addListener(keyListener);
    }

    @Override
    protected void reset()
    {
        focusFeature = null;
        reference.onKeyDown.removeListener(keyListener);
        cleanFocus();
    }

    @Override
    protected void disable()
    {
        enabled = false;
    }

    @Override
    protected void enable()
    {
        enabled = true;
    }

    private void cleanFocus()
    {
        focusView.setMeteringArea(null, TouchFocusView.FOCUS_METERING);
        lastTouchArea = null;
    }

    private boolean shouldAutoFocus()
    {
        return focusFeature.isAvailable()
                && focusFeature.getValue().canAutoFocus()
                && !focusFeature.getValue().isContinuous();
    }

    private void drawMeteringArea()
    {
        focusView.setMeteringArea(lastTouchArea, TouchFocusView.FOCUS_METERING);
    }
}


text:
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="utf-8">
    <title>angular-responsive Directive Example</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author" content="Jim Lavin">
    <!-- Le styles -->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>
<div ng-view></div>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!--script src="../bower_components/jquery/jquery.js"></script -->
<script src="../bower_components/angular/angular.js"></script>
<script src="../bower_components/angular-route/angular-route.js"></script>
<script src="../bower_components/angular-responsive/responsive-directive.js"></script>

<script src="app/app.js"></script>
</body>
</html>


text:
import * as fs from "fs";
import * as path from "path";
import { utils } from "./utils";
import { ensureNoTsHeaderOrSpecFiles } from "./utils/ensureNoTsHeaderOrSpecFiles";

import { env, recalculateEnv } from "./../classes/process/env";
import { id, recalcuateId } from "./../classes/process/id";
import {
  actionheroVersion,
  recalculateActionheroVersion,
} from "./../classes/process/actionheroVersion";
import {
  recalculateIsTypescript,
  typescript,
} from "./../classes/process/typescript";
import {
  projectRoot,
  recalculateProjectRoot,
} from "./../classes/process/projectRoot";
import { RouteMethod, RoutesConfig, RouteType } from "..";
import { ActionheroConfigInterface } from "../classes/config";
import { safeGlobSync } from "./utils/safeGlob";

export function buildConfig() {
  const configPaths: string[] = [];

  let config: Partial<ActionheroConfigInterface> = {
    process: {
      env,
      id,
      typescript,
      projectRoot,
      actionheroVersion,
    },
  };

  // We support multiple configuration paths as follows:
  //
  // 1. Use the project 'config' folder, if it exists.
  // 2. "actionhero --config=PATH1 --config=PATH2 --config=PATH3,PATH4"
  // 3. "ACTIONHERO_CONFIG=PATH1,PATH2 npm start"
  // 4. "ACTIONHERO_CONFIG_OVERRIDES" (stringified JSON) can partially override any of the config objects loaded from the above
  //
  // Note that if --config or ACTIONHERO_CONFIG are used, they _overwrite_ the use of the default "config" folder. If
  // you wish to use both, you need to re-specify "config", e.g. "--config=config,local-config". Also, note that
  // specifying multiple --config options on the command line does exactly the same thing as using one parameter with
  // comma separators, however the environment variable method only supports the comma-delimited syntax.

  function addConfigPath(
    pathToCheck: string | Array<string>,
    alreadySplit: boolean
  ) {
    if (typeof pathToCheck === "string") {
      if (!alreadySplit) {
        addConfigPath(pathToCheck.split(","), true);
      } else {
        if (pathToCheck.charAt(0) !== "/") {
          pathToCheck = path.resolve(projectRoot, pathToCheck);
        }
        if (fs.existsSync(pathToCheck)) {
          configPaths.push(pathToCheck);
        }
      }
    } else if (Array.isArray(pathToCheck)) {
      pathToCheck.map((entry) => {
        addConfigPath(entry, alreadySplit);
      });
    }
  }

  [utils.argv.config?.toString(), process.env.ACTIONHERO_CONFIG].map(
    (entry) => {
      addConfigPath(entry, false);
    }
  );

  if (configPaths.length < 1 && typescript) {
    addConfigPath("src/config", false);
  }

  if (configPaths.length < 1) {
    addConfigPath("dist/config", false);
  }

  if (configPaths.length < 1) {
    throw new Error(
      configPaths +
        "No config directory found in this project.  Did you compile your typescript project?"
    );
  }

  const loadConfigFile = (f: string) => {
    const localConfig = require(f);
    if (f.includes("routes.js") || f.includes("routes.ts")) {
      // We don't want to merge in routes from Actionhero core unless we are running core directly
      // Routes can be loaded by plugins via `registerRoute`
      if (
        f.includes(`${path.sep}node_modules${path.sep}actionhero${path.sep}`)
      ) {
        return;
      }

      let localRoutes: { routes: Partial<RoutesConfig> } = { routes: {} };

      if (localConfig.DEFAULT) {
        // @ts-ignore
        localRoutes = utils.hashMerge(localRoutes, localConfig.DEFAULT, config);
      }

      if (localConfig[env]) {
        // @ts-ignore
        localRoutes = utils.hashMerge(localRoutes, localConfig[env], config);
      }

      (Object.keys(localRoutes.routes) as RouteMethod[]).forEach((v) => {
        if (config.routes && config.routes[v]) {
          config.routes[v].push(...localRoutes.routes[v]);
        } else {
          if (!config.routes) config.routes = {};
          config.routes[v] = localRoutes.routes[v];
        }
      });
    } else {
      if (localConfig.DEFAULT) {
        config = utils.hashMerge(config, localConfig.DEFAULT, config);
      }

      if (localConfig[env]) {
        config = utils.hashMerge(config, localConfig[env], config);
      }
    }
  };

  const loadConfigDirectory = (configPath: string, watch: boolean) => {
    const configFiles = ensureNoTsHeaderOrSpecFiles(
      safeGlobSync(path.join(configPath, "**", "**/*(*.js|*.ts)"))
    );

    let loadRetries = 0;
    let loadErrors: Record<
      string,
      { error: NodeJS.ErrnoException; msg: string }
    > = {};
    for (let i = 0, limit = configFiles.length; i < limit; i++) {
      const f = configFiles[i];
      try {
        // attempt configuration file load
        loadConfigFile(f);

        // configuration file load success: clear retries and
        // errors since progress has been made
        loadRetries = 0;
        loadErrors = {};
      } catch (error) {
        // error loading configuration, abort if all remaining
        // configuration files have been tried and failed
        // indicating inability to progress
        loadErrors[f] = { error: error, msg: error.toString() };
        if (++loadRetries === limit - i) {
          Object.keys(loadErrors).forEach((e) => {
            console.log(loadErrors[e].error.stack);
            console.log("");
            delete loadErrors[e].error;
          });

          throw new Error(
            "Unable to load configurations, errors: " +
              JSON.stringify(loadErrors)
          );
        }
        // adjust configuration files list: remove and push
        // failed configuration to the end of the list and
        // continue with next file at same index
        configFiles.push(configFiles.splice(i--, 1)[0]);
        continue;
      }
    }

    // We load the config twice. Utilize configuration files load order that succeeded on the first pass.
    // This is to allow 'literal' values to be loaded whenever possible, and then for references to be resolved
    configFiles.forEach(loadConfigFile);

    // Remove duplicate routes since we might be loading from multiple config directories, also we load every
    // config directory twice.
    if (config.routes) {
      (Object.keys(config.routes) as RouteMethod[]).forEach((v) => {
        config.routes[v] = config.routes[v].filter(
          (route: RouteType, index: number, self: RouteType[]) =>
            index ===
            self.findIndex(
              (r) =>
                r.path === route.path &&
                r.action === route.action &&
                r.apiVersion === route.apiVersion &&
                r.matchTrailingPathParts === route.matchTrailingPathParts &&
                r.dir === route.dir
            )
        );
      });
    }
  };

  // load the default config of actionhero
  loadConfigDirectory(path.join(__dirname, "/../config"), false);

  // load the project specific config
  configPaths.map((p) => loadConfigDirectory(p, false));

  if (process.env.ACTIONHERO_CONFIG_OVERRIDES) {
    try {
      config = utils.hashMerge(
        config,
        JSON.parse(process.env.ACTIONHERO_CONFIG_OVERRIDES)
      );
    } catch (error) {
      throw new Error(`could not parse ACTIONHERO_CONFIG_OVERRIDES: ${error}`);
    }
  }

  if (utils.argv.ACTIONHERO_CONFIG_OVERRIDES) {
    try {
      config = utils.hashMerge(
        config,
        JSON.parse(utils.argv.ACTIONHERO_CONFIG_OVERRIDES.toString())
      );
    } catch (error) {
      throw new Error(`could not parse ACTIONHERO_CONFIG_OVERRIDES: ${error}`);
    }
  }

  return config;
}

export let config = buildConfig();

/**
 * Rebuild Actionhero's `config` object.  Useful when Environment variables effecting the config may have changed.
 */
export const rebuildConfig = () => {
  recalculateEnv();
  recalculateActionheroVersion();
  recalcuateId();
  recalculateProjectRoot();
  recalculateIsTypescript();
  config = buildConfig();
};


text:
package funct

type Formula func (n int) int
type Recursive func(recur Formula, n int) int

func Memoizer(memo map[int]int, formula Recursive) Formula {
	var recur Formula
    recur = func (n int) int {
		result, ok := memo[n]
        if !ok {
            result = formula(recur, n);
			memo[n] = result;
        }
        return result;
    };
    return recur;
};

func Fib (recur Formula, n int) int {
	return recur(n - 1) + recur(n - 2)
}

func Fact(recur Formula, n int) int {
	return n * recur( n-1 )
}


text:
.class public Lcom/android/gallery3d/ui/TiledScreenNail;
.super Ljava/lang/Object;
.source "TiledScreenNail.java"

# interfaces
.implements Lcom/android/gallery3d/ui/ScreenNail;

# static fields
.field private static mDrawPlaceholder:Z

.field private static mPlaceholderColor:I

.field private static sMaxSide:I

# instance fields
.field private mAnimationStartTime:J

.field private mBitmap:Landroid/graphics/Bitmap;

.field private mHeight:I

.field private mTexture:Lcom/android/gallery3d/ui/TiledTexture;

.field private mWidth:I

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 43
    const/16 v0, 0x280

    sput v0, Lcom/android/gallery3d/ui/TiledScreenNail;->sMaxSide:I

    .line 70
    const v0, -0xddddde

    sput v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mPlaceholderColor:I

    .line 71
    const/4 v0, 0x1

    sput-boolean v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mDrawPlaceholder:Z

    return-void
.end method

.method public constructor <init>(II)V
    .locals 2
    .parameter "width"
    .parameter "height"

    .prologue
    .line 64
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 52
    const-wide/16 v0, -0x1

    iput-wide v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    .line 65
    invoke-direct {p0, p1, p2}, Lcom/android/gallery3d/ui/TiledScreenNail;->setSize(II)V

    .line 66
    return-void
.end method

.method public constructor <init>(Landroid/graphics/Bitmap;)V
    .locals 2
    .parameter "bitmap"

    .prologue
    .line 57
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 52
    const-wide/16 v0, -0x1

    iput-wide v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    .line 58
    invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v0

    iput v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mWidth:I

    .line 59
    invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v0

    iput v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mHeight:I

    .line 60
    iput-object p1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    .line 61
    new-instance v0, Lcom/android/gallery3d/ui/TiledTexture;

    invoke-direct {v0, p1}, Lcom/android/gallery3d/ui/TiledTexture;-><init>(Landroid/graphics/Bitmap;)V

    iput-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    .line 62
    return-void
.end method

.method public static disableDrawPlaceholder()V
    .locals 1

    .prologue
    .line 152
    const/4 v0, 0x0

    sput-boolean v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mDrawPlaceholder:Z

    .line 153
    return-void
.end method

.method public static enableDrawPlaceholder()V
    .locals 1

    .prologue
    .line 156
    const/4 v0, 0x1

    sput-boolean v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mDrawPlaceholder:Z

    .line 157
    return-void
.end method

.method private getRatio()F
    .locals 6

    .prologue
    const/high16 v5, 0x3f80

    .line 208
    invoke-static {}, Lcom/android/gallery3d/ui/AnimationTime;->get()J

    move-result-wide v1

    iget-wide v3, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    sub-long/2addr v1, v3

    long-to-float v1, v1

    const/high16 v2, 0x4334

    div-float v0, v1, v2

    .line 209
    .local v0, r:F
    sub-float v1, v5, v0

    const/4 v2, 0x0

    invoke-static {v1, v2, v5}, Lcom/android/gallery3d/common/Utils;->clamp(FFF)F

    move-result v1

    return v1
.end method

.method private static recycleBitmap(Lcom/android/gallery3d/data/BitmapPool;Landroid/graphics/Bitmap;)V
    .locals 0
    .parameter "pool"
    .parameter "bitmap"

    .prologue
    .line 88
    if-eqz p0, :cond_0

    if-nez p1, :cond_1

    .line 90
    :cond_0
    :goto_0
    return-void

    .line 89
    :cond_1
    invoke-virtual {p0, p1}, Lcom/android/gallery3d/data/BitmapPool;->recycle(Landroid/graphics/Bitmap;)V

    goto :goto_0
.end method

.method public static setMaxSide(I)V
    .locals 0
    .parameter "size"

    .prologue
    .line 221
    sput p0, Lcom/android/gallery3d/ui/TiledScreenNail;->sMaxSide:I

    .line 222
    return-void
.end method

.method public static setPlaceholderColor(I)V
    .locals 0
    .parameter "color"

    .prologue
    .line 74
    sput p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mPlaceholderColor:I

    .line 75
    return-void
.end method

.method private setSize(II)V
    .locals 4
    .parameter "width"
    .parameter "height"

    .prologue
    .line 78
    if-eqz p1, :cond_0

    if-nez p2, :cond_1

    .line 79
    :cond_0
    sget p1, Lcom/android/gallery3d/ui/TiledScreenNail;->sMaxSide:I

    .line 80
    sget v1, Lcom/android/gallery3d/ui/TiledScreenNail;->sMaxSide:I

    mul-int/lit8 v1, v1, 0x3

    div-int/lit8 p2, v1, 0x4

    .line 82
    :cond_1
    const/high16 v1, 0x3f80

    sget v2, Lcom/android/gallery3d/ui/TiledScreenNail;->sMaxSide:I

    int-to-float v2, v2

    invoke-static {p1, p2}, Ljava/lang/Math;->max(II)I

    move-result v3

    int-to-float v3, v3

    div-float/2addr v2, v3

    invoke-static {v1, v2}, Ljava/lang/Math;->min(FF)F

    move-result v0

    .line 83
    .local v0, scale:F
    int-to-float v1, p1

    mul-float/2addr v1, v0

    invoke-static {v1}, Ljava/lang/Math;->round(F)I

    move-result v1

    iput v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mWidth:I

    .line 84
    int-to-float v1, p2

    mul-float/2addr v1, v0

    invoke-static {v1}, Ljava/lang/Math;->round(F)I

    move-result v1

    iput v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mHeight:I

    .line 85
    return-void
.end method

# virtual methods
.method public combine(Lcom/android/gallery3d/ui/ScreenNail;)Lcom/android/gallery3d/ui/ScreenNail;
    .locals 4
    .parameter "other"

    .prologue
    const/4 v3, 0x0

    .line 95
    if-nez p1, :cond_0

    .line 118
    .end local p0
    :goto_0
    return-object p0

    .line 99
    .restart local p0
    :cond_0
    instance-of v1, p1, Lcom/android/gallery3d/ui/TiledScreenNail;

    if-nez v1, :cond_1

    .line 100
    invoke-virtual {p0}, Lcom/android/gallery3d/ui/TiledScreenNail;->recycle()V

    move-object p0, p1

    .line 101
    goto :goto_0

    :cond_1
    move-object v0, p1

    .line 106
    check-cast v0, Lcom/android/gallery3d/ui/TiledScreenNail;

    .line 107
    .local v0, newer:Lcom/android/gallery3d/ui/TiledScreenNail;
    iget v1, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mWidth:I

    iput v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mWidth:I

    .line 108
    iget v1, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mHeight:I

    iput v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mHeight:I

    .line 109
    iget-object v1, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v1, :cond_3

    .line 110
    invoke-static {}, Lcom/android/gallery3d/data/MediaItem;->getThumbPool()Lcom/android/gallery3d/data/BitmapPool;

    move-result-object v1

    iget-object v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    invoke-static {v1, v2}, Lcom/android/gallery3d/ui/TiledScreenNail;->recycleBitmap(Lcom/android/gallery3d/data/BitmapPool;Landroid/graphics/Bitmap;)V

    .line 111
    iget-object v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v1}, Lcom/android/gallery3d/ui/TiledTexture;->recycle()V

    .line 112
    :cond_2
    iget-object v1, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    iput-object v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    .line 113
    iget-object v1, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    iput-object v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    .line 114
    iput-object v3, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    .line 115
    iput-object v3, v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    .line 117
    :cond_3
    invoke-virtual {v0}, Lcom/android/gallery3d/ui/TiledScreenNail;->recycle()V

    goto :goto_0
.end method

.method public draw(Lcom/android/gallery3d/ui/GLCanvas;IIII)V
    .locals 8
    .parameter "canvas"
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"

    .prologue
    const-wide/16 v4, -0x2

    .line 161
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v0}, Lcom/android/gallery3d/ui/TiledTexture;->isReady()Z

    move-result v0

    if-nez v0, :cond_3

    .line 162
    :cond_0
    iget-wide v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    const-wide/16 v2, -0x1

    cmp-long v0, v0, v2

    if-nez v0, :cond_1

    .line 163
    iput-wide v4, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    .line 165
    :cond_1
    sget-boolean v0, Lcom/android/gallery3d/ui/TiledScreenNail;->mDrawPlaceholder:Z

    if-eqz v0, :cond_2

    .line 166
    int-to-float v1, p2

    int-to-float v2, p3

    int-to-float v3, p4

    int-to-float v4, p5

    sget v5, Lcom/android/gallery3d/ui/TiledScreenNail;->mPlaceholderColor:I

    move-object v0, p1

    invoke-interface/range {v0 .. v5}, Lcom/android/gallery3d/ui/GLCanvas;->fillRect(FFFFI)V

    .line 181
    :cond_2
    :goto_0
    return-void

    .line 171
    :cond_3
    iget-wide v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    cmp-long v0, v0, v4

    if-nez v0, :cond_4

    .line 172
    invoke-static {}, Lcom/android/gallery3d/ui/AnimationTime;->get()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    .line 175
    :cond_4
    invoke-virtual {p0}, Lcom/android/gallery3d/ui/TiledScreenNail;->isAnimating()Z

    move-result v0

    if-eqz v0, :cond_5

    .line 176
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    sget v2, Lcom/android/gallery3d/ui/TiledScreenNail;->mPlaceholderColor:I

    invoke-direct {p0}, Lcom/android/gallery3d/ui/TiledScreenNail;->getRatio()F

    move-result v3

    move-object v1, p1

    move v4, p2

    move v5, p3

    move v6, p4

    move v7, p5

    invoke-virtual/range {v0 .. v7}, Lcom/android/gallery3d/ui/TiledTexture;->drawMixed(Lcom/android/gallery3d/ui/GLCanvas;IFIIII)V

    goto :goto_0

    .line 179
    :cond_5
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    move-object v1, p1

    move v2, p2

    move v3, p3

    move v4, p4

    move v5, p5

    invoke-virtual/range {v0 .. v5}, Lcom/android/gallery3d/ui/TiledTexture;->draw(Lcom/android/gallery3d/ui/GLCanvas;IIII)V

    goto :goto_0
.end method

.method public draw(Lcom/android/gallery3d/ui/GLCanvas;Landroid/graphics/RectF;Landroid/graphics/RectF;)V
    .locals 6
    .parameter "canvas"
    .parameter "source"
    .parameter "dest"

    .prologue
    .line 185
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v0}, Lcom/android/gallery3d/ui/TiledTexture;->isReady()Z

    move-result v0

    if-nez v0, :cond_1

    .line 186
    :cond_0
    iget v1, p3, Landroid/graphics/RectF;->left:F

    iget v2, p3, Landroid/graphics/RectF;->top:F

    invoke-virtual {p3}, Landroid/graphics/RectF;->width()F

    move-result v3

    invoke-virtual {p3}, Landroid/graphics/RectF;->height()F

    move-result v4

    sget v5, Lcom/android/gallery3d/ui/TiledScreenNail;->mPlaceholderColor:I

    move-object v0, p1

    invoke-interface/range {v0 .. v5}, Lcom/android/gallery3d/ui/GLCanvas;->fillRect(FFFFI)V

    .line 192
    :goto_0
    return-void

    .line 191
    :cond_1
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v0, p1, p2, p3}, Lcom/android/gallery3d/ui/TiledTexture;->draw(Lcom/android/gallery3d/ui/GLCanvas;Landroid/graphics/RectF;Landroid/graphics/RectF;)V

    goto :goto_0
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 134
    iget v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mHeight:I

    return v0
.end method

.method public getTexture()Lcom/android/gallery3d/ui/TiledTexture;
    .locals 1

    .prologue
    .line 217
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    return-object v0
.end method

.method public getWidth()I
    .locals 1

    .prologue
    .line 129
    iget v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mWidth:I

    return v0
.end method

.method public isAnimating()Z
    .locals 6

    .prologue
    const/4 v1, 0x1

    const/4 v0, 0x0

    .line 198
    iget-object v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v2, :cond_0

    iget-object v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v2}, Lcom/android/gallery3d/ui/TiledTexture;->isReady()Z

    move-result v2

    if-nez v2, :cond_2

    :cond_0
    move v0, v1

    .line 204
    :cond_1
    :goto_0
    return v0

    .line 199
    :cond_2
    iget-wide v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    const-wide/16 v4, 0x0

    cmp-long v2, v2, v4

    if-ltz v2, :cond_1

    .line 200
    invoke-static {}, Lcom/android/gallery3d/ui/AnimationTime;->get()J

    move-result-wide v2

    iget-wide v4, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    sub-long/2addr v2, v4

    const-wide/16 v4, 0xb4

    cmp-long v2, v2, v4

    if-ltz v2, :cond_3

    .line 201
    const-wide/16 v1, -0x3

    iput-wide v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mAnimationStartTime:J

    goto :goto_0

    :cond_3
    move v0, v1

    .line 204
    goto :goto_0
.end method

.method public noDraw()V
    .locals 0

    .prologue
    .line 139
    return-void
.end method

.method public recycle()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 143
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    if-eqz v0, :cond_0

    .line 144
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    invoke-virtual {v0}, Lcom/android/gallery3d/ui/TiledTexture;->recycle()V

    .line 145
    iput-object v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mTexture:Lcom/android/gallery3d/ui/TiledTexture;

    .line 147
    :cond_0
    invoke-static {}, Lcom/android/gallery3d/data/MediaItem;->getThumbPool()Lcom/android/gallery3d/data/BitmapPool;

    move-result-object v0

    iget-object v1, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    invoke-static {v0, v1}, Lcom/android/gallery3d/ui/TiledScreenNail;->recycleBitmap(Lcom/android/gallery3d/data/BitmapPool;Landroid/graphics/Bitmap;)V

    .line 148
    iput-object v2, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    .line 149
    return-void
.end method

.method public updatePlaceholderSize(II)V
    .locals 1
    .parameter "width"
    .parameter "height"

    .prologue
    .line 122
    iget-object v0, p0, Lcom/android/gallery3d/ui/TiledScreenNail;->mBitmap:Landroid/graphics/Bitmap;

    if-eqz v0, :cond_1

    .line 125
    :cond_0
    :goto_0
    return-void

    .line 123
    :cond_1
    if-eqz p1, :cond_0

    if-eqz p2, :cond_0

    .line 124
    invoke-direct {p0, p1, p2}, Lcom/android/gallery3d/ui/TiledScreenNail;->setSize(II)V

    goto :goto_0
.end method


text:
import Title from './components/Title';

module.exports = {
  Title
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class org.apache.poi.util.StringUtil.StringsIterator (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

Uses of Class
org.apache.poi.util.StringUtil.StringsIterator

Packages that use StringUtil.StringsIterator

Package
Description

org.apache.poi.hsmf.extractor

Uses of StringUtil.StringsIterator in org.apache.poi.hsmf.extractor

Methods in org.apache.poi.hsmf.extractor with parameters of type StringUtil.StringsIterator

Modifier and Type
Method and Description

protected void
OutlookTextExtactor.handleEmails(java.lang.StringBuffer s,
            java.lang.String type,
            java.lang.String displayText,
            StringUtil.StringsIterator emails)

Takes a Display focused string, eg "Nick; Jim" and an iterator
  of emails, and does its best to return something like
  "Nick <nick@example.com>; Jim <jim@example.com>"

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV

NEXT

FRAMES

NO FRAMES

All Classes

                Copyright 2016 The Apache Software Foundation or
        its licensors, as applicable.


text:
<?xml version="1.0" encoding="UTF-8"?>
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <name>bannerTS</name>
  <description>basic typesystem started by sid</description>
  <version>1.0</version>
  <vendor/>
  <types>
    <typeDescription>
      <name>banner.types.uima.Gene</name>
      <description>Just marks the gene</description>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
        <featureDescription>
          <name>id</name>
          <description>id is the reference to a standard database such as uniprot or ensembl
</description>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
    <typeDescription>
      <name>banner.types.uima.Source</name>
      <description>stores information about the source of the input</description>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
        <featureDescription>
          <name>filePath</name>
          <description>file path of the source</description>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>text</name>
          <description>text in the file or line</description>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
  </types>
</typeSystemDescription>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch-srv-discovery</artifactId>
    <version>0.90.11-8</version>
    <packaging>jar</packaging>
    <name>Elasticsearch SRV discovery plugin</name>
    <description>The SRV discovery plugin allows to use SRV recrds for unicast discovery.</description>
    <url>https://github.com/grantr/elasticsearch-srv-discovery/</url>
    <inceptionYear>2015</inceptionYear>
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git@github.com:grantr/elasticsearch-srv-discovery.git</connection>
        <developerConnection>scm:git:git@github.com:grantr/elasticsearch-srv-discovery.git</developerConnection>
        <url>http://github.com/grantr/elasticsearch-srv-discovery</url>
    </scm>

    <properties>
        <elasticsearch.version>6.8.15</elasticsearch.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>dnsjava</groupId>
            <artifactId>dnsjava</artifactId>
            <version>2.1.7</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                    <descriptors>
                        <descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Build Debian (.deb) package -->
                <!-- Documentation: https://github.com/tcurdt/jdeb/blob/master/docs/maven.md -->
                <artifactId>jdeb</artifactId>
                <groupId>org.vafer</groupId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jdeb</goal>
                        </goals>
                        <configuration>
                            <!-- Name of debian package -->
                            <deb>${project.basedir}/${project.artifactId}-${project.version}.deb</deb>
                            <verbose>true</verbose>
                            <snapshotExpand>true</snapshotExpand>
                            <!-- expand "SNAPSHOT" to what is in the "USER" env variable -->
                            <snapshotEnv>USER</snapshotEnv>
                            <verbose>true</verbose>
                            <controlDir>src/deb/control</controlDir>
                            <dataSet>
                                <data>
                                    <type>file</type>
                                    <src>
                                        ${project.build.directory}/elasticsearch-srv-discovery-${project.version}.jar
                                    </src>
                                    <mapper>
                                        <type>perm</type>
                                        <prefix>/usr/share/elasticsearch/plugins/consul</prefix>
                                        <user>root</user>
                                        <group>root</group>
                                        <dirmode>755</dirmode>
                                        <filemode>644</filemode>
                                    </mapper>
                                </data>

                                <data>
                                    <type>file</type>
                                    <src>
                                        ${project.build.directory}/lib/dnsjava-2.1.7.jar
                                    </src>
                                    <mapper>
                                        <type>perm</type>
                                        <prefix>/usr/share/elasticsearch/plugins/consul</prefix>
                                        <user>root</user>
                                        <group>root</group>
                                        <dirmode>755</dirmode>
                                        <filemode>644</filemode>
                                    </mapper>
                                </data>
                            </dataSet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
package org.apache.pulsar.common.naming;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.pulsar.broker.namespace.NamespaceService;

/**
 * This algorithm divides the bundle into two parts with the same topics count.
 */
public class TopicCountEquallyDivideBundleSplitAlgorithm implements NamespaceBundleSplitAlgorithm  {

    @Override
    public CompletableFuture<List<Long>> getSplitBoundary(BundleSplitOption bundleSplitOption) {
        NamespaceService service = bundleSplitOption.getService();
        NamespaceBundle bundle = bundleSplitOption.getBundle();
        return service.getOwnedTopicListForNamespaceBundle(bundle).thenCompose(topics -> {
            if (topics == null || topics.size() <= 1) {
                return CompletableFuture.completedFuture(null);
            }
            List<Long> topicNameHashList = new ArrayList<>(topics.size());
            for (String topic : topics) {
                topicNameHashList.add(bundle.getNamespaceBundleFactory().getLongHashCode(topic));
            }
            Collections.sort(topicNameHashList);
            long splitStart = topicNameHashList.get(Math.max((topicNameHashList.size() / 2) - 1, 0));
            long splitEnd = topicNameHashList.get(topicNameHashList.size() / 2);
            long splitMiddle = splitStart + (splitEnd - splitStart) / 2;
            return CompletableFuture.completedFuture(Collections.singletonList(splitMiddle));
        });
    }
}


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-m-rel-xr-w32-bld/build/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl
 */

#ifndef __gen_nsIDOMXULCheckboxElement_h__
#define __gen_nsIDOMXULCheckboxElement_h__

#ifndef __gen_nsIDOMElement_h__
#include "nsIDOMElement.h"
#endif

#ifndef __gen_nsIDOMXULLabeledControlEl_h__
#include "nsIDOMXULLabeledControlEl.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    nsIDOMXULCheckboxElement */
#define NS_IDOMXULCHECKBOXELEMENT_IID_STR "064aa0c2-3442-489c-a4f5-a42b626dcc53"

#define NS_IDOMXULCHECKBOXELEMENT_IID \
  {0x064aa0c2, 0x3442, 0x489c, \
    { 0xa4, 0xf5, 0xa4, 0x2b, 0x62, 0x6d, 0xcc, 0x53 }}

class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMXULCheckboxElement : public nsIDOMXULLabeledControlElement {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMXULCHECKBOXELEMENT_IID)

  enum { CHECKSTATE_UNCHECKED = 0 };

  enum { CHECKSTATE_CHECKED = 1 };

  enum { CHECKSTATE_MIXED = 2 };

  /* attribute boolean checked; */
  NS_SCRIPTABLE NS_IMETHOD GetChecked(bool *aChecked) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetChecked(bool aChecked) = 0;

  /* attribute long checkState; */
  NS_SCRIPTABLE NS_IMETHOD GetCheckState(PRInt32 *aCheckState) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetCheckState(PRInt32 aCheckState) = 0;

  /* attribute boolean autoCheck; */
  NS_SCRIPTABLE NS_IMETHOD GetAutoCheck(bool *aAutoCheck) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetAutoCheck(bool aAutoCheck) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMXULCheckboxElement, NS_IDOMXULCHECKBOXELEMENT_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMXULCHECKBOXELEMENT \
  NS_SCRIPTABLE NS_IMETHOD GetChecked(bool *aChecked); \
  NS_SCRIPTABLE NS_IMETHOD SetChecked(bool aChecked); \
  NS_SCRIPTABLE NS_IMETHOD GetCheckState(PRInt32 *aCheckState); \
  NS_SCRIPTABLE NS_IMETHOD SetCheckState(PRInt32 aCheckState); \
  NS_SCRIPTABLE NS_IMETHOD GetAutoCheck(bool *aAutoCheck); \
  NS_SCRIPTABLE NS_IMETHOD SetAutoCheck(bool aAutoCheck);

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMXULCHECKBOXELEMENT(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetChecked(bool *aChecked) { return _to GetChecked(aChecked); } \
  NS_SCRIPTABLE NS_IMETHOD SetChecked(bool aChecked) { return _to SetChecked(aChecked); } \
  NS_SCRIPTABLE NS_IMETHOD GetCheckState(PRInt32 *aCheckState) { return _to GetCheckState(aCheckState); } \
  NS_SCRIPTABLE NS_IMETHOD SetCheckState(PRInt32 aCheckState) { return _to SetCheckState(aCheckState); } \
  NS_SCRIPTABLE NS_IMETHOD GetAutoCheck(bool *aAutoCheck) { return _to GetAutoCheck(aAutoCheck); } \
  NS_SCRIPTABLE NS_IMETHOD SetAutoCheck(bool aAutoCheck) { return _to SetAutoCheck(aAutoCheck); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMXULCHECKBOXELEMENT(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetChecked(bool *aChecked) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChecked(aChecked); } \
  NS_SCRIPTABLE NS_IMETHOD SetChecked(bool aChecked) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetChecked(aChecked); } \
  NS_SCRIPTABLE NS_IMETHOD GetCheckState(PRInt32 *aCheckState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCheckState(aCheckState); } \
  NS_SCRIPTABLE NS_IMETHOD SetCheckState(PRInt32 aCheckState) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCheckState(aCheckState); } \
  NS_SCRIPTABLE NS_IMETHOD GetAutoCheck(bool *aAutoCheck) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAutoCheck(aAutoCheck); } \
  NS_SCRIPTABLE NS_IMETHOD SetAutoCheck(bool aAutoCheck) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAutoCheck(aAutoCheck); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsDOMXULCheckboxElement : public nsIDOMXULCheckboxElement
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMXULCHECKBOXELEMENT

  nsDOMXULCheckboxElement();

private:
  ~nsDOMXULCheckboxElement();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMXULCheckboxElement, nsIDOMXULCheckboxElement)

nsDOMXULCheckboxElement::nsDOMXULCheckboxElement()
{
  /* member initializers and constructor code */
}

nsDOMXULCheckboxElement::~nsDOMXULCheckboxElement()
{
  /* destructor code */
}

/* attribute boolean checked; */
NS_IMETHODIMP nsDOMXULCheckboxElement::GetChecked(bool *aChecked)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMXULCheckboxElement::SetChecked(bool aChecked)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute long checkState; */
NS_IMETHODIMP nsDOMXULCheckboxElement::GetCheckState(PRInt32 *aCheckState)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMXULCheckboxElement::SetCheckState(PRInt32 aCheckState)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute boolean autoCheck; */
NS_IMETHODIMP nsDOMXULCheckboxElement::GetAutoCheck(bool *aAutoCheck)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMXULCheckboxElement::SetAutoCheck(bool aAutoCheck)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#endif /* __gen_nsIDOMXULCheckboxElement_h__ */


text:
package main

import (
	"flag"
	"fmt"
	"github.com/ActiveState/tail"
	"github.com/op/go-logging"
	"github.com/vmihailenco/redis"
	"os"
	"regexp"
	"time"
)

var (
	path        string
	redisHost   string
	redisPasswd string
	logRegex    string
	redisDB     int64
	log         logging.Logger
)

func init() {
	flag.StringVar(&path, "l", "", "Path to the access log to watch")
	flag.StringVar(&redisHost, "h", "localhost:6379", "Hostname:port Redis")
	flag.StringVar(&redisPasswd, "p", "", "Redis password")
	flag.Int64Var(&redisDB, "d", -1, "Redis DB number to store the data")
	flag.StringVar(&logRegex, "r", "", "PCRE Regex to parse the log. Must return the remote IP on the first capture group")
}

func main() {
	if len(os.Args) < 6 {
		fmt.Fprintln(os.Stderr, "You need arguments")
		flag.Usage()
		os.Exit(10)
	}
	flag.Parse()

	// Seek to the end at the start
	seek := &tail.SeekInfo{
		Offset: 0,
		Whence: 2,
	}

	config := tail.Config{
		ReOpen:    true,
		MustExist: true,
		Follow:    true,
		Location:  seek,
	}

	t, err := tail.TailFile(path, config)
	if err != nil {
		log.Fatalf("Could not tail: %v\n", err)
	}

	client := redis.NewTCPClient(redisHost, redisPasswd, redisDB)
	multi, err := client.MultiClient()
	if err != nil {
		log.Fatalf("Failed to create multiclient: %v", err)
	}
	defer client.Close()
	log.Info("Connected to redis")

	r := regexp.MustCompile(logRegex)
	ipRegex := regexp.MustCompile(`\S+\.\S+\.\S+\.\S+`)
	ignored_ips := map[string]bool{"127.0.0.1": true}

	for line := range t.Lines {
		if matches := r.FindStringSubmatch(line.Text); matches != nil {
			if !ipRegex.MatchString(matches[1]) {
				continue
			}
			if ignored_ips[matches[1]] {
				continue
			}

			if res := client.Ping(); res.Err() != nil {
				log.Warning("Redis not connected, %v, reconnecting", res.Val())
				client = redis.NewTCPClient(redisHost, redisPasswd, redisDB)
				multi, err = client.MultiClient()
				if err != nil {
					log.Fatalf("Failed to create multiclient: %v", err)
				}
			}
			ip := matches[1]
			_, err := multi.Exec(func() {
				multi.ZIncrBy("ipcount_5m", 1, ip)
				multi.HSet("ipcount_h5m", ip, fmt.Sprintf("%d", time.Now().Unix()))
				multi.ZIncrBy("ipcount_1h", 1, ip)
				multi.HSet("ipcount_h1h", ip, fmt.Sprintf("%d", time.Now().Unix()))
				multi.ZIncrBy("ipcount_12h", 1, ip)
				multi.HSet("ipcount_h12h", ip, fmt.Sprintf("%d", time.Now().Unix()))
				multi.ZIncrBy("ipcount_24h", 1, ip)
				multi.HSet("ipcount_h24h", ip, fmt.Sprintf("%d", time.Now().Unix()))
			})
			if err == redis.Nil {
				log.Warning("Failed to add to set: %v", err)
			}
		}
	}
}


text:
export { default as attr } from './attr';
export { default as belongsTo } from './belongs-to';
export { default as hasMany } from './has-many';
export { default as Model } from './model';
export { default as Errors } from './errors';

export { default as ManyArray } from './system/many-array';
export { default as PromiseBelongsTo } from './system/promise-belongs-to';
export { default as PromiseManyArray } from './system/promise-many-array';
export { default as _modelForMixin } from './system/model-for-mixin';

// // Used by tests
export { default as diffArray } from './system/diff-array';


text:
<?php
/**
 * header.php
 *
 * The theme header.
 */
?>

<!DOCTYPE html>

 <html <?php language_attributes(); ?> class="no-js">

    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php wp_title( '|', true, 'right' ); ?><?php bloginfo( 'name' ); ?></title>
    <meta name="description" content="<?php bloginfo( 'description' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php
        $favicon   = IMAGES . '/icons/favicon.ico';
        $touchicon = IMAGES . '/icons/apple-touch-icon-precomposed.png';
    ?>

    <link rel="shortcut icon" href="<?php echo $favicon; ?>">
    <link rel="apple-touch-icon-precomposed" href="<?php echo $touchicon; ?>" sizes="152x152">

    <?php wp_head(); ?>

<body <?php body_class(); ?>>

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <?php _e( 'Toggle navigation', 'versover' ); ?>

            </button>
            <a class="navbar-brand" href="<?php echo esc_url( home_url('/') ); ?>">
                <?php bloginfo( 'name' );?>

            <?php
                wp_nav_menu( array(
                    'menu_class'     => 'nav navbar-nav navbar-right',
                    'theme_location' => 'main-menu',
                    'container'      => false,
                ) );
            ?>


text:
all: bench

bench: dist/benchmark
	dist/benchmark

dist/benchmark:
	crystal build -o dist/benchmark --release src/benchmark.cr

.PHONY: all


text:
package com.happydroids.droidtowers.achievements;

import com.happydroids.droidtowers.entities.GridObject;
import com.happydroids.droidtowers.grid.GameGrid;
import com.happydroids.droidtowers.types.GridObjectType;
import com.happydroids.droidtowers.types.ProviderType;

public class TestGridObjectType extends GridObjectType {
  public TestGridObjectType() {
    name = TestGridObjectType.class.getSimpleName();
    id = name;
    width = 1;
    height = 1;
  }

  @Override
  public GridObject makeGridObject(GameGrid gameGrid) {
    return new TestGridObject(this, gameGrid);
  }

  @Override
  public boolean canBeAt(GridObject gridObject) {
    return false;
  }

  public void setAtlasFilename(String atlasFilename) {
    this.atlasFilename = atlasFilename;
  }

  public void setCanShareSpace(boolean canShareSpace) {
    this.canShareSpace = canShareSpace;
  }

  public void setCoins(int coins) {
    this.coins = coins;
  }

  public void setExperienceAward(int experienceAward) {
    this.experienceAward = experienceAward;
  }

  public void setHeight(byte height) {
    this.height = height;
  }

  public void setId(String id) {
    this.id = id;
  }

  public void setImageFilename(String imageFilename) {
    this.imageFilename = imageFilename;
  }

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

  public void setNoiseLevel(float noiseLevel) {
    this.noiseLevel = noiseLevel;
  }

  public void setProvides(ProviderType provides) {
    this.provides = provides;
  }

  public void setWidth(byte width) {
    this.width = width;
  }
}


text:
<?php

/**
 * Base class for all combiners. This class provides the interface to the YUI
 * compressor (the compress() method).
 *
 * @author Sam Stenvall <sam@supportersplace.com>
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 */

namespace yiiyuiclientscript\components;
use yiiyuiclientscript\exceptions\Exception as Exception;

class Combiner
{

	/**
	 * @var \YUI\Compressor the YUI compressor
	 */
	protected $compressor;

	/**
	 * Class constructor. It initializes the YUI compressor.
	 * @see \YUI\Compressor
	 */
	public function __construct()
	{
		$compressorOptions = \Yii::app()->clientScript->compressorOptions;
		$this->compressor = new \YUI\Compressor($compressorOptions);
	}

	/**
	 * Compresses the specified contents using the specified content type
	 * @see \YUI\Compressor
	 * @param string $contentType content type for the compressor
	 * @param string $contents the contents to compress
	 * @return string the compressed contents
	 */
	public function compress($contentType, $contents)
	{
		$this->compressor->setType($contentType);

		// Re-throw any errors from the compressor under our own namespace
		try
		{
			foreach ($contents as &$content)
				$content = $this->compressor->compress($content);
		}
		catch (\YUI\Exception $e)
		{
			throw new Exception('YUI compressor failed with: '.$e->getMessage(), $e->getCode(), $e);
		}

		return $contents;
	}

	/**
	 * Checks whether the contents from the specified URL should be excluded
	 * from the minification process
	 * @param string $url the URL to the file
	 * @return boolean
	 */
	protected function shouldExclude($url)
	{
		foreach (\Yii::app()->clientScript->exclude as $needle)
			if (strpos($url, $needle) !== false)
				return true;

		return false;
	}

}


text:
package org.fusesource.mqtt.client;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import static org.fusesource.hawtbuf.Buffer.utf8;

/**
 *

 *

 *
 * @author Hiram Chirino
 */
public class BlockingApiBenchmark {

    static public void main(String []args) throws Exception {
        MQTT mqtt = new MQTT();
        mqtt.setConnectAttemptsMax(0);
        mqtt.setReconnectAttemptsMax(0);
        mqtt.setHost("localhost", 1883);

        final BlockingConnection publishConnection = mqtt.blockingConnection();
        publishConnection.connect();

        final BlockingConnection subscribeConnection = mqtt.blockingConnection();
        subscribeConnection.connect();
        subscribeConnection.setReceiveBuffer(1024*64);

        Topic[] topic = {new Topic(utf8("foo"), QoS.EXACTLY_ONCE)};
        byte[] qoses = subscribeConnection.subscribe(topic);

        final long start = System.currentTimeMillis();
        final AtomicLong sendCounter = new AtomicLong();
        final AtomicLong receiveCounter = new AtomicLong();

        Thread receiver = new Thread("receiver") {
            @Override
            public void run() {
                try {
                    while (true) {
                        if (System.currentTimeMillis() > start + TimeUnit.SECONDS.toMillis(120)) {
                            break;
                        }
                        Thread.sleep(10);
                        subscribeConnection.receive().ack();
                        receiveCounter.incrementAndGet();
                    }

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        receiver.start();

        Thread sender = new Thread("sender"){
            @Override
            public void run() {
                try {
                    while (true) {
                        if (System.currentTimeMillis() > start + TimeUnit.SECONDS.toMillis(120)) {
                            break;
                        }
                        publishConnection.publish("foo", new byte[1024], QoS.EXACTLY_ONCE, false);
                        sendCounter.incrementAndGet();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        sender.start();

        while (true) {
            if (System.currentTimeMillis() > start + TimeUnit.SECONDS.toMillis(120)) {
                break;
            }
            Thread.sleep(1000);
            System.out.println("Sent: "+sendCounter.get()+", Received: " + receiveCounter.get());
        }

        publishConnection.disconnect();
        subscribeConnection.disconnect();
        receiver.join();
        sender.join();

    }
}


text:
package eu.verdelhan.ta4j.indicators.statistics;

import eu.verdelhan.ta4j.Decimal;
import eu.verdelhan.ta4j.Rule;
import eu.verdelhan.ta4j.Strategy;
import static eu.verdelhan.ta4j.TATestsUtils.assertDecimalEquals;
import eu.verdelhan.ta4j.TimeSeries;
import eu.verdelhan.ta4j.indicators.simple.ClosePriceIndicator;
import eu.verdelhan.ta4j.mocks.MockTimeSeries;
import eu.verdelhan.ta4j.trading.rules.CrossedDownIndicatorRule;
import eu.verdelhan.ta4j.trading.rules.CrossedUpIndicatorRule;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;

public class PeriodicalGrowthRateIndicatorTest {

    private TimeSeries mockdata;

    private ClosePriceIndicator closePrice;

    @Before
    public void setUp() {
        mockdata = new MockTimeSeries(
                29.49, 28.30, 27.74, 27.65, 27.60, 28.70, 28.60,
                28.19, 27.40, 27.20, 27.28, 27.00, 27.59, 26.20,
                25.75, 24.75, 23.33, 24.45, 24.25, 25.02, 23.60,
                24.20, 24.28, 25.70, 25.46, 25.10, 25.00, 25.00,
                25.85);
        closePrice = new ClosePriceIndicator(mockdata);
    }

    @Test
    public void testGetTotalReturn() {
        PeriodicalGrowthRateIndicator gri = new PeriodicalGrowthRateIndicator(this.closePrice, 5);
        double expResult = 0.9564;
        double result = gri.getTotalReturn();
        assertEquals(expResult, result, 0.01);
    }

    @Test
    public void testCalculation() {
        PeriodicalGrowthRateIndicator gri = new PeriodicalGrowthRateIndicator(this.closePrice,5);

        assertEquals(gri.getValue(0), Decimal.NaN);
        assertEquals(gri.getValue(4), Decimal.NaN);
        assertDecimalEquals(gri.getValue(5), -0.0268);
        assertDecimalEquals(gri.getValue(6), 0.0541);
        assertDecimalEquals(gri.getValue(10), -0.0495);
        assertDecimalEquals(gri.getValue(21), 0.2009);
        assertDecimalEquals(gri.getValue(24), 0.0220);
        assertEquals(gri.getValue(25), Decimal.NaN);
        assertEquals(gri.getValue(26), Decimal.NaN);
    }

    @Test
    public void testStrategies() {

        PeriodicalGrowthRateIndicator gri = new PeriodicalGrowthRateIndicator(this.closePrice,5);

        // Rules
        Rule buyingRule = new CrossedUpIndicatorRule(gri, Decimal.ZERO);
        Rule sellingRule = new CrossedDownIndicatorRule(gri, Decimal.ZERO);

        Strategy strategy = new Strategy(buyingRule, sellingRule);

        // Check trades
        int result = mockdata.run(strategy).getTradeCount();
        int expResult = 3;

        assertEquals(expResult, result);
    }
}