text:
package org.apache.kafka.clients;

import java.io.Closeable;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.kafka.common.network.ChannelBuilders;
import org.apache.kafka.common.network.LoginType;
import org.apache.kafka.common.network.Mode;
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.protocol.Protocol;
import org.apache.kafka.common.protocol.SecurityProtocol;
import org.apache.kafka.common.network.ChannelBuilder;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.config.SaslConfigs;
import org.apache.kafka.common.requests.ApiVersionsResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.apache.kafka.common.utils.Utils.getHost;
import static org.apache.kafka.common.utils.Utils.getPort;

public class ClientUtils {
    private static final Logger log = LoggerFactory.getLogger(ClientUtils.class);

    public static List<InetSocketAddress> parseAndValidateAddresses(List<String> urls) {
        List<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>();
        for (String url : urls) {
            if (url != null && !url.isEmpty()) {
                try {
                    String host = getHost(url);
                    Integer port = getPort(url);
                    if (host == null || port == null)
                        throw new ConfigException("Invalid url in " + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + ": " + url);

                    InetSocketAddress address = new InetSocketAddress(host, port);

                    if (address.isUnresolved()) {
                        log.warn("Removing server {} from {} as DNS resolution failed for {}", url, CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, host);
                    } else {
                        addresses.add(address);
                    }
                } catch (IllegalArgumentException e) {
                    throw new ConfigException("Invalid port in " + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + ": " + url);
                }
            }
        }
        if (addresses.isEmpty())
            throw new ConfigException("No resolvable bootstrap urls given in " + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG);
        return addresses;
    }

    public static void closeQuietly(Closeable c, String name, AtomicReference<Throwable> firstException) {
        if (c != null) {
            try {
                c.close();
            } catch (Throwable t) {
                firstException.compareAndSet(null, t);
                log.error("Failed to close " + name, t);
            }
        }
    }

    /**
     * @param configs client/server configs
     * @return configured ChannelBuilder based on the configs.
     */
    public static ChannelBuilder createChannelBuilder(Map<String, ?> configs) {
        SecurityProtocol securityProtocol = SecurityProtocol.forName((String) configs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG));
        if (!SecurityProtocol.nonTestingValues().contains(securityProtocol))
            throw new ConfigException("Invalid SecurityProtocol " + securityProtocol);
        String clientSaslMechanism = (String) configs.get(SaslConfigs.SASL_MECHANISM);
        return ChannelBuilders.create(securityProtocol, Mode.CLIENT, LoginType.CLIENT, configs, clientSaslMechanism, true);
    }

    public static Collection<ApiVersionsResponse.ApiVersion> buildExpectedApiVersions(Collection<ApiKeys> apiKeys) {
        List<ApiVersionsResponse.ApiVersion> expectedApiVersions = new ArrayList<>();
        for (ApiKeys apiKey : apiKeys)
            expectedApiVersions.add(
                    // once backwards client compatibility is added, expected min API version for an API should be set to it's min version
                    new ApiVersionsResponse.ApiVersion(
                            apiKey.id, Protocol.CURR_VERSION[apiKey.id], Protocol.CURR_VERSION[apiKey.id]));
        return expectedApiVersions;
    }
}


text:
Run all the tests inside the features folder with:
`bin/behat`

Keep Selenium running in background with
`java -jar selenium-server-*.jar`

redpajama_set_name: RedPajamaGithub


text:
package cdp4aws.examples;

/**
 * @author jraymond
 *         Date: 7/25/14
 *         Time: 3:19 PM
 */
public class CommandProcessorRouteBuilder {
}


text:
var layout = require('./layout'),
    resource = require('resource');

