text:
#include <linux/types.h>
#include <linux/kernel.h>

#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/rio.h>
#include <linux/rio_drv.h>
#include <linux/rio_ids.h>
#include <linux/rio_regs.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include <linux/slab.h>

#include "rio.h"

LIST_HEAD(rio_devices);
static LIST_HEAD(rio_switches);

#define RIO_ENUM_CMPL_MAGIC	0xdeadbeef

static void rio_enum_timeout(unsigned long);

DEFINE_SPINLOCK(rio_global_list_lock);

static int next_destid = 0;
static int next_switchid = 0;
static int next_net = 0;

static struct timer_list rio_enum_timer =
TIMER_INITIALIZER(rio_enum_timeout, 0, 0);

static int rio_mport_phys_table[] = {
	RIO_EFB_PAR_EP_ID,
	RIO_EFB_PAR_EP_REC_ID,
	RIO_EFB_SER_EP_ID,
	RIO_EFB_SER_EP_REC_ID,
	-1,
};

static int rio_sport_phys_table[] = {
	RIO_EFB_PAR_EP_FREE_ID,
	RIO_EFB_SER_EP_FREE_ID,
	-1,
};

/**
 * rio_get_device_id - Get the base/extended device id for a device
 * @port: RIO master port
 * @destid: Destination ID of device
 * @hopcount: Hopcount to device
 *
 * Reads the base/extended device id from a device. Returns the
 * 8/16-bit device ID.
 */
static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
{
	u32 result;

	rio_mport_read_config_32(port, destid, hopcount, RIO_DID_CSR, &result);

	return RIO_GET_DID(result);
}

/**
 * rio_set_device_id - Set the base/extended device id for a device
 * @port: RIO master port
 * @destid: Destination ID of device
 * @hopcount: Hopcount to device
 * @did: Device ID value to be written
 *
 * Writes the base/extended device id from a device.
 */
static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did)
{
	rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR,
				  RIO_SET_DID(did));
}

/**
 * rio_local_set_device_id - Set the base/extended device id for a port
 * @port: RIO master port
 * @did: Device ID value to be written
 *
 * Writes the base/extended device id from a device.
 */
static void rio_local_set_device_id(struct rio_mport *port, u16 did)
{
	rio_local_write_config_32(port, RIO_DID_CSR, RIO_SET_DID(did));
}

/**
 * rio_clear_locks- Release all host locks and signal enumeration complete
 * @port: Master port to issue transaction
 *
 * Marks the component tag CSR on each device with the enumeration
 * complete flag. When complete, it then release the host locks on
 * each device. Returns 0 on success or %-EINVAL on failure.
 */
static int rio_clear_locks(struct rio_mport *port)
{
	struct rio_dev *rdev;
	u32 result;
	int ret = 0;

	/* Write component tag CSR magic complete value */
	rio_local_write_config_32(port, RIO_COMPONENT_TAG_CSR,
				  RIO_ENUM_CMPL_MAGIC);
	list_for_each_entry(rdev, &rio_devices, global_list)
	    rio_write_config_32(rdev, RIO_COMPONENT_TAG_CSR,
				RIO_ENUM_CMPL_MAGIC);

	/* Release host device id locks */
	rio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR,
				  port->host_deviceid);
	rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result);
	if ((result & 0xffff) != 0xffff) {
		printk(KERN_INFO
		       "RIO: badness when releasing host lock on master port, result %8.8x\n",
		       result);
		ret = -EINVAL;
	}
	list_for_each_entry(rdev, &rio_devices, global_list) {
		rio_write_config_32(rdev, RIO_HOST_DID_LOCK_CSR,
				    port->host_deviceid);
		rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result);
		if ((result & 0xffff) != 0xffff) {
			printk(KERN_INFO
			       "RIO: badness when releasing host lock on vid %4.4x did %4.4x\n",
			       rdev->vid, rdev->did);
			ret = -EINVAL;
		}
	}

	return ret;
}

/**
 * rio_enum_host- Set host lock and initialize host destination ID
 * @port: Master port to issue transaction
 *
 * Sets the local host master port lock and destination ID register
 * with the host device ID value. The host device ID value is provided
 * by the platform. Returns %0 on success or %-1 on failure.
 */
static int rio_enum_host(struct rio_mport *port)
{
	u32 result;

	/* Set master port host device id lock */
	rio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR,
				  port->host_deviceid);

	rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result);
	if ((result & 0xffff) != port->host_deviceid)
		return -1;

	/* Set master port destid and init destid ctr */
	rio_local_set_device_id(port, port->host_deviceid);

	if (next_destid == port->host_deviceid)
		next_destid++;

	return 0;
}

/**
 * rio_device_has_destid- Test if a device contains a destination ID register
 * @port: Master port to issue transaction
 * @src_ops: RIO device source operations
 * @dst_ops: RIO device destination operations
 *
 * Checks the provided @src_ops and @dst_ops for the necessary transaction
 * capabilities that indicate whether or not a device will implement a
 * destination ID register. Returns 1 if true or 0 if false.
 */
static int rio_device_has_destid(struct rio_mport *port, int src_ops,
				 int dst_ops)
{
	u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP | RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC | RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR;

	return !!((src_ops | dst_ops) & mask);
}

/**
 * rio_release_dev- Frees a RIO device struct
 * @dev: LDM device associated with a RIO device struct
 *
 * Gets the RIO device struct associated a RIO device struct.
 * The RIO device struct is freed.
 */
static void rio_release_dev(struct device *dev)
{
	struct rio_dev *rdev;

	rdev = to_rio_dev(dev);
	kfree(rdev);
}

/**
 * rio_is_switch- Tests if a RIO device has switch capabilities
 * @rdev: RIO device
 *
 * Gets the RIO device Processing Element Features register
 * contents and tests for switch capabilities. Returns 1 if
 * the device is a switch or 0 if it is not a switch.
 * The RIO device struct is freed.
 */
static int rio_is_switch(struct rio_dev *rdev)
{
	if (rdev->pef & RIO_PEF_SWITCH)
		return 1;
	return 0;
}

/**
 * rio_route_set_ops- Sets routing operations for a particular vendor switch
 * @rdev: RIO device
 *
 * Searches the RIO route ops table for known switch types. If the vid
 * and did match a switch table entry, then set the add_entry() and
 * get_entry() ops to the table entry values.
 */
static void rio_route_set_ops(struct rio_dev *rdev)
{
	struct rio_route_ops *cur = __start_rio_route_ops;
	struct rio_route_ops *end = __end_rio_route_ops;

	while (cur < end) {
		if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) {
			pr_debug("RIO: adding routing ops for %s\n", rio_name(rdev));
			rdev->rswitch->add_entry = cur->add_hook;
			rdev->rswitch->get_entry = cur->get_hook;
		}
		cur++;
	}

	if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry)
		printk(KERN_ERR "RIO: missing routing ops for %s\n",
		       rio_name(rdev));
}

/**
 * rio_add_device- Adds a RIO device to the device model
 * @rdev: RIO device
 *
 * Adds the RIO device to the global device list and adds the RIO
 * device to the RIO device list.  Creates the generic sysfs nodes
 * for an RIO device.
 */
static void __devinit rio_add_device(struct rio_dev *rdev)
{
	device_add(&rdev->dev);

	spin_lock(&rio_global_list_lock);
	list_add_tail(&rdev->global_list, &rio_devices);
	spin_unlock(&rio_global_list_lock);

	rio_create_sysfs_dev_files(rdev);
}

/**
 * rio_setup_device- Allocates and sets up a RIO device
 * @net: RIO network
 * @port: Master port to send transactions
 * @destid: Current destination ID
 * @hopcount: Current hopcount
 * @do_enum: Enumeration/Discovery mode flag
 *
 * Allocates a RIO device and configures fields based on configuration
 * space contents. If device has a destination ID register, a destination
 * ID is either assigned in enumeration mode or read from configuration
 * space in discovery mode.  If the device has switch capabilities, then
 * a switch is allocated and configured appropriately. Returns a pointer
 * to a RIO device on success or NULL on failure.
 *
 */
static struct rio_dev *rio_setup_device(struct rio_net *net,
					struct rio_mport *port, u16 destid,
					u8 hopcount, int do_enum)
{
	struct rio_dev *rdev;
	struct rio_switch *rswitch;
	int result, rdid;

	rdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL);
	if (!rdev)
		goto out;

	memset(rdev, 0, sizeof(struct rio_dev));
	rdev->net = net;
	rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR,
				 &result);
	rdev->did = result >> 16;
	rdev->vid = result & 0xffff;
	rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_INFO_CAR,
				 &rdev->device_rev);
	rio_mport_read_config_32(port, destid, hopcount, RIO_ASM_ID_CAR,
				 &result);
	rdev->asm_did = result >> 16;
	rdev->asm_vid = result & 0xffff;
	rio_mport_read_config_32(port, destid, hopcount, RIO_ASM_INFO_CAR,
				 &result);
	rdev->asm_rev = result >> 16;
	rio_mport_read_config_32(port, destid, hopcount, RIO_PEF_CAR,
				 &rdev->pef);
	if (rdev->pef & RIO_PEF_EXT_FEATURES)
		rdev->efptr = result & 0xffff;

	rio_mport_read_config_32(port, destid, hopcount, RIO_SRC_OPS_CAR,
				 &rdev->src_ops);
	rio_mport_read_config_32(port, destid, hopcount, RIO_DST_OPS_CAR,
				 &rdev->dst_ops);

	if (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops)) {
		if (do_enum) {
			rio_set_device_id(port, destid, hopcount, next_destid);
			rdev->destid = next_destid++;
			if (next_destid == port->host_deviceid)
				next_destid++;
		} else
			rdev->destid = rio_get_device_id(port, destid, hopcount);
	} else
		/* Switch device has an associated destID */
		rdev->destid = RIO_INVALID_DESTID;

	/* If a PE has both switch and other functions, show it as a switch */
	if (rio_is_switch(rdev)) {
		rio_mport_read_config_32(port, destid, hopcount,
					 RIO_SWP_INFO_CAR, &rdev->swpinfo);
		rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL);
		if (!rswitch) {
			kfree(rdev);
			rdev = NULL;
			goto out;
		}
		rswitch->switchid = next_switchid;
		rswitch->hopcount = hopcount;
		rswitch->destid = destid;
		/* Initialize switch route table */
		for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++)
			rswitch->route_table[rdid] = RIO_INVALID_ROUTE;
		rdev->rswitch = rswitch;
		sprintf(rio_name(rdev), "%02x:s:%04x", rdev->net->id,
			rdev->rswitch->switchid);
		rio_route_set_ops(rdev);

		list_add_tail(&rswitch->node, &rio_switches);

	} else
		sprintf(rio_name(rdev), "%02x:e:%04x", rdev->net->id,
			rdev->destid);

	rdev->dev.bus = &rio_bus_type;

	device_initialize(&rdev->dev);
	rdev->dev.release = rio_release_dev;
	rio_dev_get(rdev);

	rdev->dma_mask = DMA_32BIT_MASK;
	rdev->dev.dma_mask = &rdev->dma_mask;
	rdev->dev.coherent_dma_mask = DMA_32BIT_MASK;

	if ((rdev->pef & RIO_PEF_INB_DOORBELL) &&
	    (rdev->dst_ops & RIO_DST_OPS_DOORBELL))
		rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
				   0, 0xffff);

	rio_add_device(rdev);

      out:
	return rdev;
}

/**
 * rio_sport_is_active- Tests if a switch port has an active connection.
 * @port: Master port to send transaction
 * @destid: Associated destination ID for switch
 * @hopcount: Hopcount to reach switch
 * @sport: Switch port number
 *
 * Reads the port error status CSR for a particular switch port to
 * determine if the port has an active link.  Returns
 * %PORT_N_ERR_STS_PORT_OK if the port is active or %0 if it is
 * inactive.
 */
