text:
package sarama

type fetchRequestBlock struct {
	Version int16
	// currentLeaderEpoch contains the current leader epoch of the partition.
	currentLeaderEpoch int32
	// fetchOffset contains the message offset.
	fetchOffset int64
	// logStartOffset contains the earliest available offset of the follower
	// replica.  The field is only used when the request is sent by the
	// follower.
	logStartOffset int64
	// maxBytes contains the maximum bytes to fetch from this partition.  See
	// KIP-74 for cases where this limit may not be honored.
	maxBytes int32
}

func (b *fetchRequestBlock) encode(pe packetEncoder, version int16) error {
	b.Version = version
	if b.Version >= 9 {
		pe.putInt32(b.currentLeaderEpoch)
	}
	pe.putInt64(b.fetchOffset)
	if b.Version >= 5 {
		pe.putInt64(b.logStartOffset)
	}
	pe.putInt32(b.maxBytes)
	return nil
}

func (b *fetchRequestBlock) decode(pd packetDecoder, version int16) (err error) {
	b.Version = version
	if b.Version >= 9 {
		if b.currentLeaderEpoch, err = pd.getInt32(); err != nil {
			return err
		}
	}
	if b.fetchOffset, err = pd.getInt64(); err != nil {
		return err
	}
	if b.Version >= 5 {
		if b.logStartOffset, err = pd.getInt64(); err != nil {
			return err
		}
	}
	if b.maxBytes, err = pd.getInt32(); err != nil {
		return err
	}
	return nil
}

// FetchRequest (API key 1) will fetch Kafka messages. Version 3 introduced the MaxBytes field. See
// https://issues.apache.org/jira/browse/KAFKA-2063 for a discussion of the issues leading up to that.  The KIP is at
// https://cwiki.apache.org/confluence/display/KAFKA/KIP-74%3A+Add+Fetch+Response+Size+Limit+in+Bytes
type FetchRequest struct {
	// Version defines the protocol version to use for encode and decode
	Version int16
	// ReplicaID contains the broker ID of the follower, of -1 if this request
	// is from a consumer.
	// ReplicaID int32
	// MaxWaitTime contains the maximum time in milliseconds to wait for the response.
	MaxWaitTime int32
	// MinBytes contains the minimum bytes to accumulate in the response.
	MinBytes int32
	// MaxBytes contains the maximum bytes to fetch.  See KIP-74 for cases
	// where this limit may not be honored.
	MaxBytes int32
	// Isolation contains a This setting controls the visibility of
	// transactional records. Using READ_UNCOMMITTED (isolation_level = 0)
	// makes all records visible. With READ_COMMITTED (isolation_level = 1),
	// non-transactional and COMMITTED transactional records are visible. To be
	// more concrete, READ_COMMITTED returns all data from offsets smaller than
	// the current LSO (last stable offset), and enables the inclusion of the
	// list of aborted transactions in the result, which allows consumers to
	// discard ABORTED transactional records
	Isolation IsolationLevel
	// SessionID contains the fetch session ID.
	SessionID int32
	// SessionEpoch contains the epoch of the partition leader as known to the
	// follower replica or a consumer.
	SessionEpoch int32
	// blocks contains the topics to fetch.
	blocks map[string]map[int32]*fetchRequestBlock
	// forgotten contains in an incremental fetch request, the partitions to remove.
	forgotten map[string][]int32
	// RackID contains a Rack ID of the consumer making this request
	RackID string
}

type IsolationLevel int8

const (
	ReadUncommitted IsolationLevel = iota
	ReadCommitted
)

func (r *FetchRequest) encode(pe packetEncoder) (err error) {
	metricRegistry := pe.metricRegistry()

	pe.putInt32(-1) // ReplicaID is always -1 for clients
	pe.putInt32(r.MaxWaitTime)
	pe.putInt32(r.MinBytes)
	if r.Version >= 3 {
		pe.putInt32(r.MaxBytes)
	}
	if r.Version >= 4 {
		pe.putInt8(int8(r.Isolation))
	}
	if r.Version >= 7 {
		pe.putInt32(r.SessionID)
		pe.putInt32(r.SessionEpoch)
	}
	err = pe.putArrayLength(len(r.blocks))
	if err != nil {
		return err
	}
	for topic, blocks := range r.blocks {
		err = pe.putString(topic)
		if err != nil {
			return err
		}
		err = pe.putArrayLength(len(blocks))
		if err != nil {
			return err
		}
		for partition, block := range blocks {
			pe.putInt32(partition)
			err = block.encode(pe, r.Version)
			if err != nil {
				return err
			}
		}
		getOrRegisterTopicMeter("consumer-fetch-rate", topic, metricRegistry).Mark(1)
	}
	if r.Version >= 7 {
		err = pe.putArrayLength(len(r.forgotten))
		if err != nil {
			return err
		}
		for topic, partitions := range r.forgotten {
			err = pe.putString(topic)
			if err != nil {
				return err
			}
			err = pe.putArrayLength(len(partitions))
			if err != nil {
				return err
			}
			for _, partition := range partitions {
				pe.putInt32(partition)
			}
		}
	}
	if r.Version >= 11 {
		err = pe.putString(r.RackID)
		if err != nil {
			return err
		}
	}

	return nil
}

func (r *FetchRequest) decode(pd packetDecoder, version int16) (err error) {
	r.Version = version

	if _, err = pd.getInt32(); err != nil {
		return err
	}
	if r.MaxWaitTime, err = pd.getInt32(); err != nil {
		return err
	}
	if r.MinBytes, err = pd.getInt32(); err != nil {
		return err
	}
	if r.Version >= 3 {
		if r.MaxBytes, err = pd.getInt32(); err != nil {
			return err
		}
	}
	if r.Version >= 4 {
		isolation, err := pd.getInt8()
		if err != nil {
			return err
		}
		r.Isolation = IsolationLevel(isolation)
	}
	if r.Version >= 7 {
		r.SessionID, err = pd.getInt32()
		if err != nil {
			return err
		}
		r.SessionEpoch, err = pd.getInt32()
		if err != nil {
			return err
		}
	}
	topicCount, err := pd.getArrayLength()
	if err != nil {
		return err
	}
	if topicCount == 0 {
		return nil
	}
	r.blocks = make(map[string]map[int32]*fetchRequestBlock)
	for i := 0; i < topicCount; i++ {
		topic, err := pd.getString()
		if err != nil {
			return err
		}
		partitionCount, err := pd.getArrayLength()
		if err != nil {
			return err
		}
		r.blocks[topic] = make(map[int32]*fetchRequestBlock)
		for j := 0; j < partitionCount; j++ {
			partition, err := pd.getInt32()
			if err != nil {
				return err
			}
			fetchBlock := &fetchRequestBlock{}
			if err = fetchBlock.decode(pd, r.Version); err != nil {
				return err
			}
			r.blocks[topic][partition] = fetchBlock
		}
	}

	if r.Version >= 7 {
		forgottenCount, err := pd.getArrayLength()
		if err != nil {
			return err
		}
		r.forgotten = make(map[string][]int32)
		for i := 0; i < forgottenCount; i++ {
			topic, err := pd.getString()
			if err != nil {
				return err
			}
			partitionCount, err := pd.getArrayLength()
			if err != nil {
				return err
			}
			r.forgotten[topic] = make([]int32, partitionCount)

			for j := 0; j < partitionCount; j++ {
				partition, err := pd.getInt32()
				if err != nil {
					return err
				}
				r.forgotten[topic][j] = partition
			}
		}
	}

	if r.Version >= 11 {
		r.RackID, err = pd.getString()
		if err != nil {
			return err
		}
	}

	return nil
}

func (r *FetchRequest) key() int16 {
	return 1
}

func (r *FetchRequest) version() int16 {
	return r.Version
}

func (r *FetchRequest) headerVersion() int16 {
	return 1
}

func (r *FetchRequest) requiredVersion() KafkaVersion {
	switch r.Version {
	case 0:
		return MinVersion
	case 1:
		return V0_9_0_0
	case 2:
		return V0_10_0_0
	case 3:
		return V0_10_1_0
	case 4, 5:
		return V0_11_0_0
	case 6:
		return V1_0_0_0
	case 7:
		return V1_1_0_0
	case 8:
		return V2_0_0_0
	case 9, 10:
		return V2_1_0_0
	case 11:
		return V2_3_0_0
	default:
		return MaxVersion
	}
}

