text:
package org.jcrom;

import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.RepositoryException;

import javafx.beans.property.ListProperty;
import javafx.beans.property.MapProperty;
import org.jcrom.annotations.JcrChildNode;
import org.jcrom.util.JavaFXUtils;
import org.jcrom.util.NodeFilter;
import org.jcrom.util.ReflectionUtils;

import static org.jcrom.util.JavaFXUtils.*;

/**
 * This class handles mappings of type @JcrChildNode
 *
 * @author Olafur Gauti Gudmundsson
 * @author Nicolas Dos Santos
 */
public class ChildNodeMapper {

    private static final String POLICY_NODE_NAME = "rep:policy";

    private final Mapper mapper;

    public ChildNodeMapper(Mapper mapper) {
        this.mapper = mapper;
    }

    protected String getNodeName(Field field) {
        JcrChildNode jcrChildNode = mapper.getJcrom().getAnnotationReader().getAnnotation(field, JcrChildNode.class);
        String name = field.getName();
        if (!jcrChildNode.name().equals(Mapper.DEFAULT_FIELDNAME)) {
            name = jcrChildNode.name();
        }
        return name;
    }

    private void removeChildren(Node containerNode) throws RepositoryException {
        NodeIterator nodeIterator = containerNode.getNodes();
        while (nodeIterator.hasNext()) {
            Node currentNode = nodeIterator.nextNode();
            // ignore the policy node
            if (!currentNode.getName().equals(POLICY_NODE_NAME)) {
                currentNode.remove();
            }
        }
    }

    private Node createChildNodeContainer(Node node, String containerName, JcrChildNode jcrChildNode, Mapper mapper) throws RepositoryException {

        if (!node.hasNode(mapper.getCleanName(containerName))) {
            Node containerNode = node.addNode(mapper.getCleanName(containerName), jcrChildNode.containerNodeType());

            // add annotated mixin types
            if (jcrChildNode != null && jcrChildNode.containerMixinTypes() != null) {
                for (String mixinType : jcrChildNode.containerMixinTypes()) {
                    if (containerNode.canAddMixin(mixinType)) {
                        containerNode.addMixin(mixinType);
                    }
                }
            }
            return containerNode;
        } else {
            return node.getNode(mapper.getCleanName(containerName));
        }
    }

    private void addSingleChildToNode(Field field, JcrChildNode jcrChildNode, Object obj, String nodeName, Node node, Mapper mapper, int depth, NodeFilter nodeFilter) throws IllegalAccessException, RepositoryException, IOException {

        if (jcrChildNode.createContainerNode()) {
            Node childContainer = createChildNodeContainer(node, nodeName, jcrChildNode, mapper);
            if (!childContainer.hasNodes()) {
                if (getObject(field, obj) != null) {
                    // add the node if it does not exist
                    mapper.addNode(childContainer, getObject(field, obj), null, null);
                }
            } else {
                if (getObject(field, obj) != null) {
                    Object childObj = getObject(field, obj);
                    mapper.updateNode(childContainer.getNodes().nextNode(), childObj, childObj.getClass(), nodeFilter, depth + 1, null);
                } else {
                    // field is now null, so we remove the child node
                    removeChildren(childContainer);
                }
            }
        } else {
            // don't create a container node for this child,
            // use the field name for the node instead
            if (!node.hasNode(nodeName)) {
                if (getObject(field, obj) != null) {
                    Object childObj = getObject(field, obj);
                    mapper.setNodeName(childObj, nodeName);
                    mapper.addNode(node, childObj, null, null);
                }
            } else {
                if (getObject(field, obj) != null) {
                    Object childObj = getObject(field, obj);
                    mapper.setNodeName(childObj, nodeName);
                    mapper.updateNode(node.getNode(nodeName), childObj, childObj.getClass(), nodeFilter, depth + 1, null);
                } else {
                    NodeIterator nodeIterator = node.getNodes(nodeName);
                    while (nodeIterator.hasNext()) {
                        nodeIterator.nextNode().remove();
                    }
                }
            }
        }
    }

    private void addMultipleChildrenToNode(Field field, JcrChildNode jcrChildNode, Object obj, String nodeName, Node node, Mapper mapper, int depth, NodeFilter nodeFilter) throws IllegalAccessException, RepositoryException, IOException {

        Node childContainer = createChildNodeContainer(node, nodeName, jcrChildNode, mapper);
        List<?> children = (List<?>) getObject(field, obj);
        if (children != null && !children.isEmpty()) {
            if (childContainer.hasNodes()) {
                // children exist, we must update
                NodeIterator childNodes = childContainer.getNodes();
                while (childNodes.hasNext()) {
                    Node child = childNodes.nextNode();
                    Object childEntity = mapper.findEntityByPath(children, child.getPath());
                    if (childEntity == null) {
                        // this child was not found, so we remove it
                        child.remove();
                    } else {
                        mapper.updateNode(child, childEntity, childEntity.getClass(), nodeFilter, depth + 1, null);
                    }
                }
                // we must add new children, if any
                for (int i = 0; i < children.size(); i++) {
                    Object child = children.get(i);
                    String childPath = mapper.getNodePath(child);
                    if (childPath == null || childPath.equals("") || !childContainer.hasNode(mapper.getCleanName(mapper.getNodeName(child)))) {
                        mapper.addNode(childContainer, child, null, null);
                    }
                }
            } else {
                // no children exist, we add
                for (int i = 0; i < children.size(); i++) {
                    mapper.addNode(childContainer, children.get(i), null, null);
                }
            }
        } else {
            // field list is now null (or empty), so we remove the child nodes
            removeChildren(childContainer);
        }
    }

    /**
     * Maps a Map<String,Object> or Map<String,List<Object>> to a JCR Node.
     */
    private void addMapOfChildrenToNode(Field field, JcrChildNode jcrChildNode, Object obj, String nodeName, Node node, Mapper mapper, int depth, NodeFilter nodeFilter) throws IllegalAccessException, RepositoryException, IOException {

        Node childContainer = createChildNodeContainer(node, nodeName, jcrChildNode, mapper);
        Map<?, ?> childMap = (Map<?, ?>) getObject(field, obj);
        if (childMap != null && !childMap.isEmpty()) {
            Class<?> paramClass = ReflectionUtils.getParameterizedClass(field, 1);
            if (childContainer.hasNodes()) {
                // nodes already exist, we need to update
                Map<String, String> mapWithCleanKeys = new HashMap<String, String>();
                for (Map.Entry<?, ?> entry : childMap.entrySet()) {
                    String key = (String) entry.getKey();
                    String cleanKey = mapper.getCleanName(key);
                    if (childContainer.hasNode(cleanKey)) {
                        if (isList(paramClass)) {
                            // lists are hard to update, so we just recreate it
                            childContainer.getNode(cleanKey).remove();
                            Node listContainer = childContainer.addNode(cleanKey);
                            List<?> childList = (List<?>) entry.getValue();
                            for (int i = 0; i < childList.size(); i++) {
                                mapper.addNode(listContainer, childList.get(i), null, null);
                            }
                        } else {
                            // update the child
                            mapper.updateNode(childContainer.getNode(cleanKey), entry.getValue(), paramClass, nodeFilter, depth + 1, null);
                        }
                    } else {
                        // this child does not exist, so we add it
                        addMapChild(paramClass, childContainer, childMap, key, cleanKey, mapper);
                    }
                    mapWithCleanKeys.put(cleanKey, "1");
                }

                // remove nodes that no longer exist
                NodeIterator childNodes = childContainer.getNodes();
                while (childNodes.hasNext()) {
                    Node child = childNodes.nextNode();
                    if (!mapWithCleanKeys.containsKey(child.getName())) {
                        child.remove();
                    }
                }
            } else {
                // no children exist, we simply add all
                for (Object k : childMap.keySet()) {
                    String key = (String) k;
                    String cleanKey = mapper.getCleanName(key);
                    addMapChild(paramClass, childContainer, childMap, key, cleanKey, mapper);
                }
            }
        } else {
            // map is now null (or empty), so we remove the child nodes
            removeChildren(childContainer);
        }
    }

    private void addMapChild(Class<?> paramClass, Node childContainer, Map<?, ?> childMap, String key, String cleanKey, Mapper mapper) throws IllegalAccessException, RepositoryException, IOException {
        if (isList(paramClass)) {
            List<?> childList = (List<?>) childMap.get(key);
            // create a container for the List
            Node listContainer = childContainer.addNode(cleanKey);
            for (int i = 0; i < childList.size(); i++) {
                mapper.addNode(listContainer, childList.get(i), null, null);
            }
        } else {
            mapper.setNodeName(childMap.get(key), cleanKey);
            mapper.addNode(childContainer, childMap.get(key), null, null);
        }
    }

    private void setChildren(Field field, Object obj, Node node, int depth, NodeFilter nodeFilter, Mapper mapper) throws IllegalAccessException, RepositoryException, IOException {

        JcrChildNode jcrChildNode = mapper.getJcrom().getAnnotationReader().getAnnotation(field, JcrChildNode.class);
        String nodeName = getNodeName(field);

        // make sure that this child is supposed to be updated
        if (nodeFilter == null || nodeFilter.isIncluded(field.getName(), depth)) {
            if (isList(field)) {
                // multiple children in a List
                addMultipleChildrenToNode(field, jcrChildNode, obj, nodeName, node, mapper, depth, nodeFilter);
            } else if (isMap(field)) {
                // multiple children in a Map
                addMapOfChildrenToNode(field, jcrChildNode, obj, nodeName, node, mapper, depth, nodeFilter);
            } else {
                // single child
                addSingleChildToNode(field, jcrChildNode, obj, nodeName, node, mapper, depth, nodeFilter);
            }
        }
    }

    void addChildren(Field field, Object entity, Node node, Mapper mapper) throws IllegalAccessException, RepositoryException, IOException {

        setChildren(field, entity, node, NodeFilter.DEPTH_INFINITE, null, mapper);
    }

    void updateChildren(Field field, Object obj, Node node, int depth, NodeFilter nodeFilter, Mapper mapper) throws IllegalAccessException, RepositoryException, IOException {

        setChildren(field, obj, node, depth, nodeFilter, mapper);
    }

    @SuppressWarnings("unchecked")
    List<?> getChildrenList(Class<?> childObjClass, Node childrenContainer, Object parentObj, Mapper mapper, int depth, NodeFilter nodeFilter, JcrChildNode jcrChildNode) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException {
        List<Object> children = jcrChildNode.listContainerClass().newInstance();
        NodeIterator iterator = childrenContainer.getNodes();
        while (iterator.hasNext()) {
            Node childNode = iterator.nextNode();
            // ignore the policy node when loading child nodes
            if (!childNode.getName().equals(POLICY_NODE_NAME)) {
                children.add(getSingleChild(childObjClass, childNode, parentObj, mapper, depth, nodeFilter));
            }
        }
        return children;
    }

