text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:background="@color/Background"
    android:layout_height="match_parent"

    android:orientation="vertical" >

        <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:fillViewport="true" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="center_horizontal"
        android:orientation="vertical"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" >

      <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvDrname"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:text="@string/DrName"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#384248"
                android:textSize="16sp"
                android:typeface="monospace" />

            <EditText
                android:id="@+id/etDrName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:inputType="text"
                android:textColor="#384248" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvDate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:text="@string/date"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#384248"
                android:textSize="16sp"
                android:typeface="monospace" />

            <EditText
                android:id="@+id/etDate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:inputType="date"
                android:textColor="#384248" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvTime"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:text="@string/time"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#384248"
                android:textSize="16sp"
                android:typeface="monospace" />

            <EditText
                android:id="@+id/etTime"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:inputType="time"
                android:textColor="#384248" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tvPurpose"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:text="@string/purpose"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#384248"
                android:textSize="16sp"
                android:typeface="monospace" />

            <EditText
                android:id="@+id/etPurpose"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:inputType="textMultiLine"
                android:textColor="#384248" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/tvLocation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:text="@string/location"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#384248"
                android:textSize="16sp"
                android:typeface="monospace" />

            <EditText
                android:id="@+id/etLocation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:inputType="textMultiLine"
                android:textColor="#384248" />
        </LinearLayout>

        <CheckBox
            android:id="@+id/cbAlarm"
            android:layout_width="wrap_content"
            android:layout_gravity="left"
            android:layout_height="wrap_content"
            android:text="@string/setalarm"
            android:textColor="#384248" />

    </LinearLayout>

    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        android:layout_gravity="bottom|center_vertical" >

        <Button
            android:id="@+id/btnSave"
            android:layout_width="match_parent"
            android:maxHeight="80dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_vertical"
            android:background="@color/DarkRed"
            android:text="@string/save"
            android:textColor="#FFFFFF"
            android:typeface="monospace" />
    </LinearLayout>

</LinearLayout>


text:
var browser = require( 'browser-specific' );

// Include the stylesheets
require( './eradicate.css' );

var forEach = require('lodash/collection/foreach');

var React = require('react');

var NewsFeedEradicator = require('./components/index.jsx');

// This delay ensures that the elements have been created by Facebook's
// scripts before we attempt to replace them
setTimeout(function(){
	// Add News Feed Eradicator display
	var streamContainer = document.getElementById('stream_pagelet');
	var nfeContainer = document.createElement("div");
	nfeContainer.id = "nfe-container";
	streamContainer.appendChild(nfeContainer);

	// Delete the stream to prevent its infinite scroll infinitely loading
	// new stories (even though they are hidden)
	var streamMatcher = /^topnews_main_stream/;
	forEach(streamContainer.children, (child) => {
		if(streamMatcher.test(child.id)) {
			streamContainer.removeChild(child);

			// Exit the foreach
			return false;
		}
	});

	React.render(
		React.createElement(NewsFeedEradicator, null),
		nfeContainer
	);
}, 1000);

redpajama_set_name: RedPajamaGithub


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#include <sstream>
#include <limits>

#include "ifcpp/model/AttributeObject.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/model/BuildingGuid.h"
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/IFC4/include/IfcColourRgb.h"
#include "ifcpp/IFC4/include/IfcSurfaceStyleLighting.h"

// ENTITY IfcSurfaceStyleLighting
IfcSurfaceStyleLighting::IfcSurfaceStyleLighting( int id ) { m_entity_id = id; }
shared_ptr<BuildingObject> IfcSurfaceStyleLighting::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcSurfaceStyleLighting> copy_self( new IfcSurfaceStyleLighting() );
	if( m_DiffuseTransmissionColour ) { copy_self->m_DiffuseTransmissionColour = dynamic_pointer_cast<IfcColourRgb>( m_DiffuseTransmissionColour->getDeepCopy(options) ); }
	if( m_DiffuseReflectionColour ) { copy_self->m_DiffuseReflectionColour = dynamic_pointer_cast<IfcColourRgb>( m_DiffuseReflectionColour->getDeepCopy(options) ); }
	if( m_TransmissionColour ) { copy_self->m_TransmissionColour = dynamic_pointer_cast<IfcColourRgb>( m_TransmissionColour->getDeepCopy(options) ); }
	if( m_ReflectanceColour ) { copy_self->m_ReflectanceColour = dynamic_pointer_cast<IfcColourRgb>( m_ReflectanceColour->getDeepCopy(options) ); }
	return copy_self;
}
void IfcSurfaceStyleLighting::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCSURFACESTYLELIGHTING" << "(";
	if( m_DiffuseTransmissionColour ) { stream << "#" << m_DiffuseTransmissionColour->m_entity_id; } else { stream << "$"; }
	stream << ",";
	if( m_DiffuseReflectionColour ) { stream << "#" << m_DiffuseReflectionColour->m_entity_id; } else { stream << "$"; }
	stream << ",";
	if( m_TransmissionColour ) { stream << "#" << m_TransmissionColour->m_entity_id; } else { stream << "$"; }
	stream << ",";
	if( m_ReflectanceColour ) { stream << "#" << m_ReflectanceColour->m_entity_id; } else { stream << "$"; }
	stream << ");";
}
void IfcSurfaceStyleLighting::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_entity_id; }
const std::wstring IfcSurfaceStyleLighting::toString() const { return L"IfcSurfaceStyleLighting"; }
void IfcSurfaceStyleLighting::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map )
{
	const size_t num_args = args.size();
	if( num_args != 4 ){ std::stringstream err; err << "Wrong parameter count for entity IfcSurfaceStyleLighting, expecting 4, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	readEntityReference( args[0], m_DiffuseTransmissionColour, map );
	readEntityReference( args[1], m_DiffuseReflectionColour, map );
	readEntityReference( args[2], m_TransmissionColour, map );
	readEntityReference( args[3], m_ReflectanceColour, map );
}
void IfcSurfaceStyleLighting::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IfcPresentationItem::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "DiffuseTransmissionColour", m_DiffuseTransmissionColour ) );
	vec_attributes.emplace_back( std::make_pair( "DiffuseReflectionColour", m_DiffuseReflectionColour ) );
	vec_attributes.emplace_back( std::make_pair( "TransmissionColour", m_TransmissionColour ) );
	vec_attributes.emplace_back( std::make_pair( "ReflectanceColour", m_ReflectanceColour ) );
}
void IfcSurfaceStyleLighting::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IfcPresentationItem::getAttributesInverse( vec_attributes_inverse );
}
void IfcSurfaceStyleLighting::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcPresentationItem::setInverseCounterparts( ptr_self_entity );
}
void IfcSurfaceStyleLighting::unlinkFromInverseCounterparts()
{
	IfcPresentationItem::unlinkFromInverseCounterparts();
}


text:
$(function(){
  var site = JSON.parse($('#site-config').html()),
      embedTemplate = Handlebars.compile($('#embed-template').html());
      $embedCode = $('#embed-code')
      baseFilters = {};

  $.each(site.filters, function(i, f) {
    baseFilters[f.field] = f.default;
  });

  var $hierarchyMenu = $('#hierarchy-menu'),
      $infobox = $('#infobox'),
      $parent = $('#parent'),
      $filterValues = $('.site-filters .value'),
      treemap = new OSDE.TreeMap('#treemap'),
      table =  new OSDE.Table('#table');

  function getData(drilldown, cut) {
    var cutStr = $.map(cut, function(v, k) { if((v+'').length) { return site.keyrefs[k] + ':' + v; }});
    var drilldowns = [site.keyrefs[drilldown]]
    if (site.keyrefs[drilldown] != site.labelrefs[drilldown]) {
      drilldowns.push(site.labelrefs[drilldown]);
    }
    return $.ajax({
      url: site.api + '/aggregate',
      data: {
        drilldown: drilldowns.join('|'),
        cut: cutStr.join('|'),
        order: site.aggregate + ':desc',
        page: 0,
        pagesize: 500
      },
      dataType: 'json',
      cache: true
    });
  }

  $('#infobox-toggle').click(function(e) {
    var $e = $(e.target);
    if ($e.hasClass('active')) {
      $e.removeClass('active');
      $infobox.slideUp();
    } else {
      $e.addClass('active');
      $infobox.slideDown();
    }
    return false;
  });

  function parsePath(hash) {
    var path = {},
        location = hash.split('/'),
        levels = location.slice(1, location.length-1);

    path.hierarchyName = location[0];
    path.hierarchy = site.hierarchies[path.hierarchyName];
    path.hierarchy.cuts = path.hierarchy.cuts || {};
    path.level = levels.length;
    path.root = path.level == 0;
    path.bottom = path.level >= (path.hierarchy.drilldowns.length - 1);
    path.drilldown = path.hierarchy.drilldowns[path.level];
    path.args = OSDE.parseArgs(location[location.length-1]);

    $.each(levels, function(i, val) {
      path.args[path.hierarchy.drilldowns[i]] = decodeURIComponent(val);
    });
    return path;
  }

  function parentUrl(path) {
    if (path.level < 1) {
      return makeUrl(path, null);
    }
    var p = $.extend(true, {}, path);
    $.each(p.hierarchy.drilldowns, function(i, drilldown) {
      if (i >= (p.level-1) ) {
        delete p.args[drilldown];
      }
    });
    return makeUrl(p, {});
  }

  function makeUrl(path, modifiers) {
    var args = $.extend({}, path.args, modifiers),
        url = '#' + path.hierarchyName + '/';

    if (!modifiers) args = {};

    $.each(path.hierarchy.drilldowns, function(i, drilldown) {
      if (args[drilldown]) {
        url += args[drilldown].replace('/','%2F') + '/';
        delete args[drilldown];
      }
    });
    return url + OSDE.mergeArgs(args);
  }

  function update() {
    var rawPath = window.location.hash.substring(1);
    if (!rawPath.length) {
      rawPath = site.default + '/'
    }

    var path = parsePath(rawPath),
        rootDimension = path.hierarchy.drilldowns[0],
        rootColor = null;
        color = d3.scale.ordinal().range(OSDE.categoryColors),
        cuts = $.extend({}, baseFilters, path.hierarchy.cuts || {}, path.args);

    $hierarchyMenu.find('.btn').removeClass('active');
    $hierarchyMenu.find('.btn.' + path.hierarchyName).addClass('active');

    $parent.unbind();
    if (path.root) {
      $parent.hide();
    } else {
      $parent.show();
      $parent.attr('href', parentUrl(path));
    }

    $filterValues.removeClass('active');
    $filterValues.each(function(i, f) {
      var $f = $(f), field = $f.data('field'), value = $f.data('value'), modifiers = {};
      modifiers[field] = value;
      $f.attr('href', makeUrl(path, modifiers));
      if (cuts[field] == value) {
        $f.addClass('active');
      }
    });

    $.each(site.filters, function(i, f) {
      var val = cuts[f.field], label = val;
      $.each(f.values, function(j, v) {
        if (v.key == val) {
          label = v.label;
        }
      });
      $('.site-filters strong[data-field="' + f.field + '"]').html(label || 'Alle');
    });

    var baseCuts = $.extend({}, baseFilters, path.hierarchy.cuts);
    getData(rootDimension, baseCuts).done(function(base) {

      $.each(base.cells, function(i, drilldown) {
        drilldown._color = color(i);
        var rootRef = site.keyrefs[rootDimension];
        if (cuts[rootDimension] && cuts[rootDimension] == drilldown[rootRef]) {
          rootColor = d3.rgb(drilldown._color);
        }
      });

      getData(path.drilldown, cuts).done(function(data) {
        var dimension = path.drilldown;

        if (dimension != rootDimension) {
          color = d3.scale.linear();
          color = color.interpolate(d3.interpolateRgb)
          color = color.range([rootColor.brighter(), rootColor.darker().darker()]);
          color = color.domain([data.total_cell_count, 0]);
        }

        data.summary._value = data.summary[site.aggregate];
        data.summary._value_fmt = OSDE.amount(data.summary._value);

        $.each(data.cells, function(e, cell) {
          cell._current_label = cell[site.labelrefs[dimension]];
          cell._current_key = cell[site.keyrefs[dimension]];
          cell._value = cell[site.aggregate];
          cell._value_fmt = OSDE.amount(cell._value);
          cell._percentage = cell[site.aggregate] / data.summary[site.aggregate];
          cell._small = cell._percentage < 0.01;
          cell._percentage_fmt = (cell._percentage * 100).toFixed(2) + '%';
          cell._percentage_fmt = cell._percentage_fmt.replace('.', ',');

          if (!path.bottom) {
            var modifiers = {};
            modifiers[dimension] = cell._current_key;
            cell._url = makeUrl(path, modifiers);
          } else {
            cell._no_url = true;
          }
          cell._color = color(e);

        });

        treemap.render(data, path.drilldown);
        table.render(data, path.drilldown);
      });
    });
    $embedCode.text(embedTemplate({
      name: site.name,
      baseurl: document.location.href.split('#')[0],
      url: document.location.href,
      hash: document.location.hash,
    }));
  }

  hashtrack.onhashchange(update);
});