func (r *FetchRequest) AddBlock(topic string, partitionID int32, fetchOffset int64, maxBytes int32, leaderEpoch int32) {
	if r.blocks == nil {
		r.blocks = make(map[string]map[int32]*fetchRequestBlock)
	}

	if r.Version >= 7 && r.forgotten == nil {
		r.forgotten = make(map[string][]int32)
	}

	if r.blocks[topic] == nil {
		r.blocks[topic] = make(map[int32]*fetchRequestBlock)
	}

	tmp := new(fetchRequestBlock)
	tmp.Version = r.Version
	tmp.maxBytes = maxBytes
	tmp.fetchOffset = fetchOffset
	if r.Version >= 9 {
		tmp.currentLeaderEpoch = leaderEpoch
	}

	r.blocks[topic][partitionID] = tmp
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <label>A Test Value 2</label>
    <values>
        <field>Picklist__c</field>
        <value xsi:type="xsd:string">TestPicklistNonAlpha</value>
    </values>
    <values>
        <field>SortOrder__c</field>
        <value xsi:type="xsd:double">2.0</value>
    </values>
</CustomMetadata>

redpajama_set_name: RedPajamaGithub


text:
using namespace SDKTemplate;

using namespace concurrency;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Security::Credentials::UI;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;

Scenario3_CredentialPickerOptions::Scenario3_CredentialPickerOptions()
{
    InitializeComponent();
}

void Scenario3_CredentialPickerOptions::SetResult(CredentialPickerResults^ result)
{
    auto domainName = result->CredentialDomainName;
    auto userName = result->CredentialUserName;
    auto password = result->CredentialPassword;
    auto savedByApi = result->CredentialSaved;
    auto saveOption = result->CredentialSaveOption;

    Status->Text = "OK";
    Domain->Text = domainName;
    Username->Text = userName;
    Password->Text = password;
    CredentialSaved->Text = (savedByApi ? "true" : "false");
    switch (result->CredentialSaveOption)
    {
    case Windows::Security::Credentials::UI::CredentialSaveOption::Hidden:
        CheckboxState->Text = "Hidden";
        break;
    case Windows::Security::Credentials::UI::CredentialSaveOption::Selected:
        CheckboxState->Text = "Selected";
        break;
    case Windows::Security::Credentials::UI::CredentialSaveOption::Unselected:
        CheckboxState->Text = "Unselected";
        break;
    }

}

void Scenario3_CredentialPickerOptions::SetPasswordExplainVisibility(bool isShown)
{
    if (isShown)
    {
        PasswordExplain1->Visibility = Windows::UI::Xaml::Visibility::Visible;
        PasswordExplain2->Visibility = Windows::UI::Xaml::Visibility::Visible;
    }
    else
    {
        PasswordExplain1->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
        PasswordExplain2->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
    }
}

void Scenario3_CredentialPickerOptions::Launch_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    if ((Message->Text == nullptr) || (Caption->Text == nullptr) || (Target->Text == nullptr))
    {
        return;
    }

    CredentialPickerOptions^ credPickerOptions = ref new CredentialPickerOptions();
    credPickerOptions->AlwaysDisplayDialog = AlwaysShowDialog->IsChecked->Value;
    credPickerOptions->Message = Message->Text;
    credPickerOptions->Caption = Caption->Text;
    credPickerOptions->TargetName = Target->Text;
    if (ProtocolSelection->SelectedItem == nullptr)
    {
        credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Negotiate;
    }
    else
    {
        String^ protocolName = ((ComboBoxItem^)ProtocolSelection->SelectedItem)->Content->ToString();
        if (protocolName->Equals("Negotiate"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Negotiate;
        }
        else if (protocolName->Equals("NTLM"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Ntlm;
        }
        else if (protocolName->Equals("Kerberos"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Kerberos;
        }
        else if (protocolName->Equals("CredSsp"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::CredSsp;
        }
        else if (protocolName->Equals("Basic"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Basic;
        }
        else if (protocolName->Equals("Digest"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Digest;
        }
        else if (protocolName->Equals("Custom"))
        {
            credPickerOptions->AuthenticationProtocol = Windows::Security::Credentials::UI::AuthenticationProtocol::Custom;
            credPickerOptions->CustomAuthenticationProtocol = CustomProtocol->Text;
        }
        else
        {
            MainPage::Current->NotifyUser("Unknown Protocol", NotifyType::ErrorMessage);
        }
    }
    if (SaveCheckboxSelection->SelectedItem != nullptr)
    {
        String^ checkboxState = ((ComboBoxItem^)SaveCheckboxSelection->SelectedItem)->Content->ToString();
        if (checkboxState->Equals("Hidden"))
        {
            credPickerOptions->CredentialSaveOption = Windows::Security::Credentials::UI::CredentialSaveOption::Hidden;
        }
        else if (checkboxState->Equals("Selected"))
        {
            credPickerOptions->CredentialSaveOption = Windows::Security::Credentials::UI::CredentialSaveOption::Selected;
        }
        else if (checkboxState->Equals("Unselected"))
        {
            credPickerOptions->CredentialSaveOption = Windows::Security::Credentials::UI::CredentialSaveOption::Unselected;
        }
        else
        {
            MainPage::Current->NotifyUser("Unknown Checkbox state", NotifyType::ErrorMessage);
        }
    }
    create_task(Windows::Security::Credentials::UI::CredentialPicker::PickAsync(credPickerOptions))
        .then([this](CredentialPickerResults^ credPickerResult)
    {
        SetResult(credPickerResult);
    });

}

void Scenario3_CredentialPickerOptions::Protocol_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
{
    ComboBox^ box = (ComboBox^)sender;
    if (ProtocolSelection == nullptr || ProtocolSelection->SelectedItem == nullptr || CustomProtocol == nullptr)
    {
        //return if this was triggered before all components are initialized
        return;
    }

    String^ selectedProtocol = ProtocolSelection->SelectedItem->ToString();

    if (selectedProtocol->Equals("Custom"))
    {
        CustomProtcolStackPanel->Visibility = Windows::UI::Xaml::Visibility::Visible;
    }
    else
    {
        CustomProtcolStackPanel->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
        //Basic and Digest return plaintext passwords
        if (selectedProtocol->Equals("Basic"))
        {
            SetPasswordExplainVisibility(false);
        }
        else if (selectedProtocol->Equals("Digest"))
        {
            SetPasswordExplainVisibility(false);
        }
        else
        {
            SetPasswordExplainVisibility(true);
        }
    }
}


text:
#include "cairoint.h"

#include "cairo-gl-private.h"

#include "cairo-error-private.h"
#include "cairo-rtree-private.h"

#define GLYPH_CACHE_WIDTH 1024
#define GLYPH_CACHE_HEIGHT 1024
#define GLYPH_CACHE_MIN_SIZE 4
#define GLYPH_CACHE_MAX_SIZE 128

typedef struct _cairo_gl_glyph_private {
    cairo_rtree_node_t node;
    cairo_gl_glyph_cache_t *cache;
    struct { float x, y; } p1, p2;
} cairo_gl_glyph_private_t;

static cairo_status_t
_cairo_gl_glyph_cache_add_glyph (cairo_gl_context_t *ctx,
				 cairo_gl_glyph_cache_t *cache,
				 cairo_scaled_glyph_t  *scaled_glyph)
{
    cairo_image_surface_t *glyph_surface = scaled_glyph->surface;
    cairo_gl_surface_t *cache_surface;
    cairo_gl_glyph_private_t *glyph_private;
    cairo_rtree_node_t *node = NULL;
    cairo_status_t status;
    int width, height;

    width = glyph_surface->width;
    if (width < GLYPH_CACHE_MIN_SIZE)
	width = GLYPH_CACHE_MIN_SIZE;
    height = glyph_surface->height;
    if (height < GLYPH_CACHE_MIN_SIZE)
	height = GLYPH_CACHE_MIN_SIZE;

    /* search for an available slot */
    status = _cairo_rtree_insert (&cache->rtree, width, height, &node);
    /* search for an unlocked slot */
    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
	status = _cairo_rtree_evict_random (&cache->rtree,
				            width, height, &node);
	if (status == CAIRO_STATUS_SUCCESS) {
	    status = _cairo_rtree_node_insert (&cache->rtree,
		                               node, width, height, &node);
	}
    }
    if (status)
	return status;

    cache_surface = (cairo_gl_surface_t *) cache->pattern.surface;

    /* XXX: Make sure we use the mask texture. This should work automagically somehow */
    glActiveTexture (GL_TEXTURE1);
    status = _cairo_gl_surface_draw_image (cache_surface,
                                           glyph_surface,
                                           0, 0,
                                           glyph_surface->width, glyph_surface->height,
                                           node->x, node->y);
    if (unlikely (status))
	return status;

    scaled_glyph->surface_private = node;
    node->owner = &scaled_glyph->surface_private;

    glyph_private = (cairo_gl_glyph_private_t *) node;
    glyph_private->cache = cache;

    /* compute tex coords */
    glyph_private->p1.x = node->x;
    glyph_private->p1.y = node->y;
    glyph_private->p2.x = node->x + glyph_surface->width;
    glyph_private->p2.y = node->y + glyph_surface->height;
    if (! _cairo_gl_device_requires_power_of_two_textures (&ctx->base)) {
	glyph_private->p1.x /= cache_surface->width;
	glyph_private->p1.y /= cache_surface->height;
	glyph_private->p2.x /= cache_surface->width;
	glyph_private->p2.y /= cache_surface->height;
    }

    return CAIRO_STATUS_SUCCESS;
}

static cairo_gl_glyph_private_t *
_cairo_gl_glyph_cache_lock (cairo_gl_glyph_cache_t *cache,
			    cairo_scaled_glyph_t *scaled_glyph)
{
    return _cairo_rtree_pin (&cache->rtree, scaled_glyph->surface_private);
}

static cairo_status_t
cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
				  cairo_format_t format,
                                  cairo_gl_glyph_cache_t **cache_out)
{
    cairo_gl_glyph_cache_t *cache;
    cairo_content_t content;

    switch (format) {
    case CAIRO_FORMAT_RGB16_565:
    case CAIRO_FORMAT_ARGB32:
    case CAIRO_FORMAT_RGB24:
	cache = &ctx->glyph_cache[0];
        content = CAIRO_CONTENT_COLOR_ALPHA;
	break;
    case CAIRO_FORMAT_A8:
    case CAIRO_FORMAT_A1:
	cache = &ctx->glyph_cache[1];
        content = CAIRO_CONTENT_ALPHA;
	break;
    case CAIRO_FORMAT_INVALID:
	ASSERT_NOT_REACHED;
	return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
    }

    if (unlikely (cache->pattern.surface == NULL)) {
        cairo_surface_t *surface;
        surface = cairo_gl_surface_create (&ctx->base,
                                           content,
                                           GLYPH_CACHE_WIDTH,
                                           GLYPH_CACHE_HEIGHT);
        if (unlikely (surface->status)) {
            cairo_status_t status = surface->status;
            cairo_surface_destroy (surface);
            return status;
        }
        _cairo_surface_release_device_reference (surface);
        _cairo_pattern_init_for_surface (&cache->pattern, surface);
        cairo_surface_destroy (surface);
        cache->pattern.base.has_component_alpha = (content == CAIRO_CONTENT_COLOR_ALPHA);
    }

    *cache_out = cache;
    return CAIRO_STATUS_SUCCESS;
}

static void
_cairo_gl_glyph_cache_unlock (cairo_gl_glyph_cache_t *cache)
{
    _cairo_rtree_unpin (&cache->rtree);
}

static cairo_bool_t
_cairo_gl_surface_owns_font (cairo_gl_surface_t *surface,
			     cairo_scaled_font_t *scaled_font)
{
    cairo_device_t *font_private;

    font_private = scaled_font->surface_private;
    if ((scaled_font->surface_backend != NULL &&
	 scaled_font->surface_backend != &_cairo_gl_surface_backend) ||
	(font_private != NULL && font_private != surface->base.device))
    {
	return FALSE;
    }

    return TRUE;
}

void
_cairo_gl_surface_scaled_font_fini (cairo_scaled_font_t  *scaled_font)
{
    cairo_list_del (&scaled_font->link);
}

void
_cairo_gl_surface_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph,
				     cairo_scaled_font_t  *scaled_font)
{
    cairo_gl_glyph_private_t *glyph_private;

    glyph_private = scaled_glyph->surface_private;
    if (glyph_private != NULL) {
	glyph_private->node.owner = NULL;
	if (! glyph_private->node.pinned) {
	    /* XXX thread-safety? Probably ok due to the frozen scaled-font. */
	    _cairo_rtree_node_remove (&glyph_private->cache->rtree,
		                      &glyph_private->node);
	}
    }
}

static cairo_status_t
_render_glyphs (cairo_gl_surface_t	*dst,
	        int dst_x, int dst_y,
	        cairo_operator_t	 op,
		const cairo_pattern_t	*source,
		cairo_glyph_t		*glyphs,
		int			 num_glyphs,
		const cairo_rectangle_int_t *glyph_extents,
		cairo_scaled_font_t	*scaled_font,
		cairo_bool_t		*has_component_alpha,
		cairo_region_t		*clip_region,
		int			*remaining_glyphs)
{
    cairo_format_t last_format = CAIRO_FORMAT_INVALID;
    cairo_gl_glyph_cache_t *cache = NULL;
    cairo_gl_context_t *ctx;
    cairo_gl_composite_t setup;
    cairo_status_t status;
    int i = 0;

    *has_component_alpha = FALSE;

    status = _cairo_gl_context_acquire (dst->base.device, &ctx);
    if (unlikely (status))
	return status;

    _cairo_scaled_font_freeze_cache (scaled_font);

    status = _cairo_gl_composite_init (&setup, op, dst,
                                       TRUE, glyph_extents);

    if (unlikely (status))
	goto FINISH;

    if (! _cairo_gl_surface_owns_font (dst, scaled_font)) {
	status = CAIRO_INT_STATUS_UNSUPPORTED;
	goto FINISH;
    }

    status = _cairo_gl_composite_set_source (&setup, source,
                                             glyph_extents->x, glyph_extents->y,
                                             dst_x, dst_y,
                                             glyph_extents->width,
                                             glyph_extents->height);
    if (unlikely (status))
	goto FINISH;

    if (scaled_font->surface_private == NULL) {
	scaled_font->surface_private = ctx;
	scaled_font->surface_backend = &_cairo_gl_surface_backend;
	cairo_list_add (&scaled_font->link, &ctx->fonts);
    }

    _cairo_gl_composite_set_clip_region (&setup, clip_region);

    for (i = 0; i < num_glyphs; i++) {
	cairo_scaled_glyph_t *scaled_glyph;
	cairo_gl_glyph_private_t *glyph;
	double x_offset, y_offset;
	double x1, x2, y1, y2;

	status = _cairo_scaled_glyph_lookup (scaled_font,
					     glyphs[i].index,
					     CAIRO_SCALED_GLYPH_INFO_SURFACE,
					     &scaled_glyph);
	if (unlikely (status))
	    goto FINISH;

	if (scaled_glyph->surface->width  == 0 ||
	    scaled_glyph->surface->height == 0)
	{
	    continue;
	}
	if (scaled_glyph->surface->width  > GLYPH_CACHE_MAX_SIZE ||
	    scaled_glyph->surface->height > GLYPH_CACHE_MAX_SIZE)
	{
	    status = CAIRO_INT_STATUS_UNSUPPORTED;
	    goto FINISH;
	}

	if (scaled_glyph->surface->format != last_format) {
	    status = cairo_gl_context_get_glyph_cache (ctx,
						       scaled_glyph->surface->format,
                                                       &cache);
            if (unlikely (status))
                goto FINISH;

	    last_format = scaled_glyph->surface->format;

            status = _cairo_gl_composite_set_mask (&setup,
                                                   &cache->pattern.base,
                                                   0, 0, 0, 0, 0, 0);
            if (unlikely (status))
                goto FINISH;

	    *has_component_alpha |= cache->pattern.base.has_component_alpha;

            /* XXX: _cairo_gl_composite_begin() acquires the context a
             * second time. Need to refactor this loop so this doesn't happen.
             */
            status = _cairo_gl_composite_begin (&setup, &ctx);

            status = _cairo_gl_context_release (ctx, status);
	    if (unlikely (status))
		goto FINISH;
	}

	if (scaled_glyph->surface_private == NULL) {
	    status = _cairo_gl_glyph_cache_add_glyph (ctx, cache, scaled_glyph);

	    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
		/* Cache is full, so flush existing prims and try again. */
                _cairo_gl_composite_flush (ctx);
		_cairo_gl_glyph_cache_unlock (cache);
		status = _cairo_gl_glyph_cache_add_glyph (ctx, cache, scaled_glyph);
	    }

	    if (unlikely (_cairo_status_is_error (status)))
		goto FINISH;
	}

	x_offset = scaled_glyph->surface->base.device_transform.x0;
	y_offset = scaled_glyph->surface->base.device_transform.y0;

	x1 = _cairo_lround (glyphs[i].x - x_offset);
	y1 = _cairo_lround (glyphs[i].y - y_offset);
	x2 = x1 + scaled_glyph->surface->width;
	y2 = y1 + scaled_glyph->surface->height;

	glyph = _cairo_gl_glyph_cache_lock (cache, scaled_glyph);
	_cairo_gl_composite_emit_glyph (ctx,
					x1, y1, x2, y2,
                                        glyph->p1.x, glyph->p1.y,
                                        glyph->p2.x, glyph->p2.y);
    }

    status = CAIRO_STATUS_SUCCESS;
  FINISH:
    _cairo_scaled_font_thaw_cache (scaled_font);

    status = _cairo_gl_context_release (ctx, status);

    _cairo_gl_composite_fini (&setup);

    *remaining_glyphs = num_glyphs - i;
    return status;
}

static cairo_int_status_t
_cairo_gl_surface_show_glyphs_via_mask (cairo_gl_surface_t	*dst,
			                cairo_operator_t	 op,
					const cairo_pattern_t	*source,
					cairo_glyph_t		*glyphs,
					int			 num_glyphs,
					const cairo_rectangle_int_t *glyph_extents,
					cairo_scaled_font_t	*scaled_font,
					cairo_clip_t		*clip,
					int			*remaining_glyphs)
{
    cairo_surface_t *mask;
    cairo_status_t status;
    cairo_bool_t has_component_alpha;
    int i;

    /* XXX: For non-CA, this should be CAIRO_CONTENT_ALPHA to save memory */
    mask = cairo_gl_surface_create (dst->base.device,
                                    CAIRO_CONTENT_COLOR_ALPHA,
                                    glyph_extents->width,
                                    glyph_extents->height);
    if (unlikely (mask->status))
        return mask->status;

    for (i = 0; i < num_glyphs; i++) {
	glyphs[i].x -= glyph_extents->x;
	glyphs[i].y -= glyph_extents->y;
    }

    status = _render_glyphs ((cairo_gl_surface_t *) mask, 0, 0,
	                     CAIRO_OPERATOR_ADD,
			     &_cairo_pattern_white.base,
	                     glyphs, num_glyphs, glyph_extents,
			     scaled_font, &has_component_alpha,
			     NULL, remaining_glyphs);
    if (likely (status == CAIRO_STATUS_SUCCESS)) {
	cairo_surface_pattern_t mask_pattern;

        mask->is_clear = FALSE;
	_cairo_pattern_init_for_surface (&mask_pattern, mask);
	mask_pattern.base.has_component_alpha = has_component_alpha;
	cairo_matrix_init_translate (&mask_pattern.base.matrix,
		                     -glyph_extents->x, -glyph_extents->y);
	status = _cairo_surface_mask (&dst->base, op,
		                      source, &mask_pattern.base, clip);
	_cairo_pattern_fini (&mask_pattern.base);
    } else {
	for (i = 0; i < num_glyphs; i++) {
	    glyphs[i].x += glyph_extents->x;
	    glyphs[i].y += glyph_extents->y;
	}
	*remaining_glyphs = num_glyphs;
    }

    cairo_surface_destroy (mask);

    return status;
}

cairo_int_status_t
_cairo_gl_surface_show_glyphs (void			*abstract_dst,
			       cairo_operator_t		 op,
			       const cairo_pattern_t	*source,
			       cairo_glyph_t		*glyphs,
			       int			 num_glyphs,
			       cairo_scaled_font_t	*scaled_font,
			       cairo_clip_t		*clip,
			       int			*remaining_glyphs)
{
    cairo_gl_surface_t *dst = abstract_dst;
    cairo_rectangle_int_t surface_extents;
    cairo_rectangle_int_t extents;
    cairo_region_t *clip_region = NULL;
    cairo_bool_t overlap, use_mask = FALSE;
    cairo_bool_t has_component_alpha;
    cairo_status_t status;
    int i;

    if (! _cairo_gl_operator_is_supported (op))
	return UNSUPPORTED ("unsupported operator");

    if (! _cairo_operator_bounded_by_mask (op))
	use_mask |= TRUE;

    /* If any of the glyphs are component alpha, we have to go through a mask,
     * since only _cairo_gl_surface_composite() currently supports component
     * alpha.
     */
    if (!use_mask && op != CAIRO_OPERATOR_OVER) {
	for (i = 0; i < num_glyphs; i++) {
	    cairo_scaled_glyph_t *scaled_glyph;

	    status = _cairo_scaled_glyph_lookup (scaled_font,
						 glyphs[i].index,
						 CAIRO_SCALED_GLYPH_INFO_SURFACE,
						 &scaled_glyph);
	    if (!_cairo_status_is_error (status) &&
		scaled_glyph->surface->format == CAIRO_FORMAT_ARGB32)
	    {
		use_mask = TRUE;
		break;
	    }
	}
    }

    /* For CLEAR, cairo's rendering equation (quoting Owen's description in:
     * http://lists.cairographics.org/archives/cairo/2005-August/004992.html)
     * is:
     *     mask IN clip ? src OP dest : dest
     * or more simply:
     *     mask IN CLIP ? 0 : dest
     *
     * where the ternary operator A ? B : C is (A * B) + ((1 - A) * C).
     *
     * The model we use in _cairo_gl_set_operator() is Render's:
     *     src IN mask IN clip OP dest
     * which would boil down to:
     *     0 (bounded by the extents of the drawing).
     *
     * However, we can do a Render operation using an opaque source
     * and DEST_OUT to produce:
     *    1 IN mask IN clip DEST_OUT dest
     * which is
     *    mask IN clip ? 0 : dest
     */
    if (op == CAIRO_OPERATOR_CLEAR) {
	source = &_cairo_pattern_white.base;
	op = CAIRO_OPERATOR_DEST_OUT;
    }

    /* For SOURCE, cairo's rendering equation is:
     *     (mask IN clip) ? src OP dest : dest
     * or more simply:
     *     (mask IN clip) ? src : dest.
     *
     * If we just used the Render equation, we would get:
     *     (src IN mask IN clip) OP dest
     * or:
     *     (src IN mask IN clip) bounded by extents of the drawing.
     *
     * The trick is that for GL blending, we only get our 4 source values
     * into the blender, and since we need all 4 components of source, we
     * can't also get the mask IN clip into the blender.  But if we did
     * two passes we could make it work:
     *     dest = (mask IN clip) DEST_OUT dest
     *     dest = src IN mask IN clip ADD dest
     *
     * But for now, composite via an intermediate mask.
     */
    if (op == CAIRO_OPERATOR_SOURCE)
	use_mask |= TRUE;

    /* XXX we don't need ownership of the font as we use a global
     * glyph cache -- but we do need scaled_glyph eviction notification. :-(
     */
    if (! _cairo_gl_surface_owns_font (dst, scaled_font))
	return UNSUPPORTED ("do not control font");

    /* If the glyphs overlap, we need to build an intermediate mask rather
     * then perform the compositing directly.
     */
    status = _cairo_scaled_font_glyph_device_extents (scaled_font,
						      glyphs, num_glyphs,
						      &extents,
						      &overlap);
    if (unlikely (status))
	return status;

    use_mask |= overlap;

    if (clip != NULL) {
	status = _cairo_clip_get_region (clip, &clip_region);
	/* the empty clip should never be propagated this far */
	assert (status != CAIRO_INT_STATUS_NOTHING_TO_DO);
	if (unlikely (_cairo_status_is_error (status)))
	    return status;

	use_mask |= status == CAIRO_INT_STATUS_UNSUPPORTED;

	if (! _cairo_rectangle_intersect (&extents,
		                          _cairo_clip_get_extents (clip)))
	    goto EMPTY;
    }

    surface_extents.x = surface_extents.y = 0;
    surface_extents.width = dst->width;
    surface_extents.height = dst->height;
    if (! _cairo_rectangle_intersect (&extents, &surface_extents))
	goto EMPTY;

    if (use_mask) {
	return _cairo_gl_surface_show_glyphs_via_mask (dst, op,
			                               source,
			                               glyphs, num_glyphs,
						       &extents,
						       scaled_font,
						       clip,
						       remaining_glyphs);
    }

    return _render_glyphs (dst, extents.x, extents.y,
	                   op, source,
			   glyphs, num_glyphs, &extents,
			   scaled_font, &has_component_alpha,
			   clip_region, remaining_glyphs);

EMPTY:
    *remaining_glyphs = 0;
    if (! _cairo_operator_bounded_by_mask (op))
	return _cairo_surface_paint (&dst->base, op, source, clip);
    else
	return CAIRO_STATUS_SUCCESS;
}

void
_cairo_gl_glyph_cache_init (cairo_gl_glyph_cache_t *cache)
{
    _cairo_rtree_init (&cache->rtree,
		       GLYPH_CACHE_WIDTH,
		       GLYPH_CACHE_HEIGHT,
		       GLYPH_CACHE_MIN_SIZE,
		       sizeof (cairo_gl_glyph_private_t));
}

void
_cairo_gl_glyph_cache_fini (cairo_gl_context_t *ctx,
			    cairo_gl_glyph_cache_t *cache)
{
    _cairo_rtree_fini (&cache->rtree);

    if (cache->pattern.surface) {
        _cairo_pattern_fini (&cache->pattern.base);
        cache->pattern.surface = NULL;
    }
}


text:
layout: post
title: "CouchDB"
slug: couchdb
source: http://couchdb.apache.org/
image: couchdb.png
---


text:
package br.com.delogic.leitoor.controller.professor;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import br.com.delogic.csa.repository.Criteria;
import br.com.delogic.csa.repository.QueryRepository;
import br.com.delogic.leitoor.service.AutenticacaoService;
import br.com.delogic.leitoor.util.Result;
import br.com.delogic.leitoor.util.csa.UrlMapping;
import br.com.delogic.leitoor.view.ResumoMaterial;
import br.com.delogic.leitoor.view.ResumoTarefa;

@Controller
@RequestMapping("/professor")
public class HomeProfessorController {

    @Inject
    @Named("resumoMateriais")
    private QueryRepository<ResumoMaterial> queryMateriais;

    @Inject
    @Named("resumoTarefas")
    private QueryRepository<ResumoTarefa>   queryTarefas;

    @Inject
    private AutenticacaoService             autenticacaoService;

    @Inject
    @Named("urlHomeProfessor")
    private UrlMapping                      urlHomeProfessor;

    public static class ConvidarProfessorModel {

        @NotEmpty
        @Size(max = 5000)
        @Pattern(regexp =
            "^([a-zA-Z0-9\\._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9]{2,}\\s*)+$*", message =
            "E-mails devem ser algo como nome@email(.com, .gov, .br, etc). Sem virgulas ou caracteres especiais.")
        private String emails;

        public String getEmails() {
            return emails;
        }

        public void setEmails(String emails) {
            this.emails = emails;
        }

    }

    @RequestMapping({ "", "/home", "/" })
    public ModelAndView getHome() {

        Criteria filtroProfessor = new Criteria();
        filtroProfessor.addParameter("idProfessor", autenticacaoService.getProfessorAutenticado().getId());

        List<ResumoMaterial> materiais = queryMateriais.getList(filtroProfessor);

        filtroProfessor.setParameterizedOrderBy("percentualCompleto");
        List<ResumoTarefa> tarefas = queryTarefas.getList(filtroProfessor);

        return new ModelAndView("professor/home")
            .addObject("materiais", materiais)
            .addObject("tarefas", tarefas); // mensagem de sucesso
    }

    @RequestMapping(value = "/convidar", method = RequestMethod.GET)
    public ModelAndView exibirConvidar() {
        return getViewConvidar(new ConvidarProfessorModel());
    }

    @RequestMapping(value = "/convidar", method = RequestMethod.POST)
    public ModelAndView enviarConvites(@Valid @ModelAttribute("convidar") ConvidarProfessorModel model,
        BindingResult result, RedirectAttributes redirectAttributes) {

        if (result.hasErrors()) {
            return getViewConvidar(model);
        }

        Result<Void> resultado = autenticacaoService.convidarProfessores(model.getEmails(), autenticacaoService.getProfessorAutenticado());

        redirectAttributes.addFlashAttribute("sucesso", resultado.getMessage());

        return new ModelAndView(urlHomeProfessor.getRedirectPath());

    }

    private ModelAndView getViewConvidar(ConvidarProfessorModel model) {
        return new ModelAndView("professor/convidar")
            .addObject("convidar", model);
    }

}


text:
{% extends 'layout/management_page.html' %}
{% from 'users/_category.html' import suggested_category, user_category %}
{% from 'users/_labels.html' import labels %}

{% macro _format_event_times(event) %}
    {% if event.start_dt.astimezone(session.tzinfo).date() != event.end_dt.astimezone(session.tzinfo).date() %}
        {{ event.start_dt|format_datetime }} - {{ event.end_dt|format_datetime }}
    {% else %}
        {{ event.start_dt|format_time }} - {{ event.end_dt|format_time }}
    {% endif %}
    ({{ session.tzinfo.zone }})
{% endmacro %}

{% macro _format_event_time(event) %}
    {% if event.start_dt <= now() < event.end_dt %}
        {% trans %}Now{% endtrans %}
    {% else %}
        {{ event.start_dt | format_pretty_date(tzinfo=session.tzinfo) }}
    {% endif %}
{% endmacro %}

{% block page_class %}user-dashboard{% endblock %}
{% block banner_class %}user-dashboard{% endblock %}

{% block banner_title -%}
    {% trans %}Dashboard{% endtrans %}
{%- endblock %}

{% block banner_actions -%}

{% endblock %}

{% block content %}

{{ user.full_name }}

                            {% if config.DEBUG %}

                                    ID

{{ user.id }}

                            {% endif %}
                            {{ labels(user) }}

                                {% trans %}Last login{% endtrans %}

                                    {% if user.last_login_dt %}
                                        {{ user.last_login_dt | format_datetime }}
                                    {% else %}
                                        {% trans %}Never{% endtrans %}
                                    {% endif %}

                        {% if user.affiliation %}

                                {{ user.affiliation }}

                        {% endif %}

                            {{ user.email }}

                        {% if user.phone %}

                                {{ user.phone }}

                        {% endif %}

                            {% trans %}Settings{% endtrans %}

                        {% trans %}Your events at hand{% endtrans %}

                        {% for event, roles in linked_events %}

                                    {{ _format_event_time(event) }}

                                        {{ event.get_verbose_title(show_series_pos=true) }}

                                    {{ event.get_label_markup('mini') }}

                        {% else %}

                                    {% trans %}You have no events.{% endtrans %}

                        {% endfor %}

                {% if suggested_categories %}

{% trans %}You might be interested in the following categories...{% endtrans %}

                            {% for category in suggested_categories %}
                                {{ suggested_category(category.categ, category.path) }}
                            {% endfor %}

                {% endif %}

{% trans %}Your categories{% endtrans %}

                        {% if not categories %}

                                    {% trans %}You have no categories.{% endtrans %}

                        {% else %}
                            {% for category in categories.values() %}
                                {{ user_category(category.categ, category.path, category.managed) }}
                            {% endfor %}
                        {% endif %}

{% trans %}Happening in your categories{% endtrans %}

                        {% if not categories %}

                                    {% trans %}You have no categories.{% endtrans %}

                        {% elif not categories_events %}

                                    {% trans %}Nothing happening in your categories.{% endtrans %}

                        {% else %}
                            {% for event in categories_events %}

                                        {{ _format_event_time(event) }}

                                                {{ event.get_verbose_title(show_series_pos=true) }}

                                            {{ event.get_label_markup('mini') }}

                                            {{ event.category.title }}

                            {% endfor %}
                        {% endif %}

{% endblock %}


text:
<?php

/**
 * SFTP Stream Wrapper
 *
 * @package Net_SFTP_Stream
 * @author  Jim Wigginton <terrafrost@php.net>
 * @access  public
 */
class Net_SFTP_Stream
{
    /**
     * SFTP instances
     *
     * Rather than re-create the connection we re-use instances if possible
     *
     * @var Array
     */
    static $instances;

    /**
     * SFTP instance
     *
     * @var Object
     * @access private
     */
    var $sftp;

    /**
     * Path
     *
     * @var String
     * @access private
     */
    var $path;

    /**
     * Mode
     *
     * @var String
     * @access private
     */
    var $mode;

    /**
     * Position
     *
     * @var Integer
     * @access private
     */
    var $pos;

    /**
     * Size
     *
     * @var Integer
     * @access private
     */
    var $size;

    /**
     * Directory entries
     *
     * @var Array
     * @access private
     */
    var $entries;

    /**
     * EOF flag
     *
     * @var Boolean
     * @access private
     */
    var $eof;

    /**
     * Context resource
     *
     * Technically this needs to be publically accessible so PHP can set it directly
     *
     * @var Resource
     * @access public
     */
    var $context;

    /**
     * Notification callback function
     *
     * @var Callable
     * @access public
     */
    var $notification;

    /**
     * Registers this class as a URL wrapper.
     *
     * @param optional String $protocol The wrapper name to be registered.
     * @return Boolean True on success, false otherwise.
     * @access public
     */
    static function register($protocol = 'sftp')
    {
        if (in_array($protocol, stream_get_wrappers(), true)) {
            return false;
        }
        $class = function_exists('get_called_class') ? get_called_class() : __CLASS__;
        return stream_wrapper_register($protocol, $class);
    }

    /**
     * The Constructor
     *
     * @access public
     */
    function Net_SFTP_Stream()
    {
        if (defined('NET_SFTP_STREAM_LOGGING')) {
            echo "__construct()\r\n";
        }

        if (!class_exists('Net_SFTP')) {
            include_once 'Net/SFTP.php';
        }
    }

    /**
     * Path Parser
     *
     * Extract a path from a URI and actually connect to an SSH server if appropriate
     *
     * If "notification" is set as a context parameter the message code for successful login is
     * NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE.
     *
     * @param String $path
     * @return String
     * @access private
     */
    function _parse_path($path)
    {
        extract(parse_url($path) + array('port' => 22));

        if (!isset($host)) {
            return false;
        }

        if (isset($this->context)) {
            $context = stream_context_get_params($this->context);
            if (isset($context['notification'])) {
                $this->notification = $context['notification'];
            }
        }

        if ($host[0] == '$') {
            $host = substr($host, 1);
            global $$host;
            if (!is_object($$host) || get_class($$host) != 'Net_SFTP') {
                return false;
            }
            $this->sftp = $$host;
        } else {
            if (isset($this->context)) {
                $context = stream_context_get_options($this->context);
            }
            if (isset($context[$scheme]['session'])) {
                $sftp = $context[$scheme]['session'];
            }
            if (isset($context[$scheme]['sftp'])) {
                $sftp = $context[$scheme]['sftp'];
            }
            if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
                $this->sftp = $sftp;
                return $path;
            }
            if (isset($context[$scheme]['username'])) {
                $user = $context[$scheme]['username'];
            }
            if (isset($context[$scheme]['password'])) {
                $pass = $context[$scheme]['password'];
            }
            if (isset($context[$scheme]['privkey']) && is_object($context[$scheme]['privkey']) && get_Class($context[$scheme]['privkey']) == 'Crypt_RSA') {
                $pass = $context[$scheme]['privkey'];
            }

            if (!isset($user) || !isset($pass)) {
                return false;
            }

            // casting $pass to a string is necessary in the event that it's a Crypt_RSA object
            if (isset(self::$instances[$host][$port][$user][(string) $pass])) {
                $this->sftp = self::$instances[$host][$port][$user][(string) $pass];
            } else {
                $this->sftp = new Net_SFTP($host, $port);
                $this->sftp->disableStatCache();
                if (isset($this->notification) && is_callable($this->notification)) {
                    /* if !is_callable($this->notification) we could do this:

                       user_error('fopen(): failed to call user notifier', E_USER_WARNING);

                       the ftp wrapper gives errors like that when the notifier isn't callable.
                       i've opted not to do that, however, since the ftp wrapper gives the line
                       on which the fopen occurred as the line number - not the line that the
                       user_error is on.
                    */
                    call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
                    call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
                    if (!$this->sftp->login($user, $pass)) {
                        call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0);
                        return false;
                    }
                    call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0);
                } else {
                    if (!$this->sftp->login($user, $pass)) {
                        return false;
                    }
                }
                self::$instances[$host][$port][$user][(string) $pass] = $this->sftp;
            }
        }

        return $path;
    }

    /**
     * Opens file or URL
     *
     * @param String $path
     * @param String $mode
     * @param Integer $options
     * @param String $opened_path
     * @return Boolean
     * @access public
     */
    function _stream_open($path, $mode, $options, &$opened_path)
    {
        $path = $this->_parse_path($path);

        if ($path === false) {
            return false;
        }
        $this->path = $path;

        $this->size = $this->sftp->size($path);
        $this->mode = preg_replace('#[bt]$#', '', $mode);
        $this->eof = false;

        if ($this->size === false) {
            if ($this->mode[0] == 'r') {
                return false;
            } else {
                $this->sftp->touch($path);
                $this->size = 0;
            }
        } else {
            switch ($this->mode[0]) {
                case 'x':
                    return false;
                case 'w':
                    $this->sftp->truncate($path, 0);
                    $this->size = 0;
            }
        }

        $this->pos = $this->mode[0] != 'a' ? 0 : $this->size;

        return true;
    }

    /**
     * Read from stream
     *
     * @param Integer $count
     * @return Mixed
     * @access public
     */
    function _stream_read($count)
    {
        switch ($this->mode) {
            case 'w':
            case 'a':
            case 'x':
            case 'c':
                return false;
        }

        // commented out because some files - eg. /dev/urandom - will say their size is 0 when in fact it's kinda infinite
        //if ($this->pos >= $this->size) {
        //    $this->eof = true;
        //    return false;
        //}

        $result = $this->sftp->get($this->path, false, $this->pos, $count);
        if (isset($this->notification) && is_callable($this->notification)) {
            if ($result === false) {
                call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
                return 0;
            }
            // seems that PHP calls stream_read in 8k chunks
            call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size);
        }

        if (empty($result)) { // ie. false or empty string
            $this->eof = true;
            return false;
        }
        $this->pos+= strlen($result);

        return $result;
    }

    /**
     * Write to stream
     *
     * @param String $data
     * @return Mixed
     * @access public
     */
    function _stream_write($data)
    {
        switch ($this->mode) {
            case 'r':
                return false;
        }

        $result = $this->sftp->put($this->path, $data, NET_SFTP_STRING, $this->pos);
        if (isset($this->notification) && is_callable($this->notification)) {
            if (!$result) {
                call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
                return 0;
            }
            // seems that PHP splits up strings into 8k blocks before calling stream_write
            call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data));
        }

        if ($result === false) {
            return false;
        }
        $this->pos+= strlen($data);
        if ($this->pos > $this->size) {
            $this->size = $this->pos;
        }
        $this->eof = false;
        return strlen($data);
    }

    /**
     * Retrieve the current position of a stream
     *
     * @return Integer
     * @access public
     */
    function _stream_tell()
    {
        return $this->pos;
    }

    /**
     * Tests for end-of-file on a file pointer
     *
     * In my testing there are four classes functions that normally effect the pointer:
     * fseek, fputs  / fwrite, fgets / fread and ftruncate.
     *
     * Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof()
     * will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof()
     * will return false. do fread($fp, 1) and feof() will then return true.
     *
     * @return Boolean
     * @access public
     */
    function _stream_eof()
    {
        return $this->eof;
    }

    /**
     * Seeks to specific location in a stream
     *
     * @param Integer $offset
     * @param Integer $whence
     * @return Boolean
     * @access public
     */
    function _stream_seek($offset, $whence)
    {
        switch ($whence) {
            case SEEK_SET:
                if ($offset >= $this->size || $offset < 0) {
                    return false;
                }
                break;
            case SEEK_CUR:
                $offset+= $this->pos;
                break;
            case SEEK_END:
                $offset+= $this->size;
        }

        $this->pos = $offset;
        $this->eof = false;
        return true;
    }

    /**
     * Change stream options
     *
     * @param String $path
     * @param Integer $option
     * @param Mixed $var
     * @return Boolean
     * @access public
     */
    function _stream_metadata($path, $option, $var)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        // stream_metadata was introduced in PHP 5.4.0 but as of 5.4.11 the constants haven't been defined
        // see http://www.php.net/streamwrapper.stream-metadata and https://bugs.php.net/64246
        //     and https://github.com/php/php-src/blob/master/main/php_streams.h#L592
        switch ($option) {
            case 1: // PHP_STREAM_META_TOUCH
                return $this->sftp->touch($path, $var[0], $var[1]);
            case 2: // PHP_STREAM_OWNER_NAME
            case 3: // PHP_STREAM_GROUP_NAME
                return false;
            case 4: // PHP_STREAM_META_OWNER
                return $this->sftp->chown($path, $var);
            case 5: // PHP_STREAM_META_GROUP
                return $this->sftp->chgrp($path, $var);
            case 6: // PHP_STREAM_META_ACCESS
                return $this->sftp->chmod($path, $var) !== false;
        }
    }

    /**
     * Retrieve the underlaying resource
     *
     * @param Integer $cast_as
     * @return Resource
     * @access public
     */
    function _stream_cast($cast_as)
    {
        return $this->sftp->fsock;
    }

    /**
     * Advisory file locking
     *
     * @param Integer $operation
     * @return Boolean
     * @access public
     */
    function _stream_lock($operation)
    {
        return false;
    }

    /**
     * Renames a file or directory
     *
     * Attempts to rename oldname to newname, moving it between directories if necessary.
     * If newname exists, it will be overwritten.  This is a departure from what Net_SFTP
     * does.
     *
     * @param String $path_from
     * @param String $path_to
     * @return Boolean
     * @access public
     */
    function _rename($path_from, $path_to)
    {
        $path1 = parse_url($path_from);
        $path2 = parse_url($path_to);
        unset($path1['path'], $path2['path']);
        if ($path1 != $path2) {
            return false;
        }

        $path_from = $this->_parse_path($path_from);
        $path_to = parse_url($path_to);
        if ($path_from === false) {
            return false;
        }

        $path_to = $path_to['path']; // the $component part of parse_url() was added in PHP 5.1.2
        // "It is an error if there already exists a file with the name specified by newpath."
        //  -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.5
        if (!$this->sftp->rename($path_from, $path_to)) {
            if ($this->sftp->stat($path_to)) {
                return $this->sftp->delete($path_to, true) && $this->sftp->rename($path_from, $path_to);
            }
            return false;
        }

        return true;
    }

    /**
     * Open directory handle
     *
     * The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and
     * removed in 5.4 I'm just going to ignore it.
     *
     * Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client
     * sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting
     * the SFTP specs:
     *
     *    The SSH_FXP_NAME response has the following format:
     *
     *        uint32     id
     *        uint32     count
     *        repeats count times:
     *                string     filename
     *                string     longname
     *                ATTRS      attrs
     *
     * @param String $path
     * @param Integer $options
     * @return Boolean
     * @access public
     */
    function _dir_opendir($path, $options)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }
        $this->pos = 0;
        $this->entries = $this->sftp->nlist($path);
        return $this->entries !== false;
    }

    /**
     * Read entry from directory handle
     *
     * @return Mixed
     * @access public
     */
    function _dir_readdir()
    {
        if (isset($this->entries[$this->pos])) {
            return $this->entries[$this->pos++];
        }
        return false;
    }

    /**
     * Rewind directory handle
     *
     * @return Boolean
     * @access public
     */
    function _dir_rewinddir()
    {
        $this->pos = 0;
        return true;
    }

    /**
     * Close directory handle
     *
     * @return Boolean
     * @access public
     */
    function _dir_closedir()
    {
        return true;
    }

    /**
     * Create a directory
     *
     * Only valid $options is STREAM_MKDIR_RECURSIVE
     *
     * @param String $path
     * @param Integer $mode
     * @param Integer $options
     * @return Boolean
     * @access public
     */
    function _mkdir($path, $mode, $options)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE);
    }

    /**
     * Removes a directory
     *
     * Only valid $options is STREAM_MKDIR_RECURSIVE per <http://php.net/streamwrapper.rmdir>, however,
     * <http://php.net/rmdir>  does not have a $recursive parameter as mkdir() does so I don't know how
     * STREAM_MKDIR_RECURSIVE is supposed to be set. Also, when I try it out with rmdir() I get 8 as
     * $options. What does 8 correspond to?
     *
     * @param String $path
     * @param Integer $mode
     * @param Integer $options
     * @return Boolean
     * @access public
     */
    function _rmdir($path, $options)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->rmdir($path);
    }

    /**
     * Flushes the output
     *
     * See <http://php.net/fflush>. Always returns true because Net_SFTP doesn't cache stuff before writing
     *
     * @return Boolean
     * @access public
     */
    function _stream_flush()
    {
        return true;
    }

    /**
     * Retrieve information about a file resource
     *
     * @return Mixed
     * @access public
     */
    function _stream_stat()
    {
        $results = $this->sftp->stat($this->path);
        if ($results === false) {
            return false;
        }
        return $results;
    }

    /**
     * Delete a file
     *
     * @param String $path
     * @return Boolean
     * @access public
     */
    function _unlink($path)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->delete($path, false);
    }

    /**
     * Retrieve information about a file
     *
     * Ignores the STREAM_URL_STAT_QUIET flag because the entirety of Net_SFTP_Stream is quiet by default
     * might be worthwhile to reconstruct bits 12-16 (ie. the file type) if mode doesn't have them but we'll
     * cross that bridge when and if it's reached
     *
     * @param String $path
     * @param Integer $flags
     * @return Mixed
     * @access public
     */
    function _url_stat($path, $flags)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        $results = $flags & STREAM_URL_STAT_LINK ? $this->sftp->lstat($path) : $this->sftp->stat($path);
        if ($results === false) {
            return false;
        }

        return $results;
    }

    /**
     * Truncate stream
     *
     * @param Integer $new_size
     * @return Boolean
     * @access public
     */
    function _stream_truncate($new_size)
    {
        if (!$this->sftp->truncate($this->path, $new_size)) {
            return false;
        }

        $this->eof = false;
        $this->size = $new_size;

        return true;
    }

    /**
     * Change stream options
     *
     * STREAM_OPTION_WRITE_BUFFER isn't supported for the same reason stream_flush isn't.
     * The other two aren't supported because of limitations in Net_SFTP.
     *
     * @param Integer $option
     * @param Integer $arg1
     * @param Integer $arg2
     * @return Boolean
     * @access public
     */
    function _stream_set_option($option, $arg1, $arg2)
    {
        return false;
    }

    /**
     * Close an resource
     *
     * @access public
     */
    function _stream_close()
    {
    }

    /**
     * __call Magic Method
     *
     * When you're utilizing an SFTP stream you're not calling the methods in this class directly - PHP is calling them for you.
     * Which kinda begs the question... what methods is PHP calling and what parameters is it passing to them? This function
     * lets you figure that out.
     *
     * If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not
     * NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method.
     *
     * @param String
     * @param Array
     * @return Mixed
     * @access public
     */
    function __call($name, $arguments)
    {
        if (defined('NET_SFTP_STREAM_LOGGING')) {
            echo $name . '(';
            $last = count($arguments) - 1;
            foreach ($arguments as $i => $argument) {
                var_export($argument);
                if ($i != $last) {
                    echo ',';
                }
            }
            echo ")\r\n";
        }
        $name = '_' . $name;
        if (!method_exists($this, $name)) {
            return false;
        }
        return call_user_func_array(array($this, $name), $arguments);
    }
}

