text:
'use strict';

// Test that fs.copyFile() respects file permissions.
// Ref: https://github.com/nodejs/node/issues/26936

const common = require('../common');

if (!common.isWindows && process.getuid() === 0)
  common.skip('as this test should not be run as `root`');

if (common.isIBMi)
  common.skip('IBMi has a different access permission mechanism');

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

const assert = require('assert');
const fs = require('fs');
const path = require('path');

let n = 0;

function beforeEach() {
  n++;
  const source = path.join(tmpdir.path, `source${n}`);
  const dest = path.join(tmpdir.path, `dest${n}`);
  fs.writeFileSync(source, 'source');
  fs.writeFileSync(dest, 'dest');
  fs.chmodSync(dest, '444');

  const check = (err) => {
    const expected = ['EACCES', 'EPERM'];
    assert(expected.includes(err.code), `${err.code} not in ${expected}`);
    assert.strictEqual(fs.readFileSync(dest, 'utf8'), 'dest');
    return true;
  };

  return { source, dest, check };
}

// Test synchronous API.
{
  const { source, dest, check } = beforeEach();
  assert.throws(() => { fs.copyFileSync(source, dest); }, check);
}

// Test promises API.
{
  const { source, dest, check } = beforeEach();
  (async () => {
    await assert.rejects(fs.promises.copyFile(source, dest), check);
  })();
}

// Test callback API.
{
  const { source, dest, check } = beforeEach();
  fs.copyFile(source, dest, common.mustCall(check));
}

redpajama_set_name: RedPajamaGithub


text:
#pragma once

#include <vector>
#include <opencv/cv.h>
#include <boost/noncopyable.hpp>

//点が領域の内にあるか外にあるかを調べるクラス
//AddPointした数が2点以下の時,IsPointInnerの戻り値は必ずtrue

class CPolygonalRegion
{
public:
  CPolygonalRegion();

  //四角形
  CPolygonalRegion(double dX1, double dY1, double dX2, double dY2);
  virtual ~CPolygonalRegion(void);

  CPolygonalRegion(const CPolygonalRegion &r);
  CPolygonalRegion & operator = (const CPolygonalRegion &r);

  size_t GetSize() const;
  bool IsPointInner(double x, double y) const;

  void AddPoint(double x, double y);
  void RemoveLast();
  void Reset();

  void GetPoints(std::vector<BoostVec> &rvVec) const;
  CvPoint GetPoint(size_t n) const;

  double GetXMin() const {return _dXMin;}
  double GetXMax() const {return _dXMax;}
  double GetYMin() const {return _dYMin;}
  double GetYMax() const {return _dYMax;}

  //座標系に平行な矩形領域を選択
  void SetRectangleRegion(double dX1, double dY1, double dX2, double dY2);

protected:

  double _dXMin;
  double _dXMax;
  double _dYMin;
  double _dYMax;

  CvMemStorage *_storage1;
  CvSeq* _pPointsOuter;

};


text:
/*************************************************************************/
/*  PaymentsCache.java                                                   */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

package org.godotengine.godot.payments;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class PaymentsCache {

	public Context context;

	public PaymentsCache(Context context) {
		this.context = context;
	}

	public void setConsumableFlag(String set, String sku, Boolean flag) {
		SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = sharedPref.edit();
		editor.putBoolean(sku, flag);
		editor.apply();
	}

	public boolean getConsumableFlag(String set, String sku) {
		SharedPreferences sharedPref = context.getSharedPreferences(
				"consumables_" + set, Context.MODE_PRIVATE);
		return sharedPref.getBoolean(sku, false);
	}

	public void setConsumableValue(String set, String sku, String value) {
		SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = sharedPref.edit();
		editor.putString(sku, value);
		//Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
		editor.apply();
	}

	public String getConsumableValue(String set, String sku) {
		SharedPreferences sharedPref = context.getSharedPreferences(
				"consumables_" + set, Context.MODE_PRIVATE);
		//Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
		return sharedPref.getString(sku, null);
	}
}


text:
@extends('layouts.sb-admin-2')

@section('title')
Create | Global BIM Dashboard
@stop

@section('script-front')

    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <link href="../bower_components/startbootstrap-sb-admin-2/dist/css/sb-admin-2.css" rel="stylesheet">

    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

@stop

@section('script-rear')

@stop

@section('page-wrapper')

SLIM BIM Model Survey

 {{HTML::ul($errors->all()) }}

{{Form::open(array('route'=>'slimtestvalues.store')) }}

{{ Form::label('country','Country')}}

{{ Form::select('country', $codes ,array('class'=>'form-control')) }}

{{ Form::label('year','Year') }}

	{{ Form::select('year',array('2009'=>'2009','2010'=>'2010','2012'=>'2012','2013'=>'2013'),Input::old('year'),array('class'=>'form-control')) }}

	{{ Form::label('adoption','Adoption') }}

		{{ Form::number('adoption',Input::old('adoption'),array('class'=>'form-control'))}}%

	{{ Form::label('years','Years') }}

	{{ Form::number('years',Input::old('years'),array('class'=>'form-control')) }}%

	{{ Form::label('depth','Depth') }}

	{{ Form::number('depth',Input::old('depth'),array('class'=>'form-control')) }}%

	{{ Form::label('expertise','Expertise') }}

	{{ Form::number('expertise',Input::old('expertise'),array('class'=>'form-control')) }}%

{{ Form::submit('Submit the Survey!',array('class'=>'btn btn-primary')) }}

{{ Form::close() }}

@stop


text:
exports = module.exports = function(app, config, mongoose, nodemailer){

	var userSchema = new mongoose.Schema({
		username: {type: String},
		email: {type: String},
		first_name: {type: String},
		last_name: {type: String},
		hashed_password: {type: String},
		address: [
			{
				name: {type: String},
				street: {type: String},
				city: {type: String},
				state: {type: String},
				zip: {type: Number}
			}
		],
		payment_methods: [{
			name: {type: String},
			last_four: {type: Number},
			crypted_number: {type: Number},
			expiration_date: {type: Date}
		}]
	});
	mongoose.userSchema = userSchema;

	var User = mongoose.model('User', userSchema);

	User.findOne({username:'admin'},function(err,doc){
		if(!doc){
			var user = User({
				username: 'admin',
				email: 'admin@test.com',
				address: [{
					name: 'admin',
					street: 'street',
					city: 'city',
					state: 'state',
					zip: 100000
				}],
				payment_methods:[{
					name: 'admin',
					last_four: 1234,
					crypted_number: 123456,
					expiration_date: new Date()
				}]
			});
			user.save();
		}
	});
	User.findOne({username:'user'},function(err,doc){
		if(!doc){
			var user = User({
				username: 'user',
				email: 'user@test.com',
				address: [{
					name: 'user',
					street: 'street',
					city: 'city',
					state: 'state',
					zip: 100000
				}],
				payment_methods:[{
					name: 'user',
					last_four: 1234,
					crypted_number: 123456,
					expiration_date: new Date()
				}]
			});
			user.save();
		}
	});};


text:
package org.kie.wires.core.client.actions;

import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.RequiresResize;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.errai.ioc.client.container.SyncBeanManager;
import org.uberfire.client.annotations.WorkbenchPartTitle;
import org.uberfire.client.annotations.WorkbenchPartView;
import org.uberfire.client.annotations.WorkbenchScreen;

@Dependent
@WorkbenchScreen(identifier = "WiresActionsScreen")
public class ActionsScreen extends Composite implements RequiresResize {

    interface ViewBinder extends UiBinder<Widget, ActionsScreen> {

    }

    private static ViewBinder uiBinder = GWT.create( ViewBinder.class );

    @UiField
    public SimplePanel actions;

    @Inject
    private SyncBeanManager iocManager;

    @PostConstruct
    public void init() {
        initWidget( uiBinder.createAndBindUi( this ) );
        actions.add( iocManager.lookupBean( ActionsGroup.class ).getInstance() );
    }

    @WorkbenchPartTitle
    @Override
    public String getTitle() {
        return "Actions";
    }

    @WorkbenchPartView
    public IsWidget getView() {
        return this;
    }

    @Override
    public void onResize() {
        int height = getParent().getOffsetHeight();
        int width = getParent().getOffsetWidth();
        super.setPixelSize( width, height );
    }

}


text:
package cn.newcapec.jwxt.jcxxgl.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * JwxtXkxtXqxf entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="JWXT_XKXT_XQXF"
    ,schema="JWXT"
)

public class JwxtXkxtXqxf extends cn.newcapec.function.digitalcampus.common.model.AbstractModel implements java.io.Serializable {

    // Fields

     private String id;
     private String nj;
     private String xq;
     private BigDecimal xxkms;
     private Double xxkfs;
     private BigDecimal gxkms;
     private Double gxkfs;
     private String cjr;
     private String jlssdw;
     private Date whsj;
     private Date cjsj;

    // Constructors

    /** default constructor */
    public JwxtXkxtXqxf() {
    }

	/** minimal constructor */
    public JwxtXkxtXqxf(String id, String nj, String xq, BigDecimal xxkms, Double xxkfs, BigDecimal gxkms, Double gxkfs, String cjr, String jlssdw, Date cjsj) {
        this.id = id;
        this.nj = nj;
        this.xq = xq;
        this.xxkms = xxkms;
        this.xxkfs = xxkfs;
        this.gxkms = gxkms;
        this.gxkfs = gxkfs;
        this.cjr = cjr;
        this.jlssdw = jlssdw;
        this.cjsj = cjsj;
    }

    /** full constructor */
    public JwxtXkxtXqxf(String id, String nj, String xq, BigDecimal xxkms, Double xxkfs, BigDecimal gxkms, Double gxkfs, String cjr, String jlssdw, Date whsj, Date cjsj) {
        this.id = id;
        this.nj = nj;
        this.xq = xq;
        this.xxkms = xxkms;
        this.xxkfs = xxkfs;
        this.gxkms = gxkms;
        this.gxkfs = gxkfs;
        this.cjr = cjr;
        this.jlssdw = jlssdw;
        this.whsj = whsj;
        this.cjsj = cjsj;
    }

