text:
/*
 * Driver: pcmuio
 * Description: Winsystems PC-104 based 48/96-channel DIO boards.
 * Devices: [Winsystems] PCM-UIO48A (pcmuio48), PCM-UIO96A (pcmuio96)
 * Author: Calin Culianu <calin@ajvar.org>
 * Updated: Fri, 13 Jan 2006 12:01:01 -0500
 * Status: works
 *
 * A driver for the relatively straightforward-to-program PCM-UIO48A and
 * PCM-UIO96A boards from Winsystems. These boards use either one or two
 * (in the 96-DIO version) WS16C48 ASIC HighDensity I/O Chips (HDIO). This
 * chip is interesting in that each I/O line is individually programmable
 * for INPUT or OUTPUT (thus comedi_dio_config can be done on a per-channel
 * basis). Also, each chip supports edge-triggered interrupts for the first
 * 24 I/O lines. Of course, since the 96-channel version of the board has
 * two ASICs, it can detect polarity changes on up to 48 I/O lines. Since
 * this is essentially an (non-PnP) ISA board, I/O Address and IRQ selection
 * are done through jumpers on the board. You need to pass that information
 * to this driver as the first and second comedi_config option, respectively.
 * Note that the 48-channel version uses 16 bytes of IO memory and the 96-
 * channel version uses 32-bytes (in case you are worried about conflicts).
 * The 48-channel board is split into two 24-channel comedi subdevices. The
 * 96-channel board is split into 4 24-channel DIO subdevices.
 *
 * Note that IRQ support has been added, but it is untested.
 *
 * To use edge-detection IRQ support, pass the IRQs of both ASICS (for the
 * 96 channel version) or just 1 ASIC (for 48-channel version). Then, use
 * comedi_commands with TRIG_NOW. Your callback will be called each time an
 * edge is triggered, and the data values will be two sample_t's, which
 * should be concatenated to form one 32-bit unsigned int.  This value is
 * the mask of channels that had edges detected from your channel list. Note
 * that the bits positions in the mask correspond to positions in your
 * chanlist when you specified the command and *not* channel id's!
 *
 * To set the polarity of the edge-detection interrupts pass a nonzero value
 * for either CR_RANGE or CR_AREF for edge-up polarity, or a zero value for
 * both CR_RANGE and CR_AREF if you want edge-down polarity.
 *
 * In the 48-channel version:
 *
 * On subdev 0, the first 24 channels channels are edge-detect channels.
 *
 * In the 96-channel board you have the following channels that can do edge
 * detection:
 *
 * subdev 0, channels 0-24  (first 24 channels of 1st ASIC)
 * subdev 2, channels 0-24  (first 24 channels of 2nd ASIC)
 *
 * Configuration Options:
 *  [0] - I/O port base address
 *  [1] - IRQ (for first ASIC, or first 24 channels)
 *  [2] - IRQ (for second ASIC, pcmuio96 only - IRQ for chans 48-72
 *             can be the same as first irq!)
 */

#include <linux/module.h>
#include <linux/interrupt.h>

#include "../comedidev.h"

/*
 * Register I/O map
 *
 * Offset    Page 0       Page 1       Page 2       Page 3
 * ------  -----------  -----------  -----------  -----------
 *  0x00   Port 0 I/O   Port 0 I/O   Port 0 I/O   Port 0 I/O
 *  0x01   Port 1 I/O   Port 1 I/O   Port 1 I/O   Port 1 I/O
 *  0x02   Port 2 I/O   Port 2 I/O   Port 2 I/O   Port 2 I/O
 *  0x03   Port 3 I/O   Port 3 I/O   Port 3 I/O   Port 3 I/O
 *  0x04   Port 4 I/O   Port 4 I/O   Port 4 I/O   Port 4 I/O
 *  0x05   Port 5 I/O   Port 5 I/O   Port 5 I/O   Port 5 I/O
 *  0x06   INT_PENDING  INT_PENDING  INT_PENDING  INT_PENDING
 *  0x07    Page/Lock    Page/Lock    Page/Lock    Page/Lock
 *  0x08       N/A         POL_0       ENAB_0       INT_ID0
 *  0x09       N/A         POL_1       ENAB_1       INT_ID1
 *  0x0a       N/A         POL_2       ENAB_2       INT_ID2
 */
#define PCMUIO_PORT_REG(x)		(0x00 + (x))
#define PCMUIO_INT_PENDING_REG		0x06
#define PCMUIO_PAGE_LOCK_REG		0x07
#define PCMUIO_LOCK_PORT(x)		((1 << (x)) & 0x3f)
#define PCMUIO_PAGE(x)			(((x) & 0x3) << 6)
#define PCMUIO_PAGE_MASK		PCMUIO_PAGE(3)
#define PCMUIO_PAGE_POL			1
#define PCMUIO_PAGE_ENAB		2
#define PCMUIO_PAGE_INT_ID		3
#define PCMUIO_PAGE_REG(x)		(0x08 + (x))

#define PCMUIO_ASIC_IOSIZE		0x10
#define PCMUIO_MAX_ASICS		2

struct pcmuio_board {
	const char *name;
	const int num_asics;
};

static const struct pcmuio_board pcmuio_boards[] = {
	{
		.name		= "pcmuio48",
		.num_asics	= 1,
	}, {
		.name		= "pcmuio96",
		.num_asics	= 2,
	},
};

struct pcmuio_asic {
	spinlock_t pagelock;	/* protects the page registers */
	spinlock_t spinlock;	/* protects member variables */
	unsigned int enabled_mask;
	unsigned int active:1;
};

struct pcmuio_private {
	struct pcmuio_asic asics[PCMUIO_MAX_ASICS];
	unsigned int irq2;
};

static inline unsigned long pcmuio_asic_iobase(struct comedi_device *dev,
					       int asic)
{
	return dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
}

static inline int pcmuio_subdevice_to_asic(struct comedi_subdevice *s)
{
	/*
	 * subdevice 0 and 1 are handled by the first asic
	 * subdevice 2 and 3 are handled by the second asic
	 */
	return s->index / 2;
}

static inline int pcmuio_subdevice_to_port(struct comedi_subdevice *s)
{
	/*
	 * subdevice 0 and 2 use port registers 0-2
	 * subdevice 1 and 3 use port registers 3-5
	 */
	return (s->index % 2) ? 3 : 0;
}

static void pcmuio_write(struct comedi_device *dev, unsigned int val,
			 int asic, int page, int port)
{
	struct pcmuio_private *devpriv = dev->private;
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	unsigned long iobase = pcmuio_asic_iobase(dev, asic);
	unsigned long flags;

	spin_lock_irqsave(&chip->pagelock, flags);
	if (page == 0) {
		/* Port registers are valid for any page */
		outb(val & 0xff, iobase + PCMUIO_PORT_REG(port + 0));
		outb((val >> 8) & 0xff, iobase + PCMUIO_PORT_REG(port + 1));
		outb((val >> 16) & 0xff, iobase + PCMUIO_PORT_REG(port + 2));
	} else {
		outb(PCMUIO_PAGE(page), iobase + PCMUIO_PAGE_LOCK_REG);
		outb(val & 0xff, iobase + PCMUIO_PAGE_REG(0));
		outb((val >> 8) & 0xff, iobase + PCMUIO_PAGE_REG(1));
		outb((val >> 16) & 0xff, iobase + PCMUIO_PAGE_REG(2));
	}
	spin_unlock_irqrestore(&chip->pagelock, flags);
}

static unsigned int pcmuio_read(struct comedi_device *dev,
				int asic, int page, int port)
{
	struct pcmuio_private *devpriv = dev->private;
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	unsigned long iobase = pcmuio_asic_iobase(dev, asic);
	unsigned long flags;
	unsigned int val;

	spin_lock_irqsave(&chip->pagelock, flags);
	if (page == 0) {
		/* Port registers are valid for any page */
		val = inb(iobase + PCMUIO_PORT_REG(port + 0));
		val |= (inb(iobase + PCMUIO_PORT_REG(port + 1)) << 8);
		val |= (inb(iobase + PCMUIO_PORT_REG(port + 2)) << 16);
	} else {
		outb(PCMUIO_PAGE(page), iobase + PCMUIO_PAGE_LOCK_REG);
		val = inb(iobase + PCMUIO_PAGE_REG(0));
		val |= (inb(iobase + PCMUIO_PAGE_REG(1)) << 8);
		val |= (inb(iobase + PCMUIO_PAGE_REG(2)) << 16);
	}
	spin_unlock_irqrestore(&chip->pagelock, flags);

	return val;
}

/*
 * Each channel can be individually programmed for input or output.
 * Writing a '0' to a channel causes the corresponding output pin
 * to go to a high-z state (pulled high by an external 10K resistor).
 * This allows it to be used as an input. When used in the input mode,
 * a read reflects the inverted state of the I/O pin, such that a
 * high on the pin will read as a '0' in the register. Writing a '1'
 * to a bit position causes the pin to sink current (up to 12mA),
 * effectively pulling it low.
 */
static int pcmuio_dio_insn_bits(struct comedi_device *dev,
				struct comedi_subdevice *s,
				struct comedi_insn *insn,
				unsigned int *data)
{
	int asic = pcmuio_subdevice_to_asic(s);
	int port = pcmuio_subdevice_to_port(s);
	unsigned int chanmask = (1 << s->n_chan) - 1;
	unsigned int mask;
	unsigned int val;

	mask = comedi_dio_update_state(s, data);
	if (mask) {
		/*
		 * Outputs are inverted, invert the state and
		 * update the channels.
		 *
		 * The s->io_bits mask makes sure the input channels
		 * are '0' so that the outputs pins stay in a high
		 * z-state.
		 */
		val = ~s->state & chanmask;
		val &= s->io_bits;
		pcmuio_write(dev, val, asic, 0, port);
	}

	/* get inverted state of the channels from the port */
	val = pcmuio_read(dev, asic, 0, port);

	/* return the true state of the channels */
	data[1] = ~val & chanmask;

	return insn->n;
}

