text:
package com.twistedmatrix.amp;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.ClassNotFoundException;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.concurrent.TimeUnit;
import java.util.Collection;
import java.util.Date;
import java.util.TimeZone;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.Set;
import java.util.HashSet;

/**
 * Small ordered key => value mapping where the keys and values are both byte
 * arrays. This class is used to decode and encode AMP messages coming from and
 * going to the network. This class is rarely, if ever, used directly.
 */

public class AMPBox implements Map<byte[], byte[]> {
    private ArrayList<Pair> pairs;

    public AMPBox() {
	pairs = new ArrayList<Pair>();
    }

    /** Convert a byte array into a string. */
    public static String asString(byte[] in) {
	return asString(in, "ISO-8859-1");
    }

    /** Removes all of the mappings from this map. */
    @Override public void clear() throws UnsupportedOperationException {
	throw new UnsupportedOperationException();
    }

    /** Returns true if this map contains a mapping for the specified key. */
    public boolean containsKey(Object value) {
	return null != get(value);
    }

    /** Returns true if this maps one or more keys to the specified value. */
    public boolean containsValue(Object v) {
	byte[] value = (byte[]) v;
	for (Pair p: pairs) {
	    if (Arrays.equals(p.value, value)) {
		return true;
	    }
	}
	return false;
    }

    /** Returns a {@link Set} view of the mappings contained in this map. */
    @Override public Set<Map.Entry<byte[], byte[]>> entrySet() {
	HashSet<Map.Entry<byte[], byte[]>> hs =
	    new HashSet<Map.Entry<byte[], byte[]>>();
	for (Pair p: pairs) {
	    hs.add(p);
	}
	return hs;
    }

    /** Encodes the mapped data to a byte array. */
    public byte[] encode() {
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	for (Pair p: pairs) {
	    for (byte[] bp : new byte[][] {p.key, p.value}) {
		baos.write(bp.length / 0x100); // DIV
		baos.write(bp.length % 0x100); // MOD
		baos.write(bp, 0, bp.length);
	    }
	}
	baos.write(0);
	baos.write(0);
	return baos.toByteArray();
    }

    /** Compares the specified object with this map for equality. */
    @Override public boolean equals (Object o) {
	if (!(o instanceof AMPBox)) {
	    return false;
	}
	AMPBox other = (AMPBox) o;

	for (Pair p: pairs) {
	    if (!Arrays.equals(other.get(p.key), p.value)) {
		return false;
	    }
	}
	return true;
    }

    /** Adds all the public variables of an arbitrary Java object the the map.*/
    public void extractFrom(Object o) {
	Class c = o.getClass();
	Field[] fields = c.getFields();
	for (Field f: fields) {
	    putAndEncode(f, o);
	}
    }

    /** Extract error information if remote command returned an error. */
    public Throwable fillError() {
	String code = (String) getAndDecode("_error_code", String.class);
	String description = (String) getAndDecode("_error_description",
						   String.class);

	return new Throwable(code + " " + description);
    }

    /**
     * Take the values encoded in this packet and map them into an arbitrary
     * Java object.  This method will fill out fields declared in the given
     * object's class which correspond to types defined in the AMP protocol:
     * integer, unicode string, raw bytes, boolean, float.
     */

    public void fillOut(Object o) {
	Class c = o.getClass();
	Field[] fields = c.getFields();

	try {
	    for (Field f: fields) {
		byte[] toDecode = get(f.getName());
		Object decoded = getAndDecode(f);
		if (null != decoded) {
		    f.set(o, decoded);
		}
	    }
	} catch (IllegalAccessException iae) {
	    iae.printStackTrace();
	    /*
	      This should be basically impossible to get; getFields should
	      only give us public fields.
	    */
	}
    }

    /** Returns the value to which the specified key is mapped, or null
     * if this map contains no mapping for the key. */
    public byte[] get(byte[] key) {
	for(Pair p: pairs) {
	    if (Arrays.equals(key, p.key)) {
		return p.value;
	    }
	}
	return null;
    }

    /** Returns the value to which the specified key is mapped, or null
     * if this map contains no mapping for the key. */
    public byte[] get(String key) {
	return get(key.getBytes());
    }

    /** Returns the value to which the specified key is mapped, or null
     * if this map contains no mapping for the key. */
    public byte[] get(Object key) {
	if (key instanceof String) {
	    return get((String)key);
	} else if (key instanceof byte[]) {
	    return get((byte[])key);
	}
	return null;
    }

    /** Decode incoming data. */
    public Object getAndDecode(Field fld) {
	List<Class> listVals = getListTypes(fld);
	return decodeObject(this.get(fld.getName()), fld.getType(),
			    getListTypes(fld));
    }

    /** Decode incoming data. */
    public Object getAndDecode(String key, Class cls) {
	return decodeObject(this.get(key), cls, null);
    }

    /** Returns true if this map contains no key-value mappings. */
    @Override public boolean isEmpty() {
	return 0 == size();
    }

    /** Returns a {@link Set} view of the keys contained in this map. */
    @Override public Set<byte[]> keySet() {
	HashSet<byte[]> hs = new HashSet<byte[]>();
	for (Pair p: pairs) {
	    hs.add(p.key);
	}
	return hs;
    }

    /** Associates the specified value with the specified key in this map. */
    @Override public byte[] put(byte[] key, byte[] value) {
	pairs.add(new Pair(key, value));
	return null;
    }

    /** Associates the specified value with the specified key in this map. */
    public void put(String key, String value) {
	put(asBytes(key), asBytes(value));
    }

    /** Associates the specified value with the specified key in this map. */
    public void put(String key, byte[] value) {
	put(asBytes(key), value);
    }

    /** Copies all of the mappings from the specified map to this map. */
    @Override public void putAll(Map<? extends byte[], ? extends byte[]> m) {
	for (Map.Entry<? extends byte[], ? extends byte[]> me: m.entrySet()) {
	    put(me.getKey(), me.getValue());
	}
    }

    /** Encode outgoing data. */
    public void putAndEncode(Field fld, Object o) {
	try {
	    byte[] value = encodeObject(fld.getType(), fld.get(o),
					getListTypes(fld));
	    if (null != value) {
		put(asBytes(fld.getName()), value);
	    }
	} catch (IllegalAccessException iae) {
	    iae.printStackTrace();
	    /*
	      This should be basically impossible to get; getFields should
	      only give us public fields.
	    */
	}
    }

    /** Encode outgoing data. */
    public void putAndEncode(String key, Object o) {
	byte[] value = encodeObject(o.getClass(), o, null);
	if (null != value) {
	    put(asBytes(key), value);
	}
    }

    /** Removes the mapping for a key from this map if it is present. */
    @Override public byte[] remove(Object k) {
	byte[] key = (byte[]) k;
	for (int i = 0; i < pairs.size(); i++) {
	    Pair p = pairs.get(i);
	    if (Arrays.equals(p.key, key)) {
		pairs.remove(i);
		return p.value;
	    }
	}
	return null;
    }

    /** Returns the number of key-value mappings in this map. */
    @Override public int size() {
	return pairs.size();
    }

    /** Returns a {@link Collection} view of the values contained in this map.*/
    @Override public Collection<byte[]> values() {
	ArrayList<byte[]> v = new ArrayList<byte[]>();
	for (Pair p: pairs) {
	    v.add(p.value);
	}
	return v;
    }

    private class Pair implements Map.Entry<byte[], byte[]> {
	Pair(byte[] k, byte[] v) {
	    this.key = k;
	    this.value = v;
	}
	byte[] key;
	byte[] value;

	public boolean equals(Object o) {
	    if (o instanceof Pair) {
		Pair other = (Pair) o;
		return (Arrays.equals(other.key, this.key) &&
			Arrays.equals(other.value, this.value));
	    }
	    return false;
	}

	public byte[] getKey() { return key; }
	public byte[] getValue() { return value; }

	public byte[] setValue(byte[] value)
	    throws UnsupportedOperationException {
	    throw new UnsupportedOperationException();
	}
    }

    /** Convenience API because there is no byte literal syntax in java. */
    private static byte[] asBytes(String in) {
	return asBytes(in, "ISO-8859-1");
    }

    private static byte[] asBytes(String in, String encoding) {
	try {
	    return in.getBytes(encoding);
	} catch (UnsupportedEncodingException uee) {
	    throw new Error("JVMs are required to support encoding: "+encoding);
	}
    }

    private static String asString(byte[] in, String knownEncoding) {
	try {
	    return new String(in, knownEncoding);
	} catch (UnsupportedEncodingException uee) {
	    throw new Error("JVMs are required to support this encoding: " +
			    knownEncoding);
	}
    }

    private List<Class> getListTypes(Field fld) {
	List<Class> listVals = new ArrayList<Class>();
	if (fld != null &&
	    (fld.getType() == List.class || fld.getType() == ArrayList.class)) {
	    ParameterizedType pt = (ParameterizedType) fld.getGenericType();
	    for (Type type: pt.getActualTypeArguments()) {
		if (type instanceof Class) {
		    // Single dimensional ListOf
		    listVals.add((Class) type);
		} else {
		    // Multidimensional ListOf
		    //listVals.add((new ArrayList<Object>()).getClass());
		    for (String sub: type.toString().split("<"))
			if (sub.indexOf("List") > 5)
			    listVals.add((new ArrayList<Object>()).getClass());
			else try {
				String cn = sub.substring(0, sub.indexOf(">"));
				listVals.add(Class.forName(cn));
			    } catch (ClassNotFoundException cnf) {
				throw new Error ("Class not found: '"+sub+"'");
			    }
		}
	    }
	}
	return listVals;
    }

    private int getItemLength(byte[] item) {
	return (Int16StringReceiver.toInt(item[0])*256) +
	    Int16StringReceiver.toInt(item[1]);
    }