    @SuppressWarnings("unchecked")
    private Map<?, ?> getChildrenMap(Class<?> mapParamClass, Node childrenContainer, Object parentObj, Mapper mapper, int depth, NodeFilter nodeFilter, JcrChildNode jcrChildNode) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException {

        Map<Object, Object> children = jcrChildNode.mapContainerClass().newInstance();
        NodeIterator iterator = childrenContainer.getNodes();
        while (iterator.hasNext()) {
            Node childNode = iterator.nextNode();
            if (isList(mapParamClass)) {
                // each value in the map is a list of child nodes
                if (jcrChildNode.lazy()) {
                    // lazy loading
                    children.put(childNode.getName(), ProxyFactory.createChildNodeListProxy(Object.class, parentObj, childNode.getPath(), childNode.getSession(), mapper, depth, nodeFilter, jcrChildNode));
                } else {
                    // eager loading
                    children.put(childNode.getName(), getChildrenList(Object.class, childNode, parentObj, mapper, depth, nodeFilter, jcrChildNode));
                }
            } else {
                // each value in the map is a child node
                if (jcrChildNode.lazy()) {
                    // lazy loading
                    children.put(childNode.getName(), ProxyFactory.createChildNodeProxy(mapper.findClassFromNode(Object.class, childNode), parentObj, childNode.getPath(), childNode.getSession(), mapper, depth, nodeFilter, false));
                } else {
                    // eager loading
                    children.put(childNode.getName(), getSingleChild(Object.class, childNode, parentObj, mapper, depth, nodeFilter));
                }
            }
        }
        return children;
    }

    Object getSingleChild(Class<?> childObjClass, Node childNode, Object obj, Mapper mapper, int depth, NodeFilter nodeFilter) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException {
        childNode = mapper.checkIfVersionedChild(childNode);
        Object childObj = mapper.createInstanceForNode(childObjClass, childNode);
        childObj = mapper.mapNodeToClass(childObj, childNode, nodeFilter, obj, depth + 1);
        return childObj;
    }

    void getChildrenFromNode(Field field, Node node, Object obj, int depth, NodeFilter nodeFilter, Mapper mapper) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException {

        String nodeName = getNodeName(field);
        JcrChildNode jcrChildNode = mapper.getJcrom().getAnnotationReader().getAnnotation(field, JcrChildNode.class);

        boolean childHasNodes = node.hasNode(nodeName) && (node.getNode(nodeName).hasNodes() || node.getNode(nodeName).hasProperty(Property.JCR_CHILD_VERSION_HISTORY));

        if (node.hasNode(nodeName) && (childHasNodes || (!jcrChildNode.createContainerNode() && !ReflectionUtils.implementsInterface(field.getType(), List.class) && !ListProperty.class.isAssignableFrom(field.getType()) && !ReflectionUtils.implementsInterface(field.getType(), Map.class) && !MapProperty.class.isAssignableFrom(field.getType()))) && nodeFilter.isIncluded(nodeName, depth)) {

            // child nodes are almost always stored inside a container node
            Node childrenContainer = node.getNode(nodeName);
            childrenContainer = mapper.checkIfVersionedChild(childrenContainer);
            if (isList(field)) {
                // we can expect more than one child object here
                Class<?> childObjClass = ReflectionUtils.getParameterizedClass(field);
                List<?> children;
                if (jcrChildNode.lazy()) {
                    // lazy loading
                    children = ProxyFactory.createChildNodeListProxy(childObjClass, obj, childrenContainer.getPath(), node.getSession(), mapper, depth, nodeFilter, jcrChildNode);
                } else {
                    // eager loading
                    children = getChildrenList(childObjClass, childrenContainer, obj, mapper, depth, nodeFilter, jcrChildNode);
                }
                setObject(field, obj, children);
            } else if (isMap(field)) {
                // dynamic map of child nodes
                // lazy loading is applied to each value in the Map
                Class<?> mapParamClass = ReflectionUtils.getParameterizedClass(field, 1);
                Map<?, ?> childrenMap = getChildrenMap(mapParamClass, childrenContainer, obj, mapper, depth, nodeFilter, jcrChildNode);
                setObject(field, obj, childrenMap);
            } else {
                // instantiate the field class
                Class<?> childObjClass = getType(field, obj);
                if (childrenContainer.hasNodes() || !jcrChildNode.createContainerNode()) {
                    if (jcrChildNode.lazy()) {
                        // lazy loading
                        setObject(field, obj, ProxyFactory.createChildNodeProxy(childObjClass, obj, childrenContainer.getPath(), node.getSession(), mapper, depth, nodeFilter, jcrChildNode.createContainerNode()));
                    } else {
                        // eager loading
                        if (jcrChildNode.createContainerNode()) {
                            setObject(field, obj, getSingleChild(childObjClass, childrenContainer.getNodes().nextNode(), obj, mapper, depth, nodeFilter));
                        } else {
                            setObject(field, obj, getSingleChild(childObjClass, childrenContainer, obj, mapper, depth, nodeFilter));
                        }
                    }
                } else {
                    // Issue 87: Child nodes not set to empty list/null
                    Object fieldValue = getObject(field, obj);
                    if (fieldValue != null) {
                        if (fieldValue instanceof Collection<?>) {
                            ((Collection<?>) fieldValue).clear();
                        } else if (fieldValue instanceof Map<?, ?>) {
                            ((Map<?, ?>) fieldValue).clear();
                        } else {
                            setObject(field, obj, null);
                        }
                    }
                }
            }
        }
    }

    String getChildContainerNodePath(Object childObject, Object parentObject, Node parentNode) throws IllegalAccessException, RepositoryException {
        List<String> childContainerPaths = getChildContainerNodePaths(childObject, parentObject, parentNode);
        if (childContainerPaths.size() > 1) {
            throw new IllegalAccessException("Multiple child objects found with type '" + childObject.getClass() + "' from parent object '" + parentObject.getClass() + "'");
        }
        return childContainerPaths.isEmpty() ? null : childContainerPaths.get(0);
    }

    List<String> getChildContainerNodePaths(Object childObject, Object parentObject, Node parentNode) throws IllegalAccessException, RepositoryException {
        Class<?> type = childObject.getClass();
        String childNodeName = mapper.getNodeName(childObject);

        List<String> containers = new ArrayList<String>();
        List<String> children = new ArrayList<String>();
        for (Field field : ReflectionUtils.getDeclaredAndInheritedFields(parentObject.getClass(), false)) {
            field.setAccessible(true);
            if (mapper.getJcrom().getAnnotationReader().isAnnotationPresent(field, JcrChildNode.class)) {
                Class<?> childObjClass;
                if (isList(field)) {
                    childObjClass = ReflectionUtils.getParameterizedClass(field);
                } else if (isMap(field)) {
                    childObjClass = ReflectionUtils.getParameterizedClass(field, 1);
                } else {
                    childObjClass = field.getType();
                }

                if (childObjClass.isAssignableFrom(type)) {
                    JcrChildNode jcrChildNode = mapper.getJcrom().getAnnotationReader().getAnnotation(field, JcrChildNode.class);
                    String nodeName = getNodeName(field);
                    if (jcrChildNode.createContainerNode()) {
                        if (!parentNode.hasNode(nodeName)) {
                            throw new IllegalAccessException("The child container node not found with name '" + nodeName + "' from parent node '" + parentNode.getPath() + "'");
                        }
                        Node n = parentNode.getNode(nodeName);
                        containers.add(n.getPath());
                    } else {
                        children.add(nodeName);
                    }
                }
            }
        }

        // Check if there is child objects or the childNodeName is equal to one of the object names in the objects which is not creating a container node
        if (containers.isEmpty() && !children.contains(childNodeName)) {
            throw new IllegalAccessException("Child object not found with name '" + childNodeName + "' and type '" + type + "' from parent object '" + parentObject.getClass() + "'");
        }

        return containers;
    }
}


text:
function g() {
  console.log("should have tab width 5 because it has .ts extension");
}

redpajama_set_name: RedPajamaGithub


text:
Class MainWindow

End Class


text:
package com.github.dockerjava.core.command;

import static com.google.common.base.Preconditions.checkNotNull;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;

import com.github.dockerjava.api.command.BuildImageCmd;
import com.github.dockerjava.api.model.AuthConfigurations;
import com.github.dockerjava.api.model.BuildResponseItem;
import com.github.dockerjava.core.FilePathUtil;
import com.github.dockerjava.core.dockerfile.Dockerfile;

/**
 *
 * Build an image from Dockerfile.
 *
 */
public class BuildImageCmdImpl extends AbstrAsyncDockerCmd<BuildImageCmd, BuildResponseItem> implements BuildImageCmd {

    private InputStream tarInputStream;

    private String tag;

    private Boolean noCache;

    private Boolean remove = true;

    private Boolean quiet;

    private Boolean pull;

    private AuthConfigurations buildAuthConfigs;

    private File dockerFile;

    private File baseDirectory;

    private String cpusetcpus;

    private Long memory;

    private String cpushares;

    private Boolean forcerm;

    private Long memswap;

    private URI remote;

    public BuildImageCmdImpl(BuildImageCmd.Exec exec) {
        super(exec);
    }

    public BuildImageCmdImpl(BuildImageCmd.Exec exec, File dockerFileOrFolder) {
        super(exec);
        checkNotNull(dockerFileOrFolder, "dockerFolder is null");

        if (dockerFileOrFolder.isDirectory()) {
            withBaseDirectory(dockerFileOrFolder);
            withDockerfile(new File(dockerFileOrFolder, "Dockerfile"));
        } else {
            withDockerfile(dockerFileOrFolder);
        }
    }

    public BuildImageCmdImpl(BuildImageCmd.Exec exec, InputStream tarInputStream) {
        super(exec);
        checkNotNull(tarInputStream, "tarInputStream is null");
        withTarInputStream(tarInputStream);
    }

    // getters API

    @Override
    public String getTag() {
        return tag;
    }

    @Override
    public URI getRemote() {
        return remote;
    }

    @Override
    public Boolean hasNoCacheEnabled() {
        return noCache;
    }

    @Override
    public Boolean hasRemoveEnabled() {
        return remove;
    }

    @Override
    public Boolean isForcerm() {
        return forcerm;
    }

    @Override
    public Boolean isQuiet() {
        return quiet;
    }

    @Override
    public Boolean hasPullEnabled() {
        return pull;
    }

    @Override
    public String getPathToDockerfile() {
        if (baseDirectory != null && dockerFile != null) {
            return FilePathUtil.relativize(baseDirectory, dockerFile);
        } else {
            return null;
        }
    }

    @Override
    public Long getMemory() {
        return memory;
    }

    @Override
    public Long getMemswap() {
        return memswap;
    }

    @Override
    public String getCpushares() {
        return cpushares;
    }

