text:
@implementation UIImage (CKTransform)

#define DEGREES_TO_RADIANS(DEGREES) (DEGREES * (M_PI / 180.0f))

- (UIImage *)scaleToFitSize:(CGSize)newSize {
  CGFloat wFactor = newSize.width / self.size.width;
  CGFloat hFactor = newSize.height / self.size.height;
  CGFloat factor = MAX(wFactor, hFactor);

  CGSize size = CGSizeMake(self.size.width * factor, self.size.height * factor);

  CGContextRef bitmap = CGBitmapContextCreate(NULL,
                                              size.width,
                                              size.height,
                                              CGImageGetBitsPerComponent(self.CGImage),
                                              0,
                                              CGImageGetColorSpace(self.CGImage),
                                              CGImageGetBitmapInfo(self.CGImage));
  if (!bitmap) {
    return nil;
  }

  CGContextSetShouldAntialias(bitmap, YES);
  CGContextSetAllowsAntialiasing(bitmap, YES);
  CGContextSetInterpolationQuality(bitmap, kCGInterpolationHigh);

  UIGraphicsPushContext(bitmap);
  CGContextTranslateCTM(bitmap, 0.0f, size.height);
  CGContextScaleCTM(bitmap, 1.0f, -1.0f);
  CGRect rect = {.origin.x = 0.0f, .origin.y = 0.0f, .size.width = size.width, .size.height = size.height};
  [self drawInRect:rect];
  UIGraphicsPopContext();

  CGImageRef scaledImageRef = CGBitmapContextCreateImage(bitmap);
  UIImage* scaled = [UIImage imageWithCGImage:scaledImageRef];

  CGImageRelease(scaledImageRef);
  CGContextRelease(bitmap);

  return scaled;
}

- (UIImage *)scaleToSize:(CGSize)newSize {
  const size_t originalWidth = self.size.width;
  const size_t originalHeight = self.size.height;

  size_t width, height;
  if (originalWidth > originalHeight) {
    width = newSize.width;
    height = originalHeight * newSize.width / originalWidth;
  }
  else {
    height = newSize.height;
    width = originalWidth * newSize.height / originalHeight;
  }

  if (height > newSize.width) {
    width = newSize.width;
    height = originalHeight * newSize.width / originalWidth;
  }

  if (height > newSize.height) {
    height = newSize.height;
    width = originalWidth * newSize.height / originalHeight;
  }

  CGContextRef bitmap = CGBitmapContextCreate(NULL,
                                              width,
                                              height,
                                              CGImageGetBitsPerComponent(self.CGImage),
                                              0,
                                              CGImageGetColorSpace(self.CGImage),
                                              CGImageGetBitmapInfo(self.CGImage));

  if (!bitmap) {
    return nil;
  }

  CGContextSetInterpolationQuality(bitmap, kCGInterpolationNone);

  UIGraphicsPushContext(bitmap);
  CGContextTranslateCTM(bitmap, 0.0f, height);
  CGContextScaleCTM(bitmap, 1.0f, -1.0f);
  CGRect rect = {.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = height};
  [self drawInRect:rect];
  UIGraphicsPopContext();

  CGImageRef scaledImageRef = CGBitmapContextCreateImage(bitmap);
  UIImage* scaled = [UIImage imageWithCGImage:scaledImageRef];

  CGImageRelease(scaledImageRef);
  CGContextRelease(bitmap);

  return scaled;
}

- (UIImage *)cropImage:(CGSize) newSize {
  return [self cropImage:newSize mode:ImageCropModeTopLeft];
}

- (UIImage *) cropToRect:(CGRect) rect {
  CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], rect);
  UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
  CGImageRelease(imageRef);

  return croppedImage;
}

- (UIImage *)cropImage:(CGSize) newSize mode:(ImageCropMode)cropMode {
  const CGSize size = self.size;
  CGFloat x = 0;
  CGFloat y = 0;

  switch (cropMode) {
    case ImageCropModeTopLeft:
      x = y = 0.0f;
      break;
    case ImageCropModeTopCenter:
      x = (size.width - newSize.width) * 0.5f;
      y = 0.0f;
      break;
    case ImageCropModeTopRight:
      x = size.width - newSize.width;
      y = 0.0f;
      break;
    case ImageCropModeBottomLeft:
      x = 0.0f;
      y = size.height - newSize.height;
      break;
    case ImageCropModeBottomCenter:
      x = newSize.width * 0.5f;
      y = size.height - newSize.height;
      break;
    case ImageCropModeBottomRight:
      x = size.width - newSize.width;
      y = size.height - newSize.height;
      break;
    case ImageCropModeLeftCenter:
      x = 0.0f;
      y = (size.height - newSize.height) * 0.5f;
      break;
    case ImageCropModeRightCenter:
      x = size.width - newSize.width;
      y = (size.height - newSize.height) * 0.5f;
      break;
    case ImageCropModeCenter:
      x = (size.width - newSize.width) * 0.5f;
      y = (size.height - newSize.height) * 0.5f;
      break;
    default:
      x = y = 0.0f;
      break;
  }

  CGRect cropRect = CGRectMake(x * self.scale, y * self.scale, newSize.width * self.scale, newSize.height * self.scale);

  CGImageRef croppedImageRef = CGImageCreateWithImageInRect(self.CGImage, cropRect);
  UIImage* cropped = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:self.imageOrientation];

  CGImageRelease(croppedImageRef);

  return cropped;
}

- (UIImage *)rotateInRadians:(float)radians {
  const size_t width = self.size.width * self.scale;
  const size_t height = self.size.height * self.scale;

  CGRect imgRect = (CGRect){.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = height};
  CGRect rotatedRect = CGRectApplyAffineTransform(imgRect, CGAffineTransformMakeRotation(radians));
  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

  CGContextRef bitmap = CGBitmapContextCreate(NULL,
                                              rotatedRect.size.width,
                                              rotatedRect.size.height,
                                              8,
                                              0,
                                              colorSpace,
                                              kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);

  CGColorSpaceRelease(colorSpace);
  if (!bitmap) {
    return nil;
  }

  CGContextSetShouldAntialias(bitmap, true);
  CGContextSetAllowsAntialiasing(bitmap, true);
  CGContextSetInterpolationQuality(bitmap, kCGInterpolationHigh);

  CGContextTranslateCTM(bitmap, +(rotatedRect.size.width * 0.5f), +(rotatedRect.size.height * 0.5f));
  CGContextRotateCTM(bitmap, radians);

  CGRect rect = {.origin.x = -(width * 0.5f), .origin.y = -(height * 0.5f), .size.width = width, .size.height = height};
  CGContextDrawImage(bitmap, rect, self.CGImage);

  CGImageRef rotatedImageRef = CGBitmapContextCreateImage(bitmap);
  UIImage* rotated = [UIImage imageWithCGImage:rotatedImageRef scale:self.scale orientation:self.imageOrientation];

  CGImageRelease(rotatedImageRef);
  CGContextRelease(bitmap);

  return rotated;
}

- (UIImage *) rotateInDegrees:(float) degrees {
  return [self rotateInRadians:DEGREES_TO_RADIANS(degrees)];
}

+ (UIImage *) normalizeImage:(UIImage *) image {
  CGFloat kMaxResolution = NSUIntegerMax;

  CGImageRef imgRef = image.CGImage;

  CGFloat width = CGImageGetWidth(imgRef);
  CGFloat height = CGImageGetHeight(imgRef);

  CGAffineTransform transform = CGAffineTransformIdentity;
  CGRect bounds = CGRectMake(0, 0, width, height);

  if (width > kMaxResolution || height > kMaxResolution) {
    CGFloat ratio = width/height;
    if (ratio > 1) {
      bounds.size.width = kMaxResolution;
      bounds.size.height = bounds.size.width / ratio;
    }
    else {
      bounds.size.height = kMaxResolution;
      bounds.size.width = bounds.size.height * ratio;
    }
  }

  CGFloat scaleRatio = bounds.size.width / width;
  CGSize imageSize = CGSizeMake(CGImageGetWidth(imgRef), CGImageGetHeight(imgRef));
  CGFloat boundHeight = 0;
  UIImageOrientation orientation = image.imageOrientation;

  switch(orientation) {
    case UIImageOrientationUp: //EXIF = 1
      transform = CGAffineTransformIdentity;
      break;

    case UIImageOrientationUpMirrored: //EXIF = 2
      transform = CGAffineTransformMakeTranslation(imageSize.width, 0.0);
      transform = CGAffineTransformScale(transform, -1.0, 1.0);
      break;

    case UIImageOrientationDown: //EXIF = 3
      transform = CGAffineTransformMakeTranslation(imageSize.width, imageSize.height);
      transform = CGAffineTransformRotate(transform, M_PI);
      break;

    case UIImageOrientationDownMirrored: //EXIF = 4
      transform = CGAffineTransformMakeTranslation(0.0, imageSize.height);
      transform = CGAffineTransformScale(transform, 1.0, -1.0);
      break;

    case UIImageOrientationLeftMirrored: //EXIF = 5
      boundHeight = bounds.size.height;
      bounds.size.height = bounds.size.width;
      bounds.size.width = boundHeight;
      transform = CGAffineTransformMakeTranslation(imageSize.height, imageSize.width);
      transform = CGAffineTransformScale(transform, -1.0, 1.0);
      transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
      break;

    case UIImageOrientationLeft: //EXIF = 6
      boundHeight = bounds.size.height;
      bounds.size.height = bounds.size.width;
      bounds.size.width = boundHeight;
      transform = CGAffineTransformMakeTranslation(0.0, imageSize.width);
      transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
      break;

    case UIImageOrientationRightMirrored: //EXIF = 7
      boundHeight = bounds.size.height;
      bounds.size.height = bounds.size.width;
      bounds.size.width = boundHeight;
      transform = CGAffineTransformMakeScale(-1.0, 1.0);
      transform = CGAffineTransformRotate(transform, M_PI / 2.0);
      break;

    case UIImageOrientationRight: //EXIF = 8
      boundHeight = bounds.size.height;
      bounds.size.height = bounds.size.width;
      bounds.size.width = boundHeight;
      transform = CGAffineTransformMakeTranslation(imageSize.height, 0.0);
      transform = CGAffineTransformRotate(transform, M_PI / 2.0);
      break;

    default:
      [NSException raise:NSInternalInconsistencyException format:@"Invalid image orientation"];

  }

  UIGraphicsBeginImageContext(bounds.size);

  CGContextRef context = UIGraphicsGetCurrentContext();

  if (orientation == UIImageOrientationRight || orientation == UIImageOrientationLeft) {
    CGContextScaleCTM(context, -scaleRatio, scaleRatio);
    CGContextTranslateCTM(context, -height, 0);
  }
  else {
    CGContextScaleCTM(context, scaleRatio, -scaleRatio);
    CGContextTranslateCTM(context, 0, -height);
  }

  CGContextConcatCTM(context, transform);

  CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
  UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();

  return imageCopy;
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
              android:id="@+id/background">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_tasks"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </android.support.v7.widget.RecyclerView>
</LinearLayout>

redpajama_set_name: RedPajamaGithub


text:
// *****************************************************
// CIXReader
// SettingsDialog.cs
//
// Author: Steve Palmer (spalmer@cix)
//
// Created: 05/03/2015 14:33
//
// Copyright (C) 2013-2014 CIX Online Ltd. All Rights Reserved.
// *****************************************************

using System;
using System.Drawing;
using System.Windows.Forms;
using CIXReader.Utilities;

namespace CIXReader.Forms
{
    public sealed partial class SettingsDialog : Form
    {
        private readonly SettingsGeneral _general;
        private readonly SettingsSignatures _signatures;
        private readonly SettingsUpdates _updates;
        private readonly SettingsViewing _viewing;
        private readonly SettingsRules _rules;

        private Button _activeButton;
        private Form _activeView;

        public SettingsDialog()
        {
            InitializeComponent();

            _general = new SettingsGeneral();
            _viewing = new SettingsViewing();
            _signatures = new SettingsSignatures();
            _updates = new SettingsUpdates();
            _rules = new SettingsRules();
        }

        /// <summary>
        /// Display the General tab to start with.
        /// </summary>
        private void NewSettingsDialog_Load(object sender, EventArgs e)
        {
            // On Linux, Check for Updates is not supported
            #if __MonoCS__
            settingsUpdates.Visible = false;
            #endif
            SelectButton(settingsGeneral);
            LoadPage(_general);
        }

        /// <summary>
        /// Load and make the specified page active
        /// </summary>
        /// <param name="page">Page to show</param>
        private void LoadPage(Form page)
        {
            if (page != _activeView)
            {
                if (_activeView != null)
                {
                    _activeView.Hide();
                }
                _activeView = page;
                _activeView.TopLevel = false;
                _activeView.Parent = settingsPanel;
                _activeView.Size = settingsPanel.Size;
                _activeView.Show();
            }
        }

        /// <summary>
        /// Select the specified tab button.
        /// </summary>
        private void SelectButton(Button tabButton)
        {
            if (tabButton != _activeButton)
            {
                if (_activeButton != null)
                {
                    _activeButton.ForeColor = SystemColors.ControlText;
                    _activeButton.BackColor = settingsToolbar.BackColor;
                }
                _activeButton = tabButton;
                _activeButton.BackColor = SystemColors.Highlight;
                _activeButton.ForeColor = SystemColors.HighlightText;
            }
        }

        /// <summary>
        /// Resize the active view when the main form is resized.
        /// </summary>
        private void NewSettingsDialog_Resize(object sender, EventArgs e)
        {
            if (_activeView != null)
            {
                _activeView.Size = settingsPanel.Size;
            }
        }

        /// <summary>
        /// Activate the General tab.
        /// </summary>
        private void settingsGeneral_Click(object sender, EventArgs e)
        {
            SelectButton(settingsGeneral);
            LoadPage(_general);
        }

        /// <summary>
        /// Activate the Viewings tab.
        /// </summary>
        private void settingsViewing_Click(object sender, EventArgs e)
        {
            SelectButton(settingsViewing);
            LoadPage(_viewing);
        }

        /// <summary>
        /// Activate the Signatures tab.
        /// </summary>
        private void settingsSignatures_Click(object sender, EventArgs e)
        {
            SelectButton(settingsSignatures);
            LoadPage(_signatures);
        }

        /// <summary>
        /// Activate the Rules tab.
        /// </summary>
        private void settingsRules_Click(object sender, EventArgs e)
        {
            SelectButton(settingsRules);
            LoadPage(_rules);
        }

        /// <summary>
        /// Activate the Updates tab.
        /// </summary>
        private void settingsUpdates_Click(object sender, EventArgs e)
        {
            SelectButton(settingsUpdates);
            LoadPage(_updates);
        }

        /// <summary>
        /// Save the settings when the form is closing.
        /// </summary>
        private void SettingsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            Preferences.Save();
        }
    }
}