    /** Decode incoming data. */
    private Object decodeObject(byte[] toDecode, Class t, List<Class> lvals) {
	if (null != toDecode) {
	    if (t == int.class || t == Integer.class) {
		return Integer.decode(asString(toDecode));
	    } else if (t == String.class) {
		return asString(toDecode, "UTF-8");
	    } else if (t == double.class || t == Double.class) {
		String s = asString(toDecode);
		if (s.equals("Inf"))
		    return Double.POSITIVE_INFINITY;
		else if (s.equals("-Inf"))
		    return Double.NEGATIVE_INFINITY;
		else if (s.equals("nan"))
		    return Double.NaN;
		else
		    return Double.parseDouble(s);
	    } else if (t == boolean.class || t == Boolean.class) {
		String s = asString(toDecode);
		if (s.equals("True"))
		    return Boolean.TRUE;
		else
		    return Boolean.FALSE;
	    } else if (t == BigDecimal.class) {
		String s = asString(toDecode);
		if (s.equals("Infinity") || s.equals("-Infinity") ||
		    s.equals("NaN") || s.equals("-NaN") ||
		    s.equals("sNaN") || s.equals("-sNaN"))
		    throw new Error ("Value '" + s + "' is not supported!");
		else
		    return new BigDecimal(s);
	    } else if (t == Calendar.class ||
		       t.getSuperclass() == Calendar.class) {
		String s = asString(toDecode);
		Date date = new Date();
		SimpleDateFormat dtf =
		    new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS");
		try {
		    date = dtf.parse(s);
		} catch (ParseException pe) {
		    throw new Error ("Unable to parse date '" + s + "'!");
		}

		Calendar cal = Calendar.getInstance();
		cal.setTime(date);

		if (s.length() == 32) {
		    String tzid = "UTC" + s.substring(26, 32);
		    TimeZone tz = TimeZone.getTimeZone(tzid);
		    cal.setTimeZone(tz);
		}

		return cal;
	    } else if (t.getSuperclass() == AmpItem.class) {
		List<Object> result = new ArrayList<Object>();
		Map<String,Field> params = new HashMap<String,Field>();
		Field[] fields = t.getFields();
		for (Field f: fields) params.put(f.getName(), f);

		while (toDecode.length > 1) {
		    int tdlen = getItemLength(toDecode);
		    if (tdlen > 0) {
			Map<String,Object> values =new HashMap<String,Object>();
			for (String param: params.keySet()) {
			    byte[] hunk = new byte[tdlen];
			    System.arraycopy(toDecode, 2, hunk, 0, tdlen);
			    byte[] oldbuf = toDecode;
			    int newlen = oldbuf.length - tdlen - 2;
			    toDecode = new byte[newlen];
			    System.arraycopy(oldbuf,tdlen+2,toDecode,0,newlen);
			    String key =(String) decodeObject(hunk,String.class,
							      lvals);

			    tdlen = getItemLength(toDecode);
			    hunk = new byte[tdlen];
			    if (tdlen > 0) {
				System.arraycopy(toDecode, 2, hunk, 0, tdlen);
				oldbuf = toDecode;
				newlen = oldbuf.length - tdlen - 2;
				toDecode = new byte[newlen];
				System.arraycopy(oldbuf, tdlen+2,
						 toDecode, 0, newlen);

			    } else {
				oldbuf = toDecode;
				newlen = oldbuf.length - 2;
				toDecode = new byte[newlen];
				System.arraycopy(oldbuf,2,toDecode,0,newlen);
			    }
			    tdlen = getItemLength(toDecode);

			    Field f = params.get(key);
			    Object value = decodeObject(hunk, f.getType(),
							getListTypes(f));

			    values.put(key, value);
			}

			try {
			    Object obj = t.newInstance();

			    for (Field f: fields)
				f.set(obj, values.get(f.getName()));
			    result.add(obj);
			} catch (Exception e) { e.printStackTrace(); }
		    } else {
			byte[] oldbuf = toDecode;
			int newlen = oldbuf.length - 2;
			toDecode = new byte[newlen];
			System.arraycopy(oldbuf,2,toDecode,0,newlen);
		    }
		}
		return result;
	    } else if (t == List.class || t == ArrayList.class) {
		List<Object> result = new ArrayList<Object>();
		if (lvals == null || lvals.size() == 0) {
		    throw new Error ("No listVals given for list!");
		} else {
		    Class type = lvals.get(lvals.size() - 1);
		    if (lvals.size() == 1 &&
			type.getSuperclass() == AmpItem.class) {
			return decodeObject(toDecode,type,lvals);
		    } else {
			while (toDecode.length > 1) {
			    int tdlen = getItemLength(toDecode);
			    byte[] hunk = new byte[tdlen];
			    System.arraycopy(toDecode, 2, hunk, 0, tdlen);
			    byte[] oldbuf = toDecode;
			    int newlen = oldbuf.length - tdlen - 2;
			    toDecode = new byte[newlen];
			    System.arraycopy(oldbuf,tdlen+2,toDecode,0,newlen);

			    if (lvals.size() == 1) {
				result.add(decodeObject(hunk,type,lvals));
			    } else {
				List<Class> sub = new ArrayList<Class>();
				sub.addAll(lvals);
				result.add(decodeObject(hunk, sub.remove(0),
							sub));
			    }
			}
		    }
		}
		return result;
	    } else if (t == ByteBuffer.class ||
		       t.getSuperclass() == ByteBuffer.class) {
		return ByteBuffer.wrap(toDecode);
	    } else if (t == byte[].class) {
		return toDecode;
	    }
	}
	return null;
    }

    /** Encode outgoing data. */
    private byte[] encodeObject(Class t, Object o, List<Class> lvals){
	byte[] value = null;
	if (t == int.class || t == Integer.class) {
	    value = asBytes(((Integer) o).toString());
	} else if (t == String.class) {
	    value = asBytes(((String) o), "UTF-8");
	} else if (t == double.class || t == Double.class) {
	    Double d = (Double) o;
	    if (d.equals(Double.POSITIVE_INFINITY))
		value = asBytes("Inf");
	    else if (d.equals(Double.NEGATIVE_INFINITY))
		value = asBytes("-Inf");
	    else if (d.equals(Double.NaN))
		value = asBytes("nan");
	    else
		value = asBytes(d.toString());
	} else if (t == boolean.class || t == Boolean.class) {
	    if (((Boolean) o).booleanValue()) {
		value = asBytes("True");
	    } else {
		value = asBytes("False");
	    }
	} else if (t == BigDecimal.class) {
	    value = asBytes(((BigDecimal) o).toString());
	} else if (t == Calendar.class || t.getSuperclass() == Calendar.class) {
	    String dir = "+";
	    Calendar cal = (Calendar) o;
	    TimeZone tz = cal.getTimeZone();
	    long tzhours = TimeUnit.MILLISECONDS.toHours(tz.getRawOffset());
	    long tzmins = TimeUnit.MILLISECONDS.toMinutes(tz.getRawOffset())
		- TimeUnit.HOURS.toMinutes(tzhours);
	    if (tzhours < 0) {
		dir = "-";
		tzhours = 0 - tzhours;
	    }

	    String str = String.format("%04d-%02d-%02dT%02d:%02d:%02d.%03d000" +
				       "%s%02d:%02d", cal.get(cal.YEAR),
				       cal.get(cal.MONTH),
				       cal.get(cal.DAY_OF_MONTH),
				       cal.get(cal.HOUR_OF_DAY),
				       cal.get(cal.MINUTE), cal.get(cal.SECOND),
				       cal.get(cal.MILLISECOND),
				       dir, tzhours, tzmins);

	    value = asBytes(str);
	} else if (t.getSuperclass() == AmpItem.class) {
	    Field[] fields = t.getFields();
	    ByteArrayOutputStream stream = new ByteArrayOutputStream();

	    try {
		for (Object li: (List) o) {
		    for (Field f: fields) {
			byte[] bp = encodeObject(String.class,f.getName(),null);
			if (bp != null) {
			    stream.write(bp.length / 0x100); // DIV
			    stream.write(bp.length % 0x100); // MOD
			    stream.write(bp, 0, bp.length);
			}

			bp = encodeObject(f.getType(), f.get(li),
					  getListTypes(f));
			if (bp != null) {
			    stream.write(bp.length / 0x100); // DIV
			    stream.write(bp.length % 0x100); // MOD
			    stream.write(bp, 0, bp.length);
			}
		    }
		    stream.write(0);
		    stream.write(0);
		}
	    } catch (Exception e) { e.printStackTrace(); }

	    value = stream.toByteArray();
	} else if (t == List.class || t == ArrayList.class) {
	    if (lvals == null || lvals.size() == 0) {
		throw new Error ("No listVals given for List!");
	    } else {
		Class type = lvals.get(lvals.size() - 1);
		if (lvals.size() == 1 && type.getSuperclass() == AmpItem.class){
		    value = encodeObject(type, o, lvals);
		} else {
		    ByteArrayOutputStream stream = new ByteArrayOutputStream();
		    for (Object li: (List) o) {
			List<Class> sub = new ArrayList<Class>();
			sub.addAll(lvals);
			sub.remove(0);
			byte[] bp = encodeObject(li.getClass(), li, sub);
			if (bp != null) {
			    stream.write(bp.length / 0x100); // DIV
			    stream.write(bp.length % 0x100); // MOD
			    stream.write(bp, 0, bp.length);
			}
		    }
		    value = stream.toByteArray();
		}
	    }
	} else if (t == ByteBuffer.class ||
		   t.getSuperclass() == ByteBuffer.class) {
	    ByteBuffer bb = (ByteBuffer) o;
	    bb.clear();
	    value = new byte[bb.capacity()];
	    bb.get(value, 0, value.length);
	} else if (t == byte[].class) {
	    value = (byte[]) o;
	}
	return value;
    }

}


text:
            Ohje, diese Seite wurde nicht gefunden.
            Hier gehts zurück zum Start!

redpajama_set_name: RedPajamaGithub


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: java.security.cert.CertPathValidatorSpi
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_DECL
#define J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_DECL

namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace java { namespace security { namespace cert { class CertPath; } } } }
namespace j2cpp { namespace java { namespace security { namespace cert { class CertPathParameters; } } } }
namespace j2cpp { namespace java { namespace security { namespace cert { class CertPathValidatorResult; } } } }

#include <java/lang/Object.hpp>
#include <java/security/cert/CertPath.hpp>
#include <java/security/cert/CertPathParameters.hpp>
#include <java/security/cert/CertPathValidatorResult.hpp>

namespace j2cpp {

namespace java { namespace security { namespace cert {

	class CertPathValidatorSpi;
	class CertPathValidatorSpi
		: public object<CertPathValidatorSpi>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)

		explicit CertPathValidatorSpi(jobject jobj)
		: object<CertPathValidatorSpi>(jobj)
		{
		}

		operator local_ref<java::lang::Object>() const;

		CertPathValidatorSpi();
		local_ref< java::security::cert::CertPathValidatorResult > engineValidate(local_ref< java::security::cert::CertPath >  const&, local_ref< java::security::cert::CertPathParameters >  const&);
	}; //class CertPathValidatorSpi

} //namespace cert
} //namespace security
} //namespace java

} //namespace j2cpp

#endif //J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_IMPL
#define J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_IMPL

