text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

namespace core\event;
defined('MOODLE_INTERNAL') || die();

/**
 * User removed from a cohort event class.
 *
 * @package    core
 * @since      Moodle 2.6
 * @copyright  2013 Dan Poltawski <dan@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

class cohort_member_removed extends base {

    /**
     * Init method.
     *
     * @return void
     */
    protected function init() {
        $this->data['crud'] = 'd';
        $this->data['edulevel'] = self::LEVEL_OTHER;
        $this->data['objecttable'] = 'cohort';
    }

    /**
     * Returns localised general event name.
     *
     * @return string
     */
    public static function get_name() {
        return get_string('eventcohortmemberremoved', 'core_cohort');
    }

    /**
     * Returns description of what happened.
     *
     * @return string
     */
    public function get_description() {
        return "The user with id '$this->userid' removed the user with id '$this->relateduserid' from the cohort with " .
            "id '$this->objectid'.";
    }

    /**
     * Returns relevant URL.
     *
     * @return \moodle_url
     */
    public function get_url() {
        return new \moodle_url('/cohort/assign.php', array('id' => $this->objectid));
    }

    /**
     * Return legacy event name.
     *
     * @return string legacy event name.
     */
    public static function get_legacy_eventname() {
        return 'cohort_member_removed';
    }

    /**
     * Return legacy event data.
     *
     * @return \stdClass
     */
    protected function get_legacy_eventdata() {
        $data = new \stdClass();
        $data->cohortid = $this->objectid;
        $data->userid = $this->relateduserid;
        return $data;
    }

    /**
     * Custom validations.
     *
     * @throws \coding_exception
     * @return void
     */
    protected function validate_data() {
        parent::validate_data();

        if (!isset($this->relateduserid)) {
            throw new \coding_exception('The \'relateduserid\' must be set.');
        }
    }

    public static function get_objectid_mapping() {
        // Cohorts are not included in backups, so no mapping is needed for restore.
        return array('db' => 'cohort', 'restore' => base::NOT_MAPPED);
    }
}


text:
<?php
namespace Concrete\Core\Entity\Express\Entry;

use Concrete\Core\Entity\Express\Entry;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="ExpressEntityEntryOneAssociations")
 */
class OneAssociation extends Association
{

    /**
     * @ORM\Id @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="\Concrete\Core\Entity\Express\Entry")
     * @ORM\JoinColumn(name="exSelectedEntryID", referencedColumnName="exEntryID")
     */
    protected $selected_entry;

    /**
     * @return mixed
     */
    public function getSelectedEntry()
    {
        return $this->selected_entry;
    }

    public function getSelectedEntries()
    {
        return array($this->getSelectedEntry());
    }

    /**
     * @param mixed $selected_entry
     */
    public function setSelectedEntry($selected_entry)
    {
        $this->selected_entry = $selected_entry;
    }

