text:
package com.sun.xml.internal.stream;

import java.util.Hashtable;

import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
import com.sun.org.apache.xerces.internal.impl.PropertyManager;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import java.util.Enumeration;

/**
 *
 * @author K.Venugopal SUN Microsystems
 * @author Neeraj Bajaj SUN Microsystems
 * @author Andy Clark, IBM
 *
 */
public class XMLEntityStorage {

    /** Property identifier: error reporter. */
    protected static final String ERROR_REPORTER =
    Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;

    /** Feature identifier: warn on duplicate EntityDef */
    protected static final String WARN_ON_DUPLICATE_ENTITYDEF =
    Constants.XERCES_FEATURE_PREFIX +Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;

    /** warn on duplicate Entity declaration.
     *  http://apache.org/xml/features/warn-on-duplicate-entitydef
     */
    protected boolean fWarnDuplicateEntityDef;

    /** Entities. */
    protected Hashtable fEntities = new Hashtable();

    protected Entity.ScannedEntity fCurrentEntity ;

    private XMLEntityManager fEntityManager;
    /**
     * Error reporter. This property identifier is:
     * http://apache.org/xml/properties/internal/error-reporter
     */
    protected XMLErrorReporter fErrorReporter;
    protected PropertyManager fPropertyManager ;

    /* To keep track whether an entity is declared in external or internal subset*/
    protected boolean fInExternalSubset = false;

    /** Creates a new instance of XMLEntityStorage */
    public XMLEntityStorage(PropertyManager propertyManager) {
        fPropertyManager = propertyManager ;
    }

    /** Creates a new instance of XMLEntityStorage */
    /*public XMLEntityStorage(Entity.ScannedEntity currentEntity) {
        fCurrentEntity = currentEntity ;*/
    public XMLEntityStorage(XMLEntityManager entityManager) {
        fEntityManager = entityManager;
    }

    public void reset(PropertyManager propertyManager){

        fErrorReporter = (XMLErrorReporter)propertyManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY);
        fEntities.clear();
        fCurrentEntity = null;

    }

    public void reset(){
        fEntities.clear();
        fCurrentEntity = null;
    }
    /**
     * Resets the component. The component can query the component manager
     * about any features and properties that affect the operation of the
     * component.
     *
     * @param componentManager The component manager.
     *
     * @throws SAXException Thrown by component on initialization error.
     *                      For example, if a feature or property is
     *                      required for the operation of the component, the
     *                      component manager may throw a
     *                      SAXNotRecognizedException or a
     *                      SAXNotSupportedException.
     */
    public void reset(XMLComponentManager componentManager)
    throws XMLConfigurationException {

        // xerces features

        fWarnDuplicateEntityDef = componentManager.getFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);

        fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);

        fEntities.clear();
        fCurrentEntity = null;

    } // reset(XMLComponentManager)

    /**
     * Returns entity declaration.
     *
     * @param name The name of the entity.
     *
     * @see SymbolTable
     */
    public Entity getEntity(String name) {
        return (Entity)fEntities.get(name);
    } // getEntity(String)

    public boolean hasEntities() {
            return (fEntities!=null);
    } // getEntity(String)

    public int getEntitySize() {
        return fEntities.size();
    } // getEntity(String)

    public Enumeration getEntityKeys() {
        return fEntities.keys();
    }
    /**
     * Adds an internal entity declaration.
     *

     * Note: This method ignores subsequent entity
     * declarations.
     *

     * Note: The name should be a unique symbol. The
     * SymbolTable can be used for this purpose.
     *
     * @param name The name of the entity.
     * @param text The text of the entity.
     *
     * @see SymbolTable
     */
    public void addInternalEntity(String name, String text) {
      if (!fEntities.containsKey(name)) {
            Entity entity = new Entity.InternalEntity(name, text, fInExternalSubset);
            fEntities.put(name, entity);
        }
        else{
            if(fWarnDuplicateEntityDef){
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                "MSG_DUPLICATE_ENTITY_DEFINITION",
                new Object[]{ name },
                XMLErrorReporter.SEVERITY_WARNING );
            }
        }
    } // addInternalEntity(String,String)

    /**
     * Adds an external entity declaration.
     *

     * Note: This method ignores subsequent entity
     * declarations.
     *

     * Note: The name should be a unique symbol. The
     * SymbolTable can be used for this purpose.
     *
     * @param name         The name of the entity.
     * @param publicId     The public identifier of the entity.
     * @param literalSystemId     The system identifier of the entity.
     * @param baseSystemId The base system identifier of the entity.
     *                     This is the system identifier of the entity
     *                     where the entity being added and
     *                     is used to expand the system identifier when
     *                     the system identifier is a relative URI.
     *                     When null the system identifier of the first
     *                     external entity on the stack is used instead.
     *
     * @see SymbolTable
     */
    public void addExternalEntity(String name,
    String publicId, String literalSystemId,
    String baseSystemId) {
        if (!fEntities.containsKey(name)) {
            if (baseSystemId == null) {
                // search for the first external entity on the stack
                //xxx commenting the 'size' variable..
                /**
                 * int size = fEntityStack.size();
                 * if (size == 0 && fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                 * baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
                 * }
                 */

                //xxx we need to have information about the current entity.
                if (fCurrentEntity != null && fCurrentEntity.entityLocation != null) {
                    baseSystemId = fCurrentEntity.entityLocation.getExpandedSystemId();
                }
                /**
                 * for (int i = size - 1; i >= 0 ; i--) {
                 * ScannedEntity externalEntity =
                 * (ScannedEntity)fEntityStack.elementAt(i);
                 * if (externalEntity.entityLocation != null && externalEntity.entityLocation.getExpandedSystemId() != null) {
                 * baseSystemId = externalEntity.entityLocation.getExpandedSystemId();
                 * break;
                 * }
                 * }
                 */
            }

            fCurrentEntity = fEntityManager.getCurrentEntity();
            Entity entity = new Entity.ExternalEntity(name,
            new XMLResourceIdentifierImpl(publicId, literalSystemId,
            baseSystemId, expandSystemId(literalSystemId, baseSystemId)),
            null, fInExternalSubset);
            //TODO :: Forced to pass true above remove it.
            //(fCurrentEntity == null) ? fasle : fCurrentEntity.isEntityDeclInExternalSubset());
            //                                  null, fCurrentEntity.isEntityDeclInExternalSubset());
            fEntities.put(name, entity);
        }
        else{
            if(fWarnDuplicateEntityDef){
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                "MSG_DUPLICATE_ENTITY_DEFINITION",
                new Object[]{ name },
                XMLErrorReporter.SEVERITY_WARNING );
            }
        }

    } // addExternalEntity(String,String,String,String)

    /**
     * Checks whether an entity given by name is external.
     *
     * @param entityName The name of the entity to check.
     * @returns True if the entity is external, false otherwise
     *           (including when the entity is not declared).
     */
    public boolean isExternalEntity(String entityName) {

        Entity entity = (Entity)fEntities.get(entityName);
        if (entity == null) {
            return false;
        }
        return entity.isExternal();
    }

    /**
     * Checks whether the declaration of an entity given by name is
     * // in the external subset.
     *
     * @param entityName The name of the entity to check.
     * @returns True if the entity was declared in the external subset, false otherwise
     *           (including when the entity is not declared).
     */
    public boolean isEntityDeclInExternalSubset(String entityName) {

        Entity entity = (Entity)fEntities.get(entityName);
        if (entity == null) {
            return false;
        }
        return entity.isEntityDeclInExternalSubset();
    }

    /**
     * Adds an unparsed entity declaration.
     *

     * Note: This method ignores subsequent entity
     * declarations.
     *

     * Note: The name should be a unique symbol. The
     * SymbolTable can be used for this purpose.
     *
     * @param name     The name of the entity.
     * @param publicId The public identifier of the entity.
     * @param systemId The system identifier of the entity.
     * @param notation The name of the notation.
     *
     * @see SymbolTable
     */
    public void addUnparsedEntity(String name,
    String publicId, String systemId,
    String baseSystemId, String notation) {

        fCurrentEntity = fEntityManager.getCurrentEntity();
        if (!fEntities.containsKey(name)) {
            Entity entity = new Entity.ExternalEntity(name, new XMLResourceIdentifierImpl(publicId, systemId, baseSystemId, null), notation, fInExternalSubset);
            //                  (fCurrentEntity == null) ? fasle : fCurrentEntity.isEntityDeclInExternalSubset());
            //                  fCurrentEntity.isEntityDeclInExternalSubset());
            fEntities.put(name, entity);
        }
        else{
            if(fWarnDuplicateEntityDef){
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                "MSG_DUPLICATE_ENTITY_DEFINITION",
                new Object[]{ name },
                XMLErrorReporter.SEVERITY_WARNING );
            }
        }
    } // addUnparsedEntity(String,String,String,String)

    /**
     * Checks whether an entity given by name is unparsed.
     *
     * @param entityName The name of the entity to check.
     * @returns True if the entity is unparsed, false otherwise
     *          (including when the entity is not declared).
     */
    public boolean isUnparsedEntity(String entityName) {

        Entity entity = (Entity)fEntities.get(entityName);
        if (entity == null) {
            return false;
        }
        return entity.isUnparsed();
    }

    /**
     * Checks whether an entity given by name is declared.
     *
     * @param entityName The name of the entity to check.
     * @returns True if the entity is declared, false otherwise.
     */
    public boolean isDeclaredEntity(String entityName) {

        Entity entity = (Entity)fEntities.get(entityName);
        return entity != null;
    }
    /**
     * Expands a system id and returns the system id as a URI, if
     * it can be expanded. A return value of null means that the
     * identifier is already expanded. An exception thrown
     * indicates a failure to expand the id.
     *
     * @param systemId The systemId to be expanded.
     *
     * @return Returns the URI string representing the expanded system
     *         identifier. A null value indicates that the given
     *         system identifier is already expanded.
     *
     */
    public static String expandSystemId(String systemId) {
        return expandSystemId(systemId, null);
    } // expandSystemId(String):String

    // current value of the "user.dir" property
    private static String gUserDir;
    // escaped value of the current "user.dir" property
    private static String gEscapedUserDir;
    // which ASCII characters need to be escaped
    private static boolean gNeedEscaping[] = new boolean[128];
    // the first hex character if a character needs to be escaped
    private static char gAfterEscaping1[] = new char[128];
    // the second hex character if a character needs to be escaped
    private static char gAfterEscaping2[] = new char[128];
    private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
    // initialize the above 3 arrays
    static {
        for (int i = 0; i <= 0x1f; i++) {
            gNeedEscaping[i] = true;
            gAfterEscaping1[i] = gHexChs[i >> 4];
            gAfterEscaping2[i] = gHexChs[i & 0xf];
        }
        gNeedEscaping[0x7f] = true;
        gAfterEscaping1[0x7f] = '7';
        gAfterEscaping2[0x7f] = 'F';
        char[] escChs = {' ', '<', '>', '#', '%', '"', '{', '}',
        '|', '\\', '^', '~', '[', ']', '`'};
        int len = escChs.length;
        char ch;
        for (int i = 0; i < len; i++) {
            ch = escChs[i];
            gNeedEscaping[ch] = true;
            gAfterEscaping1[ch] = gHexChs[ch >> 4];
            gAfterEscaping2[ch] = gHexChs[ch & 0xf];
        }
    }
    // To escape the "user.dir" system property, by using %HH to represent
    // special ASCII characters: 0x00~0x1F, 0x7F, ' ', '<', '>', '#', '%'
    // and '"'. It's a static method, so needs to be synchronized.
    // this method looks heavy, but since the system property isn't expected
    // to change often, so in most cases, we only need to return the string
    // that was escaped before.
    // According to the URI spec, non-ASCII characters (whose value >= 128)
    // need to be escaped too.
    // REVISIT: don't know how to escape non-ASCII characters, especially
    // which encoding to use. Leave them for now.
    private static synchronized String getUserDir() {
        // get the user.dir property
        String userDir = "";
        try {
            userDir = SecuritySupport.getSystemProperty("user.dir");
        }
        catch (SecurityException se) {
        }

        // return empty string if property value is empty string.
        if (userDir.length() == 0)
            return "";

        // compute the new escaped value if the new property value doesn't
        // match the previous one
        if (userDir.equals(gUserDir)) {
            return gEscapedUserDir;
        }

        // record the new value as the global property value
        gUserDir = userDir;

        char separator = java.io.File.separatorChar;
        userDir = userDir.replace(separator, '/');

        int len = userDir.length(), ch;
        StringBuffer buffer = new StringBuffer(len*3);
        // change C:/blah to /C:/blah
        if (len >= 2 && userDir.charAt(1) == ':') {
            ch = Character.toUpperCase(userDir.charAt(0));
            if (ch >= 'A' && ch <= 'Z') {
                buffer.append('/');
            }
        }

        // for each character in the path
        int i = 0;
        for (; i < len; i++) {
            ch = userDir.charAt(i);
            // if it's not an ASCII character, break here, and use UTF-8 encoding
            if (ch >= 128)
                break;
            if (gNeedEscaping[ch]) {
                buffer.append('%');
                buffer.append(gAfterEscaping1[ch]);
                buffer.append(gAfterEscaping2[ch]);
                // record the fact that it's escaped
            }
            else {
                buffer.append((char)ch);
            }
        }

        // we saw some non-ascii character
        if (i < len) {
            // get UTF-8 bytes for the remaining sub-string
            byte[] bytes = null;
            byte b;
            try {
                bytes = userDir.substring(i).getBytes("UTF-8");
            } catch (java.io.UnsupportedEncodingException e) {
                // should never happen
                return userDir;
            }
            len = bytes.length;

            // for each byte
            for (i = 0; i < len; i++) {
                b = bytes[i];
                // for non-ascii character: make it positive, then escape
                if (b < 0) {
                    ch = b + 256;
                    buffer.append('%');
                    buffer.append(gHexChs[ch >> 4]);
                    buffer.append(gHexChs[ch & 0xf]);
                }
                else if (gNeedEscaping[b]) {
                    buffer.append('%');
                    buffer.append(gAfterEscaping1[b]);
                    buffer.append(gAfterEscaping2[b]);
                }
                else {
                    buffer.append((char)b);
                }
            }
        }

        // change blah/blah to blah/blah/
        if (!userDir.endsWith("/"))
            buffer.append('/');

        gEscapedUserDir = buffer.toString();

        return gEscapedUserDir;
    }

    /**
     * Expands a system id and returns the system id as a URI, if
     * it can be expanded. A return value of null means that the
     * identifier is already expanded. An exception thrown
     * indicates a failure to expand the id.
     *
     * @param systemId The systemId to be expanded.
     *
     * @return Returns the URI string representing the expanded system
     *         identifier. A null value indicates that the given
     *         system identifier is already expanded.
     *
     */
    public static String expandSystemId(String systemId, String baseSystemId) {

        // check for bad parameters id
        if (systemId == null || systemId.length() == 0) {
            return systemId;
        }
        // if id already expanded, return
        try {
            new URI(systemId);
            return systemId;
        } catch (URI.MalformedURIException e) {
            // continue on...
        }
        // normalize id
        String id = fixURI(systemId);

        // normalize base
        URI base = null;
        URI uri = null;
        try {
            if (baseSystemId == null || baseSystemId.length() == 0 ||
            baseSystemId.equals(systemId)) {
                String dir = getUserDir();
                base = new URI("file", "", dir, null, null);
            }
            else {
                try {
                    base = new URI(fixURI(baseSystemId));
                }
                catch (URI.MalformedURIException e) {
                    if (baseSystemId.indexOf(':') != -1) {
                        // for xml schemas we might have baseURI with
                        // a specified drive
                        base = new URI("file", "", fixURI(baseSystemId), null, null);
                    }
                    else {
                        String dir = getUserDir();
                        dir = dir + fixURI(baseSystemId);
                        base = new URI("file", "", dir, null, null);
                    }
                }
            }
            // expand id
            uri = new URI(base, id);
        }
        catch (Exception e) {
            // let it go through

        }

        if (uri == null) {
            return systemId;
        }
        return uri.toString();

    } // expandSystemId(String,String):String
    //
    // Protected static methods
    //

    /**
     * Fixes a platform dependent filename to standard URI form.
     *
     * @param str The string to fix.
     *
     * @return Returns the fixed URI string.
     */
    protected static String fixURI(String str) {

        // handle platform dependent strings
        str = str.replace(java.io.File.separatorChar, '/');

        // Windows fix
        if (str.length() >= 2) {
            char ch1 = str.charAt(1);
            // change "C:blah" to "/C:blah"
            if (ch1 == ':') {
                char ch0 = Character.toUpperCase(str.charAt(0));
                if (ch0 >= 'A' && ch0 <= 'Z') {
                    str = "/" + str;
                }
            }
            // change "//blah" to "file://blah"
            else if (ch1 == '/' && str.charAt(0) == '/') {
                str = "file:" + str;
            }
        }

        // done
        return str;

    } // fixURI(String):String

    // indicate start of external subset
    public void startExternalSubset() {
        fInExternalSubset = true;
    }

    public void endExternalSubset() {
        fInExternalSubset = false;
    }
}


