text:
using System;

namespace Azure.ResourceManager.Network.Models
{
    /// <summary> Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. </summary>
    public partial class VirtualNetworkBgpCommunities
    {
        /// <summary> Initializes a new instance of VirtualNetworkBgpCommunities. </summary>
        /// <param name="virtualNetworkCommunity"> The BGP community associated with the virtual network. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="virtualNetworkCommunity"/> is null. </exception>
        public VirtualNetworkBgpCommunities(string virtualNetworkCommunity)
        {
            if (virtualNetworkCommunity == null)
            {
                throw new ArgumentNullException(nameof(virtualNetworkCommunity));
            }

            VirtualNetworkCommunity = virtualNetworkCommunity;
        }

        /// <summary> Initializes a new instance of VirtualNetworkBgpCommunities. </summary>
        /// <param name="virtualNetworkCommunity"> The BGP community associated with the virtual network. </param>
        /// <param name="regionalCommunity"> The BGP community associated with the region of the virtual network. </param>
        internal VirtualNetworkBgpCommunities(string virtualNetworkCommunity, string regionalCommunity)
        {
            VirtualNetworkCommunity = virtualNetworkCommunity;
            RegionalCommunity = regionalCommunity;
        }

        /// <summary> The BGP community associated with the virtual network. </summary>
        public string VirtualNetworkCommunity { get; set; }
        /// <summary> The BGP community associated with the region of the virtual network. </summary>
        public string RegionalCommunity { get; }
    }
}


text:
@interface ALDLabelsViewController ()
@property (nonatomic) ALDAutoHeightLabel *label1;
@property (nonatomic) ALDAutoHeightLabel *label2;
@end

@implementation ALDLabelsViewController

- (void)loadView {
    self.view = [UIView new];
    self.view.backgroundColor = [UIColor colorWithRed:0.8f green:0.9f blue:1.f alpha:1.f];

    [self createSubviews];
    [self addSubviews];
    [self addConstraints];
}

- (void)createSubviews {
    _label1 = [ALDAutoHeightLabel new];
    _label1.text = @"You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out. Now, I don't know exactly when we turned on each other, but I know that seven of us survived the slide... and only five made it out. Now we took an oath, that I'm breaking now. We said we'd say it was the snow that killed the other two, but it wasn't. Nature is lethal but it doesn't hold a candle to man.";

    _label2 = [ALDAutoHeightLabel new];
    _label2.text = @"Do you see any Teletubbies in here? Do you see a slender plastic tag clipped to my shirt with my name printed on it?";
}

- (void)addSubviews {
    [self.view addSubview:_label1];
    [self.view addSubview:_label2];
}

- (void)addConstraints {
    for (UIView *view in @[_label1, _label2]) {
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.view).with.offset(10);
            make.trailing.equalTo(self.view).with.offset(-10);
        }];
    }

    [_label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).with.offset(74);
    }];

    [_label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_label1.mas_bottom).with.offset(10);
    }];
}

@end

redpajama_set_name: RedPajamaGithub


text:
<?php

if (!is_file($loaderFile = __DIR__.'/../../../vendor/autoload.php')) {
    throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}

$loader = require $loaderFile;


text:
layout: post
microblog: true
date: 2017-05-17 05:25 +0300
guid: http://desparoz.micro.blog/2017/05/17/t864668098598768640.html
---
Referring to my last micro post / tweet, I wrote years ago about making vs taking photos [t.co/YJIRXc45X...](https://t.co/YJIRXc45XU)


text:
static CGFloat kLineLayerWidth = 25.0f;
static CGFloat kLineLayerHeight = 3.5f;
static CGFloat kLineLayerVerticalSpacing = 5.0f;

@interface WAMenuButton () {
    CALayer *_firstLineLayer;
    CALayer *_secondLineLayer;
    CALayer *_thirdLineLayer;

    CGColorRef layerBackgroundColor;
}

@end

@implementation WAMenuButton

#pragma mark -
#pragma mark Constructors
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self){
        [self setupLayers];
    }
    return self;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self setupLayers];
    }
    return self;
}

-(void)setupLayers
{
    self.buttonColor = [UIColor whiteColor];
    layerBackgroundColor = self.buttonColor.CGColor;

    _firstLineLayer = [[CALayer alloc] init];
    _firstLineLayer.anchorPoint = CGPointMake(0.0f, 0.5f);
    _firstLineLayer.backgroundColor = layerBackgroundColor; // TODO: Proper color
    [self.layer addSublayer:_firstLineLayer];

    _secondLineLayer = [[CALayer alloc] init];
    _secondLineLayer.backgroundColor = layerBackgroundColor;
    [self.layer addSublayer:_secondLineLayer];

    _thirdLineLayer = [[CALayer alloc] init];
    _thirdLineLayer.anchorPoint = CGPointMake(0.0f, 0.5f);
    _thirdLineLayer.backgroundColor = layerBackgroundColor;
    [self.layer addSublayer:_thirdLineLayer];
}

#pragma mark -
#pragma mark Setters

- (void)setButtonState:(WAMenuButtonState)buttonState {
    [self setButtonState:buttonState animated:NO];
}

- (void)setButtonState:(WAMenuButtonState)buttonState animated:(BOOL)animated {
    if (_buttonState == buttonState) {
        return;
    }

    _buttonState = buttonState;

    __block void(^interfaceUpdates)();

    if (buttonState == WAMenuButtonStateBurger) {
        interfaceUpdates = ^() {
            _firstLineLayer.transform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(0.0f), 0.0f, 0.0f, 1.0f);
            _secondLineLayer.opacity = 1.0f;
            _thirdLineLayer.transform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(0.0f), 0.0f, 0.0f, 1.0f);
        };
    } else if (buttonState == WAMenuButtonStateCross) {
        interfaceUpdates = ^() {
            _firstLineLayer.position = CGPointMake(_firstLineLayer.position.x + 4.0f, _firstLineLayer.position.y);
            _thirdLineLayer.position = CGPointMake(_thirdLineLayer.position.x + 4.0f, _thirdLineLayer.position.y + 0.5f);

            _firstLineLayer.transform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(45.0f), 0.0f, 0.0f, 1.0f);
            _secondLineLayer.opacity = 0.0f;
            _thirdLineLayer.transform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(-45.0f), 0.0f, 0.0f, 1.0f);
        };
    }

    if (animated) {
        interfaceUpdates();
    } else {
        [CATransaction begin];
        [CATransaction setValue:(__bridge id)kCFBooleanTrue forKey:kCATransactionDisableActions];
        interfaceUpdates();
        [CATransaction commit];
    }
}

#pragma mark -
#pragma mark Layout

- (void)layoutSubviews {
    [super layoutSubviews];

    CGFloat lineLayerX = floorf((self.bounds.size.width - kLineLayerWidth) / 2.0f);
    CGFloat lineLayerY = floorf((self.bounds.size.height - kLineLayerHeight * 3.0f - kLineLayerVerticalSpacing * 2.0f) / 2.0f);

    if (_buttonState == WAMenuButtonStateBurger) {
        _firstLineLayer.frame = CGRectMake(lineLayerX, lineLayerY, kLineLayerWidth, kLineLayerHeight);
        _secondLineLayer.frame = CGRectOffset(_firstLineLayer.frame, 0.0f, kLineLayerHeight + kLineLayerVerticalSpacing);
        _thirdLineLayer.frame = CGRectOffset(_firstLineLayer.frame, 0.0f, kLineLayerHeight * 2.0f + kLineLayerVerticalSpacing * 2.0f);
    }
}

@end