    @Override
    public String getCpusetcpus() {
        return cpusetcpus;
    }

    // getter lib specific

    @Override
    public AuthConfigurations getBuildAuthConfigs() {
        return buildAuthConfigs;
    }

    @Override
    public InputStream getTarInputStream() {
        return tarInputStream;
    }

    // setters

    @Override
    public BuildImageCmdImpl withTag(String tag) {
        checkNotNull(tag, "Tag is null");
        this.tag = tag;
        return this;
    }

    @Override
    public BuildImageCmd withRemote(URI remote) {
        this.remote = remote;
        return this;
    }

    @Override
    public BuildImageCmdImpl withNoCache(Boolean noCache) {
        this.noCache = noCache;
        return this;
    }

    @Override
    public BuildImageCmdImpl withRemove(Boolean rm) {
        this.remove = rm;
        return this;
    }

    @Override
    public BuildImageCmd withForcerm(Boolean forcerm) {
        this.forcerm = forcerm;
        return this;
    }

    @Override
    public BuildImageCmdImpl withQuiet(Boolean quiet) {
        this.quiet = quiet;
        return this;
    }

    @Override
    public BuildImageCmdImpl withPull(Boolean pull) {
        this.pull = pull;
        return this;
    }

    @Override
    public BuildImageCmd withMemory(Long memory) {
        this.memory = memory;
        return this;
    }

    @Override
    public BuildImageCmd withMemswap(Long memswap) {
        this.memswap = memswap;
        return this;
    }

    @Override
    public BuildImageCmd withCpushares(String cpushares) {
        this.cpushares = cpushares;
        return this;
    }

    @Override
    public BuildImageCmd withCpusetcpus(String cpusetcpus) {
        this.cpusetcpus = cpusetcpus;
        return this;
    }

    // lib specific

    @Override
    public BuildImageCmd withBaseDirectory(File baseDirectory) {
        this.baseDirectory = baseDirectory;
        return this;
    }

    @Override
    public BuildImageCmdImpl withDockerfile(File dockerfile) {
        checkNotNull(dockerfile);
        if (!dockerfile.exists())
            throw new IllegalArgumentException("Dockerfile does not exist");
        if (!dockerfile.isFile())
            throw new IllegalArgumentException("Not a directory");

        if (baseDirectory == null)
            withBaseDirectory(dockerfile.getParentFile());

        this.dockerFile = dockerfile;

        try {
            withTarInputStream(new Dockerfile(dockerfile).parse().buildDockerFolderTar(baseDirectory));
        } catch (IOException e) {
            // we just created the file this should never happen.
            throw new RuntimeException(e);
        }
        return this;
    }

    @Override
    public BuildImageCmdImpl withTarInputStream(InputStream tarInputStream) {
        checkNotNull(tarInputStream, "tarInputStream is null");
        this.tarInputStream = tarInputStream;
        return this;
    }

    @Override
    public BuildImageCmd withBuildAuthConfigs(AuthConfigurations authConfigs) {
        checkNotNull(authConfigs, "authConfig is null");
        this.buildAuthConfigs = authConfigs;
        return this;
    }

    @Override
    public void close() {
        super.close();

        try {
            tarInputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}


text:
package gov.hhs.fha.nhinc.docsubmission.passthru.proxy;

import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.common.nhinccommon.NhinTargetSystemType;
import gov.hhs.fha.nhinc.common.nhinccommonproxy.RespondingGatewayProvideAndRegisterDocumentSetRequestType;
import gov.hhs.fha.nhinc.docsubmission.passthru.proxy.description.PassthruDocSubmissiona0ServicePortDescriptor;
import gov.hhs.fha.nhinc.messaging.client.CONNECTClient;
import gov.hhs.fha.nhinc.messaging.client.CONNECTCXFClientFactory;
import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor;
import gov.hhs.fha.nhinc.nhinclib.NhincConstants;
import gov.hhs.fha.nhinc.nhincproxyxdr.ProxyXDRPortType;
import gov.hhs.fha.nhinc.webserviceproxy.WebServiceProxyHelper;
import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType;
import oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author JHOPPESC
 */
public class PassthruDocSubmissionProxyWebServiceUnsecuredImpl implements PassthruDocSubmissionProxy {
    private Log log = null;
    private WebServiceProxyHelper oProxyHelper = null;

    public PassthruDocSubmissionProxyWebServiceUnsecuredImpl() {
        log = createLogger();
        oProxyHelper = createWebServiceProxyHelper();
    }

    protected Log createLogger() {
        return LogFactory.getLog(getClass());
    }

    protected WebServiceProxyHelper createWebServiceProxyHelper() {
        return new WebServiceProxyHelper();
    }

    public ServicePortDescriptor<ProxyXDRPortType> getServicePortDescriptor(
            NhincConstants.ADAPTER_API_LEVEL apiLevel) {
        return new PassthruDocSubmissiona0ServicePortDescriptor();
    }

    public RegistryResponseType provideAndRegisterDocumentSetB(ProvideAndRegisterDocumentSetRequestType body,
            AssertionType assertion, NhinTargetSystemType target) {
        log.debug("Begin provideAndRegisterDocumentSetB");
        RegistryResponseType response = null;

        try {
            String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.NHINC_PROXY_XDR_SERVICE_NAME);

            ServicePortDescriptor<ProxyXDRPortType> portDescriptor = getServicePortDescriptor(NhincConstants.ADAPTER_API_LEVEL.LEVEL_a0);

            CONNECTClient<ProxyXDRPortType> client = CONNECTCXFClientFactory.getInstance()
                    .getCONNECTClientUnsecured(portDescriptor, url, assertion);

            RespondingGatewayProvideAndRegisterDocumentSetRequestType request = new RespondingGatewayProvideAndRegisterDocumentSetRequestType();
            request.setProvideAndRegisterDocumentSetRequest(body);
            request.setAssertion(assertion);
            request.setNhinTargetSystem(target);

            response = (RegistryResponseType) client.invokePort(ProxyXDRPortType.class,
                    "provideAndRegisterDocumentSetB", request);

        } catch (Exception ex) {
            log.error("Error calling provideAndRegisterDocumentSetB: " + ex.getMessage(), ex);

        }

        log.debug("End provideAndRegisterDocumentSetB");
        return response;
    }

}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
/**
 * String.prototype.slice (start, end)
 *
 * @path ch15/15.5/15.5.4/15.5.4.13/S15.5.4.13_A1_T6.js
 * @description Arguments are x and number, and instance is new String, x is undefined variable
 */

//since ToInteger(undefined yelds 0)
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (new String("undefined").slice(x,3) !== "und") {
  $ERROR('#1: var x; new String("undefined").slice(x,3) === "und". Actual: '+new String("undefined").slice(x,3) );
}
//
//////////////////////////////////////////////////////////////////////////////

var x;


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Eurofurence.App.Domain.Model.Images;
using Eurofurence.App.Server.Services.Abstractions.Images;
using Eurofurence.App.Server.Web.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using System.Text;

namespace Eurofurence.App.Server.Web.Controllers
{
    [Route("Api/[controller]")]
    public class ImagesController : BaseController
    {
        private readonly IImageService _imageService;

        public ImagesController(IImageService imageService)
        {
            _imageService = imageService;
        }

        /// <summary>
        ///     Retrieves a list of all images.
        /// </summary>
        /// <returns>All knowledge groups.</returns>
        [HttpGet]
        [ProducesResponseType(typeof(string), 404)]
        [ProducesResponseType(typeof(IEnumerable<ImageRecord>), 200)]
        public Task<IEnumerable<ImageRecord>> GetImagesAsync()
        {
            return _imageService.FindAllAsync();
        }

        /// <summary>
        ///     Retrieve a single image.
        /// </summary>
        /// <param name="id">id of the requested entity</param>
        [HttpGet("{id}")]
        [ProducesResponseType(typeof(string), 404)]
        [ProducesResponseType(typeof(ImageRecord), 200)]
        public async Task<ImageRecord> GetImageAsync([FromRoute] Guid id)
        {
            return (await _imageService.FindOneAsync(id)).Transient404(HttpContext);
        }

        /// <summary>
        ///     Retrieve a single image content.
        /// </summary>
        /// <param name="id">id of the requested entity</param>
        [HttpGet("{id}/Content")]
        [ProducesResponseType(typeof(string), 404)]
        [ProducesResponseType(typeof(byte[]), 200)]
        public async Task<ActionResult> GetImageContentAsync([FromRoute] Guid id)
        {
            var record = await _imageService.FindOneAsync(id);
            if (record == null) return NotFound();

            var content = await _imageService.GetImageContentByIdAsync(id);
            return File(content, record.MimeType);
        }

        /// <summary>
        ///     Retrieve a single image content using hash code (preferred, as it allows caching).
        /// </summary>
        /// <param name="id">id of the requested entity</param>
        /// <param name="contentHashBase64Encoded">Base64 Encoded ContentHashSha1 of the requested entity</param>
        [HttpGet("{id}/Content/with-hash:{contentHashBase64Encoded}")]
        [ProducesResponseType(typeof(string), 404)]
        [ProducesResponseType(typeof(byte[]), 200)]
        [ResponseCache(Duration = 60 * 60 * 24, Location = ResponseCacheLocation.Any)]
        public async Task<ActionResult> GetImageWithHashContentAsync(
            [EnsureNotNull][FromRoute] Guid id,
            [EnsureNotNull][FromRoute] string contentHashBase64Encoded)
        {
            var record = await _imageService.FindOneAsync(id);
            if (record == null) return NotFound();

            var contentHash =
                Encoding.Default.GetString(Convert.FromBase64String(contentHashBase64Encoded));

            if (record.ContentHashSha1 != contentHash)
            {
                return Redirect($"./with-hash:{Convert.ToBase64String(Encoding.Default.GetBytes(record.ContentHashSha1))}");
            }

            var content = await _imageService.GetImageContentByIdAsync(id);
            return File(content, record.MimeType);
        }

        [Authorize(Roles = "System,Developer,KnowledgeBase-Maintainer")]
        [HttpPut("{id}/Content")]
        public async Task<ActionResult> PutImageContentAsync([FromRoute] Guid id, [FromBody] string ImageContent)
        {
            var record = await _imageService.FindOneAsync(id);
            if (record == null) return NotFound();

            byte[] imageBytes = Convert.FromBase64String(ImageContent);

            await _imageService.InsertOrUpdateImageAsync(record.InternalReference, imageBytes);

            return NoContent();
        }

    }
}


text:
package com.techery.droid.billings.models;

public class BillableItem {
    private boolean isAvailable;
    private final String sku;
    private Purchase purchase;

    public BillableItem(String sku) {
        this.sku = sku;
    }

    public boolean isAvailable() {
        return isAvailable;
    }

    public void setAvailable(boolean isAvailable) {
        this.isAvailable = isAvailable;
    }

    public String getSku() {
        return sku;
    }