Net_SFTP_Stream::register();


text:
'use strict';

angular.module('app').controller('nrgiContractTableCtrl', function ($scope,nrgiContractTablesSrvc,usSpinnerService, $filter) {
    $scope.openClose=true;
    $scope.loading = false;
    $scope.contracts=[];
    $scope.expression='';
    $scope.csv_contracts = [];
    var countryName='';
    var commodityName='';
    var headerContracts = [];
    var fields = [];
    usSpinnerService.spin('spinner-contract');
    $scope.$watch('id', function(value) {
        if(value!=undefined){
            $scope.loading = false;
            setTimeout(function(){
            $scope.getContracts($scope.id, $scope.type);},2000)
        }
    });
    $scope.getContracts=function(id,type) {
        if ($scope.id != undefined) {
            if ($scope.openClose == true) {
                if ($scope.contracts.length == 0 || $scope.loading == false) {
                    $scope.loading = true;
                    nrgiContractTablesSrvc.get({
                        _id: id,
                        type: type
                    }, function (success) {
                        $scope.expression='';
                        $scope.contracts =success.contracts;
                        if (success.contracts.length == 0 || _.isEmpty(success.contracts[0])) {
                            $scope.expression = 'showLast';
                            $scope.contracts = [];
                        }
                        usSpinnerService.stop('spinner-contract');
                        var headers = [{name: 'Name', status: !$scope.companies, field: 'contract_name'},
                            {name: 'RC-ID', status: $scope.companies, field: '_id'},
                            {name: 'Country ', status: $scope.country, field: 'contract_country'},
                            {name: 'Commodity ', status: $scope.commodity, field: 'contract_commodity'},
                            {name: 'RC-ID ', status: !$scope.companies, field: '_id'},
                            {name: 'No. Companies ', status: $scope.companies, field: 'companies'}];
                        angular.forEach(headers, function (header) {
                            if (header.status != false && header.status != undefined) {
                                headerContracts.push(header.name);
                                fields.push(header.field);
                            }
                        });
                        $scope.getHeaderContracts = function () {
                            return headerContracts
                        };
                        angular.forEach($scope.contracts, function (contract, key) {
                            $scope.csv_contracts[key] = [];
                            angular.forEach(fields, function (field) {
                                if (field == 'contract_country') {
                                    countryName = '';
                                    if (contract[field] != undefined) {
                                        countryName = contract[field].name.toString();
                                        countryName = countryName.charAt(0).toUpperCase() + countryName.substr(1);
                                    }
                                    $scope.csv_contracts[key].push(countryName);
                                }
                                if(field =='contract_commodity'){
                                    commodityName = '';
                                    if (contract[field] != undefined) {
                                        commodityName = $filter('addSpace')(contract[field].toString())
                                    }
                                    $scope.csv_contracts[key].push(commodityName);
                                }
                                if (field != 'contract_country' && field !='contract_commodity') {
                                    $scope.csv_contracts[key].push(contract[field]);
                                }
                            });
                        })
                    }, function(error){
                        console.log(error)
                        usSpinnerService.stop('spinner-contract');
                    })
                }
            }
        }
    }
});