text:
/******************************************************************************
  This source file is part of the Avogadro project.
  This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/

#include "curvegeometry.h"

#include "camera.h"
#include "scene.h"
#include "visitor.h"

namespace {
#include "cylinders_fs.h"
#include "cylinders_vs.h"
} // namespace
#include "avogadrogl.h"

#include <iostream>
#include <queue>
#include <vector>

using std::cout;
using std::endl;

namespace Avogadro::Rendering {

using Core::Array;

const size_t CurveGeometry::SKIPPED = 1;

CurveGeometry::CurveGeometry() : m_dirty(true), m_canBeFlat(true)
{
  setRenderPass(SolidPass);
}

CurveGeometry::CurveGeometry(bool flat) : m_dirty(true), m_canBeFlat(flat)
{
  setRenderPass(SolidPass);
}

CurveGeometry::~CurveGeometry()
{
  for (auto& l : m_lines) {
    delete l;
  }
}

std::vector<ColorNormalVertex> CurveGeometry::computeCirclePoints(
  const Eigen::Affine3f& a, const Eigen::Affine3f& b, bool flat) const
{
  unsigned int circleResolution = flat ? 1 : 12;
  const float resolutionRadians =
    2.0f * static_cast<float>(M_PI) / static_cast<float>(circleResolution);
  std::vector<ColorNormalVertex> result;

  for (unsigned int i = 0; i < circleResolution; ++i) {
    float theta = i * resolutionRadians;
    Vector3f circle = Vector3f(std::cos(theta), 0.0f, std::sin(theta));
    ColorNormalVertex vert1;
    vert1.normal = a.linear() * circle;
    vert1.vertex = a * circle;
    vert1.color = Vector3ub(0, 0, 0);
    result.push_back(vert1);

    ColorNormalVertex vert2;
    vert2.normal = b.linear() * circle;
    vert2.vertex = b * circle;
    vert2.color = Vector3ub(0, 0, 0);
    result.push_back(vert2);
  }
  return result;
}

float CurveGeometry::computeScale(size_t, float, float scale) const
{
  return scale;
}

void CurveGeometry::update(int index)
{
  // compute the middle points
  Line* line = m_lines[index];
  unsigned int lineResolution = line->flat ? 20 : 15;
  size_t qttyPoints = line->points.size();

  const size_t qttySegments = lineResolution * qttyPoints;
  Vector3f previous;
  std::vector<Eigen::Affine3f> points;
  size_t top = qttyPoints <= 4 ? 0 : line->points.size() - 4;
  auto it = line->points.begin();
  for (size_t i = SKIPPED; i < top; ++i) {
    for (size_t j = 0; j < lineResolution; ++j) {
      float t = (i * lineResolution + j) / float(qttySegments);
      auto p = computeCurvePoint(t, line->points);
      if (i > SKIPPED) {
        Eigen::Matrix3f m;
        m.col(1) = (p - previous).normalized();
        m.col(0) = m.col(1).unitOrthogonal() * -1.0f;
        if (i > SKIPPED + 1) {
          const auto& previousAngle = points.back().linear().col(0);
          float angle = previousAngle.dot(m.col(0));
          // avoid nans
          if (std::isnan(angle)) {
            m.col(0) = previousAngle;
            break;
            // if angle > 90 flip it
          } else if (angle <= 0.0f) {
            m.col(0) *= -1.0f;
          }
          angle = previousAngle.dot(m.col(0));
          float degrees =
            (std::acos(angle / (m.col(0).norm() * previousAngle.norm())) *
             RAD_TO_DEG_F);
          // if angle is > 25º get the bisector
          while (degrees > 25.0f) {
            m.col(0) = (m.col(0) + previousAngle).normalized();
            angle = previousAngle.dot(m.col(0));
            degrees =
              (std::acos(angle / (m.col(0).norm() * previousAngle.norm())) *
               RAD_TO_DEG_F);
          }
        }
        m.col(2) = m.col(0).cross(m.col(1)) * -1.0f;
        Eigen::Affine3f affine;
        affine.translation() = p;
        affine.linear() = m;
        float r = !m_canBeFlat || !line->flat
                    ? computeScale(i, j / static_cast<float>(lineResolution),
                                   line->radius)
                    : 0.01f;
        affine.scale(r);
        points.push_back(affine);
      }
      previous = p;
    }
    ++it;
  }

  // prepare VBO and EBO
  std::vector<unsigned int> indices;
  std::vector<ColorNormalVertex> vertices;

  it = line->points.begin();
  if (line->points.size() > 3) {
    it = std::next(it, 3);
  }
  for (size_t i = 1; i < points.size(); ++i) {
    if (i % lineResolution == 0) {
      ++it;
    }
    std::vector<ColorNormalVertex> radials =
      computeCirclePoints(points[i], points[i - 1], line->flat);
    for (auto r : radials) {
      r.color = (*it)->color;
      vertices.push_back(r);
    }
    const auto tubeStart = static_cast<unsigned int>(
      vertices.size() - (line->flat && m_canBeFlat ? radials.size() : 0));
    for (unsigned int j = 0; j < radials.size() / 2; ++j) {
      unsigned int r1 = j + j;
      unsigned int r2 = (j != 0 ? r1 : radials.size()) - 2;
      indices.push_back(tubeStart + r1);
      indices.push_back(tubeStart + r1 + 1);
      indices.push_back(tubeStart + r2);

      indices.push_back(tubeStart + r2);
      indices.push_back(tubeStart + r1 + 1);
      indices.push_back(tubeStart + r2 + 1);
    }
  }

  line->vbo.upload(vertices, BufferObject::ArrayBuffer);
  line->ibo.upload(indices, BufferObject::ElementArrayBuffer);
  line->numberOfVertices = vertices.size();
  line->numberOfIndices = indices.size();

  line->dirty = false;
}

void CurveGeometry::accept(Visitor& visitor)
{
  visitor.visit(*this);
}

void checkShaderInfo(ShaderInfo& shaderInfo, const std::string& fs,
                     const std::string& vs)
{
  if (shaderInfo.vertexShader.type() == Shader::Unknown) {
    shaderInfo.vertexShader.setType(Shader::Vertex);
    shaderInfo.vertexShader.setSource(vs);
    shaderInfo.fragmentShader.setType(Shader::Fragment);
    shaderInfo.fragmentShader.setSource(fs);
    if (!shaderInfo.vertexShader.compile())
      cout << shaderInfo.vertexShader.error() << endl;
    if (!shaderInfo.fragmentShader.compile())
      cout << shaderInfo.fragmentShader.error() << endl;
    shaderInfo.program.attachShader(shaderInfo.vertexShader);
    shaderInfo.program.attachShader(shaderInfo.fragmentShader);
    if (!shaderInfo.program.link())
      cout << shaderInfo.program.error() << endl;
  }
}

void CurveGeometry::processShaderError(bool error)
{
  if (error) {
    cout << m_shaderInfo.program.error() << endl;
  }
}

void CurveGeometry::render(const Camera& camera)
{
  if (m_dirty) {
    checkShaderInfo(m_shaderInfo, cylinders_fs, cylinders_vs);
    m_dirty = false;
  }
  if (!m_dirty) {
    processShaderError(!m_shaderInfo.program.bind());
    processShaderError(!m_shaderInfo.program.setUniformValue(
      "modelView", camera.modelView().matrix()));
    processShaderError(!m_shaderInfo.program.setUniformValue(
      "projection", camera.projection().matrix()));
    Eigen::Matrix3f normalMatrix =
      camera.modelView().linear().inverse().transpose();
    processShaderError(
      !m_shaderInfo.program.setUniformValue("normalMatrix", normalMatrix));

    for (size_t i = 0; i < m_lines.size(); ++i) {
      Line* line = m_lines[i];
      if (line->dirty) {
        update(i);
      }

      line->vbo.bind();
      line->ibo.bind();

      processShaderError(!m_shaderInfo.program.enableAttributeArray("vertex"));
      processShaderError(!m_shaderInfo.program.useAttributeArray(
        "vertex", ColorNormalVertex::vertexOffset(), sizeof(ColorNormalVertex),
        FloatType, 3, ShaderProgram::NoNormalize));

      processShaderError(!m_shaderInfo.program.enableAttributeArray("color"));
      processShaderError(!m_shaderInfo.program.useAttributeArray(
        "color", ColorNormalVertex::colorOffset(), sizeof(ColorNormalVertex),
        UCharType, 3, ShaderProgram::Normalize));

      processShaderError(!m_shaderInfo.program.enableAttributeArray("normal"));
      processShaderError(!m_shaderInfo.program.useAttributeArray(
        "normal", ColorNormalVertex::normalOffset(), sizeof(ColorNormalVertex),
        FloatType, 3, ShaderProgram::NoNormalize));
      if (line->flat && m_canBeFlat) {
        glLineWidth(-line->radius);
      }
      glDrawRangeElements(line->flat && m_canBeFlat ? GL_LINE_STRIP
                                                    : GL_TRIANGLES,
                          0, static_cast<GLuint>(line->numberOfVertices),
                          static_cast<GLsizei>(line->numberOfIndices),
                          GL_UNSIGNED_INT, reinterpret_cast<const GLvoid*>(0));
      line->vbo.release();
      line->ibo.release();
      m_shaderInfo.program.disableAttributeArray("vector");
      m_shaderInfo.program.disableAttributeArray("color");
      m_shaderInfo.program.disableAttributeArray("normal");
    }
    m_shaderInfo.program.release();
  }
}

void CurveGeometry::addPoint(const Vector3f& pos, const Vector3ub& color,
                             float radius, size_t group, size_t id)
{
  if (m_indexMap.find(group) == m_indexMap.end()) {
    m_indexMap[group] = m_lines.size();
    m_lines.push_back(new Line(radius));
  }
  m_lines[m_indexMap[group]]->radius = radius;
  m_lines[m_indexMap[group]]->flat = radius < 0.0f;
  m_lines[m_indexMap[group]]->add(new Point(pos, color, id));
}

Array<Identifier> CurveGeometry::areaHits(const Frustrum& f) const
{
  Array<Identifier> result;
  // Check for intersection.
  for (const auto& line : m_lines) {
    size_t skip = 0;
    std::queue<size_t> previous;
    for (const auto& point : line->points) {
      previous.push(point->id);
      if (skip < 2) {
        ++skip;
        continue;
      }
      int in = 0;
      for (; in < 4; ++in) {
        float dist = (point->pos - f.points[2 * in]).dot(f.planes[in]);
        if (dist > 0.0f) {
          // Outside of our frustrum, break.
          break;
        }
      }
      if (in == 4) {
        // The center is within the four planes that make our frustrum - hit.
        Identifier id;
        id.molecule = m_identifier.molecule;
        id.type = m_identifier.type;
        id.index = previous.front();
        result.push_back(id);
      }
      previous.pop();
    }
  }
  return result;
}

} // namespace Avogadro


text:
from django import forms
from django.contrib.auth.models import User

class TemplateReprForm(forms.Form):
    user = forms.ModelChoiceField(queryset=User.objects.all())

    def __repr__(self):
        return repr(self)


text:
class CudaMem : public EventEmitter {
public:
  static Persistent<FunctionTemplate> constructor_template;
  static void Initialize (Handle<Object> target);
  static Handle<Value> New(const Arguments& args);
  static Handle<Value> alloc(const Arguments& args);
  static Handle<Value> allocPitch(const Arguments& args);
  static Handle<Value> free(const Arguments& args);

  CUdeviceptr m_devicePtr;
protected:
  CudaMem () : EventEmitter () {
    m_devicePtr = 0;
  }
  ~CudaMem (){}
};

#endif


text:
!STARTOFREGISTRYGENERATEDFILE 'IfW_FFWind_Base_Types.f90'
!
! WARNING This file is generated automatically by the FAST registry.
! Do not edit.  Your changes to this file will be lost.
!
! FAST Registry
!*********************************************************************************************************************************
! IfW_FFWind_Base_Types
!.................................................................................................................................
! This file is part of IfW_FFWind_Base.
!
! Copyright (C) 2012-2016 National Renewable Energy Laboratory
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
! You may obtain a copy of the License at
!
!     http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing, software
! distributed under the License is distributed on an "AS IS" BASIS,
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and
! limitations under the License.
!
!
! W A R N I N G : This file was automatically generated from the FAST registry.  Changes made to this file may be lost.
!
!*********************************************************************************************************************************
!> This module contains the user-defined types needed in IfW_FFWind_Base. It also contains copy, destroy, pack, and
!! unpack routines associated with each defined data type. This code is automatically generated by the FAST Registry.
MODULE IfW_FFWind_Base_Types
!---------------------------------------------------------------------------------------------------------------------------------
USE NWTC_Library
IMPLICIT NONE
! =========  IfW_FFWind_InitInputType  =======
  TYPE, PUBLIC :: IfW_FFWind_InitInputType
    INTEGER(IntKi)  :: ScaleMethod = 0      !< Turbulence scaling method [0=none, 1=direct scaling, 2= calculate scaling factor based on a desired standard deviation] [-]
    REAL(ReKi) , DIMENSION(1:3)  :: SF      !< Turbulence scaling factor for each direction [ScaleMethod=1] [-]
    REAL(ReKi) , DIMENSION(1:3)  :: SigmaF      !< Turbulence standard deviation to calculate scaling from in each direction [ScaleMethod=2] [-]
    INTEGER(IntKi)  :: WindProfileType = -1      !< Wind profile type (0=constant;1=logarithmic;2=power law) [-]
    REAL(ReKi)  :: RefHt = 0      !< Reference (hub) height of the grid [meters]
    REAL(ReKi)  :: URef = 0      !< Mean u-component wind speed at the reference height [meters]
    REAL(ReKi)  :: PLExp = 0      !< Power law exponent (used for PL wind profile type only) [-]
    REAL(ReKi)  :: Z0 = 0      !< Surface roughness length (used for LOG wind profile type only) [-]
    REAL(ReKi)  :: XOffset = 0      !< distance offset for FF wind files [m]
  END TYPE IfW_FFWind_InitInputType
! =======================
! =========  IfW_FFWind_ParameterType  =======
  TYPE, PUBLIC :: IfW_FFWind_ParameterType
    LOGICAL  :: Periodic = .FALSE.      !< Flag to indicate if the wind file is periodic [-]
    LOGICAL  :: InterpTower = .FALSE.      !< Flag to indicate if we should interpolate wind speeds below the tower [-]
    REAL(SiKi) , DIMENSION(:,:,:,:), ALLOCATABLE  :: FFData      !< Array of FF data [-]
    REAL(SiKi) , DIMENSION(:,:,:), ALLOCATABLE  :: FFTower      !< Array of data along tower, below FF array [-]
    REAL(ReKi)  :: FFDTime = 0      !< Delta time [seconds]
    REAL(ReKi)  :: FFRate = 0      !< Data rate (1/FFDTime) [Hertz]
    REAL(ReKi)  :: FFYHWid = 0      !< Half the grid width [meters]
    REAL(ReKi)  :: FFZHWid = 0      !< Half the grid height [meters]
    REAL(ReKi)  :: RefHt = 0      !< Reference (hub) height of the grid [meters]
    REAL(ReKi)  :: GridBase = 0      !< the height of the bottom of the grid [meters]
    REAL(ReKi)  :: InitXPosition = 0      !< the initial x position of grid (distance in FF is offset) [meters]
    REAL(ReKi)  :: InvFFYD = 0      !< reciprocal of delta y [1/meters]
    REAL(ReKi)  :: InvFFZD = 0      !< reciprocal of delta z [1/meters]
    REAL(ReKi)  :: InvMFFWS = 0      !< reciprocal of mean wind speed (MeanFFWS) [seconds/meter]
    REAL(ReKi)  :: MeanFFWS = 0      !< Mean wind speed (as defined in FF file), not necessarily of the portion used [meters/second]
    REAL(ReKi)  :: TotalTime = 0      !< The total time of the simulation [seconds]
    INTEGER(IntKi)  :: NFFComp = 3      !< Number of wind components [-]
    INTEGER(IntKi)  :: NFFSteps = 0      !< Number of time steps in the FF array [-]
    INTEGER(IntKi)  :: NYGrids = 0      !< Number of points in the lateral (y) direction of the grids [-]
    INTEGER(IntKi)  :: NZGrids = 0      !< Number of points in the vertical (z) direction of the grids [-]
    INTEGER(IntKi)  :: NTGrids = 0      !< Number of points in the vertical (z) direction on the tower (below the grids) [-]
    INTEGER(IntKi)  :: WindFileFormat      !< Binary file format description number [-]
    LOGICAL  :: AddMeanAfterInterp = .FALSE.      !< Add the mean wind speed after interpolating at a given height? [-]
    INTEGER(IntKi)  :: WindProfileType = -1      !< Wind profile type (0=constant;1=logarithmic;2=power law) [-]
    REAL(ReKi)  :: PLExp = 0      !< Power law exponent (used for PL wind profile type only) [-]
    REAL(ReKi)  :: Z0 = 0      !< Surface roughness length (used for LOG wind profile type only) [-]
  END TYPE IfW_FFWind_ParameterType
! =======================
CONTAINS
 SUBROUTINE IfW_FFWind_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg )
   TYPE(IfW_FFWind_InitInputType), INTENT(IN) :: SrcInitInputData
   TYPE(IfW_FFWind_InitInputType), INTENT(INOUT) :: DstInitInputData
   INTEGER(IntKi),  INTENT(IN   ) :: CtrlCode
   INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
   CHARACTER(*),    INTENT(  OUT) :: ErrMsg
! Local
   INTEGER(IntKi)                 :: i,j,k
   INTEGER(IntKi)                 :: i1, i1_l, i1_u  !  bounds (upper/lower) for an array dimension 1
   INTEGER(IntKi)                 :: i2, i2_l, i2_u  !  bounds (upper/lower) for an array dimension 2
   INTEGER(IntKi)                 :: i3, i3_l, i3_u  !  bounds (upper/lower) for an array dimension 3
   INTEGER(IntKi)                 :: i4, i4_l, i4_u  !  bounds (upper/lower) for an array dimension 4
   INTEGER(IntKi)                 :: ErrStat2
   CHARACTER(ErrMsgLen)           :: ErrMsg2
   CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_CopyInitInput'
!
   ErrStat = ErrID_None
   ErrMsg  = ""
    DstInitInputData%ScaleMethod = SrcInitInputData%ScaleMethod
    DstInitInputData%SF = SrcInitInputData%SF
    DstInitInputData%SigmaF = SrcInitInputData%SigmaF
    DstInitInputData%WindProfileType = SrcInitInputData%WindProfileType
    DstInitInputData%RefHt = SrcInitInputData%RefHt
    DstInitInputData%URef = SrcInitInputData%URef
    DstInitInputData%PLExp = SrcInitInputData%PLExp
    DstInitInputData%Z0 = SrcInitInputData%Z0
    DstInitInputData%XOffset = SrcInitInputData%XOffset
 END SUBROUTINE IfW_FFWind_CopyInitInput

 SUBROUTINE IfW_FFWind_DestroyInitInput( InitInputData, ErrStat, ErrMsg )
  TYPE(IfW_FFWind_InitInputType), INTENT(INOUT) :: InitInputData
  INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
  CHARACTER(*),    INTENT(  OUT) :: ErrMsg
  CHARACTER(*),    PARAMETER :: RoutineName = 'IfW_FFWind_DestroyInitInput'
  INTEGER(IntKi)                 :: i, i1, i2, i3, i4, i5
!
  ErrStat = ErrID_None
  ErrMsg  = ""
 END SUBROUTINE IfW_FFWind_DestroyInitInput

 SUBROUTINE IfW_FFWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly )
  REAL(ReKi),       ALLOCATABLE, INTENT(  OUT) :: ReKiBuf(:)
  REAL(DbKi),       ALLOCATABLE, INTENT(  OUT) :: DbKiBuf(:)
  INTEGER(IntKi),   ALLOCATABLE, INTENT(  OUT) :: IntKiBuf(:)
  TYPE(IfW_FFWind_InitInputType),  INTENT(IN) :: InData
  INTEGER(IntKi),   INTENT(  OUT) :: ErrStat
  CHARACTER(*),     INTENT(  OUT) :: ErrMsg
  LOGICAL,OPTIONAL, INTENT(IN   ) :: SizeOnly
    ! Local variables
  INTEGER(IntKi)                 :: Re_BufSz
  INTEGER(IntKi)                 :: Re_Xferred
  INTEGER(IntKi)                 :: Db_BufSz
  INTEGER(IntKi)                 :: Db_Xferred
  INTEGER(IntKi)                 :: Int_BufSz
  INTEGER(IntKi)                 :: Int_Xferred
  INTEGER(IntKi)                 :: i,i1,i2,i3,i4,i5
  LOGICAL                        :: OnlySize ! if present and true, do not pack, just allocate buffers
  INTEGER(IntKi)                 :: ErrStat2
  CHARACTER(ErrMsgLen)           :: ErrMsg2
  CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_PackInitInput'
 ! buffers to store subtypes, if any
  REAL(ReKi),      ALLOCATABLE   :: Re_Buf(:)
  REAL(DbKi),      ALLOCATABLE   :: Db_Buf(:)
  INTEGER(IntKi),  ALLOCATABLE   :: Int_Buf(:)

  OnlySize = .FALSE.
  IF ( PRESENT(SizeOnly) ) THEN
    OnlySize = SizeOnly
  ENDIF
    !
  ErrStat = ErrID_None
  ErrMsg  = ""
  Re_BufSz  = 0
  Db_BufSz  = 0
  Int_BufSz  = 0
      Int_BufSz  = Int_BufSz  + 1  ! ScaleMethod
      Re_BufSz   = Re_BufSz   + SIZE(InData%SF)  ! SF
      Re_BufSz   = Re_BufSz   + SIZE(InData%SigmaF)  ! SigmaF
      Int_BufSz  = Int_BufSz  + 1  ! WindProfileType
      Re_BufSz   = Re_BufSz   + 1  ! RefHt
      Re_BufSz   = Re_BufSz   + 1  ! URef
      Re_BufSz   = Re_BufSz   + 1  ! PLExp
      Re_BufSz   = Re_BufSz   + 1  ! Z0
      Re_BufSz   = Re_BufSz   + 1  ! XOffset
  IF ( Re_BufSz  .GT. 0 ) THEN
     ALLOCATE( ReKiBuf(  Re_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF ( Db_BufSz  .GT. 0 ) THEN
     ALLOCATE( DbKiBuf(  Db_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF ( Int_BufSz  .GT. 0 ) THEN
     ALLOCATE( IntKiBuf(  Int_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them)

  Re_Xferred  = 1
  Db_Xferred  = 1
  Int_Xferred = 1

    IntKiBuf(Int_Xferred) = InData%ScaleMethod
    Int_Xferred = Int_Xferred + 1
    DO i1 = LBOUND(InData%SF,1), UBOUND(InData%SF,1)
      ReKiBuf(Re_Xferred) = InData%SF(i1)
      Re_Xferred = Re_Xferred + 1
    END DO
    DO i1 = LBOUND(InData%SigmaF,1), UBOUND(InData%SigmaF,1)
      ReKiBuf(Re_Xferred) = InData%SigmaF(i1)
      Re_Xferred = Re_Xferred + 1
    END DO
    IntKiBuf(Int_Xferred) = InData%WindProfileType
    Int_Xferred = Int_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%RefHt
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%URef
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%PLExp
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%Z0
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%XOffset
    Re_Xferred = Re_Xferred + 1
 END SUBROUTINE IfW_FFWind_PackInitInput

 SUBROUTINE IfW_FFWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg )
  REAL(ReKi),      ALLOCATABLE, INTENT(IN   ) :: ReKiBuf(:)
  REAL(DbKi),      ALLOCATABLE, INTENT(IN   ) :: DbKiBuf(:)
  INTEGER(IntKi),  ALLOCATABLE, INTENT(IN   ) :: IntKiBuf(:)
  TYPE(IfW_FFWind_InitInputType), INTENT(INOUT) :: OutData
  INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
  CHARACTER(*),    INTENT(  OUT) :: ErrMsg
    ! Local variables
  INTEGER(IntKi)                 :: Buf_size
  INTEGER(IntKi)                 :: Re_Xferred
  INTEGER(IntKi)                 :: Db_Xferred
  INTEGER(IntKi)                 :: Int_Xferred
  INTEGER(IntKi)                 :: i
  INTEGER(IntKi)                 :: i1, i1_l, i1_u  !  bounds (upper/lower) for an array dimension 1
  INTEGER(IntKi)                 :: i2, i2_l, i2_u  !  bounds (upper/lower) for an array dimension 2
  INTEGER(IntKi)                 :: i3, i3_l, i3_u  !  bounds (upper/lower) for an array dimension 3
  INTEGER(IntKi)                 :: i4, i4_l, i4_u  !  bounds (upper/lower) for an array dimension 4
  INTEGER(IntKi)                 :: ErrStat2
  CHARACTER(ErrMsgLen)           :: ErrMsg2
  CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_UnPackInitInput'
 ! buffers to store meshes, if any
  REAL(ReKi),      ALLOCATABLE   :: Re_Buf(:)
  REAL(DbKi),      ALLOCATABLE   :: Db_Buf(:)
  INTEGER(IntKi),  ALLOCATABLE   :: Int_Buf(:)
    !
  ErrStat = ErrID_None
  ErrMsg  = ""
  Re_Xferred  = 1
  Db_Xferred  = 1
  Int_Xferred  = 1
    OutData%ScaleMethod = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    i1_l = LBOUND(OutData%SF,1)
    i1_u = UBOUND(OutData%SF,1)
    DO i1 = LBOUND(OutData%SF,1), UBOUND(OutData%SF,1)
      OutData%SF(i1) = ReKiBuf(Re_Xferred)
      Re_Xferred = Re_Xferred + 1
    END DO
    i1_l = LBOUND(OutData%SigmaF,1)
    i1_u = UBOUND(OutData%SigmaF,1)
    DO i1 = LBOUND(OutData%SigmaF,1), UBOUND(OutData%SigmaF,1)
      OutData%SigmaF(i1) = ReKiBuf(Re_Xferred)
      Re_Xferred = Re_Xferred + 1
    END DO
    OutData%WindProfileType = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%RefHt = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%URef = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%PLExp = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%Z0 = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%XOffset = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
 END SUBROUTINE IfW_FFWind_UnPackInitInput

 SUBROUTINE IfW_FFWind_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg )
   TYPE(IfW_FFWind_ParameterType), INTENT(IN) :: SrcParamData
   TYPE(IfW_FFWind_ParameterType), INTENT(INOUT) :: DstParamData
   INTEGER(IntKi),  INTENT(IN   ) :: CtrlCode
   INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
   CHARACTER(*),    INTENT(  OUT) :: ErrMsg
! Local
   INTEGER(IntKi)                 :: i,j,k
   INTEGER(IntKi)                 :: i1, i1_l, i1_u  !  bounds (upper/lower) for an array dimension 1
   INTEGER(IntKi)                 :: i2, i2_l, i2_u  !  bounds (upper/lower) for an array dimension 2
   INTEGER(IntKi)                 :: i3, i3_l, i3_u  !  bounds (upper/lower) for an array dimension 3
   INTEGER(IntKi)                 :: i4, i4_l, i4_u  !  bounds (upper/lower) for an array dimension 4
   INTEGER(IntKi)                 :: ErrStat2
   CHARACTER(ErrMsgLen)           :: ErrMsg2
   CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_CopyParam'
!
   ErrStat = ErrID_None
   ErrMsg  = ""
    DstParamData%Periodic = SrcParamData%Periodic
    DstParamData%InterpTower = SrcParamData%InterpTower
IF (ALLOCATED(SrcParamData%FFData)) THEN
  i1_l = LBOUND(SrcParamData%FFData,1)
  i1_u = UBOUND(SrcParamData%FFData,1)
  i2_l = LBOUND(SrcParamData%FFData,2)
  i2_u = UBOUND(SrcParamData%FFData,2)
  i3_l = LBOUND(SrcParamData%FFData,3)
  i3_u = UBOUND(SrcParamData%FFData,3)
  i4_l = LBOUND(SrcParamData%FFData,4)
  i4_u = UBOUND(SrcParamData%FFData,4)
  IF (.NOT. ALLOCATED(DstParamData%FFData)) THEN
    ALLOCATE(DstParamData%FFData(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2)
    IF (ErrStat2 /= 0) THEN
      CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%FFData.', ErrStat, ErrMsg,RoutineName)
      RETURN
    END IF
  END IF
    DstParamData%FFData = SrcParamData%FFData
ENDIF
IF (ALLOCATED(SrcParamData%FFTower)) THEN
  i1_l = LBOUND(SrcParamData%FFTower,1)
  i1_u = UBOUND(SrcParamData%FFTower,1)
  i2_l = LBOUND(SrcParamData%FFTower,2)
  i2_u = UBOUND(SrcParamData%FFTower,2)
  i3_l = LBOUND(SrcParamData%FFTower,3)
  i3_u = UBOUND(SrcParamData%FFTower,3)
  IF (.NOT. ALLOCATED(DstParamData%FFTower)) THEN
    ALLOCATE(DstParamData%FFTower(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2)
    IF (ErrStat2 /= 0) THEN
      CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%FFTower.', ErrStat, ErrMsg,RoutineName)
      RETURN
    END IF
  END IF
    DstParamData%FFTower = SrcParamData%FFTower
ENDIF
    DstParamData%FFDTime = SrcParamData%FFDTime
    DstParamData%FFRate = SrcParamData%FFRate
    DstParamData%FFYHWid = SrcParamData%FFYHWid
    DstParamData%FFZHWid = SrcParamData%FFZHWid
    DstParamData%RefHt = SrcParamData%RefHt
    DstParamData%GridBase = SrcParamData%GridBase
    DstParamData%InitXPosition = SrcParamData%InitXPosition
    DstParamData%InvFFYD = SrcParamData%InvFFYD
    DstParamData%InvFFZD = SrcParamData%InvFFZD
    DstParamData%InvMFFWS = SrcParamData%InvMFFWS
    DstParamData%MeanFFWS = SrcParamData%MeanFFWS
    DstParamData%TotalTime = SrcParamData%TotalTime
    DstParamData%NFFComp = SrcParamData%NFFComp
    DstParamData%NFFSteps = SrcParamData%NFFSteps
    DstParamData%NYGrids = SrcParamData%NYGrids
    DstParamData%NZGrids = SrcParamData%NZGrids
    DstParamData%NTGrids = SrcParamData%NTGrids
    DstParamData%WindFileFormat = SrcParamData%WindFileFormat
    DstParamData%AddMeanAfterInterp = SrcParamData%AddMeanAfterInterp
    DstParamData%WindProfileType = SrcParamData%WindProfileType
    DstParamData%PLExp = SrcParamData%PLExp
    DstParamData%Z0 = SrcParamData%Z0
 END SUBROUTINE IfW_FFWind_CopyParam

 SUBROUTINE IfW_FFWind_DestroyParam( ParamData, ErrStat, ErrMsg )
  TYPE(IfW_FFWind_ParameterType), INTENT(INOUT) :: ParamData
  INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
  CHARACTER(*),    INTENT(  OUT) :: ErrMsg
  CHARACTER(*),    PARAMETER :: RoutineName = 'IfW_FFWind_DestroyParam'
  INTEGER(IntKi)                 :: i, i1, i2, i3, i4, i5
!
  ErrStat = ErrID_None
  ErrMsg  = ""
IF (ALLOCATED(ParamData%FFData)) THEN
  DEALLOCATE(ParamData%FFData)
ENDIF
IF (ALLOCATED(ParamData%FFTower)) THEN
  DEALLOCATE(ParamData%FFTower)
ENDIF
 END SUBROUTINE IfW_FFWind_DestroyParam

 SUBROUTINE IfW_FFWind_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly )
  REAL(ReKi),       ALLOCATABLE, INTENT(  OUT) :: ReKiBuf(:)
  REAL(DbKi),       ALLOCATABLE, INTENT(  OUT) :: DbKiBuf(:)
  INTEGER(IntKi),   ALLOCATABLE, INTENT(  OUT) :: IntKiBuf(:)
  TYPE(IfW_FFWind_ParameterType),  INTENT(IN) :: InData
  INTEGER(IntKi),   INTENT(  OUT) :: ErrStat
  CHARACTER(*),     INTENT(  OUT) :: ErrMsg
  LOGICAL,OPTIONAL, INTENT(IN   ) :: SizeOnly
    ! Local variables
  INTEGER(IntKi)                 :: Re_BufSz
  INTEGER(IntKi)                 :: Re_Xferred
  INTEGER(IntKi)                 :: Db_BufSz
  INTEGER(IntKi)                 :: Db_Xferred
  INTEGER(IntKi)                 :: Int_BufSz
  INTEGER(IntKi)                 :: Int_Xferred
  INTEGER(IntKi)                 :: i,i1,i2,i3,i4,i5
  LOGICAL                        :: OnlySize ! if present and true, do not pack, just allocate buffers
  INTEGER(IntKi)                 :: ErrStat2
  CHARACTER(ErrMsgLen)           :: ErrMsg2
  CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_PackParam'
 ! buffers to store subtypes, if any
  REAL(ReKi),      ALLOCATABLE   :: Re_Buf(:)
  REAL(DbKi),      ALLOCATABLE   :: Db_Buf(:)
  INTEGER(IntKi),  ALLOCATABLE   :: Int_Buf(:)

  OnlySize = .FALSE.
  IF ( PRESENT(SizeOnly) ) THEN
    OnlySize = SizeOnly
  ENDIF
    !
  ErrStat = ErrID_None
  ErrMsg  = ""
  Re_BufSz  = 0
  Db_BufSz  = 0
  Int_BufSz  = 0
      Int_BufSz  = Int_BufSz  + 1  ! Periodic
      Int_BufSz  = Int_BufSz  + 1  ! InterpTower
  Int_BufSz   = Int_BufSz   + 1     ! FFData allocated yes/no
  IF ( ALLOCATED(InData%FFData) ) THEN
    Int_BufSz   = Int_BufSz   + 2*4  ! FFData upper/lower bounds for each dimension
      Re_BufSz   = Re_BufSz   + SIZE(InData%FFData)  ! FFData
  END IF
  Int_BufSz   = Int_BufSz   + 1     ! FFTower allocated yes/no
  IF ( ALLOCATED(InData%FFTower) ) THEN
    Int_BufSz   = Int_BufSz   + 2*3  ! FFTower upper/lower bounds for each dimension
      Re_BufSz   = Re_BufSz   + SIZE(InData%FFTower)  ! FFTower
  END IF
      Re_BufSz   = Re_BufSz   + 1  ! FFDTime
      Re_BufSz   = Re_BufSz   + 1  ! FFRate
      Re_BufSz   = Re_BufSz   + 1  ! FFYHWid
      Re_BufSz   = Re_BufSz   + 1  ! FFZHWid
      Re_BufSz   = Re_BufSz   + 1  ! RefHt
      Re_BufSz   = Re_BufSz   + 1  ! GridBase
      Re_BufSz   = Re_BufSz   + 1  ! InitXPosition
      Re_BufSz   = Re_BufSz   + 1  ! InvFFYD
      Re_BufSz   = Re_BufSz   + 1  ! InvFFZD
      Re_BufSz   = Re_BufSz   + 1  ! InvMFFWS
      Re_BufSz   = Re_BufSz   + 1  ! MeanFFWS
      Re_BufSz   = Re_BufSz   + 1  ! TotalTime
      Int_BufSz  = Int_BufSz  + 1  ! NFFComp
      Int_BufSz  = Int_BufSz  + 1  ! NFFSteps
      Int_BufSz  = Int_BufSz  + 1  ! NYGrids
      Int_BufSz  = Int_BufSz  + 1  ! NZGrids
      Int_BufSz  = Int_BufSz  + 1  ! NTGrids
      Int_BufSz  = Int_BufSz  + 1  ! WindFileFormat
      Int_BufSz  = Int_BufSz  + 1  ! AddMeanAfterInterp
      Int_BufSz  = Int_BufSz  + 1  ! WindProfileType
      Re_BufSz   = Re_BufSz   + 1  ! PLExp
      Re_BufSz   = Re_BufSz   + 1  ! Z0
  IF ( Re_BufSz  .GT. 0 ) THEN
     ALLOCATE( ReKiBuf(  Re_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF ( Db_BufSz  .GT. 0 ) THEN
     ALLOCATE( DbKiBuf(  Db_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF ( Int_BufSz  .GT. 0 ) THEN
     ALLOCATE( IntKiBuf(  Int_BufSz  ), STAT=ErrStat2 )
     IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName)
       RETURN
     END IF
  END IF
  IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them)

  Re_Xferred  = 1
  Db_Xferred  = 1
  Int_Xferred = 1

    IntKiBuf(Int_Xferred) = TRANSFER(InData%Periodic, IntKiBuf(1))
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = TRANSFER(InData%InterpTower, IntKiBuf(1))
    Int_Xferred = Int_Xferred + 1
  IF ( .NOT. ALLOCATED(InData%FFData) ) THEN
    IntKiBuf( Int_Xferred ) = 0
    Int_Xferred = Int_Xferred + 1
  ELSE
    IntKiBuf( Int_Xferred ) = 1
    Int_Xferred = Int_Xferred + 1
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFData,1)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFData,1)
    Int_Xferred = Int_Xferred + 2
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFData,2)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFData,2)
    Int_Xferred = Int_Xferred + 2
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFData,3)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFData,3)
    Int_Xferred = Int_Xferred + 2
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFData,4)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFData,4)
    Int_Xferred = Int_Xferred + 2

      DO i4 = LBOUND(InData%FFData,4), UBOUND(InData%FFData,4)
        DO i3 = LBOUND(InData%FFData,3), UBOUND(InData%FFData,3)
          DO i2 = LBOUND(InData%FFData,2), UBOUND(InData%FFData,2)
            DO i1 = LBOUND(InData%FFData,1), UBOUND(InData%FFData,1)
              ReKiBuf(Re_Xferred) = InData%FFData(i1,i2,i3,i4)
              Re_Xferred = Re_Xferred + 1
            END DO
          END DO
        END DO
      END DO
  END IF
  IF ( .NOT. ALLOCATED(InData%FFTower) ) THEN
    IntKiBuf( Int_Xferred ) = 0
    Int_Xferred = Int_Xferred + 1
  ELSE
    IntKiBuf( Int_Xferred ) = 1
    Int_Xferred = Int_Xferred + 1
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFTower,1)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFTower,1)
    Int_Xferred = Int_Xferred + 2
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFTower,2)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFTower,2)
    Int_Xferred = Int_Xferred + 2
    IntKiBuf( Int_Xferred    ) = LBOUND(InData%FFTower,3)
    IntKiBuf( Int_Xferred + 1) = UBOUND(InData%FFTower,3)
    Int_Xferred = Int_Xferred + 2

      DO i3 = LBOUND(InData%FFTower,3), UBOUND(InData%FFTower,3)
        DO i2 = LBOUND(InData%FFTower,2), UBOUND(InData%FFTower,2)
          DO i1 = LBOUND(InData%FFTower,1), UBOUND(InData%FFTower,1)
            ReKiBuf(Re_Xferred) = InData%FFTower(i1,i2,i3)
            Re_Xferred = Re_Xferred + 1
          END DO
        END DO
      END DO
  END IF
    ReKiBuf(Re_Xferred) = InData%FFDTime
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%FFRate
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%FFYHWid
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%FFZHWid
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%RefHt
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%GridBase
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%InitXPosition
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%InvFFYD
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%InvFFZD
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%InvMFFWS
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%MeanFFWS
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%TotalTime
    Re_Xferred = Re_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%NFFComp
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%NFFSteps
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%NYGrids
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%NZGrids
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%NTGrids
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%WindFileFormat
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = TRANSFER(InData%AddMeanAfterInterp, IntKiBuf(1))
    Int_Xferred = Int_Xferred + 1
    IntKiBuf(Int_Xferred) = InData%WindProfileType
    Int_Xferred = Int_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%PLExp
    Re_Xferred = Re_Xferred + 1
    ReKiBuf(Re_Xferred) = InData%Z0
    Re_Xferred = Re_Xferred + 1
 END SUBROUTINE IfW_FFWind_PackParam

 SUBROUTINE IfW_FFWind_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg )
  REAL(ReKi),      ALLOCATABLE, INTENT(IN   ) :: ReKiBuf(:)
  REAL(DbKi),      ALLOCATABLE, INTENT(IN   ) :: DbKiBuf(:)
  INTEGER(IntKi),  ALLOCATABLE, INTENT(IN   ) :: IntKiBuf(:)
  TYPE(IfW_FFWind_ParameterType), INTENT(INOUT) :: OutData
  INTEGER(IntKi),  INTENT(  OUT) :: ErrStat
  CHARACTER(*),    INTENT(  OUT) :: ErrMsg
    ! Local variables
  INTEGER(IntKi)                 :: Buf_size
  INTEGER(IntKi)                 :: Re_Xferred
  INTEGER(IntKi)                 :: Db_Xferred
  INTEGER(IntKi)                 :: Int_Xferred
  INTEGER(IntKi)                 :: i
  INTEGER(IntKi)                 :: i1, i1_l, i1_u  !  bounds (upper/lower) for an array dimension 1
  INTEGER(IntKi)                 :: i2, i2_l, i2_u  !  bounds (upper/lower) for an array dimension 2
  INTEGER(IntKi)                 :: i3, i3_l, i3_u  !  bounds (upper/lower) for an array dimension 3
  INTEGER(IntKi)                 :: i4, i4_l, i4_u  !  bounds (upper/lower) for an array dimension 4
  INTEGER(IntKi)                 :: ErrStat2
  CHARACTER(ErrMsgLen)           :: ErrMsg2
  CHARACTER(*), PARAMETER        :: RoutineName = 'IfW_FFWind_UnPackParam'
 ! buffers to store meshes, if any
  REAL(ReKi),      ALLOCATABLE   :: Re_Buf(:)
  REAL(DbKi),      ALLOCATABLE   :: Db_Buf(:)
  INTEGER(IntKi),  ALLOCATABLE   :: Int_Buf(:)
    !
  ErrStat = ErrID_None
  ErrMsg  = ""
  Re_Xferred  = 1
  Db_Xferred  = 1
  Int_Xferred  = 1
    OutData%Periodic = TRANSFER(IntKiBuf(Int_Xferred), OutData%Periodic)
    Int_Xferred = Int_Xferred + 1
    OutData%InterpTower = TRANSFER(IntKiBuf(Int_Xferred), OutData%InterpTower)
    Int_Xferred = Int_Xferred + 1
  IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN  ! FFData not allocated
    Int_Xferred = Int_Xferred + 1
  ELSE
    Int_Xferred = Int_Xferred + 1
    i1_l = IntKiBuf( Int_Xferred    )
    i1_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    i2_l = IntKiBuf( Int_Xferred    )
    i2_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    i3_l = IntKiBuf( Int_Xferred    )
    i3_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    i4_l = IntKiBuf( Int_Xferred    )
    i4_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    IF (ALLOCATED(OutData%FFData)) DEALLOCATE(OutData%FFData)
    ALLOCATE(OutData%FFData(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u,i4_l:i4_u),STAT=ErrStat2)
    IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%FFData.', ErrStat, ErrMsg,RoutineName)
       RETURN
    END IF
      DO i4 = LBOUND(OutData%FFData,4), UBOUND(OutData%FFData,4)
        DO i3 = LBOUND(OutData%FFData,3), UBOUND(OutData%FFData,3)
          DO i2 = LBOUND(OutData%FFData,2), UBOUND(OutData%FFData,2)
            DO i1 = LBOUND(OutData%FFData,1), UBOUND(OutData%FFData,1)
              OutData%FFData(i1,i2,i3,i4) = REAL(ReKiBuf(Re_Xferred), SiKi)
              Re_Xferred = Re_Xferred + 1
            END DO
          END DO
        END DO
      END DO
  END IF
  IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN  ! FFTower not allocated
    Int_Xferred = Int_Xferred + 1
  ELSE
    Int_Xferred = Int_Xferred + 1
    i1_l = IntKiBuf( Int_Xferred    )
    i1_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    i2_l = IntKiBuf( Int_Xferred    )
    i2_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    i3_l = IntKiBuf( Int_Xferred    )
    i3_u = IntKiBuf( Int_Xferred + 1)
    Int_Xferred = Int_Xferred + 2
    IF (ALLOCATED(OutData%FFTower)) DEALLOCATE(OutData%FFTower)
    ALLOCATE(OutData%FFTower(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2)
    IF (ErrStat2 /= 0) THEN
       CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%FFTower.', ErrStat, ErrMsg,RoutineName)
       RETURN
    END IF
      DO i3 = LBOUND(OutData%FFTower,3), UBOUND(OutData%FFTower,3)
        DO i2 = LBOUND(OutData%FFTower,2), UBOUND(OutData%FFTower,2)
          DO i1 = LBOUND(OutData%FFTower,1), UBOUND(OutData%FFTower,1)
            OutData%FFTower(i1,i2,i3) = REAL(ReKiBuf(Re_Xferred), SiKi)
            Re_Xferred = Re_Xferred + 1
          END DO
        END DO
      END DO
  END IF
    OutData%FFDTime = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%FFRate = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%FFYHWid = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%FFZHWid = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%RefHt = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%GridBase = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%InitXPosition = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%InvFFYD = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%InvFFZD = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%InvMFFWS = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%MeanFFWS = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%TotalTime = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%NFFComp = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%NFFSteps = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%NYGrids = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%NZGrids = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%NTGrids = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%WindFileFormat = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%AddMeanAfterInterp = TRANSFER(IntKiBuf(Int_Xferred), OutData%AddMeanAfterInterp)
    Int_Xferred = Int_Xferred + 1
    OutData%WindProfileType = IntKiBuf(Int_Xferred)
    Int_Xferred = Int_Xferred + 1
    OutData%PLExp = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
    OutData%Z0 = ReKiBuf(Re_Xferred)
    Re_Xferred = Re_Xferred + 1
 END SUBROUTINE IfW_FFWind_UnPackParam

END MODULE IfW_FFWind_Base_Types
!ENDOFREGISTRYGENERATEDFILE


text:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.IO;

namespace FineUI.Examples.grid
{
    public partial class grid_aspnet : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();
            }
        }

        #region BindGrid

        private void BindGrid()
        {
            DataTable table = DataSourceUtil.GetDataTable();

            Grid1.DataSource = table;
            Grid1.DataBind();
        }

        #endregion

    }
}


text:
<?php

namespace Bolt\Tests\Users;

use Bolt\Tests\BoltUnitTest;
use Bolt\Users;

/**
 * Class to test correct operation of src/Users.
 *
 * @author Steven de Vries <info@stevendevries.nl>
 **/
