text:
package com.glaf.base.modules.sys.interceptor;

import java.lang.reflect.Method;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.web.context.WebApplicationContext;

import com.glaf.base.modules.sys.model.BaseDataInfo;
import com.glaf.base.modules.sys.model.SysFunction;
import com.glaf.base.modules.sys.model.SysLog;
import com.glaf.base.modules.sys.model.SysUser;
import com.glaf.base.modules.sys.service.SysLogService;
import com.glaf.base.modules.utils.ContextUtil;
import com.glaf.base.utils.RequestUtil;

public class AuthorizeInterceptor implements MethodBeforeAdvice {
	private static final Logger logger = Logger
			.getLogger(AuthorizeInterceptor.class);

	/**
	 * method - method being invoked args - arguments to the method target -
	 * target of the method invocation. May be null.
	 */
	public void before(Method method, Object[] args, Object target)
			throws Throwable {
		boolean authorized = false;

		String objectName = target.getClass().getName();
		String methodName = method.getName();
		logger.debug("object:" + objectName);
		logger.debug("method:" + methodName);
		String ip = "";
		String account = "";

		for (int i = 0; i < args.length; i++) {
			logger.debug("args:" + args[i]);
			if (args[i] instanceof HttpServletRequest) {
				HttpServletRequest request = (HttpServletRequest) args[i];
				if (request != null && request.getParameter("method") != null) {
					methodName = request.getParameter("method");
					ip = request.getRemoteHost();
					SysUser user = RequestUtil.getLoginUser(request);
					if (user != null) {
						account = user.getAccount();
					}
					logger.debug("IP:" + ip + ", Account:" + account);
				}
			}
		}
		methodName = objectName + "." + methodName;
		logger.debug("methodName:" + methodName);

		// À¹½ØµÄ¹¦ÄÜÔÚϵͳ¹¦ÄÜÁбíÖÐ
		if (findSysFunction(methodName)) {
			// ÔÚÓû§¹¦ÄÜÁбíÖУ¬Í¨¹ý
			if (findUserFunction(account, methodName)) {
				logger.debug("method is in user functions");
				authorized = true;
			}
		} else {// À¹½ØµÄ¹¦Äܲ»ÔÚϵͳ¹¦ÄÜÁбíÖУ¬Í¨¹ý
			logger.debug("method isn't in sys functions");
			authorized = true;
		}

		// ¼Ç¼Óû§²Ù×÷
		createLog(account, methodName, ip, authorized ? 1 : 0);

		if (!authorized) {
			throw new AuthorizeException("No Privileges.");
		}
	}

	/**
	 * ¼Ç¼ÈÕÖ¾
	 *
	 * @param methodName
	 * @param ip
	 * @param flag
	 */
	private void createLog(String account, String methodName, String ip,
			int flag) {
		SysLog log = new SysLog();
		SysUser user = (SysUser) ContextUtil.get(account);
		if (user != null) {
			log.setAccount(user.getName() + "[" + user.getAccount() + "]");
			log.setIp(ip);
			log.setCreateTime(new Date());
			log.setOperate(methodName);
			log.setFlag(flag);

			WebApplicationContext wac = (WebApplicationContext) ContextUtil
					.get("wac");
			SysLogService logService = (SysLogService) wac
					.getBean("sysLogProxy");
			logService.create(log);
		}
	}

	/**
	 * ¼ì²é¹¦ÄÜÊÇ·ñ´æÔÚϵͳ¹¦ÄÜÁбíÖÐ
	 *
	 * @param methodName
	 * @return
	 */
	private boolean findSysFunction(String methodName) {
		boolean ret = false;
		try {
			// ϵͳ¹¦ÄÜÁÐ±í£¬ÔÚ³õ'»¯servletÖмÓÔØ
			Iterator iter = ((List) ContextUtil.get("function")).iterator();
			logger.debug("function:" + iter);
			while (iter.hasNext()) {
				BaseDataInfo bdi = (BaseDataInfo) iter.next();
				logger.debug("sys function:" + bdi.getCode());
				if (bdi.getCode().equals(methodName)) {// ÕÒµ½
					ret = true;
					break;
				}
			}
			iter = null;
		} catch (Exception e) {
			logger.error(e);
		}
		return ret;
	}

	/**
	 * ¼ì²é¹¦ÄÜÊÇ·ñ´æÔÚÓû§¹¦ÄÜÁбíÖÐ
	 *
	 * @param methodName
	 * @return
	 */
	private boolean findUserFunction(String account, String methodName) {
		boolean ret = false;
		// Óû§¶ÔÏó£¬Ôڵǽºó¼ÓÔØ
		SysUser user = (SysUser) ContextUtil.get(account);
		logger.debug("user:" + user);
		Iterator iter = user.getFunctions().iterator();// Óû§¹¦ÄÜÁбí
		while (iter.hasNext()) {
			SysFunction function = (SysFunction) iter.next();
			if (function.getFuncMethod().equals(methodName)) {
				ret = true;
				break;
			}
		}
		iter = null;
		return ret;
	}
}


text:
/**
 *
 */
package com.github.nnest.sparrow.simple.token;

/**
 * end point
 *
 * @author brad.wu
 * @since 0.0.1
 * @version 0.0.1
 */
public class Endpoint extends AbstractTokens {
	public Endpoint(String endpoint) {
		super(endpoint);
	}
}

redpajama_set_name: RedPajamaGithub


text:
/*	$NetBSD: yp_prot.h,v 1.18 2013/01/23 17:27:35 mbalmer Exp $	*/

/*
 * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef _RPCSVC_YP_PROT_H_
#define _RPCSVC_YP_PROT_H_

/*
 * YPSERV PROTOCOL:
 *
 * ypserv supports the following procedures:
 *
 * YPPROC_NULL		takes (void), returns (void).
 * 			called to check if server is alive.
 * YPPROC_DOMAIN	takes (char *), returns (bool_t).
 * 			true if ypserv serves the named domain.
 * YPPROC_DOMAIN_NOACK	takes (char *), returns (bool_t).
 * 			true if ypserv serves the named domain.
 *			used for broadcasts, does not ack if ypserv
 *			doesn't handle named domain.
 * YPPROC_MATCH		takes (struct ypreq_key), returns (struct ypresp_val)
 * 			does a lookup.
 * YPPROC_FIRST		takes (struct ypreq_nokey) returns (ypresp_key_val).
 * 			gets the first key/datum from the map.
 * YPPROC_NEXT		takes (struct ypreq_key) returns (ypresp_key_val).
 * 			gets the next key/datum from the map.
 * YPPROC_XFR		takes (struct ypreq_xfr), returns (void).
 * 			tells ypserv to check if there is a new version of
 *			the map.
 * YPPROC_CLEAR		takes (void), returns (void).
 * 			tells ypserv to flush its file cache, so that
 *			newly transferred files will get read.
 * YPPROC_ALL		takes (struct ypreq_nokey), returns (bool_t and
 *			struct ypresp_key_val).
 * 			returns an array of data, with the bool_t being
 * 			false on the last datum. read the source, it's
 *			convoluted.
 * YPPROC_MASTER	takes (struct ypreq_nokey), returns (ypresp_master).
 * YPPROC_ORDER		takes (struct ypreq_nokey), returns (ypresp_order).
 * YPPROC_MAPLIST	takes (char *), returns (struct ypmaplist *).
 */

/* Program and version symbols, magic numbers */
#define YPPROG		((unsigned long)100004)
#define YPVERS		((unsigned long)2)
#define YPVERS_ORIG	((unsigned long)1)

#define YPMAXRECORD	1024
#define YPMAXDOMAIN	64
#define YPMAXMAP	64
#define YPMAXPEER	256

/*
 * I don't know if anything of sun's depends on this, or if they
 * simply defined it so that their own code wouldn't try to send
 * packets over the ethernet MTU. This YP code doesn't use it.
 */
#define YPMSGSZ		1600

#ifndef DATUM
typedef struct {
	const char	*dptr;
	int		 dsize;
} datum;
#define DATUM
#endif

struct ypmap_parms {
	const char *domain;
	const char *map;
	unsigned int ordernum;
	char *owner;
};

struct ypreq_key {
	const char *domain;
	const char *map;
	datum keydat;
};

struct ypreq_nokey {
	const char *domain;
	const char *map;
};

struct ypreq_xfr {
	struct ypmap_parms map_parms;
	unsigned int transid;
	unsigned int proto;
	unsigned int port;
};
#define ypxfr_domain	map_parms.domain
#define ypxfr_map	map_parms.map
#define ypxfr_ordernum	map_parms.ordernum
#define ypxfr_owner	map_parms.owner

struct ypresp_val {
	unsigned int status;
	datum valdat;
};

struct ypresp_key_val {
	unsigned int status;
	datum keydat;
	datum valdat;
};

struct ypresp_master {
	unsigned int status;
	char *master;
};

struct ypresp_order {
	unsigned int status;
	unsigned int ordernum;
};

struct ypmaplist {
	char ypml_name[YPMAXMAP + 1];
	struct ypmaplist *ypml_next;
};

struct ypresp_maplist {
	unsigned int status;
	struct ypmaplist *list;
};

/* ypserv procedure numbers */
#define YPPROC_NULL		((unsigned long)0)
#define YPPROC_DOMAIN		((unsigned long)1)
#define YPPROC_DOMAIN_NONACK	((unsigned long)2)
#define YPPROC_MATCH		((unsigned long)3)
#define YPPROC_FIRST		((unsigned long)4)
#define YPPROC_NEXT		((unsigned long)5)
#define YPPROC_XFR		((unsigned long)6)
#define YPPROC_CLEAR		((unsigned long)7)
#define YPPROC_ALL		((unsigned long)8)
#define YPPROC_MASTER		((unsigned long)9)
#define YPPROC_ORDER		((unsigned long)10)
#define YPPROC_MAPLIST		((unsigned long)11)