static int
rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport)
{
	u32 result;
	u32 ext_ftr_ptr;

	int *entry = rio_sport_phys_table;

	do {
		if ((ext_ftr_ptr =
		     rio_mport_get_feature(port, 0, destid, hopcount, *entry)))

			break;
	} while (*++entry >= 0);

	if (ext_ftr_ptr)
		rio_mport_read_config_32(port, destid, hopcount,
					 ext_ftr_ptr +
					 RIO_PORT_N_ERR_STS_CSR(sport),
					 &result);

	return (result & PORT_N_ERR_STS_PORT_OK);
}

/**
 * rio_route_add_entry- Add a route entry to a switch routing table
 * @mport: Master port to send transaction
 * @rswitch: Switch device
 * @table: Routing table ID
 * @route_destid: Destination ID to be routed
 * @route_port: Port number to be routed
 *
 * Calls the switch specific add_entry() method to add a route entry
 * on a switch. The route table can be specified using the @table
 * argument if a switch has per port routing tables or the normal
 * use is to specific all tables (or the global table) by passing
 * %RIO_GLOBAL_TABLE in @table. Returns %0 on success or %-EINVAL
 * on failure.
 */
static int rio_route_add_entry(struct rio_mport *mport, struct rio_switch *rswitch,
			       u16 table, u16 route_destid, u8 route_port)
{
	return rswitch->add_entry(mport, rswitch->destid,
					rswitch->hopcount, table,
					route_destid, route_port);
}

/**
 * rio_route_get_entry- Read a route entry in a switch routing table
 * @mport: Master port to send transaction
 * @rswitch: Switch device
 * @table: Routing table ID
 * @route_destid: Destination ID to be routed
 * @route_port: Pointer to read port number into
 *
 * Calls the switch specific get_entry() method to read a route entry
 * in a switch. The route table can be specified using the @table
 * argument if a switch has per port routing tables or the normal
 * use is to specific all tables (or the global table) by passing
 * %RIO_GLOBAL_TABLE in @table. Returns %0 on success or %-EINVAL
 * on failure.
 */
static int
rio_route_get_entry(struct rio_mport *mport, struct rio_switch *rswitch, u16 table,
		    u16 route_destid, u8 * route_port)
{
	return rswitch->get_entry(mport, rswitch->destid,
					rswitch->hopcount, table,
					route_destid, route_port);
}

/**
 * rio_get_host_deviceid_lock- Reads the Host Device ID Lock CSR on a device
 * @port: Master port to send transaction
 * @hopcount: Number of hops to the device
 *
 * Used during enumeration to read the Host Device ID Lock CSR on a
 * RIO device. Returns the value of the lock register.
 */
static u16 rio_get_host_deviceid_lock(struct rio_mport *port, u8 hopcount)
{
	u32 result;

	rio_mport_read_config_32(port, RIO_ANY_DESTID, hopcount,
				 RIO_HOST_DID_LOCK_CSR, &result);

	return (u16) (result & 0xffff);
}

/**
 * rio_get_swpinfo_inport- Gets the ingress port number
 * @mport: Master port to send transaction
 * @destid: Destination ID associated with the switch
 * @hopcount: Number of hops to the device
 *
 * Returns port number being used to access the switch device.
 */
static u8
rio_get_swpinfo_inport(struct rio_mport *mport, u16 destid, u8 hopcount)
{
	u32 result;

	rio_mport_read_config_32(mport, destid, hopcount, RIO_SWP_INFO_CAR,
				 &result);

	return (u8) (result & 0xff);
}

/**
 * rio_get_swpinfo_tports- Gets total number of ports on the switch
 * @mport: Master port to send transaction
 * @destid: Destination ID associated with the switch
 * @hopcount: Number of hops to the device
 *
 * Returns total numbers of ports implemented by the switch device.
 */
static u8 rio_get_swpinfo_tports(struct rio_mport *mport, u16 destid,
				 u8 hopcount)
{
	u32 result;

	rio_mport_read_config_32(mport, destid, hopcount, RIO_SWP_INFO_CAR,
				 &result);

	return RIO_GET_TOTAL_PORTS(result);
}

/**
 * rio_net_add_mport- Add a master port to a RIO network
 * @net: RIO network
 * @port: Master port to add
 *
 * Adds a master port to the network list of associated master
 * ports..
 */
static void rio_net_add_mport(struct rio_net *net, struct rio_mport *port)
{
	spin_lock(&rio_global_list_lock);
	list_add_tail(&port->nnode, &net->mports);
	spin_unlock(&rio_global_list_lock);
}

/**
 * rio_enum_peer- Recursively enumerate a RIO network through a master port
 * @net: RIO network being enumerated
 * @port: Master port to send transactions
 * @hopcount: Number of hops into the network
 *
 * Recursively enumerates a RIO network.  Transactions are sent via the
 * master port passed in @port.
 */
static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
			 u8 hopcount)
{
	int port_num;
	int num_ports;
	int cur_destid;
	int sw_destid;
	int sw_inport;
	struct rio_dev *rdev;
	u16 destid;
	int tmp;

	if (rio_get_host_deviceid_lock(port, hopcount) == port->host_deviceid) {
		pr_debug("RIO: PE already discovered by this host\n");
		/*
		 * Already discovered by this host. Add it as another
		 * master port for the current network.
		 */
		rio_net_add_mport(net, port);
		return 0;
	}

	/* Attempt to acquire device lock */
	rio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount,
				  RIO_HOST_DID_LOCK_CSR, port->host_deviceid);
	while ((tmp = rio_get_host_deviceid_lock(port, hopcount))
	       < port->host_deviceid) {
		/* Delay a bit */
		mdelay(1);
		/* Attempt to acquire device lock again */
		rio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount,
					  RIO_HOST_DID_LOCK_CSR,
					  port->host_deviceid);
	}

	if (rio_get_host_deviceid_lock(port, hopcount) > port->host_deviceid) {
		pr_debug(
		    "RIO: PE locked by a higher priority host...retreating\n");
		return -1;
	}

	/* Setup new RIO device */
	if ((rdev = rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) {
		/* Add device to the global and bus/net specific list. */
		list_add_tail(&rdev->net_list, &net->devices);
	} else
		return -1;

	if (rio_is_switch(rdev)) {
		next_switchid++;
		sw_inport = rio_get_swpinfo_inport(port, RIO_ANY_DESTID, hopcount);
		rio_route_add_entry(port, rdev->rswitch, RIO_GLOBAL_TABLE,
				    port->host_deviceid, sw_inport);
		rdev->rswitch->route_table[port->host_deviceid] = sw_inport;

		for (destid = 0; destid < next_destid; destid++) {
			if (destid == port->host_deviceid)
				continue;
			rio_route_add_entry(port, rdev->rswitch, RIO_GLOBAL_TABLE,
					    destid, sw_inport);
			rdev->rswitch->route_table[destid] = sw_inport;
		}

		num_ports =
		    rio_get_swpinfo_tports(port, RIO_ANY_DESTID, hopcount);
		pr_debug(
		    "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
		    rio_name(rdev), rdev->vid, rdev->did, num_ports);
		sw_destid = next_destid;
		for (port_num = 0; port_num < num_ports; port_num++) {
			if (sw_inport == port_num)
				continue;

			cur_destid = next_destid;

			if (rio_sport_is_active
			    (port, RIO_ANY_DESTID, hopcount, port_num)) {
				pr_debug(
				    "RIO: scanning device on port %d\n",
				    port_num);
				rio_route_add_entry(port, rdev->rswitch,
						    RIO_GLOBAL_TABLE,
						    RIO_ANY_DESTID, port_num);

				if (rio_enum_peer(net, port, hopcount + 1) < 0)
					return -1;

				/* Update routing tables */
				if (next_destid > cur_destid) {
					for (destid = cur_destid;
					     destid < next_destid; destid++) {
						if (destid == port->host_deviceid)
							continue;
						rio_route_add_entry(port, rdev->rswitch,
								    RIO_GLOBAL_TABLE,
								    destid,
								    port_num);
						rdev->rswitch->
						    route_table[destid] =
						    port_num;
					}
				}
			}
		}

		/* Check for empty switch */
		if (next_destid == sw_destid) {
			next_destid++;
			if (next_destid == port->host_deviceid)
				next_destid++;
		}

		rdev->rswitch->destid = sw_destid;
	} else
		pr_debug("RIO: found %s (vid %4.4x did %4.4x)\n",
		    rio_name(rdev), rdev->vid, rdev->did);

	return 0;
}

/**
 * rio_enum_complete- Tests if enumeration of a network is complete
 * @port: Master port to send transaction
 *
 * Tests the Component Tag CSR for presence of the magic enumeration
 * complete flag. Return %1 if enumeration is complete or %0 if
 * enumeration is incomplete.
 */
static int rio_enum_complete(struct rio_mport *port)
{
	u32 tag_csr;
	int ret = 0;

	rio_local_read_config_32(port, RIO_COMPONENT_TAG_CSR, &tag_csr);

	if (tag_csr == RIO_ENUM_CMPL_MAGIC)
		ret = 1;

	return ret;
}

/**
 * rio_disc_peer- Recursively discovers a RIO network through a master port
 * @net: RIO network being discovered
 * @port: Master port to send transactions
 * @destid: Current destination ID in network
 * @hopcount: Number of hops into the network
 *
 * Recursively discovers a RIO network.  Transactions are sent via the
 * master port passed in @port.
 */
static int
rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
	      u8 hopcount)
{
	u8 port_num, route_port;
	int num_ports;
	struct rio_dev *rdev;
	u16 ndestid;

	/* Setup new RIO device */
	if ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) {
		/* Add device to the global and bus/net specific list. */
		list_add_tail(&rdev->net_list, &net->devices);
	} else
		return -1;

	if (rio_is_switch(rdev)) {
		next_switchid++;

		/* Associated destid is how we accessed this switch */
		rdev->rswitch->destid = destid;

		num_ports = rio_get_swpinfo_tports(port, destid, hopcount);
		pr_debug(
		    "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
		    rio_name(rdev), rdev->vid, rdev->did, num_ports);
		for (port_num = 0; port_num < num_ports; port_num++) {
			if (rio_get_swpinfo_inport(port, destid, hopcount) ==
			    port_num)
				continue;

			if (rio_sport_is_active
			    (port, destid, hopcount, port_num)) {
				pr_debug(
				    "RIO: scanning device on port %d\n",
				    port_num);
				for (ndestid = 0; ndestid < RIO_ANY_DESTID;
				     ndestid++) {
					rio_route_get_entry(port, rdev->rswitch,
							    RIO_GLOBAL_TABLE,
							    ndestid,
							    &route_port);
					if (route_port == port_num)
						break;
				}

				if (rio_disc_peer
				    (net, port, ndestid, hopcount + 1) < 0)
					return -1;
			}
		}
	} else
		pr_debug("RIO: found %s (vid %4.4x did %4.4x)\n",
		    rio_name(rdev), rdev->vid, rdev->did);

	return 0;
}

/**
 * rio_mport_is_active- Tests if master port link is active
 * @port: Master port to test
 *
 * Reads the port error status CSR for the master port to
 * determine if the port has an active link.  Returns
 * %PORT_N_ERR_STS_PORT_OK if the  master port is active
 * or %0 if it is inactive.
 */