static int pcmuio_dio_insn_config(struct comedi_device *dev,
				  struct comedi_subdevice *s,
				  struct comedi_insn *insn,
				  unsigned int *data)
{
	int asic = pcmuio_subdevice_to_asic(s);
	int port = pcmuio_subdevice_to_port(s);
	int ret;

	ret = comedi_dio_insn_config(dev, s, insn, data, 0);
	if (ret)
		return ret;

	if (data[0] == INSN_CONFIG_DIO_INPUT)
		pcmuio_write(dev, s->io_bits, asic, 0, port);

	return insn->n;
}

static void pcmuio_reset(struct comedi_device *dev)
{
	const struct pcmuio_board *board = dev->board_ptr;
	int asic;

	for (asic = 0; asic < board->num_asics; ++asic) {
		/* first, clear all the DIO port bits */
		pcmuio_write(dev, 0, asic, 0, 0);
		pcmuio_write(dev, 0, asic, 0, 3);

		/* Next, clear all the paged registers for each page */
		pcmuio_write(dev, 0, asic, PCMUIO_PAGE_POL, 0);
		pcmuio_write(dev, 0, asic, PCMUIO_PAGE_ENAB, 0);
		pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);
	}
}

/* chip->spinlock is already locked */
static void pcmuio_stop_intr(struct comedi_device *dev,
			     struct comedi_subdevice *s)
{
	struct pcmuio_private *devpriv = dev->private;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];

	chip->enabled_mask = 0;
	chip->active = 0;
	s->async->inttrig = NULL;

	/* disable all intrs for this subdev.. */
	pcmuio_write(dev, 0, asic, PCMUIO_PAGE_ENAB, 0);
}

static void pcmuio_handle_intr_subdev(struct comedi_device *dev,
				      struct comedi_subdevice *s,
				      unsigned triggered)
{
	struct pcmuio_private *devpriv = dev->private;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	struct comedi_cmd *cmd = &s->async->cmd;
	unsigned int val = 0;
	unsigned long flags;
	unsigned int i;

	spin_lock_irqsave(&chip->spinlock, flags);

	if (!chip->active)
		goto done;

	if (!(triggered & chip->enabled_mask))
		goto done;

	for (i = 0; i < cmd->chanlist_len; i++) {
		unsigned int chan = CR_CHAN(cmd->chanlist[i]);

		if (triggered & (1 << chan))
			val |= (1 << i);
	}

	comedi_buf_write_samples(s, &val, 1);

	if (cmd->stop_src == TRIG_COUNT &&
	    s->async->scans_done >= cmd->stop_arg)
		s->async->events |= COMEDI_CB_EOA;

done:
	spin_unlock_irqrestore(&chip->spinlock, flags);

	comedi_handle_events(dev, s);
}

static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic)
{
	/* there are could be two asics so we can't use dev->read_subdev */
	struct comedi_subdevice *s = &dev->subdevices[asic * 2];
	unsigned long iobase = pcmuio_asic_iobase(dev, asic);
	unsigned int val;

	/* are there any interrupts pending */
	val = inb(iobase + PCMUIO_INT_PENDING_REG) & 0x07;
	if (!val)
		return 0;

	/* get, and clear, the pending interrupts */
	val = pcmuio_read(dev, asic, PCMUIO_PAGE_INT_ID, 0);
	pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);

	/* handle the pending interrupts */
	pcmuio_handle_intr_subdev(dev, s, val);

	return 1;
}

static irqreturn_t pcmuio_interrupt(int irq, void *d)
{
	struct comedi_device *dev = d;
	struct pcmuio_private *devpriv = dev->private;
	int handled = 0;

	if (irq == dev->irq)
		handled += pcmuio_handle_asic_interrupt(dev, 0);
	if (irq == devpriv->irq2)
		handled += pcmuio_handle_asic_interrupt(dev, 1);

	return handled ? IRQ_HANDLED : IRQ_NONE;
}

/* chip->spinlock is already locked */
static void pcmuio_start_intr(struct comedi_device *dev,
			      struct comedi_subdevice *s)
{
	struct pcmuio_private *devpriv = dev->private;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	struct comedi_cmd *cmd = &s->async->cmd;
	unsigned int bits = 0;
	unsigned int pol_bits = 0;
	int i;

	chip->enabled_mask = 0;
	chip->active = 1;
	if (cmd->chanlist) {
		for (i = 0; i < cmd->chanlist_len; i++) {
			unsigned int chanspec = cmd->chanlist[i];
			unsigned int chan = CR_CHAN(chanspec);
			unsigned int range = CR_RANGE(chanspec);
			unsigned int aref = CR_AREF(chanspec);

			bits |= (1 << chan);
			pol_bits |= ((aref || range) ? 1 : 0) << chan;
		}
	}
	bits &= ((1 << s->n_chan) - 1);
	chip->enabled_mask = bits;

	/* set pol and enab intrs for this subdev.. */
	pcmuio_write(dev, pol_bits, asic, PCMUIO_PAGE_POL, 0);
	pcmuio_write(dev, bits, asic, PCMUIO_PAGE_ENAB, 0);
}

static int pcmuio_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
	struct pcmuio_private *devpriv = dev->private;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	unsigned long flags;

	spin_lock_irqsave(&chip->spinlock, flags);
	if (chip->active)
		pcmuio_stop_intr(dev, s);
	spin_unlock_irqrestore(&chip->spinlock, flags);

	return 0;
}

static int pcmuio_inttrig_start_intr(struct comedi_device *dev,
				     struct comedi_subdevice *s,
				     unsigned int trig_num)
{
	struct pcmuio_private *devpriv = dev->private;
	struct comedi_cmd *cmd = &s->async->cmd;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	unsigned long flags;

	if (trig_num != cmd->start_arg)
		return -EINVAL;

	spin_lock_irqsave(&chip->spinlock, flags);
	s->async->inttrig = NULL;
	if (chip->active)
		pcmuio_start_intr(dev, s);

	spin_unlock_irqrestore(&chip->spinlock, flags);

	return 1;
}

/*
 * 'do_cmd' function for an 'INTERRUPT' subdevice.
 */
static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
	struct pcmuio_private *devpriv = dev->private;
	struct comedi_cmd *cmd = &s->async->cmd;
	int asic = pcmuio_subdevice_to_asic(s);
	struct pcmuio_asic *chip = &devpriv->asics[asic];
	unsigned long flags;

	spin_lock_irqsave(&chip->spinlock, flags);
	chip->active = 1;

	/* Set up start of acquisition. */
	if (cmd->start_src == TRIG_INT)
		s->async->inttrig = pcmuio_inttrig_start_intr;
	else	/* TRIG_NOW */
		pcmuio_start_intr(dev, s);

	spin_unlock_irqrestore(&chip->spinlock, flags);

	return 0;
}

static int pcmuio_cmdtest(struct comedi_device *dev,
			  struct comedi_subdevice *s,
			  struct comedi_cmd *cmd)
{
	int err = 0;

	/* Step 1 : check if triggers are trivially valid */

	err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT);
	err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT);
	err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW);
	err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
	err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);

	if (err)
		return 1;

	/* Step 2a : make sure trigger sources are unique */

	err |= comedi_check_trigger_is_unique(cmd->start_src);
	err |= comedi_check_trigger_is_unique(cmd->stop_src);

	/* Step 2b : and mutually compatible */

	if (err)
		return 2;

	/* Step 3: check if arguments are trivially valid */

	err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0);
	err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
	err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0);
	err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
					   cmd->chanlist_len);

	if (cmd->stop_src == TRIG_COUNT)
		err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1);
	else	/* TRIG_NONE */
		err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0);

	if (err)
		return 3;

	/* step 4: fix up any arguments */

	/* if (err) return 4; */

	return 0;
}

static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
	const struct pcmuio_board *board = dev->board_ptr;
	struct comedi_subdevice *s;
	struct pcmuio_private *devpriv;
	int ret;
	int i;

	ret = comedi_request_region(dev, it->options[0],
				    board->num_asics * PCMUIO_ASIC_IOSIZE);
	if (ret)
		return ret;

	devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
	if (!devpriv)
		return -ENOMEM;

	for (i = 0; i < PCMUIO_MAX_ASICS; ++i) {
		struct pcmuio_asic *chip = &devpriv->asics[i];

		spin_lock_init(&chip->pagelock);
		spin_lock_init(&chip->spinlock);
	}

	pcmuio_reset(dev);

	if (it->options[1]) {
		/* request the irq for the 1st asic */
		ret = request_irq(it->options[1], pcmuio_interrupt, 0,
				  dev->board_name, dev);
		if (ret == 0)
			dev->irq = it->options[1];
	}

	if (board->num_asics == 2) {
		if (it->options[2] == dev->irq) {
			/* the same irq (or none) is used by both asics */
			devpriv->irq2 = it->options[2];
		} else if (it->options[2]) {
			/* request the irq for the 2nd asic */
			ret = request_irq(it->options[2], pcmuio_interrupt, 0,
					  dev->board_name, dev);
			if (ret == 0)
				devpriv->irq2 = it->options[2];
		}
	}

	ret = comedi_alloc_subdevices(dev, board->num_asics * 2);
	if (ret)
		return ret;

	for (i = 0; i < dev->n_subdevices; ++i) {
		s = &dev->subdevices[i];
		s->type		= COMEDI_SUBD_DIO;
		s->subdev_flags	= SDF_READABLE | SDF_WRITABLE;
		s->n_chan	= 24;
		s->maxdata	= 1;
		s->range_table	= &range_digital;
		s->insn_bits	= pcmuio_dio_insn_bits;
		s->insn_config	= pcmuio_dio_insn_config;

		/* subdevices 0 and 2 can support interrupts */
		if ((i == 0 && dev->irq) || (i == 2 && devpriv->irq2)) {
			/* setup the interrupt subdevice */
			dev->read_subdev = s;
			s->subdev_flags	|= SDF_CMD_READ | SDF_LSAMPL |
					   SDF_PACKED;
			s->len_chanlist	= s->n_chan;
			s->cancel	= pcmuio_cancel;
			s->do_cmd	= pcmuio_cmd;
			s->do_cmdtest	= pcmuio_cmdtest;
		}
	}

	return 0;
}