text:
using System.Reflection;

[assembly: AssemblyMetadata("StartDate", "2015-12-02")]


text:
<?xml version="1.0" encoding="utf-8"?>

<!--
  - Copyright (c) 2016 Affectiva Inc.
  - See the file license.txt for copying permission.
  -->

<resources>

    <style name="optionsStyle">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">@color/letter_gray</item>
        <item name="android:textSize">@dimen/menu_text_size</item>
        <item name="android:textStyle">bold</item>
    </style>
</resources>


text:
@class CountryViewController;
@protocol CountryViewControllerDelegate <NSObject>
- (void)yf_countryViewControllerGetCountryInfo:(NSDictionary *)dict;
@end
@interface CountryViewController : BaseViewController
@property (nonatomic,assign) id <CountryViewControllerDelegate> delegate;

@end


text:
// Clarity Positioning functionality

/// <reference path="./clarity.ts" />
/// <reference path="./sidepane.ts" />

namespace clarity.positioning {
	export var HeaderHeight: number;
	export var HeaderIsMini: boolean;

	export function Init() {
		clarity.positioning.HeaderIsMini = clarity.Header.hasAttribute("data-site-type");
		clarity.positioning.HeaderHeight = clarity.Header.getClientRects()[0].height;

		document.onscroll = clarity.positioning.ChangeToggleButtonTone;
		window.onresize = clarity.positioning.ResizeHandler;
	}

	/**
	 * ResizeHandler
	 */
	export function ResizeHandler() {
		clarity.positioning.HeaderHeight = clarity.Header.getClientRects()[0].height;
	}

	/**
	 * ChangeToggleButtonTone will
	 */
	export function ChangeToggleButtonTone() {
		if (!clarity.positioning.HeaderIsMini) { // If the header is not mini
			let scrolledPassedHeader = (window.scrollY > (clarity.positioning.HeaderHeight * 0.8));
			let toggleButtonIsInverted = clarity.sidepane.ToggleButton.hasAttribute("data-site-type");

			if (scrolledPassedHeader && !toggleButtonIsInverted) { // If we've scrolled more than 80% down passed the header and we've not already inverted
				clarity.sidepane.ToggleButton.setAttribute("data-site-type", "invert"); // Invert the button
			} else if (!scrolledPassedHeader && toggleButtonIsInverted) { // If we've not scrolled past the header and the button IS inverted
				clarity.sidepane.ToggleButton.removeAttribute("data-site-type"); // Remove the invert
			}
		}
	}
}


text:
One of main features of the Styx server available for users is an admin interface available "out of the box".
It provides an HTTP interface with functionality that ease quick adaptation of the library.
Note that this endpoint must be externally secured.

