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

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
SymbolFacade (PMD 4.2.5 API)
</TITLE>

<META NAME="date" CONTENT="2009-02-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

net.sourceforge.pmd.symboltable

Class SymbolFacade

java.lang.Object
  net.sourceforge.pmd.symboltable.SymbolFacade

public class SymbolFacade
extends java.lang.Object

Constructor Summary

SymbolFacade()

Method Summary

 void
initializeWith(ASTCompilationUnit node)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SymbolFacade

public SymbolFacade()

Method Detail

initializeWith

public void initializeWith(ASTCompilationUnit node)

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2009 InfoEther. All Rights Reserved.


text:
using UnityEngine;
using System.Collections;

public class MopScript : MonoBehaviour {
	public AudioClip oilDeath;

	void OnTriggerEnter2D(Collider2D other){
		if (other.tag == "drop")
		{
			Destroy(other.gameObject);
            KillCount.increment();
			AudioSource.PlayClipAtPoint(oilDeath,transform.position);
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
from qtpy import QtWidgets, QtGui

from echo.qt.autoconnect import autoconnect_callbacks_to_qt
from echo import CallbackProperty
from echo.qt.connect import UserDataWrapper

def test_autoconnect_callbacks_to_qt():

    class Data(object):
        pass

    data1 = Data()
    data2 = Data()

    class CustomWidget(QtWidgets.QWidget):
        def __init__(self, parent=None):

            super(CustomWidget, self).__init__(parent=parent)

            self.layout = QtWidgets.QVBoxLayout()
            self.setLayout(self.layout)

            self.combotext_planet = QtWidgets.QComboBox(objectName='combotext_planet')
            self.layout.addWidget(self.combotext_planet)
            self.combotext_planet.addItem('earth')
            self.combotext_planet.addItem('mars')
            self.combotext_planet.addItem('jupiter')

            self.combodata_dataset = QtWidgets.QComboBox(objectName='combodata_dataset')
            self.layout.addWidget(self.combodata_dataset)
            self.combodata_dataset.addItem('data1', UserDataWrapper(data1))
            self.combodata_dataset.addItem('data2', UserDataWrapper(data2))

            self.text_name = QtWidgets.QLineEdit(objectName='text_name')
            self.layout.addWidget(self.text_name)

            self.valuetext_age = QtWidgets.QLineEdit(objectName='valuetext_age')
            self.layout.addWidget(self.valuetext_age)

            self.value_height = QtWidgets.QSlider(objectName='value_height')
            self.value_height.setMinimum(0)
            self.value_height.setMaximum(10)
            self.layout.addWidget(self.value_height)

            self.bool_log = QtWidgets.QToolButton(objectName='bool_log')
            self.bool_log.setCheckable(True)
            self.layout.addWidget(self.bool_log)

    class Person(object):
        planet = CallbackProperty()
        dataset = CallbackProperty()
        name = CallbackProperty()
        age = CallbackProperty()
        height = CallbackProperty()
        log = CallbackProperty()

    widget = CustomWidget()

    person = Person()

    connect_kwargs = {'height': {'value_range': (0, 100)},
                      'age': {'fmt': '{:.2f}'}}

    c1 = autoconnect_callbacks_to_qt(person, widget, connect_kwargs=connect_kwargs)  # noqa

    # Check that modifying things in the Qt widget updates the callback properties

    widget.combotext_planet.setCurrentIndex(2)
    assert person.planet == 'jupiter'

    widget.combodata_dataset.setCurrentIndex(1)
    assert person.dataset is data2

    widget.text_name.setText('Lovelace')
    widget.text_name.editingFinished.emit()
    assert person.name == 'Lovelace'

    widget.valuetext_age.setText('76')
    widget.valuetext_age.editingFinished.emit()
    assert person.age == 76

    widget.value_height.setValue(7)
    assert person.height == 70

    widget.bool_log.setChecked(True)
    assert person.log

    # Check that modifying the callback properties updates the Qt widget

    person.planet = 'mars'
    assert widget.combotext_planet.currentIndex() == 1

    person.dataset = data1
    assert widget.combodata_dataset.currentIndex() == 0

    person.name = 'Curie'
    assert widget.text_name.text() == 'Curie'

    person.age = 66.3
    assert widget.valuetext_age.text() == '66.30'

    person.height = 54
    assert widget.value_height.value() == 5

    person.log = False
    assert not widget.bool_log.isChecked()

def test_autoconnect_with_empty_qt_item():

    # The following test just makes sure that if a widget without children
    # is ever passed to autoconnect_callbacks_to_qt, things don't crash

    widget = QtGui.QPalette()

    class Person(object):
        name = CallbackProperty()

    person = Person()

    autoconnect_callbacks_to_qt(person, widget)


text:
#ifndef IU_QGL_IMAGE_GPU_WIDGET_H
#define IU_QGL_IMAGE_GPU_WIDGET_H

#include <GL/glew.h>
#include <QObject>
#include <QGLWidget>
#include <QString>
#include <QRadioButton>
#include <cuda_gl_interop.h>

#include "iudefs.h"
#include "overlay.h"

// forward declarations
class QMenu;
class QSignalMapper;
class QWidgetAction;

namespace iu {

//-----------------------------------------------------------------------------
/** \brief QGLImageGpuWidget: An Qt OpenGL widget for CUDA/GPU memory.
  \ingroup iugui
  */
class IUGUI_DLLAPI QGLImageGpuWidget : public QGLWidget
{
  Q_OBJECT        // must include this if you use Qt signals/slots

public:
  QGLImageGpuWidget(QWidget *parent=0);
  virtual ~QGLImageGpuWidget();
  void setImage(iu::ImageGpu_8u_C1* image, bool normalize = false);
  void setImage(iu::ImageGpu_32f_C1* image, bool normalize = false);
  void setImage(iu::ImageGpu_8u_C4* image, bool normalize = false);
  void setImage(iu::ImageGpu_32f_C4* image, bool normalize = false);

  void setMinMax(float min, float max);
  void autoMinMax();
  void setAutoNormalize(bool flag);

  void addOverlay(QString name, iu::Image* constraint_image,
                  iu::LinearMemory* lut_values, iu::LinearDeviceMemory_8u_C4* lut_colors,
                  bool active = true, IuComparisonOperator comp_op = IU_EQUAL);

  void getPboOutput(iu::ImageGpu_8u_C4* image);
  unsigned int imageWidth();
  unsigned int imageHeight();

signals:
  void mouseMoved(int from_x, int from_y, int to_x, int to_y);
  void mousePressed(int x, int y);
  void mousePressed(int x, int y, int global_x, int global_y);
  void mouseReleased(int x, int y);

  void pan(int from_x, int from_y, int to_x, int to_y);

  void zoomChanged(float val);
  void zoomed(double factor);

  void showToolbar(bool val);
  void pixelInfo(QString text);

public slots:
  void setZoom(float val);
  void updateCUDA() { updateCuda_ = true; updateGL(); }

private slots:
  //  /** Invokes timer triggered updates if the autoupdate ability is set. */
  //  void slotTimerCallback();

  /** Resets the zoom to 100% (1:1). */
  void slotZoomReset();

  void slotZoom0p25();
  void slotZoom0p33();
  void slotZoom0p5();
  void slotZoom2();
  void slotZoom3();
  void slotZoom4();

  void useNN(bool val);
  void useLinear(bool val);

  //  /** Sets the minimum gray value that should be displayed from the context menu slider. */
  //  void slotMinimumValue(int value);

  //  /** Sets the maximum gray value that should be displayed from the context menu slider. */
  //  void slotMaximumValue(int value);

  /** Activates the corresponing overlay to be displayed. */
  void slotActivateOverlay(const QString& overlay_name);

protected:
  void mousePressEvent(QMouseEvent *event);
  void mouseReleaseEvent(QMouseEvent *event);
  void mouseMoveEvent(QMouseEvent *event);
  void wheelEvent(QWheelEvent *event);
  void contextMenuEvent(QContextMenuEvent *);

  void createActions();
  void initializeGL();
  void resizeGL(int w, int h);
  void createTexture();
  void deleteTexture();
  void createPbo();
  void deletePbo();
  bool init();
  //void resizeGL(int w, int h);
  void paintGL();
  bool fillPbo(iu::ImageGpu_8u_C4* output=NULL);

  GLuint gl_pbo_; /**< OpenGL PBO name. */
  GLuint gl_tex_; /**< OpenGL texture name. */
  struct cudaGraphicsResource *cuda_pbo_resource_; /**< Handles OpenGL <-> CUDA exchange. */

  iu::Image* image_; /**< image that will be displayed. Currently 1-channel and 4-channel images are supported. */
  unsigned int num_channels_;
  unsigned int bit_depth_;
  bool normalize_;
  float min_;
  float max_;
  bool init_ok_;
  float zoom_;

  // mouse interaction
  int  mouse_x_old_; /**< Previous mouse position (x coordinate). */
  int  mouse_y_old_; /**< Previous mouse position (y coordinate). */
  int  mouse_x_;     /**< Current mouse position (x coordinate). */
  int  mouse_y_;     /**< Current mouse position (y coordinate). */

  // overlays
  iuprivate::OverlayList overlay_list_;

  // context menus and actions
  QMenu *context_menu_; /**< Menu that is displayed when a context menu event is invoked. */
  QSignalMapper *overlay_signal_mapper_; /**< Maps the signal from the overlay checkbox to active the overlay. */
  QList<QWidgetAction*> action_list_overlays_; /**< Checkboxes for all added overlays. */
  QAction *action_close_; /**< Action that closes the widget. */
  QAction *action_zoom_reset_; /**< Action that sets the zoom to 100% (1:1) */
  QAction *action_zoom_0p25_;
  QAction *action_zoom_0p33_;
  QAction *action_zoom_0p5_;
  QAction *action_zoom_2_;
  QAction *action_zoom_3_;
  QAction *action_zoom_4_;
  QMenu *action_zoom_group_;

  QMenu *action_interpolate_group_;
  QWidgetAction *action_NN_;
  QWidgetAction *action_Linear_;

  QWidgetAction *show_Toolbar_;

  bool filter_linear_;
  int button_;

  QCursor old_cursor_;

  //  QWidgetAction *action_slider_min_; /**< Slider for the min gray value. */
  //  QWidgetAction *action_slider_max_; /**< Slider for the max gray value. */
  //  QWidgetAction *action_slider_range_label_; /**< Slider range label. */
  //  QLabel* min_max_slider_label_; /**< Slider range label text. */
  //  QSlider *slider_min_;
  //  QSlider *slider_max_;

private:
  // Copy and asignment operator intentionally declared private.
  QGLImageGpuWidget(const QGLImageGpuWidget&);
  QGLImageGpuWidget& operator= (const QGLImageGpuWidget&);

  void doCUDA();
  bool updateCuda_;
};

} // namespace iu

#endif // IUPRIVATE_QGL_IMAGE_GPU_WIDGET_H


text:
// Generated Source

interface DeviceInfoRequest {

    /**
     * Device unique identifier, retrieved on previous session (if any)
     */
    id?: string;

    /**
     * For iOS devices only Certificate name (used by iOS applications for APNS subscription)
     */
    appExternalId?: string;

    /**
     * For SoftPhone only Computer name
     */
    computerName?: string;
}

export default DeviceInfoRequest;


text:
"use strict";

var common = require('./common')
	, utils = require('../utils')
  , toError = require('../utils').toError
  , f = require('util').format
  , shallowClone = utils.shallowClone
  , WriteError = common.WriteError
  , BulkWriteResult = common.BulkWriteResult
  , LegacyOp = common.LegacyOp
  , ObjectID = require('mongodb-core').BSON.ObjectID
  , Batch = common.Batch
  , mergeBatchResults = common.mergeBatchResults;

/**
 * Create a FindOperatorsUnordered instance (INTERNAL TYPE, do not instantiate directly)
 * @class
 * @return {FindOperatorsUnordered} a FindOperatorsUnordered instance.
 */
var FindOperatorsUnordered = function(self) {
  this.s = self.s;
}

/**
 * Add a single update document to the bulk operation
 *
 * @method
 * @param {object} doc update operations
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.update = function(updateDocument) {
  // Perform upsert
  var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false;

  // Establish the update command
  var document = {
      q: this.s.currentOp.selector
    , u: updateDocument
    , multi: true
    , upsert: upsert
  }

  // Clear out current Op
  this.s.currentOp = null;
  // Add the update document to the list
  return addToOperationsList(this, common.UPDATE, document);
}

/**
 * Add a single update one document to the bulk operation
 *
 * @method
 * @param {object} doc update operations
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.updateOne = function(updateDocument) {
  // Perform upsert
  var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false;

  // Establish the update command
  var document = {
      q: this.s.currentOp.selector
    , u: updateDocument
    , multi: false
    , upsert: upsert
  }

  // Clear out current Op
  this.s.currentOp = null;
  // Add the update document to the list
  return addToOperationsList(this, common.UPDATE, document);
}

/**
 * Add a replace one operation to the bulk operation
 *
 * @method
 * @param {object} doc the new document to replace the existing one with
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.replaceOne = function(updateDocument) {
  this.updateOne(updateDocument);
}

/**
 * Upsert modifier for update bulk operation
 *
 * @method
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.upsert = function() {
  this.s.currentOp.upsert = true;
  return this;
}

/**
 * Add a remove one operation to the bulk operation
 *
 * @method
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.removeOne = function() {
  // Establish the update command
  var document = {
      q: this.s.currentOp.selector
    , limit: 1
  }

  // Clear out current Op
  this.s.currentOp = null;
  // Add the remove document to the list
  return addToOperationsList(this, common.REMOVE, document);
}

/**
 * Add a remove operation to the bulk operation
 *
 * @method
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
FindOperatorsUnordered.prototype.remove = function() {
  // Establish the update command
  var document = {
      q: this.s.currentOp.selector
    , limit: 0
  }

  // Clear out current Op
  this.s.currentOp = null;
  // Add the remove document to the list
  return addToOperationsList(this, common.REMOVE, document);
}

//
// Add to the operations list
//
var addToOperationsList = function(_self, docType, document) {
  // Get the bsonSize
  var bsonSize = _self.s.bson.calculateObjectSize(document, false);
  // Throw error if the doc is bigger than the max BSON size
  if(bsonSize >= _self.s.maxBatchSizeBytes) throw toError("document is larger than the maximum size " + _self.s.maxBatchSizeBytes);
  // Holds the current batch
  _self.s.currentBatch = null;
  // Get the right type of batch
  if(docType == common.INSERT) {
    _self.s.currentBatch = _self.s.currentInsertBatch;
  } else if(docType == common.UPDATE) {
    _self.s.currentBatch = _self.s.currentUpdateBatch;
  } else if(docType == common.REMOVE) {
    _self.s.currentBatch = _self.s.currentRemoveBatch;
  }

  // Create a new batch object if we don't have a current one
  if(_self.s.currentBatch == null) _self.s.currentBatch = new Batch(docType, _self.s.currentIndex);

  // Check if we need to create a new batch
  if(((_self.s.currentBatch.size + 1) >= _self.s.maxWriteBatchSize)
    || ((_self.s.currentBatch.sizeBytes + bsonSize) >= _self.s.maxBatchSizeBytes)
    || (_self.s.currentBatch.batchType != docType)) {
    // Save the batch to the execution stack
    _self.s.batches.push(_self.s.currentBatch);

    // Create a new batch
    _self.s.currentBatch = new Batch(docType, _self.s.currentIndex);
  }

  // We have an array of documents
  if(Array.isArray(document)) {
    throw toError("operation passed in cannot be an Array");
  } else {
    _self.s.currentBatch.operations.push(document);
    _self.s.currentBatch.originalIndexes.push(_self.s.currentIndex);
    _self.s.currentIndex = _self.s.currentIndex + 1;
  }

  // Save back the current Batch to the right type
  if(docType == common.INSERT) {
    _self.s.currentInsertBatch = _self.s.currentBatch;
    _self.s.bulkResult.insertedIds.push({index: _self.s.currentIndex, _id: document._id});
  } else if(docType == common.UPDATE) {
    _self.s.currentUpdateBatch = _self.s.currentBatch;
  } else if(docType == common.REMOVE) {
    _self.s.currentRemoveBatch = _self.s.currentBatch;
  }

  // Update current batch size
  _self.s.currentBatch.size = _self.s.currentBatch.size + 1;
  _self.s.currentBatch.sizeBytes = _self.s.currentBatch.sizeBytes + bsonSize;

  // Return self
  return _self;
}

/**
 * Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly)
 * @class
 * @return {UnorderedBulkOperation} a UnorderedBulkOperation instance.
 */
var UnorderedBulkOperation = function(topology, collection, options) {
	options = options == null ? {} : options;

	// Contains reference to self
	var self = this;
	// Get the namesspace for the write operations
  var namespace = collection.collectionName;
  // Used to mark operation as executed
  var executed = false;

	// Current item
  // var currentBatch = null;
	var currentOp = null;
	var currentIndex = 0;
  var batches = [];

  // The current Batches for the different operations
  var currentInsertBatch = null;
  var currentUpdateBatch = null;
  var currentRemoveBatch = null;

	// Handle to the bson serializer, used to calculate running sizes
	var bson = topology.bson;

  // Get the capabilities
  var capabilities = topology.capabilities();

  // Set max byte size
	var maxBatchSizeBytes = topology.isMasterDoc.maxBsonObjectSize;
	var maxWriteBatchSize = topology.isMasterDoc.maxWriteBatchSize || 1000;

  // Get the write concern
  var writeConcern = common.writeConcern(shallowClone(options), collection, options);

  // Final results
  var bulkResult = {
  	  ok: 1
    , writeErrors: []
    , writeConcernErrors: []
    , insertedIds: []
    , nInserted: 0
    , nUpserted: 0
    , nMatched: 0
    , nModified: 0
    , nRemoved: 0
    , upserted: []
  };

  // Internal state
  this.s = {
    // Final result
      bulkResult: bulkResult
    // Current batch state
    , currentInsertBatch: null
    , currentUpdateBatch: null
    , currentRemoveBatch: null
    , currentBatch: null
    , currentIndex: 0
    , batches: []
    // Write concern
    , writeConcern: writeConcern
    // Capabilities
    , capabilities: capabilities
    // Max batch size options
    , maxBatchSizeBytes: maxBatchSizeBytes
    , maxWriteBatchSize: maxWriteBatchSize
    // Namespace
    , namespace: namespace
    // BSON
    , bson: bson
    // Topology
    , topology: topology
    // Options
    , options: options
    // Current operation
    , currentOp: currentOp
    // Executed
    , executed: executed
    // Collection
    , collection: collection
  }
}

/**
 * Add a single insert document to the bulk operation
 *
 * @param {object} doc the document to insert
 * @throws {MongoError}
 * @return {UnorderedBulkOperation}
 */
UnorderedBulkOperation.prototype.insert = function(document) {
  if(document._id == null) document._id = new ObjectID();
  return addToOperationsList(this, common.INSERT, document);
}

/**
 * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne
 *
 * @method
 * @param {object} selector The selector for the bulk operation.
 * @throws {MongoError}
 * @return {FindOperatorsUnordered}
 */
UnorderedBulkOperation.prototype.find = function(selector) {
  if (!selector) {
    throw toError("Bulk find operation must specify a selector");
  }

  // Save a current selector
  this.s.currentOp = {
    selector: selector
  }

  return new FindOperatorsUnordered(this);
}

/**
 * Return the number of operations in the bulk
 *
 * @method
 * @return {Number}
 */
UnorderedBulkOperation.prototype.length = function() {
	return this.s.currentIndex;
}

UnorderedBulkOperation.prototype.raw = function(op) {
  var key = Object.keys(op)[0];

  // Update operations
  if((op.updateOne && op.updateOne.q)
    || (op.updateMany && op.updateMany.q)
    || (op.replaceOne && op.replaceOne.q)) {
    op[key].multi = op.updateOne || op.replaceOne ? false : true;
    return addToOperationsList(this, common.UPDATE, op[key]);
  }

  // Crud spec update format
  if(op.updateOne || op.updateMany || op.replaceOne) {
    var multi = op.updateOne || op.replaceOne ? false : true;
    var operation = {q: op[key].filter, u: op[key].update || op[key].replacement, multi: multi}
    if(op[key].upsert) operation.upsert = true;
    return addToOperationsList(this, common.UPDATE, operation);
  }

  // Remove operations
  if(op.removeOne || op.removeMany || (op.deleteOne && op.deleteOne.q) || op.deleteMany && op.deleteMany.q) {
    op[key].limit = op.removeOne ? 1 : 0;
    return addToOperationsList(this, common.REMOVE, op[key]);
  }

  // Crud spec delete operations, less efficient
  if(op.deleteOne || op.deleteMany) {
    var limit = op.deleteOne ? 1 : 0;
    var operation = {q: op[key].filter, limit: limit}
    return addToOperationsList(this, common.REMOVE, operation);
  }

  // Insert operations
  if(op.insertOne && op.insertOne.document == null) {
    if(op.insertOne._id == null) op.insertOne._id = new ObjectID();
    return addToOperationsList(this, common.INSERT, op.insertOne);
  } else if(op.insertOne && op.insertOne.document) {
    if(op.insertOne.document._id == null) op.insertOne.document._id = new ObjectID();
    return addToOperationsList(this, common.INSERT, op.insertOne.document);
  }

  if(op.insertMany) {
    for(var i = 0; i < op.insertMany.length; i++) {
      addToOperationsList(this, common.INSERT, op.insertMany[i]);
    }

    return;
  }

  // No valid type of operation
  throw toError("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany");
}

//
// Execute the command
var executeBatch = function(self, batch, callback) {
  var finalOptions = {ordered: false}
  if(self.s.writeConcern != null) {
    finalOptions.writeConcern = self.s.writeConcern;
  }

  var resultHandler = function(err, result) {
    // If we have and error
    if(err) err.ok = 0;
    callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, result));
  }

  try {
    if(batch.batchType == common.INSERT) {
      self.s.topology.insert(self.s.collection.namespace, batch.operations, finalOptions, resultHandler);
    } else if(batch.batchType == common.UPDATE) {
      self.s.topology.update(self.s.collection.namespace, batch.operations, finalOptions, resultHandler);
    } else if(batch.batchType == common.REMOVE) {
      self.s.topology.remove(self.s.collection.namespace, batch.operations, finalOptions, resultHandler);
    }
  } catch(err) {
    // Force top level error
    err.ok = 0;
    // Merge top level error and return
    callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, null));
  }
}