text:
namespace CGAL {

template <class CDT>
inline
void
read_triangle_poly_file(CDT& t, std::istream &f)
{
  read_triangle_poly_file(t, f, Emptyset_iterator());
}

//the function that reads a Shewchuk Triangle .poly file
template <class CDT, class OutputIterator>
void
read_triangle_poly_file(CDT& t, std::istream &f,
                        OutputIterator seeds)
{
  typedef typename CDT::Vertex_handle Vertex_handle;
  typedef typename CDT::Point Point;

  t.clear();

  unsigned int number_of_points;
  skip_comment_OFF(f);
  f >> number_of_points;
  skip_until_EOL(f);
  skip_comment_OFF(f);

  // read vertices
  std::vector<Vertex_handle> vertices(number_of_points);
  for(unsigned int i = 0; i < number_of_points; ++i)
    {
      unsigned int j;
      double x, y;
      f >> j >> iformat(x) >> iformat(y);
      Point p(x, y);
      skip_until_EOL(f); skip_comment_OFF(f);
      vertices[--j] = t.insert(p);
    }

  // read segments
  unsigned int number_of_segments;
  f >> number_of_segments;
  skip_until_EOL(f); skip_comment_OFF(f);
  for(unsigned int k = 0; k < number_of_segments; ++k)
    {
      unsigned int l, v1, v2;
      f >> l >> v1 >> v2;
      skip_until_EOL(f); skip_comment_OFF(f);
      t.insert_constraint(vertices[--v1], vertices[--v2]);
    }

  // read holes
  unsigned int number_of_holes;
  f >> number_of_holes;
  for(unsigned int m = 0; m < number_of_holes; ++m)
    {
      unsigned int n;
      Point p;
      f >> n >> p;
      skip_until_EOL(f); skip_comment_OFF(f);
      *seeds++ = p;
    }
}

//the function that write a Shewchuk Triangle .poly file
template <class CDT, typename InputIterator>
void
write_triangle_poly_file(const CDT& t, std::ostream &f,
                         InputIterator begin, InputIterator end)
{
  typedef typename CDT::Vertex_handle Vertex_handle;
  typedef typename CDT::Finite_vertices_iterator
    Finite_vertices_iterator;
  typedef typename CDT::Finite_edges_iterator
    Finite_edges_iterator;

  std::map<Vertex_handle, unsigned int> index;

  // write vertices
  f << "# Shewchuk Triangle .poly file, produced by the CGAL::Mesh_2 package"
    << std::endl
    << "# Neither attributes nor boundary markers are used." << std::endl
    << t.number_of_vertices() << " " << 2 << " "
    << 0 << " " << 0 << std::endl;

  f << std::endl;

  unsigned int vertices_counter = 0;
  for(Finite_vertices_iterator vit = t.finite_vertices_begin();
      vit != t.finite_vertices_end();
      ++vit)
    {
      f << ++vertices_counter << " " << vit->point() << std::endl;
      index[vit] = vertices_counter;
    }

  f << std::endl;

  // write constrained edges

  int number_of_constrained_edges = 0;
  for(Finite_edges_iterator it = t.finite_edges_begin();
      it != t.finite_edges_end();
      ++it)
    if(it->first->is_constrained(it->second))
      ++number_of_constrained_edges;

  f << number_of_constrained_edges << " " << 0 << std::endl;
  unsigned int edges_counter = 0;

  for(Finite_edges_iterator eit = t.finite_edges_begin();
      eit != t.finite_edges_end();
      ++eit)
    if(eit->first->is_constrained(eit->second))
      f << ++edges_counter << " "
        << index[eit->first->vertex(t.cw(eit->second))] << " "
        << index[eit->first->vertex(t.ccw(eit->second))]
        << std::endl;

  f << std::endl;

  // write seeds, assuming that the seeds unmarks faces
  f << std::distance(begin, end) << std::endl;
  unsigned int seeds_counter = 0;
  for(InputIterator sit = begin;
      sit!=end; ++sit)
    f << ++seeds_counter << " " << *sit << std::endl;
}

//the same without holes.
template <class CDT>
void
write_triangle_poly_file(const CDT& t, std::ostream &f)
{
  std::list<int> l;

  write_triangle_poly_file(t, f, l.begin(), l.end());
}

} // end namespace CGAL

#endif // CGAL_FILE_POLY_H

redpajama_set_name: RedPajamaGithub


text:
from ctypes import c_char_p, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
    double_output, int_output, srs_output, string_output, void_output)

## Shortcut generation for routines with known parameters.
def srs_double(f):
    """
    Creates a function prototype for the OSR routines that take
    the OSRSpatialReference object and
    """
    return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True)

def units_func(f):
    """
    Creates a ctypes function prototype for OSR units functions, e.g.,
    OSRGetAngularUnits, OSRGetLinearUnits.
    """
    return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True)

# Creation & destruction.
clone_srs = srs_output(std_call('OSRClone'), [c_void_p])
new_srs = srs_output(std_call('OSRNewSpatialReference'), [c_char_p])
release_srs = void_output(lgdal.OSRRelease, [c_void_p], errcheck=False)
destroy_srs = void_output(std_call('OSRDestroySpatialReference'), [c_void_p], errcheck=False)
srs_validate = void_output(lgdal.OSRValidate, [c_void_p])

