text:
package it.cnr.isti.zigbee.zcl.library.impl.core;

import it.cnr.isti.zigbee.zcl.library.api.core.Command;
import it.cnr.isti.zigbee.zcl.library.api.core.ZCLHeader;
/**
 *
 * @author Stefano "Kismet" Lenzi
 * @author Francesco Furfari
 * @author Manlio Bacco
 * @version $LastChangedRevision$ ($LastChangedDate$)
 * @since 0.8.0
 *
 */
public class ZCLHeaderImpl implements ZCLHeader {

    private ZCLFrameControlImpl frameControl;
    private byte[] manufacturerId;
    private byte transactionId;
    private byte commandId;

    private Command cmd;
    private byte[] header;
    private byte[] frame;

    public ZCLHeaderImpl(Command cmd, boolean isDefaultResponseEnabled) {

        this.cmd = cmd;

        frameControl = new ZCLFrameControlImpl(cmd,isDefaultResponseEnabled);
        manufacturerId = cmd.getManufacturerId();
        transactionId = ZCLLayer.getTransactionId();
        commandId = cmd.getHeaderCommandId();

        header = createHeader();
    }

    private byte[] createHeader(){
        byte[] newHeader;
        if (cmd.isManufacturerExtension()){
            newHeader = new byte[5];
            newHeader[0] = frameControl.toByte();
            newHeader[1] = manufacturerId[0];
            newHeader[2] = manufacturerId[1];
            newHeader[3] = transactionId;
            newHeader[4] = commandId;
        }
        else {
            newHeader = new byte[3];
            newHeader[0] = frameControl.toByte();
            newHeader[1] = transactionId;
            newHeader[2] = commandId;
        }
        return newHeader;
    }

    public ZCLHeaderImpl(byte[] frame) {
        this.frame = frame;
        frameControl = new ZCLFrameControlImpl(frame[0]);
        header = copyHeader(frameControl.isManufacturerExtension());
    }

    private byte[] copyHeader(boolean extendedHeader) {
        byte[] resultHeader;
        if(extendedHeader){
            resultHeader = new byte[5];
            System.arraycopy(frame, 0, resultHeader, 0, 5);
            manufacturerId = new byte[2];
            manufacturerId[0] = resultHeader[1];
            manufacturerId[1] = resultHeader[2];
            transactionId = resultHeader[3];
            commandId = resultHeader[4];
        } else{
            resultHeader = new byte[3];
            System.arraycopy(frame, 0, resultHeader, 0, 3);
            transactionId = resultHeader[1];
            commandId = resultHeader[2];
        }
        return resultHeader;
    }

    /* (non-Javadoc)
     * @see it.cnr.isti.zigbee.zcl.library.impl.core.ZCLHeaderInterface#getFramecontrol()
     */
    public ZCLFrameControlImpl getFramecontrol(){
        return frameControl;
    }

    /* (non-Javadoc)
     * @see it.cnr.isti.zigbee.zcl.library.impl.core.ZCLHeaderInterface#getManufacturerId()
     */
    public byte[] getManufacturerId() {
        return manufacturerId;
    }

    /* (non-Javadoc)
     * @see it.cnr.isti.zigbee.zcl.library.impl.core.ZCLHeaderInterface#getTransactionId()
     */
    public byte getTransactionId() {
        return transactionId;
    }

    /* (non-Javadoc)
     * @see it.cnr.isti.zigbee.zcl.library.impl.core.ZCLHeaderInterface#getCommandId()
     */
    public byte	 getCommandId() {
        return commandId;
    }

    public byte[] toByte() {
        return header;
    }

    public int size(){
        return toByte().length;
    }
}


text:
A Template is a [[Pragma]] which the engine uses to populate other [[Pragma]] instances. Any [[Pragma]] can be used as a Template (which is how "strong copies" are made).

Most Templates, however, possess special wiring to allow for signaling [[Actions|Action]] on the destination [[Pragma]] after construction.

## Uses

These are the different use cases I've come up with, in relative priority order:

1. Populate a new Pragma with some data to allow easy "cookie cutter" copies of similar objects. This is modeling the "class" concept.

2. Allow updating existing Pragma objects with new functionality from a new plugin added into the simulation. The plugin would have [[matchers|Matcher Pattern]] to determine which Pragma to update with what values, and it needs to know whether to override the existing value or keep the existing value or use some combination of them.

3. Add new behavior to an existing Pragma based on a state change.  For example, a wooden doll comes to live with a magic spell, causing it to now become an active member of the simulation. The Pragma itself didn't change, and there's no need to go through the hassle of reconnecting all the links.

4. Create a copy of an existing Pragma, so that concepts like, "split a pile of 37,656 leaves into 2 piles" can be trivial to solve.

## Invocation

The invocation to perform the copy takes an optional Pragma that defines the list of attributes to copy by value (creating hard links). This allows for a two-pass copy to perform the necessary actions; the first is copying a "filter" pragma that has a link to the original object, and all the additional function linking via values, and the second is copying the filter pragma onto the destination. The original will need to be a weak "predictive" copy, to make sure it retains the original values. For a full copy to take place would require multiple runs through the computation chain within a single cycle.

## Templates as Classes and Mixins

A Template can be used to have similar functionality to a Class or Mixin concept. The Template provides data fields (default Attributes) and methods (Actions and Functions) for the new instance.

The _convention_ to using Templates which require a programmatic behavior uses an Attribute ("AddedTemplates") - a set of Strings - which contains all the global IDs of the Templates which copied themselves into the [[Pragma]], and they add a bound Action to that Attribute that performs the initialization when it changes value, which will always be triggered after copying in a Template. The initializer should remove itself at the end of the action to ensure another Template copy doesn't trigger it again.

## Plugin vs. Patching

Templates also allow for installing extensions and patches into an existing simulation. A Plugin package refers to a bundle that contains new behaviours or additional interactions to the simulation. A Patch refers to updates to existing interactions and behaviours to remove issues or enhance existing functionality.

redpajama_set_name: RedPajamaGithub


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"
    android:paddingBottom="5dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        android:id="@+id/carName"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/carRegistrationNumber"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/carSeats"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/dash_separator"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/carDoors"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/dash_separator"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/carTransmission"/>
    </LinearLayout>
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/carStatus"/>
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="end"
        android:id="@+id/carPricePerDay"/>
</LinearLayout>


text:
<?php

/**
 * This is the model class for table "comments_user".
 *
 * The followings are the available columns in table 'comments_user':
 * @property integer $id
 * @property integer $id_user
 * @property integer $id_comments
 * @property integer $like
 */
class CommentsUser extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'comments_user';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_user, id_comments, like', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id, id_user, id_comments, like', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'id_user' => 'Id User',
			'id_comments' => 'Id Comments',
			'like' => 'Like',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('id_user',$this->id_user);
		$criteria->compare('id_comments',$this->id_comments);
		$criteria->compare('like',$this->like);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return CommentsUser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}


text:
layout: post
title: "Hello World"
date: 2017-09-22 23:10:45 -0700
categories: grouchy
#thumbnail: /images/comics/thumbs/
facebook_type:
facebook_image: /images/comics/grouchy-1.png
---

{% include figure.html src="grouchy-1.png" alt="Monday.." %}


text:
using System;

namespace Skutt.Contract
{
    public class PreconditionFailedException : Exception
    {
        public PreconditionFailedException(string message) : base(message)
        {
        }
    }
}


text:
<?php
namespace Ens\JobeetBundle\DataFixtures\ORM;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Ens\JobeetBundle\Entity\Category;

class LoadCategoryData extends AbstractFixture implements OrderedFixtureInterface
{
    public function load(ObjectManager $em)
    {
        $design = new Category();
        $design->setName('Design');

        $programming = new Category();
        $programming->setName('Programming');

        $manager = new Category();
        $manager->setName('Manager');

        $administrator = new Category();
        $administrator->setName('Administrator');

        $em->persist($design);
        $em->persist($programming);
        $em->persist($manager);
        $em->persist($administrator);

        $em->flush();

        $this->addReference('category-design', $design);
        $this->addReference('category-programming', $programming);
        $this->addReference('category-manager', $manager);
        $this->addReference('category-administrator', $administrator);
    }

    public function getOrder()
    {
        return 1; // the order in which fixtures will be loaded
    }
}


text:
#include "omap_drv.h"

#include "drm_crtc.h"
#include "drm_fb_helper.h"

MODULE_PARM_DESC(ywrap, "Enable ywrap scrolling (omap44xx and later, default 'y')");
static bool ywrap_enabled = true;
module_param_named(ywrap, ywrap_enabled, bool, 0644);

/*
 * fbdev funcs, to implement legacy fbdev interface on top of drm driver
 */

#define to_omap_fbdev(x) container_of(x, struct omap_fbdev, base)

struct omap_fbdev {
	struct drm_fb_helper base;
	struct drm_framebuffer *fb;
	struct drm_gem_object *bo;
	bool ywrap_enabled;

	/* for deferred dmm roll when getting called in atomic ctx */
	struct work_struct work;
};

static void omap_fbdev_flush(struct fb_info *fbi, int x, int y, int w, int h);
static struct drm_fb_helper *get_fb(struct fb_info *fbi);

static ssize_t omap_fbdev_write(struct fb_info *fbi, const char __user *buf,
		size_t count, loff_t *ppos)
{
	ssize_t res;

	res = fb_sys_write(fbi, buf, count, ppos);
	omap_fbdev_flush(fbi, 0, 0, fbi->var.xres, fbi->var.yres);

	return res;
}

static void omap_fbdev_fillrect(struct fb_info *fbi,
		const struct fb_fillrect *rect)
{
	sys_fillrect(fbi, rect);
	omap_fbdev_flush(fbi, rect->dx, rect->dy, rect->width, rect->height);
}

static void omap_fbdev_copyarea(struct fb_info *fbi,
		const struct fb_copyarea *area)
{
	sys_copyarea(fbi, area);
	omap_fbdev_flush(fbi, area->dx, area->dy, area->width, area->height);
}

static void omap_fbdev_imageblit(struct fb_info *fbi,
		const struct fb_image *image)
{
	sys_imageblit(fbi, image);
	omap_fbdev_flush(fbi, image->dx, image->dy,
				image->width, image->height);
}

static void pan_worker(struct work_struct *work)
{
	struct omap_fbdev *fbdev = container_of(work, struct omap_fbdev, work);
	struct fb_info *fbi = fbdev->base.fbdev;
	int npages;

	/* DMM roll shifts in 4K pages: */
	npages = fbi->fix.line_length >> PAGE_SHIFT;
	omap_gem_roll(fbdev->bo, fbi->var.yoffset * npages);
}

