text:
package io.cdap.plugin.successfactors.source.metadata;

import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.List;

public class SuccessFactorsColumnMetaDataTest {
  @Rule
  public ExpectedException exceptionRule = ExpectedException.none();

  private static final String FIELD_NAME = "fieldName";

  private SuccessFactorsColumnMetadata successFactorsColumnMetadata;

  private enum SapSuccessFactorsColMetadata {
    BYTE(FIELD_NAME, "Byte", false, null, 2, Boolean.TRUE,
         Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, "displayFormat", "filterRestrictions",
         "collation", "concurrencyModeName", "defaultValue", "kindName",
         "label"),
    INT16(FIELD_NAME, "Int16", false, null, 2, Boolean.TRUE,
          Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, "displayFormat", "filterRestrictions",
          "collation", "concurrencyModeName", "defaultValue", "kindName",
          "label"),
    DECIMAL(FIELD_NAME, "Decimal", false, null, 2, Boolean.TRUE,
            Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, "displayFormat", "filterRestrictions",
            "collation", "concurrencyModeName", "defaultValue", "kindName",
            "label"),
    GUID(FIELD_NAME, "Guid", false, null, 2, Boolean.TRUE,
         Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, "displayFormat", "filterRestrictions",
         "collation", "concurrencyModeName", "defaultValue", "kindName",
         "label"),
    STRING(FIELD_NAME, "String", false, null, 2, Boolean.TRUE,
           Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, "displayFormat", "filterRestrictions",
           "collation", "concurrencyModeName", "defaultValue", "kindName",
           "label"),
    DATETIME(FIELD_NAME, "DateTime", false, null, 2, Boolean.TRUE,
             Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, "displayFormat", "filterRestrictions",
             "collation", "concurrencyModeName", "defaultValue", "kindName",
             "label");

    private final String name;
    private final String type;
    private final boolean isNullable;
    private final Integer maxLength;
    private final Boolean isVisible;
    private final Boolean isFixedLength;
    private final Boolean isUnicode;
    private final Boolean getRequiredInFilter;
    private final String displayFormat;
    private final String filterRestrictions;
    private final String collation;
    private final String concurrencyModeName;
    private final String kindName;
    private final String label;
    private final String defaultValue;
    private List<SuccessFactorsColumnMetadata> childList;

    SapSuccessFactorsColMetadata(String name, String type, boolean isNullable,
                                 List<SuccessFactorsColumnMetadata> childList, Integer maxLength, Boolean isVisible,
                                 Boolean isFixedLength, Boolean isUnicode, Boolean getRequiredInFilter,
                                 String displayFormat, String filterRestrictions, String collation,
                                 String concurrencyModeName, String label, String kindName, String defaultValue) {
      this.name = name;
      this.type = type;
      this.isNullable = isNullable;
      this.maxLength = maxLength;
      this.isVisible = isVisible;
      this.isUnicode = isUnicode;
      this.isFixedLength = isFixedLength;
      this.getRequiredInFilter = getRequiredInFilter;
      this.filterRestrictions = filterRestrictions;
      this.collation = collation;
      this.displayFormat = displayFormat;
      this.concurrencyModeName = concurrencyModeName;
      this.kindName = kindName;
      this.defaultValue = defaultValue;
      this.label = label;

    }

    public String getName() {
      return name;
    }

    public String getType() {
      return type;
    }

    public boolean isNullable() {
      return isNullable;
    }

    public boolean isVisible() {
      return isVisible;
    }

    public Integer getMaxLength() {
      return maxLength;
    }

    public boolean isFixedLength() {
      return isFixedLength;
    }

    public boolean isUnicode() {
      return isUnicode;
    }

    public boolean getRequiredInFilter() {
      return getRequiredInFilter;
    }

    public String getCollation() {
      return collation;
    }

    public String getConcurrencyModeName() {
      return concurrencyModeName;
    }

    public String getDisplayFormat() {
      return displayFormat;
    }

    public String getFilterRestrictions() {
      return filterRestrictions;
    }

    public String getKindName() {
      return kindName;
    }

    public String getDefaultValue() {
      return defaultValue;
    }

    public String getLabel() {
      return label;
    }
  }

  @Test
  public void checkBuildForDefaultInitialization() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder().build();