# Getting the semi_major, semi_minor, and flattening functions.
semi_major = srs_double(lgdal.OSRGetSemiMajor)
semi_minor = srs_double(lgdal.OSRGetSemiMinor)
invflattening = srs_double(lgdal.OSRGetInvFlattening)

# WKT, PROJ, EPSG, XML importation routines.
from_wkt = void_output(lgdal.OSRImportFromWkt, [c_void_p, POINTER(c_char_p)])
from_proj = void_output(lgdal.OSRImportFromProj4, [c_void_p, c_char_p])
from_epsg = void_output(std_call('OSRImportFromEPSG'), [c_void_p, c_int])
from_xml = void_output(lgdal.OSRImportFromXML, [c_void_p, c_char_p])
from_user_input = void_output(std_call('OSRSetFromUserInput'), [c_void_p, c_char_p])

# Morphing to/from ESRI WKT.
morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])
morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])

# Identifying the EPSG
identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])

# Getting the angular_units, linear_units functions
linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits)

# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML.
to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)], decoding='ascii')
to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)], decoding='ascii')
to_pretty_wkt = string_output(std_call('OSRExportToPrettyWkt'),
    [c_void_p, POINTER(c_char_p), c_int], offset=-2, decoding='ascii'
)

# Memory leak fixed in GDAL 1.5; still exists in 1.4.
to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2, decoding='ascii')

# String attribute retrival routines.
get_attr_value = const_string_output(std_call('OSRGetAttrValue'), [c_void_p, c_char_p, c_int], decoding='ascii')
get_auth_name = const_string_output(lgdal.OSRGetAuthorityName, [c_void_p, c_char_p], decoding='ascii')
get_auth_code = const_string_output(lgdal.OSRGetAuthorityCode, [c_void_p, c_char_p], decoding='ascii')

# SRS Properties
isgeographic = int_output(lgdal.OSRIsGeographic, [c_void_p])
islocal = int_output(lgdal.OSRIsLocal, [c_void_p])
isprojected = int_output(lgdal.OSRIsProjected, [c_void_p])

# Coordinate transformation
new_ct = srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
destroy_ct = void_output(std_call('OCTDestroyCoordinateTransformation'), [c_void_p], errcheck=False)


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
  xmlns:p="http://www.springframework.org/schema/p" xmlns:security="http://www.springframework.org/schema/security"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
	http://www.springframework.org/schema/mvc
	http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
	http://www.springframework.org/schema/context
	http://www.springframework.org/schema/context/spring-context-4.0.xsd
	http://www.springframework.org/schema/security
	http://www.springframework.org/schema/security/spring-security-4.0.xsd">
  <context:component-scan base-package="com.lxp.activemq.*.controller" />

  <mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
      <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
        <property name="objectMapper">
          <bean class="com.fasterxml.jackson.databind.ObjectMapper">
            <property name="serializationInclusion">
              <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
            </property>
            <property name="dateFormat">
              <bean class="java.text.SimpleDateFormat">
                <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" />
              </bean>
            </property>
          </bean>
        </property>
      </bean>
    </mvc:message-converters>
  </mvc:annotation-driven>

  <bean id="encodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
    <property name="encoding" value="UTF-8" />
    <property name="forceEncoding" value="true" />
  </bean>
  <bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
    <security:filter-chain-map request-matcher="ant">
      <security:filter-chain filters="encodingFilter" pattern="/**" />
    </security:filter-chain-map>
  </bean>
</beans>


text:
package net.minidev.ovh.api.dedicated.storage;

/**
 * Atime values
 */
public enum OvhAtimeEnum {
	off("off"),
	on("on");

	final String value;

	OvhAtimeEnum(String s) {
		this.value = s;
	}

	public String toString() {
		return this.value;
	}
}


text:
C { dg-do compile }
C { dg-options "-pedantic-errors -mdalign" { target sh*-*-* } }
C PR 20059
C Check that the warning for padding works correctly.
      SUBROUTINE PLOTZ
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      COMMON /CCPOOL/ RMIN,RMAX,ZMIN,ZMAX,IMIN,JMIN,IMAX,JMAX,NFLOP, ! { dg-warning "Padding" }
     $ HTP
C
        RETURN
      END


text:
DROP TABLE IF EXISTS icp; CREATE TABLE icp AS
with ce as
(
  select
  ce.subject_id
  , ce.stay_id
  , ce.charttime
  -- TODO: handle high ICPs when monitoring two ICPs
  , case when valuenum > 0 and valuenum < 100 then valuenum else null end as icp
  FROM mimiciv_icu.chartevents ce
  -- exclude rows marked as error
  where ce.itemid in
  (
    220765 -- Intra Cranial Pressure -- 92306
  , 227989 -- Intra Cranial Pressure #2 -- 1052
  )
)
select
  ce.subject_id
  , ce.stay_id
  , ce.charttime
  , MAX(icp) as icp
from ce
group by ce.subject_id, ce.stay_id, ce.charttime
;


text:
use std::cast;
use std::libc;
use std::cell::RefCell;
use std::rc::Rc;

use super::events;
use super::IoResult;
use super::eventqueue;
use super::eventqueue::IEventQueue;
use super::eventqueueimpl::EventQueueImpl;
use super::syscalls;
use super::helpers;

pub struct Timer {
	priv process_func: fn(func_ptr: *libc::c_void, event_queue: &mut EventQueueImpl, epoll_events: u32),
	priv fd: i32,
	priv is_active: bool,
	priv interval: u32,
	priv singleshot: bool,
	priv epoll_registered: bool,
	priv event_queue: Rc<RefCell<EventQueueImpl>>,
	priv event_source_info: Rc<events::EventSourceInfo>
}

impl Timer {
	pub fn create(event_queue: &eventqueue::EventQueue) -> IoResult<~Timer> {
		let tfd = unsafe {
			syscalls::timerfd_create(libc::CLOCK_MONOTONIC, 0)
		};
		if tfd == -1 {
			Err(helpers::last_error())
		}
		else {
			Ok(~Timer{
				fd: tfd,
				interval: 0,
				is_active: false,
				singleshot: false,
				epoll_registered: false,
				event_queue: event_queue._get_impl(),
				process_func: Timer::process_epoll_events,
				event_source_info: Rc::new(events::EventSourceInfo::new())
			})
		}
	}

	pub fn set_interval(&mut self, interval: u32) {
		self.interval = interval;
	}

	pub fn get_interal(&self) -> u32 {
		self.interval
	}

	pub fn set_singleshot(&mut self, singleshot: bool) {
		self.singleshot = singleshot;
	}

	pub fn is_singleshot(&self) -> bool {
		self.singleshot
	}

	pub fn is_active(&self) -> bool {
		self.is_active
	}

	pub fn stop(&mut self) {
		if !self.is_active { return; }

		let new_value = syscalls::itimerspec::new(); // init to 0

		let ret = unsafe {
			syscalls::timerfd_settime(self.fd, 0, &new_value, 0 as *syscalls::itimerspec)
		};
		if ret != 0 {
			fail!("Error on stopping timer {0}", helpers::last_error().desc);
		}

		self.event_queue.borrow().with_mut(
			|q|q.unregister_fd(self.fd)
		);
		self.epoll_registered = false;
		self.is_active = false;
		self.remove_pending_events();
	}

	pub fn start(&mut self) {
		if self.is_active || self.interval == 0 { return; }

		let mut new_value = syscalls::itimerspec::new();
		new_value.it_value.tv_sec = (self.interval / 1000u32) as libc::time_t;
		new_value.it_value.tv_nsec = (self.interval % 1000u32) as libc::c_long;
		new_value.it_value.tv_nsec *= 1000000;

		if !self.singleshot {
			new_value.it_interval.tv_sec = new_value.it_value.tv_sec;
			new_value.it_interval.tv_nsec = new_value.it_value.tv_nsec;
		}

		let ret = unsafe {
			syscalls::timerfd_settime(self.fd, 0, &new_value, 0 as *syscalls::itimerspec)
		};
		if ret != 0 {
			fail!("Error on starting timer {0}", helpers::last_error().desc);
		}

		self.is_active = true;
		// Register fd
		let epoll_flags = if self.singleshot {
			syscalls::EPOLLIN | syscalls::EPOLLONESHOT
		} else { syscalls::EPOLLIN };
		let callback: *libc::c_void = unsafe { cast::transmute(&self.process_func) };

		if !self.epoll_registered {
			self.event_queue.borrow().with_mut(|q|
				q.register_fd(self.fd, epoll_flags, callback)
			);
			self.epoll_registered = true;
		} else {
			self.event_queue.borrow().with_mut(|q|
				q.modify_fd(self.fd, epoll_flags, callback)
			);
		}
	}

	fn process_epoll_events(func_ptr: *libc::c_void, event_queue: &mut EventQueueImpl, epoll_events: u32) {
		unsafe {
			let timer: *mut Timer = func_ptr as *mut Timer;

			if epoll_events & syscalls::EPOLLIN != 0 {
				let buffer = [0, ..8];

				let ret = helpers::retry(||
					libc::read((*timer).fd,
						       buffer.as_ptr() as *mut libc::c_void,
						       buffer.len() as libc::size_t) as i32
				);

				if ret == 8 { // Must be 8 bytes
					let expirations: *u64 = cast::transmute(&buffer);
					for _ in range(0, *expirations) {
						let e = events::Event {
							event_type: events::TimerEvent,
							is_valid: true,
							source_info: (*timer).event_source_info.clone()
						};
						event_queue.push_back_event(e);
						// Set timer to inactive when it was a singleshot
						if (*timer).singleshot {
							(*timer).is_active = false;
						}
					}
				}
			}
		}
	}

	fn remove_pending_events(&mut self) {
		self.event_queue.borrow().with_mut(|q|
			q.remove_pending_events(
				|ev|ev.originates_from(self))
		);
	}
}

#[unsafe_destructor]
impl Drop for Timer {
	fn drop(&mut self) {
		// Don't call close because this won't deque already
		// queued events if the timer is inactive
		self.remove_pending_events();
		if self.fd != 0 {
			unsafe { libc::close(self.fd); }
		}
	}
}

impl events::EventSource for Timer {
	fn get_event_source_info<'a>(&'a self) -> &'a Rc<events::EventSourceInfo> {
		&self.event_source_info
	}
}


text:
import unittest
from azure.cli.testsdk import ScenarioTest, JMESPathCheck, ResourceGroupPreparer, live_only

@live_only()
class ResourceDeleteTests(ScenarioTest):
    @ResourceGroupPreparer(name_prefix='cli_test_delete_dependent_resources', location='southcentralus')
    def test_delete_dependent_resources(self, resource_group):
        vm_name = self.create_random_name('cli-test-vm', 30)
        tag_name = self.create_random_name('cli-test-tag', 20)
        username = 'ubuntu'
        password = self.create_random_name('Password#1', 30)

        self.cmd('vm create -n {} -g {} --image UbuntuLTS --tag {} '
                 '--admin-username {} --admin-password {} --authentication-type {} --nsg-rule None'
                 .format(vm_name, resource_group, tag_name, username, password, 'password'))

        rsrc_list = self.cmd('resource list --tag {} --query [].id'.format(tag_name)).get_output_in_json()
        self.cmd('resource delete --ids {}'.format(' '.join(rsrc_list)))
        self.cmd('resource wait --ids {} --deleted --timeout 300'.format(''.join(rsrc_list)))