static int rio_mport_is_active(struct rio_mport *port)
{
	u32 result = 0;
	u32 ext_ftr_ptr;
	int *entry = rio_mport_phys_table;

	do {
		if ((ext_ftr_ptr =
		     rio_mport_get_feature(port, 1, 0, 0, *entry)))
			break;
	} while (*++entry >= 0);

	if (ext_ftr_ptr)
		rio_local_read_config_32(port,
					 ext_ftr_ptr +
					 RIO_PORT_N_ERR_STS_CSR(port->index),
					 &result);

	return (result & PORT_N_ERR_STS_PORT_OK);
}

/**
 * rio_alloc_net- Allocate and configure a new RIO network
 * @port: Master port associated with the RIO network
 *
 * Allocates a RIO network structure, initializes per-network
 * list heads, and adds the associated master port to the
 * network list of associated master ports. Returns a
 * RIO network pointer on success or %NULL on failure.
 */
static struct rio_net __devinit *rio_alloc_net(struct rio_mport *port)
{
	struct rio_net *net;

	net = kmalloc(sizeof(struct rio_net), GFP_KERNEL);
	if (net) {
		memset(net, 0, sizeof(struct rio_net));
		INIT_LIST_HEAD(&net->node);
		INIT_LIST_HEAD(&net->devices);
		INIT_LIST_HEAD(&net->mports);
		list_add_tail(&port->nnode, &net->mports);
		net->hport = port;
		net->id = next_net++;
	}
	return net;
}

/**
 * rio_update_route_tables- Updates route tables in switches
 * @port: Master port associated with the RIO network
 *
 * For each enumerated device, ensure that each switch in a system
 * has correct routing entries. Add routes for devices that where
 * unknown dirung the first enumeration pass through the switch.
 */
static void rio_update_route_tables(struct rio_mport *port)
{
	struct rio_dev *rdev;
	struct rio_switch *rswitch;
	u8 sport;
	u16 destid;

	list_for_each_entry(rdev, &rio_devices, global_list) {

		destid = (rio_is_switch(rdev))?rdev->rswitch->destid:rdev->destid;

		list_for_each_entry(rswitch, &rio_switches, node) {

			if (rio_is_switch(rdev)	&& (rdev->rswitch == rswitch))
				continue;

			if (RIO_INVALID_ROUTE == rswitch->route_table[destid]) {

				sport = rio_get_swpinfo_inport(port,
						rswitch->destid, rswitch->hopcount);

				if (rswitch->add_entry)	{
					rio_route_add_entry(port, rswitch, RIO_GLOBAL_TABLE, destid, sport);
					rswitch->route_table[destid] = sport;
				}
			}
		}
	}
}

/**
 * rio_enum_mport- Start enumeration through a master port
 * @mport: Master port to send transactions
 *
 * Starts the enumeration process. If somebody has enumerated our
 * master port device, then give up. If not and we have an active
 * link, then start recursive peer enumeration. Returns %0 if
 * enumeration succeeds or %-EBUSY if enumeration fails.
 */
int rio_enum_mport(struct rio_mport *mport)
{
	struct rio_net *net = NULL;
	int rc = 0;

	printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id,
	       mport->name);
	/* If somebody else enumerated our master port device, bail. */
	if (rio_enum_host(mport) < 0) {
		printk(KERN_INFO
		       "RIO: master port %d device has been enumerated by a remote host\n",
		       mport->id);
		rc = -EBUSY;
		goto out;
	}

	/* If master port has an active link, allocate net and enum peers */
	if (rio_mport_is_active(mport)) {
		if (!(net = rio_alloc_net(mport))) {
			printk(KERN_ERR "RIO: failed to allocate new net\n");
			rc = -ENOMEM;
			goto out;
		}
		if (rio_enum_peer(net, mport, 0) < 0) {
			/* A higher priority host won enumeration, bail. */
			printk(KERN_INFO
			       "RIO: master port %d device has lost enumeration to a remote host\n",
			       mport->id);
			rio_clear_locks(mport);
			rc = -EBUSY;
			goto out;
		}
		rio_update_route_tables(mport);
		rio_clear_locks(mport);
	} else {
		printk(KERN_INFO "RIO: master port %d link inactive\n",
		       mport->id);
		rc = -EINVAL;
	}

      out:
	return rc;
}

/**
 * rio_build_route_tables- Generate route tables from switch route entries
 *
 * For each switch device, generate a route table by copying existing
 * route entries from the switch.
 */
static void rio_build_route_tables(void)
{
	struct rio_dev *rdev;
	int i;
	u8 sport;

	list_for_each_entry(rdev, &rio_devices, global_list)
	    if (rio_is_switch(rdev))
		for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {
			if (rio_route_get_entry
			    (rdev->net->hport, rdev->rswitch, RIO_GLOBAL_TABLE,
			     i, &sport) < 0)
				continue;
			rdev->rswitch->route_table[i] = sport;
		}
}

/**
 * rio_enum_timeout- Signal that enumeration timed out
 * @data: Address of timeout flag.
 *
 * When the enumeration complete timer expires, set a flag that
 * signals to the discovery process that enumeration did not
 * complete in a sane amount of time.
 */
static void rio_enum_timeout(unsigned long data)
{
	/* Enumeration timed out, set flag */
	*(int *)data = 1;
}

/**
 * rio_disc_mport- Start discovery through a master port
 * @mport: Master port to send transactions
 *
 * Starts the discovery process. If we have an active link,
 * then wait for the signal that enumeration is complete.
 * When enumeration completion is signaled, start recursive
 * peer discovery. Returns %0 if discovery succeeds or %-EBUSY
 * on failure.
 */
int rio_disc_mport(struct rio_mport *mport)
{
	struct rio_net *net = NULL;
	int enum_timeout_flag = 0;

	printk(KERN_INFO "RIO: discover master port %d, %s\n", mport->id,
	       mport->name);

	/* If master port has an active link, allocate net and discover peers */
	if (rio_mport_is_active(mport)) {
		if (!(net = rio_alloc_net(mport))) {
			printk(KERN_ERR "RIO: Failed to allocate new net\n");
			goto bail;
		}

		pr_debug("RIO: wait for enumeration complete...");

		rio_enum_timer.expires =
		    jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ;
		rio_enum_timer.data = (unsigned long)&enum_timeout_flag;
		add_timer(&rio_enum_timer);
		while (!rio_enum_complete(mport)) {
			mdelay(1);
			if (enum_timeout_flag) {
				del_timer_sync(&rio_enum_timer);
				goto timeout;
			}
		}
		del_timer_sync(&rio_enum_timer);

		pr_debug("done\n");
		if (rio_disc_peer(net, mport, RIO_ANY_DESTID, 0) < 0) {
			printk(KERN_INFO
			       "RIO: master port %d device has failed discovery\n",
			       mport->id);
			goto bail;
		}

		rio_build_route_tables();
	}

	return 0;

      timeout:
	pr_debug("timeout\n");
      bail:
	return -EBUSY;
}


text:
package com.test.hx.ganknews.base;

import android.app.Fragment;
import android.content.Context;

import com.test.hx.ganknews.utils.LogUtil;
import com.test.hx.ganknews.utils.NetWorkUtils;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * Created by hans on 2017/3/14 14:41.
 */

public abstract class CommonSubscriber<T> implements Observer<T> {
    private Context context;

    public CommonSubscriber(Context context) {
        this.context = context;
    }

    private static final String TAG = "CommonSubscriber";

    @Override
    public void onSubscribe(Disposable d) {
        if (!NetWorkUtils.isConnectedByState(context)) {
            LogUtil.e(TAG, "网络不可用");
        } else {
//            LogUtil.e(TAG, "网络可用");
        }
        if (context instanceof BaseActivity){
            ((BaseActivity)context).addRxDestroy(d);
//            LogUtil.e("加入Rx池内");
        }
    }

    @Override
    public void onError(Throwable e) {
        LogUtil.e(TAG,"e:"+e.toString());
    }