static void pcmuio_detach(struct comedi_device *dev)
{
	struct pcmuio_private *devpriv = dev->private;

	if (devpriv) {
		pcmuio_reset(dev);

		/* free the 2nd irq if used, the core will free the 1st one */
		if (devpriv->irq2 && devpriv->irq2 != dev->irq)
			free_irq(devpriv->irq2, dev);
	}
	comedi_legacy_detach(dev);
}

static struct comedi_driver pcmuio_driver = {
	.driver_name	= "pcmuio",
	.module		= THIS_MODULE,
	.attach		= pcmuio_attach,
	.detach		= pcmuio_detach,
	.board_name	= &pcmuio_boards[0].name,
	.offset		= sizeof(struct pcmuio_board),
	.num_names	= ARRAY_SIZE(pcmuio_boards),
};
module_comedi_driver(pcmuio_driver);

MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver");
MODULE_LICENSE("GPL");


text:
using System;

namespace HealthMonitoring.Configuration
{
    public interface IMonitorSettings
    {
        TimeSpan HealthCheckInterval { get; }
        TimeSpan HealthyResponseTimeLimit { get; }
        TimeSpan ShortTimeOut { get; }
        TimeSpan FailureTimeOut { get; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.cuacfm.members.model.directdebit;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/** The Class ReturnReasonRepositoryImpl. */
@Repository
@Transactional(readOnly = true)
public class ReturnReasonRepositoryImpl implements ReturnReasonRepository {

	private static final Logger logger = LoggerFactory.getLogger(ReturnReasonRepositoryImpl.class);

	@PersistenceContext
	private EntityManager entityManager;

	@Override
	@Transactional
	public ReturnReason save(ReturnReason returnReason) {
		entityManager.persist(returnReason);
		return returnReason;
	}

	@Override
	@Transactional
	public ReturnReason update(ReturnReason returnReason) {
		return entityManager.merge(returnReason);
	}

	@Override
	@Transactional
	public void remove(ReturnReason returnReason) {
		entityManager.remove(returnReason);
	}

	@Override
	public ReturnReason findById(String id) {
		try {
			return entityManager.createQuery("select r from ReturnReason r where r.id = :id", ReturnReason.class).setParameter("id", id)
					.getSingleResult();
		} catch (NoResultException e) {
			logger.info("NoResult" + e.getMessage());
			return null;
		}
	}

	@Override
	public List<ReturnReason> findAll() {
		return entityManager.createQuery("select r from ReturnReason r order by r.id asc ", ReturnReason.class).getResultList();
	}
}


text:
layout: post
title: "CSS font-family"
subtitle: "Choosing a font"
section: css
---

CSS provides several **font** properties, that directly affect text rendering. The `font-family` property defines _which_ font to use.

### Generic font families

Fonts are grouped in 5 **generic** families:

* `serif` fonts have small lines attached to the end of each character
* `sans-serif`
* `monospace`
* `cursive`
* `fantasy`

`cursive` and `fantasy` are never used.
{: .info}

Because the `font-family` property is inherited by all HTML children elements, you can apply a font for the whole HTML document by applying it on the ancestor of all HTML elements: the `<body>` element.

{% highlight css %}
body{ font-family: sans-serif;}
{% endhighlight %}

With this CSS rule, the webpage will use the **sans-serif** font defined by the user in his preferences.

### Web-safe fonts

The problem with using generic font names is that the design of your webpage will rely upon the font set by the user in his settings.

As you probably want your webpage to look the same on anyone's computer, you'll want to define a **specific** font to be used. To do so, just use the **name** of the font.

{% highlight css %}
body{ font-family: Arial;}
{% endhighlight %}

Your webpage will use Arial **provided it is installed on the user's computer**. If the Arial font is not available on the user's computer, it will use the browser's default serif font (which is usually Times).

Arial is a safe choice though, because it is installed on all Windows and Mac computers, and on most Linux systems. That is why Arial is considered a **web-safe** font: you can safely use it in your CSS and be almost sure that the user's computer will have it installed.

There are **9** web-safe fonts:

* Arial
* Arial Black
* Comic Sans MS
* Courier New
* Georgia
* Impact
* Times New Roman
* Trebuchet MS
* Verdana

### Applying a list of fonts

Although using _any_ of these values for the `font-family` property is a safe bet, you can define **fallback** values by writing a **list of font families**:

{% highlight css %}
body{ font-family: Arial, Verdana, sans-serif;}
{% endhighlight %}

By defining **multiple values** for `font-family`, the browser will look for the first value `Arial` and use it. If it's not available, it will use the following one `Verdana`. Finally, if that one isn't available either, it will use the browser's default sans-serif font.

It is good practice to use a **generic family** as the last value. If you can't define the specific font to use, you can at least define the _type_ of font you want.

Because designers want to use more original fonts but still want their webpage to look exactly the same on anyone's computer, it is possible to **include a font** in a webpage. That way, they make sure the font is available even if it's not present on the user's computer, simply because the website provides the font.

We'll look into this method called `@font-face`, and see how services like Google Fonts or Typekit can help you.


text:
/* eslint max-len: 0 */
import React from 'react';
import ExpandRow from './expandRow';
import ExpandByColumn from './expand-row-by-column';
import ManageExpandExternal from './manage-expanding';
import ExpandWithSelection from './expand-row-with-selection';
import ExpandWithCellEdit from './expand-row-with-cellEdit';
import ExpandIndicator from './expand-indicator';
import CustomExpandIndicator from './custom-expand-indicator';
import renderLinks from '../utils';

import { Col, Panel } from 'react-bootstrap';

class Demo extends React.Component {
  render() {
    return (
      <Col md={ 8 } mdOffset={ 1 }>
        <Panel header={ 'A basic react-bootstrap-table with expandable row' }>
          { renderLinks('expandRow/expandRow.js') }

You can insert your customize component as a expand component

          <ExpandRow/>
        </Panel>
        <Panel header={ 'Row Expand Indicator' }>
          { renderLinks('expandRow/expand-indicator.js') }
          <ExpandIndicator/>
        </Panel>
        <Panel header={ 'Custom Row Expand Indicator' }>
          { renderLinks('expandRow/custom-expand-indicator.js') }
          <CustomExpandIndicator/>
        </Panel>
        <Panel header={ 'Expand Row Trigger by Column instead of Row' }>
          { renderLinks('expandRow/expand-row-by-column.js') }
          You can trigger expand row by column or row, default is row,
          configure expandBy in options props
          <ExpandByColumn/>
        </Panel>
        <Panel header={ 'Manage the Expanding Row External' }>
          { renderLinks('expandRow/expand-row-by-column.js') }
          <ManageExpandExternal/>
        </Panel>
        <Panel header={ 'Expand Row with Selection - Keep select column first' }>
          You can enable/disable the expanding if you click row to select,
          configure clickToExpand in selectRow props, default is false
          { renderLinks('expandRow/expand-row-with-selection.js') }
          <ExpandWithSelection/>
        </Panel>
        <Panel header={ 'Expand Row with CellEdit' }>
          { renderLinks('expandRow/expand-row-with-cellEdit.js') }
          <ExpandWithCellEdit/>
        </Panel>
      </Col>
    );
  }
}

export default Demo;


text:
namespace ui {

class GLOzoneGLX : public GLOzone {
 public:
  GLOzoneGLX() {}
  ~GLOzoneGLX() override {}

  bool InitializeGLOneOffPlatform() override;
  bool InitializeStaticGLBindings(gl::GLImplementation implementation) override;
  void InitializeDebugGLBindings() override;
  void ShutdownGL() override;
  bool GetGLWindowSystemBindingInfo(
      gl::GLWindowSystemBindingInfo* info) override;
  scoped_refptr<gl::GLContext> CreateGLContext(
      gl::GLShareGroup* share_group,
      gl::GLSurface* compatible_surface,
      const gl::GLContextAttribs& attribs) override;
  scoped_refptr<gl::GLSurface> CreateViewGLSurface(
      gfx::AcceleratedWidget window) override;
  scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface(
      gfx::AcceleratedWidget window) override;
  scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
      const gfx::Size& size) override;

 private:
  DISALLOW_COPY_AND_ASSIGN(GLOzoneGLX);
};

}  // namespace ui

#endif  // UI_OZONE_PLATFORM_X11_GL_OZONE_GLX_H_


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Camera {
    constructor() {
        this.x = 0;
        this.y = 0;
    }
}
exports.default = Camera;
//# sourceMappingURL=Camera.js.map


text:
package de.fraunhofer.fokus.oefit.particity.model.impl;

/**
 * The extended model implementation for the AHOrg service. Represents a row in the "AHORG" database table, with each column mapped to a property of this class.
 *
 * <p>
 * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link de.fraunhofer.fokus.oefit.particity.model.AHOrg} interface.
 * </p>
 *
 * @author Brian Wing Shun Chan
 */
public class AHOrgImpl extends AHOrgBaseImpl {
    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never reference this class directly. All methods that expect a a h org model instance should use the {@link de.fraunhofer.fokus.oefit.particity.model.AHOrg} interface instead.
     */
    public AHOrgImpl() {
    }
}


text:
class TestUInt32Array < Test::Unit::TestCase
  include Helper::Buildable
  include Helper::Omittable

  def test_new
    assert_equal(build_uint32_array([1, 2, nil]),
                 Arrow::UInt32Array.new(3,
                                        Arrow::Buffer.new([1, 2].pack("L*")),
                                        Arrow::Buffer.new([0b011].pack("C*")),
                                        -1))
  end

  def test_buffer
    builder = Arrow::UInt32ArrayBuilder.new
    builder.append(1)
    builder.append(2)
    builder.append(4)
    array = builder.finish
    assert_equal([1, 2, 4].pack("L*"), array.buffer.data.to_s)
  end

  def test_value
    builder = Arrow::UInt32ArrayBuilder.new
    builder.append(1)
    array = builder.finish
    assert_equal(1, array.get_value(0))
  end