class UsersTest extends BoltUnitTest
{
    /**
     * @var array
     */
    private $user;

    protected function setUp()
    {
        $this->resetDb();

        $app = $this->getApp();
        $this->addNewUser($app, 'admin', 'Admin', 'root');
        $this->addNewUser($app, 'editor', 'Editor', 'editor');
        $this->user = ['id' => 2, 'username' => 'editor', 'email' => 'editor@example.com'];
    }

    /**
     * @covers \Bolt\Users::getUser
     */
    public function testGetUserById()
    {
        // Setup test
        $users = $this->getMockUsers();

        // Run test
        $result = $users->getUser(2);

        // Check result
        $this->assertEquals($this->user['id'], $result['id']);
        $this->assertEquals($this->user['username'], $result['username']);
        $this->assertEquals($this->user['email'], $result['email']);
    }

    /**
     * @covers \Bolt\Users::getUser
     */
    public function testGetUserByUnknownId()
    {
        // Setup test
        $users = $this->getMockUsers();

        // Run test
        $result = $users->getUser(0);

        // Check result
        $this->assertEquals(false, $result);
    }

    /**
     * @covers \Bolt\Users::getUser
     */
    public function testGetUserByUsername()
    {
        // Setup test
        $users = $this->getMockUsers();

        // Run test
        $result = $users->getUser('editor');

        // Check result
        $this->assertEquals($this->user['id'], $result['id']);
        $this->assertEquals($this->user['username'], $result['username']);
        $this->assertEquals($this->user['email'], $result['email']);
    }

