text:
<?php
/**
 * The loop that displays posts.
 *
 * @package WordPress
 * @subpackage Starkers
 * @since Starkers HTML5 3.0
 */
?>

<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>

        <?php next_posts_link( __( '← Older posts', 'starkers' ) ); ?>
        <?php previous_posts_link( __( 'Newer posts →', 'starkers' ) ); ?>

<?php endif; ?>

<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( ! have_posts() ) : ?>

<?php _e( 'Not Found', 'starkers' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'starkers' ); ?>

            <?php get_search_form(); ?>
<?php endif; ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>

    <?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'starkers' ) ) ) : ?>

        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'starkers' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

                <?php starkers_posted_on(); ?>

<?php if ( post_password_required() ) : ?>
                <?php the_content(); ?>
<?php else : ?>
<?php $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
        $total_images = count( $images );
        $image = array_shift( $images );
        $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' ); ?>

        <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?>

<?php printf( _n( 'This gallery contains %2$s photo.', 'This gallery contains %2$s photos.', $total_images, 'starkers' ), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'starkers' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', number_format_i18n( $total_images )); ?>

	<?php endif; ?>

    <?php the_excerpt(); ?>

<?php endif; ?>

	            <?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
	            <a href="<?php echo get_post_format_link( 'gallery' ); ?>" title="<?php esc_attr_e( 'View Galleries', 'starkers' ); ?>"><?php _e( 'More Galleries', 'starkers' ); ?> |

	            <?php elseif ( in_category( _x( 'gallery', 'gallery category slug', 'starkers' ) ) ) : ?>
	            <a href="<?php echo get_term_link( _x( 'gallery', 'gallery category slug', 'starkers' ), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'starkers' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?> |

	            <?php endif; ?>

	            <?php comments_popup_link( __( 'Leave a comment', 'starkers' ), __( '1 Comment', 'starkers' ), __( '% Comments', 'starkers' ) ); ?>
	            <?php edit_post_link( __( 'Edit', 'starkers' ), '| ', '' ); ?>

<?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>

    <?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'starkers' ) )  ) : ?>

        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
                <?php the_excerpt(); ?>
        <?php else : ?>
                <?php the_content( __( 'Continue reading →', 'starkers' ) ); ?>
        <?php endif; ?>

                <?php starkers_posted_on(); ?> | <?php comments_popup_link( __( 'Leave a comment', 'starkers' ), __( '1 Comment', 'starkers' ), __( '% Comments', 'starkers' ) ); ?> <?php edit_post_link( __( 'Edit', 'starkers' ), '| ', '' ); ?>

