text:
package com.huoxy.googleofficialpractice.apiguide.chapter3;

import android.content.ClipData;
import android.content.ClipDescription;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.DragEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.huoxy.googleofficialpractice.R;

/**
 * 拖放 —— 移动数据 or UI操作
 */
public class DragAndDropActivity extends AppCompatActivity {

    private static final String TAG = "DragAndDrop";

    private static final String IMAGEVIEW_TAG = "icon_bitmap";

    ImageView appIcon;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drag_and_drop);

        appIcon = (ImageView) findViewById(R.id.app_icon);
        appIcon.setTag(IMAGEVIEW_TAG);
        appIcon.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                ClipData.Item item = new ClipData.Item((CharSequence) v.getTag());
                String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
                ClipData clipData = new ClipData(v.getTag().toString(), mimeTypes, item);

                MyDragShadowBuilder myShadow = new MyDragShadowBuilder(appIcon);

                v.startDrag(clipData, myShadow, null, 0);

                return true;
            }
        });

        appIcon.setOnDragListener(new View.OnDragListener() {
            @Override
            public boolean onDrag(View v, DragEvent event) {
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) v.getLayoutParams();

                // Handles each of the expected events
                switch (event.getAction()) {
                    case DragEvent.ACTION_DRAG_STARTED:
                        Log.i(TAG, "DragEvent.ACTION_DRAG_STARTED ===== ");
                        break;
                    case DragEvent.ACTION_DRAG_ENTERED:
                        Log.i(TAG, "DragEvent.ACTION_DRAG_ENTERED ===== ");
                        int x_cord = (int) event.getX();
                        int y_cord = (int) event.getY();
                        break;
                    case DragEvent.ACTION_DRAG_LOCATION:
                        Log.i(TAG, "DragEvent.ACTION_DRAG_LOCATION ===== ");
                        // Ignore the event
                        x_cord = (int) event.getX();
                        y_cord = (int) event.getY();
                        break;
                    case DragEvent.ACTION_DRAG_EXITED:
                        Log.i(TAG, "DragEvent.ACTION_DRAG_EXITED ===== ");
                        x_cord = (int) event.getX();
                        y_cord = (int) event.getY();
                        layoutParams.leftMargin = x_cord;
                        layoutParams.topMargin = y_cord;
                        v.setLayoutParams(layoutParams);
                        break;
                    case DragEvent.ACTION_DROP:
                        Log.i(TAG, "DragEvent.ACTION_DROP ===== ");
                        break;
                    case DragEvent.ACTION_DRAG_ENDED:
                        Log.i(TAG, "DragEvent.ACTION_DRAG_ENDED ===== ");
                        // Turns off any color tinting
                        break;
                    // An unknown action type was received.
                    default:
                        Log.e(TAG, "Unknown action type received by OnDragListener.");
                        break;
                }
                return true;
            }
        });
    }

    //定义了 MyDragShadowBuilder 它会创建灰色小方框形式的拖拽阴影用于拖拽 View
    private static class MyDragShadowBuilder extends View.DragShadowBuilder {
        private static Drawable shadow;

        public MyDragShadowBuilder(View view) {
            super(view);
            shadow = new ColorDrawable(Color.LTGRAY);
        }

        // Defines a callback that sends the drag shadow dimensions and touch point back to the
        // system.
        @Override
        public void onProvideShadowMetrics(Point outShadowSize, Point outShadowTouchPoint) {
            // Defines local variables
            int width, height;

            // Sets the width of the shadow to half the width of the original View
            width = getView().getWidth() / 2;

            // Sets the height of the shadow to half the height of the original View
            height = getView().getHeight() / 2;

            // The drag shadow is a ColorDrawable. This sets its dimensions to be the same as the
            // Canvas that the system will provide. As a result, the drag shadow will fill the
            // Canvas.
            shadow.setBounds(0, 0, width, height);

            // Sets the size parameter's width and height values. These get back to the system
            // through the size parameter.
            outShadowSize.set(width, height);

            // Sets the touch point's position to be in the middle of the drag shadow
            outShadowTouchPoint.set(width / 2, height / 2);
        }

        // Defines a callback that draws the drag shadow in a Canvas that the system constructs
        // from the dimensions passed in onProvideShadowMetrics().
        @Override
        public void onDrawShadow(Canvas canvas) {
            shadow.draw(canvas);
        }
    }
}


text:
<?php

/**
 * DO NOT EDIT!
 * This file was automatically generated via bin/generate-validator-spec.php.
 */

namespace AmpProject\Validator\Spec\Tag;

use AmpProject\Format;
use AmpProject\Html\Attribute;
use AmpProject\Html\Tag as Element;
use AmpProject\Protocol;
use AmpProject\Validator\Spec\AttributeList;
use AmpProject\Validator\Spec\Identifiable;
use AmpProject\Validator\Spec\SpecRule;
use AmpProject\Validator\Spec\Tag;

/**
 * Tag class Image.
 *
 * @package ampproject/amp-toolbox.
 *
 * @property-read string $tagName
 * @property-read array<array> $attrs
 * @property-read array<string> $attrLists
 * @property-read string $specUrl
 * @property-read string $mandatoryAncestor
 * @property-read array<string> $htmlFormat
 */
final class Image extends Tag implements Identifiable
{
    /**
     * ID of the tag.
     *
     * @var string
     */
    const ID = 'IMAGE';

    /**
     * Array of spec rules.
     *
     * @var array
     */
    const SPEC = [
        SpecRule::TAG_NAME => Element::IMAGE,
        SpecRule::ATTRS => [
            Attribute::EXTERNALRESOURCESREQUIRED => [],
            Attribute::HEIGHT => [],
            Attribute::PRESERVEASPECTRATIO => [],
            Attribute::TRANSFORM => [],
            Attribute::WIDTH => [],
            Attribute::X => [],
            Attribute::XLINK_ACTUATE => [],
            Attribute::XLINK_ARCROLE => [],
            Attribute::XLINK_HREF => [
                SpecRule::ALTERNATIVE_NAMES => [
                    Attribute::HREF,
                ],
                SpecRule::DISALLOWED_VALUE_REGEX => '(^|\s)data:image\/svg\+xml',
                SpecRule::VALUE_URL => [
                    SpecRule::PROTOCOL => [
                        Protocol::DATA,
                        Protocol::HTTP,
                        Protocol::HTTPS,
                    ],
                    SpecRule::ALLOW_EMPTY => false,
                ],
            ],
            Attribute::XLINK_ROLE => [],
            Attribute::XLINK_SHOW => [],
            Attribute::XLINK_TITLE => [],
            Attribute::XLINK_TYPE => [],
            Attribute::Y => [],
        ],
        SpecRule::ATTR_LISTS => [
            AttributeList\SvgConditionalProcessingAttributes::ID,
            AttributeList\SvgCoreAttributes::ID,
            AttributeList\SvgPresentationAttributes::ID,
            AttributeList\SvgStyleAttr::ID,
        ],
        SpecRule::SPEC_URL => 'https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/#svg',
        SpecRule::MANDATORY_ANCESTOR => Element::SVG,
        SpecRule::HTML_FORMAT => [
            Format::AMP,
            Format::AMP4ADS,
        ],
    ];
}

redpajama_set_name: RedPajamaGithub


text:
.dpCoverflow {
  -webkit-perspective:1000px;
  -webkit-perspective-origin:center 33%;
  -webkit-transform-style: preserve-3d;
  list-style: none;
  position:relative;
  width:100%;
  height:225px;
  overflow:hidden;
  margin-bottom:-25px;
  -webkit-mask-image:-webkit-gradient(linear, left top, right top, from(rgba(0,0,0,.7)), color-stop(0.5, black), to(rgba(0,0,0,.7)));
}
.dpCoverflow li {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 150px;
  margin-left: -100px;
  margin-top: -110px;
  -webkit-transition: -webkit-transform .6s cubic-bezier(0, 1, 1, 1);
  background-color:#fff;
}
.dpCoverflow .photon-shader {
  pointer-events:none;
}
.dpCoverflow a {
  display:table-cell;
  width:200px;
  height:150px;
  vertical-align:middle;
  text-align:center;
}
.dpCoverflow img {
  width: 196px;
}
.dpCoverflow.hasShadow li {
}
.dpCoverflow.hasReflection li {
  -webkit-box-reflect:below 1px;
}
.dpCoverflow.hasReflection li:after {
  content:'\00a0';
  display:block;
  position:absolute;
  left:-1px;
  right:-1px;
  top:100%;
  height:110%;
  background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.25)), color-stop(0.35, white), to(white));
}

@media all and (max-width: 320px) {
  .dpCoverflow {
    -webkit-transform-origin:left top;
    -webkit-transform:scale(0.66);
    width:150%;
    margin-bottom:-75px;
  }
}

div.reel {
  margin-bottom:0;
}
#wrap {
  margin-top:0;
  padding-top:0;
}
.hidden {
  display:none;
}


text:
@implementation NetworkManager

SingletonM();

@end


text:
'use strict';

exports.__esModule = true;
exports.default = normalizeFlexFlow;