  def test_values
    require_gi(3, 1, 7)
    builder = Arrow::UInt32ArrayBuilder.new
    builder.append(1)
    builder.append(2)
    builder.append(4)
    array = builder.finish
    assert_equal([1, 2, 4], array.values)
  end
end


text:
/*
 * IOGTest.cpp
 *
 *  Created on: 12.12.2012
 *      Author: Christian Staudt (christian.staudt@kit.edu)
 */

#ifndef NOGTEST

#include "IOGTest.h"

#include <fstream>
#include <unordered_set>
#include <vector>

#include "../METISGraphReader.h"
#include "../METISGraphWriter.h"
#include "../PartitionWriter.h"
#include "../PartitionReader.h"
#include "../GraphIO.h"
#include "../DotGraphWriter.h"
#include "../DGSReader.h"
#include "../EdgeListWriter.h"
#include "../EdgeListPartitionReader.h"
#include "../SNAPEdgeListPartitionReader.h"
#include "../SNAPGraphWriter.h"
#include "../EdgeListReader.h"
#include "../GMLGraphWriter.h"
#include "../EdgeListCoverReader.h"
#include "../CoverReader.h"
#include "../CoverWriter.h"
#include "../GMLGraphReader.h"
#include "../GraphToolBinaryReader.h"
#include "../GraphToolBinaryWriter.h"
#include "../../generators/ErdosRenyiGenerator.h"

#include "../../community/GraphClusteringTools.h"
#include "../../auxiliary/Log.h"
#include "../../community/ClusteringGenerator.h"
#include "../../structures/Partition.h"
#include "../../community/Modularity.h"
#include "../../community/PLP.h"

namespace NetworKit {

TEST_F(IOGTest, testGraphIOEdgeList) {
	ErdosRenyiGenerator graphGen(100, 0.1);
	Graph G = graphGen.generate();

	GraphIO graphio;
	std::string path = "output/edgelist.txt";
	graphio.writeEdgeList(G, path);

	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;
}

TEST_F(IOGTest, testGraphIOAdjacencyList) {
	ErdosRenyiGenerator graphGen(100, 0.1);
	Graph G = graphGen.generate();
	GraphIO graphio;
	std::string path = "output/circular.adjlist";
	graphio.writeAdjacencyList(G, path);

	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;
}

TEST_F(IOGTest, testGraphIOForIsolatedNodes) {
	Graph G(20);
	GraphIO graphio;
	std::string path = "output/isolated.adjlist";
	graphio.writeAdjacencyList(G, path);

	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;
}

TEST_F(IOGTest, testMETISGraphReader) {
	std::string path = "input/jazz.graph";

	METISGraphReader reader;
	Graph G = reader.read(path);
	count n = 198;
	count m = 2742;
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

	// graph polblogs (has singletons)
	path = "input/polblogs.graph";
	G = reader.read(path);
	n = 1490;
	m = 16715;
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

	// graph PGPgiantcompo
	path = "input/PGPgiantcompo.graph";
	G = reader.read(path);
	n = 10680;
	m = 24316;
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}
}

TEST_F(IOGTest, testMETISGraphReaderWithTinyGraphs) {
	/* These graphs are from the METIS documentation and cover different settings
		of the fmt flag in the header of a METIS graph file */
	count n = 7;
	count m = 11;
	METISGraphReader reader;

	std::string path = "input/tiny_01.graph";
	Graph G = reader.read(path);
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

	path = "input/tiny_02.graph";
	G = reader.read(path);
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

	path = "input/tiny_03.graph";
	G = reader.read(path);
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

	path = "input/tiny_04.graph";
	G = reader.read(path);
	EXPECT_FALSE(G.isEmpty());
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}

}
/*
TEST_F(IOGTest, testMETISGraphReaderWithDoubleWeights) {
	std::string path = "input/jazz2double.graph";

	FastMETISGraphReader reader;
	Graph G = reader.read(path);

	EXPECT_FALSE(G.isEmpty());
	count n = 5;
	count m = 6;
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}
	double edgeweight = 7.71099;
	double abs = 1e-9;
	EXPECT_LE(G.totalEdgeWeight()-edgeweight,abs) << "Total edgeweight should be " << edgeweight;
}
*/
/* Old and therefore not actually needed */
/*TEST_F(IOGTest, testMETISGraphReaderWithWeights) {
	std::string path = "input/lesmis.graph";

	METISGraphReader reader;
	Graph G = reader.read(path);

	EXPECT_FALSE(G.isEmpty());
	count n = 77;
	count m = 254;
	EXPECT_EQ(n, G.numberOfNodes()) << "There are " << n << " nodes in the graph";
	EXPECT_EQ(m, G.numberOfEdges()) << "There are " << m << " edges in the graph";

	for (index v = 0; v < n; ++v) {
		EXPECT_TRUE(G.hasNode(v)) << "Node " << v << " should be there";
	}
}*/

TEST_F(IOGTest, testMETISGraphWriter) {
	std::string path = "output/jazz1.graph";
	Graph G = Graph(3);
	G.addEdge(0,2);
	G.addEdge(1,1);
	G.addEdge(1,2);
	G.addEdge(2,2);

	METISGraphWriter writer;
	writer.write(G, false, path);
	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;

}

TEST_F(IOGTest, testMETISGraphWriterWithWeights) {
	std::string path = "output/jazz2.graph";
	Graph G = Graph(5);
	G.addEdge(0,2);
	G.addEdge(0,1);
	G.addEdge(0,0);
	G.addEdge(1,1);

	METISGraphWriter writer;
	writer.write(G, true, path);
    bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;

}

TEST_F(IOGTest, testPartitionWriterAndReader) {
	// write clustering first
	std::string path = "output/example.clust";

	count n = 100;
	count k = 3;
	ErdosRenyiGenerator graphGen(n, 0.1);
	Graph G = graphGen.generate();

	ClusteringGenerator clusteringGen;
	Partition zeta = clusteringGen.makeRandomClustering(G, k);

	PartitionWriter writer;
	writer.write(zeta, path);

	// check if file exists
	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "clustering file should have been written to: " << path;

	PartitionReader reader;
	Partition read = reader.read(path);

	EXPECT_EQ(n, read.numberOfElements()) << "read clustering should contain n nodes";
	EXPECT_TRUE(GraphClusteringTools::isProperClustering(G, read)) << "read clustering should be proper clustering of G";
	EXPECT_TRUE(GraphClusteringTools::equalClusterings(read, zeta, G)) << "read clustering should be identical to created clustering";
}

TEST_F(IOGTest, testDotGraphWriter) {
	ErdosRenyiGenerator graphGen(100, 0.1);
	Graph G = graphGen.generate();

	std::string path = "output/example.dot";

	DotGraphWriter writer;
	writer.write(G, path);

	// check if file exists
	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "graph file should have been written to: " << path;
}

TEST_F(IOGTest, tryDGSReaderOnBigFile) {
	// read example graph
	DGSReader reader;
	Graph G;
	GraphEventProxy Gproxy(G);
	reader.read("/Users/forigem/KIT/NetworKit-CommunityDetection/input/AuthorsGraph.dgs", Gproxy);
}

TEST_F(IOGTest, tryDGSReader) {
	// read example graph
	DGSReader reader;
	Graph G;
	GraphEventProxy Gproxy(G);
	reader.read("input/example2.dgs", Gproxy);

	// get input parameters
	count nodeCount = G.numberOfNodes();
	DEBUG("Number of nodes " , nodeCount);
	EXPECT_EQ(3u, nodeCount);
	count edgeCount = G.numberOfEdges();
	DEBUG("Number of edges " , edgeCount);
	EXPECT_EQ(2u, edgeCount);

	G.forNodes([&](node n) {
		DEBUG("DEGREE OF NODE: " , G.degree(n) , "\n");
	});

}

TEST_F(IOGTest, testEdgeListReader) {
	EdgeListReader reader('\t', 1);

	std::string path = "input/LFR-generator-example/network.dat";
	DEBUG("reading file: " , path);
	Graph G = reader.read(path);
	EXPECT_EQ(10u, G.numberOfNodes());
	EXPECT_EQ(10u, G.numberOfEdges());
	EXPECT_TRUE(G.hasEdge(0, 5));
	EXPECT_TRUE(G.hasEdge(2, 9));
	EXPECT_TRUE(G.hasEdge(1, 7));

	path = "input/example.edgelist";
	DEBUG("reading file: " , path);
	EdgeListReader reader2('\t', 1);
	Graph G2 = reader2.read(path);
	EXPECT_EQ(10u, G2.numberOfEdges());
	EXPECT_TRUE(G2.hasEdge(0, 4));

	path = "input/spaceseparated.edgelist";
	DEBUG("reading file: " , path);
	EdgeListReader reader3(' ', 1);
	Graph G3 = reader3.read(path);
	EXPECT_EQ(10u, G3.numberOfEdges());
	EXPECT_TRUE(G3.hasEdge(0, 4));

	path = "input/spaceseparated_weighted.edgelist";
	DEBUG("reading file: " , path);
	Graph G32 = reader3.read(path);
	EXPECT_TRUE(G32.isWeighted());
	EXPECT_EQ(2,G32.weight(0,1));
	EXPECT_EQ(4,G32.weight(0,2));
	EXPECT_EQ(3,G32.weight(1,2));

	path = "input/comments.edgelist";
	DEBUG("reading file: " , path);
	EdgeListReader reader4('\t', 1);
	Graph G4 = reader4.read(path);
	EXPECT_EQ(10u, G4.numberOfEdges());
	EXPECT_TRUE(G4.hasEdge(0, 4));

}

TEST_F(IOGTest, testEdgeListPartitionReader) {
	EdgeListPartitionReader reader(1);

	Partition zeta = reader.read("input/LFR-generator-example/community.dat");
	//EXPECT_EQ(10, zeta.size());
	EXPECT_EQ(1u, zeta[0]);
	EXPECT_EQ(3u, zeta[1]);
	EXPECT_EQ(2u, zeta[2]);
	EXPECT_EQ(10u, zeta.numberOfElements());

}

TEST_F(IOGTest, testEdgeListCoverReader) {
	EdgeListCoverReader reader(1);
	EdgeListReader gReader('\t', 1);

	Graph G = gReader.read("input/LFR-generator-example/network_overlapping.dat");
	Cover zeta = reader.read("input/LFR-generator-example/community_overlapping.dat", G);
	EXPECT_EQ(9u, zeta.upperBound());
	EXPECT_EQ(10u, zeta.numberOfElements());
	EXPECT_EQ(1u, zeta[0].count(1));
	EXPECT_EQ(3u, zeta[0].size());
	EXPECT_EQ(1u, zeta[3].size());
}

TEST_F(IOGTest, testCoverReader) {
	CoverReader reader;
	EdgeListReader gReader('\t', 1);

	Graph G = gReader.read("input/LFR-generator-example/network_overlapping.dat");
	Cover zeta = reader.read("input/LFR-generator-example/community_overlapping.cover", G);
	EXPECT_EQ(9u, zeta.upperBound());
	EXPECT_EQ(10u, zeta.numberOfElements());
	EXPECT_EQ(1u, zeta[0].count(1));
	EXPECT_EQ(3u, zeta[0].size());
	EXPECT_EQ(1u, zeta[3].size());
}

TEST_F(IOGTest, testCoverWriter) {
	std::string outpath = "output/coverWriter_test.cover";
	CoverWriter writer;
	CoverReader reader;
	EdgeListReader gReader('\t', 1);

	Graph G = gReader.read("input/LFR-generator-example/network_overlapping.dat");
	Cover zeta = reader.read("input/LFR-generator-example/community_overlapping.cover", G);

	writer.write(zeta, outpath);

	Cover read = reader.read(outpath, G);
	EXPECT_EQ(9u, read.upperBound());
	EXPECT_EQ(10u, read.numberOfElements());
	EXPECT_EQ(1u, read[0].count(1));
	EXPECT_EQ(3u, read[0].size());
	EXPECT_EQ(1u, read[3].size());
}

TEST_F(IOGTest, testMETISGraphReaderForNodeExistence2) {
	METISGraphReader reader;
	Graph G = reader.read("input/jazz.graph");
	EXPECT_TRUE(G.hasNode(0));
	EXPECT_EQ(198u, G.numberOfNodes());
	EXPECT_EQ(2742u, G.numberOfEdges());
}

TEST_F(IOGTest, testMETISGraphReaderWithIsolatedNode) {
	METISGraphReader reader;
	Graph G = reader.read("input/example.graph");
	EXPECT_EQ(4u, G.numberOfNodes());
	EXPECT_EQ(2u, G.numberOfEdges());
	EXPECT_TRUE(G.hasNode(0));
	EXPECT_TRUE(G.hasNode(1));
	EXPECT_TRUE(G.hasNode(2));
	EXPECT_TRUE(G.hasNode(3));
	EXPECT_TRUE(G.hasEdge(0,1));
	EXPECT_TRUE(G.hasEdge(0,3));
}

TEST_F(IOGTest, tryReadingLFR) {
	std::string graphPath;
	std::string clustPath;

	std::cout << "[INPUT] LFR graph file path >" << std::endl;
	std::getline(std::cin, graphPath);

	std::cout << "[INPUT] clustering file path >" << std::endl;
	std::getline(std::cin, clustPath);

	EdgeListReader graphReader('\t',1);
	EdgeListPartitionReader clusteringReader;

	Graph G = graphReader.read(graphPath);
	Partition truth = clusteringReader.read(clustPath);

	PLP PLP(G);
	PLP.run();
	Partition zeta = PLP.getPartition();

	Modularity mod;
	INFO("static clustering quality: " , mod.getQuality(zeta, G));
	INFO("static clustering number of clusters: " , zeta.numberOfSubsets());
	INFO("ground truth quality: " , mod.getQuality(truth, G));
	INFO("ground truth number of clusters: " , truth.numberOfSubsets());

}

TEST_F(IOGTest, tryReadingSNAP) {
	std::string graphPath;

	std::cout << "[INPUT] SNAP graph file path >" << std::endl;
	std::getline(std::cin, graphPath);

	EdgeListReader graphReader(' ', 1);

	Graph G = graphReader.read(graphPath);

	INFO("n = " , G.numberOfNodes());
	INFO("m = " , G.numberOfEdges());

}

TEST_F(IOGTest, testSNAPGraphWriter) {
	METISGraphReader reader;
	Graph G = reader.read("input/jazz.graph");

	SNAPGraphWriter writer;
	writer.write(G, "output/SNAPGraphWriter.gr");
}

/* obsolete as FastMETISGraphReader has been removed */
/*
TEST_F(IOGTest, testFastMETISGraphReader) {
	FastMETISGraphReader reader;
	Graph G = reader.read("input/PGPgiantcompo.graph");

	EXPECT_EQ(10680u, G.numberOfNodes());
	EXPECT_EQ(24316u, G.numberOfEdges());

	Graph W = reader.read("input/lesmis.graph");

	EXPECT_EQ(77u, W.numberOfNodes());
	EXPECT_EQ(254u, W.numberOfEdges());
}*/

TEST_F(IOGTest, tryReadingMETISFile) {
	std::string graphPath;
	std::cout << "[INPUT] graph file path >" << std::endl;
	std::getline(std::cin, graphPath);

	METISGraphReader reader;
	Graph G = reader.read(graphPath);

	EXPECT_TRUE(true);
}

TEST_F(IOGTest, testGMLGraphWriterUndirected) {
	std::string path = "output/jazz2_undirected.gml";
	Graph G = Graph(5);
	G.addEdge(0,2);
	G.addEdge(0,1);
	G.addEdge(0,0);
	G.addEdge(1,1);

	GMLGraphWriter writer;
	writer.write(G,path);
	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;

}

TEST_F(IOGTest, testGMLGraphWriterDirected) {
	std::string path = "output/jazz2_directed.gml";
	Graph G = Graph(5,false,true);
	G.addEdge(0,2);
	G.addEdge(0,1);
	G.addEdge(0,0);
	G.addEdge(1,1);

	GMLGraphWriter writer;
	writer.write(G,path);
	bool exists = false;
	std::ifstream file(path);
	if (file) {
		exists = true;
	}
	EXPECT_TRUE(exists) << "A file should have been created : " << path;

}

TEST_F(IOGTest, testGMLGraphReaderUndirected) {
	std::string path = "input/jazz2_undirected.gml";
	GMLGraphReader reader;
	Graph G = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),5) << "number of nodes is not correct";
	EXPECT_TRUE(G.hasEdge(0,2));
	EXPECT_TRUE(G.hasEdge(0,1));
	EXPECT_TRUE(G.hasEdge(0,0));
	EXPECT_TRUE(G.hasEdge(1,1));
	EXPECT_FALSE(G.isDirected());
	EXPECT_TRUE(G.hasEdge(2,0));
	EXPECT_TRUE(G.hasEdge(1,0));
}