namespace j2cpp {

java::security::cert::CertPathValidatorSpi::operator local_ref<java::lang::Object>() const
{
	return local_ref<java::lang::Object>(get_jobject());
}

java::security::cert::CertPathValidatorSpi::CertPathValidatorSpi()
: object<java::security::cert::CertPathValidatorSpi>(
	call_new_object<
		java::security::cert::CertPathValidatorSpi::J2CPP_CLASS_NAME,
		java::security::cert::CertPathValidatorSpi::J2CPP_METHOD_NAME(0),
		java::security::cert::CertPathValidatorSpi::J2CPP_METHOD_SIGNATURE(0)
	>()
)
{
}

local_ref< java::security::cert::CertPathValidatorResult > java::security::cert::CertPathValidatorSpi::engineValidate(local_ref< java::security::cert::CertPath > const &a0, local_ref< java::security::cert::CertPathParameters > const &a1)
{
	return call_method<
		java::security::cert::CertPathValidatorSpi::J2CPP_CLASS_NAME,
		java::security::cert::CertPathValidatorSpi::J2CPP_METHOD_NAME(1),
		java::security::cert::CertPathValidatorSpi::J2CPP_METHOD_SIGNATURE(1),
		local_ref< java::security::cert::CertPathValidatorResult >
	>(get_jobject(), a0, a1);
}

J2CPP_DEFINE_CLASS(java::security::cert::CertPathValidatorSpi,"java/security/cert/CertPathValidatorSpi")
J2CPP_DEFINE_METHOD(java::security::cert::CertPathValidatorSpi,0,"<init>","()V")
J2CPP_DEFINE_METHOD(java::security::cert::CertPathValidatorSpi,1,"engineValidate","(Ljava/security/cert/CertPath;Ljava/security/cert/CertPathParameters;)Ljava/security/cert/CertPathValidatorResult;")

} //namespace j2cpp

#endif //J2CPP_JAVA_SECURITY_CERT_CERTPATHVALIDATORSPI_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
package org.flywaydb.core.internal.command;

import org.flywaydb.core.internal.dbsupport.Schema;
import org.flywaydb.core.internal.metadatatable.MetaDataTable;
import org.flywaydb.core.internal.util.jdbc.TransactionCallback;
import org.flywaydb.core.internal.util.jdbc.TransactionTemplate;
import org.flywaydb.core.internal.util.logging.Log;
import org.flywaydb.core.internal.util.logging.LogFactory;

import java.sql.Connection;

/**
 * Handles Flyway's automatic schema creation.
 */
public class DbSchemas {
    private static final Log LOG = LogFactory.getLog(DbSchemas.class);

    /**
     * The database connection to use for accessing the metadata table.
     */
    private final Connection connection;

    /**
     * The schemas managed by Flyway.
     */
    private final Schema[] schemas;

    /**
     * The metadata table.
     */
    private final MetaDataTable metaDataTable;

    /**
     * Creates a new DbSchemas.
     *
     * @param connection    The database connection to use for accessing the metadata table.
     * @param schemas       The schemas managed by Flyway.
     * @param metaDataTable The metadata table.
     */
    public DbSchemas(Connection connection, Schema[] schemas, MetaDataTable metaDataTable) {
        this.connection = connection;
        this.schemas = schemas;
        this.metaDataTable = metaDataTable;
    }

    /**
     * Creates the schemas
     */
    public void create() {
        new TransactionTemplate(connection).execute(new TransactionCallback<Void>() {
            public Void doInTransaction() {
                for (Schema schema : schemas) {
                    if (schema.exists()) {
                        LOG.debug("Schema " + schema + " already exists. Skipping schema creation.");
                        return null;
                    }
                }

                for (Schema schema : schemas) {
                    LOG.info("Creating schema " + schema + " ...");
                    schema.create();
                }

                metaDataTable.addSchemasMarker(schemas);

                return null;
            }
        });
    }
}


text:
/* Commentary:
 *
 */

/* Change log:
 *
 */

#ifndef DTKCOMPOSERNODEBOOLEANOPERATOR_H
#define DTKCOMPOSERNODEBOOLEANOPERATOR_H

#include <dtkComposerSupportExport.h>
#include "dtkComposerNodeLeaf.h"

// /////////////////////////////////////////////////////////////////
// Unary boolean operator
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeBooleanOperatorUnaryPrivate;

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorUnary : public dtkComposerNodeLeaf
{
public:
    dtkComposerNodeBooleanOperatorUnary(void);
    ~dtkComposerNodeBooleanOperatorUnary(void);

public:
    inline QString inputLabelHint(int) {
        return "value";
    }

    inline QString outputLabelHint(int) {
        return "value";
    }

protected:
    dtkComposerNodeBooleanOperatorUnaryPrivate *d;
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator
// /////////////////////////////////////////////////////////////////

class dtkComposerNodeBooleanOperatorBinaryPrivate;

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinary : public dtkComposerNodeLeaf
{
public:
    dtkComposerNodeBooleanOperatorBinary(void);
    ~dtkComposerNodeBooleanOperatorBinary(void);

public:
    inline QString inputLabelHint(int port) {
        if (port == 0)
            return "lhs";
        else if (port == 1)
            return "rhs";
        else
            return "value";
    }

    inline QString outputLabelHint(int) {
        return "value";
    }

protected:
    dtkComposerNodeBooleanOperatorBinaryPrivate *d;
};

// /////////////////////////////////////////////////////////////////
// Unary boolean operator - NOT
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorUnaryNot : public dtkComposerNodeBooleanOperatorUnary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "not";
    }

    inline QString titleHint(void) {
        return "Not";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - AND
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryAnd : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "and";
    }

    inline QString titleHint(void) {
        return "And";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - OR
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryOr : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "or";
    }

    inline QString titleHint(void) {
        return "Or";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - XOR
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryXor : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "xor";
    }

    inline QString titleHint(void) {
        return "Xor";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - NAND
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryNand : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "nand";
    }

    inline QString titleHint(void) {
        return "Nand";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - NOR
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryNor : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "nor";
    }

    inline QString titleHint(void) {
        return "Nor";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - XNOR
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryXnor : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "xnor";
    }

    inline QString titleHint(void) {
        return "Xnor";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - IMP
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryImp : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "imp";
    }

    inline QString titleHint(void) {
        return "Imp";
    }
};

// /////////////////////////////////////////////////////////////////
// Binary boolean operator - NIMP
// /////////////////////////////////////////////////////////////////

class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeBooleanOperatorBinaryNimp : public dtkComposerNodeBooleanOperatorBinary
{
public:
    void run(void);

public:
    inline QString type(void) {
        return "nimp";
    }

    inline QString titleHint(void) {
        return "Nimp";
    }
};

#endif


text:
package org.scalaide.ui.internal.editor.outline

import org.eclipse.jface.viewers.TreeViewer

object OutlineHelper {
  def foldImportNodes(viewer: TreeViewer, input: Any): Unit = {
    input match {
      case n: ImportsNode => viewer.collapseToLevel(n, 1)
      case n: ContainerNode => n.children.values.foreach { x => foldImportNodes(viewer, x) }
      case _ =>
    }
  }
}


text:
发送系统消息

		类型:
		<select class="form-control" ng-options="type.id as type.label for type in typeOptions" ng-model="options.type"></select>

		状态:
		通过
		未通过

		原因:
		<input type="text" class="form-control" placeholder="请输入详细原因." ng-model="options.cause">

	<button class="btn btn-info" type="button" ng-click="submitWithoutMessage()">不发送消息提交</button>
	<button class="btn btn-primary" type="button" ng-click="submit()">发送</button>
	<button class="btn btn-warning" type="button" ng-click="cancel()">取消</button>


text:
require 'spec_helper'

set :os, :family => 'base'

describe mysql_config('innodb-buffer-pool-size') do
  let(:stdout) { 'innodb-buffer-pool-size           134217728' }
  its(:value) { should eq 134217728 }
end

describe mysql_config('socket') do
  let(:stdout) { 'socket                            /tmp/mysql.sock' }
  its(:value) { should eq '/tmp/mysql.sock' }
end


text:
module InfoBoxHelper
  # Hash derived from info_box_terms in config/settings.yml.
  # The Hash keys represent the top-level terms, and the values
  # are Hashes representing the various attributes, such as synonyms,
  # title, description, and url.
  #
  # Here is an example Hash that would be returned:
  # { "wic" => {
  #     "synonyms" => ["women, infants, and children", "wic"],
  #     "title" => "Women, Infants, and Children",
  #     "description" => "Women, Infants, and Children (WIC) provides...",
  #     "url" => "http://www.fns.usda.gov/wic"
  #    },
  #   "sfmnp" => {
  #     "synonyms" => ["senior farmers' market nutrition program"],
  #     "title" => "Senior Farmers' Market Nutrition Program",
  #     "description" => "Senior Farmers' Market Nutrition Program (SFMNP)...",
  #     "url" => "http://www.fns.usda.gov/sfmnp"
  #    }
  # }
  #
  # @return [Hash] If key is present, otherwise returns nil.
  def info_box_hash
    SETTINGS.try(:[], :info_box_terms)
  end

  # Returns an array of all the synonyms from the info_box_hash.
  #
  # @return [Array]
  def synonyms
    info_box_hash.values.map { |hash| hash['synonyms'] }.flatten
  end

  # If the search keyword matches a synonym in the info_box_hash,
  # return the top-level key that corresponds to that synonym.
  #
  # @return [String]
  def info_box_key_corresponding_to_keyword
    keyword = params[:keyword].try(:downcase)
    return unless synonyms.include?(keyword)
    info_box_hash.find { |_, hash| hash['synonyms'].include? keyword }.first
  end

  # @param info_box [Hash] Infobox title, description, and link settings.
  # @return [HTML]
  # Returns an HTML description list with the info box's title,
  # description, and a "More info..." link to its URL if it has one defined.
  def render_html_for_generic_info_box(info_box)
    html = content_tag :dl do
      concat(content_tag :dt, info_box['title'])
      concat(content_tag :dd, info_box['description'])
    end
    return html if info_box['url'].blank?
    html.concat(content_tag(:p) do
      link_to('More info...', info_box['url'], target: '_blank')
    end)
  end

  # @param info_box_key [String] Key to look up infobox settings
  #   in config/settings.yml.
  # @return [HTML]
  # If the info box has a "custom" key, render the partial that the
  # "custom" key points to. Otherwise, render the default description list
  # template defined in the method above.
  def render_info_box(info_box_key)
    info_box = info_box_hash[info_box_key]

    if info_box['custom'].present?
      render info_box['custom']
    else
      render_html_for_generic_info_box(info_box)
    end
  end
end