    // Property accessors
    @Id

    @Column(name="ID", unique=true, nullable=false, length=32)

    public String getId() {
        return this.id;
    }

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

    @Column(name="NJ", nullable=false, length=32)

    public String getNj() {
        return this.nj;
    }

    public void setNj(String nj) {
        this.nj = nj;
    }

    @Column(name="XQ", nullable=false, length=32)

    public String getXq() {
        return this.xq;
    }

    public void setXq(String xq) {
        this.xq = xq;
    }

    @Column(name="XXKMS", nullable=false, precision=22, scale=0)

    public BigDecimal getXxkms() {
        return this.xxkms;
    }

    public void setXxkms(BigDecimal xxkms) {
        this.xxkms = xxkms;
    }

    @Column(name="XXKFS", nullable=false, precision=9)

    public Double getXxkfs() {
        return this.xxkfs;
    }

    public void setXxkfs(Double xxkfs) {
        this.xxkfs = xxkfs;
    }

    @Column(name="GXKMS", nullable=false, precision=22, scale=0)

    public BigDecimal getGxkms() {
        return this.gxkms;
    }

    public void setGxkms(BigDecimal gxkms) {
        this.gxkms = gxkms;
    }

    @Column(name="GXKFS", nullable=false, precision=9)

    public Double getGxkfs() {
        return this.gxkfs;
    }

    public void setGxkfs(Double gxkfs) {
        this.gxkfs = gxkfs;
    }

    @Column(name="CJR", nullable=false, length=32)

    public String getCjr() {
        return this.cjr;
    }

    public void setCjr(String cjr) {
        this.cjr = cjr;
    }

    @Column(name="JLSSDW", nullable=false, length=32)

    public String getJlssdw() {
        return this.jlssdw;
    }

    public void setJlssdw(String jlssdw) {
        this.jlssdw = jlssdw;
    }
    @Temporal(TemporalType.DATE)
    @Column(name="WHSJ", length=7)

    public Date getWhsj() {
        return this.whsj;
    }

    public void setWhsj(Date whsj) {
        this.whsj = whsj;
    }
    @Temporal(TemporalType.DATE)
    @Column(name="CJSJ", nullable=false, length=7)

    public Date getCjsj() {
        return this.cjsj;
    }

    public void setCjsj(Date cjsj) {
        this.cjsj = cjsj;
    }

}


text:
package org.pathvisio.visualization;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.pathvisio.desktop.plugin.Plugin;
import org.pathvisio.visualization.plugins.VisualizationPlugin;

public class Activator implements BundleActivator {

	@Override
	public void start(BundleContext context) throws Exception {

		VisualizationPlugin plugin = new VisualizationPlugin();
		context.registerService(Plugin.class.getName(), plugin, null);

	}

	@Override
	public void stop(BundleContext context) throws Exception {
		// TODO Auto-generated method stub

	}

}


text:
{% import '../../macro/depends.html' as m_depends %}

{% if ! opts.filter %}

    {{ field.settings.label }}

        <button type="button" class="btn btn-primary btn-sm" data-index="0" onclick="addObject(this, '{{ name }}', '{{ field.alias }}');">
            + add {{ field.settings.label|lowerCase }}
        </button>

{% endif %}


text:
package behavioral.patterns.chain_of_responsibility;

/**
 * Handler for images.
 * It holds a reference to the next handler in the chain.
 */

public class ImageFileHandler implements Handler{
    private Handler handler;
    private String handlerName;

    public ImageFileHandler(String handlerName) {
        this.handlerName = handlerName;
    }

    @Override
    public void setHandler(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void process(File file) {
        if (file.getFileType().equals("image")) {
            System.out.println("Process and saving image... by " + handlerName);
        } else if (handler != null) {
            System.out.println(handlerName + " forwards request to " + handler.getHandlerName());
            handler.process(file);
        } else {
            //There are no handlers in the chain so we need to throw an exception.
            System.out.println("File not supported");
        }
    }

    @Override
    public String getHandlerName() {
        return handlerName;
    }
}


text:
package org.apache.phoenix.trace;

import static org.apache.phoenix.metrics.MetricInfo.ANNOTATION;
import static org.apache.phoenix.metrics.MetricInfo.DESCRIPTION;
import static org.apache.phoenix.metrics.MetricInfo.END;
import static org.apache.phoenix.metrics.MetricInfo.HOSTNAME;
import static org.apache.phoenix.metrics.MetricInfo.PARENT;
import static org.apache.phoenix.metrics.MetricInfo.SPAN;
import static org.apache.phoenix.metrics.MetricInfo.START;
import static org.apache.phoenix.metrics.MetricInfo.TAG;
import static org.apache.phoenix.metrics.MetricInfo.TRACE;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.htrace.Span;
import org.apache.htrace.TimelineAnnotation;
import org.apache.phoenix.compile.MutationPlan;
import org.apache.phoenix.execute.MutationState;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.jdbc.PhoenixPreparedStatement;
import org.apache.phoenix.metrics.MetricInfo;
import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.schema.TableNotFoundException;
import org.apache.phoenix.trace.util.Tracing;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.QueryUtil;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.util.concurrent.ThreadFactoryBuilder;

/**
 * Sink for the trace spans pushed into the queue by {@link TraceSpanReceiver}. The class
 * instantiates a thread pool of configurable size, which will pull the data from queue and write to
 * the Phoenix Trace Table in batches. Various configuration options include thread pool size and
 * batch commit size.
 */
public class TraceWriter {
    private static final Log LOG = LogFactory.getLog(TraceWriter.class);

    private static final String VARIABLE_VALUE = "?";

    private static final Joiner COLUMN_JOIN = Joiner.on(".");
    static final String TAG_FAMILY = "tags";
    /**
     * Count of the number of tags we are storing for this row
     */
    static final String TAG_COUNT = COLUMN_JOIN.join(TAG_FAMILY, "count");

    static final String ANNOTATION_FAMILY = "annotations";
    static final String ANNOTATION_COUNT = COLUMN_JOIN.join(ANNOTATION_FAMILY, "count");

    /**
     * Join strings on a comma
     */
    private static final Joiner COMMAS = Joiner.on(',');

    private String tableName;
    private int batchSize;
    private int numThreads;
    private TraceSpanReceiver traceSpanReceiver;

    protected ScheduledExecutorService executor;

    public TraceWriter(String tableName, int numThreads, int batchSize) {

        this.batchSize = batchSize;
        this.numThreads = numThreads;
        this.tableName = tableName;
    }

    public void start() {

        traceSpanReceiver = getTraceSpanReceiver();
        if (traceSpanReceiver == null) {
            LOG.warn(
                "No receiver has been initialized for TraceWriter. Traces will not be written.");
            LOG.warn("Restart Phoenix to try again.");
            return;
        }

        ThreadFactoryBuilder builder = new ThreadFactoryBuilder();
        builder.setDaemon(true).setNameFormat("PHOENIX-METRICS-WRITER");
        executor = Executors.newScheduledThreadPool(this.numThreads, builder.build());

        for (int i = 0; i < this.numThreads; i++) {
            executor.scheduleAtFixedRate(new FlushMetrics(), 0, 10, TimeUnit.SECONDS);
        }

        LOG.info("Writing tracing metrics to phoenix table");
    }

    @VisibleForTesting
    protected TraceSpanReceiver getTraceSpanReceiver() {
        return Tracing.getTraceSpanReceiver();
    }

    public class FlushMetrics implements Runnable {

        private Connection conn;
        private int counter = 0;

        public FlushMetrics() {
            conn = getConnection(tableName);
        }

        @Override
        public void run() {
            if (conn == null) return;
            while (!traceSpanReceiver.isSpanAvailable()) {
                Span span = traceSpanReceiver.getSpan();
                if (null == span) break;
                if (LOG.isTraceEnabled()) {
                    LOG.trace("Span received: " + span.toJson());
                }
                addToBatch(span);
                counter++;
                if (counter >= batchSize) {
                    commitBatch(conn);
                    counter = 0;
                }
            }
        }