    @Override
    public void onComplete() {
//        LogUtil.e(TAG, "成功了");
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<fileResource exportedWithPermissions="true" dataFile="FoodmartMultiVariableNoTopGrant.data">
    <folder>/organizations/organization_1/analysis/schemas</folder>
    <name>FoodmartMultiVariableNoTopGrant</name>
    <version>0</version>
    <label>Foodmart Multi Variable Grant with no top level</label>
    <description>ANALYSIS Foodmart Multi Variable Grant. Has no top</description>
    <creationDate>2014-06-19T13:09:20.799+02:00</creationDate>
    <updateDate>2014-05-28T03:48:50.646+02:00</updateDate>
    <fileType>accessGrantSchema</fileType>
</fileResource>


text:
package com.fionapet.business.service;

import com.fionapet.business.entity.WarehouseInventory;
import org.dubbo.x.repository.DaoBase;
import org.dubbo.x.service.CURDServiceBase;
import com.fionapet.business.repository.WarehouseInventoryDao;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *  仓库存货清单
* Created by tom on 2016-07-18 11:56:08.
 */
public class WarehouseInventoryServiceImpl extends CURDServiceBase<WarehouseInventory> implements WarehouseInventoryService {
    @Autowired
    private WarehouseInventoryDao warehouseInventoryDao;

    @Override
    public DaoBase<WarehouseInventory> getDao() {
        return warehouseInventoryDao;
    }
}


text:
#include "FileBasedLogAppender.h"
#include "commontypes.h"

#include <time.h>

namespace slib{
  FileBasedLogAppender::FileBasedLogAppender() :logfile(stdout), isScreenStream(true)
  {
  }

  void FileBasedLogAppender::initLogFile(const char *filename){
    isScreenStream = false;
    logfile = fopen(filename, "a+");
  }
  void FileBasedLogAppender::closeLogFile(){
    if (!isScreenStream && logfile != NULL) fclose(logfile);
  }

  static bool DoRawLog(char **buf, int *size, const char *format, ...) {
    va_list ap;
    va_start(ap, format);
    int n = safe_vsnprintf(*buf, *size, format, ap);
    va_end(ap);
    if (n < 0 || n >= *size) return false;
    *size -= n;
    *buf += n;
    return true;
  }

  void FileBasedLogAppender::append(const char *file, int line, int severity, const char *format, va_list ap) throw (){
#ifdef WIN32
    __time64_t long_time;
    _time64(&long_time);
    struct tm t;
    errno_t err = _localtime64_s(&t, &long_time);
    if (err) {
      // VMPI_log("cannot get current time");
      return;
    }
#else
    timespec ts;
    if (clock_gettime(CLOCK_REALTIME, &ts)) return;
    struct tm t;
    localtime_r(&ts.tv_sec, &t);
#endif
    static const int kLogBufSize = 4096;
    char buffer[kLogBufSize];
    int size = sizeof(buffer);
    char *buf = buffer;
    /*DoRawLog(&buf, &size, "%02d%02d %02d:%02d:%02d %5u %s:%d]  ",
    1 + t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
    static_cast<unsigned int>(GetCurrentThreadId()),
    const_basename(const_cast<char *>(file)), line);*/
#ifdef OS_WIN
    DoRawLog(&buf, &size, "%02d-%02d %02d:%02d:%02d %5u %s:%d ", 1 + t.tm_mon,
      t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
      static_cast<unsigned int>(GetCurrentThreadId()), slib::const_basename(file), line);
#else
    DoRawLog(&buf, &size, "%02d-%02d %02d:%02d:%02d %s(%d): ", 1 + t.tm_mon,
      t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, const_basename(file),
      line);
#endif
    // Record the position and size of the buffer after the prefix
    // const char* msg_start = buf;
    // const int msg_size = size;

    int n = safe_vsnprintf(buf, size, format, ap);

    if (n < 0 || n >= size) {
      DoRawLog(&buf, &size, "LOG ERROR: The Message was too long!\n");
    }
    else {
      size -= n;
      buf += n;
      DoRawLog(&buf, &size, "\n");
    }

    fputs(buffer, logfile);
  }

  FileBasedLogAppender::~FileBasedLogAppender() throw() {
    try{
      closeLogFile();
    } catch (...) {}
  }
}


text:
package org.jboss.pnc.mock.spi;

import org.jboss.pnc.mock.builddriver.BuildDriverResultMock;
import org.jboss.pnc.mock.executor.BuildExecutionConfigurationMock;
import org.jboss.pnc.mock.repositorymanager.RepositoryManagerResultMock;
import org.jboss.pnc.spi.BuildExecutionStatus;
import org.jboss.pnc.spi.BuildResult;
import org.jboss.pnc.spi.builddriver.BuildDriverResult;
import org.jboss.pnc.spi.builddriver.BuildDriverStatus;
import org.jboss.pnc.spi.executor.BuildExecutionConfiguration;
import org.jboss.pnc.spi.executor.exceptions.ExecutorException;
import org.jboss.pnc.spi.repositorymanager.RepositoryManagerResult;

import java.util.Optional;

/**
 * @author Matej Lazar
 */
public class BuildResultMock {

    public static BuildResult mock(BuildDriverStatus status) {
        BuildExecutionConfiguration buildExecutionConfig = BuildExecutionConfigurationMock.mockConfig();
        BuildDriverResult buildDriverResult = BuildDriverResultMock.mockResult(status);
        RepositoryManagerResult repositoryManagerResult = RepositoryManagerResultMock.mockResult();
        ExecutorException exception = new ExecutorException("Test exception.", new Exception("Test exception cause."));
        BuildExecutionStatus buildExecutionStatus;
        if (status.completedSuccessfully()) {
            buildExecutionStatus = null;
        } else {
            buildExecutionStatus = BuildExecutionStatus.DONE_WITH_ERRORS;
        }

        return new BuildResult(
                Optional.ofNullable(buildExecutionConfig),
                Optional.ofNullable(buildDriverResult),
                Optional.ofNullable(repositoryManagerResult),
                Optional.ofNullable(exception),
                Optional.ofNullable(buildExecutionStatus));

    }
}


text:
			{{$ctrl.portfolio.name}}

{{$ctrl.portfolio.zip}} {{$ctrl.portfolio.city}}


text:
package com.jetbrains.python.refactoring;

import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.testFramework.TestDataPath;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.refactoring.introduce.IntroduceHandler;
import com.jetbrains.python.refactoring.introduce.constant.PyIntroduceConstantHandler;

@TestDataPath("$CONTENT_ROOT/../testData/refactoring/introduceConstant/")
public class PyIntroduceConstantTest extends PyIntroduceTestCase {
  public void testPy1840() {
    doTest();
  }

  public void testPy1840EntireLine() {
    runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest);
  }

  public void testInsertAfterImport() {  // PY-2149
    doTest();
  }

  public void testInsertAfterDocstring() { // PY-3657
    doTest();
  }

  public void testSuggestUniqueNames() {  // PY-4409
    doTestSuggestions(PyExpression.class, "S1");
  }

  public void testSuggestUniqueNamesGlobalScope() {  // PY-4409
    doTestSuggestions(PyExpression.class, "S1");
  }

  public void testPy4414() {
    doTestInplace(null);
  }

  // PY-13484
  public void testFromParameterDefaultValue() {
    doTest();
  }

  // PY-23500
  public void testInsertAfterGlobalVariableOnWhichDepends() {
    doTest();
  }

  // PY-23500
  public void testInsertAfterAllGlobalVariablesOnWhichDepends() {
    doTest();
  }

  // PY-23500
  public void testInsertAfterWithStatementOnWhichDependsRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testInsertAfterLocalVariableOnWhichDependsRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testInsertAfterFunctionParameterOnWhichDependsRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testInsertAfterForIteratorOnWhichDependsRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testInsertAfterLocalVariableInForLoopOnWhichDependsRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testInsertAfterIfElse() {
    doTest();
  }

  // PY-23500
  public void testFromImportTopLevel() {
    doTest();
  }

  // PY-23500
  public void testFromImportInFunctionRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testExpressionWithFunctionCall() {
    doTest();
  }

  // PY-23500
  public void testExpressionWithParameterRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testSubexpressionWithParameterRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-23500
  public void testSubexpressionWithGlobal() {
    doTest();
  }

  // PY-23500
  public void testSubexpressionNotFullWordRefactoringError() {
    doTestThrowsRefactoringErrorHintException();
  }

  // PY-33843
  public void testStringLiteralArgumentInComprehension() {
    doTest();
  }

  private void doTestThrowsRefactoringErrorHintException() {
    assertThrows(CommonRefactoringUtil.RefactoringErrorHintException.class, () -> doTest());
  }

  @Override
  protected String getTestDataPath() {
    return super.getTestDataPath() + "/refactoring/introduceConstant";
  }

  @Override
  protected IntroduceHandler createHandler() {
    return new PyIntroduceConstantHandler();
  }
}


text:
module Shoulda
  module Matchers
    module ActionController
      # The `render_template` matcher tests that an action renders a template
      # or partial. In RSpec, it is very similar to rspec-rails's
      # `render_template` matcher. In a test suite using Minitest + Shoulda, it
      # provides a more expressive syntax over `assert_template`.
      #
      #     class PostsController < ApplicationController
      #       def show
      #       end
      #     end
      #
      #     # app/views/posts/show.html.erb
      #     <%= render 'sidebar' %>
      #
      #     # RSpec
      #     RSpec.describe PostsController, type: :controller do
      #       describe 'GET #show' do
      #         before { get :show }
      #
      #         it { should render_template('show') }
      #         it { should render_template(partial: '_sidebar') }
      #       end
      #     end
      #
      #     # Minitest (Shoulda)
      #     class PostsControllerTest < ActionController::TestCase
      #       context 'GET #show' do
      #         setup { get :show }
      #
      #         should render_template('show')
      #         should render_template(partial: '_sidebar')
      #       end
      #     end
      #
      # @return [RenderTemplateMatcher]
      #
      def render_template(options = {}, message = nil)
        RenderTemplateMatcher.new(options, message, self)
      end

      # @private
      class RenderTemplateMatcher
        attr_reader :failure_message, :failure_message_when_negated

        def initialize(options, message, context)
          @options = options
          @message = message
          @template = options.is_a?(Hash) ? options[:partial] : options
          @context = context
          @controller = nil
          @failure_message = nil
          @failure_message_when_negated = nil
        end

        def matches?(controller)
          @controller = controller
          renders_template?
        end

        def description
          "render template #{@template}"
        end

        def in_context(context)
          @context = context
          self
        end

        private

        def renders_template?
          begin
            @context.__send__(:assert_template, @options, @message)
            @failure_message_when_negated = "Didn't expect to render #{@template}"
            true
          rescue Shoulda::Matchers.assertion_exception_class => error
            @failure_message = error.message
            false
          end
        end
      end
    end
  end
end


text:
module ActiveRecord
  module ConnectionAdapters # :nodoc:
    module QueryCache
      def select_all(arel, name = nil, binds = [])
        if (arel.rcache_value rescue false) && !locked?(arel) && (arel.rcache_value[:expires_in] || Rcache.expires_in).to_i > 0
          sql = to_sql(arel, binds)
          redis_cache_sql(arel.rcache_value, sql, binds) { super(sql, name, binds) }
            .collect { |row| row.dup }
        elsif @query_cache_enabled && !locked?(arel)
          sql = to_sql(arel, binds)
          cache_sql(sql, binds) { super(sql, name, binds) }
        else
          super
        end
      end

      def select_value(arel, name = nil)
        binds = []
        if (arel.rcache_value rescue false) && !locked?(arel) && (arel.rcache_value[:expires_in] || Rcache.expires_in).to_i > 0
          sql = to_sql(arel, binds)
          redis_cache_sql(arel.rcache_value, sql, binds) { super(sql, name) }
        else
          super
        end
      end

      private

      def redis_cache_sql(rcache_value, sql, binds)
        [:redis, :expires_in, :log_cached_queries, :key_prefix].each do |attr|
          instance_variable_set("@#{attr}", rcache_value.has_key?(attr) ? rcache_value[attr] : Rcache.send(attr))
        end

        # return from memory
        if @query_cache_enabled && @query_cache[sql].key?(binds)
          ActiveSupport::Notifications.instrument("sql.active_record", :sql => sql, :binds => binds, :name => "CACHE", :connection_id => object_id) if @log_cached_queries
          @query_cache[sql][binds]
        # write to memory from redis and return
        else
          res = @redis.get(redis_cache_key(sql, binds, @key_prefix))
          if res
            begin
              res = JSON.parse(res)
            rescue JSON::ParserError
            end
            ActiveSupport::Notifications.instrument("sql.active_record", :sql => sql, :binds => binds, :name => "REDIS", :connection_id => object_id) if @log_cached_queries
            @query_cache[sql][binds] = res
          else
            # write to memory and redis from db and return
            res = yield
            @query_cache[sql][binds] = res
            @redis.setex(redis_cache_key(sql, binds, @key_prefix), @expires_in, res.to_json)
            res
          end
        end
      end