if __name__ == '__main__':
    unittest.main()


text:
#include "uiColorInput.h"
#include "Converters.h"
#include "Converter.h"
#include "dynv/Map.h"
#include "uiUtilities.h"
#include "GlobalState.h"
#include "gtk/ColorWheel.h"
#include "I18N.h"
#include "gtk/ColorComponent.h"
#include "gtk/ColorWidget.h"
#include "ColorObject.h"
#include "ColorSpaces.h"
#include "color_names/ColorNames.h"
#include "common/SetOnScopeEnd.h"
#include <string>
namespace {
struct DialogInputArgs {
	common::Ref<ColorObject> colorObject;
	GlobalState &gs;
	dynv::Ref options;
	GtkWidget *colorWidget, *textInput, *nameInput, *automaticName;
	GtkWidget *rgbExpander, *hsvExpander, *hslExpander, *cmykExpander, *labExpander, *lchExpander;
	GtkWidget *rgbControl, *hsvControl, *hslControl, *cmykControl, *labControl, *lchControl;
	bool ignoreTextChange;
	DialogInputArgs(GlobalState &gs):
		gs(gs),
		ignoreTextChange(false) {
		options = gs.settings().getOrCreateMap("gpick.color_input");
	}
};
static void updateComponentText(DialogInputArgs *args, GtkColorComponent *component) {
	Color transformedColor;
	gtk_color_component_get_transformed_color(component, transformedColor);
	float alpha = gtk_color_component_get_alpha(component);
	std::vector<std::string> values = toTexts(gtk_color_component_get_color_space(component), transformedColor, alpha, args->gs);
	const char *texts[5] = { 0 };
	int j = 0;
	for (auto &value: values) {
		texts[j++] = value.c_str();
		if (j > 4)
			break;
	}
	gtk_color_component_set_texts(component, texts);
}
static void update(DialogInputArgs *args, GtkWidget *exceptWidget) {
	auto color = args->colorObject->getColor();
	gtk_color_set_color(GTK_COLOR(args->colorWidget), &color, "");
	if (exceptWidget != args->textInput) {
		std::string text = args->gs.converters().serialize(*args->colorObject, Converters::Type::display);
		common::SetOnScopeEnd ignoreTextChange(args->ignoreTextChange = true, false);
		gtk_entry_set_text(GTK_ENTRY(args->textInput), text.c_str());
	}
	if (exceptWidget != args->hslControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->hslControl), color);
	if (exceptWidget != args->hsvControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->hsvControl), color);
	if (exceptWidget != args->rgbControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->rgbControl), color);
	if (exceptWidget != args->cmykControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->cmykControl), color);
	if (exceptWidget != args->labControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->labControl), color);
	if (exceptWidget != args->lchControl) gtk_color_component_set_color(GTK_COLOR_COMPONENT(args->lchControl), color);
	updateComponentText(args, GTK_COLOR_COMPONENT(args->hslControl));
	updateComponentText(args, GTK_COLOR_COMPONENT(args->hsvControl));
	updateComponentText(args, GTK_COLOR_COMPONENT(args->rgbControl));
	updateComponentText(args, GTK_COLOR_COMPONENT(args->cmykControl));
	updateComponentText(args, GTK_COLOR_COMPONENT(args->labControl));
	updateComponentText(args, GTK_COLOR_COMPONENT(args->lchControl));
}
static void onComponentChangeValue(GtkWidget *widget, Color *color, DialogInputArgs *args) {
	args->colorObject->setColor(*color);
	update(args, widget);
}
static void onComponentInputClicked(GtkWidget *widget, int channel, DialogInputArgs *args) {
	dialog_color_component_input_show(GTK_WINDOW(gtk_widget_get_toplevel(widget)), GTK_COLOR_COMPONENT(widget), channel, args->options->getOrCreateMap("component_edit"));
}
static void setComponentHandlers(GtkWidget *widget, DialogInputArgs *args) {
	g_signal_connect(G_OBJECT(widget), "color-changed", G_CALLBACK(onComponentChangeValue), args);
	g_signal_connect(G_OBJECT(widget), "input-clicked", G_CALLBACK(onComponentInputClicked), args);
}
static void addComponentEditor(GtkWidget *vbox, ColorSpace colorSpace, const char *expandOption, DialogInputArgs *args, GtkWidget *&expander, GtkWidget *&control) {
	expander = gtk_expander_new(::colorSpace(colorSpace).name);
	gtk_expander_set_expanded(GTK_EXPANDER(expander), args->options->getBool(expandOption, false));
	gtk_box_pack_start(GTK_BOX(vbox), expander, false, false, 0);
	control = gtk_color_component_new(colorSpace);
	const char *labels[ColorSpaceDescription::maxChannels * 2] = { 0 };
	const auto &type = ::colorSpace(colorSpace);
	for (int i = 0; i < type.channelCount; ++i) {
		labels[i * 2 + 0] = type.channels[i].shortName;
		labels[i * 2 + 1] = _(type.channels[i].name);
	}
	gtk_color_component_set_labels(GTK_COLOR_COMPONENT(control), labels);
	setComponentHandlers(control, args);
	gtk_container_add(GTK_CONTAINER(expander), control);
}
static void onTextChanged(GtkWidget *entry, DialogInputArgs *args) {
	if (args->ignoreTextChange)
		return;
	ColorObject colorObject;
	if (args->gs.converters().deserialize(gtk_entry_get_text(GTK_ENTRY(entry)), colorObject)) {
		args->colorObject->setColor(colorObject.getColor());
		update(args, entry);
	}
}
static void onAutomaticNameToggled(GtkWidget *entry, DialogInputArgs *args) {
	gtk_widget_set_sensitive(args->nameInput, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(args->automaticName)));
}
}
int dialog_color_input_show(GtkWindow *parent, GlobalState &gs, common::OptionalReference<ColorObject> colorObject, bool editableName, common::Ref<ColorObject> &newColorObject) {
	auto args = new DialogInputArgs(gs);
	bool newItem = false;
	if (colorObject) {
		args->colorObject = colorObject->get().copy();
	} else {
		newItem = true;
		args->colorObject = common::Ref(new ColorObject());
	}
	GtkWidget *dialog = gtk_dialog_new_with_buttons(newItem ? _("Add color") : _("Edit color"), parent, GtkDialogFlags(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
		GTK_STOCK_OK, GTK_RESPONSE_OK,
		nullptr);
	gtk_window_set_default_size(GTK_WINDOW(dialog), args->options->getInt32("window.width", -1), args->options->getInt32("window.height", -1));
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);
	GtkWidget *vbox = gtk_vbox_new(false, 5);
	GtkWidget *widget = args->colorWidget = gtk_color_new();
	gtk_color_set_rounded(GTK_COLOR(widget), true);
	gtk_color_set_hcenter(GTK_COLOR(widget), true);
	gtk_color_set_roundness(GTK_COLOR(widget), 5);
	gtk_widget_set_size_request(widget, 30, 30);
	if (!newItem) {
		gtk_color_enable_split(GTK_COLOR(widget), true);
		gtk_color_set_split_color(GTK_COLOR(widget), &args->colorObject->getColor());
	}
	gtk_box_pack_start(GTK_BOX(vbox), widget, true, true, 0);

	Grid grid(2, 3);
	gtk_box_pack_start(GTK_BOX(vbox), grid, false, false, 0);
	grid.addLabel(_("Color:"));
	GtkWidget *entry = args->textInput = grid.add(gtk_entry_new(), true);
	gtk_entry_set_activates_default(GTK_ENTRY(entry), true);
	gtk_widget_grab_focus(entry);
	g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(onTextChanged), args);
	if (editableName) {
		grid.addLabel(_("Name:"));
		args->nameInput = grid.add(gtk_entry_new(), true);
		gtk_widget_set_sensitive(args->nameInput, !args->options->getBool("automatic_name", false));
		grid.nextColumn();
		args->automaticName = grid.add(gtk_check_button_new_with_mnemonic(_("_Automatic name")), true);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(args->automaticName), args->options->getBool("automatic_name", false));
		g_signal_connect(G_OBJECT(args->automaticName), "toggled", G_CALLBACK(onAutomaticNameToggled), args);
	}
	addComponentEditor(vbox, ColorSpace::hsv, "expander.hsv", args, args->hsvExpander, args->hsvControl);
	addComponentEditor(vbox, ColorSpace::hsl, "expander.hsl", args, args->hslExpander, args->hslControl);
	addComponentEditor(vbox, ColorSpace::rgb, "expander.rgb", args, args->rgbExpander, args->rgbControl);
	addComponentEditor(vbox, ColorSpace::cmyk, "expander.cmyk", args, args->cmykExpander, args->cmykControl);
	addComponentEditor(vbox, ColorSpace::lab, "expander.lab", args, args->labExpander, args->labControl);
	addComponentEditor(vbox, ColorSpace::lch, "expander.lch", args, args->lchExpander, args->lchControl);
	if (newItem) {
		auto text = args->options->getString("text", "");
		gtk_entry_set_text(GTK_ENTRY(args->textInput), text.c_str());
	} else {
		update(args, nullptr);
		if (editableName)
			gtk_entry_set_text(GTK_ENTRY(args->nameInput), args->colorObject->getName().c_str());
	}

	gtk_widget_show_all(vbox);
	setDialogContent(dialog, vbox);
	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
	int result = -1;
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
		if (editableName) {
			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(args->automaticName))) {
				std::string name = color_names_get(gs.getColorNames(), &args->colorObject->getColor(), gs.settings().getBool("gpick.color_names.imprecision_postfix", false));
				args->colorObject->setName(name);
			} else {
				args->colorObject->setName(gtk_entry_get_text(GTK_ENTRY(args->nameInput)));
			}
		}
		newColorObject = args->colorObject;
		result = 0;
	}
	if (newItem)
		args->options->set("text", gtk_entry_get_text(GTK_ENTRY(entry)));
	if (editableName)
		args->options->set<bool>("automatic_name", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(args->automaticName)));
	args->options->set<bool>("expander.rgb", gtk_expander_get_expanded(GTK_EXPANDER(args->rgbExpander)));
	args->options->set<bool>("expander.hsv", gtk_expander_get_expanded(GTK_EXPANDER(args->hsvExpander)));
	args->options->set<bool>("expander.hsl", gtk_expander_get_expanded(GTK_EXPANDER(args->hslExpander)));
	args->options->set<bool>("expander.lab", gtk_expander_get_expanded(GTK_EXPANDER(args->labExpander)));
	args->options->set<bool>("expander.lch", gtk_expander_get_expanded(GTK_EXPANDER(args->lchExpander)));
	args->options->set<bool>("expander.cmyk", gtk_expander_get_expanded(GTK_EXPANDER(args->cmykExpander)));
	gint width, height;
	gtk_window_get_size(GTK_WINDOW(dialog), &width, &height);
	args->options->set("window.width", width);
	args->options->set("window.height", height);
	gtk_widget_destroy(dialog);
	delete args;
	return result;
}