    public void update(Inventory inventory) {
        this.purchase = inventory.getPurchase(getSku());
        this.isAvailable = validate(this.purchase);
    }

    protected boolean validate(Purchase p) {
        return p != null;
    }

    public void updateFromPurchase(Purchase p) {
        this.purchase = p;
        this.isAvailable = validate(p);
    }

    public Purchase getPurchase() {
        return purchase;
    }
}


text:
package de.cosmocode.commons;

import org.junit.Assert;
import org.junit.Test;

/**
 * Tests the {@link Strings} class.
 *
 * @author Willi Schoenborn
 */
public class StringsTest {

    /**
     * Tests {@link Strings#isNumeric(String)} with null.
     */
    @Test
    public void isNumericNull() {
        Assert.assertFalse(Strings.isNumeric(null));
    }

    /**
     * Tests {@link Strings#isNumeric(String)} with an empty String.
     */
    @Test
    public void isNumericEmpty() {
        Assert.assertFalse(Strings.isNumeric(""));
    }

    /**
     * Tests {@link Strings#isNumeric(String)} with whitespaces.
     */
    @Test
    public void isNumericWhitespaces() {
        Assert.assertFalse(Strings.isNumeric("   \t"));
    }

    /**
     * Tests {@link Strings#isNumeric(String)} with alphanumeric characters.
     */
    @Test
    public void isNumericAlpha() {
        Assert.assertFalse(Strings.isNumeric("abc"));
        Assert.assertFalse(Strings.isNumeric("125543b232"));
    }

    /**
     * Tests {@link Strings#isNumeric(String)} with digits.
     */
    @Test
    public void isNumeric() {
        Assert.assertTrue(Strings.isNumeric("123"));
    }

    /**
     * Tests {@link Strings#checkNotEmpty(String)} with null.
     */
    @Test(expected = IllegalArgumentException.class)
    public void checkNotEmptyOfNull() {
        Strings.checkNotEmpty(null);
    }

    /**
     * Tests {@link Strings#checkNotEmpty(String)} with "".
     */
    @Test(expected = IllegalArgumentException.class)
    public void checkNotEmptyOfEmpty() {
        Strings.checkNotEmpty("");
    }

    /**
     * Tests {@link Strings#checkNotEmpty(String)} with "   ".
     */
    @Test
    public void checkNotEmptyOfBlank() {
        final String expected = "   ";
        final String actual = Strings.checkNotEmpty(expected);
        Assert.assertEquals(expected, actual);
    }

    /**
     * Tests {@link Strings#checkNotEmpty(String)} with "blubb".
     */
    @Test
    public void checkNotEmptyOfValid() {
        final String expected = "blubb";
        final String actual = Strings.checkNotEmpty(expected);
        Assert.assertEquals(expected, actual);
    }

    /**
     * Tests {@link Strings#checkNotBlank(String)} with null.
     */
    @Test(expected = IllegalArgumentException.class)
    public void checkNotBlankOfNull() {
        Strings.checkNotBlank(null);
    }

    /**
     * Tests {@link Strings#checkNotBlank(String)} with "".
     */
    @Test(expected = IllegalArgumentException.class)
    public void checkNotBlankOfEmpty() {
        Strings.checkNotBlank("");
    }

    /**
     * Tests {@link Strings#checkNotBlank(String)} with "   ".
     */
    @Test(expected = IllegalArgumentException.class)
    public void checkNotBlankOfBlank() {
        Strings.checkNotBlank("   ");
    }

    /**
     * Tests {@link Strings#checkNotBlank(String)} with "blubb".
     */
    @Test
    public void checkNotBlankOfValid() {
        final String actual = Strings.checkNotBlank("  blubb  ");
        Assert.assertEquals("  blubb  ", actual);
    }

}


text:
TOOLSDIR	=

TOOLSCRIPT	= trackgen

PROGRAM      	= trackgen-bin

DATADIR      	= tools/trackgen

DATA         	= trackgen.xml

SOURCES      	= maintrackgen.cpp track.cpp easymesh.cpp ../../linux/linuxspec.cpp relief.cpp elevation.cpp objects.cpp ac3d.cpp util.cpp raceline.cpp

SOLIBS       	= -ltgf -ltgfclient -lmusicplayer -lplibssg -lplibsg -lplibul -lrobottools -ltxml

src_PKGFILES	= $(shell find * -maxdepth 0 -type f -print)

src_PKGDIR	= ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))

include ${MAKE_DEFAULT}


text:
from RGT.XML.SVG.baseContainerNode import BaseContainerNode
from types import StringType
from RGT.XML.SVG.basicSvgNode import BasicSvgNode

class MarkerNode(BaseContainerNode):
    svgNodeType = BasicSvgNode.SVG_MARKER_NODE

    ATTRIBUTE_EXTERNAL_RESOURCES_REQUIRED = 'externalResourcesRequired'
    ATTRIBUTE_VIEW_BOX = 'viewBox'
    ATTRIBUTE_PRESERVE_ASPECT_RATIO = 'preserveAspectRatio'
    ATTRIBUTE_REF_X = 'refX'
    ATTRIBUTE_REF_Y = 'refY'
    ATTRIBUTE_MARKER_UNITS = 'markerUnits'
    ATTRIBUTE_MARKER_WIDTH = 'markerWidth'
    ATTRIBUTE_MARKER_HEIGHT = 'markerHeight'
    ATTRIBUTE_ORIENT = 'orient'

    def __init__(self, ownderDoc):
        BaseContainerNode.__init__(self, ownderDoc, 'marker')
        #add the groups
        self._allowedSvgChildNodes.update(self.SVG_GROUP_ANIMATION_ELEMENTS, self.SVG_GROUP_DESCRIPTIVE_ELEMENTS,
                                          self.SVG_GROUP_SHAPE_ELEMENTS, self.SVG_GROUP_STRUCTURAL_ELEMENTS,
                                          self.SVG_GROUP_GRADIENT_ELEMENTS)
        #add the individual nodes
        self._allowedSvgChildNodes.update(
            {self.SVG_A_NODE, self.SVG_ALT_GLYPH_DEF_NODE, self.SVG_CLIP_PATH_NODE, self.SVG_COLOR_PROFILE_NODE,
             self.SVG_CURSOR_NODE, self.SVG_FILTER_NODE,
             self.SVG_FONT_NODE, self.SVG_FONT_FACE_NODE, self.SVG_FOREIGN_OBJECT_NODE, self.SVG_IMAGE_NODE,
             self.SVG_MARKER_NODE, self.SVG_MASK_NODE, self.SVG_PATTERN_NODE,
             self.SVG_SCRIPT_NODE, self.SVG_STYLE_NODE, self.SVG_SWITCH_NODE, self.SVG_TEXT_NODE, self.SVG_VIEW_NODE})

    def setExternalResourcesRequired(self, data):
        allowedValues = ['true', 'false']

        if data is not None:
            if data not in allowedValues:
                values = ''
                for value in allowedValues:
                    values += value + ', '
                values = values[0: len(values) - 2]
                raise ValueError('Value not allowed, only ' + values + 'are allowed')
            else:
                self._setNodeAttribute(self.ATTRIBUTE_EXTERNAL_RESOURCES_REQUIRED, data)

    def setViewBox(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_VIEW_BOX, data)

    def setPreserveAspectRatio(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_PRESERVE_ASPECT_RATIO, data)

    def setRefX(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_REF_X, data)

    def setRefY(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_REF_Y, data)

    def setMarkerUnits(self, data):
        allowedValues = ['strokeWidth', 'userSpaceOnUse']

        if data is not None:
            if data not in allowedValues:
                values = ''
                for value in allowedValues:
                    values += value + ', '
                values = values[0: len(values) - 2]
                raise ValueError('Value not allowed, only ' + values + 'are allowed')
            else:
                self._setNodeAttribute(self.ATTRIBUTE_MARKER_UNITS, data)

    def setMarkerWidth(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_MARKER_WIDTH, data)

    def setMarkerHeight(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_MARKER_HEIGHT, data)

    def setOrient(self, data):
        if data is not None:
            if type(data) is not StringType:
                data = str(data)
            self._setNodeAttribute(self.ATTRIBUTE_ORIENT, data)

    def getExternalResourcesRequired(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_EXTERNAL_RESOURCES_REQUIRED)
        if node is not None:
            return node.nodeValue
        return None

    def getViewBox(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_VIEW_BOX)
        if node is not None:
            return node.nodeValue
        return None

    def getPreserveAspectRatio(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_PRESERVE_ASPECT_RATIO)
        if node is not None:
            return node.nodeValue
        return None

    def getRefX(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_REF_X)
        if node is not None:
            return node.nodeValue
        return None

    def getRefY(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_REF_Y)
        if node is not None:
            return node.nodeValue
        return None

    def getMarkerUnits(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_MARKER_UNITS)
        if node is not None:
            return node.nodeValue
        return None

    def getMarkerWidth(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_MARKER_WIDTH)
        if node is not None:
            return node.nodeValue
        return None

    def getMarkerHeight(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_MARKER_HEIGHT)
        if node is not None:
            return node.nodeValue
        return None

    def getOrient(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_ORIENT)
        if node is not None:
            return node.nodeValue
        return None


text:
.no-close .ui-dialog-titlebar-close {
  display: none; }


text:
package kr.pe.courage.admin.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import kr.pe.courage.contact.domain.ContactRepository;
import kr.pe.courage.contact.domain.ContactVO;
import kr.pe.courage.exception.DataNotFoundException;
import kr.pe.courage.setup.domain.SetupRepository;
import kr.pe.courage.setup.domain.SetupVO;
import kr.pe.courage.setup.exception.ExistsSetupException;

@Service
public class AdminService {
	@Autowired
	private SetupRepository setupRepo;
	@Autowired
	private ContactRepository contactRepo;

	/**
	 *

	 * 1. 개요 : 설정 정보 최초등록
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 6. 27.
	 * @Method Name : insertSetupData
	 * @param SetupVO
	 * @throws ExistsSetupException
	 */
	public void insertSetupData(SetupVO vo) throws ExistsSetupException {
		if (setupRepo.selectSetupCnt() > 0) {
			throw new ExistsSetupException();
		}

		setupRepo.insertSetup(vo);
	}

	/**
	 *

	 * 1. 개요 : 설정 정보 수정
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 6. 27.
	 * @Method Name : updateSetupData
	 * @param SetupVO
	 * @throws DataNotFoundException
	 */
	public void updateSetupData(SetupVO vo) throws DataNotFoundException {
		if (setupRepo.selectSetup() == null) {
			throw new DataNotFoundException();
		}

		setupRepo.updateSetup(vo);
	}

	/**
	 *

	 * 1. 개요 : contact 목록 갯수 조회
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 7. 5.
	 * @Method Name : selectContactListCnt
	 * @param ContactVO
	 * @return int
	 */
	public int selectContactListCnt(ContactVO vo) {
		return contactRepo.selectContactListCnt(vo);
	}

