text:
title: "Multifractals in ecology using R - Day 5"
date: 2013-08-30 19:06
collection: teaching
type: "Posgraduate course"
date: 2013-07-26
venue: "University of Maringá"
location: "Brasil"
---

## Not everything is fractal

* Halley (2004) states that Before fractality can be affirmed, a power-law relationship between scale and our
	variable of interest should hold over a reasonable number of scales. If we want to demonstrate the existence
	of self-similar mechanisms we should have a reasonable good number of points between our minimum and maximum scales.

	+ A ratio of maximum scale to minimum scale more than 100 is recommended and a ratio of 1000 is optimal.

	+ I think that this requirement is too stringent for ecological data and is related to the number of points needed to fit a linear relationship.

	+ The folowing figure shows the distribution of microphytobenthos chlorophyll-a concentration (modified from Seuront 2009) as a continous pattern (A) or a discrete pattern (B) and the scaling behaviour (C) where $\delta$ is the scale

		![](figs/C5_MicroPhytoB.png)

		Here the ratio is about 15, but there is no doubt that there is a power law in the extent considered.

+ The box counting method is very sensitive to the amount of area occupied at the finest scale.
	When we look at coarser scales (bigger $r$) the boxes can be filled before we reach the maximum.
	Alternatively the object could occupy less area than the coarser scales thus after some threshold we count only 1 point.

	![](figs/C5_FractOccup.png)

	One should ignore the scales after these limits. Another solution is to estimate higher order fractal dimension, $D_1$ for example, that are less sensitive to

+ There are other artifact due to the finiteness of natural fractals thus the maximum scale should be (much) less than the maximum extension of the object under study and the minimum scale should be greater than the minimum inter point separation. These problems are all related to the box-counting method and $D_0$.

+ Because small boxes are nested into big boxes the points used for linear regressions are not independent, then p-values and confidence intervals are underestimated. Moreover residuals are typically neither constant in variance nor have a Gaussian distribution. One solution is to examine the number of occupied subcells within a sample of occupied cells at each scale, this will do independent samples for each scale.

+ Objects and edges have different fractal dimensions. For example, vegetation may be defined by
the area covered by the leaves of the plants or by the set of the positions of individuals in space. The question we are asking will determine Which representation we'll choose.

## Synthesis

+ The intuitive notion that a healthy organism is characterized by regular, mechanistic function has been challenged by observations that a loss complexity is, in fact, indicative of ill-health.

+ Understanding the origins of scaling can provide valuable information about the origins of ecological complexity.

+ But understanding means that we should investigate the origins of the power law patterns, we should not be satisfied only with a description.

+ Models, experimentation and comparative observational studies should be used in conjunction with previous hypothesis

+ When we formulate a hypothesis previously to an analysis we are making explicit our ideas about the functioning of the system this improve our understanding and help to reduce bias.

+ Sometimes we want to view or push some particular behavior of the data, and writing down the hypothesis helps to not take this avenue.

+ Fractals and power laws tell us which behaviors are constant across scales or transmit across scales. The limits or the break points of fractal behavior can tell us additional information to understand the system under investigation.

+ THE END.

## Bibliography

1. Halley JM, Hartley S, Kallimanis AS, Kunin WE, Lennon JJ, et al. (2004) Uses and abuses of fractal methodology in ecology. Ecology Letters 7: 254–271.

1. Seuront L (2009) Fractals and Multifractals in Ecology and Aquatic Science. Taylor & Francis.

1. Xiao X, White E, Hooten M, Durham S (2011) On the use of log-transformation vs. nonlinear regression for analyzing biological power-laws. Ecology 92: 1887–1894. doi:10.1890/11-0538.1.


text:
import {Injectable} from '@angular/core';
import {ShoppingCart} from "../../model/shopping-cart.component";
import {ProductCart} from "../../model/product-cart.component";
import {ReplaySubject, Observable} from "rxjs";
import {GoogleAnalyicsEventsService} from "../google-analyics-events.service";

@Injectable()
export class CartService {

  shoppingCart: ShoppingCart;
  itemsNumberObservable: ReplaySubject<number>;

  constructor(private googleAnalytics :GoogleAnalyicsEventsService) {
    this.shoppingCart = new ShoppingCart();
    this.shoppingCart.products = new Array<ProductCart>();
    this.itemsNumberObservable = new ReplaySubject(1);
  }

  getShoppingCart() {
    return this.shoppingCart;
  }

  getItemsNumberObservable(): Observable<number> {
    return this.itemsNumberObservable;
  }
  getItemsNumber(): number {
    return this.shoppingCart.products.length;
  }

  emitItemsNumberObservable() {
    this.itemsNumberObservable.next(this.shoppingCart.products.length);
  }

  getTotalPrice() {
    var count: number = 0;
    this.shoppingCart.products.forEach(p => count = count + (p.totalPrice * p.quantity));
    return count;
  }

  addProduct(productCart: ProductCart) {
    this.googleAnalytics.addProductEvent(productCart.id.toString(), productCart.name, productCart.quantity);
    this.getShoppingCart().products.push(productCart);
    this.emitItemsNumberObservable();
  }

  deleteProduct(index: number) {
    var productCart = this.shoppingCart.products.pop();
    this.googleAnalytics.removeProductEvent(productCart.id.toString(), productCart.name, productCart.quantity);
    this.shoppingCart.products.splice(index, 1);
    this.emitItemsNumberObservable();
    return this.shoppingCart;
  }

  deleteShoppingCart() {
    this.shoppingCart = new ShoppingCart();
    this.shoppingCart.products = [];
    this.emitItemsNumberObservable();
  }
}

redpajama_set_name: RedPajamaGithub


text:
package bookshop2.ui;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;

import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.aries.runtime.BeanContext;
import org.aries.ui.Display;

import admin.Action;
import admin.Role;
import admin.RoleType;
import admin.User;

@SessionScoped
@Named("securityGuard")
public class SecurityGuard implements Serializable {

	@Inject
	private Display display;

	private User selectedUserRecord;

	@Inject
	private PermissionResolver permissionResolver;

	public User getUser() {
		User user = BeanContext.get("org.aries.user");
		return user;
	}

	public String getDomain() {
		display = BeanContext.getFromSession("display");
		return display.getModule();
	}

	public boolean isCheckUser() {
		return checkRole(RoleType.USER);
	}

	public boolean isCheckHost() {
		return checkRole(RoleType.HOST);
	}

	public boolean isCheckManager() {
		return checkRole(RoleType.MANAGER);
	}

	public boolean isUser(String userId) {
		User user = getUser();
		return user != null && user.getUserName().equals(userId);
	}

	protected boolean checkRole(RoleType roleType) {
		User user = getUser();
		if (user == null)
			return false;
		boolean containsRole = containsRole(user.getRoles(), roleType);
		return containsRole;
	}

	protected boolean containsRole(Collection<Role> roles, RoleType roleType) {
		Iterator<Role> iterator = roles.iterator();
		while (iterator.hasNext()) {
			Role role = iterator.next();
			if (role.getRoleType() == roleType)
				return true;
		}
		return false;
	}

	public boolean canRead(String element) {
		return resolve(element, Action.READ);
	}

	//TODO add OPEN to Actions
	public boolean canOpen(String element) {
		return resolve(element, Action.READ);
	}

	public boolean canCreate(String element) {
		return resolve(element, Action.CREATE);
	}

	public boolean canUpdate(String element) {
		return resolve(element, Action.UPDATE);
	}

	public boolean canDelete(String element) {
		return resolve(element, Action.DELETE);
	}

	public boolean canExport(String element) {
		return resolve(element, Action.EXPORT);
	}

	public boolean canPrint(String element) {
		return resolve(element, Action.PRINT);
	}

	protected boolean resolve(String element, Action action) {
		//permissionResolver = BeanContext.getFromSession("permissionResolver");
		//return permissionResolver.check(getUser(), getDomain(), element, action);
		return true;
	}

}


text:
#ifndef _CORE_BUFFER_HPP_
#define _CORE_BUFFER_HPP_

/**
 * @file
 *
 * This is a simple implementation of buffer class, inspired by
 * boost::asio.  It provides a template version of both const_buffer
 * and mutable_buffer.
 *
 * The classes have no ownership of the memory and their use is
 * intended to provide a uniform IO interface for a bunch of different
 * data: raw pointers, std::vector, std::basic_string etc.
 *
 */

#include <vector>
#include <utility>
#include <string>

namespace blockmon {

    /**
     * forward declaration of const_buffer class;
     *
     */

    template <typename Tp>
    struct const_buffer;

    /**
     *  The mutable_buffer class provides a safe representation of a buffer of Tp objects
     *  that can be modified. It does not own the underlying data, and so is cheap to copy or
     *  assign.
     */

    template <typename Tp>
    struct mutable_buffer
    {
        friend struct const_buffer<Tp>;

        /**
         * default constructor: create a null mutable_buffer
         */

        mutable_buffer()
        : m_addr(0), m_len(0)
        {}

        mutable_buffer(const mutable_buffer &other)
        : m_addr(other.m_addr),
        m_len(other.m_len)
        {}

        mutable_buffer & operator=(const mutable_buffer &other)
        {
            m_addr = other.m_addr;
            m_len  = other.m_len;
            return *this;
        }

        /**
         * constructor: create a mutable_buffer referencing to an external
         * contiguous memory of numb Tp objects.
         *
         * @param: addr Address of the first object
         * @param: numb Number of objects
         */

        mutable_buffer(Tp *addr, size_t numb)
        : m_addr(addr), m_len(numb)
        {}

        /**
         * constructor: create a mutable_buffer referencing to an external
         * std::vector of Tp objects.
         *
         * @param: vec L-value reference of std::vector<Tp>
         */

        template <typename Alloc>
        mutable_buffer(std::vector<Tp, Alloc> &vec)
        : m_addr(&vec.front()), m_len(vec.size())
        {}

        /**
         * addr: return the pointer to the first
         * Tp object referenced by this mutable_buffer (const version)
         *
         */

        const Tp *
        addr() const
        {
            return m_addr;
        }

        /**
         * addr: return the pointer to the first Tp object referenced by
         * this mutable_buffer
         *
         */

        Tp *
        addr()
        {
            return m_addr;
        }

        /**
         * len: return the number of Tp objects * referenced by
         * this mutable_buffer
         *
         */

        size_t
        len() const
        {
            return m_len;
        }

        /**
         * explicit conversion to boolean
         */
        explicit operator bool() const
        {
            return m_addr != NULL;
        }

    private:
        Tp       *m_addr;
        size_t    m_len;
    };

    /**
     *  The const_buffer class provides a safe representation of a
     *  buffer of Tp objects that cannot be modified. It does not own
     *  the underlying data, and so is cheap to copy or assign.
     */