struct ColorPickerComponentEditArgs {
	GtkWidget *value[5];
	ColorSpace colorSpace;
	int channel;
	dynv::Ref options;
};

void dialog_color_component_input_show(GtkWindow *parent, GtkColorComponent *colorComponent, int channel, dynv::Ref options) {
	ColorSpace colorSpace = gtk_color_component_get_color_space(GTK_COLOR_COMPONENT(colorComponent));
	ColorPickerComponentEditArgs *args = new ColorPickerComponentEditArgs;
	args->options = options;
	args->colorSpace = colorSpace;
	args->channel = channel;
	memset(args->value, 0, sizeof(args->value));
	GtkWidget *dialog = gtk_dialog_new_with_buttons(_("Edit"), parent, GtkDialogFlags(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
		GTK_STOCK_OK, GTK_RESPONSE_OK,
		nullptr);
	gtk_window_set_default_size(GTK_WINDOW(dialog), args->options->getInt32("window.width", -1), args->options->getInt32("window.height", -1));
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);
	GtkWidget *table = gtk_table_new(2, 2, FALSE);
	Color rawColor;
	gtk_color_component_get_raw_color(colorComponent, rawColor);
	float alpha = gtk_color_component_get_alpha(colorComponent);
	auto &colorSpaceType = ::colorSpace(colorSpace);
	for (int i = 0; i < colorSpaceType.channelCount; i++) {
		gtk_table_attach(GTK_TABLE(table), gtk_label_aligned_new(_(colorSpaceType.channels[i].name), 0, 0, 0, 0), 0, 1, i, i + 1, GtkAttachOptions(GTK_FILL), GTK_FILL, 5, 5);
		args->value[i] = gtk_spin_button_new_with_range(colorSpaceType.channels[i].minValue, colorSpaceType.channels[i].maxValue, colorSpaceType.channels[i].step);
		gtk_entry_set_activates_default(GTK_ENTRY(args->value[i]), true);
		if (i < 4)
			gtk_spin_button_set_value(GTK_SPIN_BUTTON(args->value[i]), rawColor[i] * colorSpaceType.channels[i].rawScale);
		else
			gtk_spin_button_set_value(GTK_SPIN_BUTTON(args->value[i]), alpha * colorSpaceType.channels[i].rawScale);
		gtk_table_attach(GTK_TABLE(table), args->value[i], 1, 2, i, i + 1, GtkAttachOptions(GTK_FILL | GTK_EXPAND), GTK_FILL, 5, 0);
		if (i == channel)
			gtk_widget_grab_focus(args->value[i]);
	}
	setDialogContent(dialog, table);
	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
		for (int i = 0; i < colorSpaceType.channelCount; i++) {
			if (i < 4)
				rawColor[i] = static_cast<float>(gtk_spin_button_get_value(GTK_SPIN_BUTTON(args->value[i])) / colorSpaceType.channels[i].rawScale);
			else
				alpha = static_cast<float>(gtk_spin_button_get_value(GTK_SPIN_BUTTON(args->value[i])) / colorSpaceType.channels[i].rawScale);
		}
		gtk_color_component_set_raw_color(colorComponent, rawColor, alpha);
	}
	gint width, height;
	gtk_window_get_size(GTK_WINDOW(dialog), &width, &height);
	options->set("window.width", width);
	options->set("window.height", height);
	gtk_widget_destroy(dialog);
	delete args;
}


text:
if ! brew ls --versions zsh > /dev/null; then
  echo "Installing zsh.."
  brew install zsh
fi

if [[ -f "/usr/local/bin/zsh" ]]; then
  if [[ ! "$(cat /etc/shells|grep /usr/local/bin/zsh)" ]]; then
    echo Allowing non-standard zsh to be set as shell
    echo /usr/local/bin/zsh | sudo tee -a /etc/shells
  fi

  # Use homebrew version if it exists
  if [[ "$(default-user-shell)" != "/usr/local/bin/zsh" ]]; then
    echo "Setting default shell to zsh (homebrew) from '$(default-user-shell)'"
    chsh -s /usr/local/bin/zsh
  fi
else
  # Otherwise use system version
  if [[ "$(default-user-shell)" != "/bin/zsh" ]]; then
    echo "Setting default shell to zsh (system) from '$(default-user-shell)'"
    chsh -s /bin/zsh
  fi
fi

exit 0


text:
In the last two notebooks, we simulated data and calculated empirical power. Here, we'll compare the parametric power calculations, the empirical power values and the predicted power. This notebook will generate Figure S1.

```python
>>> import os
>>> import pickle
>>> import warnings
...
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import pandas as pd
>>> import seaborn as sn
...
>>> import machivellian.plot as plot
>>> import machivellian.summarize as summarize
...
>>> % matplotlib inline
>>> sn.set_style('ticks')
```

# 2. Parameters

We've performed 100 simulations, which are stored in the simulation directory.

```python
>>> num_rounds = 100
```

```python
>>> sim_location = './simulations'
>>> if not os.path.exists(sim_location):
...     raise ValueError('The power simulations do not exist.'
...                      'Please go back to notebooks 2 and 3 and'
...                      'calculate power.'
...                      )
>>> return_dir = os.path.join(sim_location, 'extrapolation')
>>> if not os.path.exists(return_dir):
...     os.makedirs(return_dir)
```

Power in previous notebooks was calculated with between 5 and no more htan 100 observations, with 10 observation steps.

```python
>>> counts = np.arange(5, 100, 10)
```

We'll use the spectral colormap, scaled by the count depth.

```python
>>> # colormap = 'Spectral'
...
... # colors = {count: list(sn.color_palette(colormap, n_colors=len(counts))[i])
... #           for (i, count) in enumerate(counts)}
... colors = {count: sn.color_palette()[0] for count in counts}
```

# 3. Loading Power Calculations

We'll compare the behavior of distribution-based power, emperical power and the power calculated from curve fitting on the parametric tests. We can compare the behavior of emperical power, and power fit to emperical values for all tests.

```python
>>> tests = ['ttest_1', 'ttest_ind', 'anova_3', 'anova_8', 'correlation']
```

Finally, we'll create a set of parameters for each of the distributions being evaluated. This includes the clean name, which provides a prettier title in plots, the number of groups in the tested (2 for everything except the ANOVAs), and the location of both the input emperical power calculations and output summary tables.

```python
>>> distributions = {'ttest_1': {'clean_name': 'One Sample\nT Test',
...                                'input_dir': './simulations/power/ttest_1/',
...                                'return_fp': './simulations/extrapolation/ttest_1.txt'
...                                },
...                  'ttest_ind': {'clean_name': 'Independent Sample\n T Test',
...                                'input_dir': './simulations/power/ttest_ind',
...                                'return_fp': './simulations/extrapolation/ttest_ind.txt'
...                                },
...                  'anova_3': {'clean_name': 'One way ANOVA\n(3 groups)',
...                              'input_dir': './simulations/power/anova_3',
...                              'return_fp': './simulations/extrapolation/anova_3.txt'
...                              },
...                  'anova_8': {'clean_name': 'One way ANOVA\n(8 groups)',
...                              'input_dir': './simulations/power/anova_8',
...                              'return_fp': './simulations/extrapolation/anova_8.txt'
...                              },
...                  'correlation': {'clean_name': 'Correlation',
...                                  'input_dir': './simulations/power/correlation',
...                                  'return_fp': './simulations/extrapolation/correlation.txt'
...                                  },
...                  }
```

We'll start by loading the poewr data for all the tests we've preformed.

```python
>>> all_powers = []
>>> titles = []
>>> for test_name in tests:
...     titles.append(distributions[test_name]['clean_name'])
...     power_dir = distributions[test_name]['input_dir']
...     return_fp = distributions[test_name]['return_fp']
...
...     if not os.path.exists(power_dir):
...         raise ValueError('%s does not exist' % power_dir)
...
...     summaries = []
...
...     for i in range(num_rounds):
...         # Loads through the power simulation for the round
...         power_fp = os.path.join(power_dir, 'simulation_%i.p' % i)
...
...         with open(power_fp, 'rb') as f_:
...             sim = pickle.load(f_)
...         summaries.append(
...             summarize.summarize_power(power_summary=sim,
...                                       sim_num=i,
...                                       test=test_name,
...                                       colors=colors)
...             )
...     summaries = pd.concat(summaries)
...     summaries.to_csv(return_fp, sep='\t')
...
...     all_powers.append(summaries)
>>> all_powers = pd.concat(all_powers)
>>> all_powers['sim_id'] = all_powers['test'] + '.' + all_powers['sim_num'].astype(str)
```

# 4. Power Calculation

We're going to plot a comparison between the emperical and traditional power calculations, to see if there's a strong relationship. We'll plot the distribution-based power on the x axis and the emperical power on the y axis.

```python
>>> te_fig = plot.summarize_regression(all_powers,
...                                    test_names=tests,
...                                    titles=titles,
...                                    x='traditional',
...                                    y='empirical',
...                                    gradient='colors',
...                                    alpha=0.1,
...                                    ylim=[-0.2, 0.2],
...                                    ylabel='Empirical'
...                                    )
>>> te_fig.axes[2].set_xlabel('Distribution Power')
>>> plot.add_labels(te_fig.axes)
...
>>> te_fig.set_size_inches([10, 3])
...
>>> te_fig.savefig('/Users/jdebelius/Desktop/empr_dist.pdf')
>>> te_fig.savefig('/Users/jdebelius/Desktop/empr_dist.png', dpi=300)
/Users/jdebelius/Repositories/monte_carlo_power/machivellian/plot.py:28: VisibleDeprecationWarning: using a boolean instead of an integer will result in an error in the future
  start_pos = np.arange(0, 26)[letters == start]
```

We see a high degree of correlation between the distribution-based power and the empirical power, although there is poor performance in the correlation with 5 observations per group.

Let's save the comparison dataframe, which we'll use to calculate the empirical power values in the [next notebook]().

```python
>>> all_powers.to_csv('./simulations/parametric_power_summary.txt',
...                   sep='\t')
```

We've demonstrated the ability of the empirical distribution to recapitulate the empirical distribution. Next, we'll loke at the the performance of the power prediction.


text:
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
  file \
  curl \
  ca-certificates \
  python2.7 \
  git \
  cmake \
  sudo \
  gdb \
  xz-utils \
  g++-mips64el-linux-gnuabi64 \
  libssl-dev \
  pkg-config

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV HOSTS=mips64el-unknown-linux-gnuabi64

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS


text: 4bitrun live version: http://kepppu.github.io/


text:
require 'test_helper'