text:
/**
 * uninstall.js
 *
 * Uninstall a clarity package
 */

module.exports = function(env, package, options){

};


text:
Analyst::Analyst(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Analyst)
{
    ui->setupUi(this);

    this->draw();
    this->bind();

    this->minor = new Minor();
}

Analyst::~Analyst()
{
    delete ui;
}

void Analyst::draw()
{
    setFixedSize(1000, 600);
    statusBar()->setSizeGripEnabled(false);

    QLabel *lTemperature = new QLabel(this);
    lTemperature->setText("Temperature");
    lTemperature->move(50,20);

    QLabel *lHumidity = new QLabel(this);
    lHumidity->setText("Humidity");
    lHumidity->move(210,20);

    QLabel *lAccel = new QLabel(this);
    lAccel->setText("Accelerometer");
    lAccel->move(370,20);

    QLabel *lGyro = new QLabel(this);
    lGyro->setText("Gyroscope");
    lGyro->move(520,20);

    bDataMining = new QPushButton("DataMining", this);
    bDataMining->move(680, 67);

    lToolTip = new QLabel(this);
    lToolTip->setVisible(false);
    lToolTip->setText("Calculating...");
    lToolTip->move(800,67);

    QLabel *lTemperatureMin = new QLabel(this);
    lTemperatureMin->setText("min");
    lTemperatureMin->move(50,50);
    sbTemperatureMin = new QSpinBox(this);
    sbTemperatureMin->setMaximum(350);
    sbTemperatureMin->setValue(260);
    sbTemperatureMin->move(75,50);

    QLabel *lTemperatureMax = new QLabel(this);
    lTemperatureMax->setText("max");
    lTemperatureMax->move(50,85);
    sbTemperatureMax = new QSpinBox(this);
    sbTemperatureMax->setMaximum(350);
    sbTemperatureMax->setValue(320);
    sbTemperatureMax->move(75,85);

    QLabel *lHumidityMin = new QLabel(this);
    lHumidityMin->setText("min");
    lHumidityMin->move(210,50);
    sbHumidityMin = new QSpinBox(this);
    sbHumidityMin->setValue(0);
    sbHumidityMin->move(235,50);
    sbHumidityMin->setMaximum(0);
    sbHumidityMin->setMaximum(100);

    QLabel *lHumidityMax = new QLabel(this);
    lHumidityMax->setText("max");
    lHumidityMax->move(210,85);
    sbHumidityMax = new QSpinBox(this);
    sbHumidityMax->move(235,85);
    sbHumidityMax->setMinimum(0);
    sbHumidityMax->setMaximum(100);
    sbHumidityMax->setValue(100);

    QLabel *lAccelerometerMin = new QLabel(this);
    lAccelerometerMin->setText("min");
    lAccelerometerMin->move(370,50);
    sbAccelerometerMin = new QSpinBox(this);
    sbAccelerometerMin->move(395,50);
    sbAccelerometerMin->setMinimum(-50);
    sbAccelerometerMin->setMaximum(50);
    sbAccelerometerMin->setValue(-10);

    QLabel *lAccelerometerMax = new QLabel(this);
    lAccelerometerMax->setText("max");
    lAccelerometerMax->move(370,85);
    sbAccelerometerMax = new QSpinBox(this);
    sbAccelerometerMax->move(395,85);
    sbAccelerometerMax->setMinimum(-50);
    sbAccelerometerMax->setMaximum(50);
    sbAccelerometerMax->setValue(10);

    QLabel *lGyroscopeMin = new QLabel(this);
    lGyroscopeMin->setText("min");
    lGyroscopeMin->move(520,50);
    sbGyroscopeMin = new QSpinBox(this);
    sbGyroscopeMin->move(545,50);
    sbGyroscopeMin->setMinimum(-50);
    sbGyroscopeMin->setMaximum(50);
    sbGyroscopeMin->setValue(-10);

    QLabel *lGyroscopeMax = new QLabel(this);
    lGyroscopeMax->setText("max");
    lGyroscopeMax->move(520,85);
    sbGyroscopeMax = new QSpinBox(this);
    sbGyroscopeMax->move(545,85);
    sbGyroscopeMax->setMinimum(-50);
    sbGyroscopeMax->setMaximum(50);
    sbGyroscopeMax->setValue(10);

    tableWidget = new QTableWidget(this);
    tableWidget->move(30,140);
    tableWidget->setFixedWidth(942);
    tableWidget->setFixedHeight(440);
    tableWidget->setColumnCount(9);
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);

    tableWidget->setHorizontalHeaderLabels(QStringList() <<"Journey"<<"mTemp"<<"MTemp"<<"mHumidity"<<"MHumidity"<<"mAccelXYZ"<<"MAccelXYZ"<<"mGyroXYZ"<<"MGyroXYZ");

    this->movie = new QMovie("animiners.gif");
    this->movie->setScaledSize(QSize(180,120));
    this->processLabel = new QLabel(this);
    this->processLabel->setMovie(this->movie);
    this->processLabel->move(795,5);
    this->processLabel->setFixedHeight(140);
    this->processLabel->setFixedWidth(200);
    this->movie->start();
    this->processLabel->setVisible(false);
}

void Analyst::bind()
{
    QObject::connect(
        tableWidget,
        SIGNAL(doubleClicked(QModelIndex)),
        this,
        SLOT(
            callTracker()
        )
    );

    QObject::connect(
        bDataMining,
        SIGNAL(clicked(bool)),
        this,
        SLOT(mine())
    );
}

void Analyst::callTracker()
{
    QSettings settings("conf.ini", QSettings::IniFormat);
    QString filepath = settings.value("external/tracker").toString();
    qDebug() << "Tracker path: " << filepath;
    qDebug() << "file: " << tableWidget->selectedItems().first()->text();
    qDebug() << QApplication::applicationDirPath() + "/" + tableWidget->selectedItems().first()->text() + ".json";
    Tools::execCommandLine(filepath, QApplication::applicationDirPath() + "/" + tableWidget->selectedItems().first()->text() + ".json");
}

void Analyst::mine()
{
    this->tableWidget->setRowCount(0);
    QMap<QString, float> sills = QMap<QString, float>();
    sills.insert(QString("tempMin"), sbTemperatureMin->value());
    sills.insert(QString("tempMax"), sbTemperatureMax->value());
    sills.insert(QString("humiMin"), sbHumidityMin->value());
    sills.insert(QString("humiMax"), sbHumidityMax->value());
    sills.insert(QString("accelMin"), sbAccelerometerMin->value());
    sills.insert(QString("accelMax"), sbAccelerometerMax->value());
    sills.insert(QString("gyroMin"), sbGyroscopeMin->value());
    sills.insert(QString("gyroMax"), sbGyroscopeMax->value());

    this->processLabel->setVisible(true);

    this->minor->sills = sills;
    this->minor->table = this->tableWidget;
    this->minor->processLabel = this->processLabel;

    this->minor->start();

    //this->minor.mine(sills, this->tableWidget, this->processLabel);
}


text:
enyo.kind({
	name: "Infobox",
	kind: "onyx.Popup",
	classes: "infobox",
	published: {
		title: "",
		details: ""
	},
	floating: true,
	components: [
		{name: "title"},
		{name: "details", classes: "infobox-details"}
	],
	create: function() {
		this.inherited(arguments);
		this.titleChanged();
		this.detailsChanged();
	},
	titleChanged: function() {
		this.$.title.setContent(this.title);
	},
	detailsChanged: function() {
		this.$.details.setContent(this.details);
	},
	openAt: function(inTop, inLeft) {
		this.applyStyle("top", inTop + "px");
		this.applyStyle("left", inLeft + "px");
		this.show();
	},
	openWithItem: function(inItem, inTop, inLeft) {
		this.setTitle(inItem.Title);
		this.setDetails(inItem.Address);
		this.openAt(inTop, inLeft);
	}
});


text:
class RelativeHMC6352
{
	public:
		RelativeHMC6352();
        void set_north();
        void set_north_val(float val);
        float real_north();
        float angle_raw();
        float angle();
	private:
		float _north;
};

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/MyServiceFabricApp" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="PubSubService_PartitionCount" Value="4" />
    <Parameter Name="PubSubService_MinReplicaSetSize" Value="3" />
    <Parameter Name="PubSubService_TargetReplicaSetSize" Value="3" />
    <Parameter Name="SubscribingToRelayStatefulService_PartitionCount" Value="1" />
    <Parameter Name="SubscribingToRelayStatefulService_MinReplicaSetSize" Value="2" />
    <Parameter Name="SubscribingToRelayStatefulService_TargetReplicaSetSize" Value="3" />
    <Parameter Name="PublishingStatelessService_InstanceCount" Value="-1" />
    <Parameter Name="SubscribingStatefulService_PartitionCount" Value="1" />
    <Parameter Name="SubscribingStatefulService_MinReplicaSetSize" Value="2" />
    <Parameter Name="SubscribingStatefulService_TargetReplicaSetSize" Value="3" />
    <Parameter Name="SubscribingStatelessService_InstanceCount" Value="-1" />
  </Parameters>