//
// Execute all the commands
var executeBatches = function(self, callback) {
  var numberOfCommandsToExecute = self.s.batches.length;
  // Execute over all the batches
  for(var i = 0; i < self.s.batches.length; i++) {
    executeBatch(self, self.s.batches[i], function(err, result) {
      numberOfCommandsToExecute = numberOfCommandsToExecute - 1;

      // Execute
      if(numberOfCommandsToExecute == 0) {
        var error = self.s.bulkResult.writeErrors.length > 0 ? self.s.bulkResult.writeErrors[0] : null;
        callback(error, new BulkWriteResult(self.s.bulkResult));
      }
    });
  }
}

/**
 * The callback format for results
 * @callback UnorderedBulkOperation~resultCallback
 * @param {MongoError} error An error instance representing the error during the execution.
 * @param {BulkWriteResult} result The bulk write result.
 */

/**
 * Execute the ordered bulk operation
 *
 * @method
 * @param {object} [options=null] Optional settings.
 * @param {(number|string)} [options.w=null] The write concern.
 * @param {number} [options.wtimeout=null] The write concern timeout.
 * @param {boolean} [options.j=false] Specify a journal write concern.
 * @param {boolean} [options.fsync=false] Specify a file sync write concern.
 * @param {UnorderedBulkOperation~resultCallback} callback The result callback
 * @throws {MongoError}
 * @return {null}
 */
UnorderedBulkOperation.prototype.execute = function(_writeConcern, callback) {
  if(this.s.executed) throw toError("batch cannot be re-executed");
  if(typeof _writeConcern == 'function') {
    callback = _writeConcern;
  } else {
    this.s.writeConcern = _writeConcern;
  }

  // If we have current batch
  if(this.s.currentInsertBatch) this.s.batches.push(this.s.currentInsertBatch);
  if(this.s.currentUpdateBatch) this.s.batches.push(this.s.currentUpdateBatch);
  if(this.s.currentRemoveBatch) this.s.batches.push(this.s.currentRemoveBatch);

  // If we have no operations in the bulk raise an error
  if(this.s.batches.length == 0) {
    throw toError("Invalid Operation, No operations in bulk");
  }

  // Execute batches
  return executeBatches(this, function(err, result) {
    callback(err, result);
  });
}

