text:
package com.easyooo.framework.cache.impl;

import static com.easyooo.framework.cache.impl.CascadeOperation.getDeleteOps;
import static com.easyooo.framework.cache.impl.CascadeOperation.getInsertOps;
import static com.easyooo.framework.cache.impl.CascadeOperation.getUpdateOps;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.easyooo.framework.cache.CacheException;
import com.easyooo.framework.cache.ModInfo;
import com.easyooo.framework.cache.config.CacheBean;
import com.easyooo.framework.cache.config.GroupBean;
import com.easyooo.framework.cache.storage.ICache;
import com.easyooo.framework.common.util.CglibUtil;

/**
 * 缓存的级联管理, 主要维护组的级联关系
 * @author Killer
 */
public class CascadeCacheManager extends CacheManagerImpl{
	Logger logger = LoggerFactory.getLogger(getClass());

	public CascadeCacheManager(){
	}

	public CascadeCacheManager(CacheChainBuilder cacheChain) {
		super(cacheChain);
	}

	@Override
	public String insert(Object bean) throws CacheException {
		final String cacheKey = super.insert(bean);
		if(cacheKey == null)
			return cacheKey;
		// check has more groups
		Map<String, List<GroupBean>> groups = getGroups(bean);
		if(groups == null || groups.size() == 0)
			return cacheKey;
		doCascadeOps(cacheKey, bean, null, getInsertOps(groups));
		return cacheKey;
	}

	/**
	 * @see super{@link #updateByPrimaryKey(Object)}
	 * 如果修改的缓存数据存在分组信息并且分组属性值也需要修改,
	 * 这个时候就必须保证分组缓存数据的正确性
	 */
	@SuppressWarnings("unchecked")
	@Override
	public String updateByPrimaryKey(Object newBean) throws CacheException {
		// check has more groups
		Map<String, List<GroupBean>> groups = getGroups(newBean);
		if(groups == null || groups.size() == 0){
			return super.updateByPrimaryKey(newBean);
		}
		// exist groups
		Object oldBean = selectByPrimaryKey(newBean);
		String cacheKey = super.updateByPrimaryKey(newBean);
		if(cacheKey == null || oldBean == null){
			return null;
		}
		Map<String, Object> oldMap = CglibUtil.describe(oldBean);
		Map<String, Object> newMap = CglibUtil.describe(newBean);
		ModInfo mod = new ModInfo(cacheKey, oldBean, oldMap, newBean, newMap);
		return updateGroupObject(mod, groups, false).getCacheKey();
	}

	/**
	 * @see #updateByPrimaryKey(Object) 排除分组属性值为null的分组
	 */
	@Override
	public ModInfo updateByPrimaryKeySelective(Object newBean) throws CacheException {
		ModInfo mod = super.updateByPrimaryKeySelective(newBean);
		if(mod == null){
			return null;
		}
		// check groups & get default group cacheKey by parameter bean
		Map<String, List<GroupBean>> groups = getGroups(newBean);
		if(groups == null || groups.size() == 0){
			return mod;
		}
		return updateGroupObject(mod, groups, true);
	}

	/**
	 * 级联修改对象,selectiveMode 是否选择性的去修改
	 */
	private ModInfo updateGroupObject(ModInfo mod, Map<String, List<GroupBean>> groups, boolean selectiveMode)throws CacheException{
		Map<String, Object> oldMap = mod.getOldMap();
		Map<String, Object> newMap = mod.getNewMap();
		final String cacheKey = mod.getCacheKey();
		Object newBean = mod.getNewBean();
		Object oldBean = mod.getOldBean();
		List<CascadeOperation> operationList = getUpdateOps(groups,
				oldMap, newMap, selectiveMode);
		// cascade
		doCascadeOps(cacheKey, newBean, oldBean, operationList);
		return mod;
	}

	/**
	 *
删除缓存数据并清除分组信息

	 *
如果存在分组,此时就会从缓存中查找到这些值,触发额外的1次Socket

	 */
	@Override
	public String deleteByPrimaryKey(Object bean) throws CacheException {
		// check groups & get default group cacheKey by parameter bean
		Map<String, List<GroupBean>> groups = getGroups(bean);
		if(groups == null)
			return super.deleteByPrimaryKey(bean);
		// exist groups
		Object oldBean = this.selectByPrimaryKey(bean);
		// remove
		final String cacheKey = super.deleteByPrimaryKey(bean);
		if(cacheKey == null || oldBean == null)
			return cacheKey;
		// cascade
		doCascadeOps(cacheKey, bean, oldBean, getDeleteOps(groups));
		return cacheKey;
	}

	/**
	 * 级联操作实现
	 */
	protected void doCascadeOps(String cacheKey, Object newBean, Object oldBean,
			List<CascadeOperation> cascades) throws CacheException {
		if(cascades == null || cascades.size() == 0){
			return ;
		}
		ICache cache = buildCache(newBean);
		for (CascadeOperation op : cascades) {
			try{
				String group = op.getGroup();
				switch (op.getOperation()) {
				case DELETE:
					cache.delMembers(buildGroupCacheKey(oldBean, group), cacheKey);
					break;
				case DELETE_INSERT:
					cache.delMembers(buildGroupCacheKey(oldBean, group), cacheKey);
					// 执行完不跳出,继续执行INSERT CASE
				case INSERT:
					String groupKey = buildGroupCacheKey(newBean, group);
					if(existGroup(cache, groupKey)){
						cache.addMembers(groupKey, cacheKey);
					}
					break;
				default:
					break;
				}
			}catch(CacheException e){
				logger.error("Cascade operation failed", e);
			}
		}
	}

	private boolean existGroup(ICache cache, String groupKey)throws CacheException{
		Set<String> mems = cache.getMembers(groupKey);
		return mems == null || mems.size() == 0 ? false : true;
	}

	private Map<String, List<GroupBean>> getGroups(Object bean)throws CacheException{
		CacheBean cacheBean = getCacheBean(bean);
		Map<String, List<GroupBean>> groups = cacheBean.getGroups();
		if (groups == null || groups.size() == 0) {
			return null;
		}
		return groups;
	}
}


text:
require 'sphere-cli/version.rb'
require 'sphere-cli/api.rb'
require 'sphere-cli/account.rb'
require 'sphere-cli/catalogs.rb'
require 'sphere-cli/client.rb'
require 'sphere-cli/download.rb'
require 'sphere-cli/base.rb'
require 'sphere-cli/code.rb'
require 'sphere-cli/products.rb'
require 'sphere-cli/types.rb'
require 'sphere-cli/projects.rb'
require 'sphere-cli/folder.rb'
require 'sphere-cli/taxes.rb'
require 'sphere-cli/customergroups.rb'
require 'sphere-cli/customers.rb'

# Add requires for other files you add to your project here, so
# you just need to require this one file in your bin file
require 'csv'
require 'set'
require 'json'
require 'open-uri'
include Sphere::CommandBase
include Sphere::MCAPI
include Sphere::API

redpajama_set_name: RedPajamaGithub


text:
import { KubernetesObject } from 'kpt-functions';
import * as apiCoreV1 from './io.k8s.api.core.v1';
import * as apisMetaV1 from './io.k8s.apimachinery.pkg.apis.meta.v1';

// Endpoint represents a single logical "backend" implementing a service.
export class Endpoint {
  // addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at least one address but no more than 100.
  public addresses: string[];

  // conditions contains information about the current status of the endpoint.
  public conditions?: EndpointConditions;

  // hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must pass DNS Label (RFC 1123) validation.
  public hostname?: string;

  // targetRef is a reference to a Kubernetes object that represents this endpoint.
  public targetRef?: apiCoreV1.ObjectReference;

  // topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node
  //   where the endpoint is located. This should match the corresponding
  //   node label.
  // * topology.kubernetes.io/zone: the value indicates the zone where the
  //   endpoint is located. This should match the corresponding node label.
  // * topology.kubernetes.io/region: the value indicates the region where the
  //   endpoint is located. This should match the corresponding node label.
  public topology?: {[key: string]: string};

  constructor(desc: Endpoint) {
    this.addresses = desc.addresses;
    this.conditions = desc.conditions;
    this.hostname = desc.hostname;
    this.targetRef = desc.targetRef;
    this.topology = desc.topology;
  }
}

// EndpointConditions represents the current condition of an endpoint.
export class EndpointConditions {
  // ready indicates that this endpoint is prepared to receive traffic, according to whatever system is managing the endpoint. A nil value indicates an unknown state. In most cases consumers should interpret this unknown state as ready.
  public ready?: boolean;
}

// EndpointPort represents a Port used by an EndpointSlice
export class EndpointPort {
  // The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names. Default is empty string.
  public appProtocol?: string;

  // The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.
  public name?: string;

  // The port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.
  public port?: number;

  // The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.
  public protocol?: string;
}

// EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints.
export class EndpointSlice implements KubernetesObject {
  // addressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name.
  public addressType: string;

  // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
  public apiVersion: string;

  // endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.
  public endpoints: Endpoint[];

  // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  public kind: string;

  // Standard object's metadata.
  public metadata: apisMetaV1.ObjectMeta;

  // ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates "all ports". Each slice may include a maximum of 100 ports.
  public ports?: EndpointPort[];

  constructor(desc: EndpointSlice.Interface) {
    this.addressType = desc.addressType;
    this.apiVersion = EndpointSlice.apiVersion;
    this.endpoints = desc.endpoints;
    this.kind = EndpointSlice.kind;
    this.metadata = desc.metadata;
    this.ports = desc.ports;
  }
}