        private void addToBatch(Span span) {

            String stmt = "UPSERT INTO " + tableName + " (";
            // drop it into the queue of things that should be written
            List<String> keys = new ArrayList<String>();
            List<Object> values = new ArrayList<Object>();
            // we need to keep variable values in a separate set since they may have spaces, which
            // causes the parser to barf. Instead, we need to add them after the statement is
            // prepared
            List<String> variableValues = new ArrayList<String>();
            keys.add(TRACE.columnName);
            values.add(span.getTraceId());

            keys.add(DESCRIPTION.columnName);
            values.add(VARIABLE_VALUE);
            variableValues.add(span.getDescription());

            keys.add(SPAN.traceName);
            values.add(span.getSpanId());

            keys.add(PARENT.traceName);
            values.add(span.getParentId());

            keys.add(START.traceName);
            values.add(span.getStartTimeMillis());

            keys.add(END.traceName);
            values.add(span.getStopTimeMillis());

            int annotationCount = 0;
            int tagCount = 0;

            // add the tags to the span. They were written in order received so we mark them as such
            for (TimelineAnnotation ta : span.getTimelineAnnotations()) {
                addDynamicEntry(keys, values, variableValues, TAG_FAMILY,
                    Long.toString(ta.getTime()), ta.getMessage(), TAG, tagCount);
                tagCount++;
            }

            // add the annotations. We assume they are serialized as strings and integers, but that
            // can
            // change in the future
            Map<byte[], byte[]> annotations = span.getKVAnnotations();
            for (Map.Entry<byte[], byte[]> annotation : annotations.entrySet()) {
                Pair<String, String> val =
                        TracingUtils.readAnnotation(annotation.getKey(), annotation.getValue());
                addDynamicEntry(keys, values, variableValues, ANNOTATION_FAMILY, val.getFirst(),
                    val.getSecond(), ANNOTATION, annotationCount);
                annotationCount++;
            }

            // add the tag count, now that we know it
            keys.add(TAG_COUNT);
            // ignore the hostname in the tags, if we know it
            values.add(tagCount);

            keys.add(ANNOTATION_COUNT);
            values.add(annotationCount);

            // compile the statement together
            stmt += COMMAS.join(keys);
            stmt += ") VALUES (" + COMMAS.join(values) + ")";

            if (LOG.isTraceEnabled()) {
                LOG.trace("Logging metrics to phoenix table via: " + stmt);
                LOG.trace("With tags: " + variableValues);
            }
            try {
                PreparedStatement ps = conn.prepareStatement(stmt);
                // add everything that wouldn't/may not parse
                int index = 1;
                for (String tag : variableValues) {
                    ps.setString(index++, tag);
                }

                // Not going through the standard route of using statement.execute() as that code
                // path
                // is blocked if the metadata hasn't been been upgraded to the new minor release.
                MutationPlan plan = ps.unwrap(PhoenixPreparedStatement.class).compileMutation(stmt);
                MutationState state = conn.unwrap(PhoenixConnection.class).getMutationState();
                MutationState newState = plan.execute();
                state.join(newState);
            } catch (SQLException e) {
                LOG.error("Could not write metric: \n" + span + " to prepared statement:\n" + stmt,
                    e);
            }
        }
    }

    public static String getDynamicColumnName(String family, String column, int count) {
        return COLUMN_JOIN.join(family, column) + count;
    }

    private void addDynamicEntry(List<String> keys, List<Object> values,
            List<String> variableValues, String family, String desc, String value,
            MetricInfo metric, int count) {
        // <family><.dynColumn><count> <VARCHAR>
        keys.add(getDynamicColumnName(family, metric.columnName, count) + " VARCHAR");

        // build the annotation value
        String val = desc + " - " + value;
        values.add(VARIABLE_VALUE);
        variableValues.add(val);
    }

    protected Connection getConnection(String tableName) {

        try {
            // create the phoenix connection
            Properties props = new Properties();
            props.setProperty(QueryServices.TRACING_FREQ_ATTRIB, Tracing.Frequency.NEVER.getKey());
            Configuration conf = HBaseConfiguration.create();
            Connection conn = QueryUtil.getConnectionOnServer(props, conf);

            if (!traceTableExists(conn, tableName)) {
                createTable(conn, tableName);
            }

            LOG.info(
                "Created new connection for tracing " + conn.toString() + " Table: " + tableName);
            return conn;
        } catch (Exception e) {
            LOG.error("Tracing will NOT be pursued. New connection failed for tracing Table: "
                    + tableName,
                e);
            LOG.error("Restart Phoenix to retry.");
            return null;
        }
    }

    protected boolean traceTableExists(Connection conn, String traceTableName) throws SQLException {
        try {
            PhoenixRuntime.getTable(conn, traceTableName);
            return true;
        } catch (TableNotFoundException e) {
            return false;
        }
    }

    /**
     * Create a stats table with the given name. Stores the name for use later when creating upsert
     * statements
     * @param conn connection to use when creating the table
     * @param table name of the table to create
     * @throws SQLException if any phoenix operations fails
     */
    protected void createTable(Connection conn, String table) throws SQLException {
        // only primary-key columns can be marked non-null
        String ddl =
                "create table if not exists " + table + "( " + TRACE.columnName
                        + " bigint not null, " + PARENT.columnName + " bigint not null, "
                        + SPAN.columnName + " bigint not null, " + DESCRIPTION.columnName
                        + " varchar, " + START.columnName + " bigint, " + END.columnName
                        + " bigint, " + HOSTNAME.columnName + " varchar, " + TAG_COUNT
                        + " smallint, " + ANNOTATION_COUNT + " smallint"
                        + "  CONSTRAINT pk PRIMARY KEY (" + TRACE.columnName + ", "
                        + PARENT.columnName + ", " + SPAN.columnName + "))\n" +
                        // We have a config parameter that can be set so that tables are
                        // transactional by default. If that's set, we still don't want these system
                        // tables created as transactional tables, make these table non
                        // transactional
                        PhoenixDatabaseMetaData.TRANSACTIONAL + "=" + Boolean.FALSE;
        PreparedStatement stmt = conn.prepareStatement(ddl);
        stmt.execute();
    }

    protected void commitBatch(Connection conn) {
        try {
            conn.commit();
        } catch (SQLException e) {
            LOG.error(
                "Unable to commit traces on conn: " + conn.toString() + " to table: " + tableName,
                e);
        }
    }

}


text:
ActiveRecord::Schema.define(version: 5) do

  create_table "job_parameters", id: :bigint, default: nil, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC" do |t|
    t.datetime "signedin_at", null: false
    t.integer "statuses_count", null: false
    t.datetime "registered_at", null: false
    t.string "collect_method", null: false
    t.text "archive_url"
    t.boolean "protect_reply", default: false
    t.boolean "protect_favorite", default: false
    t.date "collect_from"
    t.date "collect_to"
    t.text "start_message"
    t.text "finish_message"
  end

  create_table "jobs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC" do |t|
    t.bigint "user_id", null: false
    t.string "transition_state", null: false
    t.string "progression_state", null: false
    t.integer "collect_count", default: 0
    t.integer "destroy_count", default: 0
    t.boolean "notified_start_message", default: false
    t.boolean "notified_finish_message", default: false
    t.datetime "finished_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["progression_state"], name: "index_jobs_on_progression_state"
    t.index ["transition_state"], name: "index_jobs_on_transition_state"
    t.index ["user_id", "transition_state"], name: "index_jobs_on_user_id_and_transition_state"
    t.index ["user_id"], name: "index_jobs_on_user_id"
  end

  create_table "timeline_fragments", id: :bigint, default: nil, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC" do |t|
    t.bigint "job_id", null: false
    t.index ["job_id"], name: "index_timeline_fragments_on_job_id"
  end

  create_table "users", id: :bigint, default: nil, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC" do |t|
    t.string "token", null: false
    t.string "secret", null: false
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

end


text:
<?php

namespace Ekkinox\KataCatAndMouse\Factory;

use Ekkinox\KataCatAndMouse\Model\AbstractAnimal;
use Ekkinox\KataCatAndMouse\Model\Cat;
use Ekkinox\KataCatAndMouse\Model\Mouse;

/**
 * @package Ekkinox\KataCatAndMouse\Factory
 */
class AnimalFactory
{
    /**
     * @param string $class
     * @param int    $position
     *
     * @return AbstractAnimal|Cat|Mouse
     */
    public function create(string $class, int $position): AbstractAnimal
    {
        /** @var AbstractAnimal $animal */
        $animal = new $class();

        return $animal->setPosition($position);
    }
}


text:
import { Directive, Input, ElementRef, HostListener, Renderer, OnInit} from '@angular/core';

@Directive({
  selector: '[ng2-draggable]'
})
export class Draggable implements OnInit{
    topStart:number=0;
    leftStart:number=0;
    _allowDrag:boolean = true;
    md:boolean;

    @Input() ng2DraggableTarget: HTMLElement;

    constructor(public element: ElementRef) {}

        ngOnInit(){
          // css changes
          if(this._allowDrag){
            this.element.nativeElement.style.position = 'relative';
            this.element.nativeElement.className += ' cursor-draggable';
          }
        }

        @HostListener('mousedown', ['$event'])
        onMouseDown(event:MouseEvent) {
          if(event.button === 2 || (typeof this.ng2DraggableTarget != 'undefined' && event.target != this.ng2DraggableTarget))
            return; // prevents right click drag, remove his if you don't want it
          this.md = true;
          this.topStart = event.clientY - this.element.nativeElement.style.top.replace('px','');
          this.leftStart = event.clientX - this.element.nativeElement.style.left.replace('px','');
        }

        @HostListener('document:mouseup')
        onMouseUp(event:MouseEvent) {
          this.md = false;
        }

        @HostListener('document:mousemove', ['$event'])
        onMouseMove(event:MouseEvent) {
          if(this.md && this._allowDrag){
            this.element.nativeElement.style.top = (event.clientY - this.topStart) + 'px';
            this.element.nativeElement.style.left = (event.clientX - this.leftStart) + 'px';
          }
        }

        @HostListener('touchstart', ['$event'])
        onTouchStart(event:TouchEvent) {
          this.md = true;
          this.topStart = event.changedTouches[0].clientY - this.element.nativeElement.style.top.replace('px','');
          this.leftStart = event.changedTouches[0].clientX - this.element.nativeElement.style.left.replace('px','');
          event.stopPropagation();
        }

        @HostListener('document:touchend')
        onTouchEnd() {
          this.md = false;
        }

        @HostListener('document:touchmove', ['$event'])
        onTouchMove(event:TouchEvent) {
          if(this.md && this._allowDrag){
            this.element.nativeElement.style.top = ( event.changedTouches[0].clientY - this.topStart ) + 'px';
            this.element.nativeElement.style.left = ( event.changedTouches[0].clientX - this.leftStart ) + 'px';
          }
          event.stopPropagation();
        }

        @Input('ng2-draggable')
        set allowDrag(value:boolean){
          this._allowDrag = value;
          if(this._allowDrag)
            this.element.nativeElement.className += ' cursor-draggable';
          else
            this.element.nativeElement.className = this.element.nativeElement.className
                                                    .replace(' cursor-draggable','');
        }
}


text:
package net.ludokx.jelp;

/**
 * Locale parameters to be used in a search or to retrieve a business.
 * @author Ludovic Galibert (ludokxg@gmail.com)
 */
public class LocaleParameters {