static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
		struct fb_info *fbi)
{
	struct drm_fb_helper *helper = get_fb(fbi);
	struct omap_fbdev *fbdev = to_omap_fbdev(helper);

	if (!helper)
		goto fallback;

	if (!fbdev->ywrap_enabled)
		goto fallback;

	if (drm_can_sleep()) {
		pan_worker(&fbdev->work);
	} else {
		struct omap_drm_private *priv = helper->dev->dev_private;
		queue_work(priv->wq, &fbdev->work);
	}

	return 0;

fallback:
	return drm_fb_helper_pan_display(var, fbi);
}

static struct fb_ops omap_fb_ops = {
	.owner = THIS_MODULE,

	/* Note: to properly handle manual update displays, we wrap the
	 * basic fbdev ops which write to the framebuffer
	 */
	.fb_read = fb_sys_read,
	.fb_write = omap_fbdev_write,
	.fb_fillrect = omap_fbdev_fillrect,
	.fb_copyarea = omap_fbdev_copyarea,
	.fb_imageblit = omap_fbdev_imageblit,

	.fb_check_var = drm_fb_helper_check_var,
	.fb_set_par = drm_fb_helper_set_par,
	.fb_pan_display = omap_fbdev_pan_display,
	.fb_blank = drm_fb_helper_blank,
	.fb_setcmap = drm_fb_helper_setcmap,

	.fb_debug_enter = drm_fb_helper_debug_enter,
	.fb_debug_leave = drm_fb_helper_debug_leave,
};

static int omap_fbdev_create(struct drm_fb_helper *helper,
		struct drm_fb_helper_surface_size *sizes)
{
	struct omap_fbdev *fbdev = to_omap_fbdev(helper);
	struct drm_device *dev = helper->dev;
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_framebuffer *fb = NULL;
	union omap_gem_size gsize;
	struct fb_info *fbi = NULL;
	struct drm_mode_fb_cmd2 mode_cmd = {0};
	dma_addr_t paddr;
	int ret;

	/* only doing ARGB32 since this is what is needed to alpha-blend
	 * with video overlays:
	 */
	sizes->surface_bpp = 32;
	sizes->surface_depth = 32;

	DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
			sizes->surface_height, sizes->surface_bpp,
			sizes->fb_width, sizes->fb_height);

	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
			sizes->surface_depth);

	mode_cmd.width = sizes->surface_width;
	mode_cmd.height = sizes->surface_height;

	mode_cmd.pitches[0] = align_pitch(
			mode_cmd.width * ((sizes->surface_bpp + 7) / 8),
			mode_cmd.width, sizes->surface_bpp);

	fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
	if (fbdev->ywrap_enabled) {
		/* need to align pitch to page size if using DMM scrolling */
		mode_cmd.pitches[0] = ALIGN(mode_cmd.pitches[0], PAGE_SIZE);
	}

	/* allocate backing bo */
	gsize = (union omap_gem_size){
		.bytes = PAGE_ALIGN(mode_cmd.pitches[0] * mode_cmd.height),
	};
	DBG("allocating %d bytes for fb %d", gsize.bytes, dev->primary->index);
	fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT | OMAP_BO_WC);
	if (!fbdev->bo) {
		dev_err(dev->dev, "failed to allocate buffer object\n");
		ret = -ENOMEM;
		goto fail;
	}

	fb = omap_framebuffer_init(dev, &mode_cmd, &fbdev->bo);
	if (IS_ERR(fb)) {
		dev_err(dev->dev, "failed to allocate fb\n");
		/* note: if fb creation failed, we can't rely on fb destroy
		 * to unref the bo:
		 */
		drm_gem_object_unreference(fbdev->bo);
		ret = PTR_ERR(fb);
		goto fail;
	}

	/* note: this keeps the bo pinned.. which is perhaps not ideal,
	 * but is needed as long as we use fb_mmap() to mmap to userspace
	 * (since this happens using fix.smem_start).  Possibly we could
	 * implement our own mmap using GEM mmap support to avoid this
	 * (non-tiled buffer doesn't need to be pinned for fbcon to write
	 * to it).  Then we just need to be sure that we are able to re-
	 * pin it in case of an opps.
	 */
	ret = omap_gem_get_paddr(fbdev->bo, &paddr, true);
	if (ret) {
		dev_err(dev->dev, "could not map (paddr)!\n");
		ret = -ENOMEM;
		goto fail;
	}

	mutex_lock(&dev->struct_mutex);

	fbi = framebuffer_alloc(0, dev->dev);
	if (!fbi) {
		dev_err(dev->dev, "failed to allocate fb info\n");
		ret = -ENOMEM;
		goto fail_unlock;
	}

	DBG("fbi=%p, dev=%p", fbi, dev);

	fbdev->fb = fb;
	helper->fb = fb;
	helper->fbdev = fbi;

	fbi->par = helper;
	fbi->flags = FBINFO_DEFAULT;
	fbi->fbops = &omap_fb_ops;

	strcpy(fbi->fix.id, MODULE_NAME);

	ret = fb_alloc_cmap(&fbi->cmap, 256, 0);
	if (ret) {
		ret = -ENOMEM;
		goto fail_unlock;
	}

	drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
	drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);

	dev->mode_config.fb_base = paddr;

	fbi->screen_base = omap_gem_vaddr(fbdev->bo);
	fbi->screen_size = fbdev->bo->size;
	fbi->fix.smem_start = paddr;
	fbi->fix.smem_len = fbdev->bo->size;

	/* if we have DMM, then we can use it for scrolling by just
	 * shuffling pages around in DMM rather than doing sw blit.
	 */
	if (fbdev->ywrap_enabled) {
		DRM_INFO("Enabling DMM ywrap scrolling\n");
		fbi->flags |= FBINFO_HWACCEL_YWRAP | FBINFO_READS_FAST;
		fbi->fix.ywrapstep = 1;
	}

	DBG("par=%p, %dx%d", fbi->par, fbi->var.xres, fbi->var.yres);
	DBG("allocated %dx%d fb", fbdev->fb->width, fbdev->fb->height);

	mutex_unlock(&dev->struct_mutex);

	return 0;

fail_unlock:
	mutex_unlock(&dev->struct_mutex);
fail:

	if (ret) {
		if (fbi)
			framebuffer_release(fbi);
		if (fb)
			fb->funcs->destroy(fb);
	}

	return ret;
}

static void omap_crtc_fb_gamma_set(struct drm_crtc *crtc,
		u16 red, u16 green, u16 blue, int regno)
{
	DBG("fbdev: set gamma");
}

static void omap_crtc_fb_gamma_get(struct drm_crtc *crtc,
		u16 *red, u16 *green, u16 *blue, int regno)
{
	DBG("fbdev: get gamma");
}

static int omap_fbdev_probe(struct drm_fb_helper *helper,
		struct drm_fb_helper_surface_size *sizes)
{
	int new_fb = 0;
	int ret;

	if (!helper->fb) {
		ret = omap_fbdev_create(helper, sizes);
		if (ret)
			return ret;
		new_fb = 1;
	}
	return new_fb;
}

static struct drm_fb_helper_funcs omap_fb_helper_funcs = {
	.gamma_set = omap_crtc_fb_gamma_set,
	.gamma_get = omap_crtc_fb_gamma_get,
	.fb_probe = omap_fbdev_probe,
};

static struct drm_fb_helper *get_fb(struct fb_info *fbi)
{
	if (!fbi || strcmp(fbi->fix.id, MODULE_NAME)) {
		/* these are not the fb's you're looking for */
		return NULL;
	}
	return fbi->par;
}

/* flush an area of the framebuffer (in case of manual update display that
 * is not automatically flushed)
 */
static void omap_fbdev_flush(struct fb_info *fbi, int x, int y, int w, int h)
{
	struct drm_fb_helper *helper = get_fb(fbi);

	if (!helper)
		return;

	VERB("flush fbdev: %d,%d %dx%d, fbi=%p", x, y, w, h, fbi);

	omap_framebuffer_flush(helper->fb, x, y, w, h);
}

/* initialize fbdev helper */
struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct omap_fbdev *fbdev = NULL;
	struct drm_fb_helper *helper;
	int ret = 0;

	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
	if (!fbdev) {
		dev_err(dev->dev, "could not allocate fbdev\n");
		goto fail;
	}

	INIT_WORK(&fbdev->work, pan_worker);

	helper = &fbdev->base;

	helper->funcs = &omap_fb_helper_funcs;

	ret = drm_fb_helper_init(dev, helper,
			priv->num_crtcs, priv->num_connectors);
	if (ret) {
		dev_err(dev->dev, "could not init fbdev: ret=%d\n", ret);
		goto fail;
	}

	drm_fb_helper_single_add_all_connectors(helper);
	drm_fb_helper_initial_config(helper, 32);

	priv->fbdev = helper;

	return helper;

fail:
	kfree(fbdev);
	return NULL;
}

void omap_fbdev_free(struct drm_device *dev)
{
	struct omap_drm_private *priv = dev->dev_private;
	struct drm_fb_helper *helper = priv->fbdev;
	struct omap_fbdev *fbdev;
	struct fb_info *fbi;

	DBG();

	fbi = helper->fbdev;

	unregister_framebuffer(fbi);
	framebuffer_release(fbi);

	drm_fb_helper_fini(helper);

	fbdev = to_omap_fbdev(priv->fbdev);

	/* this will free the backing object */
	if (fbdev->fb)
		fbdev->fb->funcs->destroy(fbdev->fb);

	kfree(fbdev);

	priv->fbdev = NULL;
}


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/Widget.CardContent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".view.issue.CommentListFragment">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view_comment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/text_empty_comments"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fontFamily="sans-serif-condensed"
        android:gravity="center_horizontal"
        android:text="@string/text_empty_comments"
        android:textAppearance="?android:textAppearanceLarge"
        app:layout_anchor="@id/recycler_view_comment"
        app:layout_anchorGravity="fill" />

</FrameLayout>


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

<!--

  Copyright 2009 moxter.net S.A.C.

  All Rights Reserved.
  This program contains proprietary and trade secret information of
  moxter.net S.A.C. Copyright notice is precautionary only and does not
  evidence any actual or intended publication of such program.

  Author:          moxter.net S.A.C.
  Revision:        $Rev$
  Last Changed:    $Date$
  Last Changed By: $Author$