    template <typename Tp>
    struct const_buffer
    {
        /**
         * default constructor: create a null const_buffer
         */

        const_buffer()
        : m_addr(0), m_len(0)
        {}

        const_buffer(const const_buffer &other)
        : m_addr(other.m_addr),
        m_len(other.m_len)
        {}

        const_buffer & operator=(const const_buffer &other)
        {
            m_addr = other.m_addr;
            m_len  = other.m_len;
            return *this;
        }

        /**
         * constructor: create a const_buffer referencing to an external
         * contiguous memory of numb const Tp objects.
         *
         * @param: addr Address of the first object
         * @param: numb Number of objects
         */

        const_buffer(const Tp *addr, size_t numb)
        : m_addr(addr), m_len(numb)
        {}

        /**
         * constructor: create a const_buffer from a mutable_buffer
         * Note: viceversa is forbidden.
         *
         * @param: other A const reference to a compatible mutable_buffer
         */

        const_buffer(const mutable_buffer<Tp> &other)
        : m_addr(other.addr()), m_len(other.len())
        {}

        /**
         * constructor: create a const_buffer referencing to an external
         * std::vector of Tp objects.
         *
         * @param: vec L-value reference of std::vector<Tp>
         */

        template <typename Alloc>
        const_buffer(const std::vector<Tp, Alloc> &v)
        : m_addr(&v.front()), m_len(v.size())
        {}

        /**
         * constructor: create a const_buffer referencing to an external
         * std::basic_string<> (ie: std::string or std::wstring).
         *
         * @param: s The const reference to the std::basic_string
         */

        template <typename Traits, typename Alloc>
        const_buffer(const std::basic_string<Tp,Traits, Alloc> &s)
        : m_addr(s.data()), m_len(s.size())
        {}

        /**
         * addr: return the pointer to the first
         * Tp object referenced by this const_buffer
         *
         */

        const Tp *
        addr() const
        {
            return m_addr;
        }

        /**
         * len: return the number of Tp objects
         * referenced by this const_buffer
         *
         */

        size_t
        len() const
        {
            return m_len;
        }

        /**
         * explicit conversion to boolean
         */
        explicit operator bool() const
        {
            return m_addr != NULL;
        }

    private:
        const Tp *m_addr;
        size_t    m_len;
    };

} // namespace blockmon

#endif /* _CORE_BUFFER_HPP_ */


text:
//
//  GDataRecurrenceException.m
//

#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CALENDAR_SERVICE

#import "GDataRecurrenceException.h"

#import "GDataOriginalEvent.h"
#import "GDataEntryLink.h"

@implementation GDataRecurrenceException
// a gd:recurrenceException link, possibly containing an entryLink or
// an originalEvent
//<gd:recurrenceException specialized="true">
//  <gd:entryLink>
//     <entry>
//   ...
// http://code.google.com/apis/gdata/common-elements.html#gdRecurrenceException

+ (NSString *)extensionElementURI       { return kGDataNamespaceGData; }
+ (NSString *)extensionElementPrefix    { return kGDataNamespaceGDataPrefix; }
+ (NSString *)extensionElementLocalName { return @"recurrenceException"; }

+ (GDataRecurrenceException *)recurrenceExceptionWithEntryLink:(GDataEntryLink *)entryLink
                                                 originalEvent:(GDataOriginalEvent *)originalEvent
                                                 isSpecialized:(BOOL)isSpecialized {
  GDataRecurrenceException *obj = [self object];
  [obj setEntryLink:entryLink];
  [obj setOriginalEvent:originalEvent];
  [obj setIsSpecialized:isSpecialized];
  return obj;
}

- (id)initWithXMLElement:(NSXMLElement *)element
                  parent:(GDataObject *)parent {
  self = [super initWithXMLElement:element
                            parent:parent];
  if (self) {
    [self setIsSpecialized:[self boolForAttributeName:@"specialized"
                                          fromElement:element]];
    [self setEntryLink:[self objectForChildOfElement:element
                                       qualifiedName:@"gd:entryLink"
                                        namespaceURI:kGDataNamespaceGData
                                         objectClass:[GDataEntryLink class]]];
    [self setOriginalEvent:[self objectForChildOfElement:element
                                           qualifiedName:@"gd:originalEvent"
                                            namespaceURI:kGDataNamespaceGData
                                             objectClass:[GDataOriginalEvent class]]];
  }
  return self;
}

- (void)dealloc {
  [entryLink_ release];
  [originalEvent_ release];
  [super dealloc];
}

- (id)copyWithZone:(NSZone *)zone {
  GDataRecurrenceException* newRecurrence = [super copyWithZone:zone];
  [newRecurrence setIsSpecialized:[self isSpecialized]];
  [newRecurrence setEntryLink:[[[self entryLink] copyWithZone:zone] autorelease]];
  [newRecurrence setOriginalEvent:[[[self originalEvent] copyWithZone:zone] autorelease]];
  return newRecurrence;
}

- (BOOL)isEqual:(GDataRecurrenceException *)other {
  if (self == other) return YES;
  if (![other isKindOfClass:[GDataRecurrenceException class]]) return NO;

  return [super isEqual:other]
    && AreBoolsEqual([self isSpecialized], [other isSpecialized])
    && AreEqualOrBothNil([self entryLink], [other entryLink])
    && AreEqualOrBothNil([self originalEvent], [other originalEvent]);
}

#if !GDATA_SIMPLE_DESCRIPTIONS
- (NSMutableArray *)itemsForDescription {
  NSMutableArray *items = [NSMutableArray array];

  if ([self isSpecialized]) {
    [self addToArray:items objectDescriptionIfNonNil:@"true" withName:@"specialized"];
  }
  [self addToArray:items objectDescriptionIfNonNil:entryLink_ withName:@"entryLink"];
  [self addToArray:items objectDescriptionIfNonNil:originalEvent_ withName:@"originalEvent"];

  return items;
}
#endif

- (NSXMLElement *)XMLElement {

  NSXMLElement *element = [self XMLElementWithExtensionsAndDefaultName:@"gd:recurrenceException"];

  if ([self isSpecialized]) {
    [self addToElement:element attributeValueIfNonNil:@"true" withName:@"specialized"];
  }

  if ([self entryLink]) {
    [element addChild:[[self entryLink] XMLElement]];
  }

  if ([self originalEvent]) {
    [element addChild:[[self originalEvent] XMLElement]];
  }

  return element;
}

- (BOOL)isSpecialized {
  return isSpecialized_;
}

- (void)setIsSpecialized:(BOOL)isSpecialized {
  isSpecialized_ = isSpecialized;
}

- (GDataEntryLink *)entryLink {
  return entryLink_;
}

- (void)setEntryLink:(GDataEntryLink *)entryLink {
  [entryLink_ autorelease];
  entryLink_ = [entryLink retain];
}

- (GDataOriginalEvent *)originalEvent {
  return originalEvent_;
}

- (void)setOriginalEvent:(GDataOriginalEvent *)originalEvent {
  [originalEvent_ autorelease];
  originalEvent_ = [originalEvent retain];
}

@end

#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CALENDAR_SERVICE


text:
TOP=../../..
CURRENT_DIR=`pwd`
RESOURCES_DIR=$CURRENT_DIR/resources
FUNCTIONAL_DIR=${CURRENT_DIR}/..
HEKETI_DOCKER_IMG=heketi-docker-ci.img
DOCKERDIR=$TOP/extras/docker
CLIENTDIR=$TOP/client/cli/go

source ${FUNCTIONAL_DIR}/lib.sh

### VERSIONS ###
KUBEVERSION=v1.4.0-beta.1

docker_set_env() {

    ###
    ### CENTOS WORKAROUND ###
    ### Suffering from same bug as https://github.com/getcarina/carina/issues/112
    ###
    if grep "CentOS" /etc/redhat-release > /dev/null 2>&1 ; then
        echo "CentOS DOCKER WORKAROUND"
        curl -sL https://download.getcarina.com/dvm/latest/install.sh | sh
        eval $(minikube docker-env)
        source ~/.dvm/dvm.sh
        dvm install 1.10.3
        dvm use 1.10.3
    else
        eval $(minikube docker-env)
    fi
}

copy_docker_files() {
    docker_set_env
    docker load -i $heketi_docker || fail "Unable to load Heketi docker image"
}

build_docker_file(){
    echo "Create Heketi Docker image"
    heketi_docker=$RESOURCES_DIR/$HEKETI_DOCKER_IMG
    if [ ! -f "$heketi_docker" ] ; then
        cd $DOCKERDIR/ci
        cp $TOP/heketi $DOCKERDIR/ci || fail "Unable to copy $TOP/heketi to $DOCKERDIR/ci"
        _sudo docker build --rm --tag heketi/heketi:ci . || fail "Unable to create docker container"
        _sudo docker save -o $HEKETI_DOCKER_IMG heketi/heketi:ci || fail "Unable to save docker image"
        cp $HEKETI_DOCKER_IMG $heketi_docker || fail "Unable to copy image"
        _sudo docker rmi heketi/heketi:ci
        cd $CURRENT_DIR
    fi
    copy_docker_files
}

build_heketi() {
    cd $TOP
    make || fail  "Unable to build heketi"
    cd $CURRENT_DIR
}

copy_client_files() {
    cp $CLIENTDIR/heketi-cli $RESOURCES_DIR || fail "Unable to copy client files"
}

teardown() {
    if [ -x /usr/local/bin/minikube ] ; then
        minikube stop > /dev/null
        minikube delete > /dev/null
    fi
    rm -rf $RESOURCES_DIR > /dev/null
}

setup_minikube() {
    if [ ! -d $RESOURCES_DIR ] ; then
        mkdir $RESOURCES_DIR
    fi

    echo -e "\nGet docker-machine"
    curl -Lo docker-machine https://github.com/docker/machine/releases/download/v0.8.1/docker-machine-Linux-x86_64 || fail "Unable to get docker-machine"
    chmod +x docker-machine
    _sudo mv docker-machine /usr/local/bin

    echo -e "\nGet docker-machine-driver-kvm"
    curl -Lo docker-machine-driver-kvm \
        https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm || fail "Unable to get docker-machine-driver-kvm"
    chmod +x docker-machine-driver-kvm
    _sudo mv docker-machine-driver-kvm /usr/local/bin

    _sudo usermod -a -G libvirt $(whoami)
    #newgrp libvirt

    echo -e "\nGet minikube"
    curl -Lo minikube \
        https://storage.googleapis.com/minikube/releases/v0.9.0/minikube-linux-amd64 || fail "Unable to get minikube"
    chmod +x minikube
    _sudo mv minikube /usr/local/bin

    echo -e "\nGet kubectl $KUBEVERSION"
    curl -Lo kubectl \
        http://storage.googleapis.com/kubernetes-release/release/${KUBEVERSION}/bin/linux/amd64/kubectl || fail "Unable to get kubectl"
    chmod +x kubectl
    _sudo mv kubectl /usr/local/bin

}