    Assert.assertTrue(successFactorsColumnMetadata.isNullable());
    Assert.assertFalse(successFactorsColumnMetadata.containsChild());
  }

  @Test
  public void checkBasicInitialization() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.STRING.getName())
      .type(SapSuccessFactorsColMetadata.STRING.getType())
      .isNullable(SapSuccessFactorsColMetadata.STRING.isNullable())
      .isVisible(SapSuccessFactorsColMetadata.STRING.isVisible)
      .maxLength(SapSuccessFactorsColMetadata.STRING.getMaxLength())
      .build();

    Assert.assertEquals(SapSuccessFactorsColMetadata.STRING.getName(), successFactorsColumnMetadata.getName());
    Assert.assertEquals(SapSuccessFactorsColMetadata.STRING.getType(), successFactorsColumnMetadata.getType());
    Assert.assertEquals(SapSuccessFactorsColMetadata.STRING.getMaxLength(),
                        successFactorsColumnMetadata.getMaxLength());
    Assert.assertTrue(successFactorsColumnMetadata.isVisible());
    Assert.assertFalse(successFactorsColumnMetadata.isNullable());
    Assert.assertFalse(successFactorsColumnMetadata.containsChild());
  }

  @Test
  public void checkBasicInitialization2() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .isUnicode(SapSuccessFactorsColMetadata.DECIMAL.isUnicode())
      .isFixedLength(SapSuccessFactorsColMetadata.DECIMAL.isFixedLength())
      .requiredInFilter(SapSuccessFactorsColMetadata.DECIMAL.getRequiredInFilter())
      .build();
    Assert.assertFalse(successFactorsColumnMetadata.isUnicode());
    Assert.assertTrue(successFactorsColumnMetadata.isFixedLength());
    Assert.assertTrue(successFactorsColumnMetadata.getRequiredInFilter());

  }

  @Test
  public void checkSapAttributesInitialization() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .collation(SapSuccessFactorsColMetadata.BYTE.getCollation())
      .concurrencyModeName(SapSuccessFactorsColMetadata.BYTE.getConcurrencyModeName())
      .filterRestrictions(SapSuccessFactorsColMetadata.BYTE.getFilterRestrictions())
      .displayFormat(SapSuccessFactorsColMetadata.BYTE.getDisplayFormat())
      .kindName(SapSuccessFactorsColMetadata.BYTE.getKindName())
      .defaultValue(SapSuccessFactorsColMetadata.BYTE.getDefaultValue())
      .label(SapSuccessFactorsColMetadata.BYTE.getLabel())
      .build();

    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getFilterRestrictions(),
                        successFactorsColumnMetadata.getFilterRestrictions());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getCollation(), successFactorsColumnMetadata.getCollation());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getConcurrencyModeName(),
                        successFactorsColumnMetadata.getConcurrencyModeName());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getDisplayFormat(),
                        successFactorsColumnMetadata.getDisplayFormat());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getLabel(),
                        successFactorsColumnMetadata.getLabel());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getDefaultValue(),
                        successFactorsColumnMetadata.getDefaultValue());
    Assert.assertEquals(SapSuccessFactorsColMetadata.BYTE.getKindName(),
                        successFactorsColumnMetadata.getKindName());
  }

  @Test
  public void checkBuildForChildInitialization() {
    SuccessFactorsColumnMetadata child1 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.GUID.getName())
      .type(SapSuccessFactorsColMetadata.GUID.getType())
      .build();

    SuccessFactorsColumnMetadata child2 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.DATETIME.getName())
      .type(SapSuccessFactorsColMetadata.DATETIME.getType())
      .build();

    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.STRING.getName())
      .type(SapSuccessFactorsColMetadata.STRING.getType())
      .childList(Arrays.asList(child1, child2))
      .build();

    Assert.assertTrue(successFactorsColumnMetadata.isNullable());
    Assert.assertTrue(successFactorsColumnMetadata.containsChild());

    Assert.assertEquals(2, successFactorsColumnMetadata.getChildList().size());
  }

  @Test
  public void checkAppendChildren() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.INT16.getName())
      .type(SapSuccessFactorsColMetadata.INT16.getType())
      .build();

    SuccessFactorsColumnMetadata child1 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.BYTE.getName())
      .type(SapSuccessFactorsColMetadata.BYTE.getType())
      .build();

    successFactorsColumnMetadata.appendChild(child1);

    Assert.assertTrue(successFactorsColumnMetadata.containsChild());

    Assert.assertEquals(1, successFactorsColumnMetadata.getChildList().size());
  }

  @Test
  public void checkAppendChildrenAfterFinalize() {
    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.INT16.getName())
      .type(SapSuccessFactorsColMetadata.INT16.getType())
      .build();

    successFactorsColumnMetadata.finalizeChildren();

    SuccessFactorsColumnMetadata child1 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.BYTE.getName())
      .type(SapSuccessFactorsColMetadata.BYTE.getType())
      .build();

    exceptionRule.expect(IllegalStateException.class);
    exceptionRule.expectMessage("No more children can be added for the current object, check if the " +
                                  "'finalizeChildren' is called before adding the children.");

    successFactorsColumnMetadata.appendChild(child1);
  }

  @Test
  public void checkAppendingNestedChildrenAfterParentFinalize() {
    SuccessFactorsColumnMetadata child1 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.GUID.getName())
      .type(SapSuccessFactorsColMetadata.GUID.getType())
      .build();

    SuccessFactorsColumnMetadata child2 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.DATETIME.getName())
      .type(SapSuccessFactorsColMetadata.DATETIME.getType())
      .build();

    successFactorsColumnMetadata = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.STRING.getName())
      .type(SapSuccessFactorsColMetadata.STRING.getType())
      .childList(Arrays.asList(child1, child2))
      .build();

    SuccessFactorsColumnMetadata child3 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.DATETIME.getName())
      .type(SapSuccessFactorsColMetadata.DATETIME.getType())
      .build();

    successFactorsColumnMetadata.getChildList().get(1).appendChild(child3);

    Assert.assertTrue(successFactorsColumnMetadata.containsChild());

    Assert.assertEquals(1, successFactorsColumnMetadata.getChildList().get(1).getChildList().size());

    successFactorsColumnMetadata.finalizeChildren();

    exceptionRule.expect(IllegalStateException.class);
    exceptionRule.expectMessage("No more children can be added for the current object, check if the " +
                                  "'finalizeChildren' is called before adding the children.");

    SuccessFactorsColumnMetadata child4 = SuccessFactorsColumnMetadata.builder()
      .name(SapSuccessFactorsColMetadata.DATETIME.getName())
      .type(SapSuccessFactorsColMetadata.DATETIME.getType())
      .build();

    // must throw IllegalStateException as finalizeChildren is already called
    successFactorsColumnMetadata.getChildList().get(1).appendChild(child4);
  }
}


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [puppeteer](./puppeteer.md) > [ChromeArgOptions](./puppeteer.chromeargoptions.md)

## ChromeArgOptions interface

Launcher options that only apply to Chrome.

<b>Signature:</b>

```typescript
export interface ChromeArgOptions
```

## Properties

|  Property | Type | Description |
|  --- | --- | --- |
|  [args](./puppeteer.chromeargoptions.args.md) | string\[\] |  |
|  [devtools](./puppeteer.chromeargoptions.devtools.md) | boolean |  |
|  [headless](./puppeteer.chromeargoptions.headless.md) | boolean |  |
|  [userDataDir](./puppeteer.chromeargoptions.userdatadir.md) | string |  |

redpajama_set_name: RedPajamaGithub


text:
module.exports = function (grunt, options) {

    var tasks = ['node_version', 'jshint', 'env', 'instrument', 'connect', 'mocha', 'makeReport', 'concat', 'concat_in_order', 'uglify'];
    return {
        'tasks': ['availabletasks'],
        'default': tasks,
        'test': [
            'node_version',
            'env',
            'instrument',
            'connect',
            'mocha'
        ]
    };
};


text:
import datetime, time, sys, os, arcpy

scriptPath = sys.path[0]

# local folder where wanting to download data
downloadfolder = sys.path[0] + ("\\Data\\")

if not os.path.exists(downloadfolder):
    os.makedirs(downloadfolder)

##Base Urls where data resides
baseurl = "http://coastwatch.pfeg.noaa.gov/erddap/files/"

sstmid = "erdMWsstd1day/"
chlmid = "erdMWchla1day/"

producturlChl = "_chla.nc"
producturlSST = "_sstd.nc"

#Calculate local time of yesterday - depending on where you are, the data may not yet be available for the current day
yesterdaytime = str(datetime.datetime.now()- datetime.timedelta(2))
print (yesterdaytime)

