text:
package gobreaker

import (
	"errors"
	"fmt"
	"sync"
	"time"
)

// State is a type that represents a state of CircuitBreaker.
type State int

// These constants are states of CircuitBreaker.
const (
	StateClosed State = iota
	StateHalfOpen
	StateOpen
)

var (
	// ErrTooManyRequests is returned when the CB state is half open and the requests count is over the cb maxRequests
	ErrTooManyRequests = errors.New("too many requests")
	// ErrOpenState is returned when the CB state is open
	ErrOpenState = errors.New("circuit breaker is open")
)

// String implements stringer interface.
func (s State) String() string {
	switch s {
	case StateClosed:
		return "closed"
	case StateHalfOpen:
		return "half-open"
	case StateOpen:
		return "open"
	default:
		return fmt.Sprintf("unknown state: %d", s)
	}
}

// Counts holds the numbers of requests and their successes/failures.
// CircuitBreaker clears the internal Counts either
// on the change of the state or at the closed-state intervals.
// Counts ignores the results of the requests sent before clearing.
type Counts struct {
	Requests             uint32
	TotalSuccesses       uint32
	TotalFailures        uint32
	ConsecutiveSuccesses uint32
	ConsecutiveFailures  uint32
}

func (c *Counts) onRequest() {
	c.Requests++
}

func (c *Counts) onSuccess() {
	c.TotalSuccesses++
	c.ConsecutiveSuccesses++
	c.ConsecutiveFailures = 0
}

func (c *Counts) onFailure() {
	c.TotalFailures++
	c.ConsecutiveFailures++
	c.ConsecutiveSuccesses = 0
}

func (c *Counts) clear() {
	c.Requests = 0
	c.TotalSuccesses = 0
	c.TotalFailures = 0
	c.ConsecutiveSuccesses = 0
	c.ConsecutiveFailures = 0
}

// Settings configures CircuitBreaker:
//
// Name is the name of the CircuitBreaker.
//
// MaxRequests is the maximum number of requests allowed to pass through
// when the CircuitBreaker is half-open.
// If MaxRequests is 0, the CircuitBreaker allows only 1 request.
//
// Interval is the cyclic period of the closed state
// for the CircuitBreaker to clear the internal Counts.
// If Interval is less than or equal to 0, the CircuitBreaker doesn't clear internal Counts during the closed state.
//
// Timeout is the period of the open state,
// after which the state of the CircuitBreaker becomes half-open.
// If Timeout is less than or equal to 0, the timeout value of the CircuitBreaker is set to 60 seconds.
//
// ReadyToTrip is called with a copy of Counts whenever a request fails in the closed state.
// If ReadyToTrip returns true, the CircuitBreaker will be placed into the open state.
// If ReadyToTrip is nil, default ReadyToTrip is used.
// Default ReadyToTrip returns true when the number of consecutive failures is more than 5.
//
// OnStateChange is called whenever the state of the CircuitBreaker changes.
//
// IsSuccessful is called with the error returned from the request, if not nil.
// If IsSuccessful returns false, the error is considered a failure, and is counted towards tripping the circuit breaker.
// If IsSuccessful returns true, the error will be returned to the caller without tripping the circuit breaker.
// If IsSuccessful is nil, default IsSuccessful is used, which returns false for all non-nil errors.
type Settings struct {
	Name          string
	MaxRequests   uint32
	Interval      time.Duration
	Timeout       time.Duration
	ReadyToTrip   func(counts Counts) bool
	OnStateChange func(name string, from State, to State)
	IsSuccessful  func(err error) bool
}

// CircuitBreaker is a state machine to prevent sending requests that are likely to fail.
type CircuitBreaker struct {
	name          string
	maxRequests   uint32
	interval      time.Duration
	timeout       time.Duration
	readyToTrip   func(counts Counts) bool
	isSuccessful  func(err error) bool
	onStateChange func(name string, from State, to State)

	mutex      sync.Mutex
	state      State
	generation uint64
	counts     Counts
	expiry     time.Time
}

// TwoStepCircuitBreaker is like CircuitBreaker but instead of surrounding a function
// with the breaker functionality, it only checks whether a request can proceed and
// expects the caller to report the outcome in a separate step using a callback.
type TwoStepCircuitBreaker struct {
	cb *CircuitBreaker
}

// NewCircuitBreaker returns a new CircuitBreaker configured with the given Settings.
func NewCircuitBreaker(st Settings) *CircuitBreaker {
	cb := new(CircuitBreaker)

	cb.name = st.Name
	cb.onStateChange = st.OnStateChange

	if st.MaxRequests == 0 {
		cb.maxRequests = 1
	} else {
		cb.maxRequests = st.MaxRequests
	}

	if st.Interval <= 0 {
		cb.interval = defaultInterval
	} else {
		cb.interval = st.Interval
	}

	if st.Timeout <= 0 {
		cb.timeout = defaultTimeout
	} else {
		cb.timeout = st.Timeout
	}

	if st.ReadyToTrip == nil {
		cb.readyToTrip = defaultReadyToTrip
	} else {
		cb.readyToTrip = st.ReadyToTrip
	}

	if st.IsSuccessful == nil {
		cb.isSuccessful = defaultIsSuccessful
	} else {
		cb.isSuccessful = st.IsSuccessful
	}

	cb.toNewGeneration(time.Now())

	return cb
}

// NewTwoStepCircuitBreaker returns a new TwoStepCircuitBreaker configured with the given Settings.
func NewTwoStepCircuitBreaker(st Settings) *TwoStepCircuitBreaker {
	return &TwoStepCircuitBreaker{
		cb: NewCircuitBreaker(st),
	}
}

const defaultInterval = time.Duration(0) * time.Second
const defaultTimeout = time.Duration(60) * time.Second

func defaultReadyToTrip(counts Counts) bool {
	return counts.ConsecutiveFailures > 5
}

func defaultIsSuccessful(err error) bool {
	return err == nil
}

// Name returns the name of the CircuitBreaker.
func (cb *CircuitBreaker) Name() string {
	return cb.name
}

// State returns the current state of the CircuitBreaker.
func (cb *CircuitBreaker) State() State {
	cb.mutex.Lock()
	defer cb.mutex.Unlock()

	now := time.Now()
	state, _ := cb.currentState(now)
	return state
}

// Counts returns internal counters
func (cb *CircuitBreaker) Counts() Counts {
	cb.mutex.Lock()
	defer cb.mutex.Unlock()

	return cb.counts
}

// Execute runs the given request if the CircuitBreaker accepts it.
// Execute returns an error instantly if the CircuitBreaker rejects the request.
// Otherwise, Execute returns the result of the request.
// If a panic occurs in the request, the CircuitBreaker handles it as an error
// and causes the same panic again.
func (cb *CircuitBreaker) Execute(req func() (interface{}, error)) (interface{}, error) {
	generation, err := cb.beforeRequest()
	if err != nil {
		return nil, err
	}

	defer func() {
		e := recover()
		if e != nil {
			cb.afterRequest(generation, false)
			panic(e)
		}
	}()

	result, err := req()
	cb.afterRequest(generation, cb.isSuccessful(err))
	return result, err
}

// Name returns the name of the TwoStepCircuitBreaker.
func (tscb *TwoStepCircuitBreaker) Name() string {
	return tscb.cb.Name()
}

// State returns the current state of the TwoStepCircuitBreaker.
func (tscb *TwoStepCircuitBreaker) State() State {
	return tscb.cb.State()
}

// Counts returns internal counters
func (tscb *TwoStepCircuitBreaker) Counts() Counts {
	return tscb.cb.Counts()
}

// Allow checks if a new request can proceed. It returns a callback that should be used to
// register the success or failure in a separate step. If the circuit breaker doesn't allow
// requests, it returns an error.
func (tscb *TwoStepCircuitBreaker) Allow() (done func(success bool), err error) {
	generation, err := tscb.cb.beforeRequest()
	if err != nil {
		return nil, err
	}

	return func(success bool) {
		tscb.cb.afterRequest(generation, success)
	}, nil
}

func (cb *CircuitBreaker) beforeRequest() (uint64, error) {
	cb.mutex.Lock()
	defer cb.mutex.Unlock()

	now := time.Now()
	state, generation := cb.currentState(now)

	if state == StateOpen {
		return generation, ErrOpenState
	} else if state == StateHalfOpen && cb.counts.Requests >= cb.maxRequests {
		return generation, ErrTooManyRequests
	}

	cb.counts.onRequest()
	return generation, nil
}

func (cb *CircuitBreaker) afterRequest(before uint64, success bool) {
	cb.mutex.Lock()
	defer cb.mutex.Unlock()

	now := time.Now()
	state, generation := cb.currentState(now)
	if generation != before {
		return
	}

	if success {
		cb.onSuccess(state, now)
	} else {
		cb.onFailure(state, now)
	}
}

func (cb *CircuitBreaker) onSuccess(state State, now time.Time) {
	switch state {
	case StateClosed:
		cb.counts.onSuccess()
	case StateHalfOpen:
		cb.counts.onSuccess()
		if cb.counts.ConsecutiveSuccesses >= cb.maxRequests {
			cb.setState(StateClosed, now)
		}
	}
}

func (cb *CircuitBreaker) onFailure(state State, now time.Time) {
	switch state {
	case StateClosed:
		cb.counts.onFailure()
		if cb.readyToTrip(cb.counts) {
			cb.setState(StateOpen, now)
		}
	case StateHalfOpen:
		cb.setState(StateOpen, now)
	}
}

func (cb *CircuitBreaker) currentState(now time.Time) (State, uint64) {
	switch cb.state {
	case StateClosed:
		if !cb.expiry.IsZero() && cb.expiry.Before(now) {
			cb.toNewGeneration(now)
		}
	case StateOpen:
		if cb.expiry.Before(now) {
			cb.setState(StateHalfOpen, now)
		}
	}
	return cb.state, cb.generation
}

func (cb *CircuitBreaker) setState(state State, now time.Time) {
	if cb.state == state {
		return
	}

	prev := cb.state
	cb.state = state

	cb.toNewGeneration(now)

	if cb.onStateChange != nil {
		cb.onStateChange(cb.name, prev, state)
	}
}

func (cb *CircuitBreaker) toNewGeneration(now time.Time) {
	cb.generation++
	cb.counts.clear()

	var zero time.Time
	switch cb.state {
	case StateClosed:
		if cb.interval == 0 {
			cb.expiry = zero
		} else {
			cb.expiry = now.Add(cb.interval)
		}
	case StateOpen:
		cb.expiry = now.Add(cb.timeout)
	default: // StateHalfOpen
		cb.expiry = zero
	}
}


text:
#ifndef color_rgb_get_gray
#define color_rgb_get_gray

// ::color::get::constant::gray::average_entity
// ::color::get::constant::gray::formula_enum
// ::color::get::gray( c )

//#include "../../gray/place/place.hpp"
#include "../../gray/akin/rgb.hpp"
#include "../../gray/trait/component.hpp"
#include "../../gray/constant.hpp"

#include "../category.hpp"

#include "../../_internal/normalize.hpp"
#include "../../_internal/diverse.hpp"
#include "../../generic/trait/scalar.hpp"