TEST_F(IOGTest, testGMLGraphReaderDirected) {
	std::string path = "input/jazz2_directed.gml";
	GMLGraphReader reader;
	Graph G = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),5) << "number of nodes is not correct";
	EXPECT_TRUE(G.hasEdge(0,2));
	EXPECT_TRUE(G.hasEdge(0,1));
	EXPECT_TRUE(G.hasEdge(0,0));
	EXPECT_TRUE(G.hasEdge(1,1));
	EXPECT_TRUE(G.isDirected());
	EXPECT_FALSE(G.hasEdge(2,0));
	EXPECT_FALSE(G.hasEdge(1,0));

}

TEST_F(IOGTest, testGraphToolBinaryReader) {
	std::string path = "input/power.gt";
	GraphToolBinaryReader reader;
	Graph G = reader.read(path);
	EXPECT_EQ(4941,G.numberOfNodes());
	EXPECT_EQ(6594,G.numberOfEdges());
	EXPECT_FALSE(G.isDirected());
}

TEST_F(IOGTest, testGraphToolBinaryWriter) {
	Graph G(10,false,false);
	G.addEdge(0,1);
	G.addEdge(2,1);
	G.addEdge(2,3);
	G.addEdge(3,4);
	G.addEdge(5,4);
	G.addEdge(5,6);
	G.addEdge(7,6);
	G.addEdge(8,6);
	G.addEdge(7,8);
	G.addEdge(9,8);
	G.addEdge(9,0);
	GraphToolBinaryReader reader;
	GraphToolBinaryWriter writer;
	std::string path = "output/test.gt";
	writer.write(G,path);
	Graph Gread = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),Gread.numberOfNodes());
	EXPECT_EQ(G.numberOfEdges(),Gread.numberOfEdges());
	EXPECT_EQ(G.isDirected(),Gread.isDirected());
	EXPECT_EQ(G.isWeighted(),Gread.isWeighted());
}

TEST_F(IOGTest, testGraphToolBinaryWriterWithDeletedNodes) {
	Graph G(10,false,false);
	G.removeNode(0);
	G.addEdge(2,1);
	G.addEdge(2,3);
	G.removeNode(4);
	G.addEdge(5,6);
	G.addEdge(7,6);
	G.addEdge(8,6);
	G.addEdge(7,8);
	G.removeNode(9);
	GraphToolBinaryReader reader;
	GraphToolBinaryWriter writer;
	std::string path = "output/test.gt";
	writer.write(G,path);
	Graph Gread = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),Gread.numberOfNodes());
	EXPECT_EQ(G.numberOfEdges(),Gread.numberOfEdges());
	EXPECT_EQ(G.isDirected(),Gread.isDirected());
	EXPECT_EQ(G.isWeighted(),Gread.isWeighted());
}

TEST_F(IOGTest, testGraphToolBinaryWriterDirected) {
	Graph G(10,false,true);
	G.addEdge(0,1);
	G.addEdge(2,1);
	G.addEdge(2,3);
	G.addEdge(3,4);
	G.addEdge(5,4);
	G.addEdge(5,6);
	G.addEdge(7,6);
	G.addEdge(8,6);
	G.addEdge(7,8);
	G.addEdge(9,8);
	G.addEdge(9,0);
	GraphToolBinaryReader reader;
	GraphToolBinaryWriter writer;
	std::string path = "output/test.gt";
	writer.write(G,path);
	Graph Gread = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),Gread.numberOfNodes());
	EXPECT_EQ(G.numberOfEdges(),Gread.numberOfEdges());
	EXPECT_EQ(G.isDirected(),Gread.isDirected());
	EXPECT_EQ(G.isWeighted(),Gread.isWeighted());
}

