text:
$(function() {
    "use strict";

    var OPERATION_ADD,
        USERS,
        USER_WRAPPER,
        USER;

    OPERATION_ADD = "#operation-add-user";
    USERS = ".users";
    USER_WRAPPER = ".profile-wrapper";
    USER = ".profile";
    CLASS_ACTIVE = "active";
    DURATION_EDITOR_CANCEL_EVENT = 1200;

    var hideOtherUsers = function(user) {
        $(USER).get().map(function(u) {
            if(u !== user) {
                $(u).parents(USER_WRAPPER).slideUp();
            }
        });
    };

    var revealOtherUsers = function(user) {
        $(USER).get().map(function(u) {
            if(u !== user) {
                $(u).parents(USER_WRAPPER).slideDown();
            }
        });
    };

    var configureUserEvents = function(user) {
        user.mousedown(function(event) {
            var wrapper,
                user,
                editor;

            wrapper = $(event.target).parents(USER_WRAPPER);
            user = $(event.target).parents(USER);
            editor = wrapper.find(EDITOR);

            if(!user.hasClass(CLASS_ACTIVE)) {
                user.addClass(CLASS_ACTIVE);
                hideOtherUsers(user.get(0));
                user.delay(400).animate({
                    "margin-left": "0"
                }, {
                    "complete": function() {
                        revealEditor(editor);
                    }
                });
            }
        });
    };

    var configureEditorCancelEvent = function(cancelButton) {
        cancelButton.mousedown(function(event) {
            var wrapper,
                user,
                editor;

            wrapper = $(event.target).parents(USER_WRAPPER);
            user = wrapper.find(USER);
            editor = wrapper.find(EDITOR);

            if(user.hasClass(CLASS_ACTIVE)) {
                user.removeClass(CLASS_ACTIVE);
                hideEditor(editor);
                user.delay(400).animate({
                    "margin-left": "5rem"
                }, {
                    "complete": function() {
                        revealOtherUsers(user.get(0));
                    }
                });

            }
        });
    };

    var configureEditorDeleteEvent = function(deleteButton) {
        deleteButton.mousedown(function(event) {
            var wrapper,
                cancel;

            wrapper = $(event.target).parents(USER_WRAPPER);
            cancel = wrapper.find(EDITOR_CANCEL);

            cancel
                .trigger("mousedown")
                .delay(DURATION_EDITOR_CANCEL_EVENT)
                .queue(function() {
                    wrapper.slideUp({
                        "complete": function() {
                            wrapper.remove();
                            // TODO -- delete user from database
                            // make sure that "admin" cannot be deleted
                        }
                    });
                });
        });
    };

    var configureEvents = function() {
        $(OPERATION_ADD).mousedown(function(event) {
            $.ajax({
                "url": "../../static/user-template.html",
                "success": function(template) {
                    var editor,
                        cancel,
                        deleteButton,
                        user;

                    template = $.parseHTML(template);
                    editor = $(template).find(EDITOR);
                    cancel = editor.find(EDITOR_CANCEL);
                    deleteButton = editor.find(EDITOR_DELETE);
                    user = $(template).find(USER);

                    $(template).prependTo(USERS);
                    $(template).toggle(false);
                    disableEditor(editor);
                    configureUserEvents(user);
                    configureEditorCancelEvent(cancel);
                    configureEditorDeleteEvent(deleteButton);
                    $(template).slideDown();
                }
            });
        });

        configureUserEvents($(USER));
        configureEditorCancelEvent($(EDITOR_CANCEL));
        configureEditorDeleteEvent($(EDITOR_DELETE));
    };

    var disableTextEditors = function() {
        toggleList([
            EDITOR_CANCEL,
            EDITOR_DELETE,
            EDITOR_SUBMIT
        ], false);
    };

    var initializeInterface = function() {
        disableTextEditors();
    };

    var initialize = function() {
        configureEvents();
        initializeInterface();
    };

    initialize();

    return {

    };
});


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class xmlns="http://xml.phpdox.net/src" full="CairoMatrix" namespace="" name="CairoMatrix">
  <constructor name="__construct" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Creates a new CairoMatrix object">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="xx" optional="true" byreference="false" type="object" class="float"/>
    <parameter name="yx" optional="true" byreference="false" type="object" class="float"/>
    <parameter name="xy" optional="true" byreference="false" type="object" class="float"/>
    <parameter name="yy" optional="true" byreference="false" type="object" class="float"/>
    <parameter name="x0" optional="true" byreference="false" type="object" class="float"/>
    <parameter name="y0" optional="true" byreference="false" type="object" class="float"/>
  </constructor>
  <method name="initIdentity" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Creates a new identity matrix">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
  </method>
  <method name="initRotate" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Creates a new rotated matrix">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="radians" optional="false" byreference="false" type="object" class="float"/>
  </method>
  <method name="initScale" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Creates a new scaling matrix">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="sx" optional="false" byreference="false" type="object" class="float"/>
    <parameter name="sy" optional="false" byreference="false" type="object" class="float"/>
  </method>
  <method name="initTranslate" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Creates a new translation matrix">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="tx" optional="false" byreference="false" type="object" class="float"/>
    <parameter name="ty" optional="false" byreference="false" type="object" class="float"/>
  </method>
  <method name="invert" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The invert purpose"/>
      <return type="void"/>
    </docblock>
  </method>
  <method name="multiply" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The multiply purpose"/>
      <return type="CairoMatrix"/>
    </docblock>
    <parameter name="matrix1" optional="false" byreference="false" type="object" class="CairoMatrix"/>
    <parameter name="matrix2" optional="false" byreference="false" type="object" class="CairoMatrix"/>
  </method>
  <method name="rotate" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The rotate purpose">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="sx" optional="false" byreference="false" type="string"/>
    <parameter name="sy" optional="false" byreference="false" type="string"/>
  </method>
  <method name="scale" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="Applies scaling to a matrix">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="sx" optional="false" byreference="false" type="object" class="float"/>
    <parameter name="sy" optional="false" byreference="false" type="object" class="float"/>
  </method>
  <method name="transformDistance" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The transformDistance purpose"/>
      <return type="array"/>
    </docblock>
    <parameter name="dx" optional="false" byreference="false" type="string"/>
    <parameter name="dy" optional="false" byreference="false" type="string"/>
  </method>
  <method name="transformPoint" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The transformPoint purpose"/>
      <return type="array"/>
    </docblock>
    <parameter name="dx" optional="false" byreference="false" type="string"/>
    <parameter name="dy" optional="false" byreference="false" type="string"/>
  </method>
  <method name="translate" abstract="false" static="false" visibility="public" final="false">
    <docblock>
      <description compact="The translate purpose">Object oriented style (method):</description>
      <return type="void"/>
    </docblock>
    <parameter name="tx" optional="false" byreference="false" type="string"/>
    <parameter name="ty" optional="false" byreference="false" type="string"/>
  </method>