## Endpoints available in the admin module
* POST interface with set of predefined admin commands (see [section below](#postinterface)).

* `Dashboard` - visual dashboard that shows the health of the server and origins.

* `Plugins` - list of plugin extensions and the admin endpoints they expose (if applicable).

* `Metrics` - Styx performance metrics as a JSON document.

* `JVM` - a subset of metrics specifically related to the underlying JVM usage statistics.

* `Configuration` - Styx server configuration settings.

* `Origins Configuration` - origin services configuration as a JSON document.

* `Origins Status` - origins status as a JSON document.

* `Log Configuration` - logging configuration.

* `Ping` - simple health-check for the server - returns "pong" if Styx is running.

* `Health Check`, `Status` - health-checks based on HTTP 500 rate from origins.

* `Threads` - a stack trace dump from all threads.

* `Current Request` - shows the state of proxied HTTP requests inside Styx.
   A stack trace is shown if the request is being processed in the interceptor pipeline.
   This feature must be activated by `requestTracking` flag in the Styx configuration.

All endpoints are available from the admin menu:

`http://<STYX_SERVER_URL>/admin/`

##### NOTE:
Endpoints that return `JSON` documents are compressed by default. To display documents prettified, the
`?pretty` option as an additional query parameter should be used:

* `http://<STYX_SERVER_URL>/admin/metrics?pretty`

## POST interface

The following commands can be sent to the Styx admin interface with HTTP POST requests.

### Reload Origins

This command will cause Styx to reload the origins if the file has meaningfully changed.
If the file has not changed,or the changes are purely cosmetic (such as adding comments),
no action will be taken.

#### Syntax:

`http://<STYX_SERVER_URL>/admin/tasks/origins/reload`

#### Parameters:

* `STYX_SERVER_URL`: The host and port of the Styx Admin Interface

#### How to execute command using curl:

`curl -X POST http://<STYX_SERVER_URL>/admin/tasks/origins/reload`

So if Styx was on port 8080 on localhost:

`curl -X POST http://localhost:8080/admin/tasks/origins/reload`

### Origin Toggle

#### Enable Origin

The `enable_origin` command will enable a disabled origin. If health checks are enabled, the origin will initially be
inactive and will be activated upon a successful health check. If health checks are disabled, the origin will be
active immediately.

##### Syntax:

`http://<STYX_SERVER_URL>/admin/tasks/origins?cmd=enable_origin&appId=<APP_ID>&originId=<ORIGIN_ID>`

##### Parameters:

* `STYX_SERVER_URL`: The host and port of the Styx Admin Interface
* `APP_ID`: The backend service the origin belongs to
* `ORIGIN_ID`: An origin to enable

##### How to execute command using curl:

`curl -X POST http://<STYX_SERVER_URL>/admin/tasks/origins?cmd=enable_origin&appId=<APP_ID>&originId=<ORIGIN_ID>`

So if Styx was on port 8080 on localhost and you wanted to enable an origin called "hwa1" for a backend service called "hwa":

`curl -X POST http://localhost:8080/admin/tasks/origins?cmd=enable_origin&appId=hwa&originId=hwa1`

#### Disable Origin

The `disable_origin` command will disable an enabled origin.

##### Syntax:

`http://<STYX_SERVER_URL>/admin/tasks/origins?cmd=disable_origin&appId=<APP_ID>&originId=<ORIGIN_ID>`

##### Parameters:

* `STYX_SERVER_URL`: The host and port of the Styx Admin Interface
* `APP_ID`: The backend service the origin belongs to
* `ORIGIN_ID`: An origin to disable

##### How to execute command using curl:

`curl -X POST http://<STYX_SERVER_URL>/admin/tasks/origins?cmd=disable_origin&appId=<APP_ID>&originId=<ORIGIN_ID>`

So if Styx was on port 8080 on localhost and you wanted to disable an origin called "hwa1" for a backend service called "hwa":

`curl -X POST http://localhost:8080/admin/tasks/origins?cmd=disable_origin&appId=hwa&originId=hwa1`

### Enable/Disable Plugins

Plugins can be enabled and disabled using POST commands.

#### Syntax:

`http://<STYX_SERVER_URL>/admin/tasks/plugin/<PLUGIN_NAME>/enabled`

#### Parameters:

* `PLUGIN_NAME`: The host and port of the Styx Admin Interface
* The requested state should be sent in a request body with value: `true`/`false`

#### How to execute command using curl:

If Styx was on port 8080 on localhost and you wanted to disable a plugin called "rewrite":

`curl -X POST --data "false" http://localhost:8080/admin/tasks/plugin/rewrite/enabled`

## Plugins extensions

#### Syntax

`http://<STYX_SERVER_URL>/admin/plugins`

This endpoint displays all plugins available in Styx with their library versions. Each plugin
can register additional, custom admin extensions which will be visible here. For more details, please
refer to [Plugins](../developer-guide/plugins.md)

## GUI dashboard

#### Syntax
`http://<STYX_SERVER_URL>/admin/dashboard/index.html`

Dashboard provides a visual representation of the origins health. It lists all configured origins providing
information about the status of the underlying connection to each origin. Using this dashboard you can quickly
observe whether the origin is reachable, what is the quality of a connection, etc.

It also provides summarized information about error codes in current server uptime, both for the response
from origins and from Styx.

## Styx performance metrics

#### Syntax

`http://<STYX_SERVER_URL>/admin/metrics`

Returns JSON document with server metrics (from Dropwizard Metrics) gathered in-memory by server instance.
For more information on the concrete metrics, please refer to [Metrics](metrics.md)
 and [Metrics Reference](metrics-reference.md) documents.

## JVM metrics

#### Syntax

`http://<STYX_SERVER_URL>/admin/jvm`

Subset of metrics exposed by JVM that is running the Styx server instance.

## Server Configuration
#### Syntax

`http://<STYX_SERVER_URL>/admin/configuration`

This endpoint returns a textual representation of the settings configured in the running server instance.
For more details about the content of this document please refer to [Configure overview](configure-overview.md).

## Origin services configuration

#### Syntax

`http://<STYX_SERVER_URL>/admin/configuration/origins`

## Origins status

#### Syntax

 `http://<STYX_SERVER_URL>/admin/origins/status`

This endpoint provides  similar information to the GUI dashboard but in document form. It contains
a list of configured backend services and the status of their underlying servers, stating which one are inactive
and which ones are disabled.

## Logging configuration

#### Syntax

`http://<STYX_SERVER_URL>/admin/logging`

The document returned by this endpoint presents the configuration used to setup the logging framework.

## Health checks

#### Syntax

`http://<STYX_SERVER_URL>/admin/ping`

This endpoint returns `pong` when the server is running, without performing any checks regarding the status.

## Running threads

#### Syntax

`http://<STYX_SERVER_URL>/admin/threads`

This endpoint reports threads and their statuses running on the server.


text:
<!DOCTYPE HTML>

<title>Source code</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="source: package: com.restfb.types.whatsapp.platform.message, class: Error">
<meta name="generator" content="javadoc/SourceToHTMLConverter">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

001// Generated by delombok at Tue Sep 27 22:25:18 CEST 2022
002
023package com.restfb.types.whatsapp.platform.message;
024
025import com.restfb.Facebook;
026import com.restfb.types.AbstractFacebookType;
027
028public class Error extends AbstractFacebookType {
029  @Facebook
030  private String code;
031  @Facebook
032  private String title;
033  @Facebook
034  private String details;
035
036  @java.lang.SuppressWarnings("all")
037  public String getCode() {
038    return this.code;
039  }
040
041  @java.lang.SuppressWarnings("all")
042  public void setCode(final String code) {
043    this.code = code;
044  }
045
046  @java.lang.SuppressWarnings("all")
047  public String getTitle() {
048    return this.title;
049  }
050
051  @java.lang.SuppressWarnings("all")
052  public void setTitle(final String title) {
053    this.title = title;
054  }
055
056  @java.lang.SuppressWarnings("all")
057  public String getDetails() {
058    return this.details;
059  }
060
061  @java.lang.SuppressWarnings("all")
062  public void setDetails(final String details) {
063    this.details = details;
064  }
065}


text:
require "spec_helper"

describe PaymentMailer do
  before do
    @ec = FactoryBot.create(:event_configuration, long_name: "NAUCC 2140")
  end

  describe "ipn_received" do
    let(:mail) { described_class.ipn_received("something") }

    it "renders the headers" do
      Rails.configuration.error_emails = ["robin+e@dunlopweb.com"]
      expect(mail.subject).to eq("Ipn received")
      expect(mail.to).to eq(["robin+e@dunlopweb.com"])
      expect(mail.from).to eq(["from@example.com"])
    end

    it "renders the body" do
      expect(mail.body.encoded).to match("something")
    end
  end

  describe "coupon_used" do
    let(:payment) { FactoryBot.create(:payment, completed: true) }
    let!(:payment_detail) { FactoryBot.create(:payment_detail, amount: 10, payment: payment) }
    let!(:coupon_code) { FactoryBot.create(:coupon_code, inform_emails: "a@b.c") }
    let!(:payment_detail_coupon_code) do
      FactoryBot.create(:payment_detail_coupon_code,
                        payment_detail: payment_detail,
                        coupon_code: coupon_code)
    end

    it "sends to inform_emails" do
      mail = described_class.coupon_used(payment_detail)
      expect(mail.to).to eq(["a@b.c"])
    end
  end

  describe "payment_completed" do
    let(:payment) { FactoryBot.create(:payment, completed: true) }
    let!(:payment_detail) { FactoryBot.create(:payment_detail, amount: 10, payment: payment) }

    before do
      payment.reload
      Rails.configuration.payment_notice_email = "robin+p@dunlopweb.com"
      @mail = described_class.payment_completed(payment)
    end

    it "renders the headers" do
      expect(@mail.subject).to eq("Payment Completed")
      expect(@mail.to).to eq([payment.user.email])
      expect(@mail.bcc).to eq(["robin+p@dunlopweb.com"])
      expect(@mail.from).to eq(["from@example.com"])
    end

    it "assigns the total_amount" do
      expect(@mail.body).to match(/A payment for \$10.00 USD has been received/)
    end
    it "assigns the full-event-name to @event_name" do
      expect(@mail.body).to match(/NAUCC 2140 - Payment Received/)
    end
  end
end


text:
package io.reactivex.internal.operators.observable;

import io.reactivex.internal.functions.ObjectHelper;
import java.util.concurrent.atomic.*;

import io.reactivex.*;
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.Exceptions;
import io.reactivex.functions.Function;
import io.reactivex.internal.disposables.*;
import io.reactivex.observers.*;
import io.reactivex.plugins.RxJavaPlugins;

public final class ObservableDebounce<T, U> extends AbstractObservableWithUpstream<T, T> {
    final Function<? super T, ? extends ObservableSource<U>> debounceSelector;

    public ObservableDebounce(ObservableSource<T> source, Function<? super T, ? extends ObservableSource<U>> debounceSelector) {
        super(source);
        this.debounceSelector = debounceSelector;
    }

    @Override
    public void subscribeActual(Observer<? super T> t) {
        source.subscribe(new DebounceObserver<T, U>(new SerializedObserver<T>(t), debounceSelector));
    }

    static final class DebounceObserver<T, U>
    implements Observer<T>, Disposable {
        final Observer<? super T> downstream;
        final Function<? super T, ? extends ObservableSource<U>> debounceSelector;

        Disposable upstream;

        final AtomicReference<Disposable> debouncer = new AtomicReference<Disposable>();

        volatile long index;

        boolean done;

        DebounceObserver(Observer<? super T> actual,
                Function<? super T, ? extends ObservableSource<U>> debounceSelector) {
            this.downstream = actual;
            this.debounceSelector = debounceSelector;
        }

        @Override
        public void onSubscribe(Disposable d) {
            if (DisposableHelper.validate(this.upstream, d)) {
                this.upstream = d;
                downstream.onSubscribe(this);
            }
        }

        @Override
        public void onNext(T t) {
            if (done) {
                return;
            }

            long idx = index + 1;
            index = idx;

            Disposable d = debouncer.get();
            if (d != null) {
                d.dispose();
            }

            ObservableSource<U> p;

            try {
                p = ObjectHelper.requireNonNull(debounceSelector.apply(t), "The ObservableSource supplied is null");
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                dispose();
                downstream.onError(e);
                return;
            }

            DebounceInnerObserver<T, U> dis = new DebounceInnerObserver<T, U>(this, idx, t);

            if (debouncer.compareAndSet(d, dis)) {
                p.subscribe(dis);
            }
        }

        @Override
        public void onError(Throwable t) {
            DisposableHelper.dispose(debouncer);
            downstream.onError(t);
        }

        @Override
        public void onComplete() {
            if (done) {
                return;
            }
            done = true;
            Disposable d = debouncer.get();
            if (d != DisposableHelper.DISPOSED) {
                @SuppressWarnings("unchecked")
                DebounceInnerObserver<T, U> dis = (DebounceInnerObserver<T, U>)d;
                if (dis != null) {
                    dis.emit();
                }
                DisposableHelper.dispose(debouncer);
                downstream.onComplete();
            }
        }

        @Override
        public void dispose() {
            upstream.dispose();
            DisposableHelper.dispose(debouncer);
        }

        @Override
        public boolean isDisposed() {
            return upstream.isDisposed();
        }

        void emit(long idx, T value) {
            if (idx == index) {
                downstream.onNext(value);
            }
        }

        static final class DebounceInnerObserver<T, U> extends DisposableObserver<U> {
            final DebounceObserver<T, U> parent;
            final long index;
            final T value;

            boolean done;

            final AtomicBoolean once = new AtomicBoolean();

            DebounceInnerObserver(DebounceObserver<T, U> parent, long index, T value) {
                this.parent = parent;
                this.index = index;
                this.value = value;
            }

            @Override
            public void onNext(U t) {
                if (done) {
                    return;
                }
                done = true;
                dispose();
                emit();
            }

            void emit() {
                if (once.compareAndSet(false, true)) {
                    parent.emit(index, value);
                }
            }

            @Override
            public void onError(Throwable t) {
                if (done) {
                    RxJavaPlugins.onError(t);
                    return;
                }
                done = true;
                parent.onError(t);
            }

            @Override
            public void onComplete() {
                if (done) {
                    return;
                }
                done = true;
                emit();
            }
        }
    }
}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { LazyRoutingModule } from './lazy-routing.module';
import { LazyComponent } from './lazy.component';

@NgModule({
  declarations: [LazyComponent],
  imports: [CommonModule, LazyRoutingModule],
})
export class LazyModule {}


text:
from __future__ import absolute_import

from structlog import get_logger

class LoggingFormat(object):
    HUMAN = "human"
    MACHINE = "machine"

def bind(name, **kwargs):
    """
    Syntactic sugar for binding arbitrary kv pairs to a given logger instantiated from
    logging.getLogger instead of structlog.get_logger.
    """
    return get_logger(name=name).bind(**kwargs)

def unbind(name, *keys):
    try:
        get_logger(name=name).unbind(*keys)
    except KeyError:
        pass


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>com.ox</groupId>
    <artifactId>ox</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <dependencies>
        <!--jackson json格式转化-->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>1.9.12</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>ox</finalName>
        <defaultGoal>compile</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <bootclasspath>${java.home}\lib\rt.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>Releases</name>
            <url>http://192.168.88.84:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Snapshots</name>
            <url>http://192.168.88.84:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
    <repositories>
        <repository>
            <id>snapshots</id>
            <name>Snapshots</name>
            <url>http://192.168.88.84:8081/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>snapshots</id>
            <name>Snapshots</name>
            <url>http://192.168.88.84:8081/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>


text:
package org.springframework.cloud.sleuth.benchmarks.jmh;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import brave.Tracing;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.TearDown;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.sleuth.benchmarks.app.stream.SleuthBenchmarkingStreamApplication;
import org.springframework.cloud.stream.binder.test.InputDestination;
import org.springframework.cloud.stream.binder.test.OutputDestination;
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.StringUtils;

import static org.assertj.core.api.Assertions.assertThat;

@Disabled
public class SampleTests {

	@Test
	public void testStream() throws Exception {
		for (BenchmarkContext.Instrumentation value : BenchmarkContext.Instrumentation.values()) {
			run(value);
		}
		// run(BenchmarkContext.Instrumentation.sleuthReactiveSimpleManual);
	}

	private void run(BenchmarkContext.Instrumentation value) throws Exception {
		BenchmarkContext context = new BenchmarkContext();
		System.out.println("\n\n\n\n WILL WORK WITH [" + value + "]\n\n\n\n");
		context.instrumentation = value;
		context.setup();

		try {
			context.run(value);
		}
		finally {
			context.clean();
		}
		System.out.println("\n\n FINISHED WITH [" + value + "]\n\n\n\n");
	}

	public static class BenchmarkContext {

		volatile ConfigurableApplicationContext applicationContext;

		volatile InputDestination input;

		volatile OutputDestination output;

		@Param
		private Instrumentation instrumentation;

		@Setup
		public void setup() {
			this.applicationContext = initContext();
			this.input = this.applicationContext.getBean(InputDestination.class);
			this.output = this.applicationContext.getBean(OutputDestination.class);
		}

		protected ConfigurableApplicationContext initContext() {
			SpringApplication application = new SpringApplicationBuilder(SleuthBenchmarkingStreamApplication.class)
					.web(WebApplicationType.REACTIVE).application();
			return application.run(runArgs());
		}

		protected String[] runArgs() {
			List<String> strings = new ArrayList<>();
			strings.addAll(Arrays.asList("--spring.jmx.enabled=false",
					"--spring.application.name=defaultTraceContextForStream" + instrumentation.name()));
			strings.addAll(instrumentation.entires.stream().map(s -> "--" + s).collect(Collectors.toList()));
			return strings.toArray(new String[0]);
		}

		void run(Instrumentation value) {
			System.out.println("Sending the message to input");
			input.send(MessageBuilder.withPayload("hello".getBytes())
					.setHeader("b3", "4883117762eb9420-4883117762eb9420-1").build());
			System.out.println("Retrieving the message for tests");
			Message<byte[]> message = output.receive(200L);
			System.out.println("Got the message from output");
			assertThat(message).isNotNull();
			System.out.println("Message is not null");
			assertThat(message.getPayload()).isEqualTo("HELLO".getBytes());
			System.out.println("Payload is HELLO");
			if (!value.toString().toLowerCase().contains("nosleuth")) {
				String b3 = message.getHeaders().get("b3", String.class);
				System.out.println("Checking the b3 header [" + b3 + "]");
				assertThat(b3).startsWith("4883117762eb9420");
			}
		}

		@TearDown
		public void clean() throws Exception {
			Tracing current = Tracing.current();
			if (current != null) {
				current.close();
			}
			try {
				this.applicationContext.close();
			}
			catch (Exception ig) {

			}
		}

		public enum Instrumentation {

			noSleuthSimple("spring.sleuth.enabled=false,spring.sleuth.function.type=simple");

			private Set<String> entires = new HashSet<>();

			Instrumentation(String key, String value) {
				this.entires.add(key + "=" + value);
			}

			Instrumentation(String commaSeparated) {
				this.entires.addAll(StringUtils.commaDelimitedListToSet(commaSeparated));
			}

		}

	}

	@Configuration(proxyBeanMethods = false)
	@Import(TestChannelBinderConfiguration.class)
	static class TestConfiguration {

	}

}


text:
                {{ file.translations | getTranslation:langCode:'title' }}

                  <button file-translation-delete-button
                          translation-id="{{ activeTranslation.id }}"
                          file-id="{{file.id}}"
                          class="btn btn-danger">
                       {{ "DELETE_TRANSLATION" | translate }}
                  </button>
                  <button ui-sref="files.edit.details({ fileId: file.id, langCode: langCode })"
                          type="button" class="btn btn-primary">
                      {{ 'EDIT' | translate }}
                  </button>

                {{ 'NO_TRANSLATION' | translate }}
                <button ui-sref="files.addTranslation({ fileId: file.id, langCode: langCode })"
                        type="button" class="btn btn-warning pull-right">
                     {{ 'NO_TRANSLATION_BUTTON' | translate }}
                </button>

                            {{ file.translations | getTranslation:langCode:'description' }}

                            {{ 'NO_FILE_DESCRIPTION_TRANSLATION_INFO' | translate }}


text:
/**
 * The Element interface represents an object within a DOM document.
 * This interface describes methods and properties common to all kinds of elements.
 * Specific behaviors are described in interfaces which inherit from Element but add additional functionality.
 *
 * @see https://developer.mozilla.org/en/docs/Web/API/Event
 */
"use strict";

var _createClass = require("babel-runtime/helpers/create-class")["default"];

var _classCallCheck = require("babel-runtime/helpers/class-call-check")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
/** @class Event
* @param type */
var Event = (function () {
  /**
   * @param {string} type
   */

  function Event(type) {
    _classCallCheck(this, Event);

    /**
     * A boolean indicating whether the event bubbles up through the DOM or not.
     * @type {boolean}
     * @readonly
     */
    this.bubbles = false;

    /**
     * A boolean indicating whether the event is cancelable.
     * @type {boolean}
     * @readonly
     */
    this.cancelable = false;

    /**
     * A reference to the currently registered target for the event.
     * @type {HTMLElement}
     * @readonly
     */
    this.currentTarget = false;

    /**
     * Indicates whether or not event.preventDefault() has been called on the event.
     * @type {boolean}
     * @readonly
     */
    this.defaultPrevented = false;

    /**
     * Indicates which phase of the event flow is being processed.
     * @type {number}
     * @readonly
     */
    this.eventPhase = 0;

    /**
     * A reference to the target to which the event was originally dispatched.
     * @type {HTMLElement}
     * @readonly
     */
    this.target = null;

    /**
     * The time that the event was created.
     * @type {number}
     * @readonly
     */
    this.timeStamp = Date.now() * 1000;

    /**
     * The name of the event (case-insensitive).
     * @type {string}
     * @readonly
     */
    this.type = type.toLowerCase();

    /**
     * Indicates whether or not the event was initiated by the browser (after a user click for instance)
     * or by a script (using an event creation method)
     * @type {boolean}
     * @readonly
     */
    this.isTrusted = false;
  }

  /**

  * @memberof Event
  * @instance
  * @method preventDefault */

  _createClass(Event, [{
    key: "preventDefault",
    value: function preventDefault() {
      this.defaultPrevented = true;
    }

    /**

    * @memberof Event
    * @instance
    * @method stopImmediatePropagation */
  }, {
    key: "stopImmediatePropagation",
    value: function stopImmediatePropagation() {
      this.immediatePropagationStopped = true;
      this.stopPropagation();
    }

    /**

    * @memberof Event
    * @instance
    * @method stopPropagation */
  }, {
    key: "stopPropagation",
    value: function stopPropagation() {
      this.propagationStopped = true;
    }

    /**
     * @return {boolean}

    * @memberof Event
    * @instance
    * @method isImmediatePropagationStopped */
  }, {
    key: "isImmediatePropagationStopped",
    value: function isImmediatePropagationStopped() {
      return this.immediatePropagationStopped;
    }
  }]);

  return Event;
})();

exports["default"] = Event;
module.exports = exports["default"];
//# sourceMappingURL=Event.js.map


text:
package com.google.bitcoin.core;

import java.math.BigInteger;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: HashEngineering
 * Date: 8/13/13
 * Time: 7:23 PM
 * To change this template use File | Settings | File Templates.
 */
public class CoinDefinition {

    public static final String coinName = "Smileycoin";
    public static final String coinTicker = "SMLY";
    public static final String coinURIScheme = "smileycoin";
    public static final String cryptsyMarketId = "26";
    public static final String cryptsyMarketCurrency = "BTC";
    public static final String PATTERN_PRIVATE_KEY_START = "6";
    public static final String PATTERN_PRIVATE_KEY_START_COMPRESSED = "[Q]";
    public static final String PATTERN_PRIVATE_KEY_START_TESTNET = "9";
    public static final String PATTERN_PRIVATE_KEY_START_COMPRESSED_TESTNET = "c";

    public static String lowerCaseCoinName() { return coinName.toLowerCase(); }

    public enum CoinPrecision {
        Coins,
        Millicoins,
    }
    public static final CoinPrecision coinPrecision = CoinPrecision.Coins;

    public static final String BLOCKEXPLORER_BASE_URL_PROD = "https://coinplorer.com/SMLY/";    //blockr.io
    public static final String BLOCKEXPLORER_ADDRESS_PATH = "Addresses/";             //blockr.io path
    public static final String BLOCKEXPLORER_TRANSACTION_PATH = "Transactions/";              //blockr.io path
    public static final String BLOCKEXPLORER_BLOCK_PATH = "Blocks/";                 //blockr.io path
    public static final String BLOCKEXPLORER_BASE_URL_TEST = BLOCKEXPLORER_BASE_URL_PROD;

    public static final String DONATION_ADDRESS = "BGs1L33mgDz8mUAE5h3bgmuo7s9r5Et8ne";  //NEW Smileycoin donation address

    public static final String UNSPENT_API_URL = "http://dgc.blockr.io/api/v1/address/unspent/"; // What is the smiley equivalent???
    public enum UnspentAPIType {
        BitEasy,
        Blockr,
        Abe
    };
    public static final UnspentAPIType UnspentAPI = UnspentAPIType.Blockr;

    enum CoinHash {
        SHA256,
        scrypt,
    };
    public static final CoinHash coinPOWHash = CoinHash.scrypt;

    public static boolean checkpointFileSupport = true;
    public static int checkpointDaysBack = 21;
    //Original Values

    public static final int TARGET_TIMESPAN = (int)(5 * 24 * 60 * 60);  // 72 minutes per difficulty cycle, on average.
    public static final int TARGET_SPACING = (int)(3 * 60);  // 40 seconds per block.
    public static final int INTERVAL = TARGET_TIMESPAN / TARGET_SPACING;  //108 blocks

    private static int nDifficultySwitchHeight = 476280;    //retarget every 108 instead of 1080 blocks; adjust by +100%/-50% instead of +400/-75%
    private static int nInflationFixHeight = 523800;        //increase block time to 40 from 20 seconds; decrease reward from 20 to 15 DGC
    private static int nDifficultySwitchHeightTwo = 625800; //retarget adjust changed
    public static final int V3_FORK = 1028000;
    public static final int MAX_BLOCK_ALGO_COUNT = 3;

    public static final int getInterval(int height, boolean testNet) {
            return getTargetTimespan(height, testNet) / TARGET_SPACING;
    }
    public static final int getIntervalCheckpoints() {
            return INTERVAL;    //Used to be INTERVAL_0
    }

    public static final int getTargetTimespan(int height, boolean testNet) {
            return height >=97050 ? 3*60*60 //3 hours after 97050 fork
				   : 5*24*60*60; // 5 days before
    }

    public static int getMaxTimeSpan(int value, int height, boolean testNet)
    {
        if(height < nDifficultySwitchHeight)
            return value * 4;
        else if(height < nInflationFixHeight)
            return value * 2;
        else
            return value * 75 / 60;
    }
    public static int getMinTimeSpan(int value, int height, boolean testNet)
    {
        if(height < nDifficultySwitchHeight)
            return value / 4;
        else if(height < nInflationFixHeight)
            return value / 2;
        else
            return value * 55 / 73;
    }

    public static int spendableCoinbaseDepth = 5; //main.h: static const int COINBASE_MATURITY

    public static final BigInteger MAX_MONEY = new BigInteger("50000000000").multiply(Utils.COIN); //BigInteger.valueOf(50000000000).multiply(Utils.COIN);                 //main.h:  MAX_MONEY

    public static final BigInteger DEFAULT_MIN_TX_FEE = BigInteger.valueOf(100000);   // MIN_TX_FEE
    public static final BigInteger DUST_LIMIT = BigInteger.valueOf(1000000); //main.h CTransaction::GetMinFee        0.01 coins      0.01 coins

    public static final int PROTOCOL_VERSION = 70002;          //version.h PROTOCOL_VERSION
    public static final int MIN_PROTOCOL_VERSION = 70002;        //version.h MIN_PROTO_VERSION - eliminate 60001 which are on the wrong fork
    public static final int INIT_PROTO_VERSION = 209;            //version.h

    public static final int BLOCK_CURRENTVERSION = 1;   //CBlock::CURRENT_VERSION
    public static final int MAX_BLOCK_SIZE = 1 * 1000 * 1000;

    public static final boolean supportsBloomFiltering = false; //Requires PROTOCOL_VERSION 70000 in the client
    public static boolean supportsIrcDiscovery() {
        return PROTOCOL_VERSION <= 70000;
    }

    public static final int Port    = 11337;       //protocol.h GetDefaultPort(testnet=false)
    public static final int TestPort = 21337;     //protocol.h GetDefaultPort(testnet=true)

    //
    //  Production
    //
    public static final int AddressHeader = 25;             //base58.h CBitcoinAddress::PUBKEY_ADDRESS
    public static final int p2shHeader = 5;             //base58.h CBitcoinAddress::SCRIPT_ADDRESS
    public static final boolean allowBitcoinPrivateKey = true; //for backward compatibility with previous version of smileycoin
    public static final long PacketMagic = 0xfbc0b6db;      //0xfb, 0xc0, 0xb6, 0xdb

    //Genesis Block Information from main.cpp: LoadBlockIndex
    static public long genesisBlockDifficultyTarget = (0x1e0ffff0L);         //main.cpp: LoadBlockIndex
    static public long genesisBlockTime = 1408974288;                       //main.cpp: LoadBlockIndex
    static public long genesisBlockNonce = (386703170);                         //main.cpp: LoadBlockIndex
    static public String genesisHash = "660f734cf6c6d16111bde201bbd2122873f2f2c078b969779b9d4c99732354fd"; //main.cpp: hashGenesisBlock
    static public int genesisBlockValue = 10000;                                                              //main.cpp: LoadBlockIndex
    //taken from the raw data of the block explorer
    static public String genesisTxInBytes = "04ffff001d0104494e592054696d65732031382f4175672f3230313420426974636f696e27732050726963652046616c6c73203132252c20746f204c6f776573742056616c75652053696e6365204d6179";
    static public String genesisTxOutBytes = "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9";

    //net.cpp strDNSSeed
    static public String[] dnsSeeds = new String[] {
            "dnsseed.smileyco.in",
     };

    public static int minBroadcastConnections = 1;   //0 for default; we need more peers.

    //
    // TestNet - smileycoin - not tested
    //
    public static final boolean supportsTestNet = false;
    public static final int testnetAddressHeader = 111;             //base58.h CBitcoinAddress::PUBKEY_ADDRESS_TEST
    public static final int testnetp2shHeader = 196;             //base58.h CBitcoinAddress::SCRIPT_ADDRESS_TEST
    public static final long testnetPacketMagic = 0xfcc1b7dc;      //0xfc, 0xc1, 0xb7, 0xdc
    public static final String testnetGenesisHash = "660f734cf6c6d16111bde201bbd2122873f2f2c078b969779b9d4c99732354fd";
    static public long testnetGenesisBlockDifficultyTarget = (0x1e0ffff0L);         //main.cpp: LoadBlockIndex
    static public long testnetGenesisBlockTime = 1408974288;                       //main.cpp: LoadBlockIndex
    static public long testnetGenesisBlockNonce = (386703170);                         //main.cpp: LoadBlockIndex

    public static final boolean usingNewDifficultyProtocol(int height)
    { return height >= nDifficultySwitchHeight;}

    public static final boolean usingInflationFixProtocol(int height)
    { return height >= nInflationFixHeight;}

    //main.cpp GetBlockValue(height, fee)
    public static final BigInteger GetBlockReward(int height)
    {
        int COIN = 1;
        BigInteger nSubsidy = Utils.toNanoCoins(1000, 0);

        if(height < 1000)
        {
            nSubsidy = Utils.toNanoCoins(24000000, 0); //2
        }
        else
        {
            return nSubsidy.shiftRight(height / subsidyDecreaseBlockCount);
        }
        return nSubsidy;
    }

    public static int subsidyDecreaseBlockCount = 1226400;     //main.cpp GetBlockValue(height, fee)

    public static BigInteger proofOfWorkLimit = Utils.decodeCompactBits(0x1e0fffffL);  //main.cpp bnProofOfWorkLimit (~uint256(0) >> 20); // smileycoin: starting difficulty is 1 / 2^12

    public static BigInteger [] proofOfWorkLimits = new BigInteger[] {
            proofOfWorkLimit,proofOfWorkLimit,proofOfWorkLimit,proofOfWorkLimit,proofOfWorkLimit };

    public static BigInteger getProofOfWorkLimit(int algo)
    {
        return proofOfWorkLimits[algo];
    }

    static public String[] testnetDnsSeeds = new String[] {
          "not supported"
    };
    //from main.h: CAlert::CheckSignature
    public static final String SATOSHI_KEY = "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9";
    public static final String TESTNET_SATOSHI_KEY = "04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a";

    /** The string returned by getId() for the main, production network where people trade things. */
    public static final String ID_MAINNET = "org.smileycoin.production";
    /** The string returned by getId() for the testnet. */
    public static final String ID_TESTNET = "org.smileycoin.test";
    /** Unit test network. */
    public static final String ID_UNITTESTNET = "com.google.smileycoin.unittest";

    //checkpoints.cpp Checkpoints::mapCheckpoints
    public static void initCheckpoints(Map<Integer, Sha256Hash> checkpoints)
    {
         checkpoints.put( 0, new Sha256Hash("660f734cf6c6d16111bde201bbd2122873f2f2c078b969779b9d4c99732354fd"));
        checkpoints.put( 2000, new Sha256Hash("6c75adede20c70a18ad60bd5f2184f9154edcf94db01514ff9d2d57699d7cbc6"));
        checkpoints.put( 4000, new Sha256Hash("2bf98d7022a4af00395b3e6d59c979939c5bb368505fe2c47e4552e7aa586424"));
        checkpoints.put( 6000, new Sha256Hash("e7310e1f05efae70f0265a156fa9d39151349d27f969b6f94f31cfb8a16af95a"));
     }

    //Unit Test Information
    public static final String UNITTEST_ADDRESS = "DPHYTSm3f96dHRY3VG1vZAFC1QrEPkEQnt";
    public static final String UNITTEST_ADDRESS_PRIVATE_KEY = "QU1rjHbrdJonVUgjT7Mncw7PEyPv3fMPvaGXp9EHDs1uzdJ98hUZ";

}


text:
<?php

require_once dirname(__FILE__) . '/../../../repository/Record.class.php';

/**
 * Imports data from .json encoded fixtures.
 *
 *
All fixtures: ./floe fixtures:load

 *
By name: ./floe fixtures:load books will load dev/fixtures/books.json

 *
 * @package tools
 * @subpackage tasks
 */
class FixturesLoadTask {

	/**
	 * @description load fixtures into the database
	 */
	function process($args) {
		$fixtures = (empty($args)) ? $this->collectAll() : $this->loadFromList($args);

		$db = StorageAdaptor::gateway();
		foreach($fixtures as $table=>$rows) {
			$table = Inflect::toSingular($table);
			$table = Inflect::toTableName($table);
			echo "loading $table\n";
			foreach($rows as $row) {
				$db->insert($table, $row);
			}
		}
	}

	private function loadFromList($list) {
		$fixtures = array();
		foreach($list as $entry) {
			$fixturePath = DEV_DIR.'/fixtures/'.$entry.'.json';
			$fixtures[$entry] = $this->loadFixture($fixturePath);
		}
		return $fixtures;
	}

	private function loadFixture($entry) {
		if (file_exists($entry)) {
			return json_decode(file_get_contents($entry), true);
		} else {
			throw new Exception(basename($entry).' not found.');
		}
	}

	private function collectAll() {
		$fixtures = array();
		$dir = dir(DEV_DIR.'/fixtures/');
		while (false !== ($entry = $dir->read())) {
			preg_match("/([a-z-]+)\.json/", $entry, $matches);
			if ($matches) {
				$fixtures[$matches[1]] = $this->loadFixture(DEV_DIR.'/fixtures/'.$entry);
			}
		}
		return $fixtures;
	}

}


text:
from django.views.generic import TemplateView, View
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger

def my_paginator(self, queryset):
    paginator = Paginator(queryset, 6)
    page = self.request.GET.get('page')
    try:
        photos = paginator.page(page)
    except PageNotAnInteger:
        photos = paginator.page(1)
    except EmptyPage:
        photos = paginator.page(paginator.num_pages)
    return photos

class BaseErrorView(View):

    @classmethod
    def as_error_view(cls):
        v = cls.as_view()

        def view(request):
            r = v(request)
            r.render()
            return r

        return view

class System_403(BaseErrorView, TemplateView):
    template_name = "system/403.html"

class System_404(BaseErrorView, TemplateView):
    template_name = "system/404.html"

class System_500(BaseErrorView, TemplateView):
    template_name = "system/500.html"


text:
var Builtin = require('./builtin');

exports.setClass = function(obj, cls) {
	if (cls) {
		Object.setPrototypeOf(obj, cls.prototype);
	} else {
		Object.setPrototypeOf(obj, null);
	}
};

exports.getClass = function(obj) {
	return obj.__class__;
};

exports.prepareProtoproxy = function(ourProto, prototype) {
	var hasOwnProperty = {}.hasOwnProperty;

	return new Proxy(ourProto, {
		get: function(target, name, receiver) {
			if (name === '__class__') {
				return Reflect.get(target, name, receiver);
			}

			if (hasOwnProperty.call(prototype, name)) {
				return Reflect.get(prototype, name, receiver);
			}

			return Reflect.get(target, name, receiver);
		},
		has: function(target, name) {
			if (hasOwnProperty.call(prototype, name)) {
				return true;
			}

			return Reflect.has(target, name);
		},
		hasOwn: function(target, name) {
			return hasOwnProperty.call(prototype, name);
		},
		getOwnPropertyDescriptor: function(target, name) {
			return Reflect.getOwnPropertyDescriptor(prototype, name);
		},
		ownKeys: function(target) {
			return Reflect.ownKeys(prototype);
		}
	});
};

exports.includeModulesFrom = function(includedModule, klass) {
	var insertAt = klass;
	var mod = includedModule;

	while (mod) {
		if (mod == klass || (mod.instanceOf(IncludedModule) && mod.module == klass)) {
			throw new ArgumentError("cyclic included detected");
		}

		if (Builtin(mod) == Builtin(mod).origin) {
			var superclassSeen = false;
			var add = true;

			var k = klass.directSuperclass;

			while (k) {
				if (k.kindOf(IncludedModule)) {
					if (k.module == mod) {
						if (!superclassSeen) {
							insertAt = k;
						}

						add = false;
						break;
					}
				} else {
					superclassSeen = true;
				}

				k = k.directSuperclass;
			}

			if (add) {
				var originalMod;

				if (mod.kindOf(IncludedModule)) {
					originalMod = mod.module;
				} else {
					originalMod = mod;
				}

				var im = new IncludedModule(originalMod);

				im.attach(insertAt);
				insertAt = im;
			}
		}

		mod = mod.directSuperclass;
	}
};


text:
package service
//
//import (
//	"context"
//	"encoding/json"
//	"fmt"
//	"regexp"
//
//	"github.com/lastbackend/lastbackend/internal/pkg/errors"
//	"github.com/lastbackend/lastbackend/internal/pkg/models"
//	"github.com/lastbackend/lastbackend/internal/pkg/storage"
//	"github.com/lastbackend/lastbackend/tools/log"
//)
//
//const (
//	logRoutePrefix = "distribution:route"
//)
//
//type Route struct {
//	context context.Context
//	storage storage.IStorage
//}
//
//func (r *Route) Runtime() (*models.System, error) {
//
//	log.Debugf("%s:get:> get route runtime info", logRoutePrefix)
//	runtime, err := r.storage.Info(r.context, r.storage.Collection().Pod(), "")
//	if err != nil {
//		log.Errorf("%s:get:> get runtime info error: %s", logRoutePrefix, err)
//		return &runtime.System, err
//	}
//	return &runtime.System, nil
//}
//
//func (r *Route) List() (*models.RouteList, error) {
//
//	log.Debugf("%s:listspec:> list specs", logRoutePrefix)
//
//	list := models.NewRouteList()
//
//	//TODO: change map to list
//	err := r.storage.List(r.context, r.storage.Collection().Route(), models.EmptyString, list, nil)
//	if err != nil {
//		log.Error("%s:listbynamespace:> list route err: %v", logRoutePrefix, err)
//		return list, err
//	}
//
//	return list, nil
//}
//
//func (r *Route) ListByNamespace(namespace string) (*models.RouteList, error) {
//
//	log.Debug("%s:listbynamespace:> list route", logRoutePrefix)
//
//	list := models.NewRouteList()
//
//	err := r.storage.List(r.context, r.storage.Collection().Route(), r.storage.Filter().Route().ByNamespace(namespace), list, nil)
//	if err != nil {
//		log.Error("%s:listbynamespace:> list route err: %v", logRoutePrefix, err)
//		return list, err
//	}
//
//	log.Debugf("%s:listbynamespace:> list route result: %d", logRoutePrefix, len(list.Items))
//
//	return list, nil
//}
//
//func (r *Route) Get(namespace, name string) (*models.Route, error) {
//
//	log.Debug("%s:get:> get route by id %s/%s", logRoutePrefix, namespace, name)
//
//	route := new(models.Route)
//	key := models.NewRouteSelfLink(namespace, name).String()
//
//	err := r.storage.Get(r.context, r.storage.Collection().Route(), key, &route, nil)
//	if err != nil {
//		if errors.Storage().IsErrEntityNotFound(err) {
//			log.Warnf("%s:get:> in namespace %s by name %s not found", logRoutePrefix, namespace, name)
//			return nil, nil
//		}
//
//		log.Errorf("%s:get:> in namespace %s by name %s error: %v", logRoutePrefix, namespace, name, err)
//		return nil, err
//	}
//
//	return route, nil
//}
//
//func (r *Route) Add(namespace *models.Namespace, route *models.Route) (*models.Route, error) {
//
//	log.Debugf("%s:create:> create route %#v", logRoutePrefix, route.Meta.Name)
//
//	route.Status.State = models.StateCreated
//
//	if err := r.storage.Put(r.context, r.storage.Collection().Route(),
//		route.SelfLink().String(), route, nil); err != nil {
//		log.Errorf("%s:create:> insert route err: %v", logRoutePrefix, err)
//		return nil, err
//	}
//
//	return route, nil
//}
//
//func (r *Route) Set(route *models.Route) (*models.Route, error) {
//
//	log.Debugf("%s:update:> update route %s", logRoutePrefix, route.Meta.Name)
//
//	if err := r.storage.Set(r.context, r.storage.Collection().Route(),
//		route.SelfLink().String(), route, nil); err != nil {
//		log.Errorf("%s:update:> update route err: %v", logRoutePrefix, err)
//		return nil, err
//	}
//
//	return route, nil
//}
//
//func (r *Route) Del(route *models.Route) error {
//
//	log.Debugf("%s:remove:> remove route %#v", logRoutePrefix, route)
//
//	if err := r.storage.Del(r.context, r.storage.Collection().Route(),
//		route.SelfLink().String()); err != nil {
//		log.Errorf("%s:remove:> remove route  err: %v", logRoutePrefix, err)
//		return err
//	}
//
//	return nil
//}
//
//func (r *Route) Watch(ch chan models.RouteEvent, rev *int64) error {
//
//	log.Debugf("%s:watch:> watch routes", logRoutePrefix)
//
//	done := make(chan bool)
//	watcher := storage.NewWatcher()
//
//	go func() {
//		for {
//			select {
//			case <-r.context.Done():
//				done <- true
//				return
//			case e := <-watcher:
//				if e.Data == nil {
//					continue
//				}
//
//				res := models.RouteEvent{}
//				res.Action = e.Action
//				res.Name = e.Name
//
//				route := new(models.Route)
//
//				if err := json.Unmarshal(e.Data.([]byte), route); err != nil {
//					log.Errorf("%s:> parse data err: %v", logRoutePrefix, err)
//					continue
//				}
//
//				res.Data = route
//
//				ch <- res
//			}
//		}
//	}()
//
//	opts := storage.GetOpts()
//	if err := r.storage.Watch(r.context, r.storage.Collection().Route(), watcher, opts); err != nil {
//		return err
//	}
//
//	return nil
//}
//
//func (r *Route) ManifestMap(ingress string) (*models.RouteManifestMap, error) {
//	log.Debug("%s:ManifestMap:> get route manifest map by ingress %s", logRoutePrefix, ingress)
//
//	var (
//		mf = models.NewRouteManifestMap()
//	)
//
//	if err := r.storage.Map(r.context, r.storage.Collection().Manifest().Route(ingress), models.EmptyString, mf, nil); err != nil {
//		if !errors.Storage().IsErrEntityNotFound(err) {
//			log.Errorf("%s:ManifestMap:> err: %s", logRoutePrefix, err.Error())
//			return nil, err
//		}
//
//		return nil, nil
//	}
//
//	return mf, nil
//}
//
//func (r *Route) ManifestGet(ingress, route string) (*models.RouteManifest, error) {
//	log.Debug("%s:ManifestGet:> get route manifest by name %s", logRoutePrefix, route)
//
//	var (
//		mf = new(models.RouteManifest)
//	)
//
//	if err := r.storage.Get(r.context, r.storage.Collection().Manifest().Route(ingress), route, &mf, nil); err != nil {
//
//		if errors.Storage().IsErrEntityNotFound(err) {
//			return nil, nil
//		}
//
//		return nil, err
//	}
//
//	return mf, nil
//}
//
//func (r *Route) ManifestAdd(ingress, route string, manifest *models.RouteManifest) error {
//
//	log.Debugf("%s:ManifestAdd:> ", logRoutePrefix)
//
//	if err := r.storage.Put(r.context, r.storage.Collection().Manifest().Route(ingress), route, manifest, nil); err != nil {
//		log.Errorf("%s:ManifestAdd:> err :%s", logRoutePrefix, err.Error())
//		return err
//	}
//
//	return nil
//}
//
//func (r *Route) ManifestSet(ingress, route string, manifest *models.RouteManifest) error {
//	log.Debugf("%s:ManifestSet:> ", logRoutePrefix)
//
//	if err := r.storage.Set(r.context, r.storage.Collection().Manifest().Route(ingress), route, manifest, nil); err != nil {
//		log.Errorf("%s:ManifestSet:> err :%s", logRoutePrefix, err.Error())
//		return err
//	}
//
//	return nil
//}
//
//func (r *Route) ManifestDel(ingress, route string) error {
//	log.Debugf("%s:ManifestDel:> %s on ingress %s", logRoutePrefix, route, ingress)
//
//	if err := r.storage.Del(r.context, r.storage.Collection().Manifest().Route(ingress), route); err != nil {
//		log.Errorf("%s:ManifestDel:> err :%s", logRoutePrefix, err.Error())
//		return err
//	}
//
//	return nil
//}
//
//func (r *Route) ManifestWatch(ingress string, ch chan models.RouteManifestEvent, rev *int64) error {
//	log.Debugf("%s:watch:> watch routes manifest", logRoutePrefix)
//
//	done := make(chan bool)
//	watcher := storage.NewWatcher()
//
//	var f, c string
//
//	if ingress != models.EmptyString {
//		f = fmt.Sprintf(`\b.+\/%s\/%s\/(.+)\b`, ingress, storage.RouteKind)
//		c = r.storage.Collection().Manifest().Route(ingress)
//	} else {
//		f = fmt.Sprintf(`\b.+\/(.+)\/%s\/(.+)\b`, storage.RouteKind)
//		c = r.storage.Collection().Manifest().Ingress()
//	}
//
//	rg, err := regexp.Compile(f)
//	if err != nil {
//		log.Errorf("%s:> filter compile err: %v", logRoutePrefix, err.Error())
//		return err
//	}
//
//	go func() {
//		for {
//			select {
//			case <-r.context.Done():
//				done <- true
//				return
//			case e := <-watcher:
//				if e.Data == nil {
//					continue
//				}
//
//				keys := rg.FindStringSubmatch(e.Storage.Key)
//				if len(keys) == 0 {
//					continue
//				}
//
//				res := models.RouteManifestEvent{}
//				res.Action = e.Action
//				res.Name = e.Name
//				res.SelfLink = e.SelfLink
//
//				if ingress != models.EmptyString {
//					res.Ingress = ingress
//				} else {
//					res.Ingress = keys[1]
//				}
//
//				manifest := new(models.RouteManifest)
//
//				if err := json.Unmarshal(e.Data.([]byte), manifest); err != nil {
//					log.Errorf("%s:> parse data err: %v", logRoutePrefix, err)
//					continue
//				}
//
//				res.Data = manifest
//
//				ch <- res
//			}
//		}
//	}()
//
//	opts := storage.GetOpts()
//	if err := r.storage.Watch(r.context, c, watcher, opts); err != nil {
//		return err
//	}
//
//	return nil
//}
//
//func NewRouteModel(ctx context.Context, stg storage.IStorage) *Route {
//	return &Route{ctx, stg}
//}


text:
package config

import (
	"github.com/mitchellh/go-homedir"
	"strings"
	"testing"
)

func TestGlobalDir(t *testing.T) {
	dir := GlobalDir()
	if !strings.HasSuffix(dir, ".nanobox") {
		t.Errorf("missing nanobox suffix")
	}
}

func TestLocalDir(t *testing.T) {
	dir := LocalDir()
	// this is 'nanobox', because the boxfile is at the root level. localdir returns
	// a parent boxfile if none is found in the current directory
	if !strings.HasSuffix(dir, "nanobox") {
		t.Errorf("local dir mismatch '%s'", dir)
	}
}

func TestLocalDirName(t *testing.T) {
	dir := LocalDirName()
	if dir != "nanobox" {
		t.Errorf("local dir name mismatch '%s'", dir)
	}
}

func TestSSHDir(t *testing.T) {
	homedir, _ := homedir.Dir()
	if SSHDir() != homedir+"/.ssh" {
		t.Errorf("incorrect ssh directory")
	}
}


text:
package com.thedairyfarm.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

import com.thedairyfarm.R;
import com.thedairyfarm.callback.FragmentInterface;
import com.thedairyfarm.home.MilkFragment;
import com.thedairyfarm.home.ProductsFragment;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * A simple {@link Fragment} subclass.
 */
public class HomeFragment extends Fragment {
    private Context context;

    @BindView(R.id.sliding_tabs)
    TabLayout tabLayout;

    @BindView(R.id.viewpager)
    ViewPager viewPager;

    private PagerAdapter pagerAdapter;

    public HomeFragment() {
        // Required empty public constructor
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.context = context;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

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

        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        setUpAdapter();
    }

    private void setUpAdapter() {
        pagerAdapter = new PagerAdapter(getChildFragmentManager(), context);
        viewPager.setAdapter(pagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                FragmentInterface fragmentInterface = (FragmentInterface)
                        pagerAdapter.instantiateItem(viewPager, position);
                if (fragmentInterface != null){
                    fragmentInterface.fragmentBecameVisible(context);
                }
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    private class PagerAdapter extends FragmentPagerAdapter {
        final int PAGE_COUNT = 2;
        private String tabTitles[] = new String[]{"Milk", "Products"};
        private Context context;

        public PagerAdapter(FragmentManager fm, Context context) {
            super(fm);
            this.context = context;
        }

        @Override
        public int getCount() {
            return PAGE_COUNT;
        }

        @Override
        public Fragment getItem(int position) {
            if (position == 0) {
                return MilkFragment.newInstance();
            } else {
                return ProductsFragment.newInstance();
            }
        }

        @Override
        public CharSequence getPageTitle(int position) {
            // Generate title based on item position
            return tabTitles[position];
        }
    }
}


text:
/**
 * Created by Ron on 11/5/2016.
 */
"use strict";
import {
  StyleSheet,
  Text,
  View,
  ListView,
  Image,
  Modal,
  Platform,
  NativeModules,
  StatusBar
} from 'react-native';
let AppActions = NativeModules.AppActions
import CommonModules, {
  ThemeStyle,
  DrawLeftMenuPercentage,
  DrawLeftMenuPostRatio,
  screenWidth,
  GGButton,
  HudView,
} from './../utils/CommonModules'

import React, {Component, PropTypes} from 'react'
import ItemCell from '../vendors/ItemCell'
import WebPage from './WebPage'
import { ThemeType } from './../constrants/ActionTypes'

class LeftMenu extends Component {
  // 属性类型
  static propTypes = {
    closeDrawer: React.PropTypes.func.isRequired
  };

  // 构造
  constructor(props) {
    super(props);
    // 初始状态
    this.state = {
      items: ['清空缓存', '关于'],
      modalVisible: false,
      dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) => row1 !== row2,
      }),
    };
    this._renderRow = this._renderRow.bind(this)
    this._footView = this._footView.bind(this)
  }

  _setModalVisible(visible) {
    this.setState({modalVisible: visible});
  }

  componentDidMount() {
    this.setState({
      dataSource: this.state.dataSource.cloneWithRows(this.state.items)
    });
  }

  _renderRow(rowData, rowID) {
    return (
      <ItemCell onPress={()=>{
        console.log(this,rowID,rowData)
        if (rowData == '清空缓存'){
          if(Platform.OS === 'ios'){
            this.refs.hudView.showCustomComponent(<Text style={{color:'#ffffff'}}>请稍等...</Text>)
            AppActions.cleanCacheWithresolver().then((success)=>{
              this.refs.hudView.showSuccess().then(() => {
                console.log("Success view did complete.")
              })
            })
          }else {

          }

        }else if(rowData == '关于'){
          this._setModalVisible(true)
        }
      }} {...this.props} showDisclosureIndicator={true}>
        {rowData}
      </ItemCell>
    )
  }

  _footView() {

    const { changeToTheme, _theme ,toggleUnreadSate, _unread} = this.props;

    const buttonWidth = screenWidth * DrawLeftMenuPercentage / 2

    const borderColor = ThemeStyle[_theme].color.cellSeparator

    const buttonContainerStyle = {
      backgroundColor: ThemeStyle[_theme].color.background,
      flexDirection: 'row',
      alignItems: 'center',
      width: buttonWidth,
      height: 55,
      borderTopColor: borderColor,
      borderTopWidth: 1,
    }

    const buttonImageStyle = {
      marginTop: 0,
      marginRight: 8,
      width: 20,
      height: 20
    }

    const buttonTextStyle = {
      color: ThemeStyle[_theme].color.menuText,
      fontSize: 14,
    }

    var buttonImageSource1
    var buttonImageSource2
    if (_theme == ThemeType.Night) {
      buttonImageSource1 = require('image!ic_readmode_night')
    } else {
      buttonImageSource1 = require('image!ic_readmode_day')
    }
    if (_unread === true) {
      buttonImageSource2 = require('image!ic_unreadcount_night')
    } else {
      buttonImageSource2 = require('image!ic_unreadcount_day')
    }

    return (
      <View style={{flexDirection: 'row', alignItems: 'stretch',margin: 0}}>
        <Modal
          animationType={'fade'}
          transparent={false}
          visible={this.state.modalVisible}
          onRequestClose={() => {this._setModalVisible(false)}}
        >
          <WebPage {...this.props} navTitle="关于我们" openLink="http://ganguo.io" closeHandler={()=>{
            this._setModalVisible(false);
          }}/>
        </Modal>
        <GGButton containerStyle={[buttonContainerStyle,{borderRightColor: borderColor, borderRightWidth: 1}]}
          imageStyle={buttonImageStyle}
          text={'夜间'}
          textStyle={buttonTextStyle}
          imageSource={buttonImageSource1} handler={()=>{
          changeToTheme((this.props._theme == ThemeType.Night)? ThemeType.Normal : ThemeType.Night)
      }}/>
        <GGButton containerStyle={buttonContainerStyle}
                                imageStyle={buttonImageStyle}
                                text={'未读'}
                                textStyle={buttonTextStyle}
                                imageSource={buttonImageSource2} handler={()=>{
          toggleUnreadSate(!_unread)
      }}/>
        </View>
    )
  }

  // 渲染
  render() {
    StatusBar.setBarStyle('light-content',false)

    const { _theme } = this.props

    return (
      <HudView ref="hudView">
        <View style={styles.container}>
          <Image style={styles.image} source={require('./../resources/leftmenu-background.png')}>
            <View style={[styles.imageOverlay,{opacity: ThemeStyle[_theme].color.menuPostOpacity}]}/>
          </Image>
          <ListView style={[styles.container, {backgroundColor: ThemeStyle[_theme].color.background}]}
                    contentInset={{top: 20}}
                    automaticallyAdjustContentInsets={false}
                    dataSource={this.state.dataSource}
                    renderRow={(rowData, rowID) =>
                this._renderRow(rowData, rowID)}
          />
          {this._footView()}
        </View>
        </HudView>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
    marginTop: 0,
  },
  image: {
    marginTop: 0,
    marginLeft: 0,
    width: DrawLeftMenuPercentage * screenWidth,
    height: DrawLeftMenuPercentage * screenWidth / DrawLeftMenuPostRatio,
  },
  imageOverlay: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    opacity: 0.65,
    backgroundColor: 'black',
  },
  controlText: {
    color: 'white',
  },
  button: {
    backgroundColor: 'white',
    borderWidth: 1,
    borderColor: 'black',
    padding: 10,
  }
})