    /**
     * @covers \Bolt\Users::getUser
     */
    public function testGetUserByUnknownUsername()
    {
        // Setup test
        $users = $this->getMockUsers();

        // Run test
        $result = $users->getUser('anotheruser');

        // Check result
        $this->assertEquals(false, $result);
    }
}


text:
package com.freshplanet.ane.AirFacebook.functions;

import android.content.Intent;
import android.net.Uri;
import com.adobe.air.AirFacebookActivityResultCallback;
import com.adobe.air.AndroidActivityWrapper;
import com.adobe.fre.FREContext;
import com.adobe.fre.FREObject;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.share.ShareApi;
import com.facebook.share.Sharer;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.ShareDialog;
import com.freshplanet.ane.AirFacebook.AirFacebookExtension;

import java.util.List;

public class ShareLinkDialogFunction extends BaseFunction implements AirFacebookActivityResultCallback, FacebookCallback<Sharer.Result> {

    private String callback;
    private CallbackManager callbackManager;
    AndroidActivityWrapper aaw;

    @Override
	public FREObject call(FREContext context, FREObject[] args) {

		// Retrieve callback
		String contentUrl = getStringProperty(args[0], "contentUrl");
		String placeId = getStringProperty(args[0], "placeId");
		String ref = getStringProperty(args[0], "ref");
		String contentTitle = getStringProperty(args[0], "contentTitle");
		String contentDescription = getStringProperty(args[0], "contentDescription");
		String imageUrl = getStringProperty(args[0], "imageUrl");
        List<String> peopleIds = getStringListProperty(args[0], "peopleIds");

        callback = getStringFromFREObject(args[1]);

		AirFacebookExtension.log("ShareLinkDialogFunction");

		ShareLinkContent.Builder builder = new ShareLinkContent.Builder();
		if (contentUrl != null) builder.setContentUrl(Uri.parse(contentUrl));
		if (peopleIds != null) builder.setPeopleIds(peopleIds);
		if (placeId != null) builder.setPlaceId(placeId);
		if (ref != null) builder.setRef(ref);
		if (contentTitle != null) builder.setContentTitle(contentTitle);
		if (imageUrl != null) builder.setImageUrl(Uri.parse(imageUrl));
		if (contentDescription != null) builder.setContentDescription(contentDescription);
		ShareLinkContent shareLinkContent = builder.build();

        callbackManager = CallbackManager.Factory.create();
        aaw = AndroidActivityWrapper.GetAndroidActivityWrapper();
        aaw.addActivityResultListener(this);

        ShareDialog shareDialog = new ShareDialog(aaw.getActivity());
        shareDialog.registerCallback(callbackManager, this);

        if (shareDialog.canShow(shareLinkContent, AirFacebookExtension.context.getDefaultShareDialogMode()))
            shareDialog.show(shareLinkContent, AirFacebookExtension.context.getDefaultShareDialogMode());
        else
            AirFacebookExtension.log("ERROR - CANNOT SHARE!");

		return null;
	}