/**
 * Returns an unordered batch object
 * @ignore
 */
var initializeUnorderedBulkOp = function(topology, collection, options) {
	return new UnorderedBulkOperation(topology, collection, options);
}

module.exports = initializeUnorderedBulkOp;


text:
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_rotaryencoder as upmRotaryEncoder

def main():
    # Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
    myRotaryEncoder = upmRotaryEncoder.RotaryEncoder(2, 3);

    ## Exit handlers ##
    # This function stops python from printing a stacktrace when you hit control-C
    def SIGINTHandler(signum, frame):
        raise SystemExit

    # This function lets you run code on exit, including functions from myRotaryEncoder
    def exitHandler():
        print("Exiting")
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    # Read the value every second and detect motion
    while(1):
        print("Position: {0}".format(myRotaryEncoder.position()))
        time.sleep(.1)

if __name__ == '__main__':
    main()


text:
#region License

#endregion

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using HidSharp.Reports.Encodings;

namespace HidSharp.Reports
{
    public class DescriptorCollectionItem : DescriptorItem
    {
        ReportCollectionItemChildren _children;

        public DescriptorCollectionItem()
        {
            _children = new ReportCollectionItemChildren(this);
        }

        public override IList<DescriptorItem> ChildItems
        {
            get { return _children; }
        }

        public CollectionType CollectionType
        {
            get;
            set;
        }

        #region ReportCollectionItemChildren
        sealed class ReportCollectionItemChildren : Collection<DescriptorItem>
        {
            DescriptorCollectionItem _item;

            public ReportCollectionItemChildren(DescriptorCollectionItem item)
            {
                Debug.Assert(item != null);
                _item = item;
            }

            protected override void ClearItems()
            {
                foreach (var item in this) { item.ParentItem = null; }
                base.ClearItems();
            }

            protected override void InsertItem(int index, DescriptorItem item)
            {
                Throw.If.Null(item).False(item.ParentItem == null);
                item.ParentItem = _item;
                base.InsertItem(index, item);
            }

            protected override void RemoveItem(int index)
            {
                this[index].ParentItem = null;
                base.RemoveItem(index);
            }

            protected override void SetItem(int index, DescriptorItem item)
            {
                throw new NotImplementedException();
            }
        }
        #endregion
    }
}


text:
module Azure::CDN::Mgmt::V2020_04_15
  module Models
    #
    # A condition for the delivery rule.
    #
    class DeliveryRuleCondition

      include MsRestAzure

      @@discriminatorMap = Hash.new
      @@discriminatorMap["RemoteAddress"] = "DeliveryRuleRemoteAddressCondition"
      @@discriminatorMap["RequestMethod"] = "DeliveryRuleRequestMethodCondition"
      @@discriminatorMap["QueryString"] = "DeliveryRuleQueryStringCondition"
      @@discriminatorMap["PostArgs"] = "DeliveryRulePostArgsCondition"
      @@discriminatorMap["RequestUri"] = "DeliveryRuleRequestUriCondition"
      @@discriminatorMap["RequestHeader"] = "DeliveryRuleRequestHeaderCondition"
      @@discriminatorMap["RequestBody"] = "DeliveryRuleRequestBodyCondition"
      @@discriminatorMap["RequestScheme"] = "DeliveryRuleRequestSchemeCondition"
      @@discriminatorMap["UrlPath"] = "DeliveryRuleUrlPathCondition"
      @@discriminatorMap["UrlFileExtension"] = "DeliveryRuleUrlFileExtensionCondition"
      @@discriminatorMap["UrlFileName"] = "DeliveryRuleUrlFileNameCondition"
      @@discriminatorMap["HttpVersion"] = "DeliveryRuleHttpVersionCondition"
      @@discriminatorMap["Cookies"] = "DeliveryRuleCookiesCondition"
      @@discriminatorMap["IsDevice"] = "DeliveryRuleIsDeviceCondition"

      def initialize
        @name = "DeliveryRuleCondition"
      end

      attr_accessor :name

      #
      # Mapper for DeliveryRuleCondition class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'DeliveryRuleCondition',
          type: {
            name: 'Composite',
            polymorphic_discriminator: 'name',
            uber_parent: 'DeliveryRuleCondition',
            class_name: 'DeliveryRuleCondition',
            model_properties: {
            }
          }
        }
      end
    end
  end
end


text:
{% extends "layout.html" %}

{% block pageTitle %}
  File abridged accounts using software
{% endblock %}

{% block proposition_header %}

{% endblock %}

{% block header_class %}

{% endblock %}

{% block main %}

{% include "includes/phase_banner_beta.html" %}

    Back

File abridged accounts using software

This service is open to everyone, but will mostly benefit those who file frequently - on a daily or weekly basis. The more documents you file, the more appropriate software filing is likely to be.

View list of third-party software providers Link opens in a new tab/window

{% endblock %}


text:
package javax.sip.header;

/**

 * The Proxy-Authorization header field allows the client to identify

 * itself (or its user) to a proxy that requires authentication.  A

 * Proxy-Authorization field value consists of credentials containing

 * the authentication information of the user agent for the proxy and/or

 * realm of the resource being requested.

 *

 * This header field, along with Authorization, breaks the general rules

 * about multiple header field names.  Although not a comma-separated

 * list, this header field name may be present multiple times, and MUST

 * NOT be combined into a single header line.

 *

 * An UAC sends a request to a proxy server containing a Proxy-Authorization

 * header field, so that the proxy can authenticate the UAC before processing

 * the request. A proxy can challenge for credentials by rejecting a request

 * with a 407 (Proxy Authentication Required) status code upon which a UAC may

 * provide credentials for the requested resource in the Proxy-Authorization

 * header.

 *

 * A Proxy-Authorization header field value applies only to the proxy

 * whose realm is identified in the "realm" parameter. When multiple proxies

 * are used in a chain, a Proxy-Authorization header field value MUST NOT be

 * consumed by any proxy whose realm does not match the "realm" parameter

 * specified in that value. Note that if an authentication scheme that does not

 * support realms is used in the Proxy-Authorization header field, a proxy

 * server MUST attempt to parse all Proxy-Authorization header field values to

 * determine whether one of them has what the proxy server considers to be

 * valid credentials.

 *

 * Example:

 * Proxy-Authorization: Digest username="Alice", realm="atlanta.com",

 * nonce="c60f3082ee1212b402a21831ae", response="245f23415f11432b3434341c022"

 *

 * @see Parameters

 * @see ProxyAuthenticateHeader
 * @author BEA Systems, NIST
 * @version 1.2

 */

public interface ProxyAuthorizationHeader extends AuthorizationHeader {

    /**

     * Name of ProxyAuthorizationHeader

     */

    public final static String NAME = "Proxy-Authorization";

}


text:
IBEFUR ;ALB/ARH - UTILITY: FIND RELATED FIRST AND THIRD PARTY BILLS ; 3/7/00
 ;;2.0;INTEGRATED BILLING;**130**;21-MAR-94
 ;;Per VHA Directive 10-93-142, this routine should not be modified.
 ;
 ; Called by Accounts Receivable report option
 ;
 ; for a specific Third Party bill, return all related Third Party bills
 ; matchs with the selected bill are based on:   (selected bill is included in list returned)
 ; 1)  Event Date (399,.03), returns all bills with same Event Date
 ;
 ; 2)  PTF # (399,.08), returns all bills with the same PTF number
 ; 3)  PTF # (399,.08), returns all bills with Outpatient Visit Dates (399,43) within the admission date range
 ;
 ; 4)  Opt Visit Dates (399,43), returns all bills with one or more matching Opt Visit Dates
 ; 5)  Opt Visit Dates (399,43), returns all bills for any PTF (399,.08) stay covering any of the Opt Visit Dates
 ;
 ; 6)  Prescriptions (362.4): returns all bills with one or more matching Rx # and fill date
 ;
 ; ^TMP("IBRBT", $J, selected bill ifn) = PATIENT HAS ANY RX COVERAGE ON FROM DATE OF BILL (0/1)
 ; ^TMP("IBRBT", $J, selected bill ifn, matching bill ifn) =
 ;                                        BILL FROM ^ BILL TO ^ CANCELLED (0/1) ^ AR BILL NUMBER ^
 ;                                        PAYER SEQUENCE ^ PAYER IS MEDICARE SUPPLEMENTAL (0/1) ^ PAYER NAME
 ;
TPTP(IBIFN) ; given a specific Third Party bill, find all related Third Party Bills
 N IB0,DFN,IBEVDT,IBPTF,IBADM,IBDIS,IBOPV,IBPTF1,IBXRF,IBRXN,IBRXDT,IBX Q:'$G(IBIFN)
 S IB0=$G(^DGCR(399,+IBIFN,0)) Q:IB0=""  S DFN=$P(IB0,U,2),IBEVDT=$P(IB0,U,3),IBPTF=$P(IB0,U,8)
 ;
 K ^TMP("IBRBT",$J,IBIFN) S IBX=$$LN1^IBEFURT(IBIFN) D SAVELN1^IBEFURT(IBIFN,IBX)
 ;
 I +IBEVDT D TPEVDT^IBEFURT(DFN,IBEVDT,IBIFN) ; find all bills with the same Event Date (399,.03)
 ;
IT I +IBPTF D TPPTF^IBEFURT(IBPTF,IBIFN) ; find all bills with the same PTF number  (399,.08)
 ;
 ; find any bills with Outpatient Visit Dates within the date range of the admission (PTF)
 I +IBPTF S IBADM=$P($G(^DGPT(+IBPTF,0)),U,2),IBDIS=+$G(^DGPT(+IBPTF,70)) S:'IBDIS IBDIS=DT D
 . D TPOPV^IBEFURT(DFN,IBADM,IBDIS,IBIFN)
 ;
OT ; find all bills that have one or more of the same Opt Visit Dates (399,43)
 S IBX=0 F  S IBX=$O(^DGCR(399,+IBIFN,"OP",IBX)) Q:'IBX  S IBOPV=+$G(^DGCR(399,+IBIFN,"OP",IBX,0)) D
 . D TPOPV^IBEFURT(DFN,IBOPV,IBOPV,IBIFN)
 ;
 ; find any bills for inpatient admissions whose date range includes one or more of the Opt Visit Dates
 S IBX=0 F  S IBX=$O(^DGCR(399,+IBIFN,"OP",IBX)) Q:'IBX  S IBOPV=+$G(^DGCR(399,+IBIFN,"OP",IBX,0)) D
 . S IBADM=$$ADM^IBCU64(DFN,IBOPV) I +IBADM S IBPTF1=$P(IBADM,U,4) I +IBPTF1 D
 .. D TPPTF^IBEFURT(IBPTF1,IBIFN)
 ;
RT ; find all bills that have one or more of the same Prescription: same Rx number and fill date (362.4,.01,.03)
 S IBXRF="AIFN"_IBIFN,IBRXN="" F  S IBRXN=$O(^IBA(362.4,IBXRF,IBRXN))  Q:'IBRXN  D
 . S IBX=0 F  S IBX=$O(^IBA(362.4,IBXRF,IBRXN,IBX)) Q:'IBX  S IBRXDT=$P($G(^IBA(362.4,IBX,0)),U,3) D
 .. D TPRX^IBEFURT(DFN,IBRXN,IBRXDT,IBIFN)
 Q
 ;
 ; ==============================================================================================================
 ;
 ; Called by Accounts Receivable report option
 ;
 ; for a specific Third Party bill, return all related First Party Charges
 ; only a single record of a charge event is returned, defining the charges current status, although there may
 ; have been cancellations or updates to the original charge
 ;    o Inpatient Events may have multiple charge events (Copay and Per Diem)
 ;    o Opt and Rx Events have only a single charge event (Copay)
 ;
 ; matchs with the selected bill are based on:
 ; 1) Event Date (399,.03), returns Inpatient charges whose Parent Event (350,.16) has that Event Date (350,.17)
 ; 2) PTF # (399,.08), returns Outpatient charge for Opt Visits Dates within timeframe of admission
 ;
 ; 3) Opt Visit Date (399,43), returns the Outpatient charge for that Event Date (350,.17)
 ; 4) Opt Visit Date (399,43), returns Inpatient charges for any admission that includes that Opt Visit Date
 ;
 ; 5) Rx Record (362.4,.05) and Rx Date (362.4,.03) and Outpatient Pharmacy, returns the Rx charge for the fill
 ; 6) Opt Visit Date (399,43) and Outpatient Pharmacy, returns any First Party Rx charge on one of the
 ;    selected bills Opt Visit Dates that is not billed on any Third Party bill
 ;
 ; ^TMP("IBRBF", $J , selected bill ifn ) = ""
 ; ^TMP("IBRBF", $J , selected bill ifn , charge ifn) =
 ; BILL FROM ^ BILL TO ^ CANCELLED? (1/0)^ AR BILL NUMBER ^ TOTAL CHARGE ^ ACTION TYPE (SHORT) ^ # DAYS ON HOLD
 ;
