text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的档案 | NMM 98</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<include file="Public/script" />
<include file="Public/style" />

<include file="Public/header" />

    <include file="Public/user_info" />

            <include file="Public/assist" />

帐户详情

                        <form class="form-horizontal margin-none" id="" method="post" action="{:U('User/changeInfo')}" onSubmit="return ajaxForm(this)">
                            <input type="hidden" name="__req" value="1">
                            <input type="hidden" name="__nonce" value="893fcf4e0ab344493859e6eef154e8c6ad4d90396ec0d8906afb7974ed073875">

                                    用户名

{:session('user_info.username')}

                                    姓名

                                        <input type="text" class="form-control" name="name" value="{:session('user_info.name')}">

                                    电邮地址

                                        <input type="text" class="form-control" name="email" value="{:session('user_info.email')}">

                                    手机号码

                                        <input type="text" class="form-control" name="mobile" value="{:session('user_info.phone')}">

                                    支付宝账号(淘宝账号/手机号码/邮箱)

{:session('user_info.alipay_account')}

                                    安全密码

<input class="form-control" id="epassword2" name="pay_password" value="" type="password" >

                                <button type="submit" class="btn btn-primary btn-sm">更新</button>

                        </form>

安全密码

                        <form class="form-horizontal margin-none" id="" method="post" action="{:U('User/changePayPwd')}" onSubmit="return ajaxForm(this)">

                                    新安全密码

                                            <input type="pay_password" class="form-control error" name="password2" value="" >

                                    确认安全密码

                                            <input type="password" class="form-control error" name="rep_pay_password" value="" >

                                    安全密码

<input class="form-control" id="epassword2" name="old_pay_password" value="" type="password" >

                                    <button type="submit" class="btn btn-primary btn-sm">更新</button>

                        </form>

银行资料

                        <form class="form-horizontal margin-none" id="" method="post">

                                    开户银行

{:session('user_info.bank_name')}

                                    分行或支行的名称

{:session('user_info.bank_address')}

                                    省

{:session('user_info.province')}

                                    市 / 县

{:session('user_info.city')}

                                    开户名

{:session('user_info.bank_account')}

                                    账号

{:session('user_info.bank_code')}

                                    国际银行帐户号码 (IBAN Code)

{:session('user_info.iban_code')}

                        </form>

帐户密码

                        <form class="form-horizontal margin-none" id="" method="post" action="{:U('User/changePwd')}" onSubmit="return ajaxForm(this)">

                                    新登录密码

                                            <input type="password" class="form-control error" name="password" value="" >

                                    确认登录密码

                                            <input type="password" class="form-control error" name="rep_password" value="" >

                                    安全密码

<input class="form-control" id="epassword2" name="pay_password" value="" type="password" >

                                <button type="submit" class="btn btn-primary btn-sm">更新</button>

                        </form>

终止帐号

                            如果您想终止帐号, 请按以下按钮.

                            终止服务


text:
package org.apache.drill.exec.server.options;

import java.util.Collection;
import java.util.Map;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.drill.common.map.CaseInsensitiveMap;
import org.apache.drill.exec.rpc.user.UserSession;

import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;

/**
 * {@link OptionManager} that holds options within {@link org.apache.drill.exec.rpc.user.UserSession} context. Options
 * set at the session level only apply to queries that you run during the current Drill connection. Session level
 * settings override system level settings.
 *
 * NOTE that currently, the effects of deleting a short lived option (see {@link OptionValidator#isShortLived}) are
 * undefined. For example, we inject an exception (passed through an option), then try to delete the option, depending
 * on where the exception was injected, the reset query could either succeed or the exception could actually be thrown
 * in the reset query itself.
 */
public class SessionOptionManager extends InMemoryOptionManager {
//  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SessionOptionManager.class);

  private final UserSession session;

  /**
   * Map of short lived options. Key: option name, Value: [ start, end )
   */
  private final Map<String, ImmutablePair<Integer, Integer>> shortLivedOptions =
    CaseInsensitiveMap.newConcurrentMap();

  public SessionOptionManager(final OptionManager systemOptions, final UserSession session) {
    super(systemOptions, CaseInsensitiveMap.<OptionValue>newConcurrentMap());
    this.session = session;
  }

  @Override
  public void setLocalOptionHelper(final OptionValue value) {
    super.setLocalOptionHelper(value);
    final String name = value.name;
    final OptionDefinition definition = getOptionDefinition(name); // if set, validator must exist.
    final OptionValidator validator = definition.getValidator();
    final boolean shortLived = validator.isShortLived();
    if (shortLived) {
      final int start = session.getQueryCount() + 1; // start from the next query
      final int ttl = validator.getTtl();
      final int end = start + ttl;
      shortLivedOptions.put(name, new ImmutablePair<>(start, end));
    }
  }