var _postcssValueParser = require('postcss-value-parser');

var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);

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

// flex-flow: <flex-direction> || <flex-wrap>
var flexFlowProps = ['flex-flow'];

var flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];

var flexWrap = ['nowrap ', 'wrap', 'wrap-reverse'];

function normalizeFlexFlow(decl) {
    if (! ~flexFlowProps.indexOf(decl.prop)) {
        return;
    }
    var value = decl.value;

    if (decl.raws && decl.raws.value && decl.raws.value.raw) {
        value = decl.raws.value.raw;
    }
    var order = { direction: '', wrap: '' };
    var flexFlow = (0, _postcssValueParser2.default)(value);
    var abort = false;
    if (flexFlow.nodes.length > 2) {
        flexFlow.walk(function (node) {
            if (node.type === 'comment') {
                abort = true;
                return;
            }
            if (~flexDirection.indexOf(node.value)) {
                order.direction = node.value;
                return;
            }
            if (~flexWrap.indexOf(node.value)) {
                order.wrap = node.value;
                return;
            }
        });
        if (!abort) {
            decl.value = (order.direction + ' ' + order.wrap).trim();
        }
    }
};
module.exports = exports['default'];


text:
from numpy import median

trees = ["LinearProbingHashingTree", "PatriciaTree", "TernarySearchTree"]
max_length = 8

def init_dict():
    times = dict()

    for i in range(max_length):
        times[i + 1] = []

    return times

def save_dict(times, words, log):
    log.write(str(words) + "\n")

    for i in range(max_length):
        # guardar mediana
        if len(times[i + 1]) > 0:
            med = median(times[i + 1])
        else:
            med = None
        log.write(str(i + 1) + "," + str(med) + "\n")

    return

def process_search(search):
    for tree in trees:
        log = open("processed/" + search + tree + ".csv", 'w')

        path = "results/" + search + "Search" + tree + ".csv"
        file = open(path, 'r')

        size = 0
        times = init_dict()

        for line in file.readlines():
            data = line.split(",")

            # detectar cambios en el tamano
            if size == 0:
                size = int(data[0])
            elif size != int(data[0]):
                save_dict(times, size, log)
                times = init_dict()
                size = int(data[0])

            # agregar al arreglo
            length = int(data[1])
            time = int(data[2])
            if length <= max_length:
                times[length].append(time)

        save_dict(times, size, log)

    return

def process_const(action):
    for tree in trees:
        log = open("processed/" + action + tree + ".csv", 'w')

        path = "results/" + action + tree + ".csv"
        file = open(path, 'r')

        times = dict()

        # acumular tiempos por tamaño
        for line in file.readlines():
            data = line.split(",")

            # agregar al diccionario
            size = int(data[0])
            time = int(data[1])
            if size not in times:
                times[size] = []

            times[size].append(time)

        # guardar mediana de cada tamaño
        for size in times:
            time = times[size]
            med = median(time)

            log.write(str(size) + "," + str(med) + "\n")

    return

if __name__ == '__main__':
    process_search("succ")
    print("succ searchs processed")
    process_search("unsucc")
    print("uncsucc searchs processed")
    process_const("Construction")
    print("constructions processed")
    process_const("Similarity")
    print("similarity processed")


text:
<?xml version="1.0" encoding="utf-8"?>
<workflow-app name="${occurrence.environment}-${table_name}-download" xmlns="uri:oozie:workflow:0.4.5">

  <global>
    <job-tracker>${hadoop.jobtracker}</job-tracker>
    <name-node>${hdfs.namenode}</name-node>
    <configuration>
      <property>
        <name>oozie.launcher.mapreduce.task.classpath.user.precedence</name>
        <value>true</value>
      </property>
      <property>
        <name>oozie.launcher.mapred.job.queue.name</name>
        <value>download-admin</value>
      </property>
      <property>
        <name>oozie.launcher.mapreduce.map.memory.mb</name>
        <value>${oozie.launcher.mapreduce.map.memory.mb}</value>
      </property>
    </configuration>
  </global>

  <start to="download_prepare"/>

  <action name="download_prepare">
    <java>
      <main-class>org.gbif.occurrence.download.oozie.DownloadPrepareAction</main-class>
      <arg>${gbif_filter}</arg>
      <arg>${wf:id()}</arg>
      <arg>${download_format}</arg>
      <arg>${core_term_name}</arg>
      <arg>${wf:appPath()}</arg>
      <capture-output/>
    </java>

    <ok to="download_size_decision"/>
    <error to="notify-error"/>
  </action>

  <decision name="download_size_decision">
    <switch>
      <case to="species_list_download">
        ${(download_format eq 'SPECIES_LIST')}
      </case>
      <!-- All Avro downloads are done through Hive queries -->
      <case to="simple_avro_download">
        ${(download_format eq 'SIMPLE_AVRO')}
      </case>
      <case to="simple_with_verbatim_avro_download">
        ${(download_format eq 'SIMPLE_WITH_VERBATIM_AVRO')}
      </case>
      <case to="map_of_life_download">
        ${(download_format eq 'MAP_OF_LIFE')}
      </case>
      <case to="bionomia_download">
        ${(download_format eq 'BIONOMIA')}
      </case>
      <!-- All Parquet downloads are done through Hive queries -->
      <case to="simple_parquet_download">
        ${(download_format eq 'SIMPLE_PARQUET')}
      </case>
      <!-- it's a small download -->
      <case to="from_elastic_download">
        ${wf:actionData('download_prepare')['is_small_download']}
      </case>
      <!-- it's a large download -->
      <case to="simple_csv_download">
        ${!wf:actionData('download_prepare')['is_small_download'] and (download_format eq 'SIMPLE_CSV')}
      </case>
      <case to="iucn_download">
        ${!wf:actionData('download_prepare')['is_small_download'] and (download_format eq 'IUCN')}
      </case>
      <case to="dwca_download">
        ${!wf:actionData('download_prepare')['is_small_download'] and (download_format eq 'DWCA')}
      </case>
      <default to="notify-error"/>
    </switch>
  </decision>

  <action name="from_elastic_download">
    <java>
      <main-class>org.gbif.occurrence.download.oozie.FromSearchDownloadAction</main-class>
      <arg>${download_format}</arg>
      <arg>${wf:actionData('download_prepare')['search_query']}</arg>
      <arg>${wf:actionData('download_prepare')['download_key']}</arg>
      <arg>${gbif_filter}</arg>
      <arg>${wf:actionData('download_prepare')['download_table_name']}</arg>
      <arg>${gbif_user}</arg>
      <arg>${core_term_name}</arg>
      <arg>${wf:actionData('download_prepare')['request_extensions']}</arg>
    </java>

    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="simple_csv_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/simple-csv</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="iucn_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/iucn</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="simple_avro_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/simple-avro</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="simple_with_verbatim_avro_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/simple-with-verbatim-avro</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="map_of_life_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/map-of-life</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="bionomia_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/bionomia</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="kill"/>
  </action>

  <action name="simple_parquet_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/simple-parquet</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="dwca_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/dwca</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>request_extensions</name>
          <value>${wf:actionData('download_prepare')['request_extensions']}</value>
        </property>
        <property>
          <name>has_extensions</name>
          <value>${wf:actionData('download_prepare')['has_extensions']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
        <property>
          <name>base_wf_path</name>
          <value>${wf:appPath()}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="species_list_download">
    <sub-workflow>
      <app-path>${hdfs.namenode}/${wf_prefix}-download-workflows-${occurrence.environment}/download-workflow/species-list</app-path>
      <propagate-configuration/>
      <configuration>
        <property>
          <name>download_key</name>
          <value>${wf:actionData('download_prepare')['download_key']}</value>
        </property>
        <property>
          <name>is_small_download</name>
          <value>${wf:actionData('download_prepare')['is_small_download']}</value>
        </property>
        <property>
          <name>download_table_name</name>
          <value>${wf:actionData('download_prepare')['download_table_name']}</value>
        </property>
        <property>
          <name>core_term_name</name>
          <value>${wf:actionData('download_prepare')['core_term_name']}</value>
        </property>
        <property>
          <name>table_name</name>
          <value>${wf:actionData('download_prepare')['table_name']}</value>
        </property>
        <property>
          <name>hive_query</name>
          <value>${wf:actionData('download_prepare')['hive_query']}</value>
        </property>
        <property>
          <name>hive_db</name>
          <value>${wf:actionData('download_prepare')['hive_db']}</value>
        </property>
      </configuration>
    </sub-workflow>
    <ok to="end"/>
    <error to="notify-error"/>
  </action>

  <action name="notify-error">
    <email xmlns="uri:oozie:email-action:0.2">
      <to>fmendez@gbif.org</to>
      <subject>${occurrence.environment} download ${wf:id()} failed</subject>
      <body>${core_term_name} download workflow ${wf:id()} failed:[${wf:errorMessage(wf:lastErrorNode())}]</body>
    </email>
    <ok to="kill"/>
    <error to="kill"/>
  </action>

  <kill name="kill">
    <message>${core_term_name} download failed:[${wf:errorMessage(wf:lastErrorNode())}]</message>
  </kill>

  <end name="end"/>

</workflow-app>


text:
package com.example.brewchat;

import android.os.StrictMode;
import android.util.Log;

import com.facebook.stetho.Stetho;

public class Application extends android.app.Application {

    private static final String TAG = Application.class.getSimpleName();

    public static IChatService chatService;

    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyFlashScreen()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());

            //Enable Stetho for debugging
            Stetho.initialize(
                    Stetho.newInitializerBuilder(this)
                            .enableDumpapp(
                                    Stetho.defaultDumperPluginsProvider(this))
                            .enableWebKitInspector(
                                    Stetho.defaultInspectorModulesProvider(this))
                            .build());

            Log.d(TAG, "Stetho and StrictMode Initialized");
        }

        chatService = new ChatService(getApplicationContext(),
                getString(R.string.app_id),
                getString(R.string.auth_key),
                getString(R.string.auth_secret));

        PreferenceManager.init(this);
    }

    public static IChatService getChatService() {
        return Application.chatService;
    }
}