	/** cc	 string	 optional	ISO 3166-1 alpha-2 country code.
	 * Default country to use when parsing the location field. United States = US, Canada = CA, United Kingdom = GB (not UK). */
	private String countryCode;

	/** lang	string	optional	ISO 639 language code (default=en). Reviews written in the specified language will be shown. */
	private String language;

	/** lang_filter	bool	optional	Whether to filter business reviews by the specified lang */
	private Boolean filterByLanguage;

	/**
	 * ISO 3166-1 alpha-2 country code.
	 * Default country to use when parsing the location field. United States = US, Canada = CA, United Kingdom = GB (not UK).
	 * @return the countryCode
	 */
	public String getCountryCode() {
		return countryCode;
	}

	/**
	 * ISO 3166-1 alpha-2 country code.
	 * Default country to use when parsing the location field. United States = US, Canada = CA, United Kingdom = GB (not UK).
	 * @param countryCode the countryCode to set
	 */
	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	/**
	 * ISO 639 language code (default=en). Reviews written in the specified language will be shown.
	 * @return the language
	 */
	public String getLanguage() {
		return language;
	}

	/**
	 * ISO 639 language code (default=en). Reviews written in the specified language will be shown.
	 * @param language the language to set
	 */
	public void setLanguage(String language) {
		this.language = language;
	}

	/**
	 * Whether to filter business reviews by the specified lang
	 * @return the filterByLanguage
	 */
	public Boolean isFilterByLanguage() {
		return filterByLanguage;
	}

	/**
	 * Whether to filter business reviews by the specified lang
	 * @param filterByLanguage the filterByLanguage to set
	 */
	public void setFilterByLanguage(Boolean filterByLanguage) {
		this.filterByLanguage = filterByLanguage;
	}

}


text:
package com.taig.tmpltr.markup

import com.taig.tmpltr._

import play.api.mvc.Content

trait	colgroup
extends	Tag.Body[colgroup, Content]
{
	val tag = "colgroup"
}


text:
<?php

	/*

	So what is this all about?

	Let's start with what has happened already, before this part comes in.
	A JSON Schema has been used to generate a Minimum Viable WOF document:

		$schema_fields = wof_schema_fields($ref);

	See also: schema/json/whosonfirst.schema

	Next, values from a GeoJSON record get merged into that schema structure
	using an invented (i.e., not-part-of-JSON-schema) hash key "_value".

		$schema_fields = wof_render_insert_values($schema_fields, $values);

	That schema gets handed off to a Smarty template inc_json_schema_field.txt
	which decides what kind of thing it's dealing with. In the simplest case
	it comes up with a normal <input> field. Otherwise it includes one of
	inc_json_schema_object.txt or inc_json_schema_array.txt (which in turn
	include inc_json_schema_field.txt).

	In the case of inc_json_schema_object.txt, a <table> with <tr> elements
	gets generated, each one with possible 'class' attributes defined:

	- property-editable
	- property-visible

	By default a property <tr> is hidden by CSS, but property-visible
	overrides that to make the property visible. Likewise, <input>'s include
	a `disabled="disabled"` attribute, which gets overridden in JS if the
	property includes property-editable.

	This is all to say, you can modify the edit behavior for each property
	by adjusting the data structure below. The '_default' case is what it
	sounds like.

	(20160412/dphiffer)

	*/

	$GLOBALS['wof_property_classes'] = array(
		'_default' => array(
			'visible' => true,
			'editable' => true,
			'deletable' => true,
			'minimum_viable' => false
		),
		'wof:id' => array(
			'editable' => false,
			'minimum_viable' => true
		),
		'wof:placetype' => array(
			'deletable' => false,
			'minimum_viable' => true
		),
		'wof:name' => array(
			'deletable' => false,
			'minimum_viable' => true
		),
		'wof:parent_id' => array(
			'minimum_viable' => true
		),
		'wof:hierarchy' => array(
			'deletable' => false,
			'editable' => false
		),
		'wof:country' => array(
			'deletable' => false
		),
		'iso:country' => array(
			'deletable' => false
		),
		'src:geom' => array(
			'deletable' => false
		),
		'edtf:inception' => array(
			'deletable' => false
		),
		'edtf:cessation' => array(
			'deletable' => false
		),
		'wof:concordances' => array(
			'deletable' => false
		),
		'wof:belongsto' => array(
			'visible' => false
		),
		'wof:supersedes' => array(
			'deletable' => false
		),
		'wof:superseded_by' => array(
			'deletable' => false
		),
		'wof:breaches' => array(
			'visible' => false
		),
		'wof:tags' => array(
			'deletable' => false
		),
		'wof:geomhash' => array(
			'editable' => false
		),
		'wof:created' => array(
			'editable' => false
		),
		'wof:controlled' => array(
			'deletable' => false
		),
		'wof:lastmodified' => array(
			'editable' => false
		),
		'geom:hash' => array(
			'editable' => false
		),
		'geom:area' => array(
			'editable' => false
		),
		'geom:bbox' => array(
			'editable' => false
		),
		'geom:latitude' => array(
			'deletable' => false
		),
		'geom:longitude' => array(
			'deletable' => false
		),
		'sg:classifiers' => array(
			'editable' => false
		),
		'mz:categories' => array(
			'editable' => false
		)
	);

	// See also: https://github.com/whosonfirst/whosonfirst-names/blob/master/inventory/inventory.py#L12-L31
	$GLOBALS['names_default_languages'] = array(
		"ara",
		"zho",
		"eng",
		"spa",
		"fre",
		"rus",
		"por",	# proposed UN
		"ben",	# proposed UN
		"hin",	# proposed UN
		"tur",	# proposed UN
		"ger",	# because tilezen
		"jap",	# because tilezen
		"kor",	# because tilezen
		"ita",	# because tilezen
		"gre",	# because tilezen
		"vie"   # because tilezen
	);

	########################################################################

	function wof_render_insert_values(&$schema, $values) {
		if (! is_array($values)) {
			return $schema;
		}
		foreach ($values as $key => $value) {
			if (is_scalar($value)) {
				if (! $schema['properties'][$key]) {
					$schema['properties'][$key] = array();
				}
				$schema['properties'][$key]['_value'] = $value;
				if (! $schema['properties'][$key]['type']) {
					$type = 'string';
					if (is_int($value)) {
						$type = 'integer';
					} else if (is_float($value)) {
						$type = 'number';
					}
					$schema['properties'][$key]['type'] = $type;
				}
			} else if ($schema['properties'][$key]) {
				// If the field is in the schema, recurse!
				$schema['properties'][$key] = wof_render_insert_values(
					$schema['properties'][$key],
					$value
				);
			} else {
				// ... otherwise, JSON encode the value
				$schema['properties'][$key]['type'] = 'json';
				$schema['properties'][$key]['_value'] = json_encode($value);
			}
		}
		return $schema;
	}

	########################################################################

	function wof_render_prune(&$schema) {
		foreach ($schema['properties'] as $key => $value) {
			if (! in_array($key, $GLOBALS['cfg']['wof_default_properties']) &&
			    ! $value['_required'] &&
			    ! (isset($value['_value']) ||
			       ! empty($value['properties']))) {
				// If a property hasn't been set in the existing record, and
				// isn't required, then we don't need it. The reason the property
				// exists is so that we can specify datatypes in the JSON
				// schema. So basically this hides all the specified properties
				// that haven't actually been set in a given WOF record.
				// (20160826/dphiffer)
				unset($schema['properties'][$key]);
			}
		}
		return $schema;
	}

	########################################################################

	function wof_render_property_groups(&$properties){
		$groups = array();
		foreach ($properties['properties'] as $name => $prop){
			if (preg_match('/^([^:]+):(.+)$/', $name, $matches)){
				list($name, $namespace, $predicate) = $matches;
				if (! $groups[$namespace]){
					$groups[$namespace] = array($predicate);
				} else {
					$groups[$namespace][] = $predicate;
				}
			}
		}
		return $groups;
	}

	########################################################################

	function wof_render_value(&$property) {
		if (isset($property['_value'])) {
			return $property['_value'];
		} else if (isset($property['default'])) {
			return $property['default'];
		}
		return '';
	}

	########################################################################

	function wof_render_object_id($context) {
		# $context = preg_replace('/[:.]/g', '-', $context);
		$context = preg_replace('/[:.]/', '-', $context);
		return "json-schema-object-$context";
	}

	########################################################################

	function wof_render_array_id($context) {
		# $context = preg_replace('/[:.]/g', '-', $context);
		$context = preg_replace('/[:.]/', '-', $context);
		return "json-schema-array-$context";
	}

	########################################################################

	function wof_render_property_classes($prop) {
		$classes = $GLOBALS['wof_property_classes']['_default'];
		if ($GLOBALS['wof_property_classes'][$prop]) {
			$classes = array_merge(
				$classes,
				$GLOBALS['wof_property_classes'][$prop]
			);
		}
		$class_list = array();
		foreach ($classes as $class => $enabled) {
			if ($enabled) {
				$class_list[] = "property-$class";
			}
		}
		return 'object-property ' . implode(' ', $class_list);
	}

	########################################################################

	function wof_render_type(&$property) {
		if (isset($property['type'])) {
			return $property['type'];
		}
		return 'string';
	}

	########################################################################