text:
(function() {
  "use strict";
  var Events, When, _, eventSplitter, eventsApi, listenMethods, slice, triggerEvents,
    slice1 = [].slice;

  _ = require('./util');

  When = require('when');

  slice = Array.prototype.slice;

  Events = (function() {
    function Events() {}

    Events.prototype.on = function(name, callback, context) {
      var events;
      if (!eventsApi(this, 'on', name, [callback, context]) || !callback) {
        return this;
      }
      this._events || (this._events = {});
      events = this._events[name] || (this._events[name] = []);
      events.push({
        callback: callback,
        context: context,
        ctx: context || this
      });
      return this;
    };

    Events.prototype.once = function(name, callback, context) {
      var once, self;
      if (!eventsApi(this, 'once', name, [callback, context]) || !callback) {
        return this;
      }
      self = this;
      once = _.once(function() {
        self.off(name, once);
        return callback.apply(this, arguments);
      });
      once._callback = callback;
      return this.on(name, once, context);
    };

    Events.prototype.off = function(name, callback, context) {
      var ev, events, i, j, len, len1, names, retain;
      if (!this._events || !eventsApi(this, 'off', name, [callback, context])) {
        return this;
      }
      if (!name && !callback && !context) {
        this._events = {};
        return this;
      }
      names = name ? [name] : _.keys(this._events);
      for (i = 0, len = names.length; i < len; i++) {
        name = names[i];
        if (events = this._events[name]) {
          this._events[name] = retain = [];
          if (callback || context) {
            for (j = 0, len1 = events.length; j < len1; j++) {
              ev = events[j];
              if ((callback && callback !== ev.callback && callback !== ev.callback._callback) || (context && context !== ev.context)) {
                retain.push(ev);
              }
            }
          }
          if (!retain.length) {
            delete this._events[name];
          }
        }
      }
      return this;
    };

    Events.prototype.will_trigger = function(name) {
      var allEvents, args, events, results;
      if (!this._events) {
        return When(void 0);
      }
      args = slice.call(arguments, 1);
      if (!eventsApi(this, 'trigger', name, args)) {
        return this;
      }
      events = this._events[name];
      allEvents = this._events.all;
      results = [];
      if (events) {
        results.push(triggerEvents(events, args));
      }
      if (allEvents) {
        results.push(triggerEvents(allEvents, arguments));
      }
      return When.all(results)["catch"](function() {
        var args;
        args = 1 <= arguments.length ? slice1.call(arguments, 0) : [];
        return console.error("Error in event " + name + ":", args);
      });
    };

    Events.prototype.stopListening = function(obj, name, callback) {
      var deleteListener, id, listeners;
      listeners = this._listeners;
      if (!listeners) {
        return this;
      }
      deleteListener = !name && !callback;
      if (typeof name === 'object') {
        callback = this;
      }
      if (obj) {
        (listeners = {})[obj._listenerId] = obj;
      }
      for (id in listeners) {
        listeners[id].off(name, callback, this);
        if (deleteListener) {
          delete this._listeners[id];
        }
      }
      return this;
    };

    return Events;

  })();

  eventSplitter = /\s+/;

  eventsApi = function(obj, action, name, rest) {
    var i, j, key, len, len1, names;
    if (!name) {
      return true;
    }
    if (typeof name === 'object') {
      for (i = 0, len = name.length; i < len; i++) {
        key = name[i];
        obj[action].apply(obj, [key, name[key]].concat(rest));
      }
      return false;
    }
    if (eventSplitter.test(name)) {
      names = name.split(eventSplitter);
      for (j = 0, len1 = names.length; j < len1; j++) {
        name = names[j];
        obj[action].apply(obj, [name].concat(rest));
      }
      return false;
    }
    return true;
  };

  triggerEvents = function(events, args) {
    var a1, a2, a3, ev;
    a1 = args[0];
    a2 = args[1];
    a3 = args[2];
    switch (args.length) {
      case 0:
        return When.all((function() {
          var i, len, results1;
          results1 = [];
          for (i = 0, len = events.length; i < len; i++) {
            ev = events[i];
            results1.push(ev.callback.call(ev.ctx));
          }
          return results1;
        })());
      case 1:
        return When.all((function() {
          var i, len, results1;
          results1 = [];
          for (i = 0, len = events.length; i < len; i++) {
            ev = events[i];
            results1.push(ev.callback.call(ev.ctx, a1));
          }
          return results1;
        })());
      case 2:
        return When.all((function() {
          var i, len, results1;
          results1 = [];
          for (i = 0, len = events.length; i < len; i++) {
            ev = events[i];
            results1.push(ev.callback.call(ev.ctx, a1, a2));
          }
          return results1;
        })());
      case 3:
        return When.all((function() {
          var i, len, results1;
          results1 = [];
          for (i = 0, len = events.length; i < len; i++) {
            ev = events[i];
            results1.push(ev.callback.call(ev.ctx, a1, a2, a3));
          }
          return results1;
        })());
      default:
        return When.all((function() {
          var i, len, results1;
          results1 = [];
          for (i = 0, len = events.length; i < len; i++) {
            ev = events[i];
            results1.push(ev.callback.apply(ev.ctx, args));
          }
          return results1;
        })());
    }
  };

  listenMethods = {
    listenTo: 'on',
    listenToOnce: 'once'
  };

  _.each(listenMethods, function(implementation, method) {
    return Events.prototype[method] = function(obj, name, callback) {
      var id, listeners;
      listeners = this._listeners || (this._listeners = {});
      id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
      listeners[id] = obj;
      if (typeof name === 'object') {
        callback = this;
      }
      obj[implementation](name, callback, this);
      return this;
    };
  });

  Events.eventSplitter = eventSplitter;

  module.exports = Events;

}).call(this);

//# sourceMappingURL=events.js.map


text:
package org.openntf.xpt.demo.bo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import org.openntf.xpt.core.dss.annotations.DominoEntity;
import org.openntf.xpt.core.dss.annotations.DominoStore;
import org.openntf.xpt.core.json.annotations.JSONEntity;
import org.openntf.xpt.core.json.annotations.JSONObject;

import com.ibm.xsp.http.MimeMultipart;

@JSONObject
@DominoStore(Form = "Contact", PrimaryFieldClass = String.class, PrimaryKeyField = "ID", View = "LUPContactByID")
public class Contact implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	@JSONEntity(jsonproperty = "id")
	@DominoEntity(FieldName = "ID")
	private String m_ID;
	@JSONEntity(jsonproperty = "firstname")
	@DominoEntity(FieldName = "FirstName")
	private String m_FirstName;
	@JSONEntity(jsonproperty = "lastname")
	@DominoEntity(FieldName = "LastName")
	private String m_LastName;
	@JSONEntity(jsonproperty = "city")
	@DominoEntity(FieldName = "City")
	private String m_City;
	@JSONEntity(jsonproperty = "email")
	@DominoEntity(FieldName = "Email")
	private String m_Email;
	@JSONEntity(jsonproperty = "state")
	@DominoEntity(FieldName = "State")
	private String m_State;
	@JSONEntity(jsonproperty = "observer")
	@DominoEntity(FieldName = "Observer", isNames = true)
	private List<String> m_Observers;

	// CHANGELOG Demo/TestCase
	@DominoEntity(FieldName = "Salary", changeLog = true)
	private double m_Salary;
	@DominoEntity(FieldName = "CompanyCar", changeLog = true)
	private double m_CompanyCar;
	@JSONEntity(jsonproperty = "jobfunction")
	@DominoEntity(FieldName = "JobFunction", changeLog = true)
	private String m_JobFunction;
	@DominoEntity(FieldName = "Devices", changeLog = true)
	private int m_Devices;
	@DominoEntity(FieldName = "LastInterview", changeLog = true)
	private Date m_LastInterview;

	@DominoEntity(FieldName = "Latitude", changeLog = true)
	private Double m_Latitude;
	@DominoEntity(FieldName = "Longitude", changeLog = true)
	private Double m_Longitude;
	@DominoEntity(FieldName = "Elevation", changeLog = true)
	private Integer m_Elevation;

	@DominoEntity(FieldName = "BodyMIME")
	private MimeMultipart m_Comment;

	@DominoEntity(FieldName = "TagCloud")
	private List<String> m_TagCloud;

	@DominoEntity(FieldName = "contactStatus")
	private ContactStatus m_Status = ContactStatus.UNKNOWN;

	@DominoEntity(FieldName = "ModDate")
	private Date m_ModDate;

	@DominoEntity(FieldName = "RESP", embedded = true)
	private Responsible m_Responsible = new Responsible();

	@DominoEntity(FieldName = "OTHER", embedded = true)
	private List<Address> m_OtherAddresses;

	@DominoEntity(FieldName = "PrimaryContact")
	private boolean m_PrimaryContact;

	@DominoEntity(FieldName = "SupportResponsible")
	private String m_SupportResponsible;

	@DominoEntity(FieldName = "OtherSupportResponsible")
	private List<String> m_OtherSupportResponsible;

	public String getID() {
		return m_ID;
	}

	public void setID(String id) {
		m_ID = id;
	}

	public String getFirstName() {
		return m_FirstName;
	}

	public void setFirstName(String firstName) {
		m_FirstName = firstName;
	}

	public String getLastName() {
		return m_LastName;
	}

	public void setLastName(String lastName) {
		m_LastName = lastName;
	}

	public String getCity() {
		return m_City;
	}

	public void setCity(String city) {
		m_City = city;
	}

	public String getEmail() {
		return m_Email;
	}

	public void setEmail(String email) {
		m_Email = email;
	}

	public String getState() {
		return m_State;
	}

	public void setState(String state) {
		m_State = state;
	}

	public void setObservers(List<String> observers) {
		m_Observers = observers;
	}

	public List<String> getObservers() {
		return m_Observers;
	}

	public void addObserver(String strObserver) {
		if (m_Observers == null) {
			m_Observers = new ArrayList<String>();
		}
		if (!m_Observers.contains(strObserver)) {
			m_Observers.add(strObserver);
		}
	}

	public void removeObserver(String effectiveUserName) {
		if (m_Observers != null) {
			m_Observers.remove(effectiveUserName);
		}

	}

	public void setSalary(double salary) {
		m_Salary = salary;
	}

	public double getSalary() {
		return m_Salary;
	}

	public void setCompanyCar(double companyCar) {
		m_CompanyCar = companyCar;
	}

	public double getCompanyCar() {
		return m_CompanyCar;
	}

	public void setJobFunction(String jobFunction) {
		m_JobFunction = jobFunction;
	}

	public String getJobFunction() {
		return m_JobFunction;
	}

	public void setDevices(int devices) {
		m_Devices = devices;
	}

	public int getDevices() {
		return m_Devices;
	}

	public void setLastInterview(Date lastInterview) {
		m_LastInterview = lastInterview;
	}

	public Date getLastInterview() {
		return m_LastInterview;
	}

	public void setLatitude(Double latitude) {
		m_Latitude = latitude;
	}

	public Double getLatitude() {
		return m_Latitude;
	}

	public void setLongitude(Double longitude) {
		m_Longitude = longitude;
	}

	public Double getLongitude() {
		return m_Longitude;
	}

	public void setElevation(Integer elevation) {
		m_Elevation = elevation;
	}

	public Integer getElevation() {
		return m_Elevation;
	}

	public MimeMultipart getComment() {
		return m_Comment;
	}

	public void setComment(MimeMultipart comment) {
		m_Comment = comment;
	}

	public void setTagCloud(List<String> tagCloud) {
		m_TagCloud = tagCloud;
	}

	public List<String> getTagCloud() {
		return m_TagCloud;
	}

	public void setStatus(ContactStatus status) {
		m_Status = status;
	}

	public ContactStatus getStatus() {
		return m_Status;
	}

	public void setStatusTXT(String status) {
		m_Status = ContactStatus.valueOf(status);
	}

	public String getStatusTXT() {
		return m_Status.name();
	}

	public void setModDate(Date modDate) {
		m_ModDate = modDate;
	}

	public Date getModDate() {
		return m_ModDate;
	}

	public Responsible getResponsible() {
		if (m_Responsible == null) {
			m_Responsible = new Responsible();
		}
		return m_Responsible;
	}

	public void setResponsible(Responsible responsible) {
		m_Responsible = responsible;
	}

	public void setOtherAddresses(List<Address> ohterAddresses) {
		m_OtherAddresses = ohterAddresses;
	}

	public List<Address> getOtherAddresses() {
		return m_OtherAddresses;
	}

	public void addOtherAddresses(Address addr) {
		if (m_OtherAddresses == null) {
			m_OtherAddresses = new LinkedList<Address>();
		}
		m_OtherAddresses.add(addr);
	}

	public void setPrimaryContact(boolean primaryContact) {
		m_PrimaryContact = primaryContact;
	}

	public boolean isPrimaryContact() {
		return m_PrimaryContact;
	}

	public void setSupportResponsible(String supportResponsible) {
		m_SupportResponsible = supportResponsible;
	}

	public String getSupportResponsible() {
		return m_SupportResponsible;
	}

	public void setOtherSupportResponsible(List<String> otherSupportResponsible) {
		m_OtherSupportResponsible = otherSupportResponsible;
	}

	public List<String> getOtherSupportResponsible() {
		return m_OtherSupportResponsible;
	}

}