	/**
	 *

	 * 1. 개요 : contact 목록 조회
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 7. 2.
	 * @Method Name : selectContactList
	 * @param ContactVO
	 * @return List<ContactVO>
	 */
	public List<ContactVO> selectContactList(ContactVO vo) {
		return contactRepo.selectContactList(vo);
	}

	/**
	 *

	 * 1. 개요 : contact 정보 조회
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 6. 30.
	 * @Method Name : selectContact
	 * @param ContactVO
	 * @return ContactVO
	 * @throws DataNotFoundException
	 */
	public ContactVO selectContact(ContactVO vo) throws DataNotFoundException {
		ContactVO resultVO = contactRepo.selectContact(vo);

		if (resultVO == null) {
			throw new DataNotFoundException("정보가 존재하지 않습니다. [" + vo.getSno() + "]");
		}

		return resultVO;
	}

	/**
	 *

	 * 1. 개요 : contact 회신 상태 변경
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 7. 4.
	 * @Method Name : deleteContact
	 * @param ContactVO
	 * @throws DataNotFoundException
	 */
	public void modifyContactReply(ContactVO vo) throws DataNotFoundException {
		ContactVO updateVO = contactRepo.selectContact(vo);

		if (updateVO == null) {
			throw new DataNotFoundException("삭제할 정보가 존재하지 않습니다. [" + vo.getSno() + "]");
		}

		contactRepo.updateReply(vo);
	}

	/**
	 *

	 * 1. 개요 : contact 정보 삭제
	 *

	 *
	 * @Author	: ChangHo.Seok
	 * @Date	: 2021. 7. 4.
	 * @Method Name : deleteContact
	 * @param ContactVO
	 * @throws DataNotFoundException
	 */
	public void deleteContact(ContactVO vo) throws DataNotFoundException {
		ContactVO deleteVO = contactRepo.selectContact(vo);

		if (deleteVO == null) {
			throw new DataNotFoundException("삭제할 정보가 존재하지 않습니다. [" + vo.getSno() + "]");
		}

		contactRepo.deleteContact(deleteVO);
	}
}


text:
#ifndef __PICOCOIN_WALLET_H__
#define __PICOCOIN_WALLET_H__

extern void cur_wallet_new_address(void);
extern void cur_wallet_create(void);
extern void cur_wallet_createAccount(const char *acct_name);
extern void cur_wallet_defaultAccount(const char *acct_name);
extern void cur_wallet_info(void);
extern void cur_wallet_dump(void);
extern void cur_wallet_addresses(void);
extern void cur_wallet_free(void);

#endif /* __PICOCOIN_WALLET_H__ */


text:
#include "cytypes.h"
#include "MicroSwitch.h"

/* APIs are not generated for P15[7:6] on PSoC 5 */
#if !(CY_PSOC5A &&\
	 MicroSwitch__PORT == 15 && ((MicroSwitch__MASK & 0xC0) != 0))

/*******************************************************************************
* Function Name: MicroSwitch_Write
********************************************************************************
*
* Summary:
*  Assign a new value to the digital port's data output register.
*
* Parameters:
*  prtValue:  The value to be assigned to the Digital Port.
*
* Return:
*  None
*
*******************************************************************************/
void MicroSwitch_Write(uint8 value)
{
    uint8 staticBits = (MicroSwitch_DR & (uint8)(~MicroSwitch_MASK));
    MicroSwitch_DR = staticBits | ((uint8)(value << MicroSwitch_SHIFT) & MicroSwitch_MASK);
}

/*******************************************************************************
* Function Name: MicroSwitch_SetDriveMode
********************************************************************************
*
* Summary:
*  Change the drive mode on the pins of the port.
*
* Parameters:
*  mode:  Change the pins to one of the following drive modes.
*
*  MicroSwitch_DM_STRONG     Strong Drive
*  MicroSwitch_DM_OD_HI      Open Drain, Drives High
*  MicroSwitch_DM_OD_LO      Open Drain, Drives Low
*  MicroSwitch_DM_RES_UP     Resistive Pull Up
*  MicroSwitch_DM_RES_DWN    Resistive Pull Down
*  MicroSwitch_DM_RES_UPDWN  Resistive Pull Up/Down
*  MicroSwitch_DM_DIG_HIZ    High Impedance Digital
*  MicroSwitch_DM_ALG_HIZ    High Impedance Analog
*
* Return:
*  None
*
*******************************************************************************/
void MicroSwitch_SetDriveMode(uint8 mode)
{
	CyPins_SetPinDriveMode(MicroSwitch_0, mode);
}

/*******************************************************************************
* Function Name: MicroSwitch_Read
********************************************************************************
*
* Summary:
*  Read the current value on the pins of the Digital Port in right justified
*  form.
*
* Parameters:
*  None
*
* Return:
*  Returns the current value of the Digital Port as a right justified number
*
* Note:
*  Macro MicroSwitch_ReadPS calls this function.
*
*******************************************************************************/
uint8 MicroSwitch_Read(void)
{
    return (MicroSwitch_PS & MicroSwitch_MASK) >> MicroSwitch_SHIFT;
}

/*******************************************************************************
* Function Name: MicroSwitch_ReadDataReg
********************************************************************************
*
* Summary:
*  Read the current value assigned to a Digital Port's data output register
*
* Parameters:
*  None
*
* Return:
*  Returns the current value assigned to the Digital Port's data output register
*
*******************************************************************************/
uint8 MicroSwitch_ReadDataReg(void)
{
    return (MicroSwitch_DR & MicroSwitch_MASK) >> MicroSwitch_SHIFT;
}

/* If Interrupts Are Enabled for this Pins component */
#if defined(MicroSwitch_INTSTAT)

    /*******************************************************************************
    * Function Name: MicroSwitch_ClearInterrupt
    ********************************************************************************
    * Summary:
    *  Clears any active interrupts attached to port and returns the value of the
    *  interrupt status register.
    *
    * Parameters:
    *  None
    *
    * Return:
    *  Returns the value of the interrupt status register
    *
    *******************************************************************************/
    uint8 MicroSwitch_ClearInterrupt(void)
    {
        return (MicroSwitch_INTSTAT & MicroSwitch_MASK) >> MicroSwitch_SHIFT;
    }

#endif /* If Interrupts Are Enabled for this Pins component */

#endif /* CY_PSOC5A... */

/* [] END OF FILE */


text:
import {IBase} from "../models/BaseModel";
const validator = require('validator');

/**
 * Created by malaka on 7/21/17.
 */

export class BaseController {
	constructor(private type) {
	}

	public add(data: IBase, rules, next: Function) {
		let val = this.modelValidator(data, rules);
		if (val) {
			return next({status: 16, message: val, from: 'BaseController: add'});
		}
		return new this.type(data).save(next);
	}

	public find(query: any, sort: any, select: any, distinctField: string, popFields, next: Function) {
		if (distinctField === '') {
			this.type.find(query).sort(sort).select(select).populate(popFields).exec(next);
		} else {
			this.type.find(query).distinct(distinctField).exec(next);
		}
	}

	public findById(id: any, select: any, popField: string, next: Function) {
		this.type.findById(id, select).populate(popField).exec(next);
	}

	// full object will be validated.
	public editById(id: any, data: IBase, rules: any, allowedFields: Array<string>, next: Function) {
		Object.keys(data).forEach(key => {
			if(allowedFields.length > 0 && allowedFields.indexOf(key) < 0) {
				delete data[key];
			}
		});
		let val = this.modelValidator(data, rules);
		if (val) {
			return next({status: 16, message: val, from: 'BaseController: editById'});
		}
		this.type.findByIdAndUpdate(id, data, {'new': true}, next);
	}

	// partial of object will be validate and update.
	public partiallyEdit(id: string, data: any, rules:any, allowedFields: Array<string>, next: Function) {
		this.type.findById(id, (err, doc) => {
			if (err) next(err);
			if (doc) {
				let active = [];
				Object.keys(data).forEach((key) => {
					if(allowedFields.indexOf(key) >= 0) {
						active.push(key);
					}
				});
				let val = this.modelValidator(data, rules, active);
				if (!val) {
					(active).forEach(x => {
						if (data[x]) {
							doc[x] = data[x];
						}
					});
					doc.save(next);
				} else {
					return next({status: 16, message: val, from: 'BaseController: edit'});
				}
			} else {
				return next({status: 404, message: 'No such object'});
			}
		})
	}

	public remove(id: string, next: Function) {
		this.type.findByIdAndRemove(id, next);
	}

	public modelValidator(data: IBase, rules, fields?: Array<string>): any {
		// Local custom validators
		validator['regex'] = (str: string, regex: RegExp) => {
			return regex.test(str);
		};

		let errorObj = null;
		let valFunction = (key) => {
			rules[key].forEach((valRule) => {
				if (valRule.expected == undefined)
					valRule.expected = true;
				if (validator[valRule.fun](data[key] + '', valRule.inputs) !== valRule.expected) {
					if (!errorObj) errorObj = {};
					if (!errorObj[key]) errorObj[key] = {};
					errorObj[key]['value'] = data[key];
					if (errorObj[key]['message']) {
						errorObj[key]['message'].push(valRule['msg']);
					} else {
						errorObj[key]['message'] = [valRule['msg']];
					}
				}
			});
		};

		Object.keys(rules).forEach((key) => {
			// if(fields){
			// 	if(fields.length > 0 && fields.indexOf(key) >= 0){
			// 		valFunction(key);
			// 	} else {
			// 		valFunction(key);
			// 	}
			// }else{
			// 	valFunction(key);
			// }
			if(fields && fields.length > 0) {
				if(fields.indexOf(key) >= 0) {
					valFunction(key);
				}
			} else {
				valFunction(key);
			}
		});
		return errorObj;
	}

	public count(query: any, next: Function) {
		this.type.count(query, next);
	}

}


text:
package io.netty.handler.codec.http.websocketx.extensions.compression;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.CodecException;
import io.netty.handler.codec.compression.ZlibCodecFactory;
import io.netty.handler.codec.compression.ZlibWrapper;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.ContinuationWebSocketFrame;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketFrame;
import io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionDecoder;
import io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionFilter;

import java.util.List;

import static io.netty.util.internal.ObjectUtil.*;

/**
 * Deflate implementation of a payload decompressor for
 * <tt>io.netty.handler.codec.http.websocketx.WebSocketFrame</tt>.
 */
abstract class DeflateDecoder extends WebSocketExtensionDecoder {

    static final ByteBuf FRAME_TAIL = Unpooled.unreleasableBuffer(
            Unpooled.wrappedBuffer(new byte[] {0x00, 0x00, (byte) 0xff, (byte) 0xff}))
            .asReadOnly();