-->

<access-set xmlns="http://www.efaps.org/xsd"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
    <uuid>fbe4e3f9-eb34-4e1f-a14a-4872a5a69ce6</uuid>
    <file-application>eFapsApp-Issues</file-application>
    <file-revision>$Rev$</file-revision>

    <definition>
        <version-expression>(version==latest)</version-expression>

        <name>Issues_Reader</name>

        <access-type>show</access-type>
        <access-type>read</access-type>
        <access-type>checkout</access-type>
        <access-type>statusBoost</access-type>

        <type>Issues_Ticket</type>

        <status group="Issues_TicketStatus">
            <key>Open</key>
            <key>Closed</key>
        </status>

        <role>Issues_Reader</role>
    </definition>
</access-set>


text:
import unittest

import mock

_FLASK_TRACE_ID = "flask0id"
_FLASK_SPAN_ID = "span0flask"
_FLASK_HTTP_REQUEST = {"requestUrl": "https://flask.palletsprojects.com/en/1.1.x/"}
_DJANGO_TRACE_ID = "django0id"
_DJANGO_SPAN_ID = "span0django"
_DJANGO_HTTP_REQUEST = {"requestUrl": "https://www.djangoproject.com/"}

class Test_get_request_data_from_flask(unittest.TestCase):
    @staticmethod
    def _call_fut():
        from google.cloud.logging_v2.handlers import _helpers

        http, trace, span, sampled = _helpers.get_request_data_from_flask()
        return http, trace, span, sampled

    @staticmethod
    def create_app():
        import flask

        app = flask.Flask(__name__)

        @app.route("/")
        def index():
            return "test flask trace"  # pragma: NO COVER

        return app

    def test_no_context_header(self):
        app = self.create_app()
        with app.test_request_context(path="/", headers={}):
            http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertIsNone(trace_id)
        self.assertIsNone(span_id)
        self.assertEqual(sampled, False)
        self.assertEqual(http_request["requestMethod"], "GET")

    def test_xcloud_header(self):
        flask_trace_header = "X_CLOUD_TRACE_CONTEXT"
        expected_trace_id = _FLASK_TRACE_ID
        expected_span_id = _FLASK_SPAN_ID
        flask_trace_id = f"{expected_trace_id}/{expected_span_id};o=1"

        app = self.create_app()
        context = app.test_request_context(
            path="/", headers={flask_trace_header: flask_trace_id}
        )

        with context:
            http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertEqual(trace_id, expected_trace_id)
        self.assertEqual(span_id, expected_span_id)
        self.assertEqual(sampled, True)
        self.assertEqual(http_request["requestMethod"], "GET")

    def test_traceparent_header(self):
        flask_trace_header = "TRACEPARENT"
        expected_trace_id = "4bf92f3577b34da6a3ce929d0e0e4736"
        expected_span_id = "00f067aa0ba902b7"
        flask_trace_id = f"00-{expected_trace_id}-{expected_span_id}-01"

        app = self.create_app()
        context = app.test_request_context(
            path="/", headers={flask_trace_header: flask_trace_id}
        )

        with context:
            http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertEqual(trace_id, expected_trace_id)
        self.assertEqual(span_id, expected_span_id)
        self.assertEqual(sampled, True)
        self.assertEqual(http_request["requestMethod"], "GET")

    def test_http_request_populated(self):
        expected_path = "http://testserver/123"
        expected_agent = "Mozilla/5.0"
        expected_referrer = "self"
        expected_ip = "10.1.2.3"
        headers = {
            "User-Agent": expected_agent,
            "Referer": expected_referrer,
        }

        app = self.create_app()
        with app.test_request_context(
            expected_path, headers=headers, environ_base={"REMOTE_ADDR": expected_ip}
        ):
            http_request, *_ = self._call_fut()

        self.assertEqual(http_request["requestMethod"], "GET")
        self.assertEqual(http_request["requestUrl"], expected_path)
        self.assertEqual(http_request["userAgent"], expected_agent)
        self.assertEqual(http_request["protocol"], "HTTP/1.1")

    def test_http_request_sparse(self):
        expected_path = "http://testserver/123"
        app = self.create_app()
        with app.test_request_context(expected_path):
            http_request, *_ = self._call_fut()
        self.assertEqual(http_request["requestMethod"], "GET")
        self.assertEqual(http_request["requestUrl"], expected_path)
        self.assertEqual(http_request["protocol"], "HTTP/1.1")

class Test_get_request_data_from_django(unittest.TestCase):
    @staticmethod
    def _call_fut():
        from google.cloud.logging_v2.handlers import _helpers

        http, trace, span, sampled = _helpers.get_request_data_from_django()
        return http, trace, span, sampled

    def setUp(self):
        from django.conf import settings
        from django.test.utils import setup_test_environment

        if not settings.configured:
            settings.configure()
        setup_test_environment()

    def tearDown(self):
        from django.test.utils import teardown_test_environment
        from google.cloud.logging_v2.handlers.middleware import request

        teardown_test_environment()
        request._thread_locals.__dict__.clear()

    def test_no_context_header(self):
        from django.test import RequestFactory
        from google.cloud.logging_v2.handlers.middleware import request

        django_request = RequestFactory().get("/")

        middleware = request.RequestMiddleware(None)
        middleware(django_request)
        http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertEqual(http_request["requestMethod"], "GET")
        self.assertIsNone(trace_id)
        self.assertIsNone(span_id)
        self.assertEqual(sampled, False)

    def test_xcloud_header(self):
        from django.test import RequestFactory
        from google.cloud.logging_v2.handlers.middleware import request

        django_trace_header = "HTTP_X_CLOUD_TRACE_CONTEXT"
        expected_span_id = _DJANGO_SPAN_ID
        expected_trace_id = _DJANGO_TRACE_ID
        django_trace_id = f"{expected_trace_id}/{expected_span_id};o=1"

        django_request = RequestFactory().get(
            "/", **{django_trace_header: django_trace_id}
        )

        middleware = request.RequestMiddleware(None)
        middleware(django_request)
        http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertEqual(trace_id, expected_trace_id)
        self.assertEqual(span_id, expected_span_id)
        self.assertEqual(sampled, True)
        self.assertEqual(http_request["requestMethod"], "GET")

    def test_traceparent_header(self):
        from django.test import RequestFactory
        from google.cloud.logging_v2.handlers.middleware import request

        django_trace_header = "HTTP_TRACEPARENT"
        expected_trace_id = "4bf92f3577b34da6a3ce929d0e0e4736"
        expected_span_id = "00f067aa0ba902b7"
        header = f"00-{expected_trace_id}-{expected_span_id}-01"

        django_request = RequestFactory().get("/", **{django_trace_header: header})

        middleware = request.RequestMiddleware(None)
        middleware(django_request)
        http_request, trace_id, span_id, sampled = self._call_fut()

        self.assertEqual(trace_id, expected_trace_id)
        self.assertEqual(span_id, expected_span_id)
        self.assertEqual(sampled, True)
        self.assertEqual(http_request["requestMethod"], "GET")

    def test_http_request_populated(self):
        from django.test import RequestFactory
        from google.cloud.logging_v2.handlers.middleware import request

        expected_path = "http://testserver/123"
        expected_agent = "Mozilla/5.0"
        expected_referrer = "self"
        body_content = "test"
        django_request = RequestFactory().put(
            expected_path,
            data=body_content,
            HTTP_USER_AGENT=expected_agent,
            HTTP_REFERER=expected_referrer,
        )
        # ensure test passes even after request has been read
        # context: https://github.com/googleapis/python-logging/issues/159
        django_request.read()

        middleware = request.RequestMiddleware(None)
        middleware(django_request)
        http_request, *_ = self._call_fut()
        self.assertEqual(http_request["requestMethod"], "PUT")
        self.assertEqual(http_request["requestUrl"], expected_path)
        self.assertEqual(http_request["userAgent"], expected_agent)
        self.assertEqual(http_request["protocol"], "HTTP/1.1")

    def test_http_request_sparse(self):
        from django.test import RequestFactory
        from google.cloud.logging_v2.handlers.middleware import request

        expected_path = "http://testserver/123"
        django_request = RequestFactory().put(expected_path)
        middleware = request.RequestMiddleware(None)
        middleware(django_request)
        http_request, *_ = self._call_fut()
        self.assertEqual(http_request["requestMethod"], "PUT")
        self.assertEqual(http_request["requestUrl"], expected_path)
        self.assertEqual(http_request["protocol"], "HTTP/1.1")

class Test_get_request_data(unittest.TestCase):
    @staticmethod
    def _call_fut():
        from google.cloud.logging_v2.handlers import _helpers

        http, trace, span, sampled = _helpers.get_request_data()
        return http, trace, span, sampled

    def _helper(self, django_return, flask_return):
        django_patch = mock.patch(
            "google.cloud.logging_v2.handlers._helpers.get_request_data_from_django",
            return_value=django_return,
        )
        flask_patch = mock.patch(
            "google.cloud.logging_v2.handlers._helpers.get_request_data_from_flask",
            return_value=flask_return,
        )

        with django_patch as django_mock:
            with flask_patch as flask_mock:
                result = self._call_fut()

        return django_mock, flask_mock, result

    def test_from_django(self):
        django_expected = (
            _DJANGO_HTTP_REQUEST,
            _DJANGO_TRACE_ID,
            _DJANGO_SPAN_ID,
            False,
        )
        flask_expected = (None, None, None, False)
        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)
        self.assertEqual(output, django_expected)

        django_mock.assert_called_once_with()
        flask_mock.assert_not_called()

    def test_from_flask(self):
        django_expected = (None, None, None, False)
        flask_expected = (_FLASK_HTTP_REQUEST, _FLASK_TRACE_ID, _FLASK_SPAN_ID, False)

        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)
        self.assertEqual(output, flask_expected)

        django_mock.assert_called_once_with()
        flask_mock.assert_called_once_with()

    def test_from_django_and_flask(self):
        django_expected = (
            _DJANGO_HTTP_REQUEST,
            _DJANGO_TRACE_ID,
            _DJANGO_SPAN_ID,
            False,
        )
        flask_expected = (_FLASK_HTTP_REQUEST, _FLASK_TRACE_ID, _FLASK_SPAN_ID, False)

        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)

        # Django wins.
        self.assertEqual(output, django_expected)

        django_mock.assert_called_once_with()
        flask_mock.assert_not_called()

    def test_missing_http_request(self):
        flask_expected = (None, _FLASK_TRACE_ID, _FLASK_SPAN_ID, True)
        django_expected = (None, _DJANGO_TRACE_ID, _DJANGO_TRACE_ID, True)
        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)

        # function only returns trace if http_request data is present
        self.assertEqual(output, (None, None, None, False))

        django_mock.assert_called_once_with()
        flask_mock.assert_called_once_with()

    def test_missing_trace_id(self):
        flask_expected = (_FLASK_HTTP_REQUEST, None, None, False)
        django_expected = (None, _DJANGO_TRACE_ID, _DJANGO_SPAN_ID, True)
        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)

        # trace_id is optional
        self.assertEqual(output, flask_expected)

        django_mock.assert_called_once_with()
        flask_mock.assert_called_once_with()

    def test_missing_both(self):
        flask_expected = (None, None, None, False)
        django_expected = (None, None, None, False)
        django_mock, flask_mock, output = self._helper(django_expected, flask_expected)
        self.assertEqual(output, (None, None, None, False))

        django_mock.assert_called_once_with()
        flask_mock.assert_called_once_with()

    def test_wo_libraries(self):
        output = self._call_fut()
        self.assertEqual(output, (None, None, None, False))