  @Override
  OptionValue getLocalOption(final String name) {
    final OptionValue value = super.getLocalOption(name);
    if (shortLivedOptions.containsKey(name)) {
      if (withinRange(name)) {
        return value;
      }
      final int queryNumber = session.getQueryCount();
      final int start = shortLivedOptions.get(name).getLeft();
      // option is not in effect if queryNumber < start
      if (queryNumber < start) {
        return fallback.getOption(name);
      // reset if queryNumber <= end
      } else {
        options.remove(name);
        shortLivedOptions.remove(name);
        return null; // fallback takes effect
      }
    }
    return value;
  }

  private boolean withinRange(final String name) {
    final int queryNumber = session.getQueryCount();
    final ImmutablePair<Integer, Integer> pair = shortLivedOptions.get(name);
    final int start = pair.getLeft();
    final int end = pair.getRight();
    return start <= queryNumber && queryNumber < end;
  }

  private final Predicate<OptionValue> isLive = new Predicate<OptionValue>() {
    @Override
    public boolean apply(final OptionValue value) {
      final String name = value.name;
      return !shortLivedOptions.containsKey(name) || withinRange(name);
    }
  };

  @Override
  Iterable<OptionValue> getLocalOptions() {
    final Collection<OptionValue> liveOptions = Collections2.filter(options.values(), isLive);
    return liveOptions;
  }

  /**
   * Gets the SystemOptionManager.
   * @return The SystemOptionManager.
   */
  public SystemOptionManager getSystemOptionManager() {
    final SystemOptionManager systemOptionManager = (SystemOptionManager) fallback;
    return systemOptionManager;
  }

  @Override
  public OptionValue getDefault(String optionName) {
    return fallback.getDefault(optionName);
  }

  @Override
  protected OptionValue.OptionScope getScope() {
    return OptionValue.OptionScope.SESSION;
  }
}

redpajama_set_name: RedPajamaGithub


text:
#import "OCMObjectReturnValueProvider.h"

extern NSString *OCMStubbedException;

@interface OCMExceptionReturnValueProvider : OCMObjectReturnValueProvider
{
}

@end


text:
"""Sensor for UPS packages."""
import logging
from collections import defaultdict
from datetime import timedelta

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
    ATTR_ATTRIBUTION,
    CONF_NAME,
    CONF_PASSWORD,
    CONF_SCAN_INTERVAL,
    CONF_USERNAME,
)
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle, slugify
from homeassistant.util.dt import now, parse_date

_LOGGER = logging.getLogger(__name__)

DOMAIN = "ups"
COOKIE = "upsmychoice_cookies.pickle"
ICON = "mdi:package-variant-closed"
STATUS_DELIVERED = "delivered"