/* ypserv procedure return status values */
#define YP_TRUE	 	((unsigned int)1)	/* general purpose success code */
#define YP_NOMORE 	((unsigned int)2)	/* no more entries in map */
#define YP_FALSE 	((unsigned int)0)	/* general purpose failure code */
#define YP_NOMAP 	((unsigned int)-1)	/* no such map in domain */
#define YP_NODOM 	((unsigned int)-2)	/* domain not supported */
#define YP_NOKEY 	((unsigned int)-3)	/* no such key in map */
#define YP_BADOP 	((unsigned int)-4)	/* invalid operation */
#define YP_BADDB 	((unsigned int)-5)	/* server data base is bad */
#define YP_YPERR 	((unsigned int)-6)	/* YP server error */
#define YP_BADARGS 	((unsigned int)-7)	/* request arguments bad */
#define YP_VERS		((unsigned int)-8)	/* YP server version mismatch */

/*
 * Sun's header file says:
 * "Domain binding data structure, used by ypclnt package and ypserv modules.
 * Users of the ypclnt package (or of this protocol) don't HAVE to know about
 * it, but it must be available to users because _yp_dobind is a public
 * interface."
 *
 * This is totally bogus! Nowhere else does Sun state that _yp_dobind() is
 * a public interface, and I don't know any reason anyone would want to call
 * it. But, just in case anyone does actually expect it to be available..
 * we provide this.. exactly as Sun wants it.
 */
struct dom_binding {
	struct dom_binding *dom_pnext;
	char dom_domain[YPMAXDOMAIN + 1];
	struct sockaddr_in dom_server_addr;
	u_short dom_server_port;
	int dom_socket;
	CLIENT *dom_client;
	u_short dom_local_port;
	long dom_vers;
};

/*
 * YPBIND PROTOCOL:
 *
 * ypbind supports the following procedures:
 *
 * YPBINDPROC_NULL	takes (void), returns (void).
 *			to check if ypbind is running.
 * YPBINDPROC_DOMAIN	takes (char *), returns (struct ypbind_resp).
 *			requests that ypbind start to serve the
 *			named domain (if it doesn't already)
 * YPBINDPROC_SETDOM	takes (struct ypbind_setdom), returns (void).
 *			used by ypset.
 */

#define YPBINDPROG		((unsigned long)100007)
#define YPBINDVERS		((unsigned long)2)
#define YPBINDVERS_ORIG		((unsigned long)1)

/* ypbind procedure numbers */
#define YPBINDPROC_NULL		((unsigned long)0)
#define YPBINDPROC_DOMAIN	((unsigned long)1)
#define YPBINDPROC_SETDOM	((unsigned long)2)

/* error code in ypbind_resp.ypbind_status */
enum ypbind_resptype {
	YPBIND_SUCC_VAL = 1,
	YPBIND_FAIL_VAL = 2
};

/* network order, of course */
struct ypbind_binding {
	struct in_addr	ypbind_binding_addr;
	uint16_t	ypbind_binding_port;
};

struct ypbind_resp {
	enum ypbind_resptype	ypbind_status;
	union {
		unsigned int		ypbind_error;
		struct ypbind_binding	ypbind_bindinfo;
	} ypbind_respbody;
};

/* error code in ypbind_resp.ypbind_respbody.ypbind_error */
#define YPBIND_ERR_ERR		1	/* internal error */
#define YPBIND_ERR_NOSERV	2	/* no bound server for passed domain */
#define YPBIND_ERR_RESC		3	/* system resource allocation failure */

/*
 * Request data structure for ypbind "Set domain" procedure.
 */
struct ypbind_setdom {
	char ypsetdom_domain[YPMAXDOMAIN + 1];
	struct ypbind_binding ypsetdom_binding;
	unsigned int ypsetdom_vers;
};
#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
#define ypsetdom_port ypsetdom_binding.ypbind_binding_port

/*
 * YPPUSH PROTOCOL:
 *
 * Sun says:
 * "Protocol between clients (ypxfr, only) and yppush
 *  yppush speaks a protocol in the transient range, which
 *  is supplied to ypxfr as a command-line parameter when it
 *  is activated by ypserv."
 *
 * This protocol is not implimented, naturally, because this YP
 * implimentation only does the client side.
 */
#define YPPUSHVERS		((unsigned long)1)
#define YPPUSHVERS_ORIG		((unsigned long)1)

/* yppush procedure numbers */
#define YPPUSHPROC_NULL		((unsigned long)0)
#define YPPUSHPROC_XFRRESP	((unsigned long)1)

struct yppushresp_xfr {
	unsigned int	transid;
	unsigned int	status;
};

/* yppush status value in yppushresp_xfr.status */
#define YPPUSH_SUCC	((unsigned int)1)	/* Success */
#define YPPUSH_AGE	((unsigned int)2)	/* Master's version not newer */
#define YPPUSH_NOMAP 	((unsigned int)-1)	/* Can't find server for map */
#define YPPUSH_NODOM 	((unsigned int)-2)	/* Domain not supported */
#define YPPUSH_RSRC 	((unsigned int)-3)	/* Local resource alloc failure */
#define YPPUSH_RPC 	((unsigned int)-4)	/* RPC failure talking to server */
#define YPPUSH_MADDR	((unsigned int)-5)	/* Can't get master address */
#define YPPUSH_YPERR 	((unsigned int)-6)	/* YP server/map db error */
#define YPPUSH_BADARGS 	((unsigned int)-7)	/* Request arguments bad */
#define YPPUSH_DBM	((unsigned int)-8)	/* Local dbm operation failed */
#define YPPUSH_FILE	((unsigned int)-9)	/* Local file I/O operation failed */
#define YPPUSH_SKEW	((unsigned int)-10)	/* Map version skew during transfer */
#define YPPUSH_CLEAR	((unsigned int)-11)	/* Can't send "Clear" req to local ypserv */
#define YPPUSH_FORCE	((unsigned int)-12)	/* No local order number in map - use -f */
#define YPPUSH_XFRERR	((unsigned int)-13)	/* ypxfr error */
#define YPPUSH_REFUSED	((unsigned int)-14)	/* Transfer request refused by ypserv */

struct ypall_callback;

__BEGIN_DECLS
bool_t xdr_domainname(XDR *, char *);	/* obsolete */
bool_t xdr_peername(XDR *, char *);	/* obsolete */
bool_t xdr_mapname(XDR *, char *);	/* obsolete */
bool_t xdr_datum(XDR *, datum *);
bool_t xdr_ypdomain_wrap_string(XDR *, char **);
bool_t xdr_ypmap_wrap_string(XDR *, char **);
bool_t xdr_ypreq_key(XDR *, struct ypreq_key *);
bool_t xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
bool_t xdr_ypresp_val(XDR *, struct ypresp_val *);
bool_t xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
bool_t xdr_ypmap_parms(XDR *, struct ypmap_parms *);
bool_t xdr_ypowner_wrap_string(XDR *, char **);
bool_t xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
bool_t xdr_ypresp_order(XDR *, struct ypresp_order *);
bool_t xdr_ypresp_master(XDR *, struct ypresp_master *);
bool_t xdr_ypall(XDR *, struct ypall_callback *);
bool_t xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
bool_t xdr_ypbind_resp(XDR *, struct ypbind_resp *);
bool_t xdr_ypbind_setdom(XDR *, struct ypbind_setdom *);
bool_t xdr_ypmaplist(XDR *, struct ypmaplist *);
bool_t xdr_yp_inaddr(XDR *, struct in_addr *);
__END_DECLS

#endif /* _RPCSVC_YP_PROT_H_ */


text:
package org.apereo.cas.ticket;

import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.support.oauth.OAuth20GrantTypes;
import org.apereo.cas.support.oauth.OAuth20ResponseTypes;
import org.apereo.cas.ticket.code.OAuth20Code;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;

import java.io.Serial;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * An OAuth code implementation.
 *
 * @author Jerome Leleu
 * @since 5.0.0
 */
@NoArgsConstructor
@Getter
public abstract class BaseOAuth20Token extends AbstractTicket implements OAuth20Token {

    @Serial
    private static final long serialVersionUID = -8072724186202305800L;

    private Set<String> scopes = new HashSet<>(0);

    private Map<String, Map<String, Object>> claims = new HashMap<>(0);

    /**
     * The {@link TicketGrantingTicket} this is associated with.
     */
    @JsonProperty("ticketGrantingTicket")
    private TicketGrantingTicket ticketGrantingTicket;

    /**
     * The service this ticket is valid for.
     */
    private Service service;

    /**
     * The authenticated object for which this ticket was generated for.
     */
    private Authentication authentication;

    private String codeChallenge;

    private String codeChallengeMethod;

    private String clientId;

    private OAuth20ResponseTypes responseType;

    private OAuth20GrantTypes grantType;

    public BaseOAuth20Token(final String id,
                            final @NonNull Service service,
                            final @NonNull Authentication authentication,
                            final @NonNull ExpirationPolicy expirationPolicy,
                            final TicketGrantingTicket ticketGrantingTicket,
                            final @NonNull Collection<String> scopes,
                            final String codeChallenge,
                            final String codeChallengeMethod,
                            final String clientId,
                            final Map<String, Map<String, Object>> requestClaims,
                            final OAuth20ResponseTypes responseType,
                            final OAuth20GrantTypes grantType) {
        super(id, expirationPolicy);
        this.service = service;
        this.authentication = authentication;
        this.ticketGrantingTicket = ticketGrantingTicket;
        this.codeChallenge = codeChallenge;
        this.codeChallengeMethod = codeChallengeMethod;
        this.clientId = clientId;
        this.responseType = responseType;
        this.grantType = grantType;
        this.scopes.addAll(scopes);
        this.claims.putAll(requestClaims);
    }

    @Override
    public String getPrefix() {
        return OAuth20Code.PREFIX;
    }

    @Override
    public Set<String> getScopes() {
        return ObjectUtils.defaultIfNull(this.scopes, new HashSet<>(0));
    }
}


text:
package net.nogotofail;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