class Test__parse_xcloud_trace(unittest.TestCase):
    @staticmethod
    def _call_fut(header):
        from google.cloud.logging_v2.handlers import _helpers

        trace, span, sampled = _helpers._parse_xcloud_trace(header)
        return trace, span, sampled

    def test_empty_header(self):
        header = ""
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertIsNone(trace_id)
        self.assertIsNone(span_id)
        self.assertEqual(sampled, False)

    def test_no_span(self):
        header = "12345"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, header)
        self.assertIsNone(span_id)
        self.assertEqual(sampled, False)

    def test_no_trace(self):
        header = "/12345"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertIsNone(trace_id)
        self.assertEqual(span_id, "12345")
        self.assertEqual(sampled, False)

    def test_with_span(self):
        expected_trace = "12345"
        expected_span = "67890"
        header = f"{expected_trace}/{expected_span}"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, expected_trace)
        self.assertEqual(span_id, expected_span)
        self.assertEqual(sampled, False)

    def test_with_extra_characters(self):
        expected_trace = "12345"
        expected_span = "67890"
        header = f"{expected_trace}/{expected_span};abc"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, expected_trace)
        self.assertEqual(span_id, expected_span)
        self.assertEqual(sampled, False)

    def test_with_explicit_no_sampled(self):
        expected_trace = "12345"
        expected_span = "67890"
        header = f"{expected_trace}/{expected_span};o=0"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, expected_trace)
        self.assertEqual(span_id, expected_span)
        self.assertEqual(sampled, False)

    def test_with__sampled(self):
        expected_trace = "12345"
        expected_span = "67890"
        header = f"{expected_trace}/{expected_span};o=1"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, expected_trace)
        self.assertEqual(span_id, expected_span)
        self.assertEqual(sampled, True)

class Test__parse_trace_parent(unittest.TestCase):
    @staticmethod
    def _call_fut(header):
        from google.cloud.logging_v2.handlers import _helpers

        trace, span, sampled = _helpers._parse_trace_parent(header)
        return trace, span, sampled

    def test_empty_header(self):
        header = ""
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertIsNone(trace_id)
        self.assertIsNone(span_id)
        self.assertEqual(sampled, False)

    def test_valid_header(self):
        header = "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, "0af7651916cd43dd8448eb211c80319c")
        self.assertEqual(span_id, "b7ad6b7169203331")
        self.assertEqual(sampled, True)

    def test_not_sampled(self):
        header = "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-00"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, "0af7651916cd43dd8448eb211c80319c")
        self.assertEqual(span_id, "b7ad6b7169203331")
        self.assertEqual(sampled, False)

    def test_sampled_w_other_flags(self):
        header = "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-09"
        trace_id, span_id, sampled = self._call_fut(header)
        self.assertEqual(trace_id, "0af7651916cd43dd8448eb211c80319c")
        self.assertEqual(span_id, "b7ad6b7169203331")
        self.assertEqual(sampled, True)

    def test_invalid_headers(self):
        invalid_headers = [
            "",
            "test"
            "ff-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",  # invalid version
            "00-00000000000000000000000000000000-b7ad6b7169203331-01",  # invalid trace
            "00-0af7651916cd43dd8448eb211c80319c-0000000000000000-01",  # invalid span
            "00-af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-00",
            "00-0af7651916cd43dd8448eb211c80319c-bad6b7169203331-00",
            "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-0",
            "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-",
            "00-0af7651916cd43dd8448eb211c80319c-00",
        ]
        for header in invalid_headers:
            trace_id, span_id, sampled = self._call_fut(header)
            self.assertIsNone(trace_id)
            self.assertIsNone(span_id)
            self.assertEqual(sampled, False)


text:
module TwitterAds

  # Generic container for API responses.
  class Response

    attr_reader :code,
                :headers,
                :raw_body,
                :body,
                :rate_limit_remaining,
                :rate_limit_reset

    # Creates a new Response object instance.
    #
    # @example
    #   response = Response.new(code, headers, body)
    #
    # @param code [String] The HTTP status code.
    # @param headers [Hash] A Hash object containing HTTP response headers.
    # @param body [String] The response body.
    #
    # @since 0.1.0
    #
    # @return [Response] The Response object instance.
    def initialize(code, headers, body)
      @code     = code.to_i
      @headers  = headers
      @raw_body = body

      # handle non-JSON responses
      begin
        @body = TwitterAds::Utils.symbolize!(MultiJson.load(body))
      rescue MultiJson::ParseError
        @body = raw_body
      end

      if headers.key?('x-rate-limit-reset')
        @rate_limit           = headers['x-rate-limit-limit'].first
        @rate_limit_remaining = headers['x-rate-limit-remaining'].first
        @rate_limit_reset     = headers['x-rate-limit-reset'].first.to_i
      elsif headers.key?('x-cost-rate-limit-reset')
        @rate_limit           = headers['x-cost-rate-limit-limit'].first
        @rate_limit_remaining = headers['x-cost-rate-limit-remaining'].first
        @rate_limit_reset     = Time.at(headers['x-cost-rate-limit-reset'].first.to_i)
      end

      self
    end

    # Returns an inspection string for the current Response instance.
    #
    # @example
    #   response.inspect
    #
    # @since 0.1.0
    #
    # @return [String] The inspection string.
    def inspect
      "#<#{self.class.name}:0x#{object_id} code=\"#{@code}\" error=\"#{error?}\">"
    end

    # Helper method for determining if the current Response contains an error.
    #
    # @return [Boolean] True or false indicating if this Response contains an error.
    def error?
      @error ||= (@code >= 400 && @code <= 599)
    end

  end

end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2011 Damien Bourdette
  ~
  ~ 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.
  -->

<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns="http://www.springframework.org/schema/security"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

    <http auto-config='false' use-expressions="true" create-session="never" pattern="/jsonapi/**" >
        <intercept-url pattern="/**" access="isAuthenticated()"/>
        <http-basic />
    </http>

    <http auto-config='false' use-expressions="true">
        <intercept-url pattern="/login" access="permitAll" />
        <intercept-url pattern="/favicon.ico" access="permitAll" />
        <intercept-url pattern="/bootstrap/**" access="permitAll" />
        <intercept-url pattern="/ace/**" access="permitAll" />
        <intercept-url pattern="/img/**" access="permitAll" />
        <intercept-url pattern="/css/**" access="permitAll" />
        <intercept-url pattern="/api/**" access="permitAll" />
        <intercept-url pattern="/imgapi/**" access="permitAll" />
        <intercept-url pattern="/**" access="isAuthenticated()"/>
        <form-login login-page="/login" />
        <logout logout-url="/logout" delete-cookies="" />
    </http>

    <authentication-manager>
        <authentication-provider ref="authenticationProvider" />
    </authentication-manager>

    <beans:bean id="authenticationProvider" class="com.github.dbourdette.otto.security.OttoAuthenticationProvider" />

</beans:beans>


text:
Vamos aprender mais algumas coisas nestes endereços:

Tutorial de Git
Markdown


text:
.. _install:

Installation
************

.. highlight:: console

Environment
===========

Due to the complexity of integrating geospatial/imageprocessing/scientific dependencies,
only recent Ubuntu and Homebrew environment are supported.

Binary Packages
===============

Install binary packages first::

     $ sudo apt-get install install
     >          python-dev \
     >          python-pip \
     >          libmemcachd-dev \
     >          libgdal-dev \
     >          python-gdal \
     >          imagemagick \
     >          libwebp-dev \
     >          libpng-dev \
     >          libjpeg-dev \
     >          libtiff-dev

GEOS/GDAL
~~~~~~~~~