export default LeftMenu;


text:
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org)             */
/*                                                                            */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
/* not use this file except in compliance with the License. You may obtain    */
/* a copy of the License at                                                   */
/*                                                                            */
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
/*                                                                            */
/* Unless required by applicable law or agreed to in writing, software        */
/* distributed under the License is distributed on an "AS IS" BASIS,          */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
/* See the License for the specific language governing permissions and        */
/* limitations under the License.                                             */
/* -------------------------------------------------------------------------- */

#ifndef DISPATCH_MANAGER_H_
#define DISPATCH_MANAGER_H_

#include "ActionManager.h"
#include "HostPool.h"
#include "VirtualMachinePool.h"

using namespace std;

extern "C" void * dm_action_loop(void *arg);

class DispatchManager : public ActionListener
{
public:

    DispatchManager(
        VirtualMachinePool *        _vmpool,
        HostPool *                  _hpool):
            hpool(_hpool),
            vmpool(_vmpool)
    {
        am.addListener(this);
    };

    ~DispatchManager()
    {}
    ;

    enum Actions
    {
        SUSPEND_SUCCESS,/**< Send by LCM when a VM is suspended*/
        STOP_SUCCESS,   /**< Send by LCM when a VM is stopped*/
        DONE,           /**< Send by LCM when a VM is shut down*/
        FAILED,         /**< Send by LCM when one of the execution steps fails*/
        RESUBMIT,       /**< Send by LCM when a VM is ready for resubmission*/
        FINALIZE
    };