	function wof_render_names(&$values){

		// Default languages
		$lang_defaults = $GLOBALS['names_default_languages'];

		$names = array(
			'type' => 'object',
			'properties' => array()
		);
		foreach ($lang_defaults as $lang) {
			$names['properties'][$lang] = array(
				'type' => 'object',
				'properties' => array(
					'preferred' => array(
						'type' => 'array'
					),
					'variant' => array(
						'type' => 'array'
					),
					'colloquial' => array(
						'type' => 'array'
					)
				)
			);
		}

		if (! $values['properties']){
			return $names;
		}

		// Assign names from values
		foreach ($values['properties'] as $key => $value){
			if (preg_match('/^name:(.+)_x_(.+)$/', $key, $matches)){
				list(, $lang, $type) = $matches;
				if (! $names['properties'][$lang]){
					$names['properties'][$lang] = array(
						'type' => 'object',
						'properties' => array()
					);
				}
				$names['properties'][$lang]['properties'][$type] = array(
					'type' => 'array',
					'properties' => array()
				);
				foreach ($value as $item) {
					$names['properties'][$lang]['properties'][$type]['properties'][] = array(
						'type' => 'string',
						'_value' => $item
					);
				}
			}

			if (empty($names['properties'][$lang]['properties']['preferred'])) {
				$names['properties'][$lang]['properties']['preferred'] = array(
					'type' => 'array'
				);
			}
			if (empty($names['properties'][$lang]['properties']['variant'])) {
				$names['properties'][$lang]['properties']['variant'] = array(
					'type' => 'array'
				);
			}
			if (empty($names['properties'][$lang]['properties']['colloquial'])) {
				$names['properties'][$lang]['properties']['colloquial'] = array(
					'type' => 'array'
				);
			}
		}

		// Sort by language
		ksort($names['properties']);

		return $names;
	}

	# the end


text:
/*******************************************
 *              Chatbot ESEO
 *
 * @name index.js
 * @type js router
 * @description  main router file
 *
 *******************************************/
const express     = require('express');
const router      = express.Router();

const _main     = require('../core/main');
const _io       = require('../bin/www');

router.get('/', (req, res) =>{
    res.render('Chat/index');
    _io.Socket('/').on('connection',(socket)=>{
        let main = new _main.Main(req,res,socket);
        main.init((err)=>{
            main.sendHistory();
        });
        socket.on('msg',(data)=>{ main.receive(data)});
    });
});

module.exports = router;


text: angular.module('ngLipsum', []);


text:
<?php

namespace Guzzle\Cache;

/**
 * Cache adapter that defers to closures for implementation
 */
class ClosureCacheAdapter implements CacheAdapterInterface
{
    /**
     * @var array Mapping of method names to callables
     */
    protected $callables;

    /**
     * The callables array is an array mapping the actions of the cache adapter to callables.
     * - contains: Callable that accepts an $id and $options argument
     * - delete:   Callable that accepts an $id and $options argument
     * - fetch:    Callable that accepts an $id and $options argument
     * - save:     Callable that accepts an $id, $data, $lifeTime, and $options argument
     *
     * @param array $callables array of action names to callable
     *
     * @throws \InvalidArgumentException if the callable is not callable
     */
    public function __construct(array $callables)
    {
        // Validate each key to ensure it exists and is callable
        foreach (array('contains', 'delete', 'fetch', 'save') as $key) {
            if (!array_key_exists($key, $callables) || !is_callable($callables[$key])) {
                throw new \InvalidArgumentException("callables must contain a callable {$key} key");
            }
        }

        $this->callables = $callables;
    }

    /**
     * {@inheritdoc}
     */
    public function contains($id, array $options = null)
    {
        return call_user_func($this->callables['contains'], $id, $options);
    }

    /**
     * {@inheritdoc}
     */
    public function delete($id, array $options = null)
    {
        return call_user_func($this->callables['delete'], $id, $options);
    }

    /**
     * {@inheritdoc}
     */
    public function fetch($id, array $options = null)
    {
        return call_user_func($this->callables['fetch'], $id, $options);
    }

    /**
     * {@inheritdoc}
     */
    public function save($id, $data, $lifeTime = false, array $options = null)
    {
        return call_user_func($this->callables['save'], $id, $data, $lifeTime, $options);
    }
}


text:
% Y=randsign(X,p)
% Randomly select a fraction of the entries of matrix X and flip their signs.
% p is the ratio of the number of flipped entries to the total number of entries.

function Y=randsign(X,p)

N=length(X(:));
nz=fix(p*N); % number of entries to be flipped
indx=randperm(N);
indx=indx(1:nz);
Y=X;
Y(indx)=-X(indx);


text:
import { ProxyNativeModule } from 'expo-modules-core';
import { NotificationPermissionsStatus, NativeNotificationPermissionsRequest } from './NotificationPermissions.types';
export interface NotificationPermissionsModule extends ProxyNativeModule {
    getPermissionsAsync?: () => Promise<NotificationPermissionsStatus>;
    requestPermissionsAsync?: (request: NativeNotificationPermissionsRequest) => Promise<NotificationPermissionsStatus>;
}
//# sourceMappingURL=NotificationPermissionsModule.types.d.ts.map


text:
package com.peterpotts.common.sample

import scala.util.{Failure, Success, Try}

class SampleTry[A](sampleA: Sample[A], sampleB: Sample[String])
  extends FlatMapSample[Boolean, Try[A]](SampleBoolean, { boolean =>
    for {
      a <- sampleA
      b <- sampleB
    } yield if (boolean) Success(a) else Failure(new RuntimeException(b))
  })

object SampleTry {
  def apply[A](sampleA: Sample[A], sampleB: Sample[String]) = new SampleTry(sampleA, sampleB)
}


text:
WD=$(dirname $0)

###

cd $WD

# get latest source
git clone git://github.com/OpenKinect/libfreenect.git

# remove uneeded makefiles
rm libfreenect/src/CMakeLists.txt

# we dont need freenect audio (yet)
rm libfreenect/src/audio.c
rm libfreenect/src/libfreenect-audio.h
rm libfreenect/src/loader.c
#rm libfreenect/src/loader.h

# no python either
rm libfreenect/src/fwfetcher.py

# make folder
mkdir -p ../libs/libfreenect

# copy licenses, etc
cp -v libfreenect/APACHE20 ../libs/libfreenect
cp -v libfreenect/CONTRIB ../libs/libfreenect
cp -v libfreenect/GPL2 ../libs/libfreenect

# copy sources
cp -Rv libfreenect/src/* ../libs/libfreenect

# cleanup
rm -rfv libfreenect


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="HandheldFriendly" content="true" />
  <link rel="shortcut icon" href="https://www.epa.gov/sites/all/themes/epa/favicon.ico" type="image/vnd.microsoft.icon" />
  <meta name="MobileOptimized" content="width" />
  <meta http-equiv="cleartype" content="on" />
  <meta http-equiv="ImageToolbar" content="false" />
  <meta name="viewport" content="width=device-width" />
  <meta name="version" content="20161218" />

  <meta name="DC.description" content="" />
  <meta name="DC.title" content="" />
  <title>
  Detecting Alternate States in Ecological Systems: Threshold Effects of Riparian Development and Angling on Fish Population Stability|

  Research Project Database | Grantee Research Project | ORD | US EPA</title>

  <meta name="keywords" content="" />
  <link rel="shortlink" href="" />
  <link rel="canonical" href="" />
  <meta name="DC.creator" content="" />
  <meta name="DC.language" content="en" />
  <meta name="DC.Subject.epachannel" content="" />
  <meta name="DC.type" content="" />
  <meta name="DC.date.created" content="" />
  <meta name="DC.date.modified" content="2004-06-09" />

  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/misc/ui/jquery.ui.autocomplete.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/themes/epa/css/lib/jquery.ui.theme.css" media="all" />
  <link type="text/css" rel="stylesheet" href="https://www.epa.gov/sites/all/libraries/template2/s.css" media="all" />

	<link rel="alternate" type="application/atom+xml" title="EPA.gov All Press Releases" href="https://www.epa.gov/newsreleases/search/rss" />
	<link rel="alternate" type="application/atom+xml" title="EPA.gov Headquarters Press Releases" href="https://www.epa.gov/newsreleases/search/rss/field_press_office/headquarters" />
	<link rel="alternate" type="application/atom+xml" title="Greenversations, EPA's Blog" href="https://blog.epa.gov/blog/feed/" />

Jump to main content

  <hgroup class="site-name-and-slogan">

US EPA

United States Environmental Protection Agency

  </hgroup>
  <form class="epa-search" method="get" action="https://search.epa.gov/epasearch/epasearch">
    Search
    <input class="form-text" placeholder="Search EPA.gov" name="querytext" id="search-box" value=""/>
    <button class="epa-search-button" id="search-button" type="submit" title="Search">Search</button>
    <input type="hidden" name="fld" value="" />
    <input type="hidden" name="areaname" value="" />
    <input type="hidden" name="areacontacts" value="" />
    <input type="hidden" name="areasearchurl" value="" />
    <input type="hidden" name="typeofsearch" value="epa" />
    <input type="hidden" name="result_template" value="2col.ftl" />
    <input type="hidden" name="filter" value="sample4filt.hts" />
  </form>

Contact Us

Related Information

Research Grants

P3: Student Design Competition

Research Fellowships

Small Business Innovation Research (SBIR)

Grantee Research Project Results Search

      Detecting Alternate States in Ecological Systems: Threshold Effects of Riparian Development and Angling on Fish Population Stability

    EPA Grant Number: U916019

    Title: Detecting Alternate States in Ecological Systems: Threshold Effects of Riparian Development and Angling on Fish Population Stability

    Investigators:
     Havlicek, Tanya D.

    Institution:

      University of Wisconsin - Madison

    	EPA Project Officer:

           Graham, Karen

      Project Period:
      January 1, 2001 through
        January 1, 2004

        Project Amount:

          $87,619

      RFA:
      STAR Graduate Fellowships (2001)

        		RFA Text |
          Recipients Lists

      Research Category:

          Academic Fellowships
          ,
          Aquatic Ecosystems
          ,
          Fellowship - Aquatic Ecology and Ecosystems

Objective:

The objective of this research project is to
  investigate (through models) whether critical depensation can emerge in fish
  populations in small,
  recreationally exploited northern Wisconsin lakes from a few simple assumptions.
  Collapses in fish populations are a ubiquitous phenomena of recent decades.
  Aquatic resources such as the groundfish stocks of the Grand Banks and Georges
  Banks regions that have sustained exploitation for centuries are now closed
  to harvest with little indication of recovery. This pattern is not limited
  to marine systems. Lake trout and walleye populations in the Great Lakes and
  salmon populations in the western United States also have experienced rapid
  and unexpected declines. In the Northern Highland Lake district of Wisconsin,
  a popular recreation destination, dominant piscivores sought by recreational
  anglers no longer recruit and populations are sustained only by hatchery stocking.
  Explanations for fish population crashes include over harvesting, habitat degradation,
  environmental fluctuations, gene pool alterations via stocking, and predation.
  As important as causality, though, is whether or not the decline is reversible.
  Critical depensation, decreased recruitment at low population levels, can create
  a threshold that prohibits populations from rebounding to a stable, large equilibrium.
  It is on this upper equilibrium value that policies like maximum sustained
  yield are based. The importance of fish stocks for local economies, food, water
  quality, and recreational opportunities implies the detection of critical depensation
is crucial for effective management.

Approach:

I used age-structured models to explore the effects
  of habitat-mediated interactions and harvest on fish population stability.
  Littoral zone structure,
  coarse woody debris (CWD), provides substrate for nests, refuge from predation
  for larval and small fish, and surface for benthic invertebrate production.
  Littoral structure thus affects food availability for small and large fish,
  controls predator-prey interactions, and can provide hiding refuge from anglers.
  CWD enters the lake when trees and branches in the riparian forest break and
  fall via senescence and disturbance. As people develop lake shoreline, however,
  they remove physical structure from the littoral zone to improve boating and
  swimming. I explored different development scenarios by simulating a suite
  of littoral CWD densities. Preliminary results indicate thresholds of critical
  depensation can emerge as a result of habitat-mediated food web interactions
  and recreational harvest.

Supplemental Keywords:

      fellowship, ecological systems, riparian development, fish, lake trout, fish population crashes, over harvesting, coarse woody debris, CWD, littoral zone, recreational fishing, critical depensation, food we interactions.

Top of Page

 The perspectives, information and conclusions conveyed in research project abstracts, progress reports, final reports, journal abstracts and journal publications convey the viewpoints of the principal investigator and may not represent the views and policies of ORD and EPA.  Conclusions drawn by the principal investigators have not been reviewed by the Agency.

Main menu

Environmental Topics

Laws & Regulations

About EPA

Discover.

Accessibility

EPA Administrator

Budget & Performance

Contracting

Grants

No FEAR Act Data

Privacy and Security

Connect.

Data.gov

Inspector General

Jobs

Newsroom

Open Government

Regulations.gov

Subscribe

USA.gov

White House

Ask.

Contact Us

Hotlines

FOIA Requests

Frequent Questions

Follow.

Facebook

Twitter

YouTube

Flickr

Instagram

Last updated on Wednesday, June 9, 2004


text:
( function($) {

	$.extend($.ui.gmap.prototype, {

		/**
		 * Makes an elevation request along a path, where the elevation data are returned as distance-based samples along that path.
		 * @param a:google.maps.PathElevationRequest, http://code.google.com/apis/maps/documentation/javascript/reference.html#PathElevationRequest
		 * @param b:function(result:google.maps.ElevationResult, status:google.maps.ElevationStatus), http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#ElevationResult
		 */
		/*elevationPath: function(a, b) {
			if ( !this.get('services').ElevationService ) {
				this.get('services').ElevationService = new google.maps.ElevationService();
			}
			this.get('services').ElevationService.getElevationAlongPath(a, b);
		},*/