text:
#ifndef _SBCHIPC_H_
#define _SBCHIPC_H_

#include <stddef.h>

struct chipcregs
{
    volatile ulong chipid;      /* 0x0 */
    volatile ulong capabilities;
    volatile ulong corecontrol; /* corerev >= 1 */
    volatile ulong pad0[5];

    /* Interrupt control */
    volatile ulong intstatus;   /* 0x20 */
    volatile ulong intmask;
    volatile ulong pad1[6];

    /* serial flash interface registers */
    volatile ulong flashcontrol;        /* 0x40 */
    volatile ulong flashaddress;
    volatile ulong flashdata;
    volatile ulong pad2[1];

    /* Silicon backplane configuration broadcast control */
    volatile ulong broadcastaddress;
    volatile ulong broadcastdata;
    volatile ulong pad3[2];

    /* gpio - cleared only by power-on-reset */
    volatile ulong gpioin;      /* 0x60 */
    volatile ulong gpioout;
    volatile ulong gpioouten;
    volatile ulong gpiocontrol;
    volatile ulong gpiointpolarity;
    volatile ulong gpiointmask;
    volatile ulong pad4[2];

    /* Watchdog timer */
    volatile ulong watchdog;    /* 0x80 */
    volatile ulong pad5[3];

    /* clock control */
    volatile ulong clockcontrol_n;      /* 0x90 */
    volatile ulong clockcontrol_sb;     /* aka m0 */
    volatile ulong clockcontrol_pci;    /* aka m1 */
    volatile ulong clockcontrol_m2;     /* mii/uart/mipsref */
    volatile ulong clockcontrol_mips;   /* aka m3 */
    volatile ulong uart_clkdiv; /* corerev >= 3 */
    volatile ulong pad6[2];

    /* pll delay registers (corerev >= 4) */
    volatile ulong pll_on_delay;        /* 0xb0 */
    volatile ulong fref_sel_delay;
    volatile ulong slow_clk_ctl;
    volatile ulong pad7[17];

    /* ExtBus control registers (corerev >= 3) */
    volatile ulong cs01config;  /* 0x100 */
    volatile ulong cs01memwaitcnt;
    volatile ulong cs01attrwaitcnt;
    volatile ulong cs01iowaitcnt;
    volatile ulong cs23config;
    volatile ulong cs23memwaitcnt;
    volatile ulong cs23attrwaitcnt;
    volatile ulong cs23iowaitcnt;
    volatile ulong cs4config;
    volatile ulong cs4waitcnt;
    volatile ulong parallelflashconfig;
    volatile ulong parallelflashwaitcnt;
    volatile ulong pad8[116];

    /* uarts */
    volatile uchar uart0data;   /* 0x300 */
    volatile uchar uart0imr;
    volatile uchar uart0fcr;
    volatile uchar uart0lcr;
    volatile uchar uart0mcr;
    volatile uchar uart0lsr;
    volatile uchar uart0msr;
    volatile uchar uart0scratch;
    volatile uchar pad9[248];   /* corerev >= 1 */

    volatile uchar uart1data;   /* 0x400 */
    volatile uchar uart1imr;
    volatile uchar uart1fcr;
    volatile uchar uart1lcr;
    volatile uchar uart1mcr;
    volatile uchar uart1lsr;
    volatile uchar uart1msr;
    volatile uchar uart1scratch;
};

/* chipid */
#define CID_ID_MASK   0x0000ffff        /* Chip Id mask */
#define CID_REV_MASK  0x000f0000        /* Chip Revision mask */
#define CID_REV_SHIFT 16        /* Chip Revision shift */
#define CID_PKG_MASK  0x00f00000        /* Package Option mask */
#define CID_PKG_SHIFT 20        /* Package Option shift */
#define CID_CC_MASK   0x0f000000        /* CoreCount (corerev >= 4) */
#define CID_CC_SHIFT  24

/* capabilities */
#define CAP_UARTS_MASK 0x00000003       /* Number of uarts */
#define CAP_MIPSEB     0x00000004       /* MIPS is in big-endian mode */
#define CAP_UCLKSEL    0x00000018       /* UARTs clock select */
#define CAP_UINTCLK    0x00000008       /* UARTs driven by internal clock */
#define CAP_UARTGPIO   0x00000020       /* UARTs own Gpio's 15:12 */
#define CAP_EXTBUS     0x00000040       /* External bus present */
#define CAP_FLASH_MASK 0x00000700       /* Type of flash */
#define CAP_PLL_MASK   0x00038000       /* Type of PLL */
#define CAP_PWR_CTL    0x00040000       /* Power control */

/* PLL type */
#define PLL_NONE  0x00000000
#define PLL_TYPE1 0x00010000    /* 48Mhz base, 3 dividers */
#define PLL_TYPE2 0x00020000    /* 48Mhz, 4 dividers */
#define PLL_TYPE3 0x00030000    /* 25Mhz, 2 dividers */
#define PLL_TYPE4 0x00008000    /* 48Mhz, 4 dividers */

/* corecontrol */
#define CC_UARTCLKO 0x00000001  /* Drive UART with internal clock */
#define CC_SE       0x00000002  /* sync clk out enable (corerev >= 3) */

/* intstatus/intmask */
#define CI_EI   0x00000002      /* ro: ext intr pin (corerev >= 3) */

/* slow_clk_ctl */
#define SCC_SS_MASK 0x00000007  /* slow clock source mask */
#define SCC_SS_LPO  0x00000000  /* source of slow clock is LPO */
#define SCC_SS_XTAL 0x00000001  /* source of slow clock is crystal */
#define SCC_SS_PCI  0x00000002  /* source of slow clock is PCI */
#define SCC_LF      0x00000200  /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
#define SCC_LP      0x00000400  /* LPOPowerDown, 1/0: disabled/enabled */
#define SCC_FS      0x00000800  /* ForceSlowClk, 1/0: slow clock/logic */
/* IgnorePllOffReq, 1/0: logic ignores/honors PLL clock disable */
#define SCC_IP      0x00001000
/* XtalControlEn, 1/0: power logic does/doesn't disable crystal */
#define SCC_XC      0x00002000
/* XtalPU (RO), 1/0: crystal running/disabled */
#define SCC_XP      0x00004000
/* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */
#define SCC_CD_MASK 0xffff0000
#define SCC_CD_SHF  16          /* CLockDivider shift */

/* clockcontrol_n */
#define CN_N1_MASK  0x3f        /* n1 control */
#define CN_N2_MASK  0x3f00      /* n2 control */
#define CN_N2_SHIFT 8

/* clockcontrol_sb/pci/uart */
#define CC_M1_MASK  0x3f        /* m1 control */
#define CC_M2_MASK  0x3f00      /* m2 control */
#define CC_M2_SHIFT 8
#define CC_M3_MASK  0x3f0000    /* m3 control */
#define CC_M3_SHIFT 16
#define CC_MC_MASK  0x1f000000  /* mux control */
#define CC_MC_SHIFT 24

/* N3M Clock control values for 125Mhz */
#define CC_125_N   0x0802       /* Default values for bcm4310 */
#define CC_125_M   0x04020009
#define CC_125_M25 0x11090009
#define CC_125_M33 0x11090005

/* N3M Clock control magic field values */
#define CC_F6_2   0x02
                                                                                /* A factor of 2 in */
#define CC_F6_3   0x03
                                                                                /* 6-bit fields like */
#define CC_F6_4   0x05
                                                                                /* N1, M1 or M3 */
#define CC_F6_5   0x09
#define CC_F6_6   0x11
#define CC_F6_7   0x21

#define CC_F5_BIAS  5           /* 5-bit fields get this added */

#define CC_MC_BYPASS 0x08
#define CC_MC_M1     0x04
#define CC_MC_M1M2   0x02
#define CC_MC_M1M2M3 0x01
#define CC_MC_M1M3   0x11

/* Type 2 Clock control magic field values */
#define CC_T2_BIAS   2          /* n1, n2, m1 & m3 bias */
#define CC_T2M2_BIAS 3          /* m2 bias */