TPFP(IBIFN) ; given a specific Third Party Bill, find all related First Party Bills
 N IBX,IBY,IB0,DFN,IBEVDT,IBPTF,IBADM,IBOPV,IBXRF,IBRXN,IBRXIFN,IBRXDT,IBFROM,IBTO Q:'$G(IBIFN)
 S IB0=$G(^DGCR(399,+IBIFN,0)) Q:IB0=""  S DFN=$P(IB0,U,2),IBEVDT=$P(IB0,U,3)
 ;
 K ^TMP("IBRBF",$J,IBIFN) D SAVELN1^IBEFURF(IBIFN)
 ;
IF ; find all First Party charges for the Inpatient Event Date (Admission Date) on the Third Party bill
 D FPINPT^IBEFURF(DFN,IBEVDT,IBIFN)
 ;
 ; find any First Party Outpatient charges for Visit Dates within the date range of the admission (PTF)
 S IBPTF=$P(IB0,U,8) I +IBPTF S IBADM=$$PTFADM^IBCU64(+IBPTF) I +IBADM S IBADM=$$AD^IBCU64(IBADM) D
 . S IBX=$P(IBADM,U,2)\1 I 'IBX S IBX=DT
 . D FPOPV^IBEFURF(DFN,+IBADM\1,IBX,IBIFN)
 ;
OF ; find First Party charges for the Opt Visit Dates on the Third Party Bill
 S IBX=0 F  S IBX=$O(^DGCR(399,+IBIFN,"OP",IBX)) Q:'IBX  S IBOPV=+$G(^DGCR(399,+IBIFN,"OP",IBX,0)) D
 . D FPOPV^IBEFURF(DFN,IBOPV,IBOPV,IBIFN)
 ;
 ; find any charges for inpatient admissions whose date range includes one or more of the Opt Visit Dates
 S IBX=0 F  S IBX=$O(^DGCR(399,+IBIFN,"OP",IBX)) Q:'IBX  S IBOPV=+$G(^DGCR(399,+IBIFN,"OP",IBX,0)) D
 . S IBADM=$$ADM^IBCU64(DFN,IBOPV) I 'IBADM Q
 . D FPINPT^IBEFURF(DFN,+IBADM,IBIFN)
 ;
RF ; find First Party charges for any Rx's on the selected Third Party bill
 ; based on Rx IFN (52) and fill date (362.4,.05,.03)
 S IBXRF="AIFN"_IBIFN,IBRXN="" F  S IBRXN=$O(^IBA(362.4,IBXRF,IBRXN))  Q:'IBRXN  D
 . S IBX=0 F  S IBX=$O(^IBA(362.4,IBXRF,IBRXN,IBX)) Q:'IBX  D
 .. S IBY=$G(^IBA(362.4,IBX,0)),IBRXIFN=$P(IBY,U,5),IBRXDT=$P(IBY,U,3) Q:'IBRXIFN
 .. D FPRX^IBEFURF(IBRXIFN,IBRXDT,IBIFN)
 ;
 ; find First Party Charges for any RX filled on one of the Third Party bill's Opt Visit Dates
 ; that is not billed on any Third Party bill
 S IBFROM=$G(^DGCR(399,IBIFN,"U")),IBTO=$P(IBFROM,U,2),IBFROM=+IBFROM K IBX
 D RXDISP^IBCSC5C(DFN,IBFROM,IBTO,.IBX,"","",1,1) ; get all Rx's for patient in date range
 S IBRXN="" F  S IBRXN=$O(IBX(IBRXN)) Q:IBRXN=""  S IBRXDT=0 F  S IBRXDT=$O(IBX(IBRXN,IBRXDT)) Q:'IBRXDT  D
 . I '$D(^DGCR(399,"AOPV",DFN,IBRXDT,IBIFN)) Q  ; rx not on bills opt visit date
 . I +$$RXTP^IBEFURT(DFN,IBRXN,IBRXDT) Q  ; rx billed on a third party bill
 . S IBRXIFN=$P(IBX(IBRXN,IBRXDT),U,1)
 . D FPRX^IBEFURF(IBRXIFN,IBRXDT,IBIFN)
 Q


text:
\subsection{Team Member Roles}

\paragraph{Yipeng} served the role of system integrator for the hardware. He created the sine and cosine hardware, along with the hardware for finding the forward kinematics matrix. He validated the hardware as a whole and its subcomponents individually against software models. Yipeng tuned the hardware timing and precision, in order to guarantee the solution converges while meeting FPGA area requirements.

\paragraph{Lianne} created the skeleton of the C implementation of our algorithm used
for understanding the algorithm and how components would fit together. She
produced the template OpenGL file which was used to demonstrate that the
IKSwift accelerator was working. Lianne also looked into matrix inverse
algorithms and determined the best method for inverting matrices in our
program. She implemented the two step process of inverting matrices in
SystemVerilog so that it could be interfaced with the rest of the
hardware files. After our hardware was built she worked with Qsys to
develop the files required to interface the IKSwift accelerator with
the device driver running on the ARM processor.

\paragraph{Richard} designed the skeleton for the SystemVerilog module that calculates the Jacobian
for a given configuration. Other than that, all of Richard's tangible contributions were on the
software end of the project. He designed the device driver to communicate with the hardware and
modified Lianne's openGL template to display an actual robot arm and interact with the device
driver. In terms of deliverables, Richard was in charge of maintaining accurate milestones over the
course of the semester and developed the pseudocode to describe the Jacobian and
damped least-squares algorithms.


text:
package org.literacybridge.dashboard.aggregation;

import junit.framework.TestCase;
import org.junit.Test;
import org.literacybridge.stats.model.DeploymentId;

/**
 * Created by willpugh on 2/9/14.
 */
public class TestStatAggregator {

  public static final DeploymentId UPDATE_ID_1                    = DeploymentId.parseContentUpdate("2012-4");
  public static final DeploymentId UPDATE_ID_1_DIFFERENT_INSTANCE = DeploymentId.parseContentUpdate("2012-4");
  public static final DeploymentId UPDATE_ID_2                    = DeploymentId.parseContentUpdate("2012-5");

  @Test
  public void testEmptyStatAggregator() {
    StatAggregator statAggregator = new StatAggregator();
    TestCase.assertNotNull(statAggregator.perUpdateAggregations);
    TestCase.assertEquals(0, statAggregator.perUpdateAggregations.size());
  }

  @Test
    public void testAddingStats() {
        StatAggregator statAggregator = new StatAggregator();
        statAggregator.add(UPDATE_ID_1, AggregationOf.tenSecondPlays, "TestContentId", "TestVillage", "TestTalkingBook", 3);
        TestCase.assertEquals(1, statAggregator.perUpdateAggregations.size());
        TestCase.assertEquals(3, statAggregator.perUpdateAggregations.get(UPDATE_ID_1).getAggregationMap(Grouping.contentId).get("TestContentId").get(
            AggregationOf.tenSecondPlays));

        statAggregator.add(UPDATE_ID_1_DIFFERENT_INSTANCE, AggregationOf.tenSecondPlays, "TestContentId", "TestVillage2", "TestTalkingBook2", 3);
        TestCase.assertEquals(1, statAggregator.perUpdateAggregations.size());
        TestCase.assertEquals(6, statAggregator.perUpdateAggregations.get(UPDATE_ID_1).getAggregationMap(Grouping.contentId).get("TestContentId").get(
            AggregationOf.tenSecondPlays));
        TestCase.assertEquals(3, statAggregator.perUpdateAggregations.get(UPDATE_ID_1).getAggregationMap(Grouping.village).get("TestVillage2").get(
            AggregationOf.tenSecondPlays));

        statAggregator.add(UPDATE_ID_2, AggregationOf.tenSecondPlays, "TestContentId", "TestVillage", "TestTalkingBook", 5);
        TestCase.assertEquals(2, statAggregator.perUpdateAggregations.size());
        TestCase.assertEquals(5, statAggregator.perUpdateAggregations.get(UPDATE_ID_2).getAggregationMap(Grouping.talkingBook).get("TestTalkingBook").get(
            AggregationOf.tenSecondPlays));

    }

}


text:
layout: post
title: API Pain-Points
date: 2014-06-17
eventbrite_id: 11943209461
---
This month [Phil Sturgeon][1] will be presenting on API Pain-Points.

I've been building APIs for a long time now and it is becoming ever more common for server-side developer thanks to the rise of front-end JavaScript frameworks, iPhone applications and generally API-centric architectures.

On one hand you're just grabbing stuff from a data source and shoving it out as JSON, but creating useful conventions from the start, surviving changes in business logic, handling database schema updates, and managing the shifting landscape of features creation and deprecated can be insanely tough.

This talk will outline some good the common pitfalls developers get trapped in when building APIs and give you some tools to make decisions about what you will do yourselves.

Don't forget, this event will be at [Campus North][2], Sunco House, 5 Carliol Square, Newcastle Upon Tyne, NE1 6UF, and there will be Pizza sponsored by [Sharpe Recruitment][3]

[1]: https://twitter.com/philsturgeon
[2]: http://ignite100.com/
[3]: http://www.sharperecruitment.co.uk/


text:
namespace g{namespace Android{namespace android{namespace graphics{namespace drawable{struct Drawable;}}}}}
namespace g{namespace Fuse{namespace Android{namespace Controls{struct AndroidExtensions;}}}}
namespace g{namespace Fuse{namespace Drawing{struct LinearGradient;}}}

namespace g{
namespace Fuse{
namespace Android{
namespace Controls{

// internal static extern class AndroidExtensions :506
// {
uClassType* AndroidExtensions_typeof();
void AndroidExtensions__ToDrawable_fn(::g::Fuse::Drawing::LinearGradient* linearGradient, ::g::Android::android::graphics::drawable::Drawable** __retval);

struct AndroidExtensions : uObject
{
    static ::g::Android::android::graphics::drawable::Drawable* ToDrawable(::g::Fuse::Drawing::LinearGradient* linearGradient);
};
// }

}}}} // ::g::Fuse::Android::Controls


text:
[:page partOf="trails" args="registerId"]

Enregistrement

                <input  id="[=registerId]-login" type="text" class="form-control"  placeholder="Login">

                <input id="[=registerId]-password"  type="password" class="form-control"  placeholder="Mot de passe">

                <input id="[=registerId]-password-confirm" type="password" class="form-control"  placeholder="Confirmation mot de passe">

              <button id="[=registerId]-btn-submit" type="submit" class="btn btn-primary btn-submit-register">S'enregister</button>
              <button id="[=registerId]-btn-cancel" class="btn btn-default">Annuler</button>


text:
package org.commacq;

import java.util.Collection;

/**
 * Represents an endpoint that CSV data can be obtained from.
 * This is either a database, a file or another CommaCQ server
 * which is acting as a proxy for the data source, allowing
 * servers to be chained together, perhaps across regions.
 *
 * The source is also responsible for specifying which entity
 * name it has access to.
 */
public interface CsvDataSource {

    String getEntityId();
    String getColumnNamesCsv();

    /**
     * Pushes all lines through the callback using
     * just the processUpdate method.
     */
    void getAllCsvLines(LineCallback callback);

    /**
     * Pushes a single line through the callback using
     * just a single invocation of either processUpdate and processRemove
     * depending on whether the line is found in the data source.
     */
    void getCsvLine(String id, LineCallback callback);

    /**
     * Same behaviour as {@link #getCsvLine(String, BlockCallback)}  but
     * operates on multiple lines in a single method call.
     */
    void getCsvLines(Collection<String> ids, LineCallback callback);

    void getCsvLinesForGroup(String group, String idWithinGroup, LineCallback callback);

}


text:
#if NETSTANDARD
using System;

using Meerkat.Caching;

using Microsoft.Extensions.Caching.Distributed;

namespace Meerkat.Security.Authentication
{
    /// <summary>
    /// Caching layer over a <see cref="ISecretRepository"/> using <see cref="IDistributedCache"/>
    /// </summary>
    /// <remarks>Data is stored in the cache in plaintext, for encryption use <see cref="SecretRepositoryCache" /> with a suitable configured Polly CachePolicy.</remarks>
    public class SecretRepositoryDistributedCache : ISecretRepository
    {
        private const string CacheRegion = "clientsecret";