#include "../../generic/get/gray.hpp"

#include "../../xyz/constant/transformation.hpp"

 namespace color
  {
   namespace get
    {

     namespace constant
      {
       namespace rgb { namespace gray
        {

         enum formula_enum
          {
               average_entity
            ,   middle_entity
            ,   yuv709_entity
            , hsl_star_entity //!< still under construction
            ,lightness_entity //!< TODO NYI
          };

        }
      }}

     namespace _internal { namespace rgb
      {
       namespace gray
        {

         template
          <
            typename category_name
           ,enum ::color::get::constant::rgb::gray::formula_enum formula_number
          >
          struct usher
           {
            typedef category_name category_type;

            typedef ::color::model<category_type>          model_type;
            typedef typename ::color::trait::component< category_name >::return_type return_type;

            static return_type process( model_type const& color_parameter )
             {
              return color_parameter.template get<0>();
             }
           };

         template< typename tag_name >
          struct usher< ::color::category::rgb< tag_name >, ::color::get::constant::rgb::gray::average_entity >
           {
            typedef ::color::category::rgb< tag_name > category_type;
            typedef ::color::model< category_type > model_type;

            typedef typename ::color::trait::scalar<category_type>::instance_type     scalar_type;

            typedef typename ::color::akin::gray< category_type >::akin_type  akin_type;

            typedef typename ::color::trait::component< akin_type >::return_type return_type;

            typedef ::color::_internal::diverse< akin_type >       diverse_type;
            typedef ::color::_internal::normalize< category_type > normalize_type;

            typedef ::color::constant::gray::rgb< akin_type > gray_const_type;

            enum
             {
                red_p   = ::color::place::_internal::red<category_type>::position_enum
              , green_p = ::color::place::_internal::green<category_type>::position_enum
              , blue_p  = ::color::place::_internal::blue<category_type>::position_enum
             };

            static return_type process( model_type const& color_parameter )
             {
              scalar_type value =
                   normalize_type::template process<red_p   >( color_parameter.template get<red_p   >() )
                 + normalize_type::template process<green_p >( color_parameter.template get<green_p >() )
                 + normalize_type::template process<blue_p  >( color_parameter.template get<blue_p  >() )
               ;

              value /= scalar_type( 3 );

              return diverse_type::template process<0>( /*typename ::color::trait::scalar<akin_type>::instance_type ( */value /* ) */);
             }
           };

         template< typename tag_name >
          struct usher< ::color::category::rgb< tag_name >, ::color::get::constant::rgb::gray::middle_entity >
           {
            typedef ::color::category::rgb< tag_name > category_type;
            typedef ::color::model< category_type > model_type;

            typedef typename ::color::trait::scalar<category_type>::instance_type     scalar_type;

            typedef typename ::color::akin::gray< category_type >::akin_type  akin_type;

            typedef typename ::color::trait::component< akin_type >::return_type return_type;

            typedef ::color::_internal::diverse< akin_type >       diverse_type;
            typedef ::color::_internal::normalize< category_type > normalize_type;

            typedef ::color::constant::gray::rgb< akin_type > gray_const_type;

            enum
             {
                red_p   = ::color::place::_internal::red<category_type>::position_enum
              , green_p = ::color::place::_internal::green<category_type>::position_enum
              , blue_p  = ::color::place::_internal::blue<category_type>::position_enum
             };

            static return_type process( model_type const& color_parameter )
             {
              scalar_type r = normalize_type::template process<red_p   >( color_parameter.template get<red_p   >() );
              scalar_type g = normalize_type::template process<green_p >( color_parameter.template get<green_p >() );
              scalar_type b = normalize_type::template process<blue_p  >( color_parameter.template get<blue_p  >() );

              scalar_type value = ( std::max<scalar_type>( {r,g,b} ) + std::min<scalar_type>( {r,g,b} ) ) / scalar_type( 2 );

              return diverse_type::template process<0>( /*typename ::color::trait::scalar<akin_type>::instance_type ( */value /* ) */);
             }
           };

         template< typename tag_name >
          struct usher< ::color::category::rgb< tag_name >, ::color::get::constant::rgb::gray::yuv709_entity >
           {
            typedef ::color::category::rgb< tag_name > category_type;
            typedef ::color::model< category_type > model_type;

            typedef typename ::color::trait::scalar<category_type>::instance_type     scalar_type;

            typedef typename ::color::akin::gray< category_type >::akin_type  akin_type;

            typedef typename ::color::trait::component< akin_type >::return_type return_type;

            typedef ::color::_internal::diverse< akin_type >       diverse_type;
            typedef ::color::_internal::normalize< category_type > normalize_type;

            typedef ::color::constant::gray::rgb< akin_type > gray_const_type;

            enum
             {
                red_p   = ::color::place::_internal::red<category_type>::position_enum
              , green_p = ::color::place::_internal::green<category_type>::position_enum
              , blue_p  = ::color::place::_internal::blue<category_type>::position_enum
             };

            static return_type process( model_type const& color_parameter )
             {
              scalar_type value =
                   gray_const_type::Rc() * normalize_type::template process<red_p   >( color_parameter.template get<red_p   >() )
                 + gray_const_type::Gc() * normalize_type::template process<green_p >( color_parameter.template get<green_p >() )
                 + gray_const_type::Bc() * normalize_type::template process<blue_p  >( color_parameter.template get<blue_p  >() )
               ;

              return diverse_type::template process<0>( /*typename ::color::trait::scalar<akin_type>::instance_type ( */value /* ) */);
             }
           };

         template< typename tag_name >
          struct usher< ::color::category::rgb< tag_name >, ::color::get::constant::rgb::gray::hsl_star_entity >
           {
            typedef ::color::category::rgb< tag_name > category_type;
            typedef ::color::model< category_type > model_type;

            typedef typename ::color::trait::scalar<category_type>::instance_type     scalar_type;

            typedef typename ::color::akin::gray< category_type >::akin_type  akin_type;

            typedef typename ::color::trait::component< akin_type >::return_type return_type;

            typedef ::color::_internal::diverse< akin_type >       diverse_type;
            typedef ::color::_internal::normalize< category_type > normalize_type;

            typedef ::color::constant::gray::rgb< akin_type > gray_const_type;

            enum
             {
                red_p   = ::color::place::_internal::red<category_type>::position_enum
              , green_p = ::color::place::_internal::green<category_type>::position_enum
              , blue_p  = ::color::place::_internal::blue<category_type>::position_enum
             };

            static return_type process( model_type const& color_parameter )
             {
              scalar_type r =  normalize_type::template process<red_p   >( color_parameter.template get<red_p   >() );
              scalar_type g =  normalize_type::template process<green_p >( color_parameter.template get<green_p >() );
              scalar_type b =  normalize_type::template process<blue_p  >( color_parameter.template get<blue_p  >() );

              scalar_type delta = std::max<scalar_type>( { r,g,b } ) - std::min<scalar_type>( {r,g,b} );
              scalar_type value = ( scalar_type(1) - delta ) * ( scalar_type(1) - delta );

              return diverse_type::template process<0>( /*typename ::color::trait::scalar<akin_type>::instance_type ( */ value /* ) */);
             }
           };

         template< typename tag_name >
          struct usher< ::color::category::rgb< tag_name >, ::color::get::constant::rgb::gray::lightness_entity >
           {
            typedef ::color::category::rgb< tag_name > category_type;
            typedef ::color::model< category_type > model_type;

            typedef typename ::color::trait::scalar<category_type>::instance_type     scalar_type;

            typedef typename ::color::akin::gray< category_type >::akin_type  akin_type;

            typedef typename ::color::trait::component< akin_type >::return_type return_type;

            typedef ::color::_internal::diverse< akin_type >       diverse_type;
            typedef ::color::_internal::normalize< category_type > normalize_type;

            typedef ::color::constant::gray::rgb< akin_type > gray_const_type;

            typedef ::color::constant::xyz::transformation::matrix< scalar_type > xyz_matrix_type;
            typedef ::color::constant::xyz::space::gamma< scalar_type, ::color::constant::xyz::space::sRGB_entity > xyz_gamma_type;
            typedef ::color::constant::xyz::illuminant::point< scalar_type, ::color::constant::xyz::illuminant::D65_entity, ::color::constant::xyz::illuminant::two_entity  > white_point_type;

            enum
             {
               red_p   = ::color::place::_internal::red<category_type>::position_enum
              ,green_p = ::color::place::_internal::green<category_type>::position_enum
              ,blue_p  = ::color::place::_internal::blue<category_type>::position_enum
             };

            static scalar_type f( scalar_type const& t )
             {
              static const scalar_type epsilon = scalar_type(216)/scalar_type(24389);
              static const scalar_type k = scalar_type(24389)/scalar_type(27);
              if( t > epsilon )
               {
                return  cbrt( t );
               }

              return ( k*t + scalar_type(16) )/scalar_type(116);
             }

            static return_type process( model_type const& color_parameter )
             {
              static const scalar_type b21 = xyz_matrix_type::M21(), b22 = xyz_matrix_type::M22(), b23 = xyz_matrix_type::M23();

              scalar_type r =  normalize_type::template process<red_p   >( color_parameter.template get<red_p   >() );
              scalar_type g =  normalize_type::template process<green_p >( color_parameter.template get<green_p >() );
              scalar_type b =  normalize_type::template process<blue_p  >( color_parameter.template get<blue_p  >() );

              r = xyz_gamma_type::decode( r );
              g = xyz_gamma_type::decode( g );
              b = xyz_gamma_type::decode( b );

              scalar_type y = b21 * r + b22 * g + b23 * b;

              y /= white_point_type::Y();
              scalar_type fy = f( y );
              scalar_type l = scalar_type(116) * fy -  scalar_type(16);   //[ 0, 100 ]

              l /= scalar_type( 100 );

              return diverse_type::template process<0>( /*typename ::color::trait::scalar<akin_type>::instance_type ( */ l /* ) */);
             }
           };

        }
      }}

     template
      <
        enum ::color::get::constant::rgb::gray::formula_enum formula_number = ::color::get::constant::rgb::gray::yuv709_entity
       ,typename tag_name
      >
      inline
      typename ::color::model< ::color::category::rgb< tag_name> >::component_const_type
       gray
       (
         ::color::model< ::color::category::rgb< tag_name> > const& color_parameter
       )
       {
        return ::color::get::_internal::rgb::gray::usher< ::color::category::rgb< tag_name >, formula_number  >::process( color_parameter );
       }

    }
  }

#endif

redpajama_set_name: RedPajamaGithub


text:
package com.google.ads.googleads.v12.resources;