module['exports'] = function (options, callback) {

  var $ = this.$;

  var methods = {},
  events = [];
  for (var r in resource.resources) {
    for (var m in resource.resources[r].methods) {
      events.push(r + '::' + m);
    }
  }

  events.sort();

  events.forEach(function(ev){
    var option = '<option value = "' + ev + '">' + ev + '</option>';
    $('#if').append(option);
    $('#then').append(option);
  });

  resource.resources.hook.all(function(err, results){
    results.sort(function(a,b){
      return a.if > b.if;
    });
    results.forEach(function(item){
      $('.hooks').append('
' + eventLink(item.if) + '	' + eventLink(item.then) + '	' + '' + '
')
    });
    callback(null,  $.html());
  });

}

function eventLink (event) {
  var arr = event.split('::'),
      _resource = arr[0],
      _method   = arr[1];
  return '' + event + ''
}


text:
package ca.simba.grtwaterloo.navigationdrawer;

import android.app.Activity;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import static android.support.v4.app.ActivityCompat.invalidateOptionsMenu;

public class ActionBarDrawerToggler extends ActionBarDrawerToggle {

    protected Activity mActivity;

    public ActionBarDrawerToggler(Activity activity, DrawerLayout drawerLayout, Toolbar toolbar, int openDrawerContentDescRes, int closeDrawerContentDescRes) {
        super(activity, drawerLayout, toolbar, openDrawerContentDescRes, closeDrawerContentDescRes);
        mActivity = activity;
    }

    @Override
    public void onDrawerClosed(View v) {
        super.onDrawerClosed(v);
        invalidateOptionsMenu(mActivity);
        syncState();
    }

    @Override
    public void onDrawerOpened(View v) {
        super.onDrawerOpened(v);
        invalidateOptionsMenu(mActivity);
        syncState();
    }
}


text:
package org.jboss.weld.resources;

import static org.jboss.weld.util.reflection.Reflections.cast;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;

import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.Bean;

import org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType;
import org.jboss.weld.annotated.enhanced.EnhancedAnnotation;
import org.jboss.weld.annotated.enhanced.jlr.EnhancedAnnotatedTypeImpl;
import org.jboss.weld.annotated.enhanced.jlr.EnhancedAnnotationImpl;
import org.jboss.weld.annotated.slim.AnnotatedTypeIdentifier;
import org.jboss.weld.annotated.slim.SlimAnnotatedType;
import org.jboss.weld.annotated.slim.backed.BackedAnnotatedType;
import org.jboss.weld.annotated.slim.unbacked.UnbackedAnnotatedType;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bootstrap.api.BootstrapService;
import org.jboss.weld.logging.BootstrapLogger;
import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.resources.spi.ResourceLoadingException;
import org.jboss.weld.util.AnnotatedTypes;
import org.jboss.weld.util.cache.ComputingCache;
import org.jboss.weld.util.cache.ComputingCacheBuilder;
import org.jboss.weld.util.reflection.Reflections;

/**
 * @author Pete Muir
 * @author Stuart Douglas
 * @author JBoss Weld Community
 * @author Ales Justin
 */
public class ClassTransformer implements BootstrapService {

    public static ClassTransformer instance(BeanManagerImpl manager) {
        return manager.getServices().get(ClassTransformer.class);
    }

    private class TransformClassToWeldAnnotation implements Function<Class<? extends Annotation>, EnhancedAnnotation<?>> {
        @Override
        public EnhancedAnnotation<?> apply(Class<? extends Annotation> from) {

            SlimAnnotatedType<? extends Annotation> slimAnnotatedType = syntheticAnnotationsAnnotatedTypes.get(from);

            if (slimAnnotatedType == null) {
                // We do not recognize the BDA that defined the annotation This could in theory cause problem is two
                // annotations with the same name but different definition are defined within the same application (different
                // BDAs)
                slimAnnotatedType = getBackedAnnotatedType(from, AnnotatedTypeIdentifier.NULL_BDA_ID);
            }
            return EnhancedAnnotationImpl.create(slimAnnotatedType, ClassTransformer.this);
        }
    }

    private class TransformClassToBackedAnnotatedType implements Function<TypeHolder<?>, BackedAnnotatedType<?>> {
        @Override
        public BackedAnnotatedType<?> apply(TypeHolder<?> typeHolder) {
            // make sure declaring class (if any) is loadable before loading this class
            Reflections.checkDeclaringClassLoadable(typeHolder.getRawType());
            BackedAnnotatedType<?> type = BackedAnnotatedType.of(typeHolder.getRawType(), typeHolder.getBaseType(), cache,
                    reflectionCache, contextId, typeHolder.getBdaId(), typeHolder.getSuffix());
            return updateLookupTable(type);
        }
    }

    private class TransformSlimAnnotatedTypeToEnhancedAnnotatedType implements Function<SlimAnnotatedType<?>, EnhancedAnnotatedType<?>> {
        @Override
        public EnhancedAnnotatedType<?> apply(SlimAnnotatedType<?> annotatedType) {
            return EnhancedAnnotatedTypeImpl.of(annotatedType, ClassTransformer.this);
        }
    }

    private static final class TypeHolder<T> {

        private final String bdaId;
        private final Class<T> rawType;
        private final Type baseType;
        private final String suffix;

        private TypeHolder(Class<T> rawType, Type baseType, String bdaId, String suffix) {
            this.rawType = rawType;
            this.baseType = baseType;
            this.bdaId = bdaId;
            this.suffix = suffix;
        }

        Type getBaseType() {
            return baseType;
        }

        Class<T> getRawType() {
            return rawType;
        }

        String getBdaId() {
            return bdaId;
        }

        String getSuffix() {
            return suffix;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj instanceof TypeHolder<?>) {
                TypeHolder<?> that = (TypeHolder<?>) obj;
                return Objects.equals(this.getBaseType(), that.getBaseType()) && Objects.equals(this.getBdaId(), that.getBdaId()) && Objects.equals(this.getSuffix(), that.getSuffix());
            }
            return false;
        }

        @Override
        public int hashCode() {
            return Objects.hash(this.getBaseType(), this.getBdaId(), this.getSuffix());
        }

        @Override
        public String toString() {
            return "TypeHolder [bdaId=" + bdaId + ", rawType=" + rawType + ", baseType=" + baseType + ", suffix=" + suffix + "]";
        }
    }

    // The synthetic annotations map (annotation type -> annotated type)
    private final ConcurrentMap<Class<? extends Annotation>, UnbackedAnnotatedType<? extends Annotation>> syntheticAnnotationsAnnotatedTypes = new ConcurrentHashMap<Class<? extends Annotation>, UnbackedAnnotatedType<? extends Annotation>>();

    private final ConcurrentMap<AnnotatedTypeIdentifier, SlimAnnotatedType<?>> slimAnnotatedTypesById;

    private final ComputingCache<TypeHolder<?>, BackedAnnotatedType<?>> backedAnnotatedTypes;
    private final ComputingCache<SlimAnnotatedType<?>, EnhancedAnnotatedType<?>> enhancedAnnotatedTypes;
    private final ComputingCache<Class<? extends Annotation>, EnhancedAnnotation<?>> annotations;

    private final TypeStore typeStore;
    private final SharedObjectCache cache;
    private final ReflectionCache reflectionCache;

    private final String contextId;

    public ClassTransformer(TypeStore typeStore, SharedObjectCache cache, ReflectionCache reflectionCache, String contextId) {
        this.contextId = contextId;
        this.backedAnnotatedTypes = ComputingCacheBuilder.newBuilder().setWeakValues().build(new TransformClassToBackedAnnotatedType());
        this.enhancedAnnotatedTypes = ComputingCacheBuilder.newBuilder().build(new TransformSlimAnnotatedTypeToEnhancedAnnotatedType());
        this.annotations = ComputingCacheBuilder.newBuilder().build(new TransformClassToWeldAnnotation());
        this.typeStore = typeStore;
        this.cache = cache;
        this.reflectionCache = reflectionCache;
        this.slimAnnotatedTypesById = new ConcurrentHashMap<AnnotatedTypeIdentifier, SlimAnnotatedType<?>>();
    }

    // Slim AnnotatedTypes

    public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) {
        try {
            return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix));
        } catch (RuntimeException e) {
            if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) {
                BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e);
                throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e);
            }
            throw e;
        } catch (Error e) {
            if(e instanceof NoClassDefFoundError || e instanceof LinkageError) {
                throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e);
            }
            BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e);
            throw e;
        }
    }

    public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final String bdaId) {
        return getBackedAnnotatedType(rawType, rawType, bdaId, null);
    }

    public <T> BackedAnnotatedType<T> getBackedAnnotatedType(Class<T> rawType, String bdaId, String suffix) {
        return getBackedAnnotatedType(rawType, rawType, bdaId, suffix);
    }

    public <T> SlimAnnotatedType<T> getSlimAnnotatedTypeById(AnnotatedTypeIdentifier id) {
        return cast(slimAnnotatedTypesById.get(id));
    }

    public <T> UnbackedAnnotatedType<T> getUnbackedAnnotatedType(AnnotatedType<T> source, String bdaId, String suffix) {
        UnbackedAnnotatedType<T> type = UnbackedAnnotatedType.additionalAnnotatedType(contextId, source, bdaId, suffix, cache);
        return updateLookupTable(type);
    }

    public <T> UnbackedAnnotatedType<T> getUnbackedAnnotatedType(SlimAnnotatedType<T> originalType, AnnotatedType<T> source) {
        UnbackedAnnotatedType<T> type = UnbackedAnnotatedType.modifiedAnnotatedType(originalType, source, cache);
        return updateLookupTable(type);
    }

    public UnbackedAnnotatedType<? extends Annotation> getSyntheticAnnotationAnnotatedType(
            Class<? extends Annotation> annotationType) {
        return syntheticAnnotationsAnnotatedTypes.get(annotationType);
    }

    private <T, S extends SlimAnnotatedType<T>> S updateLookupTable(S annotatedType) {
        SlimAnnotatedType<?> previousValue = slimAnnotatedTypesById.putIfAbsent(annotatedType.getIdentifier(), annotatedType);
        if (previousValue == null) {
            return annotatedType;
        } else {
            return cast(previousValue);
        }
    }

    // Enhanced AnnotatedTypes

    public <T> EnhancedAnnotatedType<T> getEnhancedAnnotatedType(Class<T> rawType, String bdaId) {
        return getEnhancedAnnotatedType(getBackedAnnotatedType(rawType, bdaId));
    }

    public <T> EnhancedAnnotatedType<T> getEnhancedAnnotatedType(Class<T> rawType, Type baseType, String bdaId) {
        return getEnhancedAnnotatedType(getBackedAnnotatedType(rawType, baseType, bdaId, null));
    }

    public <T> EnhancedAnnotatedType<T> getEnhancedAnnotatedType(AnnotatedType<T> annotatedType, String bdaId) {
        if (annotatedType instanceof EnhancedAnnotatedType<?>) {
            return cast(annotatedType);
        }
        if (annotatedType instanceof SlimAnnotatedType<?>) {
            return cast(getEnhancedAnnotatedType((SlimAnnotatedType<?>) annotatedType));
        }
        return getEnhancedAnnotatedType(getUnbackedAnnotatedType(annotatedType, bdaId,
                AnnotatedTypes.createTypeId(annotatedType)));
    }

    public <T> EnhancedAnnotatedType<T> getEnhancedAnnotatedType(SlimAnnotatedType<T> annotatedType) {
        return cast(enhancedAnnotatedTypes.getValue(annotatedType));
    }

    public <T extends Annotation> EnhancedAnnotation<T> getEnhancedAnnotation(final Class<T> clazz) {
        return annotations.getCastValue(clazz);
    }

    public void clearAnnotationData(Class<? extends Annotation> annotationClass) {
        annotations.invalidate(annotationClass);
    }

    public TypeStore getTypeStore() {
        return typeStore;
    }

    public SharedObjectCache getSharedObjectCache() {
        return cache;
    }

    public ReflectionCache getReflectionCache() {
        return reflectionCache;
    }

    /**
     *
     * @param annotation
     */
    public void addSyntheticAnnotation(AnnotatedType<? extends Annotation> annotation, String bdaId) {
        syntheticAnnotationsAnnotatedTypes.put(annotation.getJavaClass(),
                getUnbackedAnnotatedType(annotation, bdaId, AnnotatedTypeIdentifier.SYNTHETIC_ANNOTATION_SUFFIX));
        clearAnnotationData(annotation.getJavaClass());
    }

    public <T> void disposeBackedAnnotatedType(Class<T> rawType, String bdaId, String suffix) {
        TypeHolder<T> typeHolder = new TypeHolder<>(rawType, rawType, bdaId, suffix);
        BackedAnnotatedType<T> annotatedType = cast(this.backedAnnotatedTypes.getValueIfPresent(typeHolder));
        if (annotatedType != null) {
            this.backedAnnotatedTypes.invalidate(typeHolder);
            this.slimAnnotatedTypesById.remove(annotatedType.getIdentifier());
            this.enhancedAnnotatedTypes.invalidate(annotatedType);
        }
    }

    @Override
    public void cleanupAfterBoot() {
        this.enhancedAnnotatedTypes.clear();
        this.annotations.clear();
        backedAnnotatedTypes.forEachValue((BackedAnnotatedType::clear));
        this.backedAnnotatedTypes.clear();
    }

    @Override
    public void cleanup() {
        cleanupAfterBoot();
        slimAnnotatedTypesById.clear();
        syntheticAnnotationsAnnotatedTypes.clear();
    }

    public void removeAll(Set<Bean<?>> removable) {
        for (Bean<?> bean : removable) {
            if (bean instanceof AbstractClassBean) {
                slimAnnotatedTypesById.remove(((AbstractClassBean<?>) bean).getAnnotated().getIdentifier());
            }
        }
    }
}