        private readonly ISecretRepository repository;
        private readonly IDistributedCache cache;
        private readonly TimeSpan duration;

        /// <summary>
        /// Creates a new instance of the <see cref="SecretRepositoryDistributedCache"/> class.
        /// </summary>
        /// <param name="repository">Underlying repository with the secrets</param>
        /// <param name="cache">Cache to use</param>
        /// <param name="duration">Duration to cache after acquisition</param>
        public SecretRepositoryDistributedCache(ISecretRepository repository, IDistributedCache cache, TimeSpan duration)
        {
            this.repository = repository;
            this.cache = cache;
            this.duration = duration;
        }

        /// <summary>
        /// Retrieves the secret from the cache, if not present calls the underlying <see cref="ISecretRepository"/> to acquire and caches the result.
        /// </summary>
        /// <param name="clientId"></param>
        /// <returns></returns>
        /// <remarks>We don't do any locking internally, it's a case of last one wins but all that would happen is that the cache duration would be increased slightly.</remarks>
        public string ClientSecret(string clientId)
        {
            var key = CacheRegion.CacheKey(clientId);
            var options = new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = duration
            };
            return cache.GetOrCreate(key, () => repository.ClientSecret(clientId), options);
        }
    }
}
#endif


text:
import fs from 'fs';
import models from '../../models';
const uuid = require('uuid/v4');
const errors = JSON.parse(fs.readFileSync('api/static/errors.json', 'utf8'));
const defaults = JSON.parse(fs.readFileSync('api/defaults.json', 'utf8'));

const removeInternals = (storage, detailed) => {
    var pubStorage = {};
    pubStorage.access = storage.access;
    if (detailed) {
        pubStorage.backup_rule = "";
        pubStorage.backups = {};
        pubStorage.backups.backup = [];
        // TODO actual backup_rule and listing of backups
        pubStorage.servers = {};
        pubStorage.servers.server = [];
        // TODO populate server array from database
    }
    pubStorage.license = storage.license;
    pubStorage.size = storage.size;
    pubStorage.state = storage.state;
    pubStorage.tier = storage.tier;
    pubStorage.title = storage.title;
    pubStorage.type = storage.type;
    pubStorage.uuid = storage.uuid;
    pubStorage.zone = storage.zone;

    return pubStorage;
}
exports.removeInternals = removeInternals;

//   server.get('/storage', storage.list);
//   server.get('/storage/public', storage.list);
//   server.get('/storage/private', storage.list);
//   server.get('/storage/normal', storage.list);
//   server.get('/storage/backup', storage.list);
//   server.get('/storage/cdrom', storage.list);
//   server.get('/storage/template', storage.list);
//   server.get('/storage/favorite', storage.list);
exports.list = (req, res) => {

    var searchopts = {};
    searchopts.userAnnotationId = req.user.annotation_id;

    const urlparts = req.url.split('/');
    if (urlparts.length > 2) {
        switch(urlparts[2]) {
            case 'public':
                searchopts.access = 'public';
                break;
            case 'private':
                searchopts.access = 'private';
                break;
            case 'normal':
                searchopts.type = 'normal';
                break;
            case 'backup':
                searchopts.type = 'backup';
                break;
            case 'cdrom':
                searchopts.type = 'cdrom';
                break;
            case 'template':
                searchopts.type = 'template';
                break;
            case 'favorite':
                searchopts.favorite = true;
            default:
                break;
        }
    }

    models.storage_device.findAll({
        where: searchopts
    }).then((storages) => {
        var storageresp = {};
        storageresp.storages = {};
        storageresp.storages.storage = [];

        storages.forEach((s) => {
            storageresp.storages.storage.push(removeInternals(s, false));
        });

        res.statusCode = 200;
        res.json(storageresp).end();

    }).catch((err) => {
        req.log.error('Error when fetching storages', err);
        res.statusCode = 500;
        res.end();
    })

}

//   server.post('/storage', storage.create);
exports.create = (req, res) => {
    var newstorage = models.storage_device.build(req.params.storage);
    newstorage.uuid = uuid();
    newstorage.userAnnotationId = req.user.annotation_id;
    newstorage.validate()
    .then(() => {
        newstorage.save()
        .then((stor) => {
            res.statusCode = 201;
            var response = {};
            response.storage = {};
            response.storage.size = stor.size;
            response.storage.tier = stor.tier;
            response.storage.title = stor.title;
            response.storage.zone = stor.zone;
            // TODO actual backup_rule when implemented

            res.json(response).end();
        })
        .catch((err) => {
            req.log.error('Error when creating storage', err);
            res.statusCode = 500;
            res.end();
        });
    }).catch((valerr) => {
        const reason = valerr.errors[0].path;
        res.statusCode = 400;
        var errorresp = {};

        switch (reason) {
            case 'size':
                errorresp.error = errors['SIZE_INVALID'];
                break;
            case 'title':
                errorresp.error = errors['TITLE_INVALID'];
                break;
            case 'tier':
                errorresp.error = errors['TIER_INVALID'];
                break;
            case 'zone':
                errorresp.error = errors['ZONE_INVALID'];
                break;
            default:
                errorresp.error = errors['UNKNOWN_ERROR'];
                req.log.debug('Unknown validation error:', valerr.errors[0]);
                break;
        }

        res.json(errorresp).end();
    });

}

//   server.get('/storage/:uuid', storage.info);
exports.info = (req, res) => {
    models.storage_device.findOne({
        where: {
            uuid: req.params.uuid,
            userAnnotationId: req.user.annotation_id
        }
    }).then((storage) => {
        if (!storage || storage.length < 1) {
            var error = {};
            error.error = errors['STORAGE_NOT_FOUND'];
            res.statusCode = 404;
            res.json(error).end();
        }
        else {
            res.statusCode = 200;
            res.json(removeInternals(storage, true)).end();
        }
    }).catch((err) => {
        req.log.error('Problem when fetching event:', err);
        res.statusCode = 500;
        res.end();
    });
}

//   server.put('/storage/:uuid', storage.modify);
exports.modify = (req, res) => {
    models.storage_device.findOne({
        where: {
            uuid: req.params.uuid,
            userAnnotationId: req.user.annotation_id
        }
    }).then((storage) => {
        if (!storage || storage.length < 1) {
            var error = {};
            error.error = errors['STORAGE_NOT_FOUND'];
            res.statusCode = 404;
            res.json(error).end();
        }
        else {
            var error = {};
            if (storage.type != 'normal') {
                error.error = errors['STORAGE_TYPE_ILLEGAL'];
                res.statusCode = 409;
                res.json(error).end();
            }
            if (storage.state != 'online') {
                error.error = errors['STORAGE_STATE_ILLEGAL'];
                res.statusCode = 409;
                res.json(error).end();
            }
            // TODO check if attached to a running server (or just to a server? check!)
            if (!req.params.storage) {
                error.error = errors['STORAGE_INVALID'];
                res.statusCode = 400;
                res.json(error).end();
            }

            var changes = {};
            if (req.params.storage.size) {
                if (req.params.storage.size > defaults.max_storage_size || req.params.storage.size < storage.size) {
                    error.error = errors['SIZE_INVALID'];
                    res.statusCode = 400;
                    res.json(error).end();
                }
                else {
                    changes.size = req.params.storage.size;
                }
            }
            if (req.params.storage.title) {
                if (req.params.storage.title.length > defaults.max_storage_name_length) {
                    error.error = errors['TITLE_INVALID'];
                    res.statusCode = 400;
                    res.json(error).end();
                }
                else {
                    changes.title = req.params.storage.title;
                }
            }
            // TODO backup_rule when implemented

            if (JSON.stringify(changes) != JSON.stringify({}) && JSON.stringify(error) === JSON.stringify({})) {
                storage.updateAttributes(changes)
                .then((changed) => {
                    res.statusCode = 202;
                    res.json(removeInternals(changed, true)).end();
                }).catch((err) => {
                    req.log.error('Problem when changing storage attributes:', err);
                    res.statusCode = 500;
                    res.end();
                });
            }
            else {
                if (JSON.stringify(error) === JSON.stringify({})) {
                    error.error = errors['STORAGE_INVALID'];
                    res.statusCode = 400;
                    res.json(error).end();
                }
            }
        }
    }).catch((err) => {
        req.log.error('Problem when fetching event:', err);
        res.statusCode = 500;
        res.end();
    });
}

//   server.del('/storage/:uuid', storage.delete);
exports.delete = (req, res) => {
    models.storage_device.findOne({
        where: {
            uuid: req.params.uuid,
            userAnnotationId: req.user.annotation_id
        }
    }).then((storage) => {
        if (!storage || storage.length < 1) {
            var error = {};
            error.error = errors['STORAGE_NOT_FOUND'];
            res.statusCode = 404;
            res.json(error).end();
        }
        else {
            var error = {};
            if (storage.state != 'online') {
                error.error = errors['STORAGE_STATE_ILLEGAL'];
                res.statusCode = 409;
            }
            // TODO check if attached to server

            if (JSON.stringify(error) != JSON.stringify({})) {
                res.json(error).end();
            }
            else {
                storage.destroy()
                .then(() => {
                    res.statusCode = 204;
                    res.end();
                }).catch((err) => {
                    req.log.error('Problem deleting storage:', err);
                    res.statusCode = 500;
                    res.end();
                })
            }
        }
    }).catch((err) => {
        req.log.error('Problem when fetching storage for deletion:', err);
        res.statusCode = 500;
        res.end();
    });
}

//   server.post('/storage/:uuid/clone', storage.clone);
exports.clone = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/storage/:uuid/templatize', storage.templatize);
exports.templatize = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/storage/:uuid/backup', storage.createbackup);
exports.createbackup = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/storage/:uuid/restore', storage.restorebackup);
exports.restorebackup = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/storage/:uuid/favorite', storage.addfavorite);
exports.addfavorite = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.del('/storage/:uuid/favorite', storage.delfavorite);
exports.delfavorite = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/server/:uuid/storage/attach', storage.attach);
exports.attach = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/server/:uuid/storage/detach', storage.detach);
exports.detach = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/server/:uuid/cdrom/load', storage.loadcdrom);
exports.loadcdrom = (req, res) => {
    res.statusCode = 501;
    res.end();
}

//   server.post('/server/:uuid/cdrom/eject', storage.ejectcdrom);
exports.ejectcdrom = (req, res) => {
    res.statusCode = 501;
    res.end();
}


text:
/*=====================================================================*
 | Declaration file Asteroid.h
 |      declares :  Asteroid class
 |
 | For more informations (creation date, creator, etc.), please see the
 | corresponding .cpp file
 |
 *=====================================================================*/

#ifndef ASTEROID_H
#define ASTEROID_H

#include "include/game/Destroyable.h"
#include "include/game/Projectile.h"

#include "include/enum/Enum.h"
#include "include/config/Define.h"

class GameEngine;

class Asteroid : public Destroyable, public Projectile
{
public:
    Asteroid(qreal _dX, qreal _dY,Shooter _from, qreal _dResistance, qreal _dHealthPoint, GameEngine *_gameEngine,int _idParent=0,qreal _dAngleParent=0,qreal _dAngle=0);
    ~Asteroid() {}

    bool isSmall() const {return bSmall;}
    int getIdParent() const {return idParent;}
    TypeItem getTypeObject() const {return (bSmall)?tSmallAsteroid:tAsteroid;}
    QRectF boundingRect() const;
    QPainterPath shape() const;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    void collision(qreal _dAngle);
protected:
    int currentFrame;
    int numberFrameMin;
    int numberFrameMax;

private:
    GameEngine* gameEngine;

    int index;

    int idParent;

    bool bSmall;
};
#endif


text:
#include "nau/render/opengl/glProgram.h"

#include "nau.h"
#include "nau/config.h"
#include "nau/slogger.h"
#include "nau/geometry/vertexData.h"
#include "nau/material/uniformBlockManager.h"
#include "nau/render/iRenderer.h"
#include "nau/system/file.h"

//#include <GL/glew.h>

using namespace nau::render;
using namespace nau::system;

// STATIC METHOD

GLenum GLProgram::ShaderGLId[IProgram::SHADER_COUNT] =
	{GL_VERTEX_SHADER, GL_GEOMETRY_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER};

// CONSTRUCTORS