text:
<?php

namespace Google\Service\DLP;

class GooglePrivacyDlpV2ByteContentItem extends \Google\Model
{
  /**
   * @var string
   */
  public $data;
  /**
   * @var string
   */
  public $type;

  /**
   * @param string
   */
  public function setData($data)
  {
    $this->data = $data;
  }
  /**
   * @return string
   */
  public function getData()
  {
    return $this->data;
  }
  /**
   * @param string
   */
  public function setType($type)
  {
    $this->type = $type;
  }
  /**
   * @return string
   */
  public function getType()
  {
    return $this->type;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GooglePrivacyDlpV2ByteContentItem::class, 'Google_Service_DLP_GooglePrivacyDlpV2ByteContentItem');


text:
LuCI - Lua Configuration Interface

Copyright 2011 Maxim Osipov <maxim.osipov@gmail.com>
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>

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

$Id: index.lua 5485 2009-11-01 14:24:04Z jow $
]]--

module("luci.controller.flexibity.index", package.seeall)

function index()
	luci.i18n.loadc("base")
	local i18n = luci.i18n.translate
        local uci = require("luci.model.uci").cursor()
        local net = require("luci.model.network").init(uci)

	local root = node()
	if not root.lock then
		root.target = alias("flexibity")
		root.index = true
	end

	entry({"about"}, template("about"))

	local page   = entry({"flexibity"}, alias("flexibity", "index"), i18n("Flexibity"), 10)
	page.sysauth = "root"
	page.sysauth_authenticator = "htmlauth"
	page.index = true

	entry({"flexibity", "index"}, alias("flexibity", "index", "index"), i18n("Connect"), 10).index = true
	entry({"flexibity", "index", "index"}, form("flexibity/index"), i18n("Overview"), 1)

	local has_wifi = nixio.fs.stat("/etc/config/wireless")
	if has_wifi and has_wifi.size > 0 then
		page = entry({"flexibity", "index", "wifi"}, arcombine(template("flexibity/wifi_overview"), cbi("flexibity/wifi")), i18n("Wi-Fi"), 3)
		page.leaf = true
		page = entry({"flexibity", "index", "wireless_status"}, call("wifi_status"), nil, 16)
		page.leaf = true
                local wdev
                for _, wdev in ipairs(net:get_wifidevs()) do
                        local wnet
                        for _, wnet in ipairs(wdev:get_wifinets()) do
                                entry(
                                        {"flexibity", "index", "wifi", wnet:id()},
                                        alias("flexibity", "index", "wifi"),
                                        nil
                                )
                        end
                end
	else
		page = entry({"flexibity", "index", "wifi"}, template("flexibity/wifi_empty"), i18n("Wi-Fi"), 3)
		page.leaf = true
	end

	entry({"flexibity", "index", "modem"}, template("flexibity/modem"), i18n("Modem"), 4)

	local has_motion = nixio.fs.stat("/etc/config/motion")
	if has_motion and has_motion.size > 0 then
		entry({"flexibity", "index", "webcam"}, template("flexibity/webcam"), i18n("Webcam"), 5)
		page = entry({"flexibity", "index", "webcam_snapshots"}, template("flexibity/webcam_snapshots"), nil, 17)
		page.leaf = true
		page = entry({"flexibity", "index", "snapshot_update"}, call("snapshot_update"), nil, 18)
		page.leaf = true
	else
		entry({"flexibity", "index", "webcam"}, template("flexibity/webcam_empty"), i18n("Webcam"), 5)
	end

	local has_transmission = nixio.fs.stat("/etc/config/transmission")
	if has_transmission and has_transmission.size > 0 then
	        entry({"flexibity", "index", "torrents"}, template("flexibity/torrent"), i18n("Torrents"), 6)
	else
	        entry({"flexibity", "index", "torrents"}, template("flexibity/torrent_empty"), i18n("Torrents"), 6)
	end

	entry({"flexibity", "index", "logout"}, call("action_logout"), i18n("Logout"), 9)