      def redis_cache_key(sql, binds, key_prefix)
        key_prefix + Digest::MD5.hexdigest(sql + binds.to_s)
      end
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OakIdeas.Schema.Core.Intangibles
{
    /// <summary>
    /// A class, also often called a 'Type'; equivalent to rdfs:Class.
    /// </summary>
    /// <see cref="http://www.schema.org/Class"/>
    public class Class : Intangible
    {
    }
}


text:
using System;
using System.Linq;
using DbModel.Entities;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace DbModel
{
  public class ViLabContext : IdentityDbContext<ApplicationUser>
  {

    public ViLabContext(DbContextOptions<ViLabContext> options) : base(options)
    {
      Database.EnsureCreated();
    }

    public DbSet<Category> Categories { get; set; }
    public DbSet<Subcategory> Subcategories { get; set; }
    public DbSet<Case> Cases { get; set; }
  }
}


text:
package xdgbasedir

import (
	"os"
	"path/filepath"

	"github.com/zchee/go-xdgbasedir/home"
)

var (
	appData           = filepath.FromSlash(os.Getenv("APPDATA"))
	localAppData      = filepath.FromSlash(os.Getenv("LOCALAPPDATA"))
	defaultDataHome   = appData
	defaultConfigHome = appData
	defaultDataDirs   = appData
	defaultConfigDirs = appData
	defaultCacheHome  = filepath.Join(localAppData, "cache")
	defaultRuntimeDir = home.Dir()
)

func dataHome() string {
	return defaultDataHome
}

func configHome() string {
	return defaultConfigHome
}

func dataDirs() string {
	return defaultDataDirs
}

func configDirs() string {
	return defaultConfigDirs
}

func cacheHome() string {
	return defaultCacheHome
}

func runtimeDir() string {
	return defaultRuntimeDir
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Acta Soc. Sci. fenn. 7: 495 (1863)

#### Original name
Arthonia subrubella Nyl.

### Remarks
null


text:
package com.bstek.bdf3.autoconfigure;

import java.util.Properties;

import org.apache.commons.lang.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

public class BDFPreloadSpringApplicationRunListener implements
		SpringApplicationRunListener {

	private SpringApplication application;

	public BDFPreloadSpringApplicationRunListener(SpringApplication application, String[] args) {
		this.application = application;
	}

	@Override
	public void environmentPrepared(ConfigurableEnvironment environment) {

	}

	@Override
	public void contextPrepared(ConfigurableApplicationContext context) {

	}

	@Override
	public void contextLoaded(ConfigurableApplicationContext context) {

	}

	@Override
	public void starting() {
		Properties properties = new Properties();
		String basePackage = application.getClass().getPackage().getName();
		String projectName = StringUtils.substringAfterLast(basePackage, ".");
		properties.put("bdf3.projectName", projectName);
		properties.put("bdf3.basePackage", basePackage);
		properties.put("spring.mvc.staticPathPattern", "static/**");
		application.setDefaultProperties(properties);

	}

	@Override
	public void started(ConfigurableApplicationContext context) {
		// TODO Auto-generated method stub

	}

	@Override
	public void running(ConfigurableApplicationContext context) {
		// TODO Auto-generated method stub

	}

	@Override
	public void failed(ConfigurableApplicationContext context, Throwable exception) {
		// TODO Auto-generated method stub

	}

}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Riwayat_Pelatihan extends Anggota_Controller {
	private $path;
	public function __construct()
	{
		parent::__construct();

        $this->load->helper('form');
		$this->load->model('Anggota_Model');
		$this->load->model('Kontak_model');
		$this->load->model('Riwayat_Pelatihan_model');
		$this->path = "anggota/riwayat_pelatihan";

	}

	public function index()
	{
		$id = $this->session->userdata('user_id');
		$data['anggota'] = $this->Anggota_Model->get_id($id);
		$data['kontak'] = $this->Kontak_model->get_id($id);
		$data['riwayat_pelatihan'] = $this->Riwayat_Pelatihan_model->get_id($id);
		$ui['navtab']['page'] = 'pelatihan';
		$ui['nama_anggota'] = $data['anggota']->nama_lengkap;

		$this->load->view('anggota/header');
		$this->load->view('anggota/body',$ui);
		$this->load->view('anggota/profile',$data);
		$this->load->view('anggota/nav_riwayat',$ui['navtab']);
		$this->load->view('anggota/riwayat/pelatihan/content',$data);
		$this->load->view('anggota/footer');
	}

	public function add()
	{
		$id = $this->session->userdata('user_id');

		if ($_SERVER['REQUEST_METHOD'] == 'GET') {
			$ui['page'] = 'Tambah Riwayat Pelatihan';
			$this->load->view('anggota/header');
			$this->load->view('anggota/crud_header',$ui);
			$this->load->view('anggota/riwayat/pelatihan/add_riwayat_pelatihan');
		} else {
			$insert = $this->Riwayat_Pelatihan_model->add_riwayat_pelatihan($id);
			if ($insert){
				$this->session->set_flashdata('success_path', $this->path);
				  redirect('anggota/dashboard/success');
			} else echo "Insert Gagal";
		}
	}

	public function get($no_urut = null)
	{
		$id = $this->session->userdata('user_id');
		if ($no_urut != null) {
			$data = $this->Riwayat_Pelatihan_model->get_no_urut($id,$no_urut);
		} else {
			$data = $this->Riwayat_Pelatihan_model->get_id($id);
		}

		return $data;
	}

	public function update($no_urut)
	{
		$id = $this->session->userdata('user_id');

		if ($_SERVER['REQUEST_METHOD'] == 'GET') {
			$data['riwayat_pelatihan']= $this->get($no_urut);
			$ui['page'] = 'Ubah Riwayat Pelatihan';
			$this->load->view('anggota/header');
			$this->load->view('anggota/crud_header',$ui);
			$this->load->view('anggota/riwayat/pelatihan/update_riwayat_pelatihan',$data);
		} else {
			$update = $this->Riwayat_Pelatihan_model->update_riwayat_pelatihan($id,$no_urut);
			if ($update){
				$this->session->set_flashdata('success_path', $this->path);
				  redirect('anggota/dashboard/success');
			} else echo "Update Gagal";
		}
	}

	public function delete($no_urut)
	{
		$id = $this->session->userdata('user_id');

		if ($_SERVER['REQUEST_METHOD'] == 'GET') {
			$data['riwayat']= (array) $this->get($no_urut);
			$ui['page'] = 'Hapus Riwayat Pelatihan';
			$data['table']['header'] = ["Nama Pelatihan","Nama Penyelenggara","Tahun Pelatihan"];
			$data['attribute'] = ["nama_pelatihan","nama_penyelenggara_pelatihan","tahun_pelatihan"];
			$this->load->view('anggota/header');
			$this->load->view('anggota/crud_header',$ui);
			$this->load->view('anggota/hapus_riwayat',$data);
		} else {
			$delete = $this->Riwayat_Pelatihan_model->delete_riwayat_pelatihan($id,$no_urut);
			if ($delete){
				$this->session->set_flashdata('success_path', $this->path);
				 redirect('anggota/dashboard/success');
			} else echo "Delete Gagal";
		}
	}

}


text:
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            Toggle navigation

        </button>
        weppls sample-02

home

messages


text:
#include "mega.h"
#include "gtest/gtest.h"

using namespace mega;
using ::testing::InitGoogleTest;
using ::testing::Test;
using ::testing::TestCase;
using ::testing::TestInfo;
using ::testing::TestPartResult;
using ::testing::UnitTest;

bool debug;

TEST(JSON, storeobject) {
    std::string in_str("Test");
    JSON j;
    j.storeobject(&in_str);
}

// Test 64-bit int serialization/unserialization
TEST(Serialize64, serialize) {
    uint64_t in = 0xDEADBEEF;
    uint64_t out;
    byte buf[sizeof in];

    Serialize64::serialize(buf, in);
    ASSERT_GT(Serialize64::unserialize(buf, sizeof buf, &out), 0);
    ASSERT_EQ(in, out);
}

int main (int argc, char *argv[])
{
    InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}


text:
using log4net;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GZ_SpotGateEx.Core
{
    class ConfigProfile
    {
        private static ConfigProfile _current = new ConfigProfile();

        public int AutoRun { get; set; }

        public string CheckInServerUrl { get; set; }

        public string OpenGateUrl { get; set; }

        public string RebootGateUrl { get; set; }

        public string GateSoundUrl { get; set; }

        public string AutoRestartTime { get; set; }

        public string ShutdownTime { get; set; }

        private ILog log = LogManager.GetLogger("ConfigProfile");

        private ConfigProfile()
        {
        }

        public static ConfigProfile Current
        {
            get
            {
                return _current;
            }
        }

        public void ReadConfig()
        {
            AutoRun = GetKey("auto").ToInt32();
            CheckInServerUrl = GetKey("checkInServerUrl");
            OpenGateUrl = GetKey("clientGateUrl");
            RebootGateUrl = GetKey("rebootGateUrl");
            GateSoundUrl = GetKey("gatesoundUrl");
            ShutdownTime = GetKey("gateshutdownTime");
        }

        public void Save()
        {
            Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            cfg.AppSettings.Settings["auto"].Value = AutoRun.ToString();
            cfg.AppSettings.Settings["checkInServerUrl"].Value = CheckInServerUrl;
            cfg.AppSettings.Settings["clientGateUrl"].Value = OpenGateUrl;
            cfg.AppSettings.Settings["rebootGateUrl"].Value = RebootGateUrl;
            cfg.AppSettings.Settings["gatesoundUrl"].Value = GateSoundUrl;
            cfg.AppSettings.Settings["gateshutdownTime"].Value = ShutdownTime;
            cfg.Save();
        }

        private string GetKey(string key)
        {
            if (ConfigurationManager.AppSettings.AllKeys.Contains(key))
            {
                var val = ConfigurationManager.AppSettings[key];
                return val;
            }
            else
            {
                return string.Empty;
            }
        }
    }
}


text:
<?php
date_default_timezone_set('PRC');

define('INSTANCE', '_INST_DEFAULT');

define("KEY_INDUSTRY", "INDUSTRY");
define("KEY_TECHNOLOGY", "TECHNOLOGY");

define("OPTION_YES", "Y");
define("OPTION_NO", "N");

define('PRODUCTION_HOST', 'thoth-assets.mybluemix.net');
define('TRANSLATION_DIR', str_replace('\\', DIRECTORY_SEPARATOR, dirname(__FILE__)));
define('DEFAULT_LANGUAGE', 'en-US');

require 'vendor/autoload.php';
require 'inc/translations/translator.php';
/// Pear
// Pager
include 'inc/pear/Pager.php';
/// Utilities
// Common
include 'inc/utilities/common-utility.php';
// Database
include 'inc/db.php';
// Models
// User model
include 'inc/models/user-model.php';
// Build model
include 'inc/models/build-model.php';
// Role model
include 'inc/models/role-model.php';
// Managers
include 'inc/managers/session-manager.php';
include 'inc/managers/asset-manager.php';
include 'inc/managers/catalog-manager.php';
include 'inc/managers/company-manager.php';
include 'inc/managers/visitor-manager.php';
include 'inc/managers/event-manager.php';
include 'inc/managers/distribution-manager.php';
include 'inc/managers/user-manager.php';
include 'inc/managers/file-manager.php';
// Controllers
include 'inc/controllers/abstract-controller.php';
include 'inc/controllers/common-controller.php';
include 'inc/controllers/api-controller.php';
include 'inc/controllers/app-controller.php';
include 'inc/controllers/event-controller.php';
include 'inc/controllers/asset-controller.php';
include 'inc/controllers/file-controller.php';

if(isset($_ENV["VCAP_SERVICES"]) === FALSE) {
    $env = new Dotenv\Dotenv(__DIR__);
    $env->load();
    define("HOST_NAME", PRODUCTION_HOST);
    define('DEBUG', TRUE);
}
else {
    define("HOST_NAME", CommonUtility::getServerVar('HTTP_HOST', PRODUCTION_HOST));
    define('DEBUG', FALSE);
}

$_language = CommonUtility::getAcceptedLanguage();
CommonUtility::loadTranslation($_language);

function translate($var = '', $args = NULL, $language = LANGUAGE) { return CommonUtility::getTranslation($var, $args, $language); }

define('LANGUAGE', $_language, FALSE);

$app = new Slim\App();

$container = $app->getContainer();

// Register component on container
$container['view'] = function ($container) {
    return new \Slim\Views\PhpRenderer('inc/views/');
};

// Override the default Not Found Handler
$container['notFoundHandler'] = function ($cf) {

    return function ($request, $response) use ($cf) {

        $newResponse = $cf['response']
        ->withStatus(404)
        ->withHeader('Content-Type', 'text/html');
        if(SessionManager::validate()) {
            $newResponse->write('404');
            return $newResponse;
        }

        $login = '';
        $passcode = '';
        $message = '';

        return $cf->view->render($newResponse, 'signin.php', [
            'login' => $login,
            'passcode' => $passcode,
            'message' => $message
        ]);
    };
};

// Sign in post
$app->post('/', CommonController::get('postHome'));

// App download entry
$app->get('/app/{id}', CommonController::get('getApp'));
// QR Code API
$app->get('/api/v1/build/code/{id}', CommonController::get('getQRCode'));
// Get meta data of build (iOS .plist)
$app->get('/api/v1/build/meta/{id}', CommonController::get('getMeta'));
// Download build
$app->get('/api/v1/build/download/{idbuild}', CommonController::get('getBuild'));

if(SessionManager::validate()) {

    // Home
    $app->get('/', CommonController::get('getHome'));
    // Visitors selected by event
    $app->get('/api/v1/visitors/company/{idcompany}/event/{id}', APIController::get('getVisitorsByEvent'));

    Session::init()->whatIfThen('VIEW_CATALOG', function() use($app) {
        // Add or Catalogs
        $app->post('/api/v1/catalog', APIController::get('postCatalog'));
        // Catalogs
        $app->get('/catalog/{name}', AssetController::get('getCatalog'));
    });

    Session::init()->whatIfThen('VIEW_ASSETS', function() use($app) {
        // Assets
        $app->get('/assets', AssetController::get('getAssets'));
        // Asset update
        $app->post('/assets/{id}', AssetController::get('postAsset'));
        // Asset details
        $app->get('/assets/{id}', AssetController::get('getAsset'));
        $app->get('/files', FileController::get('getFiles'));
        $app->get('/files/{id}', FileController::get('getFile'));
        // Delete attachment
        $app->delete('/api/v1/assets/attachment/{id}', APIController::get('deleteAssetAttachment'));
    });

    Session::init()->whatIfThen('VIEW_COMPANIES', function() use($app) {
        /// Events
        // Companies
        $app->get('/companies', EventController::get('getCompanies'));
        // Company details
        $app->get('/companies/{id}', EventController::get('getCompany'));
        // Company update
        $app->post('/companies/{id}', EventController::get('postCompany'));
        // Delete logo
        $app->delete('/api/v1/companies/logo/{id}', APIController::get('deleteCompanyLogo'));
    });

    Session::init()->whatIfThen('VIEW_VISITORS', function() use($app) {
        // Visitors
        $app->get('/visitors', EventController::get('getVisitors'));
        // Visitor details
        $app->get('/visitors/{id}', EventController::get('getVisitor'));
        // Visitor update
        $app->post('/visitors/{id}', EventController::get('postVisitor'));
        // Visitor avatar delete
        $app->delete('/api/v1/visitors/avatar/{id}', APIController::get('deleteVisitorAvatar'));
    });

    Session::init()->whatIfThen('VIEW_EVENTS', function() use($app) {
        // Events
        $app->get('/events', EventController::get('getEvents'));
        // Event details
        $app->get('/events/{id}', EventController::get('getEvent'));
        // Add or update Event
        $app->post('/events/{id}', EventController::get('postEvent'));
        // Timeline delete
        $app->delete('/api/v1/timelines/{id}', APIController::get('deleteTimeline'));
    });

    Session::init()->whatIfThen('VIEW_USERS', function() use($app) {
        // Users
        $app->get('/users', CommonController::get('getUsers'));
        // User details
        $app->get('/users/{id}', CommonController::get('getUser'));
        $app->post('/users/{id}', CommonController::get('postUser'));
    });

    Session::init()->whatIfThen('VIEW_ROLES', function() use($app) {
        // Roles
        $app->get('/roles', CommonController::get('getRoles'));
        // Role details
        $app->get('/roles/{id}', CommonController::get('getRole'));
        $app->post('/roles/{id}', CommonController::get('postRole'));
    });

    Session::init()->whatIfThen('VIEW_APPS', function() use($app) {
        // App list
        $app->get('/apps', AppController::get('getApps'));
        // App details
        $app->get('/apps/{id}', AppController::get('getApp'));
        // Add or Update app
        $app->post('/apps/{id}', AppController::get('postApp'));
        // Distribution list
        $app->get('/apps/{idapp}/distribute', AppController::get('getDistribute'));
        // Add or update distribution
        $app->post('/apps/{idapp}/distribute', AppController::get('postDistribute'));
        // Build information
        $app->get('/apps/{idapp}/builds/{idbuild}', AppController::get('getAppBuild'));
        // Add or Upload build
        $app->post('/apps/{idapp}/builds/{idbuild}', AppController::get('postAppBuild'));
        // Delete a build
        $app->delete('/api/v1/apps/{idapp}/builds/{idbuild}', APIController::get('deleteAppBuild'));
    });

    Session::init()->whatIfThen('VIEW_SETTINGS', function() use($app) {
        // View or update Settings
        $app->get('/settings', CommonController::get('getSettings'));
        $app->post('/settings', CommonController::get('postSettings'));
    });

    // Sign out
    $app->get('/signout', APIController::get('getSignedOut'));
}
else {
    $app->get('/', APIController::get('getUnAuthorizedHome'));
    $app->get('/signout', APIController::get('getSignOut'));
}

/// Public APIs
// Catalogs by catalog keyword
$app->get('/api/v1/catalog/{q}', APIController::get('getCatalogs'));
// Attachment render
$app->get('/api/v1/assets/attachment/{id}', APIController::get('getAttachment'));
// Query assets by catalog, INDUSTRY | TECHNOLOGY
$app->get('/api/v1/assets/catalog/{catalog}/name/{name}', APIController::get('getAssetsByCatalogName'));
// Query assets by company
$app->get('/api/v1/assets/company/id/{id}', APIController::get('getAssetsByCompanyId'));
// Query assets by catalog id
$app->get('/api/v1/assets/catalog/{catalog}/id/{id}', APIController::get('getAssetsByCatalogId'));

/// Company
// Get logo image
$app->get('/api/v1/companies/logo/{id}', APIController::get('getCompanyLogo'));
// Event of today, Watson uses it
$app->get('/api/v1/event/today', APIController::get('getEventToday'));
$app->get('/api/v1/event/recents', APIController::get('getRecentVisitors'));

// Visitor avatar
$app->get('/api/v1/visitor/avatar/{id}', APIController::get('getVisitorAvatar'));

/// Debug
// PHP info
$app->get('/api/v1/info', CommonController::get('getPHPInfo'));
$app->get('/api/v1/test/image', CommonController::get('getPage'));

// unused
// $app->delete('/api/v1/assets/{id}', function ($request, $response, $args) {

//     $id = isset($args['id']) ? $args['id'] : 0;
//     $result = AssetManager::deleteAsset($id);

//     return $this->view->render($response, 'asset.php', [
//         'asset' => $result
//     ]);
// });

$app->run();


text:
from .chain import *
from .estimators import *
from .evaluation import *
from .inference import *
from .objectives import *

__all__ = [
    'VariationalChain', 'VariationalEvaluation', 'VariationalInference',
    'VariationalLowerBounds', 'VariationalTrainingObjectives',
    'elbo_objective', 'importance_sampling_log_likelihood', 'iwae_estimator',
    'monte_carlo_objective', 'nvil_estimator', 'sgvb_estimator',
    'vimco_estimator',
]


text:
module GoogleApiHelper

  API_KEY = "AIzaSyBQxopw4OR08VaLVtHaY4XEXWk3dvLSj5k"

  def google_js_api_uri(key=API_KEY)
    javascript_path "http://www.google.com/jsapi?key=#{key}"
  end

  def google_maps_url(latitude, longitude)
    "https://www.google.com/maps/place/#{latitude},#{longitude}/"
  end

  def google_static_map_src(properties, use_stylers=true, key=API_KEY)
    src = "https://maps.googleapis.com/maps/api/staticmap"
    src += "?key=#{key}"
    src += "&size=#{properties[:width]}x#{properties[:height]}"
    src += "&zoom=#{properties[:zoom]}&scale=#{properties[:scale]}"

    if properties[:marker]
      src+= "&markers=scale:#{properties[:icon_scale]}|icon:#{CGI.escape(properties[:icon])}|#{properties[:latitude]},#{properties[:longitude]}"
    else
      src+= "&center=#{properties[:latitude]},#{properties[:longitude]}"
    end

    if use_stylers
      stylers = [
        "feature:water|element:geometry|color:0xcbdae7",
        "feature:landscape.man_made|element:geometry.fill|color:0xeff1f3",
        "feature:road|element:labels.text.stroke|color:0xffffff",
        "feature:road.arterial|element:geometry.fill|color:0xffffff",
        "feature:road.arterial|element:geometry.stroke|visibility:off",
        "feature:road.highway|element:geometry.fill|color:0x16c98d",
        "feature:road.highway|element:geometry.stroke|visibility:off",
        "feature:road.local|element:geometry.stroke|visibility:off",
        "feature:road.local|element:labels|visibility:off",
        "feature:poi.park|element:geometry.fill|color:0xc8e6aa",
        "feature:poi.school|element:geometry|color:0xdfdad3",
        "feature:poi.medical|element:geometry|color:0xfa5e5b"
      ]

      src+= "&style=#{stylers.join('&style=')}"
    end

    src
  end

end


text:
layout: post
date: '2015-08-20'
title: "Antonios Couture 64"
category: Antonios Couture
tags: [Antonios Couture]
---
### Antonios Couture 64
Just **$319.99**
###

Buy it: [https://www.readybrides.com/en/antonios-couture/17391-antonios-couture-64.html](https://www.readybrides.com/en/antonios-couture/17391-antonios-couture-64.html)


text:
package com.baomidou.mybatisplus.test.activerecord;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.jdbc.SQL;
import org.apache.ibatis.session.SqlSessionFactory;

import com.baomidou.mybatisplus.MybatisSessionFactoryBuilder;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.test.mysql.entity.Test;
import com.baomidou.mybatisplus.test.mysql.mapper.TestMapper;
import com.baomidou.mybatisplus.toolkit.IdWorker;
import com.baomidou.mybatisplus.toolkit.TableInfoHelper;

/**
 * <p>
 * ActiveRecord 测试
 * </p>
 *
 * @author Caratacus
 * @date 2016-10-11
 */
public class ActiveRecordTest {

    public static void main(String[] args) {
        // 加载配置文件
        InputStream in = TestMapper.class.getClassLoader().getResourceAsStream("mysql-config.xml");
        MybatisSessionFactoryBuilder mf = new MybatisSessionFactoryBuilder();
        SqlSessionFactory sqlSessionFactory = mf.build(in);
        TableInfoHelper.initSqlSessionFactory(sqlSessionFactory);
        sqlSessionFactory.openSession(false);
        // 保存一条记录
        Test t1 = new Test();
        t1.setType("test10");
        boolean rlt = t1.insert();
        print(" ar save=" + rlt + ", id=" + t1.getId());

        // 根据ID更新
        t1.setType("t1023");
        rlt = t1.updateById();
        print(" ar updateById:" + rlt);

        // 更新 SQL
        Test t11 = new Test();
        t11.setType("123");
        rlt = t11.update("id={0}", t1.getId());
        print("update sql=" + rlt);

        // 查询 SQL
        Test t10 = t1.selectOne("id={0}", t1.getId());
        print("selectOne=" + t10.getType());

        // 插入OR更新
        t1.setType("t1021");
        rlt = t1.insertOrUpdate();
        print(" ar saveOrUpdate:" + rlt);

        // 根据ID查询
        Test t2 = t1.selectById();
        print(" t2 = " + t2.toString());
        t2.setId(IdWorker.getId());
        t2.insert();

        // 查询所有
        List<Test> tl = t2.selectAll();
        for (Test t : tl) {
            print("selectAll=" + t.toString());
        }

        // 查询总记录数
        print(" count=" + t2.selectCount(null));

        // 翻页查询
        Page<Test> page = new Page<>(0, 10);
        page = t2.selectPage(page, null);
        print(page.toString());

        // 根据ID删除
        rlt = t2.deleteById();
        print("deleteById=" + rlt + ", id=" + t2.getId());

        // 执行 SQL 查询总数
        List<Map<String, Object>> ul = t2.sql().selectList(new SQL() {
            {
                SELECT("*");
                FROM("test");
                WHERE("type='t1021'");
            }
        }.toString());
        System.err.println("selectList SQL:");
        for (Map<String, Object> map : ul) {
            System.err.println(map);
        }

        // 根据ID查询
        Test t20 = t2.selectById();
        print("t2 删除后是否存在?" + (null != t20));

        // 删除 SQL
        rlt = t2.delete("type={0}", "t1021");
        System.err.println("delete sql=" + rlt);
    }

    /*
     * 慢点打印
     */
    private static void print(String text) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.err.println(text);
    }

}


text:
Feedback on this pattern

  To feedback on this pattern, open an issue on Github.


text:
package com.emitrom.touch4j.charts.client.series;

import com.emitrom.touch4j.client.core.JsoHelper;
import com.emitrom.touch4j.client.laf.Color;
import com.google.gwt.core.client.JsArrayString;

public class PieSeries extends BaseSeries {

    public PieSeries() {
        jsObj = JsoHelper.createObject();
        this.setType("Pie");
    }

    /**
     * The store record field name to be used for the pie angles. The values
     * bound to this field name must be positive real numbers.
     *
     * @param value
     */
    public void setAngleField(String value) {
        JsoHelper.setAttribute(jsObj, "angleField", value);
    }

    public void setField(String value) {
        JsoHelper.setAttribute(jsObj, "field", value);
    }

    /**
     * An array of color values which will be used, in order, as the pie slice
     * fill colors.
     *
     * @param colors
     */
    public void setColorSet(Color[] colors) {
        JsArrayString strings = JsArrayString.createArray().cast();
        for (Color color : colors) {
            strings.push(color.getValue());
        }
        setColorSet(strings);
    }

    private void setColorSet(JsArrayString values) {
        JsoHelper.setAttribute(jsObj, "colorSet", values);
    }

    /**
     * Whether to set the pie chart as donut chart. Default's false. Can be set
     * to a particular percentage to set the radius of the donut chart.
     *
     * @param value
     */
    public void setDonut(int value) {
        JsoHelper.setAttribute(jsObj, "donut", value);
    }

    /**
     * Whether to set the pie chart as donut chart. Default's false. Can be set
     * to a particular percentage to set the radius of the donut chart.
     *
     * @param value
     */
    public void setDonut(boolean value) {
        JsoHelper.setAttribute(jsObj, "donut", value);
    }

    /**
     * Extra distance value for which the labelOverflow listener is triggered.
     * Default to 20.
     *
     * @param value
     */
    public void setLabelOverflowPadding(int value) {
        JsoHelper.setAttribute(jsObj, "labelOverflowPadding", value);
    }

    /**
     * The store record field name to be used for the pie slice lengths. The
     * values bound to this field name must be positive real numbers. This
     * parameter is optional.
     *
     * @param value
     */
    public void setLengthField(String value) {
        JsoHelper.setAttribute(jsObj, "LengthField", value);
    }

    /**
     * The angle in degrees at which the first pie slice should start.
     *
     * @param value
     */
    public void setRotation(double value) {
        JsoHelper.setAttribute(jsObj, "rotation", value);
    }

}


text:
<?php

namespace Doctrine\Tests\DBAL\Functional\Driver;

use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\Tests\DbalFunctionalTestCase;

class PDOConnectionTest extends DbalFunctionalTestCase
{
    /**
     * The PDO driver connection under test.
     *
     * @var \Doctrine\DBAL\Driver\PDOConnection
     */
    protected $driverConnection;

    protected function setUp()
    {
        if ( ! extension_loaded('PDO')) {
            $this->markTestSkipped('PDO is not installed.');
        }

        parent::setUp();

        $this->driverConnection = $this->_conn->getWrappedConnection();

        if ( ! $this->_conn->getWrappedConnection() instanceof PDOConnection) {
            $this->markTestSkipped('PDO connection only test.');
        }
    }

    public function testDoesNotRequireQueryForServerVersion()
    {
        $this->assertFalse($this->driverConnection->requiresQueryForServerVersion());
    }
}


text:
package nl.my888.resume.services.people.impl;

import javax.persistence.EntityNotFoundException;

import nl.my888.resume.repository.people.PeopleRepository;
import nl.my888.resume.repository.people.Person;
import nl.my888.resume.services.people.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PeopleRepository peopleRepository;

    @Override
    public Person save(Person person) {
        return peopleRepository.save(person);
    }

    @Override
    public Person findOneByUsername(String username) {
        return peopleRepository.findByUsername(username);
    }

    @Override
    public Iterable<Person> findAll() {
        return peopleRepository.findAll();
    }

    @Override
    public Person findOne(Long id) {
        return peopleRepository.findOne(id);
    }

    @Override
    public Person getPerson(Long id) {
        final Person result = findOne(id);
        if (result == null) {
            throw new EntityNotFoundException(String.format("Person %s not found!", id));
        }
        return result;
    }

    @Override
    public Person getPersonByUsername(String username) {
        final Person result = findOneByUsername(username);
        if (result == null) {
            throw new EntityNotFoundException(String.format("User %s not found!", username));
        }
        return result;
    }
}


text:
Option Strict Off
Option Explicit On
Friend Class frmKeyboardList
	Inherits System.Windows.Forms.Form
	Dim gFilter As String
	Dim gRS As ADODB.Recordset
	Dim gFilterSQL As String
	Dim gID As Integer
	Dim gSection As Short
	Dim gAll As Boolean