start_minikube() {
	minikube start \
		--iso-url=https://github.com/kubernetes/minikube/releases/download/v0.9.0/minikube.iso \
		--cpus=2 \
		--memory=2048 \
		--vm-driver=kvm \
		--kubernetes-version="${KUBEVERSION}" || fail "Unable to start minikube"
}

setup() {
    setup_minikube
    build_heketi
    copy_client_files
}

test_teardown() {
    minikube stop
    minikube delete
}

test_setup() {
    start_minikube
    build_docker_file
}

### MAIN ###
teardown
setup

### TESTS ###
# test the Authentication using the token
for kubetest in test*.sh ; do
   test_setup
   println "TEST $kubetest"
   bash $kubetest; result=$?

   if [ $result -ne 0 ] ; then
       println "FAILED $kubetest"
   else
       println "PASSED $kubetest"
   fi
   test_teardown
done
teardown
exit $result


text:
package com.wantdo.stat.dao.shop;

import com.wantdo.stat.entity.shop.AlibabaOrder;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * @ Date : 15/10/21
 * @ From : stat
 * @ Author : luanx@wantdo.com
 */
public interface AlibabaOrderDao extends PagingAndSortingRepository<AlibabaOrder, Long>, JpaSpecificationExecutor<AlibabaOrder>{

    AlibabaOrder findByPlatformOrderId(String platformOrderId);

    AlibabaOrder findByTrackno(String trackno);
}


text:
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import "mocha";

// Hyperdoc readers
import { MappingReader } from "../../src/reader/MappingReader";

// Hyperdoc writers
import { MappingWriter } from "../../src/writer/MappingWriter";
import { MappingWriterError } from "../../src/writer/MappingWriterError";

// Hyperdoc models
import { MappingProperties } from "../../src/model/Mapping";

// test dependencies
import { TestDataGenerator } from "../util/TestDataGenerator";
import { AWSMock } from "../mock/aws";
import { InMemoryMappingStore } from "../mock/InMemoryMappingStore";

const testExecutionContext = TestDataGenerator.randomExecutionContext();

function mappingServiceTests() {
  describe("MappingWriter/MappingReader", () => {
    before(() => {
      chai.should();
      chai.use(chaiAsPromised);

      AWSMock.enableMock();
    });

    beforeEach(() => {
      InMemoryMappingStore.reset();
    });

    after(() => {
      AWSMock.restoreMock();
    });

    it("get() should resolve to None for a random MappingId", () => {
      const mappingId = TestDataGenerator.randomMappingId();

      return MappingReader.get(testExecutionContext, mappingId).then((mappingOpt) => {
        chai.should().exist(mappingOpt);
        mappingOpt.isNone().should.be.true;
      });
    });

    it("get() should resolve to Some for an existing mapping", () => {
      const mapping = TestDataGenerator.randomMapping();

      // update in-memory store to facilite the new mapping to MappingService.get()
      InMemoryMappingStore.put(mapping);

      return MappingReader.get(testExecutionContext, mapping.mappingId).then((mappingOpt) => {
        chai.should().exist(mappingOpt);
        mappingOpt.isSome().should.be.true;

        const m = mappingOpt.getOrElse(null);
        chai.should().exist(m);

        m.should.eql(mapping);
      });
    });

    it("getByName() should resolve to None for a random mapping name", () => {
      const mappingName = TestDataGenerator.randomMappingName();

      return MappingReader.getByName(testExecutionContext, mappingName).then((mappingOpt) => {
        chai.should().exist(mappingOpt);
        mappingOpt.isNone().should.be.true;
      });
    });

    it("getByName() should resolve to Some for an existing mapping", () => {
      const mapping = TestDataGenerator.randomMapping();

      // update in-memory store to facilite the new mapping to MappingService.getByName()
      InMemoryMappingStore.put(mapping);

      return MappingReader.getByName(testExecutionContext, mapping.name).then((mappingOpt) => {
        chai.should().exist(mappingOpt);
        mappingOpt.isSome().should.be.true;

        const m = mappingOpt.getOrElse(null);
        chai.should().exist(m);

        m.should.eql(mapping);
      });
    });

    it("list() should resolve a dictionary of mapping", () => {
      for (let i = 0; i < 10; i++) {
        // update in-memory store to facilite a list of mappings to MappingService.list()
        InMemoryMappingStore.put(TestDataGenerator.randomMapping());
      }

      return MappingReader.list(testExecutionContext).then((mappings) => {
        chai.should().exist(mappings);
        Object.keys(mappings).length.should.be.equal(10);
      });
    });

    it("create() should be rejected if a mapping with the same name already exists", () => {
      const mappingName = TestDataGenerator.randomMappingName();
      const mappingStrictness = TestDataGenerator.randomMappingStrictnessLevel();
      const mappingProperties = TestDataGenerator.randomMappingProperties();

      return MappingWriter.create(testExecutionContext, mappingName, mappingStrictness, mappingProperties).then(
        (mapping) => {
          chai.should().exist(mapping);

          mapping.name.should.equal(mappingName);
          mapping.properties.should.eql(mappingProperties);

          // update in-memory store to facilite the new node to MappingService.get()
          InMemoryMappingStore.put(mapping);

          const p = MappingWriter.create(testExecutionContext, mappingName, mappingStrictness, mappingProperties);
          return p.should.be.rejectedWith(MappingWriterError);
        }
      );
    });

    it("create() should be rejected if a mapping name or properties are not valid", () => {
      const mappingName = TestDataGenerator.randomMappingName();
      const invalidMappingName = TestDataGenerator.randomUUID(); // UUID does not match the mapping name format
      const mappingProperties = TestDataGenerator.randomMappingProperties();
      const invalidMappingProperties: MappingProperties = {
        prop: {
          type: null,
          mandatory: false,
          multiple: false
        }
      };

      // invalid name and valid properties
      MappingWriter.create
        .bind(testExecutionContext, invalidMappingName, mappingProperties)
        .should.throw(MappingWriterError);

      // valid name and invalid properties
      MappingWriter.create
        .bind(testExecutionContext, mappingName, invalidMappingProperties)
        .should.throw(MappingWriterError);
    });

    it("setProperties() should be rejected for random MappingId", () => {
      const mappingId = TestDataGenerator.randomMappingId();
      const mappingProperties = TestDataGenerator.randomMappingProperties();

      return MappingWriter.setProperties(testExecutionContext, mappingId, mappingProperties).should.be.rejected;
    });

    it("setProperties() should set properties to an existing mapping", () => {
      const mappingName = TestDataGenerator.randomMappingName();
      const mappingStrictness = TestDataGenerator.randomMappingStrictnessLevel();
      const mappingProperties = TestDataGenerator.randomMappingProperties();
      const mappingProperties2 = TestDataGenerator.randomMappingProperties();

      let mappingId;
      return MappingWriter.create(testExecutionContext, mappingName, mappingStrictness, mappingProperties)
        .then((mapping) => {
          chai.should().exist(mapping);

          // set mappingId for testing
          mappingId = mapping.mappingId;

          mapping.name.should.equal(mappingName);
          mapping.properties.should.eql(mappingProperties);

          // update in-memory store to facilite the new node to MappingService.get()
          InMemoryMappingStore.put(mapping);

          return MappingWriter.setProperties(testExecutionContext, mappingId, mappingProperties2);
        })
        .then((mapping) => {
          chai.should().exist(mapping);

          // set mappingId for testing
          mappingId = mapping.mappingId;

          mapping.name.should.equal(mappingName);
          mapping.properties.should.eql(mappingProperties2);
        });
    });
  });
}

export default mappingServiceTests;


text: export { default } from 'ember-dashboard-controls/components/base/db-dashhead/dashhead-subtitle';


text:
'use strict';

const fs = require('fs');
const path = require('path');

function loadTests (desc, dir) {
	let contents = fs.readdirSync(path.join(__dirname, dir));
	describe(desc, function () {
		for (let i = 0; i < contents.length; i++) {
			if (contents[i].substr(-3) === '.js') require('./' + path.join(dir, contents[i]));
		}
	});
}

loadTests('Abilities', 'abilities');
loadTests('Moves', 'moves');
loadTests('Items', 'items');
loadTests('Miscellanous', 'misc');


text:
var legendaryData = require('../../data/legendary');

var getCraftable = function(dClass) {

	var craftable = {};

	var slots = Object.keys(legendaryData);
	var slotsLength = slots.length;

	for (var i =0; i < slotsLength; i++) {

		//initialize array for each slot
		craftable[slots[i]] = [];

		var items = legendaryData[slots[i]];
		var itemsCount = items.length;
		//loop through all items and check if item is craftable
		for (var j = 0; j < itemsCount;j++) {

			//has a kadala weight of zero and
			//smartloot has the class so it is craftable
			if(items[j].weight === 0 &&
				items[j].smartLoot.indexOf(dClass) > -1) {
				craftable[slots[i]].push(items[j]);
			}
		}
	}

	return craftable;

};

module.exports = getCraftable;


text:
<!DOCTYPE html>
<form method="post">
    <input name="username" type="text" placeholder="Enter your username" value="{{request.form.username}}"/>
    <input name="password" type="password" placeholder="Enter your password" value="{{request.form.password}}"/>

    <input type="submit" value="Login"/>
</form>

{% if error %}
    {{error}}
{% endif %}

</html>