GLProgram::GLProgram() :
	m_File(SHADER_COUNT,""),
	m_Source(SHADER_COUNT,""),
	m_ID(SHADER_COUNT,0),
	m_Compiled(SHADER_COUNT,false),
	m_NumUniforms (0),
	m_MaxLength (0),
	m_PLinked (false),
	m_ShowGlobalUniforms (false),
	m_Name("default") {

	m_P = glCreateProgram();
}

GLProgram::~GLProgram() {

	if (m_P != 0)
		glDeleteProgram(m_P);

	for (int i = 0; i < SHADER_COUNT; ++i) {

		if (m_ID[i] != 0)
			glDeleteShader(m_ID[i]);
	}

}

bool
GLProgram::areCompiled() {

	bool res = true;

	for (int i = 0; i < SHADER_COUNT; ++i) {
		if (m_ID[i] != 0)
			res = res && m_Compiled[i];
	}
	return(res);
}

bool
GLProgram::isCompiled(IProgram::ShaderType type) {

	return m_Compiled[type];
}

bool
GLProgram::isLinked() {

	return(m_PLinked);
}

void
GLProgram::getAttributeNames(std::vector<std::string>* s) {

	int k;
	GLsizei len, siz;
	GLenum typ;
	char name[256];
	glGetProgramiv(m_P, GL_ACTIVE_ATTRIBUTES, &k);
	for (unsigned int i = 0; i < (unsigned int)k; ++i) {
		glGetActiveAttrib(m_P, i, 256, &len, &siz, &typ, name);
		s->push_back(name);
	}
}

void
GLProgram::setName(const std::string &name) {

	m_Name = name;
}

const std::string &
GLProgram::getName() {

	return(m_Name);
}

bool
GLProgram::loadShader (IProgram::ShaderType type, const std::string &filename) {

	if (!isShaderSupported(type))
		return false;

	if (type == TESS_CONTROL_SHADER || type == TESS_EVALUATION_SHADER)
		m_HasTessShader = true;

	if (true == setShaderFile(type,filename)) {
		m_Compiled[type] = compileShader(type);
		return m_Compiled[type];
	}
	else
		return false;
}

const std::string &
GLProgram::getShaderFile(ShaderType type) {

	return m_File[type];
}

bool
GLProgram::setValueOfUniform (const std::string &name, void *values) {

	int i;

	i = findUniform (name);

	if (-1 == i) {
		return false;
	}
	m_Uniforms[i].setValues (values);
	setValueOfUniform(i);

	return true;
}

bool
GLProgram::setValueOfUniform(int loc, void *values) {

	int i = findUniformByLocation(loc);
	if (-1 == i) {
		return false;
	}
	m_Uniforms[i].setValues(values);
	setValueOfUniform(i);
	return true;
}

int
GLProgram::getUniformLocation(std::string name) {

	int i = findUniform(name);
	if (-1 == i)
		return -1;
	else
		return m_Uniforms[i].getLoc();

}

bool
GLProgram::setShaderFile (IProgram::ShaderType type, const std::string &filename) {

	if (!isShaderSupported(type))
		return false;

	// reset shader
	if (filename == "" && m_ID[type] != 0) {
		glDetachShader(m_P, (GLuint)ShaderGLId[type]);
		glDeleteShader((GLuint)ShaderGLId[type]);
		m_File[type] = "";
		m_ID[type] = 0;
		m_Source[type] = "";
		return true;
	}

	// if first time
	if (m_ID[type] == 0) {
		m_ID[type] = glCreateShader(ShaderGLId[type]);
	}

	// init shader variables
	m_Compiled[type] = false;
	m_PLinked = false;
	m_File[type] = filename;
	m_Source[type] = nau::system::File::TextRead(m_File[type]);

	// set shader source
	const char * vv = m_Source[type].c_str();

	glShaderSource (m_ID[type], 1, &vv, NULL);
	return true;
}

bool
GLProgram::reloadShaderFile (IProgram::ShaderType type) {

	if (!isShaderSupported(type))
		return false;

	m_Compiled[type] = false;
	m_PLinked = false;
	m_Source[type] = nau::system::File::TextRead (m_File[type]);
	if (m_Source[type] != "") { // if read successfuly

		// set shader source
		const char * ff = (char *)m_Source[type].c_str();

		glShaderSource (m_ID[type], 1, &ff, NULL);
		return true;
	}
	else
		return false;
}

bool
GLProgram::reload (void)
{
	for (int i = 0; i < SHADER_COUNT; ++i) {
		reloadShaderFile((IProgram::ShaderType)i);
		m_Compiled[i] = compileShader((IProgram::ShaderType)i);
	}

	if (areCompiled()) {
		m_PLinked = linkProgram();
	}

	return m_PLinked;
}

int
GLProgram::programValidate() {

	int v;

	glGetProgramiv(m_P,GL_VALIDATE_STATUS,&v);

	return(v);
}

bool
GLProgram::compileShader (IProgram::ShaderType type)
{
	int r;

	if (m_ID[type] != 0) {
		glCompileShader (m_ID[type]);

		glGetShaderiv (m_ID[type], GL_COMPILE_STATUS, &r);
		m_Compiled[type] = (1 == r);

		m_PLinked = false;

		return (m_Compiled[type]);
	}
	else
		return true;
}

bool
GLProgram::linkProgram()
{
	int r;

	if (!areCompiled()) {
		return false;
	}

	unsigned int index;
	for (index = 0; index < VertexData::MaxAttribs; index++) {
		glBindAttribLocation(m_P, index , VertexData::Syntax[index].c_str());
	}

	for (int i = 0; i < SHADER_COUNT; ++i) {
		if (m_ID[i] != 0)
			glAttachShader(m_P, m_ID[i]);
	}
	glLinkProgram (m_P);
	glUseProgram (m_P);

	glGetProgramiv (m_P, GL_LINK_STATUS, &r);
	m_PLinked = (1 == r);

	glGetProgramiv (m_P, GL_ACTIVE_UNIFORMS, &m_NumUniforms);
	glGetProgramiv (m_P, GL_ACTIVE_UNIFORM_MAX_LENGTH, &m_MaxLength);

	setUniforms();
	setBlocks();

	glUseProgram(0);

	return (m_PLinked);
}

int
GLProgram::getNumberOfUniforms() {

	if (true == m_PLinked) {
		return (m_NumUniforms);
	} else {
		return (-1);
	}
}

int
GLProgram::getAttributeLocation (const std::string &name) {

	return glGetAttribLocation (m_P, name.c_str());
}

void
GLProgram::useProgram (void) {

	if (m_ID[FRAGMENT_SHADER] == 0 && m_ID[COMPUTE_SHADER] == 0)
		glEnable(GL_RASTERIZER_DISCARD);
	else
		glDisable(GL_RASTERIZER_DISCARD);

	if (true == m_PLinked) {
		glUseProgram (m_P);
	} else {
		glUseProgram (0);
	}
}

unsigned int
GLProgram::getProgramID() {

	return m_P;
}

void
GLProgram::showGlobalUniforms (void) {

	m_ShowGlobalUniforms = !m_ShowGlobalUniforms;
}

bool
GLProgram::prepare (void) {

	useProgram();
	return true;
}

void
GLProgram::prepareBlocks(void) {

	UniformBlockManager *blockMan = UNIFORMBLOCKMANAGER;
	IUniformBlock *block;
	std::string blockName;
	for (auto b : m_Blocks)  {
		blockName = b.first;
		block = blockMan->getBlock(blockName);
		block->useBlock();
	}
}

bool
GLProgram::restore (void) {

	glUseProgram (0);
	return true;
}

int
GLProgram::findUniform (const std::string &name) {

	GLUniform uni;
	int i = 0;
	bool found (false);

	std::vector<GLUniform>::iterator it;
	for (it = m_Uniforms.begin(); it != m_Uniforms.end() && !found; it++) {
		//uni = *it;
		if ((*it).getName() == name) {
			found = true;
		} else {
			i++;
		}
	}

	if (true == found) {
		return (i);
	} else {
		return (-1);
	}
}

int
GLProgram::findUniformByLocation(int loc) {

	GLUniform uni;
	int i = 0;
	bool found(false);

	std::vector<GLUniform>::iterator it;
	for (it = m_Uniforms.begin(); it != m_Uniforms.end() && !found; it++) {
		//uni = *it;
		if ((*it).getLoc() == loc) {
			found = true;
		}
		else {
			i++;
		}
	}

	if (true == found) {
		return (i);
	}
	else {
		return (-1);
	}
}

const GLUniform&
GLProgram::getUniform(const std::string &name) {

	int i = findUniform (name);
	if (-1 == i) {
		i = 0;
	}
	return (m_Uniforms[i]);
}

void
GLProgram::getUniformBlockNames(std::vector<std::string>* s) {

	for (auto b : m_Blocks) {

		s->push_back(b.first);
	}
}

const IUniform&
GLProgram::getIUniform(int i) {

	assert((unsigned int) i < m_Uniforms.size());
	return (m_Uniforms[i]);
}

void
GLProgram::setValueOfUniform (int i) {

	m_Uniforms[i].setValueInProgram();
}

void
GLProgram::setBlocks() {

	int count, dataSize, actualLen, activeUnif, maxUniLength;
	int uniType, uniSize, uniOffset, uniMatStride, uniArrayStride, auxSize;
	char name[256], name2[256];
	unsigned int indices[256];

	IUniformBlock *block;
	UniformBlockManager *blockMan = UNIFORMBLOCKMANAGER;

	glGetProgramiv(m_P, GL_ACTIVE_UNIFORM_BLOCKS, &count);

	for (int i = 0; i < count; ++i) {
		// Get buffers name
		glGetActiveUniformBlockiv(m_P, i, GL_UNIFORM_BLOCK_NAME_LENGTH, &actualLen);
		//name = (char *)malloc(sizeof(char) * actualLen);
		glGetActiveUniformBlockName(m_P, i, actualLen, NULL, name);
		glGetActiveUniformBlockiv(m_P, i, GL_UNIFORM_BLOCK_DATA_SIZE, &dataSize);
		bool newBlock = true;
		std::string sName = name;
		if (blockMan->hasBlock(sName)) {
			newBlock = false;
			block = blockMan->getBlock(sName);
			if (block->getSize() != dataSize)
				NAU_THROW("Block %s is already defined with a different size", name);
		}

		//	/*if (!spBlocks.count(name))*/ {
		//		// Get buffers size
		//		//block = spBlocks[name];
		//
		//		//printf("DataSize:%d\n", dataSize);

		if (newBlock) {
			blockMan->addBlock(sName, dataSize);
			block = blockMan->getBlock(sName);
			block->setBindingIndex(blockMan->getCurrentBindingIndex());
			IBuffer *b = block->getBuffer();
			b->bind((unsigned int)GL_UNIFORM_BUFFER);
			glBufferData(GL_UNIFORM_BUFFER, dataSize, NULL, GL_DYNAMIC_DRAW);
			glUniformBlockBinding(m_P, i, blockMan->getCurrentBindingIndex());
			glBindBufferRange(GL_UNIFORM_BUFFER, blockMan->getCurrentBindingIndex(),
								block->getBuffer()->getPropi(IBuffer::ID), 0, dataSize);
		}
		else {
			block = blockMan->getBlock(sName);
			IBuffer *b = block->getBuffer();
			b->bind((unsigned int)GL_UNIFORM_BUFFER);
			glUniformBlockBinding(m_P, i, block->getBindingIndex());
			glBindBufferRange(GL_UNIFORM_BUFFER, block->getBindingIndex(),
				block->getBuffer()->getPropi(IBuffer::ID), 0, dataSize);
		}
		m_Blocks[name] = i;
		glGetActiveUniformBlockiv(m_P, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &activeUnif);

		//indices = (unsigned int *)malloc(sizeof(unsigned int) * activeUnif);
		glGetActiveUniformBlockiv(m_P, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, (int *)indices);

		glGetProgramiv(m_P, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniLength);
		//name2 = (char *)malloc(sizeof(char) * maxUniLength);

		for (int k = 0; k < activeUnif; ++k) {

			glGetActiveUniformName(m_P, indices[k], maxUniLength, &actualLen, name2);
			glGetActiveUniformsiv(m_P, 1, &indices[k], GL_UNIFORM_TYPE, &uniType);
			glGetActiveUniformsiv(m_P, 1, &indices[k], GL_UNIFORM_SIZE, &uniSize);
			glGetActiveUniformsiv(m_P, 1, &indices[k], GL_UNIFORM_OFFSET, &uniOffset);
			glGetActiveUniformsiv(m_P, 1, &indices[k], GL_UNIFORM_MATRIX_STRIDE, &uniMatStride);
			glGetActiveUniformsiv(m_P, 1, &indices[k], GL_UNIFORM_ARRAY_STRIDE, &uniArrayStride);

			if (uniArrayStride > 0)
				auxSize = uniArrayStride * uniSize;

			else if (uniMatStride > 0) {

				switch (uniType) {
				case (int)GL_FLOAT_MAT2:
				case (int)GL_FLOAT_MAT2x3:
				case (int)GL_FLOAT_MAT2x4:
				case (int)GL_DOUBLE_MAT2:
				case (int)GL_DOUBLE_MAT2x3:
				case (int)GL_DOUBLE_MAT2x4:
					auxSize = 2 * uniMatStride;
					break;
				case (int)GL_FLOAT_MAT3:
				case (int)GL_FLOAT_MAT3x2:
				case (int)GL_FLOAT_MAT3x4:
				case (int)GL_DOUBLE_MAT3:
				case (int)GL_DOUBLE_MAT3x2:
				case (int)GL_DOUBLE_MAT3x4:
					auxSize = 3 * uniMatStride;
					break;
				case (int)GL_FLOAT_MAT4:
				case (int)GL_FLOAT_MAT4x2:
				case (int)GL_FLOAT_MAT4x3:
				case (int)GL_DOUBLE_MAT4:
				case (int)GL_DOUBLE_MAT4x2:
				case (int)GL_DOUBLE_MAT4x3:
					auxSize = 4 * uniMatStride;
					break;
				}
			}
			else
				auxSize = Enums::getSize(GLUniform::spSimpleType[(GLenum)uniType]) * uniSize;;

			std::string uniName = name2;
			block->addUniform(uniName, GLUniform::spSimpleType[(GLenum)uniType],
				uniOffset, auxSize, uniArrayStride);

		}
	}
}