    /**
     *  Triggers specific actions to the Dispatch Manager. This function
     *  wraps the ActionManager trigger function.
     *    @param action the DM action
     *    @param vid VM unique id. This is the argument of the passed to the
     *    invoked action.
     */
    void trigger(
        Actions action,
        int     _vid);

    /**
     *  This functions creates a new thread for the Dispatch Manager. This
     *  thread will wait in an action loop till it receives ACTION_FINALIZE.
     *    @return 0 on success.
     */
    int start();

    /**
     *  Gets the thread identification.
     *    @return pthread_t for the manager thread (that in the action loop).
     */
    pthread_t get_thread_id() const
    {
        return dm_thread;
    };

    //--------------------------------------------------------------------------
    // DM Actions, the RM and the Scheduler will invoke this methods
    //--------------------------------------------------------------------------
    /**
     *  Deploys a VM. A new history record MUST be added before calling this
     *  function. Also the VM MUST have its mutex locked. If the function fails
     *  the calling funtion is responsible for recovering from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */
    int deploy (
        VirtualMachine * vm);

    /**
     *  Migrates a VM. The following actions must be performed before calling
     *  this function:
     *    - Lock the VM mutex.
     *    - Update the History statistics of the current host.
     *    - Add a new History record with the new host.
     *  If the function fails the calling funtion is responsible for recovering
     *  from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */
    int migrate(
        VirtualMachine * vm);