public final class ProductGroupViewProto {
  private ProductGroupViewProto() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_ads_googleads_v12_resources_ProductGroupView_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_ads_googleads_v12_resources_ProductGroupView_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n;google/ads/googleads/v12/resources/pro" +
      "duct_group_view.proto\022\"google.ads.google" +
      "ads.v12.resources\032\037google/api/field_beha" +
      "vior.proto\032\031google/api/resource.proto\"\323\001" +
      "\n\020ProductGroupView\022H\n\rresource_name\030\001 \001(" +
      "\tB1\340A\003\372A+\n)googleads.googleapis.com/Prod" +
      "uctGroupView:u\352Ar\n)googleads.googleapis." +
      "com/ProductGroupView\022Ecustomers/{custome" +
      "r_id}/productGroupViews/{adgroup_id}~{cr" +
      "iterion_id}B\207\002\n&com.google.ads.googleads" +
      ".v12.resourcesB\025ProductGroupViewProtoP\001Z" +
      "Kgoogle.golang.org/genproto/googleapis/a" +
      "ds/googleads/v12/resources;resources\242\002\003G" +
      "AA\252\002\"Google.Ads.GoogleAds.V12.Resources\312" +
      "\002\"Google\\Ads\\GoogleAds\\V12\\Resources\352\002&G" +
      "oogle::Ads::GoogleAds::V12::Resourcesb\006p" +
      "roto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
          com.google.api.FieldBehaviorProto.getDescriptor(),
          com.google.api.ResourceProto.getDescriptor(),
        });
    internal_static_google_ads_googleads_v12_resources_ProductGroupView_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_google_ads_googleads_v12_resources_ProductGroupView_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_ads_googleads_v12_resources_ProductGroupView_descriptor,
        new java.lang.String[] { "ResourceName", });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.FieldBehaviorProto.fieldBehavior);
    registry.add(com.google.api.ResourceProto.resource);
    registry.add(com.google.api.ResourceProto.resourceReference);
    com.google.protobuf.Descriptors.FileDescriptor
        .internalUpdateFileDescriptor(descriptor, registry);
    com.google.api.FieldBehaviorProto.getDescriptor();
    com.google.api.ResourceProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
    <title>WebTCPDUMP</title>
    <link rel="stylesheet" href="js/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/tcpdump.css">

TCPDUMP WebUI

Interfaces

    <button id="start" type="button" class="btn btn-default btn-lg">
      Start
    </button>
    <button id="stop" type="button" class="btn btn-default btn-lg">
      Stop
    </button>

Output


text:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

struct Intersection
{
	char C;//ASCII Character
	bool T, R, B, L;//Top, Right, Bottom, Left
};

void GetDimensions();
void Initialize();
void ResetArray(Intersection[]);
int Filter(char, bool);
void DrawGrid();
void CopyArray(Intersection[], Intersection[], int);
Intersection PickRandom();
void SwitchColors();

const int NUMBER_OF_CHARACTERS = 12;
const int SWITCH_INTERVAL = 4;

Intersection available[NUMBER_OF_CHARACTERS];
Intersection **grid = NULL;

int numberOfAvailable, ROWS, COLS, style, color;

void main(void)
{
	srand( time(NULL) );
	color = 0;
	SwitchColors();
	GetDimensions();
	grid = new Intersection *[ROWS];
	for( int i = 0 ; i < ROWS ; i++ )
		grid[i] = new Intersection[COLS];

	while (true)
	{
		system("cls");
		Initialize();

		for (int row = 0; row < ROWS; row++)
		{
			for (int col = 0; col < COLS; col++)
			{
				if (row > 0)// First Row
					numberOfAvailable = Filter('T', grid[row-1][col].B);
				else
					numberOfAvailable = Filter('T', false);
				if (col > 0)// First Column
					numberOfAvailable = Filter('L', grid[row][col-1].R);
				else
					numberOfAvailable = Filter('L', false);

				if (row == ROWS - 1)// Last Row
				{
					numberOfAvailable = Filter('B', false);
					if (col == COLS - 2)
						numberOfAvailable = Filter('R', true);
				}
				if (col == COLS - 1)// Last Column
				{
					numberOfAvailable = Filter('R', false);
					if (row == ROWS - 2)
						numberOfAvailable = Filter('B', true);
				}
				if (row == ROWS - 2 && col == COLS - 2)// bottom-right corner must be connected to top & left
				{
					numberOfAvailable = Filter('B', true);
					numberOfAvailable = Filter('R', true);
				}
				grid[row][col] = PickRandom();
				cout << grid[row][col].C;
				ResetArray(available);
				numberOfAvailable = NUMBER_OF_CHARACTERS;
			}
			cout << endl;
		}

		cout << endl << endl;
		system("pause");
		SwitchColors();
	}
}

void GetDimensions()
{
	cout << "Width: ";
	cin  >> COLS;
	cout << "Height: ";
	cin  >> ROWS;
	cout << "Style (1 or 2): ";
	cin  >> style;
}

void Initialize()
{
	ResetArray(available);
	numberOfAvailable = NUMBER_OF_CHARACTERS;
}

void ResetArray(Intersection Array[])
{
	Intersection Default[] = {{' ', false, false, false, false},// (SPACE)
							{218, false, true, true, false},// ┌
							{191, false, false, true, true},// ┐
							{217, true, false, false, true},// ┘
							{192, true, true, false, false},// └
							{196, false, true, false, true},// ─
							{179, true, false, true, false},// │
							{194, false, true, true, true},//  ┬
							{180, true, false, true, true},//  ┤
							{193, true, true, false, true},//  ┴
							{195, true, true, true, false},//  ├
							{197, true, true, true, true}};//  ┼
	//alternate style characters:
	Intersection Default2[] = {{' ', false, false, false, false},// (SPACE)
							{201, false, true, true, false},// ╔
							{187, false, false, true, true},// ╗
							{188, true, false, false, true},// ╝
							{200, true, true, false, false},// ╚
							{205, false, true, false, true},// ═
							{186, true, false, true, false},// ║
							{203, false, true, true, true},//  ╦
							{185, true, false, true, true},//  ╣
							{202, true, true, false, true},//  ╩
							{204, true, true, true, false},//  ╠
							{206, true, true, true, true}};//  ╬

	if (style == 1)
		CopyArray(Default, Array, NUMBER_OF_CHARACTERS);
	else
		CopyArray(Default2, Array, NUMBER_OF_CHARACTERS);
}

int Filter(char direction, bool connecting)
{
	int count;
	int newPos = 0;
	Intersection newAvailable[NUMBER_OF_CHARACTERS];
	if (direction == 'T')
	{
		for (count = 0; count < numberOfAvailable; count ++)
			if (available[count].T == connecting)
			{
				newAvailable[newPos] = available[count];
				newPos ++;
			}
	}
	else if (direction == 'R')
	{
		for (count = 0; count < numberOfAvailable; count ++)
			if (available[count].R == connecting)
			{
				newAvailable[newPos] = available[count];
				newPos ++;
			}
	}
	else if (direction == 'B')
	{
		for (count = 0; count < numberOfAvailable; count ++)
			if (available[count].B == connecting)
			{
				newAvailable[newPos] = available[count];
				newPos ++;
			}
	}
	else //direction == 'L'
	{
		for (count = 0; count < numberOfAvailable; count ++)
			if (available[count].L == connecting)
			{
				newAvailable[newPos] = available[count];
				newPos ++;
			}
	}
	CopyArray(newAvailable, available, newPos);
	return newPos;
}

void CopyArray(Intersection from[], Intersection to[], int size)
{
	for (int count = 0; count < size; count++)
		to[count] = from[count];
}

Intersection PickRandom() {
	int randomIndex = rand() % numberOfAvailable;
	return available[randomIndex];
}

void SwitchColors()
{
	if (color >= SWITCH_INTERVAL * 2)
		color = 0;
	if (color >= SWITCH_INTERVAL)
		system("color f0");
	else
		system("color 07");
	color++;
}


text:
<archimate:Location
    xmlns:archimate="http://www.archimatetool.com/archimate"
    name="Thailand"
    id="id-0a5220472c7342f390341084c61e2a3c"
    documentation="the Kingdom of Thailand">
  <properties
      key="Country Code"
      value="THA"/>
  <properties
      key="Latest Sync Date"
      value="15/10/2020 17:22:39"/>
  <properties
      key="Capital"
      value="Bangkok"/>
  <properties
      key="Currency"
      value="Baht (THB)"/>
</archimate:Location>


text:
import { FACEBOOK_ID } from '../../app.constants';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/fromPromise';

@Injectable()
export class FacebookLoadService {
  private isLoaded: boolean = false;
  private isLoading: boolean = false;
  private loadObsv: Observable<boolean> = null;

  constructor() { }

  load(): Observable<boolean> {
    if (this.isLoaded) return Observable.of(true);
    else if (this.isLoading) return this.loadObsv;
    this.isLoading = true;

    let prom: Promise<boolean> = new Promise((resolve, reject) => {
      let js,
        id = 'facebook-jssdk',
        ref = document.getElementsByTagName('script')[0];

      js = document.createElement('script');
      js.id = id;
      js.async = true;
      js.src = "//connect.facebook.net/es_ES/sdk.js";
      ref.parentNode.insertBefore(js, ref);

      window.fbAsyncInit = () => {
        FB.init({
          appId: FACEBOOK_ID,
          xfbml: true,
          version: 'v2.8'
        });
        this.isLoaded = true;
        this.isLoading = false;
        resolve(true);
      };
    });

    this.loadObsv = Observable.fromPromise(prom);
    return this.loadObsv;
  }

  login(): Observable<FB.LoginStatusResponse> {
    if(!this.isLoaded) return Observable.throw("Facebook SDK is not loaded!");

    let prom: Promise<FB.LoginStatusResponse> = new Promise((resolve, reject) => {
      FB.getLoginStatus((response) => {
        if (response.status === 'connected') {
          resolve(response);
        } else {
          FB.login((response) => {
            if (response.status === 'connected') {
              resolve(response);
            } else {
              reject("Facebook login failed");
            }
          }, { scope: 'public_profile,email' });
        }
      });
    });

    return Observable.fromPromise(prom);
  }

}


text:
nodeehz
=======

Small node.js EHZ tool to read power values from your smart meter (e.g. Hager EHZ) with SML protocol and OBIS values.

Sample
------

Wirkleistung momentan: -2394.4 W

Gesamt Bezug: 3517.6868 kW

Gesamt Einspeisung: 8723.6061 kW

Install
-------

Get nodeehz: "git clone https://github.com/sunny5/nodeehz.git", "cd nodeehz"

Install needed modules: "npm install node-xml serialport"

Run: "node readSML.js"

Optional
--------

A second tool, pushSML2GroupChat.js, is available to push the ehz data via jabber/xmpp. Further applications can then use this realtime data by entering the configured xmpp room. For this feature to work an account and/or server on www.think5.de GroupChat services is needed. E.g. http://my.sunny5.de uses these xmpp/bosh services.

To run this tool, another node module is necessary, change to directory node_modules: git clone https://github.com/mark-sch/xmppjs.git

Copy mygrid-config.json to grid-config.json and set custom xmpp server, user and password settings here.

Notes
-----
For the serialport module to work, it seems that at least node.js v0.8 is necessary.


text: This is the assignment