TEST_F(IOGTest, testGraphToolBinaryWriterWithDeletedNodesDirected) {
	Graph G(10,false,true);
	G.removeNode(0);
	G.addEdge(2,1);
	G.addEdge(2,3);
	G.removeNode(4);
	G.addEdge(5,6);
	G.addEdge(7,6);
	G.addEdge(8,6);
	G.addEdge(7,8);
	G.removeNode(9);
	GraphToolBinaryReader reader;
	GraphToolBinaryWriter writer;
	std::string path = "output/test.gt";
	writer.write(G,path);
	Graph Gread = reader.read(path);
	EXPECT_EQ(G.numberOfNodes(),Gread.numberOfNodes());
	EXPECT_EQ(G.numberOfEdges(),Gread.numberOfEdges());
	EXPECT_EQ(G.isDirected(),Gread.isDirected());
	EXPECT_EQ(G.isWeighted(),Gread.isWeighted());
}

} /* namespace NetworKit */

#endif /* NOGTEST */


text:
require 'google/protobuf'

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file("google/ads/googleads/v10/enums/education_placeholder_field.proto", :syntax => :proto3) do
    add_message "google.ads.googleads.v10.enums.EducationPlaceholderFieldEnum" do
    end
    add_enum "google.ads.googleads.v10.enums.EducationPlaceholderFieldEnum.EducationPlaceholderField" do
      value :UNSPECIFIED, 0
      value :UNKNOWN, 1
      value :PROGRAM_ID, 2
      value :LOCATION_ID, 3
      value :PROGRAM_NAME, 4
      value :AREA_OF_STUDY, 5
      value :PROGRAM_DESCRIPTION, 6
      value :SCHOOL_NAME, 7
      value :ADDRESS, 8
      value :THUMBNAIL_IMAGE_URL, 9
      value :ALTERNATIVE_THUMBNAIL_IMAGE_URL, 10
      value :FINAL_URLS, 11
      value :FINAL_MOBILE_URLS, 12
      value :TRACKING_URL, 13
      value :CONTEXTUAL_KEYWORDS, 14
      value :ANDROID_APP_LINK, 15
      value :SIMILAR_PROGRAM_IDS, 16
      value :IOS_APP_LINK, 17
      value :IOS_APP_STORE_ID, 18
    end
  end
end

module Google
  module Ads
    module GoogleAds
      module V10
        module Enums
          EducationPlaceholderFieldEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v10.enums.EducationPlaceholderFieldEnum").msgclass
          EducationPlaceholderFieldEnum::EducationPlaceholderField = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v10.enums.EducationPlaceholderFieldEnum.EducationPlaceholderField").enummodule
        end
      end
    end
  end
end


text:
using System.Linq;
using System.Xml.Linq;
using Orchard.Data;
using Orchard.Layouts.Models;
using Orchard.Localization;
using Orchard.Recipes.Services;

namespace Orchard.Layouts.Recipes.Builders {

    public class CustomElementsStep : RecipeBuilderStep {
        private readonly IRepository<ElementBlueprint> _repository;

        public CustomElementsStep(IRepository<ElementBlueprint> repository) {
            _repository = repository;
        }

        public override string Name {
            get { return "CustomElements"; }
        }

        public override LocalizedString DisplayName {
            get { return T("Custom Elements"); }
        }

        public override LocalizedString Description {
            get { return T("Exports custom defined elements."); }
        }

        public override void Build(BuildContext context) {
            var elements = _repository.Table.OrderBy(x => x.ElementTypeName).ToList();

            if (!elements.Any()) {
                return;
            }

            var root = new XElement("CustomElements");
            context.RecipeDocument.Element("Orchard").Add(root);

            foreach (var element in elements) {
                root.Add(new XElement("Element",
                    new XAttribute("ElementTypeName", element.ElementTypeName),
                    new XAttribute("BaseElementTypeName", element.BaseElementTypeName),
                    new XAttribute("ElementDisplayName", element.ElementDisplayName),
                    new XAttribute("ElementDescription", element.ElementDescription),
                    new XAttribute("ElementCategory", element.ElementCategory),
                    new XElement("BaseElementState", new XCData(element.BaseElementState))));
            }
        }
    }
}


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

<title>Uses of Class org.codehaus.jackson.map.InjectableValues (Jackson JSON Processor)</title>
<meta name="date" content="2013-07-14">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.codehaus.jackson.map.InjectableValues

Packages that use InjectableValues

Package
Description

org.codehaus.jackson.map