#define CC_T2MC_M1BYP 1
#define CC_T2MC_M2BYP 2
#define CC_T2MC_M3BYP 4

/* Common clock base */
#define CC_CLOCK_BASE 24000000  /* Half the clock freq */

/* Flash types in the chipcommon capabilities register */
#define FLASH_NONE 0x000        /* No flash */
#define SFLASH_ST  0x100        /* ST serial flash */
#define SFLASH_AT  0x200        /* Atmel serial flash */
#define PFLASH     0x700
                                                                                /* Parallel flash */

/* Bits in the config registers */
#define CC_CFG_EN        0x0001 /* Enable */
#define CC_CFG_EM_MASK   0x000e /* Extif Mode */
#define CC_CFG_EM_ASYNC  0x0002 /*   Async/Parallel flash */
#define CC_CFG_EM_SYNC   0x0004 /*   Synchronous */
#define CC_CFG_EM_PCMCIA 0x0008 /*   PCMCIA */
#define CC_CFG_EM_IDE    0x000a /*   IDE */
#define CC_CFG_DS        0x0010 /* Data size, 0=8bit, 1=16bit */
#define CC_CFG_CD_MASK   0x0060 /* Sync: Clock divisor */
#define CC_CFG_CE        0x0080 /* Sync: Clock enable */
#define CC_CFG_SB        0x0100 /* Sync: Size/Bytestrobe */

/* Start/busy bit in flashcontrol */
#define SFLASH_START  0x80000000
#define SFLASH_BUSY  SFLASH_START

/* flashcontrol opcodes for ST flashes */
#define SFLASH_ST_WREN  0x0006  /* Write Enable */
#define SFLASH_ST_WRDIS 0x0004  /* Write Disable */
#define SFLASH_ST_RDSR  0x0105  /* Read Status Register */
#define SFLASH_ST_WRSR  0x0101  /* Write Status Register */
#define SFLASH_ST_READ  0x0303  /* Read Data Bytes */
#define SFLASH_ST_PP    0x0302  /* Page Program */
#define SFLASH_ST_SE    0x02d8  /* Sector Erase */
#define SFLASH_ST_BE    0x00c7  /* Bulk Erase */
#define SFLASH_ST_DP    0x00b9  /* Deep Power-down */
#define SFLASH_ST_RES   0x03ab  /* Read Electronic Signature */

/* Status register bits for ST flashes */
#define SFLASH_ST_WIP      0x01 /* Write In Progress */
#define SFLASH_ST_WEL      0x02 /* Write Enable Latch */
#define SFLASH_ST_BP_MASK  0x1c /* Block Protect */
#define SFLASH_ST_BP_SHIFT 2
#define SFLASH_ST_SRWD     0x80 /* Status Register Write Disable */

/* flashcontrol opcodes for Atmel flashes */
#define SFLASH_AT_READ                0x07e8
#define SFLASH_AT_PAGE_READ           0x07d2
#define SFLASH_AT_BUF1_READ
#define SFLASH_AT_BUF2_READ
#define SFLASH_AT_STATUS              0x01d7
#define SFLASH_AT_BUF1_WRITE          0x0384
#define SFLASH_AT_BUF2_WRITE          0x0387
#define SFLASH_AT_BUF1_ERASE_PROGRAM  0x0283
#define SFLASH_AT_BUF2_ERASE_PROGRAM  0x0286
#define SFLASH_AT_BUF1_PROGRAM        0x0288
#define SFLASH_AT_BUF2_PROGRAM        0x0289
#define SFLASH_AT_PAGE_ERASE          0x0281
#define SFLASH_AT_BLOCK_ERASE         0x0250
#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
#define SFLASH_AT_BUF1_LOAD           0x0253
#define SFLASH_AT_BUF2_LOAD           0x0255
#define SFLASH_AT_BUF1_COMPARE        0x0260
#define SFLASH_AT_BUF2_COMPARE        0x0261
#define SFLASH_AT_BUF1_REPROGRAM      0x0258
#define SFLASH_AT_BUF2_REPROGRAM      0x0259

/* Status register bits for Atmel flashes */
#define SFLASH_AT_READY    0x80
#define SFLASH_AT_MISMATCH 0x40
#define SFLASH_AT_ID_MASK  0x38
#define SFLASH_AT_ID_SHIFT 3

#endif                          /* _SBCHIPC_H_ */


text:
/* -*- buffer-read-only: t -*- vi: set ro: */
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Tests of areadlink_with_size.
   Copyright (C) 2009-2011 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* Written by Eric Blake <ebb9@byu.net>, 2009.  */

#include <config.h>

#include "areadlink.h"

#include <fcntl.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>

#include "ignore-value.h"
#include "macros.h"

#define BASE "test-areadlink-with-size.t"

#include "test-areadlink.h"

int
main (void)
{
  /* Remove any leftovers from a previous partial run.  */
  ignore_value (system ("rm -rf " BASE "*"));

  return test_areadlink (areadlink_with_size, true);
}


text:
package net.bootsfaces.component.fetchBeanInfos;

import java.io.IOException;

import javax.el.ValueExpression;
import javax.faces.component.FacesComponent;
import javax.faces.context.FacesContext;

import net.bootsfaces.C;
import net.bootsfaces.utils.BsfUtils;

/**
 * <b:fetchBeanInfos> brings information about the outcome of the last validation to the client.
 * So you can ask from JavaScript whether the validation has failed, and which classes of messages
 * have been generated..
 *
 * @author Stephan Rauh
 */

@FacesComponent(FetchBeanInfos.COMPONENT_TYPE)
public class FetchBeanInfos extends FetchBeanInfosCore {

        public static final String COMPONENT_TYPE = C.BSFCOMPONENT + ".fetchBeanInfos.FetchBeanInfos";

	/**
	 * The component family for this component.
	 */
	public static final String COMPONENT_FAMILY = C.BSFCOMPONENT;

	public FetchBeanInfos() {
		setRendererType("net.bootsfaces.component.fetchBeanInfos.FetchBeanInfos");
	}

	@Override
	public String getFamily() {
		return COMPONENT_FAMILY;
	}

	/**
	 * Provide support to snake-case attribute in EL-expression items
	 */
	@Override
	public void setValueExpression(String name, ValueExpression binding) {
		name = BsfUtils.snakeCaseToCamelCase(name);
		super.setValueExpression(name, binding);
	}

	@Override
	public void encodeBegin(FacesContext context) throws IOException {
		super.encodeBegin(context);
	}
}


text:
'******************************************************************************************************
'  XmlCodeCommentRegion.vb - Gbtc
'
'  Copyright © 2015, Grid Protection Alliance.  All Rights Reserved.
'
'  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
'  the NOTICE file distributed with this work for additional information regarding copyright ownership.
'  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
'  not use this file except in compliance with the License. You may obtain a copy of the License at:
'
'      http://opensource.org/licenses/MIT
'
'  Unless agreed to in writing, the subject software distributed under the License is distributed on an
'  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
'  License for the specific language governing permissions and limitations.
'
'  Code Modification History:
'  ----------------------------------------------------------------------------------------------------
'  10/02/2015 - Stephen C. Wills
'       Generated original version of source code.
'
'******************************************************************************************************

Imports System
Imports System.ComponentModel.Design
Imports EnvDTE
Imports EnvDTE80
Imports Microsoft.VisualStudio.Shell