export function isEndpointSlice(o: any): o is EndpointSlice {
  return o && o.apiVersion === EndpointSlice.apiVersion && o.kind === EndpointSlice.kind;
}

export namespace EndpointSlice {
  export const apiVersion = "discovery.k8s.io/v1beta1";
  export const group = "discovery.k8s.io";
  export const version = "v1beta1";
  export const kind = "EndpointSlice";

  // EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints.
  export interface Interface {
    // addressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name.
    addressType: string;

    // endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.
    endpoints: Endpoint[];

    // Standard object's metadata.
    metadata: apisMetaV1.ObjectMeta;

    // ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates "all ports". Each slice may include a maximum of 100 ports.
    ports?: EndpointPort[];
  }
}

// EndpointSliceList represents a list of endpoint slices
export class EndpointSliceList {
  // APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
  public apiVersion: string;

  // List of endpoint slices
  public items: EndpointSlice[];

  // Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  public kind: string;

  // Standard list metadata.
  public metadata?: apisMetaV1.ListMeta;

  constructor(desc: EndpointSliceList) {
    this.apiVersion = EndpointSliceList.apiVersion;
    this.items = desc.items.map((i) => new EndpointSlice(i));
    this.kind = EndpointSliceList.kind;
    this.metadata = desc.metadata;
  }
}

export function isEndpointSliceList(o: any): o is EndpointSliceList {
  return o && o.apiVersion === EndpointSliceList.apiVersion && o.kind === EndpointSliceList.kind;
}

export namespace EndpointSliceList {
  export const apiVersion = "discovery.k8s.io/v1beta1";
  export const group = "discovery.k8s.io";
  export const version = "v1beta1";
  export const kind = "EndpointSliceList";

  // EndpointSliceList represents a list of endpoint slices
  export interface Interface {
    // List of endpoint slices
    items: EndpointSlice[];

    // Standard list metadata.
    metadata?: apisMetaV1.ListMeta;
  }
}


text:
-*- markdown -*-

2015-05-10 0.4.0.0

* Compatible with GHC 7.10.

* New withAPISession and withSessionControl functions make talking to
  REST services more efficient.

* Added support for AWS S3 virtual-host style URLs.

* Added signing support for region specific calls to the AWS Security
  Token Service (AWS STS).

* The introduction of AWS support accidentally introduced unwanted AWS
  headers and computation into all requests. This has been fixed.

2014-12-11 0.3.0.1

* Bump lower bound on http-client to 0.3.0.1

2014-12-02 0.3.0.0

* Support for Amazon Web Services request signing

* New customMethod, customMethodWith functions allow use of arbitrary
  HTTP verbs

* httpProxy, basicAuth, oauth2Bearer, oauth2Token: removed Maybe from
  result types, changed documentation to suggest use of (?~)

2014-08-25 0.2.0.0

* Support for lens 4.4

2014-04-22 0.1.0.0

* Initial release.


text:
package de.org.lmu.othello.player;

import java.util.ArrayList;
import java.util.Random;

import szte.mi.Move;
import szte.mi.Player;
import de.org.lmu.othello.service.GameEngine;

public class RandomPlayer implements Player {
	private Random rnd;

	@Override
	public void init(int order, long t, Random rnd) {
		this.rnd = rnd;
	}