    public function removeSelectedEntry(Entry $entry)
    {
        if ($entry->getID() == $this->selected_entry->getID()) {
            $this->selected_entry = null;
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
int main(int, char **)
{
    Halide::Buffer<uint8_t> reference_buf(NN, MM);
    init_buffer(reference_buf, (uint8_t)1);

    Halide::Buffer<uint8_t> output_buf(NN, MM);
    init_buffer(output_buf, (uint8_t)5);

    test_tag_gpu_level(output_buf.raw_buffer());

    output_buf.copy_to_host();

    compare_buffers("test_tag_gpu_level", output_buf, reference_buf);

    return 0;
}


text:
NotFoundException
=================
.. php:namespace:: DreamCommerce\ShopAppstoreLib\Resource\Exception
.. php:class:: NotFoundException

An exception raised if target object does not exist.

Check: :doc:`resource_exception`.


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Spanglboard</title>

    <meta name="description" content="Now, the doctor can follow you wherever you go!" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="mobile-web-app-capable" content="yes">

    <meta property="og:title" content="Spanglboard" />
    <meta property="og:description" content="Now, the doctor can follow you wherever you go!" />
    <meta property="og:image" content="http://spanglboard.com/assets/img/jurgen.png" />

    <link rel="shortcut icon" href="assets/img/favicon.png" />
    <link rel="stylesheet" href="css/style.css">
    <link rel="icon" sizes="192x192" href="assets/img/jurgen.png">
    <link rel="apple-touch-icon" sizes="152x152" href="assets/img/jurgen.png">

Spanglboard


text:
<?php

/**
 * Adapter to fix some issues from jsfiddle.
 */
namespace Embed\Adapters;

use Embed\Utils;

class Jsfiddle extends Webpage implements AdapterInterface
{
    /**
     * {@inheritdoc}
     */
    public function getCode()
    {
    	$this->width = null;
        $this->height = null;

        $url = $this->url;
        $embed_url = $url.((substr($url, -1) === '/') ? 'embedded/' : '/embedded/');

        return Utils::iframe($embed_url);
    }
}


text:
.propertyHeader {
  border-bottom: 1px solid lightgrey;
  width: 100%;
  padding: 10px 8px 3px;
  font-size: 1.1em;
  font-weight: bold;
  box-sizing: border-box;
}


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

using System;

namespace Cassandra
{
    public class InitFatalErrorException : Exception
    {
        private const string ExceptionMessage =
            "An error occured during the initialization of the cluster instance. Further initialization attempts " +
            "for this cluster instance will never succeed and will return this exception instead. The InnerException property holds " +
            "a reference to the exception that originally caused the initialization error.";

        public InitFatalErrorException(Exception innerException) : base(ExceptionMessage, innerException)
        {
        }
    }
}


text:
package com.flipkart.hbaseobjectmapper.codec;

import com.flipkart.hbaseobjectmapper.HBObjectMapper;
import com.flipkart.hbaseobjectmapper.codec.exceptions.DeserializationException;
import com.flipkart.hbaseobjectmapper.codec.exceptions.SerializationException;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.Map;

/**
 * Interface that defines serialization and deserialization behavior for {@link HBObjectMapper HBObjectMapper}
 */
public interface Codec {
    /**
     * Serializes object to a byte[]
     *
     * @param object Object to be serialized
     * @param flags  Flags for tuning serialization behavior (Implementations of this method are expected to handle null and empty map in the same way)
     * @return byte array - this would be used 'as is' in setting the column value in HBase row
     * @throws SerializationException If serialization fails (e.g. when input object has a field of data type that isn't serializable by this codec)
     * @see #deserialize(byte[], Type, Map)
     */
    byte[] serialize(Serializable object, Map<String, String> flags) throws SerializationException;

    /**
     * Deserialize byte[] into an object
     *
     * @param bytes byte array that needs to be deserialized
     * @param flags Flags for tuning deserialization behavior  (Implementations of this method are expected to handle null and empty map in the same way)
     * @param type  Java type to which this byte[] needs to be deserialized to
     * @return The object
     * @throws DeserializationException If deserialization fails (e.g. malformed string or definition of a data type used isn't available at runtime)
     * @see #serialize(Serializable, Map)
     * @see #canDeserialize(Type)
     */
    Serializable deserialize(byte[] bytes, Type type, Map<String, String> flags) throws DeserializationException;

    /**
     * Check whether a specific type can be deserialized using this codec
     *
     * @param type Java type
     * @return true (if an object of specified type can be deserialized using this codec) or false
     * @see #deserialize(byte[], Type, Map)
     */
    @SuppressWarnings("BooleanMethodIsAlwaysInverted")
    boolean canDeserialize(Type type);

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/url"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <ImageView
        android:id="@+id/image"
        android:transitionName="image"
        android:layout_margin="4dip"
        android:layout_width="100dip"
        android:layout_height="100dip"
        android:layout_gravity="center_horizontal"/>
</LinearLayout>


text:
var System = require('./dist/es6-module-loader.src');

System.transpiler = 'traceur';
try {
  System.paths.traceur = 'file:' + require.resolve('traceur/bin/traceur.js');
}
catch(e) {}
try {
  System.paths.babel = 'file:' + require.resolve('babel-core/browser.js');
}
catch(e) {}
try {
  System.paths.babel = System.paths.babel || 'file:' + require.resolve('babel/browser.js');
}
catch(e) {}

module.exports = {
  Loader: global.LoaderPolyfill,
  System: System
};


text:
package org.gearvrf.util;

import android.content.Context;
import android.os.Handler;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;

/**
 * Detects various gestures and events using the supplied {@link MotionEvent}s.
 * The {@link OnGestureListener} callback will notify users when a particular
 * motion event has occurred. This class should only be used with
 * {@link MotionEvent}s reported via touch (don't use for trackball events).
 *
 * To use this class:
 *

 *
Create an instance of the {@code VRTouchPadGestureDetector} for your
 * {@link View}
 *
In the {@link View#onTouchEvent(MotionEvent)} method ensure you call
 * {@link #onTouchEvent(MotionEvent)}. The methods defined in your callback will
 * be executed when the events occur.
 *

 */
@SuppressWarnings("deprecation")
public class VRTouchPadGestureDetector extends Object implements
        OnGestureListener, OnDoubleTapListener {
    private static final int SWIPE_MIN_DISTANCE = 80;
    private static final int ONTAP_MIN_DISTANCE = 0;

    public enum SwipeDirection {
        Backward, Forward, Down, Up
    }

    GestureDetector gestureDetector;
    VRTouchPadGestureDetector.OnTouchPadGestureListener gestureListener;
    VRTouchPadGestureDetector.OnTouchPadDoubleTapListener doubleTapListener;

    /**
     * The listener that is used to notify when gestures occur.
     */
    public interface OnTouchPadGestureListener {
        /**
         * Notified when a tap occurs with the up {@link MotionEvent} that
         * triggered it.
         *
         * @param e
         *            The up motion event that completed the first tap
         * @return true if the event is consumed, else false
         */
        boolean onSingleTap(MotionEvent e);

        /**
         * Notified when a long press occurs with the initial on down
         * {@link MotionEvent} that triggered it.
         *
         * @param e
         *            The initial on down motion event that started the
         *            longpress.
         */
        void onLongPress(MotionEvent e);

        /**
         * Notified when a swipe occurs.
         *
         * @param e1
         *            The first down motion event that started the fling.
         * @param swipeDirection
         *            The direction of swipe.
         * @param velocityX
         *            The velocity of this fling measured in pixels per second
         *            along the x axis.
         * @param velocityY
         *            The velocity of this fling measured in pixels per second
         *            along the y axis.
         * @return true if the event is consumed, else false
         */
        boolean onSwipe(MotionEvent e, SwipeDirection swipeDirection,
                float velocityX, float velocityY);
    }

    /**
     * The listener that is used to notify when a double-tap or a confirmed
     * single-tap occur.
     */
    public interface OnTouchPadDoubleTapListener {
        /**
         * Notified when a single-tap occurs.
         *
         * @param e
         *            The down motion event of the single-tap.
         * @return true if the event is consumed, else false
         */
        boolean onSingleTapConfirmed(MotionEvent e);

        /**
         * Notified when a double-tap occurs.
         *
         * @param e
         *            The down motion event of the first tap of the double-tap.
         * @return true if the event is consumed, else false
         */
        boolean onDoubleTap(MotionEvent e);
    }

    @SuppressWarnings("deprecation")
    public VRTouchPadGestureDetector(
            VRTouchPadGestureDetector.OnTouchPadGestureListener listener) {
        gestureDetector = new GestureDetector(this);
        gestureListener = listener;

    }

    public VRTouchPadGestureDetector(Context context,
            VRTouchPadGestureDetector.OnTouchPadGestureListener listener) {
        gestureDetector = new GestureDetector(context, this);
        gestureListener = listener;
    }

    public VRTouchPadGestureDetector(Context context,
            VRTouchPadGestureDetector.OnTouchPadGestureListener listener,
            Handler handler) {
        gestureDetector = new GestureDetector(context, this, handler);
        gestureListener = listener;
    }

    public void setOnDoubleTapListener(
            VRTouchPadGestureDetector.OnTouchPadDoubleTapListener onDoubleTapListener) {
        doubleTapListener = onDoubleTapListener;
    }

    // OnGestureListener
    @Override
    public boolean onDown(MotionEvent arg0) {
        return false;
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        if (gestureDetector == null)
            return false;

        double distance = Math.sqrt(Math.pow(e2.getX() - e1.getX(), 2)
                + Math.pow(e2.getY() - e1.getY(), 2));

        if (distance > SWIPE_MIN_DISTANCE) {
            try {

                double deltaY = e2.getY() - e1.getY();
                double deltaX = e2.getX() - e1.getX();

                double angle = Math.toDegrees(Math.atan2(deltaY, deltaX)) + 180 + 45;

                if (angle > 360)
                    angle -= 360;

                if (angle < 90) {
                    return gestureListener.onSwipe(e1, SwipeDirection.Forward,
                            velocityX, velocityY);
                } else if (angle < 180) {
                    return gestureListener.onSwipe(e1, SwipeDirection.Up,
                            velocityX, velocityY);
                } else if (angle < 270) {
                    return gestureListener.onSwipe(e1, SwipeDirection.Backward,
                            velocityX, velocityY);
                } else {
                    return gestureListener.onSwipe(e1, SwipeDirection.Down,
                            velocityX, velocityY);
                }

            } catch (Exception e) {
                // Ignore
            }
        } else if (distance >= ONTAP_MIN_DISTANCE) {
            /*
             * The gesture listener filters out dirty taps that look like swipes
             * altogether. This reduces usability as it's hard to get a clean
             * tap on the tracker
             */
            gestureListener.onSingleTap(e1);
            return true;
        }

        return false;
    }

    @Override
    public void onLongPress(MotionEvent arg0) {
        if (gestureListener != null) {
            gestureListener.onLongPress(arg0);
        }
    }

    @Override
    public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
            float arg3) {
        return false;
    }

    @Override
    public boolean onSingleTapUp(MotionEvent arg0) {
        if (gestureListener != null) {
            return gestureListener.onSingleTap(arg0);
        }

        return false;
    }

    /**
     * Analyzes the given motion event and if applicable triggers the
     * appropriate callbacks on the {@link OnGestureListener} supplied.
     *
     * @param ev
     *            The current motion event.
     * @return true if the {@link OnGestureListener} consumed the event, else
     *         false.
     */
    public boolean onTouchEvent(MotionEvent ev) {
        return gestureDetector.onTouchEvent(ev);
    }

    @Override
    public boolean onDoubleTap(MotionEvent arg0) {
        if (doubleTapListener != null) {
            return doubleTapListener.onDoubleTap(arg0);
        }
        return false;
    }

    @Override
    public boolean onDoubleTapEvent(MotionEvent arg0) {
        return false;
    }

    @Override
    public boolean onSingleTapConfirmed(MotionEvent arg0) {
        if (doubleTapListener != null) {
            return doubleTapListener.onSingleTapConfirmed(arg0);
        }
        return false;
    }

    @Override
    public void onShowPress(MotionEvent e) {

    }

}


text:
package registration.exceptions;

public class InvalidVoterCredentialsException extends RegistrationException{

	private static final long serialVersionUID = -5200397643712312945L;

private String error;

	public InvalidVoterCredentialsException() {
	}

	public InvalidVoterCredentialsException(String error) {
		this.error = error;
	}

	public InvalidVoterCredentialsException(Throwable cause){
		super(cause);
	}

	public String getError(){
		return this.error;
	}

}


text:
package org.mule.transport.zmq.helper;

import org.jeromq.ZMQ;
import org.jeromq.ZMQQueue;

public class ZMQResourceFactory {

    private ZMQResourceFactory() {

    }

    public static ZMQ.Context createContext(int ioThreads) {
        return ZMQ.context(ioThreads);
    }

    public static ZMQ.Socket createSocket(ZMQSocketConfig socketConfig, ZMQ.Context zmqContext) {
        int socketType = socketTypeToInteger(socketConfig.getSocketType());
        ZMQ.Socket zmqSocket = zmqContext.socket(socketType);

        if (socketConfig.getIdentity() != null) {
            zmqSocket.setIdentity(socketConfig.getIdentity().getBytes());
        }

        if (socketType == ZMQ.PUB) {
            String[] subscribers = socketConfig.getAddress().split(";");

            for (String subscriber : subscribers) {
                prepare(zmqSocket, socketConfig.getSocketOperation(), subscriber);
            }
        } else {
            prepare(zmqSocket, socketConfig.getSocketOperation(), socketConfig.getAddress());
        }

        if (socketType == ZMQ.SUB) {
            if (socketConfig.getFilter() != null) {
                zmqSocket.subscribe(socketConfig.getFilter().getBytes());
            } else {
                zmqSocket.subscribe(new byte[]{});
            }
        }

        return zmqSocket;
    }

    public static ZMQ.Poller createPoller(ZMQ.Socket zmqSocket, ZMQ.Context zmqContext) {
        ZMQ.Poller poller = zmqContext.poller(1);
        poller.register(zmqSocket, ZMQ.Poller.POLLIN);

        return poller;
    }

    public static ZMQQueue createQueue(ZMQ.Socket frontendZMQSocket, ZMQ.Socket backendZMQSocket, ZMQ.Context zmqContext) {
        return new ZMQQueue(zmqContext, frontendZMQSocket, backendZMQSocket);
    }

    private static void prepare(ZMQ.Socket zmqSocket, ZMQURIConstants.SocketOperation socketOperation, String address) {
        if (socketOperation.equals(ZMQURIConstants.SocketOperation.BIND)) {
            zmqSocket.bind(address);
        } else {
            zmqSocket.connect(address);
        }
    }

    private static int socketTypeToInteger(ZMQURIConstants.SocketType socketType) {

        switch (socketType) {
            case REP:
                return ZMQ.REP;

            case REQ:
                return ZMQ.REQ;

            case SUB:
                return ZMQ.SUB;

            case XSUB:
                return ZMQ.XSUB;

            case PUB:
                return ZMQ.PUB;

            case XPUB:
                return ZMQ.XPUB;

            case PULL:
                return ZMQ.PULL;

            case PUSH:
                return ZMQ.PUSH;

            case DEALER:
                return ZMQ.DEALER;

            case ROUTER:
                return ZMQ.ROUTER;

            case PAIR:
                return ZMQ.PAIR;

            default:
                throw new UnsupportedOperationException();
        }
    }

}


text:
"""
News for state space models

Author: Chad Fulton
License: BSD-3
"""

import numpy as np
import pandas as pd

from statsmodels.iolib.table import SimpleTable
from statsmodels.iolib.summary import Summary
from statsmodels.iolib.tableformatting import fmt_params

class NewsResults:
    """
    Impacts of data revisions and news on estimates of variables of interest

    Parameters
    ----------
    news_results : SimpleNamespace instance
        Results from `KalmanSmoother.news`.
    model : MLEResults
        The results object associated with the model from which the NewsResults
        was generated.
    updated : MLEResults
        The results object associated with the model containing the updated
        dataset.
    previous : MLEResults
        The results object associated with the model containing the previous
        dataset.
    impacted_variable : str, list, array, or slice, optional
        Observation variable label or slice of labels specifying particular
        impacted variables to display in output. The impacted variable(s)
        describe the variables that were *affected* by the news. If you do not
        know the labels for the variables, check the `endog_names` attribute of
        the model instance.
    tolerance : float, optional
        The numerical threshold for determining zero impact. Default is that
        any impact less than 1e-10 is assumed to be zero.
    row_labels : iterable
        Row labels (often dates) for the impacts of the revisions and news.

    Attributes
    ----------
    total_impacts : pd.Series
        Updates to forecasts of impacted variables from both news and data
        revisions, E[y^i | post] - E[y^i | previous].
    update_impacts : pd.Series
        Updates to forecasts of impacted variables from the news,
        E[y^i | post] - E[y^i | revisions] where y^i are the impacted variables
        of interest.
    revision_impacts : pd.Series
        Updates to forecasts of impacted variables from data revisions,
        E[y^i | revisions] - E[y^i | previous].
    news : pd.Series
        The unexpected component of the updated data,
        E[y^u | post] - E[y^u | revisions] where y^u are the updated variables.
    weights : pd.Series
        Weights describing the effect of news on variables of interest.
    revisions : pd.Series
        The revisions betwen the current and previously observed data
        y^r_{revised} - y^r_{previous} where y^r are the revised variables.
    revision_weights : pd.Series
        Weights describing the effect of revisions on variables of interest.
    update_forecasts : pd.Series
        Forecasts based on the previous dataset of the variables that were
        updated, E[y^u | previous].
    update_realized : pd.Series
        Actual observed data associated with the variables that were
        updated, y^u
    revised_prev : pd.Series
        Previously observed data associated with the variables that were
        revised, y^r_{previous}
    revised : pd.Series
        Currently observed data associated with the variables that were
        revised, y^r_{revised}
    prev_impacted_forecasts : pd.Series
        Previous forecast of the variables of interest, E[y^i | previous].
    post_impacted_forecasts : pd.Series
        Forecast of the variables of interest after taking into account both
        revisions and updates, E[y^i | post].
    revisions_iloc : pd.DataFrame
        The integer locations of the data revisions in the dataset.
    revisions_ix : pd.DataFrame
        The label-based locations of the data revisions in the dataset.
    updates_iloc : pd.DataFrame
        The integer locations of the updated data points.
    updates_ix : pd.DataFrame
        The label-based locations of updated data points.
    state_index : array_like
        Index of state variables used to compute impacts.

    References
    ----------
    .. [1] Bańbura, Marta, and Michele Modugno.
           "Maximum likelihood estimation of factor models on datasets with
           arbitrary pattern of missing data."
           Journal of Applied Econometrics 29, no. 1 (2014): 133-160.
    .. [2] Bańbura, Marta, Domenico Giannone, and Lucrezia Reichlin.
           "Nowcasting."
           The Oxford Handbook of Economic Forecasting. July 8, 2011.
    .. [3] Bańbura, Marta, Domenico Giannone, Michele Modugno, and Lucrezia
           Reichlin.
           "Now-casting and the real-time data flow."
           In Handbook of economic forecasting, vol. 2, pp. 195-237.
           Elsevier, 2013.
    """
    def __init__(self, news_results, model, updated, previous,
                 impacted_variable=None, tolerance=1e-10, row_labels=None):
        # Note: `model` will be the same as one of `revised` or `previous`, but
        # we need to save it as self.model so that the `predict_dates`, which
        # were generated by the `_get_prediction_index` call, will be available
        # for use by the base wrapping code.
        self.model = model
        self.updated = updated
        self.previous = previous
        self.news_results = news_results
        self._impacted_variable = impacted_variable
        self._tolerance = tolerance
        self.row_labels = row_labels
        self.params = []  # required for `summary` to work

        self.endog_names = self.updated.model.endog_names
        self.k_endog = len(self.endog_names)

        index = self.updated.model._index
        columns = np.atleast_1d(self.endog_names)

        # E[y^i | post]
        self.post_impacted_forecasts = pd.DataFrame(
            news_results.post_impacted_forecasts.T,
            index=self.row_labels, columns=columns)
        # E[y^i | previous]
        self.prev_impacted_forecasts = pd.DataFrame(
            news_results.prev_impacted_forecasts.T,
            index=self.row_labels, columns=columns)
        # E[y^i | post] - E[y^i | revisions]
        self.update_impacts = pd.DataFrame(
            news_results.update_impacts,
            index=self.row_labels, columns=columns)
        # E[y^i | revisions] - E[y^i | previous]
        self.revision_impacts = pd.DataFrame(
            news_results.revision_impacts,
            index=self.row_labels, columns=columns)
        # E[y^i | post] - E[y^i | previous]
        self.total_impacts = (self.post_impacted_forecasts -
                              self.prev_impacted_forecasts)

        # Indices of revisions and updates
        self.revisions_iloc = pd.DataFrame(
            list(zip(*news_results.revisions_ix)),
            index=['revision date', 'revised variable']).T
        iloc = self.revisions_iloc
        if len(iloc) > 0:
            self.revisions_ix = pd.DataFrame({
                'revision date': index[iloc['revision date']],
                'revised variable': columns[iloc['revised variable']]})
        else:
            self.revisions_ix = iloc.copy()

        self.updates_iloc = pd.DataFrame(
            list(zip(*news_results.updates_ix)),
            index=['update date', 'updated variable']).T
        iloc = self.updates_iloc
        if len(iloc) > 0:
            self.updates_ix = pd.DataFrame({
                'update date': index[iloc['update date']],
                'updated variable': columns[iloc['updated variable']]})
        else:
            self.updates_ix = iloc.copy()

        # Index of the state variables used
        self.state_index = news_results.state_index

        # Wrap forecasts and forecasts errors
        r_ix = pd.MultiIndex.from_arrays([
            self.revisions_ix['revision date'],
            self.revisions_ix['revised variable']])
        u_ix = pd.MultiIndex.from_arrays([
            self.updates_ix['update date'],
            self.updates_ix['updated variable']])

        # E[y^u | post] - E[y^u | revisions]
        if news_results.news is None:
            self.news = pd.Series([], index=u_ix, name='news',
                                  dtype=model.params.dtype)
        else:
            self.news = pd.Series(news_results.news, index=u_ix, name='news')
        # E[y^u | revisions] - E[y^u | previous]
        if news_results.revisions is None:
            self.revisions = pd.Series([], index=r_ix, name='revision',
                                       dtype=model.params.dtype)
        else:
            self.revisions = pd.Series(news_results.revisions, index=r_ix,
                                       name='revision')
        # E[y^u | revised]
        if news_results.update_forecasts is None:
            self.update_forecasts = pd.Series([], index=u_ix,
                                              dtype=model.params.dtype)
        else:
            self.update_forecasts = pd.Series(
                news_results.update_forecasts, index=u_ix)
        # y^r_{revised}
        if news_results.revised is None:
            self.revised = pd.Series([], index=r_ix, dtype=model.params.dtype,
                                     name='revised')
        else:
            self.revised = pd.Series(news_results.revised, index=r_ix,
                                     name='revised')
        # y^r_{previous}
        if news_results.revised_prev is None:
            self.revised_prev = pd.Series([], index=r_ix,
                                          dtype=model.params.dtype)
        else:
            self.revised_prev = pd.Series(
                news_results.revised_prev, index=r_ix)
        # y^u
        if news_results.update_realized is None:
            self.update_realized = pd.Series([], index=u_ix,
                                             dtype=model.params.dtype)
        else:
            self.update_realized = pd.Series(
                news_results.update_realized, index=u_ix)
        cols = pd.MultiIndex.from_product([self.row_labels, columns])
        # reshaped version of gain matrix E[y A'] E[A A']^{-1}
        if len(self.updates_iloc):
            weights = news_results.gain.reshape(
                len(cols), len(u_ix))
        else:
            weights = np.zeros((len(cols), len(u_ix)))
        self.weights = pd.DataFrame(weights, index=cols, columns=u_ix).T
        self.weights.columns.names = ['impact date', 'impacted variable']

        # reshaped version of revision_weights
        if len(self.revisions_iloc):
            revision_weights = news_results.revision_weights.reshape(
                len(cols), len(r_ix))
        else:
            revision_weights = np.zeros((len(cols), len(r_ix)))
        self.revision_weights = pd.DataFrame(
            revision_weights, index=cols, columns=r_ix).T
        self.revision_weights.columns.names = [
            'impact date', 'impacted variable']

    @property
    def impacted_variable(self):
        return self._impacted_variable

    @impacted_variable.setter
    def impacted_variable(self, value):
        self._impacted_variable = value

    @property
    def tolerance(self):
        return self._tolerance

    @tolerance.setter
    def tolerance(self, value):
        self._tolerance = value

    @property
    def data_revisions(self):
        """
        Revisions to data points that existed in the previous dataset

        Returns
        -------
        data_revisions : pd.DataFrame
            Index is as MultiIndex consisting of `revision date` and
            `revised variable`. The columns are:

            - `observed (prev)`: the value of the data as it was observed
              in the previous dataset.
            - `revised`: the revised value of the data, as it is observed
              in the new dataset

        See also
        --------
        data_updates
        """
        # Save revisions data
        data = pd.concat([
            self.revised.rename('revised'),
            self.revised_prev.rename('observed (prev)')
        ], axis=1).sort_index()
        return data

    @property
    def data_updates(self):
        """
        Updated data; new entries that did not exist in the previous dataset

        Returns
        -------
        data_updates : pd.DataFrame
            Index is as MultiIndex consisting of `update date` and
            `updated variable`. The columns are:

            - `forecast (prev)`: the previous forecast of the new entry,
              based on the information available in the previous dataset
              (recall that for these updated data points, the previous dataset
              had no observed value for them at all)
            - `observed`: the value of the new entry, as it is observed in the
              new dataset

        See also
        --------
        data_revisions
        """
        data = pd.concat([
            self.update_realized.rename('observed'),
            self.update_forecasts.rename('forecast (prev)')
        ], axis=1).sort_index()
        return data

    @property
    def details_by_impact(self):
        """
        Details of forecast revisions from news, organized by impacts first

        Returns
        -------
        details : pd.DataFrame
            Index is as MultiIndex consisting of:

            - `impact date`: the date of the impact on the variable of interest
            - `impacted variable`: the variable that is being impacted
            - `update date`: the date of the data update, that results in
              `news` that impacts the forecast of variables of interest
            - `updated variable`: the variable being updated, that results in
              `news` that impacts the forecast of variables of interest

            The columns are:

            - `forecast (prev)`: the previous forecast of the new entry,
              based on the information available in the previous dataset
            - `observed`: the value of the new entry, as it is observed in the
              new dataset
            - `news`: the news associated with the update (this is just the
              forecast error: `observed` - `forecast (prev)`)
            - `weight`: the weight describing how the `news` effects the
              forecast of the variable of interest
            - `impact`: the impact of the `news` on the forecast of the
              variable of interest

        Notes
        -----
        This table decomposes updated forecasts of variables of interest from
        the `news` associated with each updated datapoint from the new data
        release.

        This table does not summarize the impacts or show the effect of
        revisions. That information can be found in the `impacts` or
        `revision_details_by_impact` tables.

        This form of the details table is organized so that the impacted
        dates / variables are first in the index. This is convenient for
        slicing by impacted variables / dates to view the details of data
        updates for a particular variable or date.

        However, since the `forecast (prev)` and `observed` columns have a lot
        of duplication, printing the entire table gives a result that is less
        easy to parse than that produced by the `details_by_update` property.
        `details_by_update` contains the same information but is organized to
        be more convenient for displaying the entire table of detailed updates.
        At the same time, `details_by_update` is less convenient for
        subsetting.

        See Also
        --------
        details_by_update
        revision_details_by_update
        impacts
        """
        df = self.weights.stack(level=[0, 1]).rename('weight').to_frame()
        if len(self.updates_iloc):
            df['forecast (prev)'] = self.update_forecasts
            df['observed'] = self.update_realized
            df['news'] = self.news
            df['impact'] = df['news'] * df['weight']
        else:
            df['forecast (prev)'] = []
            df['observed'] = []
            df['news'] = []
            df['impact'] = []
        df = df[['observed', 'forecast (prev)', 'news', 'weight', 'impact']]
        df = df.reorder_levels([2, 3, 0, 1]).sort_index()

        if self.impacted_variable is not None and len(df) > 0:
            df = df.loc[np.s_[:, self.impacted_variable], :]

        mask = np.abs(df['weight']) > self.tolerance
        return df[mask]

    @property
    def revision_details_by_impact(self):
        """
        Details of forecast revisions from revised data, organized by impacts

        Returns
        -------
        details : pd.DataFrame
            Index is as MultiIndex consisting of:

            - `impact date`: the date of the impact on the variable of interest
            - `impacted variable`: the variable that is being impacted
            - `revision date`: the date of the data revision, that results in
              `revision` that impacts the forecast of variables of interest
            - `revised variable`: the variable being revised, that results in
              `news` that impacts the forecast of variables of interest

            The columns are:

            - `observed (prev)`: the previous value of the observation, as it
              was given in the previous dataset
            - `revised`: the value of the revised entry, as it is observed in
              the new dataset
            - `revision`: the revision (this is `revised` - `observed (prev)`)
            - `weight`: the weight describing how the `revision` effects the
              forecast of the variable of interest
            - `impact`: the impact of the `revision` on the forecast of the
              variable of interest

        Notes
        -----
        This table decomposes updated forecasts of variables of interest from
        the `revision` associated with each revised datapoint from the new data
        release.

        This table does not summarize the impacts or show the effect of
        new datapoints. That information can be found in the
        `impacts` or `details_by_impact` tables.

        This form of the details table is organized so that the impacted
        dates / variables are first in the index. This is convenient for
        slicing by impacted variables / dates to view the details of data
        updates for a particular variable or date.

        However, since the `observed (prev)` and `revised` columns have a lot
        of duplication, printing the entire table gives a result that is less
        easy to parse than that produced by the `details_by_revision` property.
        `details_by_revision` contains the same information but is organized to
        be more convenient for displaying the entire table of detailed
        revisions. At the same time, `details_by_revision` is less convenient
        for subsetting.

        See Also
        --------
        details_by_revision
        details_by_impact
        impacts
        """
        weights = self.revision_weights.stack(level=[0, 1])
        df = pd.concat([
            self.revised.reindex(weights.index),
            self.revised_prev.rename('observed (prev)').reindex(weights.index),
            self.revisions.reindex(weights.index),
            weights.rename('weight'),
            (self.revisions * weights).rename('impact'),
        ], axis=1)

        df = df.reorder_levels([2, 3, 0, 1]).sort_index()

        if self.impacted_variable is not None and len(df) > 0:
            df = df.loc[np.s_[:, self.impacted_variable], :]

        mask = np.abs(df['weight']) > self.tolerance
        return df[mask]

    @property
    def details_by_update(self):
        """
        Details of forecast revisions from news, organized by updates first

        Returns
        -------
        details : pd.DataFrame
            Index is as MultiIndex consisting of:

            - `update date`: the date of the data update, that results in
              `news` that impacts the forecast of variables of interest
            - `updated variable`: the variable being updated, that results in
              `news` that impacts the forecast of variables of interest
            - `forecast (prev)`: the previous forecast of the new entry,
              based on the information available in the previous dataset
            - `observed`: the value of the new entry, as it is observed in the
              new dataset
            - `impact date`: the date of the impact on the variable of interest
            - `impacted variable`: the variable that is being impacted

            The columns are:

            - `news`: the news associated with the update (this is just the
              forecast error: `observed` - `forecast (prev)`)
            - `weight`: the weight describing how the `news` affects the
              forecast of the variable of interest
            - `impact`: the impact of the `news` on the forecast of the
              variable of interest

        Notes
        -----
        This table decomposes updated forecasts of variables of interest from
        the `news` associated with each updated datapoint from the new data
        release.

        This table does not summarize the impacts or show the effect of
        revisions. That information can be found in the `impacts` table.

        This form of the details table is organized so that the updated
        dates / variables are first in the index, and in this table the index
        also contains the forecasts and observed values of the updates. This is
        convenient for displaying the entire table of detailed updates because
        it allows sparsifying duplicate entries.

        However, since it includes forecasts and observed values in the index
        of the table, it is not convenient for subsetting by the variable of
        interest. Instead, the `details_by_impact` property is organized to
        make slicing by impacted variables / dates easy. This allows, for
        example, viewing the details of data updates on a particular variable
        or date of interest.

        See Also
        --------
        details_by_impact
        impacts
        """
        df = self.weights.stack(level=[0, 1]).rename('weight').to_frame()
        if len(self.updates_iloc):
            df['forecast (prev)'] = self.update_forecasts
            df['observed'] = self.update_realized
            df['news'] = self.news
            df['impact'] = df['news'] * df['weight']
        else:
            df['forecast (prev)'] = []
            df['observed'] = []
            df['news'] = []
            df['impact'] = []
        df = df[['forecast (prev)', 'observed', 'news',
                 'weight', 'impact']]
        df = df.reset_index()
        keys = ['update date', 'updated variable', 'observed',
                'forecast (prev)', 'impact date', 'impacted variable']
        df.index = pd.MultiIndex.from_arrays([df[key] for key in keys])
        details = df.drop(keys, axis=1).sort_index()

        if self.impacted_variable is not None and len(df) > 0:
            details = details.loc[
                np.s_[:, :, :, :, :, self.impacted_variable], :]

        mask = np.abs(details['weight']) > self.tolerance
        return details[mask]

    @property
    def revision_details_by_update(self):
        """
        Details of forecast revisions from revisions, organized by updates

        Returns
        -------
        details : pd.DataFrame
            Index is as MultiIndex consisting of:

            - `revision date`: the date of the data revision, that results in
              `revision` that impacts the forecast of variables of interest
            - `revised variable`: the variable being revised, that results in
              `news` that impacts the forecast of variables of interest
            - `observed (prev)`: the previous value of the observation, as it
              was given in the previous dataset
            - `revised`: the value of the revised entry, as it is observed in
              the new dataset
            - `impact date`: the date of the impact on the variable of interest
            - `impacted variable`: the variable that is being impacted

            The columns are:

            - `revision`: the revision (this is `revised` - `observed (prev)`)
            - `weight`: the weight describing how the `revision` affects the
              forecast of the variable of interest
            - `impact`: the impact of the `revision` on the forecast of the
              variable of interest

        Notes
        -----
        This table decomposes updated forecasts of variables of interest from
        the `revision` associated with each revised datapoint from the new data
        release.

        This table does not summarize the impacts or show the effect of
        revisions. That information can be found in the `impacts` table.

        This form of the details table is organized so that the revision
        dates / variables are first in the index, and in this table the index
        also contains the previously observed and revised values. This is
        convenient for displaying the entire table of detailed revisions
        because it allows sparsifying duplicate entries.

        However, since it includes previous observations and revisions in the
        index of the table, it is not convenient for subsetting by the variable
        of interest. Instead, the `revision_details_by_impact` property is
        organized to make slicing by impacted variables / dates easy. This
        allows, for example, viewing the details of data revisions on a
        particular variable or date of interest.

        See Also
        --------
        details_by_impact
        impacts
        """
        weights = self.revision_weights.stack(level=[0, 1])

        df = pd.concat([
            self.revised_prev.rename('observed (prev)').reindex(weights.index),
            self.revised.reindex(weights.index),
            self.revisions.reindex(weights.index),
            weights.rename('weight'),
            (self.revisions * weights).rename('impact'),
        ], axis=1)

        details = (df.set_index(['observed (prev)', 'revised'], append=True)
                     .reorder_levels([
                         'revision date', 'revised variable', 'revised',
                         'observed (prev)', 'impact date',
                         'impacted variable'])
                     .sort_index())

        if self.impacted_variable is not None and len(df) > 0:
            details = details.loc[
                np.s_[:, :, :, :, :, self.impacted_variable], :]

        mask = np.abs(details['weight']) > self.tolerance
        return details[mask]

    @property
    def impacts(self):
        """
        Impacts from news and revisions on all dates / variables of interest

        Returns
        -------
        impacts : pd.DataFrame
            Index is as MultiIndex consisting of:

            - `impact date`: the date of the impact on the variable of interest
            - `impacted variable`: the variable that is being impacted

            The columns are:

            - `estimate (prev)`: the previous estimate / forecast of the
              date / variable of interest.
            - `impact of revisions`: the impact of all data revisions on
              the estimate of the date / variable of interest.
            - `impact of news`: the impact of all news on the estimate of
              the date / variable of interest.
            - `total impact`: the total impact of both revisions and news on
              the estimate of the date / variable of interest.
            - `estimate (new)`: the new estimate / forecast of the
              date / variable of interest after taking into account the effects
              of the revisions and news.

        Notes
        -----
        This table decomposes updated forecasts of variables of interest into
        the overall effect from revisions and news.

        This table does not break down the detail by the updated
        dates / variables. That information can be found in the
        `details_by_impact` `details_by_update` tables.

        See Also
        --------
        details_by_impact
        details_by_update
        """
        # Summary of impacts
        impacts = pd.concat([
            self.prev_impacted_forecasts.unstack().rename('estimate (prev)'),
            self.revision_impacts.unstack().rename('impact of revisions'),
            self.update_impacts.unstack().rename('impact of news'),
            self.post_impacted_forecasts.unstack().rename('estimate (new)')],
            axis=1)
        impacts['impact of revisions'] = (
            impacts['impact of revisions'].fillna(0))
        impacts['impact of news'] = (
            impacts['impact of news'].fillna(0))
        impacts['total impact'] = (impacts['impact of revisions'] +
                                   impacts['impact of news'])
        impacts = impacts.reorder_levels([1, 0]).sort_index()
        impacts.index.names = ['impact date', 'impacted variable']
        impacts = impacts[['estimate (prev)', 'impact of revisions',
                           'impact of news', 'total impact', 'estimate (new)']]

        if self.impacted_variable is not None:
            impacts = impacts.loc[np.s_[:, self.impacted_variable], :]

        tmp = np.abs(impacts[['impact of revisions', 'impact of news']])
        mask = (tmp > self.tolerance).any(axis=1)

        return impacts[mask]

    def summary_impacts(self, impact_date=None, impacted_variable=None,
                        groupby='impact date', show_revisions_columns=None,
                        sparsify=True, float_format='%.2f'):
        """
        Create summary table with detailed impacts from news; by date, variable

        Parameters
        ----------
        impact_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            impact periods to display. The impact date(s) describe the periods
            in which impacted variables were *affected* by the news. If this
            argument is given, the output table will only show this impact date
            or dates. Note that this argument is passed to the Pandas `loc`
            accessor, and so it should correspond to the labels of the model's
            index. If the model was created with data in a list or numpy array,
            then these labels will be zero-indexes observation integers.
        impacted_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            impacted variables to display. The impacted variable(s) describe
            the variables that were *affected* by the news. If you do not know
            the labels for the variables, check the `endog_names` attribute of
            the model instance.
        groupby : {impact date, impacted date}
            The primary variable for grouping results in the impacts table. The
            default is to group by update date.
        show_revisions_columns : bool, optional
            If set to False, the impacts table will not show the impacts from
            data revisions or the total impacts. Default is to show the
            revisions and totals columns if any revisions were made and
            otherwise to hide them.
        sparsify : bool, optional, default True
            Set to False for the table to include every one of the multiindex
            keys at each row.
        float_format : str, optional
            Formatter format string syntax for converting numbers to strings.
            Default is '%.2f'.

        Returns
        -------
        impacts_table : SimpleTable
            Table describing total impacts from both revisions and news. See
            the documentation for the `impacts` attribute for more details
            about the index and columns.

        See Also
        --------
        impacts
        """
        # Squeeze for univariate models
        if impacted_variable is None and self.k_endog == 1:
            impacted_variable = self.endog_names[0]

        # Default is to only show the revisions columns if there were any
        # revisions (otherwise it would just be a column of zeros)
        if show_revisions_columns is None:
            show_revisions_columns = len(self.revisions_iloc) > 0

        # Select only the variables / dates of interest
        s = list(np.s_[:, :])
        if impact_date is not None:
            s[0] = np.s_[impact_date]
        if impacted_variable is not None:
            s[1] = np.s_[impacted_variable]
        s = tuple(s)
        impacts = self.impacts.loc[s, :]

        # Make the first index level the groupby level
        groupby = groupby.lower()
        if groupby in ['impacted variable', 'impacted_variable']:
            impacts.index = impacts.index.swaplevel(1, 0)
        elif groupby not in ['impact date', 'impact_date']:
            raise ValueError('Invalid groupby for impacts table. Valid options'
                             ' are "impact date" or "impacted variable".'
                             f'Got "{groupby}".')
        impacts = impacts.sort_index()

        # Drop the non-groupby level if there's only one value
        tmp_index = impacts.index.remove_unused_levels()
        k_vars = len(tmp_index.levels[1])
        removed_level = None
        if sparsify and k_vars == 1:
            name = tmp_index.names[1]
            value = tmp_index.levels[1][0]
            removed_level = f'{name} = {value}'
            impacts.index = tmp_index.droplevel(1)
            impacts = impacts.applymap(
                lambda num: '' if pd.isnull(num) else float_format % num)
            impacts = impacts.reset_index()
            impacts.iloc[:, 0] = impacts.iloc[:, 0].map(str)
        else:
            impacts = impacts.reset_index()
            impacts.iloc[:, :2] = impacts.iloc[:, :2].applymap(str)
            impacts.iloc[:, 2:] = impacts.iloc[:, 2:].applymap(
                lambda num: '' if pd.isnull(num) else float_format % num)

        # Sparsify the groupby column
        if sparsify and groupby in impacts:
            mask = impacts[groupby] == impacts[groupby].shift(1)
            tmp = impacts.loc[mask, groupby]
            if len(tmp) > 0:
                impacts.loc[mask, groupby] = ''

        # Drop revisions and totals columns if applicable
        if not show_revisions_columns:
            impacts.drop(['impact of revisions', 'total impact'], axis=1,
                         inplace=True)

        params_data = impacts.values
        params_header = impacts.columns.tolist()
        params_stubs = None

        title = 'Impacts'
        if removed_level is not None:
            join = 'on' if groupby == 'date' else 'for'
            title += f' {join} [{removed_level}]'
        impacts_table = SimpleTable(
            params_data, params_header, params_stubs,
            txt_fmt=fmt_params, title=title)

        return impacts_table

    def summary_details(self, source='news', impact_date=None,
                        impacted_variable=None, update_date=None,
                        updated_variable=None, groupby='update date',
                        sparsify=True, float_format='%.2f',
                        multiple_tables=False):
        """
        Create summary table with detailed impacts; by date, variable

        Parameters
        ----------
        source : {news, revisions}
            The source of impacts to summarize. Default is "news".
        impact_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            impact periods to display. The impact date(s) describe the periods
            in which impacted variables were *affected* by the news. If this
            argument is given, the output table will only show this impact date
            or dates. Note that this argument is passed to the Pandas `loc`
            accessor, and so it should correspond to the labels of the model's
            index. If the model was created with data in a list or numpy array,
            then these labels will be zero-indexes observation integers.
        impacted_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            impacted variables to display. The impacted variable(s) describe
            the variables that were *affected* by the news. If you do not know
            the labels for the variables, check the `endog_names` attribute of
            the model instance.
        update_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            updated periods to display. The updated date(s) describe the
            periods in which the new data points were available that generated
            the news). See the note on `impact_date` for details about what
            these labels are.
        updated_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            updated variables to display. The updated variable(s) describe the
            variables that were *affected* by the news. If you do not know the
            labels for the variables, check the `endog_names` attribute of the
            model instance.
        groupby : {update date, updated date, impact date, impacted date}
            The primary variable for grouping results in the details table. The
            default is to group by update date.
        sparsify : bool, optional, default True
            Set to False for the table to include every one of the multiindex
            keys at each row.
        float_format : str, optional
            Formatter format string syntax for converting numbers to strings.
            Default is '%.2f'.
        multiple_tables : bool, optional
            If set to True, this function will return a list of tables, one
            table for each of the unique `groupby` levels. Default is False,
            in which case this function returns a single table.

        Returns
        -------
        details_table : SimpleTable or list of SimpleTable
            Table or list of tables describing how the news from each update
            (i.e. news from a particular variable / date) translates into
            changes to the forecasts of each impacted variable variable / date.

            This table contains information about the updates and about the
            impacts. Updates are newly observed datapoints that were not
            available in the previous results set. Each update leads to news,
            and the news may cause changes in the forecasts of the impacted
            variables. The amount that a particular piece of news (from an
            update to some variable at some date) impacts a variable at some
            date depends on weights that can be computed from the model
            results.

            The data contained in this table that refer to updates are:

            - `update date` : The date at which a new datapoint was added.
            - `updated variable` : The variable for which a new datapoint was
              added.
            - `forecast (prev)` : The value that had been forecast by the
              previous model for the given updated variable and date.
            - `observed` : The observed value of the new datapoint.
            - `news` : The news is the difference between the observed value
              and the previously forecast value for a given updated variable
              and date.

            The data contained in this table that refer to impacts are:

            - `impact date` : A date associated with an impact.
            - `impacted variable` : A variable that was impacted by the news.
            - `weight` : The weight of news from a given `update date` and
              `update variable` on a given `impacted variable` at a given
              `impact date`.
            - `impact` : The revision to the smoothed estimate / forecast of
              the impacted variable at the impact date based specifically on
              the news generated by the `updated variable` at the
              `update date`.

        See Also
        --------
        details_by_impact
        details_by_update
        """
        # Squeeze for univariate models
        if self.k_endog == 1:
            if impacted_variable is None:
                impacted_variable = self.endog_names[0]
            if updated_variable is None:
                updated_variable = self.endog_names[0]

        # Select only the variables / dates of interest
        s = list(np.s_[:, :, :, :, :, :])
        if impact_date is not None:
            s[0] = np.s_[impact_date]
        if impacted_variable is not None:
            s[1] = np.s_[impacted_variable]
        if update_date is not None:
            s[2] = np.s_[update_date]
        if updated_variable is not None:
            s[3] = np.s_[updated_variable]
        s = tuple(s)

        if source == 'news':
            details = self.details_by_impact.loc[s, :]
            columns = {
                'current': 'observed',
                'prev': 'forecast (prev)',
                'update date': 'update date',
                'updated variable': 'updated variable',
                'news': 'news',
            }
        elif source == 'revisions':
            details = self.revision_details_by_impact.loc[s, :]
            columns = {
                'current': 'revised',
                'prev': 'observed (prev)',
                'update date': 'revision date',
                'updated variable': 'revised variable',
                'news': 'revision',
            }
        else:
            raise ValueError(f'Invalid `source`: {source}. Must be "news" or'
                             ' "impacts".')

        # Make the first index level the groupby level
        groupby = groupby.lower().replace('_', ' ')
        groupby_overall = 'impact'
        levels_order = [0, 1, 2, 3]
        if groupby == 'update date':
            levels_order = [2, 3, 0, 1]
            groupby_overall = 'update'
        elif groupby == 'updated variable':
            levels_order = [3, 2, 1, 0]
            groupby_overall = 'update'
        elif groupby == 'impacted variable':
            levels_order = [1, 0, 3, 2]
        elif groupby != 'impact date':
            raise ValueError('Invalid groupby for details table. Valid options'
                             ' are "update date", "updated variable",'
                             ' "impact date",or "impacted variable".'
                             f' Got "{groupby}".')
        details.index = (details.index.reorder_levels(levels_order)
                                      .remove_unused_levels())
        details = details.sort_index()

        # If our overall group-by is `update`, move forecast (prev) and
        # observed into the index
        base_levels = [0, 1, 2, 3]
        if groupby_overall == 'update':
            details.set_index([columns['current'], columns['prev']],
                              append=True, inplace=True)
            details.index = details.index.reorder_levels([0, 1, 4, 5, 2, 3])
            base_levels = [0, 1, 4, 5]

        # Drop the non-groupby levels if there's only one value
        tmp_index = details.index.remove_unused_levels()
        n_levels = len(tmp_index.levels)
        k_level_values = [len(tmp_index.levels[i]) for i in range(n_levels)]
        removed_levels = []
        if sparsify:
            for i in sorted(base_levels)[::-1][:-1]:
                if k_level_values[i] == 1:
                    name = tmp_index.names[i]
                    value = tmp_index.levels[i][0]
                    can_drop = (
                        (name == columns['update date']
                            and update_date is not None) or
                        (name == columns['updated variable']
                            and updated_variable is not None) or
                        (name == 'impact date'
                            and impact_date is not None) or
                        (name == 'impacted variable'
                            and (impacted_variable is not None or
                                 self.impacted_variable is not None)))
                    if can_drop or not multiple_tables:
                        removed_levels.insert(0, f'{name} = {value}')
                        details.index = tmp_index = tmp_index.droplevel(i)

        # Move everything to columns
        details = details.reset_index()

        # Function for formatting numbers
        def str_format(num, mark_ones=False, mark_zeroes=False):
            if pd.isnull(num):
                out = ''
            elif mark_ones and np.abs(1 - num) < self.tolerance:
                out = '1.0'
            elif mark_zeroes and np.abs(num) < self.tolerance:
                out = '0'
            else:
                out = float_format % num
            return out

        # Function to create the table
        def create_table(details, removed_levels):
            # Convert everything to strings
            for key in [columns['current'], columns['prev'], columns['news'],
                        'weight', 'impact']:
                if key in details:
                    args = (
                        # mark_ones
                        True if key in ['weight'] else False,
                        # mark_zeroes
                        True if key in ['weight', 'impact'] else False)
                    details[key] = details[key].apply(str_format, args=args)
            for key in [columns['update date'], 'impact date']:
                if key in details:
                    details[key] = details[key].apply(str)

            # Sparsify index columns
            if sparsify:
                sparsify_cols = [columns['update date'],
                                 columns['updated variable'], 'impact date',
                                 'impacted variable']
                data_cols = [columns['current'], columns['prev']]
                if groupby_overall == 'update':
                    # Put data columns first, since we need to do an additional
                    # check based on the other columns before sparsifying
                    sparsify_cols = data_cols + sparsify_cols

                for key in sparsify_cols:
                    if key in details:
                        mask = details[key] == details[key].shift(1)
                        if key in data_cols:
                            if columns['update date'] in details:
                                tmp = details[columns['update date']]
                                mask &= tmp == tmp.shift(1)
                            if columns['updated variable'] in details:
                                tmp = details[columns['updated variable']]
                                mask &= tmp == tmp.shift(1)
                        details.loc[mask, key] = ''

            params_data = details.values
            params_header = [str(x) for x in details.columns.tolist()]
            params_stubs = None

            title = f"Details of {source}"
            if len(removed_levels):
                title += ' for [' + ', '.join(removed_levels) + ']'
            return SimpleTable(params_data, params_header, params_stubs,
                               txt_fmt=fmt_params, title=title)

        if multiple_tables:
            details_table = []
            for item in details[groupby].unique():
                mask = details[groupby] == item
                item_details = details[mask].drop(groupby, axis=1)
                item_removed_levels = [f'{groupby} = {item}'] + removed_levels
                details_table.append(create_table(item_details,
                                                  item_removed_levels))
        else:
            details_table = create_table(details, removed_levels)

        return details_table

    def summary_revisions(self, sparsify=True):
        """
        Create summary table showing revisions to the previous results' data

        Parameters
        ----------
        sparsify : bool, optional, default True
            Set to False for the table to include every one of the multiindex
            keys at each row.

        Returns
        -------
        revisions_table : SimpleTable
            Table showing revisions to the previous results' data. Columns are:

            - `revision date` : date associated with a revised data point
            - `revised variable` : variable that was revised at `revision date`
            - `observed (prev)` : the observed value prior to the revision
            - `revised` : the new value after the revision
            - `revision` : the new value after the revision
        """
        data = pd.merge(
            self.data_revisions, self.revisions, left_index=True,
            right_index=True).sort_index().reset_index()
        data[['revision date', 'revised variable']] = (
            data[['revision date', 'revised variable']].applymap(str))
        data.iloc[:, 2:] = data.iloc[:, 2:].applymap(
            lambda num: '' if pd.isnull(num) else '%.2f' % num)

        # Sparsify the date column
        if sparsify:
            mask = data['revision date'] == data['revision date'].shift(1)
            data.loc[mask, 'revision date'] = ''

        params_data = data.values
        params_header = data.columns.tolist()
        params_stubs = None

        title = 'Revisions to dataset:'
        revisions_table = SimpleTable(
            params_data, params_header, params_stubs,
            txt_fmt=fmt_params, title=title)

        return revisions_table

    def summary_news(self, sparsify=True):
        """
        Create summary table showing news from new data since previous results

        Parameters
        ----------
        sparsify : bool, optional, default True
            Set to False for the table to include every one of the multiindex
            keys at each row.

        Returns
        -------
        updates_table : SimpleTable
            Table showing new datapoints that were not in the previous results'
            data. Columns are:

            - `update date` : date associated with a new data point.
            - `updated variable` : variable for which new data was added at
              `update date`.
            - `forecast (prev)` : the forecast value for the updated variable
              at the update date in the previous results object (i.e. prior to
              the data being available).
            - `observed` : the observed value of the new datapoint.

        See Also
        --------
        data_updates
        """
        data = pd.merge(
            self.data_updates, self.news, left_index=True,
            right_index=True).sort_index().reset_index()
        data[['update date', 'updated variable']] = (
            data[['update date', 'updated variable']].applymap(str))
        data.iloc[:, 2:] = data.iloc[:, 2:].applymap(
            lambda num: '' if pd.isnull(num) else '%.2f' % num)

        # Sparsify the date column
        if sparsify:
            mask = data['update date'] == data['update date'].shift(1)
            data.loc[mask, 'update date'] = ''

        params_data = data.values
        params_header = data.columns.tolist()
        params_stubs = None

        title = 'News from updated observations:'
        updates_table = SimpleTable(
            params_data, params_header, params_stubs,
            txt_fmt=fmt_params, title=title)

        return updates_table

    def summary(self, impact_date=None, impacted_variable=None,
                update_date=None, updated_variable=None,
                revision_date=None, revised_variable=None,
                impacts_groupby='impact date', details_groupby='update date',
                show_revisions_columns=None, sparsify=True,
                include_details_tables=None, include_revisions_tables=False,
                float_format='%.2f'):
        """
        Create summary tables describing news and impacts

        Parameters
        ----------
        impact_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            impact periods to display. The impact date(s) describe the periods
            in which impacted variables were *affected* by the news. If this
            argument is given, the impact and details tables will only show
            this impact date or dates. Note that this argument is passed to the
            Pandas `loc` accessor, and so it should correspond to the labels of
            the model's index. If the model was created with data in a list or
            numpy array, then these labels will be zero-indexes observation
            integers.
        impacted_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            impacted variables to display. The impacted variable(s) describe
            the variables that were *affected* by the news. If you do not know
            the labels for the variables, check the `endog_names` attribute of
            the model instance.
        update_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            updated periods to display. The updated date(s) describe the
            periods in which the new data points were available that generated
            the news). See the note on `impact_date` for details about what
            these labels are.
        updated_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            updated variables to display. The updated variable(s) describe the
            variables that newly added in the updated dataset and which
            generated the news. If you do not know the labels for the
            variables, check the `endog_names` attribute of the model instance.
        revision_date : int, str, datetime, list, array, or slice, optional
            Observation index label or slice of labels specifying particular
            revision periods to display. The revision date(s) describe the
            periods in which the data points were revised. See the note on
            `impact_date` for details about what these labels are.
        revised_variable : str, list, array, or slice, optional
            Observation variable label or slice of labels specifying particular
            revised variables to display. The updated variable(s) describe the
            variables that were *revised*. If you do not know the labels for
            the variables, check the `endog_names` attribute of the model
            instance.
        impacts_groupby : {impact date, impacted date}
            The primary variable for grouping results in the impacts table. The
            default is to group by update date.
        details_groupby : str
            One of "update date", "updated date", "impact date", or
            "impacted date". The primary variable for grouping results in the
            details table. Only used if the details tables are included. The
            default is to group by update date.
        show_revisions_columns : bool, optional
            If set to False, the impacts table will not show the impacts from
            data revisions or the total impacts. Default is to show the
            revisions and totals columns if any revisions were made and
            otherwise to hide them.
        sparsify : bool, optional, default True
            Set to False for the table to include every one of the multiindex
            keys at each row.
        include_details_tables : bool, optional
            If set to True, the summary will show tables describing the details
            of how news from specific updates translate into specific impacts.
            These tables can be very long, particularly in cases where there
            were many updates and in multivariate models. The default is to
            show detailed tables only for univariate models.
        include_revisions_tables : bool, optional
            If set to True, the summary will show tables describing the
            revisions and updates that lead to impacts on variables of
            interest.
        float_format : str, optional
            Formatter format string syntax for converting numbers to strings.
            Default is '%.2f'.

        Returns
        -------
        summary_tables : Summary
            Summary tables describing news and impacts. Basic tables include:

            - A table with general information about the sample.
            - A table describing the impacts of revisions and news.
            - Tables describing revisions in the dataset since the previous
              results set (unless `include_revisions_tables=False`).

            In univariate models or if `include_details_tables=True`, one or
            more tables will additionally be included describing the details
            of how news from specific updates translate into specific impacts.

        See Also
        --------
        summary_impacts
        summary_details
        summary_revisions
        summary_updates
        """
        # Default for include_details_tables
        if include_details_tables is None:
            include_details_tables = (self.k_endog == 1)

        # Model specification results
        model = self.model.model
        title = 'News'

        def get_sample(model):
            if model._index_dates:
                mask = ~np.isnan(model.endog).all(axis=1)
                ix = model._index[mask]
                d = ix[0]
                sample = ['%s' % d]
                d = ix[-1]
                sample += ['- ' + '%s' % d]
            else:
                sample = [str(0), ' - ' + str(model.nobs)]

            return sample
        previous_sample = get_sample(self.previous.model)
        revised_sample = get_sample(self.updated.model)

        # Standardize the model name as a list of str
        model_name = model.__class__.__name__

        # Top summary table
        top_left = [('Model:', [model_name]),
                    ('Date:', None),
                    ('Time:', None)]
        if self.state_index is not None:
            k_states_used = len(self.state_index)
            if k_states_used != self.model.model.k_states:
                top_left.append(('# of included states:', [k_states_used]))

        top_right = [
            ('Original sample:', [previous_sample[0]]),
            ('', [previous_sample[1]]),
            ('Update through:', [revised_sample[1][2:]]),
            ('# of revisions:', [len(self.revisions_ix)]),
            ('# of new datapoints:', [len(self.updates_ix)])]

        summary = Summary()
        self.model.endog_names = self.model.model.endog_names
        summary.add_table_2cols(self, gleft=top_left, gright=top_right,
                                title=title)
        table_ix = 1

        # Impact table
        summary.tables.insert(table_ix, self.summary_impacts(
            impact_date=impact_date, impacted_variable=impacted_variable,
            groupby=impacts_groupby,
            show_revisions_columns=show_revisions_columns, sparsify=sparsify,
            float_format=float_format))
        table_ix += 1

        # News table
        if len(self.updates_iloc) > 0:
            summary.tables.insert(
                table_ix, self.summary_news(sparsify=sparsify))
            table_ix += 1

        # Detail tables
        multiple_tables = (self.k_endog > 1)
        details_tables = self.summary_details(
            source='news',
            impact_date=impact_date, impacted_variable=impacted_variable,
            update_date=update_date, updated_variable=updated_variable,
            groupby=details_groupby, sparsify=sparsify,
            float_format=float_format, multiple_tables=multiple_tables)
        if not multiple_tables:
            details_tables = [details_tables]

        if include_details_tables:
            for table in details_tables:
                summary.tables.insert(table_ix, table)
                table_ix += 1

        # Revisions
        if include_revisions_tables and len(self.revisions_iloc) > 0:
            summary.tables.insert(
                table_ix, self.summary_revisions(sparsify=sparsify))
            table_ix += 1

            # Revision detail tables
            revision_details_tables = self.summary_details(
                source='revisions',
                impact_date=impact_date, impacted_variable=impacted_variable,
                update_date=revision_date, updated_variable=revised_variable,
                groupby=details_groupby, sparsify=sparsify,
                float_format=float_format, multiple_tables=multiple_tables)
            if not multiple_tables:
                revision_details_tables = [revision_details_tables]

            if include_details_tables:
                for table in revision_details_tables:
                    summary.tables.insert(table_ix, table)
                    table_ix += 1

        return summary

    def get_details(self, include_revisions=True, include_updates=True):
        details = []
        if include_updates:
            details.append(self.details_by_impact.rename(
                columns={'forecast (prev)': 'previous'}))
        if include_revisions:
            tmp = self.revision_details_by_impact.rename_axis(
                index={'revision date': 'update date',
                       'revised variable': 'updated variable'})
            tmp = tmp.rename(columns={'revised': 'observed',
                                      'observed (prev)': 'previous',
                                      'revision': 'news'})
            details.append(tmp)
        if not (include_updates or include_revisions):
            details.append(self.details_by_impact.rename(
                columns={'forecast (prev)': 'previous'}).iloc[:0])

        return pd.concat(details)

    def get_impacts(self, groupby=None, include_revisions=True,
                    include_updates=True):
        details = self.get_details(include_revisions=include_revisions,
                                   include_updates=include_updates)

        impacts = details['impact'].unstack(['impact date',
                                             'impacted variable'])

        if groupby is not None:
            impacts = (impacts.unstack('update date')
                              .groupby(groupby).sum(min_count=1)
                              .stack('update date')
                              .swaplevel()
                              .sort_index())

        return impacts


text:
<?php

use ChurchCRM\Service\FinancialService;
use ChurchCRM\Service\GroupService;
use ChurchCRM\Service\PersonService;
use ChurchCRM\Service\SystemService;

// DIC configuration

$container['PersonService'] = new PersonService();
$container['GroupService'] = new GroupService();

$container['FinancialService'] = new FinancialService();

$container['SystemService'] = new SystemService();


text:
#import "../AmazonServiceRequest.h"

#import "SimpleDBRequest.h"
#import "SimpleDBBatchDeleteAttributesRequest.h"
#import "SimpleDBDeletableItem.h"
#import "SimpleDBAttribute.h"

/**
 * Batch Delete Attributes Request Marshaller
 */
@interface SimpleDBBatchDeleteAttributesRequestMarshaller:NSObject {
}

+(AmazonServiceRequest *)createRequest:(SimpleDBBatchDeleteAttributesRequest *)batchDeleteAttributesRequest;

@end


text:
@interface WiaDeviceApiKeys : NSObject

@property (nonatomic, copy, nullable) NSString *publicKey;
@property (nonatomic, copy, nullable) NSString *secretKey;

- (nonnull instancetype)initWithDictionary:(nonnull NSDictionary *)dict;

@end


text:
my::MessageHandler::MessageHandler()
{

}

my::MessageHandler::~MessageHandler()
{

}

void my::MessageHandler::onRecv(ConnectionPtr conn, NetMessage& req)
{
	NetMessage rsp;
	funcHandlerMgr.runFuncHandler(req, rsp);
	if (rsp.serialize())
	{
		conn->sendMessage(rsp);
	}
}


text:
```
$ python example_breast_cancer.py
Base score: -0.151235673812

Most frequent individual (1 times, average score -0.128750840096):
	feature 0: sin col 26
	feature 1: negative col 24
	feature 2: floor col 11
	feature 3: multiply cols 26 and 28
	feature 4: floor col 5
	feature 5: cos col 18
neg_log_loss: -0.128750840096

Best params:
	feature 0: around col 18
	feature 1: nanmedian every row
	feature 2: nanstd every row
	feature 3: multiply cols 1 and 27
	feature 4: fabs col 26
	feature 5: cos col 21
neg_log_loss: -0.120126101022

```


text:
module Hotdog
  module Commands
    class Hosts < BaseCommand
      def run(args=[], options={})
        if args.empty?
          result = execute("SELECT id FROM hosts").to_a.reduce(:+)
          show_hosts(result)
        else
          if args.any? { |host_name| glob?(host_name) }
            result = args.flat_map { |host_name|
              execute("SELECT id FROM hosts WHERE LOWER(name) GLOB LOWER(?);", [host_name]).to_a.reduce(:+) || []
            }
          else
            sqlite_limit_compound_select = options[:sqlite_limit_compound_select] || SQLITE_LIMIT_COMPOUND_SELECT
            result = args.each_slice(sqlite_limit_compound_select).flat_map { |args|
              execute("SELECT id FROM hosts WHERE name IN (%s);" % args.map { "?" }.join(", "), args).to_a.reduce(:+) || []
            }
          end
          if result.empty?
            STDERR.puts("no match found: #{args.join(" ")}")
            exit(1)
          else
            show_hosts(result)
            logger.info("found %d host(s)." % result.length)
            if result.length < args.length
              STDERR.puts("insufficient result: #{args.join(" ")}")
              exit(1)
            end
          end
        end
      end

      def show_hosts(hosts)
        result, fields = get_hosts(hosts || [])
        STDOUT.print(format(result, fields: fields))
      end
    end
  end
end

# vim:set ft=ruby :


text:
title: Using Apache Cassandra In CD/CD With CodeShip Basic
shortTitle: Apache Cassandra
tags:
  - services
  - databases
  - db
  - cassandra
menus:
  basic/db:
    title: Apache Cassandra
    weight: 5
categories:
  - Databases
redirect_from:
  - /databases/cassandra/
  - /classic/getting-started/cassandra/
---

* include a table of contents
{:toc}

[Apache Cassandra](https://cassandra.apache.org/) **2.1.21** is installed on the build VMs, but not running by default.

To use the service during your builds, start the service with the following command:

```shell
sudo /etc/init.d/cassandra start
```

If you require a CLI tool to access the Cassandra server, try [cqlsh](https://pypi.python.org/pypi/cqlsh) available via pip.

```shell
pip install cqlsh
cqlsh --cqlversion="3.2.1"
```


text:
https://jiajunchou.github.io/wiki/

## test


text:
app.controller('postsController', function($scope, $http, $location, PostService) {
  $scope.images = [];

  $scope.saveDraft = function() {
    $scope.loading = true;

    PostService
      .saveDraft($scope.draft)
        .then(function success() {
          $scope.resetDraftModel();
          $location.path("/postsList");
          $scope.loading = false;
          Materialize.toast('Post has been saved', 3000);
        }, function error() {
          $scope.loading = false;
          Materialize.toast('Cannot save post. Server error', 5000);
        });
  };

  $scope.findAll = function() {
    $scope.loading = true;

    PostService
      .findAll()
        .then(function success(response) {
          $scope.drafts = response;
          $scope.loading = false;
          $('.modal').modal(); //Setting up the modals
        }, function error(response) {
          $scope.loading = false;
          Materialize.toast('Cannot retrieve posts. Server error', 5000);
        });
  };

  $scope.deleteDraft = function() {
    if($scope.drafts.length > 0 && $scope.selectedPost !== undefined) {
      PostService
        .deleteDraft($scope.selectedPost)
          .then(function success(response) {
            Materialize.toast('Post has been deleted', 3000);
            $scope.findAll();
          }, function error() {
            Materialize.toast('Cannot delete post. Server error', 5000);
          });
    } else {
      Materialize.toast('You need to select a post before delete', 5000);
    }
  };

  $scope.addPhoto = function() {
    if($scope.drafts.length > 0 && $scope.selectedPost !== undefined) {
      $scope.imageUploading = true;

      PostService
        .addPhoto($scope.selectedPost, $scope.image)
          .then(function success(response) {
            Materialize.toast('Photo has been uploaded', 3000);
            $scope.findAllPhotos();
            $('#uploadPhotoModal').modal('close');
            $scope.imageUploading = false;
          }, function error() {
            Materialize.toast('Cannot upload photo. Server error', 5000);
            $scope.imageUploading = false;
          });
    }
  };

  $scope.findAllPhotos = function() {
    if($scope.drafts.length > 0 && $scope.selectedPost !== undefined) {
      $scope.images = [];

      PostService
        .findAllPhotos($scope.selectedPost)
          .then(function success(response) {
            for(var i in response) {
              var photo = response[i];

              PostService
                .findPhoto(photo[photo.length - 1])
                  .then(function success(image) {
                    if(image != undefined && image != "") {
                      $scope.images.push(image);
                      setTimeout(function(){ $('.materialboxed').materialbox(); }, 1000);
                    }
                });
            }

          });
    }
  };

  $scope.resetDraftModel = function() {
    $scope.draft = undefined;
    $scope.draftForm.$setUntouched();
  };

  $scope.setSelectedPost = function(id) {
    $scope.selectedPost = id;
  };

  $scope.findAll();

});


text:
var http = require('http'),
    React =require('react'),
    express = require('express'),
    fs = require('fs'),
    bcrypt = require('bcrypt'),
    errorPage = fs.readFileSync("./404.html"),
    cookieParser = require('cookie-parser'),
    bodyParser = require('body-parser');

var port = process.env.PORT || 5000,
    app = express(),
    r = express.Router();

require('node-jsx').install();
app.use(express.static('assets'));
app.set('title', "Bucket Sharing");
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));

r.get('/', function(req, res) {
        var data = fs.readFileSync("index.html", "utf-8");
        res.send(data.toString());
});

r.get('/about', function(req, res) {
        var data = fs.readFileSync("views/about.html", "utf-8");
        res.send(data.toString());
});

r.get('/signup', function(req, res) {
        var data = fs.readFileSync("views/signup.html", "utf-8");
        res.send(data.toString());
});

r.post('/controller/login', function(req, res) {
        var username = req.body.email;
        var password = req.body.password;
        var hash = bcrypt.compareSync(password, salt);
        res.send(html);
});

r.post('/controller/signup', function(req, res) {
        var username = req.body.username;
        var email = req.body.email;
        var pwd = req.body.password;
        var confirm_pwd = req.body.password_confirm;
        res.send(html);
});

r.get('*', function(req, res) {
        var match = 'views/' + req.params[0]+ ".html";
        fs.exists(match, function(exists) {
                if(exists) {
                        fs.readFile(match, function(err, d) {
                                if(err)
                                   res.end(errorPage.toString(), 'utf-8');
                                else
                                   res.end(d, 'utf-8');
                        });
                }
                else {
                        res.end(errorPage.toString(), 'utf-8');
                }
        });
});

app.use('/', r);

http.createServer(app).listen(port, function() {
        console.log("Listening on port 5000");
})


text:
using namespace flink;
using namespace eeros::hal;
using namespace eeros;

Pwm::Pwm(std::string id,
				   void* libHandle,
				   std::string device,
				   uint32_t subDeviceNumber,
				   uint32_t channel,
				   double scale,
				   double offset,
				   double rangeMin,
				   double rangeMax,
				   std::string unit
	) : ScalableOutput<double>(id, libHandle, scale, offset, rangeMin, rangeMax, unit), channel(channel) {

	FlinkDevice *dev = FlinkDevice::getDevice(device);
	subdeviceHandle = flink_get_subdevice_by_id(dev->getDeviceHandle(), subDeviceNumber);
	uint16_t function = flink_subdevice_get_function(subdeviceHandle);
	if (function != PWM_INTERFACE_ID) throw Fault("flink invalid subdevice number " + std::to_string(subDeviceNumber) + ", not a PWM subdevice");
	flink_pwm_get_baseclock(subdeviceHandle, &baseFrequency);
	if (channel < 0 || channel >= flink_subdevice_get_nofchannels(subdeviceHandle)) throw Fault("flink PWM subdevice, invalid channel number " + std::to_string(channel));
}

double Pwm::get() {
	uint32_t period, hightime;
	flink_pwm_get_period(subdeviceHandle, channel, &period);
	flink_pwm_get_hightime(subdeviceHandle, channel, &hightime);
	return (double)hightime / period;
}

void Pwm::set(double dutyCycle) {
	setDutyCycle(dutyCycle);
}

void Pwm::setFrequency(double f) {
	pwmFrequency = f;
	flink_pwm_set_period(subdeviceHandle, channel, (uint32_t)(baseFrequency / pwmFrequency));
}

void Pwm::setDutyCycle(double d) {
	if(d < 0.0) d = 0.0;
	if(d > 1.0) d = 1.0;
	flink_pwm_set_hightime(subdeviceHandle, channel, (uint32_t)(baseFrequency / pwmFrequency * d));
}

extern "C"{
	eeros::hal::ScalableOutput<double> *createPwm(std::string id, void *libHandle, std::string device, uint32_t subDeviceNumber, uint32_t channel,
						      double scale, double offset, double rangeMin, double rangeMax, std::string unit){
		return new flink::Pwm(id, libHandle, device, subDeviceNumber, channel, scale, offset, rangeMin, rangeMax, unit);
	}

	void setPwmFrequency(Pwm *obj, double f){
		obj->setFrequency(f);
	}

	void setPwmDutyCycle(Pwm *obj, double d){
		obj->setDutyCycle(d);
	}
}