	Private Sub loadLanguage()

		'frmKeyboardList = No Code  [Select a Keyboard]
		'rsLang.filter = "LanguageLayoutLnk_LanguageID=" & 0000
		'If rsLang.RecordCount Then frmKeyboard.Caption = rsLang("LanguageLayoutLnk_Description"): frmKeyboard.RightToLeft = rsLang("LanguageLayoutLnk_RightTL")

		rsLang.filter = "LanguageLayoutLnk_LanguageID=" & 1080 'Search|Checked
		If rsLang.RecordCount Then lbl.Text = rsLang.Fields("LanguageLayoutLnk_Description").Value : lbl.RightToLeft = rsLang.Fields("LanguageLayoutLnk_RightTL").Value

		rsLang.filter = "LanguageLayoutLnk_LanguageID=" & 1065 'New|Checked
		If rsLang.RecordCount Then cmdNew.Text = rsLang.Fields("LanguageLayoutLnk_Description").Value : cmdNew.RightToLeft = rsLang.Fields("LanguageLayoutLnk_RightTL").Value

		rsLang.filter = "LanguageLayoutLnk_LanguageID=" & 1004 'Exit|Checked
		If rsLang.RecordCount Then cmdExit.Text = rsLang.Fields("LanguageLayoutLnk_Description").Value : cmdExit.RightToLeft = rsLang.Fields("LanguageLayoutLnk_RightTL").Value