</class>

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * @var $this \yii\web\View
 * @var $model \app\modules\store\models\StoreProduct
 */
use app\modules\store\models\StoreCategory;
use app\modules\store\models\StoreProductCartPosition;
use common\models\StoreProductAttribute;
use metalguardian\fileProcessor\helpers\FPM;
use yii\helpers\Html;
use yii\helpers\Url;

?>

    <?= $model->getCategoryBreadCrumbs(); ?> »
    <?= $model->label ?>

<?= $model->label ?>

            <?php if ($model->allImages) { ?>
                <?php $mainImageId = $model->allImages[0]->file_id ?>
                <?php $mainImageSrc = FPM::src($mainImageId, 'product', 'big') ?>
                <a href="<?= $mainImageSrc ?>" title="" class="cloud-zoom" id='zoom1' rel="adjustX: 0, adjustY:0">
                    <?= FPM::image($mainImageId, 'product', 'mainPreview') ?>

                    <a id="zoomer" class="colorbox" href="<?= $mainImageSrc ?>">+ Zoom

            <?php } ?>

        <?php if (count($model->allImages) > 1) { ?>

                        <?php foreach ($model->allImages as $image): ?>
                            <?php $imageSrc = FPM::src($image->file_id, 'product', 'big') ?>

                                <a href="<?= $imageSrc ?>" title="" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '<?= $imageSrc ?>' ">
                                    <?= FPM::image($image->file_id, 'product', 'smallPreview') ?>

                        <?php endforeach; ?>

        <?php } ?>

                    <?php if ($model->getMinPrice()) { ?>
                        <?= $model->getOldPrice() ?>
                    <?php } ?>
                    <?= $model->getMinPriceWithCurrency() ?>

            <?= \Yii::t('front', 'Product Code:') ?> <?= $model->sku ?>

            <?= \Yii::t('front', 'Availability:') ?> <?= \common\models\StoreProduct::getStatus($model->status) ?>

        <?php if ($model->getMinPrice()) { ?>

                <?= \app\modules\store\widgets\productSizes\Widget::widget(['model' => $model]) ?>

<?= \Yii::t('front', 'Qty:') ?>
                    <input class="cart-quantity" type="text" name="quantity" size="2" value="1">

                    <?php $url = StoreProductCartPosition::getCartAddUrl(['id' => $model->id, 'sizeId' => $model->productSizes[0]->id]) ?>
                    <a class="cart-add ajax-popup-link" href="<?= $url ?>" data-url="<?= $url ?>">
                        <input type="button" value="<?= \Yii::t('front', 'Add to Cart') ?>" id="button-cart" class="button">

        <?php } ?>

<?= \Yii::t('front', 'Description') ?>

            <?= $model->content ?>


text:
<?php
/**
 * ecoCart install script
 * Author: UP608985
 */

$configFile = __DIR__ . "/../api/config.inc.php";

print("<!doctype html>\n"
        . "\n"
        . "\t\n"
        . "\t\t<title>Install ecoCart</title>\n"
        . "\t\n"
        . "\t\n");