Contains basic mapper (conversion) functionality that
allows for converting between regular streaming json content and
Java objects (beans or Tree Model: support for both is via
ObjectMapper class, as well
as convenience methods included in
JsonParser

org.codehaus.jackson.map.deser

Contains implementation classes of deserialization part of
 data binding.

Uses of InjectableValues in org.codehaus.jackson.map

Subclasses of InjectableValues in org.codehaus.jackson.map

Modifier and Type
Class and Description

static class
InjectableValues.Std

Simple standard implementation which uses a simple Map to
 store values to inject, identified by simple String keys.

Fields in org.codehaus.jackson.map declared as InjectableValues

Modifier and Type
Field and Description

protected InjectableValues
ObjectReader._injectableValues

Values that can be injected during deserialization, if any.

protected InjectableValues
ObjectMapper._injectableValues

Provider for values to inject in deserialized POJOs.

Methods in org.codehaus.jackson.map with parameters of type InjectableValues

Modifier and Type
Method and Description

ObjectReader
ObjectMapper.reader(InjectableValues injectableValues)

Factory method for constructing ObjectReader that will
 use specified injectable values.

ObjectMapper
ObjectMapper.setInjectableValues(InjectableValues injectableValues)

ObjectReader
ObjectReader.withInjectableValues(InjectableValues injectableValues)

Method for constructing a new instance with configuration that uses
 passed InjectableValues to provide injectable values.

Constructors in org.codehaus.jackson.map with parameters of type InjectableValues

Constructor and Description

ObjectReader(ObjectMapper mapper,
            DeserializationConfig config,
            JavaType valueType,
            Object valueToUpdate,
            FormatSchema schema,
            InjectableValues injectableValues)

ObjectReader(ObjectReader base,
            DeserializationConfig config,
            JavaType valueType,
            Object valueToUpdate,
            FormatSchema schema,
            InjectableValues injectableValues)

Copy constructor used for building variations.

Uses of InjectableValues in org.codehaus.jackson.map.deser

Fields in org.codehaus.jackson.map.deser declared as InjectableValues

Modifier and Type
Field and Description

protected InjectableValues
StdDeserializationContext._injectableValues

Constructors in org.codehaus.jackson.map.deser with parameters of type InjectableValues

Constructor and Description

StdDeserializationContext(DeserializationConfig config,
                         JsonParser jp,
                         DeserializerProvider prov,
                         InjectableValues injectableValues)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
package com.s3s3l.jdbc.bind.express;

import com.s3s3l.jdbc.validator.ValidatorFactory;

/**
 * ClassName:ExpressFactory

 * Date: 2016年7月22日 下午5:19:54

 *
 * @author kehw_zwei
 * @version 1.0.0
 * @since JDK 1.8
 */
public interface ExpressFactory {

	<T> DataBindExpress getDataBindExpress(Class<T> modelType, ValidatorFactory validatorFactory);
}


text:
module Producer
  module Core
    class Env
      extend Forwardable
      def_delegators :@registry, :[]=, :key?

      attr_reader   :input, :output, :error_output, :registry, :logger
      attr_accessor :target, :verbose, :debug, :dry_run, :recipe_argv

      def initialize input: $stdin, output: $stdout, error_output: $stderr,
          remote: nil, registry: {}
        @verbose = @debug = @dry_run = false
        @input        = input
        @output       = output
        @error_output = error_output
        @remote       = remote
        @registry     = registry
      end

      def remote
        @remote ||= Remote.new(target)
      end

      def [] *args
        @registry.fetch *args
      rescue KeyError
        raise RegistryKeyError, args.first.inspect
      end
      alias get []

      def logger
        @logger ||= Logger.new(output).tap do |o|
          o.level     = verbose? ? Logger::INFO : Logger::WARN
          o.formatter = LoggerFormatter.new
        end
      end

      def log message, severity = :info
        logger.send severity, message
      end

      def verbose?
        @verbose
      end

      def debug?
        @debug
      end

      def dry_run?
        @dry_run
      end

      def cleanup
        remote.cleanup
      end
    end
  end
end


text:
// <copyright file="VideoOutputCallbackHandler.cs" company="Techyian">
// Copyright (c) Ian Auty and contributors. All rights reserved.
// Licensed under the MIT License. Please see LICENSE.txt for License info.
// </copyright>

using System;
using Microsoft.Extensions.Logging;
using MMALSharp.Common;
using MMALSharp.Common.Utility;
using MMALSharp.Components;
using MMALSharp.Config;
using MMALSharp.Handlers;
using MMALSharp.Native;
using MMALSharp.Ports.Outputs;
using MMALSharp.Processors.Motion;

namespace MMALSharp.Callbacks
{
    /// <summary>
    /// Represents a callback handler specifically for <see cref="MMALVideoEncoder"/> components.
    /// </summary>
    public class VideoOutputCallbackHandler : PortCallbackHandler<IVideoPort, IVideoCaptureHandler>, IVideoOutputCallbackHandler
    {
        /// <summary>
        /// Object containing properties used to determine when we should perform a file split.
        /// </summary>
        public Split Split { get; }

        /// <summary>
        /// States the time we last did a file split.
        /// </summary>
        public DateTime? LastSplit { get; private set; }

        /// <summary>
        /// Property to indicate whether on the next callback we should split. This is used so that we can request an I-Frame from the camera
        /// and this can be applied on the next run to the newly created file.
        /// </summary>
        private bool PrepareSplit { get; set; }

        /// <summary>
        /// Property to indicate whether we should store motion vectors when processing image frames.
        /// Motion vector data will be present when the buffer header equals "MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO".
        /// </summary>
        private bool StoreMotionVectors { get; }

        /// <summary>
        /// Creates a new instance of <see cref="VideoOutputCallbackHandler"/>.
        /// </summary>
        /// <param name="port">The working <see cref="IOutputPort"/>.</param>
        /// <param name="handler">The output port capture handler.</param>
        /// <param name="split">Configure to split into multiple files.</param>
        /// <param name="storeMotionVectors">Indicates whether we should store motion vectors.</param>
        public VideoOutputCallbackHandler(
            IVideoPort port,
            IVideoCaptureHandler handler,
            Split split,
            bool storeMotionVectors = false)
            : base(port, handler)
        {
            var motionType = this.WorkingPort.EncodingType == MMALEncoding.H264
                ? MotionType.MotionVector
                : MotionType.FrameDiff;

            if (handler != null && handler is IMotionCaptureHandler)
            {
                var motionHandler = handler as IMotionCaptureHandler;
                motionHandler.MotionType = motionType;
            }

            this.Split = split;
            this.StoreMotionVectors = storeMotionVectors;
        }

        /// <summary>
        /// The callback function to carry out.
        /// </summary>
        /// <param name="buffer">The working buffer header.</param>
        public override void Callback(IBuffer buffer)
        {
            if (MMALCameraConfig.Debug)
            {
                MMALLog.Logger.LogDebug("In video output callback");
            }

            if (this.PrepareSplit && buffer.AssertProperty(MMALBufferProperties.MMAL_BUFFER_HEADER_FLAG_CONFIG))
            {
                this.CaptureHandler.Split();
                LastSplit = DateTime.Now;
                this.PrepareSplit = false;
            }

            // Ensure that if we need to split then this is done before processing the buffer data.
            if (this.Split != null)
            {
                if (!this.LastSplit.HasValue)
                {
                    LastSplit = DateTime.Now;
                }

                if (DateTime.Now.CompareTo(this.CalculateSplit()) > 0)
                {
                    MMALLog.Logger.LogInformation("Preparing to split.");
                    this.PrepareSplit = true;
                    this.WorkingPort.SetParameter(MMALParametersVideo.MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME, true);
                }
            }

            if (this.StoreMotionVectors && buffer.AssertProperty(MMALBufferProperties.MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO))
            {
                // This is data containing Motion vectors. Check if the capture handler supports storing motion vectors.
                if (this.CaptureHandler is IMotionVectorCaptureHandler)
                {
                    var handler = this.CaptureHandler as IMotionVectorCaptureHandler;
                    handler?.ProcessMotionVectors(buffer.GetBufferData());
                }
            }
            else
            {
                // If user has requested to store motion vectors separately, do not store the motion vector data in the same file
                // as image frame data.
                base.Callback(buffer);
            }
        }

        private DateTime CalculateSplit()
        {
            DateTime tempDt = new DateTime(this.LastSplit.Value.Ticks);
            switch (this.Split.Mode)
            {
                case TimelapseMode.Millisecond:
                    return tempDt.AddMilliseconds(this.Split.Value);
                case TimelapseMode.Second:
                    return tempDt.AddSeconds(this.Split.Value);
                case TimelapseMode.Minute:
                    return tempDt.AddMinutes(this.Split.Value);
                default:
                    return tempDt.AddMinutes(this.Split.Value);
            }
        }
    }
}


text:
module.exports = {
  name: 'AST',
  init: function(){
    var AST = basis.require('basis.router.ast');
    var parsePath = AST.parsePath;
    var stringify = AST.stringify;

    function plain(name) {
      return { type: AST.TYPE.PLAIN_PARAM, name: name };
    }
    function any(name) {
      return { type: AST.TYPE.ANY_PARAM, name: name };
    }
    function word(name) {
      return { type: AST.TYPE.WORD, name: name };
    }
    function group() {
      return { type: AST.TYPE.GROUP, options: basis.array.from(arguments) };
    }
    function option() {
      return { type: AST.TYPE.GROUP_OPTION, children: basis.array.from(arguments) };
    }

    function ast(path) {
      return JSON.stringify(parsePath(path).ast);
    }
    function str(obj) {
      return JSON.stringify(obj);
    }
  },
  test: [
    {
      name: 'parsePath',
      test: [
        {
          name: 'simple case',
          test: function(){
            var actual = ast('foo/:bar/*baz');
            var expected = str([
              word('foo/'),
              plain('bar'),
              word('/'),
              any('baz')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'word with extra chars',
          test: function(){
            var actual = ast('/[]?{}/:bar/|+-.^');
            var expected = str([
              word('/[]?{}/'),
              plain('bar'),
              word('/|+-.^')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'group with one child',
          test: function(){
            var actual = ast('page/sub(/)(:rest)(complex/*sub)');
            var expected = str([
              word('page/sub'),
              group(
                option(
                  word('/')
                )
              ),
              group(
                option(
                  plain('rest')
                )
              ),
              group(
                option(
                  word('complex/'),
                  any('sub')
                )
              )
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'word with non-closing bracket',
          test: function(){
            var actual = ast('page/sub)(');
            var expected = str([
              word('page/sub)(')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'group with multiple options',
          test: function(){
            var actual = ast('page/(:foo|bar|*baz)/end');
            var expected = str([
              word('page/'),
              group(
                option(
                  plain('foo')
                ),
                option(
                  word('bar')
                ),
                option(
                  any('baz')
                )
              ),
              word('/end')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'recursive group',
          test: function(){
            var actual = ast('page/(:foo|(bar|:spam(/))|*baz)/end');
            var expected = str([
              word('page/'),
              group(
                option(
                  plain('foo')
                ),
                option(
                  group(
                    option(
                      word('bar')
                    ),
                    option(
                      plain('spam'),
                      group(
                        option(
                          word('/')
                        )
                      )
                    )
                  )
                ),
                option(
                  any('baz')
                )
              ),
              word('/end')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'escaping',
          test: function(){
            var actual = ast('page\\/\\(\\:foo\\|bar\\|\\*baz\\)\\/\\end\\\\');
            var expected = str([
              word('page/(:foo|bar|*baz)/end\\')
            ]);
            assert(actual == expected);
          }
        },
        {
          name: 'regexp - groups and params',
          test: function(){
            var actual = parsePath('page/(:foo|(bar|:spam(/))|*baz)/end').regexp.toString();
            var expected = new RegExp('^page\/(?:([^/]+)|(?:bar|([^/]+)(?:\/)?)?|(.*?))?\/end$', 'i').toString();
            assert(actual == expected);
          }
        },
        {
          name: 'regexp - escaping',
          test: function(){
            // page\/\(\:foo\|bar\|\*baz\)\/\end\\
            var actual = parsePath('page\\/\\(\\:foo\\|bar\\|\\*baz\\)\\/\\end\\\\').regexp.toString();
            var expected = new RegExp('^page\\/\\(\\:foo\\|bar\\|\\*baz\\)\\/\\end\\\\$', 'i').toString();
            assert(actual == expected);
          }
        },
        {
          name: 'regexp - symbols',
          test: function(){
            var actual = parsePath('/[]?{}/:bar/|+-.^').regexp.toString();
            var expected = new RegExp('^\\/\\[\\]\\?\\{\\}\\/([^/]+)\\/\\|\\+\\-\\.\\^$', 'i').toString();
            assert(actual == expected);
          }
        }
      ]
    },
    {
      name: 'stringify',
      test: [
        {
          name: 'word',
          test: function(){
            var actual = stringify([
              word('myword')
            ], {}, {});
            var expected = 'myword';
            assert(actual == expected);
          }
        },
        {
          name: 'plain param',
          test: function(){
            var actual = stringify([
              plain('plainParam')
            ], {
              plainParam: 'plainParam value'
            }, {
              plainParam: true // plainParam has modified value
            });
            var expected = 'plainParam%20value';
            assert(actual == expected);
          }
        },
        {
          name: 'any param',
          test: function(){
            var actual = stringify([
              any('anyParam')
            ], {
              anyParam: 'anyParam/value'
            }, {
              anyParam: true // anyParam has modified value
            });
            var expected = 'anyParam%2Fvalue';
            assert(actual == expected);
          }
        },
        {
          name: 'omits optional group without params',
          test: function(){
            var actual = stringify([
              word('begin'),
              group(
                option(
                  word('/end')
                )
              )
            ], {}, {});
            var expected = 'begin';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional group with any param',
          test: function(){
            var actual = stringify([
              word('begin'),
              group(
                option(
                  word('/'),
                  any('id')
                )
              )
            ], {
              id: 42
            }, {
              id: true // id has modified value
            });
            var expected = 'begin/42';
            assert(actual == expected);
          }
        },
        {
          name: 'omits optional group with plain param with default value',
          test: function(){
            var actual = stringify([
              word('begin'),
              group(
                option(
                  word('/'),
                  plain('id')
                )
              )
            ], {
              id: -1
            }, {
              id: false // id has default value
            });
            var expected = 'begin';
            assert(actual == expected);
          }
        },
        {
          name: 'omits optional group with any param with default value - recursive',
          test: function(){
            var actual = stringify([
              word('begin'),
              group(
                option(
                  word('/'),
                  plain('id')
                )
              )
            ], {
              id: 1
            }, {
              id: false // id has default value
            });
            var expected = 'begin';
            assert(actual == expected);
          }
        },
        {
          name: 'omits optional group with multiple options if there is no params between them',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  word('foo')
                ),
                option(
                  word('bar')
                ),
                option(
                  word('baz')
                )
              )
            ], {}, {});
            var expected = 'page/';
            assert(actual == expected);
          }
        },
        {
          name: 'omits optional group with multiple options if there is no nondefault params',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  word('foo')
                ),
                option(
                  plain('plainParam')
                ),
                option(
                  any('anyParam')
                )
              )
            ], {
              plainParam: 'plain',
              anyParam: 'any'
            }, {
              plainParam: false, // plainParam has default value
              anyParam: false // anyParam has default value
            });
            var expected = 'page/';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional group with specified param only',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  word('foo')
                ),
                option(
                  plain('plainParam')
                ),
                option(
                  any('anyParam')
                )
              )
            ], {
              plainParam: 'plain',
              anyParam: 'any'
            }, {
              plainParam: false, // plainParam has default value
              anyParam: true // anyParam has modified value
            });
            var expected = 'page/any';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional group with specified param only - recursive',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  word('foo')
                ),
                option(
                  group(
                    option(
                      word('bar')
                    ),
                    option(
                      plain('plainParam')
                    )
                  )
                ),
                option(
                  any('anyParam')
                )
              )
            ], {
              plainParam: 'plain',
              anyParam: 'any param'
            }, {
              plainParam: true, // plainParam has modified value
              anyParam: true // anyParam has modified value
            });
            var expected = 'page/plain?anyParam=any%20param';
            assert(actual == expected);
          }
        },
        {
          name: 'writes multiple optional params to query',
          test: function(){
            var actual = stringify([
              word('page/')
            ], {
              plainParam: 'plain',
              anyParam: 'any param'
            }, {
              plainParam: true, // plainParam has modified value
              anyParam: true // anyParam has modified value
            });
            var expected = 'page/?plainParam=plain&anyParam=any%20param';
            assert(actual == expected);
          }
        },
        {
          name: 'writes multiple optional params to query',
          test: function(){
            var actual = stringify([
              word('page/')
            ], {
              'basis js': 'framework'
            }, {
              'basis js': true // 'basis js' has modified value
            });
            var expected = 'page/?basis%20js=framework';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional groups with default params in case they precedes a nondefault param',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  plain('first'),
                  word('/')
                )
              ),
              group(
                option(
                  plain('second'),
                  word('/')
                )
              ),
              group(
                option(
                  plain('third'),
                  word('/')
                )
              ),
              group(
                option(
                  plain('fourth'),
                  word('/')
                )
              )
            ], {
              first: 1,
              second: 2,
              third: 3,
              fourth: 4
            }, {
              first: false, // first has default value
              second: false, // second has default value
              third: true, // third has modified value
              fourth: false // fourth has default value
            });

            var expected = 'page/1/2/3/';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional group with default params in case they precedes a required plain param',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  plain('first'),
                  word('/')
                )
              ),
              plain('second')
            ], {
              first: 1,
              second: 2
            }, {
              first: false, // first has default value
              second: false // second has default value
            });

            var expected = 'page/1/2';
            assert(actual == expected);
          }
        },
        {
          name: 'writes optional group with default params in case they precedes a word',
          test: function(){
            var actual = stringify([
              word('page/'),
              group(
                option(
                  plain('first'),
                  word('/')
                )
              ),
              word('second')
            ], {
              first: 1
            }, {
              first: false // first has default value
            });

            var expected = 'page/1/second';
            assert(actual == expected);
          }
        }
      ]
    }
  ]
};