text:
NotifyCategoryDecl(MarginCell, EXPCL_LIBOTP, EXPTP_LIBOTP);

class MarginManager;
class MarginPopup;

class MarginCell : public NodePath, public virtual TypedObject {
    PUBLISHED:
        MarginCell(MarginManager* manager);
        virtual ~MarginCell();

    public:
        void set_available(bool available);
        void set_content(MarginPopup* content);
        void set_content_nodepath(PandaNode* path);
        void set_content_nodepath(NodePath* path);

        MarginPopup* get_content();

        bool get_available();
        bool has_content();
        bool is_available();
        bool is_free();

    private:
        bool m_available;
        MarginPopup* m_content;
        MarginManager* m_manager;
        NodePath m_content_np;

    TYPE_HANDLE(MarginCell, TypedObject);
};


text:
layout: page
title: Beasley Sentry Company Conference
date: 2016-05-24
author: Nicholas Page
tags: weekly links, java
status: published
summary: Maecenas volutpat, felis ut consectetur lacinia, diam leo viverra.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 06/21/2016
  endDate: 06/26/2016
  ctyhocn: GREALHX
  groupCode: BSCC
published: true
---
Quisque sit amet ipsum dolor. Etiam ultrices dui eu ante condimentum egestas. Quisque vulputate nunc ac nisi porta, non dignissim nisi euismod. Maecenas aliquam risus eget tortor scelerisque, sit amet semper elit elementum. Maecenas hendrerit justo vitae eros dignissim, vel molestie elit imperdiet. Etiam nec fringilla felis. Pellentesque nunc velit, mollis lacinia mattis a, convallis vitae lectus. Etiam dictum metus vitae justo placerat consectetur. Etiam aliquet nulla a magna vestibulum ullamcorper.

1 Quisque laoreet diam lacinia, dignissim nibh eu, bibendum arcu
1 Duis nec odio ut purus ullamcorper egestas vel vel nisl
1 Mauris nec erat id ex iaculis laoreet
1 In auctor massa tincidunt venenatis vehicula
1 Mauris nec mauris ac leo tristique lacinia ac semper ligula
1 Vivamus gravida felis congue dignissim posuere.

In hac habitasse platea dictumst. Curabitur ut mauris volutpat, sagittis nulla non, rhoncus turpis. Aliquam molestie, nulla eget cursus hendrerit, massa erat tincidunt nisi, sed faucibus ligula eros a ex. Maecenas tempor massa non accumsan tempor. Phasellus sit amet condimentum urna. Nulla dapibus libero sed turpis sollicitudin, vitae facilisis sem blandit. Phasellus malesuada dignissim nibh pretium tristique. In in dui nisi. Morbi dolor nisl, tristique a diam sit amet, venenatis convallis lacus. Cras diam erat, dapibus ac fringilla non, fringilla sit amet ligula. Nulla eu orci quam. Donec tristique placerat lectus id varius. Nulla sed ultrices mi. Donec elit dui, tempus et rutrum id, volutpat iaculis leo. Vestibulum hendrerit purus libero, sit amet lacinia ligula molestie ut.
Praesent in nulla nec felis aliquet feugiat at id nisl. Etiam rhoncus faucibus hendrerit. Duis id bibendum orci. Vivamus eu ex ut leo suscipit suscipit. Nunc bibendum interdum elit sit amet tempor. Duis in sem gravida, dapibus enim ut, gravida ante. In non velit ut nibh porta tristique. Maecenas quis nunc eros. Donec in metus non felis auctor euismod. Aliquam nec pharetra lectus. Maecenas eleifend sed lectus quis vestibulum.


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <ListView
        android:id="@+id/coursesList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"></ListView>

</FrameLayout>


text:
package gatewayoutter

import (
	"game/gateway/gm"
	"io"
	cm "library/core/controlmsg"
	dm "library/core/datamsg"
	"library/logger"
	"net"
	"time"
	. "types"
)

func (t *gatewayOutter) Start(bus *dm.DataMsgPipe) bool {
	t.output = bus
	tcpAddr, err := net.ResolveTCPAddr("tcp", t.ip+":"+t.port)
	if err != nil {
		logger.Error("%s:net.ResolveTCPAddr error,%s", t.Name, err.Error())
		return false
	}

	t.listener, err = net.ListenTCP("tcp", tcpAddr)
	if err != nil {
		logger.Error("%s:net.ListenTCP error,%s", t.Name, err.Error())
		return false
	}

	logger.Info("%s:listening port:%s", t.Name, t.port)
	go t.gatewayClient()
	return true
}

func (t *gatewayOutter) Pause() bool {
	return true
}

func (t *gatewayOutter) Resume() bool {
	return true
}

func (t *gatewayOutter) Exit() bool {
	return true
}

func (t *gatewayOutter) ControlHandler(msg *cm.ControlMsg) (int, int) {
	return cm.NextActionContinue, cm.ProcessStatOK
}

func (t *gatewayOutter) gatewayClient() {

	for {
		connect, err := t.listener.AcceptTCP()
		if err != nil {
			logger.Error("%s:listener.AcceptTCP error,%s", t.Name, err.Error())
			time.Sleep(time.Second * 2)
			connect.Close()
			continue
		}
		go t.gatewayClientConn(connect)
	}
}

func (t *gatewayOutter) gatewayClientConn(connection *net.TCPConn) {
	clientMeta := gm.NewClientMeta(connection)
	logger.Info("new connntion established with client")
	for clientMeta.Conn != nil {
		head := make([]byte, NetMsgHeadNoIdSize)
		_, err := io.ReadAtLeast(connection, head, NetMsgHeadNoIdSize)
		if err != nil {
			logger.Error("%s: read player %s req head[NOID] error: %s",
				t.Name, clientMeta.ID, err.Error())
			break
		}

		msg, err := NewNetMsgFromHeadNoId(head)
		if err != nil {
			logger.Error("%s:decode player %s req head(NOID) error: %s",
				t.Name, clientMeta.ID, err.Error())
			break
		}

		msg.MsgType = AddMsgFlag(msg.MsgType, NetMsgIdFlagClient)

		_, err = io.ReadAtLeast(connection, msg.Content, int(msg.Size))
		if err != nil {
			logger.Error("%s: read player %s req [%s] payload error",
				t.Name, clientMeta.ID, msg.TypeString())
			break
		}

		d := dm.NewDataMsg(ServiceName, "gatewayinner", DataMsgFlagC2G, msg)
		d.SetMeta(t.Name, clientMeta)
		t.output.WritePipeNoBlock(d)
	}

	logger.Warn("%s: player %s connection exit", t.Name, clientMeta.ID)
	//should send logout req to server for client
	t.noticeServerClientLogout(clientMeta)
}

func (t *gatewayOutter) noticeServerClientLogout(clientMeta *gm.ConnMeta) {
	if clientMeta.ForwardMeta != nil {
		msg := &NetMsg{}
		msg.MsgType = MT_LogoutReq
		msg.SetPayLoad(MT_LogoutReq, &LogoutReq{UserId: string(clientMeta.ID)}, NetMsgIdFlagClient)
		d := dm.NewDataMsg(ServiceName, "gatewayinner", DataMsgFlagC2G, msg)
		d.SetMeta(t.Name, clientMeta)
		t.output.WritePipeNoBlock(d)
	}
}