</Application>


text:
import { reduceRight } from "../index";
export = reduceRight;


text:
from FHQVisualizationLib import FHQVisualizationLib
from time import sleep

host="localhost"
port=31001

with FHQVisualizationLib(host, port) as fhq:
	while True:
		fhq.showthreelock("keva")
		sleep(3)
		fhq.showthreelock("mustang")
		sleep(3)


text:
from flask.ext.admin import AdminIndexView, expose
from flask.ext import login
from flask import url_for, redirect

class CustomAdminIndexView(AdminIndexView):
    @expose('/')
    def index(self):
        if not login.current_user.is_authenticated():
            return redirect('/login')
        return super(CustomAdminIndexView, self).index()

#    @expose('/login/', methods=('GET', 'POST'))
#    def login_view(self):
#        # handle user login
#        form = LoginForm(request.form)
#        if helpers.validate_form_on_submit(form):
#            user = form.get_user()
#            login.login_user(user)
#
#        if login.current_user.is_authenticated():
#            return redirect(url_for('.index'))
#        link = '
Don\'t have an account? Click here to register.
'
#        self._template_args['form'] = form
#        self._template_args['link'] = link
#        return super(MyAdminIndexView, self).index()
#
#    @expose('/register/', methods=('GET', 'POST'))
#    def register_view(self):
#        form = RegistrationForm(request.form)
#        if helpers.validate_form_on_submit(form):
#            user = User()
#
#            form.populate_obj(user)
#
#            db.session.add(user)
#            db.session.commit()
#
#            login.login_user(user)
#            return redirect(url_for('.index'))
#        link = '
Already have an account? Click here to log in.
'
#        self._template_args['form'] = form
#        self._template_args['link'] = link
#        return super(MyAdminIndexView, self).index()


text:
using System;
using System.Collections.Generic;
using Traveller.Commands.Contracts;
using Traveller.Core.Contracts;
using Traveller.Core.Providers;

namespace Traveller.Commands.Creating
{
    public class ListTicketsCommand : ICommand
    {
        private readonly ITravellerFactory factory;
        private readonly IDatabase database;

        public ListTicketsCommand(ITravellerFactory factory, IDatabase database)
        {
            this.factory = factory ?? throw new ArgumentNullException("factory");
            this.database = database ?? throw new ArgumentNullException("database");
        }

        public string Execute(IList<string> parameters)
        {
            var tickets = this.database.Tickets;

            if (tickets.Count == 0)
            {
                return "There are no registered tickets.";
            }

            return string.Join(Environment.NewLine + "####################" + Environment.NewLine, tickets);
        }
    }
}


text:
module.exports = function(callback, config) {

  var Nexmo = require('../lib/Nexmo');

  var nexmo = new Nexmo({
    apiKey: config.API_KEY,
    apiSecret: config.API_SECRET
  }, {
    debug: config.DEBUG
  });

  nexmo.message.shortcode2FA(config.TO_US_NUMBER, {"company-name": "Acme", "pin": "1234"}, {}, callback);
};


text:
= 1.3.0

 * Further improvements for JSON payloads:
   * Added set of methods for distinguishing between set and unset parameters.
   * The `import` now properly handles parameters with `nil` and `false` values.
   * The `to_data` method now returns all set parameters, regardless of their value.

= 1.2.0

 * Few changes for easier import and export of JSON payloads:
   * The `import` and the new `from_data` methods now support numeric, boolean, and `nil` values natively.
   * Added `to_data` method which creates a hash of all non-`nil` parameters.

= 1.1.0

 * Added `report!` methods for late reporting of the most fundamental errors.

 * Added support for multiple `check` and `test` validation callbacks.

= 1.0.0

 * Initial release.


text:
<?php

namespace NFePHP\install;

require_once('../bootstrap.php');

if (!defined('PATH_NFEPHP')) {
    define('PATH_NFEPHP', dirname(dirname(__FILE__)));
}

use NFePHP\Common\Files\FilesFolders;

$configfolder = filter_input(INPUT_GET, 'configfolder', FILTER_SANITIZE_STRING);

$defaultconfigfolder = PATH_NFEPHP .'/config';
$defaultpathConfig =  $defaultconfigfolder .'/config.json';

$tpAmb = filter_input(
    INPUT_GET,
    'tpAmb',
    FILTER_VALIDATE_INT,
    array("options" => array("min_range"=>1, "max_range"=>2))
);

$pathXmlUrlFileNFe = filter_input(INPUT_GET, 'pathXmlUrlFileNFe', FILTER_SANITIZE_STRING);
$pathXmlUrlFileCTe = filter_input(INPUT_GET, 'pathXmlUrlFileCTe', FILTER_SANITIZE_STRING);
$pathXmlUrlFileMDFe = filter_input(INPUT_GET, 'pathXmlUrlFileMDFe', FILTER_SANITIZE_STRING);
$pathXmlUrlFileCLe = filter_input(INPUT_GET, 'pathXmlUrlFileCLe', FILTER_SANITIZE_STRING);
$pathXmlUrlFileNFSe = filter_input(INPUT_GET, 'pathXmlUrlFileNFSe', FILTER_SANITIZE_STRING);

$pathNFeFiles = filter_input(INPUT_GET, 'pathNFeFiles', FILTER_SANITIZE_STRING);
$pathCTeFiles = filter_input(INPUT_GET, 'pathCTeFiles', FILTER_SANITIZE_STRING);
$pathMDFeFiles = filter_input(INPUT_GET, 'pathMDFeFiles', FILTER_SANITIZE_STRING);
$pathCLeFiles = filter_input(INPUT_GET, 'pathCLeFiles', FILTER_SANITIZE_STRING);
$pathNFSeFiles = filter_input(INPUT_GET, 'pathNFSeFiles', FILTER_SANITIZE_STRING);
$pathCertsFiles = filter_input(INPUT_GET, 'pathCertsFiles', FILTER_SANITIZE_STRING);

$siteUrl = filter_input(INPUT_GET, 'siteUrl', FILTER_SANITIZE_URL);

$schemesNFe = filter_input(INPUT_GET, 'schemesNFe', FILTER_SANITIZE_STRING);
$schemesCTe = filter_input(INPUT_GET, 'schemesCTe', FILTER_SANITIZE_STRING);
$schemesMDFe = filter_input(INPUT_GET, 'schemesMDFe', FILTER_SANITIZE_STRING);
$schemesCLe = filter_input(INPUT_GET, 'schemesCLe', FILTER_SANITIZE_STRING);
$schemesNFSe = filter_input(INPUT_GET, 'schemesNFSe', FILTER_SANITIZE_STRING);

$razaosocial = filter_input(INPUT_GET, 'razaosocial', FILTER_SANITIZE_SPECIAL_CHARS);
$nomefantasia = filter_input(INPUT_GET, 'nomefantasia', FILTER_SANITIZE_SPECIAL_CHARS);
$siglaUF = filter_input(INPUT_GET, 'siglaUF', FILTER_SANITIZE_STRING);
$cnpj = filter_input(INPUT_GET, 'cnpj', FILTER_SANITIZE_STRING);
$ie = filter_input(INPUT_GET, 'ie', FILTER_SANITIZE_STRING);
$im = filter_input(INPUT_GET, 'im', FILTER_SANITIZE_STRING);
$iest = filter_input(INPUT_GET, 'iest', FILTER_SANITIZE_STRING);
$cnae = filter_input(INPUT_GET, 'cnae', FILTER_SANITIZE_STRING);
$regime = filter_input(
    INPUT_GET,
    'regime',
    FILTER_VALIDATE_INT,
    array("options" => array("min_range"=>1, "max_range"=>3))
);
$tokenIBPT = filter_input(INPUT_GET, 'tokenIBPT', FILTER_SANITIZE_STRING);
$tokenNFCe = filter_input(INPUT_GET, 'tokenNFCe', FILTER_SANITIZE_STRING);
$tokenNFCeId = filter_input(INPUT_GET, 'tokenNFCeId', FILTER_SANITIZE_STRING);

$certPfxName = filter_input(INPUT_GET, 'certPfxName', FILTER_SANITIZE_STRING);
$certPassword = filter_input(INPUT_GET, 'certPassword', FILTER_SANITIZE_STRING);
$certPhrase = filter_input(INPUT_GET, 'certPhrase', FILTER_SANITIZE_STRING);

$format = filter_input(INPUT_GET, 'format', FILTER_SANITIZE_STRING);
$paper = filter_input(INPUT_GET, 'paper', FILTER_SANITIZE_STRING);
$southpaw = filter_input(INPUT_GET, 'southpaw');
$pathLogoFile = filter_input(INPUT_GET, 'pathLogoFile', FILTER_SANITIZE_STRING);
$pathLogoNFe = filter_input(INPUT_GET, 'pathLogoNFe', FILTER_SANITIZE_STRING);
$pathLogoNFCe = filter_input(INPUT_GET, 'pathLogoNFCe', FILTER_SANITIZE_STRING);
$logoPosition = filter_input(INPUT_GET, 'logoPosition', FILTER_SANITIZE_STRING);
$font = filter_input(INPUT_GET, 'font', FILTER_SANITIZE_STRING);
$printer = filter_input(INPUT_GET, 'printer', FILTER_SANITIZE_STRING);

$mailAuth = filter_input(INPUT_GET, 'mailAuth');
$mailFrom = filter_input(INPUT_GET, 'mailFrom', FILTER_VALIDATE_EMAIL);
$mailSmtp = filter_input(INPUT_GET, 'mailSmtp', FILTER_SANITIZE_URL);
$mailUser = filter_input(INPUT_GET, 'mailUser', FILTER_SANITIZE_STRING);
$mailPass = filter_input(INPUT_GET, 'mailPass', FILTER_SANITIZE_STRING);
$mailProtocol = filter_input(INPUT_GET, 'mailProtocol', FILTER_SANITIZE_STRING);
$mailPort = filter_input(INPUT_GET, 'mailPort', FILTER_SANITIZE_NUMBER_INT);

$mailFromMail = filter_input(INPUT_GET, 'mailFromMail', FILTER_VALIDATE_EMAIL);
$mailFrom = empty($mailFrom) ? $mailFromMail : '';
$mailFromName = filter_input(INPUT_GET, 'mailFromName', FILTER_SANITIZE_STRING);
$mailReplayToMail = filter_input(INPUT_GET, 'mailReplayToMail', FILTER_VALIDATE_EMAIL);
$mailReplayToName = filter_input(INPUT_GET, 'mailReplayToName', FILTER_SANITIZE_STRING);
$mailImapHost = filter_input(INPUT_GET, 'mailImapHost', FILTER_SANITIZE_URL);
$mailImapPort = filter_input(INPUT_GET, 'mailImapPort', FILTER_SANITIZE_NUMBER_INT);
$mailImapSecurity = filter_input(INPUT_GET, 'mailImapSecurity', FILTER_SANITIZE_STRING);
$mailImapNocerts = filter_input(INPUT_GET, 'mailImapNocerts');
$mailImapBox = filter_input(INPUT_GET, 'mailImapBox', FILTER_SANITIZE_STRING);

$proxyIp = filter_input(INPUT_GET, 'proxyIp', FILTER_SANITIZE_STRING);
$proxyPort = filter_input(INPUT_GET, 'proxyPort', FILTER_SANITIZE_NUMBER_INT);
$proxyUser = filter_input(INPUT_GET, 'proxyUser', FILTER_SANITIZE_STRING);
$proxyPass = filter_input(INPUT_GET, 'proxyPass', FILTER_SANITIZE_STRING);