class EmailNotifierWhitespaceTest < ActiveSupport::TestCase
  setup do
    @dummy_env_var = "KAKEEDKANSJHSJIWWKSKLALEJE"

    Time.stubs(:current).returns('Sat, 20 Apr 2013 20:58:55 UTC +00:00')
    @email_notifier = ExceptionNotifier.registered_exception_notifier(:email)
    @captured_env_vars = Hash[@email_notifier.mailer.whitelisted_env_vars.map do |k|
        k = k.to_s.sub(/^(\(.*:)(.*)(\))$/, '\2') if k.is_a? Regexp
        [k.to_s, "val #{k}"]
      end]

    begin
      1/0
    rescue => e
      @exception = e
      @mail1 = @email_notifier.create_email(@exception,
        :sections => %w(environment),
        :env => @captured_env_vars.dup)
      @mail2 = @email_notifier.create_email(@exception,
        :sections => %w(environment),
        :env => {@dummy_env_var => "woot"})
    end
  end

  test "should have the same whitelist at class and instance level" do
    #NB: Need to use #class_eval, as the underlying is dynamically extended
    assert @email_notifier.mailer.whitelisted_env_vars == @email_notifier.mailer.class_eval { self.whitelisted_env_vars }
  end

  test "should keep whitelisted env-vars" do
    @captured_env_vars.each do |k, v|
      assert @mail1.body =~ /\*\s*#{k}\s*:\s*#{v}$/, "Could not find #{k.inspect}: #{v.inspect} in the mail.body"
    end
  end

  test "should drop the non-whitelisted env-vars" do
    assert @mail1.body !~ /#{@dummy_env_var}:/
  end

  test "should update the class-level whitelisted env-vars" do
    # Make sure the dummy var-name isn't somehow in the whitelisted list, before we start:
    assert !@email_notifier.mailer.whitelisted_env_vars.include?(@dummy_env_var)
    assert !@email_notifier.mailer.class_eval { whitelisted_env_vars }.include?(@dummy_env_var)

    @email_notifier.mailer.whitelisted_env_vars << @dummy_env_var

    assert @email_notifier.mailer.whitelisted_env_vars.include?(@dummy_env_var)
    assert @email_notifier.mailer.class_eval { whitelisted_env_vars }.include?(@dummy_env_var)
  end
end


text:
host="127.0.0.1"
port=80
key="Rn1qOp0IQkxcT1FCDezaqxmpGmIUbw7bkpXeF31J"

echo "Create test_bucket"
swift -A http://$host:$port/auth -U testuser:swift -K $key post test_bucket

echo "List all buckets"
swift -A http://$host:$port/auth -U testuser:swift -K $key list

echo "Get status of test_bucket"
swift -A http://$host:$port/auth -U testuser:swift -K $key stat test_bucket

echo "Upload test_object"
swift -A http://$host:$port/auth -U testuser:swift -K $key upload test_bucket /etc/ceph/ceph.conf --object-name test_object

echo "List all objects of test_bucket"
swift -A http://$host:$port/auth -U testuser:swift -K $key list test_bucket

echo "Get status of test_object"
swift -A http://$host:$port/auth -U testuser:swift -K $key stat test_bucket test_object

echo "Download test_object"
swift -A http://$host:$port/auth -U testuser:swift -K $key download test_bucket test_object

echo "Delete test_object"
swift -A http://$host:$port/auth -U testuser:swift -K $key delete test_bucket test_object

echo "Delete test_bucket"
swift -A http://$host:$port/auth -U testuser:swift -K $key delete test_bucket


text:
require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({"./lang/id":[function(require,module,exports){
module.exports = {
  accepted: ':attribute harus disetujui.',
  after: ':attribute harus setelah :after.',
  after_or_equal: ':attribute harus sama dengan atau setelah :after_or_equal.',
  alpha: ':attribute hanya boleh berisi huruf.',
  alpha_dash: ':attribute hanya boleh berisi huruf, - atau _.',
  alpha_num: ':attribute hanya boleh berisi huruf dan angka.',
  before: ':attribute harus sebelum :before.',
  before_or_equal: ':attribute harus sama dengan atau sebelum :before_or_equal.',
  between: ':attribute harus berisi antara :min dan :max.',
  confirmed: ':attribute konfirmasi tidak sama.',
  email: ':attribute harus berupa email.',
  date: ':attribute format tanggal tidak benar.',
  def: ':attribute attribute has errors.',
  digits: ':attribute harus :digits digit.',
  digits_between: 'Isian :attribute harus antara angka :min dan :max.',
  different: ':attribute dan :different harus berbeda.',
  in: ':attribute tidak benar.',
  integer: ':attribute harus berupa angka.',
  hex: ':attribute harus berformat heksadesimal',
  min: {
    numeric: ':attribute minimal :min.',
    string: ':attribute minimal :min karakter.'
  },
  max: {
    numeric: ':attribute harus lebih kecil :max.',
    string: ':attribute maksimal :max karakter.'
  },
  not_in: ':attribute tidak benar.',
  numeric: ':attribute harus berupa angka.',
  present: ':attribute harus ada (tapi boleh kosong).',
  required: ':attribute tidak boleh kosong.',
  required_if: ':attribute harus di isi jika :other berisi :value.',
  required_unless: ':attribute harus di isi jika :other tidak berisi :value.',
  required_with: ':attribute harus di isi jika :field tidak kosong.',
  required_with_all: ':attribute harus di isi jika :fields tidak kosong.',
  required_without: ':attribute harus di isi jika :field kosong.',
  required_without_all: ':attribute harus di isi jika :fields kosong.',
  same: ':attribute dan :same harus sama.',
  size: {
    numeric: ':attribute harus berisi :size.',
    string: ':attribute harus berisi :size karakter.'
  },
  string: ':attribute harus berupa string.',
  url: ':attribute harus berupa format url.',
  regex: ':attribute format tidak benar.',
  attributes: {}
};

},{}]},{},[]);


text:
NS_ASSUME_NONNULL_BEGIN

@class NSManagedObjectContext;

@interface FEMManagedObjectStore : FEMObjectStore

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithContext:(NSManagedObjectContext *)context NS_DESIGNATED_INITIALIZER;
@property (nonatomic, strong, readonly) NSManagedObjectContext *context;

@property (nonatomic) BOOL saveContextOnCommit;

@end

NS_ASSUME_NONNULL_END


text: angular.module('app', ['main', 'api']);


text:
package de.fraunhofer.fokus.movepla.model;

import com.liferay.portal.model.ModelWrapper;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * This class is a wrapper for {@link LegalDetails}.
 * </p>
 *
 * @author    jpa
 * @see       LegalDetails
 * @generated
 */