text:
/*
 * Licensed to waterwave under one or more contributor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package waterwave.proxy;

import java.util.Properties;

import shui.common.log.Logger;
import shui.common.util.ParamUtil;
import shui.common.util.PropertiesUtil;
import waterwave.proxy.ProxyRouterService.type;
import waterwave.proxy.aio.ProxyAioServerService;
import waterwave.proxy.bio.ProxyBioServerService;
import waterwave.proxy.nio.ProxyNioServerService;
import waterwave.proxy.nioSingle.ProxyNioSingleServerService;

public class ProxyServerStartUp {

	static final String initPpFile = "sp.properties";

	public static void startUp(String[] args) {

		//get env param
		Properties initPp = ParamUtil.loadPropertiesfile(initPpFile);

		String ppfile = initPp.getProperty("service.ppfile");

		ppfile = ParamUtil.setPp(args, ppfile);

		Logger.log(ppfile);

		//get param
		Properties pp = ParamUtil.loadPropertiesfile(ppfile);

		ParamUtil.setArgs(args, pp);

		Logger.log(pp);

		PropertiesUtil ppp = new PropertiesUtil(pp);
		type t = ppp.getEnum("type", ProxyRouterService.type.class, ProxyRouterService.type.aio);

		//service start up
		switch (t) {
		case aio:
			ProxyAioServerService cs = new ProxyAioServerService();
			cs.init(pp);
			break;
		case nio:
			ProxyNioServerService ns = new ProxyNioServerService();
			ns.init(pp);
			break;
		case single:
			ProxyNioSingleServerService ss = new ProxyNioSingleServerService();
			ss.init(pp);
			break;
		case single1:
			waterwave.proxy.nioSingle1.ProxyNioSingleServerService ss1 = new waterwave.proxy.nioSingle1.ProxyNioSingleServerService();
			ss1.init(pp);
			break;
		case bio:
			ProxyBioServerService bs = new ProxyBioServerService();
			bs.init(pp);
			break;
		}

	}

	public static void main(String[] args) {
		Logger.log("init...");
		System.out.println("using: java -jar this.jar ppFilePath params");
		startUp(args);

	}

}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Vulkan - Eric's Blog</title>

    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <meta name="description" content="">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="Vulkan - Eric's Blog">
    <meta name="twitter:description" content="">

    <meta property="og:type" content="article">
    <meta property="og:title" content="Vulkan - Eric's Blog">
    <meta property="og:description" content="">

    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
    <link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon">

    <link rel="stylesheet" type="text/css" href="//lxjk.github.io/themes/uno/assets/css/uno.css?v=1583804038316" />
    <link rel="stylesheet" href="//lxjk.github.io/themes/uno/assets/css/asciidoctor-foundation.css?v=1583804038316"/>

	<link rel="stylesheet" type="text/css" href="//lxjk.github.io/themes/uno/assets/highlighter/prettify.css?v=1583804038316" />

    <link rel="canonical" href="https://lxjk.github.io/https://lxjk.github.io/tag/Vulkan/" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="Eric's Blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Vulkan - Eric's Blog" />
    <meta property="og:url" content="https://lxjk.github.io/https://lxjk.github.io/tag/Vulkan/" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Vulkan - Eric's Blog" />
    <meta name="twitter:url" content="https://lxjk.github.io/https://lxjk.github.io/tag/Vulkan/" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="Eric's Blog" href="https://lxjk.github.io/rss/" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/atom-one-dark.min.css">

Eric's Blog

- Game - Engine - Tool  - Math -

Blog

                      Twitter

                      LinkedIn

                      Email

Tag: Vulkan

Translate GLSL to SPIR-V for Vulkan at Runtime

Table of Contents Get Glslang Libs Use Glslang Build Glslang Libs As I’m porting my game engine from OpenGL to Vulkan, I encountered the need of translating exisiting glsl shaders (with changes for Vulkan) to spir-v. The recommanded way is to use offline toolchain glslangValidator, provided in Vulkan…

            <time datetime="10 Mar 2020" class="post-list__meta--date date">10 Mar 2020</time> •
            Vulkan

    Page 1 of 1

                © 2020. All rights reserved.
                Uno theme by Dale-Anthony
                Proudly published with Hubpress


text:
`backup` is a simple daemon that backs up server assest to [Amazon Glacier](https://aws.amazon.com/glacier/). Due to the nature of Amazon Glacier, it must run continuously as a daemon to work with the service's long async behavior.

## Installation

Although the project is structured as a Ruby gem, it is not intended to be released as one. Simply checkout the code, create a `config.yml` file from the `config.yml.example` file, and run it.

## Configuration

The following options are available for the `config.yml` file:

`aws_access_key_id`: The AWS access key ID.

`aws_secret_access_key`: The AWS secret access key.

`glacier_arn`: The Amazon Resource Name to store your backups in.

`glacier_vault`: The existing Amazon Glacier Vault to store your backups in.

`directories`: A list of directories that should be backed up. Each entry requires a `name` and `path`.

`backup_interval`: The interval in hours to back up each directory.

`purge_age`: The age in hours before an archive is deleted.

`purge_interval`: The interval in hours to start a purge discovery process.

## Usage

After you have created your `config.yml` file, simply run the following from the root of the project:

    # bundle exec ./exe/backup -c /path/to/your/config.yml

The above command will run forever, performing backups and purges as configured. The scheduled tasks do not fire immediately. If you would also like to perform these tasks immediately on launch, add the `-f` option.

An example systemd service file is available in the `contrib` folder. For Debian / Ubuntu systems, install the file in `/etc/systemd/system`. Be sure to modify the service file for your specific directories and user.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/stack/backup.


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

using FluentMigrator.Expressions;
using FluentMigrator.Runner.Announcers;
using FluentMigrator.Runner.Logging;

using JetBrains.Annotations;

using Microsoft.Extensions.Logging;

namespace FluentMigrator.Runner.Processors
{
    public abstract class ProcessorBase : IMigrationProcessor
    {
#pragma warning disable 612
        [Obsolete]
        private readonly IMigrationProcessorOptions _legacyOptions;
#pragma warning restore 612

        protected internal readonly IMigrationGenerator Generator;

#pragma warning disable 612
        [Obsolete]
        protected readonly IAnnouncer Announcer;
#pragma warning restore 612

        [Obsolete]
        protected ProcessorBase(
            IMigrationGenerator generator,
            IAnnouncer announcer,
            [NotNull] IMigrationProcessorOptions options)
        {
            Generator = generator;
            Announcer = announcer;
            Logger = new AnnouncerFluentMigratorLogger(announcer);
            Options = options as ProcessorOptions ?? new ProcessorOptions()
            {
                PreviewOnly = options.PreviewOnly,
                ProviderSwitches = options.ProviderSwitches,
                Timeout = options.Timeout == null ? null : (TimeSpan?) TimeSpan.FromSeconds(options.Timeout.Value),
            };

            _legacyOptions = options;
        }

        [Obsolete]
        protected ProcessorBase(
            [NotNull] IMigrationGenerator generator,
            [NotNull] IAnnouncer announcer,
            [NotNull] ProcessorOptions options)
        {
            Generator = generator;
            Announcer = announcer;
            Options = options;
            _legacyOptions = options;
            Logger = new AnnouncerFluentMigratorLogger(announcer);
        }

        protected ProcessorBase(
            [NotNull] IMigrationGenerator generator,
            [NotNull] ILogger logger,
            [NotNull] ProcessorOptions options)
        {
            Generator = generator;
            Options = options;
            Logger = logger;
#pragma warning disable 612
            Announcer = new LoggerAnnouncer(
                logger,
                new AnnouncerOptions()
                {
                    ShowSql = true,
                    ShowElapsedTime = true,
                });
            _legacyOptions = options;
#pragma warning restore 612
        }

        [Obsolete]
        IMigrationProcessorOptions IMigrationProcessor.Options => _legacyOptions;

        [Obsolete]
        public abstract string ConnectionString { get; }

        public abstract string DatabaseType { get; }

        public abstract IList<string> DatabaseTypeAliases { get; }

        public bool WasCommitted { get; protected set; }

        protected internal ILogger Logger { get; }

        [NotNull]
        protected ProcessorOptions Options { get; }

        public virtual void Process(CreateSchemaExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteSchemaExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateTableExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(AlterTableExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(AlterColumnExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateColumnExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteTableExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteColumnExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateForeignKeyExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteForeignKeyExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateIndexExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteIndexExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(RenameTableExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(RenameColumnExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(InsertDataExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteDataExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(AlterDefaultConstraintExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(UpdateDataExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public abstract void Process(PerformDBOperationExpression expression);

        public virtual void Process(AlterSchemaExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateSequenceExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteSequenceExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(CreateConstraintExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteConstraintExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        public virtual void Process(DeleteDefaultConstraintExpression expression)
        {
            Process(Generator.Generate(expression));
        }

        protected abstract void Process(string sql);

        public virtual void BeginTransaction()
        {
        }

        public virtual void CommitTransaction()
        {
        }

        public virtual void RollbackTransaction()
        {
        }

        public abstract DataSet ReadTableData(string schemaName, string tableName);

        public abstract DataSet Read(string template, params object[] args);

        public abstract bool Exists(string template, params object[] args);

        /// <inheritdoc />
        public virtual void Execute(string sql)
        {
            Execute(sql.Replace("{", "{{").Replace("}", "}}"), Array.Empty<object>());
        }

        public abstract void Execute(string template, params object[] args);

        public abstract bool SchemaExists(string schemaName);

        public abstract bool TableExists(string schemaName, string tableName);

        public abstract bool ColumnExists(string schemaName, string tableName, string columnName);

        public abstract bool ConstraintExists(string schemaName, string tableName, string constraintName);

        public abstract bool IndexExists(string schemaName, string tableName, string indexName);

        public abstract bool SequenceExists(string schemaName, string sequenceName);

        public abstract bool DefaultValueExists(string schemaName, string tableName, string columnName, object defaultValue);

        public void Dispose()
        {
            Dispose(true);
        }

        protected abstract void Dispose(bool isDisposing);

        protected virtual void ReThrowWithSql(Exception ex, string sql)
        {
            using (var message = new StringWriter())
            {
                message.WriteLine("An error occured executing the following sql:");
                message.WriteLine(sql);
                message.WriteLine("The error was {0}", ex.Message);

                throw new Exception(message.ToString(), ex);
            }
        }
    }
}


text:
FROM dockerfile/ubuntu
MAINTAINER Ross Zurowski <ross@rosszurowski.com>

# Don't give us warnings about ttys
ENV DEBIAN_FRONTEND noninteractive

# Get core utils
RUN apt-get update -y -qq && \
 	apt-get install -y -qq git wget curl software-properties-common && \
 	apt-get -y clean

# Install Nginx
RUN add-apt-repository -y ppa:nginx/stable && \
	apt-get update -y -qq && \
	apt-get -y -qq install nginx && \
	apt-get -y clean

# Update Nginx configs
RUN echo "daemon off;" >> /etc/nginx/nginx.conf

# Install HHVM
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 2>&1 && \
 	add-apt-repository 'deb http://dl.hhvm.com/ubuntu trusty main' 2>&1 && \
 	apt-get update -qq && \
 	apt-get install -y -qq hhvm && \
 	apt-get -y -qq clean

# Update HHVM configs
RUN echo "date.timezone = America/Toronto" >> /etc/hhvm/php.ini && \
	/usr/share/hhvm/install_fastcgi.sh && \
	update-rc.d hhvm defaults && \
	service hhvm restart


text:
package org.owasp.dependencycheck.analyzer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Dependency;

import java.io.File;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*;

/**
 * Unit tests for OpenSSLAnalyzerAnalyzer.
 *
 * @author Dale Visser <dvisser@ida.org>
 */
public class OpenSSLAnalyzerTest extends BaseTest {