$aDocFormat = array(
    'format'=> $format,
    'paper' => $paper,
    'southpaw' => $southpaw,
    'pathLogoFile' => $pathLogoFile,
    'pathLogoNFe' => $pathLogoNFe,
    'pathLogoNFCe' => $pathLogoNFCe,
    'logoPosition' => $logoPosition,
    'font' => $font,
    'printer' => $printer
);

$aMailConf = array(
    'mailAuth' => $mailAuth,
    'mailFrom' => $mailFrom,
    'mailSmtp' => $mailSmtp,
    'mailUser' => $mailUser,
    'mailPass' => $mailPass,
    'mailProtocol' => $mailProtocol,
    'mailPort' => $mailPort,
    'mailFromMail' => $mailFromMail,
    'mailFromName' => $mailFromName,
    'mailReplayToMail' => $mailReplayToMail,
    'mailReplayToName' => $mailReplayToName,
    'mailImapHost' => $mailImapHost,
    'mailImapPort' => $mailImapPort,
    'mailImapSecurity' => $mailImapSecurity,
    'mailImapNocerts' => $mailImapNocerts,
    'mailImapBox' => $mailImapBox
);

$aProxyConf = array(
    'proxyIp'=> $proxyIp,
    'proxyPort'=> $proxyPort,
    'proxyUser'=> $proxyUser,
    'proxyPass'=> $proxyPass
);

$aConfig = array(
    'atualizacao' => date('Y-m-d h:i:s'),
    'tpAmb' => $tpAmb,
    'pathXmlUrlFileNFe' => $pathXmlUrlFileNFe,
    'pathXmlUrlFileCTe' => $pathXmlUrlFileCTe,
    'pathXmlUrlFileMDFe' => $pathXmlUrlFileMDFe,
    'pathXmlUrlFileCLe' => $pathXmlUrlFileCLe,
    'pathXmlUrlFileNFSe' => $pathXmlUrlFileNFSe,
    'pathNFeFiles' => $pathNFeFiles,
    'pathCTeFiles'=> $pathCTeFiles,
    'pathMDFeFiles'=> $pathMDFeFiles,
    'pathCLeFiles'=> $pathCLeFiles,
    'pathNFSeFiles'=> $pathNFSeFiles,
    'pathCertsFiles' => $pathCertsFiles,
    'siteUrl' => $siteUrl,
    'schemesNFe' => $schemesNFe,
    'schemesCTe' => $schemesCTe,
    'schemesMDFe' => $schemesMDFe,
    'schemesCLe' => $schemesCLe,
    'schemesNFSe' => $schemesNFSe,
    'razaosocial' => $razaosocial,
    'nomefantasia' => $nomefantasia,
    'siglaUF'=> $siglaUF,
    'cnpj' => $cnpj,
    'ie' => $ie,
    'im' => $im,
    'iest' => $iest,
    'cnae' => $cnae,
    'regime' => $regime,
    'tokenIBPT' => $tokenIBPT,
    'tokenNFCe' => $tokenNFCe,
    'tokenNFCeId' => $tokenNFCeId,
    'certPfxName' => $certPfxName,
    'certPassword' => $certPassword,
    'certPhrase' => $certPhrase,
    'aDocFormat' => $aDocFormat,
    'aMailConf' => $aMailConf,
    'aProxyConf' => $aProxyConf
);

$content = json_encode($aConfig);

$msg = 'SUCESSO !! arquivo de configuração confg.json SALVO.';
if (! $resdefault = FilesFolders::saveFile($defaultconfigfolder, 'config.json', $content)) {
    $msg = "Falha ao salvar o config.json na pasta $defaultconfigfolder \n";

}
if ($configfolder != $defaultconfigfolder) {
    if (! $res = FilesFolders::saveFile($configfolder, 'config.json', $content)) {
        $msg = "Falha ao salvar o config.json na pasta $configfolder \n";
    }
}
$aResp = array('status' => ($resdefault && $res), 'msg' => $msg);

print json_encode($aResp);


text:
Ums::Engine.routes.draw do

    root :to => 'users#welcome'
	get "users/login"
    post "users/login"
    get "users/password"
    post "users/password"
    get "users/profile"
    patch "users/profile"
    get "users/logout"
    get "users/welcome"
    resources :users
    resources :roles
    resources :functions
    resources :logs
end


text:
package info.javaperformance.compressedmaps.normal.floats;

/**
 * Common set of methods implemented by maps
 */
public interface IFloatFloatMap {
    public float get( final float key );
    public float put( final float key, final float value );
    public float remove( final float key );
    public long size();
}


text:
<?php

namespace HippoPHP\Hippo;

use HippoPHP\Hippo\Config\Config;
use HippoPHP\Hippo\Exception\FileNotFoundException;

class CheckRunner
{
    /**
     * @var \HippoPHP\Hippo\FileSystem
     */
    private $fileSystem;

    /**
     * @var \HippoPHP\Hippo\CheckRepository
     */
    private $checkRepository;

    /**
     * @var \HippoPHP\Hippo\Config\Config
     */
    private $config;

    /**
     * @var callable
     */
    private $observer;

    /**
     * @param \HippoPHP\Hippo\FileSystem      $fileSystem
     * @param \HippoPHP\Hippo\CheckRepository $checkRepository
     * @param \HippoPHP\Hippo\Config\Config   $config
     */
    public function __construct(
        FileSystem $fileSystem,
        CheckRepository $checkRepository,
        Config $config
    ) {
        $this->fileSystem = $fileSystem;
        $this->checkRepository = $checkRepository;
        $this->config = $config;
        $this->observer = null;
    }

    /**
     * @param callable $observer
     */
    public function setObserver(callable $observer)
    {
        $this->observer = $observer;

        return $this;
    }

    /**
     * @param string $path
     *
     * @return bool if there were no errors
     */
    public function checkPath($path)
    {
        if (!file_exists($path)) {
            throw new FileNotFoundException($path);
        }

        return is_dir($path)
            ? $this->checkPathDirectory($path)
            : $this->checkPathFile($path);
    }

    /**
     * @param \HippoPHP\Hippo\File $file
     *
     * @return \HippoPHP\Hippo\CheckResult[]
     */
    public function checkFile(File $file)
    {
        $checkContext = new CheckContext($file);
        $results = [];

        foreach ($this->checkRepository->getChecks() as $check) {
            $branch = $this->config->get($check->getConfigRoot());
            if ($branch->get('enabled') === true) {
                $results[] = $check->checkFile($checkContext, $branch);
            }
        }

        return $results;
    }

    /**
     * @param string $path
     *
     * @return \HippoPHP\Hippo\CheckResult[]
     */
    private function checkPathDirectory($path)
    {
        $iterator = $this->fileSystem->getAllFiles($path, '/^.+\.php$/i');
        $results = [];
        foreach ($iterator as $subPath) {
            $results = array_merge($results, $this->checkPathFile($subPath));
        }

        return $results;
    }

    /**
     * @param string $path
     *
     * @return \HippoPHP\Hippo\CheckResult[]
     */
    protected function checkPathFile($path)
    {
        $file = new File($path, $this->fileSystem->getContent($path));
        $checkResults = $this->checkFile($file);
        if ($this->observer !== null) {
            call_user_func($this->observer, $file, $checkResults);
        }

        return $checkResults;
    }
}


text:
/********************************************************************
 *
 * File		:	EventAdminHandler.java
 *
 * Author	:	Bob Brady, rpbrady@gmail.com
 *
 * Contents	:	The OSGi Service that handles OSGi Events from the
 * 				EventAdmin Service and acts as an observer of TPTeam
 * 				Events received by the TPSharedObject of the TPBridge
 * 				OSGi Service
 *
 ********************************************************************/
package edu.harvard.fas.rbrady.tpteam.tpbridge.eventadmin;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import edu.harvard.fas.rbrady.tpteam.tpbridge.Activator;
import edu.harvard.fas.rbrady.tpteam.tpbridge.bridge.ITPBridge;
import edu.harvard.fas.rbrady.tpteam.tpbridge.bridge.TPSharedObject;
import edu.harvard.fas.rbrady.tpteam.tpbridge.model.TPEvent;

/*******************************************************************************
 * File 		: 	EventAdminClient.java
 *
 * Description 	: 	The OSGi Service that handles OSGi Events from the
 * 					EventAdmin Service and acts as an observer of TPTeam Events
 * 					received by the TPSharedObject of the TPBridge OSGi Service
 *
 * @author Bob Brady, rpbrady@gmail.com
 * @version $Revision$
 * @date $Date$ Copyright (c) 2007 Bob Brady
 ******************************************************************************/
public class EventAdminHandler implements EventHandler, Observer {

	/** Table of key=value pairs of the OSGi Event */
	private Hashtable<String, String[]> mDictionary = new Hashtable<String, String[]>();
	/** A List log of all TPEvents received */
	private ArrayList<TPEvent> mEvents;

	/**
	 * Constructor
	 *
	 * Sets the OSGi Event topics to be handled by this service
	 *
	 * Sets the
	 * @param context
	 */
	public EventAdminHandler(BundleContext context) {
		mEvents = new ArrayList<TPEvent>();
		// Set topics for events where tpbridge will send out of JVM on ECF
		// SharedObect
		String topicsProp = Activator.getTPTeamProps().getProperty(
				ITPBridge.BRIDGE_EA_CLIENT_TOPICS_KEY);
		String topics[] = topicsProp.split(",");
		for (String topic : topics)
			System.out.println(ITPBridge.BRIDGE_EA_CLIENT_TOPICS_KEY + ": "
					+ topic);

		mDictionary.put(EventConstants.EVENT_TOPIC, topics);
		context
				.registerService(EventHandler.class.getName(), this,
						mDictionary);
	}

	/**
	 * Handles an OSGi Event from the EventAdmin Service
	 * and fowards it to the TPBridge Service so it can
	 * be sent out-of-JVM
	 *
	 * @param event the OSGi Event to be handled
	 */
	public void handleEvent(Event event) {
		// Info message
		System.out.println("TPBridge EventAdminHandler: Got "
				+ event.getTopic() + " Event SEND_TO "
				+ event.getProperty(TPEvent.SEND_TO));
		// Adapt the OSGi Event to a TPEvent and log it
		TPEvent tpEvent = new TPEvent(event);
		mEvents.add(tpEvent);

		// If no ECF recipient, skip sending
		String sendTo = tpEvent.getDictionary().get(TPEvent.SEND_TO);
		if (sendTo == null || sendTo.trim().equalsIgnoreCase(""))
			return;

		// Send out-of-JVM via TPBridge OSGi Service
		Activator.getTPBridge().sendECFTPMsg(event);
	}

	/**
	 * Handles incoming out-of-JVM messages from the TPBridge
	 * shared object and routes to all subscribers via the
	 * OSGi EventAdmin Service
	 *
	 * @param observable the TPSharedObject of the TPBridge Service
	 * @param object the ECF shared object message event to be handled
	 */
	public void update(Observable observable, Object object) {
		if (observable instanceof TPSharedObject
				&& object instanceof ISharedObjectMessageEvent) {
			// Extract the encapsulated TPEvent
			ISharedObjectMessageEvent sharedObjEvent = (ISharedObjectMessageEvent) object;
			TPEvent tpEvent = (TPEvent) sharedObjEvent.getData();
			System.out
					.println("TPBridge: Update from SharedObject Got TPEvent topic "
							+ tpEvent.getTopic() + " from " + tpEvent.getDictionary().get(TPEvent.FROM));
			// Included so outbound messages don't get into infinite loop
			if(isTopicForwardable(tpEvent.getTopic()))
			{
				Activator.getEventAdminClient().sendEvent(tpEvent.getTopic(),
					tpEvent.getDictionary());
			}
		}
	}

	/**
	 * Getter
	 * @return the log list of TPEvents
	 */
	public ArrayList<TPEvent> getEventLog() {
		return mEvents;
	}