    /**
     *  Migrates a VM. The following actions must be performed before calling
     *  this function:
     *    - Lock the VM mutex.
     *    - Update the History statistics of the current host.
     *    - Add a new History record with the new host.
     *  If the function fails the calling funtion is responsible for recovering
     *  from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */

     /**
     *  Backup a VM. The following actions must be performed before calling
     *  this function:
     *    - Lock the VM mutex.
     *    - Add a new Backup record with the new host.
     *  If the function fails the calling funtion is responsible for recovering
     *  from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */
    int backup(                                     //added by shenxy
        VirtualMachine * vm);

     /**
     *  Recover a VM. The following actions must be performed before calling
     *  this function:
     *    - Lock the VM mutex.
     *    - Add a new Recover record with the new host.
     *  If the function fails the calling funtion is responsible for recovering
     *  from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */
     int recover(                                  //added by shenxy
       VirtualMachine * vm);

     /**
     *  Backupdisk a VM. The following actions must be performed before calling
     *  this function:
     *    - Lock the VM mutex.
     *    - Add a new Recover record with the new host.
     *  If the function fails the calling funtion is responsible for recovering
     *  from the error.
     *    @param vm pointer to a VirtualMachine with its mutex locked.
     *    @return 0 on success
     */
      int backupdisk(                             //added by shenxy
       VirtualMachine * vm);