text:
namespace media {

// static
SimpleCdmBuffer* SimpleCdmBuffer::Create(uint32_t capacity) {
  DCHECK(capacity);
  return new SimpleCdmBuffer(capacity);
}

SimpleCdmBuffer::SimpleCdmBuffer(uint32_t capacity)
    : buffer_(capacity), size_(0) {}

SimpleCdmBuffer::~SimpleCdmBuffer() {}

void SimpleCdmBuffer::Destroy() {
  delete this;
}

uint32_t SimpleCdmBuffer::Capacity() const {
  return buffer_.size();
}

uint8_t* SimpleCdmBuffer::Data() {
  return buffer_.data();
}

void SimpleCdmBuffer::SetSize(uint32_t size) {
  DCHECK(size <= Capacity());
  size_ = size > Capacity() ? 0 : size;
}

uint32_t SimpleCdmBuffer::Size() const {
  return size_;
}

}  // namespace media


text:
void handleConnect(RakNet::Packet* packet)
{
	if (!mainServer->hasClient(packet->guid))
	{
		mainServer->addClient(packet->guid, *new ConnectedClient(packet->systemAddress));
	}
};


text:
package org.jitsi.videobridge.transform;

import net.sf.fmj.media.rtp.*;
import net.sf.fmj.media.rtp.util.*;
import org.jitsi.impl.neomedia.*;
import org.jitsi.impl.neomedia.rtcp.*;
import org.jitsi.impl.neomedia.transform.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.util.*;

/**
 * A <tt>TransformEngine</tt> implementation which parses RTCP packets and
 * transforms them using a transformer for <tt>RTCPCompoundPacket</tt>s.
 * This is similar to (and based on) <tt>libjitsi</tt>'s
 * <tt>RTCPTerminationTransformEngine</tt> but is not connected with a
 * <tt>MediaStream</tt>.
 * @author Boris Grozev
 */
public class RTCPTransformEngine
    extends SinglePacketTransformer
    implements TransformEngine, Transformer<RTCPCompoundPacket>
{
    /**
     * The <tt>Logger</tt> used by the <tt>RTCPTransformEngine</tt> class
     * and its instances to print debug information.
     */
    private static final Logger logger
            = Logger.getLogger(RTCPTransformEngine.class);

    /**
     * The chain of transformers that operate on <tt>RTCPCompoundPacket</tt>s
     * (already parsed).
     */
    private Transformer<RTCPCompoundPacket>[] chain;

    /**
     * The instance used to parse the input <tt>RawPacket</tt>s/bytes into
     * <tt>RTCPCompoundPacket</tt>s.
     */
    private final RTCPPacketParserEx parser = new RTCPPacketParserEx();

    /**
     * Initializes this transformer with the given chain of transformers.
     * @param chain
     */
    public RTCPTransformEngine(Transformer<RTCPCompoundPacket>[] chain)
    {
        this.chain = chain;
    }

    /**
     * Implements
     * {@link org.jitsi.service.neomedia.Transformer#transform(Object)}.
     *
     * Does not touch outgoing packets.
     */
    @Override
    public RTCPCompoundPacket transform(RTCPCompoundPacket rtcpCompoundPacket)
    {
        // Not implemented.
        return rtcpCompoundPacket;
    }

    /**
     * Implements
     * {@link org.jitsi.service.neomedia.Transformer#reverseTransform(Object)}.
     *
     * Transforms incoming RTCP packets through the configured transformer
     * chain.
     */
    @Override
    public RTCPCompoundPacket reverseTransform(
        RTCPCompoundPacket inPacket)
    {
        if (chain != null)
        {
            for (Transformer<RTCPCompoundPacket> transformer : chain)
            {
                if (transformer != null)
                    inPacket = transformer.reverseTransform(inPacket);
            }
        }

        return inPacket;
    }

    /**
     * Implements
     * {@link org.jitsi.service.neomedia.Transformer#close()}.
     */
    @Override
    public void close()
    {
    }

    /**
     * Implements
     * {@link org.jitsi.impl.neomedia.transform.TransformEngine#getRTPTransformer()}.
     */
    @Override
    public PacketTransformer getRTPTransformer()
    {
        return null;
    }

    /**
     * Implements
     * {@link org.jitsi.impl.neomedia.transform.TransformEngine#getRTCPTransformer()}.
     */
    @Override
    public PacketTransformer getRTCPTransformer()
    {
        return this;
    }

    /**
     * Implements
     * {@link org.jitsi.impl.neomedia.transform.SinglePacketTransformer#transform(org.jitsi.impl.neomedia.RawPacket)}
     *
     * Does not touch outgoing packets.
     */
    @Override
    public RawPacket transform(RawPacket packet)
    {
        // Not implemented.
        return packet;
    }

    /**
     * Implements
     * {@link org.jitsi.impl.neomedia.transform.SinglePacketTransformer#reverseTransform(org.jitsi.impl.neomedia.RawPacket)}
     *
     * Parses the given packet as an RTCP packet and transforms the result
     * using the configured transformer chain. Returns the <tt>RawPacket</tt>
     * constructed from the transformed <tt>RTCPCompoundPacket</tt>.
     */
    @Override
    public RawPacket reverseTransform(RawPacket pkt)
    {
        // Parse the RTCP packet.
        RTCPCompoundPacket inRTCPPacket;
        try
        {
            inRTCPPacket = (RTCPCompoundPacket) parser.parse(
                    pkt.getBuffer(),
                    pkt.getOffset(),
                    pkt.getLength());
        }
        catch (BadFormatException e)
        {
            // TODO(gp) decide what to do with malformed packets!
            logger.error("Could not parse RTCP packet.", e);
            return pkt;
        }

        // Transform the RTCP packet with the transform chain.
        RTCPCompoundPacket outRTCPPacket = reverseTransform(inRTCPPacket);

        if (outRTCPPacket == null
                || outRTCPPacket.packets == null
                || outRTCPPacket.packets.length == 0)
            return null;

        // Assemble the RTCP packet.
        int len = outRTCPPacket.calcLength();
        outRTCPPacket.assemble(len, false);

        pkt.setBuffer(outRTCPPacket.data);
        pkt.setLength(outRTCPPacket.data.length);
        pkt.setOffset(0);

        return pkt;
    }
}


text:
package Composite;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

//swing classes

public class Jxframe extends JFrame {
  public Jxframe(String title) {
    super(title);
    setCloseClick();
    setLF();
  }

  private void setCloseClick() {
    //create window listener to respond to window close click
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
  }

  //------------------------------------------
  private void setLF() {
    // Force SwingApp to come up in the System L&F
    String laf = UIManager.getSystemLookAndFeelClassName();
    try {
      UIManager.setLookAndFeel(laf);
    } catch (UnsupportedLookAndFeelException exc) {
      System.err.println("Warning: UnsupportedLookAndFeel: " + laf);
    } catch (Exception exc) {
      System.err.println("Error loading " + laf + ": " + exc);
    }
  }
}


text:
<ion-view class="blackbg">

        <button class="button button-icon icon ion-clipboard white" onclick="window.location = '#/newsfeed'"></button>

        <button class="button button-icon icon ion-ios7-person white" onclick="window.location = '#/ranking'"></button>

    <ion-content class="contentContainer">

{{loggedInUser.name}}

{{getRankName(loggedInUser.points)}}

{{loggedInUser.points}}

{{rankList[$index]}}

You

{{friend.name}}

{{getRankName(friend.points)}}

{{friend.points}}

+ {{friend.punctual}}

- {{friend.penalty}}

    </ion-content>

</ion-view>


text:
BEGIN_INANITY_OIL

MaterialInstance::MaterialInstance(ptr<Material> material)
: material(material) {}

MaterialInstance::~MaterialInstance() {}

ptr<Material> MaterialInstance::GetMaterial() const
{
	return material;
}

END_INANITY_OIL


text:
package com.logginghub.logging.servers;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.logginghub.logging.listeners.ConnectionListener;
import com.logginghub.utils.WorkerThread;

/**
 * A worker thread that handles a java.net.ServerSocket. Add
 * ConnectionListeners to handle the newly accepted connections.
 *
 * @deprecated not used anymore
 * @author admin
 */
public class ServerSocketWorkerThread extends WorkerThread
{
    private List<ConnectionListener> m_listeners = new ArrayList<ConnectionListener>();
    private int m_port;
    private ServerSocket m_serverSocket;
    private Logger m_logger = Logger.getLogger(this.getClass().getName());
    private CountDownLatch m_boundLatch = new CountDownLatch(1);

    public ServerSocketWorkerThread(int port)
    {
        super("ServerSocketWorkerThread");

        m_port = port;
    }

    public void addConnectionListner(ConnectionListener listener)
    {
        m_listeners.add(listener);
    }

    public void removeConnectionListener(ConnectionListener listener)
    {
        m_listeners.remove(listener);
    }

    // //////////////////////////////////////////////////////////////////
    // WorkerThread overrides
    // //////////////////////////////////////////////////////////////////

    @Override
    protected void onRun()
    {
        if(ensureBound())
        {
            try
            {
                Socket accepted = accept();
                fireListeners(accepted);
            }
            catch (IOException e)
            {
                if(keepRunning())
                {
                    m_logger.log(Level.INFO, "Failed to accept connection", e);
                }
            }
        }
    }

    @Override
    protected void beforeStart()
    {

    }

    @Override
    protected void beforeStop()
    {
        if(m_serverSocket != null)
        {
            try
            {
                m_serverSocket.close();
            }
            catch (IOException e)
            {
                m_logger.log(Level.FINE,
                             "Failed to close server socket whilst stopping, this is odd but shouldn't cause any issues",
                             e);
            }
        }
    }

    // //////////////////////////////////////////////////////////////////
    // Private methods
    // //////////////////////////////////////////////////////////////////

    private void fireListeners(Socket accepted)
    {
        for(ConnectionListener listener : m_listeners)
        {
//            listener.onNewConnection(accepted);
        }
    }

    private Socket accept() throws IOException
    {
        return m_serverSocket.accept();
    }

    private boolean ensureBound()
    {
        if(m_serverSocket == null || !m_serverSocket.isBound())
        {
            try
            {
                m_serverSocket = new ServerSocket(m_port);
                m_logger.log(Level.INFO, "Successfully bound to server port " + m_port);
                m_boundLatch.countDown();
            }
            catch (IOException e)
            {
                m_logger.log(Level.WARNING, "Failed to bind to server port " + m_port, e);
                m_serverSocket = null;
            }
        }

        return true;
    }

    public void waitUntilBound()
    {
        try
        {
            m_boundLatch.await();
        }
        catch (InterruptedException e)
        {
            throw new RuntimeException("Thread was interupted waiting on the bound latch, so we do not know what start the server socket is in", e);
        }
    }
}


text:
# `lines-between-class-members`

Requires or disallows an empty line between class members.

This rule improves readability by enforcing lines between class members. It will not check empty lines before the first member and after the last member. This rule require or disallow an empty line between class members.

## Rule Details