    @Override
    public void onActivityResult(int i, int i1, Intent intent) {
        callbackManager.onActivityResult(i, i1, intent);
    }

    @Override
    public void onSuccess(Sharer.Result result) {

        AirFacebookExtension.log("SUCCESS! " + result.toString());
        AirFacebookExtension.context.dispatchStatusEventAsync("SHARE_SUCCESS_" + callback, "{}");
        aaw.removeActivityResultListener(this);
    }

    @Override
    public void onCancel() {

        AirFacebookExtension.log("CANCELLED!");
        AirFacebookExtension.context.dispatchStatusEventAsync("SHARE_CANCELLED_" + callback, "{}");
        aaw.removeActivityResultListener(this);
    }

    @Override
    public void onError(FacebookException error) {

        AirFacebookExtension.log("ERROR!" + error.getMessage());
        AirFacebookExtension.context.dispatchStatusEventAsync("SHARE_ERROR_" + callback, "{}");
        aaw.removeActivityResultListener(this);
    }
}


text:
struct level lvl;
struct level_info info;
struct move root;
struct hashtable hash;
struct solution lvl_sol;

struct queue move_queue[MAXDISTANCE];
int current_distance;

struct position static_deadlocks[MAXFIELDS][MAXSTATICDEADLOCKS];
int static_deadlocks_count[MAXSTATICDEADLOCKS];

int search_queue[LVLSIZE*LVLSIZE];
int search_queue_x[MAXFIELDS];
int search_queue_y[MAXFIELDS];

int reachable[LVLSIZE][LVLSIZE];
int boxx[MAXFIELDS];
int boxy[MAXFIELDS];
int box_count;

int solvable = 1; // 0/1
struct move* solution = 0;

const int movesx[8] = {-1,0,1,0,-1,0,1,0};
const int movesy[8] = {0,1,0,-1,0,1,0,-1};


text:
WidgetsUpdateNotifier::WidgetsUpdateNotifier(QObject *parent) :
	QObject(parent),
	_trayIcon(new QSystemTrayIcon(QApplication::windowIcon(), this)),
	_trayMenu(new QMenu()),
	_blinkTimer(new QTimer(this)),
	_normalIcon(QStringLiteral(":/icons/main.ico")),
	_invertIcon(QStringLiteral(":/icons/inverted.ico")),
	_currentNormal(true)
{
	_trayMenu->addAction(QIcon::fromTheme(QStringLiteral("gtk-execute")), tr("Show Main Window"),
						 this, &WidgetsUpdateNotifier::showMainViewModel);
	_trayMenu->addAction(QIcon::fromTheme(QStringLiteral("gtk-quit")), tr("Quit"),
						 this, &WidgetsUpdateNotifier::quit);
	_trayIcon->setContextMenu(_trayMenu.data());

	_trayIcon->setToolTip(QApplication::applicationDisplayName());
	connect(_trayIcon, &QSystemTrayIcon::activated,
			this, &WidgetsUpdateNotifier::trayActivated);
	connect(_trayIcon, &QSystemTrayIcon::messageClicked,
			this, &WidgetsUpdateNotifier::showMainViewModel);

	_blinkTimer->setInterval(500);
	connect(_blinkTimer, &QTimer::timeout,
			this, &WidgetsUpdateNotifier::timerTriggered);
}

void WidgetsUpdateNotifier::showNotification(bool isPositive, const QString &title, const QString &description)
{
	_trayIcon->show();
	_blinkTimer->start();
	_trayIcon->showMessage(title, description, isPositive ? QSystemTrayIcon::Information : QSystemTrayIcon::Critical);
}

void WidgetsUpdateNotifier::updateProgress(int value, int max)
{
	Q_UNUSED(value)
	Q_UNUSED(max)
}

void WidgetsUpdateNotifier::timerTriggered()
{
	if(_currentNormal)
		_trayIcon->setIcon(_invertIcon);
	else
		_trayIcon->setIcon(_normalIcon);
	_currentNormal = !_currentNormal;
	if(getMainWindow()) {
		_trayIcon->hide();
		_blinkTimer->stop();
	}
}