''' <summary>
''' Command handler
''' </summary>
Public NotInheritable Class XmlCodeCommentRegion

    ''' <summary>
    ''' Command ID.
    ''' </summary>
    Public Const CommandId As Integer = 258

    ''' <summary>
    ''' Command menu group (command set GUID).
    ''' </summary>
    Public Shared ReadOnly CommandSet As New Guid("e5b1a060-7d63-4673-9524-936d738bf413")

    ''' <summary>
    ''' VS Package that provides this command, not null.
    ''' </summary>
    Private ReadOnly package As package

    ''' <summary>
    ''' Initializes a new instance of the <see cref="XmlCodeCommentRegion"/> class.
    ''' Adds our command handlers for menu (the commands must exist in the command table file)
    ''' </summary>
    ''' <param name="package">Owner package, not null.</param>
    Private Sub New(package As package)
        If package Is Nothing Then
            Throw New ArgumentNullException("package")
        End If

        Me.package = package
        Dim commandService As OleMenuCommandService = Me.ServiceProvider.GetService(GetType(IMenuCommandService))
        If commandService IsNot Nothing Then
            Dim menuCommandId = New CommandID(CommandSet, CommandId)
            Dim menuCommand = New MenuCommand(AddressOf Me.MenuItemCallback, menuCommandId)
            commandService.AddCommand(menuCommand)
        End If
    End Sub

    ''' <summary>
    ''' Gets the instance of the command.
    ''' </summary>
    Public Shared Property Instance As XmlCodeCommentRegion

    ''' <summary>
    ''' Get service provider from the owner package.
    ''' </summary>
    Private ReadOnly Property ServiceProvider As IServiceProvider
        Get
            Return Me.package
        End Get
    End Property

    ''' <summary>
    ''' Initializes the singleton instance of the command.
    ''' </summary>
    ''' <param name="package">Owner package, Not null.</param>
    Public Shared Sub Initialize(package As package)
        Instance = New XmlCodeCommentRegion(package)
    End Sub

    ''' <summary>
    ''' This function is the callback used to execute the command when the menu item is clicked.
    ''' See the constructor to see how the menu item is associated with this function using
    ''' OleMenuCommandService service and MenuCommand class.
    ''' </summary>
    ''' <param name="sender">Event sender.</param>
    ''' <param name="e">Event args.</param>
    Private Sub MenuItemCallback(sender As Object, e As EventArgs)

        XmlCodeCommentRegion()

    End Sub

    Public Sub XmlCodeCommentRegion()

        Dim selection As EnvDTE.TextSelection
        Dim startPoint As EnvDTE.EditPoint
        Dim endPoint As TextPoint
        Dim commentStart As String

        selection = ApplicationObject.ActiveDocument.Selection()
        startPoint = selection.TopPoint.CreateEditPoint()
        endPoint = selection.BottomPoint
        commentStart = LineOrientedXmlCodeCommentStart()
        ApplicationObject.UndoContext.Open("Xml Code Comment Region")

        Try
            Do While (True)
                Dim line As Integer
                line = startPoint.Line
                startPoint.Insert(commentStart)
                startPoint.LineDown()
                startPoint.StartOfLine()
                If (line = endPoint.Line) Then Exit Do
            Loop
        Finally
            ' If an error occurred, then make sure that the undo context is cleaned up.
            ' Otherwise, the editor can be left in a perpetual undo context.
            ApplicationObject.UndoContext.Close()
        End Try

    End Sub

    Private Function LineOrientedXmlCodeCommentStart(Optional ByVal document As Document = Nothing) As String

        Dim extension As String

        If document Is Nothing Then document = ApplicationObject.ActiveDocument

        extension = document.Name

        If (extension.EndsWith(".cs") Or extension.EndsWith(".cpp") Or extension.EndsWith(".h") Or extension.EndsWith(".idl") Or extension.EndsWith(".jsl")) Then
            Return "/// "
        ElseIf (extension.EndsWith(".vb")) Then
            Return "''' "
        Else
            Throw New Exception("Unrecognized file type. You can add this file type by modifying the function LineOrientedXmlCodeCommentStart to include the extension of this file.")
        End If

    End Function

    Private ReadOnly Property ApplicationObject() As DTE2
        Get
            Return ServiceProvider.GetService(GetType(DTE))
        End Get
    End Property
End Class