    int live_migrate(
        VirtualMachine * vm);

    /**
     *  Shuts down a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int shutdown (
        int vid);

    /**
     *  Holds a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int hold(
        int vid);

    /**
     *  Releases a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int release(
        int vid);

    /**
     *  Stops a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int stop(
        int vid);

    /**
     *  Cancels a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int cancel(
        int vid);

      //added by shenxy 20120228
     /**
     *  Offs a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int off(
        int vid);

    /**
     *  Ons a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int on(
        int vid);

    /**
     *  Suspends a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int suspend(
        int vid);

    /**
     *  Resumes a VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int resume(
        int vid);

    /**
     * Restart a previusly deployed VM.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int restart(
        int vid);

    /**
     *  Ends a VM life cycle inside ONE.
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int finalize(
        int vid);

    /**
     *  Moves a VM to PENDING state preserving any resource (i.e. leases) and id
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int resubmit(
        int vid);

    /**
     *  Reboots a VM preserving any resource and RUNNING state
     *    @param vid VirtualMachine identification
     *    @return 0 on success, -1 if the VM does not exits or -2 if the VM is
     *    in a wrong a state
     */
    int reboot(
        int vid);

private:
    /**
     *  Thread id for the Dispatch Manager
     */
    pthread_t               dm_thread;