SCAN_INTERVAL = timedelta(seconds=1800)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_USERNAME): cv.string,
        vol.Required(CONF_PASSWORD): cv.string,
        vol.Optional(CONF_NAME): cv.string,
    }
)

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the UPS platform."""
    import upsmychoice

    _LOGGER.warning(
        "The ups integration is deprecated and will be removed "
        "in Home Assistant 0.100.0. For more information see ADR-0004:"
        "https://github.com/home-assistant/architecture/blob/master/adr/0004-webscraping.md"
    )

    try:
        cookie = hass.config.path(COOKIE)
        session = upsmychoice.get_session(
            config.get(CONF_USERNAME), config.get(CONF_PASSWORD), cookie_path=cookie
        )
    except upsmychoice.UPSError:
        _LOGGER.exception("Could not connect to UPS My Choice")
        return False

    add_entities(
        [
            UPSSensor(
                session,
                config.get(CONF_NAME),
                config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL),
            )
        ],
        True,
    )

class UPSSensor(Entity):
    """UPS Sensor."""

    def __init__(self, session, name, interval):
        """Initialize the sensor."""
        self._session = session
        self._name = name
        self._attributes = None
        self._state = None
        self.update = Throttle(interval)(self._update)

    @property
    def name(self):
        """Return the name of the sensor."""
        return self._name or DOMAIN

    @property
    def state(self):
        """Return the state of the sensor."""
        return self._state

    @property
    def unit_of_measurement(self):
        """Return the unit of measurement of this entity, if any."""
        return "packages"

    def _update(self):
        """Update device state."""
        import upsmychoice

        status_counts = defaultdict(int)
        try:
            for package in upsmychoice.get_packages(self._session):
                status = slugify(package["status"])
                skip = (
                    status == STATUS_DELIVERED
                    and parse_date(package["delivery_date"]) < now().date()
                )
                if skip:
                    continue
                status_counts[status] += 1
        except upsmychoice.UPSError:
            _LOGGER.error("Could not connect to UPS My Choice account")

        self._attributes = {ATTR_ATTRIBUTION: upsmychoice.ATTRIBUTION}
        self._attributes.update(status_counts)
        self._state = sum(status_counts.values())

    @property
    def device_state_attributes(self):
        """Return the state attributes."""
        return self._attributes

    @property
    def icon(self):
        """Icon to use in the frontend."""
        return ICON


text:
namespace dvxplorer_ros_driver {

DvxplorerRosDriver::DvxplorerRosDriver(ros::NodeHandle &nh, ros::NodeHandle nh_private) :
	nh_(nh), imu_calibration_running_(false) {
	// load parameters
	nh_private.param<std::string>("serial_number", device_id_, "");
	nh_private.param<bool>("master", master_, true);
	double reset_timestamps_delay;
	nh_private.param<double>("reset_timestamps_delay", reset_timestamps_delay, -1.0);
	nh_private.param<int>("imu_calibration_sample_size", imu_calibration_sample_size_, 1000);

	// initialize IMU bias
	nh_private.param<double>("imu_bias/ax", bias.linear_acceleration.x, 0.0);
	nh_private.param<double>("imu_bias/ay", bias.linear_acceleration.y, 0.0);
	nh_private.param<double>("imu_bias/az", bias.linear_acceleration.z, 0.0);
	nh_private.param<double>("imu_bias/wx", bias.angular_velocity.x, 0.0);
	nh_private.param<double>("imu_bias/wy", bias.angular_velocity.y, 0.0);
	nh_private.param<double>("imu_bias/wz", bias.angular_velocity.z, 0.0);

	// set namespace
	ns = ros::this_node::getNamespace();
	if (ns == "/") {
		ns = "/dvs";
	}

	event_array_pub_ = nh_.advertise<dvs_msgs::EventArray>(ns + "/events", 10);
	camera_info_pub_ = nh_.advertise<sensor_msgs::CameraInfo>(ns + "/camera_info", 1);
	imu_pub_         = nh_.advertise<sensor_msgs::Imu>(ns + "/imu", 10);

	// reset timestamps is publisher as master, subscriber as slave
	if (master_) {
		reset_pub_ = nh_.advertise<std_msgs::Time>((ns + "/reset_timestamps").c_str(), 1);
	}
	else {
		reset_sub_
			= nh_.subscribe((ns + "/reset_timestamps").c_str(), 1, &DvxplorerRosDriver::resetTimestampsCallback, this);
	}

	// Open device.
	caerConnect();

	// Dynamic reconfigure
	// Will call callback, which will pass stored config to device.
	dynamic_reconfigure_callback_ = boost::bind(&DvxplorerRosDriver::callback, this, _1, _2);
	server_.reset(new dynamic_reconfigure::Server<dvxplorer_ros_driver::DVXplorer_ROS_DriverConfig>(nh_private));
	server_->setCallback(dynamic_reconfigure_callback_);

	imu_calibration_sub_
		= nh_.subscribe((ns + "/calibrate_imu").c_str(), 1, &DvxplorerRosDriver::imuCalibrationCallback, this);

	// start timer to reset timestamps for synchronization
	if (reset_timestamps_delay > 0.0) {
		timestamp_reset_timer_
			= nh_.createTimer(ros::Duration(reset_timestamps_delay), &DvxplorerRosDriver::resetTimerCallback, this);
		ROS_INFO("Started timer to reset timestamps on master DVS for synchronization (delay=%3.2fs).",
			reset_timestamps_delay);
	}
}

DvxplorerRosDriver::~DvxplorerRosDriver() {
	if (running_) {
		ROS_INFO("shutting down threads");
		running_ = false;
		readout_thread_->join();
		ROS_INFO("threads stopped");
		caerLog(CAER_LOG_ERROR, "destructor", "data stop now");
		caerDeviceDataStop(dvxplorer_handle_);
		caerDeviceClose(&dvxplorer_handle_);
	}
}

void DvxplorerRosDriver::dataStop() {
	caerLog(CAER_LOG_INFO, "Exiting from driver node", "executing data stop");
	ROS_INFO("Exiting from driver node, executing data stop");
	caerDeviceDataStop(dvxplorer_handle_);
	caerDeviceClose(&dvxplorer_handle_);
}

void DvxplorerRosDriver::caerConnect() {
	// start driver
	bool device_is_running = false;
	while (!device_is_running) {
		const char *serial_number_restrict = (device_id_.empty()) ? nullptr : device_id_.c_str();

		if (serial_number_restrict) {
			ROS_WARN("Requested serial number: %s", device_id_.c_str());
		}

		dvxplorer_handle_ = caerDeviceOpen(1, CAER_DEVICE_DVXPLORER, 0, 0, serial_number_restrict);

		// was opening successful?
		device_is_running = (dvxplorer_handle_ != nullptr);

		if (!device_is_running) {
			ROS_WARN("Could not find DVXplorer. Will retry every second.");
			ros::Duration(1.0).sleep();
			ros::spinOnce();
		}

		if (!ros::ok()) {
			return;
		}
	}

	dvxplorer_info_ = caerDVXplorerInfoGet(dvxplorer_handle_);
	device_id_      = "DVXplorer-" + std::string(dvxplorer_info_.deviceSerialNumber);

	ROS_INFO("%s --- ID: %d, Master: %d, DVS X: %d, DVS Y: %d, Firmware: %d, Logic: %d.\n",
		dvxplorer_info_.deviceString, dvxplorer_info_.deviceID, dvxplorer_info_.deviceIsMaster,
		dvxplorer_info_.dvsSizeX, dvxplorer_info_.dvsSizeY, dvxplorer_info_.firmwareVersion,
		dvxplorer_info_.logicVersion);

	if (master_ && !dvxplorer_info_.deviceIsMaster) {
		ROS_WARN("Device %s should be master, but is not!", device_id_.c_str());
	}

	// Send the default configuration before using the device.
	// No configuration is sent automatically!
	caerDeviceSendDefaultConfig(dvxplorer_handle_);

	// spawn threads
	running_ = true;
	readout_thread_
		= boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&DvxplorerRosDriver::readout, this)));

	// camera info handling
	ros::NodeHandle nh_ns(ns);
	camera_info_manager_.reset(new camera_info_manager::CameraInfoManager(nh_ns, device_id_));

	// initialize timestamps
	resetTimestamps();
}

void DvxplorerRosDriver::onDisconnectUSB(void *driver) {
	ROS_ERROR("USB connection lost with DVS !");
	static_cast<dvxplorer_ros_driver::DvxplorerRosDriver *>(driver)->caerConnect();
}

void DvxplorerRosDriver::resetTimestamps() {
	caerDeviceConfigSet(dvxplorer_handle_, DVX_MUX, DVX_MUX_TIMESTAMP_RESET, 1);
	reset_time_ = ros::Time::now();

	ROS_INFO("Reset timestamps on %s to %.9f.", device_id_.c_str(), reset_time_.toSec());

	// if master, publish reset time to slaves
	if (master_) {
		std_msgs::Time reset_msg;
		reset_msg.data = reset_time_;
		reset_pub_.publish(reset_msg);
	}
}

void DvxplorerRosDriver::resetTimestampsCallback(const std_msgs::Time::ConstPtr &msg) {
	// if slave, only adjust offset time
	if (!dvxplorer_info_.deviceIsMaster) {
		ROS_INFO("Adapting reset time of master on slave %s.", device_id_.c_str());
		reset_time_ = msg->data;
	}
	// if master, or not single camera configuration, just reset timestamps
	else {
		resetTimestamps();
	}
}

void DvxplorerRosDriver::imuCalibrationCallback(const std_msgs::Empty::ConstPtr &msg) {
	ROS_INFO("Starting IMU calibration with %d samples...", (int) imu_calibration_sample_size_);
	imu_calibration_running_ = true;
	imu_calibration_samples_.clear();
}

void DvxplorerRosDriver::updateImuBias() {
	bias.linear_acceleration.x = 0.0;
	bias.linear_acceleration.y = 0.0;
	bias.linear_acceleration.z = 0.0;
	bias.angular_velocity.x    = 0.0;
	bias.angular_velocity.y    = 0.0;
	bias.angular_velocity.z    = 0.0;

	for (const auto &m : imu_calibration_samples_) {
		bias.linear_acceleration.x += m.linear_acceleration.x;
		bias.linear_acceleration.y += m.linear_acceleration.y;
		bias.linear_acceleration.z += m.linear_acceleration.z;
		bias.angular_velocity.x += m.angular_velocity.x;
		bias.angular_velocity.y += m.angular_velocity.y;
		bias.angular_velocity.z += m.angular_velocity.z;
	}

	bias.linear_acceleration.x /= (double) imu_calibration_samples_.size();
	bias.linear_acceleration.y /= (double) imu_calibration_samples_.size();
	bias.linear_acceleration.z /= (double) imu_calibration_samples_.size();
	bias.linear_acceleration.z -= STANDARD_GRAVITY * sgn(bias.linear_acceleration.z);

	bias.angular_velocity.x /= (double) imu_calibration_samples_.size();
	bias.angular_velocity.y /= (double) imu_calibration_samples_.size();
	bias.angular_velocity.z /= (double) imu_calibration_samples_.size();

	ROS_INFO("IMU calibration done.");
	ROS_INFO("Acceleration biases: %1.5f %1.5f %1.5f [m/s^2]", bias.linear_acceleration.x, bias.linear_acceleration.y,
		bias.linear_acceleration.z);
	ROS_INFO("Gyroscope biases: %1.5f %1.5f %1.5f [rad/s]", bias.angular_velocity.x, bias.angular_velocity.y,
		bias.angular_velocity.z);
}

void DvxplorerRosDriver::resetTimerCallback(const ros::TimerEvent &te) {
	timestamp_reset_timer_.stop();
	resetTimestamps();
}

void DvxplorerRosDriver::callback(dvxplorer_ros_driver::DVXplorer_ROS_DriverConfig &config, uint32_t level) {
	// All changes have 'level' set.
	if (level == 0) {
		return;
	}

	// DVS control.
	if (level & (0x01 << 0)) {
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS, DVX_DVS_RUN, config.dvs_enabled);
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP_BIAS, DVX_DVS_CHIP_BIAS_SIMPLE, config.bias_sensitivity);
	}

	// Subsampling.
	if (level & (0x01 << 1)) {
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_SUBSAMPLE_ENABLE, config.subsample_enable);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_SUBSAMPLE_HORIZONTAL, config.subsample_horizontal);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_SUBSAMPLE_VERTICAL, config.subsample_vertical);
	}

	// Polarity control.
	if (level & (0x01 << 2)) {
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_EVENT_FLATTEN, config.polarity_flatten);
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_EVENT_ON_ONLY, config.polarity_on_only);
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP, DVX_DVS_CHIP_EVENT_OFF_ONLY, config.polarity_off_only);
	}

	// DVS Region Of Interest.
	if (level & (0x01 << 3)) {
		caerDeviceConfigSet(dvxplorer_handle_, DVX_DVS_CHIP_CROPPER, DVX_DVS_CHIP_CROPPER_ENABLE, config.roi_enabled);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP_CROPPER, DVX_DVS_CHIP_CROPPER_X_START_ADDRESS, config.roi_start_column);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP_CROPPER, DVX_DVS_CHIP_CROPPER_X_END_ADDRESS, config.roi_end_column);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP_CROPPER, DVX_DVS_CHIP_CROPPER_Y_START_ADDRESS, config.roi_start_row);
		caerDeviceConfigSet(
			dvxplorer_handle_, DVX_DVS_CHIP_CROPPER, DVX_DVS_CHIP_CROPPER_Y_END_ADDRESS, config.roi_end_row);
	}

	// Inertial Measurement Unit.
	if (level & (0x01 << 4)) {
		caerDeviceConfigSet(dvxplorer_handle_, DVX_IMU, DVX_IMU_RUN_ACCELEROMETER, config.imu_enabled);
		caerDeviceConfigSet(dvxplorer_handle_, DVX_IMU, DVX_IMU_RUN_GYROSCOPE, config.imu_enabled);

		caerDeviceConfigSet(dvxplorer_handle_, DVX_IMU, DVX_IMU_ACCEL_RANGE, config.imu_acc_scale);
		caerDeviceConfigSet(dvxplorer_handle_, DVX_IMU, DVX_IMU_GYRO_RANGE, config.imu_gyro_scale);
	}

	// Streaming rate changes.
	if (level & (0x01 << 5)) {
		if (config.streaming_rate > 0) {
			delta_ = boost::posix_time::microseconds(long(1e6 / config.streaming_rate));
		}

		streaming_rate_ = config.streaming_rate;
		max_events_     = config.max_events;
	}
}

void DvxplorerRosDriver::readout() {
	// std::vector<dvs::Event> events;

	caerDeviceConfigSet(dvxplorer_handle_, CAER_HOST_CONFIG_DATAEXCHANGE, CAER_HOST_CONFIG_DATAEXCHANGE_BLOCKING, true);
	caerDeviceDataStart(dvxplorer_handle_, nullptr, nullptr, nullptr, &DvxplorerRosDriver::onDisconnectUSB, this);

	boost::posix_time::ptime next_send_time = boost::posix_time::microsec_clock::local_time();

	dvs_msgs::EventArrayPtr event_array_msg;

	while (running_) {
		try {
			caerEventPacketContainer packetContainer = caerDeviceDataGet(dvxplorer_handle_);
			if (packetContainer == nullptr) {
				continue; // Skip if nothing there.
			}

			const int32_t packetNum = caerEventPacketContainerGetEventPacketsNumber(packetContainer);

			for (int32_t i = 0; i < packetNum; i++) {
				caerEventPacketHeader packetHeader = caerEventPacketContainerGetEventPacket(packetContainer, i);
				if (packetHeader == nullptr) {
					continue; // Skip if nothing there.
				}

				const int type = caerEventPacketHeaderGetEventType(packetHeader);

				// Packet 0 is always the special events packet for DVS128, while packet is the polarity events packet.
				if (type == POLARITY_EVENT) {
					if (!event_array_msg) {
						event_array_msg         = dvs_msgs::EventArrayPtr(new dvs_msgs::EventArray());
						event_array_msg->height = dvxplorer_info_.dvsSizeY;
						event_array_msg->width  = dvxplorer_info_.dvsSizeX;
					}

					caerPolarityEventPacket polarity = (caerPolarityEventPacket) packetHeader;

					const int numEvents = caerEventPacketHeaderGetEventNumber(packetHeader);
					for (int j = 0; j < numEvents; j++) {
						// Get full timestamp and addresses of first event.
						caerPolarityEvent event = caerPolarityEventPacketGetEvent(polarity, j);

						dvs_msgs::Event e;
						e.x  = caerPolarityEventGetX(event);
						e.y  = caerPolarityEventGetY(event);
						e.ts = reset_time_
							   + ros::Duration().fromNSec(caerPolarityEventGetTimestamp64(event, polarity) * 1000);
						e.polarity = caerPolarityEventGetPolarity(event);

						if (j == 0) {
							event_array_msg->header.stamp = e.ts;
						}

						event_array_msg->events.push_back(e);
					}

					int streaming_rate = streaming_rate_;
					int max_events     = max_events_;

					// throttle event messages
					if ((boost::posix_time::microsec_clock::local_time() > next_send_time) || (streaming_rate == 0)
						|| ((max_events != 0) && (event_array_msg->events.size() > max_events))) {
						event_array_pub_.publish(event_array_msg);

						if (streaming_rate > 0) {
							next_send_time += delta_;
						}

						if ((max_events != 0) && (event_array_msg->events.size() > max_events)) {
							next_send_time = boost::posix_time::microsec_clock::local_time() + delta_;
						}

						event_array_msg.reset();
					}

					if (camera_info_manager_->isCalibrated()) {
						sensor_msgs::CameraInfoPtr camera_info_msg(
							new sensor_msgs::CameraInfo(camera_info_manager_->getCameraInfo()));
						camera_info_pub_.publish(camera_info_msg);
					}
				}
				else if (type == IMU6_EVENT) {
					caerIMU6EventPacket imu = (caerIMU6EventPacket) packetHeader;

					const int numEvents = caerEventPacketHeaderGetEventNumber(packetHeader);

					for (int j = 0; j < numEvents; j++) {
						caerIMU6Event event = caerIMU6EventPacketGetEvent(imu, j);

						sensor_msgs::Imu msg;

						// convert from g's to m/s^2 and align axes with camera frame
						msg.linear_acceleration.x = -caerIMU6EventGetAccelX(event) * STANDARD_GRAVITY;
						msg.linear_acceleration.y = caerIMU6EventGetAccelY(event) * STANDARD_GRAVITY;
						msg.linear_acceleration.z = -caerIMU6EventGetAccelZ(event) * STANDARD_GRAVITY;
						// convert from deg/s to rad/s and align axes with camera frame
						msg.angular_velocity.x = -caerIMU6EventGetGyroX(event) / 180.0 * M_PI;
						msg.angular_velocity.y = caerIMU6EventGetGyroY(event) / 180.0 * M_PI;
						msg.angular_velocity.z = -caerIMU6EventGetGyroZ(event) / 180.0 * M_PI;

						// no orientation estimate: http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html
						msg.orientation_covariance[0] = -1.0;

						// time
						msg.header.stamp
							= reset_time_ + ros::Duration().fromNSec(caerIMU6EventGetTimestamp64(event, imu) * 1000);

						// frame
						msg.header.frame_id = "base_link";

						// IMU calibration
						if (imu_calibration_running_) {
							if (imu_calibration_samples_.size() < imu_calibration_sample_size_) {
								imu_calibration_samples_.push_back(msg);
							}
							else {
								imu_calibration_running_ = false;
								updateImuBias();
							}
						}

						// bias correction
						msg.linear_acceleration.x -= bias.linear_acceleration.x;
						msg.linear_acceleration.y -= bias.linear_acceleration.y;
						msg.linear_acceleration.z -= bias.linear_acceleration.z;
						msg.angular_velocity.x -= bias.angular_velocity.x;
						msg.angular_velocity.y -= bias.angular_velocity.y;
						msg.angular_velocity.z -= bias.angular_velocity.z;

						imu_pub_.publish(msg);
					}
				}
			}

			caerEventPacketContainerFree(packetContainer);

			ros::spinOnce();
		}
		catch (boost::thread_interrupted &) {
			return;
		}
	}

	caerDeviceDataStop(dvxplorer_handle_);
}

} // namespace dvxplorer_ros_driver


text:
scripts.utils
=============

Repo with bash tricks tips and tricks.


text:
#include "rapter/typedefs.h"
#include "rapter/optimization/segmentation.h"
#include "rapter/optimization/impl/segmentation.hpp"
#include "rapter/primitives/impl/planePrimitive.hpp"

namespace rapter
{
    template int
    Segmentation::segmentCli< rapter::_3d::PrimitiveT
                            , rapter::_3d::PrimitiveVectorT
                            , rapter::PointPrimitiveT
                            , rapter::PointContainerT
                            , rapter::Scalar
                            >
                            ( int argc, char** argv );

    template int
    Segmentation::segmentCli< rapter::_2d::PrimitiveT
                            , rapter::_2d::PrimitiveVectorT
                            , rapter::PointPrimitiveT
                            , rapter::PointContainerT
                            , rapter::Scalar
                            >
                            ( int argc, char** argv );

    template int
    Segmentation::orientPoints< rapter::PointPrimitiveT
                              , rapter::_3d::PrimitiveT
                              , rapter::Scalar
                              , rapter::PointContainerT
                              >
                              ( rapter::PointContainerT       &points
                              , rapter::Scalar          const  scale
                              , int                  const  nn_K
                              , int                  const  verbose );

    template int
    Segmentation::orientPoints< rapter::PointPrimitiveT
                              , rapter::_2d::PrimitiveT
                              , rapter::Scalar
                              , rapter::PointContainerT
                              >
                              ( rapter::PointContainerT       &points
                              , rapter::Scalar          const  scale
                              , int                  const  nn_K
                              , int                  const  verbose );

    template int
    Segmentation::patchify< rapter::_2d::PrimitiveT
            , rapter::Scalar
            , rapter::_2d::PrimitiveVectorT
            , rapter::PointContainerT
            , typename rapter::_2d::PatchPatchDistanceFunctorT
            >
            ( rapter::_2d::PrimitiveVectorT                 & patches
            , rapter::PointContainerT                       & points
            , rapter::Scalar                           const  scale
            , std::vector<rapter::Scalar>              const& angles
            , rapter::_2d::PatchPatchDistanceFunctorT  const& patchPatchDistanceFunctor
            , int                                      const  nn_K
            , int                                      const  verbose
            , size_t                                   const  patchPopLimit
            );

    template int
    Segmentation::patchify< rapter::_3d::PrimitiveT
                          , rapter::Scalar
                          , rapter::_3d::PrimitiveVectorT
                          , rapter::PointContainerT
                          , typename rapter::_3d::PatchPatchDistanceFunctorT
                          >
                          ( rapter::_3d::PrimitiveVectorT                 & patches
                          , rapter::PointContainerT                       & points
                          , rapter::Scalar                           const  scale
                          , std::vector<rapter::Scalar>              const& angles
                          , rapter::_3d::PatchPatchDistanceFunctorT  const& patchPatchDistanceFunctor
                          , int                                      const  nn_K
                          , int                                      const  verbose
                          , size_t                                   const  patchPopLimit
                          );

    namespace segm_templinst
    {
        namespace _2d
        {
            typedef segmentation::Patch<rapter::Scalar, rapter::_2d::PrimitiveT> PatchT;
            typedef std::vector< PatchT > PatchesT;
        }
        namespace _3d
        {
            typedef segmentation::Patch<rapter::Scalar, rapter::_3d::PrimitiveT> PatchT;
            typedef std::vector< PatchT > PatchesT;
        }
    }
    template int
    Segmentation::regionGrow  < rapter::_2d::PrimitiveT
                              , rapter::PointContainerT
                              , rapter::_2d::PatchPatchDistanceFunctorT
                              , segm_templinst::_2d::PatchesT
                              , rapter::Scalar
                              , rapter::PointPrimitiveT
                              >
                              ( rapter::PointContainerT             & points
                              , segm_templinst::_2d::PatchesT    & groups_arg
                              , rapter::Scalar                 const  /*scale*/
                              , rapter::_2d::PatchPatchDistanceFunctorT const& patchPatchDistanceFunctor
                              , GidT                        const  gid_tag_name              //= _PointT::GID
                              , int                         const  nn_K
                              , bool                        const  verbose
                              );
    template int
    Segmentation::regionGrow  < rapter::_3d::PrimitiveT
                              , rapter::PointContainerT
                              , rapter::_3d::PatchPatchDistanceFunctorT
                              , segm_templinst::_3d::PatchesT
                              , rapter::Scalar
                              , rapter::PointPrimitiveT
                              >
                              ( rapter::PointContainerT             & points
                              , segm_templinst::_3d::PatchesT    & groups_arg
                              , rapter::Scalar                 const  /*scale*/
                              , rapter::_3d::PatchPatchDistanceFunctorT const& patchPatchDistanceFunctor
                              , GidT                        const  gid_tag_name              //= _PointT::GID
                              , int                         const  nn_K
                              , bool                        const  verbose
                              );

    template int
    Segmentation::fitLocal  ( rapter::_2d::InnerPrimitiveContainerT & lines
                            , pcl::PointCloud<pcl::PointXYZ>::Ptr const  cloud
                            , std::vector<int>     const* indices
                            , int                  const  K
                            , float                const  radius
                            , bool                 const  soft_radius
                            , std::vector<PidT>         * mapping
                            , int                  const  verbose
                            );

    template int
    Segmentation::fitLocal  ( rapter::_3d::InnerPrimitiveContainerT & lines
                            , pcl::PointCloud<pcl::PointXYZ>::Ptr const  cloud
                            , std::vector<int>     const* indices
                            , int                  const  K
                            , float                const  radius
                            , bool                 const  soft_radius
                            , std::vector<PidT>         * mapping
                            , int                  const  verbose
                            );

    template int
    Segmentation::_tagPointsFromGroups< rapter::PointPrimitiveT
                                      , rapter::Scalar
                                      , rapter::_2d::PatchPatchDistanceFunctorT
                                      , segm_templinst::_2d::PatchesT
                                      , rapter::PointContainerT
                                      >
                                      ( rapter::PointContainerT                      & points
                                      , segm_templinst::_2d::PatchesT        const& groups
                                      , rapter::_2d::PatchPatchDistanceFunctorT const& pointPatchDistanceFunctor
                                      , GidT                                 const  gid_tag_name );

    template int
    Segmentation::_tagPointsFromGroups< rapter::PointPrimitiveT
                                      , rapter::Scalar
                                      , rapter::_3d::PatchPatchDistanceFunctorT
                                      , segm_templinst::_3d::PatchesT
                                      , rapter::PointContainerT
                                      >
                                      ( rapter::PointContainerT                      & points
                                      , segm_templinst::_3d::PatchesT        const& groups
                                      , rapter::_3d::PatchPatchDistanceFunctorT const& pointPatchDistanceFunctor
                                      , GidT                                 const  gid_tag_name );
}


text:
> Tagging

    Looks like it's your first time using Ralphy. Welcome!

 You need to
    configure Ralphy to get started.

Select the PDF to append

                    NO TAG
                    {{file.tag.displayName}}

                    {{file.nameTagless}}

        <button ng-click="mergeSelectedFile = null; mergeSelectorActive = false;">Cancel</button>
        <button ng-click="appendPdf(mergeSelectedFile)" ng-disabled="mergeSelectedFile == null" >Append</button>
        <input type="checkbox" ng-model="mergeSelector.deleteMerged"> Delete Merged PDF

                    NO TAG
                    {{file.tag.displayName}}

                    {{file.nameTagless}}

                <canvas id="pdf-canvas"></canvas>

                {{activeFile.currentPage}}
                /
                {{activeFile.pdfDocument.numPages}}

            <form ng-submit="changeName()">

                    .pdf

                    Suggested tags:

                        {{tagObj.displayName}}

                    Suggested filenames:

                        {{filename}}

                    Variables:

- %{date}

- %{year}

                    Target location: {{proposed.tag.dest}}/{{proposed.name}}.pdf

                <button type="submit">Rename</button>
            </form>

                {{tagObj.tag}}

Select a tag to see its details

{{activeTag.displayName}}

            <form ng-submit="saveTags()">

                    Target destination
                    <input id="activeTagDest" type="text" ng-model="activeTag.dest" />

                    Keywords
                    <input id="activeKeywords" type="text" ng-list="," ng-model="activeTag.keywords" />

                <button type="submit">Save</button>
                <button class="delete-tag-button" ng-click="deleteTag(activeTag)">Delete</button>
            </form>