#Today's date
#todaytime = str(datetime.datetime.now())
#print (todaytime)

formattime = time.strftime('%Y%j',time.strptime(yesterdaytime,"%Y-%m-%d %H:%M:%S.%f"))
print (formattime)

##format string request
downloadlocationChl = str(os.path.join(downloadfolder) + "MW" + formattime + "_" + formattime + producturlChl)
downloadlocationSST = str(os.path.join(downloadfolder) + "MW" + formattime + "_" + formattime + producturlSST)

print ("Chlorophyll Location " + downloadlocationChl)
print ("SST Location " + downloadlocationSST)

#Format string request for Cholorphyll
dlMODISdataChl = str(baseurl + chlmid + "MW" + formattime + "_" + formattime +  producturlChl)
print ("Downloading Chl " + dlMODISdataChl)

#Format string request for Sea Surface Temperature
dlMODISdataSST= str(baseurl + sstmid + "MW" + formattime + "_" + formattime + producturlSST)

print ("Downloading SST " + dlMODISdataSST)

if sys.version_info[0]== 3:
    import urllib.request
#    from .DOYtoTime import getdate
    #What Python
    sysver = sys.version
    print (sysver)
    urllib.request.urlretrieve(dlMODISdataChl, downloadlocationChl)
    urllib.request.urlretrieve(dlMODISdataSST, downloadlocationSST)

    print ("Downloaded MODIS Data")

else:
    if sys.version_info[0]== 2:
        import urllib
#        from DOYtoTime import getdate
        sysver = sys.version
        print (sysver)
        urllib.urlretrieve(dlMODISdataChl, downloadlocationChl)
        urllib.urlretrieve(dlMODISdataSST, downloadlocationSST)

        print ("Downloaded MODIS Data")

#Output of the folder where the date would be downloaded
arcpy.SetParameter(0,downloadfolder)

#add rasters to Mosaic Dataset
MosaicDataset = "\FishSuitability.gdb\MODIS"
RasterType = "NetCDF"

#input the rest of the parameters here

arcpy.AddRastersToMosaicDataset_management(MosaicDataset,"netcdf",)

#
quit()