text:
package br.com.caelum.vraptor.view;

/**
 * Controller used to test Generic Controllers on LinkToHandler
 * @author Nykolas Lima
 *
 */
public class SubGenericController extends GenericController<String> {
	@Override
	public void method(String string) {
		System.out.println("Do something thing by Sub Generic Controller");
	}

	public void okMethod(String string) {
		System.out.println("OKOK");
	}

	@Override
	public void anotherMethod(String string, String param) {
		System.out.println("Do another thing by Sub Generic Controller");
	}
}


text:
package org.springframework.social.linkedin.api;

import java.util.List;

/**
 * Model class representing group memberships on LinkedIn
 *
 * @author Robert Drysdale
 */
public class GroupMemberships extends SearchResult {

	private static final long serialVersionUID = 1L;

	private List<GroupSettings> memberships;

	public GroupMemberships(int count, int start, int total) {
		super(count, start, total);
	}

	public List<GroupSettings> getMemberships() {
		return memberships;
	}

}


text:
package redis.clients.jedis;

import com.esotericsoftware.reflectasm.MethodAccess;
import org.apache.log4j.Logger;

import java.util.Map;

public abstract class Command {
	private final static Logger LOG = Logger.getLogger(Command.class);

	private final static MethodAccess access = MethodAccess
			.get(ShardedJedis.class);

	protected ShardedJedisSentinelPool pool;

	public String set(String key, String value) {
		return String.valueOf(this.invoke("set", new String[] { key, value },
				new Class[] { String.class, String.class }));
	}

	public String get(String key) {
		return String.valueOf(this.invoke("get", new String[] { key },
				String.class));
	}

	public long del(String key) {
		return (long) this.invoke("del", new String[] { key }, String.class);
	}

	public String lpopList(String key) {
		return String.valueOf(this.invoke("lpop", new String[] { key },
				String.class));
	}

	public long rpushList(String key, String... values) {
		return (long) this.invoke("rpush", new Object[] { key, values },
				new Class[] { String.class, String[].class });
	}

	public long expire(String key, int time) {
		return (long) this.invoke("expire", new Object[] { key, time },
				new Class[] { String.class, int.class });
	}

	public long hsetnx(String key, String field, String value) {
		return (long) this.invoke("hsetnx", new String[] { key, field, value },
				new Class[] { String.class, String.class, String.class });
	}

	public boolean exist(String key) {
		return (boolean) this.invoke("exists", new String[] { key },
				String.class);
	}

	public boolean existInSet(String key, String member) {
		return (boolean) this.invoke("sismember", new String[] { key, member },
				new Class[] { String.class, String.class });
	}

	public long saddSet(String key, String... members) {
		return (long) this.invoke("sadd", new Object[] { key, members },
				new Class[] { String.class, String[].class });
	}

	public long sremSet(String key, String... members) {
		return (long) this.invoke("srem", new Object[] { key, members },
				new Class[] { String.class, String[].class });
	}

	public String spopSet(String key) {
		return String.valueOf(this.invoke("spop", new Object[] { key },
				new Class[] { String.class }));
	}

	public long hSet(byte[] key, byte[] field, byte[] value) {
		return (long) this.invoke("hset", new Object[] { key, field, value },
				new Class[] { byte[].class, byte[].class, byte[].class });
	}

	@SuppressWarnings("unchecked")
	public Map<byte[], byte[]> hGetAll(byte[] key) {
		return (Map<byte[], byte[]>) this.invoke("hgetAll",
				new Object[] { key }, new Class[] { byte[].class });
	}

	public byte[] hGet(byte[] key, byte[] field) {
		return (byte[]) this.invoke("hget", new Object[] { key, field },
				new Class[] { byte[].class, byte[].class });
	}

	public long del(byte[] key) {
		return (long) this.invoke("del", new Object[] { key }, byte[].class);
	}

	protected Object invoke(String methodName, Object[] args,
			Class<?>... parameterTypes) {
		Object ret = null;

		ShardedJedis jedis = pool.getResource();
		try {
			/*
			 * Method method = clazz.getMethod(methodName, parameterTypes); ret
			 * = method.invoke(jedis, args);
			 */
			ret = access.invoke(jedis, methodName, parameterTypes, args);
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
			pool.returnBrokenResource(jedis);
		} finally {
			pool.returnResource(jedis);
		}
		return ret;
	}
}


text:
layout: page-fullwidth
show_meta: false
title: "Cellular Components"
subheadline: ""
teaser: ""
header: ""
image_fullwidth: ""
permalink: "/cellular_components/"
---