<?php /* How to display all other posts. */ ?>

    <?php else : ?>

        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'starkers' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

                <?php starkers_posted_on(); ?>

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                <?php the_excerpt(); ?>
    <?php else : ?>
                <?php the_content( __( 'Continue reading →', 'starkers' ) ); ?>

                <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'starkers' ), 'after' => '' ) ); ?>
    <?php endif; ?>

                <?php if ( count( get_the_category() ) ) : ?>
                        <?php printf( __( 'Posted in %2$s', 'starkers' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> |
                <?php endif; ?>
                <?php
                    $tags_list = get_the_tag_list( '', ', ' );
                    if ( $tags_list ):
                ?>
                        <?php printf( __( 'Tagged %2$s', 'starkers' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> |
                <?php endif; ?>
                <?php comments_popup_link( __( 'Leave a comment', 'starkers' ), __( '1 Comment', 'starkers' ), __( '% Comments', 'starkers' ) ); ?>
                <?php edit_post_link( __( 'Edit', 'starkers' ), '| ', '' ); ?>

            <?php comments_template( '', true ); ?>

    <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>

<?php endwhile; // End the loop. Whew. ?>

<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if (  $wp_query->max_num_pages > 1 ) : ?>

        <?php next_posts_link( __( '← Older posts', 'starkers' ) ); ?>
        <?php previous_posts_link( __( 'Newer posts →', 'starkers' ) ); ?>

<?php endif; ?>


text:
require "google/cloud/gke_hub/v1"

##
# Example demonstrating basic usage of
# Google::Cloud::GkeHub::V1::GkeHub::Client#list_features
#
def list_features
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::GkeHub::V1::GkeHub::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::GkeHub::V1::ListFeaturesRequest.new

  # Call the list_features method.
  result = client.list_features request

  # The returned object is of type Gapic::PagedEnumerable. You can
  # iterate over all elements by calling #each, and the enumerable
  # will lazily make API calls to fetch subsequent pages. Other
  # methods are also available for managing paging directly.
  result.each do |response|
    # Each element is of type ::Google::Cloud::GkeHub::V1::Feature.
    p response
  end
end
# [END gkehub_v1_generated_GkeHub_ListFeatures_sync]

redpajama_set_name: RedPajamaGithub


text:
=begin
	Please uncomment the code which you want to execute.
=end

require '../lib/asposediagramjava'
include Asposediagramjava
#include Asposediagramjava::GetShapeInfo
#include Asposediagramjava::SetShapeXFormData
#include Asposediagramjava::SetShapeLineData
#include Asposediagramjava::SetShapeFillData
#include Asposediagramjava::ReadShapeData
#include Asposediagramjava::SetShapeHeightAndWidth
#include Asposediagramjava::ChangeShapePosition
#include Asposediagramjava::RotateShape
#include Asposediagramjava::ConnectSubShapes
#include Asposediagramjava::SelectRerouteOption
#include Asposediagramjava::SetShapeAppearance
#include Asposediagramjava::GetShapeIcon
#include Asposediagramjava::ExtractImages
#include Asposediagramjava::SetMilestoneShapeProperties

initialize_aspose_diagram


text:
package jwk_test

import (
	"crypto/rand"
	"fmt"
	"io"
	"testing"

	"github.com/ory/hydra/driver/config"
	"github.com/ory/hydra/internal"
	. "github.com/ory/hydra/jwk"

	"github.com/pborman/uuid"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func secret(t *testing.T) string {
	bytes := make([]byte, 32)
	_, err := io.ReadFull(rand.Reader, bytes)
	require.NoError(t, err)
	return fmt.Sprintf("%X", bytes)
}

func TestAEAD(t *testing.T) {
	c := internal.NewConfigurationWithDefaults()
	t.Run("case=without-rotation", func(t *testing.T) {
		c.MustSet(config.KeyGetSystemSecret, []string{secret(t)})
		a := NewAEAD(c)

		plain := []byte(uuid.New())
		ct, err := a.Encrypt(plain)
		assert.NoError(t, err)

		res, err := a.Decrypt(ct)
		assert.NoError(t, err)
		assert.Equal(t, plain, res)
	})

	t.Run("case=wrong-secret", func(t *testing.T) {
		c.MustSet(config.KeyGetSystemSecret, []string{secret(t)})
		a := NewAEAD(c)

		ct, err := a.Encrypt([]byte(uuid.New()))
		require.NoError(t, err)

		c.MustSet(config.KeyGetSystemSecret, []string{secret(t)})
		_, err = a.Decrypt(ct)
		require.Error(t, err)
	})

	t.Run("case=with-rotation", func(t *testing.T) {
		old := secret(t)
		c.MustSet(config.KeyGetSystemSecret, []string{old})
		a := NewAEAD(c)

		plain := []byte(uuid.New())
		ct, err := a.Encrypt(plain)
		require.NoError(t, err)

		// Sets the old secret as a rotated secret and creates a new one.
		c.MustSet(config.KeyGetSystemSecret, []string{secret(t), old})
		res, err := a.Decrypt(ct)
		require.NoError(t, err)
		assert.Equal(t, plain, res)

		// THis should also work when we re-encrypt the same plain text.
		ct2, err := a.Encrypt(plain)
		require.NoError(t, err)
		assert.NotEqual(t, ct2, ct)

		res, err = a.Decrypt(ct)
		require.NoError(t, err)
		assert.Equal(t, plain, res)
	})

	t.Run("case=with-rotation-wrong-secret", func(t *testing.T) {
		c.MustSet(config.KeyGetSystemSecret, []string{secret(t)})
		a := NewAEAD(c)

		plain := []byte(uuid.New())
		ct, err := a.Encrypt(plain)
		require.NoError(t, err)

		// When the secrets do not match, an error should be thrown during decryption.
		c.MustSet(config.KeyGetSystemSecret, []string{secret(t), secret(t)})
		_, err = a.Decrypt(ct)
		require.Error(t, err)
	})
}


text:
from cmath import exp
from collections import Counter

class Solution:
    def minDeletions(self, s: str) -> int:
        ans, letter_freqs, used = 0, Counter(s), set()
        for _, f in letter_freqs.items():
            while f > 0 and f in used:
                f -= 1
                ans += 1
            used.add(f)
        return ans

# TESTS
for s, expected in [
    ("aab", 0),
    ("aaabbbcc", 2),
    ("ceabaacb", 2),
]:
    sol = Solution()
    actual = sol.minDeletions(s)
    print("The minimum deletions needed for", s, "->", actual)
    assert actual == expected


text:
#ifndef ANDROID_LIGHTS_INTERFACE_H
#define ANDROID_LIGHTS_INTERFACE_H

#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>

#include <hardware/hardware.h>

__BEGIN_DECLS

/**
 * The id of this module
 */
#define LIGHTS_HARDWARE_MODULE_ID "lights"

/*
 * These light IDs correspond to logical lights, not physical.
 * So for example, if your INDICATOR light is in line with your
 * BUTTONS, it might make sense to also light the INDICATOR
 * light to a reasonable color when the BUTTONS are lit.
 */
#define LIGHT_ID_BACKLIGHT          "backlight"
#define LIGHT_ID_KEYBOARD           "keyboard"
#define LIGHT_ID_BUTTONS            "buttons"
#define LIGHT_ID_BATTERY            "battery"
#define LIGHT_ID_NOTIFICATIONS      "notifications"
#define LIGHT_ID_ATTENTION          "attention"

/*
 * These lights aren't currently supported by the higher
 * layers, but could be someday, so we have the constants
 * here now.
 */
#define LIGHT_ID_BLUETOOTH          "bluetooth"
#define LIGHT_ID_WIFI               "wifi"

/*
 * Additional hardware-specific lights
 */
#define LIGHT_ID_CAPS               "caps"
#define LIGHT_ID_FUNC               "func"

/* ************************************************************************
 * Flash modes for the flashMode field of light_state_t.
 */

#define LIGHT_FLASH_NONE            0

/**
 * To flash the light at a given rate, set flashMode to LIGHT_FLASH_TIMED,
 * and then flashOnMS should be set to the number of milliseconds to turn
 * the light on, followed by the number of milliseconds to turn the light
 * off.
 */
#define LIGHT_FLASH_TIMED           1

/**
 * To flash the light using hardware assist, set flashMode to
 * the hardware mode.
 */
#define LIGHT_FLASH_HARDWARE        2

/**
 * Light brightness is managed by a user setting.
 */
#define BRIGHTNESS_MODE_USER        0

/**
 * Light brightness is managed by a light sensor.
 */
#define BRIGHTNESS_MODE_SENSOR      1

/**
 * Light mode allows multiple LEDs
 */
#define LIGHT_MODE_MULTIPLE_LEDS    0x01

/**
 * The parameters that can be set for a given light.
 *
 * Not all lights must support all parameters.  If you
 * can do something backward-compatible, you should.
 */
struct light_state_t {
    /**
     * The color of the LED in ARGB.
     *
     * Do your best here.
     *   - If your light can only do red or green, if they ask for blue,
     *     you should do green.
     *   - If you can only do a brightness ramp, then use this formula:
     *      unsigned char brightness = ((77*((color>>16)&0x00ff))
     *              + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8;
     *   - If you can only do on or off, 0 is off, anything else is on.
     *
     * The high byte should be ignored.  Callers will set it to 0xff (which
     * would correspond to 255 alpha).
     *
     * CyanogenMod: The high byte value can be implemented to control the LEDs
     * Brightness from the Lights settings. The value goes from 0x01 to 0xFF.
     */
    unsigned int color;

    /**
     * See the LIGHT_FLASH_* constants
     */
    int flashMode;
    int flashOnMS;
    int flashOffMS;

    /**
     * Policy used by the framework to manage the light's brightness.
     * Currently the values are BRIGHTNESS_MODE_USER and BRIGHTNESS_MODE_SENSOR.
     */
    int brightnessMode;

    /**
     * Define the LEDs modes (multiple, ...).
     * See the LIGHTS_MODE_* mask constants.
     */
    unsigned int ledsModes;
};

struct light_device_t {
    struct hw_device_t common;

    /**
     * Set the provided lights to the provided values.
     *
     * Returns: 0 on succes, error code on failure.
     */
    int (*set_light)(struct light_device_t* dev,
            struct light_state_t const* state);
};

__END_DECLS

#endif  // ANDROID_LIGHTS_INTERFACE_H


text:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
						http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
						http://www.springframework.org/schema/mvc
						http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
						http://www.springframework.org/schema/context
						http://www.springframework.org/schema/context/spring-context-3.2.xsd
						http://www.springframework.org/schema/tx
						http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

	<!-- Scans whole package for annotated classes -->
	<context:component-scan base-package="com.abuabdul.apps" />

	<!-- To handle mvc annotations -->
	<mvc:annotation-driven />

	<!-- To handle static resources. It needs DispatcherServlet to be mapped to '/'  -->
	<mvc:resources mapping="/resources/**" location="/WEB-INF/static-content/" cache-period="10000" />

	<!-- Last view resolver to be invoked by default -->
	<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>

    <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
		<property name="order" value="0" />
	</bean>

	<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
		<property name="definitions">
			<list>
				<value>/WEB-INF/tiles-def.xml</value>
			</list>
		</property>
	</bean>
</beans>


text:
package org.kisoonlineapp.model.security;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.kisoonlineapp.model.AbstractDatabaseObject;

/**
 *
 * @author berni
 */
@Entity
@Table(name = "KI_SEC_USER")
public class User extends AbstractDatabaseObject {

    private static final long serialVersionUID = 20151104L;

    private String username;
    private String passwd;

    @ManyToMany
    @JoinTable(name = "KI_SEC_USER_ROLE")
    private List<Role> roleList = new ArrayList<>();

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public List<Role> getRoleList() {
        return roleList;
    }

    void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    public void addRole(Role role) {
        if (!this.roleList.contains(role)) {
            this.roleList.add(role);
        }
    }

    public void removeRole(Role role) {
        this.roleList.remove(role);
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 41 * hash + Objects.hashCode(this.username);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof User)) {
            return false;
        }
        final User other = (User) obj;
        if (!Objects.equals(this.username, other.username)) {
            return false;
        }
        return true;
    }

}


text:
package org.apache.maven.plugins.dependency.fromConfiguration;

import java.io.File;
import java.util.Collections;
import java.util.List;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.dependency.AbstractDependencyMojo;
import org.apache.maven.plugins.dependency.utils.DependencyUtil;
import org.apache.maven.plugins.dependency.utils.filters.ArtifactItemFilter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.shared.artifact.DefaultArtifactCoordinate;
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
import org.apache.maven.shared.repository.RepositoryManager;
import org.apache.maven.shared.artifact.resolve.ArtifactResolver;
import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
import org.codehaus.plexus.util.StringUtils;

/**
 * Abstract parent class used by mojos that get Artifact information from the plugin configuration as an ArrayList of
 * ArtifactItems
 *
 * @author Brian Fox
 * @version $Id$
 * @see ArtifactItem
 */
public abstract class AbstractFromConfigurationMojo
    extends AbstractDependencyMojo
{
    /**
     * Default output location used for mojo, unless overridden in ArtifactItem.
     *
     * @since 1.0
     */
    @Parameter( property = "outputDirectory", defaultValue = "${project.build.directory}/dependency" )
    private File outputDirectory;

    /**
     * Overwrite release artifacts
     *
     * @since 1.0
     */
    @Parameter( property = "mdep.overWriteReleases", defaultValue = "false" )
    private boolean overWriteReleases;

    /**
     * Overwrite snapshot artifacts
     *
     * @since 1.0
     */
    @Parameter( property = "mdep.overWriteSnapshots", defaultValue = "false" )
    private boolean overWriteSnapshots;

    /**
     * Overwrite if newer
     *
     * @since 2.0
     */
    @Parameter( property = "mdep.overIfNewer", defaultValue = "true" )
    private boolean overWriteIfNewer;

    /**
     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId, artifactId, version, type, classifier,
     * outputDirectory, destFileName, overWrite and encoding.) See Usage for details.
     *
     * @since 1.0
     */
    @Parameter
    private List<ArtifactItem> artifactItems;

    /**
     * Path to override default local repository during plugin's execution. To remove all downloaded artifacts as part
     * of the build, set this value to a location under your project's target directory
     *
     * @since 2.2
     */
    @Parameter
    private File localRepositoryDirectory;

    @Component
    private ArtifactResolver artifactResolver;

    @Component
    private RepositoryManager repositoryManager;

    @Component
    private ArtifactHandlerManager artifactHandlerManager;

    abstract ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item );

    // artifactItems is filled by either field injection or by setArtifact()
    protected void verifyRequirements()
        throws MojoFailureException
    {
        if ( artifactItems == null || artifactItems.isEmpty() )
        {
            throw new MojoFailureException( "Either artifact or artifactItems is required " );
        }
    }

    /**
     * Preprocesses the list of ArtifactItems. This method defaults the outputDirectory if not set and creates the
     * output Directory if it doesn't exist.
     *
     * @param processArtifactItemsRequest preprocessing instructions
     * @return An ArrayList of preprocessed ArtifactItems
     * @throws MojoExecutionException with a message if an error occurs.
     * @see ArtifactItem
     */
    protected List<ArtifactItem> getProcessedArtifactItems( ProcessArtifactItemsRequest processArtifactItemsRequest )
        throws MojoExecutionException
    {

        boolean removeVersion = processArtifactItemsRequest.isRemoveVersion(),
                        prependGroupId = processArtifactItemsRequest.isPrependGroupId(),
                        useBaseVersion = processArtifactItemsRequest.isUseBaseVersion();

        boolean removeClassifier = processArtifactItemsRequest.isRemoveClassifier();

        if ( artifactItems == null || artifactItems.size() < 1 )
        {
            throw new MojoExecutionException( "There are no artifactItems configured." );
        }

        for ( ArtifactItem artifactItem : artifactItems )
        {
            this.getLog().info( "Configured Artifact: " + artifactItem.toString() );

            if ( artifactItem.getOutputDirectory() == null )
            {
                artifactItem.setOutputDirectory( this.outputDirectory );
            }
            artifactItem.getOutputDirectory().mkdirs();

            // make sure we have a version.
            if ( StringUtils.isEmpty( artifactItem.getVersion() ) )
            {
                fillMissingArtifactVersion( artifactItem );
            }

            artifactItem.setArtifact( this.getArtifact( artifactItem ) );

            if ( StringUtils.isEmpty( artifactItem.getDestFileName() ) )
            {
                artifactItem.setDestFileName( DependencyUtil.getFormattedFileName( artifactItem.getArtifact(),
                                                                                removeVersion, prependGroupId,
                                                                                useBaseVersion, removeClassifier ) );
            }

            try
            {
                artifactItem.setNeedsProcessing( checkIfProcessingNeeded( artifactItem ) );
            }
            catch ( ArtifactFilterException e )
            {
                throw new MojoExecutionException( e.getMessage(), e );
            }
        }
        return artifactItems;
    }

    private boolean checkIfProcessingNeeded( ArtifactItem item )
        throws MojoExecutionException, ArtifactFilterException
    {
        return StringUtils.equalsIgnoreCase( item.getOverWrite(), "true" )
            || getMarkedArtifactFilter( item ).isArtifactIncluded( item );
    }

    /**
     * Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved
     * from the dependency list or from the DependencyManagement section of the pom.
     *
     * @param artifactItem containing information about artifact from plugin configuration.
     * @return Artifact object representing the specified file.
     * @throws MojoExecutionException with a message if the version can't be found in DependencyManagement.
     */
    protected Artifact getArtifact( ArtifactItem artifactItem )
        throws MojoExecutionException
    {
        Artifact artifact;

        try
        {
            // mdep-50 - rolledback for now because it's breaking some functionality.
            /*
             * List listeners = new ArrayList(); Set theSet = new HashSet(); theSet.add( artifact );
             * ArtifactResolutionResult artifactResolutionResult = artifactCollector.collect( theSet, project
             * .getArtifact(), managedVersions, this.local, project.getRemoteArtifactRepositories(),
             * artifactMetadataSource, null, listeners ); Iterator iter =
             * artifactResolutionResult.getArtifactResolutionNodes().iterator(); while ( iter.hasNext() ) {
             * ResolutionNode node = (ResolutionNode) iter.next(); artifact = node.getArtifact(); }
             */

            ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest();

            if ( localRepositoryDirectory != null )
            {
                buildingRequest =
                    repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryDirectory );
            }

            // Map dependency to artifact coordinate
            DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate();
            coordinate.setGroupId( artifactItem.getGroupId() );
            coordinate.setArtifactId( artifactItem.getArtifactId() );
            coordinate.setVersion( artifactItem.getVersion() );
            coordinate.setClassifier( artifactItem.getClassifier() );

            final String extension;
            ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( artifactItem.getType() );
            if ( artifactHandler != null )
            {
                extension = artifactHandler.getExtension();
            }
            else
            {
                extension = artifactItem.getType();
            }
            coordinate.setExtension( extension );

            artifact = artifactResolver.resolveArtifact( buildingRequest, coordinate ).getArtifact();
        }
        catch ( ArtifactResolverException e )
        {
            throw new MojoExecutionException( "Unable to find/resolve artifact.", e );
        }

        return artifact;
    }

    /**
     * Tries to find missing version from dependency list and dependency management. If found, the artifact is updated
     * with the correct version. It will first look for an exact match on artifactId/groupId/classifier/type and if it
     * doesn't find a match, it will try again looking for artifactId and groupId only.
     *
     * @param artifact representing configured file.
     * @throws MojoExecutionException
     */
    private void fillMissingArtifactVersion( ArtifactItem artifact )
        throws MojoExecutionException
    {
        MavenProject project = getProject();
        List<Dependency> deps = project.getDependencies();
        List<Dependency> depMngt = project.getDependencyManagement() == null ? Collections.<Dependency>emptyList()
                        : project.getDependencyManagement().getDependencies();

        if ( !findDependencyVersion( artifact, deps, false )
            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, depMngt, false ) )
            && !findDependencyVersion( artifact, deps, true )
            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, depMngt, true ) ) )
        {
            throw new MojoExecutionException( "Unable to find artifact version of " + artifact.getGroupId() + ":"
                + artifact.getArtifactId() + " in either dependency list or in project's dependency management." );
        }
    }

    /**
     * Tries to find missing version from a list of dependencies. If found, the artifact is updated with the correct
     * version.
     *
     * @param artifact representing configured file.
     * @param dependencies list of dependencies to search.
     * @param looseMatch only look at artifactId and groupId
     * @return the found dependency
     */
    private boolean findDependencyVersion( ArtifactItem artifact, List<Dependency> dependencies, boolean looseMatch )
    {
        for ( Dependency dependency : dependencies )
        {
            if ( StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
                && StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
                && ( looseMatch || StringUtils.equals( dependency.getClassifier(), artifact.getClassifier() ) )
                && ( looseMatch || StringUtils.equals( dependency.getType(), artifact.getType() ) ) )
            {
                artifact.setVersion( dependency.getVersion() );

                return true;
            }
        }

        return false;
    }

    /**
     * @return Returns the artifactItems.
     */
    public List<ArtifactItem> getArtifactItems()
    {
        return this.artifactItems;
    }

    /**
     * @param theArtifactItems The artifactItems to set.
     */
    public void setArtifactItems( List<ArtifactItem> theArtifactItems )
    {
        this.artifactItems = theArtifactItems;
    }

    /**
     * @return Returns the outputDirectory.
     */
    public File getOutputDirectory()
    {
        return this.outputDirectory;
    }

    /**
     * @param theOutputDirectory The outputDirectory to set.
     */
    public void setOutputDirectory( File theOutputDirectory )
    {
        this.outputDirectory = theOutputDirectory;
    }

    /**
     * @return Returns the overWriteIfNewer.
     */
    public boolean isOverWriteIfNewer()
    {
        return this.overWriteIfNewer;
    }

    /**
     * @param theOverWriteIfNewer The overWriteIfNewer to set.
     */
    public void setOverWriteIfNewer( boolean theOverWriteIfNewer )
    {
        this.overWriteIfNewer = theOverWriteIfNewer;
    }

    /**
     * @return Returns the overWriteReleases.
     */
    public boolean isOverWriteReleases()
    {
        return this.overWriteReleases;
    }

    /**
     * @param theOverWriteReleases The overWriteReleases to set.
     */
    public void setOverWriteReleases( boolean theOverWriteReleases )
    {
        this.overWriteReleases = theOverWriteReleases;
    }

    /**
     * @return Returns the overWriteSnapshots.
     */
    public boolean isOverWriteSnapshots()
    {
        return this.overWriteSnapshots;
    }

    /**
     * @param theOverWriteSnapshots The overWriteSnapshots to set.
     */
    public void setOverWriteSnapshots( boolean theOverWriteSnapshots )
    {
        this.overWriteSnapshots = theOverWriteSnapshots;
    }

    public void setLocalRepositoryDirectory( File localRepositoryDirectory )
    {
        this.localRepositoryDirectory = localRepositoryDirectory;
    }

    public void setArtifact( String artifact )
        throws MojoFailureException
    {
        if ( artifact != null )
        {
            String packaging = "jar";
            String classifier;
            String[] tokens = StringUtils.split( artifact, ":" );
            if ( tokens.length < 3 || tokens.length > 5 )
            {
                throw new MojoFailureException( "Invalid artifact, "
                    + "you must specify groupId:artifactId:version[:packaging[:classifier]] " + artifact );
            }
            String groupId = tokens[0];
            String artifactId = tokens[1];
            String version = tokens[2];
            if ( tokens.length >= 4 )
            {
                packaging = tokens[3];
            }
            if ( tokens.length == 5 )
            {
                classifier = tokens[4];
            }
            else
            {
                classifier = null;
            }

            ArtifactItem artifactItem = new ArtifactItem();
            artifactItem.setGroupId( groupId );
            artifactItem.setArtifactId( artifactId );
            artifactItem.setVersion( version );
            artifactItem.setType( packaging );
            artifactItem.setClassifier( classifier );

            setArtifactItems( Collections.singletonList( artifactItem ) );
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Basic Fudge</title>
      <categories>
        <cat>Desserts</cat></categories>
      <yield>1</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>3</qty>
          <unit>cups</unit></amt>
        <item>Sugar</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Vanilla Extract</item></ing>
      <ing>
        <amt>
          <qty>3</qty>
          <unit>tablespoons</unit></amt>
        <item>Hershey's Cocoa, heaping</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>tablespoon</unit></amt>
        <item>Butter</item></ing>
      <ing>
        <amt>
          <qty>1 1/2</qty>
          <unit>cups</unit></amt>
        <item>Milk</item></ing>
      <ing>
        <amt>
          <qty>1/2</qty>
          <unit>cups</unit></amt>
        <item>Pecans (opt)</item></ing></ingredients>
    <directions>
      <step>  Notes: Before you begin, be sure to fill sink half full of cold water.
  Also, butter a dinner plate (or similar dish) to the edge to pour the
  fudge on when it is done.

  In a deep, heavy bottomed pan (I use a pressure cooker pan), mix
  together sugar, cocoa and milk. Cook on high heat, stirring
  constantly to remove any lumps from cocoa and prevent burning, until
  mixture comes to a boil. Continue boiling, stirring occasionally,
  until mixture reaches soft ball stage (about 10-15 minutes) and turn
  off heat (if you have an electric stove, move pan off burner as it
  will overcook the fudge with the remaining heat on the burner). Add
  vanilla extract and butter.

  Place pan in sink of cold water to speed cooling; do not let the
  water come over the edge of the pan. Beat with spoon until fudge
  starts to thicken slightly, it will still have a glossy look to it.
  After it has cooled, remove pan from water (be sure and put a kitchen
  towel on your lap for protection as the pan will still be quite
  warm!) and continue to beat until the fudge loses its gloss and
  begins to get stiff. Add the pecans then. Beat a couple more minutes.
  Pour out onto buttered plate, scrape the sides and bottom to get as
  much on the plate as you can, let cool (if you can wait at least 10
  minutes), and it is ready to serve.

  Notes: Test for soft ball stage by dropping a partial spoonful into a
  cup of cold water. When the mixture forms a `soft' ball, it is ready
  or you can use a candy thermometer (I never have mastered those
  things). If your fudge comes out runny or a bit soft, it was
  undercooked; if it is hard and grainy, it was overcooked. Mine turns
  out all ways and we eat it.

  This recipe is *not* fail proof and it takes a lot of practice and
  patience to get the hang of it, good luck and watch the waistline!

  File ftp://ftp.idiscover.co.uk/pub/food/mealmaster/recipes/mmkah001.zip

</step></directions></recipe></recipeml>


text:
package com.amazonaws.services.kinesis.waiters;

import javax.annotation.Generated;

import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.services.kinesis.AmazonKinesis;
import com.amazonaws.services.kinesis.model.*;
import com.amazonaws.waiters.*;

import java.util.concurrent.ExecutorService;

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonKinesisWaiters {

    /**
     * Represents the service client
     */
    private final AmazonKinesis client;

    private final ExecutorService executorService = WaiterExecutorServiceFactory.buildExecutorServiceForWaiter("AmazonKinesisWaiters");

    /**
     * Constructs a new AmazonKinesisWaiters with the given client
     *
     * @param client
     *        Service client
     */
    @SdkInternalApi
    public AmazonKinesisWaiters(AmazonKinesis client) {
        this.client = client;
    }

    /**
     * Builds a StreamExists waiter by using custom parameters waiterParameters and other parameters defined in the
     * waiters specification, and then polls until it determines whether the resource entered the desired state or not,
     * where polling criteria is bound by either default polling strategy or custom polling strategy.
     */
    public Waiter<DescribeStreamRequest> streamExists() {

        return new WaiterBuilder<DescribeStreamRequest, DescribeStreamResult>().withSdkFunction(new DescribeStreamFunction(client))
                .withAcceptors(new StreamExists.IsACTIVEMatcher())
                .withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(18), new FixedDelayStrategy(10)))
                .withExecutorService(executorService).build();
    }

    /**
     * Builds a StreamNotExists waiter by using custom parameters waiterParameters and other parameters defined in the
     * waiters specification, and then polls until it determines whether the resource entered the desired state or not,
     * where polling criteria is bound by either default polling strategy or custom polling strategy.
     */
    public Waiter<DescribeStreamRequest> streamNotExists() {

        return new WaiterBuilder<DescribeStreamRequest, DescribeStreamResult>().withSdkFunction(new DescribeStreamFunction(client))
                .withAcceptors(new StreamNotExists.IsResourceNotFoundExceptionMatcher())
                .withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(18), new FixedDelayStrategy(10)))
                .withExecutorService(executorService).build();
    }

    public void shutdown() {
        executorService.shutdown();
    }
}


text:
1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Setup - The basics of getting started with postgres_xc](#setup)
    * [What postgres_xc affects](#what-postgres_xc-affects)
    * [Setup requirements](#setup-requirements)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - How to contribute to the module](#development)

##Overview

Postgres-XC (PG-XC) module. Configures a basic cluster and manages PG-XC service.

##Module Description

This module does not install PG-XC. It configures a Postgres-XC cluster on Debian system.
It adds service script.
It adds bash scripts enabling high availability.

##Setup

###What postgres_xc affects

  * PG-XC configuration file
  * PG-XC service

###Setup Requirements

PG-XC should be downloaded and compiled from source.

PG-XC configures a cluster so it needs to be declared on many nodes.

This tutorial/module is designed for a 4 machines environment.
The 4 hostnames are database1, database2, gtm and gtm2.
GTM standby is installed on gtm2

Datanode\_slave needs a ssh free password authentification between the two datanodes for data replication (by rsync)

To get High Availability the Postgres-xc documentation advises to install datanode, coordinator and gtm proxy process on the same server.
GTM and GTM standby have to be installed on two other machines.

I use "database" to indicate the node with coordinator, datanode and GTM proxy.

For more information, you should read [official PG-XC tutorial](http://postgresxc.wikia.com/wiki/Real_Server_configuration). This module configures the same cluster with a GTM standby. [(GTM standby doc)](http://postgresxc.wikia.com/wiki/GTM_Standby_Configuration). It also installs datanode slave for datanode high availability : [datanode HA configuration](http://postgresxc.wikia.com/wiki/Datanode_HA_configuration).

##Usage

### Configuring database node

On database1 :

```puppet

    class { 'postgres_xc':
      database                  => true,
      other_database_hostname   => 'database2',
      other_database_ip         => '192.168.0.2/24',
      gtm_standby_hostname      => 'gtm2',
      gtm_hostname              => 'gtm',
    }
```

On database2 :

```puppet

    class { 'postgres_xc':
      database                => true,
      other_database_hostname => 'database1',
      other_database_ip       => '192.168.0.1/24',
      gtm_standby_hostname    => 'gtm2',
      gtm_hostname            => 'gtm',
    }
```
### Configuring GTM node

On gtm :

```puppet

    class { 'postgres_xc':
      gtm     => true,
    }
```

### Configuring GTM standby node

On gtm2 :

```puppet

    class { 'postgres_xc':
      gtm_standby     => true,
      gtm_hostname    => 'gtm',
    }
```

##Reference

###Classes

  * postgres_xc: Handles all nodes.
  * postgres_xc::database: Handles database node.
  * postgres_xc::gtm: Handles GTM node.
  * postgres_xc::gtm_standby: Handles GTM standby node.
  * postgres_xc::coordinator: Handles coordinator process.
  * postgres_xc::datanode: Handles datanode process.
  * postgres_xc::datanode_slave: Handles datanode_slave process.
  * postgres_xc::gtm_proxy: Handles GTM proxy process.

###Parameters

####`super_user`
   PG-XC processes will be launched under this user.
    If $super_user doesn't exist, it will creates it.
   default : postgres

####`user`
   Create a user named with this parameter.
   default : echoes

####`password`
   Password for the user.
   default : echoes

####`group`
   super_user's group.
   default : postgres

####`home`
   super_user's home directory.
   default : /var/lib/postgresql

####`gtm_port`
   Listening port for gtm process.
   default : 7777

####`gtm_proxy_port`
   Listening port for gtm_proxy process.
   default : 7777

####`datanode_port`
   Listening port of datanode process.
   default : 5555

####`datanode_slave_port`
   Listening port of datanode_slave process.
   default : 20010

####`coordinator_port`
   Listening port for coordinator process.
   default : 5432 (default postgreSQL port)

####`gtm_directory`
   Directory where gtm will be initialise.
   default : "$home/gtm"

####`datanode_directory`
   Directory where datanode will be initialised.
   default : "$home/datanode"

####`coordinator_directory`
   Directory where coordinator will be initialised.
   default : "$home/coord"

####`gtm_proxy_directory`
   Directory where gtm proxy will be initialised.
   default : "$home/gtm_proxy"

####`gtm_standby_directory`
   Directory where gtm standby will be initialised.
   default : "$home/gtm_standby"

####`gtm_name`
   Name of GTM node in configuration file.
   default : gtm

####`gtm_standby_name`
   Name of GTM standby node in configuration file.

####`datanode_slave`
   Boolean to install datanode_slave or not
   default : true

##Limitations

This module has been tested only on Debian sytems.

##Development

Bug can be reported on [Github issues tracker](https://github.com/echoes-tech/puppet-postgres_xc/issues)

###Changelog

v0.2.0 Support datanode slave


text:
//
//      Copyright (C) DataStax Inc.
//
//   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.
//
using System;
using System.Numerics;

namespace Cassandra.Serialization.Primitive
{
    public class DecimalSerializer : TypeSerializer<decimal>
    {
        public override ColumnTypeCode CqlType
        {
            get { return ColumnTypeCode.Decimal; }
        }

        public override decimal Deserialize(ushort protocolVersion, byte[] buffer, int offset, int length, IColumnInfo typeInfo)
        {
            var scale = BeConverter.ToInt32(buffer, offset);
            var unscaledBytes = Utils.SliceBuffer(buffer, offset + 4, length - 4);
            if (BitConverter.IsLittleEndian)
            {
                Array.Reverse(unscaledBytes);
            }
            return ToDecimal(new BigInteger(unscaledBytes), scale);
        }

        internal static decimal ToDecimal(BigInteger unscaledValue, int scale)
        {
            if (scale < -28 || scale > 28)
            {
                //Scale representation is an int, but System.Decimal only supports a scale from -28 to 28
                throw new ArgumentOutOfRangeException(
                    "scale", scale, "CLR Decimal structure can not represent numbers with a scale greater than 28");
            }
            if (scale < 0)
            {
                try
                {
                    return (decimal) (unscaledValue*BigInteger.Pow(new BigInteger(10), Math.Abs(scale)));
                }
                catch (OverflowException)
                {
                    throw new ArgumentOutOfRangeException(
                        "unscaledValue",
                        unscaledValue*BigInteger.Pow(new BigInteger(10), Math.Abs(scale)),
                        "Value can not be represented as a CLR Decimal");
                }
            }
            var isNegative = unscaledValue < 0;
            unscaledValue = BigInteger.Abs(unscaledValue);
            var bigintBytes = unscaledValue.ToByteArray();
            if (bigintBytes.Length > 13 || (bigintBytes.Length == 13 && bigintBytes[12] != 0))
            {
                throw new ArgumentOutOfRangeException(
                    "unscaledValue", unscaledValue, "Value can not be represented as a CLR Decimal");
            }
            var intArray = new int[3];
            Buffer.BlockCopy(bigintBytes, 0, intArray, 0, Math.Min(12, bigintBytes.Length));
            return new decimal(intArray[0], intArray[1], intArray[2], isNegative, (byte)scale);
        }

        public override byte[] Serialize(ushort protocolVersion, decimal value)
        {
            int[] bits = decimal.GetBits(value);
            int scale = (bits[3] >> 16) & 31;
            byte[] scaleBytes = BeConverter.GetBytes(scale);
            var bigintBytes = new byte[13]; // 13th byte is for making sure that the number is positive
            Buffer.BlockCopy(bits, 0, bigintBytes, 0, 12);
            var bigInteger = new BigInteger(bigintBytes);
            if (value < 0)
            {
                bigInteger = -bigInteger;
            }

            bigintBytes = bigInteger.ToByteArray();
            Array.Reverse(bigintBytes);
            var resultBytes = new byte[scaleBytes.Length + bigintBytes.Length];
            Array.Copy(scaleBytes, resultBytes, scaleBytes.Length);
            Array.Copy(bigintBytes, 0, resultBytes, scaleBytes.Length, bigintBytes.Length);
            return resultBytes;
        }
    }
}


text:
import asyncio
import collections
import warnings
from types import TracebackType
from typing import (
    Any,
    Awaitable,
    Callable,
    Deque,
    Generator,
    Optional,
    Set,
    Type,
)

import async_timeout
import psycopg2.extensions

from .connection import TIMEOUT, Connection, Cursor, connect
from .utils import _ContextManager, create_completed_future, get_running_loop

def create_pool(
    dsn: Optional[str] = None,
    *,
    minsize: int = 1,
    maxsize: int = 10,
    timeout: float = TIMEOUT,
    pool_recycle: float = -1.0,
    enable_json: bool = True,
    enable_hstore: bool = True,
    enable_uuid: bool = True,
    echo: bool = False,
    on_connect: Optional[Callable[[Connection], Awaitable[None]]] = None,
    **kwargs: Any,
) -> _ContextManager["Pool"]:
    coro = Pool.from_pool_fill(
        dsn,
        minsize,
        maxsize,
        timeout,
        enable_json=enable_json,
        enable_hstore=enable_hstore,
        enable_uuid=enable_uuid,
        echo=echo,
        on_connect=on_connect,
        pool_recycle=pool_recycle,
        **kwargs,
    )
    return _ContextManager[Pool](coro, _destroy_pool)

async def _destroy_pool(pool: "Pool") -> None:
    pool.close()
    await pool.wait_closed()

class _PoolConnectionContextManager:
    """Context manager.

    This enables the following idiom for acquiring and releasing a
    connection around a block:

        async with pool as conn:
            cur = await conn.cursor()

    while failing loudly when accidentally using:

        with pool:
            <block>
    """

    __slots__ = ("_pool", "_conn")

    def __init__(self, pool: "Pool", conn: Connection):
        self._pool: Optional[Pool] = pool
        self._conn: Optional[Connection] = conn

    def __enter__(self) -> Connection:
        assert self._conn
        return self._conn

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        if self._pool is None or self._conn is None:
            return
        try:
            self._pool.release(self._conn)
        finally:
            self._pool = None
            self._conn = None

    async def __aenter__(self) -> Connection:
        assert self._conn
        return self._conn

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        if self._pool is None or self._conn is None:
            return
        try:
            await self._pool.release(self._conn)
        finally:
            self._pool = None
            self._conn = None

class _PoolCursorContextManager:
    """Context manager.

    This enables the following idiom for acquiring and releasing a
    cursor around a block:

        async with pool.cursor() as cur:
            await cur.execute("SELECT 1")

    while failing loudly when accidentally using:

        with pool:
            <block>
    """

    __slots__ = ("_pool", "_conn", "_cursor")

    def __init__(self, pool: "Pool", conn: Connection, cursor: Cursor):
        self._pool = pool
        self._conn = conn
        self._cursor = cursor

    def __enter__(self) -> Cursor:
        return self._cursor

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        try:
            self._cursor.close()
        except psycopg2.ProgrammingError:
            # seen instances where the cursor fails to close:
            #   https://github.com/aio-libs/aiopg/issues/364
            # We close it here so we don't return a bad connection to the pool
            self._conn.close()
            raise
        finally:
            try:
                self._pool.release(self._conn)
            finally:
                self._pool = None  # type: ignore
                self._conn = None  # type: ignore
                self._cursor = None  # type: ignore

class Pool:
    """Connection pool"""

    def __init__(
        self,
        dsn: str,
        minsize: int,
        maxsize: int,
        timeout: float,
        *,
        enable_json: bool,
        enable_hstore: bool,
        enable_uuid: bool,
        echo: bool,
        on_connect: Optional[Callable[[Connection], Awaitable[None]]],
        pool_recycle: float,
        **kwargs: Any,
    ):
        if minsize < 0:
            raise ValueError("minsize should be zero or greater")
        if maxsize < minsize and maxsize != 0:
            raise ValueError("maxsize should be not less than minsize")
        self._dsn = dsn
        self._minsize = minsize
        self._loop = get_running_loop()
        self._timeout = timeout
        self._recycle = pool_recycle
        self._enable_json = enable_json
        self._enable_hstore = enable_hstore
        self._enable_uuid = enable_uuid
        self._echo = echo
        self._on_connect = on_connect
        self._conn_kwargs = kwargs
        self._acquiring = 0
        self._free: Deque[Connection] = collections.deque(
            maxlen=maxsize or None
        )
        self._cond = asyncio.Condition()
        self._used: Set[Connection] = set()
        self._terminated: Set[Connection] = set()
        self._closing = False
        self._closed = False

    @property
    def echo(self) -> bool:
        return self._echo

    @property
    def minsize(self) -> int:
        return self._minsize

    @property
    def maxsize(self) -> Optional[int]:
        return self._free.maxlen

    @property
    def size(self) -> int:
        return self.freesize + len(self._used) + self._acquiring

    @property
    def freesize(self) -> int:
        return len(self._free)

    @property
    def timeout(self) -> float:
        return self._timeout

    async def clear(self) -> None:
        """Close all free connections in pool."""
        async with self._cond:
            while self._free:
                conn = self._free.popleft()
                await conn.close()
            self._cond.notify()

    @property
    def closed(self) -> bool:
        return self._closed

    def close(self) -> None:
        """Close pool.

        Mark all pool connections to be closed on getting back to pool.
        Closed pool doesn't allow to acquire new connections.
        """
        if self._closed:
            return
        self._closing = True

    def terminate(self) -> None:
        """Terminate pool.

        Close pool with instantly closing all acquired connections also.
        """

        self.close()

        for conn in list(self._used):
            conn.close()
            self._terminated.add(conn)

        self._used.clear()

    async def wait_closed(self) -> None:
        """Wait for closing all pool's connections."""

        if self._closed:
            return
        if not self._closing:
            raise RuntimeError(
                ".wait_closed() should be called " "after .close()"
            )

        while self._free:
            conn = self._free.popleft()
            await conn.close()

        async with self._cond:
            while self.size > self.freesize:
                await self._cond.wait()

        self._closed = True

    def acquire(self) -> _ContextManager[Connection]:
        """Acquire free connection from the pool."""
        coro = self._acquire()
        return _ContextManager[Connection](coro, self.release)

    @classmethod
    async def from_pool_fill(cls, *args: Any, **kwargs: Any) -> "Pool":
        """constructor for filling the free pool with connections,
        the number is controlled by the minsize parameter
        """
        self = cls(*args, **kwargs)
        if self._minsize > 0:
            async with self._cond:
                await self._fill_free_pool(False)

        return self

    async def _acquire(self) -> Connection:
        if self._closing:
            raise RuntimeError("Cannot acquire connection after closing pool")
        async with async_timeout.timeout(self._timeout), self._cond:
            while True:
                await self._fill_free_pool(True)
                if self._free:
                    conn = self._free.popleft()
                    assert not conn.closed, conn
                    assert conn not in self._used, (conn, self._used)
                    self._used.add(conn)
                    return conn
                else:
                    await self._cond.wait()

    async def _fill_free_pool(self, override_min: bool) -> None:
        # iterate over free connections and remove timeouted ones
        n, free = 0, len(self._free)
        while n < free:
            conn = self._free[-1]
            if conn.closed:
                self._free.pop()
            elif -1 < self._recycle < self._loop.time() - conn.last_usage:
                await conn.close()
                self._free.pop()
            else:
                self._free.rotate()
            n += 1

        while self.size < self.minsize:
            self._acquiring += 1
            try:
                conn = await connect(
                    self._dsn,
                    timeout=self._timeout,
                    enable_json=self._enable_json,
                    enable_hstore=self._enable_hstore,
                    enable_uuid=self._enable_uuid,
                    echo=self._echo,
                    **self._conn_kwargs,
                )
                if self._on_connect is not None:
                    await self._on_connect(conn)
                # raise exception if pool is closing
                self._free.append(conn)
                self._cond.notify()
            finally:
                self._acquiring -= 1
        if self._free:
            return

        if override_min and (not self.maxsize or self.size < self.maxsize):
            self._acquiring += 1
            try:
                conn = await connect(
                    self._dsn,
                    timeout=self._timeout,
                    enable_json=self._enable_json,
                    enable_hstore=self._enable_hstore,
                    enable_uuid=self._enable_uuid,
                    echo=self._echo,
                    **self._conn_kwargs,
                )
                if self._on_connect is not None:
                    await self._on_connect(conn)
                # raise exception if pool is closing
                self._free.append(conn)
                self._cond.notify()
            finally:
                self._acquiring -= 1

    async def _wakeup(self) -> None:
        async with self._cond:
            self._cond.notify()

    def release(self, conn: Connection) -> "asyncio.Future[None]":
        """Release free connection back to the connection pool."""
        future = create_completed_future(self._loop)
        if conn in self._terminated:
            assert conn.closed, conn
            self._terminated.remove(conn)
            return future
        assert conn in self._used, (conn, self._used)
        self._used.remove(conn)
        if conn.closed:
            return future
        transaction_status = conn.raw.get_transaction_status()
        if transaction_status != psycopg2.extensions.TRANSACTION_STATUS_IDLE:
            warnings.warn(
                f"Invalid transaction status on "
                f"released connection: {transaction_status}",
                ResourceWarning,
            )
            conn.close()
            return future
        if self._closing:
            conn.close()
        else:
            self._free.append(conn)
        return asyncio.ensure_future(self._wakeup(), loop=self._loop)

    async def cursor(
        self,
        name: Optional[str] = None,
        cursor_factory: Any = None,
        scrollable: Optional[bool] = None,
        withhold: bool = False,
        *,
        timeout: Optional[float] = None,
    ) -> _PoolCursorContextManager:
        conn = await self.acquire()
        cursor = await conn.cursor(
            name=name,
            cursor_factory=cursor_factory,
            scrollable=scrollable,
            withhold=withhold,
            timeout=timeout,
        )
        return _PoolCursorContextManager(self, conn, cursor)

    def __await__(self) -> Generator[Any, Any, _PoolConnectionContextManager]:
        # This is not a coroutine.  It is meant to enable the idiom:
        #
        #     with (await pool) as conn:
        #         <block>
        #
        # as an alternative to:
        #
        #     conn = await pool.acquire()
        #     try:
        #         <block>
        #     finally:
        #         conn.release()
        conn = yield from self._acquire().__await__()
        return _PoolConnectionContextManager(self, conn)

    def __enter__(self) -> "Pool":
        raise RuntimeError(
            '"await" should be used as context manager expression'
        )

    def __exit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        # This must exist because __enter__ exists, even though that
        # always raises; that's how the with-statement works.
        pass  # pragma: nocover

    async def __aenter__(self) -> "Pool":
        return self

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        tb: Optional[TracebackType],
    ) -> None:
        self.close()
        await self.wait_closed()

    def __del__(self) -> None:
        try:
            self._free
        except AttributeError:
            return  # frame has been cleared, __dict__ is empty
        if self._free:
            left = 0
            while self._free:
                conn = self._free.popleft()
                conn.close()
                left += 1
            warnings.warn(
                f"Unclosed {left} connections in {self!r}", ResourceWarning
            )


text: package protoutil


text:
import {MemorySlice} from '../MemorySlice';
import {Message} from './Message'
import {Checksum} from "../Checksum";
import {startsWith} from "../../util/text";

export class Step {
  static MIN_PRESSURE = 0;
  static MAX_PRESSURE = 140;
  static MIN_TIME = 0;
  static MAX_TIME = 600;

  duration:number; //deciseconds (e.g. a value of 180 here is 18.0 seconds)
  pressure:number; //decibars (e.g. a value of 90 here is 9.0 bars)

  constructor(duration:number, pressure:number) {
    this.duration = duration;
    this.pressure = pressure;
  }

  toString():string {
    return `[${this.duration / 10}s@${this.pressure / 10}b]`;
  }

}

export class PressureProfile {

  steps:Step[];

  constructor(steps:Step[]) {
    //TODO: validate steps
    this.steps = steps;
  }

  toString():string {
    return '[' + this.steps.map(String).join(',') + ']';
  }

  static DEFAULT_PROFILE_A() {
    return new PressureProfile([
      new Step(60, 40),
      new Step(180, 90),
      new Step(60, 50),
      new Step(0, 0),
      new Step(0, 0),
    ]);
  }

  static DEFAULT_PROFILE_B() {
    return new PressureProfile([
      new Step(80, 40),
      new Step(220, 90),
      new Step(0, 0),
      new Step(0, 0),
      new Step(0, 0),
    ]);
  }

  static DEFAULT_PROFILE_C() {
    return new PressureProfile([
      new Step(200, 90),
      new Step(100, 50),
      new Step(0, 0),
      new Step(0, 0),
      new Step(0, 0),
    ]);
  }

}

export enum TemperatureUnit {
  Celsius = 0,
  Fahrenheit = 1
}
export enum WaterSource {
  PlumbedIn = 0,
  Tank = 1
}

const MIN_COFFEE_TEMP_CELSIUS = 85;
const MAX_COFFEE_TEMP_CELSIUS = 115;
const MIN_COFFEE_TEMP_FAHRENHEIT = 185;
const MAX_COFFEE_TEMP_FAHRENHEIT = 239;

const MIN_STEAM_TEMP_CELSIUS = 115;
const MAX_STEAM_TEMP_CELSIUS = 125;
const MIN_STEAM_TEMP_FAHRENHEIT = 239;
const MAX_STEAM_TEMP_FAHRENHEIT = 257;

export class PIDConstants {
  proportional:number;
  integral:number;
  derivative:number;

  constructor(proportional:number, integral:number, derivative:number) {
    this.proportional = proportional;
    this.integral = integral;
    this.derivative = derivative;
  }
}

export class TimeOfDay {
  hours:number; //TODO: what is range?
  minutes:number; //0-59
  constructor(hours:number, minutes:number) {
    this.hours = hours;
    this.minutes = minutes;
  }
}

export enum DayOfWeek {
  Unknown = 0,
  Monday = 1,
  Tuesday = 2,
  Wednesday = 3,
  Thursday = 4,
  Friday = 5,
  Saturday = 6,
  Sunday = 7
}

export enum Language {
  English = 0,
  German = 1,
  French = 2,
  Italian = 3
}

export class MachineState {
  coffeeCyclesSubtotal:number;
  coffeeCyclesTotal:number;

  pressureA:PressureProfile = PressureProfile.DEFAULT_PROFILE_A();
  pressureB:PressureProfile = PressureProfile.DEFAULT_PROFILE_B();
  pressureC:PressureProfile = PressureProfile.DEFAULT_PROFILE_C();
  activeProfile:number = 0; //0

  //misc settings
  language:Language = Language.English;
  isServiceBoilerOn:boolean = null; //false
  isMachineInStandby:boolean = null; //false
  waterSource:WaterSource = WaterSource.Tank;

  temperatureUnit:TemperatureUnit = TemperatureUnit.Celsius;
  coffeeTemperature:number = 105; //depends on temperatureUnit
  steamTemperature:number = 123; //depends on temperatureUnit
  steamCleanTime:number;

  coffeePID:PIDConstants;
  groupPID:PIDConstants;
  mysteryPID:PIDConstants;

  autoOnTime:TimeOfDay;
  autoStandbyTime:TimeOfDay;
  autoSkipDay:DayOfWeek;
}

export class BinaryFormat {

  static parse(bytes:MemorySlice) {
    let state = new MachineState();
    state.temperatureUnit = (bytes.getByte(0) === 0) ? TemperatureUnit.Celsius : TemperatureUnit.Fahrenheit;
    state.language = bytes.getByte(1); //TODO: validate?
    state.coffeeTemperature = bytes.getByte(2);
    state.steamTemperature = bytes.getByte(3);
    state.coffeePID = this.parsePIDConstants(bytes, 4); //4-5, 10-11, 16-17
    state.groupPID = this.parsePIDConstants(bytes, 6); //6-7, 12-13, 18-19
    state.mysteryPID = this.parsePIDConstants(bytes, 8); //8-9, 14-15, 20-21
    state.pressureA = this.parsePressureProfile(bytes, 22); //22-36
    state.pressureB = this.parsePressureProfile(bytes, 38); //38-52
    state.pressureC = this.parsePressureProfile(bytes, 54); //54-68
    state.waterSource = (bytes.getByte(70) === 0) ? WaterSource.PlumbedIn : WaterSource.Tank;
    state.activeProfile = bytes.getByte(71);
    state.steamCleanTime = bytes.getByte(72);
    state.isServiceBoilerOn = bytes.getBoolean(73);
    state.isMachineInStandby = bytes.getBoolean(74);
    state.coffeeCyclesSubtotal = bytes.getShort(75); //75-76
    state.coffeeCyclesTotal = bytes.getInt(77); //77-80
    state.autoOnTime = new TimeOfDay(bytes.getByte(81), bytes.getByte(82));
    state.autoStandbyTime = new TimeOfDay(bytes.getByte(83), bytes.getByte(84));
    state.autoSkipDay = bytes.getByte(85);
    return state;
  }

  static serialize(state:MachineState):MemorySlice {
    let bytes = MemorySlice.ofLength(100, 0); //100 bytes, initialized to 0
    bytes.setByte(0, state.temperatureUnit);
    bytes.setByte(1, state.language);
    bytes.setByte(2, state.coffeeTemperature);
    bytes.setByte(3, state.steamTemperature);
    this.writePIDConstants(bytes, state.coffeePID, 4);
    this.writePIDConstants(bytes, state.groupPID, 6);
    this.writePIDConstants(bytes, state.mysteryPID, 8);
    this.writePressureProfile(bytes, state.pressureA, 22);
    this.writePressureProfile(bytes, state.pressureB, 38);
    this.writePressureProfile(bytes, state.pressureC, 54);
    bytes.setByte(70, state.waterSource);
    bytes.setByte(71, state.activeProfile);
    bytes.setByte(72, state.steamCleanTime);
    bytes.setBoolean(73, state.isServiceBoilerOn);
    bytes.setBoolean(74, state.isMachineInStandby);
    bytes.setShort(75, state.coffeeCyclesSubtotal);
    bytes.setInt(77, state.coffeeCyclesTotal);
    bytes.setByte(81, state.autoOnTime.hours);
    bytes.setByte(82, state.autoOnTime.minutes);
    bytes.setByte(83, state.autoStandbyTime.hours);
    bytes.setByte(84, state.autoStandbyTime.minutes);
    bytes.setByte(85, state.autoSkipDay);
    return bytes;
  }

  static parsePIDConstants(bytes:MemorySlice, offset:number):PIDConstants {
    let p = bytes.getShort(offset);
    let i = bytes.getShort(offset + 6);
    let d = bytes.getShort(offset + 12);
    return new PIDConstants(p, i, d);
  }

  static writePIDConstants(bytes:MemorySlice, pid:PIDConstants, offset:number) {
    bytes.setShort(offset, pid.proportional);
    bytes.setShort(offset + 6, pid.integral);
    bytes.setShort(offset + 12, pid.derivative);
  }

  static parsePressureProfile(bytes:MemorySlice, offset:number):PressureProfile {
    return new PressureProfile([
      new Step(bytes.getShort(offset + 0), bytes.getByte(offset + 10)),
      new Step(bytes.getShort(offset + 2), bytes.getByte(offset + 11)),
      new Step(bytes.getShort(offset + 4), bytes.getByte(offset + 12)),
      new Step(bytes.getShort(offset + 6), bytes.getByte(offset + 13)),
      new Step(bytes.getShort(offset + 8), bytes.getByte(offset + 14)),
    ]);
  }

  static writePressureProfile(bytes:MemorySlice, profile:PressureProfile, offset:number) {
    for (let i = 0; i < 5; i++) {
      let step = profile.steps[i];
      bytes.setShort(offset + (2 * i), step.duration);
      bytes.setByte(offset + 10 + i, step.pressure);
    }
  }
}

export class MachineStateReadResult extends Message {
  state:MachineState;

  constructor(rawMessageWithChecksum:string) {
    super(rawMessageWithChecksum);

    if (!MachineStateReadResult.looksValid(rawMessageWithChecksum)) {
      throw new RangeError('Provided message does not appear to be a machine state response');
    }
    //remove the four preamble bytes
    this.state = BinaryFormat.parse(this.bytes.slice(4));

  }

  static looksValid(rawMessageWithChecksum:string):boolean {
    return Checksum.verify(rawMessageWithChecksum)
      && startsWith(rawMessageWithChecksum, 'r00000073');
  }

}


text:
#ifndef __GLNullStateCacheManagerImp_H__
#define __GLNullStateCacheManagerImp_H__

#include "OgreGLPrerequisites.h"

typedef Ogre::GeneralAllocatedObject StateCacheAlloc;

namespace Ogre
{
    /** An in memory cache of the OpenGL state.
     @see GLStateCacheManager
     */
    class GLStateCacheManagerImp : public StateCacheAlloc
    {
    private:
        /// Stores the current clear colour
        vector<GLclampf>::type mClearColour;
        /// Stores the current colour write mask
        vector<GLboolean>::type mColourMask;
        /// Stores the current depth write mask
        GLboolean mDepthMask;
        /// Stores the current polygon rendering mode
        GLenum mPolygonMode;
        /// Stores the current blend equation
        GLenum mBlendEquation;
        /// Stores the current blend source function
        GLenum mBlendFuncSource;
        /// Stores the current blend destination function
        GLenum mBlendFuncDest;
        /// Stores the current face culling setting
        GLenum mCullFace;
        /// Stores the current depth test function
        GLenum mDepthFunc;
        /// Stores the current stencil mask
        GLuint mStencilMask;
        /// Stores the currently active texture unit
        size_t mActiveTextureUnit;
        /// Mask of buffers who contents can be discarded if GL_EXT_discard_framebuffer is supported
        unsigned int mDiscardBuffers;
        /// Stores the current depth clearing colour
        GLclampf mClearDepth;
        /// Viewport origin and size
        int mViewport[4];

        GLenum mBlendEquationRGB;
        GLenum mBlendEquationAlpha;
        GLenum mShadeModel;

        GLfloat mAmbient[4];
        GLfloat mDiffuse[4];
        GLfloat mSpecular[4];
        GLfloat mEmissive[4];
        GLfloat mLightAmbient[4];
        GLfloat mShininess;

        GLfloat mPointSize;
        GLfloat mPointSizeMin;
        GLfloat mPointSizeMax;
        GLfloat mPointAttenuation[3];

    public:
        GLStateCacheManagerImp(void);
        ~GLStateCacheManagerImp(void);

        /// See GLStateCacheManager.initializeCache.
        void initializeCache();

        /// See GLStateCacheManager.clearCache.
        void clearCache();

        /// See GLStateCacheManager.bindGLBuffer.
        void bindGLBuffer(GLenum target, GLuint buffer, bool force = false);

        /// See GLStateCacheManager.deleteGLBuffer.
        void deleteGLBuffer(GLenum target, GLuint buffer, bool force = false);

        /// See GLStateCacheManager.bindGLTexture.
        void bindGLTexture(GLenum target, GLuint texture);

        /// See GLStateCacheManager.setTexParameteri.
        void setTexParameteri(GLenum target, GLenum pname, GLint param);

        /// See GLStateCacheManager.invalidateStateForTexture.
        void invalidateStateForTexture(GLuint texture);

        /// See GLStateCacheManager.activateGLTextureUnit.
        bool activateGLTextureUnit(size_t unit);

        /// See GLStateCacheManager.getBlendEquation.
        GLenum getBlendEquation(void) const { return mBlendEquation; }

        /// See GLStateCacheManager.setBlendEquation.
        void setBlendEquation(GLenum eq);

        /// Set the blend equation for RGB and alpha separately.
        void setBlendEquation(GLenum eqRGB, GLenum eqA);

        /// See GLStateCacheManager.setBlendFunc.
        void setBlendFunc(GLenum source, GLenum dest);

        /// See GLStateCacheManager.setShadeModel.
        void setShadeModel(GLenum model);

        /// See GLStateCacheManager.setLightAmbient.
        void setLightAmbient(GLfloat r, GLfloat g, GLfloat b);

        /// See GLStateCacheManager.getDepthMask.
        GLboolean getDepthMask(void) const { return mDepthMask; }

        /// See GLStateCacheManager.setDepthMask.
        void setDepthMask(GLboolean mask);

        /// See GLStateCacheManager.getDepthFunc.
        GLenum getDepthFunc(void) const { return mDepthFunc; }

        /// See GLStateCacheManager.setDepthFunc.
        void setDepthFunc(GLenum func);

        /// See GLStateCacheManager.getClearDepth.
        GLclampf getClearDepth(void) const { return mClearDepth; }

        /// See GLStateCacheManager.setClearDepth.
        void setClearDepth(GLclampf depth);

        /// See GLStateCacheManager.setClearColour.
        void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);

        /// See GLStateCacheManager.getColourMask.
        vector<GLboolean>::type & getColourMask(void) { return mColourMask; }

        /// See GLStateCacheManager.setColourMask.
        void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);

        /// See GLStateCacheManager.getStencilMask.
        GLuint getStencilMask(void) const { return mStencilMask; }

        /// See GLStateCacheManager.setStencilMask.
        void setStencilMask(GLuint mask);

        /// See GLStateCacheManager.setEnabled.
        void setEnabled(GLenum flag, bool enabled);

        /// See GLStateCacheManager.getDiscardBuffers.
        unsigned int getDiscardBuffers(void) const { return mDiscardBuffers; }

        /// See GLStateCacheManager.setDiscardBuffers.
        void setDiscardBuffers(unsigned int flags) { mDiscardBuffers = flags; }

        /// See GLStateCacheManager.getPolygonMode.
        GLenum getPolygonMode(void) const { return mPolygonMode; }

        /// See GLStateCacheManager.setPolygonMode.
        void setPolygonMode(GLenum mode);

        /// See GLStateCacheManager.getCullFace.
        GLenum getCullFace(void) const { return mCullFace; }

        /// See GLStateCacheManager.setCullFace.
        void setCullFace(GLenum face);

        /// Enable the specified texture coordinate generation option for the currently active texture unit
        void enableTextureCoordGen(GLenum type);
        /// Disable the specified texture coordinate generation option for the currently active texture unit
        void disableTextureCoordGen(GLenum type);

        // Set material lighting parameters
        void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
        void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
        void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
        void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
        void setMaterialShininess(GLfloat shininess);
        void setPointSize(GLfloat size);
        void setPointParameters(GLfloat* attenuation, float minSize, float maxSize);

        /// Set viewport parameters
        void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);

        /// Get viewport parameters
        void getViewport(int* array);
    };
}

#endif