	/**
	 * Helper method to determine if an event having the given
	 * topic should be forwarded out-of-JVM by the TPBridge
	 * OSGi Service
	 * @param topic the topic of an event
	 * @return true if it should be forwarded out-of-JVM, false otherwise
	 */
	private boolean isTopicForwardable(String topic)
	{
		for(String bridgeTopic : mDictionary.get(EventConstants.EVENT_TOPIC))
		{
			if(topic.equalsIgnoreCase(bridgeTopic))
				return false;
		}
		return true;
	}
}


text:
START_ATF_NAMESPACE
    #pragma pack(push, 8)
    struct CGuildRoomInfo
    {
        bool m_bRent;
        char m_byRoomType;
        char m_byRace;
        int m_iGuildIdx;
        unsigned int m_dwGuildSerial;
        int m_timeBegin;
        int m_timer;
        std::vector<RoomCharInfo> m_vecRoomMember;
        CMapData *m_pRoomMap;
        unsigned __int16 m_wRoomMapLayer;
        _LAYER_SET *m_pLayerSet;
        _dummy_position *m_pRoomStartDummy;
    public:
        CGuildRoomInfo(struct CGuildRoomInfo* __that);
        void ctor_CGuildRoomInfo(struct CGuildRoomInfo* __that);
        CGuildRoomInfo();
        void ctor_CGuildRoomInfo();
        unsigned int GetGuildSerial();
        struct CMapData* GetMapData();
        uint16_t GetMapLayer();
        bool GetMapPos(float* pPos);
        int GetRestTime();
        char GetRoomType();
        bool IsMemberIn(int n, unsigned int dwCharSerial);
        bool IsRent();
        void OutAllRoomMember();
        int RoomIn(int n, unsigned int dwCharSerial);
        int RoomOut(int n, unsigned int dwCharSerial);
        void RoomTimer();
        void Room_Initialize();
        void SendDQS_RoomInsert();
        void SendDQS_RoomUpdate();
        void SendMsg_RoomTimeOver();
        bool SetPlayerOut(int n, unsigned int dwCharSerial, int iMemberIdx);
        bool SetRoom(int iGuildInx, unsigned int dwGuildSerial);
        void SetRoomMapInfo(struct CMapData* pMap, uint16_t wMapLayer, char byRoomType, char byRace);
        void SetRoomTime();
        void SetRoomTime_Restore(struct tagTIMESTAMP_STRUCT ts);
        bool SetRoom_Restore(int iGuildInx, unsigned int dwGuildSerial, struct tagTIMESTAMP_STRUCT ts);
        void TimeOver();
        ~CGuildRoomInfo();
        void dtor_CGuildRoomInfo();
    };
    #pragma pack(pop)
    static_assert(ATF::checkSize<CGuildRoomInfo, 96>(), "CGuildRoomInfo");
END_ATF_NAMESPACE


text:
package org.kie.workbench.common.screens.server.management.client.remote;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.Collections;

import org.jboss.errai.ioc.client.api.ManagedInstance;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.server.api.model.Message;
import org.kie.server.controller.api.model.runtime.Container;
import org.kie.server.controller.api.model.runtime.ServerInstanceKey;
import org.kie.workbench.common.screens.server.management.client.remote.card.ContainerCardPresenter;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;

import com.google.gwt.user.client.ui.Widget;

@RunWith(MockitoJUnitRunner.class)
public class RemoteStatusPresenterTest {

    @Mock
    ManagedInstance<ContainerCardPresenter> presenterProvider;

    @Mock
    RemoteStatusPresenter.View view;

    @Mock
    ContainerCardPresenter containerCardPresenter;

    @InjectMocks
    @Spy
    RemoteStatusPresenter presenter;

    @Before
    public void setup() {
        doReturn( containerCardPresenter ).when( presenterProvider ).get();
        when( containerCardPresenter.getView() ).thenReturn( mock( org.kie.workbench.common.screens.server.management.client.container.status.card.ContainerCardPresenter.View.class ) );
    }

    @Test
    public void testInit() {
        presenter.init();

        assertEquals( view, presenter.getView() );
    }

    @Test
    public void testSetup() {
        final Container container = new Container( "containerSpecId", "containerName", new ServerInstanceKey(), Collections.<Message>emptyList(), null, null );
        presenter.setup( Collections.singletonList( container ) );

        verify( containerCardPresenter ).setup( container );
        verify( view ).addCard( any( Widget.class ) );
    }
}


text:
Steps

Steps components is an indicator for the steps in a wizard workflow. Example below uses nested routes with Steps.

    <app-demoActions github="steps" stackblitz="steps-demo"></app-demoActions>

    <router-outlet></router-outlet>

Import

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
import {StepsModule} from 'primeng/steps';
import {MenuItem} from 'primeng/api';
</app-code>

MenuModel API

Steps uses the common menumodel api to define its items, visit MenuModel API for details.

Getting Started

Steps requires a collection of menuitems as its model.

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<p-steps [model]="items"></p-steps>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class MenuDemo {

    items: MenuItem[];

    ngOnInit() {
        this.items = [
            {label: 'Step 1'},
            {label: 'Step 2'},
            {label: 'Step 3'}
        ];
    }
}
</app-code>

Readonly

Items are readonly by default, if you'd like to make them interactive then disable readonly.

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<p-steps [model]="items" [readonly]="false"></p-steps>
</app-code>

Properties

                        Name
                        Type
                        Default
                        Description

                            model
                            array
                            null
                            An array of menuitems.

                            activeIndex
                            number
                            0
                            Index of the active item.

                            readonly
                            boolean
                            true
                            Whether the items are clickable or not.

                            style
                            string
                            null
                            Inline style of the component.

                            styleClass
                            string
                            null
                            Style class of the component.

Events

                            Name
                            Parameters
                            Description

                            activeIndexChange
                            index: Index of the active step item
                            Callback to invoke when the new step is selected.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

                            Name
                            Element

                            p-steps
                            Container element.

                            p-steps-item
                            Menuitem element.

                            p-steps-number
                            Number of menuitem.

                            p-steps-title
                            Label of menuitem.

Dependencies

None.

                View on GitHub

                Edit in StackBlitz

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<div class="card">
    <p-toast></p-toast>
    <p-steps [model]="items" [readonly]="true"></p-steps>
</div>
<router-outlet></router-outlet>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class StepsDemo implements OnInit {

    items: MenuItem[];

    subscription: Subscription;

    constructor(public messageService: MessageService, public ticketService: TicketService) {}

    ngOnInit() {
        this.items = [{
                label: 'Personal',
                routerLink: 'personal'
            },
            {
                label: 'Seat',
                routerLink: 'seat'
            },
            {
                label: 'Payment',
                routerLink: 'payment'
            },
            {
                label: 'Confirmation',
                routerLink: 'confirmation'
            }
        ];

        this.subscription = this.ticketService.paymentComplete$.subscribe((personalInformation) =>{
            this.messageService.add({severity:'success', summary:'Order submitted', detail: 'Dear, ' + personalInformation.firstname + ' ' + personalInformation.lastname + ' your order completed.'});
        });
    }

    ngOnDestroy() {
        if (this.subscription) {
            this.subscription.unsubscribe();
        }
    }
}
</app-code>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<div class="stepsdemo-content">
    <p-card>
        <ng-template pTemplate="title">
            Personal Information
        </ng-template>
        <ng-template pTemplate="subtitle">
            Enter your personal information
        </ng-template>
        <ng-template pTemplate="content">
            <div class="p-fluid"formgrid;grid class="field">
                    <label for="firstname">Firstname</label>
                    <input #firstname="ngModel" id="firstname" type="text" required pInputText [(ngModel)]="personalInformation.firstname" [ngClass]="{'ng-dirty': (firstname.invalid && submitted) || (firstname.dirty && firstname.invalid)}">
                    <small *ngIf="(firstname.invalid && submitted) || (firstname.dirty && firstname.invalid)" class="p-error">Firstname is required.</small>
                </div>
                <div class="field">
                    <label for="lastname">Lastname</label>
                    <input #lastname="ngModel" id="lastname" type="text" required pInputText [(ngModel)]="personalInformation.lastname" [ngClass]="{'ng-dirty': (lastname.invalid && submitted) || (lastname.dirty && lastname.invalid)}">
                    <small class="p-error" *ngIf="(lastname.invalid && submitted )|| (lastname.dirty && lastname.invalid)">Lastname is required.</small>
                </div>
                <div class="field">
                    <label for="age">Age</label>
                    <input #age="ngModel" id="age" type="number" required pInputText [(ngModel)]="personalInformation.age" [ngClass]="{'ng-dirty': (age.invalid && submitted) || (age.dirty && age.invalid)}">
                    <small class="p-error" *ngIf="(age.invalid && submitted) || (age.dirty && age.invalid)">Age is required.</small>
                </div>
            </div>
        </ng-template>
        <ng-template pTemplate="footer">
            <div class="grid grid-nogutter justify-content-end">
                <p-button label="Next" (onClick)="nextPage()" icon="pi pi-angle-right" iconPos="right"></p-button>
            </div>
        </ng-template>
    </p-card>
</div>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class PersonalDemo implements OnInit {

    personalInformation: any;

    submitted: boolean = false;

    constructor(public ticketService: TicketService, private router: Router) { }

    ngOnInit() {
        this.personalInformation = this.ticketService.getTicketInformation().personalInformation;
    }

    nextPage() {
        if (this.personalInformation.firstname && this.personalInformation.lastname && this.personalInformation.age) {
            this.ticketService.ticketInformation.personalInformation = this.personalInformation;
            this.router.navigate(['steps/seat']);

            return;
        }

        this.submitted = true;
    }
}
</app-code>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<div class="stepsdemo-content">
    <p-card>
        <ng-template pTemplate="title">
            Seat Information
        </ng-template>
        <ng-template pTemplate="subtitle">
            Choose your seat
        </ng-template>
        <ng-template pTemplate="content">
            <div class="p-fluid formgrid grid">
                <div class="field col-12 md:col-6">
                    <label for="class">Class</label>
                    <p-dropdown inputId="class" [(ngModel)]="seatInformation.class" [options]="classes" (onChange)="setVagons($event)" optionLabel="name" placeholder="Select a Class"></p-dropdown>
                </div>
                <div class="field col-12 md:col-6">
                    <label for="wagon">Wagon</label>
                    <p-dropdown inputId="wagon" [(ngModel)]="seatInformation.wagon" [options]="vagons" (onChange)="setSeats($event)" optionLabel="wagon" placeholder="Select a Wagon"></p-dropdown>
                </div>
                <div class="field col-12">
                    <label for="seat">Seat</label>
                    <p-dropdown inputId="seat" [(ngModel)]="seatInformation.seat" [options]="seats" optionLabel="seat" placeholder="Select a Seat"></p-dropdown>
                </div>
            </div>
        </ng-template>
        <ng-template pTemplate="footer">
            <div class="grid grid-nogutter justify-content-end">
                <p-button label="Back" (onClick)="prevPage()" icon="pi pi-angle-left"></p-button>
                <p-button label="Next" (onClick)="nextPage()" icon="pi pi-angle-right" iconPos="right"></p-button>
            </div>
        </ng-template>
    </p-card>