/**
 * Protocol handler for the connection to the MiTM server.
 *
 *
The protocol is line-oriented.
 *
 *
The handshake is similar to HTTP response/request without body. The client sends:
 *

 *   nogotofail_ctl/1.0
 *   User-Agent: ...
 *   Platform-Info: ...
 *   ...
 *

 * followed by an empty line. The server replies with status code ({@code 0} for success) and
 * status message, followed by headers, followed by an empty line.
 *
 *
The server can then send commands to the client. Each command starts with a transaction ID,
 * an opaque (to client) string, followed by a space, followed by the name of the command, followed
 * optionally followed by space and additional arguments. The client responds with the transaction
 * ID corresponding to a request, followed by space, followed by the return value for that request.
 *
 *
Supported commands:
 *

 *
{@code tcp_client_id src_port [dst_ip_addr_in_hex [dsp_port]]} -- looks up a process that
 *     is responsible for the outbound TCP connection matching the parameters and returns the
 *     ID of the package(s) associated with the process. The list of packages is comma-separated,
 *     with each entry consisting of package name followed by space followed by version code.
 *

 *
{@code vuln_notify request_id vuln_type dst_host/addr dst_port [<pkg name> <version code>[, ...]]]}
 *     -- notifies the user of this Android that network traffic is vulnerable. The list of packages
 *     is comma-separated, with each entry consisting of package name followed by space followed by
 *     version code.
 *

 *

 */
public class RouterConnectionHandler implements RouterSocketClient.ConnectionHandler {

  /**
   * Handler of a command received from the server.
   */
  interface CommandHandler {
    String handleCommand(InetAddress localAddress, String parameters) throws IOException;
  }

  private static final String TAG = RouterConnectionHandler.class.getSimpleName();

  private static final String PROTOCOL_NAME = "nogotofail_ctl";
  private static final String PROTOCOL_VERSION = "1.0";
  private static final String HEADER_USER_AGENT = "User-Agent";
  private static final String HEADER_PLATFORM_INFO = "Platform-Info";
  private static final String HEADER_INSTALLATION_ID = "Installation-ID";
  private static final String HEADER_ATTACK_PROBABILITY = "Attack-Probability";
  private static final String HEADER_ENABLED_ATTACKS = "Attacks";
  private static final String HEADER_SUPPORTED_ATTACKS = "Supported-Attacks";
  private static final String HEADER_SUPPORTED_ATTACKS_LOWER_CASE =
      HEADER_SUPPORTED_ATTACKS.toLowerCase(Locale.US);
  private static final String HEADER_ENABLED_DATA_ATTACKS = "Data-Attacks";
  private static final String HEADER_SUPPORTED_DATA_ATTACKS = "Supported-Data-Attacks";
  private static final String HEADER_SUPPORTED_DATA_ATTACKS_LOWER_CASE =
      HEADER_SUPPORTED_DATA_ATTACKS.toLowerCase(Locale.US);

  /**
   * Timeout (milliseconds) for a read operation waiting for a command from the server. The server
   * may send commands very infrequently. The timeout is thus set to a large enough value to avoid
   * cycling too much when waiting for a command from the server.
   */
  private static final long INTERCOMMAND_READ_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(5);

  /** Timeout (milliseconds) after which to terminate the connection and initiate a retry if no data
   * has been received over the connection. */
  private static final long CONNECTION_IDLE_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(30);

  private final Context mContext;
  private final String mPlatformInfo;
  private final String mUserAgent;
  private final Map<String, CommandHandler> mCommandHandlers =
      new HashMap<String, CommandHandler>();

  public RouterConnectionHandler(Context context) {
    mContext = context;
    String packageName = context.getPackageName();
    PackageInfo packageInfo;
    try {
      packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
    } catch (PackageManager.NameNotFoundException e) {
      packageInfo = null;
    }
    int versionCode = (packageInfo != null) ? packageInfo.versionCode : -1;
    mUserAgent = packageName + "/" + versionCode
        + " (Linux"
        + "; Android " + Build.VERSION.RELEASE + ")";
    mPlatformInfo = Build.FINGERPRINT;

    mCommandHandlers.put("tcp_client_id", new TcpClientInfoCommandHandler(context));
    mCommandHandlers.put("vuln_notify", new VulnNotifyCommandHandler(context));
  }

  @Override
  public void handleConnection(Socket socket) throws IOException {
    Log.i(TAG, "Handling connection to " + socket.getRemoteSocketAddress());
    try {
      BufferedWriter out =
          new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF-8"));
      BufferedReader in =
          new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8"));

      // Start handshake
      writeHandshakeRequestLine(out, PROTOCOL_NAME + "/" + PROTOCOL_VERSION);
      writeHandshakeRequestHeader(out, HEADER_USER_AGENT, mUserAgent);
      writeHandshakeRequestHeader(
          out, HEADER_INSTALLATION_ID, AdvancedPreferenceFragment.getInstallationId(mContext));
      writeHandshakeRequestHeader(out, HEADER_PLATFORM_INFO, mPlatformInfo);
      Double requestedAttackProbability =
          AttacksPreferenceFragment.getAttackProbability(mContext);
      if (requestedAttackProbability != null) {
        writeHandshakeRequestHeader(
            out, HEADER_ATTACK_PROBABILITY, String.valueOf(requestedAttackProbability));
      }
      Set<String> requestedEnabledAttackIds =
          AttacksPreferenceFragment.getEnabledAttackIds(mContext);
      if (requestedEnabledAttackIds != null) {
        writeHandshakeRequestHeader(
            out, HEADER_ENABLED_ATTACKS, TextUtils.join(",", requestedEnabledAttackIds));
      }
      Set<String> requestedEnabledDataAttackIds =
          AttacksPreferenceFragment.getEnabledDataAttackIds(mContext);
      if (requestedEnabledDataAttackIds != null) {
        writeHandshakeRequestHeader(
            out, HEADER_ENABLED_DATA_ATTACKS, TextUtils.join(",", requestedEnabledDataAttackIds));
      }
      out.write("\r\n");
      out.flush();

      boolean responseRead = false;
      boolean firstLineRead = false;
      String line;
      while ((line = in.readLine()) != null) {
        if (line.length() == 0) {
          // End of response
          responseRead = true;
          break;
        }
        Log.d(TAG, "Handshake response line: " + line);
        if (!firstLineRead) {
          // Status line
          String[] tokens = line.split("\\s", 2);
          String responseCode = tokens[0];
          if (!"0".equals(responseCode)) {
            throw new IOException("Handshake failed. Server reply: " + line);
          }
          firstLineRead = true;
          continue;
        }
        // Header line
        int delimiterIndex = line.indexOf(':');
        String headerName;
        String headerValue;
        if (delimiterIndex != -1) {
          headerName = line.substring(0, delimiterIndex).trim();
          headerValue = line.substring(delimiterIndex + 1).trim();
        } else {
          headerName = line.trim();
          headerValue = null;
        }
        String headerNameLowerCase = headerName.toLowerCase(Locale.US);
        if (HEADER_SUPPORTED_ATTACKS_LOWER_CASE.equals(headerNameLowerCase)) {
          String[] attackIdsArray = (headerValue != null) ? headerValue.split(",") : new String[0];
          Set<String> attackIds = new HashSet<String>();
          for (String attackId : attackIdsArray) {
            attackId = attackId.trim();
            if (!attackId.isEmpty()) {
              attackIds.add(attackId);
            }
          }
          AttacksPreferenceFragment.setSupportedAttackIds(mContext, attackIds);
        } else if (HEADER_SUPPORTED_DATA_ATTACKS_LOWER_CASE.equals(headerNameLowerCase)) {
          String[] attackIdsArray = (headerValue != null) ? headerValue.split(",") : new String[0];
          Set<String> attackIds = new HashSet<String>();
          for (String attackId : attackIdsArray) {
            attackId = attackId.trim();
            if (!attackId.isEmpty()) {
              attackIds.add(attackId);
            }
          }
          AttacksPreferenceFragment.setSupportedDataAttackIds(mContext, attackIds);
        }
      }
      if (!firstLineRead) {
        throw new EOFException("Empty response to handshake");
      }
      if (!responseRead) {
        throw new EOFException("Premature EOF while reading handshake response");
      }

      // Handshake completed
      Log.d(TAG, "Handshake succeeded");

      // IMPLEMENTATION NOTE: The timeout below technically affects not just the first read of a new
      // command, but also any reads while already reading a command. It's pretty much impossible to
      // use different timeouts for these two operations while using a stock BufferedReader. It
      // should be possible to use two different timeouts if we switch to a binary (rather than
      // line-oriented) format or if we create our own BufferedInputStream reader.
      // TODO: Switch to using a much shorter read timeout while already reading a command.
      socket.setSoTimeout((int) INTERCOMMAND_READ_TIMEOUT_MILLIS);
      long lastReceivedDataTimestampMillis = SystemClock.elapsedRealtime();
      while (true) {
        try {
          while ((line = in.readLine()) != null) {
            // Received a request from the server
            lastReceivedDataTimestampMillis = SystemClock.elapsedRealtime();
            int transactionIdDelimiterIndex = line.indexOf(' ');
            if (transactionIdDelimiterIndex == -1) {
              throw new IOException("No transaction ID in request");
            }
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
              Log.v(TAG, "Request: " + line);
            }
            String transactionId = line.substring(0, transactionIdDelimiterIndex);
            line = line.substring(transactionIdDelimiterIndex + 1);
            int commandDelimiterIndex = line.indexOf(' ');
            String command;
            if (commandDelimiterIndex == -1) {
              command = line;
              line = "";
            } else {
              command = line.substring(0, commandDelimiterIndex);
              line = line.substring(commandDelimiterIndex + 1);
            }

            String replyPayload;
            CommandHandler commandHandler = mCommandHandlers.get(command);
            if (commandHandler != null) {
              replyPayload = commandHandler.handleCommand(socket.getLocalAddress(), line);
              if (replyPayload == null) {
                replyPayload = "";
              }
            } else {
              replyPayload = "ERROR: Unsupported command";
            }
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
              Log.v(TAG, "Reply: " + transactionId + " " + replyPayload);
            }
            out.write(transactionId + " " + replyPayload + "\n");
            out.flush();
          }
          Log.d(TAG, "EOF from server");
          return;
        } catch (SocketTimeoutException ignored) {
          // Read timed out
          Log.v(TAG, "Socket timed out");
          long idleTimeMillis = SystemClock.elapsedRealtime() - lastReceivedDataTimestampMillis;
          if (idleTimeMillis >= CONNECTION_IDLE_TIMEOUT_MILLIS) {
            // Connection idle for too long -- terminate the connection and initiate a retry.
            throw new IOException("Connection idle for too long: "
                + (idleTimeMillis / 1000) + " seconds");
          }
          // Try reading again
        }
      }
    } finally {
      Log.i(TAG, "DONE handling connection to " + socket.getRemoteSocketAddress());
    }
  }

  private static void writeHandshakeRequestHeader(
      BufferedWriter out, String headerName, String headerValue) throws IOException {
    boolean valueCensored = false;
    if (HEADER_INSTALLATION_ID.equals(headerName)) {
      valueCensored = true;
    }

    if (valueCensored) {
      Log.d(TAG, "Sending handshake request line: " + headerName + ": <REDACTED>");
      out.write(headerName + ": " + headerValue + "\r\n");
    } else {
      writeHandshakeRequestLine(out, headerName + ": " + headerValue);
    }
  }

  private static void writeHandshakeRequestLine(
      BufferedWriter out, String line) throws IOException {
    Log.d(TAG, "Sending handshake request line: " + line);
    out.write(line + "\r\n");
  }
}