		/**
		 * Makes an elevation request for a list of discrete locations.
		 * @param a:google.maps.PathElevationRequest, http://code.google.com/apis/maps/documentation/javascript/reference.html#PathElevationRequest
		 * @param b:function(result:google.maps.ElevationResult, status:google.maps.ElevationStatus), http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#ElevationResult
		 */
		/*elevationLocations: function(a, b) {
			if ( !this.get('services').ElevationService ) {
				this.get('services').ElevationService = new google.maps.ElevationService();
			}
			this.get('services').ElevationService.getElevationForLocations(a, b);
		},*/

		/* PLACES SERVICE */

		/**
		 * Retrieves a list of Places in a given area. The PlaceResultss passed to the callback are stripped-down versions of a full PlaceResult. A more detailed PlaceResult for each Place can be obtained by sending a Place Details request with the desired Place's reference value.
		 * @param a:google.maps.places.PlaceSearchRequest, http://code.google.com/apis/maps/documentation/javascript/reference.html#PlaceSearchRequest
		 * @param b:function(result:google.maps.places.PlaceResult, status:google.maps.places.PlacesServiceStatus), http://code.google.com/apis/maps/documentation/javascript/reference.html#PlaceResult
		 */
		/*placesSearch: function(a, b) {
			if ( !this.get('services').PlacesService ) {
				this.get('services').PlacesService = new google.maps.places.PlacesService(this.get('map'));
			}
			this.get('services').PlacesService.search(a, b);
		},*/

		/**
		 * Retrieves details about the Place identified by the given reference.
		 * @param a:google.maps.places.PlaceDetailsRequest, http://code.google.com/apis/maps/documentation/javascript/reference.html#PlaceDetailsRequest
		 * @param b:function(result:google.maps.places.PlaceResult, status:google.maps.places.PlacesServiceStatus), http://code.google.com/apis/maps/documentation/javascript/reference.html#PlaceResult
		 */
		/*placesDetails: function(a, b) {
			if ( !this.get('services').PlacesService ) {
				this.get('services').PlacesService = new google.maps.places.PlacesService(this.get('map'));
			}
			this.get('services').PlacesService.getDetails(a, b);
		},*/

		/**
		 * A service to predict the desired Place based on user input. The service is attached to an <input> field in the form of a drop-down list. The list of predictions is updated dynamically as text is typed into the input field.
		 * @param a:jquery/node/string
		 * @param b:google.maps.places.AutocompleteOptions, http://code.google.com/apis/maps/documentation/javascript/reference.html#AutocompleteOptions
		 */
		/*placesAutocomplete: function(a, b) {
			if ( !this.get('services').Autocomplete ) {
				this.get('services').Autocomplete = new google.maps.places.Autocomplete(this._unwrap(a));
			}
		},*/

		/* DISTANCE MATRIX SERVICE */

		/**
		 * Issues a distance matrix request.
		 * @param a:google.maps.DistanceMatrixRequest, http://code.google.com/apis/maps/documentation/javascript/reference.html#DistanceMatrixRequest
		 * @param b:function(result:google.maps.DistanceMatrixResponse, status: google.maps.DistanceMatrixStatus), http://code.google.com/apis/maps/documentation/javascript/reference.html#DistanceMatrixResponse
		 */
		/*displayDistanceMatrix: function(a, b) {
			if ( !this.get('services').DistanceMatrixService ) {
				this.get('services').DistanceMatrixService = new google.maps.DistanceMatrixService();
			}
			this.get('services').DistanceMatrixService.getDistanceMatrix(a, b);
		},*/

		/* DIRECTIONS SERVICE */

		/**
		 * Computes directions between two or more places.
		 * @param directionsRequest:google.maps.DirectionsRequest
		 * @param directionsRendererOptions:google.maps.DirectionsRendererOptions (optional)
		 * @param callback:function(result:google.maps.DirectionsResult, status:google.maps.DirectionsStatus)
		 * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRequest
		 * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRendererOptions
		 * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsResult
		 */
		displayDirections: function(a, b, c) {
			var d = this;
			var e = this.get('services > DirectionsService', new google.maps.DirectionsService());
			var f = this.get('services > DirectionsRenderer', new google.maps.DirectionsRenderer());
			f.setOptions(b);
			e.route(a, function(g, h) {
				if ( h === 'OK' ) {
					if ( b.panel ) {
						f.setDirections(g);
					}
					f.setMap(d.get('map'));
				} else {
					f.setMap(null);
				}
				d._call(c, g, h);
			});
		},

		/**
		 * Displays the panorama for a given LatLng or panorama ID.
		 * @param panel:jQuery/String/Node
		 * @param streetViewPanoramaOptions:google.maps.StreetViewPanoramaOptions (optional)
		 * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#StreetViewPanoramaOptions
		 */
		displayStreetView: function(a, b) {
			this.get('map').setStreetView(this.get('services > StreetViewPanorama', new google.maps.StreetViewPanorama(this._unwrap(a), b)));
		},

		/* GEOCODING SERVICE */

		/**
		 * A service for converting between an address and a LatLng.
		 * @param geocoderRequest:google.maps.GeocoderRequest
		 * @param callback:function(result:google.maps.GeocoderResult, status:google.maps.GeocoderStatus),
		 * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#GeocoderResult
		 */
		search: function(a, b) {
			this.get('services > Geocoder', new google.maps.Geocoder()).geocode(a, b);
		}

	});

} (jQuery) );


text:
a-frame
=======

A-Frame is a library aimed to get based on php projects source code more readable and testable.
- Wrapping primary types Classes in order to (inspired by JS primary types)
- Wrapping impure functions Classes in order to mock


text:
// This file is automatically generated.

package adila.db;

/*
 * Sony Ericsson Xperia Tipo
 *
 * DEVICE: ST21i
 * MODEL: ST21i
 */
final class st21i_st21i {
    public static final String DATA = "Sony Ericsson|Xperia Tipo|";
}


text:
@interface NSString (QueryString)

- (NSString*)stringByEscapingForURLQuery;
- (NSString*)stringByUnescapingFromURLQuery;