		rsHelp.filter = "Help_Section=0 AND Help_Form='" & Me.Name & "'"
		'UPGRADE_ISSUE: Form property frmKeyboardList.ToolTip1 was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
		If rsHelp.RecordCount Then Me.ToolTip1 = rsHelp.Fields("Help_ContextID").Value

	End Sub

	Public Sub loadItem(ByRef section As Short)
		gSection = section
		If gSection Then cmdNew.Visible = False
		doSearch()

		loadLanguage()
		Me.ShowDialog()
	End Sub
	Public Function getItem() As Integer
		cmdNew.Visible = False

		loadLanguage()
		Me.ShowDialog()
		getItem = gID
	End Function
	Private Sub getNamespace()
	End Sub
	Private Sub cmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExit.Click
		Me.Close()
	End Sub
	Private Sub cmdNamespace_Click()
		frmFilter.loadFilter(gFilter)
		getNamespace()
	End Sub
	Private Sub cmdNew_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNew.Click
		Dim rs As ADODB.Recordset
		cnnDB.Execute("INSERT INTO KeyboardLayout ( KeyboardLayout_Name ) SELECT 'New Keyboard';")
		rs = getRS("SELECT Max(KeyboardLayout.KeyboardLayoutID) AS MaxOfKeyboardLayoutID FROM KeyboardLayout;")
        frmKeyboard.loadItem(rs.Fields("MaxOfKeyboardLayoutID").Value)
		doSearch()
	End Sub
	Private Sub DataList1_DblClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles DataList1.DoubleClick
		If cmdNew.Visible Then
			If DataList1.BoundText <> "" Then
				frmKeyboard.loadItem((DataList1.BoundText))
			End If
			doSearch()
		Else
			If DataList1.BoundText = "" Then
				gID = 0
			Else
				gID = CInt(DataList1.BoundText)
			End If
			Me.Close()
		End If
	End Sub

	Private Sub DataList1_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As KeyPressEventArgs) Handles DataList1.KeyPress
        Select Case eventArgs.KeyChar
            Case ChrW(13)
                DataList1_DblClick(DataList1, New System.EventArgs())
                eventArgs.KeyChar = ChrW(0)
            Case ChrW(27)
                Me.Close()
                eventArgs.KeyChar = ChrW(0)
        End Select

	End Sub

	Private Sub frmKeyboardList_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
		Dim KeyCode As Short = eventArgs.KeyCode
		Dim Shift As Short = eventArgs.KeyData \ &H10000
		If KeyCode = 36 Then
			gAll = Not gAll
			doSearch()
			KeyCode = False
		End If
	End Sub

	Private Sub frmKeyboardList_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Select Case KeyAscii
			Case System.Windows.Forms.Keys.Escape
				KeyAscii = 0
				cmdExit_Click(cmdExit, New System.EventArgs())
		End Select

		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	Private Sub frmKeyboardList_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		doSearch()
	End Sub
	Private Sub frmKeyboardList_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		gRS.Close()
	End Sub
	Private Sub txtSearch_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtSearch.Enter
		txtSearch.SelectionStart = 0
		txtSearch.SelectionLength = 999
	End Sub

	Private Sub txtSearch_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyEventArgs) Handles txtSearch.KeyDown
		Dim KeyCode As Short = eventArgs.KeyCode
		Dim Shift As Short = eventArgs.KeyData \ &H10000
		Select Case KeyCode
			Case 40
				Me.DataList1.Focus()
		End Select
	End Sub

	Private Sub txtSearch_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtSearch.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Select Case KeyAscii
			Case 13
				doSearch()
				KeyAscii = 0
		End Select
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	Private Sub doSearch()
		Dim sql As String
		Dim lString As String

		lString = Trim(txtSearch.Text)
		lString = Replace(lString, "  ", " ")
		lString = Replace(lString, "  ", " ")
		lString = Replace(lString, "  ", " ")
		lString = Replace(lString, "  ", " ")
		lString = Replace(lString, "  ", " ")
		lString = Replace(lString, "  ", " ")
		lString = " WHERE (KeyboardLayout_Name LIKE '%" & Replace(lString, " ", "%' AND KeyboardLayout_Name LIKE '%") & "%')"
		gRS = getRS("SELECT KeyboardLayout.KeyboardLayoutID, KeyboardLayout.KeyboardLayout_Name FROM KeyboardLayout " & lString & " ORDER BY KeyboardLayout_Name")

		'Display the list of Titles in the DataCombo
		DataList1.DataSource = gRS
		DataList1.listField = "KeyboardLayout_Name"

		'Bind the DataCombo to the ADO Recordset
		'UPGRADE_ISSUE: VBControlExtender property DataList1.DataSource is not supported at runtime. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="74E732F3-CAD8-417B-8BC9-C205714BB4A7"'
		DataList1.DataSource = gRS
		DataList1.boundColumn = "KeyboardLayoutID"

	End Sub
End Class


text:
package edu.towson.cis.cosc603.project2.monopoly.gui;

import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;

import edu.towson.cis.cosc603.project2.monopoly.Cell;
import edu.towson.cis.cosc603.project2.monopoly.GameBoard;

// TODO: Auto-generated Javadoc
/**
 * The Class GameBoardUtil.
 */
public class GameBoardUtil {

	/**
	 * Calculate dimension.
	 *
	 * @param i the i
	 * @return the dimension
	 */
	public static Dimension calculateDimension(int i) {
		i = i - 4;
		int shortSide = i / 4;
		int longSide = (i - (shortSide * 2)) / 2;
		return new Dimension(longSide, shortSide);
	}

	/**
	 * Gets the east cells.
	 *
	 * @param board the board
	 * @return the east cells
	 */
	public static List<Cell> getEastCells(GameBoard board) {
		Dimension d = calculateDimension(board.getCellNumber());
		int shortSide = d.height;
		List<Cell> cells = new ArrayList<Cell>();
		for(int i = board.getCellNumber() - shortSide; i <= board.getCellNumber() - 1; i++) {
			cells.add(board.getCell(i));
		}
		return cells;
	}