    static final ByteBuf EMPTY_DEFLATE_BLOCK = Unpooled.unreleasableBuffer(
            Unpooled.wrappedBuffer(new byte[] { 0x00 }))
            .asReadOnly();

    private final boolean noContext;
    private final WebSocketExtensionFilter extensionDecoderFilter;

    private EmbeddedChannel decoder;

    /**
     * Constructor
     *
     * @param noContext true to disable context takeover.
     * @param extensionDecoderFilter extension decoder filter.
     */
    DeflateDecoder(boolean noContext, WebSocketExtensionFilter extensionDecoderFilter) {
        this.noContext = noContext;
        this.extensionDecoderFilter = checkNotNull(extensionDecoderFilter, "extensionDecoderFilter");
    }

    /**
     * Returns the extension decoder filter.
     */
    protected WebSocketExtensionFilter extensionDecoderFilter() {
        return extensionDecoderFilter;
    }

    protected abstract boolean appendFrameTail(WebSocketFrame msg);

    protected abstract int newRsv(WebSocketFrame msg);

    @Override
    protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception {
        final ByteBuf decompressedContent = decompressContent(ctx, msg);

        final WebSocketFrame outMsg;
        if (msg instanceof TextWebSocketFrame) {
            outMsg = new TextWebSocketFrame(msg.isFinalFragment(), newRsv(msg), decompressedContent);
        } else if (msg instanceof BinaryWebSocketFrame) {
            outMsg = new BinaryWebSocketFrame(msg.isFinalFragment(), newRsv(msg), decompressedContent);
        } else if (msg instanceof ContinuationWebSocketFrame) {
            outMsg = new ContinuationWebSocketFrame(msg.isFinalFragment(), newRsv(msg), decompressedContent);
        } else {
            throw new CodecException("unexpected frame type: " + msg.getClass().getName());
        }

        out.add(outMsg);
    }

    @Override
    public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
        cleanup();
        super.handlerRemoved(ctx);
    }

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        cleanup();
        super.channelInactive(ctx);
    }

    private ByteBuf decompressContent(ChannelHandlerContext ctx, WebSocketFrame msg) {
        if (decoder == null) {
            if (!(msg instanceof TextWebSocketFrame) && !(msg instanceof BinaryWebSocketFrame)) {
                throw new CodecException("unexpected initial frame type: " + msg.getClass().getName());
            }
            decoder = new EmbeddedChannel(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE));
        }

        boolean readable = msg.content().isReadable();
        boolean emptyDeflateBlock = EMPTY_DEFLATE_BLOCK.equals(msg.content());

        decoder.writeInbound(msg.content().retain());
        if (appendFrameTail(msg)) {
            decoder.writeInbound(FRAME_TAIL.duplicate());
        }

        CompositeByteBuf compositeDecompressedContent = ctx.alloc().compositeBuffer();
        for (;;) {
            ByteBuf partUncompressedContent = decoder.readInbound();
            if (partUncompressedContent == null) {
                break;
            }
            if (!partUncompressedContent.isReadable()) {
                partUncompressedContent.release();
                continue;
            }
            compositeDecompressedContent.addComponent(true, partUncompressedContent);
        }
        // Correctly handle empty frames
        // See https://github.com/netty/netty/issues/4348
        if (!emptyDeflateBlock && readable && compositeDecompressedContent.numComponents() <= 0) {
            compositeDecompressedContent.release();
            throw new CodecException("cannot read uncompressed buffer");
        }

        if (msg.isFinalFragment() && noContext) {
            cleanup();
        }

        return compositeDecompressedContent;
    }

    private void cleanup() {
        if (decoder != null) {
            // Clean-up the previous encoder if not cleaned up correctly.
            if (decoder.finish()) {
                for (;;) {
                    ByteBuf buf = decoder.readOutbound();
                    if (buf == null) {
                        break;
                    }
                    // Release the buffer
                    buf.release();
                }
            }
            decoder = null;
        }
    }
}


text:
// Type: Highsoft.Web.Mvc.Stocks.SplineSeriesDataLabelsAlign

namespace Highsoft.Web.Mvc.Stocks
{
    public enum SplineSeriesDataLabelsAlign
    {
        Left,
        Center,
        Right,
    }
}


text:
from __future__ import (absolute_import, division, print_function, unicode_literals)

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

application = get_wsgi_application()


text:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.1" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 <name>sfWidgetFormAvatarPlugin</name>
 <channel>pear.symfony-project.com</channel>
 <summary>A custom file</summary>
 <description>Input field will be seen as a default picture.
Default picture will be automatically changed by file selected. The file will be uploaded once selected. A preview will be automatically generated once file selected / uploaded.</description>
 <lead>
  <name>orchidcreation.com</name>
  <user>Stef</user>
  <email>stephane@orchidcreation.com</email>
  <active>yes</active>
 </lead>
 <date>2012-05-02</date>
 <time>12:08:29</time>
 <version>
  <release>1.0.4</release>
  <api>1.0.1</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
<license uri="http://www.symfony-project.com/license">MIT license</license>
 <notes>
-
 </notes>
<contents>
  <dir name="/">
  	<file md5sum="07b47655cad08467e716a9b805175fb1" name="lib/helper/ThumbHelper.php" role="data"/>
  	<file md5sum="a9f49a1b159a0370f5e269fded659b02" name="lib/widget/sfWidgetFormAvatar.class.php" role="data"/>
  	<file md5sum="1ed0cd4de8f75fa2be2fb31b7a2ac424" name="lib/class.upload.php" role="data"/>
  	<file md5sum="c773fa61d600619b8e77c7c2db88ce16" name="modules/avatar/actions/actions.class.php" role="data"/>
  	<file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="modules/avatar/template/uploadSuccess.php" role="data"/>
  	<file md5sum="7d6e4f19e0332c0e8f074cbddd4c181c" name="web/css/avatar.css" role="data"/>
  	<file md5sum="8bddd48d898c59ca1382083bd1dec869" name="web/images/ico-add.png" role="data"/>
  	<file md5sum="11188b5f7d29016c1b75601d16fc5710" name="web/images/loading.gif" role="data"/>
  	<file md5sum="beed136cd67466e8f353cb1a04ed14ab" name="web/js/ajaxfileupload.js" role="data"/>
  	<file md5sum="beed136cd67466e8f353cb1a04ed14ab" name="README" role="data"/>
  	<file md5sum="beed136cd67466e8f353cb1a04ed14ab" name="LICENSE" role="data"/>
 </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>5.0.0</min>
   </php>
   <pearinstaller>
    <min>1.4.1</min>
   </pearinstaller>

   <package>
        <name>sfImageTransformPlugin</name>
        <channel>plugins.symfony-project.org</channel>
        <min>1.4.1</min>
   </package>

   <package>
        <name>symfony</name>
        <channel>pear.symfony-project.com</channel>
        <min>1.4.0</min>
        <max>1.4.2</max>

      </package>

  </required>
 </dependencies>
 <phprelease/>
</package>


text:
package org.immutables.generator.processor;

import org.immutables.generator.AnnotationMirrors;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import java.util.Map;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import org.immutables.generator.Generator;
import org.immutables.generator.Templates;

public final class Imports extends Introspection {
  private final TypeMirror importType;

  public Imports(ProcessingEnvironment environment) {
    super(environment);
    this.importType = elements.getTypeElement(Generator.Import.class.getCanonicalName()).asType();
  }

  public final ImmutableMap<String, TypeMirror> importsIn(TypeElement type) {
    Map<String, TypeMirror> collected = Maps.newHashMap();

    collectSimpleUsages(type, collected);
    collectBuiltins(collected);
    collectPackage(type, collected);
    collectImports(type, collected);
    collectTypedefs(type, collected);

    return ImmutableMap.copyOf(collected);
  }

  private void collectBuiltins(Map<String, TypeMirror> collected) {
    for (TypeKind kind : TypeKind.values()) {
      if (kind.isPrimitive()) {
        TypeElement boxedClass = types.boxedClass(types.getPrimitiveType(kind));
        collected.put(boxedClass.getSimpleName().toString(), boxedClass.asType());
      }
    }

    TypeElement typeElement = elements.getTypeElement(String.class.getCanonicalName());
    collected.put(typeElement.getSimpleName().toString(), typeElement.asType());

    typeElement = elements.getTypeElement(Templates.Invokable.class.getCanonicalName());
    collected.put(typeElement.getSimpleName().toString(), typeElement.asType());
  }

  private void collectPackage(TypeElement type, Map<String, TypeMirror> collected) {
    for (TypeElement samePackageType : ElementFilter.typesIn(elements.getPackageOf(type).getEnclosedElements())) {
      collectIfSimpleType(samePackageType.asType(), collected);
    }
  }

  private void collectTypedefs(TypeElement type, Map<String, TypeMirror> collected) {
    for (VariableElement field : ElementFilter.fieldsIn(elements.getAllMembers(type))) {
      if (field.getAnnotation(Generator.Typedef.class) != null) {
        collected.put(field.getSimpleName().toString(), field.asType());
      }
    }
  }

  private void collectSimpleUsages(TypeElement type, Map<String, TypeMirror> collected) {
    for (ExecutableElement method : ElementFilter.methodsIn(elements.getAllMembers(type))) {
      if (shouldConsideredAsTypeUsage(method)) {
        collectIfSimpleType(method.getReturnType(), collected);
        for (VariableElement parameter : method.getParameters()) {
          collectIfSimpleType(parameter.asType(), collected);
        }
      }
    }
  }

  private boolean shouldConsideredAsTypeUsage(ExecutableElement method) {
    return method.getTypeParameters().isEmpty()
        && !method.getModifiers().contains(Modifier.PRIVATE)
        && !method.getModifiers().contains(Modifier.STATIC);
  }

  private void collectIfSimpleType(TypeMirror type, Map<String, TypeMirror> collected) {
    if (type.getKind() == TypeKind.DECLARED) {
      DeclaredType declared = (DeclaredType) type;
      if (declared.getTypeArguments().isEmpty()) {
        collected.put(declared.asElement().getSimpleName().toString(), declared);
      }
    }
  }

  private void collectImports(TypeElement type, Map<String, TypeMirror> collected) {
    for (TypeMirror typeMirror : extractImports(type)) {
      collected.put(toSimpleName(typeMirror), typeMirror);
    }
  }

  private ImmutableList<TypeMirror> extractImports(TypeElement type) {
    ImmutableList.Builder<TypeMirror> importedTypes = ImmutableList.builder();

    for (TypeElement t = type; t != null; t = (TypeElement) types.asElement(t.getSuperclass())) {
      importedTypes.addAll(extractDeclaredImports(t).reverse());
      importedTypes.addAll(extractDeclaredImports(elements.getPackageOf(type)).reverse());
    }

    return importedTypes.build().reverse();
  }

  private ImmutableList<TypeMirror> extractDeclaredImports(Element element) {
    return AnnotationMirrors.getTypesFromMirrors(
        types,
        importType,
        "value",
        element.getAnnotationMirrors());
  }
}