@end


text:
<!doctype html>

  <meta charset="UTF-8">
  <title>Example - example-example85-production</title>

       list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};


text:
import {
  differenceInHours,
  differenceInMinutes,
  differenceInSeconds,
  subHours,
  subMinutes
} from 'date-fns';

/**
 * Returns the elapsed time since `since` as a duration in the format hh:mm:ss.
 */
export const formatDuration = (start: string | number | Date, stop?: string | number | Date) => {
  const now = stop || Date.now();
  const hours = differenceInHours(now, start);
  const minutes = differenceInMinutes(subHours(now, hours), start);
  const seconds = differenceInSeconds(subMinutes(subHours(now, hours), minutes), start);
  const timeValue = (value: number) => value.toString().padStart(2, '0');

  return `${hours}:${timeValue(minutes)}:${timeValue(seconds)}`;
}


text:
package net.sqlcipher;

import java.util.Map;

import android.database.CharArrayBuffer;
import android.database.ContentObserver;
import android.database.DataSetObserver;

import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;

/**
 * Adapts an {@link IBulkCursor} to a {@link Cursor} for use in the local
 * process.
 *
 * {@hide}
 */
public final class BulkCursorToCursorAdaptor extends AbstractWindowedCursor {
    private static final String TAG = "BulkCursor";

    private SelfContentObserver mObserverBridge;
    private IBulkCursor mBulkCursor;
    private int mCount;
    private String[] mColumns;
    private boolean mWantsAllOnMoveCalls;

    public void set(IBulkCursor bulkCursor) {
        mBulkCursor = bulkCursor;

        try {
            mCount = mBulkCursor.count();
            mWantsAllOnMoveCalls = mBulkCursor.getWantsAllOnMoveCalls();

            // Search for the rowID column index and set it for our parent
            mColumns = mBulkCursor.getColumnNames();
            mRowIdColumnIndex = findRowIdColumnIndex(mColumns);
        } catch (RemoteException ex) {
            Log.e(TAG, "Setup failed because the remote process is dead");
        }
    }

    /**
     * Version of set() that does fewer Binder calls if the caller
     * already knows BulkCursorToCursorAdaptor's properties.
     */
    public void set(IBulkCursor bulkCursor, int count, int idIndex) {
        mBulkCursor = bulkCursor;
        mColumns = null;  // lazily retrieved
        mCount = count;
        mRowIdColumnIndex = idIndex;
    }

    /**
     * Returns column index of "_id" column, or -1 if not found.
     */
    public static int findRowIdColumnIndex(String[] columnNames) {
        int length = columnNames.length;
        for (int i = 0; i < length; i++) {
            if (columnNames[i].equals("_id")) {
                return i;
            }
        }
        return -1;
    }

    /**
     * Gets a SelfDataChangeOberserver that can be sent to a remote
     * process to receive change notifications over IPC.
     *
     * @return A SelfContentObserver hooked up to this Cursor
     */
    public synchronized IContentObserver getObserver() {
        if (mObserverBridge == null) {
            mObserverBridge = new SelfContentObserver(this);
        }
        return null;//mObserverBridge.getContentObserver(); //TODO nf fix this
    }

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

    @Override
    public boolean onMove(int oldPosition, int newPosition) {
        try {
            // Make sure we have the proper window
            if (mWindow != null) {
                if (newPosition < mWindow.getStartPosition() ||
                        newPosition >= (mWindow.getStartPosition() + mWindow.getNumRows())) {
                    mWindow = mBulkCursor.getWindow(newPosition);
                } else if (mWantsAllOnMoveCalls) {
                    mBulkCursor.onMove(newPosition);
                }
            } else {
                mWindow = mBulkCursor.getWindow(newPosition);
            }
        } catch (RemoteException ex) {
            // We tried to get a window and failed
            Log.e(TAG, "Unable to get window because the remote process is dead");
            return false;
        }

        // Couldn't obtain a window, something is wrong
        if (mWindow == null) {
            return false;
        }

        return true;
    }

    @Override
    public void deactivate() {
        // This will call onInvalidated(), so make sure to do it before calling release,
        // which is what actually makes the data set invalid.
        super.deactivate();

        try {
            mBulkCursor.deactivate();
        } catch (RemoteException ex) {
            Log.w(TAG, "Remote process exception when deactivating");
        }
        mWindow = null;
    }

    @Override
    public void close() {
        super.close();
        try {
            mBulkCursor.close();
        } catch (RemoteException ex) {
            Log.w(TAG, "Remote process exception when closing");
        }
        mWindow = null;
    }

    @Override
    public boolean requery() {
        try {
            int oldCount = mCount;
            //TODO get the window from a pool somewhere to avoid creating the memory dealer
            mCount = mBulkCursor.requery(getObserver(), new CursorWindow(
                    false /* the window will be accessed across processes */));
            if (mCount != -1) {
                mPos = -1;
                mWindow = null;

                // super.requery() will call onChanged. Do it here instead of relying on the
                // observer from the far side so that observers can see a correct value for mCount
                // when responding to onChanged.
                super.requery();
                return true;
            } else {
                deactivate();
                return false;
            }
        } catch (Exception ex) {
            Log.e(TAG, "Unable to requery because the remote process exception " + ex.getMessage());
            deactivate();
            return false;
        }
    }

    /**
     * @hide
     * @deprecated
     */
    @Override
    public boolean deleteRow() {
        try {
            boolean result = mBulkCursor.deleteRow(mPos);
            if (result != false) {
                // The window contains the old value, discard it
                mWindow = null;

                // Fix up the position
                mCount = mBulkCursor.count();
                if (mPos < mCount) {
                    int oldPos = mPos;
                    mPos = -1;
                    moveToPosition(oldPos);
                } else {
                    mPos = mCount;
                }

                // Send the change notification
                onChange(true);
            }
            return result;
        } catch (RemoteException ex) {
            Log.e(TAG, "Unable to delete row because the remote process is dead");
            return false;
        }
    }

    @Override
    public String[] getColumnNames() {
        if (mColumns == null) {
            try {
                mColumns = mBulkCursor.getColumnNames();
            } catch (RemoteException ex) {
                Log.e(TAG, "Unable to fetch column names because the remote process is dead");
                return null;
            }
        }
        return mColumns;
    }

    /**
     * @hide
     * @deprecated
     */
    @Override
    public boolean commitUpdates(Map<? extends Long,
            ? extends Map<String,Object>> additionalValues) {
        if (!supportsUpdates()) {
            Log.e(TAG, "commitUpdates not supported on this cursor, did you include the _id column?");
            return false;
        }

        synchronized(mUpdatedRows) {
            if (additionalValues != null) {
                mUpdatedRows.putAll(additionalValues);
            }

            if (mUpdatedRows.size() <= 0) {
                return false;
            }

            try {
                boolean result = mBulkCursor.updateRows(mUpdatedRows);

                if (result == true) {
                    mUpdatedRows.clear();

                    // Send the change notification
                    onChange(true);
                }
                return result;
            } catch (RemoteException ex) {
                Log.e(TAG, "Unable to commit updates because the remote process is dead");
                return false;
            }
        }
    }

    @Override
    public Bundle getExtras() {
        try {
            return mBulkCursor.getExtras();
        } catch (RemoteException e) {
            // This should never happen because the system kills processes that are using remote
            // cursors when the provider process is killed.
            throw new RuntimeException(e);
        }
    }

    @Override
    public Bundle respond(Bundle extras) {
        try {
            return mBulkCursor.respond(extras);
        } catch (RemoteException e) {
            // the system kills processes that are using remote cursors when the provider process
            // is killed, but this can still happen if this is being called from the system process,
            // so, better to log and return an empty bundle.
            Log.w(TAG, "respond() threw RemoteException, returning an empty bundle.", e);
            return Bundle.EMPTY;
        }
    }

	@Override
	public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) {
		// TODO Auto-generated method stub

	}

	@Override
	public void registerContentObserver(ContentObserver observer) {
		// TODO Auto-generated method stub

	}

	@Override
	public void registerDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub

	}

	@Override
	public void unregisterContentObserver(ContentObserver observer) {
		// TODO Auto-generated method stub

	}

	@Override
	public void unregisterDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub

	}

}


text:
import { AuthenticationResponseModel } from './../models/authentication-response.model';
import { CookieService } from 'angular2-cookie/services/cookies.service';
import { Injectable } from '@angular/core';
import { ItemListing } from './../models/item-listing.model';

@Injectable()
export class UserStorageService {

  private cookieName: string;
  private localStorageFavoritesKey: string;

  constructor(private cookieService: CookieService) {
    this.cookieName = 'com.herokuapps.killerapp';
    this.localStorageFavoritesKey = 'killerappuserfavorites';
  }

  get loggedUser(): string {
    const loggedUser = this.getLoggedUser();
    if (loggedUser) {
      return loggedUser.username;
    }

    return undefined;
  }

  isLogged(): boolean {
    const loggedUser = this.getLoggedUser();
    return loggedUser ? true : false;
  }

  getLoggedUser(): AuthenticationResponseModel {
    const cookieContent = this.cookieService.getObject(this.cookieName);
    return cookieContent as AuthenticationResponseModel;
  }

  setLoggedUser(authResponse: AuthenticationResponseModel) {
    const expirationDate = new Date(2050, 12, 12);
    this.cookieService.putObject(this.cookieName, authResponse, { expires: expirationDate });
  }

  clearLoggedUser(): void {
    this.cookieService.remove(this.cookieName);
  }

  setLoggedUserFavorites(favorites: any[]): void {
    const favoritesJson = JSON.stringify(favorites);
    localStorage.setItem(this.localStorageFavoritesKey, favoritesJson);
  }

  getLoggedUserFavorites(): string[] {
    const favoritesJson = localStorage.getItem(this.localStorageFavoritesKey);
    return JSON.parse(favoritesJson);
  }