	@Override
	public Move nextMove(Move prevMove, long tOpponent, long t) {
		GameEngine engine = GameEngine.getInstance();
		final ArrayList<Move> nextSteps = engine.getNextPossibleMoves();
		return (nextSteps.size() > 0) ? nextSteps.get(rnd.nextInt(nextSteps
				.size())) : null;

	}

}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MessyLab.PicoComputer {
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Messages {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Messages() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MessyLab.PicoComputer.Messages", typeof(Messages).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to at line.
        /// </summary>
        internal static string AtLineLowerCase {
            get {
                return ResourceManager.GetString("AtLineLowerCase", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to column.
        /// </summary>
        internal static string ColumnLowerCase {
            get {
                return ResourceManager.GetString("ColumnLowerCase", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Syntax Error ({0}).
        /// </summary>
        internal static string E0000 {
            get {
                return ResourceManager.GetString("E0000", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to The symbol '{0}' is already defined.
        /// </summary>
        internal static string E0001 {
            get {
                return ResourceManager.GetString("E0001", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to The value '{0}' is out of range.
        /// </summary>
        internal static string E0002 {
            get {
                return ResourceManager.GetString("E0002", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Address error in argument '{0}'. Legal adresses [{1}..{2}].
        /// </summary>
        internal static string E0003 {
            get {
                return ResourceManager.GetString("E0003", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Zero is the only constant allowed in branch instructions.
        /// </summary>
        internal static string E0004 {
            get {
                return ResourceManager.GetString("E0004", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Allowed constant values for the I/O instructions are in range [0..127].
        /// </summary>
        internal static string E0005 {
            get {
                return ResourceManager.GetString("E0005", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Program is too big. Memory limit reached.
        /// </summary>
        internal static string E0006 {
            get {
                return ResourceManager.GetString("E0006", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to The symbol '{0}' is not defined.
        /// </summary>
        internal static string E0007 {
            get {
                return ResourceManager.GetString("E0007", resourceCulture);
            }
        }
    }
}


text:
package service;

import domain.Task;
import repository.Repository;
import util.Observable;
import util.Observer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by claudiu on 02.12.2016.
 */
public class TaskService implements Observable<Task> {

    private Repository<Task> taskRepository;
    private List<Observer<Task>> observers = new ArrayList<Observer<Task>>();

    public TaskService(Repository<Task> taskRepository) {
        this.taskRepository = taskRepository;
    }

    public void save(Task taskParam) throws Exception {
        this.taskRepository.add(taskParam);
        this.notifyObservers();
    }

    public void delete(Task taskParam) throws Exception {
        this.taskRepository.remove(taskParam);
        this.notifyObservers();
    }

    public void update(Task taskParam) throws Exception {
        this.taskRepository.update(taskParam);
        this.notifyObservers();
    }

    @Override
    public void addObserver(Observer<Task> o) {
        this.observers.add(o);
    }

    @Override
    public void removeObserver(Observer<Task> o) {
        this.observers.remove(o);
    }

    @Override
    public void notifyObservers() {
        for (Observer<Task> o : observers) {
            o.update(this);
        }
    }

    public List<Task> getAll() {
        return taskRepository.getAll();
    }

    public int getLastId() {
        return this.taskRepository.getLastId();
    }

    public boolean existsId(int id) {
        return this.taskRepository.existId(id);
    }
}


text:
<?php
if (!defined('CAKEPHP_SHELL')) {
	if (!file_exists(TMP . 'config.php')) {
		App::uses('ClassRegistry', 'Utility');
		ClassRegistry::init('Config.Config')->writeFile('config.php');
	}
}
if (file_exists(TMP . 'config.php')) {
	include (TMP . 'config.php');
	Configure::write($config);
}


text: <app-send-invite [organisationId]="organisationId" (done)="close($event)"></app-send-invite>


text:
package voot.provider;

import com.github.tomakehurst.wiremock.client.MappingBuilder;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StreamUtils;
import voot.AbstractTest;
import voot.model.Group;
import voot.model.Member;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.jupiter.api.Assertions.*;

class TeamsProviderClientTest extends AbstractTest {

    private TeamsProvider subject = new TeamsProviderClient(
            new Provider.Configuration(GroupProviderType.TEAMS, "http://localhost:8889",
                    new Provider.Configuration.Credentials("user", "password"),
                    2000, "test.surfteams.nl", "teams"));

    @Test
    public void isTeamsGroup() throws Exception {
        assertTrue(subject.isTeamsGroup("urn:collab:group:test.surfteams.nl:nl:surfnet:diensten:test-team"));
        assertFalse(subject.isTeamsGroup("urn:collab:group:example.org"));
        assertFalse(subject.isTeamsGroup(""));
    }

    @Test
    public void shouldBeQueriedForMemberships() throws Exception {
        assertTrue(subject.shouldBeQueriedForMemberships("whatever"));
    }

    @Test
    public void findByLocalGroupId() throws Exception {
        stubResponse("/group/nl:surfnet:diensten:test-team", "json/voot2/voot2_group.json");//"http://localhost:8971/user/test-team/groups"
        Optional<Group> groupOptional = subject.findByLocalGroupId("nl:surfnet:diensten:test-team");
        assertEquals("urn:collab:group:test.surfteams.nl:id3", groupOptional.get().id);
        assertEquals("teams", groupOptional.get().sourceID);
    }

    @Test
    public void findByLocalGroupId404() throws Exception {
        stubFor(get(urlEqualTo("/group/nl:surfnet:diensten:test-team"))
                .willReturn(aResponse().withStatus(404)));
        Optional<Group> groupOptional = subject.findByLocalGroupId("nl:surfnet:diensten:test-team");
        assertFalse(groupOptional.isPresent());
    }

    @Test
    public void linkedLocalTeamsGroup() throws Exception {
        stubResponse("/linked-locals", "json/voot2/voot2_groups.json");
        List<Group> groups = subject.linkedLocalTeamsGroup(Arrays.asList("urn:collab:group:avans:test-team", "urn:collab:group:avans:test-team-2"));
        assertEquals(2, groups.size());
    }

    @Test
    public void linkedExternalGroupIds() throws Exception {
        stubResponse("/linked-externals", "json/teams/external_team_ids.json");
        List<String> externalGroupIds = subject.linkedExternalGroupIds("urn:collab:group:avans:test-team");
        assertEquals(2, externalGroupIds.size());
    }

    @Test
    public void getAllGroups() throws Exception {
        stubResponse("/groups", "json/voot2/voot2_groups.json");
        List<Group> groups = subject.getAllGroups();
        assertEquals(2, groups.size());
    }

    @Test
    public void getMembers() throws Exception {
        stubResponse("/members/nl:surfnet:diensten:test-team", "json/teams/members.json");
        List<Member> members = subject.getMembers("nl:surfnet:diensten:test-team");
        assertEquals(2, members.size());
    }

    @Test
    public void getMembersWithMemberId() throws Exception {
        stubResponse("/members/nl:surfnet:diensten:test-team", "json/teams/members.json");
        List<Member> members = subject.getMembers("totally-ignored", "nl:surfnet:diensten:test-team");
        assertEquals(2, members.size());
    }

    private void stubResponse(String path, String fileName) throws IOException {
        InputStream inputStream = new ClassPathResource(fileName).getInputStream();
        String json = StreamUtils.copyToString(inputStream, Charset.defaultCharset());
        MappingBuilder mappingBuilder = get(urlPathEqualTo(path));
        stubFor(mappingBuilder.willReturn(
                aResponse().
                        withStatus(200).
                        withHeader("Content-type", "application/json").
                        withBody(json)
        ));
    }

}


text:
var express = require('express'),
    router = express.Router();

// Car brands page
router.get('/brands', function(req, res) {
  var brands = {
    brands: ['Audi', 'BMW', 'Mercedes']
  };

  res.send(brands);
});

module.exports = router;


text:
SyliusFixturesBundle [![Build status...](https://secure.travis-ci.org/Sylius/SyliusFixturesBundle.png?branch=master)](http://travis-ci.org/Sylius/SyliusFixturesBundle)
====================

Configurable fixtures for Symfony2 applications.

Sylius
------

**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.org).

Tests
-----

```bash
$ composer install
$ bin/phpspec run -f pretty
$ bin/phpunit --testdox
```

Documentation
-------------

Documentation is available on [**docs.sylius.org**](http://docs.sylius.org).

Contributing
------------

All informations about contributing to Sylius can be found on [this page](http://docs.sylius.org/en/latest/contributing/index.html).

Sylius twitter account
----------------------

If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/Sylius).

Bug tracking
------------

This bundle uses [GitHub issues](https://github.com/Sylius/Sylius/issues).
If you have found bug, please create an issue.

Versioning
----------

Releases will be numbered with the format `major.minor.patch`.

And constructed with the following guidelines.

* Breaking backwards compatibility bumps the major.
* New additions without breaking backwards compatibility bumps the minor.
* Bug fixes and misc changes bump the patch.

For more information on SemVer, please visit [semver.org website](http://semver.org/).
This versioning method is the same for all **Sylius** bundles and applications.

MIT License
-----------

License can be found [here](https://github.com/Sylius/SyliusFixturesBundle/blob/master/Resources/meta/LICENSE).

Authors
-------

The bundle was originally created by [Kamil Kokot](http://kamil.kokot.me).
See the list of [contributors](https://github.com/Sylius/SyliusFixturesBundle/contributors).


text:
package sarama

import (
	"context"
	"fmt"
	"log"
	"reflect"
	"sync"
	"sync/atomic"
	"testing"
	"time"
)

func TestFuncConsumerGroupPartitioning(t *testing.T) {
	checkKafkaVersion(t, "0.10.2")
	setupFunctionalTest(t)
	defer teardownFunctionalTest(t)

	groupID := testFuncConsumerGroupID(t)

	// start M1
	m1 := runTestFuncConsumerGroupMember(t, groupID, "M1", 0, nil)
	defer m1.Stop()
	m1.WaitForState(2)
	m1.WaitForClaims(map[string]int{"test.4": 4})
	m1.WaitForHandlers(4)

	// start M2
	m2 := runTestFuncConsumerGroupMember(t, groupID, "M2", 0, nil, "test.1", "test.4")
	defer m2.Stop()
	m2.WaitForState(2)

	// assert that claims are shared among both members
	m1.WaitForClaims(map[string]int{"test.4": 2})
	m1.WaitForHandlers(2)
	m2.WaitForClaims(map[string]int{"test.1": 1, "test.4": 2})
	m2.WaitForHandlers(3)

	// shutdown M1, wait for M2 to take over
	m1.AssertCleanShutdown()
	m2.WaitForClaims(map[string]int{"test.1": 1, "test.4": 4})
	m2.WaitForHandlers(5)

	// shutdown M2
	m2.AssertCleanShutdown()
}

func TestFuncConsumerGroupExcessConsumers(t *testing.T) {
	checkKafkaVersion(t, "0.10.2")
	setupFunctionalTest(t)
	defer teardownFunctionalTest(t)

	groupID := testFuncConsumerGroupID(t)

	// start members
	m1 := runTestFuncConsumerGroupMember(t, groupID, "M1", 0, nil)
	defer m1.Stop()
	m2 := runTestFuncConsumerGroupMember(t, groupID, "M2", 0, nil)
	defer m2.Stop()
	m3 := runTestFuncConsumerGroupMember(t, groupID, "M3", 0, nil)
	defer m3.Stop()
	m4 := runTestFuncConsumerGroupMember(t, groupID, "M4", 0, nil)
	defer m4.Stop()

	m1.WaitForClaims(map[string]int{"test.4": 1})
	m2.WaitForClaims(map[string]int{"test.4": 1})
	m3.WaitForClaims(map[string]int{"test.4": 1})
	m4.WaitForClaims(map[string]int{"test.4": 1})

	// start M5
	m5 := runTestFuncConsumerGroupMember(t, groupID, "M5", 0, nil)
	defer m5.Stop()
	m5.WaitForState(1)
	m5.AssertNoErrs()

	// assert that claims are shared among both members
	m4.AssertCleanShutdown()
	m5.WaitForState(2)
	m5.WaitForClaims(map[string]int{"test.4": 1})

	// shutdown everything
	m1.AssertCleanShutdown()
	m2.AssertCleanShutdown()
	m3.AssertCleanShutdown()
	m5.AssertCleanShutdown()
}

func TestFuncConsumerGroupFuzzy(t *testing.T) {
	checkKafkaVersion(t, "0.10.2")
	setupFunctionalTest(t)
	defer teardownFunctionalTest(t)

	if err := testFuncConsumerGroupFuzzySeed("test.4"); err != nil {
		t.Fatal(err)
	}

	groupID := testFuncConsumerGroupID(t)
	sink := &testFuncConsumerGroupSink{msgs: make(chan testFuncConsumerGroupMessage, 20000)}
	waitForMessages := func(t *testing.T, n int) {
		t.Helper()

		for i := 0; i < 600; i++ {
			if sink.Len() >= n {
				break
			}
			time.Sleep(100 * time.Millisecond)
		}
		if sz := sink.Len(); sz < n {
			log.Fatalf("expected to consume %d messages, but consumed %d", n, sz)
		}
	}

	defer runTestFuncConsumerGroupMember(t, groupID, "M1", 1500, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M2", 3000, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M3", 1500, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M4", 200, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M5", 100, sink).Stop()
	waitForMessages(t, 3000)

	defer runTestFuncConsumerGroupMember(t, groupID, "M6", 300, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M7", 400, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M8", 500, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M9", 2000, sink).Stop()
	waitForMessages(t, 8000)

	defer runTestFuncConsumerGroupMember(t, groupID, "M10", 1000, sink).Stop()
	waitForMessages(t, 10000)

	defer runTestFuncConsumerGroupMember(t, groupID, "M11", 1000, sink).Stop()
	defer runTestFuncConsumerGroupMember(t, groupID, "M12", 2500, sink).Stop()
	waitForMessages(t, 12000)

	defer runTestFuncConsumerGroupMember(t, groupID, "M13", 1000, sink).Stop()
	waitForMessages(t, 15000)

	if umap := sink.Close(); len(umap) != 15000 {
		dupes := make(map[string][]string)
		for k, v := range umap {
			if len(v) > 1 {
				dupes[k] = v
			}
		}
		t.Fatalf("expected %d unique messages to be consumed but got %d, including %d duplicates:\n%v", 15000, len(umap), len(dupes), dupes)
	}
}

// --------------------------------------------------------------------

func testFuncConsumerGroupID(t *testing.T) string {
	return fmt.Sprintf("sarama.%s%d", t.Name(), time.Now().UnixNano())
}

func testFuncConsumerGroupFuzzySeed(topic string) error {
	client, err := NewClient(kafkaBrokers, nil)
	if err != nil {
		return err
	}
	defer func() { _ = client.Close() }()

	total := int64(0)
	for pn := int32(0); pn < 4; pn++ {
		newest, err := client.GetOffset(topic, pn, OffsetNewest)
		if err != nil {
			return err
		}
		oldest, err := client.GetOffset(topic, pn, OffsetOldest)
		if err != nil {
			return err
		}
		total = total + newest - oldest
	}
	if total >= 21000 {
		return nil
	}

	producer, err := NewAsyncProducerFromClient(client)
	if err != nil {
		return err
	}
	for i := total; i < 21000; i++ {
		producer.Input() <- &ProducerMessage{Topic: topic, Value: ByteEncoder([]byte("testdata"))}
	}
	return producer.Close()
}

type testFuncConsumerGroupMessage struct {
	ClientID string
	*ConsumerMessage
}

type testFuncConsumerGroupSink struct {
	msgs  chan testFuncConsumerGroupMessage
	count int32
}

func (s *testFuncConsumerGroupSink) Len() int {
	if s == nil {
		return -1
	}
	return int(atomic.LoadInt32(&s.count))
}

func (s *testFuncConsumerGroupSink) Push(clientID string, m *ConsumerMessage) {
	if s != nil {
		s.msgs <- testFuncConsumerGroupMessage{ClientID: clientID, ConsumerMessage: m}
		atomic.AddInt32(&s.count, 1)
	}
}

func (s *testFuncConsumerGroupSink) Close() map[string][]string {
	close(s.msgs)

	res := make(map[string][]string)
	for msg := range s.msgs {
		key := fmt.Sprintf("%s-%d:%d", msg.Topic, msg.Partition, msg.Offset)
		res[key] = append(res[key], msg.ClientID)
	}
	return res
}

type testFuncConsumerGroupMember struct {
	ConsumerGroup
	clientID    string
	claims      map[string]int
	state       int32
	handlers    int32
	errs        []error
	maxMessages int32
	isCapped    bool
	sink        *testFuncConsumerGroupSink

	t  *testing.T
	mu sync.RWMutex
}

func runTestFuncConsumerGroupMember(t *testing.T, groupID, clientID string, maxMessages int32, sink *testFuncConsumerGroupSink, topics ...string) *testFuncConsumerGroupMember {
	t.Helper()

	config := NewConfig()
	config.ClientID = clientID
	config.Version = V0_10_2_0
	config.Consumer.Return.Errors = true
	config.Consumer.Offsets.Initial = OffsetOldest
	config.Consumer.Group.Rebalance.Timeout = 10 * time.Second

	group, err := NewConsumerGroup(kafkaBrokers, groupID, config)
	if err != nil {
		t.Fatal(err)
		return nil
	}

	if len(topics) == 0 {
		topics = []string{"test.4"}
	}

	member := &testFuncConsumerGroupMember{
		ConsumerGroup: group,
		clientID:      clientID,
		claims:        make(map[string]int),
		maxMessages:   maxMessages,
		isCapped:      maxMessages != 0,
		sink:          sink,
		t:             t,
	}
	go member.loop(topics)
	return member
}

func (m *testFuncConsumerGroupMember) AssertCleanShutdown() {
	m.t.Helper()

	if err := m.Close(); err != nil {
		m.t.Fatalf("unexpected error on Close(): %v", err)
	}
	m.WaitForState(4)
	m.WaitForHandlers(0)
	m.AssertNoErrs()
}

func (m *testFuncConsumerGroupMember) AssertNoErrs() {
	m.t.Helper()

	var errs []error
	m.mu.RLock()
	errs = append(errs, m.errs...)
	m.mu.RUnlock()

	if len(errs) != 0 {
		m.t.Fatalf("unexpected consumer errors: %v", errs)
	}
}

func (m *testFuncConsumerGroupMember) WaitForState(expected int32) {
	m.t.Helper()

	m.waitFor("state", expected, func() (interface{}, error) {
		return atomic.LoadInt32(&m.state), nil
	})
}

func (m *testFuncConsumerGroupMember) WaitForHandlers(expected int) {
	m.t.Helper()

	m.waitFor("handlers", expected, func() (interface{}, error) {
		return int(atomic.LoadInt32(&m.handlers)), nil
	})
}

func (m *testFuncConsumerGroupMember) WaitForClaims(expected map[string]int) {
	m.t.Helper()

	m.waitFor("claims", expected, func() (interface{}, error) {
		m.mu.RLock()
		claims := m.claims
		m.mu.RUnlock()
		return claims, nil
	})
}

func (m *testFuncConsumerGroupMember) Stop() { _ = m.Close() }

func (m *testFuncConsumerGroupMember) Setup(s ConsumerGroupSession) error {
	// store claims
	claims := make(map[string]int)
	for topic, partitions := range s.Claims() {
		claims[topic] = len(partitions)
	}
	m.mu.Lock()
	m.claims = claims
	m.mu.Unlock()

	// enter post-setup state
	atomic.StoreInt32(&m.state, 2)
	return nil
}
func (m *testFuncConsumerGroupMember) Cleanup(s ConsumerGroupSession) error {
	// enter post-cleanup state
	atomic.StoreInt32(&m.state, 3)
	return nil
}
func (m *testFuncConsumerGroupMember) ConsumeClaim(s ConsumerGroupSession, c ConsumerGroupClaim) error {
	atomic.AddInt32(&m.handlers, 1)
	defer atomic.AddInt32(&m.handlers, -1)

	for msg := range c.Messages() {
		if n := atomic.AddInt32(&m.maxMessages, -1); m.isCapped && n < 0 {
			break
		}
		s.MarkMessage(msg, "")
		m.sink.Push(m.clientID, msg)
	}
	return nil
}

func (m *testFuncConsumerGroupMember) waitFor(kind string, expected interface{}, factory func() (interface{}, error)) {
	m.t.Helper()

	deadline := time.NewTimer(60 * time.Second)
	defer deadline.Stop()

	ticker := time.NewTicker(100 * time.Millisecond)
	defer ticker.Stop()

	var actual interface{}
	for {
		var err error
		if actual, err = factory(); err != nil {
			m.t.Errorf("failed retrieve value, expected %s %#v but received error %v", kind, expected, err)
		}

		if reflect.DeepEqual(expected, actual) {
			return
		}

		select {
		case <-deadline.C:
			m.t.Fatalf("ttl exceeded, expected %s %#v but got %#v", kind, expected, actual)
			return
		case <-ticker.C:
		}
	}
}

func (m *testFuncConsumerGroupMember) loop(topics []string) {
	defer atomic.StoreInt32(&m.state, 4)

	go func() {
		for err := range m.Errors() {
			_ = m.Close()

			m.mu.Lock()
			m.errs = append(m.errs, err)
			m.mu.Unlock()
		}
	}()

	ctx := context.Background()
	for {
		// set state to pre-consume
		atomic.StoreInt32(&m.state, 1)

		if err := m.Consume(ctx, topics, m); err == ErrClosedConsumerGroup {
			return
		} else if err != nil {
			m.mu.Lock()
			m.errs = append(m.errs, err)
			m.mu.Unlock()
			return
		}

		// return if capped
		if n := atomic.LoadInt32(&m.maxMessages); m.isCapped && n < 0 {
			return
		}
	}
}


text:
// Copyright (c) Andrew Fischer. See LICENSE file for license terms.

#include "common_headers.h"

#include "block.h"
#include "building.h"
#include "code_iterators.h"
#include "control_flow.h"
#include "function.h"
#include "hashtable.h"
#include "kernel.h"
#include "inspection.h"
#include "list.h"
#include "loops.h"
#include "symbols.h"
#include "string_type.h"
#include "term.h"
#include "type.h"
#include "type_inference.h"

/*

When a for-loop is compiled to bytecode, here's what happens:

  for k,i in list
   <stuff>

compiles to:

  a = to_iter(list)
  for(a) {
    if a.done
      break
    k = a.key
    i = a.next

    a = a.advance
  }
*/

namespace circa {

Term* loop_find_iterator(Block* contents)
{
    for (int i=0; i < contents->length(); i++)
        if (contents->get(i)->function == FUNCS.loop_iterator)
            return contents->get(i);
    return NULL;
}

Term* loop_find_iterator_value(Block* block)
{
    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        if (term->boolProp(s_iterator_value, false))
            return term;
    }
    return NULL;
}

Term* loop_find_done_call(Block* block)
{
    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        Value* methodName = term->getProp(s_method_name);
        if (methodName && string_equals(methodName, "done"))
            return term;
    }
    return NULL;
}

Term* loop_find_key(Block* block)
{
    Term* iterator = loop_find_iterator(block);
    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        if (term->input(0) != iterator)
            continue;
        Value* methodName = term->getProp(s_method_name);
        if (methodName && string_equals(methodName, "key"))
            return term;
    }
    return NULL;
}

Term* loop_find_iterator_advance(Block* block)
{
    Term* iterator = loop_find_iterator(block);
    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        if (term->input(0) != iterator)
            continue;
        Value* methodName = term->getProp(s_method_name);
        if (methodName && string_equals(methodName, "advance"))
            return term;
    }
    return NULL;
}

const char* for_loop_get_iterator_name(Term* forTerm)
{
    Term* iterator = loop_find_iterator_value(nested_contents(forTerm));
    if (iterator == NULL)
        return "";

    return iterator->name();
}

Block* get_for_loop_outer_rebinds(Term* forTerm)
{
    Block* contents = nested_contents(forTerm);
    return contents->getFromEnd(0)->contents();
}

void start_building_for_loop(Block* contents, Term* listExpr, Value* indexName,
    Value* elementName, Type* iteratorType)
{
    Term* iterator = apply(contents, FUNCS.loop_iterator, TermList(listExpr));

    Term* done = apply_dynamic_method(contents, s_done, TermList(iterator));
    hide_from_source(done);

    Term* getKey = apply_dynamic_method(contents, s_key, TermList(iterator));
    hide_from_source(getKey);

    if (!is_null(indexName)) {
        Term* getIndex = apply_dynamic_method(contents, s_key, TermList(iterator), indexName);
        hide_from_source(getIndex);
    }

    Term* getCurrent = apply_dynamic_method(contents, s_current, TermList(iterator), elementName);
    getCurrent->setBoolProp(s_iterator_value, true);
    hide_from_source(getCurrent);

    if (iteratorType != NULL) {
        Term* castedValue = apply(contents, FUNCS.cast,
            TermList(getCurrent, iteratorType->declaringTerm), elementName);
    }
}

void list_names_that_must_be_looped(Block* contents, Value* names)
{
    // Find all names within 'contents' that must be looped. A name must be looped when
    // a term inside the loop binds a name that was already used outside the loop.

    Value namesMap;
    set_hashtable(&namesMap);

    for (BlockIteratorFlat it(contents); it; ++it) {
        Term* term = it.current();

        if (has_empty_name(term))
            continue;

        Value termVal;
        termVal.set_term(contents->owningTerm);
        Term* outsideName = find_name_at(&termVal, term_name(term));

        // Don't look at names outside the major block.
        if (outsideName != NULL && !is_under_same_major_block(term, outsideName))
            outsideName = NULL;

        if (outsideName != NULL)
            set_bool(hashtable_insert(&namesMap, term_name(term)), true);
    }

    hashtable_get_keys(&namesMap, names);
    list_sort(names, NULL, NULL);
}

void insert_looped_placeholders(Block* contents)
{
    Value names;
    list_names_that_must_be_looped(contents, &names);

    for (ListIterator it(&names); it; ++it) {
        Term* inputPlaceholder = append_input_placeholder(contents);
        Value* name = it.value();
        rename(inputPlaceholder, name);
        Value owningTermVal;
        owningTermVal.set_term(contents->owningTerm);
        Term* outsideTerm = find_name_at(&owningTermVal, name);
        Term* innerResult = find_local_name(contents, name);
        Term* outputPlaceholder = append_output_placeholder(contents, innerResult);
        rename(outputPlaceholder, name);

        set_inputs(inputPlaceholder, TermList(outsideTerm, outputPlaceholder));

        for (BlockInputIterator it(contents); it; ++it) {
            Term* term = it.currentTerm();
            if (it.currentInput() == outsideTerm && term != inputPlaceholder)
                set_input(term, it.currentInputIndex(), inputPlaceholder);
        }
    }
}

void list_names_that_should_be_used_as_minor_block_output(Block* block, Value* names)
{
    Value namesMap;
    set_hashtable(&namesMap);
}

// Find the term that should be the 'primary' result for this loop.
Term* loop_get_primary_result(Block* block)
{
    Term* iterator = loop_find_iterator_value(block);

    // For a rebound list, use the last term that has the iterator's
    // name.
    if (block->owningTerm->boolProp(s_ModifyList, false)) {
        Term* term = block->get(iterator->name());
        if (term != NULL)
            return term;
    }

    // Otherwise, use the last expression as the output.
    return find_expression_for_implicit_output(block);
}

void finish_while_loop(Block* block)
{
    block_finish_changes(block);

    // Add a a primary output
    apply(block, FUNCS.output, TermList(NULL));

    // Add looped_inputs
    insert_looped_placeholders(block);

    update_extra_outputs(block->owningTerm, block);
    update_for_control_flow(block);

    block_finish_changes(block);
}

void finish_for_loop(Term* forTerm)
{
    Block* block = nested_contents(forTerm);

    // Need to finish here to prevent error
    block_finish_changes(block);

    Term* primaryResult = loop_get_primary_result(block);

    Term* iterator = loop_find_iterator(block);
    Term* nextCall = apply_dynamic_method(block, s_advance, TermList(iterator));
    hide_from_source(nextCall);

    // Add a a primary output
    Term* primaryOutput = apply(block, FUNCS.output, TermList(primaryResult));
    primaryOutput->setBoolProp(s_AccumulatingOutput, true); // TODO: can delete?
    respecialize_type(primaryOutput);

    insert_looped_placeholders(block);

    update_extra_outputs(forTerm, block);

    block_finish_changes(block);
}

Term* find_enclosing_for_loop(Term* location)
{
    while (location != NULL && location->function != FUNCS.for_func)
        location = parent_term(location);
    return location;
}

Block* find_enclosing_for_loop_contents(Term* term)
{
    Term* loop = find_enclosing_for_loop(term);
    if (loop == NULL)
        return NULL;
    return nested_contents(loop);
}

bool loop_produces_output_value(Term* forTerm)
{
    ca_assert(forTerm->function == FUNCS.for_func);
    return user_count(forTerm) > 0;
}
bool enclosing_loop_produces_output_value(Term* term)
{
    Term* enclosingForLoop = find_enclosing_for_loop(term);
    if (enclosingForLoop == NULL)
        return false;
    return loop_produces_output_value(enclosingForLoop);
}

void loop_add_condition_check(Block* caseBlock, Term* condition)
{
    apply(caseBlock, FUNCS.loop_condition_bool, TermList(condition));
}

Term* loop_find_condition_check(Block* block)
{
    for (int i=0; i < block->length(); i++) {
        Term* term = block->get(i);
        if (term->function == FUNCS.loop_condition_bool)
            return term;
    }
    return NULL;
}

Term* loop_find_condition(Block* block)
{
    Term* conditionCheck = loop_find_condition_check(block);
    if (conditionCheck != NULL)
        return conditionCheck->input(0);
    return NULL;
}

} // namespace circa


text:
<!DOCTYPE html>

  <title>background-size: 64px 40px; repeat, zoom reference</title>


text:
namespace wsiToDicomConverter {

class DcmtkUtils {
 public:
  // Generates DICOM file based on outputFileName
  // imageHeight, imageWidth - size of complete image
  // rowSize - how many frames in one row of this image
  // studyId, seriesId, imageName - required DICOM metadata
  // pixelData - pixel data, requre transfer of ownership
  // imgInfo - image metadata
  // numberOfFrames - how many frames in this file
  // row, column - position to start
  // level - which level represent this file
  // batchNumber - index number of this file for one level
  // offset - how many frames where already generated
  //          for this level
  // totalNumberOfFrames - how many frames in this level
  // tiled - frame organizationtype
  //           true:TILED_FULL
  //           false:TILED_SPARSE
  // additionalTags - additional DICOM metadata
  // firstLevelWidthMm, firstLevelHeightMm - physical size
  // of first level
  static OFCondition startConversion(
      int64_t imageHeight, int64_t imageWidth, uint32_t rowSize,
      absl::string_view studyId, absl::string_view seriesId,
      absl::string_view imageName, std::unique_ptr<DcmPixelData> pixelData,
      const DcmtkImgDataInfo& imgInfo, uint32_t numberOfFrames, uint32_t row,
      uint32_t column, const int32_t instanceNumber, const int32_t downsample,
      int batchNumber, unsigned int offset, uint32_t totalNumberOfFrames,
      bool tiled, DcmTags* additionalTags, double firstLevelWidthMm,
      double firstLevelHeightMm, DcmOutputStream* outStream);

  // Wrapper for startConversion without additional parameters.
  static OFCondition startConversion(
      int64_t imageHeight, int64_t imageWidth, uint32_t rowSize,
      absl::string_view studyId, absl::string_view seriesId,
      absl::string_view imageName, std::unique_ptr<DcmPixelData> pixelData,
      const DcmtkImgDataInfo& imgInfo, uint32_t numberOfFrames, uint32_t row,
      uint32_t column, int32_t instanceNumber, int32_t downsample,
      int batchNumber, uint32_t offset, uint32_t totalNumberOfFrames,
      bool tiled, DcmOutputStream* outStream);

  // Generates DICOM file object.
  static OFCondition populateDataSet(
      const int64_t imageHeight, const int64_t imageWidth,
      const uint32_t rowSize, absl::string_view studyId,
      absl::string_view seriesId, absl::string_view imageName,
      std::unique_ptr<DcmPixelData> pixelData, const DcmtkImgDataInfo& imgInfo,
      const uint32_t numberOfFrames, const uint32_t row, const uint32_t column,
      const int32_t instanceNumber, const int32_t downsample,
      const int batchNumber, const uint32_t offset,
      const uint32_t totalNumberOfFrames, const bool tiled,
      DcmTags* additionalTags, const double firstLevelWidthMm,
      const double firstLevelHeightMm, DcmDataset* dataSet);

  // Inserts current date/time into DCM_ContentDate/Time.
  static OFCondition generateDateTags(DcmDataset* dataSet);

  // Inserts which is same for pathology DICOMs.
  static OFCondition insertStaticTags(DcmDataset* dataSet, int downsample);
  // Inserts studyId and seriesId by params and generated instanceId.
  static OFCondition insertIds(absl::string_view studyId,
                               absl::string_view seriesId,
                               DcmDataset* dataSet);
  // Inserts tags related to base image.
  static OFCondition insertBaseImageTags(absl::string_view imageName,
                                         const int64_t imageHeight,
                                         const int64_t imageWidth,
                                         const double firstLevelWidthMm,
                                         const double firstLevelHeightMm,
                                         DcmDataset* dataSet);
  // Inserts tags which is required for multi frame DICOM.
  static OFCondition insertMultiFrameTags(
      const DcmtkImgDataInfo& imgInfo, const uint32_t numberOfFrames,
      const uint32_t rowSize, const uint32_t row, const uint32_t column,
      const int instanceNumber, const int batchNumber, const uint32_t offset,
      const uint32_t totalNumberOfFrames, const bool tiled,
      absl::string_view seriesId, DcmDataset* dataSet);
};
}  // namespace wsiToDicomConverter
#endif  // SRC_DCMTKUTILS_H_


text:
package konstructs.tools

import java.util.UUID
import akka.actor.{Actor, Props, ActorRef}
import konstructs.plugin.PluginConstructor
import konstructs.KonstructingViewActor
import konstructs.api._
import konstructs.api.messages._
import konstructs.plugin.toolsack.ToolSackActor

class WorkTableActor(universe: ActorRef) extends Actor {
  import WorkTableActor._

  def receive = {
    case f: InteractTertiaryFilter =>
      f.getMessage match {
        case i: InteractTertiary
            if i.isWorldPhase && i.getBlockAtPosition != null && i.getBlockAtPosition.getType == BlockId =>
          if (i.getBlock != null && i.getBlock.getType == ToolSackActor.BlockId && i.getBlock.getId() != null) {
            context.actorOf(
              KonstructingViewActor
                .props(i.getSender, universe, i.getBlock.getId, ToolSackActor.SackView, KonstructingView, ResultView))
          } else {
            context.actorOf(
              KonstructingViewActor.props(i.getSender, universe, null, EmptyView, KonstructingView, ResultView))
          }
          f.skip(self)
        case _ =>
          f.next(self)
      }
  }
}

object WorkTableActor {
  val BlockId = new BlockTypeId("org/konstructs", "work-table")
  val EmptyView = new InventoryView(0, 0, 0, 0)
  val KonstructingView = new InventoryView(9, 4, 3, 3)
  val ResultView = new InventoryView(11, 9, 1, 1)

  @PluginConstructor
  def props(name: String, universe: ActorRef) = Props(classOf[WorkTableActor], universe)

}


text:
this = File.expand_path(File.dirname(__FILE__))

require "#{this}/acts_as_taggable_on_forms/form_extensions"
#require "#{this}/acts_as_taggable_on_forms/_tag_field.html.erb"

ActionView::Helpers::FormBuilder.send(:include, ActsAsTaggableOnForms::FormExtensions)


text:
<?php

/**
 * Create order form header
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Adminhtml_Block_Sales_Order_Create_Header extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
{
    protected function _toHtml()
    {
        if ($this->_getSession()->getOrder()->getId()) {
            return '
'.Mage::helper('sales')->__('Edit Order #%s', $this->_getSession()->getOrder()->getIncrementId()).'
';
        }

        $customerId = $this->getCustomerId();
        $storeId    = $this->getStoreId();
        $out = '';
        if ($customerId && $storeId) {
            $out.= Mage::helper('sales')->__('Create New Order for %s in %s', $this->getCustomer()->getName(), $this->getStore()->getName());
        }
        elseif (!is_null($customerId) && $storeId){
            $out.= Mage::helper('sales')->__('Create New Order for New Customer in %s', $this->getStore()->getName());
        }
        elseif ($customerId) {
            $out.= Mage::helper('sales')->__('Create New Order for %s', $this->getCustomer()->getName());
        }
        elseif (!is_null($customerId)){
            $out.= Mage::helper('sales')->__('Create New Order for New Customer');
        }
        else {
            $out.= Mage::helper('sales')->__('Create New Order');
        }
        $out = $this->htmlEscape($out);
        $out = '
' . $out . '
';
        return $out;
    }
}


text:
package org.araqne.logdb.sort;

public class SortedRunRange {
	private SortedRun run;
	private int from;
	private int to;

	public SortedRunRange() {
	}

	public SortedRunRange(SortedRun run, int from, int to) {
		this.run = run;
		this.from = from;
		this.to = to;
	}

	public SortedRun getRun() {
		return run;
	}

	public void setRun(SortedRun run) {
		this.run = run;
	}

	public int getFrom() {
		return from;
	}

	public void setFrom(int from) {
		this.from = from;
	}

	public int getTo() {
		return to;
	}

	public void setTo(int to) {
		this.to = to;
	}

	public int length() {
		return to - from + 1;
	}

	@Override
	public String toString() {
		return "[#" + run + ", from=" + from + ", to=" + to + "]";
	}

}


text:
package nxt.http;

import nxt.Constants;
import nxt.CurrencyType;
import nxt.Genesis;
import nxt.MonetarySystem;
import nxt.TransactionType;
import nxt.util.Convert;
import nxt.util.JSON;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONStreamAware;

import javax.servlet.http.HttpServletRequest;

public final class GetConstants extends APIServlet.APIRequestHandler {

    static final GetConstants instance = new GetConstants();

    private static final JSONStreamAware CONSTANTS;

    static {

        JSONObject response = new JSONObject();
        response.put("genesisBlockId", Convert.toUnsignedLong(Genesis.GENESIS_BLOCK_ID));
        response.put("genesisAccountId", Convert.toUnsignedLong(Genesis.CREATOR_ID));
        response.put("maxBlockPayloadLength", Constants.MAX_PAYLOAD_LENGTH);
        response.put("maxArbitraryMessageLength", Constants.MAX_ARBITRARY_MESSAGE_LENGTH);

        JSONArray transactionTypes = new JSONArray();
        JSONObject transactionType = new JSONObject();
        transactionType.put("value", TransactionType.Payment.ORDINARY.getType());
        transactionType.put("description", "Payment");
        JSONArray subtypes = new JSONArray();
        JSONObject subtype = new JSONObject();
        subtype.put("value", TransactionType.Payment.ORDINARY.getSubtype());
        subtype.put("description", "Ordinary payment");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        transactionType = new JSONObject();
        transactionType.put("value", TransactionType.Messaging.ARBITRARY_MESSAGE.getType());
        transactionType.put("description", "Messaging");
        subtypes = new JSONArray();
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ARBITRARY_MESSAGE.getSubtype());
        subtype.put("description", "Arbitrary message");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ALIAS_ASSIGNMENT.getSubtype());
        subtype.put("description", "Alias assignment");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ALIAS_SELL.getSubtype());
        subtype.put("description", "Alias sell");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ALIAS_BUY.getSubtype());
        subtype.put("description", "Alias buy");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ALIAS_DELETE.getSubtype());
        subtype.put("description", "Alias delete");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.POLL_CREATION.getSubtype());
        subtype.put("description", "Poll creation");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.VOTE_CASTING.getSubtype());
        subtype.put("description", "Vote casting");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.HUB_ANNOUNCEMENT.getSubtype());
        subtype.put("description", "Hub terminal announcement");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.Messaging.ACCOUNT_INFO.getSubtype());
        subtype.put("description", "Account info");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        transactionType = new JSONObject();
        transactionType.put("value", TransactionType.ColoredCoins.ASSET_ISSUANCE.getType());
        transactionType.put("description", "Colored coins");
        subtypes = new JSONArray();
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.ASSET_ISSUANCE.getSubtype());
        subtype.put("description", "Asset issuance");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.ASSET_TRANSFER.getSubtype());
        subtype.put("description", "Asset transfer");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.ASK_ORDER_PLACEMENT.getSubtype());
        subtype.put("description", "Ask order placement");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.BID_ORDER_PLACEMENT.getSubtype());
        subtype.put("description", "Bid order placement");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.ASK_ORDER_CANCELLATION.getSubtype());
        subtype.put("description", "Ask order cancellation");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.BID_ORDER_CANCELLATION.getSubtype());
        subtype.put("description", "Bid order cancellation");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.ColoredCoins.DIVIDEND_PAYMENT.getSubtype());
        subtype.put("description", "Dividend payment");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        transactionType = new JSONObject();
        transactionType.put("value", TransactionType.DigitalGoods.LISTING.getType());
        transactionType.put("description", "Digital goods");
        subtypes = new JSONArray();
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.LISTING.getSubtype());
        subtype.put("description", "Listing");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.DELISTING.getSubtype());
        subtype.put("description", "Delisting");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.PRICE_CHANGE.getSubtype());
        subtype.put("description", "Price change");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.QUANTITY_CHANGE.getSubtype());
        subtype.put("description", "Quantity change");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.PURCHASE.getSubtype());
        subtype.put("description", "Purchase");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.DELIVERY.getSubtype());
        subtype.put("description", "Delivery");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.FEEDBACK.getSubtype());
        subtype.put("description", "Feedback");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", TransactionType.DigitalGoods.REFUND.getSubtype());
        subtype.put("description", "Refund");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        transactionType = new JSONObject();
        transactionType.put("value", TransactionType.AccountControl.EFFECTIVE_BALANCE_LEASING.getType());
        transactionType.put("description", "Account Control");
        subtypes = new JSONArray();
        subtype = new JSONObject();
        subtype.put("value", TransactionType.AccountControl.EFFECTIVE_BALANCE_LEASING.getSubtype());
        subtype.put("description", "Effective balance leasing");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        transactionType = new JSONObject();
        transactionType.put("value", MonetarySystem.CURRENCY_ISSUANCE.getType());
        transactionType.put("description", "Monetary System");
        subtypes = new JSONArray();
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.CURRENCY_ISSUANCE.getSubtype());
        subtype.put("description", "Currency issuance");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.RESERVE_INCREASE.getSubtype());
        subtype.put("description", "Reserve increase");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.RESERVE_CLAIM.getSubtype());
        subtype.put("description", "Reserve claim");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.CURRENCY_TRANSFER.getSubtype());
        subtype.put("description", "Currency transfer");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.PUBLISH_EXCHANGE_OFFER.getSubtype());
        subtype.put("description", "Publish exchange offer");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.EXCHANGE_BUY.getSubtype());
        subtype.put("description", "Exchange buy");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.EXCHANGE_SELL.getSubtype());
        subtype.put("description", "Exchange sell");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.CURRENCY_MINTING.getSubtype());
        subtype.put("description", "Currency minting");
        subtypes.add(subtype);
        subtype = new JSONObject();
        subtype.put("value", MonetarySystem.CURRENCY_DELETION.getSubtype());
        subtype.put("description", "Currency deletion");
        subtypes.add(subtype);
        transactionType.put("subtypes", subtypes);
        transactionTypes.add(transactionType);
        response.put("transactionTypes", transactionTypes);

        JSONArray currencyTypes = new JSONArray();
        for (CurrencyType currencyType : CurrencyType.values()) {
            JSONObject typeJSON = new JSONObject();
            typeJSON.put(currencyType.toString(), currencyType.getCode());
            currencyTypes.add(typeJSON);
        }
        response.put("currencyTypes", currencyTypes);

        JSONArray peerStates = new JSONArray();
        JSONObject peerState = new JSONObject();
        peerState.put("value", 0);
        peerState.put("description", "Non-connected");
        peerStates.add(peerState);
        peerState = new JSONObject();
        peerState.put("value", 1);
        peerState.put("description", "Connected");
        peerStates.add(peerState);
        peerState = new JSONObject();
        peerState.put("value", 2);
        peerState.put("description", "Disconnected");
        peerStates.add(peerState);
        response.put("peerStates", peerStates);

        CONSTANTS = JSON.prepare(response);

    }

    private GetConstants() {
        super(new APITag[] {APITag.INFO});
    }

    @Override
    JSONStreamAware processRequest(HttpServletRequest req) {
        return CONSTANTS;
    }

}


text:
.p-steps {
    position: relative;
}

.p-steps ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
    display: flex;
}

.p-steps-item {
    position: relative;
    display: flex;
    justify-content: center;
    flex: 1 1 auto;
}

.p-steps-item .p-menuitem-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    text-decoration: none;
}

.p-steps.p-steps-readonly .p-steps-item {
    cursor: auto;
}

.p-steps-item.p-steps-current .p-menuitem-link {
    cursor: default;
}

.p-steps-title {
    white-space: nowrap;
}

.p-steps-number {
    display: flex;
    align-items: center;
    justify-content: center;
}

.p-steps-title {
    display: block;
}


text:
import os.path
from datetime import datetime

from fabric.api import env, hosts
from fabric.context_managers import settings
from fabric.decorators import task
from fabric.operations import local

from lib import *

# This script provides tasks to build a new development environment or
# deploy to production. It is simple. It should include the following:
#
#   - a task to build staging and run tests
#   - a task to push a tarball of code from staging to production
#   - pulling production passwords in from a different repo so prod
#     passwords can remain separate from the main codebase
#   - consider disabling the site (display an upgrade banner) to take the
#     site off line before backing up the db and applying migrations.
#
# See http://www.slideshare.net/lemonad/django-deployment-with-fabric for
# more information/ideas.
#

# path to git repository
env.repo_path = 'git://github.com/boosh/pwlocker.git'

# get the project name, e.g. healthcms
env.project_name = os.path.basename(os.path.dirname(env.real_fabfile))

# the virtualenv directory name
env.venv_dir = 'venv'

# where all projects are stored on production servers
env.production_projects_directory = 'projects'

# directory to copy database backups to
env.database_backup_dir = '/root/db_backups'

# @todo - add a task to download a backup of the production db

@task
@hosts('localhost')
def build():
    """
    Build a local development environment.
    """
    # where the .git directory is
    env.project_root = os.path.realpath(os.path.join(
        env.real_fabfile, '..', '..'))

    __build_env_dictionary()

    create_virtualenv(env.virtualenv_dir, env.user)
    install_pip_dependencies(env.requirements_path)
    git_init_submodules(env.project_root)
    django_syncdb(env.project_dir)
    django_migrate_schema(env.project_dir)
    django_load_fixture(env.project_dir, 'fixtures/initial_data.json')
    puts(success="Build finished")

@task
def deploy():
    """
    Deploy site to production.

    @todo - make it keep track of the number of deploys/db backups
      so it doesn't end up creating hundreds by mistake

    @todo - Extend this so it will provision new servers by:
       - installing nginx
       - installing supervisord
       - uploading base configurations using files.upload_template
       - creating links in /etc/nginx/conf.d to the project config file
       - doing the same for supervisord
    """
    timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
    env.user = 'deploy'

    # where the .git directory is
    env.project_root = os.path.realpath(os.path.join(
        '/home', env.user, env.production_projects_directory,
        env.project_name, timestamp))

    __build_env_dictionary()

    git_clone(env.repo_path, env.project_root, env.user)
    git_init_submodules(env.project_root)

    create_virtualenv(env.virtualenv_dir, env.user)
    # if we need to install PIL, we need to do it ourselves. It must be
    # installed and patched otherwise we won't have JPEG or PNG support
    conditionally_install_and_patch_pil(env.requirements_path,
        env.virtualenv_dir, os.path.join(env.fab_dir, 'PIL.setup.py.diff'))

    install_pip_dependencies(env.requirements_path)
    compile_less_css(env.project_dir)

    # from this point on, we're making changes that will affect the live site
# perhaps we should display a banner to disable the site while we perform a
# backup and migration...
#    django_syncdb(env.project_dir, True)
#    django_migrate_schema(env.project_dir, True)
    django_sync_and_migrate(env.project_dir, True)
    django_load_fixture(env.project_dir, 'fixtures/initial_data.json')

    django_publish_static_content(env.project_dir)
    roll_site_forward(os.path.dirname(env.project_root))
    restart_services()
    prune_directory(os.path.dirname(env.project_root), 2, 10)
    puts(success="Deployment finished")

@task
def in_place_deploy():
    """
    Update an existing production deployment of the site.

    Code will be updated, but dependencies will not be reinstalled.

    @todo - make it keep track of the number of deploys/db backups
      so it doesn't end up creating hundreds by mistake

    @todo - Extend this so it will provision new servers by:
       - installing nginx
       - installing supervisord
       - uploading base configurations using files.upload_template
       - creating links in /etc/nginx/conf.d to the project config file
       - doing the same for supervisord
    """
    env.user = 'deploy'

    # where the .git directory is
    env.project_root = os.path.realpath(os.path.join(
        '/home', env.user, env.production_projects_directory,
        env.project_name, 'live'))

    __build_env_dictionary()

    git_pull(env.project_root)

    compile_less_css(env.project_dir)

    # from this point on, we're making changes that will affect the live site
# perhaps we should display a banner to disable the site while we perform a
# backup and migration...
    django_sync_and_migrate(env.project_dir, True)
#    django_syncdb(env.project_dir, True)
#    django_migrate_schema(env.project_dir, True)

    django_publish_static_content(env.project_dir)
    restart_services()
    puts(success="In-place deployment finished")

def __build_env_dictionary():
    """
    Builds the env dictionary. Everything is relative to the project directory
    (which contains the .git directory).
    """
    # where the manage.py script is
    env.project_dir = os.path.join(env.project_root, env.project_name)

    # the root of the virtualenv
    env.virtualenv_dir = os.path.join(env.project_root, env.venv_dir)

    # the directory containing the requirements file and PIL setup diff
    env.fab_dir = os.path.join(env.project_dir,
        os.path.basename(env.real_fabfile))

    # path to pip's requirements file
    env.requirements_path = os.path.join(env.fab_dir, 'requirements.txt')


text:
var db = require('../db')
var session = db.Schema({
	user: {
		type: db.Schema.Types.ObjectId,
		ref: 'UA_User',
		required: true
	},
	token: {
		type: String,
		required: true
	},
	started: {
		type: Date,
		required: true,
		default: Date.now
	},
	permanent: {
		type: Boolean,
		required: true,
		default: false
	}
})
module.exports = db.model('UA_Session', session)


text:
package storage

type GCP struct {
	ServiceAccountKey string `json:"-"`
	// ideally we could get rid of ServiceAccountKeyPath,
	// but this is how we are passing the key along to terraform
	// ... we had trouble getting it to work with HEREDOC in go
	ServiceAccountKeyPath string   `json:"-"`
	ProjectID             string   `json:"-"`
	Zone                  string   `json:"zone"`
	Region                string   `json:"region"`
	Zones                 []string `json:"zones"`
}

func (g GCP) Empty() bool {
	return g.ServiceAccountKey == "" && g.ProjectID == "" && g.Region == "" && g.Zone == ""
}


text:
package b3m.application.scanner;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

/**
 * Created by florent on 13/10/13.
 */
public class CommandeChooseDialog extends DialogFragment {
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        // Use the Builder class for convenient dialog construction
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(R.string.choose_commande);
        // Create the AlertDialog object and return it
        return builder.create();
    }
}


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

<title>AutoNumberingScheme (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV CLASS

NEXT CLASS

FRAMES

NO FRAMES

All Classes

SUMMARY:

NESTED |

ENUM CONSTANTS |

FIELD |

METHOD

DETAIL:

ENUM CONSTANTS |

FIELD |

METHOD

org.apache.poi.sl.usermodel

Enum AutoNumberingScheme

java.lang.Object

java.lang.Enum<AutoNumberingScheme>

org.apache.poi.sl.usermodel.AutoNumberingScheme

All Implemented Interfaces:

java.io.Serializable, java.lang.Comparable<AutoNumberingScheme>

public enum AutoNumberingScheme
extends java.lang.Enum<AutoNumberingScheme>

Enum Constant Summary

Enum Constants

Enum Constant and Description

alphaLcParenBoth

Lowercase alphabetic character enclosed in parentheses.

alphaLcParenRight

Lowercase alphabetic character followed by a closing parenthesis.

alphaLcPeriod

Lowercase Latin character followed by a period.

alphaUcParenBoth

Uppercase alphabetic character enclosed in parentheses.

alphaUcParenRight

Uppercase alphabetic character followed by a closing parenthesis.

alphaUcPeriod

Uppercase Latin character followed by a period.

arabic1Minus

Bidi Arabic 1 (AraAlpha) with ANSI minus symbol.

arabic2Minus

Bidi Arabic 2 (AraAbjad) with ANSI minus symbol.

arabicDbPeriod

Double-byte Arabic numbers with double-byte period.

arabicDbPlain

Double-byte Arabic numbers.

arabicParenBoth

Arabic numeral enclosed in parentheses.

arabicParenRight

Arabic numeral followed by a closing parenthesis.

arabicPeriod

Arabic numeral followed by a period.

arabicPlain

Arabic numeral.

circleNumDbPlain

Double byte circle numbers.

circleNumWdBlackPlain

Wingdings black circle numbers.

circleNumWdWhitePlain

Wingdings white circle numbers.

ea1ChsPeriod

Simplified Chinese with single-byte period.

ea1ChsPlain

Simplified Chinese.

ea1ChtPeriod

Traditional Chinese with single-byte period.

ea1ChtPlain

Traditional Chinese.

ea1JpnChsDbPeriod

Japanese with double-byte period.

ea1JpnKorPeriod

Japanese/Korean with single-byte period.

ea1JpnKorPlain

Japanese/Korean.

hebrew2Minus

Bidi Hebrew 2 with ANSI minus symbol.

hindiAlpha1Period

Hindi alphabetic character followed by a period.

hindiAlphaPeriod

Hindi alphabetic character followed by a period.

hindiNumParenRight

Hindi numeric character followed by a closing parenthesis.

hindiNumPeriod

Hindi numeric character followed by a period.

romanLcParenBoth

Lowercase Roman numeral enclosed in parentheses.

romanLcParenRight

Lowercase Roman numeral followed by a closing parenthesis.

romanLcPeriod

Lowercase Roman numeral followed by a period.

romanUcParenBoth

Uppercase Roman numeral enclosed in parentheses.

romanUcParenRight

Uppercase Roman numeral followed by a closing parenthesis.

romanUcPeriod

Uppercase Roman numeral followed by a period.

thaiAlphaParenBoth

Thai alphabetic character enclosed by parentheses.

thaiAlphaParenRight

Thai alphabetic character followed by a closing parenthesis.

thaiAlphaPeriod

Thai alphabetic character followed by a period.

thaiNumParenBoth

Thai numeral enclosed in parentheses.

thaiNumParenRight

Thai numeral followed by a closing parenthesis.

thaiNumPeriod

Thai numeral followed by a period.

Field Summary

Fields

Modifier and Type
Field and Description

int
nativeId

int
ooxmlId

Method Summary

Methods

Modifier and Type
Method and Description

java.lang.String
format(int value)

static AutoNumberingScheme
forNativeID(int nativeId)

static AutoNumberingScheme
forOoxmlID(int ooxmlId)

java.lang.String
getDescription()

static AutoNumberingScheme
valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.

static AutoNumberingScheme[]
values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Methods inherited from class java.lang.Enum

clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Enum Constant Detail

alphaLcParenBoth

public static final AutoNumberingScheme alphaLcParenBoth

Lowercase alphabetic character enclosed in parentheses. Example: (a), (b), (c), ...

alphaUcParenBoth

public static final AutoNumberingScheme alphaUcParenBoth

Uppercase alphabetic character enclosed in parentheses. Example: (A), (B), (C), ...

alphaLcParenRight

public static final AutoNumberingScheme alphaLcParenRight

Lowercase alphabetic character followed by a closing parenthesis. Example: a), b), c), ...

alphaUcParenRight

public static final AutoNumberingScheme alphaUcParenRight

Uppercase alphabetic character followed by a closing parenthesis. Example: A), B), C), ...

alphaLcPeriod

public static final AutoNumberingScheme alphaLcPeriod

Lowercase Latin character followed by a period. Example: a., b., c., ...

alphaUcPeriod

public static final AutoNumberingScheme alphaUcPeriod

Uppercase Latin character followed by a period. Example: A., B., C., ...

arabicParenBoth

public static final AutoNumberingScheme arabicParenBoth

Arabic numeral enclosed in parentheses. Example: (1), (2), (3), ...

arabicParenRight

public static final AutoNumberingScheme arabicParenRight

Arabic numeral followed by a closing parenthesis. Example: 1), 2), 3), ...

arabicPeriod

public static final AutoNumberingScheme arabicPeriod

Arabic numeral followed by a period. Example: 1., 2., 3., ...

arabicPlain

public static final AutoNumberingScheme arabicPlain

Arabic numeral. Example: 1, 2, 3, ...

romanLcParenBoth

public static final AutoNumberingScheme romanLcParenBoth

Lowercase Roman numeral enclosed in parentheses. Example: (i), (ii), (iii), ...

romanUcParenBoth

public static final AutoNumberingScheme romanUcParenBoth

Uppercase Roman numeral enclosed in parentheses. Example: (I), (II), (III), ...

romanLcParenRight

public static final AutoNumberingScheme romanLcParenRight

Lowercase Roman numeral followed by a closing parenthesis. Example: i), ii), iii), ...

romanUcParenRight

public static final AutoNumberingScheme romanUcParenRight

Uppercase Roman numeral followed by a closing parenthesis. Example: I), II), III), ....

romanLcPeriod

public static final AutoNumberingScheme romanLcPeriod

Lowercase Roman numeral followed by a period. Example: i., ii., iii., ...

romanUcPeriod

public static final AutoNumberingScheme romanUcPeriod

Uppercase Roman numeral followed by a period. Example: I., II., III., ...

circleNumDbPlain

public static final AutoNumberingScheme circleNumDbPlain

Double byte circle numbers.

circleNumWdBlackPlain

public static final AutoNumberingScheme circleNumWdBlackPlain

Wingdings black circle numbers.

circleNumWdWhitePlain

public static final AutoNumberingScheme circleNumWdWhitePlain

Wingdings white circle numbers.

arabicDbPeriod

public static final AutoNumberingScheme arabicDbPeriod

Double-byte Arabic numbers with double-byte period.

arabicDbPlain

public static final AutoNumberingScheme arabicDbPlain

Double-byte Arabic numbers.

ea1ChsPeriod

public static final AutoNumberingScheme ea1ChsPeriod

Simplified Chinese with single-byte period.

ea1ChsPlain

public static final AutoNumberingScheme ea1ChsPlain

Simplified Chinese.

ea1ChtPeriod

public static final AutoNumberingScheme ea1ChtPeriod

Traditional Chinese with single-byte period.

ea1ChtPlain

public static final AutoNumberingScheme ea1ChtPlain

Traditional Chinese.

ea1JpnChsDbPeriod

public static final AutoNumberingScheme ea1JpnChsDbPeriod

Japanese with double-byte period.

ea1JpnKorPlain

public static final AutoNumberingScheme ea1JpnKorPlain

Japanese/Korean.

ea1JpnKorPeriod

public static final AutoNumberingScheme ea1JpnKorPeriod

Japanese/Korean with single-byte period.

arabic1Minus

public static final AutoNumberingScheme arabic1Minus

Bidi Arabic 1 (AraAlpha) with ANSI minus symbol.

arabic2Minus

public static final AutoNumberingScheme arabic2Minus

Bidi Arabic 2 (AraAbjad) with ANSI minus symbol.

hebrew2Minus

public static final AutoNumberingScheme hebrew2Minus

Bidi Hebrew 2 with ANSI minus symbol.

thaiAlphaPeriod

public static final AutoNumberingScheme thaiAlphaPeriod

Thai alphabetic character followed by a period.

thaiAlphaParenRight

public static final AutoNumberingScheme thaiAlphaParenRight

Thai alphabetic character followed by a closing parenthesis.

thaiAlphaParenBoth

public static final AutoNumberingScheme thaiAlphaParenBoth

Thai alphabetic character enclosed by parentheses.

thaiNumPeriod

public static final AutoNumberingScheme thaiNumPeriod

Thai numeral followed by a period.

thaiNumParenRight

public static final AutoNumberingScheme thaiNumParenRight

Thai numeral followed by a closing parenthesis.

thaiNumParenBoth

public static final AutoNumberingScheme thaiNumParenBoth

Thai numeral enclosed in parentheses.

hindiAlphaPeriod

public static final AutoNumberingScheme hindiAlphaPeriod

Hindi alphabetic character followed by a period.

hindiNumPeriod

public static final AutoNumberingScheme hindiNumPeriod

Hindi numeric character followed by a period.

hindiNumParenRight

public static final AutoNumberingScheme hindiNumParenRight

Hindi numeric character followed by a closing parenthesis.

hindiAlpha1Period

public static final AutoNumberingScheme hindiAlpha1Period

Hindi alphabetic character followed by a period.

Field Detail

nativeId

public final int nativeId

ooxmlId

public final int ooxmlId

Method Detail

values

public static AutoNumberingScheme[] values()

Returns an array containing the constants of this enum type, in
the order they are declared.  This method may be used to iterate
over the constants as follows:

for (AutoNumberingScheme c : AutoNumberingScheme.values())
    System.out.println(c);

Returns:

an array containing the constants of this enum type, in
the order they are declared

valueOf

public static AutoNumberingScheme valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type.  (Extraneous whitespace characters are
not permitted.)

Parameters:

name - the name of the enum constant to be returned.

Returns:

the enum constant with the specified name

Throws:

java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name

java.lang.NullPointerException - if the argument is null

forNativeID

public static AutoNumberingScheme forNativeID(int nativeId)

forOoxmlID

public static AutoNumberingScheme forOoxmlID(int ooxmlId)

getDescription

public java.lang.String getDescription()

format

public java.lang.String format(int value)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

PREV CLASS

NEXT CLASS

FRAMES

NO FRAMES

All Classes

SUMMARY:

NESTED |

ENUM CONSTANTS |

FIELD |

METHOD

DETAIL:

ENUM CONSTANTS |

FIELD |

METHOD

                Copyright 2016 The Apache Software Foundation or
        its licensors, as applicable.