text:
BCFtools WGS variant filtering pipeline
=======================================

In order to run this workflow we need to do the following:

1. Preparing the environment

  Modify your ``$PYTHONPATH`` to include the required libraries::

  	 export PYTHONPATH=${ehive_dir}/wrappers/python3/:$PYTHONPATH

  Modify your ``$PERL5LIB`` to include the required libraries::

  	 export PERL5LIB=${ehive_dir}/modules/:${igsr_analysis_dir}/:${PERL5LIB}

  Modify your ``$PATH`` to include the location of the eHive scripts::

  	 export PATH=${ehive_dir}/scripts/:${PATH}

  * Install dependency

    1) Clone repo by doing ``git clone https://github.com/igsr/igsr_analysis.git`` in the desired folder
    2) ``pip install ${igsr_analysis_dir}/dist/igsr_analysis-0.91.dev0.tar.gz``
    3) Modify ``$PYTHONPATH`` to add the folder where your pip installs the Python packages

    And you are ready to go!

  * Conventions used in this section

    * ``${igsr_analysis_dir}`` is the folder where you have cloned ``https://github.com/igsr/igsr_analysis.git``
    * ``${ehive_dir}`` is the folder where you have cloned ``https://github.com/Ensembl/ensembl-hive.git``

2. Databases

  The pipeline uses two databases. They may be on different servers or the
  same server.

  2.1 The ReseqTrack database

    The pipeline queries a ``ReseqTrack`` database to find the VCF that will be
    filtered by the pipeline. It will also add file metadata for the final
    filtered VCF.

    In order to create a ``ReseqTrack`` database use the following

    commands::

	mysql -h <hostname> -P <portnumber> -u <username> -p???? -e "create database testreseqtrack" # where testreseqtrack
    	             		      		      	                  		 	     # is the name you want
												     # to give to the ReseqTrack DB
    	mysql -h <hostname> -P <portnumber> -u <username> -p???? testreseqtrack < $RESEQTRACK/sql/table.sql
    	mysql -h <hostname> -P <portnumber> -u <username> -p???? testreseqtrack < $RESEQTRACK/sql/views.sql

    * Conventions used in this section:

     ``$RESEQTRACK`` is the folder where you have cloned ``https://github.com/EMBL-EBI-GCA/reseqtrack.git``

  2.2 The Hive database

    This is database is used by the Hive code to manage the pipeline and job
    submission etc. The pipeline will be created automatically when you run
    the ``init_pipeline.pl`` script.  Write access is needed to this database.

3. Initialise the pipeline

  The pipeline is initialised with the hive script ``init_pipeline.pl``. Here is
  an example of how to initialise a pipeline::

     init_pipeline.pl PyHive::PipeConfig::FILTER::VCFilterSamtoolsWGS \
     		      -pipeline_url mysql://g1krw:$DB_PASS@mysql-rs-1kg-prod:4175/hive_dbname \
     		      -db testreseqtrack \
     		      -pwd $DB_PASS \
     		      -hive_force_init 1

  The first argument is the the module that defines this pipeline.
  Then ``-pipeline_url`` controls the Hive database connection details, in this
  example::

	 g1krw= username
	 $DB_PASS= password
	 mysql-rs-1kg-prod= hostname
	 4175= Port number
	 hive_dbname= Hive DB name

  Then ``-db`` is the name of the Reseqtrack database name used in the section 2.1
  ``-pwd`` is the ReseqTrack DB password

  The rest of the options are documented in the `PyHive::PipeConfig::FILTER::VCFilterSamtoolsWGS <https://github.com/igsr/igsr_analysis/blob/master/PyHive/PipeConfig/FILTER/VCFilterSamtoolsWGS.pm>`_
  module file. You will probably want to override the defaults for many of
  these options so take a look.

4. Seeding the pipeline

  In order to seed the pipeline with the VCF file that will be analyzed use the hive script
  ``seed_pipeline.pl``::

	 seed_pipeline.pl \
    	 		  -url mysql://g1krw:$DB_PASS@mysql-rs-1kg-prod:4175/hive_dbname \
    			  -logic_name find_files \
    			  -input_id "{ 'file' => '/path/to/file/input_file.txt' }"

  Where ``-url`` controls the Hive database connection details and ``/path/to/file/input_file.txt``
  contains the filename of the VCF to be analyzed. This file must exist in the ReseqTrack database

5. Sync the hive database

  This should always be done before [re]starting a pipeline:

  Run e.g.::

	 beekeeper.pl -url mysql://g1krw:{password}@mysql-g1k:4175/my_hive_db_name -sync

  where ``-url`` are the details of your hive database.  Look at the output from
  ``init_pipeline.pl`` to see what your url is.

6. Run the pipeline

  Run e.g.::

    beekeeper.pl -url mysql://g1krw:{password}@mysql-g1k:4175/my_hive_db_name -loop &

  Note the '&' makes it run in the background.

  Look at the pod for ``beekeeper.pl`` to see the various options.  E.g. you might
  want to use the ``-hive_log_dir`` flag so that all ``output/error`` gets recorded in
  files.

  While the pipeline is running, you can check the 'progress' view of the hive
  database to see the current status.  If a job has failed, check the msg
  view.


text:
layout: post-index
title: All Posts
excerpt: "A List of Posts"
---

{% capture written_year %}'None'{% endcapture %}
{% for post in site.posts %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}

{{ year }}

  {% capture written_year %}{{ year }}{% endcapture %}
{% endif %}

      <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%B %d, %Y" }}</time>
      {% if site.reading_time %}

        {% assign readtime = post.content | number_of_words | divided_by:site.words_per_minute %}
        Reading time ~{% if readtime <= 1 %}1 minute{% else %}{{ readtime }} minutes{% endif %}

      {% endif %}

    {% if post.link %}

 {{ post.title }}

    {% else %}

{{ post.title }}

    {% endif %}

    {{ post.excerpt | strip_html | truncatewords:50 }}

{% endfor %}


text:
using System.ComponentModel;

namespace OpenLiveWriter.ApplicationFramework.Commands
{
	/// <summary>
	/// Summary description for CommandCopy.
	/// </summary>
	public class CommandDelete : Command
	{

		public CommandDelete(IContainer container)
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			InitializeComponent();

			//
			//
			//
		}

		public CommandDelete()
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			InitializeComponent();

			//
			//
			//
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			//
			// CommandDelete
			//
			this.ContextMenuPath = "-&Delete-@151";
			this.Identifier = "MindShare.ApplicationCore.Commands.Delete";
			this.MainMenuPath = "&Edit@2/-&Delete-@151";
			this.MenuText = "&Delete";
			this.Shortcut = System.Windows.Forms.Shortcut.Del;
			this.Text = "Delete";

		}
		#endregion
	}
}


text:
package com.intellij.execution.rmi.ssl;

import org.jetbrains.annotations.NotNull;

import javax.net.ssl.*;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;

public class DefaultSslSocketFactory extends DelegateSslSocketFactory {
  public DefaultSslSocketFactory() throws GeneralSecurityException {
    this(false);
  }

  public DefaultSslSocketFactory(boolean trustEveryone) throws GeneralSecurityException {
    super(trustEveryone ? createTrustEveryoneDelegate() : createDefaultDelegate());
  }

  public DefaultSslSocketFactory(String trustEveryone) throws GeneralSecurityException {
    this(Boolean.valueOf(trustEveryone));
  }

  @NotNull
  private static SSLSocketFactory createDefaultDelegate() throws NoSuchAlgorithmException {
    return SSLContext.getDefault().getSocketFactory();
  }
  @NotNull
  private static SSLSocketFactory createTrustEveryoneDelegate() throws GeneralSecurityException {
    KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
    KeyStore ks = KeyStore.getInstance(SslKeyStore.NAME);
    try {
      ks.load(null, null);
    }
    catch (IOException e) {
      throw new GeneralSecurityException(e);
    }
    kmf.init(ks, null);
    KeyManager[] km = kmf.getKeyManagers();
    SSLContext ctx = SSLContext.getInstance("TLS");
    ctx.init(km, new TrustManager[]{new SslUtil.TrustEverybodyManager()}, null);
    return ctx.getSocketFactory();
  }
}


text:
#include "query_optimizer/logical/CreateIndex.hpp"

#include <string>
#include <vector>

#include "query_optimizer/OptimizerTree.hpp"
#include "query_optimizer/expressions/AttributeReference.hpp"
#include "utility/Cast.hpp"
#include "utility/Macros.hpp"

namespace quickstep {
namespace optimizer {
namespace logical {

void CreateIndex::getFieldStringItems(
    std::vector<std::string> *inline_field_names,
    std::vector<std::string> *inline_field_values,
    std::vector<std::string> *non_container_child_field_names,
    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
    std::vector<std::string> *container_child_field_names,
    std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
  inline_field_names->push_back("index_name");
  inline_field_values->push_back(index_name_);

  non_container_child_field_names->push_back("relation");
  non_container_child_fields->push_back(input_);

  container_child_field_names->push_back("index_attributes");
  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(index_attributes_));

  inline_field_names->push_back("serialized_index_description");
  inline_field_values->push_back(index_description_->DebugString());
}

}  // namespace logical
}  // namespace optimizer
}  // namespace quickstep