For copyright reasons, `GDAL` debian package don't have some projection
data files included, this requires extra patching form source::

    $ wget http://download.osgeo.org/gdal/1.10.1/gdal-1.10.1.tar.gz
    $ tar x gdal-1.10.1.tar.gz
    $ sudo cp gdal-1.10.1/data/*extra.wkt /usr/share/gdal/1.10/

Mapnik
~~~~~~

For ``mapnik``, check their official installation_ manual.

    .. _installation: <https://github.com/mapnik/mapnik/wiki/UbuntuInstallation>

At the time of writing they provide pip distribution for python2.7 on
debian/homebrew enviroment::

    $ pip install mapnik

Python Dependency
=================

After grab the source code using Git or source package, run::

    $ pip install -rrequirements.txt
    $ pip install -rrequirements-dev.txt

Build and Test
==============

If you want running `stonemason` without installing you must build all
`Cython` extensions in place::

    $ python setup.py build_ext --inplace

`stonemason` uses `nose` for testing::

    $ nosetests
    ...
    ...
    Ran XXX tests in 15.23s
    OK

.. note::  The test suites expects a memcached server listens on localhost
    TCP 11121 port.

Document
========

Build html based document::

    $ cd docs
    $ make html

To build PDF version `textlive` is required::

    $ sudo apt-get install texlive texlive-latex-extra
    $ make latexpdf

Docker Image
============

A docker image with all dependencies installed is provided which can be used
to quickly build a sample tile map service::

    $ docker run -p 0.0.0.0:80:80 kotaimen/stonemason
    [2015-03-02 18:10:00 +0800] [43027] [INFO] Starting gunicorn 19.2.1
    [2015-03-02 18:10:00 +0800] [43027] [INFO] Listening at: http://0.0.0.0:7086 (43027)
    [2015-03-02 18:10:00 +0800] [43027] [INFO] Using worker: threads
    [2015-03-02 18:10:00 +0800] [43054] [INFO] Booting worker with pid: 43054


text:
class StatOperatingSystem < ActiveRecord::Base
  belongs_to :stat
end


text:
<!DOCTYPE html>

<meta content="text/html;charset=utf-8" http-equiv="content-type"/>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>pymel.core.general.exactWorldBoundingBox — PyMEL 1.0.7 documentation</title>
<link href="../../../_static/nature.css" rel="stylesheet" type="text/css"/>
<link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../index-2.html" rel="top" title="PyMEL 1.0.7 documentation"/>
<link href="../../pymel.core.general.html" rel="up" title="pymel.core.general"/>
<link href="pymel.core.general.format.html" rel="next" title="pymel.core.general.format"/>
<link href="pymel.core.general.evalDeferred.html" rel="prev" title="pymel.core.general.evalDeferred"/>
<link href="../../../../style/adsk.cpm.css" rel="stylesheet" type="text/css"/><meta content="expert" name="experiencelevel"/><meta content="programmer" name="audience"/><meta content="enable" name="user-comments"/><meta content="ENU" name="language"/><meta content="MAYAUL" name="product"/><meta content="2016" name="release"/><meta content="Customization" name="book"/><meta content="Maya-Tech-Docs" name="component"/><meta content="/view/MAYAUL/2016/ENU/" name="helpsystempath"/><meta content="04/03/2015" name="created"/><meta content="04/03/2015" name="modified"/><meta content="Navigation

 index

 modules |

 next |

 previous |
 PyMEL 1.0.7 documentation »
 pymel.core.general »

 pymel.core.general.exactWorldBoundingBox ¶

 exactWorldBoundingBox ( *args , **kwargs ) ¶
 This command figures out an exact-fit bounding box for the specified objects (or selected objects if none are specified)
This bounding box is always in world space.
 Flags:

 Long Name / Short Name
 Argument Types
 Properties..." name="description"/><meta content="__PyMel_generated_functions_pymel_core_general_pymel_core_general_exactWorldBoundingBox_html" name="topicid"/>

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.general »

pymel.core.general.exactWorldBoundingBox¶

<tt class="descname">exactWorldBoundingBox</tt><big>(</big>*args, **kwargs<big>)</big>¶

This command figures out an exact-fit bounding box for the specified objects (or selected objects if none are specified)
This bounding box is always in world space.

Flags:

<colgroup>
<col width="1%"></col>
<col width="61%"></col>
<col width="19%"></col>
<col width="19%"></col>
</colgroup>

Long Name / Short Name
Argument Types
Properties

<tt class="docutils literal">calculateExactly</tt> / <tt class="docutils literal">ce</tt>
bool

<tt class="docutils literal">ignoreInvisible</tt> / <tt class="docutils literal">ii</tt>
bool

Should the bounding box calculation include or exclude invisible objects?                         Flag can have multiple arguments, passed either as a tuple or a
list.

Derived from mel command <tt class="xref py py-obj docutils literal">maya.cmds.exactWorldBoundingBox</tt>

Example:

import pymel.core as pm

bbox = pm.exactWorldBoundingBox( 'sphere1', 'cube1', 'cone2')
print 'Bounding box ranges from: %f' % bbox[0], ', %f' % bbox[1], ', %f' % bbox[2],
print ' to %f' % bbox[3], ', %f' % bbox[4], ', %f' % bbox[5]

Previous topic

pymel.core.general.evalDeferred

Next topic

pymel.core.general.format

Core Modules

<tt class="xref">animation</tt>

<tt class="xref">effects</tt>

<tt class="xref">general</tt>

<tt class="xref">language</tt>

<tt class="xref">modeling</tt>

<tt class="xref">rendering</tt>

<tt class="xref">system</tt>

<tt class="xref">windows</tt>

Type Modules

<tt class="xref">datatypes</tt>

<tt class="xref">nodetypes</tt>

<tt class="xref">uitypes</tt>

Other Modules

<tt class="xref">plugins</tt>

<tt class="xref">mayautils</tt>

<tt class="xref">util</tt>

<tt class="xref">versions</tt>

<tt class="xref">tools</tt>

This Page

Show Source

Quick search

<form action="http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/search.html" class="search" method="get"></form>
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>

    Enter search terms or a module, class or function name.

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.general »

        © Copyright 2009, Chad Dombrova.
      Created using Sphinx 1.2.3.


text:
""" Module for interacting with VSphere
"""

import ssl

from pyVim.connect import Disconnect, SmartConnect
from pyVmomi import vim

class VSphereInvalidLogin(vim.fault.InvalidLogin):
    """ Login was invalid, could be user or password mismatch
    """
    pass

class VSphereClient:
    def __init__(self, credential, host, port=443):
        self.host = host
        self.port = port
        self.username = credential.username
        self.password = credential.password
        self.si = None
        self.content = None

    def login(self):
        context = None
        if hasattr(ssl, '_create_unverified_context'):
            context = ssl._create_unverified_context()

        self.si = SmartConnect(host=self.host,
                               user=self.username,
                               pwd=self.password,
                               port=self.port,
                               sslContext=context)
        self._retrieve_content()

    def disconnect(self):
        return Disconnect(self.si)

    def _retrieve_content(self):
        self.content = self.si.RetrieveContent()

    def _get_view_obj(self, vim_type):
        return self.content.viewManager.CreateContainerView(
            self.content.rootFolder,
            [vim_type],
            True)

    def get_hosts(self):
        view_obj = self._get_view_obj(vim.HostSystem)
        return [host for host in view_obj.view]

    def get_datacenters(self):
        view_obj = self._get_view_obj(vim.Datacenter)
        return [dc for dc in view_obj.view]


text:
```
________                 __  .__   ___.          .__  .__
\______ \   ____ _____ _/  |_|  |__\_ |__ _____  |  | |  |
 |    |  \_/ __ \\__  \\   __\  |  \| __ \\__  \ |  | |  |
 |    `   \  ___/ / __ \|  | |   Y  \ \_\ \/ __ \|  |_|  |__
/_______  /\___  >____  /__| |___|  /___  (____  /____/____/
        \/     \/     \/          \/    \/     \/
```

[![Deathball - PSX Game (Global Game Jam Barcelona 2017)](http://img.youtube.com/vi/tPisBxHv-cI/0.jpg)](http://www.youtube.com/watch?v=tPisBxHv-cI "Deathball - PSX Game (Global Game Jam Barcelona 2017")

Installation requirements:
* ePSXe emulator
* Game BIN/CUE: Go into "Bin" subfolder.

What is about the game:
The Death ball game is about two volleyballs fighting each other in a beach until one of them is dead.
To win a game you must push the opponent's volleyball through the spikes of the cactus located in each border of the level before the countdown finishes.

There are only two actions to make the opponent's ball move in the direction of the spikes.  The first of one is pushing him with your ball.
The second one is using the wind to make him moving there.

Keys used in the game:
control pad to move the ball, X button to bounce, R1 to make wind to the right direction, L1 to make wind to the left direction.

Installation guide:
* Download the ePSXe emulator.
* Configurate the emulator.
* Load the game image to the emulator.
* Play it and enjoy it.


text:
* Java
* Filezilla
* Integrative Genomics Viewer (IGV)
* Putty (for Windows only)

## Introduction to the data

* Introduction
	* dataset: http://www.datacarpentry.org/organization-genomics/01-introduction/
	* SRA: http://www.ncbi.nlm.nih.gov/sra?term=SRA026813
	* Click on first entry (ZDB30), All runs, RunInfo Table
	* downloads as SraRunTable.txt

* Planning for NGS projects
	* sample submission sheet: https://raw.githubusercontent.com/hbc/dc_2016_04/master/data/sample_submission.txt
		* What are some errors you can spot in the data? Typos, missing data, inconsistencies?
		* What improvements could be made to the choices in naming?
		* What are some errors in the spreadsheet that would be difficult to spot? Is there anyway you can test this?
	* metadata back from facility: https://raw.githubusercontent.com/hbc/dc_2016_04/master/data/sequencing_results_metadata.txt
		* How are these samples organized?
		* If you wanted to relate file names to the sample names submitted above (e.g. wild type…) could you do so?
		* What do the _R1/_R2 extensions mean in the file names?
		* What does the '.gz' extension on the filenames indicate?
		* What is the total file size - what challenges in downloading and sharing these data might exist?

## Cloud computing for genomics

* what is cloud computing?
	* on-demand, virtual computing (virtual machine, or cloud instance)
	* difference between remote and local
	* ask about previous experience
	* advantages: access, admin rights, preconfigured (BioLinux)
	* disadvantages: may cost $$$, may be difficult to obtain help
	* commercial: Amazon (using today), Google Cloud; open science: Atmosphere, JetStream
* logging in
	* Mac and Linux
		* terminal
		* ssh username@host
		* answer yes (first time)
		* enter password
	* Windows
		* putty
		* Host, dcuser, ps, port (22)
* data transfer
	* can download from URL using `wget URL`
	* can transfer using FileZilla (we'll do this later)
	* today the data and software we'll be using are already available on our custom cloud instance
	* quick download of some data files used today: http://www.datacarpentry.org/wrangling-genomics/variant_calling.tar.gz

## Introduction to the command line/shell

* Introduction and the file system
	* why use the shell?
	* how to access the shell
	* files and directories (slashes)
	* home and root directories
	* full and relative paths
	* cd
	* ls
	* man and --help
	* tab completion

* Project organization
	* mkdir
	* history
	* tail
	* | (pipe)
	* nano
	* make directories: ~/dc_workshop, containing docs, data, results
	* history

* Working with files
	* cat
	* head
	* tail
	* cp
	* mv
	* rm

* Redirection
	* grep (use -B1 -A2 for line before and two lines after)
	* `>` and `>>`
	* cut
	* sort

* Writing scripts
	* creating .sh
	* chmod

## Data wrangling and processing

* link to module: http://www.datacarpentry.org/wrangling-genomics/
* required software (preinstalled): http://www.datacarpentry.org/wrangling-genomics/setup/

* instructor setup:
	* make sure data are back in hidden folder: `mv ~/.dc_sampledata_lite/untrimmed_fastq/ ~/dc_workshop/data/`
	* have two ssh sessions open to show things
	* have short list of notes available for students to reference?
	* draw directory structure on board
	* open lesson webpage to show data formats and other figures

* describe variant calling
	* data types
	* main process
	* all software we'll use is already available on the cloud instance
	* in many cases, there are multiple ways to accomplish the same task
		* some are more efficient (use less typing)
		* we may skip running steps on all files and copy processed data over to save time
		* we'll use absolute paths for this lesson to minimize confusion (but relative paths can work too!)

* Quality control
	* cd (home directory)
	* move data to project directory: `mv ~/.dc_sampledata_lite/untrimmed_fastq/ ~/dc_workshop/data/`
	* change directory to data folder: `cd ~/dc_workshop/data/untrimmed_fastq/`
	* software used in this section represents software downloaded by a user
		* executable files can be found wherever you decide to place them
	* **FastQC:** https://www.bioinformatics.babraham.ac.uk/projects/fastqc/
	* run fastqc on untrimmed data: `~/FastQC/fastqc SRR097977.fastq`
	* can run on all untrimmed data with one command: `~/FastQC/fastqc *.fastq`
		* takes 4-5 minutes to run all (but don't need to run all)
		* in the meantime, discuss fasta/fastq format
	* directory for results: `mkdir ~/dc_workshop/results/fastqc_untrimmed_reads`
	* move results: `mv *.zip ~/dc_workshop/results/fastqc_untrimmed_reads/`, `mv *.html ~/dc_workshop/results/fastqc_untrimmed_reads/`
	* view results: change directory, try to unzip (`unzip *.zip`)
	* for loop: `for zip in *.zip; do unzip $zip; done`
	* save all results to file: `cat */summary.txt > ~/dc_workshop/docs/fastqc_summaries.txt`
	* **trimmomatic:** http://www.usadellab.org/cms/?page=trimmomatic
	* run with `java -jar ~/Trimmomatic-0.32/trimmomatic-0.32.jar SE SRR098283.fastq \