**Table of Contents**
{: #toc }
*  TOC
{:toc}

## Neurons {#neurons}

Neurons are the largest population of cells in the nervous system that specialize in communication. Estimates vary but there appear to be approximately 100 billion neurons in the brain. They can come in several shapes and sizes depending on their specialized functions but all neurons will have axons and dendrites that protrude from the cell body.

![Neurons in the brain]({{ "/images/introtoneuro/wellcome_udqg385v.jpg" | absolute_url }}){:height="100px"}

**Neurons in the brain** *Credit: [Dr Jonathan Clarke](https://wellcomecollection.org/works/udqg385v). [CC BY](https://creativecommons.org/licenses/by/4.0/)*

### Dendrites {#dendrites}

Dendrites are specialized structures for receiving and integrating signals from other cells. They do this mainly through receptors for small molecules and even for gases (Nitric Oxide). Dendrites often connect to the specialized structure at the end of an axon.

### Axons {#axons}

Most neurons have a single axon that typically sends electrical impulses outwards away from the cell body. Axons can vary in length from extremely short to over 1 m to reach from the base of your spine to your ankle. Axons can also have branches, or collaterals, that can connect with other cells, or groups of cells. The axons of the neurons in the peripheral nervous system are also known as nerves.

### Synapse {#synapse}

Neurons communicate through axon-dendrite, axon-soma and sometimes dendrite-dendrite connections but these protrusions don't actually touch. A chemical synapse consists of a small gap between two neurons, with specialized proteins at both the presynaptic and postsynaptic membrane. Processes activated by these electrical signals at the presynaptic membrane of the end of one axon result in a downstream cascade leading to the release of chemicals called neurotransmitters. Other electrical synapses also exist between cells that are very close to each other and contain specialized tunnel-like structures, called gap junctions, allowing electrical signals to travel through them.

[![Synapse schematic]({{ "/images/introtoneuro/SynapseSchematic_en.svg.png" | absolute_url }})](https://commons.wikimedia.org/wiki/File:SynapseSchematic_lines.svg){:height="100px"}

**Synapse schematic**
*Credit: [Thomas Splettstoesser (www.scistyle.com)](https://commons.wikimedia.org/wiki/File:SynapseSchematic_lines.svg). [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/deed.en)*

## Neuronal Communication {#neuronal-communication}

An electrical signal from one neuron's axon will trigger a release of neurotransmitters which bind to channels on another neuron's dendrite. This causes the channels to open and receive positively-charged ions from the synapse. If this increases the charge enough, can trigger an action potential, causing that neuron to send an electrical signal (positive charge) down its own axon.

[![Chemical synapse schema cropped](https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Chemical_synapse_schema_cropped.jpg/512px-Chemical_synapse_schema_cropped.jpg)](https://commons.wikimedia.org/wiki/File%3AChemical_synapse_schema_cropped.jpg "By user:Looie496 created file, US National Institutes of Health, National Institute on Aging created original \[Public domain\], via Wikimedia Commons")

**Chemical Synapse**

## Neural Networks {#neural-networks}

A nervous system emerges from a large assemblage of connected neurons. Nerve impulses can also be transmitted in a multitude of ways: from a sensory receptor cell to a neuron; from a neuron to a set of muscles or an endocrine gland; from an astrocyte to a neuron. Any cell that receives a synaptic signal from a neuron may be excited, inhibited, or otherwise modulated.

## Glial Cells {#glial-cells}

Glial cells mostly act as caretaker cells, supporting the neurons and their connections. There are several different types:

**Astrocytes**[^1]**:** These are often considered a third component of synapses as they are intimately connected with neurons. Their functions include recycling excess neurotransmitter, releasing its own transmitters to modulate the synapse and providing protection from cellular damage or injury.

**Oligodendrocytes:** These are myelinating cells in the central nervous system. They surround the axons of neurons with a fatty, myelin sheath that insulates the electrical signal and allows for quicker communication.

**Ependymal cells:** These are cells which line part of the brain called ventricles, which have finger-like projections called cilia. These regions in the brain are chambers that are filled with cerebrospinal fluid, produced by ependymal cells, and they bathe both the brain and the spinal cord. These calls may also be involved in the migration of new neurons being formed (at least  in rodents)[^2]. For a more extensive review, see footnotes[^3].

**Schwann cells:** These are the myelinating cells of the PNS which can also insulate the electrical signals travelling through axons. They also act to speed up the neural signalling. The effect of demyelination can be seen in related disorders such as multiple sclerosis

**Microglial cells:** These are the resident immune cells of the brain (up to 10% of brain cells). They are also involved in synaptic pruning/neurodevelopment and can also release molecules for other immune cells to recognize[^4]. Microglia can become activated into a pro-inflammatory or an anti-inflammatory state, both of which change the shape of the cell as well as the types of molecules that it releases into the environment.

## Neurochemistry {#neurochemistry}

### Neurotransmitters {#neurotransmitters}

Neurotransmitters are the biochemical messengers, or couriers, of information between cells, released from neurons at the presynaptic nerve terminal to cross through synapses where they may be accepted by a receptor site on the other side. A single neuron will produce several different neurotransmitters. The effect of a neurotransmitter is dependent on the receptor that it binds; depending on the receptor's machinery, it may result in changes affecting the excitability of the cell or even more subtle chemical and molecular changes.

Following is a list of the prominent neurotransmitters involved in the many functions of our bodies:

   Neurotransmitter

   Role

   Glutamate

   Major excitatory neurotransmitter in the brain involved in learning, memory, synaptic plasticity and development. It is also involved in cell death - because overstimulation of a neuron with glutamate can cause excitotoxicity.

   GABA (Gamma-Amino Butyric Acid)

   GABA is the major inhibitory neurotransmitter in the CNS, contributing to motor control, anxiety regulation, vision, and many other cortical functions.

   Acetylcholine

   Acetylcholine is a very widely distributed excitatory neurotransmitter that triggers voluntary muscle contraction and stimulates the secretion of certain hormones. It is involved in wakefulness, attentiveness, learning, memory, sleep, anger, aggression, sexuality, and thirst.

   Dopamine

   Dopamine correlates with movement, attention, and learning. Dopamine is involved in controlling movement and posture. It also modulates mood and plays a central role in positive reinforcement and dependency.

   Norepinephrine

   Norepinephrine is associated with alertness. neurotransmitter that is important for attentiveness, emotions, sleeping, dreaming, and learning. Norepinephrine is also associated with the "fight or flight" response.

   Serotonin

   Serotonin plays a role in mood, sleep, appetite, and impulsive and aggressive behavior.

   Endorphins

   Involved in pain relief and feelings of pleasure and contentedness.

## Receptors {#receptors}

Receptors are protein structures on the surface or inside of cells that recognize and bind to specific neurotransmitters, hormones, or psychotropic drugs. Once bound, the receptor then changes shape to exert a specific effect - this may involve altering the charge of the cell by opening or closing ion channels, or more subtle effects by impacting which genes in the cell are activated. This impacts the function of the neuron; it is important to note that the effect of a neurotransmitter is entirely dependent on the receptor to which it is bound.

## Footnotes

[^1]:
     Eroglu, C. and Barres, B.A., 2010. Regulation of synaptic connectivity by glia. _Nature_, _468_(7321), p.223.

[^2]:
     Sawamoto, K., Wichterle, H., Gonzalez-Perez, O., Cholfin, J.A., Yamada, M., Spassky, N., Murcia, N.S., Garcia-Verdugo, J.M., Marin, O., Rubenstein, J.L. and Tessier-Lavigne, M., 2006. New neurons follow the flow of cerebrospinal fluid in the adult brain. _Science_, _311_(5761), pp.629-632.

[^3]:
     Del Bigio, M.R., 1995. The ependyma: a protective barrier between brain and cerebrospinal fluid. _Glia_, _14_(1), pp.1-13.

[^4]:
     Bilbo, S.D. and Schwarz, J.M., 2012. The immune system and developmental programming of brain and behavior. _Frontiers in neuroendocrinology_, _33_(3), pp.267-286.


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

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <!-- Is organization expression language function -->
        <service id="fxp_security.expression.functions.is_organization" class="Fxp\Component\Security\Authorization\Expression\IsOrganizationProvider" public="false">
            <tag name="security.expression_language_provider" />
            <tag name="fxp_security.expression.variables" organizational_context="@fxp_security.organizational_context" />
        </service>
    </services>
</container>


text:
using System;
using Xunit;

namespace System.Linq.Expressions.Tests
{
    public static class UnaryDecrementTests
    {
        #region Test methods

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementShortTest(bool useInterpreter)
        {
            short[] values = new short[] { 0, 1, -1, short.MinValue, short.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementShort(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementUShortTest(bool useInterpreter)
        {
            ushort[] values = new ushort[] { 0, 1, ushort.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementUShort(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementIntTest(bool useInterpreter)
        {
            int[] values = new int[] { 0, 1, -1, int.MinValue, int.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementInt(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementUIntTest(bool useInterpreter)
        {
            uint[] values = new uint[] { 0, 1, uint.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementUInt(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementLongTest(bool useInterpreter)
        {
            long[] values = new long[] { 0, 1, -1, long.MinValue, long.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementLong(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckUnaryDecrementULongTest(bool useInterpreter)
        {
            ulong[] values = new ulong[] { 0, 1, ulong.MaxValue };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementULong(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckDecrementFloatTest(bool useInterpreter)
        {
            float[] values = new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementFloat(values[i], useInterpreter);
            }
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public static void CheckDecrementDoubleTest(bool useInterpreter)
        {
            double[] values = new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
            for (int i = 0; i < values.Length; i++)
            {
                VerifyDecrementDouble(values[i], useInterpreter);
            }
        }

        #endregion

        #region Test verifiers

        private static void VerifyDecrementShort(short value, bool useInterpreter)
        {
            Expression<Func<short>> e =
                Expression.Lambda<Func<short>>(
                    Expression.Decrement(Expression.Constant(value, typeof(short))),
                    Enumerable.Empty<ParameterExpression>());
            Func<short> f = e.Compile(useInterpreter);
            Assert.Equal((short)(--value), f());
        }

        private static void VerifyDecrementUShort(ushort value, bool useInterpreter)
        {
            Expression<Func<ushort>> e =
                Expression.Lambda<Func<ushort>>(
                    Expression.Decrement(Expression.Constant(value, typeof(ushort))),
                    Enumerable.Empty<ParameterExpression>());
            Func<ushort> f = e.Compile(useInterpreter);
            Assert.Equal((ushort)(--value), f());
        }

        private static void VerifyDecrementInt(int value, bool useInterpreter)
        {
            Expression<Func<int>> e =
                Expression.Lambda<Func<int>>(
                    Expression.Decrement(Expression.Constant(value, typeof(int))),
                    Enumerable.Empty<ParameterExpression>());
            Func<int> f = e.Compile(useInterpreter);
            Assert.Equal((int)(--value), f());
        }

        private static void VerifyDecrementUInt(uint value, bool useInterpreter)
        {
            Expression<Func<uint>> e =
                Expression.Lambda<Func<uint>>(
                    Expression.Decrement(Expression.Constant(value, typeof(uint))),
                    Enumerable.Empty<ParameterExpression>());
            Func<uint> f = e.Compile(useInterpreter);
            Assert.Equal((uint)(--value), f());
        }

        private static void VerifyDecrementLong(long value, bool useInterpreter)
        {
            Expression<Func<long>> e =
                Expression.Lambda<Func<long>>(
                    Expression.Decrement(Expression.Constant(value, typeof(long))),
                    Enumerable.Empty<ParameterExpression>());
            Func<long> f = e.Compile(useInterpreter);
            Assert.Equal((long)(--value), f());
        }

        private static void VerifyDecrementULong(ulong value, bool useInterpreter)
        {
            Expression<Func<ulong>> e =
                Expression.Lambda<Func<ulong>>(
                    Expression.Decrement(Expression.Constant(value, typeof(ulong))),
                    Enumerable.Empty<ParameterExpression>());
            Func<ulong> f = e.Compile(useInterpreter);
            Assert.Equal((ulong)(--value), f());
        }

        private static void VerifyDecrementFloat(float value, bool useInterpreter)
        {
            Expression<Func<float>> e =
                Expression.Lambda<Func<float>>(
                    Expression.Decrement(Expression.Constant(value, typeof(float))),
                    Enumerable.Empty<ParameterExpression>());
            Func<float> f = e.Compile(useInterpreter);
            Assert.Equal((float)(--value), f());
        }

        private static void VerifyDecrementDouble(double value, bool useInterpreter)
        {
            Expression<Func<double>> e =
                Expression.Lambda<Func<double>>(
                    Expression.Decrement(Expression.Constant(value, typeof(double))),
                    Enumerable.Empty<ParameterExpression>());
            Func<double> f = e.Compile(useInterpreter);
            Assert.Equal((double)(--value), f());
        }

        #endregion
    }
}


text:
package ratecounter

import "sync/atomic"

// A Counter is a thread-safe counter implementation
type Counter int64

// Increment the counter by some value
func (c *Counter) Incr(val int64) {
	atomic.AddInt64((*int64)(c), val)
}

// Return the counter's current value
func (c *Counter) Value() int64 {
	return atomic.LoadInt64((*int64)(c))
}


text:
#ifndef DUK_TRANS_SOCKET_H_INCLUDED
#define DUK_TRANS_SOCKET_H_INCLUDED

#include "duktape.h"

void duk_trans_socket_init(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);

#endif  /* DUK_TRANS_SOCKET_H_INCLUDED */


text:
<?php namespace AdammBalogh\KeyValueStore\Adapter\MemcacheAdapter;

trait ClientTrait
{
    /**
     * @return \Memcache
     */
    public function getClient()
    {
        return $this->client;
    }
}


text:
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Serilog;
using Serilog.Events;
using StackExchange.Profiling;
using StackExchange.Profiling.Storage;

namespace Profiling.Serilog
{
    public class SerilogStorage : IStorage
    {
        private readonly ILogger _logger;
        private readonly LogEventLevel _profilingLevel;

        public SerilogStorage(ILogger logger, LogEventLevel profilingLevel)
        {
            _logger = logger;
            _profilingLevel = profilingLevel;
        }

        public IEnumerable<Guid> List(int maxResults, DateTime? start = null, DateTime? finish = null, ListResultsOrder orderBy = ListResultsOrder.Descending)
        {
            //TODO NotImplementedException();
            return null;
        }

        public void Save(MiniProfiler profiler)
        {
            if (_logger == null)
            {
                return;
            }

            switch (_profilingLevel)
            {
                //TODO DRY!
                case LogEventLevel.Verbose:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Verbose("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                case LogEventLevel.Debug:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Debug("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                case LogEventLevel.Information:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Information("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                case LogEventLevel.Warning:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Warning("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                case LogEventLevel.Error:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Error("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                case LogEventLevel.Fatal:
                    if (_logger.IsEnabled(_profilingLevel))
                    {
                        GetLogWithContext(_logger).Fatal("Completed step in {Timing} ms", MiniProfiler.Current.Root.DurationMilliseconds);
                    }
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

        private ILogger GetLogWithContext(ILogger logger)
        {
            return logger
                .ForContext("MiniProfiler", JsonConvert.DeserializeObject<dynamic>(MiniProfiler.ToJson()), true);
        }

        public MiniProfiler Load(Guid id)
        {
            //TODO NotImplementedException();
            return null;
        }

        public void SetUnviewed(string user, Guid id)
        {
            //TODO NotImplementedException();
        }

        public void SetViewed(string user, Guid id)
        {
            //TODO NotImplementedException();
        }

        public List<Guid> GetUnviewedIds(string user)
        {
            //TODO NotImplementedException();
            return null;
        }
    }
}


text:
#import "CCBPCCBFile.h"
#import "ResourceManager.h"
#import "CCBReaderInternal.h"
#import "CCBGlobals.h"
#import "CCBDocument.h"
#import "AppDelegate.h"
#import "CCNode+NodeInfo.h"

@implementation CCBPCCBFile

@synthesize ccbFile;

- (id) init
{
    self = [super init];
    if (!self) return NULL;

    return self;
}

//- (void) setTimeLine:(NSString *)timeLine{
//
//}

- (void) setCcbFile:(CCNode *)cf
{
    ccbFile = cf;

    [self removeAllChildrenWithCleanup:YES];
    if (cf)
    {
        [self addChild:cf];
        self.contentSize = ccbFile.contentSize;
        self.anchorPoint = ccbFile.anchorPoint;
        self.ignoreAnchorPointForPosition = ccbFile.ignoreAnchorPointForPosition;
        cf.anchorPoint = ccp(0,0);
    }
    else
    {
        self.contentSize = CGSizeZero;
        self.anchorPoint = ccp(0,0);
        self.ignoreAnchorPointForPosition = NO;
    }
}

- (id) extraPropForKey:(NSString *)key
{
    if ([key isEqualToString:@"customClass"] && ccbFile)
    {
        return [ccbFile extraPropForKey:@"customClass"];
    }
    else
    {
        return [super extraPropForKey:key];
    }
}

- (NSMutableArray*) customProperties
{
    if (!ccbFile) return [NSMutableArray array];

    return [ccbFile customProperties];
}

@end


text:
package com.cc.mobilesafe.Adapter;

import java.util.List;

import com.cc.mobilesafe.R;
import com.cc.mobilesafe.Bean.CommonPhoneChildBean;
import com.cc.mobilesafe.Bean.CommonPhoneGroupBean;
import com.cc.mobilesafe.Bean.CommonPhoneGroupCombineChild;

import android.R.color;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

public class CommonPhoneAdapter extends BaseExpandableListAdapter {

	private Context context;
	private List<CommonPhoneGroupCombineChild> list;

	static class GroupViewHolder {
		TextView tv_groupname;
	}

	static class ChildViewHolder {
		TextView tv_name;
		TextView tv_phone;
	}

	public CommonPhoneAdapter(Context context, List<CommonPhoneGroupCombineChild> list) {
		// TODO 自动生成的构造函数存根
		this.context = context;
		this.list = list;
	}

	@Override
	public boolean hasStableIds() {
		// TODO 自动生成的方法存根
		return false;
	}

	@Override
	public CommonPhoneChildBean getChild(int groupPosition, int childPosition) {
		// TODO 自动生成的方法存根
		return list.get(groupPosition).child.get(childPosition);
	}

	@Override
	public long getChildId(int groupPosition, int childPosition) {
		// TODO 自动生成的方法存根
		return childPosition;
	}

	@Override
	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
			ViewGroup parent) {
		// TODO 自动生成的方法存根
		ChildViewHolder holder = new ChildViewHolder();
		if (convertView != null) {
			holder = (ChildViewHolder) convertView.getTag();
		} else {
			convertView = View.inflate(context, R.layout.elv_commonphonechild, null);
			holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
			holder.tv_phone = (TextView) convertView.findViewById(R.id.tv_phone);

			convertView.setTag(holder);
		}
		holder.tv_name.setText(getChild(groupPosition, childPosition).name);
		holder.tv_phone.setText("电话号码:" + getChild(groupPosition, childPosition).number);

		return convertView;
	}

	@Override
	public int getChildrenCount(int groupPosition) {
		// TODO 自动生成的方法存根
		return list.get(groupPosition).child.size();
	}

	@Override
	public CommonPhoneGroupCombineChild getGroup(int groupPosition) {
		// TODO 自动生成的方法存根
		return list.get(groupPosition);
	}

	@Override
	public int getGroupCount() {
		// TODO 自动生成的方法存根
		return list.size();
	}

	@Override
	public long getGroupId(int groupPosition) {
		// TODO 自动生成的方法存根
		return groupPosition;
	}

	@Override
	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
		// TODO 自动生成的方法存根
		GroupViewHolder holder = new GroupViewHolder();
		if (convertView != null) {
			holder = (GroupViewHolder) convertView.getTag();
		} else {
			convertView = View.inflate(context, R.layout.elv_commonphonegroup, null);
			holder.tv_groupname = (TextView) convertView.findViewById(R.id.tv_groupname);
			convertView.setTag(holder);
		}
		holder.tv_groupname.setText(getGroup(groupPosition).name);

		return convertView;
	}

	@Override
	public boolean isChildSelectable(int groupPosition, int childPosition) {
		// TODO 自动生成的方法存根
		return true;
	}

}


text:
package com.martinet.emplitude.Initialization;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.martinet.emplitude.Constants;
import com.martinet.emplitude.Global;
import com.martinet.emplitude.MainActivity;
import com.martinet.emplitude.Models.Student;
import com.martinet.emplitude.Models.Group;
import com.martinet.emplitude.R;

/**
 * Created by martinet on 11/08/16.
 */

public class SelectionAuthentification extends FragmentSelection {

    private Group group;
    private TextView tvPseudo;
    private TextView tvPassword;

    public static SelectionAuthentification newInstance()
    {
        SelectionAuthentification selectionAuthentification = new SelectionAuthentification();
        Bundle bdl = new Bundle();
        selectionAuthentification.setArguments(bdl);
        return selectionAuthentification;
    }

    public static SelectionAuthentification newInstance(Group group)
    {
        SelectionAuthentification selectionAuthentification = newInstance();
        selectionAuthentification.getArguments().putSerializable("group", group);
        return selectionAuthentification;
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        this.group = (Group) getArguments().get("group");

        View view = inflater.inflate(R.layout.initialisation_authentification, container, false);
        initialisation.getBtnNext().setOnClickListener(onValidate());
        initialisation.getBtnPrevious().setOnClickListener(onRevert());
        initialisation.getBtnNext().setText(R.string.finish);
        initialisation.getBtnNext().setVisibility(View.VISIBLE);

        tvPseudo = (TextView) view.findViewById(R.id.tvPseudo);
        tvPassword = (TextView) view.findViewById(R.id.tvPassword);
        return view;
    }

    public View.OnClickListener onValidate() {
        return new View.OnClickListener() {
            public void onClick(View v) {
                if("".equals(tvPseudo.getText().toString().trim())) {
                    tvPseudo.setError("Le champ est requis");
                    return;
                }
                if("".equals(tvPassword.getText().toString().trim())) {
                    tvPassword.setError("Le champ est requis");
                    return;
                }
                group.setPseudo(tvPseudo.getText().toString());
                group.setPassword(tvPassword.getText().toString());
                if(Global.global.getStudent() == null) {
                    Student student = new Student(group);
                    SelectionLoading selection = SelectionLoading.newInstance(student);
                    Constants.changeFragment(initialisation.getFragmentActivity(), R.id.selection, selection, R.anim.slide_in_left, R.anim.slide_out_right);
                } else {
                    addGroup(group);
                }

            }
        };
    }

    public View.OnClickListener onRevert() {
        return new View.OnClickListener() {
            public void onClick(View v) {
                SelectionGroup selection = SelectionGroup.newInstance(group.getSchool());
                Constants.changeFragment(initialisation.getFragmentActivity(), R.id.selection, selection, R.anim.slide_in_right, R.anim.slide_out_left);
            }
        };
    }

}


text:
import { Intent } from "@blueprintjs/core";
import debug from "debug";
import * as get from "lodash.get";
import { LOCATION_CHANGE, push } from "react-router-redux";
import { cancel, put, select, take, takeLatest } from "redux-saga/effects";
import request from "../../../api";
import { createNotification } from "../../../reducers/notification";
import { USER_ACTION_TYPES } from "../../../reducers/user";

const log = debug("app:pages:sign-up:saga");

export function* loginUser(action) {
  try {
    const response = yield request("/auth/sign-up", {
      body: action.payload,
      method: "POST"
    });
    yield put({
      payload: response,
      type: USER_ACTION_TYPES.SIGNUP_SUCCESS
    });
    const redirect = yield select(state =>
      get(
        state,
        "routing.locationBeforeTransitions.query.redirect",
        "tournaments"
      )
    );

    return yield put(push(redirect));
  } catch (e) {
    log("Error %s", e);
    yield put(
      createNotification({
        intent: Intent.DANGER,
        message: "There was an error with your signup details"
      })
    );
    yield put({ type: USER_ACTION_TYPES.SIGNUP_FAILURE });
  }
}

export default function*() {
  const watcher = yield takeLatest(USER_ACTION_TYPES.SIGNUP_REQUEST, loginUser);

  // Suspend execution until location changes
  yield take(LOCATION_CHANGE);
  yield cancel(watcher);
}


text:
package utils

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"time"

	"github.com/thecodeteam/rexray/libstorage/api/types"
	"github.com/thecodeteam/rexray/libstorage/drivers/storage/ebs"
)

const (
	raddr  = "169.254.169.254"
	mdtURL = "http://" + raddr + "/latest/meta-data/"
	iidURL = "http://" + raddr + "/latest/dynamic/instance-identity/document"
	bdmURL = "http://" + raddr + "/latest/meta-data/block-device-mapping/"
)

// IsEC2Instance returns a flag indicating whether the executing host is an EC2
// instance based on whether or not the metadata URL can be accessed.
func IsEC2Instance(ctx types.Context) (bool, error) {
	client := &http.Client{Timeout: time.Duration(1 * time.Second)}
	req, err := http.NewRequest(http.MethodHead, mdtURL, nil)
	if err != nil {
		return false, err
	}
	res, err := doRequestWithClient(ctx, client, req)
	if err != nil {
		if terr, ok := err.(net.Error); ok && terr.Timeout() {
			return false, nil
		}
		return false, err
	}
	if res.StatusCode >= 200 || res.StatusCode <= 299 {
		return true, nil
	}
	return false, nil
}

type instanceIdentityDoc struct {
	InstanceID       string `json:"instanceId,omitempty"`
	Region           string `json:"region,omitempty"`
	AvailabilityZone string `json:"availabilityZone,omitempty"`
}

// InstanceID returns the instance ID for the local host.
func InstanceID(
	ctx types.Context,
	driverName string) (*types.InstanceID, error) {

	req, err := http.NewRequest(http.MethodGet, iidURL, nil)
	if err != nil {
		return nil, err
	}

	res, err := doRequest(ctx, req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()

	iid := instanceIdentityDoc{}
	dec := json.NewDecoder(res.Body)
	if err := dec.Decode(&iid); err != nil {
		return nil, err
	}

	return &types.InstanceID{
		ID:     iid.InstanceID,
		Driver: driverName,
		Fields: map[string]string{
			ebs.InstanceIDFieldRegion:           iid.Region,
			ebs.InstanceIDFieldAvailabilityZone: iid.AvailabilityZone,
		},
	}, nil
}

// BlockDevices returns the EBS devices attached to the local host.
func BlockDevices(ctx types.Context) ([]byte, error) {

	req, err := http.NewRequest(http.MethodGet, bdmURL, nil)
	if err != nil {
		return nil, err
	}

	res, err := doRequest(ctx, req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()

	buf, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	return buf, nil
}

// BlockDeviceName returns the name of the provided EBS device.
func BlockDeviceName(
	ctx types.Context,
	device string) ([]byte, error) {

	req, err := http.NewRequest(
		http.MethodGet,
		fmt.Sprintf("%s%s", bdmURL, device),
		nil)
	if err != nil {
		return nil, err
	}

	res, err := doRequest(ctx, req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()

	buf, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	return buf, nil
}


text:
package org.apache.calcite.interpreter;

import org.apache.calcite.rel.core.Values;
import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.rex.RexNode;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * Interpreter node that implements a
 * {@link org.apache.calcite.rel.core.Values}.
 */
public class ValuesNode implements Node {
  private final Sink sink;
  private final int fieldCount;
  private final ImmutableList<Row> rows;

  public ValuesNode(Compiler compiler, Values rel) {
    this.sink = compiler.sink(rel);
    this.fieldCount = rel.getRowType().getFieldCount();
    this.rows = createRows(compiler, rel.getTuples());
  }

  private ImmutableList<Row> createRows(Compiler compiler,
      ImmutableList<ImmutableList<RexLiteral>> tuples) {
    final List<RexNode> nodes = Lists.newArrayList();
    for (ImmutableList<RexLiteral> tuple : tuples) {
      nodes.addAll(tuple);
    }
    final Scalar scalar = compiler.compile(nodes, null);
    final Object[] values = new Object[nodes.size()];
    final Context context = compiler.createContext();
    scalar.execute(context, values);
    final ImmutableList.Builder<Row> rows = ImmutableList.builder();
    Object[] subValues = new Object[fieldCount];
    for (int i = 0; i < values.length; i += fieldCount) {
      System.arraycopy(values, i, subValues, 0, fieldCount);
      rows.add(Row.asCopy(subValues));
    }
    return rows.build();
  }

  public void run() throws InterruptedException {
    for (Row row : rows) {
      sink.send(row);
    }
    sink.end();
  }
}

// End ValuesNode.java


text:
package smile.regression;

import smile.math.Math;
import smile.math.matrix.CholeskyDecomposition;
import smile.math.matrix.QRDecomposition;
import smile.math.special.Beta;

/**
 * Ordinary least squares. In linear regression,
 * the model specification is that the dependent variable is a linear
 * combination of the parameters (but need not be linear in the independent
 * variables). The residual is the difference between the value of the
 * dependent variable predicted by the model, and the true value of the
 * dependent variable. Ordinary least squares obtains parameter estimates
 * that minimize the sum of squared residuals, SSE (also denoted RSS).
 *

 * The OLS estimator is consistent when the independent variables are
 * exogenous and there is no multicollinearity, and optimal in the class
 * of linear unbiased estimators when the errors are homoscedastic and
 * serially uncorrelated. Under these conditions, the method of OLS provides
 * minimum-variance mean-unbiased estimation when the errors have finite
 * variances.
 *

 * There are several different frameworks in which the linear regression
 * model can be cast in order to make the OLS technique applicable. Each
 * of these settings produces the same formulas and same results, the only
 * difference is the interpretation and the assumptions which have to be
 * imposed in order for the method to give meaningful results. The choice
 * of the applicable framework depends mostly on the nature of data at hand,
 * and on the inference task which has to be performed.
 *

 * Least squares corresponds to the maximum likelihood criterion if the
 * experimental errors have a normal distribution and can also be derived
 * as a method of moments estimator.
 *

 * Once a regression model has been constructed, it may be important to
 * confirm the goodness of fit of the model and the statistical significance
 * of the estimated parameters. Commonly used checks of goodness of fit
 * include the R-squared, analysis of the pattern of residuals and hypothesis
 * testing. Statistical significance can be checked by an F-test of the overall
 * fit, followed by t-tests of individual parameters.
 *

 * Interpretations of these diagnostic tests rest heavily on the model
 * assumptions. Although examination of the residuals can be used to
 * invalidate a model, the results of a t-test or F-test are sometimes more
 * difficult to interpret if the model's assumptions are violated.
 * For example, if the error term does not have a normal distribution,
 * in small samples the estimated parameters will not follow normal
 * distributions and complicate inference. With relatively large samples,
 * however, a central limit theorem can be invoked such that hypothesis
 * testing may proceed using asymptotic approximations.
 *
 * @author Haifeng Li
 */
public class OLS implements Regression<double[]> {

    /**
     * The dimensionality.
     */
    private int p;
    /**
     * The intercept.
     */
    private double b;
    /**
     * The linear weights.
     */
    private double[] w;
    /**
     * The coefficients, their standard errors, t-scores, and p-values.
     */
    private double[][] coefficients;
    /**
     * The residuals, that is response minus fitted values.
     */
    private double[] residuals;
    /**
     * Residual sum of squares.
     */
    private double RSS;
    /**
     * Residual standard error.
     */
    private double error;
    /**
     * The degree-of-freedom of residual standard error.
     */
    private int df;
    /**
     * R2. R2 is a statistic that will give some information
     * about the goodness of fit of a model. In regression, the R2
     * coefficient of determination is a statistical measure of how well
     * the regression line approximates the real data points. An R2
     * of 1.0 indicates that the regression line perfectly fits the data.
     *

     * In the case of ordinary least-squares regression, R2
     * increases as we increase the number of variables in the model
     * (R2 will not decrease). This illustrates a drawback to
     * one possible use of R2, where one might try to include
     * more variables in the model until "there is no more improvement".
     * This leads to the alternative approach of looking at the
     * adjusted R2.
     */
    private double RSquared;
    /**
     * Adjusted R2. The adjusted R2 has almost same
     * explanation as R2 but it penalizes the statistic as
     * extra variables are included in the model.
     */
    private double adjustedRSquared;
    /**
     * The F-statistic of the goodness-of-fit of the model.
     */
    private double F;
    /**
     * The p-value of the goodness-of-fit test of the model.
     */
    private double pvalue;

    /**
     * Trainer for linear regression by ordinary least squares.
     */
    public static class Trainer extends RegressionTrainer<double[]> {
        /**
         * Constructor.
         */
        public Trainer() {
        }

        @Override
        public OLS train(double[][] x, double[] y) {
            return new OLS(x, y);
        }
    }

    /**
     * Constructor. Learn the ordinary least squares model.
     * @param x a matrix containing the explanatory variables.
     * @param y the response values.
     */
    public OLS(double[][] x, double[] y) {
        if (x.length != y.length) {
            throw new IllegalArgumentException(String.format("The sizes of X and Y don't match: %d != %d", x.length, y.length));
        }

        int n = x.length;
        p = x[0].length;

        // weights and intercept
        double[] w1 = new double[p+1];
        double[][] X = new double[n][p+1];
        for (int i = 0; i < n; i++) {
            System.arraycopy(x[i], 0, X[i], 0, p);
            X[i][p] = 1.0;
        }

        QRDecomposition qr = new QRDecomposition(X, true);
        qr.solve(y, w1);

        b = w1[p];
        w = new double[p];
        System.arraycopy(w1, 0, w, 0, p);

        double[] yhat = new double[n];
        Math.ax(x, w, yhat);

        double TSS = 0.0;
        RSS = 0.0;
        double ybar = Math.mean(y);
        residuals = new double[n];
        for (int i = 0; i < n; i++) {
            double r = y[i] - yhat[i] - b;
            residuals[i] = r;
            RSS += Math.sqr(r);
            TSS += Math.sqr(y[i] - ybar);
        }

        error = Math.sqrt(RSS / (n - p - 1));
        df = n - p - 1;

        RSquared = 1.0 - RSS / TSS;
        adjustedRSquared = 1.0 - ((1 - RSquared) * (n-1) / (n-p-1));

        F = (TSS - RSS) * (n - p - 1) / (RSS * p);
        int df1 = p;
        int df2 = n - p - 1;
        pvalue = Beta.regularizedIncompleteBetaFunction(0.5 * df2, 0.5 * df1, df2 / (df2 + df1 * F));

        CholeskyDecomposition cholesky = qr.toCholesky();
        double[][] inv = cholesky.inverse();

        coefficients = new double[p+1][4];
        for (int i = 0; i <= p; i++) {
            coefficients[i][0] = w1[i];
            double se = error * Math.sqrt(inv[i][i]);
            coefficients[i][1] = se;
            double t = w1[i] / se;
            coefficients[i][2] = t;
            coefficients[i][3] = Beta.regularizedIncompleteBetaFunction(0.5 * df, 0.5, df / (df + t * t));
        }
    }

    /**
     * Returns the t-test of the coefficients (including intercept).
     * The first column is the coefficients, the second column is the standard
     * error of coefficients, the third column is the t-score of the hypothesis
     * test if the coefficient is zero, the fourth column is the p-values of
     * test. The last row is of intercept.
     */
    public double[][] ttest() {
        return coefficients;
    }

    /**
     * Returns the linear coefficients (without intercept).
     */
    public double[] coefficients() {
        return w;
    }

    /**
     * Returns the intercept.
     */
    public double intercept() {
        return b;
    }

    /**
     * Returns the residuals, that is response minus fitted values.
     */
    public double[] residuals() {
        return residuals;
    }

    /**
     * Returns the residual sum of squares.
     */
    public double RSS() {
        return RSS;
    }

    /**
     * Returns the residual standard error.
     */
    public double error() {
        return error;
    }

    /**
     * Returns the degree-of-freedom of residual standard error.
     */
    public int df() {
        return df;
    }

    /**
     * Returns R2 statistic. In regression, the R2
     * coefficient of determination is a statistical measure of how well
     * the regression line approximates the real data points. An R2
     * of 1.0 indicates that the regression line perfectly fits the data.
     *

     * In the case of ordinary least-squares regression, R2
     * increases as we increase the number of variables in the model
     * (R2 will not decrease). This illustrates a drawback to
     * one possible use of R2, where one might try to include more
     * variables in the model until "there is no more improvement". This leads
     * to the alternative approach of looking at the adjusted R2.
     */
    public double RSquared() {
        return RSquared;
    }

    /**
     * Returns adjusted R2 statistic. The adjusted R2
     * has almost same explanation as R2 but it penalizes the
     * statistic as extra variables are included in the model.
     */
    public double adjustedRSquared() {
        return adjustedRSquared;
    }

    /**
     * Returns the F-statistic of goodness-of-fit.
     */
    public double ftest() {
        return F;
    }

    /**
     * Returns the p-value of goodness-of-fit test.
     */
    public double pvalue() {
        return pvalue;
    }

    @Override
    public double predict(double[] x) {
        if (x.length != p) {
            throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, p));
        }

        return b + Math.dot(x, w);
    }

    /**
     * Returns the significance code given a p-value.
     * Significance codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
     */
    private String significance(double pvalue) {
        if (pvalue < 0.001)
            return "***";
        else if (pvalue < 0.01)
            return "**";
        else if (pvalue < 0.05)
            return "*";
        else if (pvalue < 0.1)
            return ".";
        else
            return "";
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Linear Model:\n");

        double[] r = residuals.clone();
        builder.append("\nResiduals:\n");
        builder.append("\t     Min\t      1Q\t  Median\t      3Q\t     Max\n");
        builder.append(String.format("\t%8.4f\t%8.4f\t%8.4f\t%8.4f\t%8.4f\n", Math.min(r), Math.q1(r), Math.median(r), Math.q3(r), Math.max(r)));

        builder.append("\nCoefficients:\n");
        builder.append("\t    Estimate\t Std. Error\t t value\t Pr(>|t|)\n");
        builder.append(String.format("Intercept%11.4f%19.4f%16.4f%17.4f %s\n", coefficients[p][0], coefficients[p][1], coefficients[p][2], coefficients[p][3], significance(coefficients[p][3])));
        for (int i = 0; i < p; i++) {
            builder.append(String.format("Var %d\t%7.4f%19.4f%16.4f%17.4f %s\n", i+1, coefficients[i][0], coefficients[i][1], coefficients[i][2], coefficients[i][3], significance(coefficients[i][3])));
        }

        builder.append("---\n");
        builder.append("Significance codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n");

        builder.append(String.format("\nResidual standard error: %.4f on %d degrees of freedom\n", error, df));
        builder.append(String.format("Multiple R-squared: %.4f,    Adjusted R-squared: %.4f\n", RSquared, adjustedRSquared));
        builder.append(String.format("F-statistic: %.4f on %d and %d DF,  p-value: %.4g\n", F, p, df, pvalue));

        return builder.toString();
    }
}