    /**
     *  Pointer to the Host Pool, to access hosts
     */
    HostPool *              hpool;

    /**
     *  Pointer to the Virtual Machine Pool, to access hosts
     */
    VirtualMachinePool *    vmpool;

    /**
     *  Action engine for the Manager
     */
    ActionManager           am;

    /**
     *  Function to execute the Manager action loop method within a new pthread
     * (requires C linkage)
     */
    friend void * dm_action_loop(void *arg);

    /**
     *  The action function executed when an action is triggered.
     *    @param action the name of the action
     *    @param arg arguments for the action function
     */
    void do_action(
        const string &  action,
        void *          arg);

    //--------------------------------------------------------------------------
    // DM Actions associated with a VM state transition
    //--------------------------------------------------------------------------

    void  suspend_success_action(int vid);

    void  stop_success_action(int vid);

    void  done_action(int vid);

    void  failed_action(int vid);

    void  resubmit_action(int vid);
};

#endif /*DISPATCH_MANAGER_H*/


text:
package org.testfun.jee.runner.inject;

import org.testfun.jee.runner.EjbWithMockitoRunnerException;

import java.lang.reflect.Field;

public class InjectionUtils {

    public static <T> Class<?> getFieldInterface(T target, Field field) {
        Class<?> fieldClass = field.getType();
        if (!fieldClass.isInterface()) {
            throw new EjbWithMockitoRunnerException(getFieldDescription(field, target) + " isn't an interface");
        }
        return fieldClass;
    }

    public static <T> void assignObjectToField(T target, Field field, Object value) {
        boolean fieldAccessible = field.isAccessible();
        field.setAccessible(true);
        try {
            field.set(target, value);
        } catch (Exception e) {
            throw new EjbWithMockitoRunnerException("Failed injecting to " + getFieldDescription(field, target), e);
        } finally {
            field.setAccessible(fieldAccessible);
        }
    }

    @SuppressWarnings("unchecked")
    public static <T,O> O readObjectFromField(T target, Field field) {
        boolean fieldAccessible = field.isAccessible();
        field.setAccessible(true);
        try {
            return (O) field.get(target);
        } catch (Exception e) {
            throw new EjbWithMockitoRunnerException("Failed to read from " + getFieldDescription(field, target), e);
        } finally {
            field.setAccessible(fieldAccessible);
        }
    }

    public static <T> String getFieldDescription(Field field, T target) {
        Class<?> targetClass = target.getClass();
        Class<?> fieldDeclaringClass = field.getDeclaringClass();

        if (targetClass.equals(fieldDeclaringClass)) {
            return "field '" + field.getName() + "' declared in " + targetClass;
        } else {
            return "field '" + field.getName() + "' declared in " + fieldDeclaringClass + " (superclass of " + targetClass + ")";
        }
    }

}


text:
require 'spec_helper'

describe command('uname -a') do
	its(:stdout) { should match /Ubuntu/ }
end


text:
package madgik.exareme.worker.art.executionEngine.dynamicExecutionEngine.event.independent;

import madgik.exareme.utils.eventProcessor.ActiveEvent;
import madgik.exareme.utils.eventProcessor.EventHandler;
import madgik.exareme.utils.eventProcessor.EventHandlerRunnable;
import madgik.exareme.utils.eventProcessor.EventProcessor;
import madgik.exareme.worker.art.executionEngine.ExecEngineConstants;
import madgik.exareme.worker.art.executionEngine.dynamicExecutionEngine.event.ExecEngineEvent;
import madgik.exareme.worker.art.executionEngine.dynamicExecutionEngine.event.ExecEngineEventHandler;
import org.apache.log4j.Logger;

import java.rmi.RemoteException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;

/**
 * @author heraldkllapi
 */
public class IndependentEventsHandler implements EventHandler<IndependentEvents> {
    private static final long serialVersionUID = 1L;
    private static final ExecutorService service =
        Executors.newFixedThreadPool(ExecEngineConstants.THREADS_PER_INDEPENDENT_TASKS);
    private static final Logger log = Logger.getLogger(IndependentEventsHandler.class);
    private long startTime = 0;
    private long endTime = 0;

    public IndependentEventsHandler() {

    }

    @Override public void handle(IndependentEvents event, EventProcessor proc)
        throws RemoteException {
        try {
            startTime = System.currentTimeMillis();
            Semaphore wait = new Semaphore(0);
            // Pre-process
            for (ActiveEvent e : event.events) {
                ExecEngineEventHandler handler = (ExecEngineEventHandler) e.getHandler();
                handler.preProcess(e.getEvent(), event.state);
            }
            // Parallel-process
            for (ActiveEvent e : event.events) {
                ((ExecEngineEvent) e.getEvent()).wait = wait;
                service.submit(new EventHandlerRunnable(e, proc));
            }
            //      service.shutdown();
            //      log.debug("Waiting termination ...");
            wait.acquire(event.events.size());
            //      service.awaitTermination(1, TimeUnit.DAYS);
            //      log.debug("ok!");

            // Post-process
            for (ActiveEvent e : event.events) {
                ExecEngineEventHandler handler = (ExecEngineEventHandler) e.getHandler();
                handler.postProcess(e.getEvent(), event.state);
            }
            event.state.getStatistics().incrIndependentMessages();
            endTime = System.currentTimeMillis();
            event.state.getStatistics()
                .addTotalEventProcessTime(endTime - startTime, startTime - event.queueTime);
            event.state.getStatistics().setXaxIndependentMsgCount(event.events.size());
        } catch (Exception e) {
            throw new RemoteException("Cannot handle independent events", e);
        }
    }
}