text:
<template name="profileSmall">

					{{#if customImageUrl}}

					{{else}}
						{{> avatar userId=userId size="medium" class="center-block"}}
					{{/if}}

{{displayName}}

					{{#if availableForHire}}
						 Hire Me
					{{/if}}
					{{#if $eq type 'Company'}}
						 Company
					{{/if}}

					{{title}}

					{{#if location}}
						 {{location}}
					{{/if}}

</template>


text:
package scutil.geom

object IntRect {
	val zero	= new IntRect(IntSpan.zero, IntSpan.zero)

	def zeroSized(size:IntPoint):IntRect	=
		new IntRect(
			horizontal	= IntSpan.startSize(0, size.x),
			vertical	= IntSpan.startSize(0, size.y)
		)

	def leftTopRightBottom(left:Int, top:Int, right:Int, bottom:Int):IntRect	=
		new IntRect(
			horizontal	= IntSpan.startEnd(left, right),
			vertical	= IntSpan.startEnd(top, bottom)
		)

	def leftTopWidthHeight(left:Int, top:Int, width:Int, height:Int):IntRect	=
		new IntRect(
			horizontal	= IntSpan.startSize(left, width),
			vertical	= IntSpan.startSize(top, height)
		)

	def topLeftToBottomRight(topLeft:IntPoint, bottomRight:IntPoint):IntRect	=
		new IntRect(
			horizontal	= IntSpan.startEnd(topLeft.x, bottomRight.x),
			vertical	= IntSpan.startEnd(topLeft.y, bottomRight.y)
		)

	def topLeftWithSize(topLeft:IntPoint, size:IntPoint):IntRect	=
		new IntRect(
			horizontal	= IntSpan.startSize(topLeft.x, size.x),
			vertical	= IntSpan.startSize(topLeft.y, size.y)
		)

	def horizontalWithVertical(horizontal:IntSpan, vertical:IntSpan):IntRect	=
		new IntRect(horizontal, vertical)
}

final class IntRect private (val horizontal:IntSpan, val vertical:IntSpan) {
	def left:Int	= horizontal.start
	def right:Int	= horizontal.end
	def top:Int		= vertical.start
	def bottom:Int	= vertical.end
	def width:Int	= horizontal.size
	def height:Int	= vertical.size

	def size:IntPoint	= IntPoint(horizontal.size,	vertical.size)

	def topLeft:IntPoint		= IntPoint(left, 	top)
	def topRight:IntPoint		= IntPoint(right,	top )
	def bottomLeft:IntPoint		= IntPoint(left,	bottom)
	def bottomRight:IntPoint	= IntPoint(right,	bottom)

	def contains(pt:IntPoint):Boolean	=
		(horizontal	contains pt.x) &&
		(vertical	contains pt.y)

	def swap:IntRect			= new IntRect(vertical, horizontal)
	def negate:IntRect			= new IntRect(horizontal.negate,	vertical.negate)
	def normalize:IntRect		= new IntRect(horizontal.normalize,	vertical.normalize)

	def move(d:IntPoint):IntRect	= new IntRect(horizontal move		d.x,	vertical move		d.y)
	def unmove(d:IntPoint):IntRect	= new IntRect(horizontal unmove		d.x,	vertical unmove		d.y)

	def scale(f:IntPoint):IntRect	= new IntRect(horizontal scale		f.x,	vertical scale		f.y)
	def unscale(f:IntPoint):IntRect	= new IntRect(horizontal unscale	f.x,	vertical unscale	f.y)

	def union(that:IntRect):IntRect	=
		new  IntRect(
			this.horizontal union that.horizontal,
			this.vertical	union that.vertical
		)

	def intersect(that:IntRect):Option[IntRect]	=
		(this.horizontal intersect that.horizontal, this.vertical intersect that.vertical) match {
			case (Some(horizontal), Some(vertical))	=> Some(new  IntRect(horizontal, vertical))
			case _									=> None
		}

	def toDoubleRect:DoubleRect	= DoubleRect.horizontalWithVertical(horizontal.toDoubleSpan, vertical.toDoubleSpan)

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

	override def equals(that:Any):Boolean	=
		that match {
			case that:IntRect	=> this.horizontal == that.horizontal && this.vertical == that.vertical
			case _				=> false
		}

	override def hashCode():Int		= this.horizontal.hashCode ^ this.vertical.hashCode

	override def toString:String	= s"IntRect(left=${left.toString}, top=${top.toString}, right=${right.toString}, bottom=${bottom.toString}, width=${width.toString}, height=${height.toString})"
}


text:
package org.apache.sentry.service.thrift;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * SentryClientInvocationHandler is the base interface for all the InvocationHandler in SENTRY
 */
public abstract class SentryClientInvocationHandler implements InvocationHandler {

  /**
   * Close the InvocationHandler: An InvocationHandler may create some contexts,
   * these contexts should be close when the method "close()" of client be called.
   */
  @Override
  public final Object invoke(Object proxy, Method method, Object[] args) throws Exception {
    // close() doesn't throw exception we supress that in case of connection
    // loss. Changing SentryPolicyServiceClient#close() to throw an
    // exception would be a backward incompatible change for Sentry clients.
    if ("close".equals(method.getName()) && null == args) {
      close();
      return null;
    }
    return invokeImpl(proxy, method, args);
  }

  /**
   * Subclass should implement this method for special function
   */
  public abstract Object invokeImpl(Object proxy, Method method, Object[] args) throws Exception;

  /**
   * An abstract method "close", an invocationHandler should close its contexts at here.
   */
  public abstract void close();

}


text:
/*
 * Abstract:
 * 	Declaration of osm_mcm_info_t.
 *	This object represents a Multicast Forwarding Information object.
 *	This object is part of the OpenSM family of objects.
 */

#ifndef _OSM_MCM_INFO_H_
#define _OSM_MCM_INFO_H_

#include <string.h>
#include <iba/ib_types.h>
#include <complib/cl_qlist.h>
#include <opensm/osm_base.h>

#ifdef __cplusplus
#  define BEGIN_C_DECLS extern "C" {
#  define END_C_DECLS   }
#else				/* !__cplusplus */
#  define BEGIN_C_DECLS
#  define END_C_DECLS
#endif				/* __cplusplus */

BEGIN_C_DECLS
/****s* OpenSM: Multicast Member Info/osm_mcm_info_t
* NAME
*	osm_mcm_info_t
*
* DESCRIPTION
*	Multicast Membership Info object.
*	This object contains information about a node's membership
*	in a particular multicast group.
*
*	This object should be treated as opaque and should
*	be manipulated only through the provided functions.
*
* SYNOPSIS
*/
typedef struct osm_mcm_info {
	cl_list_item_t list_item;
	ib_net16_t mlid;
} osm_mcm_info_t;
/*
* FIELDS
*	list_item
*		Linkage structure for cl_qlist.  MUST BE FIRST MEMBER!
*
*	mlid
*		MLID of this multicast group.
*
* SEE ALSO
*********/

/****f* OpenSM: Multicast Member Info/osm_mcm_info_new
* NAME
*	osm_mcm_info_new
*
* DESCRIPTION
*	Returns an initialized a Multicast Member Info object for use.
*
* SYNOPSIS
*/
osm_mcm_info_t *osm_mcm_info_new(IN const ib_net16_t mlid);
/*
* PARAMETERS
*	mlid
*		[in] MLID value for this multicast group.
*
* RETURN VALUES
*	Pointer to an initialized tree node.
*
* NOTES
*
* SEE ALSO
*********/

/****f* OpenSM: Multicast Member Info/osm_mcm_info_delete
* NAME
*	osm_mcm_info_delete
*
* DESCRIPTION
*	Destroys and deallocates the specified object.
*
* SYNOPSIS
*/
void osm_mcm_info_delete(IN osm_mcm_info_t * const p_mcm);
/*
* PARAMETERS
*	p_mcm
*		Pointer to the object to destroy.
*
* RETURN VALUES
*	None.
*
* NOTES
*
* SEE ALSO
*********/

END_C_DECLS
#endif				/* _OSM_MCM_INFO_H_ */


text:
class CourseEvaluationQuestionnaire < Questionnaire
  after_initialize :post_initialization
  def post_initialization
    self.display_type = 'Course Evaluation'
  end
end


text:
"""Some handy functionality to be used by the Neurosynth test suite"""

__author__ = 'Yaroslav Halchenko'
__copyright__ = 'Copyright (c) 2013 Yaroslav Halchenko'
__license__ = 'MIT'

from os.path import dirname, join, pardir, sep as pathsep
from neurosynth.base.dataset import Dataset

def get_resource_path():
	return join(dirname(__file__), pardir, 'resources') + pathsep

def get_test_data_path():
    """Returns the path to test datasets, terminated with separator (/ vs \)"""
    # TODO: do not rely on __file__
    return join(dirname(__file__), 'data') + pathsep

def get_test_dataset(prefix='test'):
    test_data_path = get_test_data_path()
    dataset = Dataset(test_data_path + '%s_dataset.txt' % prefix)
    dataset.add_features(test_data_path + '%s_features.txt' % prefix)
    return dataset


text:
package online.mrsys.common.util;

import java.lang.reflect.Method;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class ContextFinalizer implements ServletContextListener {

    private static final Logger logger = Logger.getLogger(ContextFinalizer.class.getName());

    private class ThreadInfo {

        private final String name;
        private final String cause;
        private final String stop;

        public ThreadInfo(String name, String cause, String stop) {
            this.name = name;
            this.cause = cause;
            this.stop = stop;
        }

        public String getName() {
            return name;
        }

        public String getCause() {
            return cause;
        }

        public String getStop() {
            return stop;
        }

    }

    private List<ThreadInfo> threads = Arrays.asList(
            new ThreadInfo("com.mysql.jdbc.AbandonedConnectionCleanupThread",
                           "Abandoned connection cleanup thread",
                           "shutdown")
            );

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Enumeration<Driver> drivers = DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            Driver driver = drivers.nextElement();
            if (driver.getClass().getClassLoader() == cl) {
                try {
                    DriverManager.deregisterDriver(driver);
                    logger.log(Level.INFO, "Driver {0} deregistered", driver);
                } catch (SQLException e) {
                    logger.log(Level.SEVERE, "Fail to deregister driver " + driver, e);
                }
            } else {
                logger.log(Level.INFO, "Not deregister driver {0} as it does not belong to this webapp's ClassLoader", driver);
            }
        }

        Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
        Thread[] threadArr = threadSet.toArray(new Thread[threadSet.size()]);
        for (Thread thread : threadArr) {
            for (ThreadInfo info: threads) {
                if (thread.getName().contains(info.getCause())) {
                    synchronized (thread) {
                        try {
                            Class<?> cls = Class.forName(info.getName());
                            if (cls != null) {
                                Method mth = cls.getMethod(info.getStop());
                                if (mth != null) {
                                    mth.invoke(null);
                                    logger.log(Level.INFO, "Connection cleanup thread {0} shutdown successfully", info.getName());
                                }
                            }
                        } catch (Exception e) {
                            logger.log(Level.SEVERE, "Failed to shutdown connection cleanup thread: " + info.getName(), e);
                        }
                    }
                }
            }
        }
    }

    @Override
    public void contextInitialized(ServletContextEvent sce) {
    }

}


text:
package org.ovirt.engine.ui.common.widget.dialog;

import org.ovirt.engine.ui.common.CommonApplicationResources;
import org.ovirt.engine.ui.common.gin.AssetProvider;
import org.ovirt.engine.ui.common.widget.tooltip.TooltipConfig.Width;
import org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Image;

public class InfoIcon extends FocusPanel {
    private Image infoImage;
    private final WidgetTooltip tooltip;
    private boolean useItalic = true;

    private static final CommonApplicationResources resources = AssetProvider.getResources();

    @UiConstructor
    public InfoIcon(SafeHtml text) {
        super();

        infoImage = new Image(resources.dialogIconHelp());

        tooltip = new WidgetTooltip(infoImage);
        setTooltipText(text.asString());
        setWidget(tooltip);

        addMouseOutHandler(new MouseOutHandler() {

            @Override
            public void onMouseOut(MouseOutEvent event) {
                infoImage.setUrl(resources.dialogIconHelp().getSafeUri());
            }
        });

        addMouseOverHandler(new MouseOverHandler() {

            @Override
            public void onMouseOver(MouseOverEvent event) {
                infoImage.setUrl(resources.dialogIconHelpRollover().getSafeUri());
            }
        });
    }

    public void setText(SafeHtml text) {
        setTooltipText(text.asString());
        tooltip.reconfigure();
    }

    private void setTooltipText(String text) {
        tooltip.setText(useItalic ? wrapItalic(text) : text);
    }

    /**
     * Return the tooltip text, wrapped in italic if there wasn't already italic detected.
     */
    private String wrapItalic(String text) {
        if (text == null || text.isEmpty() || text.contains("<i>")) { //$NON-NLS-1$
            return text;
        }
        return text = "<i>" + text + "</i>"; //$NON-NLS-1$ //$NON-NLS-2$
    }

    public void setTooltipMaxWidth(Width width) {
        tooltip.setMaxWidth(width);
    }

    public boolean isUseItalic() {
        return useItalic;
    }

    public void setUseItalic(boolean useItalic) {
        this.useItalic = useItalic;
    }

}


text:
class Timely::Rows::AverageDaysBetween < Timely::Row
  self.default_options = { transform: :round }

  private

  def raw_value_from(scope)
    scope.average query
  end

  def query
    "DATEDIFF(#{to}, #{from})"
  end

  def from
    @from ||= disambiguate_column_name column[:from]
  end

  def to
    @to ||= disambiguate_column_name column[:to]
  end
end


text: Pre Process Atom


text:
package xyz.cloudbans.client.response.server;

import xyz.cloudbans.entities.data.Ban;

public class ServerPlayerJoinResponse {

    private Ban ban;

    public Ban getBan() {
        return ban;
    }

    public void setBan(Ban ban) {
        this.ban = ban;
    }
}


text:
<?php

/**
 * @file
 * Contains \Drupal\views\Plugin\views\row\EntityRow.
 */

namespace Drupal\views\Plugin\views\row;

use Drupal\Core\Entity\EntityManager;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\Component\Annotation\Plugin;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Generic entity row plugin to provide a common base for all entity types.
 *
 * @Plugin(
 *   id = "entity",
 *   derivative = "Drupal\views\Plugin\Derivative\ViewsEntityRow"
 * )
 */
class EntityRow extends RowPluginBase {

  /**
   * The table the entity is using for storage.
   *
   * @var string
   */
  public $base_table;

  /**
   * The actual field which is used for the entity id.
   *
   * @var string
   */
  public $base_field;

  /**
   * Stores the entity type of the result entities.
   *
   * @var string
   */
  protected $entityType;

  /**
   * Contains the entity info of the entity type of this row plugin instance.
   *
   * @see entity_get_info
   */
  protected $entityInfo;

  /**
   * Contains an array of render arrays, one for each rendered entity.
   *
   * @var array
   */
  protected $build = array();

  /**
   * {@inheritdoc}
   *
   * @param \Drupal\Core\Entity\EntityManager $entity_manager
   *   The entity manager.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityManager $entity_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);

    $this->entityManager = $entity_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);

    $this->entityType = $this->definition['entity_type'];
    $this->entityInfo = $this->entityManager->getDefinition($this->entityType);
    $this->base_table = $this->entityInfo['base_table'];
    $this->base_field = $this->entityInfo['entity_keys']['id'];
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity'));
  }

  /**
   * Overrides Drupal\views\Plugin\views\row\RowPluginBase::defineOptions().
   */
  protected function defineOptions() {
    $options = parent::defineOptions();

    $options['view_mode'] = array('default' => '');

    return $options;
  }

  /**
   * Overrides Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().
   */
  public function buildOptionsForm(&$form, &$form_state) {
    parent::buildOptionsForm($form, $form_state);

    $options = $this->buildViewModeOptions();
    $form['view_mode'] = array(
      '#type' => 'select',
      '#options' => $options,
      '#title' => t('View mode'),
      '#default_value' => $this->options['view_mode'],
    );
  }

  /**
   * Return the main options, which are shown in the summary title.
   */
  protected function buildViewModeOptions() {
    $options = array();
    $view_modes = entity_get_view_modes($this->entityType);
    foreach ($view_modes as $mode => $settings) {
      $options[$mode] = $settings['label'];
    }

    return $options;
  }

  /**
   * Overrides Drupal\views\Plugin\views\PluginBase::summaryTitle().
   */
  public function summaryTitle() {
    $options = $this->buildViewModeOptions();
    if (isset($options[$this->options['view_mode']])) {
      return check_plain($options[$this->options['view_mode']]);
    }
    else {
      return t('No view mode selected');
    }
  }

  /**
   * {@inheritdoc}
   */
  public function preRender($result) {
    parent::preRender($result);

    if ($result) {
      // Get all entities which will be used to render in rows.
      $entities = array();
      foreach ($result as $row) {
        $entity = $row->_entity;
        $entity->view = $this->view;
        $entities[$entity->id()] = $entity;
      }

      // Prepare the render arrays for all rows.
      $this->build = entity_view_multiple($entities, $this->options['view_mode']);
    }
  }

  /**
   * Overrides Drupal\views\Plugin\views\row\RowPluginBase::render().
   */
  public function render($row) {
    $entity_id = $row->{$this->field_alias};
    return $this->build[$entity_id];
  }
}


text:
namespace blink {

class ConsoleMessage;
class ModuleScriptLoader;

// ModuleScriptFetcher is an abstract class to fetch module scripts. Derived
// classes are expected to fetch a module script for the given FetchParameters
// and return its client a fetched resource as ModuleScriptCreationParams.
class CORE_EXPORT ModuleScriptFetcher : public ResourceClient {
 public:
  // ModuleScriptFetcher should only be called from ModuleScriptLoader.
  explicit ModuleScriptFetcher(util::PassKey<ModuleScriptLoader>);

  class CORE_EXPORT Client : public GarbageCollectedMixin {
   public:
    virtual void NotifyFetchFinished(
        const base::Optional<ModuleScriptCreationParams>&,
        const HeapVector<Member<ConsoleMessage>>& error_messages) = 0;

    // These helpers are used only from WorkletModuleResponsesMap.
    // TODO(nhiroki): Move these helpers to WorkletModuleResponsesMap.
    void OnFetched(const base::Optional<ModuleScriptCreationParams>&);
    void OnFailed();
  };

  // Fetch() must be called right after ModuleScriptFetcher is constructed.
  // Fetch() must not be called more than once.
  //
  // Takes a non-const reference to FetchParameters because
  // ScriptResource::Fetch() requires it.
  virtual void Fetch(FetchParameters&,
                     ResourceFetcher*,
                     ModuleGraphLevel,
                     Client*) = 0;

  void Trace(Visitor*) override;

 protected:
  static bool WasModuleLoadSuccessful(
      Resource* resource,
      HeapVector<Member<ConsoleMessage>>* error_messages,
      ModuleScriptCreationParams::ModuleType* module_type);
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_MODULESCRIPT_MODULE_SCRIPT_FETCHER_H_


text:
"""
Ask the server to parse the question text 'computer name and ip route details' and choose the first parsed result as the question to run, return right away and do not wait for results to complete/do not get result data at all
"""
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback

# disable python from generating a .pyc file
sys.dont_write_bytecode = True

# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path = os.path.join(os.path.expanduser(pytan_loc), 'lib')

# Determine our script name, script dir
my_file = os.path.abspath(sys.argv[0])
my_dir = os.path.dirname(my_file)

# try to automatically determine the pytan lib directory by assuming it is in '../../lib/'
parent_dir = os.path.dirname(my_dir)
pytan_root_dir = os.path.dirname(parent_dir)
lib_dir = os.path.join(pytan_root_dir, 'lib')

# add pytan_loc and lib_dir to the PYTHONPATH variable
path_adds = [lib_dir, pytan_static_path]
[sys.path.append(aa) for aa in path_adds if aa not in sys.path]

# import pytan
import pytan

# create a dictionary of arguments for the pytan handler
handler_args = {}

# establish our connection info for the Tanium Server
handler_args['username'] = "Administrator"
handler_args['password'] = "Tanium2015!"
handler_args['host'] = "10.0.1.240"
handler_args['port'] = "443"  # optional
handler_args['trusted_certs'] = "certs"

# optional, level 0 is no output except warnings/errors
# level 1 through 12 are more and more verbose
handler_args['loglevel'] = 1

# optional, use a debug format for the logging output (uses two lines per log entry)
handler_args['debugformat'] = False

# optional, this saves all response objects to handler.session.ALL_REQUESTS_RESPONSES
# very useful for capturing the full exchange of XML requests and responses
handler_args['record_all_requests'] = True

# instantiate a handler using all of the arguments in the handler_args dictionary
print "...CALLING: pytan.handler() with args: {}".format(handler_args)
handler = pytan.Handler(**handler_args)

# print out the handler string
print "...OUTPUT: handler string: {}".format(handler)

# setup the arguments for the handler() class
kwargs = {}
kwargs["get_results"] = False
kwargs["picker"] = 1
kwargs["question_text"] = u'computer name and ip route details'
kwargs["qtype"] = u'parsed'

print "...CALLING: handler.ask with args: {}".format(kwargs)
response = handler.ask(**kwargs)

print "...OUTPUT: Type of response: ", type(response)

print "...OUTPUT: Pretty print of response:"
print pprint.pformat(response)

print "...OUTPUT: Equivalent Question if it were to be asked in the Tanium Console: "
print response['question_object'].query_text

if response['question_results']:
    # call the export_obj() method to convert response to CSV and store it in out
    export_kwargs = {}
    export_kwargs['obj'] = response['question_results']
    export_kwargs['export_format'] = 'csv'

    print "...CALLING: handler.export_obj() with args {}".format(export_kwargs)
    out = handler.export_obj(**export_kwargs)

    # trim the output if it is more than 15 lines long
    if len(out.splitlines()) > 15:
        out = out.splitlines()[0:15]
        out.append('..trimmed for brevity..')
        out = '\n'.join(out)

    print "...OUTPUT: CSV Results of response: "
    print out

'''STDOUT from running this:
...CALLING: pytan.handler() with args: {'username': 'Administrator', 'record_all_requests': True, 'loglevel': 1, 'debugformat': False, 'host': '10.0.1.240', 'password': 'Tanium2015!', 'port': '443'}
...OUTPUT: handler string: PyTan v2.1.4 Handler for Session to 10.0.1.240:443, Authenticated: True, Platform Version: 6.5.314.4301
...CALLING: handler.ask with args: {'get_results': False, 'picker': 1, 'question_text': u'computer name and ip route details', 'qtype': u'parsed'}
...OUTPUT: Type of response:  <type 'dict'>
...OUTPUT: Pretty print of response:
{'parse_results': <taniumpy.object_types.parse_result_group_list.ParseResultGroupList object at 0x10c711c90>,
 'poller_object': <pytan.pollers.QuestionPoller object at 0x11d64e190>,
 'poller_success': None,
 'question_object': <taniumpy.object_types.question.Question object at 0x10c711d50>,
 'question_results': None}
...OUTPUT: Equivalent Question if it were to be asked in the Tanium Console:
Get Computer Name and IP Route Details from all machines

'''

'''STDERR from running this:

'''


text:
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../shared/gr-dialog/gr-dialog.html">
<link rel="import" href="../../shared/gr-overlay/gr-overlay.html">
<link rel="import" href="../../shared/gr-repo-branch-picker/gr-repo-branch-picker.html">

<dom-module id="gr-create-destination-dialog">
  <template>

    <gr-overlay id="createOverlay" with-backdrop>
      <gr-dialog
          confirm-label="View commands"
          on-confirm="_pickerConfirm"
          on-cancel="_handleClose"
          disabled="[[!_repoAndBranchSelected]]">

          Create change

          <gr-repo-branch-picker
              repo="{{_repo}}"
              branch="{{_branch}}"></gr-repo-branch-picker>

            If you haven't done so, you will need to clone the repository.

      </gr-dialog>
    </gr-overlay>
  </template>

</dom-module>


text:
@interface YXSettingController : UITableViewController

@end


text:
/**
 *
 */
package com.betfair.tornjak.monitor.aop;

import com.betfair.tornjak.monitor.ErrorCountingPolicy;

/**
 * All errors count by default, all non Throwable values do not count as errors.
 *
 * @author sorokod
 *
 */
public class DefaultErrorCountingPolicy implements ErrorCountingPolicy {

    public boolean countsAsError(Throwable t) {
        return true;
    }

    public boolean countsAsError(Object o) {
        return false;
    }

}


text:
[![Build Status](https://api.travis-ci.org/Soneritics/PostNL.svg?branch=master)](https://travis-ci.org/Soneritics/PostNL)
[![Coverage Status](https://coveralls.io/repos/Soneritics/PostNL/badge.svg?branch=master)](https://coveralls.io/r/Soneritics/PostNL?branch=master)
[![Latest Stable](https://img.shields.io/packagist/v/soneritics/postnl.svg?style=flat-square&label=stable)](https://packagist.org/packages/soneritics/postnl?branch=master)
![License](http://img.shields.io/badge/license-MIT-green.svg)

## Introduction
This library offers a variety of functions for PostNL. Mainly, these are the two categories:
- PostNL API - https://developer.postnl.nl
- PostNL Voormeldbestand

## Minimum requirements
 - PHP 7.1

## Installation
Use Composer to install: soneritics/postnl

## PostNL API
The base for connecting to the PostNL API will be provided by this plugin.
It is advised not to use it in a production environment, as it's nog error-proof,
nor (fully automated) tested. It does work, though, and is currently being tested
 in a production environment :-)

Create an issue if you need help, or need more services than the ones provided.

### Supported APIs
| Service                                       | Implemented | Version |
|-----------------------------------------------|:-----------:|:-------:|
| **Send & Track**                                                    |||
| Barcode webservice                            |      ✓      |   1_1   |
| Confirming webservice                         |      ✓      |   1_10  |
| Labelling webservice                          |      ✓      |   2_2*   |
| Shippingstatus webservice                     |      ✓      |   v2   |
| **Delivery options**                                                |||
| Deliverydate webservice                       |      X      |   N/A   |
| Location webservice                           |      ✓      |   2_1   |
| Timeframe webservice                          |      ✓      |   2_1   |
| **Checkout**                                                |||
| Postalcode Check                              |      ✓      |   1   |

> *`v2_2` supports ERS labels

### Code example: Creating the API
Always start with creating the API object.
```php
$apiKey = '*YOUR API KEY*';

$endpoints = new Sandbox;
$customer = (new Customer)
    ->setCustomerCode('DEVC')
    ->setCustomerNumber('11223344')
    ->setAddress((new Address)
        ->setAddressType(AddressType::SENDER)
        ->setCompanyName('Soneritics')
        ->setStreet('De Rosmolen')
        ->setHouseNr('123')
        ->setZipcode('1234AB')
        ->setCity('Amsterdam')
        ->setCountrycode('NL')
    );

$api = new API($apiKey, $customer, $endpoints);
```

### Code example: Fetching a barcode
```php
$barcodeService = $api->getBarcodeService();
$barcode = $barcodeService->generateBarcode();
echo "generated barcode: {$barcode}\r\n";
```

### Code example: Generate a label and confirm shipment (basic)
```php
$message = new Message(1, PrinterType::JPG);
$dimension = (new Dimension)->setWeight(1000);
$receivingAddress = (new Address)
    ->setAddressType(AddressType::RECEIVER)
    ->setCompanyName('Jordi Jolink')
    ->setStreet('Some street')
    ->setHouseNr('123')
    ->setZipcode('1234AB')
    ->setCity('Amsterdam')
    ->setCountrycode('NL');

$shipments = (new Shipments)->addShipment(
    (new Shipment)
        ->setAddresses((new Addresses)->addAddress($receivingAddress))
        ->setBarcode($barcode)
        ->setDimension($dimension)
);

$result = $api->getLabellingService()->generateLabel($shipments, $message);
$labelContentsBase64 = $result['ResponseShipments'][0]['Labels'][0]['Content'];
```

### Code example: Get time frames, get a label and confirm the shipment
```php
$receivingAddress = (new Address)
    ->setAddressType(AddressType::RECEIVER)
    ->setCompanyName('Soneritics')
    ->setStreet('Some street')
    ->setHouseNr('123')
    ->setZipcode('1234AB')
    ->setCity('Amsterdam')
    ->setCountrycode('NL');

$deliveryOptions = [
    DeliveryOptions::DAYTIME,
    DeliveryOptions::EVENING,
    DeliveryOptions::AFTERNOON,
    DeliveryOptions::MORNING,
    DeliveryOptions::NOON
];

$result = $api->getTimeframeService()->calculateTimeframes($receivingAddress, $deliveryOptions);
echo "Timeframes:\r\n";
print_r($result);

# Confirm time frame
$barcodeService = $api->getBarcodeService();

echo "Confirming timeframe..\r\n";
if (!empty($result['Timeframes']['Timeframe'])) {
    $timeframe = array_pop($result['Timeframes']['Timeframe']);
    if ($timeframe !== null) {
        $deliveryTimestampStart = new DateTime($timeframe['Date'] . ' ' . $timeframe['Timeframes']['TimeframeTimeFrame']['From']);
        $deliveryTimestampEnd = new DateTime($timeframe['Date'] . ' ' . $timeframe['Timeframes']['TimeframeTimeFrame']['To']);

       $contact = (new Contact)->setEmail('mail@no-spam4me.nl');
       $shipments = (new Shipments)->addShipment(
            (new Shipment)
                ->setAddresses((new Addresses)->addAddress($receivingAddress))
                ->setBarcode($barcodeService->generateBarcode())
                ->setDimension($dimension)
                ->setDeliveryDate($deliveryTimestampStart)
                ->setDeliveryTimeStampStart($deliveryTimestampStart)
                ->setDeliveryTimeStampEnd($deliveryTimestampEnd)
                ->setContacts((new Contacts)->addContact($contact))
        );

        $result = $api->getLabellingService()->generateLabel($shipments, $message);
        print_r($result);
    }
}
echo "Timeframe confirmed.\r\n";
```

### Code example: Fetch nearest locations
```php
$receivingAddress = (new Address)
    ->setAddressType(AddressType::RECEIVER)
    ->setZipcode('1234AB')
    ->setCountrycode('NL');

$result = $api->getLocationsService()->getNearestLocations($receivingAddress);
print_r($result);
```

### Code example: Fetch nearest locations by geocode and lookup location info
```php
$result = $api->getLocationsService()->getNearestLocationsByGeocode(51.963807, 5.968984, 'NL');

if (!empty($result['GetLocationsResult']['ResponseLocation'])) {
    $location = $result['GetLocationsResult']['ResponseLocation'][0];
    print_r($location);

    echo "Location info:\r\n";
    $locationCode = $location['LocationCode'];
    $retailNetworkID = $location['RetailNetworkID'];
    print_r($api->getLocationsService()->getLocationInformation($locationCode, $retailNetworkID));
}
```

### Code example: Fetch nearest location and create a label for pickup at the pickup point
```php
$result = $api->getLocationsService()->getNearestLocationsByGeocode(51.963807, 5.968984, 'NL');

if (!empty($result['GetLocationsResult']['ResponseLocation'])) {
    $location = $result['GetLocationsResult']['ResponseLocation'][0];
    $locationCode = $location['LocationCode'];
    $retailNetworkID = $location['RetailNetworkID'];

    $pickupAddress = (new \PostNL\Model\Address)
        ->setAddressType(\PostNL\Enum\AddressType::DELIVERY_ADDRESS_FOR_PICKUP)
        ->setCompanyName($location['Name'])
        ->setStreet($location['Address']['Street'])
        ->setHouseNr($location['Address']['HouseNr'])
        ->setZipcode($location['Address']['Zipcode'])
        ->setCity($location['Address']['City'])
        ->setCountrycode('NL');

    $contact = (new Contact)->setEmail('mail@jordijolink.nl');
    $shipments = (new Shipments)->addShipment(
        (new Shipment)
            ->setAddresses((new Addresses)->addAddress($receivingAddress)->addAddress($pickupAddress))
            ->setBarcode($barcodeService->generateBarcode())
            ->setDimension($dimension)
            ->setContacts((new Contacts)->addContact($contact))
            ->setProductCodeDelivery('3533')
            ->setDeliveryAddress(AddressType::DELIVERY_ADDRESS_FOR_PICKUP)
    );

    $result = $api->getLabellingService()->generateLabel($shipments, $message);
    print_r($result);
}
```

### Code example: Get the shipping status (via a barcode)
```
$endpoints = new Sandbox();
$api = new API($key, new Customer(), $endpoints);
$data = $api->getShippingStatusService()->getByBarcode($barcode);
```

---

## PostNL Vooraanmelding
### Codetaal: Nederlands
Voor de taal van de classes, variabelen en commentaar is gekozen voor Nederlands. Daarbij worden getters en setters als hybride aangeduid, bijvoorbeeld: setKlantnummer.
Hiervoor is gekozen aangezien PostNL uitsluitend binnen Nederland verzendt, en daardoor ook vooral door Nederlanders geïmplementeerd zal worden.
Daarnaast worden specifieke woorden gebruikt, waarvan de Engelse vertaling de werking erg onduidelijk zal maken.

### Code example
```php
$afzender = (new Afzender)
    ->setBedrijfsnaam('Bedrijfsnaam')
    ->setPostcode('1234AB')
    ->setHuisnummerPostbusnummer('1')
    ->setLandcode('NL');

$voormelding = (new Voormelding)
    ->setAfzender($afzender)
    ->setKlantCode($customerCode)
    ->setKlantNummer($customerNr)
    ->setVolgnummer($volgnummer)
    ->setAanleverLocatie($bls);

$pakket = (new Pakket)
    ->setGeadresseerdeBedrijfsnaam($company)
    ->setGeadresseerdeVoornaam($firstname)
    ->setGeadresseerdeAchternaam($lastname)
    ->setGeadresseerdePostcode($zipcode)
    ->setGeadresseerdeStraatnaam($streetname)
    ->setGeadresseerdeHuisnummerPostbusnummer($housenumber)
    ->setGeadresseerdeHuisnummerToevoeging($housenumberExtension)
    ->setGeadresseerdeWoonplaats($city)
    ->setGeadresseerdeLandcode($country)
    ->setEmailadres($email)
    ->setZendingcode($shipmentCode);
$voormelding->addPakket($pakket);

// Contents ophalen. Dit kan opgeslagen worden in een LST bestand.
$voormeldContents = $voormelding->genereerInhoud()
```

---
## ERS

### Using ERS

The product code for ERS labels is `4910`.

PostNL does not have documentation available for this product code, but you can use the documentation from product code `3085 Return label in the box` as a base.
There are additional things required for using ERS:
- The `CustomerCode` (4 letters) should have ERS enabled, or be ERS specific. Contact PostNL support for this.
- The `Addressses` of the `Customer` and `Shipment` all need to have a `name` filled in.
- The `ReturnBarcode` should be set.


text:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://ejb.dst3/")
package dst3.ws;


text:
package com.stevehead.ksp.rocketbuilder.rocket;

import com.stevehead.ksp.rocketbuilder.interfaces.Massive;

public class Stage extends BaseThruster {

	/**
	 * @param payload		the payload
	 * @param stacks		the stacks
	 */
	public Stage(Massive payload, Stack... stacks) {
		super(
				payload.getMass() + calculateDryMass(stacks),
				payload.getMass() + calculateMass(stacks),
				calculateThrust(stacks),
				calculateIsp(stacks),
				combinePropellants(stacks)
				);
	}

	/**
	 * @param payload		the payload
	 * @param stack			the stack
	 * @param stackNumber	the number of times the stack is repeated
	 */
	public Stage(Massive payload, Stack stack, int stackNumber) {
		this(payload, stack.duplicate(stackNumber));
	}
}