    /**
     * The package analyzer to test.
     */
    private OpenSSLAnalyzer analyzer;

    /**
     * Setup the {@link OpenSSLAnalyzer}.
     *
     * @throws Exception if there is a problem
     */
    @Before
    public void setUp() throws Exception {
        analyzer = new OpenSSLAnalyzer();
        analyzer.setFilesMatched(true);
        analyzer.initialize();
    }

    /**
     * Cleanup any resources used.
     *
     * @throws Exception if there is a problem
     */
    @After
    public void tearDown() throws Exception {
        analyzer.close();
        analyzer = null;
    }

    /**
     * Test of getName method, of class OpenSSLAnalyzer.
     */
    @Test
    public void testGetName() {
        assertEquals("Analyzer name wrong.", "OpenSSL Source Analyzer",
                analyzer.getName());
    }

    /**
     * Test of supportsExtension method, of class PythonPackageAnalyzer.
     */
    @Test
    public void testAccept() {
        assertTrue("Should support files named \"opensslv.h\".",
                analyzer.accept(new File("opensslv.h")));
    }

    @Test
    public void testVersionConstantExamples() {
        final long[] constants = {0x1000203fL
                , 0x00903000
                , 0x00903001
                , 0x00903002l
                , 0x0090300f
                , 0x0090301f
                , 0x0090400f
                , 0x102031af};
        final String[] versions = {"1.0.2c",
                "0.9.3-dev",
                "0.9.3-beta1",
                "0.9.3-beta2",
                "0.9.3",
                "0.9.3a",
                "0.9.4",
                "1.2.3z"};
        assertEquals(constants.length, versions.length);
        for (int i = 0; i < constants.length; i++) {
            assertEquals(versions[i], OpenSSLAnalyzer.getOpenSSLVersion(constants[i]));
        }
    }

    @Test
    public void testOpenSSLVersionHeaderFile() throws AnalysisException {
        final Dependency result = new Dependency(BaseTest.getResourceAsFile(
                this,
                "openssl/opensslv.h"));
        analyzer.analyze(result, null);
        assertThat(result.getProductEvidence().toString(), containsString("OpenSSL"));
        assertThat(result.getVendorEvidence().toString(), containsString("OpenSSL"));
        assertThat(result.getVersionEvidence().toString(), containsString("1.0.2c"));
    }
}


text:
package com.github.msemys.esjc.http;

import com.github.msemys.esjc.UserCredentials;
import com.github.msemys.esjc.http.handler.HttpResponseHandler;
import com.github.msemys.esjc.util.concurrent.ResettableLatch;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.*;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.concurrent.Future;

import java.net.InetSocketAddress;
import java.time.Duration;
import java.util.Base64;
import java.util.Queue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;

import static com.github.msemys.esjc.util.Numbers.isPositive;
import static com.github.msemys.esjc.util.Preconditions.*;
import static com.github.msemys.esjc.util.Strings.*;
import static io.netty.buffer.Unpooled.copiedBuffer;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;

/**
 * HTTP client without pipelining support
 */
public class HttpClient implements AutoCloseable {
    private final EventLoopGroup group = new NioEventLoopGroup(0, new DefaultThreadFactory("es-http"));
    private final Bootstrap bootstrap;
    private final String host;
    private final boolean acceptGzip;
    private final long operationTimeoutMillis;

    private final ExecutorService queueExecutor = newSingleThreadExecutor(new DefaultThreadFactory("es-http-queue"));
    private final Queue<HttpOperation> queue = new ConcurrentLinkedQueue<>();
    private final AtomicBoolean isProcessing = new AtomicBoolean();
    private final ResettableLatch received = new ResettableLatch(false);

    private volatile Channel channel;

    private HttpClient(Builder builder) {
        host = builder.address.getHostString();
        acceptGzip = builder.acceptGzip;
        operationTimeoutMillis = builder.operationTimeout.toMillis();

        bootstrap = new Bootstrap()
            .remoteAddress(builder.address)
            .option(ChannelOption.TCP_NODELAY, true)
            .option(ChannelOption.SO_REUSEADDR, false)
            .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) builder.connectTimeout.toMillis())
            .group(group)
            .channel(NioSocketChannel.class)
            .handler(new ChannelInitializer<SocketChannel>() {
                @Override
                protected void initChannel(SocketChannel ch) throws Exception {
                    ChannelPipeline pipeline = ch.pipeline();

                    pipeline.addLast("http-codec", new HttpClientCodec());
                    if (acceptGzip) {
                        pipeline.addLast("content-decompressor", new HttpContentDecompressor());
                    }
                    pipeline.addLast("object-aggregator", new HttpObjectAggregator(builder.maxContentLength));
                    pipeline.addLast("logger", new LoggingHandler(HttpClient.class, LogLevel.TRACE));
                    pipeline.addLast("response-handler", new HttpResponseHandler());
                }
            });
    }

    public CompletableFuture<FullHttpResponse> send(HttpRequest request) {
        checkNotNull(request, "request is null");
        checkState(isRunning(), "HTTP client is closed");

        request.headers().set(HttpHeaderNames.HOST, host);

        if (acceptGzip) {
            request.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP);
        }

        CompletableFuture<FullHttpResponse> response = new CompletableFuture<>();
        enqueue(new HttpOperation(request, response));

        return response;
    }

    private void enqueue(HttpOperation operation) {
        checkNotNull(operation, "operation is null");

        queue.offer(operation);

        if (isProcessing.compareAndSet(false, true)) {
            queueExecutor.execute(this::processQueue);
        }
    }

    private void processQueue() {
        do {
            HttpOperation operation;

            while ((operation = queue.poll()) != null) {
                if (channel == null || !channel.isActive()) {
                    try {
                        channel = bootstrap.connect().syncUninterruptibly().channel();
                    } catch (Exception e) {
                        operation.response.completeExceptionally(e);

                        if (isRunning()) {
                            continue;
                        } else {
                            break;
                        }
                    }
                }

                write(operation);
            }

            isProcessing.set(false);
        } while (isRunning() && !queue.isEmpty() && isProcessing.compareAndSet(false, true));
    }

    private void write(HttpOperation operation) {
        received.reset();

        operation.response.whenComplete((r, t) -> received.release());

        HttpResponseHandler responseHandler = channel.pipeline().get(HttpResponseHandler.class);

        try {
            responseHandler.pendingResponse = operation.response;

            channel.writeAndFlush(operation.request).sync();

            if (!received.await(operationTimeoutMillis, MILLISECONDS)) {
                channel.close().awaitUninterruptibly();
                operation.response.completeExceptionally(new HttpOperationTimeoutException(operation.request));
            }
        } catch (Exception e) {
            operation.response.completeExceptionally(e);
        } finally {
            responseHandler.pendingResponse = null;
        }
    }

    private boolean isRunning() {
        return !group.isShuttingDown();
    }

    @Override
    public void close() {
        Future shutdownFuture = group.shutdownGracefully(0, 15, SECONDS);
        queueExecutor.shutdown();

        HttpOperation operation;
        while ((operation = queue.poll()) != null) {
            operation.response.completeExceptionally(new HttpClientException("Client closed"));
        }

        shutdownFuture.awaitUninterruptibly();

        try {
            queueExecutor.awaitTermination(5, SECONDS);
        } catch (InterruptedException e) {
            // ignore
        }
    }

    private static void addAuthorizationHeader(FullHttpRequest request, UserCredentials userCredentials) {
        checkNotNull(request, "request is null");
        checkNotNull(userCredentials, "userCredentials is null");

        byte[] encodedCredentials = Base64.getEncoder().encode(toBytes(userCredentials.username + ":" + userCredentials.password));
        request.headers().add(HttpHeaderNames.AUTHORIZATION, "Basic " + newString(encodedCredentials));
    }

    public static FullHttpRequest newRequest(HttpMethod method, String uri, UserCredentials userCredentials) {
        checkNotNull(method, "method is null");
        checkArgument(!isNullOrEmpty(uri), "uri is null or empty");

        FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, uri);

        if (userCredentials != null) {
            addAuthorizationHeader(request, userCredentials);
        }

        return request;
    }

    public static FullHttpRequest newRequest(HttpMethod method, String uri, String body, CharSequence contentType, UserCredentials userCredentials) {
        checkNotNull(method, "method is null");
        checkArgument(!isNullOrEmpty(uri), "uri is null or empty");
        checkNotNull(body, "body is null");
        checkNotNull(contentType, "contentType is null");
        checkArgument(contentType.length() > 0, "contentType is empty");

        ByteBuf data = copiedBuffer(body, UTF_8);

        FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, uri, data);
        request.headers().set(HttpHeaderNames.CONTENT_TYPE, contentType);
        request.headers().set(HttpHeaderNames.CONTENT_LENGTH, data.readableBytes());

        if (userCredentials != null) {
            addAuthorizationHeader(request, userCredentials);
        }

        return request;
    }

    /**
     * Creates a new HTTP client builder.
     *
     * @return HTTP client builder
     */
    public static Builder newBuilder() {
        return new Builder();
    }

    /**
     * HTTP client builder.
     */
    public static class Builder {
        private InetSocketAddress address;
        private Duration connectTimeout;
        private Duration operationTimeout;
        private Boolean acceptGzip;
        private Integer maxContentLength;

        /**
         * Sets server address.
         *
         * @param host the host name.
         * @param port the port number.
         * @return the builder reference
         */
        public Builder address(String host, int port) {
            return address(new InetSocketAddress(host, port));
        }

        /**
         * Sets server address.
         *
         * @param address the server address.
         * @return the builder reference
         */
        public Builder address(InetSocketAddress address) {
            this.address = address;
            return this;
        }

        /**
         * Sets connection establishment timeout (by default, 10 seconds).
         *
         * @param connectTimeout connection establishment timeout.
         * @return the builder reference
         */
        public Builder connectTimeout(Duration connectTimeout) {
            this.connectTimeout = connectTimeout;
            return this;
        }

        /**
         * Sets the amount of time before an operation is considered to have timed out (by default, 7 seconds).
         *
         * @param operationTimeout the amount of time before an operation is considered to have timed out.
         * @return the builder reference
         */
        public Builder operationTimeout(Duration operationTimeout) {
            this.operationTimeout = operationTimeout;
            return this;
        }

        /**
         * Specifies whether or not the client accepts compressed content (by default, does not accept compressed content).
         *
         * @param acceptGzip {@code true} to accept.
         * @return the builder reference
         */
        public Builder acceptGzip(boolean acceptGzip) {
            this.acceptGzip = acceptGzip;
            return this;
        }

        /**
         * Sets the maximum length of the response content in bytes (by default, 128 megabytes).
         *
         * @param maxContentLength the maximum length of the response content in bytes.
         * @return the builder reference
         */
        public Builder maxContentLength(int maxContentLength) {
            this.maxContentLength = maxContentLength;
            return this;
        }

        /**
         * Builds a HTTP client.
         *
         * @return HTTP client
         */
        public HttpClient build() {
            checkNotNull(address, "address is null");

            if (connectTimeout == null) {
                connectTimeout = Duration.ofSeconds(10);
            }

            if (operationTimeout == null) {
                operationTimeout = Duration.ofSeconds(7);
            }

            if (acceptGzip == null) {
                acceptGzip = false;
            }

            if (maxContentLength == null) {
                maxContentLength = 128 * 1024 * 1024;
            } else {
                checkArgument(isPositive(maxContentLength), "maxContentLength should be positive");
            }

            return new HttpClient(this);
        }
    }

    private static class HttpOperation {
        final HttpRequest request;
        final CompletableFuture<FullHttpResponse> response;

        HttpOperation(HttpRequest request, CompletableFuture<FullHttpResponse> response) {
            checkNotNull(request, "request is null");
            checkNotNull(response, "response is null");
            this.request = request;
            this.response = response;
        }
    }

}