public class LegalDetailsWrapper implements LegalDetails,
    ModelWrapper<LegalDetails> {
    private LegalDetails _legalDetails;

    public LegalDetailsWrapper(LegalDetails legalDetails) {
        _legalDetails = legalDetails;
    }

    public Class<?> getModelClass() {
        return LegalDetails.class;
    }

    public String getModelClassName() {
        return LegalDetails.class.getName();
    }

    public Map<String, Object> getModelAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();

        attributes.put("legalDetailsId", getLegalDetailsId());
        attributes.put("companyId", getCompanyId());
        attributes.put("userId", getUserId());
        attributes.put("createDate", getCreateDate());
        attributes.put("modifiedDate", getModifiedDate());
        attributes.put("name", getName());
        attributes.put("valueAddedTaxNo", getValueAddedTaxNo());
        attributes.put("registrationCourt", getRegistrationCourt());
        attributes.put("legalForm", getLegalForm());
        attributes.put("address", getAddress());
        attributes.put("telephone", getTelephone());
        attributes.put("email", getEmail());
        attributes.put("URL", getURL());
        attributes.put("fax", getFax());

        return attributes;
    }

    public void setModelAttributes(Map<String, Object> attributes) {
        Long legalDetailsId = (Long) attributes.get("legalDetailsId");

        if (legalDetailsId != null) {
            setLegalDetailsId(legalDetailsId);
        }

        Long companyId = (Long) attributes.get("companyId");

        if (companyId != null) {
            setCompanyId(companyId);
        }

        Long userId = (Long) attributes.get("userId");

        if (userId != null) {
            setUserId(userId);
        }

        Date createDate = (Date) attributes.get("createDate");

        if (createDate != null) {
            setCreateDate(createDate);
        }

        Date modifiedDate = (Date) attributes.get("modifiedDate");

        if (modifiedDate != null) {
            setModifiedDate(modifiedDate);
        }

        String name = (String) attributes.get("name");

        if (name != null) {
            setName(name);
        }

        String valueAddedTaxNo = (String) attributes.get("valueAddedTaxNo");

        if (valueAddedTaxNo != null) {
            setValueAddedTaxNo(valueAddedTaxNo);
        }

        String registrationCourt = (String) attributes.get("registrationCourt");

        if (registrationCourt != null) {
            setRegistrationCourt(registrationCourt);
        }

        String legalForm = (String) attributes.get("legalForm");

        if (legalForm != null) {
            setLegalForm(legalForm);
        }

        String address = (String) attributes.get("address");

        if (address != null) {
            setAddress(address);
        }

        String telephone = (String) attributes.get("telephone");

        if (telephone != null) {
            setTelephone(telephone);
        }

        String email = (String) attributes.get("email");

        if (email != null) {
            setEmail(email);
        }

        String URL = (String) attributes.get("URL");

        if (URL != null) {
            setURL(URL);
        }

        String fax = (String) attributes.get("fax");

        if (fax != null) {
            setFax(fax);
        }
    }

    /**
    * Returns the primary key of this legal details.
    *
    * @return the primary key of this legal details
    */
    public long getPrimaryKey() {
        return _legalDetails.getPrimaryKey();
    }

    /**
    * Sets the primary key of this legal details.
    *
    * @param primaryKey the primary key of this legal details
    */
    public void setPrimaryKey(long primaryKey) {
        _legalDetails.setPrimaryKey(primaryKey);
    }

    /**
    * Returns the legal details ID of this legal details.
    *
    * @return the legal details ID of this legal details
    */
    public long getLegalDetailsId() {
        return _legalDetails.getLegalDetailsId();
    }

    /**
    * Sets the legal details ID of this legal details.
    *
    * @param legalDetailsId the legal details ID of this legal details
    */
    public void setLegalDetailsId(long legalDetailsId) {
        _legalDetails.setLegalDetailsId(legalDetailsId);
    }

    /**
    * Returns the company ID of this legal details.
    *
    * @return the company ID of this legal details
    */
    public long getCompanyId() {
        return _legalDetails.getCompanyId();
    }

    /**
    * Sets the company ID of this legal details.
    *
    * @param companyId the company ID of this legal details
    */
    public void setCompanyId(long companyId) {
        _legalDetails.setCompanyId(companyId);
    }

    /**
    * Returns the user ID of this legal details.
    *
    * @return the user ID of this legal details
    */
    public long getUserId() {
        return _legalDetails.getUserId();
    }

    /**
    * Sets the user ID of this legal details.
    *
    * @param userId the user ID of this legal details
    */
    public void setUserId(long userId) {
        _legalDetails.setUserId(userId);
    }

    /**
    * Returns the user uuid of this legal details.
    *
    * @return the user uuid of this legal details
    * @throws SystemException if a system exception occurred
    */
    public java.lang.String getUserUuid()
        throws com.liferay.portal.kernel.exception.SystemException {
        return _legalDetails.getUserUuid();
    }

    /**
    * Sets the user uuid of this legal details.
    *
    * @param userUuid the user uuid of this legal details
    */
    public void setUserUuid(java.lang.String userUuid) {
        _legalDetails.setUserUuid(userUuid);
    }

    /**
    * Returns the create date of this legal details.
    *
    * @return the create date of this legal details
    */
    public java.util.Date getCreateDate() {
        return _legalDetails.getCreateDate();
    }

    /**
    * Sets the create date of this legal details.
    *
    * @param createDate the create date of this legal details
    */
    public void setCreateDate(java.util.Date createDate) {
        _legalDetails.setCreateDate(createDate);
    }

    /**
    * Returns the modified date of this legal details.
    *
    * @return the modified date of this legal details
    */
    public java.util.Date getModifiedDate() {
        return _legalDetails.getModifiedDate();
    }

    /**
    * Sets the modified date of this legal details.
    *
    * @param modifiedDate the modified date of this legal details
    */
    public void setModifiedDate(java.util.Date modifiedDate) {
        _legalDetails.setModifiedDate(modifiedDate);
    }

    /**
    * Returns the name of this legal details.
    *
    * @return the name of this legal details
    */
    public java.lang.String getName() {
        return _legalDetails.getName();
    }

    /**
    * Sets the name of this legal details.
    *
    * @param name the name of this legal details
    */
    public void setName(java.lang.String name) {
        _legalDetails.setName(name);
    }

    /**
    * Returns the value added tax no of this legal details.
    *
    * @return the value added tax no of this legal details
    */
    public java.lang.String getValueAddedTaxNo() {
        return _legalDetails.getValueAddedTaxNo();
    }

    /**
    * Sets the value added tax no of this legal details.
    *
    * @param valueAddedTaxNo the value added tax no of this legal details
    */
    public void setValueAddedTaxNo(java.lang.String valueAddedTaxNo) {
        _legalDetails.setValueAddedTaxNo(valueAddedTaxNo);
    }

    /**
    * Returns the registration court of this legal details.
    *
    * @return the registration court of this legal details
    */
    public java.lang.String getRegistrationCourt() {
        return _legalDetails.getRegistrationCourt();
    }

    /**
    * Sets the registration court of this legal details.
    *
    * @param registrationCourt the registration court of this legal details
    */
    public void setRegistrationCourt(java.lang.String registrationCourt) {
        _legalDetails.setRegistrationCourt(registrationCourt);
    }

    /**
    * Returns the legal form of this legal details.
    *
    * @return the legal form of this legal details
    */
    public java.lang.String getLegalForm() {
        return _legalDetails.getLegalForm();
    }

    /**
    * Sets the legal form of this legal details.
    *
    * @param legalForm the legal form of this legal details
    */
    public void setLegalForm(java.lang.String legalForm) {
        _legalDetails.setLegalForm(legalForm);
    }

    /**
    * Returns the address of this legal details.
    *
    * @return the address of this legal details
    */
    public java.lang.String getAddress() {
        return _legalDetails.getAddress();
    }

    /**
    * Sets the address of this legal details.
    *
    * @param address the address of this legal details
    */
    public void setAddress(java.lang.String address) {
        _legalDetails.setAddress(address);
    }

    /**
    * Returns the telephone of this legal details.
    *
    * @return the telephone of this legal details
    */
    public java.lang.String getTelephone() {
        return _legalDetails.getTelephone();
    }

    /**
    * Sets the telephone of this legal details.
    *
    * @param telephone the telephone of this legal details
    */
    public void setTelephone(java.lang.String telephone) {
        _legalDetails.setTelephone(telephone);
    }

    /**
    * Returns the email of this legal details.
    *
    * @return the email of this legal details
    */
    public java.lang.String getEmail() {
        return _legalDetails.getEmail();
    }

    /**
    * Sets the email of this legal details.
    *
    * @param email the email of this legal details
    */
    public void setEmail(java.lang.String email) {
        _legalDetails.setEmail(email);
    }

    /**
    * Returns the u r l of this legal details.
    *
    * @return the u r l of this legal details
    */
    public java.lang.String getURL() {
        return _legalDetails.getURL();
    }

    /**
    * Sets the u r l of this legal details.
    *
    * @param URL the u r l of this legal details
    */
    public void setURL(java.lang.String URL) {
        _legalDetails.setURL(URL);
    }

    /**
    * Returns the fax of this legal details.
    *
    * @return the fax of this legal details
    */
    public java.lang.String getFax() {
        return _legalDetails.getFax();
    }

    /**
    * Sets the fax of this legal details.
    *
    * @param fax the fax of this legal details
    */
    public void setFax(java.lang.String fax) {
        _legalDetails.setFax(fax);
    }

    public boolean isNew() {
        return _legalDetails.isNew();
    }

    public void setNew(boolean n) {
        _legalDetails.setNew(n);
    }

    public boolean isCachedModel() {
        return _legalDetails.isCachedModel();
    }

    public void setCachedModel(boolean cachedModel) {
        _legalDetails.setCachedModel(cachedModel);
    }

    public boolean isEscapedModel() {
        return _legalDetails.isEscapedModel();
    }

    public java.io.Serializable getPrimaryKeyObj() {
        return _legalDetails.getPrimaryKeyObj();
    }

    public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
        _legalDetails.setPrimaryKeyObj(primaryKeyObj);
    }

    public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
        return _legalDetails.getExpandoBridge();
    }

    public void setExpandoBridgeAttributes(
        com.liferay.portal.service.ServiceContext serviceContext) {
        _legalDetails.setExpandoBridgeAttributes(serviceContext);
    }

    @Override
    public java.lang.Object clone() {
        return new LegalDetailsWrapper((LegalDetails) _legalDetails.clone());
    }

    public int compareTo(LegalDetails legalDetails) {
        return _legalDetails.compareTo(legalDetails);
    }

    @Override
    public int hashCode() {
        return _legalDetails.hashCode();
    }

    public com.liferay.portal.model.CacheModel<LegalDetails> toCacheModel() {
        return _legalDetails.toCacheModel();
    }

    public LegalDetails toEscapedModel() {
        return new LegalDetailsWrapper(_legalDetails.toEscapedModel());
    }

    @Override
    public java.lang.String toString() {
        return _legalDetails.toString();
    }

    public java.lang.String toXmlString() {
        return _legalDetails.toXmlString();
    }

    public void persist()
        throws com.liferay.portal.kernel.exception.SystemException {
        _legalDetails.persist();
    }

    /**
     * @deprecated Renamed to {@link #getWrappedModel}
     */
    public LegalDetails getWrappedLegalDetails() {
        return _legalDetails;
    }

    public LegalDetails getWrappedModel() {
        return _legalDetails;
    }

    public void resetOriginalValues() {
        _legalDetails.resetOriginalValues();
    }
}


text:
var React = require('react');

var Ping = React.createClass({
  render: function () {
    return (

{this.props.params.message}

    );
  }
});

module.exports = Ping;


text:
package com.opengamma.livedata;

import org.fudgemsg.FudgeMsg;
import org.fudgemsg.MutableFudgeMsg;
import org.fudgemsg.mapping.FudgeBuilder;
import org.fudgemsg.mapping.FudgeBuilderFor;
import org.fudgemsg.mapping.FudgeDeserializer;
import org.fudgemsg.mapping.FudgeSerializer;

import com.opengamma.id.ExternalIdBundle;
import com.opengamma.id.ExternalIdBundleFudgeBuilder;

/**
 * Fudge message builder for {@code LiveDataSpecification}.
 */
@FudgeBuilderFor(LiveDataSpecification.class)
public class LiveDataSpecificationFudgeBuilder implements FudgeBuilder<LiveDataSpecification> {

  /** Field name. */
  public static final String NORMALIZATION_RULE_SET_ID_FIELD_NAME = "NormalizationRuleSetId";
  /** Field name. */
  public static final String DOMAIN_SPECIFIC_IDS_FIELD_NAME = "DomainSpecificIdentifiers";

  @Override
  public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final LiveDataSpecification object) {
    return LiveDataSpecificationFudgeBuilder.toFudgeMsg(serializer, object);
  }

  public static MutableFudgeMsg toFudgeMsg(final FudgeSerializer serializer, final LiveDataSpecification object) {
    final MutableFudgeMsg msg = serializer.newMessage();
    LiveDataSpecificationFudgeBuilder.toFudgeMsg(serializer, object, msg);
    return msg;
  }

  public static void toFudgeMsg(final FudgeSerializer serializer, final LiveDataSpecification object, final MutableFudgeMsg msg) {
    msg.add(NORMALIZATION_RULE_SET_ID_FIELD_NAME, object.getNormalizationRuleSetId());
    msg.add(DOMAIN_SPECIFIC_IDS_FIELD_NAME, ExternalIdBundleFudgeBuilder.toFudgeMsg(serializer, object.getIdentifiers()));
  }

  @Override
  public LiveDataSpecification buildObject(final FudgeDeserializer deserializer, final FudgeMsg msg) {
    return LiveDataSpecificationFudgeBuilder.fromFudgeMsg(deserializer, msg);
  }

  public static LiveDataSpecification fromFudgeMsg(final FudgeDeserializer deserializer, final FudgeMsg msg) {
    final String normalizationRuleSetId = msg.getString(NORMALIZATION_RULE_SET_ID_FIELD_NAME);
    final ExternalIdBundle ids = ExternalIdBundleFudgeBuilder.fromFudgeMsg(deserializer, msg.getMessage(DOMAIN_SPECIFIC_IDS_FIELD_NAME));
    return new LiveDataSpecification(normalizationRuleSetId, ids);
  }

}


text:
import { equal } from "./equality";
import { parseTerm } from "./parser";
import { cannonize } from "./cannonize";
import { LambdaExpression as Expr, Maybe } from "./types";

// TODO: do the inverse of these -- generation of church primitives
export function renderAsChurchNumeral(uncannonized: Expr): Maybe<number> {
  const expression = cannonize(uncannonized);
  if (expression.type !== "function") {
    return undefined;
  }
  const outerName = expression.argument;
  const inner = expression.body;
  if (inner.type !== "function") {
    return undefined;
  }
  const innerName = inner.argument;

  function countLevels(
    wrapperName: string,
    targetName: string,
    piece: Expr
  ): Maybe<number> {
    if (piece.type === "variable") {
      if (piece.name !== targetName) {
        return undefined;
      } else {
        return 0;
      }
    }
    if (piece.type === "application") {
      if (piece.left.type !== "variable" || piece.left.name !== wrapperName) {
        return undefined;
      } else {
        const nextLevel = countLevels(wrapperName, targetName, piece.right);
        if (nextLevel === undefined) {
          return undefined;
        } else {
          return nextLevel + 1;
        }
      }
    }
    return undefined;
  }

  return countLevels(outerName, innerName, inner.body);
}

const churchTrue = parseTerm("λab.a");
const churchFalse = parseTerm("λab.b");

export function renderAsChurchBoolean(expression: Expr): Maybe<boolean> {
  if (equal(expression, churchTrue)) {
    return true;
  }
  if (equal(expression, churchFalse)) {
    return false;
  }
  return undefined;
}