  clearLoggedUserFavorites(): void {
    localStorage.removeItem(this.localStorageFavoritesKey);
  }
}


text:
var ROW_TYPE = {
    SET: 'SET_TYPE',
    SUBSET: 'SUBSET_TYPE',
    GROUP: 'GROUP_TYPE',
    AGGREGATE: 'AGGREGATE_TYPE',
    QUERY_GROUP: 'QUERY_GROUP_TYPE',
    SEPARATOR: 'SEPARATOR',
    UNDEFINED: 'UNDEFINED'};
/**
* The base element for all rows (sets, groups, subsets, aggregates)
* @param id
* @param elementName
* @constructor
*/

interface Element{
    id: any;
    elementName: string;
    /** The indices of the data items in this set */
    items: any[];
    /** The number of elements in this (sub)set */
    setSize: number;
    /** The ratio of elements that are contained in this set */
    dataRatio: number;
}
interface Separator extends Element{
    type: any;
}

interface BaseSet extends Element{
    combinedSets;
    setData;
    fake;
}

export class dataStructure{

    /** the user interface */
    public ui; // initialized on document ready event

    /** The input datasets */
    public sets = [];
    public setIdToSet = {};
    /** The sets currently in use */
    public usedSets = [];
    /** The ordered and grouped subsets */
    public dataRows = [];
    /** Same as dataRows but including a wrapper for the data */
    public renderRows = [];
    /** The dynamically created subSets */
    public subSets = [];
    /** The labels of the records */
    public labels = [];
    /** meta data attributes of the records/items */
    public attributes = [];
    /** attributes selected by the user (for item visualizations) */
    public selectedAttributes = {};
    /** The number of combinations that are currently active */
    public combinations = 0;

    public depth = 0;

    /** The depth of the dataset, i.e., how many records it contains */

    /** an array representing all items */
    public allItems = [];

    //var filter = new Filter();

    /** Indices of selected items **/
    public selectedItems = [];

    //var selections = new SelectionList(); //an array of selection

    //var elementViewers = new ElementViewerCollection( "#element-viewers-controls", "#element-viewers-visualization" );

    /** The list of available datasets */
    public dataSets;

    /** Groups of subsets driven by group size */
    //var sizeGroups = [];

    /** Groups of subsets driven by set containment */
    //var setGroups = [];

    /** Venn diagram for tutorial mode */
    //var venn = new VennDiagram("#venn-vis", 40);

    /** The current primary grouping */
    public levelOneGroups;
    /** The smart filter groups */
    public filterGroups;

    /** How many sets do we want to see by default */
    public nrDefaultSets = 6;

    private Element(id, elementName){
        let element:Element;

        element = {
            id: id,
            elementName: elementName,
            items: [],
            setSize: 0,
            dataRatio: 0.0
        };
        return element;
    };

    private Separator(id, elementName){
        let separator: Separator;
        separator = {
            id: id,
            elementName: elementName,
            items: [],
            setSize: 0,
            dataRatio: 0.0,
            type: ROW_TYPE.SEPARATOR
        };
        return separator;
    };

    private BaseSet(setID, setName, combinedSets, setData, fake) {
    let baseSet: BaseSet;
    /** An array of all the sets that are combined in this set. The array contains a 1 if a set at the corresponding position in the sets array is combined. */
    //let combinedSets = combinedSets;

    /** The number of combined dataRows */
    let nrCombinedSets = 0;

    for (var i = 0; i < combinedSets.length; i++) {
        if (combinedSets[i] !== 0) {
            nrCombinedSets++;
        }
    };
    let items = [];
    let setSize = 0;

    for (var i = 0; i < setData.length; i++) {
            items.push(setData[i]);
            setSize++;
    };

    let dataRatio = setSize / this.depth;

    baseSet = {
        id: setID,
        elementName: setName,
        items: items,
        setSize: setSize,
        dataRatio: dataRatio,
        combinedSets: combinedSets,
        setData: setData,
        fake: true
    };

    return baseSet;
};

// private Set(setID, setName, combinedSets, itemList) {
//     BaseSet.call(this, setID, setName, combinedSets,[],1);
//         for (var i = 0; i < itemList.length; i++) {
//         if (itemList[i] !== 0) {
//             this.items.push(i);
//             this.setSize++;
//         }
//     }
//     this.dataRatio = this.setSize / depth;

//     this.type = ROW_TYPE.SET;
//     /** Array of length depth where each element that is in this subset is set to 1, others are set to 0 */
//     this.itemList = itemList;
//     this.isSelected = false;

// }

};


text:
from webob import exc

from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute

authorize_actions = extensions.extension_authorizer('compute',
                                                    'instance_actions')
authorize_events = extensions.soft_extension_authorizer('compute',
                                                    'instance_actions:events')

ACTION_KEYS = ['action', 'instance_uuid', 'request_id', 'user_id',
               'project_id', 'start_time', 'message']
EVENT_KEYS = ['event', 'start_time', 'finish_time', 'result', 'traceback']

def make_actions(elem):
    for key in ACTION_KEYS:
        elem.set(key)

def make_action(elem):
    for key in ACTION_KEYS:
        elem.set(key)
    event = xmlutil.TemplateElement('events', selector='events')
    for key in EVENT_KEYS:
        event.set(key)
    elem.append(event)

class InstanceActionsTemplate(xmlutil.TemplateBuilder):
    def construct(self):
        root = xmlutil.TemplateElement('instanceActions')
        elem = xmlutil.SubTemplateElement(root, 'instanceAction',
                                          selector='instanceActions')
        make_actions(elem)
        return xmlutil.MasterTemplate(root, 1)

class InstanceActionTemplate(xmlutil.TemplateBuilder):
    def construct(self):
        root = xmlutil.TemplateElement('instanceAction',
                                       selector='instanceAction')
        make_action(root)
        return xmlutil.MasterTemplate(root, 1)

class InstanceActionsController(wsgi.Controller):

    def __init__(self):
        super(InstanceActionsController, self).__init__()
        self.compute_api = compute.API()
        self.action_api = compute.InstanceActionAPI()

    def _format_action(self, action_raw):
        action = {}
        for key in ACTION_KEYS:
            action[key] = action_raw.get(key)
        return action

    def _format_event(self, event_raw):
        event = {}
        for key in EVENT_KEYS:
            event[key] = event_raw.get(key)
        return event

    @wsgi.serializers(xml=InstanceActionsTemplate)
    def index(self, req, server_id):
        """Returns the list of actions recorded for a given instance."""
        context = req.environ["nova.context"]
        instance = self.compute_api.get(context, server_id)
        authorize_actions(context, target=instance)
        actions_raw = self.action_api.actions_get(context, instance)
        actions = [self._format_action(action) for action in actions_raw]
        return {'instanceActions': actions}

    @wsgi.serializers(xml=InstanceActionTemplate)
    def show(self, req, server_id, id):
        """Return data about the given instance action."""
        context = req.environ['nova.context']
        instance = self.compute_api.get(context, server_id)
        authorize_actions(context, target=instance)
        action = self.action_api.action_get_by_request_id(context, instance,
                                                          id)
        if action is None:
            raise exc.HTTPNotFound()

        action_id = action['id']
        action = self._format_action(action)
        if authorize_events(context):
            events_raw = self.action_api.action_events_get(context, instance,
                                                           action_id)
            action['events'] = [self._format_event(evt) for evt in events_raw]
        return {'instanceAction': action}

class Instance_actions(extensions.ExtensionDescriptor):
    """View a log of actions and events taken on an instance."""

    name = "InstanceActions"
    alias = "os-instance-actions"
    namespace = ("http://docs.openstack.org/compute/ext/"
                 "instance-actions/api/v1.1")
    updated = "2013-02-08T00:00:00+00:00"

    def get_resources(self):
        ext = extensions.ResourceExtension('os-instance-actions',
                                           InstanceActionsController(),
                                           parent=dict(
                                               member_name='server',
                                               collection_name='servers'))
        return [ext]


text:
AWS Lambda custom runtime.

```
$ ./build.sh
$ ./mvnw package -P native
```

builds a native-zip ZIP file in target. Upload it to AWS and set the handler to "foobar".

To test locally, run the `TestServer` and then the `DemoApplication` (either in a JVM or natively). Then POST some data into the test server:

```
$ curl localhost:8000/add -d world -H "Content-Type: text/plain"
```

There is a unit test that does the same thing. Also the `build.sh` script orchestrates the same test for the native image.


text:
package com.lucilu.rxdynamicsearch.dagger.module;

import com.lucilu.rxdynamicsearch.dagger.Qualifiers.ForActivity;
import com.lucilu.rxdynamicsearch.ui.adapter.CountryListItemComparator;
import com.lucilu.rxdynamicsearch.ui.adapter.CountryListViewHolderBinder;
import com.lucilu.rxdynamicsearch.ui.adapter.CountryListViewHolderFactory;
import com.lucilu.rxdynamicsearch.ui.adapter.base.IListItemComparator;
import com.lucilu.rxdynamicsearch.ui.adapter.base.IViewHolderBinder;
import com.lucilu.rxdynamicsearch.ui.adapter.base.IViewHolderFactory;
import com.lucilu.rxdynamicsearch.viewmodel.pojo.DisplayableItem;

import android.content.Context;

import dagger.Module;
import dagger.Provides;

@Module
public final class CountryListModule {

    @Provides
    IViewHolderFactory provideViewHolderFactory(@ForActivity Context context) {
        return new CountryListViewHolderFactory(context);
    }

    @Provides
    IViewHolderBinder<DisplayableItem> provideViewHolderBinder() {
        return new CountryListViewHolderBinder();
    }

    @Provides
    IListItemComparator provideListItemComparator() {
        return new CountryListItemComparator();
    }
}