text:
module Brightbox
  command [:lbs] do |cmd|
    cmd.desc I18n.t("lbs.show.desc")
    cmd.arg_name "lbs-id..."
    cmd.command [:show] do |c|
      c.action do |global_options, _options, args|
        lbs = LoadBalancer.find_all_or_warn(args)

        table_opts = global_options.merge(
          :vertical => true,
          :fields => %i[
            id
            status
            locked
            name
            created_at
            deleted_at
            policy
            ssl_minimum_version
            ssl_issuer
            ssl_subject
            ssl_valid_from
            ssl_expires_at
            ssl_v3_enabled
            cloud_ips
            nodes
            listeners
            healthcheck
          ]
        )

        render_table(lbs, table_opts)
      end
    end
  end
end


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Web.Mvc;

namespace Microsoft.Web.Mvc
{
    public class TempDataValueProviderFactory : ValueProviderFactory
    {
        public override IValueProvider GetValueProvider(ControllerContext controllerContext)
        {
            TempDataDictionary tempData = controllerContext.Controller.TempData;
            if (tempData.Count == 0)
            {
                // fast-track empty TempData
                return null;
            }

            return new TempDataValueProvider(tempData);
        }

        /// <summary>
        /// dummy struct that resembles Void but can be used in a generic context
        /// </summary>
        private struct TempDataVoid
        {
        }

        private sealed class TempDataValueProvider : DictionaryValueProvider<TempDataVoid>
        {
            private readonly TempDataDictionary _tempData;

            // use invariant culture since TempData should contain objects
            public TempDataValueProvider(TempDataDictionary tempData)
                : base(GetVoidDictionary(tempData), CultureInfo.InvariantCulture)
            {
                _tempData = tempData;
            }

            public override ValueProviderResult GetValue(string key)
            {
                object rawValue;

                // TryGetValue will mark the entry for removal.
                if (_tempData.TryGetValue(key, out rawValue))
                {
                    string attemptedValue = Convert.ToString(rawValue, CultureInfo.InvariantCulture);
                    return new ValueProviderResult(rawValue, attemptedValue, CultureInfo.InvariantCulture);
                }
                else
                {
                    // no value found
                    return null;
                }
            }

            private static Dictionary<string, TempDataVoid> GetVoidDictionary(TempDataDictionary tempData)
            {
                // Create a special backing store that doesn't directly hold the values, since the DictionaryValueProvider
                // enumerates over the backing store but enumerating over TempData marks everything for removal.
                Dictionary<string, TempDataVoid> d = new Dictionary<string, TempDataVoid>(StringComparer.OrdinalIgnoreCase);

                // Enumerating over TempDataDictionary.Keys doesn't mark them for removal.
                foreach (string key in tempData.Keys)
                {
                    d[key] = default(TempDataVoid);
                }

                return d;
            }
        }
    }
}


text:
import * as React from "react";
import { MapBackground } from "../map_background";
import { shallow } from "enzyme";
import { MapBackgroundProps } from "../../interfaces";
import {
  fakeMapTransformProps
} from "../../../../__test_support__/map_transform_props";

describe("<MapBackground/>", () => {
  function fakeProps(): MapBackgroundProps {
    return {
      mapTransformProps: fakeMapTransformProps(),
      plantAreaOffset: { x: 100, y: 100 },
      templateView: false,
    };
  }

  it("renders map background", () => {
    const wrapper = shallow(<MapBackground {...fakeProps()} />);
    expect(wrapper.find("#bed-interior").props()).toEqual(
      expect.objectContaining({ width: 3180, height: 1680 }));
    expect(wrapper.find("#bed-border").props()).toEqual(
      expect.objectContaining({ width: 3200, height: 1700 }));
  });

  it("renders map background: X&Y swapped", () => {
    const p = fakeProps();
    p.mapTransformProps.xySwap = true;
    const wrapper = shallow(<MapBackground {...p} />);
    expect(wrapper.find("#bed-interior").props()).toEqual(
      expect.objectContaining({ width: 1680, height: 3180 }));
    expect(wrapper.find("#bed-border").props()).toEqual(
      expect.objectContaining({ width: 1700, height: 3200 }));
  });
});


text:
title: "Beam SQL Roadmap"
---
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# SQL

This roadmap is in progress. In the meantime, here are available resources:

 - [Beam SQL documentation](/documentation/dsls/sql/overview)
 - Issues: [dsl-sql](https://github.com/apache/beam/issues?q=is%3Aopen+is%3Aissue+label%3Adsl-sql)


text:
namespace storage {

class FileSystemContext;
class FileSystemOperationRunner;

// A base class for recursive operation delegates.
//
// In short, each subclass should override ProcessFile and ProcessDirectory
// to process a directory or a file. To start the recursive operation it
// should also call StartRecursiveOperation.
class STORAGE_EXPORT RecursiveOperationDelegate
    : public base::SupportsWeakPtr<RecursiveOperationDelegate> {
 public:
  typedef FileSystemOperation::StatusCallback StatusCallback;
  typedef FileSystemOperation::FileEntryList FileEntryList;
  typedef FileSystemOperation::ErrorBehavior ErrorBehavior;

  virtual ~RecursiveOperationDelegate();

  // This is called when the consumer of this instance starts a non-recursive
  // operation.
  virtual void Run() = 0;

  // This is called when the consumer of this instance starts a recursive
  // operation.
  virtual void RunRecursively() = 0;

  // This is called each time a file is found while recursively
  // performing an operation.
  virtual void ProcessFile(const FileSystemURL& url,
                           const StatusCallback& callback) = 0;

  // This is called each time a directory is found while recursively
  // performing an operation.
  virtual void ProcessDirectory(const FileSystemURL& url,
                                const StatusCallback& callback) = 0;

  // This is called each time after files and subdirectories for a
  // directory is processed while recursively performing an operation.
  virtual void PostProcessDirectory(const FileSystemURL& url,
                                    const StatusCallback& callback) = 0;

  // Cancels the currently running operation.
  void Cancel();

 protected:
  explicit RecursiveOperationDelegate(FileSystemContext* file_system_context);

  // Starts to process files/directories recursively from the given |root|.
  // This will call ProcessFile and ProcessDirectory on each file or directory.
  //
  // First, this tries to call ProcessFile with |root| regardless whether it is
  // actually a file or a directory. If it is a directory, ProcessFile should
  // return File::FILE_NOT_A_FILE.
  //
  // For each directory, the recursive operation works as follows:
  // ProcessDirectory is called first for the directory.
  // Then the directory contents are read (to obtain its sub directories and
  // files in it).
  // ProcessFile is called for found files.
  // The same step is recursively applied to each subdirectory.
  // After all files and subdirectories in a directory are processed,
  // PostProcessDirectory is called for the directory.
  // Here is an example;
  // a_dir/ -+- b1_dir/ -+- c1_dir/ -+- d1_file
  //         |           |           |
  //         |           +- c2_file  +- d2_file
  //         |
  //         +- b2_dir/ --- e_dir/
  //         |
  //         +- b3_file
  //         |
  //         +- b4_file
  // Then traverse order is:
  // ProcessFile(a_dir) (This should return File::FILE_NOT_A_FILE).
  // ProcessDirectory(a_dir).
  // ProcessFile(b3_file).
  // ProcessFile(b4_file).
  // ProcessDirectory(b1_dir).
  // ProcessFile(c2_file)
  // ProcessDirectory(c1_dir).
  // ProcessFile(d1_file).
  // ProcessFile(d2_file).
  // PostProcessDirectory(c1_dir)
  // PostProcessDirectory(b1_dir).
  // ProcessDirectory(b2_dir)
  // ProcessDirectory(e_dir)
  // PostProcessDirectory(e_dir)
  // PostProcessDirectory(b2_dir)
  // PostProcessDirectory(a_dir)
  //
  // |error_behavior| is to specify how this behaves when an operation have
  // failed.
  // |callback| is fired with base::File::FILE_OK when every file/directory
  // under |root| is processed, or fired earlier when any suboperation fails.
  void StartRecursiveOperation(const FileSystemURL& root,
                               ErrorBehavior error_behavior,
                               const StatusCallback& callback);

  FileSystemContext* file_system_context() { return file_system_context_; }
  const FileSystemContext* file_system_context() const {
    return file_system_context_;
  }

  FileSystemOperationRunner* operation_runner();

  // Called when Cancel() is called. This is a hook to do something more
  // in a derived class. By default, do nothing.
  virtual void OnCancel();

 private:
  void TryProcessFile(const FileSystemURL& root);
  void DidTryProcessFile(const FileSystemURL& root,
                         base::File::Error error);
  void ProcessNextDirectory();
  void DidProcessDirectory(base::File::Error error);
  void DidReadDirectory(const FileSystemURL& parent,
                        base::File::Error error,
                        const FileEntryList& entries,
                        bool has_more);
  void ProcessPendingFiles();
  void DidProcessFile(const FileSystemURL& url, base::File::Error error);
  void ProcessSubDirectory();
  void DidPostProcessDirectory(base::File::Error error);

  // Called when all recursive operation is done (or an error occurs).
  void Done(base::File::Error error);

  FileSystemContext* file_system_context_;
  StatusCallback callback_;
  std::stack<FileSystemURL> pending_directories_;
  std::stack<std::queue<FileSystemURL> > pending_directory_stack_;
  std::queue<FileSystemURL> pending_files_;
  bool canceled_;
  ErrorBehavior error_behavior_;
  bool failed_some_operations_;

  DISALLOW_COPY_AND_ASSIGN(RecursiveOperationDelegate);
};

}  // namespace storage

#endif  // STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_