text:
namespace foo_mpdsrv
{
	RWLock::RWLock()
	{
		_lock.reset(new SRWLOCK);
		InitializeSRWLock(_lock.get());
	}
	RWLock::~RWLock()
	{
	}
	ReadLockHandle RWLock::LockRead()
	{
		return ReadLockHandle(_lock.get());
	}
	WriteLockHandle RWLock::LockWrite()
	{
		return WriteLockHandle(_lock.get());
	}
	ReadLockHandle::ReadLockHandle(PSRWLOCK lock) : _lock(lock)
	{
		AcquireSRWLockShared(_lock);
	}
	ReadLockHandle::ReadLockHandle(ReadLockHandle&& right)
	{
		_lock = right._lock;
		right._lock = NULL;
	}
	ReadLockHandle::~ReadLockHandle()
	{
		if(_lock != NULL)
			ReleaseSRWLockShared(_lock);
	}
	void ReadLockHandle::Unlock()
	{
		ReleaseSRWLockShared(_lock);
		_lock = NULL;
	}
	WriteLockHandle::WriteLockHandle(PSRWLOCK lock) : _lock(lock)
	{
		AcquireSRWLockExclusive(_lock);
	}
	WriteLockHandle::WriteLockHandle(WriteLockHandle&& right)
	{
		_lock = right._lock;
		right._lock = NULL;
	}
	WriteLockHandle::~WriteLockHandle()
	{
		if(_lock != NULL)
			ReleaseSRWLockExclusive(_lock);
	}
	void WriteLockHandle::Unlock()
	{
		ReleaseSRWLockExclusive(_lock);
		_lock = NULL;
	}
}


text:
using System;
using System.Threading.Tasks;

namespace BeeHive.DataStructures
{
    public interface ILockStore
    {
        Task<bool> TryLockAsync(LockToken token, int tries = 16, int retryTimeoutMilliseconds = 15000, int timeoutMilliseconds = 15000, int aquireTimeoutMilliseconds = 15000);

        Task ReleaseLockAsync(LockToken token);

    }
}


text:
chrome.storage.sync.get(['cityId', 'storeName'], function(vals) {
  findWines(vals['cityId'], vals['storeName']);
});

function findWines(cityId, storeName) {
  var links = document.querySelectorAll('.viini_wine .related a:first-child:not(.wineStatus)');
  if (links.length==0) {links=document.querySelectorAll('a.wineCode');}
    for (var i=0;i<links.length;i++) {
      var link = links[i];
      link.className += ' wineCode';
      var text = link.innerText;
      var code = text.substr(0,text.indexOf(','));
      var elId = 'viini_' + code;
      var el = document.getElementById(elId);
      if (!el) {
        el = document.createElement('a');
        el.className = 'wineStatus';
        el.id = 'viini_' + code;
        el.style.lineHeight = '200%';
        link.parentElement.insertBefore(el, link);
      }
    el.innerText = 'Saatavuutta haetaan';
    fetchAvailability(code);
  };

  function findStoreData(data) {
   for (var i=0; i<data.length; i++) {
    if (data[i].StoreName == storeName) { return data[i]; }
   }
  }

  function fetchAvailability(code) {
    var xmlHttp = new XMLHttpRequest();
    var url = 'http://www.alko.fi/api/product/Availability?productId=' + code + '&cityId=' + cityId + '&language=fi';
    xmlHttp.onload = function() {
      var link = document.getElementById('viini_' + code);
      var storeData = findStoreData(JSON.parse(this.responseText));
      var bottleCount = 0;
      if (storeData && storeData.StoreName == storeName) {
        bottleCount = storeData.Amount;
        link.innerText = storeName + ': ' + bottleCount + ' kpl.';
      }
      else {
        link.innerText = 'Jokin män pielee.';
      }
    };
    xmlHttp.open('GET', url);
    xmlHttp.send(null);
  }
}


text:
<?php

namespace Prezent\Soap\Client\Event;

use Symfony\Contracts\EventDispatcher\Event;

/**
 * CallEvent
 *
 * @see Event
 * @author Sander Marechal
 */
class CallEvent extends Event
{
    /**
     * @var string
     */
    private $method;

    /**
     * @var mixed
     */
    private $arguments;

    /**
     * Constructor
     *
     * @param string $method
     * @param mixed $arguments
     */
    public function __construct($method, $arguments)
    {
        $this->method = $method;
        $this->arguments = $arguments;
    }

    /**
     * Get method
     *
     * @return string
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * Set method
     *
     * @param string $method
     * @return self
     */
    public function setMethod($method)
    {
        $this->method = $method;
        return $this;
    }

    /**
     * Get arguments
     *
     * @return mixed
     */
    public function getArguments()
    {
        return $this->arguments;
    }

    /**
     * Set arguments
     *
     * @param mixed $arguments
     * @return self
     */
    public function setArguments($arguments)
    {
        $this->arguments = $arguments;
        return $this;
    }
}


text:
package com.mgmtp.jfunk.integrationtest.topmostelementcheck.step;

import org.openqa.selenium.By;

/**
 * @author sstrohmaier
 */
public class TopmostElementCheckDragAndDropActionStep extends AbstractTopmostElementCheckStep {

	public TopmostElementCheckDragAndDropActionStep(boolean expectedValueForFlagTopmostElementCheck) {
		super(expectedValueForFlagTopmostElementCheck);
	}

	@Override
	protected void executeInnerSteps() {

		String topMostSource = "draggable1";
		String topMostTarget = "droppable1";
		String coveredSource = "draggable2";
		String coveredTarget = "droppable2";

		verifyIsTopmostElement(topMostSource, true);
		verifyIsTopmostElement(topMostTarget, true);
		verifyIsTopmostElement(coveredSource, false);
		verifyIsTopmostElement(coveredTarget, false);

		wdt.assertTopmostElement(By.id(topMostSource));
		wdt.assertTopmostElement(By.id(topMostTarget));
		assertNotTopMostElement(coveredSource);
		assertNotTopMostElement(coveredTarget);

		checkWdtActionOnTopmostAndCoveredElement(WdtAction.dragAndDrop, topMostSource, topMostTarget, coveredSource, coveredTarget,  null);

	}

}


text:
using UnrealBuildTool;

public class SmartSnapping : ModuleRules
{
	public SmartSnapping(TargetInfo Target)
	{
		PrivateDependencyModuleNames.AddRange(
			new string[] {
				"Core",
				"CoreUObject",
				"Engine",
				"UnrealEd",
				"Slate",
				"LevelEditor",
				"ViewportSnapping"
			});
	}
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = getISODay;

var _index = _interopRequireDefault(require("../toDate/index.js"));

var _index2 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * @name getISODay
 * @category Weekday Helpers
 * @summary Get the day of the ISO week of the given date.
 *
 * @description
 * Get the day of the ISO week of the given date,
 * which is 7 for Sunday, 1 for Monday etc.
 *
 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
 *
 * ### v2.0.0 breaking changes:
 *
 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
 *
 * @param {Date|Number} date - the given date
 * @returns {Number} the day of ISO week
 * @throws {TypeError} 1 argument required
 *
 * @example
 * // Which day of the ISO week is 26 February 2012?
 * const result = getISODay(new Date(2012, 1, 26))
 * //=> 7
 */
function getISODay(dirtyDate) {
  (0, _index2.default)(1, arguments);
  var date = (0, _index.default)(dirtyDate);
  var day = date.getDay();

  if (day === 0) {
    day = 7;
  }

  return day;
}

module.exports = exports.default;


text:
            {% if page.logo %}

            {% endif %}
        Subscribe

                   {{ site.name }} {% if page.title and page.url != "/index.html"%}{% endif %}

                Hello! I'm a design enthusiast living in Singapore.
                {% if site.project%} Explore some of the works I've done and {% endif %}
                {% if site.about %} do get in touch ! {% endif %}

    Scroll Down


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project

     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.
-->

<resources>
    <dimen name="icon_size">40dp</dimen>
    <dimen name="root_icon_size">24dp</dimen>

    <dimen name="grid_width">152dp</dimen>
    <dimen name="grid_height">176dp</dimen>

    <dimen name="grid_item_width">152dp</dimen>
    <dimen name="grid_item_height">176dp</dimen>
    <dimen name="grid_item_padding">4dp</dimen>

    <dimen name="grid_padding_horiz">4dp</dimen>
    <dimen name="grid_padding_vert">4dp</dimen>

    <dimen name="list_item_height">72dp</dimen>
    <dimen name="list_item_padding">16dp</dimen>

    <dimen name="list_divider_inset">72dp</dimen>
    <bool name="list_divider_inset_left">true</bool>

    <bool name="show_as_dialog">false</bool>
    <bool name="always_show_summary">false</bool>

    <dimen name="dir_elevation">8dp</dimen>

</resources>


text:
package ninja.metrics.graphite;

import java.net.InetSocketAddress;
import java.util.concurrent.TimeUnit;

import ninja.lifecycle.Dispose;
import ninja.lifecycle.Start;
import ninja.metrics.MetricsService;
import ninja.utils.NinjaProperties;
import ninja.utils.TimeUtil;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.graphite.Graphite;
import com.codahale.metrics.graphite.GraphiteReporter;
import com.codahale.metrics.graphite.GraphiteSender;
import com.codahale.metrics.graphite.PickledGraphite;
import com.google.inject.Inject;
import com.google.inject.Singleton;

/**
 * Integration of Ninja Metrics with Graphite.
 *
 * @author James Moger
 */
@Singleton
public class NinjaGraphite {

    private final Logger log = LoggerFactory.getLogger(NinjaGraphite.class);

    private final NinjaProperties ninjaProperties;

    private final MetricsService metricsService;

    private GraphiteReporter reporter;

    @Inject
    public NinjaGraphite(NinjaProperties ninjaProperties,
                         MetricsService metricsService) {
        this.ninjaProperties = ninjaProperties;
        this.metricsService = metricsService;
    }

    @Start(order = 90)
    public void start() {

        if (ninjaProperties.getBooleanWithDefault("metrics.graphite.enabled",
                false)) {

            final String customPrefix = ninjaProperties.get("metrics.graphite.prefix");
            final String hostname = metricsService.getHostname();
            final String prefix = StringUtils.isNotBlank(customPrefix) ? customPrefix : hostname;

            final String address = ninjaProperties
                    .getOrDie("metrics.graphite.address");
            final int port = ninjaProperties.getIntegerWithDefault(
                    "metrics.graphite.port", 2003);
            final boolean isPickled = ninjaProperties.getBooleanWithDefault(
                    "metrics.graphite.pickled", false);
            final String period = ninjaProperties.getWithDefault(
                    "metrics.graphite.period", "60s");
            final int delay = TimeUtil.parseDuration(period);
            final InetSocketAddress graphiteAddress = new InetSocketAddress(
                    address, port);

            final GraphiteSender sender;
            if (isPickled) {
                sender = new PickledGraphite(graphiteAddress);
            } else {
                sender = new Graphite(graphiteAddress);
            }

            reporter = GraphiteReporter
                    .forRegistry(metricsService.getMetricRegistry())
                    .prefixedWith(prefix).convertRatesTo(TimeUnit.SECONDS)
                    .convertDurationsTo(TimeUnit.MILLISECONDS)
                    .filter(MetricFilter.ALL).build(sender);

            reporter.start(delay, TimeUnit.SECONDS);

            log.info(
                    "Started Graphite Metrics reporter for '{}', updating every {}",
                    prefix, period);

        }
    }

    @Dispose(order = 10)
    public void stop() {

        if (reporter != null) {

            reporter.stop();

            log.debug("Stopped Graphite Metrics reporter");
        }

    }
}