void WidgetsUpdateNotifier::trayActivated(QSystemTrayIcon::ActivationReason reason)
{
	switch (reason) {
	case QSystemTrayIcon::DoubleClick:
	case QSystemTrayIcon::Trigger:
		showMainViewModel();
		break;
	default:
		break;
	}
}

void WidgetsUpdateNotifier::showMainViewModel()
{
	_trayIcon->hide();
	_blinkTimer->stop();
	coreApp->show<MainViewModel>();
}

void WidgetsUpdateNotifier::quit()
{
	_trayIcon->hide();
	_blinkTimer->stop();
	qApp->quit();
}


text:
<?php

declare(strict_types=1);

namespace FSi\Bundle\AdminBundle\Behat\Page;

use SensioLabs\Behat\PageObjectExtension\PageObject\Exception\UnexpectedPageException;

class CategoryNewsList extends Page
{
    protected $path = '/admin/list/category_news?parent={parent_id}';

    protected function verifyPage(): void
    {
        if (!$this->has('css', '#page-header:contains("List of elements")')) {
            throw new UnexpectedPageException(sprintf('%s page is missing "List of elements" header', $this->path));
        }
    }
}


text:
@implementation HHViewController
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) {
        //  We check the window property to make sure that the view is not visible
        if (self.isViewLoaded && self.view.window == nil) {
            [self.view removeFromSuperview]; //  Detach it from its parent (in cases of view controller containment)
            self.view = nil;
            [self performSelectorOnMainThread:@selector(viewDidUnload) withObject:nil waitUntilDone:YES];
        }
    }
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
- (void)loadView
{
    if ([self respondsToSelector:@selector(hooksAfterLoadView)]) {
        for (NSString *selString in [self hooksAfterLoadView]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }
}

- (void)viewDidUnload
{
    if ([self respondsToSelector:@selector(hooksBeforeViewDidUnload)]) {
        for (NSString *selString in [self hooksBeforeViewDidUnload]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }

    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    if ([self respondsToSelector:@selector(hooksAfterViewWillAppear)]) {
        for (NSString *selString in [self hooksAfterViewWillAppear]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    if ([self respondsToSelector:@selector(hooksAfterViewDidAppear)]) {
        for (NSString *selString in [self hooksAfterViewDidAppear]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    if ([self respondsToSelector:@selector(hooksAfterViewWillDisappear)]) {
        for (NSString *selString in [self hooksAfterViewWillDisappear]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];

    if ([self respondsToSelector:@selector(hooksAfterViewDidDisappear)]) {
        for (NSString *selString in [self hooksAfterViewDidDisappear]) {
            [self performSelector:NSSelectorFromString(selString)];
        }
    }
}
#pragma clang diagnostic pop

@end

@implementation UIViewController (ModallyPresent)
- (void)presentModalViewControllerWithBlock:(HHViewControllerBlock)viewController animated:(BOOL)animated
{
    UIViewController *vc = viewController();
    [self presentViewController:vc animated:animated completion:nil];
}

@end


text:
To build project you should you docker. Here some helper scripts to easy get package and docker images.

- scripts/prepare_build_img.sh -prepare docker build image to get dpkg
- scripts/prepare_deb.sh - build dpkg with help of docker build image
- scripts/prepare_run_img.sh - create service runtime docker image

Some examples:

- scripts/prepare_map.sh - examples of commands to prepare osrm maps that will be used by runtime docker image
- scripts/run.sh - how to run docker runtime image


text: * { cursor: crosshair !important; }


text:
<?php

/**
 * The main debug console manager.
 *
 * @author Amadeusz Starzykiewicz
 * @copyright Invenzzia Group <http://www.invenzzia.org/> and contributors.
 * @license http://www.invenzzia.org/license/new-bsd New BSD License
 */
class Opl_Debug
{
	/* waiting for implementation */
} // end Opl_Debug;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Erysiphe polygoni f. sp

### Remarks
null


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using PeanutButter.RandomGenerators;
using PeanutButter.TestUtils.AspNetCore.Builders;
using static PeanutButter.TestUtils.AspNetCore.Fakes.FakeCookie;

// ReSharper disable MemberCanBePrivate.Global

namespace PeanutButter.TestUtils.AspNetCore.Fakes;

// ReSharper disable once ClassWithVirtualMembersNeverInherited.Global
/// <summary>
/// Provides a fake response cookies service
/// </summary>
public class FakeResponseCookies : IResponseCookies, IFake
{
    /// <summary>
    /// Snapshot the current state of the cookies
    /// </summary>
    /// <returns></returns>
    public IDictionary<string, FakeCookie> Snapshot
        => Cache.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

    private IDictionary<string, FakeCookie> Cache
        => ProvideStore();

    private IDictionary<string, FakeCookie> ProvideStore()
    {
        var currentHash = HttpResponse.Headers.GetHashCode();
        if (currentHash == _responseHeadersHash)
        {
            return _store;
        }

        _responseHeadersHash = currentHash;
        return _store = RegenerateStoreFromHeaders();
    }

    private Dictionary<string, FakeCookie> RegenerateStoreFromHeaders()
    {
        var cookieHeaders = HttpResponse.Headers.Where(
            kvp => kvp.Key.Equals(SET_COOKIE, StringComparison.OrdinalIgnoreCase)
        ).Select(kvp => kvp.Value);
        return cookieHeaders
            .Select(ParseCookies)
            .SelectMany(o => o)
            .Where(o => o is not null)
            .ToDictionary(c => c.Name, c => c);
    }

    private IEnumerable<FakeCookie> ParseCookies(StringValues stringValues)
    {
        foreach (var stringValue in stringValues)
        {
            foreach (var subValue in stringValue.Split(','))
            {
                yield return Parse(subValue);
            }
        }
    }

    private Dictionary<string, FakeCookie> _store = new();

    /// <summary>
    /// Creates an instance of FakeResponseCookies with its
    /// own internal HttpResponse that it's attached to
    /// </summary>
    public FakeResponseCookies() : this(null)
    {
    }

    /// <summary>
    /// Constructs an instance of FakeResponseCookies attached to the
    /// provided HttpResponse
    /// </summary>
    /// <param name="attachedTo"></param>
    public FakeResponseCookies(HttpResponse attachedTo)
    {
        HttpResponse = attachedTo;
        if (attachedTo is FakeHttpResponse fake)
        {
            fake.SetCookies(this);
        }
    }

    /// <summary>
    /// The HttpResponse these cookies are attached to.
    /// You may override the response, but if you provide
    /// null, it will be replaced with a new HttpResponse
    /// </summary>
    public HttpResponse HttpResponse
    {
        get => _response;
        set
        {
            _response = value ?? HttpResponseBuilder.Create()
                .WithCookies(this)
                .Build();
            _responseHeadersHash = null;
        }
    }

    private HttpResponse _response;

    private int? _responseHeadersHash;

    /// <summary>
    /// Provides easier indexing into the store
    /// </summary>
    /// <param name="key"></param>
    public FakeCookie this[string key]
    {
        get => Cache[key];
        set => UpdateStore(key, value);
    }

    private void UpdateStore(string key, FakeCookie value)
    {
        if (value is null)
        {
            Cache.Remove(key);
        }
        else
        {
            Cache[key] = value;
        }

        var strings = Cache.Select(
            kvp => GenerateSetCookieHeaderFor(kvp.Value)
        ).ToArray();
        _response.Headers[SET_COOKIE] =
            new StringValues(
                strings
            );
    }

    private string GenerateSetCookieHeaderFor(FakeCookie value)
    {
        var parts = new List<string>()
        {
            $"{WebUtility.UrlEncode(value.Name)}={WebUtility.UrlEncode(value.Value)}"
        };
        var opts = value.Options;
        if (!string.IsNullOrWhiteSpace(opts.Domain))
        {
            parts.Add($"{COOKIE_DOMAIN_KEY}={opts.Domain}");
        }

        if (!string.IsNullOrWhiteSpace(opts.Path))
        {
            parts.Add($"{COOKIE_PATH_KEY}={opts.Path}");
        }

        if (opts.MaxAge is not null)
        {
            parts.Add($"{COOKIE_MAX_AGE_KEY}={opts.MaxAge.Value.TotalSeconds}");
        }

        if (opts.Secure)
        {
            parts.Add(COOKIE_SECURE_FLAG);
        }

        if (opts.HttpOnly)
        {
            parts.Add(COOKIE_HTTP_ONLY_FLAG);
        }

        return string.Join("; ", parts);
    }

    /// <summary>
    /// Query if the store contains the key
    /// </summary>
    /// <param name="key"></param>
    /// <returns></returns>
    public bool ContainsKey(string key)
    {
        return Cache.ContainsKey(key);
    }

    /// <summary>
    /// Return all store keys
    /// </summary>
    public string[] Keys => Cache.Keys.ToArray();

    /// <summary>
    /// Return all store values
    /// </summary>
    public FakeCookie[] Values => Cache.Values.ToArray();

    /// <summary>
    /// Attempts to create a substitute for FakeResponseCookies using
    /// NSubstitute's Substitute.ForPartsOf<T> which means you should
    /// both be able to inspect the cookie store and assert that methods
    /// were called on the store within your code. However, there is a
    /// caveat: NSubstitute assertions seem to fail unless you've previously
    /// used NSubstitute in testing. This is most likely due to how NSubstitute
    /// is sought out via reflection and possibly manual assembly loading -
    /// so it may be an issue which is resolved in the future. For now, if you
    /// wish to verify calls, ensure that there is some other kind of NSubstitute
    /// invocation before performing assertions against this substitute.
    /// On the other hand, if you don't have NSubstitute available, you'll
    /// get a plain-old FakeResponseCookies object here.
    /// </summary>
    /// <returns></returns>
    public static IResponseCookies CreateSubstitutedIfPossible(
        HttpResponse attachedTo
    )
    {
        // try to return a substitute if possible
        // -> then assertions against setting cookies is easier
        return GenericBuilderBase.TryCreateSubstituteFor<FakeResponseCookies>(
            callThrough: true,
            new object[] { attachedTo },
            out var result
        )
            ? result
            : new FakeResponseCookies(attachedTo);
    }

    /// <inheritdoc />
    public virtual void Append(string key, string value)
    {
        Append(key, value, new CookieOptions());
    }

    /// <inheritdoc />
    public virtual void Append(string key, string value, CookieOptions options)
    {
        UpdateStore(key, new FakeCookie(key, value, options));
    }

    /// <inheritdoc />
    public virtual void Delete(string key)
    {
        UpdateStore(key, null);
    }

    /// <inheritdoc />
    public virtual void Delete(string key, CookieOptions options)
    {
        if (!Cache.TryGetValue(key, out var cookie))
        {
            return;
        }

        if (cookie.Options.Path != options.Path ||
            cookie.Options.Domain != options.Domain)
        {
            return;
        }

        Delete(key);
    }
}


text:
package com.intellij.openapi.module.impl.scopes;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import org.jetbrains.annotations.NotNull;

/**
 * @author nik
 */
public class LibraryScope extends LibraryScopeBase {
  private final Library myLibrary;
  private final String myLibraryName;

  public LibraryScope(Project project, Library library) {
    super(project, library.getFiles(OrderRootType.CLASSES), library.getFiles(OrderRootType.SOURCES));
    myLibraryName = LibraryUtil.getPresentableName(library);
    myLibrary = library;
  }

  @NotNull
  @Override
  public String getDisplayName() {
    return "Library '" + myLibraryName + "'";
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    return myLibrary.equals(((LibraryScope)o).myLibrary);
  }

  @Override
  public int hashCode() {
    return 31 * super.hashCode() + myLibrary.hashCode();
  }
}


text:
from flask import request
from emonitor.modules.alarmkeys.alarmkey import Alarmkey
from emonitor.modules.alarmobjects.alarmobject import AlarmObject
from emonitor.modules.streets.city import City

def getFrontendData(self, params={}):
    """
    Deliver frontend content of module alarmkeys

    :param params: given parameters of current request
    :return: data of alarmkeys
    """
    if request.args.get(u'action') == u'keyslookup':
        keys = {}

        for k in Alarmkey.getAlarmkeys():
            keys[u"{}".format(k.id)] = u'{}: {}'.format(k.category, k.key)
        return keys

    elif request.args.get(u'action') == u'categorylookup':
        key = Alarmkey.getAlarmkeys(id=request.args.get(u'keyid'))
        return {u'id': key.id, u'category': key.category}

    elif request.args.get(u'action') == u'carslookup':
        ret = {u'cars1': [], u'cars2': [], u'material': []}
        try:
            city = City.getCities(id=request.args.get(u'cityid'))
        except ValueError:
            city = None
        key = Alarmkey.getAlarmkeys(id=request.args.get(u'keyid'))
        if request.args.get(u'objectid') != u'0':  # use alarmobject and test for aao
            aobject = AlarmObject.getAlarmObjects(id=request.args.get(u'objectid'))
            if aobject.hasOwnAAO():
                return {u'cars1': [c.id for c in aobject.getCars1()], u'cars2': [c.id for c in aobject.getCars2()],
                        u'material': [m.id for m in aobject.getMaterial()]}
        if key and city:
            ret = {u'cars1': [c.id for c in key.getCars1(city.dept)], u'cars2': [c.id for c in key.getCars2(city.dept)],
                   u'material': [m.id for m in key.getMaterial(city.dept)]}
        return ret

    return u""


text:
namespace KittyHawk.MqttLib.Settings
{
    internal class MqttPlatformSettings : MqttSettings
    {
        /// <summary>
        /// Windows Store App (WinRT) Specific Settings
        /// </summary>
        public MqttPlatformSettings()
        {
        }
    }
}


text:
package com.facebook.buck.maven;

import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.jvm.core.JavaLibrary;
import com.facebook.buck.jvm.java.JavaLibraryBuilder;
import com.facebook.buck.jvm.java.MavenPublishable;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.parser.exceptions.NoSuchBuildTargetException;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.DefaultSourcePathResolver;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.SourcePathRuleFinder;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.TargetNode;
import com.facebook.buck.rules.TestBuildRuleResolver;
import com.facebook.buck.testutil.FakeProjectFilesystem;
import com.facebook.buck.testutil.TargetGraphFactory;
import com.google.common.collect.ImmutableSet;
import java.nio.file.Paths;
import java.util.Optional;
import org.eclipse.aether.deployment.DeploymentException;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class PublisherTest {

  private static final String MVN_COORDS_A = "com.facebook.buck.maven:a:jar:42";
  private static final String MVN_COORDS_B = "com.facebook.buck.maven:b:jar:10";

  @Rule public ExpectedException expectedException = ExpectedException.none();

  private Publisher publisher;

  @Before
  public void setUp() {
    ProjectFilesystem filesystem = new FakeProjectFilesystem();
    publisher =
        new Publisher(
            filesystem,
            /* remoteRepoUrl */ Optional.empty(),
            /* username */ Optional.empty(),
            /* password */ Optional.empty(),
            /* dryRun */ true);
  }

  @Test
  public void errorRaisedForDuplicateFirstOrderDeps()
      throws DeploymentException, NoSuchBuildTargetException {
    // Construct a graph that looks like this.  A and B have maven coordinates set.
    // A   B
    //  \ /
    //   C
    BuildTarget publishableTargetA =
        BuildTargetFactory.newInstance("//:a").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget publishableTargetB =
        BuildTargetFactory.newInstance("//:b").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget targetC = BuildTargetFactory.newInstance("//:c");

    TargetNode<?, ?> depNode =
        JavaLibraryBuilder.createBuilder(targetC).addSrc(Paths.get("c.java")).build();
    TargetNode<?, ?> publishableANode =
        JavaLibraryBuilder.createBuilder(publishableTargetA)
            .addSrc(Paths.get("a.java"))
            .setMavenCoords(MVN_COORDS_A)
            .addDep(targetC)
            .build();
    TargetNode<?, ?> publishableBNode =
        JavaLibraryBuilder.createBuilder(publishableTargetB)
            .addSrc(Paths.get("b.java"))
            .setMavenCoords(MVN_COORDS_B)
            .addDep(targetC)
            .build();

    TargetGraph targetGraph =
        TargetGraphFactory.newInstance(depNode, publishableANode, publishableBNode);
    BuildRuleResolver resolver = new TestBuildRuleResolver(targetGraph);
    SourcePathResolver pathResolver =
        DefaultSourcePathResolver.from(new SourcePathRuleFinder(resolver));

    MavenPublishable publishableA = (MavenPublishable) resolver.requireRule(publishableTargetA);
    MavenPublishable publishableB = (MavenPublishable) resolver.requireRule(publishableTargetB);

    expectedException.expect(DeploymentException.class);
    expectedException.expectMessage(
        Matchers.containsString(targetC.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetA.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetB.getUnflavoredBuildTarget().getFullyQualifiedName()));

    publisher.publish(pathResolver, ImmutableSet.of(publishableA, publishableB));
  }

  @Test
  public void errorRaisedForDuplicateFirstOrderAndTransitiveDep()
      throws DeploymentException, NoSuchBuildTargetException {
    // Construct a graph that looks like this.  A and B have maven coordinates set.
    // A   B
    // |   |
    // C   |
    //  \ /
    //   D
    BuildTarget publishableTargetA =
        BuildTargetFactory.newInstance("//:a").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget publishableTargetB =
        BuildTargetFactory.newInstance("//:b").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget targetC = BuildTargetFactory.newInstance("//:c");
    BuildTarget targetD = BuildTargetFactory.newInstance("//:d");

    TargetNode<?, ?> transitiveDepNode =
        JavaLibraryBuilder.createBuilder(targetD).addSrc(Paths.get("d.java")).build();
    TargetNode<?, ?> depNode =
        JavaLibraryBuilder.createBuilder(targetC)
            .addSrc(Paths.get("c.java"))
            .addDep(targetD)
            .build();
    TargetNode<?, ?> publishableANode =
        JavaLibraryBuilder.createBuilder(publishableTargetA)
            .addSrc(Paths.get("a.java"))
            .setMavenCoords(MVN_COORDS_A)
            .addDep(targetC)
            .build();
    TargetNode<?, ?> publishableBNode =
        JavaLibraryBuilder.createBuilder(publishableTargetB)
            .addSrc(Paths.get("b.java"))
            .setMavenCoords(MVN_COORDS_B)
            .addDep(targetD)
            .build();

    TargetGraph targetGraph =
        TargetGraphFactory.newInstance(
            transitiveDepNode, depNode, publishableANode, publishableBNode);
    BuildRuleResolver resolver = new TestBuildRuleResolver(targetGraph);
    SourcePathResolver pathResolver =
        DefaultSourcePathResolver.from(new SourcePathRuleFinder(resolver));

    MavenPublishable publishableA = (MavenPublishable) resolver.requireRule(publishableTargetA);
    MavenPublishable publishableB = (MavenPublishable) resolver.requireRule(publishableTargetB);

    expectedException.expect(DeploymentException.class);
    expectedException.expectMessage(
        Matchers.containsString(targetD.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetA.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetB.getUnflavoredBuildTarget().getFullyQualifiedName()));

    publisher.publish(pathResolver, ImmutableSet.of(publishableA, publishableB));
  }

  @Test
  public void errorRaisedForDuplicateTransitiveDeps()
      throws DeploymentException, NoSuchBuildTargetException {
    // Construct a graph that looks like this.  A and B have maven coordinates set.
    // A   B
    // |   |
    // C   D
    //  \ /
    //   E
    BuildTarget publishableTargetA =
        BuildTargetFactory.newInstance("//:a").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget publishableTargetB =
        BuildTargetFactory.newInstance("//:b").withFlavors(JavaLibrary.MAVEN_JAR);
    BuildTarget targetC = BuildTargetFactory.newInstance("//:c");
    BuildTarget targetD = BuildTargetFactory.newInstance("//:d");
    BuildTarget targetE = BuildTargetFactory.newInstance("//:e");

    TargetNode<?, ?> transitiveDepNode =
        JavaLibraryBuilder.createBuilder(targetE).addSrc(Paths.get("e.java")).build();
    TargetNode<?, ?> dep1Node =
        JavaLibraryBuilder.createBuilder(targetC)
            .addSrc(Paths.get("c.java"))
            .addDep(targetE)
            .build();
    TargetNode<?, ?> dep2Node =
        JavaLibraryBuilder.createBuilder(targetD)
            .addSrc(Paths.get("d.java"))
            .addDep(targetE)
            .build();
    TargetNode<?, ?> publishableANode =
        JavaLibraryBuilder.createBuilder(publishableTargetA)
            .addSrc(Paths.get("a.java"))
            .setMavenCoords(MVN_COORDS_A)
            .addDep(targetC)
            .build();
    TargetNode<?, ?> publishableBNode =
        JavaLibraryBuilder.createBuilder(publishableTargetB)
            .addSrc(Paths.get("b.java"))
            .setMavenCoords(MVN_COORDS_B)
            .addDep(targetD)
            .build();

    TargetGraph targetGraph =
        TargetGraphFactory.newInstance(
            transitiveDepNode, dep1Node, dep2Node, publishableANode, publishableBNode);
    BuildRuleResolver resolver = new TestBuildRuleResolver(targetGraph);
    SourcePathResolver pathResolver =
        DefaultSourcePathResolver.from(new SourcePathRuleFinder(resolver));

    MavenPublishable publishableA = (MavenPublishable) resolver.requireRule(publishableTargetA);
    MavenPublishable publishableB = (MavenPublishable) resolver.requireRule(publishableTargetB);

    expectedException.expect(DeploymentException.class);
    expectedException.expectMessage(
        Matchers.containsString(targetE.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetA.getUnflavoredBuildTarget().getFullyQualifiedName()));
    expectedException.expectMessage(
        Matchers.containsString(
            publishableTargetB.getUnflavoredBuildTarget().getFullyQualifiedName()));

    publisher.publish(pathResolver, ImmutableSet.of(publishableA, publishableB));
  }
}


text:
'''
Copyright (c) <2012> Tarek Galal <tare2.galal@gmail.com>

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''

import socket;
import sys
from .bintreenode import BinTreeNodeReader, BinTreeNodeWriter

from Yowsup.Common.debugger import Debugger

from .ioexceptions import ConnectionClosedException

class ConnectionEngine(socket.socket):

	def __init__(self):
		Debugger.attach(self)

		self.reader = BinTreeNodeReader(self)
		self.writer = BinTreeNodeWriter(self)

		self.readSize = 1;
		self.buf = [];
		self.maxBufRead = 0;
		self.connected = 0

		self.jid = ""

		super(ConnectionEngine,self).__init__(socket.AF_INET, socket.SOCK_STREAM);

	def getId(self):
		return self.id

	def setId(self, idx):
		self.id = idx

	def flush(self):
		'''FLUSH'''
		self.write();

	def getBuffer(self):
		return self.buffer;

	def reset(self):
		self.buffer = "";

	def write(self,data):

		if type(data) is int:
			try:
				self.sendall(chr(data)) if sys.version_info < (3, 0) else self.sendall(chr(data).encode('iso-8859-1'))
			except:
				self._d("socket 1 write crashed, reason: %s" % sys.exc_info()[1])
				raise ConnectionClosedException("socket 1 write crashed, reason: %s" % sys.exc_info()[1])
		else:
			tmp = "";

			for d in data:
				tmp += chr(d)

			try:
				self.sendall(tmp) if sys.version_info < (3, 0) else self.sendall(tmp.encode('iso-8859-1'))
			except:
				self._d("socket 2 write crashed, reason: %s" % sys.exc_info()[1])
				raise ConnectionClosedException("socket 2 write crashed, reason: %s" % sys.exc_info()[1])

	def setReadSize(self,size):
		self.readSize = size;

	def read(self, socketOnly = 0):
		x = ""
		try:
			x = self.recv(self.readSize)#.decode('iso-8859-1');
		except:
			self._d("socket read crashed, reason %s " % sys.exc_info()[1])
			raise ConnectionClosedException("socket read crashed, reason %s " % sys.exc_info()[1])

		#x= self.recvX(self.readSize);

		if len(x) == 1:
			#Utilities.debug("GOT "+str(ord((x))));
			return ord(x);
		else:
			raise ConnectionClosedException("Got 0 bytes, connection closed");
			#return x;

	def read2(self,b,off,length):
		'''reads into a buffer'''
		if off < 0 or length < 0 or (off+length)>len(b):
			raise Exception("Out of bounds");

		if length == 0:
			return 0;

		if b is None:
			raise Exception("XNull pointerX");

		count = 0;

		while count < length:

			#self.read();
			#print "OKIIIIIIIIIIII";
			#exit();
			b[off+count]=self.read(0);
			count= count+1;

		return count;


text:
HFY2PDF is a bot aimed to get the latest HFY OC posts (from subscribed authors) and convert them into PDF and ePub.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

ePub cover image by [Juskteez Vu](https://unsplash.com/@juskteez), under [Creative Commons Zero license](https://creativecommons.org/publicdomain/zero/1.0/).

[Merriweather font by Sorkin Type](fonts/README.md), licensed under the [SIL Open Font License, Version 1.1](fonts/LICENSE.md).


text:
package org.elasticsearch.common.util.concurrent;

public interface WrappedRunnable extends Runnable {
    Runnable unwrap();
}


text:
using namespace StalkerSpace;

#ifdef _DEBUG
//#	define STALKER_DEBUG_MODE
#endif

#ifdef STALKER_DEBUG_MODE
#include "attachable_item.h"
#endif

//////////////////////////////////////////////////////////////////////////
// CStalkerActionNoALife
//////////////////////////////////////////////////////////////////////////

CStalkerActionNoALife::CStalkerActionNoALife(CAI_Stalker* object, LPCSTR action_name)
    : inherited(object, action_name) {}

void CStalkerActionNoALife::initialize() {
    inherited::initialize();
#ifndef STALKER_DEBUG_MODE
    object().movement().set_desired_position(0);
    object().movement().set_desired_direction(0);
    object().movement().set_path_type(MovementManager::ePathTypeGamePath);
    object().movement().set_detail_path_type(DetailPathManager::eDetailPathTypeSmooth);
    object().movement().set_body_state(eBodyStateStand);
    object().movement().set_movement_type(eMovementTypeWalk);
    object().movement().set_mental_state(eMentalStateFree);
    object().sight().setup(CSightAction(SightManager::eSightTypeCover, false, true));

    m_stop_weapon_handling_time = Device.dwTimeGlobal;
    if (object().inventory().ActiveItem() && object().best_weapon() &&
        (object().inventory().ActiveItem()->object().ID() == object().best_weapon()->object().ID()))
        m_stop_weapon_handling_time += ::Random32.random(30000) + 30000;

#else
    object().movement().set_mental_state(eMentalStateDanger);
    object().movement().set_movement_type(eMovementTypeStand);
    object().movement().set_body_state(eBodyStateStand);
    object().movement().set_desired_direction(0);
    object().movement().set_path_type(MovementManager::ePathTypeLevelPath);
    object().movement().set_detail_path_type(DetailPathManager::eDetailPathTypeSmooth);
    object().movement().set_nearest_accessible_position();
    object().sight().setup(CSightAction(SightManager::eSightTypeCurrentDirection));
    object().CObjectHandler::set_goal(
        eObjectActionFire1, object().inventory().ItemFromSlot(INV_SLOT_2), 0, 1, 2500, 3000);
//	object().movement().patrol().set_path
//("way_0000",PatrolPathManager::ePatrolStartTypeNearest);
#endif
}

void CStalkerActionNoALife::finalize() {
    inherited::finalize();

    object().movement().set_desired_position(0);

    if (!object().g_Alive())
        return;

    object().sound().remove_active_sounds(u32(eStalkerSoundMaskNoHumming));
}

void CStalkerActionNoALife::execute() {
    inherited::execute();
#ifndef STALKER_DEBUG_MODE
    object().sound().play(eStalkerSoundHumming, 60000, 10000);
    if (Device.dwTimeGlobal >= m_stop_weapon_handling_time)
        if (!object().best_weapon())
            object().CObjectHandler::set_goal(eObjectActionIdle);
        else
            object().CObjectHandler::set_goal(eObjectActionStrapped, object().best_weapon());
    else
        object().CObjectHandler::set_goal(eObjectActionIdle, object().best_weapon());
#else
//	object().movement().set_movement_type		(eMovementTypeRun);
#endif
}

//////////////////////////////////////////////////////////////////////////
// CStalkerActionGatherItems
//////////////////////////////////////////////////////////////////////////

CStalkerActionGatherItems::CStalkerActionGatherItems(CAI_Stalker* object, LPCSTR action_name)
    : inherited(object, action_name) {}

void CStalkerActionGatherItems::initialize() {
    inherited::initialize();

    object().movement().set_desired_direction(0);
    object().movement().set_path_type(MovementManager::ePathTypeLevelPath);
    object().movement().set_detail_path_type(DetailPathManager::eDetailPathTypeSmooth);
    object().movement().set_body_state(eBodyStateStand);
    object().movement().set_movement_type(eMovementTypeWalk);
    object().movement().set_mental_state(eMentalStateDanger);
    object().sound().remove_active_sounds(u32(eStalkerSoundMaskNoHumming));
    if (!object().inventory().ActiveItem())
        object().CObjectHandler::set_goal(eObjectActionIdle);
    else
        object().CObjectHandler::set_goal(eObjectActionIdle, object().inventory().ActiveItem());

    CObject const* const selected = object().memory().item().selected();

    typedef CAI_Stalker::ignored_touched_objects_type ignored_touched_objects_type;
    ignored_touched_objects_type& ignored_touched_objects = m_object->ignored_touched_objects();
    ignored_touched_objects_type::iterator i =
        std::find(ignored_touched_objects.begin(), ignored_touched_objects.end(), selected);
    if (i == ignored_touched_objects.end())
        return;

    ignored_touched_objects.erase(i);

    m_object->generate_take_event(selected);
}

void CStalkerActionGatherItems::finalize() {
    inherited::finalize();

    object().sight().setup(SightManager::eSightTypePathDirection);

    object().movement().set_desired_position(0);

    if (!object().g_Alive())
        return;

    object().sound().set_sound_mask(0);
}

void CStalkerActionGatherItems::execute() {
    inherited::execute();

    if (!object().memory().item().selected())
        return;

    u32 level_vertex_id = object().memory().item().selected()->ai_location().level_vertex_id();
    //	if (object().movement().restrictions().accessible(level_vertex_id)) {
    object().movement().set_level_dest_vertex(level_vertex_id);
    object().movement().set_desired_position(&object().memory().item().selected()->Position());
    //	}
    //	else {
    //		object().movement().set_nearest_accessible_position	(
    //			object().memory().item().selected()->Position(),
    //			level_vertex_id
    //		);
    //	}

    object().sight().setup(SightManager::eSightTypePosition,
                           &object().memory().item().selected()->Position());
}


text:
/*global riot, todoStorage */
<todo>

todos

			<input class="new-todo" autofocus autocomplete="off" placeholder="What needs to be done?" onkeyup={ addTodo }>

			<input class="toggle-all" type="checkbox" checked={ allDone } onclick={ toggleAll }>

				{ remaining } { remaining === 1 ? 'item' : 'items' } left

All

Active

Completed

			<button class="clear-completed" onclick={ removeCompleted } show={ todos.length > remaining }>
				Clear completed</button>

Double-click to edit a todo

Written by Tianxiang Chen

Part of TodoMVC

</todo>

<todoitem>

		<input class="toggle" type="checkbox" checked={ opts.todo.completed } onclick={ toggleTodo }>
		{ opts.todo.title }
		<button class="destroy" onclick={ removeTodo }></button>

	<input name="todoeditbox" class="edit" type="text" onblur={ doneEdit } onkeyup={ editKeyUp }>

</todoitem>


text:
/**
 * @file
 * @brief Pipe kernel services
 */

#include <micro_private.h>
#include <k_pipe_buffer.h>
#include <k_pipe_util.h>
#include <microkernel/pipe.h>
#include <misc/util.h>

extern kpipe_t _k_pipe_ptr_start[];
extern kpipe_t _k_pipe_ptr_end[];

/**
 * @brief Initialize kernel pipe subsystem
 *
 * Performs any initialization of statically-defined pipes that wasn't done
 * at build time. (Note: most pipe structure fields are set to zero by sysgen.)
 *
 * @return N/A
 */
void _k_pipe_init(void)
{
	kpipe_t *pipeId;
	struct _k_pipe_struct *pipe_ptr;

	for (pipeId = _k_pipe_ptr_start; pipeId < _k_pipe_ptr_end; pipeId++) {
		pipe_ptr = (struct _k_pipe_struct *)(*pipeId);
		BuffInit((unsigned char *)pipe_ptr->Buffer,
				 &(pipe_ptr->buffer_size), &pipe_ptr->desc);
	}
}

int task_pipe_get(kpipe_t id, void *buffer,
		int bytes_to_read, int *bytes_read,
		K_PIPE_OPTION options, int32_t timeout)
{
	struct k_args A;

	/*
	 * some users do not check the FUNCTION return value,
	 * but immediately use bytes_read; make sure it always
	 * has a good value, even when we return failure immediately
	 * (see below)
	 */

	*bytes_read = 0;

	if (unlikely(bytes_to_read % SIZEOFUNIT_TO_OCTET(1))) {
		return RC_ALIGNMENT;
	}
	if (unlikely(bytes_to_read == 0)) {
		/*
		 * not allowed because enlisted requests with zero size
		 * will hang in _k_pipe_process()
		 */
		return RC_FAIL;
	}
	if (unlikely(options == _0_TO_N && timeout != TICKS_NONE)) {
		return RC_FAIL;
	}

	A.priority = _k_current_task->priority;
	A.Comm = _K_SVC_PIPE_GET_REQUEST;
	A.Time.ticks = timeout;

	A.args.pipe_req.req_info.pipe.id = id;
	A.args.pipe_req.req_type.sync.total_size = bytes_to_read;
	A.args.pipe_req.req_type.sync.data_ptr = buffer;

	_k_pipe_option_set(&A.args, options);
	_k_pipe_request_type_set(&A.args, _SYNCREQ);

	KERNEL_ENTRY(&A);

	*bytes_read = A.args.pipe_ack.xferred_size;
	return A.Time.rcode;
}

int task_pipe_put(kpipe_t id, void *buffer,
		int bytes_to_write, int *bytes_written,
		K_PIPE_OPTION options, int32_t timeout)
{
	struct k_args A;

	/*
	 * some users do not check the FUNCTION return value,
	 * but immediately use bytes_written; make sure it always
	 * has a good value, even when we return failure immediately
	 * (see below)
	 */

	*bytes_written = 0;

	if (unlikely(bytes_to_write % SIZEOFUNIT_TO_OCTET(1))) {
		return RC_ALIGNMENT;
	}
	if (unlikely(bytes_to_write == 0)) {
		/*
		 * not allowed because enlisted requests with zero size
		 * will hang in _k_pipe_process()
		 */
		return RC_FAIL;
	}
	if (unlikely(options == _0_TO_N && timeout != TICKS_NONE)) {
		return RC_FAIL;
	}

	A.priority = _k_current_task->priority;
	A.Comm = _K_SVC_PIPE_PUT_REQUEST;
	A.Time.ticks = timeout;

	A.args.pipe_req.req_info.pipe.id = id;
	A.args.pipe_req.req_type.sync.total_size = bytes_to_write;
	A.args.pipe_req.req_type.sync.data_ptr = buffer;

	_k_pipe_option_set(&A.args, options);
	_k_pipe_request_type_set(&A.args, _SYNCREQ);

	KERNEL_ENTRY(&A);

	*bytes_written = A.args.pipe_ack.xferred_size;
	return A.Time.rcode;
}

/**
 * @brief Asynchronous pipe write request
 *
 * This routine attempts to write data from a memory pool block to the
 * specified pipe. (Note that partial transfers and timeouts are not
 * supported, unlike the case for synchronous write requests.)
 *
 * @return RC_OK, RC_FAIL, or RC_ALIGNMENT
 */
int _task_pipe_block_put(kpipe_t Id, struct k_block Block,
			int iReqSize2Xfer, ksem_t sema)
{
	unsigned int iSize2Xfer;
	struct k_args A;

	iSize2Xfer = min((unsigned)iReqSize2Xfer, (unsigned)(Block.req_size));

	if (unlikely(iSize2Xfer % SIZEOFUNIT_TO_OCTET(1))) {
		return RC_ALIGNMENT;
	}
	if (unlikely(iSize2Xfer == 0)) {
		/*
		 * not allowed because enlisted requests with zero size
		 * will hang in _k_pipe_process()
		 */
		return RC_FAIL;
	}

	A.priority = _k_current_task->priority;
	A.Comm = _K_SVC_PIPE_PUT_REQUEST;
	A.Time.ticks = TICKS_UNLIMITED;
		/* same behavior in flow as a blocking call w/o a timeout */

	A.args.pipe_req.req_info.pipe.id = Id;
	A.args.pipe_req.req_type.async.block = Block;
	A.args.pipe_req.req_type.async.total_size = iSize2Xfer;
	A.args.pipe_req.req_type.async.sema = sema;

	_k_pipe_request_type_set(&A.args, _ASYNCREQ);
	_k_pipe_option_set(&A.args, _ALL_N); /* force ALL_N */

	KERNEL_ENTRY(&A);
	return RC_OK;
}


text:
#ifndef PP_PCIELANES_H
#define PP_PCIELANES_H

extern uint8_t encode_pcie_lane_width(uint32_t num_lanes);
extern uint8_t decode_pcie_lane_width(uint32_t num_lanes);

#endif