text:
using System;
using Server.Targeting;
using Server.Network;
using Server.Regions;
using Server.Items;

namespace Server.Spells.Third
{
	public class TeleportSpell : MagerySpell
	{
		private static SpellInfo m_Info = new SpellInfo(
				"Teleport", "Rel Por",
				215,
				9031,
				Reagent.Bloodmoss,
				Reagent.MandrakeRoot
			);

		public override SpellCircle Circle { get { return SpellCircle.Third; } }

		public TeleportSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
		{
		}

		public override bool CheckCast()
		{
			if ( Factions.Sigil.ExistsOn( Caster ) )
			{
				Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
				return false;
			}
			else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
			{
				Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
				return false;
			}

			return SpellHelper.CheckTravel( Caster, TravelCheckType.TeleportFrom );
		}

		public override void OnCast()
		{
			Caster.Target = new InternalTarget( this );
		}

        public void Target(IPoint3D p)
        {
            IPoint3D orig = p;
            Map map = Caster.Map;

            SpellHelper.GetSurfaceTop(ref p);

            Point3D from = Caster.Location;
            Point3D to = new Point3D(p);

            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
            }
            else if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
            }
            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom))
            {
            }
            else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo))
            {
            }
            else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }
            else if (SpellHelper.CheckMulti(to, map))
            {
                Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
            }
            else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null)
            {
                Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, orig);

                Mobile m = Caster;

                m.Location = to;
                m.ProcessDelta();

                if (m.Player)
                {
                    Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                }
                else
                {
                    m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                }

                m.PlaySound(0x1FE);

                IPooledEnumerable eable = m.GetItemsInRange(0);

                foreach (Item item in eable)
                {
                    if (item is Server.Spells.Sixth.ParalyzeFieldSpell.InternalItem || item is Server.Spells.Fifth.PoisonFieldSpell.InternalItem || item is Server.Spells.Fourth.FireFieldSpell.FireFieldItem)
                        item.OnMoveOver(m);
                }

                eable.Free();
            }

            FinishSequence();
        }

		public class InternalTarget : Target
		{
			private TeleportSpell m_Owner;

			public InternalTarget( TeleportSpell owner ) : base( Core.ML ? 11 : 12, true, TargetFlags.None )
			{
				m_Owner = owner;
			}

			protected override void OnTarget( Mobile from, object o )
			{
				IPoint3D p = o as IPoint3D;

				if ( p != null )
					m_Owner.Target( p );
			}

			protected override void OnTargetFinish( Mobile from )
			{
				m_Owner.FinishSequence();
			}
		}
	}
}


text:
class AddRoutedToCaliperEvents < ActiveRecord::Migration[5.0]
  def change
    add_column :caliper_events, :routed, :boolean
  end
end


text:
<?php

use UthandoContact\Controller\ContactController;
use UthandoContact\Controller\SettingsController;
use UthandoContact\Form\AbstractLineFieldSet;
use UthandoContact\Form\CompanyFieldSet;
use UthandoContact\Form\ContactForm;
use UthandoContact\Form\ContactSettings;
use UthandoContact\Form\DetailsFieldSet;
use UthandoContact\Form\FormFieldSet;
use UthandoContact\Form\GoogleMapFieldSet;
use UthandoContact\Form\View\Helper\AbstractLineFormCollection;
use UthandoContact\InputFilter\ContactInputFilter;
use UthandoContact\InputFilter\ContactInputFilterFactory;
use UthandoContact\Options\CompanyOptions;
use UthandoContact\Options\DetailsOptions;
use UthandoContact\Options\FormOptions;
use UthandoContact\Options\GoogleMapOptions;
use UthandoContact\Options\Service\CompanyOptionsFactory;
use UthandoContact\Options\Service\DetailsOptionsFactory;
use UthandoContact\Options\Service\FormOptionsFactory;
use UthandoContact\Options\Service\GoogleMapOptionsFactory;
use UthandoContact\ServiceManager\ContactService;
use UthandoContact\View\Helper\Contact;
use Zend\ServiceManager\Factory\InvokableFactory;

return [
    'controllers' => [
        'invokables' => [
            ContactController::class    => ContactController::class,
            SettingsController::class   => SettingsController::class,
        ],
    ],
    'form_elements' => [
        'factories' => [
            AbstractLineFieldSet::class => InvokableFactory::class,
            CompanyFieldSet::class      => InvokableFactory::class,
            ContactForm::class          => InvokableFactory::class,
            ContactSettings::class      => InvokableFactory::class,
            DetailsFieldSet::class      => InvokableFactory::class,
            FormFieldSet::class         => InvokableFactory::class,
            GoogleMapFieldSet::class    => InvokableFactory::class
        ],
    ],
    'input_filters' => [
        'factories' => [
           ContactInputFilter::class => ContactInputFilterFactory::class,
        ],
    ],
    'service_manager' => [
        'factories' => [
            CompanyOptions::class   => CompanyOptionsFactory::class,
            DetailsOptions::class   => DetailsOptionsFactory::class,
            FormOptions::class      => FormOptionsFactory::class,
            GoogleMapOptions::class => GoogleMapOptionsFactory::class,
        ],
        'invokables' => [
            ContactService::class => ContactService::class,
        ],
    ],
    'view_helpers' => [
        'aliases' => [
            'contact'                       => Contact::class,
            'abstractLineFormCollection'    => AbstractLineFormCollection::class,
        ],
        'invokables' => [
            Contact::class                      => Contact::class,
            AbstractLineFormCollection::class   => AbstractLineFormCollection::class,
        ],
    ],
    'view_manager'  => [
        'template_map' => include __DIR__ . '/../template_map.php'
    ],
    'router' => [
        'routes' => [
            'contact' => [
                'type' => 'Literal',
                'options' => [
                    'route' => '/contact',
                    'defaults' => [
                        '__NAMESPACE__' => 'UthandoContact\Controller',
                        'controller'    => ContactController::class,
                        'action'        => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'process' => [
                        'type' => 'Literal',
                        'options' => [
                            'route' => '/process',
                            'defaults' => [
                                'action' => 'process'
                            ],
                        ],
                    ],
                    'thank-you' => [
                        'type' => 'Literal',
                        'options' => [
                            'route' => '/thank-you',
                            'defaults' => [
                                'action' => 'thank-you'
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
    'navigation' => [
        'default' => [
            'contact' => [
                'label' => 'ContactService',
                'route' => 'contact',
            ],
        ],
    ],
];


text:
FROM centos:centos7
#FROM fedora:rawhide
MAINTAINER Andrew Matheny <andrew.j.matheny@gmail.com>

ENV container docker
RUN yum -y update; yum clean all
RUN yum -y install epel-release

RUN yum -y install systemd; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

RUN curl -o install_salt.sh -L https://bootstrap.saltstack.com
RUN sh install_salt.sh -X -p python-gnupg

# 2016.3.1
RUN yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el7.noarch.rpm
RUN yum -y clean expire-cache
RUN yum -y update salt-minion; yum clean all

ADD run.sh /usr/local/bin/run.sh
#RUN chmod +xw /usr/local/bin/run.sh

VOLUME ["/sys/fs/cgroup"]
VOLUME /srv/pillar
VOLUME /srv/salt
VOLUME /srv/reactor
VOLUME /var/log/salt
VOLUME /var/cache/salt

#CMD ["/usr/local/bin/run.sh; /usr/sbin/init"]
CMD ["/usr/sbin/init"]


text:
package tools.xor.service;

import javax.sql.DataSource;

import tools.xor.TypeMapper;
import tools.xor.providers.jdbc.JDBCConfigDataModel;

public class JDBCConfigDataModelBuilder implements DataModelBuilder {

    DataSource dataSource;

    public DataSource getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    /**
     * Build the DataModel and initialize it with the provided TypeMapper instance
     * @param typeMapper used to derive an external model from the built model
     * @return DataModel instance
     */
    public DataModel build(String name, TypeMapper typeMapper, AbstractDataModelFactory dataModelFactory) {
        JDBCConfigDataModel model = new JDBCConfigDataModel(dataModelFactory, typeMapper);
        model.setDataSource(getDataSource());

        return model;
    }
}