text:
"""Tests for while_v2."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl.testing import parameterized

from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import meta_graph
from tensorflow.python.framework import ops
from tensorflow.python.grappler import tf_optimizer
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gradients_impl
from tensorflow.python.ops import list_ops
from tensorflow.python.ops import while_v2
from tensorflow.python.ops.control_flow_ops import while_loop as while_loop_v1
from tensorflow.python.ops.while_v2 import while_loop as while_loop_v2
from tensorflow.python.platform import test

class WhileV2Test(test.TestCase, parameterized.TestCase):

  def testSingleLoopVar(self):
    x = constant_op.constant(2.)
    ret = while_loop_v2(lambda v: v < 8., lambda v: v * v, [x])
    grad = gradients_impl.gradients(ret, [x])
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret), 16.)
      self.assertSequenceEqual(sess.run(grad), [32.])

  def testMultipleLoopVarsBasic(self):
    x = constant_op.constant(5.)
    y = constant_op.constant(3.)

    # x = 5.
    # y = 3.
    # while x < 45.:
    #   x = x * y
    ret = while_loop_v2(lambda v, _: v < 45., lambda v, w: (v * w, w), [x, y])
    # ret = [x*y^2, y]

    # Note: This is simply d_ret[0]/d_x since d_ret[1]/d_x is 0.
    grad = gradients_impl.gradients(ret, [x])  # [2*x*y]
    with self.cached_session() as sess:
      self.assertSequenceEqual(sess.run(ret), [45., 3.])
      self.assertSequenceEqual(sess.run(grad), [9.])

  def testMultipleLoopVars(self):
    x = constant_op.constant(5.)
    y = constant_op.constant(3.)

    # x = 5.
    # y = 3.
    # while x < 45.:
    #   x = x * y
    #   y = x + y
    ret = while_loop_v2(lambda v, _: v < 45., lambda v, w: (v * w, v + w),
                        [x, y])
    # ret = [y*x**2 + x*y**2, x*y + x + y]

    gradx_0 = gradients_impl.gradients(ret[0], [x])  # [2*x*y + y**2]
    gradx_1 = gradients_impl.gradients(ret[1], [x])  # [y + 1]
    gradx_2 = gradients_impl.gradients(ret, [x])  # [2*x*y + y**2 + 2*y + 1]
    grady_0 = gradients_impl.gradients(ret[0], [y])  # [2*x*y + x**2]
    grady_1 = gradients_impl.gradients(ret[1], [y])  # [x + 1]
    grady_2 = gradients_impl.gradients(ret, [y])  # [2*x*y + x**2 + x + 1]
    with self.cached_session() as sess:
      self.assertSequenceEqual(sess.run(ret), [120., 23.])
      self.assertSequenceEqual(sess.run(gradx_0), [39.])
      self.assertSequenceEqual(sess.run(gradx_1), [4.])
      self.assertSequenceEqual(sess.run(gradx_2), [43.])
      self.assertSequenceEqual(sess.run(grady_0), [55.])
      self.assertSequenceEqual(sess.run(grady_1), [6.])
      self.assertSequenceEqual(sess.run(grady_2), [61.])

  def testMultipleWhileLoops(self):
    x = constant_op.constant(2.)
    ret1 = while_loop_v2(lambda v: v < 4., lambda v: v * v, [x])  # x**2
    ret2 = while_loop_v2(lambda v: v < 16., lambda v: v * v, ret1)  # x**4
    grad = gradients_impl.gradients(ret2, [x])  # 4x**3
    grad_grad = gradients_impl.gradients(grad, [x])  # 12x**2
    with self.cached_session() as sess:
      self.assertSequenceEqual(sess.run(grad), [32.])
      self.assertSequenceEqual(sess.run(grad_grad), [48.])

  def testDoubleDerivative(self):
    x = constant_op.constant(2.)
    ret = while_loop_v2(lambda v: v < 8., lambda v: v**2, [x])  # x**4
    grad = gradients_impl.gradients(ret, [x])  # 4x**3
    grad_grad = gradients_impl.gradients(grad, [x])  # 12x**2
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret), 16.)
      self.assertSequenceEqual(sess.run(grad), [32.])
      self.assertSequenceEqual(sess.run(grad_grad), [48.])

  def testPruning(self):
    x = constant_op.constant(1)

    tensor_list = list_ops.empty_tensor_list(
        element_dtype=x.dtype, element_shape=x.shape)

    def Cond(x, tl):
      del tl  # Unused for Cond.
      return x < 5

    def Body(x, tl):
      return x + 1, list_ops.tensor_list_push_back(tl, x)

    outputs = while_loop_v1(Cond, Body, [x, tensor_list])

    train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
    train_op.append(outputs[0])

    def GetOptimizedGraph():
      mg = meta_graph.create_meta_graph_def(graph=ops.get_default_graph())
      rewriter_config = rewriter_config_pb2.RewriterConfig(
          constant_folding=rewriter_config_pb2.RewriterConfig.OFF,
          memory_optimization=rewriter_config_pb2.RewriterConfig.MANUAL)
      return tf_optimizer.OptimizeGraph(rewriter_config, mg)

    g = GetOptimizedGraph()
    self.assertEqual(len([n for n in g.node if n.op == "Enter"]), 1)

    stack = list_ops.tensor_list_stack(outputs[1], element_dtype=x.dtype)
    train_op.append(stack)
    g = GetOptimizedGraph()
    self.assertEqual(len([n for n in g.node if n.op == "Enter"]), 2)

  def testCaptureExternalTensorInCond(self):
    x = constant_op.constant(2.)
    y = constant_op.constant(1.)
    ret = while_loop_v2(lambda v: v + y < 9., lambda v: v * 3., [x])
    grad = gradients_impl.gradients(ret, [x])
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret), 18.)
      self.assertSequenceEqual(sess.run(grad), [9.])

  def testCaptureExternalTensorInBody(self):
    x = constant_op.constant(2.)
    y = constant_op.constant(3.)
    ret = while_loop_v2(lambda v: v < 8., lambda v: v * y, [x])
    grad = gradients_impl.gradients(ret, [x])
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret), 18.)
      self.assertSequenceEqual(sess.run(grad), [9.])

  def testLoopWithTensorListPushBack(self):
    x = constant_op.constant(2.)

    tensor_list = list_ops.empty_tensor_list(
        element_dtype=dtypes.float32, element_shape=ScalarShape())

    def Cond(x, tl):
      del tl  # Unused for Cond.
      return x < 5.

    def Body(x, tl):
      tl = list_ops.tensor_list_push_back(tl, x)
      tl = list_ops.tensor_list_push_back(tl, constant_op.constant(100.))
      return x**2., tl

    ret = while_loop_v2(Cond, Body, [x, tensor_list])
    grad = gradients_impl.gradients(ret[0], x)
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret[0]), 16.)
      self.assertSequenceEqual(sess.run(grad), [32.])

  def testDuplicateAccumulator(self):
    x = constant_op.constant(2.)

    tensor_list = list_ops.empty_tensor_list(
        element_dtype=dtypes.float32, element_shape=ScalarShape())

    def Cond(x, tl):
      del tl  # Unused for Cond.
      return x < 5.

    def Body(x, tl):
      # There is an accumulator in the loop already so we should not add
      # another.
      tl = list_ops.tensor_list_push_back(tl, x)
      return x**2., tl

    ret = while_loop_v2(Cond, Body, [x, tensor_list])

    for op in ops.get_default_graph().get_operations():
      if op.type == "While":
        while_op = op

    body_graph = while_v2._get_body_graph(while_op)
    # body_graph.inputs: [counter_arg, x_arg, tl_arg, *accumulators]
    x_input_t = body_graph.inputs[1]
    accumulator_count = len(
        [c for c in x_input_t.consumers() if c.type == "TensorListPushBack"])
    self.assertEqual(accumulator_count, 1)

    grad = gradients_impl.gradients(ret[0], x)
    with self.cached_session() as sess:
      self.assertEqual(sess.run(ret[0]), 16.)
      self.assertSequenceEqual(sess.run(grad), [32.])

  @parameterized.named_parameters(
      ("UnknownShape", None),
      ("PartiallyDefinedShape", [None, 2]),
      ("FullyDefinedShape", [1, 2]),
  )
  def testTensorListOutputElementShape(self, shape):

    def MatchShape(actual_tensor_shape):
      # Compare the shapes, treating None dimensions as equal. We do not
      # directly check actual_tensor_shape and tf.TensorShape(shape) for
      # equality because tf.Dimension.__eq__ returns None if either dimension is
      # None.
      if shape is None:
        self.assertIsNone(actual_tensor_shape.dims)
      else:
        self.assertListEqual(actual_tensor_shape.as_list(), shape)

    def GetAccumulatorForInputAtIndex(while_op, idx):
      body_graph = while_v2._get_body_graph(while_op)
      y_input_t = body_graph.inputs[idx]
      push_back_node = [c for c in y_input_t.consumers()
                        if c.type == "TensorListPushBack"][0]
      output_idx = body_graph.outputs.index(push_back_node.outputs[0])
      return while_op.outputs[output_idx]

    x = constant_op.constant(2.)
    y = array_ops.placeholder(dtype=dtypes.float32, shape=shape)

    # Forward pass.
    ret = while_loop_v2(lambda v, u: v < 8., lambda v, u: (v * v, u), [x, y])
    while_op = ret[0].op.inputs[0].op
    # Get the TensorList output of While op containing the accumulated values
    # of y.
    # while_op.inputs: [counter_arg, x_arg, y_arg, *accumulators]
    output = GetAccumulatorForInputAtIndex(while_op, 2)
    _, val = list_ops.tensor_list_pop_back(output,
                                           element_dtype=dtypes.float32)
    MatchShape(val.shape)

    # Gradient pass.
    grad = gradients_impl.gradients(ret[1], y)
    grad_while_op = grad[0].op
    # Get the TensorList output of gradient While op containing the accumulated
    # values of grad_y.
    # grad_while_op.inputs:
    # [counter_arg, total_iters_arg, grad_x_arg, grad_y_arg, *other_args]
    grad_output = GetAccumulatorForInputAtIndex(grad_while_op, 4)
    _, val = list_ops.tensor_list_pop_back(grad_output,
                                           element_dtype=dtypes.float32)
    MatchShape(val.shape)

  def _createWhile(self, name):
    """Helper function testDefaultName."""
    output = while_v2.while_loop(lambda i: i < 3, lambda i: i + 1,
                                 [constant_op.constant(0)])
    while_op = output.op.inputs[0].op
    self.assertEqual(while_op.type, "While")
    return while_op

  def testDefaultName(self):
    with ops.Graph().as_default():
      while_op = self._createWhile(None)
      self.assertEqual(while_op.name, "while")
      self.assertRegexpMatches(
          while_op.get_attr("cond").name, r"while_cond_\d*")
      self.assertRegexpMatches(
          while_op.get_attr("body").name, r"while_body_\d*")

    with ops.Graph().as_default():
      with ops.name_scope("foo"):
        while1_op = self._createWhile("")
        self.assertEqual(while1_op.name, "foo/while")
        self.assertRegexpMatches(
            while1_op.get_attr("cond").name, r"foo_while_cond_\d*")
        self.assertRegexpMatches(
            while1_op.get_attr("body").name, r"foo_while_body_\d*")

        while2_op = self._createWhile(None)
        self.assertEqual(while2_op.name, "foo/while_1")
        self.assertRegexpMatches(
            while2_op.get_attr("cond").name, r"foo_while_1_cond_\d*")
        self.assertRegexpMatches(
            while2_op.get_attr("body").name, r"foo_while_1_body_\d*")

def ScalarShape():
  return ops.convert_to_tensor([], dtype=dtypes.int32)

if __name__ == "__main__":
  test.main()


text:
#include <aws/email/model/SendRawEmailResult.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>

#include <utility>

using namespace Aws::SES::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;

SendRawEmailResult::SendRawEmailResult()
{
}

SendRawEmailResult::SendRawEmailResult(const AmazonWebServiceResult<XmlDocument>& result)
{
  *this = result;
}

SendRawEmailResult& SendRawEmailResult::operator =(const AmazonWebServiceResult<XmlDocument>& result)
{
  const XmlDocument& xmlDocument = result.GetPayload();
  XmlNode rootNode = xmlDocument.GetRootElement();
  XmlNode resultNode = rootNode;
  if (rootNode.GetName() != "SendRawEmailResult")
  {
    resultNode = rootNode.FirstChild("SendRawEmailResult");
  }

  if(!resultNode.IsNull())
  {
    XmlNode messageIdNode = resultNode.FirstChild("MessageId");
    if(!messageIdNode.IsNull())
    {
      m_messageId = StringUtils::Trim(messageIdNode.GetText().c_str());
    }
  }

  XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata");
  m_responseMetadata = responseMetadataNode;
  AWS_LOGSTREAM_DEBUG("Aws::SES::Model::SendRawEmailResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );

  return *this;
}


text:
'use strict';

var React = require('react');
var CtrApp = require('./Controler_App.js');
var CtrAPI = require('./Controller_QuestetraAPI.js');

// data[13].email
module.exports = React.createClass({
	displayName: 'exports',
	_valueToViewValue: function _valueToViewValue(value) {
		if (!value || value.length == 0) {
			value = "not set";
		}
		return value;
	},
	getInitialState: function getInitialState() {
		console.log("getInitialState");
		if (this.props.formData) {
			var value = this._valueToViewValue(this.props.formData.value);

			return {
				id: this.props.formData.id,
				htmlId: "input-" + this.props.formData.id,
				label: this.props.formData.name,
				accessibility: this.props.formData.accessibility,
				inputName: "data[" + this.props.formData.number + "].email",
				value: value,
				viewValue: value,
				users: this.props.users,
				error: this.props.error || null,
				required: this.props.formData.required,
				description: this.props.formData.description
			};
		} else {
			return {
				id: null,
				htmlId: null,
				label: null,
				accessibility: 0,
				inputName: null,
				value: "not set",
				viewValue: "not set",
				users: [],
				error: null,
				required: false,
				description: null
			};
		}
	},

	componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
		// PROPS が変更された時
		//console.log("componentWillReceiveProps");
		if (this.isMounted()) {
			this.setState({
				error: nextProps.error || null,
				users: nextProps.users || []
			});
		};
	},
	onValueChange: function onValueChange(e) {
		// 値が変更されたら親に通知
		var email = e.target.value;

		this.setState({
			viewValue: email
		});

		if (email == "not set") {
			this.props.onChange(this.state.inputName, "");
		} else {
			this.props.onChange(this.state.inputName, email);
		}
	},
	setMe: function setMe(e) {
		var me = CtrApp.Store.getMe();
		this.setState({
			viewValue: me.email
		});
		this.props.onChange(this.state.inputName, me.email);
	},
	componentDidMount: function componentDidMount() {
		if (this.isMounted()) {
			this.props.onChange(this.state.inputName, this.state.value);
		};
	},
	render: function render() {
		if (this.state.id) {
			var desc;
			if (this.state.description) {
				desc = React.createElement(
					'small',
					{ className: 'form-text text-muted' },
					this.state.description
				);
			}
			if (this.state.accessibility == CtrAPI.FormAccessbility.R) {
				return React.createElement(
					'div',
					{ className: 'form-group' },
					React.createElement(
						'label',
						null,
						this.state.label
					),
					React.createElement(
						'div',
						null,
						this.state.value
					),
					desc
				);
			} else {
				var wrapperClasses = ["form-group"];
				var inputClasses = ['form-control'];

				//console.log(this.props.users);
				//console.log(this.state.users);
				var userOptions = [React.createElement(
					'option',
					{ value: 'not set', key: "formitem-" + this.state.id + "--1" },
					'not set'
				)];
				for (var i = 0; i < this.props.users.length; i++) {
					var user = this.props.users[i];
					userOptions.push(React.createElement(
						'option',
						{ value: user.email, key: "formitem-" + this.state.id + "-" + i },
						user.name
					));
				}

				var error;
				if (this.state.error) {
					// エラー表示
					wrapperClasses.push("has-danger");
					inputClasses.push("form-control-danger");
					error = React.createElement(
						'small',
						{ className: 'form-control-feedback' },
						this.props.error
					);
				} else if (this.state.required) {
					// 必須表示
					wrapperClasses.push("has-warning");
					inputClasses.push("form-control-warning");
				}

				return React.createElement(
					'div',
					{ className: wrapperClasses.join(" ") },
					React.createElement(
						'label',
						null,
						this.state.label
					),
					React.createElement(
						'div',
						{ className: 'input-group' },
						React.createElement(
							'select',
							{ name: this.state.inputName, value: this.state.viewValue, required: this.state.required, className: inputClasses.join(" "), onChange: this.onValueChange },
							userOptions
						),
						React.createElement(
							'div',
							{ className: 'input-group-addon', onClick: this.setMe },
							'\u79C1'
						)
					),
					desc,
					error
				);
			}
		}
	}
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC  "-//CL//DTD XHTML 1.0 Transitional plus Embed//EN"
  "http://www.w3.org/Graphics/xhtml1-transitional-plus-embed.dtd">

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <meta name="keywords" content="W3C SVG 1.1 2nd Edition Test Suite"/>
      <meta name="description" content="W3C SVG 1.1 2nd Edition Embedded Test Suite"/>
      <title>
SVG 1.1 2nd Edition Test (<embed>): svgdom-over-01-f.svg
      </title>

      <link rel="prev" href="styling-pres-05-f.html" />
      <link rel="index" href="index.html" />
      <link rel="next" href="text-align-01-b.html" />

Specification link:

    styling-pres-05-f ←
    index
    → text-align-01-b

    Tests that contain the draft-watermark are under development and may be incorrectly testing a feature.

svgdom-over-01-f.svg

            SVG Image

            PNG Image

            <embed src="../../svg/svgdom-over-01-f.svg" width="480" height="360"/>

      Operator Script

        Run the test. No interaction required.

    Pass Criteria

      	The test has passed if there is a line of text saying "Test status: PASSED", and there is a green rectangle to the left of that text.

    Test Description

      	This tests how unspecified attributes affect the return values from the
      	SVG DOM methods related to attributes.

      	After loading the test, you should see a list of red or green rectangles followed by some text describing each subtest.

    styling-pres-05-f ←
    index
    → text-align-01-b


text:
package nl.minvenj.nfi.storm.kafka.util;

import java.io.Serializable;

/**
 * Convenience class representing an orderable 2-tuple of a kafka message's partition and offset within that partition.
 * The natural order of {@link KafkaMessageId} is identical to the ordering in a kafka partition.
 *
 * @author Netherlands Forensics Institute
 */
public class KafkaMessageId implements Comparable<KafkaMessageId>, Serializable {
    private final int _partition;
    private final long _offset;

    public KafkaMessageId(final int partition, final long offset) {
        _partition = partition;
        _offset = offset;
    }

    public int getPartition() {
        return _partition;
    }

    public long getOffset() {
        return _offset;
    }

    /**
     * {@link KafkaMessageId}s are considered equal when both their partition and offset are identical.
     *
     * @param o The object to compare with.
     * @return Whether {@code o} is considered to be equal to this {@link KafkaMessageId}.
     */
    @Override
    public boolean equals(final Object o) {
        if (o instanceof KafkaMessageId) {
            final KafkaMessageId other = (KafkaMessageId) o;
            return other.getPartition() == _partition && other.getOffset() == _offset;
        }
        else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        // create a hash code using all bits of both identifying members
        return (31 + _partition) * (int) (_offset ^ (_offset >>> 32));
    }

    /**
     * Compares this {@link KafkaMessageId} to {@code id}. Comparison is made numerically, where the partition is
     * considered more significant than the offset within the partition. The resulting ordering of
     * {@link KafkaMessageId} is identical to the ordering in a kafka partition.
     * An instance is considered greater than {@code null}.
     *
     * @param id The {@link KafkaMessageId} to compare with.
     * @return The result of {@code 2 * signum(partition - id.getPartition()) + signum(offset - id.getOffset())} or
     *         {@code 1} if {@code id} is null.
     */
    @Override
    public int compareTo(final KafkaMessageId id) {
        // instance is always > null
        if (id == null) {
            return 1;
        }
        // use signum to perform the comparison, mark _partition more significant than _offset
        return 2 * Integer.signum(_partition - id.getPartition()) + Long.signum(_offset - id.getOffset());
    }

    @Override
    public String toString() {
        return "(" + _partition + "," + _offset + ")";
    }
}


text:
module.exports = {
    describe: function(desc, callback) {
        console.log('[INFO] - ' + desc);
        callback();
        console.log('[INFO] - End of ' + desc);
    },
    it: function(desc, callback) {
        callback();
        console.log('[  OK] - ' + desc);
    }
};


text:
package org.apache.accumulo.core.file.blockfile.cache.tinylfu;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

import org.apache.accumulo.core.file.blockfile.cache.impl.ClassSize;
import org.apache.accumulo.core.file.blockfile.cache.impl.SizeConstants;
import org.apache.accumulo.core.spi.cache.BlockCache;
import org.apache.accumulo.core.spi.cache.BlockCacheManager.Configuration;
import org.apache.accumulo.core.spi.cache.CacheEntry;
import org.apache.accumulo.core.spi.cache.CacheEntry.Weighable;
import org.apache.accumulo.core.spi.cache.CacheType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Policy;
import com.github.benmanes.caffeine.cache.stats.CacheStats;
import com.google.common.util.concurrent.ThreadFactoryBuilder;

/**
 * A block cache that is memory bounded using the W-TinyLFU eviction algorithm. This implementation
 * delegates to a Caffeine cache to provide concurrent O(1) read and write operations.
 *

 *
W-TinyLFU: http://arxiv.org/pdf/1512.00727.pdf

 *
Caffeine: https://github.com/ben-manes/caffeine

 *
Cache design: http://highscalability.com/blog/2016/1/25/design-of-a-modern-cache.html

 *

 */
public final class TinyLfuBlockCache implements BlockCache {
  private static final Logger log = LoggerFactory.getLogger(TinyLfuBlockCache.class);
  private static final int STATS_PERIOD_SEC = 60;

  private Cache<String,Block> cache;
  private Policy.Eviction<String,Block> policy;
  private ScheduledExecutorService statsExecutor;

  public TinyLfuBlockCache(Configuration conf, CacheType type) {
    cache = Caffeine.newBuilder()
        .initialCapacity((int) Math.ceil(1.2 * conf.getMaxSize(type) / conf.getBlockSize()))
        .weigher((String blockName, Block block) -> {
          int keyWeight = ClassSize.align(blockName.length()) + ClassSize.STRING;
          return keyWeight + block.weight();
        }).maximumWeight(conf.getMaxSize(type)).recordStats().build();
    policy = cache.policy().eviction().get();
    statsExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder()
        .setNameFormat("TinyLfuBlockCacheStatsExecutor").setDaemon(true).build());
    statsExecutor.scheduleAtFixedRate(this::logStats, STATS_PERIOD_SEC, STATS_PERIOD_SEC,
        TimeUnit.SECONDS);
  }

  @Override
  public long getMaxHeapSize() {
    return getMaxSize();
  }

  @Override
  public long getMaxSize() {
    return policy.getMaximum();
  }

  @Override
  public CacheEntry getBlock(String blockName) {
    return wrap(blockName, cache.getIfPresent(blockName));
  }

  @Override
  public CacheEntry cacheBlock(String blockName, byte[] buffer) {
    return wrap(blockName, cache.asMap().compute(blockName, (key, block) -> {
      return new Block(buffer);
    }));
  }

  @Override
  public BlockCache.Stats getStats() {
    CacheStats stats = cache.stats();
    return new BlockCache.Stats() {
      @Override
      public long hitCount() {
        return stats.hitCount();
      }

      @Override
      public long requestCount() {
        return stats.requestCount();
      }
    };
  }

  private void logStats() {
    double maxMB = ((double) policy.getMaximum()) / ((double) (1024 * 1024));
    double sizeMB = ((double) policy.weightedSize().getAsLong()) / ((double) (1024 * 1024));
    double freeMB = maxMB - sizeMB;
    log.debug("Cache Size={}MB, Free={}MB, Max={}MB, Blocks={}", sizeMB, freeMB, maxMB,
        cache.estimatedSize());
    log.debug(cache.stats().toString());
  }

  private static final class Block {

    private final byte[] buffer;
    private Weighable index;
    private volatile int lastIndexWeight;

    Block(byte[] buffer) {
      this.buffer = buffer;
      this.lastIndexWeight = buffer.length / 100;
    }

    int weight() {
      int indexWeight = lastIndexWeight + SizeConstants.SIZEOF_INT + ClassSize.REFERENCE;
      return indexWeight + ClassSize.align(getBuffer().length) + SizeConstants.SIZEOF_LONG
          + ClassSize.REFERENCE + ClassSize.OBJECT + ClassSize.ARRAY;
    }

    public byte[] getBuffer() {
      return buffer;
    }

    @SuppressWarnings("unchecked")
    public synchronized <T extends Weighable> T getIndex(Supplier<T> supplier) {
      if (index == null) {
        index = supplier.get();
      }

      return (T) index;
    }

    public synchronized boolean indexWeightChanged() {
      if (index != null) {
        int indexWeight = index.weight();
        if (indexWeight > lastIndexWeight) {
          lastIndexWeight = indexWeight;
          return true;
        }
      }

      return false;
    }
  }

  private CacheEntry wrap(String cacheKey, Block block) {
    if (block != null) {
      return new TlfuCacheEntry(cacheKey, block);
    }

    return null;
  }

  private class TlfuCacheEntry implements CacheEntry {

    private final String cacheKey;
    private final Block block;

    TlfuCacheEntry(String k, Block b) {
      this.cacheKey = k;
      this.block = b;
    }

    @Override
    public byte[] getBuffer() {
      return block.getBuffer();
    }

    @Override
    public <T extends Weighable> T getIndex(Supplier<T> supplier) {
      return block.getIndex(supplier);
    }

    @Override
    public void indexWeightChanged() {
      if (block.indexWeightChanged()) {
        // update weight
        cache.put(cacheKey, block);
      }
    }
  }

  private Block load(Loader loader, Map<String,byte[]> resolvedDeps) {
    byte[] data = loader.load((int) Math.min(Integer.MAX_VALUE, policy.getMaximum()), resolvedDeps);
    if (data == null) {
      return null;
    }

    return new Block(data);
  }

  private Map<String,byte[]> resolveDependencies(Map<String,Loader> deps) {
    if (deps.size() == 1) {
      Entry<String,Loader> entry = deps.entrySet().iterator().next();
      CacheEntry ce = getBlock(entry.getKey(), entry.getValue());
      if (ce == null) {
        return null;
      }
      return Collections.singletonMap(entry.getKey(), ce.getBuffer());
    } else {
      HashMap<String,byte[]> resolvedDeps = new HashMap<>();
      for (Entry<String,Loader> entry : deps.entrySet()) {
        CacheEntry ce = getBlock(entry.getKey(), entry.getValue());
        if (ce == null) {
          return null;
        }
        resolvedDeps.put(entry.getKey(), ce.getBuffer());
      }
      return resolvedDeps;
    }
  }

  @Override
  public CacheEntry getBlock(String blockName, Loader loader) {
    Map<String,Loader> deps = loader.getDependencies();
    Block block;
    if (deps.size() == 0) {
      block = cache.get(blockName, k -> load(loader, Collections.emptyMap()));
    } else {
      // This code path exist to handle the case where dependencies may need to be loaded. Loading
      // dependencies will access the cache. Cache load functions
      // should not access the cache.
      block = cache.getIfPresent(blockName);

      if (block == null) {
        // Load dependencies outside of cache load function.
        Map<String,byte[]> resolvedDeps = resolveDependencies(deps);
        if (resolvedDeps == null) {
          return null;
        }

        // Use asMap because it will not increment stats, getIfPresent recorded a miss above. Use
        // computeIfAbsent because it is possible another thread loaded
        // the data since this thread called getIfPresent.
        block = cache.asMap().computeIfAbsent(blockName, k -> load(loader, resolvedDeps));
      }
    }

    return wrap(blockName, block);
  }
}


text:
![progress stepper](./img/progress-stepper.png)

The progress stepper is useful for tracking the progress of linear, step-wise tasks.

### [Dual list selector with drag and drop](https://www.patternfly.org/v4/components/dual-list-selector#reordering-lists-using-drag-and-drop)

![dual list selector with drag and drop reordering](./img/dual-list-draggable.png)

Adds the ability to manually reorder the selected list in a dual list selector.

### [Flyout navigation](https://www.patternfly.org/v4/components/navigation#flyout)

![flyout navigation menu](./img/flyout-nav.png)

Adds a new flyout navigation variant that can be used to expose nested pages in a deep page hierarchy.

### [Link styling for banners](https://www.patternfly.org/v4/components/banner/html#banner-with-links)

![banner with an embedded link](./img/banner-with-link.png)

Adds special visual styling for links that are embedded inside a banner component.

See the [latest release notes](https://www.patternfly.org/v4/developer-resources/release-notes) for a more detailed list of changes.

-----------------------------------------------------------------------------

## What we're working on...

### 2021.14 (October 29)

* [Compact label](https://github.com/patternfly/patternfly-react/issues/6404) - adds a compact label variant that takes less vertical space to better fit inline with text in a table cell.

* [Plain menu variant](https://github.com/patternfly/patternfly-react/issues/6367) - adds a "plain" variant of the Menu component that does not have borders for use inline within a form.

### 2021.15 (November 19)

* [Key-value filtering](https://github.com/patternfly/patternfly-react/issues/6393) - demonstrate how to create a multi-select, key-value filter using existing components.

* [Update selected state visuals for Cards and Tiles](https://github.com/patternfly/patternfly/issues/4358) - introduce new visuals for selectable cards and tiles that are better differentiated from browser focus states.

* [Non-actionable card](https://github.com/patternfly/patternfly/issues/4359) - introduce special styling for "non-actionable" cards that are included inside a grid of actionable cards (e.g. in a catalog view).

* [Horizontal table scrolling with sticky columns](https://github.com/patternfly/patternfly-react/issues/6163) - Allow a table to scroll horizontally while keeping some number of columns always visible.

* [Allow control over default table sort direction](https://github.com/patternfly/patternfly-react/issues/5329) - will allow the consumer to select whether the default sort should be ascending or descending when initially clicking on a column header.

For a complete roadmap showing all items planned in future releases, see our [PatternFly Feature Roadmap](https://github.com/orgs/patternfly/projects/4?fullscreen=true) project board.


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.fabricioph.pi_student.OutsideClassQuestionCreateActivity" >

    <item
        android:id="@+id/outside_class_question_create_action_save"
        android:icon="@drawable/ic_action_save"
        android:orderInCategory="100"
        android:showAsAction="always"
        android:title="@string/action_save"/>

</menu>


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

    Copyright 2012-2021 The Feign Authors

    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.

-->
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.github.openfeign</groupId>
    <artifactId>parent</artifactId>
    <version>11.7-SNAPSHOT</version>
  </parent>

  <artifactId>feign-example-github</artifactId>
  <packaging>jar</packaging>
  <name>GitHub Example</name>

  <properties>
    <main.basedir>${project.basedir}/..</main.basedir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.github.openfeign</groupId>
      <artifactId>feign-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.github.openfeign</groupId>
      <artifactId>feign-gson</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-exec</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>example.github.GitHubExample</mainClass>
                </transformer>
              </transformers>
              <createDependencyReducedPom>false</createDependencyReducedPom>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.skife.maven</groupId>
        <artifactId>really-executable-jar-maven-plugin</artifactId>
        <version>1.5.0</version>
        <configuration>
          <programFile>github</programFile>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>really-executable-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <!--
              Travis does not inject GITHUB_TOKEN when building PRs, which will make module fail
              https://docs.travis-ci.com/user/environment-variables/#defining-encrypted-variables-in-travisyml

              ignoring test errors for any build that is not master
          -->
          <testFailureIgnore>true</testFailureIgnore>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <activation>
        <property>
          <name>env.TRAVIS_PULL_REQUEST</name>
          <value>false</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <testFailureIgnore>false</testFailureIgnore>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


text:
.. image:: ../../../Images/Synapse.png
   :width: 64
   :height: 64
   :align: left

Synapses
========

.. class:: network.synapse.Synapse

A Synapse object represents a chemical synapse between a single pre-synaptic neurite and one or more post-synaptic neurites.

Instances of this class are created by using the synapseOn method of :meth:`Neuron <network.neuron.Neuron.synapseOn>` and :meth:`Neurite <network.neurite.Neurite.synapseOn>` objects.

>>> neuron1.synapseOn(neuron2, activation = 'excitatory')

.. attribute:: network.synaspe.Synapse.activation

	The activation of the synapse, one of None (meaning unknown), 'excitatory' or 'inhibitory'

.. attribute:: network.synaspe.Synapse.preSynapticNeurite

	The :class:`neurite <network.neurite.Neurite>` that is pre-synaptic.

.. attribute:: network.synaspe.Synapse.postSynapticNeurites

	The list of :class:`neurites <network.neurite.Neurite>` that are post-synaptic.