text:
/**
 * ApiFaultDetail.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package com.microsoft.bingads.v9.campaignmanagement;

public class ApiFaultDetail  extends com.microsoft.bingads.v9.adapi.ApplicationFault  implements java.io.Serializable {
    private com.microsoft.bingads.v9.campaignmanagement.BatchError[] batchErrors;

    private com.microsoft.bingads.v9.campaignmanagement.OperationError[] operationErrors;

    public ApiFaultDetail() {
    }

    public ApiFaultDetail(
           java.lang.String trackingId,
           com.microsoft.bingads.v9.campaignmanagement.BatchError[] batchErrors,
           com.microsoft.bingads.v9.campaignmanagement.OperationError[] operationErrors) {
        super(
            trackingId);
        this.batchErrors = batchErrors;
        this.operationErrors = operationErrors;
    }

    /**
     * Gets the batchErrors value for this ApiFaultDetail.
     *
     * @return batchErrors
     */
    public com.microsoft.bingads.v9.campaignmanagement.BatchError[] getBatchErrors() {
        return batchErrors;
    }

    /**
     * Sets the batchErrors value for this ApiFaultDetail.
     *
     * @param batchErrors
     */
    public void setBatchErrors(com.microsoft.bingads.v9.campaignmanagement.BatchError[] batchErrors) {
        this.batchErrors = batchErrors;
    }

    /**
     * Gets the operationErrors value for this ApiFaultDetail.
     *
     * @return operationErrors
     */
    public com.microsoft.bingads.v9.campaignmanagement.OperationError[] getOperationErrors() {
        return operationErrors;
    }

    /**
     * Sets the operationErrors value for this ApiFaultDetail.
     *
     * @param operationErrors
     */
    public void setOperationErrors(com.microsoft.bingads.v9.campaignmanagement.OperationError[] operationErrors) {
        this.operationErrors = operationErrors;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof ApiFaultDetail)) return false;
        ApiFaultDetail other = (ApiFaultDetail) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj) &&
            ((this.batchErrors==null && other.getBatchErrors()==null) ||
             (this.batchErrors!=null &&
              java.util.Arrays.equals(this.batchErrors, other.getBatchErrors()))) &&
            ((this.operationErrors==null && other.getOperationErrors()==null) ||
             (this.operationErrors!=null &&
              java.util.Arrays.equals(this.operationErrors, other.getOperationErrors())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        if (getBatchErrors() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getBatchErrors());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getBatchErrors(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getOperationErrors() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getOperationErrors());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getOperationErrors(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(ApiFaultDetail.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "ApiFaultDetail"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("batchErrors");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "BatchErrors"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "BatchError"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        elemField.setItemQName(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "BatchError"));
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("operationErrors");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "OperationErrors"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "OperationError"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        elemField.setItemQName(new javax.xml.namespace.QName("https://bingads.microsoft.com/CampaignManagement/v9", "OperationError"));
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Writes the exception data to the faultDetails
     */
    public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context) throws java.io.IOException {
        context.serialize(qname, null, this);
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;

namespace Cosmos.Sys.FileSystem {
	public abstract class FileSystem_Old
    {
        public virtual FSDirectory GetDirectory(string path)
        {
            FSObject o = GetObject(path);
            if (o is FSDirectory)
                return o as FSDirectory;
            throw new Exception("DiretoryNotFound");
        }

        public virtual FSFile GetFile(string path)
        {
            FSObject o = GetObject(path);
            if (o is FSFile)
                return o as FSFile;
            throw new Exception("FileNotFound");
        }

        protected abstract FSObject GetObject(string path);
	}

    public abstract class FSObject
    {
        public abstract string Name
        {
            get;
            set;
        }

        public abstract int Size
        {
            get;
        }

        public abstract bool Delete(string name);
    }

    public abstract class FSFile : FSObject
    {
        public abstract Stream GetStream();
    }

    public abstract class FSDirectory : FSObject
    {
        protected FSDirectory[] SubDirectorys;
        protected FSFile[] Files;

        public FSDirectory GetDirectory(string name)
        {
            foreach (var dir in SubDirectorys)
                if (dir.Name == name)
                    return dir;
            throw new Exception("DirectoryNotFound");
        }

        public FSFile GetFile(string name)
        {
            foreach (var file in Files)
                if (file.Name == name)
                    return file;
            throw new Exception("fileNotFound");
        }

        public abstract FSFile CreateFile(string name);
        public abstract FSDirectory CreateDirectory(string name);

    }
}


text:
package org.apache.maven.artifact.resolver;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;

/**
 * Specific problems during resolution that we want to account for:
 * <p/>
 * - missing metadata - version range violations - version circular dependencies - missing artifacts
 * - network/transfer errors - file system errors: permissions
 *
 * @author Jason van Zyl
 * @TODO carlos: all these possible has*Exceptions and get*Exceptions methods make the clients too
 *       complex requiring a long list of checks, need to create a parent/interfact/encapsulation
 *       for the types of exceptions
 */
public class ArtifactResolutionResult
{
    private Artifact originatingArtifact;

    private List<Artifact> missingArtifacts;

    // Exceptions

    private List<Exception> exceptions;

    private List<Exception> versionRangeViolations;

    private List<ArtifactResolutionException> metadataResolutionExceptions;

    private List<CyclicDependencyException> circularDependencyExceptions;

    private List<ArtifactResolutionException> errorArtifactExceptions;

    // file system errors

    private List<ArtifactRepository> repositories;

    private Set<Artifact> artifacts;

    private Set<ResolutionNode> resolutionNodes;

    public Artifact getOriginatingArtifact()
    {
        return originatingArtifact;
    }

    public ArtifactResolutionResult setOriginatingArtifact( final Artifact originatingArtifact )
    {
        this.originatingArtifact = originatingArtifact;

        return this;
    }

    public void addArtifact( Artifact artifact )
    {
        if ( artifacts == null )
        {
            artifacts = new LinkedHashSet<Artifact>();
        }

        artifacts.add( artifact );
    }

    public Set<Artifact> getArtifacts()
    {
        if ( artifacts == null )
        {
            artifacts = new LinkedHashSet<Artifact>();
        }

        return artifacts;
    }

    public void setArtifacts( Set<Artifact> artifacts )
    {
        this.artifacts = artifacts;
    }

    public Set<ResolutionNode> getArtifactResolutionNodes()
    {
        if ( resolutionNodes == null )
        {
            resolutionNodes = new LinkedHashSet<ResolutionNode>();
        }

        return resolutionNodes;
    }

    public void setArtifactResolutionNodes( Set<ResolutionNode> resolutionNodes )
    {
        this.resolutionNodes = resolutionNodes;
    }

    public boolean hasMissingArtifacts()
    {
        return missingArtifacts != null && !missingArtifacts.isEmpty();
    }

    public List<Artifact> getMissingArtifacts()
    {
        return missingArtifacts == null ? Collections.<Artifact> emptyList() : missingArtifacts;
    }

    public ArtifactResolutionResult addMissingArtifact( Artifact artifact )
    {
        missingArtifacts = initList( missingArtifacts );

        missingArtifacts.add( artifact );

        return this;
    }

    public ArtifactResolutionResult setUnresolvedArtifacts( final List<Artifact> unresolvedArtifacts )
    {
        this.missingArtifacts = unresolvedArtifacts;

        return this;
    }

    public boolean isSuccess()
    {
        return !( hasMissingArtifacts() || hasExceptions() );
    }

    // ------------------------------------------------------------------------
    // Exceptions
    // ------------------------------------------------------------------------

    public boolean hasExceptions()
    {
        return exceptions != null && !exceptions.isEmpty();
    }

    public List<Exception> getExceptions()
    {
        return exceptions == null ? Collections.<Exception> emptyList() : exceptions;
    }

    // ------------------------------------------------------------------------
    // Version Range Violations
    // ------------------------------------------------------------------------

    public boolean hasVersionRangeViolations()
    {
        return versionRangeViolations != null;
    }

    /**
     * @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by
     *       {@link #getVersionRangeViolation(int)} but it's not used like that in
     *       {@link DefaultLegacyArtifactCollector}
     */
    public ArtifactResolutionResult addVersionRangeViolation( Exception e )
    {
        versionRangeViolations = initList( versionRangeViolations );

        versionRangeViolations.add( e );

        exceptions = initList( exceptions );

        exceptions.add( e );

        return this;
    }

    public OverConstrainedVersionException getVersionRangeViolation( int i )
    {
        return (OverConstrainedVersionException) versionRangeViolations.get( i );
    }

    public List<Exception> getVersionRangeViolations()
    {
        return versionRangeViolations == null ? Collections.<Exception> emptyList() : versionRangeViolations;
    }

    // ------------------------------------------------------------------------
    // Metadata Resolution Exceptions: ArtifactResolutionExceptions
    // ------------------------------------------------------------------------

    public boolean hasMetadataResolutionExceptions()
    {
        return metadataResolutionExceptions != null;
    }

    public ArtifactResolutionResult addMetadataResolutionException( ArtifactResolutionException e )
    {
        metadataResolutionExceptions = initList( metadataResolutionExceptions );

        metadataResolutionExceptions.add( e );

        exceptions = initList( exceptions );

        exceptions.add( e );

        return this;
    }

    public ArtifactResolutionException getMetadataResolutionException( int i )
    {
        return metadataResolutionExceptions.get( i );
    }

    public List<ArtifactResolutionException> getMetadataResolutionExceptions()
    {
        return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException> emptyList()
                        : metadataResolutionExceptions;
    }

    // ------------------------------------------------------------------------
    // ErrorArtifactExceptions: ArtifactResolutionExceptions
    // ------------------------------------------------------------------------

    public boolean hasErrorArtifactExceptions()
    {
        return errorArtifactExceptions != null;
    }

    public ArtifactResolutionResult addErrorArtifactException( ArtifactResolutionException e )
    {
        errorArtifactExceptions = initList( errorArtifactExceptions );

        errorArtifactExceptions.add( e );

        exceptions = initList( exceptions );

        exceptions.add( e );

        return this;
    }

    public List<ArtifactResolutionException> getErrorArtifactExceptions()
    {
        if ( errorArtifactExceptions == null )
        {
            return Collections.emptyList();
        }

        return errorArtifactExceptions;
    }

    // ------------------------------------------------------------------------
    // Circular Dependency Exceptions
    // ------------------------------------------------------------------------

    public boolean hasCircularDependencyExceptions()
    {
        return circularDependencyExceptions != null;
    }

    public ArtifactResolutionResult addCircularDependencyException( CyclicDependencyException e )
    {
        circularDependencyExceptions = initList( circularDependencyExceptions );

        circularDependencyExceptions.add( e );

        exceptions = initList( exceptions );

        exceptions.add( e );

        return this;
    }

    public CyclicDependencyException getCircularDependencyException( int i )
    {
        return circularDependencyExceptions.get( i );
    }

    public List<CyclicDependencyException> getCircularDependencyExceptions()
    {
        if ( circularDependencyExceptions == null )
        {
            return Collections.emptyList();
        }

        return circularDependencyExceptions;
    }

    // ------------------------------------------------------------------------
    // Repositories
    // ------------------------------------------------------------------------

    public List<ArtifactRepository> getRepositories()
    {
        if ( repositories == null )
        {
            return Collections.emptyList();
        }

        return repositories;
    }

    public ArtifactResolutionResult setRepositories( final List<ArtifactRepository> repositories )
    {
        this.repositories = repositories;

        return this;
    }

    //
    // Internal
    //

    private <T> List<T> initList( final List<T> l )
    {
        if ( l == null )
        {
            return new ArrayList<T>();
        }
        return l;
    }

    public String toString()
    {
        StringBuilder sb = new StringBuilder();

        if ( artifacts != null )
        {
            int i = 1;
            sb.append( "---------" ).append( "\n" );
            sb.append( artifacts.size() ).append( "\n" );
            for ( Artifact a : artifacts )
            {
                sb.append( i ).append( " " ).append( a ).append( "\n" );
                i++;
            }
            sb.append( "---------" ).append( "\n" );
        }

        return sb.toString();
    }
}


text:
import { TestBed, inject } from '@angular/core/testing';

import { FilterSortService } from './filter-sort.service';

describe('FilterSortService', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [FilterSortService]
    });
  });

  it('should be created', inject([FilterSortService], (service: FilterSortService) => {
    expect(service).toBeTruthy();
  }));
});