SRR098283.fastq_trim.fastq SLIDINGWINDOW:4:20 MINLEN:20`
	* write in for loop: `for infile in *.fastq; do outfile=$infile\_trim.fastq; java -jar ~/Trimmomatic-0.32/trimmomatic-0.32.jar SE $infile $outfile SLIDINGWINDOW:4:20 MINLEN:20; done`
		* takes 4-5 minutes to run all
		* in meantime, explain screen output, other options for trimming, can run FastQC on trimmed files to check
		* alternatively, copy already trimmed to directory: `mv ~/.dc_sampledata_lite/trimmed_fastq/ ~/dc_workshop/data/`
	* create new directory: `mkdir ~/dc_workshop/data/trimmmed_fastq`
	* move trimmed reads: `mv *_trim.fastq ~/dc_workshop/data/trimmed_fastq`

* Variant calling workflow
	* we'll work through one sequence sample, then talk about how to automate
	* software here is installed for computer, so path to executable does not need to be specified
	* start from `dc_workshop`: `cd ~/dc_workshop`
	* copy over reference genome data: `cp -r ~/.dc_sampledata_lite/ref_genome/ data/`
	* `mkdir results/sai results/sam results/bam results/bcf results/vcf`
	* **BWA:** http://bio-bwa.sourceforge.net/bwa.shtml
	* index reference: `bwa index data/ref_genome/ecoli_rel606.fasta`
	* align reads to reference: `bwa aln data/ref_genome/ecoli_rel606.fasta \
    data/trimmed_fastq/SRR097977.fastq_trim.fastq > results/sai/SRR097977.aligned.sai`
	* convert from SAI to SAM: `bwa samse data/ref_genome/ecoli_rel606.fasta \
    results/sai/SRR097977.aligned.sai \
    data/trimmed_fastq/SRR097977.fastq_trim.fastq > \
    results/sam/SRR097977.aligned.sam`
    * **samtools:** http://www.htslib.org/doc/samtools.html
    * convert SAM to BAM: `samtools view -S -b results/sam/SRR097977.aligned.sam > results/bam/SRR097977.aligned.bam`
    * sort BAM: `samtools sort results/bam/SRR097977.aligned.bam results/bam/SRR097977.aligned.sorted`
    * calculate read coverage: `samtools mpileup -g -f data/ref_genome/ecoli_rel606.fasta \
        results/bam/SRR097977.aligned.sorted.bam > results/bcf/SRR097977_raw.bcf`
    * **bcftools:** http://samtools.github.io/bcftools/bcftools.html
    * identify SNPs: `bcftools view -bvcg results/bcf/SRR097977_raw.bcf > results/bcf/SRR097977_variants.bcf`
    * filter SNPs: `bcftools view results/bcf/SRR097977_variants.bcf \ | /usr/share/samtools/vcfutils.pl varFilter - > results/vcf/SRR097977_final_variants.vcf`
    * overview vcf format: `less results/vcf/SRR097977_final_variants.vcf`
    * index BAM (required for visualization): `samtools index results/bam/SRR097977.aligned.sorted.bam`
    * transfer results files:
    	* use FileZilla: enter Host, dcuser, ps, port (22) for Quickconnect
	* will take awhile to download (fairly large files), can demo IGV in meantime
	* orient to windows: select Desktop on left, navigate in cloud on right
	* data/ref_genome/ecoli_rel606.fasta, results/bam/SRR097977.aligned.sorted.bam, results/bam/SRR097977.aligned.sorted.bam.bai, results/vcf/SRR097977_final_variants.vcf
	* mention transferring data to a cloud instance

* Visualizing with IGV
	* Genomes/Load genomes from file: load reference genome
	* File/Load from file: load .bam (make sure .bai is in same location as .bam)
	* File/Load from file: load .vcf
	* Dark blue = heterozygous, Cyan = homozygous variant, Grey = reference
	* Filtered entries are transparent

* Automating with shell scripting
	* script available in dc_sample_data/variant_calling.tar.gz
	* uncompress and expand tarball: `tar -xvf variant_calling.tar.gz`

* continuing to work on your own
	* files (data and software) will be found in different places on different computers
	* the hardest part is keeping track of files, including upload/download
	* document your work thoroughly: easiest way is through scripts


text:
[travis-image]: https://img.shields.io/travis/webtorrent/torrent-piece/master.svg
[travis-url]: https://travis-ci.org/webtorrent/torrent-piece
[npm-image]: https://img.shields.io/npm/v/torrent-piece.svg
[npm-url]: https://npmjs.org/package/torrent-piece
[downloads-image]: https://img.shields.io/npm/dm/torrent-piece.svg
[downloads-url]: https://npmjs.org/package/torrent-piece
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

### Torrent piece abstraction

[![Sauce Test Status](https://saucelabs.com/browser-matrix/torrent-piece.svg)](https://saucelabs.com/u/torrent-piece)

Also works in the browser with [browserify](http://browserify.org/)! This module is used by [WebTorrent](http://webtorrent.io) and [torrent-stream](https://npmjs.com/package/torrent-stream).

## install

```
npm install torrent-piece
```

## usage

```js
var Piece = require('torrent-piece')

Piece.BLOCK_LENGTH // 16384

var pieceLength = Piece.BLOCK_LENGTH * 5
var piece = new Piece(pieceLength)
piece.missing // 81920

piece.reserve() // 0
piece.set(0, someBuffer0)

piece.reserve() // 1
piece.reserve() // 2
piece.reserve() // 3

piece.set(1, someBuffer1)
piece.set(2, someBuffer2)
piece.set(3, someBuffer3)

piece.reserve() // 4
piece.cancel(4) // cancel the reservation of a chunk

piece.reserve() // 4 (given out again)
piece.set(4, someBuffer4)

// handy functions
piece.chunkLength(0) // 16384
piece.chunkOffset(0) // 0

// eventually, when no more chunks left...

piece.reserve() // -1 (signal that all chunks are reserved)
piece.missing // 0