</div>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class SeatDemo implements OnInit {

    constructor(public ticketService: TicketService, private router: Router) { }

    classes: any[];

    vagons: any[];

    seats: any[];

    seatInformation: any;

    ngOnInit() {
        this.seatInformation = this.ticketService.ticketInformation.seatInformation;

        this.classes = [
            {name: 'First Class', code: 'A', factor: 1},
            {name: 'Second Class', code: 'B', factor: 2},
            {name: 'Third Class', code: 'C', factor: 3}
        ];
    }

    setVagons(event) {
        if (this.seatInformation.class && event.value) {
            this.vagons = [];
            this.seats = [];
            for (let i = 1; i < 3 * event.value.factor; i++) {
                this.vagons.push({wagon: i + event.value.code, type: event.value.name, factor: event.value.factor});
            }
        }
    }

    setSeats(event) {
        if (this.seatInformation.wagon && event.value) {
            this.seats = [];
            for (let i = 1; i < 10 * event.value.factor; i++) {
                this.seats.push({seat: i, type: event.value.type});
            }
        }
    }

    nextPage() {
        if (this.seatInformation.class && this.seatInformation.seat && this.seatInformation.wagon) {
            this.ticketService.ticketInformation.seatInformation = this.seatInformation;
            this.router.navigate(['steps/payment']);
        }
    }

    prevPage() {
        this.router.navigate(['steps/personal']);
    }
}
</app-code>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<div class="stepsdemo-content">
    <p-card>
        <ng-template pTemplate="title">
            Payment Information
        </ng-template>
        <ng-template pTemplate="subtitle">
            Enter your card details
        </ng-template>
        <ng-template pTemplate="content">
            <div class="p-fluid formgrid grid">
                <div class="field col-12">
                    <label for="class">Card Holder Name</label>
                    <input type="text" required pInputText [(ngModel)]="paymentInformation.cardholderName">
                </div>
                <div class="field col-8">
                    <label id="number" for="lastname">Number</label>
                    <p-inputMask inputId="number" mask="9999-9999-9999-9999" [(ngModel)]="paymentInformation.cardholderNumber"></p-inputMask>
                </div>
                <div class="field col-2">
                    <label id="date" for="date">Date</label>
                    <p-inputMask inputId="date" mask="99/99" [(ngModel)]="paymentInformation.date"></p-inputMask>
                </div>
                <div class="field col-2">
                    <label for="cvv">CVV</label>
                    <p-inputMask id="cvv" mask="999" [(ngModel)]="paymentInformation.cvv"></p-inputMask>
                </div>
                <div class="field-checkbox col-12">
                    <p-checkbox id="remember" [binary]="true" [(ngModel)]="paymentInformation.remember"></p-checkbox>
                    <label for="remember" class="p-checkbox-label">Save credit card information for future</label>
                </div>
            </div>
        </ng-template>
        <ng-template pTemplate="footer">
            <div class="grid grid-nogutter justify-content-end">
                <p-button label="Back" (onClick)="prevPage()" icon="pi pi-angle-left"></p-button>
                <p-button label="Next" (onClick)="nextPage()" icon="pi pi-angle-right" iconPos="right"></p-button>
            </div>
        </ng-template>
    </p-card>
</div>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class PaymentDemo implements OnInit {

    paymentInformation: any;

    constructor(public ticketService: TicketService, private router: Router) { }

    ngOnInit() {
        this.paymentInformation = this.ticketService.ticketInformation.paymentInformation;
    }

    nextPage() {
        if (this.paymentInformation.cardholderName && this.paymentInformation.cardholderNumber && this.paymentInformation.date && this.paymentInformation.cvv) {
            this.ticketService.ticketInformation.paymentInformation = this.paymentInformation;
            this.router.navigate(['steps/confirmation']);
        }
    }

    prevPage() {
        this.router.navigate(['steps/seat']);
    }
}
</app-code>