void
GLProgram::setUniforms() {

	int i,index,len,size;

	unsigned int type;
	char *name = new char [m_MaxLength + 1];
	GLUniform uni;

	// set all types = NOT_USED
	std::vector<GLUniform>::iterator it;
	for(it = m_Uniforms.begin(); it != m_Uniforms.end(); it++) {
		it->setGLType(GLUniform::NOT_USED, 0);
	}
	// add new uniforms and reset types for previous uniforms

	for (i = 0; i < m_NumUniforms; i++) {

		glGetActiveUniform (m_P, i, m_MaxLength, &len, &size, (GLenum *)&type, name);
		int loc = glGetUniformLocation(m_P, name);
		if (loc != -1) {

			std::string n(name);
			index = findUniform (n);
			if (-1 != index) {
				m_Uniforms[index].setGLType(type,size);
				m_Uniforms[index].setLoc (loc);
			}
			else {
				uni.reset();
				std::string ProgName (name);
				uni.setName (ProgName);
				uni.setGLType(type,size);
				uni.setLoc (loc);
				m_Uniforms.push_back (uni);
			}
			if (size > 1) {

				for (int i = 0; i < size; i++) {
					std::stringstream s;
					s << n.c_str() << "[" << i << "]";
					std::string Location = s.str();
					index = findUniform(Location);

					int loc;
					loc = glGetUniformLocation(m_P, s.str().c_str());
					if (loc != -1) {
						if (-1 != index) {
							m_Uniforms[index].setGLType(type, 1);
							m_Uniforms[index].setLoc(loc);
						}
						else {
							uni.reset();
							std::string ProgName(s.str());
							uni.setName(ProgName);
							uni.setGLType(type, 1);
							uni.setLoc(loc);
							m_Uniforms.push_back(uni);
						}
					}
				}
			}
		}
	}

	// delete all uniforms where type is NOT_USED
	for(it = m_Uniforms.begin(), i = 0; it != m_Uniforms.end(); i++ ) {
		if (it->getGLType() == GLUniform::NOT_USED) {
			it = m_Uniforms.erase(it);
		}
		else {
			++it;
		}
	}
	m_NumUniforms = (int)m_Uniforms.size();
	delete name;
}

void
GLProgram::updateUniforms() {

	for (int i = 0; i < m_NumUniforms; i++) {
		glGetUniformfv (m_P, m_Uniforms[i].getLoc(), (float *)m_Uniforms[i].getValues());
	}
}

const GLUniform&
GLProgram::getUniform (int i) {

	if (i < m_NumUniforms) {
		return (m_Uniforms[i]);
	} else {
		return (m_Uniforms[0]);
	}
}

std::string
GLProgram::getShaderInfoLog(ShaderType type) {

//	GLuint shader;
    int infologLength = 0;
    int charsWritten  = 0;
	std::string res;
	char *infoLog;

	if (m_ID[type] == 0)
		return "";

	res = IProgram::ShaderNames[type] + ": OK";

	glGetShaderiv (m_ID[type], GL_INFO_LOG_LENGTH, &infologLength);

    if (infologLength > 1) {
        infoLog = new char[infologLength];
        glGetShaderInfoLog (m_ID[type], infologLength, &charsWritten, infoLog);
		res.assign(infoLog);
		delete infoLog;
	}
    return (res);
}

const std::string &
GLProgram::getProgramInfoLog() {

    int infologLength = 0;
    int charsWritten  = 0;

	glGetProgramiv (m_P, GL_INFO_LOG_LENGTH, &infologLength);

    if (infologLength > 1) {
        char *infoLog = new char[infologLength];
        glGetProgramInfoLog (m_P, infologLength, &charsWritten, infoLog);
		m_ReturnString = infoLog;
		delete infoLog;

	} else {
		m_ReturnString = "Program: OK";
	}
	return(m_ReturnString);
}

int
GLProgram::getNumberOfUserUniforms() {

	int count = 0;

	if (true == m_PLinked) {
		for (int i = 0; i < m_NumUniforms; i++) {
			if (m_Uniforms[i].getName().substr(0,3) != "gl_" ) {
				count++;
			}
		}
	}
	return (count);
}

bool
GLProgram::getPropertyb(int query) {

	int res;
	glGetProgramiv(m_P, (GLenum)query, &res);
	return (res != 0);
}

int
GLProgram::getPropertyi(int query) {

	int res;
	glGetProgramiv(m_P, (GLenum)query, &res);
	return (res);
}


text:
package com.quintet.littleweather.config;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by Administrator on 16-4-19.
 */
        //自定义item之间的间隔
public class SpacesItemDecoration extends RecyclerView.ItemDecoration
{
    private int space;
    public SpacesItemDecoration(int space)
    {
        this.space=space;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state)
    {
        outRect.left=space;
        outRect.right=space;
        outRect.bottom=space;
        if(parent.getChildAdapterPosition(view)==0)
        {
            outRect.top=space;
        }
    }
}


text:
package com.sun.tools.attach;

import com.sun.tools.attach.spi.AttachProvider;

/**
 * Describes a Java virtual machine.
 *

 *
 A {@code VirtualMachineDescriptor} is a container class used to
 * describe a Java virtual machine. It encapsulates an identifier that identifies
 * a target virtual machine, and a reference to the {@link
 * com.sun.tools.attach.spi.AttachProvider AttachProvider} that should be used
 * when attempting to attach to the virtual machine. The identifier is
 * implementation-dependent but is typically the process identifier (or pid)
 * environments where each Java virtual machine runs in its own operating system
 * process.

 *

 *
 A {@code VirtualMachineDescriptor} also has a {@link #displayName() displayName}.
 * The display name is typically a human readable string that a tool might
 * display to a user. For example, a tool that shows a list of Java
 * virtual machines running on a system might use the display name rather
 * than the identifier. A {@code VirtualMachineDescriptor} may be
 * created without a display name. In that case the identifier is
 * used as the display name.
 *

 *
 {@code VirtualMachineDescriptor} instances are typically created by
 * invoking the {@link VirtualMachine#list VirtualMachine.list()}
 * method. This returns the complete list of descriptors to describe the
 * Java virtual machines known to all installed {@link
 * com.sun.tools.attach.spi.AttachProvider attach providers}.
 *
 * @since 1.6
 */
public final class VirtualMachineDescriptor
{
   private AttachProvider provider;
   private String id;
   private String displayName;

   private volatile int hash;        // 0 => not computed

   /**
    * Creates a virtual machine descriptor from the given components.
    *
    * @param provider    The AttachProvider to attach to the Java virtual machine.
    * @param id          The virtual machine identifier.
    * @param displayName The display name.
    * @throws NullPointerException If any of the arguments are {@code null}
    */
   public VirtualMachineDescriptor(AttachProvider provider, String id, String displayName)
   {
      if (provider == null) {
         throw new NullPointerException("provider cannot be null");
      }

      if (id == null) {
         throw new NullPointerException("identifier cannot be null");
      }

      if (displayName == null) {
         throw new NullPointerException("display name cannot be null");
      }

      this.provider = provider;
      this.id = id;
      this.displayName = displayName;
   }

   /**
    * Creates a virtual machine descriptor from the given components.
    *

    *
 This convenience constructor works as if by invoking the
    * three-argument constructor as follows:
    *

    *
<tt>
    * new {@link #VirtualMachineDescriptor(com.sun.tools.attach.spi.AttachProvider, String, String)
    * VirtualMachineDescriptor}(provider,  id,  id);
    * </tt>

    *

    *
 That is, it creates a virtual machine descriptor such that
    * the display name is the same as the virtual machine
    * identifier.
    *
    * @param provider The AttachProvider to attach to the Java virtual machine.
    * @param id       The virtual machine identifier.
    * @throws NullPointerException If <tt>provider</tt> or <tt>id</tt> is <tt>null</tt>.
    */
   public VirtualMachineDescriptor(AttachProvider provider, String id)
   {
      this(provider, id, id);
   }

   /**
    * Return the {@code AttachProvider} that this descriptor references.
    *
    * @return The {@code AttachProvider} that this descriptor references.
    */
   public AttachProvider provider()
   {
      return provider;
   }

   /**
    * Return the identifier component of this descriptor.
    *
    * @return The identifier component of this descriptor.
    */
   public String id()
   {
      return id;
   }

   /**
    * Return the display name component of this descriptor.
    *
    * @return The display name component of this descriptor.
    */
   public String displayName()
   {
      return displayName;
   }

   /**
    * Returns a hash-code value for this VirtualMachineDescriptor. The hash
    * code is based upon the descriptor's components, and satisfies
    * the general contract of the Object.hashCode method.
    *
    * @return A hash-code value for this descriptor.
    */
   @Override
   public int hashCode()
   {
      if (hash != 0) {
         return hash;
      }

      hash = provider.hashCode() * 127 + id.hashCode();
      return hash;
   }

   /**
    * Tests this VirtualMachineDescriptor for equality with another object.
    *

    *
 If the given object is not a VirtualMachineDescriptor then this
    * method returns <tt>false</tt>. For two VirtualMachineDescriptors to
    * be considered equal requires that they both reference the same
    * provider, and their {@link #id() identifiers} are equal.

    *

    *
 This method satisfies the general contract of the  method.

    *
    * @param ob The object to which this object is to be compared
    * @return <tt>true</tt> if, and only if, the given object is
    *         a VirtualMachineDescriptor that is equal to this
    *         VirtualMachineDescriptor.
    */
   @Override
   public boolean equals(Object ob)
   {
      if (ob == this)
         return true;
      if (!(ob instanceof VirtualMachineDescriptor))
         return false;
      VirtualMachineDescriptor other = (VirtualMachineDescriptor) ob;
      if (other.provider() != this.provider()) {
         return false;
      }
      if (!other.id().equals(this.id())) {
         return false;
      }
      return true;
   }

   /**
    * Returns the string representation of the {@code VirtualMachineDescriptor}.
    */
   @Override
   public String toString()
   {
      String s = provider.toString() + ": " + id;

      if (displayName != id) {
         s += " " + displayName;
      }

      return s;
   }
}