	/**
	 * Gets the north cells.
	 *
	 * @param board the board
	 * @return the north cells
	 */
	public static List<Cell> getNorthCells(GameBoard board) {
		Dimension d = calculateDimension(board.getCellNumber());
		int longSide = d.width;
		int shortSide = d.height;
		List<Cell> cells = new ArrayList<Cell>();
		for(int i = longSide + 2 + shortSide; i <= longSide + 2 + shortSide + longSide + 1; i++) {
			cells.add(board.getCell(i));
		}
		return cells;
	}

	/**
	 * Gets the south cells.
	 *
	 * @param board the board
	 * @return the south cells
	 */
	public static List<Cell> getSouthCells(GameBoard board) {
		Dimension d = calculateDimension(board.getCellNumber());
		int longSide = d.width;
		List<Cell> cells = new ArrayList<Cell>();
		for(int i = longSide + 1; i >= 0; i--) {
			cells.add(board.getCell(i));
		}
		return cells;
	}

	/**
	 * Gets the west cells.
	 *
	 * @param board the board
	 * @return the west cells
	 */
	public static List<Cell> getWestCells(GameBoard board) {
		Dimension d = calculateDimension(board.getCellNumber());
		int longSide = d.width;
		int shortSide = d.height;
		List<Cell> cells = new ArrayList<Cell>();
		for(int i = longSide + 1 + shortSide; i > longSide + 1; i--) {
			cells.add(board.getCell(i));
		}
		return cells;
	}
}


text:
package org.knowm.xchange.clevercoin.dto.marketdata;

import java.math.BigDecimal;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author Ryan Sundberg
 */
public class CleverCoinStreamingOrderBook extends CleverCoinOrderBook {

  /**
   * Constructor
   *
   * @param bids
   * @param asks
   */
  public CleverCoinStreamingOrderBook(@JsonProperty("bids") List<List<BigDecimal>> bids, @JsonProperty("asks") List<List<BigDecimal>> asks) {

    super(null, bids, asks);
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>de.eleon</groupId>
        <artifactId>console-builder-parent</artifactId>
        <version>1.5-SNAPSHOT</version>
    </parent>
    <artifactId>console-builder</artifactId>

    <packaging>jar</packaging>

    <dependencies>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <dependency>
            <groupId>jline</groupId>
            <artifactId>jline</artifactId>
        </dependency>

        <!-- Test -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
        </dependency>

        <dependency>
            <groupId>com.jayway.awaitility</groupId>
            <artifactId>awaitility</artifactId>
        </dependency>

    </dependencies>

</project>


text:
module Howrah
  module Renderer
    class Table
      module Drawer
        def draw_table
          prawn_command :table, table_data, table_options do |prawn_table|
            draw_header(table) if table.header?

            default_body_style(prawn_table)

            draw_footer(table) if table.footer?
          end
        end

        def draw_header(table)
          prawn_command :row, 0 do |row|
            style = prawn_command :row, style
            prawn_command :style, header_style
          end
        end

        def draw_footer(table)
          prawn_command :row, :last do |row|
            style = prawn_command :row, style
            prawn_command :style, footer_style
          end
        end
      end
    end
  end
end


text:
body {
  font-size: 20px;
  background-color: #4A4647;
  color: #262626;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
}

a {
  color: #eeeeee;
  text-decoration: none;
  outline: none;
}

hr {
  clear: both;
  border: 1px solid #262626;
  margin: 10px 0;
}

main {
  background-color: #D5D69D;
  width: 1000px;
  margin: auto;
  -moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -moz-user-select: -moz-none;
  -ms-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}
main header {
  background-color: #2196F3;
  position: fixed;
  width: 1000px;
  z-index: 50;
  -moz-box-shadow: rgba(0, 0, 0, 0.26) 0 2px 5px;
  -webkit-box-shadow: rgba(0, 0, 0, 0.26) 0 2px 5px;
  box-shadow: rgba(0, 0, 0, 0.26) 0 2px 5px;
}
main header nav ul {
  margin: 0;
}
main header nav ul li {
  display: inline;
}
main header nav ul li a {
  display: inline-block;
  padding: 10px;
  -moz-box-sizing: padding-box;
  -webkit-box-sizing: padding-box;
  box-sizing: padding-box;
  color: white;
}
main header nav ul li a:hover {
  background-color: #63b5f6;
}
main section {
  padding-top: 53px;
}
main article {
  float: left;
  width: 580px;
  padding-left: 10px;
}
main article hr {
  margin: 10px 3px;
}
main aside {
  float: left;
  width: 360px;
  background-color: #EFEFEF;
  font-family: monospace;
  margin-left: 20px;
  padding: 10px;
  -moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  position: relative;
}
main aside .btn-print-bill {
  font-size: 50px;
  color: black;
  position: absolute;
  right: 0;
  -moz-transition: color 200ms;
  -o-transition: color 200ms;
  -webkit-transition: color 200ms;
  transition: color 200ms;
}
main aside .btn-print-bill.disabled {
  color: rgba(0, 0, 0, 0.2);
}
main aside h3 {
  margin: 0 0 5px;
}
main aside table {
  width: 100%;
}
main aside .amount {
  width: 35px;
  text-align: right;
}
main aside .item {
  padding: 5px 0;
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}
main aside .price {
  width: 90px;
  text-align: right;
  white-space: nowrap;
}
main aside .edit {
  width: 53px;
  text-align: right;
}
main aside .edit a {
  font-size: 22px;
  width: 20px;
  display: inline-block;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  -moz-transition: color 200ms;
  -o-transition: color 200ms;
  -webkit-transition: color 200ms;
  transition: color 200ms;
}
main aside .edit a.add {
  color: #308030;
}
main aside .edit a.remove {
  color: #FC3030;
}
main aside .edit a:active {
  color: #262626;
}
main aside .edit a:before {
  margin-left: 3px;
}
main aside .total {
  font-size: 1.5em;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: bold;
}
main aside .notes {
  padding-left: 12px;
  padding-right: 5px;
}
main aside .notes textarea {
  resize: none;
  overflow: hidden;
  -moz-transition: height 200ms;
  -o-transition: height 200ms;
  -webkit-transition: height 200ms;
  transition: height 200ms;
  width: 100%;
  height: 1em;
}
main aside .notes textarea:focus {
  overflow: auto;
  height: 5em;
}
main footer {
  clear: both;
  text-align: center;
  vertical-align: bottom;
  height: 10px;
}

#logo {
  float: left;
  padding: 5px;
  height: 75px;
  background-color: rgba(127, 74, 55, 0.8);
}

.buttons {
  list-style: none;
  padding: 0;
  margin: 0;
}
.buttons li {
  -moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -moz-border-radius: 2px;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  margin: 5px 2px;
  text-align: center;
  display: inline-block;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-justify-content: center;
  justify-content: center;
  height: 70px;
}
.buttons li.badge {
  position: relative;
}
.buttons li.badge[data-badge]:after {
  content: attr(data-badge);
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: .7em;
  background: #E54028;
  color: #eeeeee;
  width: 18px;
  height: 18px;
  text-align: center;
  line-height: 18px;
  border-radius: 50%;
  -moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  -webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
  box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.37);
}
.buttons li.disabled {
  background-color: gray;
}
.buttons li.disabled a {
  -webkit-filter: blur(1px);
  filter: blur(1px);
}
.buttons li a {
  display: block;
  width: 126px;
  word-wrap: break-word;
  overflow: auto;
  padding: 10px 5px;
}

.products {
  overflow: auto;
}

.pizza, .category-5 {
  background-color: #E54028;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.pizza:hover, .category-5:hover {
  background-color: #e85641;
}
.pizza:active, .category-5:active {
  background-color: #ce3924;
}

.restaurant, .category-3 {
  background-color: #32742C;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.restaurant:hover, .category-3:hover {
  background-color: #4a8445;
}
.restaurant:active, .category-3:active {
  background-color: #2d6827;
}

.drink, .category-1 {
  background-color: #113F8C;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.drink:hover, .category-1:hover {
  background-color: #2d5699;
}
.drink:active, .category-1:active {
  background-color: #0f387e;
}

.dessert, .category-4 {
  background-color: #F18D05;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.dessert:hover, .category-4:hover {
  background-color: #f29a23;
}
.dessert:active, .category-4:active {
  background-color: #d87e04;
}

.ticket, .category-6 {
  background-color: #D70060;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.ticket:hover, .category-6:hover {
  background-color: #db1e73;
}
.ticket:active, .category-6:active {
  background-color: #c10056;
}

.hotdogs, .category-2 {
  background-color: #01A4A4;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.hotdogs:hover, .category-2:hover {
  background-color: #1faeae;
}
.hotdogs:active, .category-2:active {
  background-color: #009393;
}

.user-form {
  float: left;
}
.user-form input {
  height: 1.5em;
  width: 280px;
  font-size: 1em;
  margin: 10px 0 10px 0;
  border: 1px solid #a0a0a0;
  padding: 3px 5px;
  -moz-border-radius: 2px / 2px;
  -webkit-border-radius: 2px 2px;
  border-radius: 2px / 2px;
  -moz-transition: box-shadow 200ms;
  -o-transition: box-shadow 200ms;
  -webkit-transition: box-shadow 200ms;
  transition: box-shadow 200ms;
}
.user-form input:focus {
  border: 1px solid #a0a0a0;
  -moz-box-shadow: 0 0 3px gray inset;
  -webkit-box-shadow: 0 0 3px gray inset;
  box-shadow: 0 0 3px gray inset;
}

.alert-panel {
  position: fixed;
  top: 200px;
  left: 50%;
  margin-left: -200px;
  width: 400px;
  background-color: #eeeeee;
  z-index: 50;
}
.alert-panel .text {
  text-align: center;
  margin: 10px;
}
.alert-panel .button {
  display: block;
  width: 100%;
  height: 2em;
  color: #111111;
  border-top: 1px solid #111111;
  text-align: center;
  font-size: 1em;
  line-height: 2em;
  -moz-transition: background-color 200ms;
  -o-transition: background-color 200ms;
  -webkit-transition: background-color 200ms;
  transition: background-color 200ms;
}
.alert-panel .button:hover {
  background-color: #d6d6d6;
}
.alert-panel .button:active {
  background-color: #bebebe;
}

.mask {
  opacity: 1;
  position: fixed;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(17, 17, 17, 0.5);
  z-index: 40;
  -moz-transition: opacity 200ms, visibility 200ms;
  -o-transition: opacity 200ms, visibility 200ms;
  -webkit-transition: opacity 200ms, visibility 200ms;
  transition: opacity 200ms, visibility 200ms;
}

.hidden {
  visibility: hidden;
  opacity: 0;
}


text:
<problems>
    <problem>
        <file>test.kt</file>
        <line>13</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'a' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>19</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Function 'f1' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>20</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Function 'f2' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>65</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'y' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>68</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Function 'f2' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>78</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'a' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>79</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'b' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>80</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'c' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>135</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can have 'private' visibility</problem_class>
        <description>Property 'bar' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>180</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class member can have 'private' visibility</problem_class>
        <description>Property 'a' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>181</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class member can have 'private' visibility</problem_class>
        <description>Property 'b' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>182</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class member can have 'private' visibility</problem_class>
        <description>Function 'c' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>190</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class member can have 'private' visibility</problem_class>
        <description>Property 'b' could be private</description>
    </problem>

    <problem>
        <file>test.kt</file>
        <line>191</line>
        <module>light_idea_test_case</module>
        <entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
        <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class member can have 'private' visibility</problem_class>
        <description>Function 'c' could be private</description>
    </problem>
</problems>