var pieceBuffer = piece.flush()
console.log(pieceBuffer)
```

## license

MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org) and [WebTorrent, LLC](https://webtorrent.io).


text:
/*

    IMPORTANT! This file is auto-generated each time you save your
    project - if you alter its contents, your changes may be overwritten!

    This is the header file that your files should include in order to get all the
    JUCE library headers. You should avoid including the JUCE headers directly in
    your own source files, because that wouldn't pick up the correct configuration
    options for your app.

*/

#pragma once

#include "AppConfig.h"

#include <danlin_fontawesome/danlin_fontawesome.h>
#include <danlin_oscpack/danlin_oscpack.h>
#include <danlin_oscserver/danlin_oscserver.h>
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_audio_devices/juce_audio_devices.h>
#include <juce_audio_formats/juce_audio_formats.h>
#include <juce_audio_plugin_client/juce_audio_plugin_client.h>
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_audio_utils/juce_audio_utils.h>
#include <juce_core/juce_core.h>
#include <juce_data_structures/juce_data_structures.h>
#include <juce_events/juce_events.h>
#include <juce_graphics/juce_graphics.h>
#include <juce_gui_basics/juce_gui_basics.h>
#include <juce_gui_extra/juce_gui_extra.h>
#include <stk_core/stk_core.h>
#include <stk_generators/stk_generators.h>

#if defined (JUCE_PROJUCER_VERSION) && JUCE_PROJUCER_VERSION < JUCE_VERSION
 /** If you've hit this error then the version of the Projucer that was used to generate this project is
     older than the version of the JUCE modules being included. To fix this error, re-save your project
     using the latest version of the Projucer or, if you aren't using the Projucer to manage your project,
     remove the JUCE_PROJUCER_VERSION define from the AppConfig.h file.
 */
 #error "This project was last saved using an outdated version of the Projucer! Re-save this project with the latest version to fix this error."
#endif

#if ! DONT_SET_USING_JUCE_NAMESPACE
 // If your code uses a lot of JUCE classes, then this will obviously save you
 // a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE.
 using namespace juce;
#endif

#if ! JUCE_DONT_DECLARE_PROJECTINFO
namespace ProjectInfo
{
    const char* const  projectName    = "Soundboard";
    const char* const  companyName    = "Ultraschall";
    const char* const  versionString  = "4.0.0";
    const int          versionNumber  = 0x40000;
}
#endif


text:
/* CVS $Id: $ */
package com.epimorphics.vocabs;
import com.hp.hpl.jena.rdf.model.*;

/**
 * Vocabulary definitions from src/main/vocabs/dsapi.ttl
 * @author Auto-generated by schemagen on 15 Aug 2013 16:42
 */
public class Dsapi {
    /**
The RDF model that holds the vocabulary terms
 */
    private static Model m_model = ModelFactory.createDefaultModel();

    /**
The namespace of the vocabulary as a string
 */
    public static final String NS = "http://www.epimorphics.com/public/vocabulary/dsapi#";

    /**
The namespace of the vocabulary as a string

     *  @see #NS */
    public static String getURI() {return NS;}

    /**
The namespace of the vocabulary as a resource
 */
    public static final Resource NAMESPACE = m_model.createResource( NS );

    /**
Indicates a meaningful collection of terms from a concept scheme
 */
    public static final Property collection = m_model.createProperty( "http://www.epimorphics.com/public/vocabulary/dsapi#collection" );

    /**
Lowest value expected for a measure or other cube component
 */
    public static final Property lowerBound = m_model.createProperty( "http://www.epimorphics.com/public/vocabulary/dsapi#lowerBound" );

    /**
Highest value expected for a measure or other cube component
 */
    public static final Property upperBound = m_model.createProperty( "http://www.epimorphics.com/public/vocabulary/dsapi#upperBound" );

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure;
using Azure.AI.FormRecognizer;
using Azure.Core.Extensions;

namespace Microsoft.Extensions.Azure
{
    /// <summary>
    /// Extension methods to add <see cref="FormRecognizerClient"/> client to clients builder.
    /// </summary>
    public static class FormRecognizerClientBuilderExtensions
    {
        /// <summary>
        /// Registers a <see cref="FormRecognizerClient"/> instance with the provided <paramref name="endpoint"/>.
        /// </summary>
        public static IAzureClientBuilder<FormRecognizerClient, FormRecognizerClientOptions> AddFormRecognizerClient<TBuilder>(this TBuilder builder, Uri endpoint)
            where TBuilder : IAzureClientFactoryBuilderWithCredential
        {
            return builder.RegisterClientFactory<FormRecognizerClient, FormRecognizerClientOptions>((options, credential) => new FormRecognizerClient(endpoint, credential, options));
        }

        /// <summary>
        /// Registers a <see cref="FormRecognizerClient"/> instance with the provided <paramref name="endpoint"/> and <paramref name="credential"/>.
        /// </summary>
        public static IAzureClientBuilder<FormRecognizerClient, FormRecognizerClientOptions> AddFormRecognizerClient<TBuilder>(this TBuilder builder, Uri endpoint, AzureKeyCredential credential)
            where TBuilder : IAzureClientFactoryBuilder
        {
            return builder.RegisterClientFactory<FormRecognizerClient, FormRecognizerClientOptions>(options => new FormRecognizerClient(endpoint, credential, options));
        }

        /// <summary>
        /// Registers a <see cref="FormRecognizerClient"/> instance with connection options loaded from the provided <paramref name="configuration"/> instance.
        /// </summary>
        public static IAzureClientBuilder<FormRecognizerClient, FormRecognizerClientOptions> AddFormRecognizerClient<TBuilder, TConfiguration>(this TBuilder builder, TConfiguration configuration)
            where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration>
        {
            return builder.RegisterClientFactory<FormRecognizerClient, FormRecognizerClientOptions>(configuration);
        }
    }
}


text:
import sbt._
import Keys._
import scala.util.Properties._

object ApplicationBuild extends Build {

  val appName = "tv-auth"
  val appVersion = envOrElse("TV_API_AUTH_VERSION", "999-SNAPSHOT")

  def unitFilter(name: String): Boolean = !integrationFilter(name) && !acceptanceFilter(name)
  def acceptanceFilter(name: String): Boolean = name contains "FeaturesRunner"
  def integrationFilter(name: String): Boolean = name contains "Int"

  lazy val IntTest = config("integration") extend(Test)
  lazy val AccTest = config("acceptance") extend (Test)

  val appDependencies = Seq(
    "org.mockito" % "mockito-core" % "1.9.5",
    "org.reactivemongo" %% "reactivemongo" % "0.10.0"
  )

  val buildSettings = Defaults.defaultSettings

  val main = play.Project(appName, appVersion, appDependencies)
    .settings(scalaSource in Test <<= baseDirectory(_ / "test/unit"),
      testOptions in Test := Seq(Tests.Filter(unitFilter)))

    .configs( IntTest )
    .settings(inConfig(IntTest)(Defaults.testSettings) : _*)
    .settings(scalaSource in Test <<= baseDirectory(_ / "test/unit"),
      testOptions in Test := Seq(Tests.Filter(unitFilter)),
      testOptions in IntTest := Seq(Tests.Filter(integrationFilter)))
    .settings(scalaSource in IntTest <<= baseDirectory(_ / "test/integration"))
    .settings(libraryDependencies ++= Seq("org.scalatestplus" % "play_2.10" % "1.0.0" % "test"))
    .settings(Keys.fork in (Test) := false)

    .configs(AccTest)
    .settings(testOptions in AccTest := Seq(Tests.Filter(acceptanceFilter)))
    .settings(inConfig(AccTest)(Defaults.testSettings): _*)
    .settings(scalaSource in AccTest <<= baseDirectory(_ / "test/acceptance"))
    .settings(libraryDependencies ++= Seq("org.scalatestplus" % "play_2.10" % "1.0.0" % "test",
    "info.cukes" %% "cucumber-scala" % "1.2.2" % "test",
    "info.cukes" % "cucumber-junit" % "1.2.2" % "test",
    "junit" % "junit" % "4.11" % "test",
    "org.mongodb" %% "casbah" % "2.7.3" % "test",
    "org.scalaj" %% "scalaj-http" % "1.1.4" % "test"))

}


text:
require 'sinatra/base'

module RackSkeleton
    class BaseRoute < Sinatra::Base
        # define some common "before" / "configure" settings, etc.
        configure do
            set :root, Settings.root_dir
        end
    end
end


text:
package org.onosproject.net.resource.impl;

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.core.Permission;
import org.onosproject.event.ListenerRegistry;
import org.onosproject.event.EventDeliveryService;
import org.onosproject.net.Link;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.resource.link.BandwidthResourceAllocation;
import org.onosproject.net.resource.link.BandwidthResourceRequest;
import org.onosproject.net.resource.link.DefaultLinkResourceAllocations;
import org.onosproject.net.resource.link.LambdaResource;
import org.onosproject.net.resource.link.LambdaResourceAllocation;
import org.onosproject.net.resource.link.LambdaResourceRequest;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceEvent;
import org.onosproject.net.resource.link.LinkResourceListener;
import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.resource.link.LinkResourceStore;
import org.onosproject.net.resource.link.LinkResourceStoreDelegate;
import org.onosproject.net.resource.link.MplsLabel;
import org.onosproject.net.resource.link.MplsLabelResourceAllocation;
import org.onosproject.net.resource.link.MplsLabelResourceRequest;
import org.onosproject.net.resource.ResourceAllocation;
import org.onosproject.net.resource.ResourceRequest;
import org.onosproject.net.resource.ResourceType;
import org.slf4j.Logger;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onosproject.security.AppGuard.checkPermission;

/**
 * Provides basic implementation of link resources allocation.
 */
@Component(immediate = true)
@Service
public class LinkResourceManager implements LinkResourceService {

    private final Logger log = getLogger(getClass());

    protected final ListenerRegistry<LinkResourceEvent, LinkResourceListener>
            listenerRegistry = new ListenerRegistry<>();

    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
    private LinkResourceStore store;

    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
    protected EventDeliveryService eventDispatcher;

    @Activate
    public void activate() {
        eventDispatcher.addSink(LinkResourceEvent.class, listenerRegistry);
        log.info("Started");
    }

    @Deactivate
    public void deactivate() {
        log.info("Stopped");
    }

    /**
     * Returns available lambdas on specified link.
     *
     * @param link the link
     * @return available lambdas on specified link
     */
    private Set<LambdaResource> getAvailableLambdas(Link link) {
        checkNotNull(link);
        Set<ResourceAllocation> resAllocs = store.getFreeResources(link);
        if (resAllocs == null) {
            return Collections.emptySet();
        }
        Set<LambdaResource> lambdas = new HashSet<>();
        for (ResourceAllocation res : resAllocs) {
            if (res.type() == ResourceType.LAMBDA) {
                lambdas.add(((LambdaResourceAllocation) res).lambda());
            }
        }
        return lambdas;
    }

    /**
     * Returns available lambdas on specified links.
     *
     * @param links the links
     * @return available lambdas on specified links
     */
    private Iterable<LambdaResource> getAvailableLambdas(Iterable<Link> links) {
        checkNotNull(links);
        Iterator<Link> i = links.iterator();
        checkArgument(i.hasNext());
        Set<LambdaResource> lambdas = new HashSet<>(getAvailableLambdas(i.next()));
        while (i.hasNext()) {
            lambdas.retainAll(getAvailableLambdas(i.next()));
        }
        return lambdas;
    }

    /**
     * Returns available MPLS label on specified link.
     *
     * @param link the link
     * @return available MPLS labels on specified link
     */
    private Iterable<MplsLabel> getAvailableMplsLabels(Link link) {
        Set<ResourceAllocation> resAllocs = store.getFreeResources(link);
        if (resAllocs == null) {
            return Collections.emptySet();
        }
        Set<MplsLabel> mplsLabels = new HashSet<>();
        for (ResourceAllocation res : resAllocs) {
            if (res.type() == ResourceType.MPLS_LABEL) {

                mplsLabels.add(((MplsLabelResourceAllocation) res).mplsLabel());
            }
        }

        return mplsLabels;
    }

    @Override
    public LinkResourceAllocations requestResources(LinkResourceRequest req) {
        checkPermission(Permission.LINK_WRITE);

        // TODO Concatenate multiple bandwidth requests.
        // TODO Support multiple lambda resource requests.
        // TODO Throw appropriate exception.
        Set<ResourceAllocation> allocs = new HashSet<>();
        Map<Link, Set<ResourceAllocation>> allocsPerLink = new HashMap<>();
        for (ResourceRequest r : req.resources()) {
            switch (r.type()) {
            case BANDWIDTH:
                BandwidthResourceRequest br = (BandwidthResourceRequest) r;
                allocs.add(new BandwidthResourceAllocation(br.bandwidth()));
                break;
            case LAMBDA:
                Iterator<LambdaResource> lambdaIterator =
                        getAvailableLambdas(req.links()).iterator();
                if (lambdaIterator.hasNext()) {
                    allocs.add(new LambdaResourceAllocation(lambdaIterator.next()));
                } else {
                    log.info("Failed to allocate lambda resource.");
                    return null;
                }
                break;
            case MPLS_LABEL:
                for (Link link : req.links()) {
                    if (allocsPerLink.get(link) == null) {
                        allocsPerLink.put(link,
                                          new HashSet<ResourceAllocation>());
                    }
                    Iterator<MplsLabel> mplsIter = getAvailableMplsLabels(link)
                            .iterator();
                    if (mplsIter.hasNext()) {
                        allocsPerLink.get(link)
                                .add(new MplsLabelResourceAllocation(mplsIter
                                             .next()));
                    } else {
                        log.info("Failed to allocate MPLS resource.");
                        break;
                    }
                }
                break;
            default:
                break;
            }
        }

        Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
        for (Link link : req.links()) {
            allocations.put(link, new HashSet<ResourceAllocation>(allocs));
            Set<ResourceAllocation> linkAllocs = allocsPerLink.get(link);
            if (linkAllocs != null) {
                allocations.get(link).addAll(linkAllocs);
            }
        }
        LinkResourceAllocations result =
                new DefaultLinkResourceAllocations(req, allocations);
        store.allocateResources(result);
        return result;

    }

    @Override
    public void releaseResources(LinkResourceAllocations allocations) {
        checkPermission(Permission.LINK_WRITE);

        final LinkResourceEvent event = store.releaseResources(allocations);
        if (event != null) {
            post(event);
        }
    }

    @Override
    public LinkResourceAllocations updateResources(LinkResourceRequest req,
            LinkResourceAllocations oldAllocations) {
        checkPermission(Permission.LINK_WRITE);

        releaseResources(oldAllocations);
         return requestResources(req);
    }

    @Override
    public Iterable<LinkResourceAllocations> getAllocations() {
        checkPermission(Permission.LINK_READ);

        return store.getAllocations();
    }

    @Override
    public Iterable<LinkResourceAllocations> getAllocations(Link link) {
        checkPermission(Permission.LINK_READ);

        return store.getAllocations(link);
    }

    @Override
    public LinkResourceAllocations getAllocations(IntentId intentId) {
        checkPermission(Permission.LINK_READ);

        return store.getAllocations(intentId);
    }

    @Override
    public Iterable<ResourceRequest> getAvailableResources(Link link) {
        checkPermission(Permission.LINK_READ);

        Set<ResourceAllocation> freeRes = store.getFreeResources(link);
        Set<ResourceRequest> result = new HashSet<>();
        for (ResourceAllocation alloc : freeRes) {
            switch (alloc.type()) {
            case BANDWIDTH:
                result.add(new BandwidthResourceRequest(
                        ((BandwidthResourceAllocation) alloc).bandwidth()));
                break;
            case LAMBDA:
                result.add(new LambdaResourceRequest());
                break;
            case MPLS_LABEL:
                result.add(new MplsLabelResourceRequest());
                break;
            default:
                break;
            }
        }
        return result;
    }

    @Override
    public Iterable<ResourceRequest> getAvailableResources(Link link,
            LinkResourceAllocations allocations) {
        checkPermission(Permission.LINK_READ);

        Set<ResourceRequest> result = new HashSet<>();
        Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link);
        result = (Set<ResourceRequest>) getAvailableResources(link);
        result.addAll(allocatedRes);
        return result;
    }

    @Override
    public void addListener(LinkResourceListener listener) {
        checkPermission(Permission.LINK_EVENT);

        listenerRegistry.addListener(listener);
    }

    @Override
    public void removeListener(LinkResourceListener listener) {
        checkPermission(Permission.LINK_EVENT);

        listenerRegistry.removeListener(listener);
    }

    /**
     * Posts the specified event to the local event dispatcher.
     */
    private void post(LinkResourceEvent event) {
        if (event != null) {
            eventDispatcher.post(event);
        }
    }

    /**
     * Store delegate to re-post events emitted from the store.
     */
    private class InternalStoreDelegate implements LinkResourceStoreDelegate {
        @Override
        public void notify(LinkResourceEvent event) {
            post(event);
        }
    }
}


text:
<patTemplate:tmpl name="view_repeat_invoices">

  Back to client list

	{INVOICES} Invoices for {INVOICES_PERIOD} {CLIENT} New Invoice

  Ref
  Value
  Date
  Client
  Description
  View
  Delete
  Print

<patTemplate:link src="repeat_invoice_results" />

  Total:
  _HTML_CURENCY_SYMBOL_{TOTAL}

</patTemplate:tmpl>

<patTemplate:tmpl name="unpaid_repeat_invoices">

Back to client list

	{INVOICES} Unpaid Invoices

  Ref
  Value
  Date
  Client
  Description
  View
  Delete
  Print

<patTemplate:link src="repeat_invoice_results" />

  Total:
  _HTML_CURENCY_SYMBOL_{TOTAL}

Back to client list

</patTemplate:tmpl>

<patTemplate:tmpl name="repeat_invoice_results">

  {REFERENCE}
  _HTML_CURENCY_SYMBOL_{VALUE}
  {DATE}
  {CLIENT}
  {DESCRIPTION}

</patTemplate:tmpl>


text:
<?php

namespace Ardent;

use Ardent\Iterator\SlicingIterator;

interface Collection extends \Countable, \Traversable {

    /**
     * @return bool
     */
    function isEmpty();

    /**
     * @param callable $callback
     */
    function each(callable $callback);

    /**
     * @param callable $f
     * @return bool
     */
    function every(callable $f);

    /**
     * @param callable $map
     * @return Collection
     */
    function map(callable $map);

    /**
     * @param callable $filter
     * @return Collection
     */
    function where(callable $filter);

    /**
     * @param callable $compare
     * @return bool
     */
    function contains(callable $compare);

    /**
     * @param string $separator
     * @return string
     */
    function join($separator);

    /**
     * @param int $n
     * @return Collection
     */
    function limit($n);

    /**
     * @param callable $compare
     * @return mixed
     */
    function max(callable $compare = NULL);

    /**
     * @param callable $compare
     * @return mixed
     */
    function min(callable $compare = NULL);

    /**
     * @param callable $f
     * @return bool
     */
    function none(callable $f);

    /**
     * @param $initialValue
     * @param callable $combine
     * @return mixed
     */
    function reduce($initialValue, callable $combine);

    /**
     * @param int $n
     * @return Collection
     */
    function skip($n);

    /**
     * @param int $start
     * @param int $count
     * @return SlicingIterator
     */
    function slice($start, $count);

    /**
     * @param bool $preserveKeys
     * @return array
     */
    function toArray($preserveKeys = FALSE);

}


text:
function getAllDatasets(wrds, libname, outfolder, checksize, startfrom)
% GETALLDATASETS Download all data sets of a WRDS library as zipped CSV
%   GETALLDATASETS(CONN, LIBNAME, [OUTFOLDER], [CHECKSIZE])
%       Where CONN should be a valid WRDS connection and
%       LIBNAME should be a string with the SAS library,
%       e.g. 'CRSPA'.
%
%       Specify where to save the downloaded datasets in OUTFOLDER.
%       It defaults to fullfile(data, LIBNAME, datasetname.zip).
%
%       NOTE: an entire library can take up several GB on disk.
%             With CHECKSIZE set to true, first the size of library
%             is assessed and afterwards the user is asked
%             whether to proceed.
%
% Examples:
%   w = wrds('myusername');
%   w.getAllDatasets('crspa')
%
% See also: GETDATASET, GETDATASETINFO, GETFILE, WRDS, UNZIP, CSVREAD, READTABLE

COMPRESSION_FACTOR = 8;

if nargin < 3 || isempty(outfolder)
    outfolder = fullfile('data', upper(libname));
end
if nargin < 4 || isempty(checksize)
    checksize = false;
end
if nargin < 5 || isempty(startfrom)
    startfrom = 1;
end

if ~exist(outfolder,'dir')
    mkdir(outfolder)
end

dtnames = wrds.getDatasetNames(libname);

if isempty(dtnames)
    return
end

N = numel(dtnames);
if checksize
    fsizes = getAllDatasetFileSize(wrds, libname, 'gb');
    fsizes = cumsum(fsizes);

    % Confirm bulk download
    msg    = sprintf(['The estimated compressed size of the library is %.2f GB.\n',...
                      'Do you want to proceed?'], fsizes(end)/COMPRESSION_FACTOR);
    answer = questdlg(msg, 'Bulk download','Yes');
    if any(strcmpi(answer, {'No','Cancel'}))
        return
    end
end

% Switch verbosity off
verbosity      = wrds.isVerbose;
wrds.isVerbose = false;

h    = waitbar(0,'Retrieving datasets...');
pause(0.1)
msgh = getfield(getappdata(h,'TMWWaitbar_handles'),'axesTitle');
set(msgh,'Interpreter','none');

cleanup = onCleanup(@()myCleanup(wrds,verbosity,h));

for ii = startfrom:N
    % Update waitbar text
    libdtname = [libname, '.', dtnames{ii}];
    msg       = sprintf('Retrieving dataset ''%s''.',upper(libdtname));
    set(msgh,'String',msg);
    drawnow

    outfile = fullfile(outfolder, [dtnames{ii} '.zip']);
    getDataset(wrds, libdtname,outfile);

    % Update progress
    if checksize
        progress = fsizes(ii)/fsizes(end);
    else
        progress = ii/N;
    end
    waitbar(progress, h)
end
waitbar(1, h, 'Completed.')
end

function myCleanup(wrds,verbosity,hwait)
wrds.isVerbose = verbosity;
close(hwait)
end


text:
NAME=$(git log -n 1 --date=short --pretty="format:centos-ermine-1.2.x-%ad-%h")
if [ ! -z "$(git status --porcelain)" ]; then
	NAME="${NAME}~dirty"
fi
echo ${NAME}


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

<!--

   Copyright 2002  The Apache Software Foundation

   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.

-->
<!-- ========================================================================= -->
<!-- Courtesy of Max Froumentin. This document can be processed directly by    -->
<!-- the Squiggle browser which will apply the stylesheet (if the              -->
<!-- XMLInputHandler in  resources/META-INF/services/                          -->
<!-- (the org.apache.batik.apps.svgbrowser.SquiggleInputHandler file) is       -->
<!-- enabled.                                                                  -->
<!--                                                                           -->
<!-- @author vincent.hardy@eng.sun.com                                         -->
<!-- @version $Id$                                                             -->
<!-- ========================================================================= -->
<?xml-stylesheet href="data.xsl" type="text/xsl"?>
<data depth="30">
</data>