<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
<div class="stepsdemo-content">
    <p-card>
        <ng-template pTemplate="title">
            Confirmation
        </ng-template>
        <ng-template pTemplate="subtitle">
            Enter your card details
        </ng-template>
        <ng-template pTemplate="content">
            <div class="field col-12">
                <label for="class">Name</label>
                <b>{{ticketInformation.personalInformation.firstname ? ticketInformation.personalInformation.firstname : '-'}} {{ticketInformation.personalInformation.lastname ? ticketInformation.personalInformation.lastname : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Age</label>
                <b>{{ticketInformation.personalInformation.age ? ticketInformation.personalInformation.age : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Seat Class</label>
                <b>{{ticketInformation.seatInformation.class ? ticketInformation.seatInformation.class.name : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Wagon Number</label>
                <b>{{ticketInformation.seatInformation.wagon ? ticketInformation.seatInformation.wagon.wagon : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Seat</label>
                <b>{{ticketInformation.seatInformation.seat ? ticketInformation.seatInformation.seat.seat : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Cardholder Name</label>
                <b>{{ticketInformation.paymentInformation.cardholderName ? ticketInformation.paymentInformation.cardholderName : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Card Number</label>
                <b>{{ticketInformation.paymentInformation.cardholderNumber ? ticketInformation.paymentInformation.cardholderNumber : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">Date</label>
                <b>{{ticketInformation.paymentInformation.date ? ticketInformation.paymentInformation.date : '-'}}</b>
            </div>
            <div class="field col-12">
                <label for="Age">CVV</label>
                <b>{{ticketInformation.paymentInformation.cvv && ticketInformation.paymentInformation.cvv.length === 3  ? '**' + ticketInformation.paymentInformation.cvv[2] : '-'}}</b>
            </div>
        </ng-template>
        <ng-template pTemplate="footer">
            <div class="grid grid-nogutter justify-content-end">
                <p-button label="Back" (onClick)="prevPage()" icon="pi pi-angle-left"></p-button>
                <p-button label="Complete" (onClick)="complete()" icon="pi pi-angle-right" iconPos="right" styleClass="p-button-success"></p-button>
            </div>
        </ng-template>
    </p-card>
</div>
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class ConfirmationDemo implements OnInit {

    ticketInformation: any;

    constructor(public ticketService: TicketService, private router: Router) { }

    ngOnInit() {
        this.ticketInformation = this.ticketService.ticketInformation;
    }

    complete() {
        this.ticketService.complete();
    }

    prevPage() {
        this.router.navigate(['steps/payment']);
    }
}
</app-code>

            <ng-template pTemplate="content">

            </ng-template>


text:
const test = require('ava');
const helpers = require('../../../src/helpers');

let tests = (testData) => {
    let moduleSizes, rootDependencies, flatDependencies, allDependencies;
    test.todo('setup was complete');

    test('get size for node_modules', t => {
        moduleSizes = helpers.getSizeForNodeModules();
        let names = Object.keys(moduleSizes).sort();
        let moduleSizesArray = [];
        for (let name of names) moduleSizesArray.push({name, size: moduleSizes[name]});
        t.deepEqual(moduleSizesArray, testData.moduleSizesArray);
    });

    test('get root dependencies', t => {
        rootDependencies = helpers.getRootDependencies();
        t.deepEqual(rootDependencies, testData.rootDependencies);
    });

    test('attach nested dependencies', t => {
        flatDependencies = helpers.attachNestedDependencies(rootDependencies);
        t.deepEqual(flatDependencies, testData.flatDependencies);
    });

    test('get all dependencies', t => {
        allDependencies = helpers.getAllDependencies(flatDependencies);
        t.deepEqual(allDependencies, testData.allDependencies);
    });

    test.todo('show results');
};

module.exports = tests;


text:
package rescala.fullmv.mirrors

import java.util.concurrent.ForkJoinPool.ManagedBlocker
import java.util.concurrent.atomic.{AtomicInteger, AtomicReference}
import rescala.fullmv._
import rescala.fullmv.TurnPhase.Type
import rescala.fullmv.sgt.synchronization._
import rescala.fullmv.tasks.TaskBundle

import scala.annotation.tailrec
import scala.concurrent.Future

trait FullMVTurnReflectionBundle extends FullMVBundle {
  self: Mirror with TurnImplBundle with TaskBundle with FullMvStateBundle with SubsumableLockBundle =>

  class FullMVTurnReflection(
      override val host: FullMVEngine,
      override val guid: Host.GUID,
      initialPhase: TurnPhase.Type,
      val proxy: FullMVTurnProxy
  ) extends FullMVTurn
      with SubsumableLockEntryPoint
      with FullMVTurnPhaseReflectionProxy
      with FullMVTurnPredecessorReflectionProxy
      with ManagedBlocker {
    val _phase: AtomicInteger          = new AtomicInteger(initialPhase)
    override def phase: TurnPhase.Type = _phase.get

    val predecessorIndex: AtomicReference[(Set[FullMVTurn], TransactionSpanningTreeNode[FullMVTurn], Int)] =
      new AtomicReference(null)
    override def selfNode: TransactionSpanningTreeNode[FullMVTurn] = {
      val maybeInitialized = predecessorIndex.get
      if (maybeInitialized == null) null else maybeInitialized._2
    }
    override def isTransitivePredecessor(txn: FullMVTurn): Boolean =
      (txn == this) || {
        val maybeInitialized = predecessorIndex.get
        maybeInitialized != null && maybeInitialized._1(txn)
      }

    var localBranchCountBuffer = new AtomicInteger(0)

    @volatile var predecessorSubscribed: Int = -1
    object predecessorSubscriptionParking

    override def clockedPredecessors: (TransactionSpanningTreeNode[FullMVTurn], Type) = {
      val (_, tree, clock) = predecessorIndex.get
      (tree, clock)
    }

    override def ensurePredecessorReplication(startAt: TransactionSpanningTreeNode[FullMVTurn], clock: Type): Unit = {
      val before = predecessorIndex.get
      if (
        before == null && predecessorIndex.compareAndSet(
          null,
          (FullMVTurnReflection.buildIndex(startAt), startAt, clock)
        )
      ) {
        proxy.asyncAddPredecessorReplicator(this, startAt, clock)
      }
    }

    override def isReleasable: Boolean = predecessorSubscriptionParking.synchronized { predecessorSubscribed != 0 }
    override def block(): Boolean =
      predecessorSubscriptionParking.synchronized {
        isReleasable || { predecessorSubscriptionParking.wait(); isReleasable }
      }

    override def activeBranchDifferential(forState: TurnPhase.Type, differential: Int): Unit = {
      assert(phase == forState, s"$this received branch differential for wrong state ${TurnPhase.toString(forState)}")
      assert(differential != 0, s"$this received 0 branch diff")
      assert(localBranchCountBuffer.get + differential >= 0, s"$this received branch diff into negative count")
      val before = localBranchCountBuffer.getAndAdd(differential)
      val after  = before + differential
      if (before == 0) {
        if (FullMVUtil.DEBUG)
          println(s"[${Thread.currentThread().getName}] $this reactivated locally, registering remote branch.")
        FullMVUtil.myAwait(proxy.addRemoteBranch(forState), host.timeout)
      } else if (after == 0) {
        if (FullMVUtil.DEBUG)
          println(s"[${Thread.currentThread().getName}] $this done locally, deregistering remote branch.")
        proxy.asyncRemoteBranchComplete(forState)
      }
    }

    override def newBranchFromRemote(forState: TurnPhase.Type): Unit = {
      assert(phase == forState, s"$this received branch differential for wrong state ${TurnPhase.toString(forState)}")
      if (localBranchCountBuffer.getAndIncrement() != 0) {
        if (FullMVUtil.DEBUG)
          println(
            s"[${Thread.currentThread().getName}] $this received remote branch but still active; deregistering immediately."
          )
        proxy.asyncRemoteBranchComplete(forState)
      } else {
        if (FullMVUtil.DEBUG) println(s"[${Thread.currentThread().getName}] $this (re-)activated by remote branch.")
      }
    }

    override def newPredecessors(predecessors: TransactionSpanningTreeNode[FullMVTurn], clock: Int): Future[Unit] = {
      //  override def asyncNewPredecessors(predecessors: TransactionSpanningTreeNode[FullMVTurn]): Unit = {
      if (phase < TurnPhase.Completed) {
        val newPreds = FullMVTurnReflection.buildIndex(predecessors)

        @inline
        @tailrec def retryCommitWhileNewer(): Future[Unit] = {
          val before = predecessorIndex.get
          if (before == null) {
            assert(phase == TurnPhase.Completed, s"shouldn't happen otherwise?")
            Future.unit
          } else if (before._3 < clock) {
            if (!predecessorIndex.compareAndSet(before, (newPreds, predecessors, clock))) {
              retryCommitWhileNewer()
            } else {
              if (FullMVUtil.DEBUG)
                println(s"[${Thread.currentThread().getName}] $this updated predecessors: $newPreds.")
              FullMVUtil.broadcast(predecessorReplicators.get)(_.newPredecessors(predecessors, clock))
            }
          } else {
            Future.unit
          }
        }

        retryCommitWhileNewer()
      } else {
        Future.unit
      }
    }

    @tailrec final override def asyncNewPhase(phase: TurnPhase.Type): Unit = {
      val currentPhase = _phase.get
      if (currentPhase < phase) {
        val preds = predecessorIndex.get
        if (preds != null) {
          val iterator = preds._2.iterator()
          while (iterator.hasNext) {
            val child = iterator.next().txn
            if (child.phase < phase) {
              assert(
                child.isInstanceOf[FullMVTurnReflection],
                s"$this predecessor $child has phase < ${TurnPhase.toString(phase)}, but is not a reflection (i.e., this cannot be caused by the async phase transition message being delayed)"
              )
              // this case may occur if this reflection receives a phase transition notification, but has another reflection as predecessor,
              // who's base turn did a required preceeding phase transition properly before this reflections' base, but the corresponding
              // remote notification is delayed, e.g., because it must pass through more hops.
              if (FullMVUtil.DEBUG)
                println(
                  s"[${Thread.currentThread().getName}] $this pre-empting phase transition of predecessor $child to $phase."
                )
              // we therefore can pre-empt the other reflection's message, which makes it so that phase transitions on this host appear
              // consistent with the transactions predecessor order.
              child.asInstanceOf[FullMVTurnPhaseReflectionProxy].asyncNewPhase(phase)
            }
          }
        }
        if (!_phase.compareAndSet(currentPhase, phase)) {
          asyncNewPhase(currentPhase)
        } else {
          phaseReplicators.get.foreach(_.asyncNewPhase(phase))
          if (phase == TurnPhase.Completed) {
            host.dropInstance(guid, this)
            phaseReplicators.set(null)
            predecessorReplicators.set(null)
            predecessorIndex.set(null)
          }
          wakeWaitersAfterPhaseSwitch(phase)
        }
      }
    }

    override def asyncRemoteBranchComplete(forPhase: Type): Unit         = proxy.asyncRemoteBranchComplete(forPhase)
    override def addRemoteBranch(forPhase: TurnPhase.Type): Future[Unit] = proxy.addRemoteBranch(forPhase)

    override def acquireRemoteBranchIfPhaseAtMost(maxPhase: Type): Future[TurnPhase.Type] = {
      val localOptimistic = phase
      if (localOptimistic <= maxPhase) {
        proxy.acquireRemoteBranchIfPhaseAtMost(maxPhase).map { phase =>
          asyncNewPhase(phase)
          phase
        }(FullMVUtil.notWorthToMoveToTaskpool)
      } else {
        Future.successful(localOptimistic)
      }
    }
    override def addPredecessor(tree: TransactionSpanningTreeNode[FullMVTurn]): Future[Boolean] = {
      if (tree.txn.phase == TurnPhase.Completed) {
        if (FullMVUtil.DEBUG)
          println(
            s"[${Thread.currentThread().getName}] $this aborting predecessor addition of known completed ${tree.txn}"
          )
        Future.successful(true)
      } else {
        proxy.addPredecessor(tree).map { wasNotAddedBecauseCompleted =>
          val predecessor = tree.txn
          if (wasNotAddedBecauseCompleted && predecessor.phase < TurnPhase.Completed) {
            assert(
              predecessor.isInstanceOf[FullMVTurnReflection],
              s"$this predecessor $predecessor is not completed despite the remote host saying so, but is not a reflection (i.e., this cannot be caused by the async phase transition message being delayed)"
            )
            // this case may occur if this reflection tries to add a predecessor relationship for an uncompleted parameter reflection,
            // but on this reflection's base instance's host, the parameter turn is already known completed. In this case, the predecessor
            // relation addition returns without actually broadcasting an according edge. If the caller thus queries for this
            // relation after having tried to add it, this query may fail.
            if (FullMVUtil.DEBUG)
              println(
                s"[${Thread.currentThread().getName}] $this pre-empting completion transition of predecessor $predecessor"
              )
            // to make this case work correctly, the base instance returns true if the parameter turn is known completed.
            // we then here pre-empt the not-yet arrived phase transition for the parameter turn.
            predecessor.asInstanceOf[FullMVTurnPhaseReflectionProxy].asyncNewPhase(TurnPhase.Completed)
          }
          wasNotAddedBecauseCompleted
        }(FullMVUtil.notWorthToMoveToTaskpool)
      }
    }
    override def maybeNewReachableSubtree(
        attachBelow: FullMVTurn,
        spanningSubTreeRoot: TransactionSpanningTreeNode[FullMVTurn]
    ): Future[Unit] = proxy.maybeNewReachableSubtree(attachBelow, spanningSubTreeRoot)

    override def newSuccessor(successor: FullMVTurn): Future[Unit] = proxy.newSuccessor(successor)

    override def getLockedRoot: Future[LockStateResult] = {
      if (proxy == null) {
        assert(phase == TurnPhase.Completed, s"incomplete $this without proxy?")
        CompletedState.futured
      } else
        proxy.getLockedRoot.map { res =>
          if (res == CompletedState) {
            if (SubsumableLock.DEBUG)
              println(s"[${Thread.currentThread().getName}] $this lock state result pre-empting completion transition")
            asyncNewPhase(TurnPhase.Completed)
          }
          res
        }(FullMVUtil.notWorthToMoveToTaskpool)
    }
    override def tryLock(): Future[TryLockResult] = {
      if (SubsumableLock.DEBUG) println(s"[${Thread.currentThread().getName}] $this sending tryLock request")
      proxy.remoteTryLock().map { res =>
        if (SubsumableLock.DEBUG)
          println(
            s"[${Thread.currentThread().getName}] $this received tryLock result $res (retaining remote transfer reference as thread reference)"
          )
        if (res == Deallocated) {
          if (SubsumableLock.DEBUG)
            println(s"[${Thread.currentThread().getName}] $this try lock result pre-empting completion transition")
          asyncNewPhase(TurnPhase.Completed)
        }
        res
      }(FullMVUtil.notWorthToMoveToTaskpool)
    }
    override def remoteTryLock(): Future[TryLockResult] = {
      if (SubsumableLock.DEBUG) println(s"[${Thread.currentThread().getName}] $this passing through tryLock request")
      proxy.remoteTryLock().map { res =>
        if (SubsumableLock.DEBUG)
          println(
            s"[${Thread.currentThread().getName}] $this passing through tryLock result $res (retaining remote transfer reference as thread reference)"
          )
        if (res == Deallocated) {
          if (SubsumableLock.DEBUG)
            println(
              s"[${Thread.currentThread().getName}] $this remote try lock result pre-empting completion transition"
            )
          asyncNewPhase(TurnPhase.Completed)
        }
        res
      }(FullMVUtil.notWorthToMoveToTaskpool)
    }
    override def trySubsume(lockedNewParent: SubsumableLock): Future[TrySubsumeResult] = {
      if (SubsumableLock.DEBUG)
        println(
          s"[${Thread.currentThread().getName}] $this sending trySubsume $lockedNewParent request, adding remote parameter transfer reference"
        )
      lockedNewParent.localAddRefs(1)
      proxy.remoteTrySubsume(lockedNewParent).map { res =>
        if (SubsumableLock.DEBUG)
          println(s"[${Thread.currentThread().getName}] $this received trySubsume $lockedNewParent result $res")
        if (res == Deallocated) {
          if (SubsumableLock.DEBUG)
            println(s"[${Thread.currentThread().getName}] $this try subsume result pre-empting completion transition")
          asyncNewPhase(TurnPhase.Completed)
        }
        res
      }(FullMVUtil.notWorthToMoveToTaskpool)
    }
    override def remoteTrySubsume(lockedNewParent: SubsumableLock): Future[TrySubsumeResult] = {
      if (SubsumableLock.DEBUG)
        println(
          s"[${Thread.currentThread().getName}] $this passing through trySubsume $lockedNewParent request (passing on remote parameter reference)"
        )
      proxy.remoteTrySubsume(lockedNewParent).map { res =>
        if (SubsumableLock.DEBUG)
          println(s"[${Thread.currentThread().getName}] $this passing through trySubsume $lockedNewParent result $res")
        if (res == Deallocated) {
          if (SubsumableLock.DEBUG)
            println(
              s"[${Thread.currentThread().getName}] $this remote try subsume result pre-empting completion transition"
            )
          asyncNewPhase(TurnPhase.Completed)
        }
        res
      }(FullMVUtil.notWorthToMoveToTaskpool)
    }

    override def toString: String =
      s"FullMVTurnReflection($guid on $host, ${TurnPhase.toString(phase)}${if (localBranchCountBuffer.get != 0) s"(${localBranchCountBuffer.get})"
        else ""})"
  }
}

object FullMVTurnReflection {
  def buildIndex[T](tree: TransactionSpanningTreeNode[T], accumulator: Set[T] = Set.empty[T]): Set[T] = {
    var accu = accumulator + tree.txn
    val it   = tree.iterator()
    while (it.hasNext) accu = buildIndex(it.next, accu)
    accu
  }
}


text:
from config import API_URL
import requests
import sys
import datetime
import utils
import errors

# check bathing
def check_bathing(bot, update, args):
    user_name, user_id, chat_id = utils.get_info(update)
    data = {"user_id": user_id, "group_id": chat_id}
    r = requests.post(API_URL + 'check_bathing', json=data)
    if r.status_code == 200:
        status = r.json()
        if status['bathing']:
            username, start_time = status['username'], status['start']
            output = "Oh no! You're unlucky. {} has been bathing since {}. ".format(username, start_time)
            bot.sendMessage(chat_id, text=output)
        else:
            bot.sendMessage(chat_id, text="You've hit the jackpot! No one is bathing now, as far as I know.")

    elif r.status_code == 400:
        bot.sendMessage(chat_id, text="You're in multiple groups. Please don't be shy and message in the group.")
    else:
        bot.sendMessage(chat_id, text='Unable to check. Are you sure you are registered with a group?')

def start_bathing(bot, update, args):
    user_name, user_id, chat_id = utils.get_info(update)
    data = {"user_id": user_id, "group_id": chat_id}
    r = requests.post(API_URL + 'start_bathing', json=data)
    if r.status_code == 200:
        response = r.json()
        if response["same_person"]:
            message = "You have already started bathing. Do you want to end the bathing session instead?"
        elif response["other_person"]:
            message = "Don't be an idiot. Someone else is bathing right now. "
        else:
            message = "You have started bathing, {}. The bathroom is yours!".format(user_name)
        bot.sendMessage(chat_id, text=message)
    elif r.status_code == 400:
        bot.sendMessage(chat_id, text="You're in multiple groups. Please don't be shy and message in the group.")
    else:
        bot.sendMessage(chat_id, text="Oh no, something went wrong. Please try again later.")

def stop_bathing(bot, update, args):
    user_name, user_id, chat_id = utils.get_info(update)
    data = {"user_id": user_id, "group_id": chat_id}
    r = requests.post(API_URL + 'stop_bathing', json=data)
    if r.status_code == 200:
        response = r.json()
        if not response['bathing']:
            bot.sendMessage(chat_id, text="Unable to process request. Are you sure you even started bathing?")
            return
        if response['correct_person']:
            bot.sendMessage(chat_id, text="Thanks for telling me. Hope you had a good bath!")
        else:
            bot.sendMessage(chat_id, text="Sorry, you can't end a bathing session on behalf of someone else.")
    elif r.status_code == 400:
        bot.sendMessage(chat_id, text="You're in multiple groups. Please don't be shy and message in the group.")
    else:
        bot.sendMessage(chat_id, text="Oh no, something went wrong. Please try again later.")


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Contracts\ShippingAdmin;

/**
*	Mozu.ShippingAdmin.Contracts.CustomTableRate ApiType DOCUMENT_HERE
*/
class CustomTableRate
{
	/**
	*Unique identifier of the source property, such as a catalog, discount, order, or email template.For a product field it will be the name of the field.For a category ID, must be a positive integer not greater than 2000000. By default,  auto-generates a category ID when categories are created. If you want to specify an ID during creation (which preserves category link relationships when migrating tenant data from one sandbox to another), you must also include the  query string in the endpoint. For example, . Then, use the  property to specify the desired category ID.For a product attribute it will be the Attribute FQN.For a document, the ID must be specified as a 32 character, case-insensitive, alphanumeric string. You can specify the ID as 32 sequential characters or as groups separated by dashes in the format 8-4-4-4-12. For example, or.For email templates, the ID must be one of the following values:
	*/
	public $id;

	/**
	*The type of the custom rate.
	*/
	public $rateType;

	/**
	*The value of a property, used by numerous objects within  including facets, attributes, products, localized content, metadata, capabilities ( and third-party), location inventory adjustment, and more. The value may be a string, integer, or double. Validation may be run against the entered and saved values depending on the object type.
	*/
	public $value;

	/**
	*Localizable content (such as a name and/or description) for an attribute. The content may be localized when displayed according to the locale code specified by the master catalog. Content can include descriptive text for product extensible attributes, catalog-level descriptions (displayed if isContentOverriden is true), product bundles, and customer account notes.
	*/
	public $content;

}

?>


text:
from __future__ import unicode_literals
from .. import unittest
from compose.service import Service
from compose.project import Project, NoSuchService
from compose.container import Container
from compose.const import LABEL_SERVICE

import mock
import docker

class ProjectTest(unittest.TestCase):
    def setUp(self):
        self.mock_client = mock.create_autospec(docker.Client)

    def test_from_dict(self):
        project = Project.from_dicts('composetest', [
            {
                'name': 'web',
                'image': 'busybox:latest'
            },
            {
                'name': 'db',
                'image': 'busybox:latest'
            },
        ], None)
        self.assertEqual(len(project.services), 2)
        self.assertEqual(project.get_service('web').name, 'web')
        self.assertEqual(project.get_service('web').options['image'], 'busybox:latest')
        self.assertEqual(project.get_service('db').name, 'db')
        self.assertEqual(project.get_service('db').options['image'], 'busybox:latest')

    def test_from_dict_sorts_in_dependency_order(self):
        project = Project.from_dicts('composetest', [
            {
                'name': 'web',
                'image': 'busybox:latest',
                'links': ['db'],
            },
            {
                'name': 'db',
                'image': 'busybox:latest',
                'volumes_from': ['volume']
            },
            {
                'name': 'volume',
                'image': 'busybox:latest',
                'volumes': ['/tmp'],
            }
        ], None)

        self.assertEqual(project.services[0].name, 'volume')
        self.assertEqual(project.services[1].name, 'db')
        self.assertEqual(project.services[2].name, 'web')

    def test_from_config(self):
        dicts = [
            {
                'name': 'web',
                'image': 'busybox:latest',
            },
            {
                'name': 'db',
                'image': 'busybox:latest',
            },
        ]
        project = Project.from_dicts('composetest', dicts, None)
        self.assertEqual(len(project.services), 2)
        self.assertEqual(project.get_service('web').name, 'web')
        self.assertEqual(project.get_service('web').options['image'], 'busybox:latest')
        self.assertEqual(project.get_service('db').name, 'db')
        self.assertEqual(project.get_service('db').options['image'], 'busybox:latest')

    def test_get_service(self):
        web = Service(
            project='composetest',
            name='web',
            client=None,
            image="busybox:latest",
        )
        project = Project('test', [web], None)
        self.assertEqual(project.get_service('web'), web)

    def test_get_service_not_found(self):
        project = Project('test', [], None)
        with self.assertRaises(NoSuchService):
            project.get_service('not_found')

    def test_get_services_returns_all_services_without_args(self):
        web = Service(
            project='composetest',
            name='web',
            image='foo',
        )
        console = Service(
            project='composetest',
            name='console',
            image='foo',
        )
        project = Project('test', [web, console], None)
        self.assertEqual(project.get_services(), [web, console])

    def test_get_services_returns_listed_services_with_args(self):
        web = Service(
            project='composetest',
            name='web',
            image='foo',
        )
        console = Service(
            project='composetest',
            name='console',
            image='foo',
        )
        project = Project('test', [web, console], None)
        self.assertEqual(project.get_services(['console']), [console])

    def test_get_services_with_include_links(self):
        db = Service(
            project='composetest',
            name='db',
            image='foo',
        )
        web = Service(
            project='composetest',
            name='web',
            image='foo',
            links=[(db, 'database')]
        )
        cache = Service(
            project='composetest',
            name='cache',
            image='foo'
        )
        console = Service(
            project='composetest',
            name='console',
            image='foo',
            links=[(web, 'web')]
        )
        project = Project('test', [web, db, cache, console], None)
        self.assertEqual(
            project.get_services(['console'], include_deps=True),
            [db, web, console]
        )

    def test_get_services_removes_duplicates_following_links(self):
        db = Service(
            project='composetest',
            name='db',
            image='foo',
        )
        web = Service(
            project='composetest',
            name='web',
            image='foo',
            links=[(db, 'database')]
        )
        project = Project('test', [web, db], None)
        self.assertEqual(
            project.get_services(['web', 'db'], include_deps=True),
            [db, web]
        )

    def test_use_volumes_from_container(self):
        container_id = 'aabbccddee'
        container_dict = dict(Name='aaa', Id=container_id)
        self.mock_client.inspect_container.return_value = container_dict
        project = Project.from_dicts('test', [
            {
                'name': 'test',
                'image': 'busybox:latest',
                'volumes_from': ['aaa']
            }
        ], self.mock_client)
        self.assertEqual(project.get_service('test')._get_volumes_from(), [container_id])

    def test_use_volumes_from_service_no_container(self):
        container_name = 'test_vol_1'
        self.mock_client.containers.return_value = [
            {
                "Name": container_name,
                "Names": [container_name],
                "Id": container_name,
                "Image": 'busybox:latest'
            }
        ]
        project = Project.from_dicts('test', [
            {
                'name': 'vol',
                'image': 'busybox:latest'
            },
            {
                'name': 'test',
                'image': 'busybox:latest',
                'volumes_from': ['vol']
            }
        ], self.mock_client)
        self.assertEqual(project.get_service('test')._get_volumes_from(), [container_name])

    @mock.patch.object(Service, 'containers')
    def test_use_volumes_from_service_container(self, mock_return):
        container_ids = ['aabbccddee', '12345']
        mock_return.return_value = [
            mock.Mock(id=container_id, spec=Container)
            for container_id in container_ids]

        project = Project.from_dicts('test', [
            {
                'name': 'vol',
                'image': 'busybox:latest'
            },
            {
                'name': 'test',
                'image': 'busybox:latest',
                'volumes_from': ['vol']
            }
        ], None)
        self.assertEqual(project.get_service('test')._get_volumes_from(), container_ids)

    def test_net_unset(self):
        project = Project.from_dicts('test', [
            {
                'name': 'test',
                'image': 'busybox:latest',
            }
        ], self.mock_client)
        service = project.get_service('test')
        self.assertEqual(service._get_net(), None)
        self.assertNotIn('NetworkMode', service._get_container_host_config({}))

    def test_use_net_from_container(self):
        container_id = 'aabbccddee'
        container_dict = dict(Name='aaa', Id=container_id)
        self.mock_client.inspect_container.return_value = container_dict
        project = Project.from_dicts('test', [
            {
                'name': 'test',
                'image': 'busybox:latest',
                'net': 'container:aaa'
            }
        ], self.mock_client)
        service = project.get_service('test')
        self.assertEqual(service._get_net(), 'container:' + container_id)

    def test_use_net_from_service(self):
        container_name = 'test_aaa_1'
        self.mock_client.containers.return_value = [
            {
                "Name": container_name,
                "Names": [container_name],
                "Id": container_name,
                "Image": 'busybox:latest'
            }
        ]
        project = Project.from_dicts('test', [
            {
                'name': 'aaa',
                'image': 'busybox:latest'
            },
            {
                'name': 'test',
                'image': 'busybox:latest',
                'net': 'container:aaa'
            }
        ], self.mock_client)

        service = project.get_service('test')
        self.assertEqual(service._get_net(), 'container:' + container_name)

    def test_container_without_name(self):
        self.mock_client.containers.return_value = [
            {'Image': 'busybox:latest', 'Id': '1', 'Name': '1'},
            {'Image': 'busybox:latest', 'Id': '2', 'Name': None},
            {'Image': 'busybox:latest', 'Id': '3'},
        ]
        self.mock_client.inspect_container.return_value = {
            'Id': '1',
            'Config': {
                'Labels': {
                    LABEL_SERVICE: 'web',
                },
            },
        }
        project = Project.from_dicts(
            'test',
            [{
                'name': 'web',
                'image': 'busybox:latest',
            }],
            self.mock_client,
        )
        self.assertEqual([c.id for c in project.containers()], ['1'])


text:
import pytest

import randomizer.dice as dice
import randomizer.functions as rand_functions

def test_add_ability_to_pool(filled_pool):
    assert len(filled_pool) == 3

def test_remove_ability_from_pool(pool_without_ranged):
    assert len(pool_without_ranged) == 2

def test_empty_pool(emptied_pool):
    assert len(emptied_pool) == 0

def test_pop_value_from_pool(popped_value, filled_pool, valeros_support):
    assert popped_value == valeros_support
    assert len(filled_pool) == 2

def test_get_random_ability_value(random_value_from_valeros_support,
                                  possible_valeros_support_values):
    assert random_value_from_valeros_support in possible_valeros_support_values

def test_get_sum_of_random_values_from_pool(possible_values_from_pool,
                                            sum_from_pool, filled_pool):
    assert sum_from_pool in possible_values_from_pool
    assert len(filled_pool) == 0

@pytest.fixture
def dexterity(ability_class):
    return ability_class(dice.d8, 0)

@pytest.fixture
def ranged(ability_class):
    return ability_class(dice.d8, 3)

@pytest.fixture
def valeros_support(ability_class):
    return ability_class(dice.d4, 0)

@pytest.fixture
def filled_pool(pool, ranged, valeros_support, dexterity):
    rand_functions.add_ability_to_pool(pool, dexterity)
    rand_functions.add_ability_to_pool(pool, ranged)
    rand_functions.add_ability_to_pool(pool, valeros_support)

    return pool

@pytest.fixture
def pool_without_ranged(filled_pool, ranged):
    rand_functions.remove_ability_from_pool(filled_pool, ranged)

    return filled_pool

@pytest.fixture
def emptied_pool(filled_pool):
    rand_functions.empty_pool(filled_pool)

    return filled_pool

@pytest.fixture
def popped_value(filled_pool):
    return rand_functions.pop_value_from_pool(filled_pool)

@pytest.fixture
def random_value_from_valeros_support(valeros_support):
    return rand_functions.get_random_ability_value(valeros_support)

@pytest.fixture
def possible_valeros_support_values(valeros_support):
    valeros_support_dice = valeros_support.dice + valeros_support.modifier

    return valeros_support_dice.randomDraw(sorted=True)

@pytest.fixture
def sum_from_pool(filled_pool):
    result = rand_functions.get_sum_of_random_values_from_pool(filled_pool)

    return result

@pytest.fixture
def possible_values_from_pool(filled_pool):
    sum_of_dice_values = sum([x.dice + x.modifier for x in filled_pool])

    return sum_of_dice_values.randomDraw(sorted=True)


text:
<?php
namespace Nueve\ViewPresenter;

interface PresenterInterface
{
	public function data();
}