end

function snapshot_update()
	local fs = require "luci.fs"

	local image_direction = luci.http.formvalue("dir")
        local image_dir = "/www/cam1"
        local image_prefix = "/cam1"
	local image_files = luci.fs.dir(image_dir)
	local image_dates = { }
	local rv = { }
--[[
	luci.http.prepare_content("text/plain")
]]--
	for idx,image_file in ipairs(image_files) do
		image_dates[idx] = luci.fs.mtime(image_dir.."/"..image_file)
--[[
        	luci.http.write("image_file = "..image_file.." image_date = "..image_dates[idx].."\n")
]]--
	end

	local curr_image = luci.http.formvalue("image")
	if curr_image and curr_image ~= "" then
		curr_image = luci.fs.basename(curr_image)
		curr_time = luci.fs.mtime(image_dir.."/"..curr_image)
	else
		curr_image = ""
		curr_time = 0
	end
--[[
        luci.http.write("curr_image = "..curr_image.." curr_time = "..curr_time.."\n")
]]--
	--[[ search for last image ]]--
	local last_image = ""
	local last_time = luci.fs.mtime(image_dir)
	if curr_image == "" then
		last_image = ""
		last_time = 0
		if image_files then
			local image_file
			for idx,image_file in ipairs(image_files) do
				if image_file:match("jpg$") then
					local tmp_time = image_dates[idx]
					if tmp_time > last_time then
						last_time = tmp_time
						last_image = image_file
					end
				end
			end
		end
	--[[ search for next image ]]--
	else
		last_image = ""
		last_time = luci.fs.mtime(image_dir)
		if image_direction == "next" then
			if image_files then
				local image_file
				for idx,image_file in ipairs(image_files) do
					if image_file:match("jpg$") then
						local tmp_time = image_dates[idx]
						if tmp_time > curr_time and tmp_time <= last_time then
							last_time = tmp_time
							last_image = image_file
						end
					end
				end
			end
		end
		if last_image == "" then
			last_image = curr_image
			last_time = curr_time
		end
	end
	if last_image ~= "" then
		rv[#rv+1] = image_prefix.."/"..last_image
	end
--[[
        luci.http.write("last_image = "..last_image.." last_time = "..last_time.."\n")
]]--
	--[[ Find previous image  ]]--
	local prev_image = ""
	local prev_time = 0
	if image_files then
		local image_file
		for idx,image_file in ipairs(image_files) do
			if image_file:match("jpg$") then
				local tmp_time = image_dates[idx]
				if tmp_time < last_time and tmp_time > prev_time then
					prev_time = tmp_time
					prev_image = image_file
				end
			end
		end
	end
	if prev_image == "" then
		prev_image = last_image
		prev_time = last_time
	end
	if prev_image ~= "" then
		rv[#rv+1] = image_prefix.."/"..prev_image
	end
--[[
        luci.http.write("prev_image = "..prev_image.." prev_time = "..prev_time.."\n")
]]--
	if #rv > 0 then
		luci.http.prepare_content("application/json")
		luci.http.write_json(rv)
		return
	end

        luci.http.status(404, "File not found")
end

function wifi_status()
	local path = luci.dispatcher.context.requestpath
	local s    = require "luci.tools.status"
	local rv   = { }

	local dev
	for dev in path[#path]:gmatch("[%w%.%-]+") do
		rv[#rv+1] = s.wifi_network(dev)
	end

	if #rv > 0 then
		luci.http.prepare_content("application/json")
		luci.http.write_json(rv)
		return
	end

        luci.http.status(404, "No such device")
end

function action_logout()
	local dsp = require "luci.dispatcher"
	local sauth = require "luci.sauth"
	if dsp.context.authsession then
		sauth.kill(dsp.context.authsession)
		dsp.context.urltoken.stok = nil
	end

	luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
	luci.http.redirect(luci.dispatcher.build_url())
end


text:
Adds and/or removes permissions of a specific SharePoint group
##Syntax
```powershell
Set-SPOGroupPermissions [-List <ListPipeBind>] [-AddRole <String[]>] [-RemoveRole <String[]>] [-Web <WebPipeBind>] -Identity <GroupPipeBind>
```

##Parameters
Parameter|Type|Required|Description
---------|----|--------|-----------
|AddRole|String[]|False|Name of the permission set to add to this SharePoint group|
|Identity|GroupPipeBind|True|Get the permissions of a specific group by name|
|List|ListPipeBind|False|The list to apply the command to.|
|RemoveRole|String[]|False|Name of the permission set to remove from this SharePoint group|
|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|
##Examples

###Example 1
```powershell
PS:> Set-SPOGroupPermissions -Identity 'My Site Members' -AddRole Contribute
```
Adds the 'Contribute' permission to the SharePoint group with the name 'My Site Members'

###Example 2
```powershell
PS:> Set-SPOGroupPermissions -Identity 'My Site Members' -RemoveRole 'Full Control' -AddRole 'Read'
```
Removes the 'Full Control' from and adds the 'Contribute' permissions to the SharePoint group with the name 'My Site Members'

###Example 3
```powershell
PS:> Set-SPOGroupPermissions -Identity 'My Site Members' -AddRole @('Contribute', 'Design')
```
Adds the 'Contribute' and 'Design' permissions to the SharePoint group with the name 'My Site Members'

###Example 4
```powershell
PS:> Set-SPOGroupPermissions -Identity 'My Site Members' -RemoveRole @('Contribute', 'Design')
```
Removes the 'Contribute' and 'Design' permissions from the SharePoint group with the name 'My Site Members'

###Example 5
```powershell
PS:> Set-SPOGroupPermissions -Identity 'My Site Members' -List 'MyList' -RemoveRole @('Contribute')
```
Removes the 'Contribute' permissions from the list 'MyList' for the group with the name 'My Site Members'


text:
package org.apache.hadoop.hive.serde2.lazy;

import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyBinaryObjectInspector;
import org.apache.hadoop.io.BytesWritable;

public class LazyBinary extends LazyPrimitive<LazyBinaryObjectInspector, BytesWritable> {

  private static final Logger LOG = LoggerFactory.getLogger(LazyBinary.class);

  public LazyBinary(LazyBinaryObjectInspector oi) {
    super(oi);
    data = new BytesWritable();
  }

  public LazyBinary(LazyBinary other){
    super(other);
    BytesWritable incoming = other.getWritableObject();
    byte[] bytes = new byte[incoming.getLength()];
    System.arraycopy(incoming.getBytes(), 0, bytes, 0, incoming.getLength());
    data = new BytesWritable(bytes);
  }

  @Override
  public void init(ByteArrayRef bytes, int start, int length) {
    super.init(bytes, start, length);
    byte[] recv = new byte[length];
    System.arraycopy(bytes.getData(), start, recv, 0, length);
    byte[] decoded = decodeIfNeeded(recv);
    // use the original bytes in case decoding should fail
    decoded = decoded.length > 0 ? decoded : recv;
    data.set(decoded, 0, decoded.length);
  }

  // todo this should be configured in serde
  public static byte[] decodeIfNeeded(byte[] recv) {
    boolean arrayByteBase64 = Base64.isArrayByteBase64(recv);
    if (LOG.isDebugEnabled() && arrayByteBase64) {
      LOG.debug("Data only contains Base64 alphabets only so try to decode the data.");
    }
    return arrayByteBase64 ? Base64.decodeBase64(recv) : recv;
  }
}


text:
package mx.emite.sdk.enums.sat.adaptadores;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import org.beanio.types.TypeConversionException;
import org.beanio.types.TypeHandler;

import lombok.extern.slf4j.Slf4j;
import mx.emite.sdk.enums.sat.TiposPercepcion;
import mx.emite.sdk.errores.ApiException;

@Slf4j
public class TiposPercepcionAdapter extends XmlAdapter<String,TiposPercepcion> implements TypeHandler{

	@Override
	public TiposPercepcion unmarshal(String metodo) throws ApiException {
		return TiposPercepcion.unmarshall(metodo);
	}
	@Override
	public Class<TiposPercepcion> getType() {
		return TiposPercepcion.class;
	}
	@Override
	public Object parse(String text) throws TypeConversionException, ApiException {
		return TiposPercepcion.parse(text);
	}

	@Override
	public String format(Object value){
		try{
		if(value instanceof TiposPercepcion)
			return TiposPercepcion.marshall((TiposPercepcion)value);
		return null;
		}catch(Exception ex){
			log.error("error formateando",ex);
			return null;
		}
	}

	@Override
	public String marshal(TiposPercepcion v) throws Exception {
		return TiposPercepcion.marshall(v);
	}

	/*@Override
	public Paises unmarshal(String metodo) throws ApiException {
		if(StringUtils.isEmpty(metodo))
			return null;
		final Paises pais = Paises.busca(metodo);
		if(pais==null)
			throw new ApiException(I_Api_Errores.CLIENTE_XML_INVALIDO,"El pais "+metodo+" no se encuentra en el catálogo de paises SAT");
		else
			return pais;
	}

	@Override
	public Class<?> getType() {
		return Paises.class;
	}*/
}


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.dialogflow.v2.model;

/**
 * Represents a response message that can be returned by a conversational agent. Response messages
 * are also used for output audio synthesis. The approach is as follows: * If at least one
 * OutputAudioText response is present, then all OutputAudioText responses are linearly
 * concatenated, and the result is used for output audio synthesis. * If the OutputAudioText
 * responses are a mixture of text and SSML, then the concatenated result is treated as SSML;
 * otherwise, the result is treated as either text or SSML as appropriate. The agent designer should
 * ideally use either text or SSML consistently throughout the bot design. * Otherwise, all Text
 * responses are linearly concatenated, and the result is used for output audio synthesis. This
 * approach allows for more sophisticated user experience scenarios, where the text displayed to the
 * user may differ from what is heard.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Dialogflow API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class GoogleCloudDialogflowCxV3ResponseMessage extends com.google.api.client.json.GenericJson {

  /**
   * Indicates that the conversation succeeded.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageConversationSuccess conversationSuccess;

  /**
   * Output only. A signal that indicates the interaction with the Dialogflow agent has ended. This
   * message is generated by Dialogflow only when the conversation reaches `END_SESSION` page. It is
   * not supposed to be defined by the user. It's guaranteed that there is at most one such message
   * in each response.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageEndInteraction endInteraction;

  /**
   * Hands off conversation to a human agent.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageLiveAgentHandoff liveAgentHandoff;

  /**
   * Output only. An audio response message composed of both the synthesized Dialogflow agent
   * responses and responses defined via play_audio. This message is generated by Dialogflow only
   * and not supposed to be defined by the user.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageMixedAudio mixedAudio;

  /**
   * A text or ssml response that is preferentially used for TTS output audio synthesis, as
   * described in the comment on the ResponseMessage message.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageOutputAudioText outputAudioText;

  /**
   * Returns a response containing a custom, platform-specific payload.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Object> payload;

  /**
   * Signal that the client should play an audio clip hosted at a client-specific URI. Dialogflow
   * uses this to construct mixed_audio. However, Dialogflow itself does not try to read or process
   * the URI in any way.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessagePlayAudio playAudio;

  /**
   * A signal that the client should transfer the phone call connected to this agent to a third-
   * party endpoint.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageTelephonyTransferCall telephonyTransferCall;

  /**
   * Returns a text response.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3ResponseMessageText text;

  /**
   * Indicates that the conversation succeeded.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageConversationSuccess getConversationSuccess() {
    return conversationSuccess;
  }

  /**
   * Indicates that the conversation succeeded.
   * @param conversationSuccess conversationSuccess or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setConversationSuccess(GoogleCloudDialogflowCxV3ResponseMessageConversationSuccess conversationSuccess) {
    this.conversationSuccess = conversationSuccess;
    return this;
  }

  /**
   * Output only. A signal that indicates the interaction with the Dialogflow agent has ended. This
   * message is generated by Dialogflow only when the conversation reaches `END_SESSION` page. It is
   * not supposed to be defined by the user. It's guaranteed that there is at most one such message
   * in each response.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageEndInteraction getEndInteraction() {
    return endInteraction;
  }

  /**
   * Output only. A signal that indicates the interaction with the Dialogflow agent has ended. This
   * message is generated by Dialogflow only when the conversation reaches `END_SESSION` page. It is
   * not supposed to be defined by the user. It's guaranteed that there is at most one such message
   * in each response.
   * @param endInteraction endInteraction or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setEndInteraction(GoogleCloudDialogflowCxV3ResponseMessageEndInteraction endInteraction) {
    this.endInteraction = endInteraction;
    return this;
  }

  /**
   * Hands off conversation to a human agent.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageLiveAgentHandoff getLiveAgentHandoff() {
    return liveAgentHandoff;
  }

  /**
   * Hands off conversation to a human agent.
   * @param liveAgentHandoff liveAgentHandoff or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setLiveAgentHandoff(GoogleCloudDialogflowCxV3ResponseMessageLiveAgentHandoff liveAgentHandoff) {
    this.liveAgentHandoff = liveAgentHandoff;
    return this;
  }

  /**
   * Output only. An audio response message composed of both the synthesized Dialogflow agent
   * responses and responses defined via play_audio. This message is generated by Dialogflow only
   * and not supposed to be defined by the user.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageMixedAudio getMixedAudio() {
    return mixedAudio;
  }

  /**
   * Output only. An audio response message composed of both the synthesized Dialogflow agent
   * responses and responses defined via play_audio. This message is generated by Dialogflow only
   * and not supposed to be defined by the user.
   * @param mixedAudio mixedAudio or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setMixedAudio(GoogleCloudDialogflowCxV3ResponseMessageMixedAudio mixedAudio) {
    this.mixedAudio = mixedAudio;
    return this;
  }

  /**
   * A text or ssml response that is preferentially used for TTS output audio synthesis, as
   * described in the comment on the ResponseMessage message.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageOutputAudioText getOutputAudioText() {
    return outputAudioText;
  }

  /**
   * A text or ssml response that is preferentially used for TTS output audio synthesis, as
   * described in the comment on the ResponseMessage message.
   * @param outputAudioText outputAudioText or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setOutputAudioText(GoogleCloudDialogflowCxV3ResponseMessageOutputAudioText outputAudioText) {
    this.outputAudioText = outputAudioText;
    return this;
  }

  /**
   * Returns a response containing a custom, platform-specific payload.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Object> getPayload() {
    return payload;
  }

  /**
   * Returns a response containing a custom, platform-specific payload.
   * @param payload payload or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setPayload(java.util.Map<String, java.lang.Object> payload) {
    this.payload = payload;
    return this;
  }

  /**
   * Signal that the client should play an audio clip hosted at a client-specific URI. Dialogflow
   * uses this to construct mixed_audio. However, Dialogflow itself does not try to read or process
   * the URI in any way.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessagePlayAudio getPlayAudio() {
    return playAudio;
  }

  /**
   * Signal that the client should play an audio clip hosted at a client-specific URI. Dialogflow
   * uses this to construct mixed_audio. However, Dialogflow itself does not try to read or process
   * the URI in any way.
   * @param playAudio playAudio or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setPlayAudio(GoogleCloudDialogflowCxV3ResponseMessagePlayAudio playAudio) {
    this.playAudio = playAudio;
    return this;
  }

  /**
   * A signal that the client should transfer the phone call connected to this agent to a third-
   * party endpoint.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageTelephonyTransferCall getTelephonyTransferCall() {
    return telephonyTransferCall;
  }

  /**
   * A signal that the client should transfer the phone call connected to this agent to a third-
   * party endpoint.
   * @param telephonyTransferCall telephonyTransferCall or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setTelephonyTransferCall(GoogleCloudDialogflowCxV3ResponseMessageTelephonyTransferCall telephonyTransferCall) {
    this.telephonyTransferCall = telephonyTransferCall;
    return this;
  }

  /**
   * Returns a text response.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessageText getText() {
    return text;
  }

  /**
   * Returns a text response.
   * @param text text or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3ResponseMessage setText(GoogleCloudDialogflowCxV3ResponseMessageText text) {
    this.text = text;
    return this;
  }

  @Override
  public GoogleCloudDialogflowCxV3ResponseMessage set(String fieldName, Object value) {
    return (GoogleCloudDialogflowCxV3ResponseMessage) super.set(fieldName, value);
  }

  @Override
  public GoogleCloudDialogflowCxV3ResponseMessage clone() {
    return (GoogleCloudDialogflowCxV3ResponseMessage) super.clone();
  }

}


text:
module Clingo.Inspection.Ground
(
    TermId (..),
    ElementId (..),
    AspifStmt (..),
    registerGroundObserver
)
where

import Control.Monad.IO.Class
import Control.Monad.Catch
import Data.Text (Text, pack)

import Foreign
import Foreign.C
import Numeric.Natural

import Clingo.ProgramBuilding
import Clingo.Internal.Types
import Clingo.Internal.Utils

import qualified Clingo.Raw as Raw

newtype TermId = TermId { termId :: Raw.Identifier }
    deriving (Show, Eq, Ord)

newtype ElementId = ElementId { elementId :: Raw.Identifier }
    deriving (Show, Eq, Ord)

data AspifStmt s
    = GRule Bool [Atom s] [Literal s]
    | GWeightedRule Bool [Atom s] Natural [WeightedLiteral s]
    | GMinimize Natural [WeightedLiteral s]
    | GProject [Atom s]
    | GExternal (Atom s) ExternalType
    | GAssume [Literal s]
    | GHeuristic (Atom s) HeuristicType Integer Natural [Literal s]
    | GAcycEdge Node Node [Literal s]
    | GTheoryTermNumber TermId Integer
    | GTheoryTermString TermId Text
    | GTheoryTermTuple TermId [TermId]
    | GTheoryTermSet TermId [TermId]
    | GTheoryTermList TermId [TermId]
    | GTheoryTermFunction TermId TermId [TermId]
    | GTheoryElement ElementId [TermId] [Literal s]
    | GTheoryAtom (Maybe (Atom s)) TermId [ElementId]
    | GTheoryAtomGuard (Maybe (Atom s)) TermId [ElementId] TermId TermId

mkRawGPO :: MonadIO m
         => (Bool -> IOSym s ())
         -> (AspifStmt s -> IOSym s ())
         -> m (Raw.GroundProgramObserver ())
mkRawGPO inf k = liftIO $ Raw.GroundProgramObserver
    <$> Raw.mkGpoInitProgram (\b _ -> reraiseIO (iosym (inf (toBool b))))
    <*> pure nullFunPtr
    <*> pure nullFunPtr
    <*> Raw.mkGpoRule rul
    <*> Raw.mkGpoWeightRule wrule
    <*> Raw.mkGpoMinimize minim
    <*> Raw.mkGpoProject proj
    <*> Raw.mkGpoExternal exter
    <*> Raw.mkGpoAssume assum
    <*> Raw.mkGpoHeuristic heuristi
    <*> Raw.mkGpoAcycEdge acyc
    <*> Raw.mkGpoTheoryTermNum ttnum
    <*> Raw.mkGpoTheoryTermStr ttstr
    <*> Raw.mkGpoTheoryTermCmp ttcomp
    <*> Raw.mkGpoTheoryElement telem
    <*> Raw.mkGpoTheoryAtom tatom
    <*> Raw.mkGpoTheoryAtomGrd tatomg

    where rul b as an ls ln _ = reraiseIO $ do
              as' <- map Atom <$> peekArray (fromIntegral an) as
              ls' <- map Literal <$> peekArray (fromIntegral ln) ls
              iosym (k (GRule (toBool b) as' ls'))
          wrule b as an w ws wn _ = reraiseIO $ do
              as' <- map Atom <$> peekArray (fromIntegral an) as
              ws' <- map fromRawWeightedLiteral <$>
                        peekArray (fromIntegral wn) ws
              iosym (k (GWeightedRule (toBool b) as' (fromIntegral w) ws'))
          minim w ws wn _ = reraiseIO $ do
              ws' <- map fromRawWeightedLiteral <$>
                        peekArray (fromIntegral wn) ws
              iosym (k (GMinimize (fromIntegral w) ws'))
          proj as an _ = reraiseIO $ do
              as' <- map Atom <$> peekArray (fromIntegral an) as
              iosym (k (GProject as'))
          exter a t _ = reraiseIO $
              iosym (k (GExternal (Atom a) (fromRawExtT t)))
          assum ls n _ = reraiseIO $ do
              ls' <- map Literal <$> peekArray (fromIntegral n) ls
              iosym (k (GAssume ls'))
          heuristi a t c d ls n _ = reraiseIO $ do
              let a' = Atom a
                  t' = fromRawHeuT t
                  c' = fromIntegral c
                  d' = fromIntegral d
              ls' <- map Literal <$> peekArray (fromIntegral n) ls
              iosym (k (GHeuristic a' t' c' d' ls'))
          acyc a b ls n _ = reraiseIO $ do
              let a' = Node . fromIntegral $ a
                  b' = Node . fromIntegral $ b
              ls' <- map Literal <$> peekArray (fromIntegral n) ls
              iosym (k (GAcycEdge a' b' ls'))
          ttnum i x _ = reraiseIO $
              iosym (k (GTheoryTermNumber (TermId i) (fromIntegral x)))
          ttstr i t _ = reraiseIO $ do
              t' <- pack <$> peekCString t
              iosym (k (GTheoryTermString (TermId i) t'))
          ttcomp i a is n _ = reraiseIO $ do
              is' <- map TermId <$> peekArray (fromIntegral n) is
              case a of
                  (-1) -> iosym (k (GTheoryTermTuple (TermId i) is'))
                  (-2) -> iosym (k (GTheoryTermSet (TermId i) is'))
                  (-3) -> iosym (k (GTheoryTermList (TermId i) is'))
                  a'   -> iosym (k (GTheoryTermFunction (TermId i)
                                       (TermId (fromIntegral a')) is'))
          telem i is n ls ln _ = reraiseIO $ do
              is' <- map TermId <$> peekArray (fromIntegral n) is
              ls' <- map Literal <$> peekArray (fromIntegral ln) ls
              iosym (k (GTheoryElement (ElementId i) is' ls'))
          tatom i t es n = reraiseIO $ do
              let i' = if i == 0 then Nothing else Just (Atom (fromIntegral i))
                  t' = TermId t
              es' <- map ElementId <$> peekArray (fromIntegral n) es
              iosym (k (GTheoryAtom i' t' es'))
          tatomg i t es n a b _ = reraiseIO $ do
              let i' = if i == 0 then Nothing else Just (Atom (fromIntegral i))
                  t' = TermId t
                  a' = TermId a
                  b' = TermId b
              es' <- map ElementId <$> peekArray (fromIntegral n) es
              iosym (k (GTheoryAtomGuard i' t' es' a' b'))

registerGroundObserver ::
       (MonadThrow m, MonadIO m)
    => (Bool -> IOSym s ())
    -> (AspifStmt s -> IOSym s ())
    -> ClingoT m s ()
registerGroundObserver i k = do
    ctrl <- askC
    gpo  <- mkRawGPO i k
    marshal0 $ with gpo $ \ptr -> Raw.controlRegisterObserver ctrl ptr nullPtr


text:
package Dec2020Leetcode;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.TreeMap;

public class _0987VerticalOrderTraversalOfABinaryTree {

	public static void main(String[] args) {
		TreeNode tn = new TreeNode(3);
		tn.left = new TreeNode(9);
		tn.right = new TreeNode(20);
		tn.right.left = new TreeNode(15);
		tn.right.right = new TreeNode(7);
		System.out.println(verticalTraversal(tn));

		tn = new TreeNode(1);
		tn.left = new TreeNode(2);
		tn.right = new TreeNode(3);
		tn.left.left = new TreeNode(4);
		tn.left.right = new TreeNode(5);
		tn.right.left = new TreeNode(6);
		tn.right.right = new TreeNode(7);
		System.out.println(verticalTraversal(tn));
	}

	static public class TreeNode {
		int val;
		TreeNode left;
		TreeNode right;

		TreeNode() {
		}

		TreeNode(int val) {
			this.val = val;
		}

		TreeNode(int val, TreeNode left, TreeNode right) {
			this.val = val;
			this.left = left;
			this.right = right;
		}
	}

	static class TreeNodeLevel {
		TreeNode tn;
		int level;

		public TreeNodeLevel(TreeNode tn, int level) {
			this.tn = tn;
			this.level = level;
		}
	}

	public static List<List<Integer>> verticalTraversal(TreeNode root) {
		TreeMap<Integer, List<Integer>> map = new TreeMap<Integer, List<Integer>>();
		List<List<Integer>> output = new ArrayList<List<Integer>>();
		Queue<TreeNodeLevel> q = new LinkedList<TreeNodeLevel>();
		if (root != null)
			q.offer(new TreeNodeLevel(root, 0));
		while (!q.isEmpty()) {
			int size = q.size();
			HashMap<Integer, List<Integer>> mapLocal = new HashMap<Integer, List<Integer>>();
			for (int i = 0; i < size; i++) {
				TreeNodeLevel tnl = q.poll();
				if (mapLocal.containsKey(tnl.level)) {
					mapLocal.get(tnl.level).add(tnl.tn.val);
				} else {
					List<Integer> list = new ArrayList<Integer>();
					list.add(tnl.tn.val);
					mapLocal.put(tnl.level, list);
				}

				if (tnl.tn.left != null) {
					q.offer(new TreeNodeLevel(tnl.tn.left, tnl.level - 1));
				}

				if (tnl.tn.right != null) {
					q.offer(new TreeNodeLevel(tnl.tn.right, tnl.level + 1));
				}
			}

			for (Map.Entry<Integer, List<Integer>> entry : mapLocal.entrySet()) {
				int key = entry.getKey();

				List<Integer> lst = entry.getValue();
				Collections.sort(lst);
				if (map.containsKey(key)) {
					map.get(key).addAll(lst);
				} else {
					map.put(key, lst);
				}
			}
		}

		for (Map.Entry<Integer, List<Integer>> entry : map.entrySet()) {
			output.add(entry.getValue());
		}
		return output;
	}
}


text:
<component name="libraryTable">
  <library name="SBT: com.thoughtworks.paranamer:paranamer:2.6:jar">
    <CLASSES>
      <root url="jar://G:/.ivy2/cache/com.thoughtworks.paranamer/paranamer/jars/paranamer-2.6.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://G:/.ivy2/cache/com.thoughtworks.paranamer/paranamer/srcs/paranamer-2.6-sources.jar!/" />
    </SOURCES>
  </library>
</component>