This rule extends the base [`eslint/lines-between-class-members`](https://eslint.org/docs/rules/lines-between-class-members) rule.
It adds support for ignoring overload methods in a class.

See the [ESLint documentation](https://eslint.org/docs/rules/lines-between-class-members) for more details on the `lines-between-class-members` rule.

## Rule Changes

```jsonc
{
  // note you must disable the base rule as it can report incorrect errors
  "lines-between-class-members": "off",
  "@typescript-eslint/lines-between-class-members": ["error"]
}
```

In addition to the options supported by the `lines-between-class-members` rule in ESLint core, the rule adds the following options:

## Options

This rule has a string option and an object option.

- Object option:

  - `"exceptAfterOverload": true` (default) - Skip checking empty lines after overload class members
  - `"exceptAfterOverload": false` - **do not** skip checking empty lines after overload class members

- [See the other options allowed](https://github.com/eslint/eslint/blob/main/docs/rules/lines-between-class-members.md#options)

### `exceptAfterOverload: true`

Examples of **correct** code for the `{ "exceptAfterOverload": true }` option:

```ts
/*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": true }]*/

class foo {
  bar(a: string): void;
  bar(a: string, b: string): void;
  bar(a: string, b: string) {}

  baz() {}

  qux() {}
}
```

### `exceptAfterOverload: false`

Examples of **correct** code for the `{ "exceptAfterOverload": false }` option:

```ts
/*eslint @typescript-eslint/lines-between-class-members: ["error", "always", { "exceptAfterOverload": false }]*/

class foo {
  bar(a: string): void;

  bar(a: string, b: string): void;

  bar(a: string, b: string) {}

  baz() {}

  qux() {}
}
```

<sup>

Taken with ❤ [from ESLint core](https://github.com/eslint/eslint/blob/main/docs/rules/lines-between-class-members.md)

</sup>


text:
namespace mojo {

template <>
class MOJO_COMMON_EXPORT TypeConverter<String, base::StringPiece> {
 public:
  static String ConvertFrom(const base::StringPiece& input);
  static base::StringPiece ConvertTo(const String& input);
};

template <>
class MOJO_COMMON_EXPORT TypeConverter<String, base::string16> {
 public:
  static String ConvertFrom(const base::string16& input);
  static base::string16 ConvertTo(const String& input);
};

}  // namespace mojo

#endif  // MOJO_COMMON_COMMON_TYPE_CONVERTERS_H_


text:
.class Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;
.super Ljava/lang/Object;
.source "BillboardDialogFragment.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;->onCreateDialog(Landroid/os/Bundle;)Landroid/app/Dialog;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;

.field final synthetic val$buttonTrigger:Ljava/lang/String;

.field final synthetic val$id:Ljava/lang/String;

# direct methods
.method constructor <init>(Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;Ljava/lang/String;Ljava/lang/String;)V
    .registers 4
    .param p1, "this$0"    # Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;

    .prologue
    .line 192
    iput-object p1, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->this$0:Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;

    iput-object p2, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->val$id:Ljava/lang/String;

    iput-object p3, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->val$buttonTrigger:Ljava/lang/String;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .registers 6
    .param p1, "dialog"    # Landroid/content/DialogInterface;
    .param p2, "which"    # I

    .prologue
    .line 195
    iget-object v0, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->this$0:Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;

    iget-object v1, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->val$id:Ljava/lang/String;

    iget-object v2, p0, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment$5;->val$buttonTrigger:Ljava/lang/String;

    # invokes: Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;->executeActions(Ljava/lang/String;Ljava/lang/String;)V
    invoke-static {v0, v1, v2}, Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;->access$000(Lcom/upsight/android/marketing/internal/billboard/BillboardDialogFragment;Ljava/lang/String;Ljava/lang/String;)V

    .line 196
    return-void
.end method


text:
namespace LifeAdvanced
{
    partial class ResultScreen
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResultScreen));
            this.title = new System.Windows.Forms.Label();
            this.text = new System.Windows.Forms.TextBox();
            this.choice1 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // title
            //
            this.title.BackColor = System.Drawing.Color.Black;
            this.title.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.title.ForeColor = System.Drawing.Color.White;
            this.title.Location = new System.Drawing.Point(12, 61);
            this.title.Name = "title";
            this.title.Size = new System.Drawing.Size(1240, 73);
            this.title.TabIndex = 0;
            this.title.Text = "Event Title";
            this.title.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            //
            // text
            //
            this.text.BackColor = System.Drawing.Color.Black;
            this.text.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.text.ForeColor = System.Drawing.Color.White;
            this.text.Location = new System.Drawing.Point(12, 167);
            this.text.Multiline = true;
            this.text.Name = "text";
            this.text.ReadOnly = true;
            this.text.Size = new System.Drawing.Size(1240, 172);
            this.text.TabIndex = 1;
            this.text.Text = "Event Text";
            //
            // choice1
            //
            this.choice1.BackColor = System.Drawing.Color.White;
            this.choice1.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.choice1.Location = new System.Drawing.Point(12, 517);
            this.choice1.Name = "choice1";
            this.choice1.Size = new System.Drawing.Size(1240, 102);
            this.choice1.TabIndex = 2;
            this.choice1.Text = "Continue";
            this.choice1.UseVisualStyleBackColor = false;
            this.choice1.Click += new System.EventHandler(this.choice1_Click);
            //
            // label1
            //
            this.label1.AutoEllipsis = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.White;
            this.label1.Location = new System.Drawing.Point(12, 372);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(1240, 31);
            this.label1.TabIndex = 3;
            this.label1.Text = "label1";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // ResultScreen
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.Black;
            this.ClientSize = new System.Drawing.Size(1264, 681);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.choice1);
            this.Controls.Add(this.text);
            this.Controls.Add(this.title);
            this.ForeColor = System.Drawing.Color.Black;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "ResultScreen";
            this.Text = "EventScreen";
            this.Load += new System.EventHandler(this.EventScreen_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label title;
        private System.Windows.Forms.TextBox text;
        private System.Windows.Forms.Button choice1;
        private System.Windows.Forms.Label label1;
    }
}


text:
MIT License

Copyright (c) 2022 Ryan Ward

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
local bin, bits = require("bin").init()
return function(self,data,client)
    local cmd,data = data:match("!(.-)!(.*)")
    --print("SERVER",cmd,data)
    if cmd == "PING" then
        self:send(client,"!PONG!")
    elseif cmd == "N_THREAD" then
        print(1)
        local dat = bin.new(data)
        print(2)
        local t = dat:getBlock("t")
        print(3)
        local ret = bin.new()
        print(4)
        ret:addBlock{ID = t.id,rets = {t.func(unpack(t.args))}}
        print(5)
        print(client,"!RETURNS!"..ret:getData())
        self:send(client,"!RETURNS!"..ret:getData())
        print(6)
	elseif cmd == "CHANNEL" then
        local dat = bin.new(data):getBlock("t")

    end
end


text:
package com.bombardier.plugin.history;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Used to persist all successfully executed test cases represented as {@link Test}.
 * @author Samuil Dragnev
 * @since 1.0
 */

@XmlRootElement(name = "history")
@XmlAccessorType(XmlAccessType.FIELD)
public class History {

	@XmlElement(name = "test")
	private List<Test> tests;

	/**
	 * Default constructor - used to initialize some
	 * of the variables.
	 */
	public History() {
		tests = new ArrayList<Test>();
	}

	public List<Test> getTests() {
		return tests;
	}

	public void setTests(List<Test> tests) {
		this.tests = tests;
	}
}


text:
package kpt

import (
	"bytes"
	"context"
	"fmt"
	"io"
	"os"
	"os/exec"
	"path/filepath"

	"sigs.k8s.io/kustomize/kyaml/fn/framework"
	"sigs.k8s.io/kustomize/kyaml/kio"
	"sigs.k8s.io/kustomize/kyaml/yaml"

	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/access"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/debug"
	component "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/component/kubernetes"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/label"
	deployutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/util"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/event"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/instrumentation"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/manifest"
	kstatus "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/status"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/log"
	olog "github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/render/kptfile"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/status"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
)

const (
	deployerName = "kptV2"
	defaultNs    = "default"
)

var (
	openFile    = os.Open
	kptInitFunc = kptfileInitIfNot
)

// Deployer deploys workflows with kpt CLI
type Deployer struct {
	configName string

	*latest.KptDeploy
	applyDir string

	accessor      access.Accessor
	logger        log.Logger
	debugger      debug.Debugger
	statusMonitor status.Monitor
	syncer        sync.Syncer

	podSelector *kubernetes.ImageList
	labeller    *label.DefaultLabeller
	localImages []graph.Artifact // the set of images parsed from the Deployer's manifest set

	insecureRegistries map[string]bool
	globalConfig       string
	kubeContext        string
	kubeConfig         string
	namespace          string
	namespaces         *[]string
}

type Config interface {
	kubectl.Config
	kstatus.Config
}

// NewDeployer generates a new Deployer object contains the kptDeploy schema.
func NewDeployer(cfg Config, labeller *label.DefaultLabeller, d *latest.KptDeploy, opts config.SkaffoldOptions, configName string) (*Deployer, error) {
	defaultNamespace := ""
	if d.DefaultNamespace != nil {
		var err error
		defaultNamespace, err = util.ExpandEnvTemplate(*d.DefaultNamespace, nil)
		if err != nil {
			return nil, err
		}
	}

	podSelector := kubernetes.NewImageList()
	namespaces := []string{}

	// TODO(nkubala)[v2-merge]: We probably shouldn't use kubectl at all here?
	// But if we do, need to expose a `kubectlFlags` field on the kpt schema?
	kubectl := kubectl.NewCLI(cfg, latest.KubectlFlags{}, defaultNamespace)

	if opts.InventoryNamespace != "" {
		d.InventoryNamespace = opts.InventoryNamespace
	}
	if opts.InventoryID != "" {
		d.InventoryID = opts.InventoryID
	}
	if opts.InventoryName != "" {
		d.Name = opts.InventoryName
	}

	logger := component.NewLogger(cfg, kubectl.CLI, podSelector, &namespaces)
	return &Deployer{
		configName:         configName,
		KptDeploy:          d,
		applyDir:           d.Dir,
		podSelector:        podSelector,
		accessor:           component.NewAccessor(cfg, cfg.GetKubeContext(), kubectl.CLI, podSelector, labeller, &namespaces),
		debugger:           component.NewDebugger(cfg.Mode(), podSelector, &namespaces, cfg.GetKubeContext()),
		logger:             logger,
		statusMonitor:      component.NewMonitor(cfg, cfg.GetKubeContext(), labeller, &namespaces),
		syncer:             component.NewSyncer(kubectl.CLI, &namespaces, logger.GetFormatter()),
		insecureRegistries: cfg.GetInsecureRegistries(),
		labeller:           labeller,
		globalConfig:       cfg.GlobalConfig(),
		kubeContext:        cfg.GetKubeContext(),
		kubeConfig:         cfg.GetKubeConfig(),
		namespace:          cfg.GetKubeNamespace(),
		namespaces:         &namespaces,
	}, nil
}

func (k *Deployer) ConfigName() string {
	return k.configName
}

func (k *Deployer) GetAccessor() access.Accessor {
	return k.accessor
}

func (k *Deployer) GetDebugger() debug.Debugger {
	return k.debugger
}

func (k *Deployer) GetLogger() log.Logger {
	return k.logger
}

func (k *Deployer) GetStatusMonitor() status.Monitor {
	return k.statusMonitor
}

func (k *Deployer) GetSyncer() sync.Syncer {
	return k.syncer
}

// TrackBuildArtifacts registers build artifacts to be tracked by a Deployer
func (k *Deployer) TrackBuildArtifacts(builds, deployedImages []graph.Artifact) {
	deployutil.AddTagsToPodSelector(builds, deployedImages, k.podSelector)
	k.logger.RegisterArtifacts(builds)
}

func (k *Deployer) RegisterLocalImages(images []graph.Artifact) {
	k.localImages = images
}

type processor struct {
	applyDir string
}

func (p processor) Process(rl *framework.ResourceList) error {
	for i := range rl.Items {
		_, err := rl.Items[i].String()
		if err != nil {
			return sourceErr(err, p.applyDir)
		}
	}
	return nil
}

func (k *Deployer) getManifests(ctx context.Context) (manifest.ManifestList, error) {
	cmd := exec.CommandContext(
		ctx, "kpt", "fn", "source", k.applyDir)
	buf, err := util.RunCmdOut(ctx, cmd)
	if err != nil {
		return nil, sourceErr(err, k.applyDir)
	}

	input := bytes.NewBufferString(string(buf))
	var outBuf []byte
	output := bytes.NewBuffer(outBuf)

	rw := kio.ByteReadWriter{
		Reader: input,
		Writer: output,
	}

	p := processor{
		applyDir: k.applyDir,
	}

	if err = framework.Execute(p, &rw); err != nil {
		return nil, err
	}

	manifests := manifest.ManifestList{}
	if len(buf) > 0 {
		manifests.Append(buf)
	}
	return manifests, nil
}

// kptfileInitIfNot guarantees the Kptfile is valid.
func kptfileInitIfNot(ctx context.Context, out io.Writer, k *Deployer) error {
	kptFilePath := filepath.Join(k.applyDir, kptfile.KptFileName)
	if _, err := os.Stat(kptFilePath); os.IsNotExist(err) {
		_, endTrace := instrumentation.StartTrace(ctx, "Deploy_InitKptfile")
		cmd := exec.CommandContext(ctx, "kpt", "pkg", "init", k.applyDir)
		cmd.Stdout = out
		cmd.Stderr = out
		if err := util.RunCmd(ctx, cmd); err != nil {
			endTrace(instrumentation.TraceEndError(err))
			return pkgInitErr(err, k.applyDir)
		}
	}
	file, err := openFile(kptFilePath)
	if err != nil {
		return openFileErr(err, kptFilePath)
	}
	defer file.Close()
	kfConfig := &kptfile.KptFile{}
	if err := yaml.NewDecoder(file).Decode(&kfConfig); err != nil {
		return parseFileErr(err, kptFilePath)
	}
	// Kptfile may already exist but do not contain the "Inventory" field, which is mandatory for `kpt live apply`.
	// This case happens when Kptfile is created by `kpt pkg init` and can be resolved by running `kpt live init`.
	// If "Inventory" already exist, running `kpt live init` raises error.
	if kfConfig.Inventory == nil {
		_, endTrace := instrumentation.StartTrace(ctx, "Deploy_InitKptfileInventory")
		args := []string{"live", "init", k.applyDir}
		args = append(args, k.KptDeploy.Flags...)
		if k.Name != "" {
			args = append(args, "--name", k.Name)
		}
		if k.InventoryID != "" {
			args = append(args, "--inventory-id", k.InventoryID)
		}
		// TODO(nkubala)[v2-merge]: we're tracking multiple namespaces on the deployer now.
		// should this be removed?
		if k.namespace != "" {
			args = append(args, "--namespace", k.namespace)
		} else if k.InventoryNamespace != "" {
			args = append(args, "--namespace", k.InventoryNamespace)
		}
		if k.Force {
			args = append(args, "--force", "true")
		}
		cmd := exec.CommandContext(ctx, "kpt", args...)
		cmd.Stdout = out
		cmd.Stderr = out
		if err := util.RunCmd(ctx, cmd); err != nil {
			endTrace(instrumentation.TraceEndError(err))
			return liveInitErr(err, k.applyDir)
		}
	} else {
		if k.InventoryID != "" && k.InventoryID != kfConfig.Inventory.InventoryID {
			olog.Entry(context.TODO()).Warnf("Updating Kptfile inventory from %v to %v", kfConfig.Inventory.InventoryID, k.InventoryID)
			kfConfig.Inventory.InventoryID = k.InventoryID
		}
		if k.Name != "" && k.Name != kfConfig.Inventory.Name {
			olog.Entry(context.TODO()).Warnf("Updating Kptfile name from %v to %v", kfConfig.Inventory.Name, k.Name)
			kfConfig.Inventory.Name = k.Name
		}
		// Set the namespace to be a valid kubernetes namespace value. If not specified, the value shall be "default".
		if k.namespace == "" {
			k.namespace = defaultNs
		}
		if k.InventoryNamespace == "" {
			k.InventoryNamespace = defaultNs
		}
		if k.namespace != kfConfig.Inventory.Namespace {
			olog.Entry(context.TODO()).Warnf("Updating Kptfile namespace from %v to %v", kfConfig.Inventory.Namespace, k.namespace)
			kfConfig.Inventory.Namespace = k.namespace
		} else if k.InventoryNamespace != kfConfig.Inventory.Namespace {
			olog.Entry(context.TODO()).Warnf("Updating Kptfile namespace from %v to %v", kfConfig.Inventory.Namespace, k.InventoryNamespace)
			kfConfig.Inventory.Namespace = k.InventoryNamespace
		}
		configByte, err := yaml.Marshal(kfConfig)
		if err != nil {
			return err
		}
		if err = os.WriteFile(kptFilePath, configByte, 0644); err != nil {
			return err
		}
	}
	return nil
}

func (k *Deployer) Deploy(ctx context.Context, out io.Writer, builds []graph.Artifact, _ manifest.ManifestListByConfig) error {
	if err := kptInitFunc(ctx, out, k); err != nil {
		return err
	}

	instrumentation.AddAttributesToCurrentSpanFromContext(ctx, map[string]string{
		"DeployerType": deployerName,
	})
	_, endTrace := instrumentation.StartTrace(ctx, "Deploy_ReadHydratedManifests")
	manifests, err := k.getManifests(ctx)
	if err != nil {
		event.DeployInfoEvent(fmt.Errorf("could not read the hydrated manifest from %v: %w", k.applyDir, err))
	}
	endTrace()

	// Add debug transformations
	debugHelpersRegistry, err := config.GetDebugHelpersRegistry(k.globalConfig)
	if err != nil {
		return err
	}
	if manifests, err = manifest.ApplyTransforms(manifests, builds, k.insecureRegistries, debugHelpersRegistry); err != nil {
		return err
	}

	_, endTrace = instrumentation.StartTrace(ctx, "Deploy_CollectNamespaces")
	namespaces, err := manifests.CollectNamespaces()
	if err != nil {
		event.DeployInfoEvent(fmt.Errorf("could not fetch deployed resource namespace. "+
			"This might cause port-forward and deploy health-check to fail: %w", err))
	}
	endTrace()

	childCtx, endTrace := instrumentation.StartTrace(ctx, "Deploy_execKptCommand")
	args := []string{"live", "apply", k.applyDir}

	args = append(args, k.Flags...)
	args = append(args, k.ApplyFlags...)
	cmd := exec.CommandContext(childCtx, "kpt", args...)
	cmd.Stdout = out
	cmd.Stderr = out
	if err := util.RunCmd(ctx, cmd); err != nil {
		endTrace(instrumentation.TraceEndError(err))
		return liveApplyErr(err, k.applyDir)
	}
	k.TrackBuildArtifacts(builds, builds)
	k.trackNamespaces(namespaces)
	endTrace()
	return nil
}

// TODO(yuwenma)[07/23/22]: remove Render func from all deployers and deployerMux.
func (k *Deployer) Render(context.Context, io.Writer, []graph.Artifact, bool, string) error {
	return fmt.Errorf("shall not be called")
}

// Dependencies is the v1 function required by "deployer" interface. It shall be no-op for v2 deployers.
func (k *Deployer) Dependencies() ([]string, error) {
	return []string{}, nil
}

// Cleanup deletes what was deployed by calling `kpt live destroy`.
func (k *Deployer) Cleanup(ctx context.Context, out io.Writer, dryRun bool, _ manifest.ManifestListByConfig) error {
	instrumentation.AddAttributesToCurrentSpanFromContext(ctx, map[string]string{
		"DeployerType": deployerName,
	})
	if err := kptInitFunc(ctx, out, k); err != nil {
		return err
	}

	var args []string
	if dryRun {
		args = append(args, "live", "status", k.applyDir)
	} else {
		args = append(args, "live", "destroy", k.applyDir)
	}

	args = append(args, k.Flags...)
	cmd := exec.CommandContext(ctx, "kpt", args...)
	cmd.Stdout = out
	cmd.Stderr = out
	if err := util.RunCmd(ctx, cmd); err != nil {
		return liveDestroyErr(err, k.applyDir)
	}

	return nil
}

func (k *Deployer) trackNamespaces(namespaces []string) {
	fmt.Fprintf(os.Stdout, "tracking namespaces: %+v\n", namespaces)
	*k.namespaces = deployutil.ConsolidateNamespaces(*k.namespaces, namespaces)
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<keywordspec generated="20170201 07:02:42" type="library" name="String" format="ROBOT">
<version>3.0.1</version>
<scope>global</scope>
<namedargs>yes</namedargs>
<doc>A test library for string manipulation and verification.

``String`` is Robot Framework's standard library for manipulating
strings (e.g. `Replace String Using Regexp`, `Split To Lines`) and
verifying their contents (e.g. `Should Be String`).

Following keywords from ``BuiltIn`` library can also be used with strings:

- `Catenate`
- `Get Length`
- `Length Should Be`
- `Should (Not) Be Empty`
- `Should (Not) Be Equal (As Strings/Integers/Numbers)`
- `Should (Not) Match (Regexp)`
- `Should (Not) Contain`
- `Should (Not) Start With`
- `Should (Not) End With`
- `Convert To String`
- `Convert To Bytes`</doc>
<kw name="Convert To Lowercase">
<arguments>
<arg>string</arg>
</arguments>
<doc>Converts string to lowercase.

Examples:
| ${str1} = | Convert To Lowercase | ABC |
| ${str2} = | Convert To Lowercase | 1A2c3D |
| Should Be Equal | ${str1} | abc |
| Should Be Equal | ${str2} | 1a2c3d |

New in Robot Framework 2.8.6.</doc>
<tags>
</tags>
</kw>
<kw name="Convert To Uppercase">
<arguments>
<arg>string</arg>
</arguments>
<doc>Converts string to uppercase.

Examples:
| ${str1} = | Convert To Uppercase | abc |
| ${str2} = | Convert To Uppercase | 1a2C3d |
| Should Be Equal | ${str1} | ABC |
| Should Be Equal | ${str2} | 1A2C3D |

New in Robot Framework 2.8.6.</doc>
<tags>
</tags>
</kw>
<kw name="Decode Bytes To String">
<arguments>
<arg>bytes</arg>
<arg>encoding</arg>
<arg>errors=strict</arg>
</arguments>
<doc>Decodes the given ``bytes`` to a Unicode string using the given ``encoding``.

``errors`` argument controls what to do if decoding some bytes fails.
All values accepted by ``decode`` method in Python are valid, but in
practice the following values are most useful:

- ``strict``: fail if characters cannot be decoded (default)
- ``ignore``: ignore characters that cannot be decoded
- ``replace``: replace characters that cannot be decoded with
  a replacement character

Examples:
| ${string} = | Decode Bytes To String | ${bytes} | UTF-8 |
| ${string} = | Decode Bytes To String | ${bytes} | ASCII | errors=ignore |

Use `Encode String To Bytes` if you need to convert Unicode strings to
byte strings, and `Convert To String` in ``BuiltIn`` if you need to
convert arbitrary objects to Unicode strings.

New in Robot Framework 2.7.7.</doc>
<tags>
</tags>
</kw>
<kw name="Encode String To Bytes">
<arguments>
<arg>string</arg>
<arg>encoding</arg>
<arg>errors=strict</arg>
</arguments>
<doc>Encodes the given Unicode ``string`` to bytes using the given ``encoding``.

``errors`` argument controls what to do if encoding some characters fails.
All values accepted by ``encode`` method in Python are valid, but in
practice the following values are most useful:

- ``strict``: fail if characters cannot be encoded (default)
- ``ignore``: ignore characters that cannot be encoded
- ``replace``: replace characters that cannot be encoded with
  a replacement character

Examples:
| ${bytes} = | Encode String To Bytes | ${string} | UTF-8 |
| ${bytes} = | Encode String To Bytes | ${string} | ASCII | errors=ignore |

Use `Convert To Bytes` in ``BuiltIn`` if you want to create bytes based
on character or integer sequences. Use `Decode Bytes To String` if you
need to convert byte strings to Unicode strings and `Convert To String`
in ``BuiltIn`` if you need to convert arbitrary objects to Unicode.

New in Robot Framework 2.7.7.</doc>
<tags>
</tags>
</kw>
<kw name="Fetch From Left">
<arguments>
<arg>string</arg>
<arg>marker</arg>
</arguments>
<doc>Returns contents of the ``string`` before the first occurrence of ``marker``.

If the ``marker`` is not found, whole string is returned.

See also `Fetch From Right`, `Split String` and `Split String
From Right`.</doc>
<tags>
</tags>
</kw>
<kw name="Fetch From Right">
<arguments>
<arg>string</arg>
<arg>marker</arg>
</arguments>
<doc>Returns contents of the ``string`` after the last occurrence of ``marker``.

If the ``marker`` is not found, whole string is returned.

See also `Fetch From Left`, `Split String` and `Split String
From Right`.</doc>
<tags>
</tags>
</kw>
<kw name="Generate Random String">
<arguments>
<arg>length=8</arg>
<arg>chars=[LETTERS][NUMBERS]</arg>
</arguments>
<doc>Generates a string with a desired ``length`` from the given ``chars``.

The population sequence ``chars`` contains the characters to use
when generating the random string. It can contain any
characters, and it is possible to use special markers
explained in the table below:

|  = Marker =   |               = Explanation =                   |
| ``[LOWER]``   | Lowercase ASCII characters from ``a`` to ``z``. |
| ``[UPPER]``   | Uppercase ASCII characters from ``A`` to ``Z``. |
| ``[LETTERS]`` | Lowercase and uppercase ASCII characters.       |
| ``[NUMBERS]`` | Numbers from 0 to 9.                            |

Examples:
| ${ret} = | Generate Random String |
| ${low} = | Generate Random String | 12 | [LOWER]         |
| ${bin} = | Generate Random String | 8  | 01              |
| ${hex} = | Generate Random String | 4  | [NUMBERS]abcdef |</doc>
<tags>
</tags>
</kw>
<kw name="Get Line">
<arguments>
<arg>string</arg>
<arg>line_number</arg>
</arguments>
<doc>Returns the specified line from the given ``string``.

Line numbering starts from 0 and it is possible to use
negative indices to refer to lines from the end. The line is
returned without the newline character.

Examples:
| ${first} =    | Get Line | ${string} | 0  |
| ${2nd last} = | Get Line | ${string} | -2 |

Use `Split To Lines` if all lines are needed.</doc>
<tags>
</tags>
</kw>
<kw name="Get Line Count">
<arguments>
<arg>string</arg>
</arguments>
<doc>Returns and logs the number of lines in the given string.</doc>
<tags>
</tags>
</kw>
<kw name="Get Lines Containing String">
<arguments>
<arg>string</arg>
<arg>pattern</arg>
<arg>case_insensitive=False</arg>
</arguments>
<doc>Returns lines of the given ``string`` that contain the ``pattern``.

The ``pattern`` is always considered to be a normal string, not a glob
or regexp pattern. A line matches if the ``pattern`` is found anywhere
on it.

The match is case-sensitive by default, but giving ``case_insensitive``
a true value makes it case-insensitive. The value is considered true
if it is a non-empty string that is not equal to ``false`` or ``no``.
If the value is not a string, its truth value is got directly in Python.

Lines are returned as one string catenated back together with
newlines. Possible trailing newline is never returned. The
number of matching lines is automatically logged.

Examples:
| ${lines} = | Get Lines Containing String | ${result} | An example |
| ${ret} =   | Get Lines Containing String | ${ret} | FAIL | case-insensitive |

See `Get Lines Matching Pattern` and `Get Lines Matching Regexp`
if you need more complex pattern matching.</doc>
<tags>
</tags>
</kw>
<kw name="Get Lines Matching Pattern">
<arguments>
<arg>string</arg>
<arg>pattern</arg>
<arg>case_insensitive=False</arg>
</arguments>
<doc>Returns lines of the given ``string`` that match the ``pattern``.

The ``pattern`` is a _glob pattern_ where:
| ``*``        | matches everything |
| ``?``        | matches any single character |
| ``[chars]``  | matches any character inside square brackets (e.g. ``[abc]`` matches either ``a``, ``b`` or ``c``) |
| ``[!chars]`` | matches any character not inside square brackets |

A line matches only if it matches the ``pattern`` fully.

The match is case-sensitive by default, but giving ``case_insensitive``
a true value makes it case-insensitive. The value is considered true
if it is a non-empty string that is not equal to ``false`` or ``no``.
If the value is not a string, its truth value is got directly in Python.

Lines are returned as one string catenated back together with
newlines. Possible trailing newline is never returned. The
number of matching lines is automatically logged.

Examples:
| ${lines} = | Get Lines Matching Pattern | ${result} | Wild???? example |
| ${ret} = | Get Lines Matching Pattern | ${ret} | FAIL: * | case_insensitive=true |

See `Get Lines Matching Regexp` if you need more complex
patterns and `Get Lines Containing String` if searching
literal strings is enough.</doc>
<tags>
</tags>
</kw>
<kw name="Get Lines Matching Regexp">
<arguments>
<arg>string</arg>
<arg>pattern</arg>
<arg>partial_match=False</arg>
</arguments>
<doc>Returns lines of the given ``string`` that match the regexp ``pattern``.

See `BuiltIn.Should Match Regexp` for more information about
Python regular expression syntax in general and how to use it
in Robot Framework test data in particular.

By default lines match only if they match the pattern fully, but
partial matching can be enabled by giving the ``partial_match``
argument a true value. The value is considered true if it is a
non-empty string that is not equal to ``false`` or ``no``. If the
value is not a string, its truth value is got directly in Python.

If the pattern is empty, it matches only empty lines by default.
When partial matching is enabled, empty pattern matches all lines.

Notice that to make the match case-insensitive, you need to prefix
the pattern with case-insensitive flag ``(?i)``.

Lines are returned as one string concatenated back together with
newlines. Possible trailing newline is never returned. The
number of matching lines is automatically logged.

Examples:
| ${lines} = | Get Lines Matching Regexp | ${result} | Reg\\w{3} example |
| ${lines} = | Get Lines Matching Regexp | ${result} | Reg\\w{3} example | partial_match=true |
| ${ret} =   | Get Lines Matching Regexp | ${ret}    | (?i)FAIL: .* |

See `Get Lines Matching Pattern` and `Get Lines Containing
String` if you do not need full regular expression powers (and
complexity).

``partial_match`` argument is new in Robot Framework 2.9. In earlier
 versions exact match was always required.</doc>
<tags>
</tags>
</kw>
<kw name="Get Regexp Matches">
<arguments>
<arg>string</arg>
<arg>pattern</arg>
<arg>*groups</arg>
</arguments>
<doc>Returns a list of all non-overlapping matches in the given string.

``string`` is the string to find matches from and ``pattern`` is the
regular expression. See `BuiltIn.Should Match Regexp` for more
information about Python regular expression syntax in general and how
to use it in Robot Framework test data in particular.

If no groups are used, the returned list contains full matches. If one
group is used, the list contains only contents of that group. If
multiple groups are used, the list contains tuples that contain
individual group contents. All groups can be given as indexes (starting
from 1) and named groups also as names.

Examples:
| ${no match} =    | Get Regexp Matches | the string | xxx     |
| ${matches} =     | Get Regexp Matches | the string | t..     |
| ${one group} =   | Get Regexp Matches | the string | t(..)   | 1 |
| ${named group} = | Get Regexp Matches | the string | t(?P<name>..) | name |
| ${two groups} =  | Get Regexp Matches | the string | t(.)(.) | 1 | 2 |
=>
| ${no match} = []
| ${matches} = ['the', 'tri']
| ${one group} = ['he', 'ri']
| ${named group} = ['he', 'ri']
| ${two groups} = [('h', 'e'), ('r', 'i')]

New in Robot Framework 2.9.</doc>
<tags>
</tags>
</kw>
<kw name="Get Substring">
<arguments>
<arg>string</arg>
<arg>start</arg>
<arg>end=None</arg>
</arguments>
<doc>Returns a substring from ``start`` index to ``end`` index.

The ``start`` index is inclusive and ``end`` is exclusive.
Indexing starts from 0, and it is possible to use
negative indices to refer to characters from the end.

Examples:
| ${ignore first} = | Get Substring | ${string} | 1  |    |
| ${ignore last} =  | Get Substring | ${string} |    | -1 |
| ${5th to 10th} =  | Get Substring | ${string} | 4  | 10 |
| ${first two} =    | Get Substring | ${string} |    | 1  |
| ${last two} =     | Get Substring | ${string} | -2 |    |</doc>
<tags>
</tags>
</kw>
<kw name="Remove String">
<arguments>
<arg>string</arg>
<arg>*removables</arg>
</arguments>
<doc>Removes all ``removables`` from the given ``string``.

``removables`` are used as literal strings. Each removable will be
matched to a temporary string from which preceding removables have
been already removed. See second example below.

Use `Remove String Using Regexp` if more powerful pattern matching is
needed. If only a certain number of matches should be removed,
`Replace String` or `Replace String Using Regexp` can be used.

A modified version of the string is returned and the original
string is not altered.

Examples:
| ${str} =        | Remove String | Robot Framework | work   |
| Should Be Equal | ${str}        | Robot Frame     |
| ${str} =        | Remove String | Robot Framework | o | bt |
| Should Be Equal | ${str}        | R Framewrk      |

New in Robot Framework 2.8.2.</doc>
<tags>
</tags>
</kw>
<kw name="Remove String Using Regexp">
<arguments>
<arg>string</arg>
<arg>*patterns</arg>
</arguments>
<doc>Removes ``patterns`` from the given ``string``.

This keyword is otherwise identical to `Remove String`, but
the ``patterns`` to search for are considered to be a regular
expression. See `Replace String Using Regexp` for more information
about the regular expression syntax. That keyword can also be
used if there is a need to remove only a certain number of
occurrences.

New in Robot Framework 2.8.2.</doc>
<tags>
</tags>
</kw>
<kw name="Replace String">
<arguments>
<arg>string</arg>
<arg>search_for</arg>
<arg>replace_with</arg>
<arg>count=-1</arg>
</arguments>
<doc>Replaces ``search_for`` in the given ``string`` with ``replace_with``.

``search_for`` is used as a literal string. See `Replace String
Using Regexp` if more powerful pattern matching is needed.
If you need to just remove a string see `Remove String`.

If the optional argument ``count`` is given, only that many
occurrences from left are replaced. Negative ``count`` means
that all occurrences are replaced (default behaviour) and zero
means that nothing is done.

A modified version of the string is returned and the original
string is not altered.

Examples:
| ${str} =        | Replace String | Hello, world!  | world | tellus   |
| Should Be Equal | ${str}         | Hello, tellus! |       |          |
| ${str} =        | Replace String | Hello, world!  | l     | ${EMPTY} | count=1 |
| Should Be Equal | ${str}         | Helo, world!   |       |          |</doc>
<tags>
</tags>
</kw>
<kw name="Replace String Using Regexp">
<arguments>
<arg>string</arg>
<arg>pattern</arg>
<arg>replace_with</arg>
<arg>count=-1</arg>
</arguments>
<doc>Replaces ``pattern`` in the given ``string`` with ``replace_with``.

This keyword is otherwise identical to `Replace String`, but
the ``pattern`` to search for is considered to be a regular
expression.  See `BuiltIn.Should Match Regexp` for more
information about Python regular expression syntax in general
and how to use it in Robot Framework test data in particular.

If you need to just remove a string see `Remove String Using Regexp`.

Examples:
| ${str} = | Replace String Using Regexp | ${str} | 20\\d\\d-\\d\\d-\\d\\d | <DATE> |
| ${str} = | Replace String Using Regexp | ${str} | (Hello|Hi) | ${EMPTY} | count=1 |</doc>
<tags>
</tags>
</kw>
<kw name="Should Be Byte String">
<arguments>
<arg>item</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``item`` is not a byte string.

Use `Should Be Unicode String` if you want to verify the ``item`` is a
Unicode string, or `Should Be String` if both Unicode and byte strings
are fine.

The default error message can be overridden with the optional
``msg`` argument.

New in Robot Framework 2.7.7.</doc>
<tags>
</tags>
</kw>
<kw name="Should Be Lowercase">
<arguments>
<arg>string</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``string`` is not in lowercase.

For example, ``'string'`` and ``'with specials!'`` would pass, and
``'String'``, ``''`` and ``' '`` would fail.

The default error message can be overridden with the optional
``msg`` argument.

See also `Should Be Uppercase` and `Should Be Titlecase`.</doc>
<tags>
</tags>
</kw>
<kw name="Should Be String">
<arguments>
<arg>item</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``item`` is not a string.

This keyword passes regardless is the ``item`` is a Unicode string or
a byte string. Use `Should Be Unicode String` or `Should Be Byte
String` if you want to restrict the string type.

The default error message can be overridden with the optional
``msg`` argument.</doc>
<tags>
</tags>
</kw>
<kw name="Should Be Titlecase">
<arguments>
<arg>string</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if given ``string`` is not title.

``string`` is a titlecased string if there is at least one
character in it, uppercase characters only follow uncased
characters and lowercase characters only cased ones.

For example, ``'This Is Title'`` would pass, and ``'Word In UPPER'``,
``'Word In lower'``, ``''`` and ``' '`` would fail.

The default error message can be overridden with the optional
``msg`` argument.

See also `Should Be Uppercase` and `Should Be Lowercase`.</doc>
<tags>
</tags>
</kw>
<kw name="Should Be Unicode String">
<arguments>
<arg>item</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``item`` is not a Unicode string.

Use `Should Be Byte String` if you want to verify the ``item`` is a
byte string, or `Should Be String` if both Unicode and byte strings
are fine.

The default error message can be overridden with the optional
``msg`` argument.

New in Robot Framework 2.7.7.</doc>
<tags>
</tags>
</kw>
<kw name="Should Be Uppercase">
<arguments>
<arg>string</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``string`` is not in uppercase.

For example, ``'STRING'`` and ``'WITH SPECIALS!'`` would pass, and
``'String'``, ``''`` and ``' '`` would fail.

The default error message can be overridden with the optional
``msg`` argument.

See also `Should Be Titlecase` and `Should Be Lowercase`.</doc>
<tags>
</tags>
</kw>
<kw name="Should Not Be String">
<arguments>
<arg>item</arg>
<arg>msg=None</arg>
</arguments>
<doc>Fails if the given ``item`` is a string.

The default error message can be overridden with the optional
``msg`` argument.</doc>
<tags>
</tags>
</kw>
<kw name="Split String">
<arguments>
<arg>string</arg>
<arg>separator=None</arg>
<arg>max_split=-1</arg>
</arguments>
<doc>Splits the ``string`` using ``separator`` as a delimiter string.

If a ``separator`` is not given, any whitespace string is a
separator. In that case also possible consecutive whitespace
as well as leading and trailing whitespace is ignored.

Split words are returned as a list. If the optional
``max_split`` is given, at most ``max_split`` splits are done, and
the returned list will have maximum ``max_split + 1`` elements.

Examples:
| @{words} =         | Split String | ${string} |
| @{words} =         | Split String | ${string} | ,${SPACE} |
| ${pre} | ${post} = | Split String | ${string} | ::    | 1 |

See `Split String From Right` if you want to start splitting
from right, and `Fetch From Left` and `Fetch From Right` if
you only want to get first/last part of the string.</doc>
<tags>
</tags>
</kw>
<kw name="Split String From Right">
<arguments>
<arg>string</arg>
<arg>separator=None</arg>
<arg>max_split=-1</arg>
</arguments>
<doc>Splits the ``string`` using ``separator`` starting from right.

Same as `Split String`, but splitting is started from right. This has
an effect only when ``max_split`` is given.

Examples:
| ${first} | ${rest} = | Split String            | ${string} | - | 1 |
| ${rest}  | ${last} = | Split String From Right | ${string} | - | 1 |</doc>
<tags>
</tags>
</kw>
<kw name="Split String To Characters">
<arguments>
<arg>string</arg>
</arguments>
<doc>Splits the given ``string`` to characters.

Example:
| @{characters} = | Split String To Characters | ${string} |

New in Robot Framework 2.7.</doc>
<tags>
</tags>
</kw>
<kw name="Split To Lines">
<arguments>
<arg>string</arg>
<arg>start=0</arg>
<arg>end=None</arg>
</arguments>
<doc>Splits the given string to lines.

It is possible to get only a selection of lines from ``start``
to ``end`` so that ``start`` index is inclusive and ``end`` is
exclusive. Line numbering starts from 0, and it is possible to
use negative indices to refer to lines from the end.

Lines are returned without the newlines. The number of
returned lines is automatically logged.

Examples:
| @{lines} =        | Split To Lines | ${manylines} |    |    |
| @{ignore first} = | Split To Lines | ${manylines} | 1  |    |
| @{ignore last} =  | Split To Lines | ${manylines} |    | -1 |
| @{5th to 10th} =  | Split To Lines | ${manylines} | 4  | 10 |
| @{first two} =    | Split To Lines | ${manylines} |    | 1  |
| @{last two} =     | Split To Lines | ${manylines} | -2 |    |

Use `Get Line` if you only need to get a single line.</doc>
<tags>
</tags>
</kw>
<kw name="Strip String">
<arguments>
<arg>string</arg>
<arg>mode=both</arg>
<arg>characters=None</arg>
</arguments>
<doc>Remove leading and/or trailing whitespaces from the given string.

``mode`` is either ``left`` to remove leading characters, ``right`` to
remove trailing characters, ``both`` (default) to remove the
characters from both sides of the string or ``none`` to return the
unmodified string.

If the optional ``characters`` is given, it must be a string and the
characters in the string will be stripped in the string. Please note,
that this is not a substring to be removed but a list of characters,
see the example below.

Examples:
| ${stripped}=  | Strip String | ${SPACE}Hello${SPACE} | |
| Should Be Equal | ${stripped} | Hello | |
| ${stripped}=  | Strip String | ${SPACE}Hello${SPACE} | mode=left |
| Should Be Equal | ${stripped} | Hello${SPACE} | |
| ${stripped}=  | Strip String | aabaHelloeee | characters=abe |
| Should Be Equal | ${stripped} | Hello | |

New in Robot Framework 3.0.</doc>
<tags>
</tags>
</kw>
</keywordspec>


text:
from google.appengine.ext import db

class Server(db.Model):
	serverdomain = db.StringProperty("Server Domain", multiline=False)
	ssl = db.BooleanProperty("Is server SSL?", default=False)
	email = db.EmailProperty("Email Address for notification")
	startedmonitoring = db.DateTimeProperty("Date monitoring started", auto_now_add=True)
	timeservercameback = db.DateTimeProperty("Date server came back online", auto_now_add=True)
	status = db.BooleanProperty("Server Status", default=False)
	responsecode = db.IntegerProperty("Server response code", default=000)
	notifylimiter = db.BooleanProperty("Notify limiter", default=False)
	uptimecounter = db.IntegerProperty("Uptime Counter", default=0)
	notifywithprowl = db.BooleanProperty("Prowl notifications",default=False)
	notifywithemail = db.BooleanProperty("Email notifications",default=False)
	notifywithtwitter = db.BooleanProperty("Twitter notifications",default=False)
	notifywithfacebook = db.BooleanProperty("Facebook notifications",default=False)
	notifywithsms = db.BooleanProperty("SMS notifications",default=False)
	falsepositivecheck = db.BooleanProperty("Prevent single bad result from triggering notifications",default=False)
	uptime = db.StringProperty("Uptime")
	class Uptime(db.Model):
		unittime = db.DateTimeProperty("Time period for uptime data", auto_now_add=False)
		uptimecounter = db.IntegerProperty("Counter for uptime in minutes for the time period", default=0)
		downtimecounter = db.IntegerProperty("Counter for downtime in minutes for the time period", default=0)

class AdminOptions(db.Model):
	twitteruser = db.StringProperty("Twitter Username", multiline=False)
	twitterpass = db.StringProperty("Twitter Passowrd", multiline=False)
	facebookconnect = db.StringProperty("Facebook connect", multiline=False)
	mobilesmsnumber = db.StringProperty("Mobile SMS number", multiline=False)
	prowlkey = db.StringProperty("Prowl API Key", multiline=False)
	prowlkeyisvalid = db.BooleanProperty("Prowl key status", default=False)