text:
package com.furnaghan.home.component.storage.sftp;

import com.furnaghan.home.component.Component;
import com.furnaghan.home.component.storage.StorageType;
import com.furnaghan.home.component.storage.sftp.jsch.PasswordUserInfo;
import com.google.common.base.Throwables;
import com.google.common.io.ByteSink;
import com.google.common.io.ByteSource;
import com.jcraft.jsch.*;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class SftpStorageComponent extends Component<StorageType.Listener> implements StorageType {

    private static final String SFTP_PROTOCOL = "sftp";

    private final ChannelSftp sftp;

    public SftpStorageComponent(final SftpStorageConfiguration configuration) {
        try {
            final Session session = new JSch().getSession(
                    configuration.getUsername(),
                    configuration.getAddress().getHostText(),
                    configuration.getAddress().getPortOrDefault(SftpStorageConfiguration.DEFAULT_SSH_PORT)
            );
            session.setUserInfo(new PasswordUserInfo(configuration.getPassword()));
            session.setConfig("StrictHostKeyChecking", "no");
            session.connect();

            sftp = (ChannelSftp) session.openChannel(SFTP_PROTOCOL);
            sftp.connect();
        } catch (JSchException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public boolean exists(final String path) {
        try {
            sftp.stat(path);
            return true;
        } catch (SftpException e) {
            if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
                return false;
            }

            throw Throwables.propagate(e);
        }
    }

    @Override
    public void rename(final String source, final String destination) {
        try {
            sftp.rename(source, destination);
        } catch (SftpException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public void delete(final String path) {
        try {
            sftp.rm(path);
        } catch (SftpException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public void mkdir(final String path) {
        try {
            sftp.mkdir(path);
        } catch (SftpException e) {
            throw Throwables.propagate(e);
        }
    }

    @Override
    public ByteSource read(final String path) {
        return new ByteSource() {
            @Override
            public InputStream openStream() throws IOException {
                try {
                    return sftp.get(path);
                } catch (SftpException e) {
                    throw Throwables.propagate(e);
                }
            }
        };
    }

    @Override
    public ByteSink write(final String path, final boolean append) {
        return new ByteSink() {
            @Override
            public OutputStream openStream() throws IOException {
                try {
                    return sftp.put(path, append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);
                } catch (SftpException e) {
                    throw Throwables.propagate(e);
                }
            }
        };
    }
}


text:
NSString * const kGTLRWebRiskConstraintsSupportedCompressionsCompressionTypeUnspecified = @"COMPRESSION_TYPE_UNSPECIFIED";
NSString * const kGTLRWebRiskConstraintsSupportedCompressionsRaw = @"RAW";
NSString * const kGTLRWebRiskConstraintsSupportedCompressionsRice = @"RICE";

// threatType
NSString * const kGTLRWebRiskThreatTypeMalware                 = @"MALWARE";
NSString * const kGTLRWebRiskThreatTypeSocialEngineering       = @"SOCIAL_ENGINEERING";
NSString * const kGTLRWebRiskThreatTypeSocialEngineeringExtendedCoverage = @"SOCIAL_ENGINEERING_EXTENDED_COVERAGE";
NSString * const kGTLRWebRiskThreatTypeThreatTypeUnspecified   = @"THREAT_TYPE_UNSPECIFIED";
NSString * const kGTLRWebRiskThreatTypeUnwantedSoftware        = @"UNWANTED_SOFTWARE";

// threatTypes
NSString * const kGTLRWebRiskThreatTypesMalware                = @"MALWARE";
NSString * const kGTLRWebRiskThreatTypesSocialEngineering      = @"SOCIAL_ENGINEERING";
NSString * const kGTLRWebRiskThreatTypesSocialEngineeringExtendedCoverage = @"SOCIAL_ENGINEERING_EXTENDED_COVERAGE";
NSString * const kGTLRWebRiskThreatTypesThreatTypeUnspecified  = @"THREAT_TYPE_UNSPECIFIED";
NSString * const kGTLRWebRiskThreatTypesUnwantedSoftware       = @"UNWANTED_SOFTWARE";

// ----------------------------------------------------------------------------
// Query Classes
//

@implementation GTLRWebRiskQuery

@dynamic fields;

@end

@implementation GTLRWebRiskQuery_HashesSearch

@dynamic hashPrefix, threatTypes;

+ (NSDictionary<NSString *, Class> *)arrayPropertyToClassMap {
  NSDictionary<NSString *, Class> *map = @{
    @"threatTypes" : [NSString class]
  };
  return map;
}

+ (instancetype)query {
  NSString *pathURITemplate = @"v1/hashes:search";
  GTLRWebRiskQuery_HashesSearch *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:nil
                       pathParameterNames:nil];
  query.expectedObjectClass = [GTLRWebRisk_GoogleCloudWebriskV1SearchHashesResponse class];
  query.loggingName = @"webrisk.hashes.search";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsOperationsCancel

@dynamic name;

+ (instancetype)queryWithObject:(GTLRWebRisk_GoogleLongrunningCancelOperationRequest *)object
                           name:(NSString *)name {
  if (object == nil) {
#if defined(DEBUG) && DEBUG
    NSAssert(object != nil, @"Got a nil object");
#endif
    return nil;
  }
  NSArray *pathParams = @[ @"name" ];
  NSString *pathURITemplate = @"v1/{+name}:cancel";
  GTLRWebRiskQuery_ProjectsOperationsCancel *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:@"POST"
                       pathParameterNames:pathParams];
  query.bodyObject = object;
  query.name = name;
  query.expectedObjectClass = [GTLRWebRisk_GoogleProtobufEmpty class];
  query.loggingName = @"webrisk.projects.operations.cancel";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsOperationsDelete

@dynamic name;

+ (instancetype)queryWithName:(NSString *)name {
  NSArray *pathParams = @[ @"name" ];
  NSString *pathURITemplate = @"v1/{+name}";
  GTLRWebRiskQuery_ProjectsOperationsDelete *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:@"DELETE"
                       pathParameterNames:pathParams];
  query.name = name;
  query.expectedObjectClass = [GTLRWebRisk_GoogleProtobufEmpty class];
  query.loggingName = @"webrisk.projects.operations.delete";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsOperationsGet

@dynamic name;

+ (instancetype)queryWithName:(NSString *)name {
  NSArray *pathParams = @[ @"name" ];
  NSString *pathURITemplate = @"v1/{+name}";
  GTLRWebRiskQuery_ProjectsOperationsGet *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:nil
                       pathParameterNames:pathParams];
  query.name = name;
  query.expectedObjectClass = [GTLRWebRisk_GoogleLongrunningOperation class];
  query.loggingName = @"webrisk.projects.operations.get";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsOperationsList

@dynamic filter, name, pageSize, pageToken;

+ (instancetype)queryWithName:(NSString *)name {
  NSArray *pathParams = @[ @"name" ];
  NSString *pathURITemplate = @"v1/{+name}/operations";
  GTLRWebRiskQuery_ProjectsOperationsList *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:nil
                       pathParameterNames:pathParams];
  query.name = name;
  query.expectedObjectClass = [GTLRWebRisk_GoogleLongrunningListOperationsResponse class];
  query.loggingName = @"webrisk.projects.operations.list";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsSubmissionsCreate

@dynamic parent;

+ (instancetype)queryWithObject:(GTLRWebRisk_GoogleCloudWebriskV1Submission *)object
                         parent:(NSString *)parent {
  if (object == nil) {
#if defined(DEBUG) && DEBUG
    NSAssert(object != nil, @"Got a nil object");
#endif
    return nil;
  }
  NSArray *pathParams = @[ @"parent" ];
  NSString *pathURITemplate = @"v1/{+parent}/submissions";
  GTLRWebRiskQuery_ProjectsSubmissionsCreate *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:@"POST"
                       pathParameterNames:pathParams];
  query.bodyObject = object;
  query.parent = parent;
  query.expectedObjectClass = [GTLRWebRisk_GoogleCloudWebriskV1Submission class];
  query.loggingName = @"webrisk.projects.submissions.create";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ProjectsUrisSubmit

@dynamic parent;

+ (instancetype)queryWithObject:(GTLRWebRisk_GoogleCloudWebriskV1SubmitUriRequest *)object
                         parent:(NSString *)parent {
  if (object == nil) {
#if defined(DEBUG) && DEBUG
    NSAssert(object != nil, @"Got a nil object");
#endif
    return nil;
  }
  NSArray *pathParams = @[ @"parent" ];
  NSString *pathURITemplate = @"v1/{+parent}/uris:submit";
  GTLRWebRiskQuery_ProjectsUrisSubmit *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:@"POST"
                       pathParameterNames:pathParams];
  query.bodyObject = object;
  query.parent = parent;
  query.expectedObjectClass = [GTLRWebRisk_GoogleLongrunningOperation class];
  query.loggingName = @"webrisk.projects.uris.submit";
  return query;
}

@end

@implementation GTLRWebRiskQuery_ThreatListsComputeDiff

@dynamic constraintsMaxDatabaseEntries, constraintsMaxDiffEntries,
         constraintsSupportedCompressions, threatType, versionToken;

+ (NSDictionary<NSString *, NSString *> *)parameterNameMap {
  NSDictionary<NSString *, NSString *> *map = @{
    @"constraintsMaxDatabaseEntries" : @"constraints.maxDatabaseEntries",
    @"constraintsMaxDiffEntries" : @"constraints.maxDiffEntries",
    @"constraintsSupportedCompressions" : @"constraints.supportedCompressions"
  };
  return map;
}

+ (NSDictionary<NSString *, Class> *)arrayPropertyToClassMap {
  NSDictionary<NSString *, Class> *map = @{
    @"constraints.supportedCompressions" : [NSString class]
  };
  return map;
}

+ (instancetype)query {
  NSString *pathURITemplate = @"v1/threatLists:computeDiff";
  GTLRWebRiskQuery_ThreatListsComputeDiff *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:nil
                       pathParameterNames:nil];
  query.expectedObjectClass = [GTLRWebRisk_GoogleCloudWebriskV1ComputeThreatListDiffResponse class];
  query.loggingName = @"webrisk.threatLists.computeDiff";
  return query;
}

@end

@implementation GTLRWebRiskQuery_UrisSearch

@dynamic threatTypes, uri;

+ (NSDictionary<NSString *, Class> *)arrayPropertyToClassMap {
  NSDictionary<NSString *, Class> *map = @{
    @"threatTypes" : [NSString class]
  };
  return map;
}

+ (instancetype)query {
  NSString *pathURITemplate = @"v1/uris:search";
  GTLRWebRiskQuery_UrisSearch *query =
    [[self alloc] initWithPathURITemplate:pathURITemplate
                               HTTPMethod:nil
                       pathParameterNames:nil];
  query.expectedObjectClass = [GTLRWebRisk_GoogleCloudWebriskV1SearchUrisResponse class];
  query.loggingName = @"webrisk.uris.search";
  return query;
}

@end

redpajama_set_name: RedPajamaGithub


text:
require "ruboty/nullpo/version"
require "ruboty/handlers/nullpo"

module Ruboty
  module Nullpo
    # Your code goes here...
  end
end


text:
package dbr

import (
	"testing"

	"github.com/gocraft/dbr/dialect"
	"github.com/stretchr/testify/assert"
)

func TestDeleteStmt(t *testing.T) {
	buf := NewBuffer()
	builder := DeleteFrom("table").Where(Eq("a", 1))
	err := builder.Build(dialect.MySQL, buf)
	assert.NoError(t, err)
	assert.Equal(t, "DELETE FROM `table` WHERE (`a` = ?)", buf.String())
	assert.Equal(t, []interface{}{1}, buf.Value())
}

func BenchmarkDeleteSQL(b *testing.B) {
	buf := NewBuffer()
	for i := 0; i < b.N; i++ {
		DeleteFrom("table").Where(Eq("a", 1)).Build(dialect.MySQL, buf)
	}
}


text:
package info.lefoll.socle.persistance;

import info.lefoll.socle.requete.Agrégation;

import java.util.Optional;

public interface Connecteur {

    <T> void créerEntité(T donnée);

    <T> Optional<T> rechercherEntitéParId(String id);

    <T> Optional<T> effectuerRequête(Agrégation agrégation);

    <T> void pourLEntité(Class<T> typeDeLEntité);

}


text:
using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using FluentHtml.Extensions;
using FluentHtml.Fluent;

namespace FluentHtml
{
    public static class UrlGenerator
    {
        public static string Generate(RequestContext requestContext, string url)
        {
            return new UrlHelper(requestContext).Content(url);
        }

        public static string Generate(RequestContext requestContext, NavigationRequest navigationItem, RouteValueDictionary routeValues)
        {
            if (requestContext == null)
                throw new ArgumentNullException("requestContext");
            if (navigationItem == null)
                throw new ArgumentNullException("navigationItem");

            var urlHelper = new UrlHelper(requestContext);
            string generatedUrl = null;

            if (!string.IsNullOrEmpty(navigationItem.RouteName))
            {
                generatedUrl = urlHelper.RouteUrl(navigationItem.RouteName, routeValues);
            }
            else if (!string.IsNullOrEmpty(navigationItem.ControllerName) && !string.IsNullOrEmpty(navigationItem.ActionName))
            {
                generatedUrl = urlHelper.Action(navigationItem.ActionName, navigationItem.ControllerName, routeValues, null, null);
            }
            else if (!string.IsNullOrEmpty(navigationItem.Url))
            {
                generatedUrl = navigationItem.Url.StartsWith("~/", StringComparison.Ordinal)
                    ? urlHelper.Content(navigationItem.Url)
                    : navigationItem.Url;
            }
            else if (routeValues.Any())
            {
                generatedUrl = urlHelper.RouteUrl(routeValues);
            }

            return generatedUrl;

        }

        public static string Generate(RequestContext requestContext, NavigationRequest navigationItem)
        {
            var routeValues = new RouteValueDictionary();

            if (navigationItem.RouteValues.Any())
                routeValues.Merge(navigationItem.RouteValues);

            return Generate(requestContext, navigationItem, routeValues);
        }
    }
}


text:
package com.picas.features.cache;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import org.apache.shiro.cache.CacheException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.Cache;
import org.springframework.cache.Cache.ValueWrapper;

@SuppressWarnings("unchecked")
public class ShiroSpringCache<K, V> implements org.apache.shiro.cache.Cache<K, V>
{
	private static final Logger LOGGER = LoggerFactory.getLogger(ShiroSpringCache.class);

	private final org.springframework.cache.Cache cache;

	public ShiroSpringCache(Cache cache)
	{
		if (cache == null)
		{
			throw new IllegalArgumentException("Cache argument cannot be null.");
		}
		this.cache = cache;
	}

	@Override
	public V get(K key) throws CacheException
	{
		LOGGER.debug("Getting object from cache [" + this.cache.getName() + "] for key [" + key + "]");
		ValueWrapper valueWrapper = cache.get(key);
		if (valueWrapper == null)
		{
			LOGGER.debug("Element for [" + key + "] is null.");
			return null;
		}
		return (V) valueWrapper.get();
	}

	@Override
	public V put(K key, V value) throws CacheException
	{
		LOGGER.debug("Putting object in cache [" + this.cache.getName() + "] for key [" + key + "]");
		cache.put(key, value);
		return value;
	}

	@Override
	public V remove(K key) throws CacheException
	{
		LOGGER.debug("Removing object from cache [" + this.cache.getName() + "] for key [" + key + "]");
		V previous = get(key);
		cache.evict(key);
		return previous;
	}

	@Override
	public void clear() throws CacheException
	{
		LOGGER.debug("Clearing all objects from cache [" + this.cache.getName() + "]");
		cache.clear();
	}

	@Override
	public int size()
	{
		return 0;
	}

	@Override
	public Set<K> keys()
	{
		return Collections.emptySet();
	}

	@Override
	public Collection<V> values()
	{
		return Collections.emptySet();
	}

	@Override
	public String toString()
	{
		return "ShiroSpringCache [" + this.cache.getName() + "]";
	}

}


text:
if defined?(ActiveRecord)
  class ActiveRecord::Base
    # serialize to YAML
    def encode_with(coder)
      coder["attributes"] = @attributes
      coder.tag = ['!ruby/ActiveRecord', self.class.name].join(':')
    end
  end
end

module Psych
  module Visitors
    class YAMLTree
      def visit_Class(klass)
        @emitter.scalar klass.name, nil, '!ruby/class', false, false, Nodes::Scalar::SINGLE_QUOTED
      end
    end

    class ToRuby
      def visit_Psych_Nodes_Scalar(o)
        @st[o.anchor] = o.value if o.anchor

        if klass = Psych.load_tags[o.tag]
          instance = klass.allocate

          if instance.respond_to?(:init_with)
            coder = Psych::Coder.new(o.tag)
            coder.scalar = o.value
            instance.init_with coder
          end

          return instance
        end

        return o.value if o.quoted
        return @ss.tokenize(o.value) unless o.tag

        case o.tag
        when '!binary', 'tag:yaml.org,2002:binary'
          o.value.unpack('m').first
        when '!str', 'tag:yaml.org,2002:str'
          o.value
        when "!ruby/object:DateTime"
          require 'date'
          @ss.parse_time(o.value).to_datetime
        when "!ruby/object:Complex"
          Complex(o.value)
        when "!ruby/object:Rational"
          Rational(o.value)
        when "!ruby/class", "!ruby/module"
          resolve_class o.value
        when "tag:yaml.org,2002:float", "!float"
          Float(@ss.tokenize(o.value))
        when "!ruby/regexp"
          o.value =~ /^\/(.*)\/([mixn]*)$/
          source  = $1
          options = 0
          lang    = nil
          ($2 || '').split('').each do |option|
            case option
            when 'x' then options |= Regexp::EXTENDED
            when 'i' then options |= Regexp::IGNORECASE
            when 'm' then options |= Regexp::MULTILINE
            when 'n' then options |= Regexp::NOENCODING
            else lang = option
            end
          end
          Regexp.new(*[source, options, lang].compact)
        when "!ruby/range"
          args = o.value.split(/([.]{2,3})/, 2).map { |s|
            accept Nodes::Scalar.new(s)
          }
          args.push(args.delete_at(1) == '...')
          Range.new(*args)
        when /^!ruby\/sym(bol)?:?(.*)?$/
          o.value.to_sym
        else
          @ss.tokenize o.value
        end
      end

      def visit_Psych_Nodes_Mapping_with_class(object)
        return revive(Psych.load_tags[object.tag], object) if Psych.load_tags[object.tag]

        case object.tag
        when /^!ruby\/ActiveRecord:(.+)$/
          klass = resolve_class($1)
          payload = Hash[*object.children.map { |c| accept c }]
          id = payload["attributes"][klass.primary_key]
          begin
            if ActiveRecord::VERSION::MAJOR >= 3
              klass.unscoped.find(id)
            else # Rails 2
              klass.with_exclusive_scope { klass.find(id) }
            end
          rescue ActiveRecord::RecordNotFound
            # raise QueueDispatcher::DeserializationError

            # Return ActiveRecord without reload
            revive(klass, object)
          end
        when /^!ruby\/Mongoid:(.+)$/
          klass = resolve_class($1)
          payload = Hash[*object.children.map { |c| accept c }]
          begin
            klass.find(payload["attributes"]["_id"])
          rescue Mongoid::Errors::DocumentNotFound
            # raise QueueDispatcher::DeserializationError

            # Return ActiveRecord without reload
            revive(klass, object)
          end
        else
          visit_Psych_Nodes_Mapping_without_class(object)
        end
      end
      alias_method_chain :visit_Psych_Nodes_Mapping, :class

      def resolve_class_with_constantize(klass_name)
        klass_name.constantize
      rescue
        resolve_class_without_constantize(klass_name)
      end
      alias_method_chain :resolve_class, :constantize
    end
  end
end


text:
namespace blink {
struct WebFontRenderStyle;
}

namespace content {

// Child-process implementation of the Blink interface that sandboxed processes
// use to obtain data from the privileged process (browser), which would
// otherwise be blocked by the sandbox.
class WebSandboxSupportLinux : public blink::WebSandboxSupport {
 public:
  explicit WebSandboxSupportLinux(sk_sp<font_service::FontLoader> font_loader);
  ~WebSandboxSupportLinux() override;

  // |fallback_font| will be filled with a font family which provides glyphs for
  // the Unicode code point specified by |character|, a UTF-32 character.
  // |preferred_locale| contains the preferred locale identifier for
  // |character|. Returns false if the request could not be satisfied.
  bool GetFallbackFontForCharacter(
      blink::WebUChar32 character,
      const char* preferred_locale,
      gfx::FallbackFontData* fallback_font) override;

  // Matches a font uniquely by postscript name or full font name.  Used in
  // Blink for @font-face { src: local(arg) } matching.  Provide full font name
  // or postscript name as argument font_unique_name in UTF-8. |fallback_font|
  // contains a filename and fontconfig interface id if a match was found.
  // Returns false, otherwise.
  bool MatchFontByPostscriptNameOrFullFontName(
      const char* font_unique_name,
      gfx::FallbackFontData* fallback_font) override;

  // Returns rendering settings for a provided font family, size, and style.
  // |size_and_style| stores the bold setting in its least-significant bit, the
  // italic setting in its second-least-significant bit, and holds the requested
  // size in pixels into its remaining bits.
  void GetWebFontRenderStyleForStrike(const char* family,
                                      int size,
                                      bool is_bold,
                                      bool is_italic,
                                      float device_scale_factor,
                                      blink::WebFontRenderStyle* out) override;

 private:
  // Blink calls GetFallbackFontForCharacter frequently, so the results are
  // cached. The cache is protected by this lock.
  base::Lock lock_;
  // Maps unicode chars to their fallback fonts.
  std::map<int32_t, gfx::FallbackFontData> unicode_font_families_
      GUARDED_BY(lock_);

  sk_sp<font_service::FontLoader> font_loader_;

  DISALLOW_COPY_AND_ASSIGN(WebSandboxSupportLinux);
};

}  // namespace content

#endif  // CONTENT_CHILD_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_LINUX_H_


text:
//===--- GenReflection.cpp - IR generation for nominal type reflection ----===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//  This file implements IR generation of type metadata for struct/class
//  stored properties and enum cases for use with reflection.
//===----------------------------------------------------------------------===//

#include "swift/AST/Decl.h"
#include "swift/AST/IRGenOptions.h"

#include "ConstantBuilder.h"
#include "IRGenModule.h"

using namespace swift;
using namespace irgen;

class ReflectionMetadataBuilder : public ConstantBuilder<> {

  const uint32_t fieldRecordSize = 8;
  ArrayRef<const NominalTypeDecl *> NominalTypeDecls;

  void addFieldDecl(const ValueDecl *value) {
    auto type = value->getInterfaceType()->getCanonicalType();
    Mangle::Mangler mangler;
    mangler.setModuleContext(value->getModuleContext());
    mangler.mangleType(type, 0);
    auto mangledName = IGM.getAddrOfStringForTypeRef(mangler.finalize());
    addRelativeAddress(mangledName);

    if (IGM.Opts.StripReflectionNames) {
      addConstantInt32(0);
    } else {
      auto fieldName = IGM.getAddrOfFieldName(value->getNameStr());
      addRelativeAddress(fieldName);
    }
  }

  void addDecl(const NominalTypeDecl *decl) {
    auto type = decl->getDeclaredInterfaceType()->getCanonicalType();
    Mangle::Mangler mangler;
    mangler.setModuleContext(decl->getModuleContext());
    mangler.mangleType(type, 0);
    auto mangledName = IGM.getAddrOfStringForTypeRef(mangler.finalize());
    addRelativeAddress(mangledName);

    switch (decl->getKind()) {
    case DeclKind::Class:
    case DeclKind::Struct: {
      auto properties = decl->getStoredProperties();
      addConstantInt32(std::distance(properties.begin(), properties.end()));
      addConstantInt32(fieldRecordSize);
      for (auto property : properties)
        addFieldDecl(property);
      break;
    }
    case DeclKind::Enum: {
      auto enumDecl = cast<EnumDecl>(decl);
      auto cases = enumDecl->getAllElements();
      addConstantInt32(std::distance(cases.begin(), cases.end()));
      addConstantInt32(fieldRecordSize);
      for (auto enumCase : cases)
        addFieldDecl(enumCase);
      break;
    }
    default:
      llvm_unreachable("Not a nominal type");
      break;
    }
  }

public:
  ReflectionMetadataBuilder(IRGenModule &IGM,
      ArrayRef<const NominalTypeDecl *> NominalTypeDecls)
    : ConstantBuilder(IGM), NominalTypeDecls(NominalTypeDecls) {}
  void layout() {
    for (auto decl : NominalTypeDecls) {
      addDecl(decl);
    }
  }

  llvm::GlobalVariable *emit() {
    auto tempBase = std::unique_ptr<llvm::GlobalVariable>(
        new llvm::GlobalVariable(IGM.Int8Ty, /*isConstant*/ true,
                                 llvm::GlobalValue::PrivateLinkage));
    setRelativeAddressBase(tempBase.get());

    layout();
    auto init = getInit();
    auto var = new llvm::GlobalVariable(*IGM.getModule(), init->getType(),
                                        /*isConstant*/ true,
                                        llvm::GlobalValue::PrivateLinkage,
                                        init,
                                        "\x01l__swift3_reflection_metadata");
    var->setSection(IGM.getReflectionMetadataSectionName());
    var->setAlignment(IGM.getPointerAlignment().getValue());

    auto replacer = llvm::ConstantExpr::getBitCast(var, IGM.Int8PtrTy);
    tempBase->replaceAllUsesWith(replacer);

    return var;
  }
};

StringRef IRGenModule::getReflectionMetadataSectionName() {
  switch (TargetInfo.OutputObjectFormat) {
    case llvm::Triple::MachO:
      return "__DATA, __swift3_reflect, regular, no_dead_strip";
      break;
    case llvm::Triple::ELF:
      return ".swift3_reflect";
      break;
    default:
      llvm_unreachable("Don't know how to emit field name table for "
                       "the selected object format.");
  }
}

StringRef IRGenModule::getReflectionStringsSectionName() {
  switch (TargetInfo.OutputObjectFormat) {
    case llvm::Triple::MachO:
      return "__DATA, __swift3_reflstr, coalesced, no_dead_strip";
      break;
    case llvm::Triple::ELF:
      return ".swift3_reflstr";
      break;
    default:
      llvm_unreachable("Don't know how to emit field metadata table for "
                       "the selected object format.");
  }
}

StringRef IRGenModule::getReflectionTypeRefSectionName() {
  switch (TargetInfo.OutputObjectFormat) {
    case llvm::Triple::MachO:
      return "__DATA, __swift3_typeref, coalesced, no_dead_strip";
      break;
    case llvm::Triple::ELF:
      return ".swift3_typeref";
      break;
    default:
      llvm_unreachable("Don't know how to emit field typeref table for "
                       "the selected object format.");
  }
}

llvm::Constant *IRGenModule::getAddrOfFieldName(StringRef Name) {
  auto &entry = FieldNames[Name];
  if (entry.second)
    return entry.second;

  entry = createStringConstant(Name, /*willBeRelativelyAddressed*/ true,
                               getReflectionStringsSectionName());
  return entry.second;
}

llvm::Constant *IRGenModule::getAddrOfStringForTypeRef(StringRef Str) {
  auto &entry = StringsForTypeRef[Str];
  if (entry.second)
    return entry.second;

  entry = createStringConstant(Str, /*willBeRelativelyAddressed*/ true,
                               getReflectionTypeRefSectionName());
  return entry.second;
}

llvm::Constant *IRGenModule::emitReflectionMetadataRecords() {
  if (Opts.StripReflectionMetadata)
    return nullptr;

  if (NominalTypeDecls.empty())
    return nullptr;

  ReflectionMetadataBuilder builder(*this, NominalTypeDecls);
  auto var = builder.emit();
  addUsedGlobal(var);
  return var;
}


text:
using System;

namespace osu.Game.Skinning
{
    public class UnsupportedSkinComponentException : Exception
    {
        public UnsupportedSkinComponentException(ISkinComponent component)
            : base($@"Unsupported component type: {component.GetType()} (lookup: ""{component.LookupName}"").")
        {
        }
    }
}


text:
<!doctype html>

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>BEEZERS Northborough MA, 01532 - Cortera Company Profile</title>

<meta name="robots" content="index,follow" />

<meta name="keywords"
	content="BEEZERS, 14 E Main St, Northborough, MA, 01532-1642, (508) 393-2727,
	business profile, credit report, company information, industry information, company snapshot, company overview, free company profile, free business report" />

<meta name="description"
	content="Free Business profile for BEEZERS at 14 E Main St, Northborough, MA, 01532-1642, US.
	BEEZERS specializes in: Eating Places. This business can be reached at (508) 393-2727" />

<meta name="page-topic"
	content="BEEZERS, 14 E Main St, Northborough, MA, 01532-1642, US free business profile.
	Phone: (508) 393-2727" />

<link rel="shortcut icon"
	href="/company/resources/images/favicon.ico"
	type="image/x-icon" />
<link rel='stylesheet' href='/company/resources/css/profile2.css?ver=17.8B2' />

<link rel='stylesheet' href='/company/resources/css/slimbox2.css?ver=17.8B2' />

					cortera. business directory

Create
								Account

Login

Developers

<form action='/company/dispatcher/searchResults' method='post' name="businesssearch" id="businesssearch" class="form-info">
<fieldset>
	Search Cortera for a Business

			<input tabindex='1' type="text" value="Company Name"
				id="searchcompany" name="searchcompany" onfocus="if(this.value=='Company Name') { this.value='';}"
				onblur="if(this.value=='') {this.value='Company Name';}" >

			<input tabindex='2' onblur="if(this.value=='') {this.value='City';}"
				onfocus="if(this.value=='City') {this.value='';}" type="text"
				value="City"
				name="searchCity" id='searchCity'>

		<select name="searchState" id='searchState' class="sel" tabindex='3' onkeyup="javascript:stateKeyup(event)" value="MA">
		<optgroup label="US States">
	<option value="">State</option>
  <option value="AL">Alabama</option>
  <option value="AK">Alaska</option>
  <option value="AZ">Arizona</option>
  <option value="AR">Arkansas</option>
  <option value="CA">California</option>
  <option value="CO">Colorado</option>
  <option value="CT">Connecticut</option>
  <option value="DE">Delaware</option>
  <option value="DC">District of Columbia</option>
  <option value="FL">Florida</option>
  <option value="GA">Georgia</option>
  <option value="HI">Hawaii</option>
  <option value="ID">Idaho</option>
  <option value="IL">Illinois</option>
  <option value="IN">Indiana</option>
  <option value="IA">Iowa</option>
  <option value="KS">Kansas</option>
  <option value="KY">Kentucky</option>
  <option value="LA">Louisiana</option>
  <option value="ME">Maine</option>
  <option value="MD">Maryland</option>
  <option value="MA">Massachusetts</option>
  <option value="MI">Michigan</option>
  <option value="MN">Minnesota</option>
  <option value="MS">Mississippi</option>
  <option value="MO">Missouri</option>
  <option value="MT">Montana</option>
  <option value="NE">Nebraska</option>
  <option value="NV">Nevada</option>
  <option value="NH">New Hampshire</option>
  <option value="NJ">New Jersey</option>
  <option value="NM">New Mexico</option>
  <option value="NY">New York</option>
  <option value="NC">North Carolina</option>
  <option value="ND">North Dakota</option>
  <option value="OH">Ohio</option>
  <option value="OK">Oklahoma</option>
  <option value="OR">Oregon</option>
  <option value="PA">Pennsylvania</option>
  <option value="PR">Puerto Rico</option>
  <option value="RI">Rhode Island</option>
  <option value="SC">South Carolina</option>
  <option value="SD">South Dakota</option>
  <option value="TN">Tennessee</option>
  <option value="TX">Texas</option>
  <option value="UT">Utah</option>
  <option value="VT">Vermont</option>
  <option value="VA">Virginia</option>
  <option value="WA">Washington</option>
  <option value="WV">West Virginia</option>
  <option value="WI">Wisconsin</option>
  <option value="WY">Wyoming</option>
</optgroup>

		</select>
		<input tabindex="4" class="rndBtnSrch rndBtnBigSrch" type="submit" value="Search" id='searchBtn' onclick="javascript:return validate()">

</fieldset>
</form>

Home

Business
							Directory

Bars and Restaraunts

Beezers

Cortera Support: 866-589-0664

						Beezers

14 E Main St

							Northborough,

							 MA

							 01532-1642

							 |  view map

(508) 393-2727

						www.beezers.com

						Looking for more information? Sign
							up for FREE!

Company Overview

BEEZERS is in the Eating Places industry in Northborough, MA.  This company currently has approximately 1 to 5 employees  and  annual sales of Under $500,000.

Company Details

						Location Type:
						Single Location

						Industry:
						Eating Places

						Ownership: Private

						Year Founded:
						1998

						Sales Range:
						Under $500,000

						Employees:
						1 to 5

						<form name='suggestionForm' id="suggestionForm"
							action="/company/dispatcher/update"
							method='post' target="_blank">
							<input type="hidden" id='link_id' name='link_id'
								value='144335471' /> <input type="hidden"
								id='company_name' name='company_name'
								value='Beezers' /> <input
								type="hidden" id='address' name='address'
								value='14 E Main St' /> <input type="hidden"
								id='city' name='city' value='Northborough' /> <input
								type="hidden" id='state' name='state'
								value='MA' /> <input type="hidden"
								id='zip' name='zip' value='015321642' />
							<input type="hidden" id='phone' name='phone'
								value='5083932727' /> <input
								type="hidden" id='url' name='url'
								value='www.beezers.com' /> <input
								type="hidden" id='executivename' name='executivename'
								value='' /> <input
								type="hidden" id='executivetitle' name='executivetitle'
								value='' /> <input
								type="hidden" id='industry' name='industry'
								value='Eating Places' />
							<input type="hidden" id='ownership' name='ownership'
								value='' /> <input
								type="hidden" id='ticker' name='ticker'
								value='' /> <input
								type="hidden" id='exchange' name='exchange'
								value='' /> <input
								type="hidden" id='yearfounded' name='yearfounded'
								value='1998' />
							<input type="hidden" id='salesrange' name='salesrange'
								value='Under $500,000' /> <input
								type="hidden" id='employeesrange' name='employeesrange'
								value='1 to 5' /> <input
								type="hidden" id='location_type' name='location_type'
								value='Single Location' />
						</form>
						Have fresher information?  Update

Latest Company News

READ ALL COMPANY NEWS IN THE
									COMPLETE COMPANY CREDIT REPORT

Recent Company Alerts

Credit Risk Increase

No

Overall Payments

No

Peer Payments

No

Public Records

No

Financial News

No

								Alerts on more than 5,000 companies today,
								including:

										Fairmont Scottsdale Princess

										Alaska Specialty Lighting & Supply Inc

										AZ Technology Inc

										MID South Tool Supply

										United Machine Works

										Kelly Electric Inc

										Lake Point State Park

										Hilton Anchorage

										City of Casa Grande

										Ridge On Sedona Golf Resort HOA

Community Payment Ratings

								LATEST COMMUNITY REVIEWS OF THIS COMPANY

Cortera is much more than an awesome business
									directory! It's an active community where real business people
									share the real deal on real businesses.

It's invaluable intel
										that's now available for FREE.

Get the inside scoop with ratings and reviews on Beezers

Rate Beezers on their
										payment behavior

Ask your network about Beezers
										with Cortera Circles

									Join
										the Cortera Community for free today.

The information contained in this company profile is compiled from third party sources, including but not limited to public records, user submissions, and other commercially available data sources. These sources may not be accurate, complete, or up-to-date.
Cortera makes no representations or warranties regarding, and assumes no responsibility for, the accuracy, completeness, or currency of the information contained herein.
Cortera products are enabled by SOFIE™, our proprietary technology platform for rapid data processing, robust analytics and flexible data access.

			© 2017 Cortera, Inc. All rights reserved.

Sitemap

Cortera Support: 866-589-0664 |

How Does it Work? |

Who
					Do We Help? |

Company Profiles |

Community
				|

Media
				|

About

Today's
					Hot Company Profiles

VUDEN INC

VOLUME REVERSAL SURVEY

WR MITCHELL CONTRACTOR INC

VOGUE

VOORHEES ARIZONA TASTE INC

VORA SHAILESH C MD

VOLUNTEERS OF AMERICA INC

WHN INC

WR SCHULZ APARTMENT COMMUNITY

VOLATUS MAXIMUS LLC

						More
							Today's Hot Companies »

Recently
					Updated Companies

NEIL SINGER MD PLLC

COPELAND WELDING

CITY OF ELOY

AR MAYS CONSTRUCTION

SELMA ELECTRIC REPAIR

WOODWORKS OF KETCHIKAN

MURRAY PACIFIC SUPPLY OF AK

EUDORA GARMENT

SESSIONS CO INC

CITY OF SMACKOVER

							More
								Recently Updated Companies »

Recently
					Rated Company Profiles

SLT EXPRESS WAY INC

IDEAL TRUE VALUE INC

GLOBAL MERCHANDISING INC

STINGER WELDING INC

SUNSTAR HEATING & AIRE

PANALPINA INC

JR BALL CONTRACTING GROUP INC

LAW OFFICES OF SUSAN M SCHAUF

AZURADISC

MD THOMAS CONSTRUCTION LLC

							More
								Recently Rated Companies »

Industry Directory

Terms & Conditions

Privacy Policy


text:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetOutApplicationLogValidFlag(FALSE);
	//SetUseDXArchiveFlag(TRUE);
	//SetDXArchiveExtension("dat");

	//if (MessageBox(NULL, "ƒtƒ‹ƒXƒNƒŠ[ƒ"'Å‹N"®'µ'Ü'·'©H", "‹N"®ƒIƒvƒVƒ‡ƒ"", MB_YESNO) == IDYES){
	//ChangeWindowMode(0);
	//}
	//else{
	ChangeWindowMode(1);
	//}

	SetGraphMode(960, 540, 16);
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	SetWindowText("Swing By");

	if (DxLib_Init() == -1) return -1;
	SetMouseDispFlag(false);

	SetDrawScreen(DX_SCREEN_BACK);

	Input::init();
	Screen::init(960, 540);
	Image::loadGameScene();
	std::shared_ptr<SceneManager> mgr = std::make_shared<SceneManager>();
	mgr->initialize();

	while (1) {
		ClearDrawScreen();

		Input::keyUpdate();
		mgr->update();
		Screen::update();

		Screen::drawAll();
		ScreenFlip();

		if (ProcessMessage() == -1) break;
		if (mgr->isQuit()) break;
	}
	mgr->finalize();

	//#ifndef _DEBUG
	DxLib_End();
	//#endif
	return 0;
}


text:
using System.Linq;

using NUnit.Framework;
using CodeIt.Data.Models;
using System.ComponentModel.DataAnnotations;

namespace CodeIt.UnitTests.DbModels.ChallengeTests
{
    [TestFixture]
    public class Title_Should
    {
        [Test]
        public void Be_OfTypeString()
        {
            // Arrange
            var challenge = new Challenge();
            challenge.Title = "title";

            // Act & Assert
            Assert.IsTrue(challenge.Title.GetType() == typeof(string));
        }

        [Test]
        public void Has_RequiredAttribute()
        {
            // Arrange
            var challenge = new Challenge();

            // Act
            var hasAttr = challenge
                .GetType()
                .GetProperty(nameof(Challenge.Title))
                .GetCustomAttributes(false)
                .Where(x => x.GetType() == typeof(RequiredAttribute))
                .Any();

            // Assert
            Assert.IsTrue(hasAttr);
        }

        [Test]
        public void Has_MinLenghtAttribute()
        {
            // Arrange
            var challenge = new Challenge();

            // Act
            var hasAttr = challenge
                .GetType()
                .GetProperty(nameof(Challenge.Title))
                .GetCustomAttributes(false)
                .Where(x => x.GetType() == typeof(MinLengthAttribute))
                .Any();

            // Assert
            Assert.IsTrue(hasAttr);
        }

        [Test]
        public void Has_MaxLenghtAttribute()
        {
            // Arrange
            var challenge = new Challenge();

            // Act
            var hasAttr = challenge
                .GetType()
                .GetProperty(nameof(Challenge.Title))
                .GetCustomAttributes(false)
                .Where(x => x.GetType() == typeof(MaxLengthAttribute))
                .Any();

            // Assert
            Assert.IsTrue(hasAttr);
        }
    }
}


text:
<?php

/**
 * チェックしたエラーの内容を確定して、例外を発生させる。
 *
 * @package Vizualizer
 * @author Naohisa Minagawa <info@vizualizer.jp>
 */
class Vizualizer_Module_Error_Exception extends Vizualizer_Plugin_Module
{

    function execute($params)
    {
        $attr = Vizualizer::attr();
        $errors = $attr[Vizualizer::ERROR_KEY];
        if (!empty($errors)) {
            throw new Vizualizer_Exception_Invalid("", "");
        }
    }
}


text:
import * as ChildProcess from 'child_process'

/**
 * Execute the following sh program.
 */
export function execShellScript(body: string, cmd = 'bash'): Promise<string> {
  const args = ['-c', body]
  const process = ChildProcess.spawn(cmd, args)

  return new Promise((resolve, reject) => {
    let output = ''

    const handleClose = (returnCode: number | Error) => {
      if (returnCode === 0) {
        resolve(output)
      } else {
        reject(`Failed to execute ${body}`)
      }
    }

    process.stdout.on('data', buffer => {
      output += buffer
    })

    process.on('close', handleClose)
    process.on('error', handleClose)
  })
}

// Currently only reserved words where documentation doesn't make sense.
// At least on OS X these just return the builtin man. On ubuntu there
// are no documentaiton for them.
const WORDS_WITHOUT_DOCUMENTATION = new Set([
  'else',
  'fi',
  'then',
  'esac',
  'elif',
  'done',
])

/**
 * Get documentation for the given word by usingZZ help and man.
 */
export async function getShellDocumentationWithoutCache({
  word,
}: {
  word: string
}): Promise<string | null> {
  if (word.split(' ').length > 1) {
    throw new Error(`lookupDocumentation should be given a word, received "${word}"`)
  }

  if (WORDS_WITHOUT_DOCUMENTATION.has(word)) {
    return null
  }

  const DOCUMENTATION_COMMANDS = [
    { type: 'help', command: `help ${word} | col -bx` },
    // We have experimented with setting MANWIDTH to different values for reformatting.
    // The default line width of the terminal works fine for hover, but could be better
    // for completions.
    { type: 'man', command: `man ${word} | col -bx` },
  ]

  for (const { type, command } of DOCUMENTATION_COMMANDS) {
    try {
      const documentation = await execShellScript(command)
      if (documentation) {
        let formattedDocumentation = documentation.trim()

        if (type === 'man') {
          formattedDocumentation = formatManOutput(formattedDocumentation)
        }

        return formattedDocumentation
      }
    } catch (error) {
      // Ignoring if command fails and store failure in cache
      console.error(`getShellDocumentation failed for "${word}"`, { error })
    }
  }

  return null
}

export function formatManOutput(manOutput: string): string {
  const indexNameBlock = manOutput.indexOf('NAME')
  const indexBeforeFooter = manOutput.lastIndexOf('\n')

  if (indexNameBlock < 0 || indexBeforeFooter < 0) {
    return manOutput
  }

  const formattedManOutput = manOutput.slice(indexNameBlock, indexBeforeFooter)

  if (!formattedManOutput) {
    console.error(`formatManOutput failed`, {
      manOutput,
    })
    return manOutput
  }

  return formattedManOutput
}

/**
 * Only works for one-parameter (serializable) functions.
 */
export function memorize<T extends Function>(func: T): T {
  const cache = new Map()

  const returnFunc = async function(arg: any) {
    const cacheKey = JSON.stringify(arg)

    if (cache.has(cacheKey)) {
      return cache.get(cacheKey)
    }

    const result = await func(arg)

    cache.set(cacheKey, result)
    return result
  }

  return returnFunc as any
}

export const getShellDocumentation = memorize(getShellDocumentationWithoutCache)


text:
@class NSArray, WFBTLECommonData;

@interface WFBTLEHeartrateData : WFHeartrateData
{
    WFBTLECommonData *btleCommonData;
    NSArray *rrIntervals;
    int sensorContactStatus;
}

@property(nonatomic) int sensorContactStatus; // @synthesize sensorContactStatus;
@property(retain, nonatomic) NSArray *rrIntervals; // @synthesize rrIntervals;
@property(retain, nonatomic) WFBTLECommonData *btleCommonData; // @synthesize btleCommonData;
- (id)init;
- (void)dealloc;

@end


text:
@interface ClarificationListController : UITableViewController

@property (nonatomic,assign) NSInteger contestID;
@property (nonatomic,copy) NSString *contestTitle;

@end


text:
<?php

/* -----basic sql queries for Group Logic requests----
	### all of this is untested and currently in procedural form, This probably doesn't work yet and is heavily subject to change.

	Every one of these functions requires the connection to be established, tested, and closed down outside of the function. If there's a connection error or a NULL result, they'll all return FALSE. Do error handling outside.

	none of the processing of the returned data has been handled in any of these functions as of yet.

	none of the input/output has been sanitized for sql or html at this point, so use at your own risk.

*/

/*	basic query prototypes for class Group:

	---- Basic getters ----
	get_this_group()
	get_group_id()
	get_group_name()
	get_group_descrip()

	---- Basic setters ----
	set_group($group_id_in, $group_name_in, $group_descrip_in)
	set_group_id($group_id_in)
	set_group_name($group_name_in)
	set_group_descrip($group_descrip_in)

	----- info retrieval, group, and group users list operations -----
	create_group($conn, $gSql, $group_name_in, $group_descrip_in, $userID)
	get_group_info($conn, $gSql ,$groupID)
	get_group_users($conn, $gSql)
	num_of_members ($conn, $gSql)

	group_join_request($conn, $gSql, $groupID, $userID,  $userApproval, $adminApproval)
	user_join_request_status($conn, $gSql, $groupID, $userID)
	group_join_request_status($conn, $gSql, $groupID, $userID)
	join_group($conn, $gSql, $groupID, $userID, $userOrAdmin)
	process_join_requests($conn, $gSql, $groupID, $userID)
	admin_approve_user($conn, $gSql, $userID)
	user_approve_group($conn, $gSql, $userID)

	leave_group_pending($conn, $gSql, $userID)
	get_groups_pending($conn, $gSql, $userID)

	---- admin leader functions ----
	get_group_admins ($conn, $gSql)
	is_admin ($conn, $gSql, $userID)
	num_of_admins ($conn, $gSql)
	kick_user($conn, $gSql, $adminUser, $userID)

	---- private functions ----
	delete_group($conn, $gSql)
	leave_group($conn, $gSql, $userID)

	---- Leave Group Public Functions ----
	request_leave_group($conn, $gSql, $userID)
	normal_leave_group($conn, $gSql, $userID)
	last_member_leave_group($conn, $gSql, $userID)		//	ALWAYS CALL request_leave_group($conn, $gSql, $userID) before using this, since it deletes the entire group.

	- Return Codes For request_leave_group and normal_leave_group (see comments at function code for details):
		-1 = error
		0 = user removed
		1 = only 1 admin, switch admin first
		2 = only 1 group member left, confirm group delete

*/

include_once 'dataAccess.php';
include_once 'groupSQL.php';

// server info class
// note: you may have to pass this into your calls every time you do a server call. Instancing this inside the class didn't work.
if (!defined($conn))
{
	$conn = new DataAccess;
}

// group sql command variable
// note: you may have to pass this into your calls every time you do a server call. Instancing this inside the class didn't work.
if (!defined($gSql))
{
	$gSql = new GroupSQL;
}

// class for holding basic group information and operations
class Group
{
	private $group_id;
	private $group_name;
	private $group_description;

	// constructor
	function __construct()
	{}

	// destructor
	function __destruct()
	{
		$this->group_id = null;
		$this->group_name = null;
		$this->group_description = null;
	}

	// ---- Basic Getters ----

	public function get_this_group()
	{
		return $this;
	}

	// #works
	public function get_group_id()
	{
		return $this->group_id;
	}

	// # works
	public function get_group_name()
	{
		return $this->group_name;
	}

	// #works
	public function get_group_descrip()
	{
		return $this->group_description;
	}

	// ---- Basic Setters ----

	// sets a group from the given input
	public function set_group($group_id_in, $group_name_in, $group_descrip_in)
	{
		$this->group_id = $group_id_in;
		$this->group_name = $group_name_in;
		$this->group_description = $group_descrip_in;
	}

	public function set_group_id($group_id_in)
	{
		$this->group_id = $group_id_in;
	}

	public function set_group_name($group_name_in)
	{
		$this->group_name = $group_name_in;
	}

	public function set_group_descrip($group_descrip_in)
	{
		$this->group_description = $group_descrip_in;
	}

// ----- info retrieval, group, and group users list operations -----

	// creates a group with the and adds the current user as its admin leader
	// Precondition: -user_id should be an existing user
	//		- creates a group based off of the inputs currently in $this, use a setter first

	// # works
	public function create_group($conn, $gSql, $group_name_in, $group_descrip_in, $userID)
	{
		// assign the new incoming variables to this instance
		$this->group_name = $group_name_in;
		$this->group_description = $group_descrip_in;

		// connect to the server
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// create the group from the info in this class
		if (!$result2 = mysqli_query($db, $gSql->create_group($this->group_name, $this->group_description)))
		{
			//echo mysqli_error($result2);
			mysqli_close($db);
			return FALSE;
		}

		if (!$result3 = mysqli_query($db, $gSql->max_group_id()))
		{
			return FALSE;
		}

		$row = mysqli_fetch_row($result3);
		$this->group_id = $row[0];

		// add in the user as the group admin
		if(!$result5 = $this->join_group($conn, $gSql, $this->group_id, $userID, TRUE))
		{

			echo "group join fail";
			mysqli_close($db);
			return FALSE;
		}

		echo "join succeed";

		mysqli_close($db);
		return TRUE;
	}

	// get group information from the database based on a group id and sets this instance to
	// Precondition: $groupID exists

	// #works
	public function get_group_info($conn, $gSql ,$groupID)
	{

				// connect to the server
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// query the server for the group info
		if (!$result = mysqli_query($db, $gSql->get_group($groupID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		// fill $this with the retrieved data
		while ($row = mysqli_fetch_row($result))
		{
			$this->group_id = $row[0];
			$this->group_name = $row[1];
			$this->group_description = $row[2];
		}

		mysqli_close($db);
		return $result;

	}

	// request join group
	// Preconditions: user exists, group exists
	// 		- don't call this if the user already has a pending group request for this group. always check first.

	// #works
	public function group_join_request($conn, $gSql, $groupID, $userID,  $userApproval, $adminApproval)
	{

		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// add to request list
		if (!$result = mysqli_query($db, $gSql->request_join_group($groupID, $userID, $userApproval, $adminApproval)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}

	// get group request status for a user - user view
	// this returns whether or not a user has admin approval to join a group
	// Preconditions: group and user exists
	// This may return false if either the group doesn't exist, the user doesn't exist, the connection fails or the user doesn't have approval.

	// # works
	public function user_join_request_status($conn, $gSql, $groupID, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// get user group join status
		if (!$result = mysqli_query($db, $gSql->user_join_request_status($groupID, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);

		// process result
		$row = mysqli_fetch_row($result);

		return $row[0];
	}

	// get group request status for a user - group view
	// this returns whether or not a user has requested or submitted approval to join a group
	// Preconditions: group and user exists
	// This may return false if either the group doesn't exist, the user doesn't exist, the connection fails or the user doesn't have approval.

	// # works
	public function group_join_request_status($conn, $gSql, $groupID, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// get user group join status
		if (!$result = mysqli_query($db, $gSql->group_join_request_status($groupID, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);

		// process result
		$row = mysqli_fetch_row($result);

		return $row[0];
	}

	// compete join group
	// do not use this for requesting group membership
	// Precondition: groupID must be for an existing group
	//		- userID must be and existing user
	//	Inputs: $userOrAdmin: 	TRUE = admin leader
	//							FALSE = normal group member

	// This doesn't prevent duplicate user entries in the same group

	// # Works
	public function join_group($conn, $gSql, $groupID, $userID, $userOrAdmin)
	{

		echo "join attempt";
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// add user to group
		if (!$result = mysqli_query($db, $gSql->join_group($groupID, $userID, $userOrAdmin)))
		{
			echo "join fail";
			mysqli_close($db);
			return FALSE;
		}

		echo "join succeeed";
		mysqli_close($db);
		return TRUE;
	}

	// checks against the Add_Users_Pending table for confirmation from both the user and admin to join a group. If both are confirmed, this will take the user out of the pending list and add them to the group.
	// always call this after adding an accept to the pending request
	// Preconditions: group and user exists, the user has a pending add to group request

//test this
	public function process_join_requests($conn, $gSql, $groupID, $userID)
	{
		// check if the user has both user and group admin confirmation

		if (!(($this->user_join_request_status($conn, $gSql, $groupID, $userID)) && ($this->group_join_request_status($conn, $gSql, $groupID, $userID))))
		{
			return FALSE;
		}

		//	add the user to the group
		if (!($this->join_group($conn, $gSql, $groupID, $userID, $userOrAdmin)))
		{
			return FALSE;	// add failed
		}

		// remove the user from group pending
		return $this->leave_group_pending($conn, $gSql, $userID);
	}

	// group admin leader function for approving a user join request for this group.
	// Preconditions: user must exist, $group_id must be set to the group in question
	//		- always check is_admin before calling this
	// Postcondition: always call process_join_requests after calling this

	// # works
	public function admin_approve_user($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// add to request list
		if (!$result = mysqli_query($db, $gSql->approve_user($this->group_id, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}

	// requesting user function for approving a group join request for this group.
	// Preconditions: user must exist, $group_id must be set to the group in question
	// Postcondition: always call process_join_requests after calling this

	// # works
	public function user_approve_group($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// add to request list
		if (!$result = mysqli_query($db, $gSql->approve_group($this->group_id, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}

	// removes a user from this group
	// Preconditions: - User must exist
	//				- $group_id must be set
	// Note: don't use this directly in your leave group calls, since this only removes the user from the database but doesn't check if they are an admin or the last member of the group. That's a multiple step operation that requires more user input in some cases.

	// # works
	private function leave_group($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// remove the user from the group
		if (!$result = mysqli_query($db, $gSql->leave_group($this->group_id, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}

	// remove a user from the group pending list for this group
	// Preconditions: - User must exist
	//				- $group_id must be set

	// # works
	public function leave_group_pending($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		// remove the user from the group
		if (!$result = mysqli_query($db, $gSql->leave_group_pending($this->group_id, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}

	// returns the user_ids for members of this group, as well as their admin leader status
	//	Precondition: $group_id is set
	// 	Returns: this will return an array which will have to be processed by each row for each group member using mysqli_fetch_row.
	// Postcondition: you'll have to get the user info for each row via the Users class

	// # works
	public function get_group_users($conn, $gSql)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->get_group_users($this->group_id)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return $result;
	}

	// get all group_ids for a user's group pending requests
	//	Precondition: $group_id is set
	// 	Returns: this will return an array which will have to be processed by each row for each group member using mysqli_fetch_row.
	// Postcondition: you'll have to get the user info for each row via the Users class

	// # works
	public function get_groups_pending($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->get_groups_pending($userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return $result;
	}

	// get the userIDs of every admin leader in this group
	// Precondition: $group_id is set
	// 	Returns: this will return an array which will have to be processed by each row for each group member using mysqli_fetch_row.
	// Postcondition: you'll have to get the user info for each row via the Users class

	// # works
	public function get_group_admins ($conn, $gSql)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->get_group_admins($this->group_id)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return $result;
	}

	// check if a user is an admin leader for this group
	// Precondition: the user is a member of the group

	// # works
	public function is_admin ($conn, $gSql, $userID)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->is_admin($this->group_id, $userID)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);

		$row = mysqli_fetch_row($result);
		return $row[0];
	}

	// returns the amount of admin leaders that the group currently has
	// Precondition: The group_id is set to an existing group

	// # works
	public function num_of_admins ($conn, $gSql)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->num_of_admins($this->group_id)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);

		$row = mysqli_fetch_row($result);
		return $row[0];
	}

	// returns the amount of members that this group currently has
	// Precondition: the group exists
	// # works
	public function num_of_members ($conn, $gSql)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->num_of_members($this->group_id)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);

		$row = mysqli_fetch_row($result);
		return $row[0];
	}

	// kicks a user from this group
	// This first checks the current admin user's credentials, then kicks the other user from the group. This will not kick another member
	// Preconditions: $adminUser is one of this group's admin users,

	// # works
	public function kick_user($conn, $gSql, $adminUser, $userID)
	{

		// prevent the adminUser from kicking themselves
		if ($adminUser == $userID)
		{
			return FALSE;
		}

		// check if the $adminUser is an admin leader for this group
		if (!$this->is_admin($conn, $gSql, $adminUser))
		{
			return FALSE;
		}

		// prevent the admin from kicking another admin user
		if ($this->is_admin($conn, $gSql, $userID))
		{
			return FALSE;
		}

		// kick the user from the group
		return $this->leave_group($conn, $gSql, $userID);
	}

// ------- Leave Group Functions ------

	// makes a request to the database to leave the group
	// Precondition: User must be a member of this group, group_id must be set
	// Return Codes: -1 = error
	//				0 = user removed
	//				1 = only 1 admin, switch admin first
	//				2 = only 1 group member left, confirm group delete

	// # works
	public function request_leave_group($conn, $gSql, $userID)
	{
		// check if the user is an admin
		if($this->is_admin ($conn, $gSql, $userID))
		{
			// user is admin, check the number of admins in the group
			if($this->num_of_admins ($conn, $gSql, $groupID) == 1)
			{
				// there's only 1 admin, check the number of members left in the group
				if($this->num_of_members ($conn, $gSql, $groupID) == 1)
				{
					// The admin is the only group member left, so they need to confirm that they want the group deleted, otherwise they can't leave. Send this to the UI.
					return 2;
				}

				else
				{
					// The group has multiple members, but another user must be made an admin leader before this user can leave the group. Send this to the UI.
					return 1;
				}
			}
		}

		// remove the user from the group
		return $this->normal_leave_group($conn, $gSql, $userID);
	}

	// removes a user from a group
	// Use this instead of leave_group for finishing leave group requests. This does the same thing but gives different return codes, which works better with request_leave_group.
	// Call in the case where an admin assigns a new admin another group to remove themselves from the group.
	// Precondition: User must be a member of this group, group_id must be set
	// Return Codes: -1 = error
	//				0 = user removed

	// # works
	public function normal_leave_group($conn, $gSql, $userID)
	{
		// user leaves group
		if (!$this->leave_group($conn, $gSql, $userID))
		{
			return -1;	// error removing user from group
		}

		return 0;
	}

	// Removes a member from a group and deletes the group.
	// Only use this when there is only one user left in the group.
	// Preconditions: this group exists and the user is the group admin leader
	//	ALWAYS CALL request_leave_group($conn, $gSql, $userID) before using this, since it deletes the entire group.

	// # works
	public function last_member_leave_group($conn, $gSql, $userID)
	{
				// user leaves group
		if (!$this->leave_group($conn, $gSql, $userID))
		{
			return FALSE;	// error removing user from group
		}

		return $this->delete_group($conn, $gSql);
	}

	// deletes this group from the database
	// Precondition: group exists

	// *** DO NOT USE THIS DIRECTLY. Always call through another function and check the admin level of the user calling it and the number of users in the group before deleting it! This will wipe the group, it's member tables, calendar and chat via cascade.

	// # works
	private function delete_group($conn, $gSql)
	{
		if(!$db = mysqli_connect($conn->host_name(), $conn->host_user(), $conn->host_pass(), $conn->serv_name()))
		{
			return FALSE;
		}

		if (!$result = mysqli_query($db, $gSql->delete_group($this->group_id)))
		{
			mysqli_close($db);
			return FALSE;
		}

		mysqli_close($db);
		return TRUE;
	}
}

?>


text:
usage(){
        echo ""
        echo "prepare-experiment: Set up and run an experiment. You must specify the"
	echo "			  number of Ec2 instances to run and time for experiment to run for"
        echo ""
        echo "Usage: `basename $0` <number of Instances> <time in seconds> <expName> <num of webnodes> <inst type>"
        echo ""
        echo " Options:"
        echo "        h - provides help messages"
        echo "        v - script version"
        echo "        d - Use DIT webnodes"
        echo "        n - Use HEANT webnodes"
        echo "        a - Use Amazon webnodes"
        echo "        x - Use all of the webnodes"
        echo "        t - Use all of the webnodes write msg from single source"
        echo ""
        echo " Parameters"
        echo "        Number of Instances: This is the number of Ec2 instances to run"
        echo "        Time in seconds: This is the numebr of seconds for the experiment to run"
        echo "        ExpName: Name of the experiment for use in logfile monitoring"
        echo "        Number of Nodes: Number of webnodes to start up. value 1-2 or 6 for all nodes"
        echo "        Type of Instance: t1.micro m1.medium m1.large ibm326"
        echo ""
}

while getopts hvdnaftx OPT; do
        case "$OPT" in
                h) #  Help
                        usage
                        exit 0
                        ;;
                v) #  Show Version
                        echo "`basename $0` version 0.1"
                        exit 0
                        ;;
                d) #  use the DIT webservers
                        COMMAND=1;;
                n) #  use the heanet webservers
                        COMMAND=2;;
                a) #  use the amazon webservers
                        COMMAND=3;;
                x) #  use all webservers
                        COMMAND=4;;
                f) #  use all FTP
                        COMMAND=5;;
                t) #  test using all webserver but ensure even distribution of filenames
                        COMMAND=6;;
                \?)
                        usage
                        exit 1
                        ;;
        esac
done

shift `expr $OPTIND - 1`

if [ $# -eq 5 ]; then
	INSTNUM=$1
	EXPTIME=$2
	EXPNAME=$3
	NUMNODE=$4
	INSTTYPE=$5
else
	usage
	echo "Invalid number of parameters"
	exit 1
fi

echo " "
echo " "
echo " "
echo " "
echo " "
echo "Start Experiment " $3
echo " "
echo " "
echo " "

SMALLDIR="/var/www/nginx-default/data/compressed-small"
BIGDIR="/var/www/nginx-default/data/compressed"
FTPDIR="/ftpsite"
DATADIR=$BIGDIR
AWSUSER="ubuntu"
DITUSER="paul"
USER=""

if [ $INSTNUM -le 0 ]; then
        echo "No instances requested to run. We will just run a timer"
elif [ $INSTNUM -gt 2 ]; then
	DATADIR=$BIGDIR
else
	DATADIR=$SMALLDIR
fi

if [ $EXPTIME -le 10 ]; then
        echo "need to enter a time for experiment > 60"
        usage
        exit 1
fi
if [ $NUMNODE -le 0 ]; then
        echo "need to enter > 0 nodes"
        usage
        exit 1
fi

WEBNODE1=""
WEBNODE2=""
DITNODE1="webnode1.dit.ie"
DITNODE2="webnode2.dit.ie"
AWSNODE1="webnode3.nightsky.ie"
AWSNODE2="webnode4.nightsky.ie"
HEANODE1="webnode5.nightsky.ie"
HEANODE2="webnode6.nightsky.ie"
HEANODE3="ftp.heanet.ie/mirrors/phdtest/"
AWSNODE3="webnode7.nightsky.ie"
AWSNODE4="webnode8.nightsky.ie"

if [ $COMMAND -eq 1 ]; then
        if [ $NUMNODE -le 0 ]  ||  [ $NUMNODE -ge 3 ] ; then
		echo "Valid nodes are 1-2 for DIT webservers"
        	usage
        	exit 1
	else
		WEBNODE1=$DITNODE1
		USER=$DITUSER
		if [ $NUMNODE -eq 2 ]; then
			WEBNODE2=$DITNODE2
		fi
	fi
fi
if [ $COMMAND -eq 2 ]; then
        if [ $NUMNODE -le 0 ] || [ $NUMNODE -ge 3 ] ; then
		echo "Valid nodes are 1-2 for HEANET webservers"
        	usage
        	exit 1
	else
		WEBNODE1=$HEANODE1
		USER=$DITUSER
		if [ $NUMNODE -eq 2 ]; then
			WEBNODE2=$HEANODE2
		fi

	fi
fi
if [ $COMMAND -eq 3 ]; then
        if [ $NUMNODE -le 0 ] || [ $NUMNODE -ge 5 ] ; then
		echo "Valid nodes are 1-4 for AMAZON webservers"
        	usage
        	exit 1
	else
		WEBNODE1=$AWSNODE1
		USER=$AWSUSER
		if [ $NUMNODE -eq 2 ]; then
			WEBNODE2=$AWSNODE2
		fi
		if [ $NUMNODE -eq 3 ]; then
			WEBNODE2=$AWSNODE2
			WEBNODE3=$AWSNODE3
		fi
		if [ $NUMNODE -eq 4 ]; then
			WEBNODE2=$AWSNODE2
			WEBNODE3=$AWSNODE3
			WEBNODE4=$AWSNODE4
		fi

	fi
fi

# Initialise timers and required variables
START=$(date +%s)
NOW=$(date +"%Y%m%d%H%M%S")

# Stop any instances running in the Ireland Region

echo "Step 1.1: terminating any running Ec2 Instances"
python Ec2-terminateallinstances
python Ec2-stopcanary.py t1.micro
python Ec2-stopcanary.py m1.large

echo "Step 2. Deleting all queues"
python sqs-delete.py workerq
python sqs-delete.py canaryq
python sqs-delete.py cmdq
python sqs-delete.py supervisor
python sqs-delete.py workerregister
python sqs-delete.py logfile
python sqs-delete.py resultq

echo "Step 3. Removing files from the bucket"
python s3-fastdelete.py

echo "Step 4. Waiting 60 seconds so queue can be recreated"
sleep 60

python sqs-create.py cmdq
python sqs-create.py supervisor
python sqs-create.py workerregister
python sqs-create.py logfile
python sqs-create.py resultq
python sqs-create.py workerq
python sqs-create.py canaryq

echo "Writing START to cmdq"
python cmdq-ctrl.py cmdq START
echo "Writing WORK to supervisor"
python cmdq-ctrl.py supervisor WORK

echo "Populating the queues as required"
#
# We are using the DIT Servers
#
if [ $COMMAND -eq 1 ]; then
	SMALLDIR="/var/www/nginx-default/data/compressed-small"
	if [ $NUMNODE -eq 2 ] ; then
		echo "Populating queue from " $WEBNODE2
		ssh $USER@$WEBNODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE2/data/compressed/ &
	fi
	echo "Populating queue from " $WEBNODE1
	ssh $USER@$WEBNODE1 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE1/data/compressed/
fi

#
# We are using the HEANET Servers
#
if [ $COMMAND -eq 2 ]; then
		if [ $NUMNODE -eq 2 ] ; then
			echo "Populating queue from " $WEBNODE2
			ssh $USER@$WEBNODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE2/data/compressed/ &
		fi
	echo "Populating queue from " $WEBNODE1
	echo "ssh " $USER $WEBNODE1 "/home/paul/nimbus-client/sqs-qm -w workerq " $DATADIR  $WEBNODE1
	ssh $USER@$WEBNODE1 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE1/data/compressed/
elif [ $COMMAND -eq 3 ]; then

	if [ $NUMNODE -ge 2 ] ; then
		echo "Populating queue from " $WEBNODE2
		echo "ssh " $USER $WEBNODE2 "/home/ubuntu/nimbus-client/sqs-qm -w workerq " $DATADIR  $WEBNODE2
		ssh -i ./keys/nimbuskey.pem $USER@$WEBNODE2 /home/ubuntu/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE2/data/compressed/ &
	fi
	if [ $NUMNODE -ge 3 ] ; then
		echo "Populating queue from " $WEBNODE3
		echo "ssh " $USER $WEBNODE3 "/home/ubuntu/nimbus-client/sqs-qm -w workerq " $DATADIR  $WEBNODE3
		ssh -i ./keys/nimbus-oregon.pem $USER@$WEBNODE3 /home/ubuntu/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE3/data/compressed/ &
	fi
	if [ $NUMNODE -ge 4 ] ; then
		echo "Populating queue from " $WEBNODE4
		echo "ssh " $USER $WEBNODE4 "/home/ubuntu/nimbus-client/sqs-qm -w workerq " $DATADIR  $WEBNODE4
		ssh -i ./keys/nimbus-oregon.pem $USER@$WEBNODE4 /home/ubuntu/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE4/data/compressed/ &
	fi

	echo "Populating queue from " $WEBNODE1
	ssh -i ./keys/nimbuskey.pem $USER@$WEBNODE1 /home/ubuntu/nimbus-client/sqs-qm -w workerq $DATADIR  $WEBNODE1/data/compressed/

elif [ $COMMAND -eq 4 ]; then
	echo "Populating all 9 webnodes...this will take a while...."
	ssh paul@$HEANODE1 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE1/data/compressed/ &
	ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE2/data/compressed/ &
	ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $FTPDIR  $HEANODE3

elif [ $COMMAND -eq 5 ]; then
	echo "Populating ftp webnodes...this will take a while...."
	DATADIR=$FTPDIR
	if [ $INSTNUM -ge 0 ]; then
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
	fi
	if [ $INSTNUM -ge  10 ]; then
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
	fi
	if [ $INSTNUM -ge  20 ]; then
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
	fi
	if [ $INSTNUM -ge  49 ]; then
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
		ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-qm -w workerq $DATADIR  $HEANODE3
	fi
elif [ $COMMAND -eq 6 ]; then
	echo "Populating all 9 webnodes from one location take a while...."
	ssh paul@$HEANODE2 /home/paul/nimbus-client/sqs-loader
fi

#read -p "When you have a queue fully populated and ready to work press any key to continue to start instances..."
NOW=$(date +"%Y-%m-%d-%H:%M:%S")
MONITORINGFILE="$3-Monitor-Workerq.csv"
LOGFILE="$3-logfile.csv"
WORKERREGFILE="$3-WorkerReg.csv"
RESULTFILE="$3-ResultQ.csv"

EXPTIMEMON=$(( $EXPTIME + 150 ))

if [ ! -d ./ExperimentalResults/$3 ]; then
	mkdir ./ExperimentalResults/$3
fi
mkdir ./ExperimentalResults/$3/$NOW
echo "Start monitoring the workerq for length of the experiment"

#ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie /home/ubuntu/nimbus-client/startmonitoring.sh $3 $NOW workerq $EXPTIMEMON &
ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185 /home/ubuntu/nimbus-client/startmonitoring.sh $3 $NOW workerq $EXPTIMEMON &
#python sqs-monitor.py workerq $EXPTIMEMON > ./ExperimentalResults/$3/$NOW/$MONITORINGFILE &

UTCDATE=$(date )
echo "Start time is " $UTCDATE

if [[ $INSTTYPE == "ibm326" ]]; then
	read -p "start the IBM server manually and hit return"
elif [[ $INSTTYPE == "x4150" ]]; then
	read -p "start the x4150 server manually and hit return"
#elif [[ $INSTTYPE == "m3.2xlarge" ]]; then
#	read -p "start the m3.2xlarges servers in other regions manually and hit return"
else
	echo "AMI instances to start = " $1
  #	echo "Starting the canary"
	#
	# A canary instance runs with the rest of the experiment and is used to see how each of its clones also runs.
	# With the exception of the 1 instance test the canary is counted as part of the run.
	#
	#
  #	python Ec2-startcanary.py $INSTTYPE &
fi

#
#
#
# This creates and stops the instances after the set amount of time has concluded
#
# A canary instance runs with the rest of the experiment and is used to see how each of its clones also runs.
# With the exception of the 1 instance test the canary is counted as part of the run.
#
#
#if [ $INSTTYPE == "t1.micro" ]; then
#	python Ec2-startcanary.py t1.micro
#else
#	python Ec2-startcanary.py M1.large
#fi

if [ $INSTNUM -le 0 ]; then
	python timer.py $EXPTIME
	# After the instances have finished, read the logfiles and write then out"
	echo "killing the monitor"
	UTCDATE=$(date)
	echo "TIME ENDED: time is " $UTCDATE
#	ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie kill $(ps aux | grep '[p]ython sqs-monitor.py' | awk '{print $2}') > /dev/null 2>&1
	ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185  kill $(ps aux | grep '[p]ython sqs-monitor.py' | awk '{print $2}') > /dev/null 2>&1
	python cmdq-ctrl.py cmdq STOP
else
	python Ec2-createinstancefromAMI.py $INSTNUM $EXPTIME $INSTTYPE
	# After the instances have finished, read the logfiles and write then out"
	echo "killing the monitor"
	UTCDATE=$(date)
	echo "TIME ENDED: time is " $UTCDATE
#	ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie kill $(ps aux | grep '[p]ython sqs-monitor.py' | awk '{print $2}') > /dev/null 2>&1
	ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185 kill $(ps aux | grep '[p]ython sqs-monitor.py' | awk '{print $2}') > /dev/null 2>&1
	python cmdq-ctrl.py cmdq STOP
	python Ec2-terminateallinstances
fi

#
#
#python Ec2-stopallinstances
#
#
#
#

echo "Reading logfiles from the queue"
#ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW workerregister
#ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW resultq &
#ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW logfile &
ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185 /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW workerregister
ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185 /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW resultq &
ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185 /home/ubuntu/nimbus-client/downloadlogfile.sh $3 $NOW logfile &

#
#
# Check that the logfile is empty before removing it
#
python sqs-count.py logfile
status=$?
echo " checking logfile"
while [ $status -gt 0 ];
    do
	python sqs-count.py logfile
    	status=$?
    	sleep 5
    done;
echo DONE

echo cleaning up processes which may still be running
echo "Running Metrics"
#ssh -i ./keys/nimbuskey.pem ubuntu@munin.nightsky.ie /home/ubuntu/nimbus-client/downloadlogfile.sh -m $3 $NOW supervisor &
ssh -i ./keys/nimbus-oregon.pem ubuntu@54.244.93.185  /home/ubuntu/nimbus-client/downloadlogfile.sh -m $3 $NOW supervisor &
UTCDATE=$(date)
echo "End time is " $UTCDATE
echo ""
echo ""
echo "---------------------"


text:
using System;
using System.Linq.Expressions;
using JetBrains.Annotations;

namespace HeaderArrayConverter.IO
{
    /// <summary>
    /// Represents a validation error.
    /// </summary>
    [PublicAPI]
    public class DataValidationException : Exception
    {
        /// <summary>
        /// Constructs a validation error for <paramref name="name"/> in which the <paramref name="expected"/> value does not align with the <paramref name="actual"/> value.
        /// </summary>
        /// <param name="name">
        /// The name of the property or operation.
        /// </param>
        /// <param name="expected">
        /// The value that was expected.
        /// </param>
        /// <param name="actual">
        /// The value that was received.
        /// </param>
        public DataValidationException(string name, object expected, object actual) : base($"Property: {name}; Expected '{expected}'; Actual: {actual}.") { }

        /// <summary>
        /// Constructs a validation error for <paramref name="propertyAccess"/> in which the <paramref name="source"/> value does not align with the <paramref name="actual"/> value.
        /// </summary>
        /// <param name="source">
        /// The object from which the named property value was expected to match.
        /// </param>
        /// <param name="propertyAccess">
        /// The name of the property or operation.
        /// </param>
        /// <param name="actual">
        /// The value that was received.
        /// </param>
        public static DataValidationException Create<T>(T source, [NotNull] Expression<Func<T, object>> propertyAccess, object actual)
        {
            return new DataValidationException(Name(propertyAccess), Value(propertyAccess, source), actual);
        }

        /// <summary>
        /// Accesses the property name passed to the <see cref="DataValidationException"/> constructor.
        /// </summary>
        /// <param name="expression">
        /// The member access expression retrieving a property.
        /// </param>
        /// <returns>
        /// The name of the property.
        /// </returns>
        private static string Name<T>([NotNull] Expression<Func<T, object>> expression)
        {
            if (expression is null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            return ((MemberExpression)expression.Body).Member.Name;
        }

        /// <summary>
        /// Accesses the property name passed to the <see cref="DataValidationException"/> constructor.
        /// </summary>
        /// <param name="expression">
        /// The member access expression retrieving a property.
        /// </param>
        /// <param name="parameter">
        /// The parameter object.
        /// </param>
        /// <returns>
        /// The name of the property.
        /// </returns>
        private static object Value<T>([NotNull] Expression<Func<T, object>> expression, T parameter)
        {
            if (expression is null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            return expression.Compile().Invoke(parameter);
        }
    }
}


text:
//-*- Mode: C++ -*-
// $Id$

#ifndef ALIHLTTRDCALIBRATIONCOMPONENT_H
#define ALIHLTTRDCALIBRATIONCOMPONENT_H
/
class AliHLTTRDCalibrationComponent : public AliHLTCalibrationProcessor
{
public:
  AliHLTTRDCalibrationComponent();
  virtual ~AliHLTTRDCalibrationComponent();

  // Public functions to implement AliHLTComponent's interface.
  // These functions are required for the registration process

  const char* GetComponentID();
  void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
  AliHLTComponentDataType GetOutputDataType();
  int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
  AliHLTComponent* Spawn();

protected:

  // Protected functions to implement AliHLTComponent's interface.
  // These functions provide initialization as well as the actual processing
  // capabilities of the component.

  AliTRDCalibraFillHisto *fTRDCalibraFillHisto;

  virtual Int_t InitCalibration();
  virtual Int_t ScanArgument(int argc, const char** argv);
  virtual Int_t DeinitCalibration();
  virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData,
				   const AliHLTComponent_BlockData* blocks,
				   AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
				   AliHLTUInt32_t& size,
				   vector<AliHLTComponent_BlockData>& outputBlocks);
  /* 	virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); */
  virtual Int_t ShipDataToFXS(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
  virtual Int_t  EORCalibration();

  using AliHLTCalibrationProcessor::ProcessCalibration;
  //using AliHLTCalibrationProcessor::ShipDataToFXS;

private:
  /** copy constructor prohibited */
  AliHLTTRDCalibrationComponent(const AliHLTTRDCalibrationComponent&);
  /** assignment operator prohibited */
  AliHLTTRDCalibrationComponent& operator=(const AliHLTTRDCalibrationComponent&);
  void FormOutput(Int_t param);

  AliHLTUInt32_t fOutputSize;    // output size
  TClonesArray* fTracksArray;    // array containing the input
  TObjArray* fOutArray;          // array containing the output
  TObjArray* fAfterRunArray;     // array with after run processing output
  TObjArray* fDisplayArray;      // array with online display histos
  Bool_t fSavedTimeBins;         // already saved the number of time bins?
  TObjArray *fTrgStrings;        // name of trigger classes to accept or reject
  Int_t  fAccRejTrg;             // do we actually accept or reject the trigger strings?
  Int_t fMinClusters;           // minimal number of clusters/tracklet accepted to fill histos
  Int_t fMinTracklets;          // minimal number of tracklets/track accepted to fill histos
  Bool_t fTakeAllEvents;         // take all events, disregarding the triggers

  ClassDef(AliHLTTRDCalibrationComponent, 2)

};
#endif


text:
/**
 * Menu item interface.
 */
export interface MenuItem {
  /**
   * Displayed name.
   */
  name?: string;

  /**
   * Entity name to be used in the URL.
   */
  entityName?: string;

  /**
   * Custom URL for list view.
   */
  listUrl?: string;

  /**
   * Custom URL for create view.
   */
  createUrl?: string;
}


text:
<readable><title>2164363131_6930455d45</title><content>
A dog leaps for a toy on a road .
A man and a dog play with a Frisbee .
A person holding a Frisbee just out of reach of a white dog on a rural road
Person holding a Frisbee with a white dog jumping for it on a road .
The dog jumps up to get the Frisbee in the man 's hand .
</content></readable>


text:
module WinJSTests {

    "use strict";

    var pivotWrapperEl;

    var Pivot = <typeof WinJS.UI.PrivatePivot>WinJS.UI.Pivot;

    export class PivotItemTests {

        setUp() {
            pivotWrapperEl = document.createElement('div');
            pivotWrapperEl.style.cssText = "width: 320px; height: 480px; background-color: #777;"
            document.body.appendChild(pivotWrapperEl);
        }

        tearDown() {
            WinJS.Utilities.disposeSubTree(pivotWrapperEl);
            document.body.removeChild(pivotWrapperEl);
        }

        testContentElement = function () {
            var pivotItemEl = document.createElement('div');
            pivotItemEl.innerHTML = '

';
            var firstChild = pivotItemEl.firstChild;
            var pivotItem = new WinJS.UI.PivotItem(pivotItemEl);

            // The content inside a pivot item should be reparented inside of contentElement.
            LiveUnit.Assert.areEqual(firstChild, pivotItem.contentElement.firstChild, "First child match");
        };

        testHeaderChange = function (complete) {
            var pivotItem = new WinJS.UI.PivotItem(undefined, {
                header: 'foo1'
            });

            var pivot = new WinJS.UI.Pivot();
            pivotWrapperEl.appendChild(pivot.element);

            pivot.items.push(pivotItem);
            pivot.addEventListener("itemanimationend", function () {
                var header = pivot.element.querySelector("." + Pivot._ClassNames.pivotHeaderSelected);
                LiveUnit.Assert.areEqual('foo1', header.textContent);

                pivotItem.header = 'foo2';
                header = pivot.element.querySelector("." + Pivot._ClassNames.pivotHeaderSelected);
                LiveUnit.Assert.areEqual('foo2', header.textContent);

                complete();
            });
        };
    };
}

LiveUnit.registerTestClass("WinJSTests.PivotItemTests");


text:
#import <UIKit/UIKit.h>

#import "MDCTextFieldPositioningDelegate.h"

@protocol MDCTextInput;
@protocol MDCTextInputCharacterCounter;

/** Controllers that manipulate styling and animation of text inputs. */
@protocol MDCTextInputController <NSObject, NSCoding, NSCopying, MDCTextInputPositioningDelegate>

/**
 Color for decorations that indicates the input is currently editing.

 Default is activeColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *activeColor;

/**
 Default value for activeColor.
 */
@property(class, nonatomic, null_resettable, strong) UIColor *activeColorDefault;

/**
 The character counter. Override to use a custom character counter.

 Default is an internal instance MDCTextInputAllCharactersCounter. Setting this property to null
 will reset it to return that instance.
 */
@property(nonatomic, null_resettable, weak) IBInspectable id<MDCTextInputCharacterCounter>
    characterCounter;

/**
 The character count maximum for the text input. A label under the input counts characters entered
 and presents the count / the max.

 If character count / max has been hidden by the characterCountViewMode
 (ie: UITextFieldViewModeNever) changing the value of characterLimit has no effect.

 If the character count goes above its max, the underline, the character count / max label and
 any floating placeholder label all turn to the error color; the text input will be in error state.
 Note: setErrorText:errorAccessibilityValue: also sets these MDCTextInput properties.

 There is no support for a minimum character count.
 */
@property(nonatomic, assign) IBInspectable NSUInteger characterCountMax;

/**
 Controls when the character count will be shown and therefore whether character counting determines
 error state.
 */
@property(nonatomic, assign) UITextFieldViewMode characterCountViewMode;

/**
 Color for decorations that indicates the input is not enabled / not accepting touch.

 Default is disabledColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *disabledColor;

/** Default value for disabledColor. */
@property(class, nonatomic, null_resettable, strong) UIColor *disabledColorDefault;

/**
 The color used to denote error state in decorations, the errorText's label, the placeholder and
 the character count label.

 Default is errorColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *errorColor;

/** Default value for errorColor. */
@property(class, nonatomic, null_resettable, strong) UIColor *errorColorDefault;

/**
 The text being displayed in the leading underline label when in an error state.

 NOTE: To set this value, you must use setErrorText:errorAccessibilityValue:.
 */
@property(nonatomic, nullable, copy, readonly) NSString *errorText;

/**
 Text displayed in the leading underline label.

 This text should give context or instruction to the user. If error text is set, it is
 not shown.
 */
@property(nonatomic, nullable, copy) IBInspectable NSString *helperText;

/**
 The color applied to the placeholder when inline (not floating).

 Default is inlinePlaceholderColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *inlinePlaceholderColor;

/** Default value for inlinePlaceholderColor. */
@property(class, nonatomic, null_resettable, strong) UIColor *inlinePlaceholderColorDefault;

/**
 The font applied to the placeholder when inline (not floating).

 Default is inlinePlaceholderFontDefault;
 */
@property(nonatomic, null_resettable, strong) UIFont *inlinePlaceholderFont;

/** Default value for inlinePlaceholderFont. */
@property(class, nonatomic, null_resettable, strong) UIFont *inlinePlaceholderFontDefault;

/**
 The font applied to the leading side underline label.

 Default is leadingUnderlineLabelFontDefault.
 */
@property(nonatomic, null_resettable, strong) UIFont *leadingUnderlineLabelFont;

/** Default value for leadingUnderlineLabelFont. */
@property(class, nonatomic, null_resettable, strong) UIFont *leadingUnderlineLabelFontDefault;

/**
 The color applied to the leading side underline label when not in error state.

 Default is leadingUnderlineLabelTextColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *leadingUnderlineLabelTextColor;

/** Default value for leadingUnderlineLabelTextColor. */
@property(class, nonatomic, null_resettable, strong) UIColor *leadingUnderlineLabelTextColorDefault;

/*
 Indicates whether the alert contents should automatically update their font when the device's
 UIContentSizeCategory changes.

 This property is modeled after the adjustsFontForContentSizeCategory property in the
 UIConnectSizeCategoryAdjusting protocol added by Apple in iOS 10.0.

 Default is mdc_adjustsFontForContentSizeCategoryDefault.
 */
@property(nonatomic, assign, readwrite, setter=mdc_setAdjustsFontForContentSizeCategory:)
    BOOL mdc_adjustsFontForContentSizeCategory;

/** Default value for mdc_adjustsFontForContentSizeCategory. */
@property(class, nonatomic, assign) BOOL mdc_adjustsFontForContentSizeCategoryDefault;

/**
 Color for decorations that indicates the input is enabled but not currently editing.

 Default is normalColorDefault.
 */
@property(nonatomic, null_resettable, strong) UIColor *normalColor;

/** Default value for normalColor. */
@property(class, nonatomic, null_resettable, strong) UIColor *normalColorDefault;

/** The text displayed in the placeholder label.*/
@property(nonatomic, nullable, copy) NSString *placeholderText;

/**
 The corners to be rounded in the border area.

 Default is roundedCornersDefault.
 */
@property(nonatomic, assign) UIRectCorner roundedCorners;

/** Default for roundedCorners. */
@property(class, nonatomic, assign) UIRectCorner roundedCornersDefault;

/** The text input the controller is affecting. */
@property(nonatomic, nullable, strong) UIView<MDCTextInput> *textInput;

/**
 The font applied to the trailing side underline label.

 Default is trailingUnderlineLabelFontDefault.
 */
@property(nonatomic, null_resettable, strong) UIFont *trailingUnderlineLabelFont;

/** Default value for trailingUnderlineLabelFont. */
@property(class, nonatomic, null_resettable, strong) UIFont *trailingUnderlineLabelFontDefault;
/**
 The color applied to the trailing side underline label when not in error state.

 Default is trailingUnderlineLabelTextColorDefault.
 */
@property(nonatomic, nullable, strong) UIColor *trailingUnderlineLabelTextColor;

/** Default value for trailingUnderlineLabelTextColor. */
@property(class, nonatomic, nullable, strong) UIColor *trailingUnderlineLabelTextColorDefault;

/**
 Height of the underline when text field is first responder.

 Default is underlineHeightActiveDefault.
 */
@property(nonatomic, assign) CGFloat underlineHeightActive;

/** Default value for underlineHeightActive. */
@property(class, nonatomic, assign) CGFloat underlineHeightActiveDefault;

/**
 Height of the underline when NOT first responder.

 Default is underlineHeightNormalDefault.
 */
@property(nonatomic, assign) CGFloat underlineHeightNormal;

/** Default value for underlineHeightNormal. */
@property(class, nonatomic, assign) CGFloat underlineHeightNormalDefault;

/**
 Controls when the underline will be shown.

 The underline is an overlay that can be hidden depending on the editing state of the input text.

 Default is underlineViewModeDefault.
 */
@property(nonatomic, assign) UITextFieldViewMode underlineViewMode;

/** Default value for underlineViewMode. */
@property(class, nonatomic, assign) UITextFieldViewMode underlineViewModeDefault;

/**
 Convenience init. Never fails.

 @param input An MDCTextInput this controller will manage.
 */
- (nonnull instancetype)initWithTextInput:(nullable UIView<MDCTextInput> *)input;

/**
 Sets the state of the controller by setting the values of properties errorText and
 errorAccessibilityValue.

 The value of errorText controls the state of the text input.

 @param errorText               The error text to be shown as underline text. (Copied.)
 @param errorAccessibilityValue Optional override of default underline text accessibility value.
                                (Copied.)

 This method is usually called from whatever object is the UITextFieldDelegate for the MDCTextField.
 That object is responsible for validation of the text and calling this method if the error state
 needs to change.

 When errorText != nil, the text input is in an error state:
 - The error text appears in the underline text with the errorColor as text color.
 - The input rectangle's underline, placeholder and character are colored to the errorColor.

 When errorText == nil, the text input is not in error state:
 - The underline text is restored to the color and value it was.
 - The underline color and height is restored.
 - The placeholder text is restored to the color it was.
 - The character count text is restored to the color it was.

 Setting errorText to an empty string (@"") will put the input in error state but the underline text
 will be empty. It will color (if visible) the underline, the placeholder, and the character
 count in the errorColor.

 Setting errorAccessibilityValue when errorText == nil has no effect.

 Note: The characterCountMax property also affects these same MDCTextInput properties.
 */
- (void)setErrorText:(nullable NSString *)errorText
    errorAccessibilityValue:(nullable NSString *)errorAccessibilityValue;

@end


text:
toreverse = input('Input a string to be reversed: ');

reversed = ''

for i in range(1, len(toreverse) + 1):
    reversed += toreverse[len(toreverse) - i]

print('%s\n' %reversed)