if (file_exists($configFile)) { // If the configuration file exists
    require($configFile); // Require the configuration file

    // Create database
    print("
Creating database
\n");
    $db_conn->query("CREATE DATABASE IF NOT EXISTS `ecocart` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
                    USE `ecocart`;");

    // Create tables
    print("
Creating tables
\n");
    print("\n
Creating category table...... ");
    $catStmt = $db_conn->prepare("CREATE TABLE `category` (
                                    `id` tinyint(1) NOT NULL AUTO_INCREMENT,
                                    `name` varchar(100) NOT NULL,
                                    `parent_id` bigint(20) NOT NULL,
                                    PRIMARY KEY (`id`)
                                  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");
    $catStmt->execute();
    print("done!
");

    print("\n
Creating delivery options table...... ");
    $delStmt = $db_conn->prepare("CREATE TABLE `delivery_option` (
                                    `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                    `name` varchar(100) NOT NULL,
                                    `max_weight` double NOT NULL,
                                    `eco_rating` int(11) NOT NULL,
                                    `cost` double NOT NULL,
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `id` (`id`)
                                  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");
    $delStmt->execute();
    print("done!
");

    print("\n
Creating item table...... ");
    $itemStmt = $db_conn->prepare("CREATE TABLE `item` (
                                    `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                    `cat` bigint(20) NOT NULL,
                                    `name` varchar(100) NOT NULL,
                                    `description` text NOT NULL,
                                    `weight` double NOT NULL,
                                    `featured` tinyint(1) NOT NULL,
                                    `price` double NOT NULL,
                                    `stock` int(11) NOT NULL DEFAULT '0',
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `id` (`id`)
                                  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");
    $itemStmt->execute();
    print("done!
");

    print("\n
Creating item image table...... ");
    $itemImgStmt = $db_conn->prepare("CREATE TABLE `item_image` (
                                        `item_id` int(11) NOT NULL,
                                        `image` varchar(100) NOT NULL,
                                        `main` tinyint(1) NOT NULL,
                                        PRIMARY KEY (`item_id`,`image`)
                                      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
    $itemImgStmt->execute();
    print("done!
");

    print("\n
Creating order table...... ");
    $orderStmt = $db_conn->prepare("CREATE TABLE `order` (
                                    `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                    `title` enum('Mr','Mrs','Miss','Ms','Dr') NOT NULL,
                                    `first_name` varchar(100) NOT NULL,
                                    `last_name` varchar(100) NOT NULL,
                                    `address_1` varchar(100) NOT NULL,
                                    `address_2` varchar(100) NOT NULL,
                                    `post_code` char(8) NOT NULL,
                                    `delivery` bigint(20) NOT NULL,
                                    `created` bigint(20) NOT NULL,
                                    `sent` tinyint(1) NOT NULL DEFAULT '0',
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `id` (`id`)
                                  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");
    $orderStmt->execute();
    print("done!
");

    print("\n
Creating order item table...... ");
    $orderItemStmt = $db_conn->prepare("CREATE TABLE `order_item` (
                                        `order_id` bigint(20) NOT NULL,
                                        `item_id` bigint(20) NOT NULL,
                                        `quantity` int(11) NOT NULL,
                                        PRIMARY KEY (`order_id`,`item_id`)
                                      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
    $orderItemStmt->execute();
    print("done!
");

    print("\n
Creating setting table...... ");
    $settingStmt = $db_conn->prepare("CREATE TABLE `setting` (
                                        `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                                        `name` varchar(100) NOT NULL,
                                        `value` varchar(255) NOT NULL,
                                        PRIMARY KEY (`id`),
                                        UNIQUE KEY `id` (`id`)
                                      ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");
    $settingStmt->execute();
    print("done!
");

    // Insert data
    print("\n
Inserting data...... ");
    $settingData = $db_conn->prepare("INSERT INTO `setting` (`id`, `name`, `value`) VALUES
                                        (1, 'url', 'http://localhost/608985/'),
                                        (2, 'name', 'ecoCart'),
                                        (3, 'stock_level_warning_threshold', '10'),
                                        (4, 'style-body!attr!color', '#000000'),
                                        (5, 'style-body!attr!font-family', 'roboto'),
                                        (6, 'style-!class!link!attr!color', '#00248f'),
                                        (7, 'style-!class!link:hover!attr!color', '#CCCC00'),
                                        (8, 'style-aside!id!catNav!attr!background-color', '#e5e2d9'),
                                        (9, 'style-header!id!mainHeader!attr!background-color', '#FFFFFF'),
                                        (10, 'style-!id!container!attr!background-color', 'inherit'),
                                        (11, 'style-main!attr!background-color', 'inherit'),
                                        (12, 'style-button!attr!cursor', 'pointer'),
                                        (13, 'style-button!attr!font-weight', 'bold'),
                                        (14, 'style-button!attr!border-radius', '3px'),
                                        (15, 'style-section!class!grid-item!attr!background-color', 'inherit'),
                                        (16, 'style-section!attr!background-color', 'inherit');");
    $settingData->execute();
    print("done!
");

} else { // If the configuration file doesn't exist
    die("Error: Configuration file not found, please ensure that the \"config.inc.php\" file exists under the \"api\" directory.");
}

print("\t\n"
        . "");


text:
package org.apache.hadoop.tools.contract;

import static org.apache.hadoop.fs.contract.ContractTestUtils.*;
import static org.junit.Assert.*;

import java.io.File;
import java.util.Arrays;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.contract.AbstractFSContractTestBase;
import org.apache.hadoop.fs.contract.ContractTestUtils;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.tools.DistCp;
import org.apache.hadoop.tools.DistCpOptions;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;

/**
 * Contract test suite covering a file system's integration with DistCp.  The
 * tests coordinate two file system instances: one "local", which is the local
 * file system, and the other "remote", which is the file system implementation
 * under test.  The tests in the suite cover both copying from local to remote
 * (e.g. a backup use case) and copying from remote to local (e.g. a restore use
 * case).
 */
public abstract class AbstractContractDistCpTest
    extends AbstractFSContractTestBase {

  @Rule
  public TestName testName = new TestName();

  private Configuration conf;
  private FileSystem localFS, remoteFS;
  private Path localDir, remoteDir;

  @Override
  protected Configuration createConfiguration() {
    Configuration newConf = new Configuration();
    newConf.set("mapred.job.tracker", "local");
    return newConf;
  }

  @Before
  @Override
  public void setup() throws Exception {
    super.setup();
    conf = getContract().getConf();
    localFS = FileSystem.getLocal(conf);
    remoteFS = getFileSystem();
    // Test paths are isolated by concrete subclass name and test method name.
    // All paths are fully qualified including scheme (not taking advantage of
    // default file system), so if something fails, the messages will make it
    // clear which paths are local and which paths are remote.
    Path testSubDir = new Path(getClass().getSimpleName(),
        testName.getMethodName());
    String testDirProp = System.getProperty("test.build.data",
        "target" + File.separator + "test" + File.separator + "data");
    File testDir = new File(testDirProp).getAbsoluteFile();
    localDir = localFS.makeQualified(new Path(new Path(
        testDir.toURI()), testSubDir));
    mkdirs(localFS, localDir);
    remoteDir = remoteFS.makeQualified(
        new Path(getContract().getTestPath(), testSubDir));
    mkdirs(remoteFS, remoteDir);
  }

  @Test
  public void deepDirectoryStructureToRemote() throws Exception {
    describe("copy a deep directory structure from local to remote");
    deepDirectoryStructure(localFS, localDir, remoteFS, remoteDir);
  }

  @Test
  public void largeFilesToRemote() throws Exception {
    describe("copy multiple large files from local to remote");
    largeFiles(localFS, localDir, remoteFS, remoteDir);
  }

  @Test
  public void deepDirectoryStructureFromRemote() throws Exception {
    describe("copy a deep directory structure from remote to local");
    deepDirectoryStructure(remoteFS, remoteDir, localFS, localDir);
  }

  @Test
  public void largeFilesFromRemote() throws Exception {
    describe("copy multiple large files from remote to local");
    largeFiles(remoteFS, remoteDir, localFS, localDir);
  }

  /**
   * Executes a test using a file system sub-tree with multiple nesting levels.
   *
   * @param srcFS source FileSystem
   * @param srcDir source directory
   * @param dstFS destination FileSystem
   * @param dstDir destination directory
   * @throws Exception if there is a failure
   */
  private void deepDirectoryStructure(FileSystem srcFS, Path srcDir,
      FileSystem dstFS, Path dstDir) throws Exception {
    Path inputDir = new Path(srcDir, "inputDir");
    Path inputSubDir1 = new Path(inputDir, "subDir1");
    Path inputSubDir2 = new Path(inputDir, "subDir2/subDir3");
    Path inputFile1 = new Path(inputDir, "file1");
    Path inputFile2 = new Path(inputSubDir1, "file2");
    Path inputFile3 = new Path(inputSubDir2, "file3");
    mkdirs(srcFS, inputSubDir1);
    mkdirs(srcFS, inputSubDir2);
    byte[] data1 = dataset(100, 33, 43);
    createFile(srcFS, inputFile1, true, data1);
    byte[] data2 = dataset(200, 43, 53);
    createFile(srcFS, inputFile2, true, data2);
    byte[] data3 = dataset(300, 53, 63);
    createFile(srcFS, inputFile3, true, data3);
    Path target = new Path(dstDir, "outputDir");
    runDistCp(inputDir, target);
    ContractTestUtils.assertIsDirectory(dstFS, target);
    verifyFileContents(dstFS, new Path(target, "inputDir/file1"), data1);
    verifyFileContents(dstFS,
        new Path(target, "inputDir/subDir1/file2"), data2);
    verifyFileContents(dstFS,
        new Path(target, "inputDir/subDir2/subDir3/file3"), data3);
  }

  /**
   * Executes a test using multiple large files.
   *
   * @param srcFS source FileSystem
   * @param srcDir source directory
   * @param dstFS destination FileSystem
   * @param dstDir destination directory
   * @throws Exception if there is a failure
   */
  private void largeFiles(FileSystem srcFS, Path srcDir, FileSystem dstFS,
      Path dstDir) throws Exception {
    Path inputDir = new Path(srcDir, "inputDir");
    Path inputFile1 = new Path(inputDir, "file1");
    Path inputFile2 = new Path(inputDir, "file2");
    Path inputFile3 = new Path(inputDir, "file3");
    mkdirs(srcFS, inputDir);
    int fileSizeKb = conf.getInt("scale.test.distcp.file.size.kb", 10 * 1024);
    int fileSizeMb = fileSizeKb / 1024;
    getLog().info("{} with file size {}", testName.getMethodName(), fileSizeMb);
    byte[] data1 = dataset((fileSizeMb + 1) * 1024 * 1024, 33, 43);
    createFile(srcFS, inputFile1, true, data1);
    byte[] data2 = dataset((fileSizeMb + 2) * 1024 * 1024, 43, 53);
    createFile(srcFS, inputFile2, true, data2);
    byte[] data3 = dataset((fileSizeMb + 3) * 1024 * 1024, 53, 63);
    createFile(srcFS, inputFile3, true, data3);
    Path target = new Path(dstDir, "outputDir");
    runDistCp(inputDir, target);
    ContractTestUtils.assertIsDirectory(dstFS, target);
    verifyFileContents(dstFS, new Path(target, "inputDir/file1"), data1);
    verifyFileContents(dstFS, new Path(target, "inputDir/file2"), data2);
    verifyFileContents(dstFS, new Path(target, "inputDir/file3"), data3);
  }

  /**
   * Executes DistCp and asserts that the job finished successfully.
   *
   * @param src source path
   * @param dst destination path
   * @throws Exception if there is a failure
   */
  private void runDistCp(Path src, Path dst) throws Exception {
    DistCpOptions options = new DistCpOptions(Arrays.asList(src), dst);
    Job job = new DistCp(conf, options).execute();
    assertNotNull("Unexpected null job returned from DistCp execution.", job);
    assertTrue("DistCp job did not complete.", job.isComplete());
    assertTrue("DistCp job did not complete successfully.", job.isSuccessful());
  }

  /**
   * Creates a directory and any ancestor directories required.
   *
   * @param fs FileSystem in which to create directories
   * @param dir path of directory to create
   * @throws Exception if there is a failure
   */
  private static void mkdirs(FileSystem fs, Path dir) throws Exception {
    assertTrue("Failed to mkdir " + dir, fs.mkdirs(dir));
  }
}


text:
/*
 NOTE: plugman/cordova cli should have already installed this,
 but you need the value UIViewControllerBasedStatusBarAppearance
 in your Info.plist as well to set the styles in iOS 7
 */

#import "CDVStatusBar.h"
#import <objc/runtime.h>
#import <Cordova/CDVViewController.h>

static const void *kHideStatusBar = &kHideStatusBar;
static const void *kStatusBarStyle = &kStatusBarStyle;

@interface CDVViewController (StatusBar)

@property (nonatomic, retain) id sb_hideStatusBar;
@property (nonatomic, retain) id sb_statusBarStyle;

@end

@implementation CDVViewController (StatusBar)

@dynamic sb_hideStatusBar;
@dynamic sb_statusBarStyle;

- (id)sb_hideStatusBar {
    return objc_getAssociatedObject(self, kHideStatusBar);
}

- (void)setSb_hideStatusBar:(id)newHideStatusBar {
    objc_setAssociatedObject(self, kHideStatusBar, newHideStatusBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (id)sb_statusBarStyle {
    return objc_getAssociatedObject(self, kStatusBarStyle);
}

- (void)setSb_statusBarStyle:(id)newStatusBarStyle {
    objc_setAssociatedObject(self, kStatusBarStyle, newStatusBarStyle, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (BOOL) prefersStatusBarHidden {
    return [self.sb_hideStatusBar boolValue];
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return (UIStatusBarStyle)[self.sb_statusBarStyle intValue];
}

@end

@implementation CDVStatusBar

- (id)settingForKey:(NSString*)key
{
    return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
}

- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
{
    if ([keyPath isEqual:@"statusBarHidden"]) {
        NSNumber* newValue = [change objectForKey:NSKeyValueChangeNewKey];
        BOOL boolValue = [newValue boolValue];

        [self.commandDelegate evalJs:[NSString stringWithFormat:@"StatusBar.isVisible = %@;", boolValue? @"false" : @"true" ]];
    }
}

- (void)pluginInitialize
{
    BOOL isiOS7 = (IsAtLeastiOSVersion(@"7.0"));

    // init
    NSNumber* uiviewControllerBasedStatusBarAppearance = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"];
    _uiviewControllerBasedStatusBarAppearance = (uiviewControllerBasedStatusBarAppearance == nil || [uiviewControllerBasedStatusBarAppearance boolValue]) && isiOS7;

    // observe the statusBarHidden property
    [[UIApplication sharedApplication] addObserver:self forKeyPath:@"statusBarHidden" options:NSKeyValueObservingOptionNew context:NULL];

    _statusBarOverlaysWebView = YES; // default

    [self initializeStatusBarBackgroundView];

    self.viewController.view.autoresizesSubviews = YES;

    NSString* setting;

    setting  = @"StatusBarOverlaysWebView";
    if ([self settingForKey:setting]) {
        self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue];
    }

    setting  = @"StatusBarBackgroundColor";
    if ([self settingForKey:setting]) {
        [self _backgroundColorByHexString:[self settingForKey:setting]];
    }

    setting  = @"StatusBarStyle";
    if ([self settingForKey:setting]) {
        [self setStatusBarStyle:[self settingForKey:setting]];
    }
}

- (void) _ready:(CDVInvokedUrlCommand*)command
{
    // set the initial value
    [self.commandDelegate evalJs:[NSString stringWithFormat:@"StatusBar.isVisible = %@;", [UIApplication sharedApplication].statusBarHidden? @"false" : @"true" ]];
}

- (void) initializeStatusBarBackgroundView
{
    CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
    if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
        // swap width and height. set origin to zero
        statusBarFrame = CGRectMake(0, 0, statusBarFrame.size.height, statusBarFrame.size.width);
    }

    _statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame];
    _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
    _statusBarBackgroundView.autoresizingMask = (UIViewAutoresizingFlexibleWidth  | UIViewAutoresizingFlexibleBottomMargin);
    _statusBarBackgroundView.autoresizesSubviews = YES;
}

- (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView
{
    // we only care about the latest iOS version or a change in setting
    if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) {
        return;
    }

    CGRect bounds = [[UIScreen mainScreen] bounds];

    if (statusBarOverlaysWebView) {

        [_statusBarBackgroundView removeFromSuperview];
        if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
            self.webView.frame = CGRectMake(0, 0, bounds.size.height, bounds.size.width);
        } else {
            self.webView.frame = bounds;
        }

    } else {

        CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;

        [self initializeStatusBarBackgroundView];

        CGRect frame = self.webView.frame;

        if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
            frame.origin.y = statusBarFrame.size.width;
            frame.size.height -= statusBarFrame.size.width;
        } else {
            frame.origin.y = statusBarFrame.size.height;
            frame.size.height -= statusBarFrame.size.height;
        }

        self.webView.frame = frame;
        [self.webView.superview addSubview:_statusBarBackgroundView];
    }

    _statusBarOverlaysWebView = statusBarOverlaysWebView;
}

- (BOOL) statusBarOverlaysWebView
{
    return _statusBarOverlaysWebView;
}

- (void) overlaysWebView:(CDVInvokedUrlCommand*)command
{
    id value = [command.arguments objectAtIndex:0];
    if (!([value isKindOfClass:[NSNumber class]])) {
        value = [NSNumber numberWithBool:YES];
    }

    self.statusBarOverlaysWebView = [value boolValue];
}

- (void) refreshStatusBarAppearance
{
    SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
    if ([self.viewController respondsToSelector:sel]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
        [self.viewController performSelector:sel withObject:nil];
#pragma clang diagnostic pop
    }
}

- (void) setStyleForStatusBar:(UIStatusBarStyle)style
{
    if (_uiviewControllerBasedStatusBarAppearance) {
        CDVViewController* vc = (CDVViewController*)self.viewController;
        vc.sb_statusBarStyle = [NSNumber numberWithInt:style];
        [self refreshStatusBarAppearance];

    } else {
        [[UIApplication sharedApplication] setStatusBarStyle:style];
    }
}

- (void) setStatusBarStyle:(NSString*)statusBarStyle
{
    // default, lightContent, blackTranslucent, blackOpaque
    NSString* lcStatusBarStyle = [statusBarStyle lowercaseString];

    if ([lcStatusBarStyle isEqualToString:@"default"]) {
        [self styleDefault:nil];
    } else if ([lcStatusBarStyle isEqualToString:@"lightcontent"]) {
        [self styleLightContent:nil];
    } else if ([lcStatusBarStyle isEqualToString:@"blacktranslucent"]) {
        [self styleBlackTranslucent:nil];
    } else if ([lcStatusBarStyle isEqualToString:@"blackopaque"]) {
        [self styleBlackOpaque:nil];
    }
}

- (void) styleDefault:(CDVInvokedUrlCommand*)command
{
    [self setStyleForStatusBar:UIStatusBarStyleDefault];
}

- (void) styleLightContent:(CDVInvokedUrlCommand*)command
{
    [self setStyleForStatusBar:UIStatusBarStyleLightContent];
}

- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command
{
    [self setStyleForStatusBar:UIStatusBarStyleBlackTranslucent];
}

- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command
{
    [self setStyleForStatusBar:UIStatusBarStyleBlackOpaque];
}

- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command
{
    id value = [command.arguments objectAtIndex:0];
    if (!([value isKindOfClass:[NSString class]])) {
        value = @"black";
    }

    SEL selector = NSSelectorFromString([value stringByAppendingString:@"Color"]);
    if ([UIColor respondsToSelector:selector]) {
        _statusBarBackgroundView.backgroundColor = [UIColor performSelector:selector];
    }
}

- (void) _backgroundColorByHexString:(NSString*)hexString
{
    unsigned int rgbValue = 0;
    NSScanner* scanner = [NSScanner scannerWithString:hexString];
    [scanner setScanLocation:1];
    [scanner scanHexInt:&rgbValue];

    _statusBarBackgroundColor = [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
    _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
}

- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command
{
    NSString* value = [command.arguments objectAtIndex:0];
    if (!([value isKindOfClass:[NSString class]])) {
        value = @"#000000";
    }

    if (![value hasPrefix:@"#"] || [value length] < 7) {
        return;
    }

    [self _backgroundColorByHexString:value];
}

- (void) hideStatusBar
{
    if (_uiviewControllerBasedStatusBarAppearance) {
        CDVViewController* vc = (CDVViewController*)self.viewController;
        vc.sb_hideStatusBar = [NSNumber numberWithBool:YES];
        [self refreshStatusBarAppearance];

    } else {
        UIApplication* app = [UIApplication sharedApplication];
        [app setStatusBarHidden:YES];
    }
}

- (void) hide:(CDVInvokedUrlCommand*)command
{
    UIApplication* app = [UIApplication sharedApplication];

    if (!app.isStatusBarHidden)
    {
        self.viewController.wantsFullScreenLayout = YES;
        CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;

        [self hideStatusBar];

        if (IsAtLeastiOSVersion(@"7.0")) {
            [_statusBarBackgroundView removeFromSuperview];
        }

        if (!_statusBarOverlaysWebView) {

            CGRect frame = self.webView.frame;
            frame.origin.y = 0;

            if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
                frame.size.height += statusBarFrame.size.width;
            } else {
                frame.size.height += statusBarFrame.size.height;
            }

            self.webView.frame = frame;
        }

        _statusBarBackgroundView.hidden = YES;
    }
}

- (void) showStatusBar
{
    if (_uiviewControllerBasedStatusBarAppearance) {
        CDVViewController* vc = (CDVViewController*)self.viewController;
        vc.sb_hideStatusBar = [NSNumber numberWithBool:NO];
        [self refreshStatusBarAppearance];

    } else {
        UIApplication* app = [UIApplication sharedApplication];
        [app setStatusBarHidden:NO];
    }
}

- (void) show:(CDVInvokedUrlCommand*)command
{
    UIApplication* app = [UIApplication sharedApplication];

    if (app.isStatusBarHidden)
    {
        BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
        self.viewController.wantsFullScreenLayout = isIOS7;

        [self showStatusBar];

        if (isIOS7) {
            CGRect frame = self.webView.frame;
            self.viewController.view.frame = [[UIScreen mainScreen] bounds];

            CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;

            if (!self.statusBarOverlaysWebView) {

                // there is a possibility that when the statusbar was hidden, it was in a different orientation
                // from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
                // statusBar's current size
                CGRect sbBgFrame = _statusBarBackgroundView.frame;

                if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
                    frame.origin.y = statusBarFrame.size.width;
                    frame.size.height -= statusBarFrame.size.width;
                    sbBgFrame.size = CGSizeMake(statusBarFrame.size.height, statusBarFrame.size.width);
                } else {
                    frame.origin.y = statusBarFrame.size.height;
                    frame.size.height -= statusBarFrame.size.height;
                    sbBgFrame.size = statusBarFrame.size;
                }

                _statusBarBackgroundView.frame = sbBgFrame;
                [self.webView.superview addSubview:_statusBarBackgroundView];
            }

            self.webView.frame = frame;

        } else {

            CGRect bounds = [[UIScreen mainScreen] applicationFrame];
            self.viewController.view.frame = bounds;
        }

        _statusBarBackgroundView.hidden = NO;
    }
}

- (void) dealloc
{
    [[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"];
}

@end


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Enum. hort. berol. alt. 2:27. 1822 "<I>rugulosum</I>"

#### Original name
null

### Remarks
null


text:
<?php

/* api status codes */
define("AUTH_FAILURE", "401");
define("AUTH_SUCCESS", "200");
define("PARA_FAILURE", "400");
define("ROUT_FAILURE", "405");
define("USER_FAILURE", "444");
define("PASS_FAILURE", "445");


text:
// Copyright 2016 Twitter. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.twitter.heron.simulator.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.twitter.heron.api.Config;
import com.twitter.heron.api.generated.TopologyAPI;
import com.twitter.heron.proto.system.PhysicalPlans;

public final class PhysicalPlanUtil {

  private PhysicalPlanUtil() {
  }

  /**
   * Want get a PhysicalPlan basing the topology given.
   * It would contain one fake stream mgr/container info. And all instances would be belong to
   * this container.
   *
   * @param topology The topology protobuf given
   * @return Physical Plan containing this topology
   */
  public static PhysicalPlans.PhysicalPlan getPhysicalPlan(TopologyAPI.Topology topology) {
    PhysicalPlans.PhysicalPlan.Builder pPlanBuilder = PhysicalPlans.PhysicalPlan.newBuilder();

    // Add the topology
    pPlanBuilder.setTopology(topology);

    // Add fake stream mgr
    PhysicalPlans.StMgr stMgr = PhysicalPlans.StMgr.newBuilder().
        setId("").setHostName("").setDataPort(-1).setLocalEndpoint("").setCwd("").build();
    pPlanBuilder.addStmgrs(stMgr);

    // Add instances
    int globalTaskIndex = 1;
    for (Map.Entry<String, Integer> componentParallelism
        : getComponentParallelism(topology).entrySet()) {
      String componentName = componentParallelism.getKey();
      int parallelism = componentParallelism.getValue();

      int componentIndex = 1;
      for (int i = 0; i < parallelism; i++) {
        PhysicalPlans.InstanceInfo instanceInfo =
            PhysicalPlans.InstanceInfo.newBuilder().
                setComponentName(componentName).
                setTaskId(globalTaskIndex).
                setComponentIndex(componentIndex).
                build();

        PhysicalPlans.Instance instance =
            PhysicalPlans.Instance.newBuilder().
                setStmgrId("").
                setInstanceId(String.format("%s_%s", componentName, componentIndex)).
                setInfo(instanceInfo).build();

        pPlanBuilder.addInstances(instance);

        componentIndex++;
        globalTaskIndex++;
      }
    }

    return pPlanBuilder.build();
  }

  /**
   * Get the map <componentId -> taskIds> from the Physical Plan given
   *
   * @param physicalPlan the given Physical Plan
   * @return the map from componentId to its task ids
   */
  public static Map<String, List<Integer>> getComponentToTaskIds(
      PhysicalPlans.PhysicalPlan physicalPlan) {
    Map<String, List<Integer>> componentToTaskIds =
        new HashMap<>();

    // Iterate over all instances and insert necessary info into the map
    for (PhysicalPlans.Instance instance : physicalPlan.getInstancesList()) {
      int taskId = instance.getInfo().getTaskId();
      String componentName = instance.getInfo().getComponentName();

      if (!componentToTaskIds.containsKey(componentName)) {
        componentToTaskIds.put(componentName, new ArrayList<Integer>());
      }

      componentToTaskIds.get(componentName).add(taskId);
    }

    return componentToTaskIds;
  }

  /**
   * Extract the config value "topology.message.timeout.secs" for given topology protobuf
   *
   * @param topology The given topology protobuf
   * @return the config value of "topology.message.timeout.secs"
   */
  public static int extractTopologyTimeout(TopologyAPI.Topology topology) {
    for (TopologyAPI.Config.KeyValue keyValue : topology.getTopologyConfig().getKvsList()) {
      if (keyValue.getKey().equals("topology.message.timeout.secs")) {
        return Integer.parseInt(keyValue.getValue());
      }
    }

    throw new IllegalArgumentException("topology.message.timeout.secs does not exist");
  }

  // TODO(mfu): put it into api package, since it is used by also scheduler package
  public static Map<String, Integer> getComponentParallelism(TopologyAPI.Topology topology) {
    Map<String, Integer> parallelismMap = new HashMap<>();
    for (TopologyAPI.Spout spout : topology.getSpoutsList()) {
      String componentName = spout.getComp().getName();
      String parallelism = getConfigWithException(
          spout.getComp().getConfig().getKvsList(), Config.TOPOLOGY_COMPONENT_PARALLELISM).trim();
      parallelismMap.put(componentName, Integer.parseInt(parallelism));
    }
    for (TopologyAPI.Bolt bolt : topology.getBoltsList()) {
      String componentName = bolt.getComp().getName();
      String parallelism = getConfigWithException(
          bolt.getComp().getConfig().getKvsList(), Config.TOPOLOGY_COMPONENT_PARALLELISM).trim();
      parallelismMap.put(componentName, Integer.parseInt(parallelism));
    }
    return parallelismMap;
  }

  // TODO(mfu): put it into api package, since it is used by also scheduler package

  public static String getConfigWithException(
      List<TopologyAPI.Config.KeyValue> config, String key) {
    for (TopologyAPI.Config.KeyValue kv : config) {
      if (kv.getKey().equals(key)) {
        return kv.getValue();
      }
    }
    throw new RuntimeException("Missing config for required key " + key);
  }
}


text:
<?php

/**
 * An ID MIME Header for something like Message-ID or Content-ID.
 * @package Swift
 * @subpackage Mime
 * @author Chris Corbyn
 */
class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_AbstractHeader {

	/**
	 * The IDs used in the value of this Header.
	 * This may hold multiple IDs or just a single ID.
	 * @var string[]
	 * @access private
	 */
	private $_ids = array();

	/**
	 * Creates a new IdentificationHeader with the given $name and $id.
	 * @param string $name
	 * @param Swift_Mime_Grammar $grammar
	 */
	public function __construct($name, Swift_Mime_Grammar $grammar) {
		$this->setFieldName($name);
		parent::__construct($grammar);
	}

	/**
	 * Get the type of Header that this instance represents.
	 * @return int
	 * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
	 * @see TYPE_DATE, TYPE_ID, TYPE_PATH
	 */
	public function getFieldType() {
		return self::TYPE_ID;
	}

	/**
	 * Set the model for the field body.
	 * This method takes a string ID, or an array of IDs
	 * @param mixed $model
	 * @throws Swift_RfcComplianceException
	 */
	public function setFieldBodyModel($model) {
		$this->setId($model);
	}

	/**
	 * Get the model for the field body.
	 * This method returns an array of IDs
	 * @return array
	 */
	public function getFieldBodyModel() {
		return $this->getIds();
	}

	/**
	 * Set the ID used in the value of this header.
	 * @param string $id
	 * @throws Swift_RfcComplianceException
	 */
	public function setId($id) {
		$this->setIds(array($id));
	}

	/**
	 * Get the ID used in the value of this Header.
	 * If multiple IDs are set only the first is returned.
	 * @return string
	 */
	public function getId() {
		if (count($this->_ids) > 0) {
			return $this->_ids[0];
		}
	}

	/**
	 * Set a collection of IDs to use in the value of this Header.
	 * @param string[] $ids
	 * @throws Swift_RfcComplianceException
	 */
	public function setIds(array $ids) {
		$actualIds = array();

		foreach ($ids as $k => $id) {
			$this->_assertValidId($id);
			$actualIds[] = $id;
		}

		$this->clearCachedValueIf($this->_ids != $actualIds);
		$this->_ids = $actualIds;
	}

	/**
	 * Get the list of IDs used in this Header.
	 * @return string[]
	 */
	public function getIds() {
		return $this->_ids;
	}

	/**
	 * Get the string value of the body in this Header.
	 * This is not necessarily RFC 2822 compliant since folding white space will
	 * not be added at this stage (see {@link toString()} for that).
	 * @return string
	 * @see toString()
	 * @throws Swift_RfcComplianceException
	 */
	public function getFieldBody() {
		if (!$this->getCachedValue()) {
			$angleAddrs = array();

			foreach ($this->_ids as $id) {
				$angleAddrs[] = '<' . $id . '>';
			}

			$this->setCachedValue(implode(' ', $angleAddrs));
		}
		return $this->getCachedValue();
	}

	/**
	 * Throws an Exception if the id passed does not comply with RFC 2822.
	 * @param string $id
	 * @throws Swift_RfcComplianceException
	 */
	private function _assertValidId($id) {
		if (!preg_match('/^' . $this->getGrammar()->getDefinition('id-left') . '@' . $this->getGrammar()->getDefinition('id-right') . '$/D', $id)) {
			throw new Swift_RfcComplianceException('Invalid ID given <' . $id . '>');
		}
	}
}


text: void unset_trace();