text:
<template name="vocForm">
  <form id="mainForm" role="form" class="editForm">
    <legend>Variables of Concern
      <button class="pull-right btn btn-default btn-xs dropdown-toggle"
              type="button"
              title="Expand/collapse all input form sections"
              id="toggleAccordian">
        {{#if allAccordiansShown}}

        {{else}}

        {{/if}}
      </button>
      {{>formLegendPulldown}}
    </legend>

Hover-over field labels for more descriptive text. Fields marked with an asterisk (*) are required.

            Effect description

            Reference*
            {{> ntpEpiDescSelectList options=getParents selected=parent_id selectName="parent_id" }}

            {{> fldInputTypeahead name="organSiteCategory" value=organSiteCategory }}

            Potential confounders

              {{> fldTypeaheadSelectMultiple name="covariates" values=covariates}}

              {{> fldTextArea name="otherVariables" value=otherVariables}}

              {{> fldTypeaheadSelectMultiple name="caseControlMatching" values=caseControlMatching}}
              {{> fldTypeaheadSelectMultiple name="caseControlDiffers" values=caseControlDiffers}}

              {{> fldTypeaheadSelectMultiple name="coexposures" values=coexposures}}

                  {{> fldSelectSingle name="confoundingRating" value=confoundingRating}}

                  {{> fldSelectSingle name="confoundingDirection" value=confoundingDirection}}

              {{> fldTextArea name="confoundingRatingRationale" value=confoundingRatingRationale }}

            Outcome assessment override (optional)

          {{#with getParent }}

              Default values taken from study-description:

Rating: {{outcomeAssessmentRating}}

Direction: {{outcomeAssessmentDirection}}

Rationale: {{outcomeAssessmentRationale}}

          {{/with}}

                {{> fldSelectSingle name="outcomeAssessmentRatingOverride" value=outcomeAssessmentRatingOverride }}

                {{> fldSelectSingle name="outcomeAssessmentDirectionOverride" value=outcomeAssessmentDirectionOverride }}

            {{> fldTextArea name="outcomeAssessmentRationaleOverride" value=outcomeAssessmentRationaleOverride }}

            Variables of concern

          {{> vocFormTable }}

    {{> qaNotice}}
    {{> evidenceFormSubmissionDiv }}
  </form>

  {{> referenceQuickAddModal}}
</template>

<template name="ntpEpiDescSelectList">
  <select class="form-control" name="{{selectName}}">
    {{#each getOptions}}
      <option value="{{this._id}}"
        selected="{{isSelected this ../selected}}">
          {{this.reference.name}}</option>
    {{/each}}
  </select>
</template>


text:
package ai.verta.swagger._public.uac.model

import scala.util.Try

import net.liftweb.json._

import ai.verta.swagger._public.uac.model.IdServiceProviderEnumIdServiceProvider._
import ai.verta.swagger._public.uac.model.UacFlagEnum._
import ai.verta.swagger.client.objects._

case class VertauacPagination (
  page_limit: Option[BigInt] = None,
  page_number: Option[BigInt] = None
) extends BaseSwagger {
  def toJson(): JValue = VertauacPagination.toJson(this)
}

object VertauacPagination {
  def toJson(obj: VertauacPagination): JObject = {
    new JObject(
      List[Option[JField]](
        obj.page_limit.map(x => JField("page_limit", JInt(x))),
        obj.page_number.map(x => JField("page_number", JInt(x)))
      ).flatMap(x => x match {
        case Some(y) => List(y)
        case None => Nil
      })
    )
  }

  def fromJson(value: JValue): VertauacPagination =
    value match {
      case JObject(fields) => {
        val fieldsMap = fields.map(f => (f.name, f.value)).toMap
        VertauacPagination(
          // TODO: handle required
          page_limit = fieldsMap.get("page_limit").map(JsonConverter.fromJsonInteger),
          page_number = fieldsMap.get("page_number").map(JsonConverter.fromJsonInteger)
        )
      }
      case _ => throw new IllegalArgumentException(s"unknown type ${value.getClass.toString}")
    }
}


text:
<BroadcastMonitor>
  <updated>2015-08-03T11:53:01</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-03T11:52:55</startTime>
    <itemId>1000080506:0</itemId>
    <titleId>216000232</titleId>
    <itemCode>B151</itemCode>
    <itemReference></itemReference>
    <titleName>Birds & Bees </titleName>
    <artistName>Rufus & Carla Thomas</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>142</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-03T11:55:15</startTime>
    <itemId>1000080506:0</itemId>
    <titleId>216120398</titleId>
    <itemCode></itemCode>
    <itemReference></itemReference>
    <titleName>*** SWEEP DIT IS RADIO 6 RUSTIG</titleName>
    <artistName></artistName>
    <albumName></albumName>
    <CategoryCode>965</CategoryCode>
    <CategoryName>ZWARTE LIJST</CategoryName>
    <itemDuration>7</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


text:
'use strict';

import { localize } from 'vs/nls';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/platform';
import { WelcomePageContribution, WelcomePageAction } from 'vs/workbench/parts/welcome/page/electron-browser/welcomePage';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';

Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
	.registerConfiguration({
		'id': 'workbench',
		'order': 7,
		'title': localize('workbenchConfigurationTitle', "Workbench"),
		'properties': {
			'workbench.welcome.enabled': {
				'type': 'boolean',
				'default': isWelcomePageEnabled(),
				'description': localize('welcomePage.enabled', "When enabled, will show the Welcome page on startup.")
			},
		}
	});

Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
	.registerWorkbenchContribution(WelcomePageContribution);

Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
	.registerWorkbenchAction(new SyncActionDescriptor(WelcomePageAction, WelcomePageAction.ID, WelcomePageAction.LABEL), 'Help: Welcome', localize('help', "Help"));


text:
from __future__ import print_function

import argparse
import os
import sys
import traceback
import logging

from pyocd.core.helpers import ConnectHelper
from pyocd.probe.pydapaccess import DAPAccess
from pyocd.core.memory_map import MemoryType
from pyocd.commands.execution_context import CommandExecutionContext

from test_util import (
    Test,
    TestResult,
    get_session_options,
    get_target_test_params,
    get_test_binary_path,
    TEST_DIR,
    )

TEST_USER_SCRIPT = os.path.join(TEST_DIR, "test_user_script.py")

class UserScriptTestResult(TestResult):
    def __init__(self):
        super(UserScriptTestResult, self).__init__(None, None, None)
        self.name = "user_script"

class UserScriptTest(Test):
    def __init__(self):
        super(UserScriptTest, self).__init__("User Script Test", user_script_test)

    def run(self, board):
        try:
            result = self.test_function(board.unique_id)
        except Exception as e:
            result = UserScriptTestResult()
            result.passed = False
            print("Exception %s when testing board %s" % (e, board.unique_id))
            traceback.print_exc(file=sys.stdout)
        result.board = board
        result.test = self
        return result

def user_script_test(board_id):
    with ConnectHelper.session_with_chosen_probe(
            unique_id=board_id, user_script=TEST_USER_SCRIPT, **get_session_options()) as session:
        board = session.board
        target = session.target

        test_params = get_target_test_params(session)
        session.probe.set_clock(test_params['test_clock'])

        memory_map = target.get_memory_map()
        boot_region = memory_map.get_boot_memory()
        ram_region = memory_map.get_default_region_of_type(MemoryType.RAM)
        binary_file = get_test_binary_path(board.test_binary)

        test_pass_count = 0
        test_count = 0
        result = UserScriptTestResult()

        # TEST basic functionality
        print("\n------ Testing delegates ------")

        # TODO verify user script delegates were called
        target.reset_and_halt()
        target.resume()
        target.halt()
        target.step()

        test_count += 1
        test_pass_count += 1
        print("TEST PASSED")

        # TEST user defined commands
        print("\n------ Testing user defined commands ------")
        context = CommandExecutionContext()
        context.attach_session(session)

        def test_command(cmd):
            try:
                print("\nTEST: %s" % cmd)
                context.process_command_line(cmd)
            except:
                print("TEST FAILED")
                traceback.print_exc(file=sys.stdout)
                return False
            else:
                print("TEST PASSED")
                return True

        # Verify command with float, int, str args.
        if test_command("testcmd 3.14 0xbeef foobar"):
            test_pass_count += 1
        test_count += 1

        # Verify varargs: all should be strings in the cmd's args
        if test_command("anothertestcmd a b 1 2 fee fie foe"):
            test_pass_count += 1
        test_count += 1

        print("\nTest Summary:")
        print("Pass count %i of %i tests" % (test_pass_count, test_count))
        if test_pass_count == test_count:
            print("USER SCRIPT TEST PASSED")
        else:
            print("USER SCRIPT TEST FAILED")

        target.reset()

        result.passed = test_count == test_pass_count
        return result

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='pyOCD user script test')
    parser.add_argument('-d', '--debug', action="store_true", help='Enable debug logging')
    parser.add_argument("-da", "--daparg", dest="daparg", nargs='+', help="Send setting to DAPAccess layer.")
    args = parser.parse_args()
    level = logging.DEBUG if args.debug else logging.INFO
    logging.basicConfig(level=level)
    DAPAccess.set_args(args.daparg)
    # Set to debug to print some of the decisions made while flashing
    session = ConnectHelper.session_with_chosen_probe(**get_session_options())
    test = UserScriptTest()
    result = [test.run(session.board)]


text:
tekartik_jqm_asset.dart
=======================

JQueryMobile assets for dart


text:
export function has_document() {
    if (document) {
        return true;
    }
    else {
        return false;
    }
}

export function has_window() {
    if (window) {
        return true;
    }
    else {
        return false;
    }
}

export function get_junk_from_window() {
    return window.junk
}

export function get_junk_from_document() {
    return document.junk
}


text:
steal
 .plugins("jquery/class")  //load your app
 .plugins('funcunit/qunit')  //load qunit
 .then("class_test")


text:
import re
import os
import logging
import psycopg2
import psycopg2.extras
from select import select
from psycopg2.extras import Json
from psycopg2.extensions import adapt
from psycopg2.extras import HstoreAdapter

# http://initd.org/psycopg/docs/module.html#exceptions
from psycopg2 import Warning
from psycopg2 import Error
from psycopg2 import InterfaceError
from psycopg2 import DatabaseError
from psycopg2 import DataError
from psycopg2 import OperationalError
from psycopg2 import IntegrityError
from psycopg2 import InternalError
from psycopg2 import ProgrammingError
from psycopg2 import NotSupportedError

__version__ = VERSION = version = '2.0.1'

_RE_WS = re.compile(r'\n\s*')
_RE_PSQL_URL = re.compile(r'^postgres://(?P<user>[^:]*):?(?P<password>[^@]*)@(?P<host>[^:]+):?(?P<port>\d+)/?(?P<database>[^#]+)(?P<search_path>#.+)?(?P<timezone>@.+)?$')

class PubSub(object):
    def __init__(self, db):
        self._db = db
        self._cur = db.cursor()
        self._channels = []

    @property
    def channels(self):
        return list(self._channels)

    def subscribe(self, channels):
        assert type(channels) in (tuple, list), 'Invalid channels. Must be tuple or list of strings'
        self._channels = set(list(self._channels) + list(channels))

    def unsubscribe(self, channels=None):
        if channels:
            assert type(channels) in (tuple, list), 'Invalid channels. Must be tuple or list of strings'
            self._cur.execute(''.join(['UNLISTEN %s;' % c for c in list(channels)]))
            [self._channels.remove(channel) for channel in channels]
        else:
            self._cur.execute(''.join(['UNLISTEN %s;' % c for c in list(self._channels)]))
            self._channels = []

    def __iter__(self):
        while len(self._channels) > 0:
            if select([self._db], [], [], 5) != ([], [], []):
                self._db.poll()
                while self._db.notifies:
                    yield self._db.notifies.pop()

    def listen(self):
        assert self._channels, 'No channels to listen to.'
        for channel in self._channels:
            self._cur.execute('LISTEN %s;' % channel)
        return self

try:
    basestring
except NameError:
    basestring = str

class _Connection(object):
    def __init__(self, host_or_url=None, database=None, user=None, password=None, port=5432,
                 search_path=None, timezone=None, enable_logging=None):
        if enable_logging is not None:
            self._logging = enable_logging
        else:
            self._logging = (os.getenv('DEBUG') == 'TRUE' or os.getenv('LOGLVL') == 'DEBUG' or os.getenv('PG_LOG') == 'TRUE')

        if host_or_url is None:
            host_or_url = os.getenv('DATABASE_URL', '127.0.0.1')
        if host_or_url.startswith('postgres://'):
            try:
                args = _RE_PSQL_URL.match(host_or_url).groupdict()
            except:
                raise ValueError('PostgreSQL url is not a valid format postgres://user:password@host:post/database from %s' % host_or_url)
            else:
                self.host = args.get('host')
                self.database = args.get('database')
                self._search_path = search_path or args.pop('search_path', None)
                self._timezone = timezone or args.pop('timezone', None)
        else:
            self._search_path = search_path
            self._timezone = timezone
            self.host = host_or_url
            self.database = database
            args = dict(host=host_or_url, database=database, port=int(port),
                        user=user, password=password)

        self._db = None
        self._db_args = args
        self._register_types = []
        self._change_path = None
        try:
            self.reconnect()
        except Exception as err:  # pragma: no cover
            logging.error('%s: Cannot connect to PostgreSQL on postgresql://%s:<password>@%s:%s/%s',
                          str(type(err)), args['user'], self.host, args['port'], self.database)

        try:
            psycopg2.extras.register_hstore(self._db, globally=True)
        except ProgrammingError:
            pass
        psycopg2.extensions.register_adapter(dict, Json)

    def hstore(self, _dict):
        return HstoreAdapter(_dict)

    def json(self, element):
        return Json(element)

    def __del__(self):
        self.close()

    def close(self):
        """Closes this database connection."""
        if getattr(self, '_db', None) is not None:
            self._db.close()
            self._db = None

    def _reconnect(self):
        """Closes the existing database connection and re-opens it."""
        self.close()
        self._db = psycopg2.connect(**self._db_args)

        if self._search_path:
            self.execute('set search_path=%s;' % self._search_path)

        if self._timezone:
            self.execute("set timezone='%s';" % self._timezone)

    def _reregister_types(self):
        """Registers existing types for a new connection"""
        for _type in self._register_types:
            psycopg2.extensions.register_type(psycopg2.extensions.new_type(*_type))

    def path(self, search_path):
        self._change_path = search_path
        return self

    def adapt(self, value):
        """Adapt any value into SQL safe string"""
        return adapt(value)

    def register_type(self, oids, name, casting):
        """Callback to register data types when reconnect
        """
        assert type(oids) is tuple
        assert isinstance(name, basestring)
        assert hasattr(casting, '__call__')
        self._register_types.append((oids, name, casting))
        psycopg2.extensions.register_type(psycopg2.extensions.new_type(oids, name, casting))

    def mogrify(self, query, *parameters, **kwargs):
        """From http://initd.org/psycopg/docs/cursor.html?highlight=mogrify#cursor.mogrify
        Return a query string after arguments binding.
        The string returned is exactly the one that would be sent to the database running
        the execute() method or similar.
        """
        cursor = self._cursor()
        try:
            if kwargs:
                res = cursor.mogrify(query % dict([(r[0], adapt(r[1])) for r in list(kwargs.items())]))
            else:
                res = cursor.mogrify(query, parameters)

            cursor.close()
            return res

        except:  # pragma: no cover
            cursor.close()
            raise

    def query(self, query, *parameters, **kwargs):
        """Returns a row list for the given query and parameters."""
        cursor = self._cursor()
        try:
            self._execute(cursor, query, parameters or None, kwargs)
            if cursor.description:
                column_names = [column.name for column in cursor.description]
                res = [Row(zip(column_names, row)) for row in cursor.fetchall()]
                cursor.close()
                return res
        except:
            cursor.close()
            raise

    def iter(self, query, *parameters, **kwargs):
        """Returns a generator for records from the query."""
        cursor = self._cursor()
        try:
            self._execute(cursor, query, parameters or None, kwargs)
            if cursor.description:
                column_names = [column.name for column in cursor.description]
                while True:
                    record = cursor.fetchone()
                    if not record:
                        break
                    yield Row(zip(column_names, record))
            raise StopIteration

        except:
            cursor.close()
            raise

    def execute(self, query, *parameters, **kwargs):
        """Same as query, but do not process results. Always returns `None`."""
        cursor = self._cursor()
        try:
            self._execute(cursor, query, parameters, kwargs)

        except:
            raise

        finally:
            cursor.close()

    def get(self, query, *parameters, **kwargs):
        """Returns the first row returned for the given query."""
        rows = self.query(query, *parameters, **kwargs)
        if not rows:
            return None
        elif len(rows) > 1:
            raise ValueError('Multiple rows returned for get() query')
        else:
            return rows[0]

    def executemany(self, query, *parameters):
        """Executes the given query against all the given param sequences.
        """
        cursor = self._cursor()
        try:
            self._executemany(cursor, query, parameters)
            if cursor.description:
                column_names = [column.name for column in cursor.description]
                res = [Row(zip(column_names, row)) for row in cursor.fetchall()]
                cursor.close()
                return res

        except Exception:  # pragma: no cover
            cursor.close()
            raise

    def _ensure_connected(self):
        if self._db is None:
            self.reconnect()

    def _cursor(self):
        self._ensure_connected()
        try:
            return self._db.cursor()

        except:
            self.reconnect()
            return self._db.cursor()

    def _execute(self, cursor, query, parameters, kwargs):
        try:
            if kwargs:
                query = query % dict([(r[0], adapt(r[1])) for r in list(kwargs.items())])
                self._log(query)
                cursor.execute(query)
            else:
                self._log(query, parameters)
                cursor.execute(query, parameters)

        except OperationalError as e:  # pragma: no cover
            logging.error("Error connecting to PostgreSQL on %s, %s", self.host, e)
            self.close()
            raise

    def _log(self, query, params=None):
        if self._logging:
            if params:
                query = self.mogrify(query, *params)
            logging.info(_RE_WS.sub(' ', query))

    def _executemany(self, cursor, query, parameters):
        """The function is mostly useful for commands that update the database:
           any result set returned by the query is discarded."""
        try:
            self._log(query)
            cursor.executemany(query, parameters)
        except OperationalError as e:  # pragma: no cover
            logging.error('Error connecting to PostgreSQL on %s, e', self.host, e)
            self.close()
            raise

    def pubsub(self):
        return PubSub(self._db)

    def file(self, path, _execute=True):
        base = os.path.dirname(path)
        with open(path) as r:
            sql = re.sub(r'\\ir\s(.*)', lambda m: self.file(os.path.join(base, m.groups()[0]), False), r.read())
        if _execute:
            cursor = self._cursor()
            map(cursor.execute, sql.split("\n-- EOF\n"))
            cursor.close()
        else:
            return sql

    @property
    def notices(self):
        """pops and returns all notices
        http://initd.org/psycopg/docs/connection.html#connection.notices
        """
        return [self._db.notices.pop()[8:].strip() for x in range(len(self._db.notices))]

class Connection(_Connection):
    def reconnect(self):
        self._reconnect()
        self._db.autocommit = True
        self._reregister_types()

class TransactionalConnection(_Connection):
    def __init__(self, host_or_url=None, database=None, user=None, password=None, port=5432,
                 search_path=None, timezone=None,
                 isolation_level=None, readonly=None,
                 deferrable=None):

        self.isolation_level = isolation_level
        self.readonly = readonly
        self.deferrable = deferrable

        super(TransactionalConnection, self).__init__(
            host_or_url=host_or_url, database=database, user=user, password=password, port=port,
            search_path=search_path, timezone=timezone
        )

    def reconnect(self):
        self._reconnect()
        self._db.set_session(isolation_level=self.isolation_level, readonly=self.readonly, deferrable=self.deferrable)
        self._reregister_types()

    def commit(self):
        self._db.commit()

    def rollback(self):
        self._db.rollback()

class Row(dict):
    """A dict that allows for object-like property access syntax."""
    def __getattr__(self, name):
        try:
            return self[name]
        except KeyError:  # pragma: no cover
            raise AttributeError(name)


text:
= ActsAsMarkable

This project rocks and uses MIT-LICENSE. And no `method_missing` and `dynamic method`.

#### Note

If you are using `rails < 4`, see [markable](https://github.com/chrome/markable) by chrome.

#### Install

```ruby
gem 'acts_as_markable', github: 'FlowerWrong/acts_as_markable', branch: 'master'
bundle install
rails generate acts_as_markable:migration
rake db:migrate
```

#### Basic Usage

```ruby
# model
class User < ActiveRecord::Base
  acts_as_marker
end

class Food < ActiveRecord::Base
  acts_as_markable [:favorite]  # array
end

pizza = Food.create(name: 'pizza')
user = User.create(name: 'yangkang')
food = Food.create(name: 'mian')

# mark
user.set_mark :favorite, [pizza, food]  # array
# or
food.mark_as :favorite, [user]  # array

# unmark
user.remove_mark :favorite, [pizza, food]
# or
food.unmark :favorite, by: user  # by can be an array

# marks
foods = Food.marked_as :favorite, by: user  # by can not be an array

# whos marked the food
food_whos = User.marked :favorite, by: food  # by can not be an array

# marked_as?
food.marked_as? :favorite, by: user  # by can not be an array
```

#### User follower

```ruby
class User < ActiveRecord::Base
  acts_as_marker
  acts_as_markable :following, by: :user
end
```

#### User Friend

```ruby
class User < ActiveRecord::Base
  acts_as_marker
  markable_as :friendly, by: :user
end
```


text:
namespace Microsoft.DocAsCode.Build.Engine
{
    using System;
    using System.Text.RegularExpressions;
    using System.Web;

    using Microsoft.DocAsCode.MarkdownLite;
    using Microsoft.DocAsCode.Plugins;
    using Microsoft.DocAsCode.Utility;

    internal sealed class XRefDetails
    {
        ///
        /// TODO: completely move into template
        /// Must be consistent with template input.replace(/\W/g, '_');
        ///
        /// <param name="id"></param>
        /// <returns></returns>
        private static Regex HtmlEncodeRegex = new Regex(@"\W", RegexOptions.Compiled);

        public string Uid { get; private set; }
        public string Anchor { get; private set; }
        public string PlainTextDisplayName { get; private set; }
        public string AnchorDisplayName { get; private set; }
        public string Title { get; private set; }
        public string Href { get; private set; }
        public string Raw { get; private set; }
        public XRefSpec Spec { get; private set; }
        public bool ThrowIfNotResolved { get; private set; }

        private XRefDetails() { }

        public static XRefDetails From(HtmlAgilityPack.HtmlNode node)
        {
            if (node.Name != "xref") throw new NotSupportedException("Only xref node is supported!");
            var xref = new XRefDetails();

            var rawUid = node.GetAttributeValue("href", null);
            if (!string.IsNullOrEmpty(rawUid))
            {
                var anchorIndex = rawUid.IndexOf("#");
                if (anchorIndex == -1)
                {
                    xref.Anchor = string.Empty;
                    xref.Uid = HttpUtility.UrlDecode(rawUid);
                }
                else
                {
                    xref.Anchor = rawUid.Substring(anchorIndex);
                    xref.Uid = HttpUtility.UrlDecode(rawUid.Remove(anchorIndex));
                }
            }

            var overrideName = node.InnerText;
            if (!string.IsNullOrEmpty(overrideName))
            {
                xref.AnchorDisplayName = overrideName;
                xref.PlainTextDisplayName = overrideName;
            }
            else
            {
                // If name | fullName exists, use the one from xref because spec name is different from name for generic types
                // e.g. return type: IEnumerable<T>, spec name should be IEnumerable
                xref.AnchorDisplayName = node.GetAttributeValue("name", null);
                xref.PlainTextDisplayName = node.GetAttributeValue("fullName", null);
            }

            xref.Title = node.GetAttributeValue("title", null);

            // Both `data-raw-html` and `data-raw` are html encoded. Use `data-raw-html` with higher priority.
            // `data-raw-html` will be decoded then displayed, while `data-raw` will be displayed directly.
            var raw = node.GetAttributeValue("data-raw-html", null);
            if (!string.IsNullOrEmpty(raw))
            {
                xref.Raw = StringHelper.HtmlDecode(raw);
            }
            else
            {
                xref.Raw = node.GetAttributeValue("data-raw", null);
            }

            xref.ThrowIfNotResolved = node.GetAttributeValue("data-throw-if-not-resolved", false);

            return xref;
        }

        public void ApplyXrefSpec(XRefSpec spec)
        {
            if (spec == null) return;
            var href = spec.Href;
            if (PathUtility.IsRelativePath(href))
            {
                if (string.IsNullOrEmpty(Anchor))
                {
                    // TODO: hashtag from tempalte
                    // TODO: What if href is not html?
                    Anchor = "#" + GetHtmlId(Uid);
                }
            }
            Href = HttpUtility.UrlDecode(href);
            Spec = spec;
        }

        ///
        /// TODO: multi-lang support
        ///
        /// <returns></returns>
        public HtmlAgilityPack.HtmlNode ConvertToHtmlNode(string language)
        {
            // If href exists, return anchor else return text
            if (!string.IsNullOrEmpty(Href))
            {
                string value = AnchorDisplayName;
                if (string.IsNullOrEmpty(value))
                {
                    value = PlainTextDisplayName ?? Uid;
                    if (Spec != null)
                    {
                        value = StringHelper.HtmlEncode(GetLanguageSpecificAttribute(Spec, language, value, "name"));
                    }
                }
                return GetAnchorNode(Href, Anchor, Title, value);
            }
            else
            {
                if (!string.IsNullOrEmpty(Raw))
                {
                    return HtmlAgilityPack.HtmlNode.CreateNode(Raw);
                }

                string value = PlainTextDisplayName;
                if (string.IsNullOrEmpty(value))
                {
                    value = AnchorDisplayName ?? Uid;
                    if (Spec != null)
                    {
                        value = StringHelper.HtmlEncode(GetLanguageSpecificAttribute(Spec, language, value, "fullName", "name"));
                    }
                }

                return GetDefaultPlainTextNode(value);
            }
        }

        public static string GetHtmlId(string id)
        {
            if (string.IsNullOrEmpty(id)) return null;
            return HtmlEncodeRegex.Replace(id, "_");
        }

        private static HtmlAgilityPack.HtmlNode GetAnchorNode(string href, string anchor, string title, string value)
        {
            var anchorNode = $"{value}";

            return HtmlAgilityPack.HtmlNode.CreateNode(anchorNode);
        }

        private static HtmlAgilityPack.HtmlNode GetDefaultPlainTextNode(string value)
        {
            var spanNode = $"{value}";
            return HtmlAgilityPack.HtmlNode.CreateNode(spanNode);
        }

        private static string GetLanguageSpecificAttribute(XRefSpec spec, string language, string defaultValue, params string[] keyInFallbackOrder)
        {
            if (keyInFallbackOrder == null || keyInFallbackOrder.Length == 0) throw new ArgumentException("key must be provided!", nameof(keyInFallbackOrder));
            string suffix = string.Empty;
            if (!string.IsNullOrEmpty(language)) suffix = "." + language;
            foreach (var key in keyInFallbackOrder)
            {
                string value;
                var keyWithSuffix = key + suffix;
                if (spec.TryGetValue(keyWithSuffix, out value))
                {
                    return value;
                }
                if (spec.TryGetValue(key, out value))
                {
                    return value;
                }
            }

            return defaultValue;
        }

        public static HtmlAgilityPack.HtmlNode ConvertXrefLinkNodeToXrefNode(HtmlAgilityPack.HtmlNode node)
        {
            var href = node.GetAttributeValue("href", null);
            if (node.Name != "a" || string.IsNullOrEmpty(href) || !href.StartsWith("xref:"))
            {
                throw new NotSupportedException("Only anchor node with href started with \"xref:\" is supported!");
            }
            href = href.Substring("xref:".Length);
            var raw = StringHelper.HtmlEncode(node.OuterHtml);
            var title = node.GetAttributeValue("title", null);

            var xrefNode = $"<xref href=\"{href}\" data-throw-if-not-resolved=\"True\" data-raw-html=\"{raw}\"";
            if (!string.IsNullOrEmpty(title))
            {
                xrefNode += $" title=\"{title}\"";
            }
            xrefNode += $">{node.InnerText}</xref>";

            return HtmlAgilityPack.HtmlNode.CreateNode(xrefNode);
        }
    }
}


text:
package org.apache.oodt.xmlps.structs;

/**
 *
 * <p>
 * A cde name and a value returned from a query against a Product Server
 * </p>.
 */
public class CDEValue {

    private String cdeName;

    private String val;

    public CDEValue() {

    }

    public CDEValue(String cdeName, String val) {
        this.cdeName = cdeName;
        this.val = val;
    }

    /**
     * @return the cdeName
     */
    public String getCdeName() {
        return cdeName;
    }

    /**
     * @param cdeName
     *            the cdeName to set
     */
    public void setCdeName(String cdeName) {
        this.cdeName = cdeName;
    }

    /**
     * @return the val
     */
    public String getVal() {
        return val;
    }

    /**
     * @param val
     *            the val to set
     */
    public void setVal(String val) {
        this.val = val;
    }

    public String toString(){
        return "[cdeName="+this.cdeName+",val="+this.val+"]";
    }
}


text:
public class ItemTypes
{
	/// <summary>
	/// Rope like objects.
	/// </summary>
	public static string Rope = "rope";

	/// <summary>
	/// Hooked objects.
	/// </summary>
	public static string Hook = "hook";

	/// <summary>
	/// Hard, sharp objects.
	/// </summary>
	public static string Sharp = "sharp";

	/// <summary>
	/// Long, thing objects.
	/// </summary>
	public static string Rod = "rod";

	/// <summary>
	/// Objects that can hold other objects.
	/// </summary>
	public static string Container = "container";

	/// <summary>
	/// Edible objects.
	/// </summary>
	public static string Edible = "edible";

	/// <summary>
	/// Objects that can be equipped.
	/// </summary>
	public static string Equipable = "equipable";

	/// <summary>
	/// Objects that can start a fire.
	/// </summary>
	public static string Igniter = "igniter";

	/// <summary>
	/// Objects that can fuel a fire.
	/// </summary>
	public static string Fuel = "fuel";

    /// <summary>
    /// Objects that can float.
    /// </summary>
    public static string FloatableObject = "floatable object";

    /// <summary>
    /// Objects that is the most advanced tools.
    /// </summary>
    public static string AdvancedTool = "advanced tool";

	/// <summary>
	/// Objects that can heal.
	/// </summary>
	public static string Medicinal = "medicinal";

	/// <summary>
	/// Advanced sharp objects that are tools.
	/// </summary>
	public static string Blade = "blade";

	/// <summary>
	/// Objects that are cloth.
	/// </summary>
	public static string Cloth = "cloth";

	/// <summary>
	/// Basic solid objects that can be used as raw materials for carving, as base materials, etc.
	/// Like wooden blocks that can be carved into handles or idols.
	/// </summary>
	public static string BaseSolid = "base solid";

	public static string[] Types = new string[]{Rope, Hook, Sharp, Rod, Container, Edible, Equipable, Igniter, Fuel, AdvancedTool, FloatableObject, Medicinal, Blade, Cloth, BaseSolid};
}


text:
using chrome::kHttpScheme;
using chrome::kStandardSchemeSeparator;

namespace {

const char kTestUrlHostname[] = "www.example.com";

}  // namespace

// A fake version of ProfileSyncService used for testing.
class FakeProfileSyncService : public ProfileSyncService {
 public:
  FakeProfileSyncService()
      : ProfileSyncService(NULL, NULL, ""),
        setup_(false) {
  }
  virtual ~FakeProfileSyncService() {}

  // Overrides of virtual methods in ProfileSyncService.
  virtual bool HasSyncSetupCompleted() const {
    return setup_;
  }
  virtual void ChangePreferredDataTypes(const syncable::ModelTypeSet& types) {
    types_ = types;
  }
  virtual void GetPreferredDataTypes(syncable::ModelTypeSet* types) const {
    *types = types_;
  }
  virtual void SetSyncSetupCompleted() {
    setup_ = true;
  }

 private:
  bool setup_;
  syncable::ModelTypeSet types_;
};

class FakeBrowserSignin : public BrowserSignin {
 public:
  // The |username_after_login| parameter determines what this fake
  // BrowserSignin will set the username to when ShowLoginDialog is called.
  FakeBrowserSignin(bool should_succeed,
                    const std::string& initial_username,
                    const std::string& username_after_login)
      : BrowserSignin(NULL),
        should_succeed_(should_succeed),
        username_(initial_username),
        username_after_login_(username_after_login) {
  }
  virtual ~FakeBrowserSignin() {}

  virtual std::string GetSignedInUsername() const {
    return username_;
  }

  virtual void RequestSignin(TabContents* tab_contents,
                             const string16& preferred_email,
                             const string16& message,
                             SigninDelegate* delegate) {
    if (should_succeed_) {
      // Simulate valid login.
      username_ = username_after_login_;
      delegate->OnLoginSuccess();

      // Fake a token available notification.
      Profile* profile = tab_contents->profile();
      if (profile->IsOffTheRecord()) {
        profile = g_browser_process->profile_manager()->GetDefaultProfile();
      }
      TokenService* token_service = profile->GetTokenService();
      token_service->IssueAuthTokenForTest(GaiaConstants::kGaiaService,
                                           "new_token");
    } else {
      delegate->OnLoginFailure(GoogleServiceAuthError(
        GoogleServiceAuthError::REQUEST_CANCELED));
    }
  }

 private:
  bool should_succeed_;
  std::string username_;
  std::string username_after_login_;
};

class ExtensionWebstorePrivateBrowserTest : public ExtensionBrowserTest {
 public:
  ExtensionWebstorePrivateBrowserTest() {
    test_url_base_ = std::string() + kHttpScheme + kStandardSchemeSeparator +
                     kTestUrlHostname;
  }

  void SetUpCommandLine(CommandLine* command_line) {
    ExtensionBrowserTest::SetUpCommandLine(command_line);
    command_line->AppendSwitchASCII(switches::kAppsGalleryURL, test_url_base_);
  }

  // This generates a regular test server url pointing to a test file at
  // |relative_path|, but replaces the hostname with kTestUrlHostname so that
  // we get the webstore private APIs injected (this happens because of the
  // command line switch we added in SetupCommandLine).
  GURL GetUrl(const std::string& relative_path) {
    GURL base_url = test_server()->GetURL(
        "files/extensions/webstore_private/" + relative_path);
    GURL::Replacements replacements;
    std::string replacement_host = std::string(kTestUrlHostname);
    replacements.SetHostStr(replacement_host);
    return base_url.ReplaceComponents(replacements);
  }

  void RunLoginTestImpl(bool incognito,
                        const std::string& relative_path,
                        const std::string& initial_login,
                        bool login_succeeds,
                        const std::string& login_result) {
    // Clear the token service so previous tests don't affect things.
    TokenService* token_service = browser()->profile()->GetTokenService();
    token_service->ResetCredentialsInMemory();
    if (!initial_login.empty()) {
      // Initialize the token service with an existing token.
      token_service->IssueAuthTokenForTest(GaiaConstants::kGaiaService,
                                           "existing_token");
    }

    FakeProfileSyncService sync_service;
    FakeBrowserSignin signin(login_succeeds, initial_login, login_result);
    WebstorePrivateApi::SetTestingProfileSyncService(&sync_service);
    WebstorePrivateApi::SetTestingBrowserSignin(&signin);

    ExtensionTestMessageListener listener("success", false);
    GURL url = GetUrl(relative_path);
    if (incognito) {
      ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url);
    } else {
      ui_test_utils::NavigateToURL(browser(), url);
    }
    EXPECT_TRUE(listener.WaitUntilSatisfied());

    WebstorePrivateApi::SetTestingBrowserSignin(NULL);
    WebstorePrivateApi::SetTestingProfileSyncService(NULL);
  }

  void RunLoginTest(const std::string& relative_path,
                    const std::string& initial_login,
                    bool login_succeeds,
                    const std::string& login_result) {
    RunLoginTestImpl(true,
                     relative_path,
                     initial_login,
                     login_succeeds,
                     login_result);
    RunLoginTestImpl(false,
                     relative_path,
                     initial_login,
                     login_succeeds,
                     login_result);
  }

 protected:
  std::string test_url_base_;
};

IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateBrowserTest, BrowserLogin) {
  host_resolver()->AddRule(kTestUrlHostname, "127.0.0.1");
  ASSERT_TRUE(test_server()->Start());

  RunLoginTest("browser_login/expect_nonempty.html",
               "foo@bar.com", false, "");

  RunLoginTest("browser_login/prompt_no_preferred.html", "", true, "");

  RunLoginTest("browser_login/prompt_preferred.html", "", true, "foo@bar.com");

  RunLoginTest("browser_login/prompt_login_fails.html",
               "", false, "foo@bar.com");
}


text:
import './chunk-2452e3d3.js';
import './helpers.js';
import './chunk-8ed29c41.js';
import { r as registerComponent, u as use } from './chunk-cca88db8.js';
import './chunk-2ef19b56.js';
import './chunk-42f463e6.js';
import { D as Dropdown, a as DropdownItem } from './chunk-e2606096.js';
export { D as BDropdown, a as BDropdownItem } from './chunk-e2606096.js';

var Plugin = {
  install: function install(Vue) {
    registerComponent(Vue, Dropdown);
    registerComponent(Vue, DropdownItem);
  }
};
use(Plugin);

export default Plugin;


text:
package org.stellasql.stella.gui.util;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.swt.SWT;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Shell;
import org.stellasql.stella.gui.custom.MessageDialog;

public class WebSiteOpener
{
  private final static Logger logger = LogManager.getLogger(WebSiteOpener.class);

  public static void openURL(String urlString, Shell shell)
  {
    try
    {
      Program.launch(urlString);
    }
    catch (Exception ex)
    {
      logger.error(ex.getMessage(), ex);
      MessageDialog md = new MessageDialog(shell, SWT.OK);
      md.setText("Error");
      md.setMessage("Problem launching browser:\n" + ex.getClass().getName() + "\n" + ex.getMessage());
      md.open();
    }
  }

}


text:
/* DOES THIS HELP AUTOSIZING? */
.admin .parameters {
	height: auto !important;
	font-family: Verdana;
}

/* DND AVATAR ICON */
.parameters .dojoDndAvatarHeader,
.parameters .tundra.dojoDndCopy .dojoDndAvatarHeader {
	background-image: url(../../../plugins/admin/images/parameter-18.png) !important;
	background-position: 0.3em 0.2em !important;
}

.admin .parameters textarea {
	overflow: auto !important;
}

.admin .parameters .headerRow {
	font-size: 12px !important;
	color: darkblue !important;
	text-align: center !important;
	padding: 0px !important;
}
.admin .parameters .unlocked,
.admin .parameters .locked {
	background-image: url(../../../plugins/admin/images/locked-24.png);
	background-repeat: no-repeat;
	width: 24px;
	text-align: center !important;
	vertical-align: middle;
}
.admin .parameters .unlocked {
	background-image: url(../../../plugins/admin/images/unlocked-24.png);
}
.admin .parameters .parameterrow .unlocked,
.admin .parameters .parameterrow .locked {
	background-image: url(../../../plugins/admin/images/locked-20.png);
	background-repeat: no-repeat;
	width: 24px;
	text-align: center !important;
	vertical-align: middle;
	background-position: 0px 4px !important;
}
.admin .parameters .parameterrow .unlocked {
	background-image: url(../../../plugins/admin/images/unlocked-20.png);
}
.admin .parameters .label {
	text-align:	center !important;
	font-weight: bolder;
	font-size: 18px;
	color: darkblue;
	font-style: oblique;
	height: 20px;
	vertical-align: bottom !important;
	/*background-color: #FF4;*/
	background-color: #EEE;
}
.admin .parameters .label .paramOrder,
.admin .parameters .label .paramFilter {
	line-height: 20px !important;
	height: 40px !important;
}

/* NB: THIS IS NEEDED FOR THE BUTTON CSS BELOW TO WORK! */
.admin .parameters table textarea {
	font-family: Verdana;
}
.admin .parameters .addParameterButton {
	height: 20px !important;
	width: 115px !important;
	/*margin-left: auto;*/
	margin-right: 0px;

	text-align: center;
	vertical-align: middle;
	-moz-user-select: none;
	font-size: 14px;
	font-family: Verdana;
	font-weight: bolder;
	color: #224;
	background-color: #FEFEFE;

	border: 4px solid #BBB;
	border-bottom-color: #888;
	border-left-color: #888;
}

.admin .parameters .addParameterButton:hover {
	border-color: #999;
	border-bottom-color: #555;
	border-left-color: #555;
	background-color : #FFF;
	/*background-color : #FF8;*/
}

.admin .parameters .addParameterButton:active {
	border-color: #999;
	border-bottom-color: #555;
	border-left-color: #555;
	background-color : #8F8;
}

.admin .parameters .inputs .name,
.admin .parameters .inputs .valuetype,
.admin .parameters .inputs .ordinal,
.admin .parameters .inputs .value,
.admin .parameters .inputs .argument,
.admin .parameters .inputs .category,
.admin .parameters .inputs .description,
.admin .parameters .inputs .discretion,
.admin .parameters .inputs .paramtype,
.admin .parameters .inputs .format,
.admin .parameters .inputs .args,
.admin .parameters .inputs .inputParams,
.admin .parameters .inputs .paramFunction
{
	height: 20px !important;
	font-size: 14px;
	color: #222;
	text-align: left !important;
	vertical-align: middle !important;
	font-weight: bolder !important;
	padding-top: 0px;
}

.admin .parameters .inputs .paramFunction {
	height: auto !important;
}

.admin .parameters .inputs .name {
	height: 24px !important;
	width: 170px !important;
}

.admin .parameters .inputs .valuetype,
.admin .parameters .inputs .ordinal,
.admin .parameters .inputs .discretion,
.admin .parameters .inputs .paramtype {
	font-size: 13px;
	height: 24px !important;
	width: 103px !important;
	padding-top: 0px;
	position: relative;
	left: 4px;
	background-color: #FFF !important;
}

.admin .parameters .inputs .format,
.admin .parameters .inputs .args,
.admin .parameters .inputs .inputParams,
.admin .parameters .inputs .paramFunction {
	/*background-color: #EEE;*/
	color: #555;
}

.admin .parameters .invalid ,
.admin .parameters .inputs .description .dijitTextArea .invalid,
.admin .parameters .inputs .discretion .dijitTextArea .invalid {
	border: 2px solid #F00 !important;
}

.admin .parameters .inputs .default {
	font-style: normal !important;
	font-weight: normal;
	font-size: 12px !important;
	background-color: #DDD;
}
.admin .parameters .inputs .default:hover {
	background-color: #DDD !important;
}

/* TOGGLE */
.admin .parameters .toggleTitle {
	text-align: left !important;
	padding-top: 6px !important;
	font-size: 14px !important;
	font-weight: 800 !important;
	color: #444 !important;
}

.admin .parameters .toggleTitle:hover {
	background-color: #FFA;
}

.admin .parameters .toggleTitle:active {
	background-color: #AFA;
}

/* APPS COMBO */
.admin .parameters .appsCombo,
.admin .parameters .appNamesCombo,
.admin .parameters .paramOrderCombo,
.admin .parameters .paramFilterCombo,
.admin .parameters .dijitMenu li,
.admin .parameters .dijitMenuItem li {
	text-indent: 10px;
	background-color: #FFF;
}

/* COMBO BOX SELECTED FIELD */
/*.admin .parameters .appsCombo .dijitReset .dijitInputField,*/
/*.admin .parameters .appNamesCombo .dijitReset .dijitInputField {*/
/*	background-color: #FFD;*/
/*}*/

.admin .parameters .appsCombo,
.admin .parameters .appNamesCombo,
.admin .parameters .paramOrderCombo,
.admin .parameters .paramFilterCombo {
	height: auto;
	width: 165px !important;
	color: #000;
	font-size: 14px;
	font-weight: bold;
	text-align: center !important;
	margin-left: auto;
	margin-right: auto;
	/*background-color: #FFC;*/
}

/*.admin .parameters .appNamesCombo {
	color: darkred;
	text-align: center !important;
}
*/
/* HIDE VALIDATION ICON AT RIGHT OF COMBO SCROLLBOX */
.admin .parameters .appsCombo .dijitValidationIcon,
.admin .parameters .appNamesCombo .dijitValidationIcon,
.admin .parameters .paramOrderCombo .dijitValidationIcon,
.admin .parameters .paramFilterCombo .dijitValidationIcon {
	display: none !important;
}

.admin .parameters .appsCombo,
.admin .parameters .appNamesCombo,
.admin .parameters .paramOrderCombo,
.admin .parameters .paramFilterCombo {
	font-size: 14px;
	background-color: #FFF !important;
	text-indent: 0px;
	width: 165px !important;
	display: table-cell;
	text-align: center;
	width: 100%;
	font-weight: bold;
	font-family: Verdana;
}

.admin .parameters .appsCombo .option,
.admin .parameters .appNamesCombo .option,
.admin .parameters .paramOrderCombo .option,
.admin .parameters .paramFilterCombo .option {
	/*background-color: #FFC !important;*/
}

/* NOTE: THIS IS NECESSARY FOR THE NEXT RULE TO WORK!!! */
.admin .parameters .appsCombo .dijitReset .dijitMenu li,
.admin .parameters .appsCombo .dijitReset .dijitMenuItem li,
.admin .parameters .appNamesCombo .dijitReset .dijitMenu li,
.admin .parameters .appNamesCombo .dijitReset .dijitMenuItem li,
.admin .parameters .paramOrderCombo .dijitReset .dijitMenu li,
.admin .parameters .paramFilterCombo .dijitReset .dijitMenuItem li
{
	/*color: #0FF !important;*/
}

/*.admin .parameters .appNamesCombo .dijitReset .dijitMenu li,
.admin .parameters .appNamesCombo .dijitReset .dijitMenuItem li {
	color: darkred;
}
*/
/*.admin .parameters .dijitMenu li,
.admin .parameters .dijitMenuItem li
{
	color: #224 !important;
	height: 25px;
	background-color: #FFD;
}
*/
/*.admin .parameters .appNamesCombo .dijitMenu li,
.admin .parameters .appNamesCombo .dijitMenuItem li
{
	color: darkred !important;
}
*/

/*.admin .parameters .dijitMenu li:hover,
.admin .parameters .dijitMenuItem li:hover
{
	background-color: #DDD;
}
*/

/* DRAG SOURCE */

.admin .parameters .dragSource table {
	border-collapse: collapse !important;

}

.admin .parameters .dragSource tr {
	/*margin: 0xp !important;*/
}

.admin .parameters .dragSource table td {
/*border-bottom: 1px dashed #333 !important;  */
/*padding: 2px 5px !important;  */
/*text-overflow:ellipsis !important;  */
/*overflow:hidden !important;  */
/*white-space:nowrap !important;  */
	/*height:100% !important;*/
	/*width:100% !important;*/
}

.admin .parameters .dragSource {
	-moz-background-clip:border;
	-moz-background-inline-policy:continuous;
	-moz-background-origin:padding;
	-moz-border-radius-bottomleft:8pt;
	-moz-border-radius-bottomright:8pt;
	-moz-border-radius-topleft:8pt;
	-moz-border-radius-topright:8pt;

	background:#FFFFFF none repeat scroll 0 0;
	border:3px solid #CCCCCC;
	cursor:default;
	padding:1em 0.5em;

	/*margin-top: 5px;*/
	width: 120px;
	height: 260px;
	min-height: 100px;

	text-align: left !important;
	font-size: 12px;
	border-color: #333;

	/* NEEDED SO THAT SCROLLBAR WILL SHOW */
	display: block !important;
	overflow:auto !important;
}

.admin .parameters .dragSource .editParameterRow {
	width: 100% !important;
	height: auto !important;
	white-space: pre !important;
}

/* NON-TOGGLED NODES */
.admin .parameters .dragSource .name,
.admin .parameters .dragSource .discretion,
.admin .parameters .dragSource .paramtype {
	display: inline-block !important;
	min-height: 20px !important;
	height: auto !important;
	max-height: auto !important;
	background-color: #FFF;
}

/* TOGGLED NODES */
.admin .parameters .dragSource .argument,
.admin .parameters .dragSource .valuetype,
.admin .parameters .dragSource .ordinal,
.admin .parameters .dragSource .category,
.admin .parameters .dragSource .value,
.admin .parameters .dragSource .description,
.admin .parameters .dragSource .format,
.admin .parameters .dragSource .args,
.admin .parameters .dragSource .inputParams,
.admin .parameters .dragSource .paramFunction {
	display: none;
	/*min-height: 25px !important;*/
	height: auto !important;
	max-height: auto !important;
	background-color: #FFF;
	font-weight: bold !important;
}

/* WIDTHS */
	/* LARGE COLUMNS */
.admin .parameters .dragSource .description,
.admin .parameters .dragSource .paramFunction {
	width: 348px !important;
}

	/* MEDIUM COLUMNS */
.admin .parameters .dragSource .name,
.admin .parameters .dragSource .argument {
	width: 160px !important;
}
.admin .parameters .dragSource .format {
	width: 53px !important;
}
	/* LARGE COLUMNS */
.admin .parameters .dragSource .value {
	width: 254px !important;
}

	/* SMALL COLUMNS */
.admin .parameters .dragSource .valuetype,
.admin .parameters .dragSource .args {
	width: 173px !important;
}
.admin .parameters .dragSource .inputParams {
	width: 171px !important;
}
.admin .parameters .dragSource .category {
	width: 90px !important;
}
	/* COMBOBOX COLUMNS */
.admin .parameters .dragSource .ordinal {
	width: 32px !important;
}
.admin .parameters .dragSource .valuetype {
	width: 90px !important;
}
.admin .parameters .dragSource .discretion {
	width: 80px !important;
}
.admin .parameters .dragSource .lockedValueTypeContainer {
	display: inline-block;
	width: 90px !important;
}

/* MARGIN-LEFT */
.admin .parameters .dragSource .name,
.admin .parameters .dragSource .value,
.admin .parameters .dragSource .argument,
.admin .parameters .dragSource .description {
	margin-left: 5px !important;
}

/* MARGIN-TOP */
.admin .parameters .dragSource .name,
.admin .parameters .dragSource .lockedValueTypeContainer,
.admin .parameters .dragSource .discretion {
	margin-top: 1px !important;
}

.admin .parameters .dragSource .argument,
.admin .parameters .dragSource .value,
.admin .parameters .dragSource .description,
.admin .parameters .dragSource .args,
.admin .parameters .dragSource .paramFunction {
	margin-top: 1px !important;
}

/* DISCRETION COMBOBOX */
.admin .parameters .dragSource .discretionSelect {
	background-color: #FFF;
	color: blue;
	font-weight: bold;
	font-size: 12px;
	background: none;
}

/* COMBOBOX HEIGHT */
.admin .parameters .dragSource .valuetype,
.admin .parameters .dragSource .paramtype,
.admin .parameters .dragSource .ordinal {
	height: 20px !important;
}

/* NAME + IMAGE */
.admin .parameters .dragSource .name {
	font-size: 14px;
	color: darkred;
	font-weight: bolder;
	text-align: left !important;
	background-image: url(../../../plugins/admin/images/parameter-18.png);
	background-repeat: no-repeat;
	text-indent: 22px;
}

/* FONT, COLOUR AND TEXT */
.admin .parameters .dragSource .paramtype .default,
.admin .parameters .dragSource .discretion .default {
	color: #555;
	font-style: italic;
}

.admin .parameters .dragSource .valuetype,
.admin .parameters .dragSource .ordinal,
.admin .parameters .dragSource .paramtype {
	font-size: 12px;
	font-weight: bold !important;
	text-align: center !important;
}

.admin .parameters .dragSource .valuetype,
.admin .parameters .dragSource .ordinal {
	color: darkblue;
	font-size: 14px;
}

.admin .parameters .dragSource .paramtype {
	color: darkred;
}

.admin .parameters .dragSource .description {
	color: #222;
	font-size: 12px;
	font-weight: bold;
	text-align: left !important;
	background-color: #EED;
}

.admin .parameters .dragSource .discretion {
	color: blue;
	font-weight: bold;
	font-size: 12px;
	background: none;
}

.admin .parameters .dragSource .format,
.admin .parameters .dragSource .args,
.admin .parameters .dragSource .inputParams,
.admin .parameters .dragSource .paramFunction {
	color: #222;
	font-weight: normal;
	font-size: 10px;
	background-color: #FFF;
}

.admin .parameters .dragSource .args,
.admin .parameters .dragSource .inputParams {
	max-width: 49% !important;
}

.admin .parameters .dragSource .format,
.admin .parameters .dragSource .args,
.admin .parameters .dragSource .paramFunction {
	margin-left: 5px !important;
}

.admin .parameters .dragSource .format {
	font-size: 14px !important;
}

/* TRASH CAN */
.admin .parameters .trash {
	-moz-background-clip:border;
	-moz-background-inline-policy:continuous;
	-moz-background-origin:padding;
	-moz-border-radius-bottomleft:8pt;
	-moz-border-radius-bottomright:8pt;
	-moz-border-radius-topleft:8pt;
	-moz-border-radius-topright:8pt;

	background:#FFFFFF none repeat scroll 0 0;
	border:3px solid #CCCCCC;
	cursor:default;
	padding:1em 0.5em;

	margin-top: 5px;
	width: 150px;
	height: 60px;
	text-align: center;
	vertical-align: middle;
}

.admin .parameters .trashIcon {
	height: 100%;
	width: 100px;
	margin-left: auto;
	margin-right: auto;

	background-image: url(../../../plugins/admin/images/trash-60.png);
	background-repeat: no-repeat;
}