text:
Using a TensorFlow Lite model in your mobile app requires multiple
considerations: you must choose a pre-trained or custom model, convert the model
to a TensorFLow Lite format, and finally, integrate the model in your app.

## 1. Choose a model

Depending on the use case, you can choose one of the popular open-sourced models,
such as *InceptionV3* or *MobileNets*, and re-train these models with a custom
data set or even build your own custom model.

### Use a pre-trained model

[MobileNets](https://research.googleblog.com/2017/06/mobilenets-open-source-models-for.html)
is a family of mobile-first computer vision models for TensorFlow designed to
effectively maximize accuracy, while taking into consideration the restricted
resources for on-device or embedded applications. MobileNets are small,
low-latency, low-power models parameterized to meet the resource constraints for
a variety of uses. They can be used for classification, detection, embeddings, and
segmentation—similar to other popular large scale models, such as
[Inception](https://arxiv.org/pdf/1602.07261.pdf). Google provides 16 pre-trained
[ImageNet](http://www.image-net.org/challenges/LSVRC/) classification checkpoints
for MobileNets that can be used in mobile projects of all sizes.

[Inception-v3](https://arxiv.org/abs/1512.00567) is an image recognition model
that achieves fairly high accuracy recognizing general objects with 1000 classes,
for example, "Zebra", "Dalmatian", and "Dishwasher". The model extracts general
features from input images using a convolutional neural network and classifies
them based on those features with fully-connected and softmax layers.

[On Device Smart Reply](https://research.googleblog.com/2017/02/on-device-machine-intelligence.html)
is an on-device model that provides one-touch replies for incoming text messages
by suggesting contextually relevant messages. The model is built specifically for
memory constrained devices, such as watches and phones, and has been successfully
used in Smart Replies on Android Wear. Currently, this model is Android-specific.

These pre-trained models are [available for download](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/models.md)

### Re-train Inception-V3 or MobileNet for a custom data set

These pre-trained models were trained on the *ImageNet* data set which contains
1000 predefined classes. If these classes are not sufficient for your use case,
the model will need to be re-trained. This technique is called
*transfer learning* and starts with a model that has been already trained on a
problem, then retrains the model on a similar problem. Deep learning from
scratch can take days, but transfer learning is fairly quick. In order to do
this, you need to generate a custom data set labeled with the relevant classes.

The [TensorFlow for Poets](https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/)
codelab walks through the re-training process step-by-step. The code supports
both floating point and quantized inference.

### Train a custom model

A developer may choose to train a custom model using Tensorflow (see the
[TensorFlow tutorials](../../tutorials/) for examples of building and training
models). If you have already written a model, the first step is to export this
to a `tf.GraphDef` file. This is required because some formats do not store the
model structure outside the code, and we must communicate with other parts of the
framework. See
[Exporting the Inference Graph](https://github.com/tensorflow/models/blob/master/research/slim/README.md)
to create .pb file for the custom model.

TensorFlow Lite currently supports a subset of TensorFlow operators. Refer to the
[TensorFlow Lite & TensorFlow Compatibility Guide](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/g3doc/tf_ops_compatibility.md)
for supported operators and their usage. This set of operators will continue to
grow in future Tensorflow Lite releases.

## 2. Convert the model format

The model generated (or downloaded) in the previous step is a *standard*
Tensorflow model and you should now have a .pb or .pbtxt `tf.GraphDef` file.
Models generated with transfer learning (re-training) or custom models must be
converted—but, we must first freeze the graph to convert the model to the
Tensorflow Lite format. This process uses several model formats:

* `tf.GraphDef` (.pb) —A protobuf that represents the TensorFlow training or
  computation graph. It contains operators, tensors, and variables definitions.
* *CheckPoint* (.ckpt) —Serialized variables from a TensorFlow graph. Since this
  does not contain a graph structure, it cannot be interpreted by itself.
* `FrozenGraphDef` —A subclass of `GraphDef` that does not contain
  variables. A `GraphDef` can be converted to a `FrozenGraphDef` by taking a
  CheckPoint and a `GraphDef`, and converting each variable into a constant
  using the value retrieved from the CheckPoint.
* `SavedModel` —A `GraphDef` and CheckPoint with a signature that labels
  input and output arguments to a model. A `GraphDef` and CheckPoint can be
  extracted from a `SavedModel`.
* *TensorFlow Lite model* (.tflite) —A serialized
  [FlatBuffer](https://google.github.io/flatbuffers/) that contains TensorFlow
  Lite operators and tensors for the TensorFlow Lite interpreter, similar to a
  `FrozenGraphDef`.

### Freeze Graph

To use the `GraphDef` .pb file with TensorFlow Lite, you must have checkpoints
that contain trained weight parameters. The .pb file only contains the structure
of the graph. The process of merging the checkpoint values with the graph
structure is called *freezing the graph*.

You should have a checkpoints folder or download them for a pre-trained model
(for example,
[MobileNets](https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md)).

To freeze the graph, use the following command (changing the arguments):

```
freeze_graph --input_graph=/tmp/mobilenet_v1_224.pb \
  --input_checkpoint=/tmp/checkpoints/mobilenet-10202.ckpt \
  --input_binary=true \
  --output_graph=/tmp/frozen_mobilenet_v1_224.pb \
  --output_node_names=MobileNetV1/Predictions/Reshape_1
```

The `input_binary` flag must be enabled so the protobuf is read and written in
a binary format. Set the `input_graph` and `input_checkpoint` files.

The `output_node_names` may not be obvious outside of the code that built the
model. The easiest way to find them is to visualize the graph, either with
[TensorBoard](https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2/#3)
or `graphviz`.

The frozen `GraphDef` is now ready for conversion to the `FlatBuffer` format
(.tflite) for use on Android or iOS devices. For Android, the Tensorflow
Optimizing Converter tool supports both float and quantized models. To convert
the frozen `GraphDef` to the .tflite format:

```
toco --input_file=$(pwd)/mobilenet_v1_1.0_224/frozen_graph.pb \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --output_file=/tmp/mobilenet_v1_1.0_224.tflite \
  --inference_type=FLOAT \
  --input_type=FLOAT \
  --input_arrays=input \
  --output_arrays=MobilenetV1/Predictions/Reshape_1 \
  --input_shapes=1,224,224,3
```

The `input_file` argument should reference the frozen `GraphDef` file
containing the model architecture. The [frozen_graph.pb](https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz)
file used here is available for download. `output_file` is where the TensorFlow
Lite model will get generated. The `input_type` and `inference_type`
arguments should be set to `FLOAT`, unless converting a
quantized model.
Setting the `input_array`, `output_array`, and `input_shape` arguments are not as
straightforward. The easiest way to find these values is to explore the graph
using Tensorboard. Reuse the arguments for specifying the output nodes for
inference in the `freeze_graph` step.

It is also possible to use the Tensorflow Optimizing Converter with protobufs
from either Python or from the command line (see the
[toco_from_protos.py](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/toco/python/toco_from_protos.py)
example). This allows you to integrate the conversion step into the model design
workflow, ensuring the model is easily convertible to a mobile inference graph.
For example:

```python
import tensorflow as tf

img = tf.placeholder(name="img", dtype=tf.float32, shape=(1, 64, 64, 3))
val = img + tf.constant([1., 2., 3.]) + tf.constant([1., 4., 4.])
out = tf.identity(val, name="out")

with tf.Session() as sess:
  tflite_model = tf.contrib.lite.toco_convert(sess.graph_def, [img], [out])
  open("converteds_model.tflite", "wb").write(tflite_model)
```

For usage, see the Tensorflow Optimizing Converter
[command-line examples](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md).

Refer to the
[Ops compatibility guide](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/g3doc/tf_ops_compatibility.md)
for troubleshooting help, and if that doesn't help, please
[file an issue](https://github.com/tensorflow/tensorflow/issues).

The [development repo](https://github.com/tensorflow/tensorflow) contains a tool
to visualize TensorFlow Lite models after conversion. To build the
[visualize.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/tools/visualize.py)
tool:

```sh
bazel run tensorflow/contrib/lite/tools:visualize -- model.tflite model_viz.html
```

This generates an interactive HTML page listing subgraphs, operations, and a
graph visualization.

## 3. Use the TensorFlow Lite model for inference in a mobile app

After completing the prior steps, you should now have a `.tflite` model file.

### Android

Since Android apps are written in Java and the core TensorFlow library is in C++,
a JNI library is provided as an interface. This is only meant for inference—it
provides the ability to load a graph, set up inputs, and run the model to
calculate outputs.

The open source Android demo app uses the JNI interface and is available
[on GitHub](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo/app).
You can also download a
[prebuilt APK](http://download.tensorflow.org/deps/tflite/TfLiteCameraDemo.apk).
See the Android demo guide for details.

The Android mobile guide has instructions for
installing TensorFlow on Android and setting up `bazel` and Android Studio.

### iOS

To integrate a TensorFlow model in an iOS app, see the
[TensorFlow Lite for iOS](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/g3doc/ios.md)
guide and iOS demo guide.

#### Core ML support

Core ML is a machine learning framework used in Apple products. In addition to
using Tensorflow Lite models directly in your applications, you can convert
trained Tensorflow models to the
[CoreML](https://developer.apple.com/machine-learning/) format for use on Apple
devices. To use the converter, refer to the
[Tensorflow-CoreML converter documentation](https://github.com/tf-coreml/tf-coreml).

### Raspberry Pi

Compile Tensorflow Lite for a Raspberry Pi by following the
[RPi build instructions](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/rpi.md)
This compiles a static library file (`.a`) used to build your app. There are
plans for Python bindings and a demo app.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The cloudi_service_http_elli application</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">

Overview

The cloudi_service_http_elli application

Overview

Generated by EDoc


text:
package org.wso2.carbon.mediator.urlrewrite;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.wso2.carbon.mediator.service.MediatorService;

/**
 * Activator class of the URLRewriteMediator
 *
 */
public class URLRewriteMediatorActivator implements BundleActivator {

		private static final Log log = LogFactory.getLog(URLRewriteMediatorActivator.class);

		public void start(BundleContext bundleContext) throws Exception {
				if (log.isDebugEnabled()) {
						log.debug(" URLRewriteMediator component starts");
				}

				//Properties props = new Properties();
				bundleContext.registerService(MediatorService.class.getName(),
				                              new URLRewriteMediatorService(), null);
				bundleContext.registerService(MediatorService.class.getName(),
				                               new URLRulesMediatorService(), null);

				if (log.isDebugEnabled()) {
						log.debug("Successfully registered the property mediator service");
				}

		}

		public void stop(BundleContext arg0) throws Exception {
				if (log.isDebugEnabled()) {
						log.debug("Stopped the URLRewriteMediator component.");
				}

		}

}


text:
#!/usr/bin/env node

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

module.exports = function (context) {
    function main () {
        // get the file transfer server address from the specified variables
        var fileTransferServerAddress = getFileTransferServerAddress(context) || getDefaultFileTransferServerAddress(context);
        console.log('Tests will use the following file transfer server address: ' + fileTransferServerAddress);
        console.log(
            'If you\'re using cordova@6.3.1 and the above address is wrong at "platform add", don\'t worry, it\'ll fix itself on "cordova run" or "cordova prepare".'
        );

        // pass it to the tests
        writeFileTransferOptions(fileTransferServerAddress, context);
    }

    function getDefaultFileTransferServerAddress (context) {
        var address = null;
        var configNodes = context.opts.plugin.pluginInfo._et._root._children;

        for (var node in configNodes) {
            if (configNodes[node].attrib.name === 'FILETRANSFER_SERVER_ADDRESS') {
                address = configNodes[node].attrib.default;
            }
        }

        return address;
    }

    function getFileTransferServerAddress (context) {
        var platformJsonFile = path.join(
            context.opts.projectRoot,
            'platforms',
            context.opts.platforms[0],
            context.opts.platforms[0] + '.json'
        );
        var platformJson = JSON.parse(fs.readFileSync(platformJsonFile, 'utf8'));

        if (
            platformJson &&
            platformJson.installed_plugins &&
            platformJson.installed_plugins['cordova-plugin-file-transfer-tests'] &&
            platformJson.installed_plugins['cordova-plugin-file-transfer-tests'].FILETRANSFER_SERVER_ADDRESS
        ) {
            return platformJson.installed_plugins['cordova-plugin-file-transfer-tests'].FILETRANSFER_SERVER_ADDRESS;
        } else {
            return null;
        }
    }

    function writeFileTransferOptions (address, context) {
        for (var p in context.opts.paths) {
            var ftOpts = {
                serverAddress: address
            };
            var ftOptsString = JSON.stringify(ftOpts);
            var ftOptsFile = path.join(context.opts.paths[p], 'fileTransferOpts.json');
            fs.writeFileSync(ftOptsFile, ftOptsString, 'utf8');
        }
    }

    main();
};


text:
package consulo.internal.dotnet.msil.decompiler.file;

import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import consulo.internal.dotnet.asm.mbel.AssemblyInfo;
import consulo.internal.dotnet.asm.mbel.CustomAttribute;
import consulo.internal.dotnet.asm.mbel.ModuleParser;
import consulo.internal.dotnet.asm.mbel.TypeDef;
import consulo.internal.dotnet.msil.decompiler.textBuilder.util.XStubUtil;
import consulo.internal.dotnet.msil.decompiler.util.MsilHelper;
import consulo.vfs.impl.archive.ArchiveEntry;
import consulo.vfs.impl.archive.ArchiveFile;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

/**
 * @author VISTALL
 * @since 11.12.13.
 */
public class DotNetArchiveFile implements ArchiveFile
{
	public static final int VERSION = 4;

	public static final String BYTECODE_FILE_EXTENSION = "il";

	private final Map<String, ArchiveEntry> myArchiveEntries;

	private String myName;

	public DotNetArchiveFile(@Nonnull File originalFile, ModuleParser moduleParser, long l)
	{
		myArchiveEntries = map(originalFile.getPath(), moduleParser, l);
		myName = originalFile.getName();
	}

	@Nonnull
	@Override
	public String getName()
	{
		return myName;
	}

	@Nonnull
	private static Map<String, ArchiveEntry> map(@Nonnull String originalFilePath, @Nonnull ModuleParser moduleParser, long lastModifier)
	{
		Ref<ModuleParser> moduleParserRef = Ref.create(moduleParser);
		TypeDef[] typeDefs = moduleParser.getTypeDefs();
		List<DotNetFileArchiveEntry> fileList = new ArrayList<>();

		Map<String, DotNetBaseFileArchiveEntry> duplicateMap = new HashMap<>(); // map used for collect types with same name but different signature

		TypeDef moduleTypeDef = null;

		// iterate type def add as files
		for(TypeDef typeDef : typeDefs)
		{
			String name = typeDef.getName();
			if(Comparing.equal(name, DotNetModuleFileArchiveEntry.ModuleTypeDef))
			{
				moduleTypeDef = typeDef;
				continue;
			}

			if(XStubUtil.isInvisibleMember(name) || typeDef.getParent() != null)
			{
				continue;
			}

			String userName = MsilHelper.cutGenericMarker(name);

			String path;
			String namespace = typeDef.getNamespace();
			if(StringUtil.isEmpty(namespace))
			{
				path = userName + "." + BYTECODE_FILE_EXTENSION;
			}
			else
			{
				path = namespace.replace(".", "/") + "/" + userName + "." + BYTECODE_FILE_EXTENSION;
			}

			DotNetBaseFileArchiveEntry fileWithSameName = duplicateMap.get(path);
			if(fileWithSameName != null)
			{
				fileWithSameName.addTypeDef(typeDef);
			}
			else
			{
				DotNetBaseFileArchiveEntry e = new DotNetBaseFileArchiveEntry(originalFilePath, moduleParserRef, typeDef, path, lastModifier);
				fileList.add(e);
				duplicateMap.put(path, e);
			}
		}

		AssemblyInfo assemblyInfo = moduleParser.getAssemblyInfo();
		if(assemblyInfo != null)
		{
			fileList.add(new DotNetAssemblyFileArchiveEntry(originalFilePath, moduleParserRef, assemblyInfo, lastModifier));
		}

		if(moduleTypeDef != null)
		{
			List<CustomAttribute> customAttributes = moduleTypeDef.getCustomAttributes();
			if(!customAttributes.isEmpty())
			{
				fileList.add(new DotNetModuleFileArchiveEntry(originalFilePath, moduleParserRef, moduleTypeDef, lastModifier));
			}
		}

		// sort - at to head, files without namespaces
		Collections.sort(fileList, (o1, o2) ->
		{
			int compare = StringUtil.compare(o1.getNamespace(), o2.getNamespace(), true);
			if(compare != 0)
			{
				return compare;
			}

			return o1.getName().compareToIgnoreCase(o2.getName());
		});

		Map<String, ArchiveEntry> map = new HashMap<>(fileList.size() + 10);

		List<String> alreadyAddedNamespaces = new ArrayList<>();

		for(DotNetFileArchiveEntry fileEntry : fileList)
		{
			DotNetDirArchiveEntry dirEntry = createNamespaceDirIfNeed(alreadyAddedNamespaces, fileEntry, lastModifier);
			if(dirEntry != null)
			{
				map.put(dirEntry.getName(), dirEntry);
			}

			map.put(fileEntry.getName(), fileEntry);
		}

		return map;
	}

	private static DotNetDirArchiveEntry createNamespaceDirIfNeed(List<String> defineList, DotNetFileArchiveEntry position, long lastModified)
	{
		String namespace = position.getNamespace();
		if(StringUtil.isEmpty(namespace))
		{
			return null;
		}

		String[] split = namespace.split("\\.");

		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < split.length; i++)
		{
			String part = split[i];
			if(i != 0)
			{
				builder.append("/");
			}

			builder.append(part);

			String dirPath = builder.toString();
			if(!defineList.contains(dirPath))
			{
				defineList.add(dirPath);

				return new DotNetDirArchiveEntry(dirPath + "/", lastModified);
			}
		}
		return null;
	}

	@Nullable
	@Override
	public ArchiveEntry getEntry(String name)
	{
		return myArchiveEntries.get(name);
	}

	@Nullable
	@Override
	public InputStream getInputStream(ArchiveEntry archiveEntry) throws IOException
	{
		if(archiveEntry instanceof DotNetDirArchiveEntry)
		{
			return new ByteArrayInputStream(ArrayUtil.EMPTY_BYTE_ARRAY);
		}
		return ((DotNetFileArchiveEntry) archiveEntry).createInputStream();
	}

	@Nonnull
	@Override
	public Iterator<? extends ArchiveEntry> entries()
	{
		return myArchiveEntries.values().iterator();
	}

	@Override
	public int getSize()
	{
		return myArchiveEntries.size();
	}
}


text:
<?php

namespace xen\http;

/**
 * Class Response
 *
 * The Response
 *
 * @package    xenframework
 * @subpackage xen\http
 * @author     Ismael Trascastro <itrascastro@xenframework.com>
 * @copyright  Copyright (c) xenFramework. (http://xenframework.com)
 * @license    MIT License - http://en.wikipedia.org/wiki/MIT_License
 * @link       https://github.com/xenframework/xen
 * @since      Class available since Release 1.0.0
 */
class Response
{
    /**
     * @var string The Response headers
     */
    private $_headers;

    /**
     * @var string The Response content
     */
    private $_content;

    /**
     * @var int The Response status code
     */
    private $_statusCode;

    /**
     * __construct
     *
     * The status code is not set at this point
     */
    public function __construct()
    {
        $this->_statusCode = false;
    }

    /**
     * send
     *
     * Set the Response status code and echoes the Response content
     *
     * @return $this The Response
     */
    public function send()
    {
        http_response_code($this->_statusCode);

        echo $this->_content;

        return $this;
    }

    /**
     * setContent
     *
     * @param string $content
     */
    public function setContent($content)
    {
        $this->_content = $content;
    }

    /**
     * getContent
     *
     * @return string
     */
    public function getContent()
    {
        return $this->_content;
    }

    /**
     * setHeaders
     *
     * @param string $headers
     */
    public function setHeaders($headers)
    {
        $this->_headers = $headers;
        header($this->_headers);
    }

    /**
     * getHeaders
     *
     * @return string
     */
    public function getHeaders()
    {
        return $this->_headers;
    }

    /**
     * setStatusCode
     *
     * @param int $statusCode
     */
    public function setStatusCode($statusCode)
    {
        $this->_statusCode = $statusCode;
    }

    /**
     * getStatusCode
     *
     * @return bool|int False if it is not set
     */
    public function getStatusCode()
    {
        return $this->_statusCode;
    }

}


text:
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Autofac;
using GSoft.Dynamite.Events;
using GSoft.Dynamite.Globalization;
using GSoft.Dynamite.Logging;
using GSoft.Dynamite.Navigation.Contracts.Configuration;
using Microsoft.SharePoint;

namespace GSoft.Dynamite.Navigation.SP.Features.CommonCMS_NavigationEventReceivers
{
    /// <summary>
    /// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
    /// </summary>
    /// <remarks>
    /// The GUID attached to this class may be used during packaging and should not be modified.
    /// </remarks>
    [Guid("7c3fcc9d-c9b4-4e75-bde4-7d052a102383")]
    public class CommonCMS_NavigationEventReceiversEventReceiver : SPFeatureReceiver
    {
        /// <summary>
        /// Creates event receivers for the <c>browsable</c> item content type
        /// </summary>
        /// <param name="properties">The event properties</param>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var site = properties.Feature.Parent as SPSite;

            if (site != null)
            {
                using (var featureScope = NavigationContainerProxy.BeginFeatureLifetimeScope(properties.Feature))
                {
                    var baseReceiversConfig = featureScope.Resolve<INavigationEventReceiverInfoConfig>();
                    var eventReceiverHelper = featureScope.Resolve<IEventReceiverHelper>();
                    var resourceLocator = featureScope.Resolve<IResourceLocator>();
                    var logger = featureScope.Resolve<ILogger>();

                    foreach (var eventReceiverInfo in baseReceiversConfig.EventReceivers)
                    {
                        // Do it for content type and list
                        eventReceiverHelper.AddContentTypeEventReceiverDefinition(site, eventReceiverInfo);
                        logger.Info("Provisioning event receiver for content type {0}", resourceLocator.Find(eventReceiverInfo.ContentType.DisplayNameResourceKey));
                    }
                }
            }
        }

        /// <summary>
        /// Deletes event receivers for the <c>browsable</c> item content type
        /// </summary>
        /// <param name="properties">The event properties</param>
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            var site = properties.Feature.Parent as SPSite;

            if (site != null)
            {
                using (var featureScope = NavigationContainerProxy.BeginFeatureLifetimeScope(properties.Feature))
                {
                    var baseReceiversConfig = featureScope.Resolve<INavigationEventReceiverInfoConfig>();
                    var eventReceiverHelper = featureScope.Resolve<IEventReceiverHelper>();
                    var resourceLocator = featureScope.Resolve<IResourceLocator>();
                    var logger = featureScope.Resolve<ILogger>();

                    foreach (var eventReceiver in baseReceiversConfig.EventReceivers)
                    {
                        logger.Info("Deleting event receiver for content type {0}", resourceLocator.Find(eventReceiver.ContentType.DisplayNameResourceKey));

                        eventReceiver.AssemblyName = Assembly.GetExecutingAssembly().FullName;

                        eventReceiverHelper.DeleteContentTypeEventReceiverDefinition(site, eventReceiver);
                    }
                }
            }
        }
    }
}


text:
package org.hsqldb.rowio;

import j2me.math.BigDecimal;
import j2me.sql.Date;
import j2me.sql.Time;
import j2me.sql.Timestamp;

import org.hsqldb.CachedRow;
import org.hsqldb.Column;
import org.hsqldb.HsqlDateTime;
import org.hsqldb.lib.StringConverter;
import org.hsqldb.types.Binary;
import org.hsqldb.types.JavaObject;

/**
 * @author fredt@users
 * @since 1.7.2
 * @version 1.7.2
 */
public class RowOutputTextLog extends RowOutputBase {

    static final byte[]     BYTES_NULL  = "NULL".getBytes();
    static final byte[]     BYTES_TRUE  = "TRUE".getBytes();
    static final byte[]     BYTES_FALSE = "FALSE".getBytes();
    static final byte[]     BYTES_AND   = " AND ".getBytes();
    static final byte[]     BYTES_IS    = " IS ".getBytes();
    public static final int MODE_DELETE = 1;
    public static final int MODE_INSERT = 0;
    private boolean         isWritten;
    private int             logMode;

    public void setMode(int mode) {
        logMode = mode;
    }

    protected void writeFieldPrefix() {

        if (logMode == MODE_DELETE && isWritten) {
            write(BYTES_AND);
        }
    }

    protected void writeChar(String s, int t) {

        write('\'');
        StringConverter.unicodeToAscii(this, s, true);
        write('\'');
    }

    protected void writeReal(Double o, int type) {
        writeBytes(Column.createSQLString( o.doubleValue()));
    }

    protected void writeSmallint(Object o) {
        this.writeBytes(o.toString());
    }

    public void writeEnd() {}

    protected void writeTime(Time o) {

        write('\'');
        writeBytes(o.toString());
        write('\'');
    }

    protected void writeBinary(Binary o, int t) {

        ensureRoom(o.getBytesLength() * 2 + 2);
        write('\'');
        StringConverter.writeHex(getBuffer(), count, o.getBytes());

        count += o.getBytesLength() * 2;

        write('\'');
    }

    public void writeType(int type) {}

    public void writeSize(int size) {}

    protected void writeDate(Date o) {

        write('\'');
        this.writeBytes(o.toString());
        write('\'');
    }

    public int getSize(CachedRow row) {
        return 0;
    }

    protected void writeInteger(Object o) {
        this.writeBytes(o.toString());
    }

    protected void writeBigint(Object o) {
        this.writeBytes(o.toString());
    }

//fredt@users - patch 1108647 by nkowalcz@users (NataliaK) fix for IS NULL
    protected void writeNull(int type) {

        if (logMode == MODE_DELETE) {
            write(BYTES_IS);
        } else if (isWritten) {
            write(',');
        }

        isWritten = true;

        write(BYTES_NULL);
    }

    protected void writeOther(JavaObject o) {

        ensureRoom(o.getBytesLength() * 2 + 2);
        write('\'');
        StringConverter.writeHex(getBuffer(), count, o.getBytes());

        count += o.getBytesLength() * 2;

        write('\'');
    }

    public void writeString(String value) {
        StringConverter.unicodeToAscii(this, value, false);
    }

    protected void writeBit(Boolean o) {
        write(o.booleanValue() ? BYTES_TRUE
                               : BYTES_FALSE);
    }

    protected void writeDecimal(BigDecimal o) {
        this.writeBytes(o.toString());
    }

    protected void writeFieldType(int type) {

        if (logMode == MODE_DELETE) {
            write('=');
        } else if (isWritten) {
            write(',');
        }

        isWritten = true;
    }

    public void writeLongData(long value) {
        this.writeBytes(Long.toString(value));
    }

    public void writeIntData(int i, int position) {}

    protected void writeTimestamp(Timestamp o) {

        write('\'');
        this.writeBytes(HsqlDateTime.getTimestampString(o));
        write('\'');
    }

    public void writeShortData(short i) {
        writeBytes(Integer.toString(i));
    }

    public void writeIntData(int i) {
        writeBytes(Integer.toString(i));
    }

    public void reset() {

        super.reset();

        isWritten = false;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.ViewManagement;

namespace Intense.UI
{
    /// <summary>
    /// The <see cref="ApplicationView"/> event sink.
    /// </summary>
    public interface IApplicationViewEventSink
    {
        /// <summary>
        /// Occurs when the window is removed from the list of recently used apps, or if the user executes a close gesture on it.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void OnConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args);
        /// <summary>
        /// This event is raised when the value of VisibleBounds changes, typically as a result of the status bar, app bar, or other chrome being shown or hidden.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void OnVisibleBoundsChanged(ApplicationView sender, object args);
    }
}


text:
import { assert } from 'chai';
import StorageService from '../../../api/services/StorageService';

describe('services:StorageService', () => {
  it('Should properly export', () => {
    assert.isObject(StorageService);
  });
});


text:
package org.sfm.reflect.meta;

import org.junit.Test;
import org.sfm.reflect.ReflectionService;
import org.sfm.reflect.impl.NullSetter;

import static org.junit.Assert.*;

public class DirectClassMetaTest {

    @Test
    public void testDirect() {
        ClassMeta<String> direct = ReflectionService.newInstance().getClassMeta(String.class);

        assertTrue(direct instanceof DirectClassMeta);
        assertEquals("DirectClassMeta{target=class java.lang.String}", direct.toString());

        PropertyMeta<String, Object> property = direct.newPropertyFinder().findProperty(new DefaultPropertyNameMatcher("bbb", 0, true, true));

        assertNull(direct.newPropertyFinder().getEligibleInstantiatorDefinitions());

        assertTrue(property instanceof DirectClassMeta.DirectPropertyMeta);
        assertEquals("DirectPropertyMeta{type=class java.lang.String}", property.toString());

        try {
            property.newGetter();
            fail("expected exception");
        } catch(Exception e) {
            // expected
        }

        assertTrue(NullSetter.isNull(property.newSetter()));

        assertArrayEquals(new String[] {""},  direct.generateHeaders());

        assertEquals(".", property.getPath());

    }
}


text:
package org.mp.em4so.common.capabilities;

import java.util.Date;

import org.mp.em4so.exceptions.UnImplementedCapabilityException;
import org.mp.em4so.model.actuating.Capability;
import org.mp.em4so.model.common.Element;
import org.mp.em4so.model.sensing.Observation;
import org.mp.em4so.model.sensing.Property;
import org.mp.em4so.model.sensing.Sensor;

// TODO: Auto-generated Javadoc
/**
 * The Class SensingCapability.
 */
public class SensingCapability extends Capability {

	/** The sensor. */
	protected Sensor sensor;

	/**
	 * Read.
	 *
	 * @param property the property
	 * @return the observation
	 */
	public final Observation read(Property property){
		Observation observation = new Observation();
		observation.setProperty(property);
		observation.setSensor(sensor);
		try {
			observation.setValue(readValue());
		} catch (UnImplementedCapabilityException e) {
			LOG.info("No ad hoc capability for property {} / {}",property.getScope(),property.getName());
			observation.setValue(readValue(property.getScope(),property.getName()));

		}
		observation.setTime(new Date());
		return observation;

	}

	/**
	 * Read value.
	 *
	 * @return the string
	 * @throws UnImplementedCapabilityException the un implemented capability exception
	 */
	public String readValue() throws UnImplementedCapabilityException{
		//TODO to review: It cannot be abstract because it is used as a generic POJO when using the read values, but in order to read, every child has its implementation
		throw new UnImplementedCapabilityException ("Capability Not found for reading the required property");
	}

	/**
	 * Read value.
	 *
	 * @param scope the scope
	 * @param propertyName the property name
	 * @return the string
	 */
	private String readValue(String scope,String propertyName) {

//		String strUrl = SOMFileConfigUtils.getKBUrl()+"/"+SOMFileConfigUtils.getKBPrefix()+getSOControlAgent().getId()+ "/_design/environment/_list/currentValue/all?keys=[\""+propertyName+"\"]";
//		RESTClientUtils c = new RESTClientUtils(SOMFileConfigUtils.getKBUser() + ":" +SOMFileConfigUtils.getKBPass() );
//		String result = c.doGet(strUrl);
		LOG.trace("Starting reading of {}",propertyName);
		String result = null;
		Element element = new Element(scope,propertyName);
		LOG.trace("2- mid reading of {}",propertyName);
		element = soca.getSom().getKbm().getPropertyValue(element);
		LOG.trace("3- end reading of {}",propertyName);
		if(element!= null){
			result = element.getValue();
		}else{
			result = "";
		}
		LOG.trace("Reading {}: {}",propertyName,result);
		return result;
	}

	/**
	 * Gets the sensor.
	 *
	 * @return the sensor
	 */
	public Sensor getSensor() {
		return sensor;
	}

	/**
	 * Sets the sensor.
	 *
	 * @param sensor the new sensor
	 */
	public void setSensor(Sensor sensor) {
		this.sensor = sensor;
	};

}


text:
<?php

class Ess_M2ePro_Sql_Upgrade_v6_2_4__v6_2_4_1_AllFeatures extends Ess_M2ePro_Model_Upgrade_Feature_AbstractFeature
{
    //########################################

    public function execute()
    {
        $installer = $this->_installer;
        $connection = $installer->getConnection();

        $tempTables = array(
            'm2epro_ebay_template_selling_format',
            'm2epro_amazon_template_selling_format',
            'm2epro_buy_template_selling_format',
            'm2epro_play_template_selling_format'
        );

        foreach ($tempTables as $tableName) {

            $tempTable = $installer->getTable($tableName);

            if ($connection->tableColumnExists($tempTable, 'qty_max_posted_value_mode') !== false &&
                $connection->tableColumnExists($tempTable, 'qty_modification_mode') === false) {
                $connection->changeColumn(
                    $tempTable,
                    'qty_max_posted_value_mode',
                    'qty_modification_mode',
                    'tinyint(2) UNSIGNED NOT NULL AFTER `qty_percentage`'
                );
            }

            if ($connection->tableColumnExists($tempTable, 'qty_min_posted_value') === false) {
                $connection->addColumn(
                    $tempTable,
                    'qty_min_posted_value',
                    'int(11) UNSIGNED DEFAULT NULL AFTER `qty_modification_mode`'
                );
            }
        }

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

        $tempTable = $installer->getTable('m2epro_amazon_template_synchronization');
        $columnName = 'stop_out_off_stock';

        if ($connection->tableColumnExists($tempTable, $columnName) !== false) {
            $connection->changeColumn(
                $tempTable, $columnName, $columnName,
                'tinyint(2) UNSIGNED NOT NULL'
            );
        }

        $tempTable = $installer->getTable('m2epro_buy_template_synchronization');
        $columnName = 'stop_out_off_stock';

        if ($connection->tableColumnExists($tempTable, $columnName) !== false) {
            $connection->changeColumn(
                $tempTable, $columnName, $columnName,
                'tinyint(2) UNSIGNED NOT NULL'
            );
        }

        //########################################

        $installer->run(<<<SQL

UPDATE `m2epro_ebay_template_selling_format`
SET `qty_min_posted_value` = 1;

UPDATE `m2epro_amazon_template_selling_format`
SET `qty_min_posted_value` = 1;

UPDATE `m2epro_buy_template_selling_format`
SET `qty_min_posted_value` = 1;

UPDATE `m2epro_play_template_selling_format`
SET `qty_min_posted_value` = 1;

SQL
        );

        //########################################

        $installer->run(<<<SQL

UPDATE `m2epro_cache_config`
SET `value` = null
WHERE `group` = '/installation/version/history/' AND `create_date` = `value`;

SQL
        );
    }

    //########################################
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="b4de846d-37b9-4e48-914e-07bf28440869" name="Default" comment="" />
    <ignored path="idaal.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="idaal" />
  </component>
  <component name="FileEditorManager">
    <leaf />
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="CSS File" />
        <option value="JavaScript File" />
      </list>
    </option>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/json/employees.json" />
        <option value="$PROJECT_DIR$/js/cut.js" />
        <option value="$PROJECT_DIR$/js/script.js" />
        <option value="$PROJECT_DIR$/json/organisations.json" />
        <option value="$PROJECT_DIR$/css/style.css" />
        <option value="$PROJECT_DIR$/js/idaal.js" />
        <option value="$PROJECT_DIR$/index.html" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="NamedScopeManager">
    <order />
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="576" />
    <option name="y" value="89" />
    <option name="width" value="1333" />
    <option name="height" value="995" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="Scratches" />
      <pane id="Scope" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="idaal" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="list.type.of.created.stylesheet" value="CSS" />
    <property name="FullScreen" value="false" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/js" />
      <recent name="$PROJECT_DIR$/json" />
    </key>
  </component>
  <component name="RunManager">
    <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
      <method />
    </configuration>
    <configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
      <method />
    </configuration>
    <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file="">
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="JsTestDriver-test-runner" factoryName="JsTestDriver">
      <setting name="configLocationType" value="CONFIG_FILE" />
      <setting name="settingsFile" value="" />
      <setting name="serverType" value="INTERNAL" />
      <setting name="preferredDebugBrowser" value="Chrome" />
      <method />
    </configuration>
    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
      <method />
    </configuration>
    <configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
      <option name="cucumberJsArguments" value="" />
      <option name="executablePath" />
      <option name="filePath" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-options />
      <gulpfile />
      <tasks />
      <arguments />
      <pass-parent-envs>true</pass-parent-envs>
      <envs />
      <method />
    </configuration>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="b4de846d-37b9-4e48-914e-07bf28440869" name="Default" comment="" />
      <created>1434054670997</created>
      <option name="number" value="Default" />
      <updated>1434054670997</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="576" y="89" width="1333" height="995" extended-state="0" />
    <editor active="false" />
    <layout>
      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.15521236" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/css/._bootstrap.min.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/json/organisations.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="33" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/style.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="17" selection-start-line="40" selection-start-column="17" selection-end-line="40" selection-end-column="17" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/idaal.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
          <folding>
            <element signature="e#0#40#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/._bootstrap.min.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/json/organisations.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="33" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/style.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="17" selection-start-line="40" selection-start-column="17" selection-end-line="40" selection-end-column="17" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/idaal.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
          <folding>
            <element signature="e#0#40#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/._bootstrap.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="58" selection-start-line="0" selection-start-column="58" selection-end-line="0" selection-end-column="58" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/jquery.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/script.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="8" column="19" selection-start-line="8" selection-start-column="19" selection-end-line="8" selection-end-column="19" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/json/organisations.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.6934487">
          <caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="33" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/._bootstrap.min.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/style.css">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="17" selection-start-line="40" selection-start-column="17" selection-end-line="40" selection-end-column="17" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/idaal.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.16287425">
          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
          <folding>
            <element signature="e#0#40#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.25216317">
          <caret line="140" column="224" selection-start-line="140" selection-start-column="224" selection-end-line="140" selection-end-column="224" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
(function() {
	var each = tinymce.each;

	tinymce.create('tinymce.plugins.TemplatePlugin', {
		init : function(ed, url) {
			var t = this;

			t.editor = ed;

			// Register commands
			ed.addCommand('mceTemplate', function(ui) {
				ed.windowManager.open({
					file : url + '/template.htm',
					width : ed.getParam('template_popup_width', 750),
					height : ed.getParam('template_popup_height', 600),
					inline : 1
				}, {
					plugin_url : url
				});
			});

			ed.addCommand('mceInsertTemplate', t._insertTemplate, t);

			// Register buttons
			ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'});

			ed.onPreProcess.add(function(ed, o) {
				var dom = ed.dom;

				each(dom.select('div', o.node), function(e) {
					if (dom.hasClass(e, 'mceTmpl')) {
						each(dom.select('*', e), function(e) {
							if (dom.hasClass(e, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))
								e.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));
						});

						t._replaceVals(e);
					}
				});
			});
		},

		getInfo : function() {
			return {
				longname : 'Template plugin',
				author : 'Moxiecode Systems AB',
				authorurl : 'http://www.moxiecode.com',
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template',
				version : tinymce.majorVersion + "." + tinymce.minorVersion
			};
		},

		_insertTemplate : function(ui, v) {
			var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent();

			h = v.content;

			each(t.editor.getParam('template_replace_values'), function(v, k) {
				if (typeof(v) != 'function')
					h = h.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);
			});

			el = dom.create('div', null, h);

			// Find template element within div
			n = dom.select('.mceTmpl', el);
			if (n && n.length > 0) {
				el = dom.create('div', null);
				el.appendChild(n[0].cloneNode(true));
			}

			function hasClass(n, c) {
				return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
			};

			each(dom.select('*', el), function(n) {
				// Replace cdate
				if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|')))
					n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format")));

				// Replace mdate
				if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))
					n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));

				// Replace selection
				if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|')))
					n.innerHTML = sel;
			});

			t._replaceVals(el);

			ed.execCommand('mceInsertContent', false, el.innerHTML);
			ed.addVisual();
		},

		_replaceVals : function(e) {
			var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values');

			each(dom.select('*', e), function(e) {
				each(vl, function(v, k) {
					if (dom.hasClass(e, k)) {
						if (typeof(vl[k]) == 'function')
							vl[k](e);
					}
				});
			});
		},

		_getDateTime : function(d, fmt) {
				if (!fmt)
					return "";

				function addZeros(value, len) {
					var i;

					value = "" + value;

					if (value.length < len) {
						for (i=0; i<(len-value.length); i++)
							value = "0" + value;
					}

					return value;
				}

				fmt = fmt.replace("%D", "%m/%d/%y");
				fmt = fmt.replace("%r", "%I:%M:%S %p");
				fmt = fmt.replace("%Y", "" + d.getFullYear());
				fmt = fmt.replace("%y", "" + d.getYear());
				fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
				fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
				fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
				fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
				fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
				fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
				fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
				fmt = fmt.replace("%B", "" + this.editor.getLang("template_months_long").split(',')[d.getMonth()]);
				fmt = fmt.replace("%b", "" + this.editor.getLang("template_months_short").split(',')[d.getMonth()]);
				fmt = fmt.replace("%A", "" + this.editor.getLang("template_day_long").split(',')[d.getDay()]);
				fmt = fmt.replace("%a", "" + this.editor.getLang("template_day_short").split(',')[d.getDay()]);
				fmt = fmt.replace("%%", "%");

				return fmt;
		}
	});

	// Register plugin
	tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin);
})();


text:
//////////////////////////////// -*- C++ -*- //////////////////////////////
//
// FILE NAME
//   ParticlesWithIdFunctions.hh
//
// AUTHOR
//    A. Shishlo
//
// CREATED
//    09/01/2015
//
// DESCRIPTION
//    A set of functions for bunches with the ParticleIdNumber attribute
//
///////////////////////////////////////////////////////////////////////////

#ifndef PARTICLES_WITH_ID_FUNCTIONS_H
#define PARTICLES_WITH_ID_FUNCTIONS_H

#include <cmath>

//ORBIT bunch
#include "Bunch.hh"

#include "Matrix.hh"

namespace OrbitUtils{

	/** A function that will sort bunch according to Id.*/
	void bunch_sort_id(Bunch* bunch);

	/**
	  Calculates transport matrix A: x_out = A*x_in +b. A is a 7x7 matrix.
		The last column of A is the b vector.
	  It returns 0 if unsuccessful or the size of the statistics otherwise.
	*/
	int transport_mtrx(Bunch* bunch_in, Bunch* bunch_out, Matrix* A_mtr);

	/** A function analyzes two bunches assuming the vectors of coordinates
	    transformation x_out = A*x_in + b, where x_in the initial coordinates,
			and x_out final. The results are matrix A (7x7) with the last column as a vector b.
			We assume that bunch_in and bunch_out are sorted according to Id PartAttr, and
			bunch_out has less particles than bunch_in (some of them could be lost).
			It returns 0 if unsuccessful or the size of the statistics otherwise.
			For statistics it uses the weights according to Gaussian distribution with
			Twiss parameters.
	*/
	int transport_mtrx(Bunch* bunch_in, Bunch* bunch_out, Matrix* A_mtr, int appl_twiss_x, int appl_twiss_y, int appl_twiss_z);

	/** A function analyzes two bunches assuming that they are already
	    sorted and synchronized according to the macro-particles Id.
	    Macrosizes of macro-particles in "in" and "out" bunches will be
	    multiplied by the same numbers wx*wy*wz where
	    wx = exp(-(x^2+(alphax*x+betax*x')^2)/(2*(betax*emittancex))
	    etc.
	    Alpha, beta, emittance are the Twiss parameters for the corresponding
	    plane.
	*/
	void apply_twiss_weights(Bunch* bunch_in, Bunch* bunch_out,int appl_x,int appl_y,int appl_z);

};
///////////////////////////////////////////////////////////////////////////
//
// END OF FILE
//
///////////////////////////////////////////////////////////////////////////

#endif


text:
/**

Structured buffer
Tempalte class that has both GPU and cpu image of the data
whgen data chagnes it resend the data bind time

*/

#ifndef __STRUCTUREDBUFFER_H__
#define __STRUCTUREDBUFFER_H__

#include "GLHeader.h"
#include <vector>
#include <cstdint>
#include <cassert>
#include <algorithm>

template <class T>
class StructuredBuffer
{
	private:
		static	size_t			resizeFactor;

		GLuint					bufferId;
		size_t					bufferCapacity;
		std::vector<T>			dataGPUImage;

		void					CheckBufferSize();

	protected:

	public:
		// Constructors & Destructor
								StructuredBuffer(size_t initialCapacity = 0, bool allocCPU = true);
								StructuredBuffer(StructuredBuffer&&);
								StructuredBuffer(const StructuredBuffer&) = delete;
		StructuredBuffer&		operator=(StructuredBuffer&&);
		StructuredBuffer&		operator=(const StructuredBuffer&) = delete;
								~StructuredBuffer();

		void					AddData(const T&);
		GLuint					getGLBuffer();
		size_t					Count() const;
		size_t					Capacity() const;

		void					Memset(uint8_t);
		void					Memset(uint32_t);
		void					Memset(uint32_t word, uint32_t offset, uint32_t size);
		void					BindAsUniformBuffer(GLuint location,
													GLuint countOffset,
													GLuint countSize) const;
		void					BindAsUniformBuffer(GLuint location) const;
		void					BindAsShaderStorageBuffer(GLuint location,
														  GLuint countOffset,
														  GLuint countSize);
		void					BindAsShaderStorageBuffer(GLuint location);
		void					BindAsDrawIndirectBuffer();

		void					Resize(size_t count, bool resizeCPU = true);
		void					RecieveData(size_t newSize);
		T						GetData(uint32_t index);
		void					ChangeData(uint32_t index, const T& newData);
		void					SendData();
		void					SendSubData(uint32_t offset, uint32_t size);
		void					SendSubData(const T* data, uint32_t offset,
											uint32_t size);

		std::vector<T>&			CPUData();
		const std::vector<T>&	CPUData() const;
};
#include "StructuredBuffer.hpp"
#endif //__STRUCTUREDBUFFER_H__


text:
class MakeTheUrnSequenceGlobalForAllCategories < ActiveRecord::Migration[4.2]
  def up
    execute 'DROP SEQUENCE "urn_seq_trade";'
    execute 'DROP SEQUENCE "urn_seq_innovation";'
    execute 'DROP SEQUENCE "urn_seq_development";'
    execute 'DROP SEQUENCE "urn_seq_promotion";'
    execute "CREATE SEQUENCE urn_seq;"
  end

  def down
    execute "DROP SEQUENCE urn_seq;"
    execute 'CREATE SEQUENCE "urn_seq_trade";'
    execute 'CREATE SEQUENCE "urn_seq_innovation";'
    execute 'CREATE SEQUENCE "urn_seq_development";'
    execute 'CREATE SEQUENCE "urn_seq_promotion";'
  end
end


text:
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;

namespace SDWebImageSampleTV
{
    [Register ("ImageCell")]
    partial class ImageCell
    {
        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UIImageView imageView { get; set; }

        void ReleaseDesignerOutlets ()
        {
            if (imageView != null) {
                imageView.Dispose ();
                imageView = null;
            }
        }
    }
}


text:
use grin_chain as chain;
use grin_core as core;
use grin_p2p as p2p;
use grin_pool as pool;

use grin_util as util;

#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate log;

#[macro_use]
mod web;
pub mod auth;
pub mod client;
mod foreign;
pub mod foreign_rpc;
mod handlers;
pub mod json_rpc;
mod owner;
pub mod owner_rpc;
mod rest;
mod router;
pub mod types;

pub use crate::auth::{
	BasicAuthMiddleware, BasicAuthURIMiddleware, GRIN_BASIC_REALM, GRIN_FOREIGN_BASIC_REALM,
};
pub use crate::foreign::Foreign;
pub use crate::foreign_rpc::ForeignRpc;
pub use crate::handlers::node_apis;
pub use crate::owner::Owner;
pub use crate::owner_rpc::OwnerRpc;
pub use crate::rest::*;
pub use crate::router::*;
pub use crate::types::*;
pub use crate::web::*;