text:
package scouter.agent.asm;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import scouter.agent.ClassDesc;
import scouter.agent.Configure;
import scouter.agent.Logger;
import scouter.agent.asm.util.AsmUtil;
import scouter.agent.asm.util.HookingSet;
import scouter.agent.trace.TraceApiCall;
import scouter.org.objectweb.asm.ClassVisitor;
import scouter.org.objectweb.asm.MethodVisitor;
import scouter.org.objectweb.asm.Opcodes;
import scouter.org.objectweb.asm.Type;
import scouter.org.objectweb.asm.commons.LocalVariablesSorter;
public class ApicallInfoASM implements IASM, Opcodes {
	private List<HookingSet> target = HookingSet.getHookingMethodSet(Configure.getInstance().hook_apicall_info_patterns);
	private Map<String, HookingSet> reserved = new HashMap<String, HookingSet>();
	public ApicallInfoASM() {
		AsmUtil.add(reserved, "io/reactivex/netty/protocol/http/client/HttpClientRequest", "setDynamicUriParts");
		// AsmUtil.add(reserved,
		// "io/reactivex/netty/protocol/http/client/HttpClientResponse", "*");
	}
	public ClassVisitor transform(ClassVisitor cv, String className, ClassDesc classDesc) {
		if (Configure.getInstance()._hook_methods_enabled == false) {
			return cv;
		}
		HookingSet mset = reserved.get(className);
		if (mset != null)
			return new ApicallInfoCV(cv, mset, className);
		for (int i = 0; i < target.size(); i++) {
			mset = target.get(i);
			if (mset.classMatch.include(className)) {
				return new ApicallInfoCV(cv, mset, className);
			}
		}
		return cv;
	}
}
class ApicallInfoCV extends ClassVisitor implements Opcodes {
	public String className;
	private HookingSet mset;
	public ApicallInfoCV(ClassVisitor cv, HookingSet mset, String className) {
		super(ASM4, cv);
		this.mset = mset;
		this.className = className;
	}
	@Override
	public MethodVisitor visitMethod(int access, String methodName, String desc, String signature, String[] exceptions) {
		MethodVisitor mv = super.visitMethod(access, methodName, desc, signature, exceptions);
		if (mv == null || mset.isA(methodName, desc) == false) {
			return mv;
		}
		if (AsmUtil.isSpecial(methodName)) {
			return mv;
		}
		Logger.println("apicall: " + className + "." + methodName + desc);
		return new ApicallInfoMV(access, desc, mv, Type.getArgumentTypes(desc), (access & ACC_STATIC) != 0, className,
				methodName, desc);
	}
}
// ///////////////////////////////////////////////////////////////////////////
class ApicallInfoMV extends LocalVariablesSorter implements Opcodes {
	private static final String TRACESUBCALL = TraceApiCall.class.getName().replace('.', '/');
	private final static String START_METHOD = "apiInfo";
	private static final String START_SIGNATURE = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)V";
	public ApicallInfoMV(int access, String desc, MethodVisitor mv, Type[] paramTypes, boolean isStatic,
			String classname, String methodname, String methoddesc) {
		super(ASM4, access, desc, mv);
		this.paramTypes = paramTypes;
		this.isStatic = isStatic;
		this.className = classname;
		this.methodName = methodname;
		this.methodDesc = methoddesc;
	}
	private Type[] paramTypes;
	private boolean isStatic;
	private String className;
	private String methodName;
	private String methodDesc;
	public void visitCode() {
		int sidx = isStatic ? 0 : 1;
		int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
		AsmUtil.PUSH(mv, paramTypes.length);
		mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
		mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);
		for (int i = 0; i < paramTypes.length; i++) {
			Type tp = paramTypes[i];
			mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
			AsmUtil.PUSH(mv, i);
			switch (tp.getSort()) {
			case Type.BOOLEAN:
				mv.visitVarInsn(Opcodes.ILOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
						false);
				break;
			case Type.BYTE:
				mv.visitVarInsn(Opcodes.ILOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
				break;
			case Type.CHAR:
				mv.visitVarInsn(Opcodes.ILOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;",
						false);
				break;
			case Type.SHORT:
				mv.visitVarInsn(Opcodes.ILOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false);
				break;
			case Type.INT:
				mv.visitVarInsn(Opcodes.ILOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
						false);
				break;
			case Type.LONG:
				mv.visitVarInsn(Opcodes.LLOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
				break;
			case Type.FLOAT:
				mv.visitVarInsn(Opcodes.FLOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false);
				break;
			case Type.DOUBLE:
				mv.visitVarInsn(Opcodes.DLOAD, sidx);
				mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false);
				break;
			default:
				mv.visitVarInsn(Opcodes.ALOAD, sidx);
			}
			mv.visitInsn(Opcodes.AASTORE);
			sidx += tp.getSize();
		}
		AsmUtil.PUSH(mv, className);
		AsmUtil.PUSH(mv, methodName);
		AsmUtil.PUSH(mv, methodDesc);
		if (isStatic) {
			AsmUtil.PUSHNULL(mv);
		} else {
			mv.visitVarInsn(Opcodes.ALOAD, 0);
		}
		mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
		mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESUBCALL, START_METHOD, START_SIGNATURE, false);
		mv.visitCode();
	}
}


text:
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Cuemon.Extensions.IO;
using Cuemon.Extensions.Newtonsoft.Json.Formatters;
using Cuemon.Extensions.Xunit;
using Cuemon.Xml.Serialization.Formatters;
using Microsoft.AspNetCore.Http;
using Xunit;
using Xunit.Abstractions;

namespace Cuemon.AspNetCore.Http
{
    public class ForbiddenExceptionTest : Test
    {
        public ForbiddenExceptionTest(ITestOutputHelper output) : base(output)
        {
        }

        [Fact]
        public void Ctor_ShouldBeSerializableAndHaveCorrectStatusCodeOf403()
        {
            var sut = new ForbiddenException();

            TestOutput.WriteLine(sut.ToString());

            var bf = new BinaryFormatter();
            using (var ms = new MemoryStream())
            {
#pragma warning disable SYSLIB0011 // Type or member is obsolete
                bf.Serialize(ms, sut);
#pragma warning restore SYSLIB0011 // Type or member is obsolete
                ms.Position = 0;
#pragma warning disable SYSLIB0011 // Type or member is obsolete
                var desEx = bf.Deserialize(ms) as ForbiddenException;
#pragma warning restore SYSLIB0011 // Type or member is obsolete
                Assert.Equal(sut.StatusCode, desEx.StatusCode);
                Assert.Equal(sut.ReasonPhrase, desEx.ReasonPhrase);
                Assert.Equal(sut.Message, desEx.Message);
                Assert.Equal(sut.ToString(), desEx.ToString());
            }

            Assert.Equal(StatusCodes.Status403Forbidden, sut.StatusCode);
        }

        [Fact]
        public void Ctor_ShouldBeSerializableAndHaveCorrectStatusCodeOf403_Json()
        {
            var sut1 = new ForbiddenException();
            var sut2 = new JsonFormatter();
            var sut3 = sut2.Serialize(sut1);
            var sut4 = sut3.ToEncodedString(o => o.LeaveOpen = true);

            TestOutput.WriteLine(sut4);

            var original = sut2.Deserialize<ForbiddenException>(sut3);

            sut3.Dispose();

            Assert.Equal(sut1.StatusCode, original.StatusCode);
            Assert.Equal(sut1.ReasonPhrase, original.ReasonPhrase);
            Assert.Equal(sut1.Message, original.Message);
            Assert.Equal(StatusCodes.Status403Forbidden, sut1.StatusCode);
            Assert.Equal(sut1.ToString(), original.ToString());

            Assert.Equal(@"{
  ""type"": ""Cuemon.AspNetCore.Http.ForbiddenException"",
  ""message"": ""The server understood the request, but is refusing to fulfill it."",
  ""statusCode"": 403,
  ""reasonPhrase"": ""Forbidden""
}", sut4);
        }

        [Fact]
        public void Ctor_ShouldBeSerializableAndHaveCorrectStatusCodeOf403_Xml()
        {
            var sut1 = new ForbiddenException();
            var sut2 = new XmlFormatter(o => o.Settings.Writer.Indent = true);
            var sut3 = sut2.Serialize(sut1);
            var sut4 = sut3.ToEncodedString(o => o.LeaveOpen = true);

            TestOutput.WriteLine(sut4);

            var original = sut2.Deserialize<ForbiddenException>(sut3);

            sut3.Dispose();

            Assert.Equal(sut1.StatusCode, original.StatusCode);
            Assert.Equal(sut1.ReasonPhrase, original.ReasonPhrase);
            Assert.Equal(sut1.Message, original.Message);
            Assert.Equal(StatusCodes.Status403Forbidden, sut1.StatusCode);
            Assert.Equal(sut1.ToString(), original.ToString());

            Assert.Equal(@"<?xml version=""1.0"" encoding=""utf-8""?>
<ForbiddenException namespace=""Cuemon.AspNetCore.Http"">
	<Message>The server understood the request, but is refusing to fulfill it.</Message>
	<StatusCode>403</StatusCode>
	<ReasonPhrase>Forbidden</ReasonPhrase>
</ForbiddenException>", sut4);
        }
    }
}


text:
<?php

namespace BetterReflectionTest\Reflection\Adapter;

use ReflectionClass as CoreReflectionClass;
use ReflectionParameter as CoreReflectionParameter;
use BetterReflection\Reflection\Adapter\ReflectionParameter as ReflectionParameterAdapter;
use BetterReflection\Reflection\ReflectionParameter as BetterReflectionParameter;
use BetterReflection\Reflection\ReflectionFunction as BetterReflectionFunction;
use BetterReflection\Reflection\ReflectionMethod as BetterReflectionMethod;
use BetterReflection\Reflection\ReflectionClass as BetterReflectionClass;

/**
 * @covers \BetterReflection\Reflection\Adapter\ReflectionParameter
 */
class ReflectionParameterTest extends \PHPUnit_Framework_TestCase
{
    public function coreReflectionParameterNamesProvider()
    {
        $methods = get_class_methods(CoreReflectionParameter::class);
        return array_combine($methods, array_map(function ($i) { return [$i]; }, $methods));
    }

    /**
     * @param string $methodName
     * @dataProvider coreReflectionParameterNamesProvider
     */
    public function testCoreReflectionParameters($methodName)
    {
        $reflectionParameterAdapterReflection = new CoreReflectionClass(ReflectionParameterAdapter::class);
        $this->assertTrue($reflectionParameterAdapterReflection->hasMethod($methodName));
    }

    public function methodExpectationProvider()
    {
        $mockFunction = $this->getMockBuilder(BetterReflectionFunction::class)
            ->disableOriginalConstructor()
            ->getMock();

        $mockMethod = $this->getMockBuilder(BetterReflectionMethod::class)
            ->disableOriginalConstructor()
            ->getMock();

        $mockClassLike = $this->getMockBuilder(BetterReflectionClass::class)
            ->disableOriginalConstructor()
            ->getMock();

        return [
            ['__toString', null, '', []],
            ['getName', null, '', []],
            ['isPassedByReference', null, true, []],
            ['canBePassedByValue', null, true, []],
            ['getDeclaringFunction', null, $mockFunction, []],
            ['getDeclaringFunction', null, $mockMethod, []],
            ['getDeclaringClass', null, null, []],
            ['getDeclaringClass', null, $mockClassLike, []],
            ['getClass', null, null, []],
            ['getClass', null, $mockClassLike, []],
            ['isArray', null, true, []],
            ['isCallable', null, true, []],
            ['allowsNull', null, true, []],
            ['getPosition', null, 123, []],
            ['isOptional', null, true, []],
            ['isDefaultValueAvailable', null, true, []],
            ['getDefaultValue', null, true, []],
            ['isDefaultValueConstant', null, true, []],
            ['getDefaultValueConstantName', null, 'foo', []],
        ];
    }

    /**
     * @param string $methodName
     * @param string|null $expectedException
     * @param mixed $returnValue
     * @param array $args
     * @dataProvider methodExpectationProvider
     */
    public function testAdapterMethods($methodName, $expectedException, $returnValue, array $args)
    {
        /* @var BetterReflectionParameter|\PHPUnit_Framework_MockObject_MockObject $reflectionStub */
        $reflectionStub = $this->getMockBuilder(BetterReflectionParameter::class)
            ->disableOriginalConstructor()
            ->getMock();

        if (null === $expectedException) {
            $reflectionStub->expects($this->once())
                ->method($methodName)
                ->with(...$args)
                ->will($this->returnValue($returnValue));
        }

        if (null !== $expectedException) {
            $this->setExpectedException($expectedException);
        }

        $adapter = new ReflectionParameterAdapter($reflectionStub);
        $adapter->{$methodName}(...$args);
    }

    public function testExport()
    {
        $this->setExpectedException(\Exception::class, 'Unable to export statically');
        ReflectionParameterAdapter::export('foo', 0);
    }
}