text:
package com.vaadin.data.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;

import org.junit.Test;

import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;

public class HierarchicalContainerTest extends
        AbstractHierarchicalContainerTestBase {

    @Test
    public void testBasicOperations() {
        testBasicContainerOperations(new HierarchicalContainer());
    }

    @Test
    public void testFiltering() {
        testContainerFiltering(new HierarchicalContainer());
    }

    @Test
    public void testSorting() {
        testContainerSorting(new HierarchicalContainer());
    }

    @Test
    public void testOrdered() {
        testContainerOrdered(new HierarchicalContainer());
    }

    @Test
    public void testHierarchicalSorting() {
        testHierarchicalSorting(new HierarchicalContainer());
    }

    @Test
    public void testSortingAndFiltering() {
        testContainerSortingAndFiltering(new HierarchicalContainer());
    }

    @Test
    public void testRemovingItemsFromFilteredContainer() {
        HierarchicalContainer container = new HierarchicalContainer();
        initializeContainer(container);
        container.setIncludeParentsWhenFiltering(true);
        container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);
        Object p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com.vaadin.ui", p1);

        container.removeItem("com.vaadin.ui.TabSheet");
        // Parent for the removed item must be null because the item is no
        // longer in the container
        p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertNull("Parent should be null, is " + p1, p1);

        container.removeAllItems();
        p1 = container.getParent("com.vaadin.terminal.gwt.client.Focusable");
        assertNull("Parent should be null, is " + p1, p1);

    }

    @Test
    public void testParentWhenRemovingFilterFromContainer() {
        HierarchicalContainer container = new HierarchicalContainer();
        initializeContainer(container);
        container.setIncludeParentsWhenFiltering(true);
        container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);
        Object p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com.vaadin.ui", p1);
        p1 = container
                .getParent("com.vaadin.terminal.gwt.client.ui.VPopupCalendar");
        assertNull(p1);
        container.removeAllContainerFilters();
        p1 = container
                .getParent("com.vaadin.terminal.gwt.client.ui.VPopupCalendar");
        assertEquals("com.vaadin.terminal.gwt.client.ui", p1);

    }

    @Test
    public void testChangeParentInFilteredContainer() {
        HierarchicalContainer container = new HierarchicalContainer();
        initializeContainer(container);
        container.setIncludeParentsWhenFiltering(true);
        container.addContainerFilter(FULLY_QUALIFIED_NAME, "Tab", false, false);

        // Change parent of filtered item
        Object p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com.vaadin.ui", p1);
        container.setParent("com.vaadin.ui.TabSheet", "com.vaadin");
        p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com.vaadin", p1);
        container.setParent("com.vaadin.ui.TabSheet", "com");
        p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com", p1);
        container.setParent("com.vaadin.ui.TabSheet", null);
        p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertNull(p1);

        // root -> non-root
        container.setParent("com.vaadin.ui.TabSheet", "com");
        p1 = container.getParent("com.vaadin.ui.TabSheet");
        assertEquals("com", p1);

    }

    @Test
    public void testHierarchicalFilteringWithParents() {
        HierarchicalContainer container = new HierarchicalContainer();
        initializeContainer(container);
        container.setIncludeParentsWhenFiltering(true);

        // Filter by "contains ab"
        container.addContainerFilter(FULLY_QUALIFIED_NAME, "ab", false, false);

        // 20 items match the filters and the have 8 parents that should also be
        // included
        // only one root "com" should exist
        // filtered
        int expectedSize = 29;
        int expectedRoots = 1;

        validateHierarchicalContainer(container, "com",
                "com.vaadin.ui.TabSheet",
                "com.vaadin.terminal.gwt.client.Focusable", "blah", true,
                expectedSize, expectedRoots, true);

        // only include .gwt.client classes
        container.removeAllContainerFilters();
        container.addContainerFilter(FULLY_QUALIFIED_NAME, ".gwt.client.",
                false, false);

        int packages = 6;
        int classes = 112;

        expectedSize = packages + classes;
        expectedRoots = 1;

        validateHierarchicalContainer(container, "com",
                "com.vaadin.terminal.gwt.client.WidgetSet",
                "com.vaadin.terminal.gwt.client.ui.VSplitPanelVertical",
                "blah", true, expectedSize, expectedRoots, true);

        // Additionally remove all without 'm' in the simple name.
        container.addContainerFilter(SIMPLE_NAME, "m", false, false);

        expectedSize = 7 + 18;
        expectedRoots = 1;

        validateHierarchicalContainer(
                container,
                "com",
                "com.vaadin.terminal.gwt.client.ui.VUriFragmentUtility",
                "com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer",
                "blah", true, expectedSize, expectedRoots, true);

    }

    @Test
    public void testRemoveLastChild() {
        HierarchicalContainer c = new HierarchicalContainer();

        c.addItem("root");
        assertEquals(false, c.hasChildren("root"));

        c.addItem("child");
        c.setParent("child", "root");
        assertEquals(true, c.hasChildren("root"));

        c.removeItem("child");
        assertFalse(c.containsId("child"));
        assertNull(c.getChildren("root"));
        assertNull(c.getChildren("child"));
        assertFalse(c.hasChildren("child"));
        assertFalse(c.hasChildren("root"));
    }

    @Test
    public void testRemoveLastChildFromFiltered() {
        HierarchicalContainer c = new HierarchicalContainer();

        c.addItem("root");
        assertEquals(false, c.hasChildren("root"));

        c.addItem("child");
        c.setParent("child", "root");
        assertEquals(true, c.hasChildren("root"));

        // Dummy filter that does not remove any items
        c.addContainerFilter(new Filter() {

            @Override
            public boolean passesFilter(Object itemId, Item item)
                    throws UnsupportedOperationException {
                return true;
            }

            @Override
            public boolean appliesToProperty(Object propertyId) {
                return true;
            }
        });
        c.removeItem("child");

        assertFalse(c.containsId("child"));
        assertNull(c.getChildren("root"));
        assertNull(c.getChildren("child"));
        assertFalse(c.hasChildren("child"));
        assertFalse(c.hasChildren("root"));
    }

    @Test
    public void testHierarchicalFilteringWithoutParents() {
        HierarchicalContainer container = new HierarchicalContainer();

        initializeContainer(container);
        container.setIncludeParentsWhenFiltering(false);

        // Filter by "contains ab"
        container.addContainerFilter(SIMPLE_NAME, "ab", false, false);

        // 20 items match the filter.
        // com.vaadin.data.BufferedValidatable
        // com.vaadin.data.Validatable
        // com.vaadin.terminal.gwt.client.Focusable
        // com.vaadin.terminal.gwt.client.Paintable
        // com.vaadin.terminal.gwt.client.ui.Table
        // com.vaadin.terminal.gwt.client.ui.VLabel
        // com.vaadin.terminal.gwt.client.ui.VScrollTable
        // com.vaadin.terminal.gwt.client.ui.VTablePaging
        // com.vaadin.terminal.gwt.client.ui.VTabsheet
        // com.vaadin.terminal.gwt.client.ui.VTabsheetBase
        // com.vaadin.terminal.gwt.client.ui.VTabsheetPanel
        // com.vaadin.server.ChangeVariablesErrorEvent
        // com.vaadin.server.Paintable
        // com.vaadin.server.Scrollable
        // com.vaadin.server.Sizeable
        // com.vaadin.server.VariableOwner
        // com.vaadin.ui.Label
        // com.vaadin.ui.Table
        // com.vaadin.ui.TableFieldFactory
        // com.vaadin.ui.TabSheet
        // all become roots.
        int expectedSize = 20;
        int expectedRoots = 20;

        validateHierarchicalContainer(container,
                "com.vaadin.data.BufferedValidatable",
                "com.vaadin.ui.TabSheet",
                "com.vaadin.terminal.gwt.client.ui.VTabsheetBase", "blah",
                true, expectedSize, expectedRoots, false);

        // only include .gwt.client classes
        container.removeAllContainerFilters();
        container.addContainerFilter(FULLY_QUALIFIED_NAME, ".gwt.client.",
                false, false);

        int packages = 3;
        int classes = 110;

        expectedSize = packages + classes;
        expectedRoots = 35 + 1; // com.vaadin.terminal.gwt.client.ui +
        // com.vaadin.terminal.gwt.client.*

        // Sorting is case insensitive
        validateHierarchicalContainer(container,
                "com.vaadin.terminal.gwt.client.ApplicationConfiguration",
                "com.vaadin.terminal.gwt.client.WidgetSet",
                "com.vaadin.terminal.gwt.client.ui.VOptionGroup", "blah", true,
                expectedSize, expectedRoots, false);

        // Additionally remove all without 'P' in the simple name.
        container.addContainerFilter(SIMPLE_NAME, "P", false, false);

        expectedSize = 13;
        expectedRoots = expectedSize;

        validateHierarchicalContainer(container,
                "com.vaadin.terminal.gwt.client.Paintable",
                "com.vaadin.terminal.gwt.client.ui.VTabsheetPanel",
                "com.vaadin.terminal.gwt.client.ui.VPopupCalendar", "blah",
                true, expectedSize, expectedRoots, false);

    }
}


text:
import SearchContainer from '../../containers/SearchContainer'

export default [
  {
    path: '/find',
    redirect: true,
    slug: false,
    pathname: '/search',
  },
  {
    path: '/search',
    component: SearchContainer,
  },
]

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Mparaiso\Doctrine\ORM;

use Doctrine\ORM\EntityManager;
use ReflectionObject;
use Symfony\Component\Yaml\Yaml;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Load Fixtures from a yaml resource
 */
class FixtureLoader {

    private $entities;
    private $resource;
    private $rawData;

    function __construct($resource) {
        $this->resource = $resource;
        $this->entities = array();
    }

    function getEntities() {
        return $this->entities;
    }

    function ParseDatesAsDateTime($bool) {
        $this->asDateTime = $bool;
    }

    function parse() {
        Yaml::enablePhpParsing();
        # parse yaml datas
        $this->rawData = Yaml::parse($this->resource, true, true);
        $config_values = array_merge($this->rawData);
        # pour chaque fixture
        foreach ($config_values['fixtures'] as $entity_def) {
            # obtenir la classe
            $class = $entity_def['entity'];
            /* @note @php changer une propriété privée d'un champ */
            # instancier la classe
            //$prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($class), $class));
            $entity = new $class; //clone $prototype;
            $ref = new ReflectionObject($entity);
            # pour chaque champ du fixture
            foreach ($entity_def['fields'] as $field => $value) {
                # si la valeur est un tableau
                if (is_array($value)) {
                    # si la valeur est du time datetime
                    if (isset($value['datetime'])) {
                        $value = \DateTime::createFromFormat('U', $value['datetime']);
                    } else {
                        $tmp = new ArrayCollection;
                        # pour chaque valeur du tableau
                        foreach ($value as $name) {
                            # réferencer l'entité déja instanciée dans le tableau
                            $tmp[] = $this->entities[$name];
                        }
                        $value = $tmp;
                    }
                    # si valeur entourée de % % , réferencer l'entité correspondante
                } elseif (preg_match("#^\%(?P<name>.*)\%$#", $value, $matches) > 0) {
                    $value = $this->entities[$matches['name']];
                }
                $field = $ref->getProperty($field);
                $field->setAccessible(true);
                # affecter la valeur du champ à la proprièter
                $field->setValue($entity, $value);
            }

            $name = isset($entity_def['name']) ? $entity_def['name'] : uniqid();

            $this->entities[$name] = $entity;
        }
        # retourner les entitées
        return $this->entities;
    }

    function persistFixtures(EntityManager $em) {
        foreach ($this->entities as $entity) {
            $em->persist($entity);
        }
        return $em->flush();
    }

    function removeFixtures(EntityManager $em) {
        foreach ($this->entities as $entity) {
            $em->remove($entity);
        }
        return $em->flush();
    }

}

/*

## fixture example :
## YAML Template.

fixtures:

  - entity: Entity\Rdv\Rsvp
    name: simon
    fields:
      attendeeName : simon

  - entity: Entity\Rdv\Rsvp
    name: jacob
    fields:
      attendeeName: jacob

  - entity: Entity\Rdv\Dinner
    name: 'Italian dinner'
    fields:
      country: France
      latitude: 1
      longitude: 2
      contactPhone: 911
      address: Paris
      description: Italian Food
      title: Let's eat italian
      hostedBy: me
      eventDate:  { datetime: 2010-10-20 } # a DateTimeObject
      rsvps : [ jacob ] # an array collection , reference to the fixture named jacob

  - entity: Entity\Rdv\Dinner
    name: 'German dinner'
    fields:
      country: Germany
      latitude: 10
      longitude: 23
      contactPhone: 911-343-333
      address: Berlin
      description: Sausages
      title: Kraut party
      hostedBy: Von Brohm
      eventDate: { datetime: 2013-10-20 }
      rsvps: [ simon ]

  - entity: Entity\Rdv\Rsvp
    name: jean
    fields:
      attendeeName: jean
      dinner: %German dinner% # a reference to another fixture name , surrounded by quotes

    */


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Boost.StaticString</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Boost.StaticString">
<link rel="next" href="static_string/ref.html" title="Reference">

Home
Libraries
People
FAQ
More

Boost.StaticString

Krystian Stasiowski

Vinnie Falco

Copyright © 2019, 2020 Krystian Stasiowski

Copyright © 2016-2019 Vinnie
      Falco

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    Introduction

    This library provides a dynamically resizable string of characters with compile-time
    fixed capacity and contiguous embedded storage in which the characters are placed
    within the string object itself. Its API closely resembles that of std::string.

    Motivation

    A fixed capacity string is useful when:

        Memory allocation is not possible, e.g., embedded environments without a
        free store, where only a stack and the static memory segment are available.

        Memory allocation imposes an unacceptable performance penalty. e.g., with
        respect to latency.

        Allocation of objects with complex lifetimes in the static-memory segment
        is required.

        A dynamically-resizable string is required within constexpr
        functions.

        The storage location of the static_vector elements is required to be within
        the string object itself (e.g. to support memcpy
        for serialization purposes).

    Requirements

    The library is usable in two different modes: standalone and Boost dependent.
    This library defaults to Boost dependent mode; standalone mode is opt-in through
    the use of a configuration macro.

    When in Boost dependent mode, the library requires the use of at least C++11,
    in addition to Boost.Core, Boost.Utility, and Boost.ContainerHash. In standalone
    mode, C++17 is required but no libraries except for the standard library are
    needed.

    Design

    The over-arching design goal is to resemble the interface and behavior of std::string
    as much as possible. When any operation would exceed the maximum allowed size
    of the string, std::length_error is thrown if exceptions are enabled.
    All algorithms which throw exceptions provide the strong exception safety guarantee.
    This is intended to be a drop in replacement for std::string.

    The API of static_string only
    diverges from std::string in few places, one of which is the addition
    of the subview function, for
    which this implementation returns a string view instead of static_string,
    and certain functions that will never throw are marked as noexcept,
    which diverges from those of std::string. The
    available overloads for static_string
    are identical to those of std::string.

    Iterators

    The iterator invalidation rules differ from those of std::string:

        Moving a static_string invalidates
        all iterators

        Swapping two static_strings
        invalidates all iterators

    Optimizations

    Depending on the character type and size used for a specialization of static_string, certain optimizations are used
    to reduce the size of the class type. Given the name of a specialization of the
    form basic_static_string<N, CharT, Traits>:

        If N is 0, then the class
        has no non-static data members. Given two objects a
        and b of type basic_static_string<0, T, Traits> and static_string<0,
        U, Traits>
        respectively, the pointer value returned by data() will be the same if T
        and U are the same.

        Otherwise, the type of the member used to store the size of the static_string will be the smallest standard
        unsigned integer type that can represent the value N.

    Configuration

    Certain features can be enabled and disabled though defining configuration macros.
    The macros and the associated feature they control are:

        BOOST_STATIC_STRING_STANDALONE:
        When defined, the library is put into standalone mode.

    Acknowledgments

    Thanks to Agustín Bergé, Peter Dimov, Glen
    Fernandes, and Christian
    Mazakas for their constant feedback and guidance during the development
    of this library.

    The development of this library is sponsored by The
    C++ Alliance.

    Reference

    Defined in namespace boost::static_strings:

    basic_static_string

Last revised: December 02, 2021 at 06:49:25 GMT


text:
/*=========================================================================
 *
 *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
 *
 *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
 *
 *  For complete copyright, license and disclaimer of warranty information
 *  please refer to the NOTICE file at the top of the ITK source tree.
 *
 *=========================================================================*/
#ifndef itkBSplineDownsampleImageFilter_h
#define itkBSplineDownsampleImageFilter_h

// include .h for each ResamplerType
#include "itkBSplineL2ResampleImageFilterBase.h"
#include "itkBSplineCenteredL2ResampleImageFilterBase.h"

namespace itk
{
/** \class BSplineDownsampleImageFilter
 * \brief Down-samples an image by a factor of 2 using B-Spline filter interpolation.
 *
 * This class is the public interface for spline down-sampling as defined by the
 *   ResamplerType.
 * Requires the use of a resampler type.  If in doubt, the basic itkBSplineResampleImageFilterBase
 *   should work fine for most applications.
 *
 *  This class may also be used to create a smoother by combining it with the upSampler
 *  as in the following example:
 *      using ResamplerType = itk::BSplineResampleImageFilterBase<ImageType2D, ImageType2D>;
 *      using DownsamplerType2D = itk::BSplineDownsampleImageFilter<ImageType2D,ImageType2D,ResamplerType>;
 *      using UpsamplerType2D = itk::BSplineUpsampleImageFilter<ImageType2D,ImageType2D,ResamplerType>;
 *
 *      DownsamplerType2D::Pointer downSampler = DownsamplerType2D::New();
 *      UpsamplerType2D::Pointer   upSampler =   UpsamplerType2D::New();
 *      int splineOrder = 3;
 *      downSampler->SetSplineOrder(splineOrder);
 *      upSampler->SetSplineOrder(splineOrder);
 *
 *      downSampler->SetInput(image);
 *      downSampler->Update();
 *
 *      upSampler->SetInput( downSampler->GetOutput() );   // output of downSampler is input to upSampler
 *      upSampler->Update();
 *
 *      ImageTypePtr2D outImage2 = upSampler->GetOutput();  // outImage2 is the smoothed imaged
 *
 * Limitations:  This class requires specification of a resampler type which may
 *                      be one of:
 *                        itkBSplineResampleImageFilterBase,
 *                        itkBSplineL2ResampleImageFilterBase
 *                        itkBSplineSplineCenteredResampleImageFilterBase,
 *                        itkBSplineCenteredL2ResampleImageFilterBase
 *               The limitations of these resampler types will apply to this filter.
 *               Downsamples only by a factor of 2.
 *
 * \sa itkBSplineDownsampleImageFilter
 * \sa itkBSplineL2ResampleImageFilter
 * \sa itkBSplineResampleImageFilterBase
 * \sa itkBSplineCenteredResampleImageFilterBase
 * \sa itkBSplineCenteredL2ResampleImageFilterBase
 *
 * \ingroup GeometricTransformationFilters
 * \ingroup SingleThreaded
 * \ingroup CannotBeStreamed
 * \ingroup ITKImageGrid
 */

//= typename BSplineResampleImageFilterBase<TInputImage, TOutputImage>
template< typename TInputImage, typename TOutputImage,
          typename ResamplerType = BSplineResampleImageFilterBase< TInputImage, TOutputImage > >
class ITK_TEMPLATE_EXPORT BSplineDownsampleImageFilter:
  public ResamplerType
{
public:
  ITK_DISALLOW_COPY_AND_ASSIGN(BSplineDownsampleImageFilter);

  /** Standard class type aliases. */
  using Self = BSplineDownsampleImageFilter;
  using Superclass = ResamplerType;
  using Pointer = SmartPointer< Self >;
  using ConstPointer = SmartPointer< const Self >;

  /** Run-time type information (and related methods). */
  itkTypeMacro(BSplineDownsampleImageFilter, ResamplerType);

  /** New macro for creation of through a Smart Pointer */
  itkNewMacro(Self);

  /** InputImageType type alias support */
  using InputImageType = typename Superclass::InputImageType;

  /** InputImagePointer type alias support */
  using InputImagePointer = typename Superclass::InputImagePointer;

  /** OutputImagePointer type alias support */
  using OutputImagePointer = typename Superclass::OutputImagePointer;

  /** OutputImageIterator type alias support */
  using OutputImageIterator = typename Superclass::OutputImageIterator;

  /** Creates an image half the size of the input image with spacing twice the
    * input image. */
  void GenerateOutputInformation() override;

  /** This filter requires all of the input image */
  void GenerateInputRequestedRegion() override;

#ifdef ITK_USE_CONCEPT_CHECKING
  // Begin concept checking
  itkConceptMacro( DoubleConvertibleToOutputCheck,
                   ( Concept::Convertible< double, typename TOutputImage::PixelType > ) );
  // End concept checking
#endif

protected:

  void GenerateData() override;

  void EnlargeOutputRequestedRegion(DataObject *output) override;

  BSplineDownsampleImageFilter() = default;
  ~BSplineDownsampleImageFilter() override = default;
};
} // namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkBSplineDownsampleImageFilter.hxx"
#endif

#endif


text:
package org.springframework.data.solr.core.query;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.util.Assert;

/**
 * General purpose {@link Query} abstract decorator.
 *
 * @author Francisco Spaeth
 * @since 1.4
 */
public abstract class AbstractQueryDecorator implements Query {

	private Query query;

	public AbstractQueryDecorator(Query query) {

		Assert.notNull(query, "query must not be null");
		this.query = query;
	}

	@Override
	public <T extends SolrDataQuery> T addCriteria(Criteria criteria) {
		return this.query.addCriteria(criteria);
	}

	@Override
	public Criteria getCriteria() {
		return this.query.getCriteria();
	}

	@Override
	public void setJoin(Join join) {
		this.query.setJoin(join);
	}

	@Override
	public Join getJoin() {
		return this.query.getJoin();
	}

	@Override
	public <T extends Query> T addProjectionOnField(Field field) {
		return this.query.addProjectionOnField(field);
	}

	@Override
	public <T extends Query> T setPageRequest(Pageable pageable) {
		return this.query.setPageRequest(pageable);
	}

	@Override
	public <T extends Query> T addGroupByField(Field field) {
		return this.query.addGroupByField(field);
	}

	@Override
	public <T extends Query> T addFilterQuery(FilterQuery query) {
		return this.query.addFilterQuery(query);
	}

	@Override
	public <T extends Query> T setTimeAllowed(Integer timeAllowed) {
		return this.query.setTimeAllowed(timeAllowed);
	}

	@Override
	public List<FilterQuery> getFilterQueries() {
		return this.query.getFilterQueries();
	}

	@Deprecated
	@Override
	public Pageable getPageRequest() {
		return this.query.getPageRequest();
	}

	@Override
	public List<Field> getGroupByFields() {
		return this.query.getGroupByFields();
	}

	@Override
	public List<Field> getProjectionOnFields() {
		return this.query.getProjectionOnFields();
	}

	@Override
	public <T extends Query> T addSort(Sort sort) {
		return this.query.addSort(sort);
	}

	@Override
	public Sort getSort() {
		return this.query.getSort();
	}

	@Override
	public Integer getTimeAllowed() {
		return this.query.getTimeAllowed();
	}

	@Override
	public void setDefaultOperator(Operator operator) {
		this.query.setDefaultOperator(operator);
	}

	@Override
	public Operator getDefaultOperator() {
		return this.query.getDefaultOperator();
	}

	@Override
	public String getDefType() {
		return this.query.getDefType();
	}

	@Override
	public void setDefType(String defType) {
		this.query.setDefType(defType);
	}

	@Override
	public String getRequestHandler() {
		return this.query.getRequestHandler();
	}

	@Override
	public void setRequestHandler(String requestHandler) {
		this.query.setRequestHandler(requestHandler);
	}

	@Override
	public <T extends Query> T setOffset(Integer offset) {
		return this.query.setOffset(offset);
	}

	@Override
	public <T extends Query> T setRows(Integer rows) {
		return this.query.setRows(rows);
	}

	@Override
	public Integer getOffset() {
		return this.query.getOffset();
	}

	@Override
	public Integer getRows() {
		return this.query.getRows();
	}

	@Override
	public <T extends Query> T setGroupOptions(GroupOptions groupOptions) {
		return query.setGroupOptions(groupOptions);
	}

	@Override
	public GroupOptions getGroupOptions() {
		return query.getGroupOptions();
	}

	/*
	 * (non-Javadoc)
	 * @see org.springframework.data.solr.core.query.Query#setStatsOptions(org.springframework.data.solr.core.query.StatsOptions)
	 */
	@Override
	public <T extends Query> T setStatsOptions(StatsOptions statsOptions) {
		return query.setStatsOptions(statsOptions);
	}

	/*
	 * (non-Javadoc)
	 * @see org.springframework.data.solr.core.query.Query#getStatsOptions()
	 */
	@Override
	public StatsOptions getStatsOptions() {
		return query.getStatsOptions();
	}

}


text:
struct lua_State;

LUALIB_API int ios_connect(lua_State *L);
LUALIB_API int ios_disconnect(lua_State *L);
LUALIB_API int conn_tostring(lua_State *L);
LUALIB_API int ios_devicename(lua_State *L);

int ios_errno(lua_State *L);
extern int idevice_errno;

typedef struct _sbconn {
  idevice_t device;
  lockdownd_client_t lockdownClient;
  lockdownd_service_descriptor_t lockdownService;
  sbservices_client_t sbClient;
} SBConnection;

#endif


text:
module Newnits
  def find_unit(name)
    Units.find(name.to_sym)
  end
  module_function :find_unit

  def extend_to_numeric
    Numeric.send :include, Newnits
  end
  module_function :extend_to_numeric

  def method_missing(sym, *args)
    if sym.to_s.match /(square|cubic)?_?([a-z]+)_?(squared|cubed)?/
      if $1
        unit = find_unit($2)
        unit.exponent = $1 == 'square' ? 2 : 3
      elsif $3
        unit = find_unit($2)
        unit.exponent = $3 == 'squared' ? 2 : 3
      else
        unit = find_unit($2)
      end
      Base.new(self, unit)
    else
      super
    end
  end

  class Base
    attr_accessor :value, :unit, :denominator_unit
    def initialize(value, unit)
      @value = Rational(value, 1) rescue Rational(1,1)
      @unit = unit.is_a?(Newnits::Unit) ? unit : Newnits.find_unit(unit)
      @denominator_unit = nil
      self
    end

    def in_base_unit
      if self.unit.dimension == :length && self.unit.name != :meter
        (self.unit.value**exponent)*self.value
      else
        (self.unit.value*self.value)
      end
    end

    def exponent
      @unit.exponent
    end

    def to_the(power=1)
      @unit.exponent = power
      self
    end

    def squared
      to_the 2
    end

    def cubed
      to_the 3
    end

    def to_i
      @value.to_i
    end

    def to_f
      @value.to_f
    end

    def inspect
      "<#{self.class.name}##{self.object_id}, @value=#{@value}, @unit=#{@unit}:#{@unit.name}, @to_f=#{@value.to_f}>"
    end

    def to_s
      @value.to_s
    end

    def to(unit_name, *args)
      if args[0].is_a?(Numeric)
        exponent, per, denom_name, denom_expon = args
      else
        per, denom_name, denom_expon = args
        exponent = 1
      end
      target_unit = Newnits.find_unit(unit_name)
      target_unit.exponent = exponent
      if denom_name
        denom_unit = Newnits.find_unit(denom_name)
        denom_unit.exponent = denom_expon || 1
      end
      raise IncompatibleUnitsError, "#{target_unit.dimension}^#{target_unit.exponent.to_i} is not compatible with #{self.unit.dimension}^#{self.exponent.to_i}" unless target_unit.compatible_dimension?(self)

      converted_value = (self.in_base_unit/(target_unit.value**target_unit.exponent))
      if denom_name
        converted_denom = Base.new(1,self.denominator_unit).in_base_unit/(denom_unit.value**denom_unit.exponent)
        converted_value /= converted_denom
      end

      base = Base.new(converted_value,target_unit)
      base.denominator_unit = denom_unit if per
      base
    end
    alias :convert_to :to
    alias :convert :to

    def per(unit_name, exponent=1)
      @denominator_unit = Newnits.find_unit(unit_name)
      @denominator_unit.exponent = exponent
      self
    end
  end

end # module Newnits


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_81_goodG2B.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml
Template File: sources-sink-81_goodG2B.tmpl.cpp
*/
/*
 * @description
 * CWE: 122 Heap Based Buffer Overflow
 * BadSource:  Initialize data as a large string
 * GoodSource: Initialize data as a small string
 * Sinks: memmove
 *    BadSink : Copy data to string using memmove
 * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
 *
 * */
#ifndef OMITGOOD

#include "std_testcase.h"
#include "CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_81.h"

namespace CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_81
{

void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_81_goodG2B::action(wchar_t * data) const
{
    {
        wchar_t dest[50] = L"";
        /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
        memmove(dest, data, wcslen(data)*sizeof(wchar_t));
        dest[50-1] = L'\0'; /* Ensure the destination buffer is null terminated */
        printWLine(data);
        free(data);
    }
}

}
#endif /* OMITGOOD */


text:
<?php

namespace Doctrine\Tests\DBAL\Types;

use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;

require_once __DIR__ . '/../../TestInit.php';

class StringTest extends \Doctrine\Tests\DbalTestCase
{
    protected
        $_platform,
        $_type;

    protected function setUp()
    {
        $this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
        $this->_type = Type::getType('string');
    }

    public function testReturnsSqlDeclarationFromPlatformVarchar()
    {
        $this->assertEquals("DUMMYVARCHAR()", $this->_type->getSqlDeclaration(array(), $this->_platform));
    }

    public function testReturnsDefaultLengthFromPlatformVarchar()
    {
        $this->assertEquals(255, $this->_type->getDefaultLength($this->_platform));
    }

    public function testConvertToPHPValue()
    {
        $this->assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform));
        $this->assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform));
    }

    public function testNullConversion()
    {
        $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
    }

    public function testSQLConversion()
    {
        $this->assertFalse($this->_type->canRequireSQLConversion(), "String type can never require SQL conversion to work.");
        $this->assertEquals('t.foo', $this->_type->convertToDatabaseValueSQL('t.foo', $this->_platform));
        $this->assertEquals('t.foo', $this->_type->convertToPHPValueSQL('t.foo', $this->_platform));
    }
}


text:
require 'typhoeus'

module Furious
  class Tag < Job
    def tag
      result = system("git tag #{tag_name} && git push origin #{tag_name}")
      fail "Failed to tag #{tag_name}" unless result
    end

    private

    def tag_name
      "v#{spec.version}"
    end
  end
end


text:
input, textarea {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box
}

input[type=checkbox], input[type=color], input[type=date], input[type=datetime-local], input[type=datetime], input[type=email], input[type=month], input[type=number], input[type=password], input[type=radio], input[type=search], input[type=tel], input[type=text], input[type=time], input[type=url], input[type=week], select, textarea {
    border: 1px solid #ddd;
    -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .07);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .07);
    background-color: #fff;
    color: #32373c;
    outline: 0;
    -webkit-transition: .05s border-color ease-in-out;
    transition: .05s border-color ease-in-out
}

input[type=checkbox]:focus, input[type=color]:focus, input[type=date]:focus, input[type=datetime-local]:focus, input[type=datetime]:focus, input[type=email]:focus, input[type=month]:focus, input[type=number]:focus, input[type=password]:focus, input[type=radio]:focus, input[type=search]:focus, input[type=tel]:focus, input[type=text]:focus, input[type=time]:focus, input[type=url]:focus, input[type=week]:focus, select:focus, textarea:focus {
    border-color: #5b9dd9;
    -webkit-box-shadow: 0 0 2px rgba(30, 140, 190, .8);
    box-shadow: 0 0 2px rgba(30, 140, 190, .8)
}

input[type=email], input[type=url] {
    direction: ltr
}

input[type=checkbox], input[type=radio] {
    border: 1px solid #b4b9be;
    background: #fff;
    color: #555;
    clear: none;
    cursor: pointer;
    display: inline-block;
    line-height: 0;
    height: 16px;
    margin: -4px 4px 0 0;
    outline: 0;
    padding: 0 !important;
    text-align: center;
    vertical-align: middle;
    width: 16px;
    min-width: 16px;
    -webkit-appearance: none;
    -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
    -webkit-transition: .05s border-color ease-in-out;
    transition: .05s border-color ease-in-out
}

input[type=radio]:checked + label:before {
    color: #82878c
}

.wp-core-ui input[type=reset]:active, .wp-core-ui input[type=reset]:hover {
    color: #00a0d2
}

.wp-admin p input[type=checkbox], .wp-admin p input[type=radio], td > input[type=checkbox] {
    margin-top: 0
}

.wp-admin p label input[type=checkbox] {
    margin-top: -4px
}

.wp-admin p label input[type=radio] {
    margin-top: -2px
}

input[type=radio] {
    -webkit-border-radius: 50%;
    border-radius: 50%;
    margin-right: 4px;
    line-height: 10px
}

input[type=checkbox]:checked:before, input[type=radio]:checked:before {
    float: left;
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    font: 400 21px/1 dashicons;
    speak: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

input[type=checkbox]:checked:before {
    content: '\f147';
    margin: -3px 0 0 -4px;
    color: #1e8cbe
}

input[type=radio]:checked:before {
    content: '\2022';
    text-indent: -9999px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    font-size: 24px;
    width: 6px;
    height: 6px;
    margin: 4px;
    line-height: 16px;
    background-color: #1e8cbe
}

@-moz-document url-prefix() {
    .form-table input.tog, input[type=checkbox], input[type=radio] {
        margin-bottom: -1px
    }
}

input[type=search] {
    -webkit-appearance: textfield
}

input[type=search]::-webkit-search-decoration {
    display: none
}

.ie8 input[type=password] {
    font-family: sans-serif
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit
}

input, select, textarea {
    font-size: 14px;
    -webkit-border-radius: 0;
    border-radius: 0
}

textarea {
    overflow: auto;
    padding: 2px 6px;
    line-height: 1.4
}

.wp-admin input[type=file] {
    padding: 3px 0
}

label {
    cursor: pointer
}

input, select {
    margin: 1px;
    padding: 3px 5px
}

input.code {
    padding-top: 6px
}

textarea.code {
    line-height: 1.4;
    padding: 4px 6px 1px
}

input.readonly, input[readonly], textarea.readonly, textarea[readonly] {
    background-color: #eee
}

.wp-core-ui :-moz-placeholder, :-moz-placeholder {
    color: #a9a9a9
}

.form-invalid {
    background-color: #ffebe8 !important
}

.form-invalid input, .form-invalid select {
    border-color: #c00 !important
}

.form-input-tip {
    color: #666
}

input.disabled, input:disabled, select.disabled, select:disabled, textarea.disabled, textarea:disabled {
    background: rgba(255, 255, 255, .5);
    border-color: rgba(222, 222, 222, .75);
    -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
    color: rgba(51, 51, 51, .5)
}

input[type=file].disabled, input[type=file]:disabled, input[type=range].disabled, input[type=range]:disabled {
    background: 0 0;
    -webkit-box-shadow: none;
    box-shadow: none
}

input[type=checkbox].disabled, input[type=checkbox].disabled:checked:before, input[type=checkbox]:disabled, input[type=checkbox]:disabled:checked:before, input[type=radio].disabled, input[type=radio].disabled:checked:before, input[type=radio]:disabled, input[type=radio]:disabled:checked:before {
    opacity: .7
}

.wp-admin select {
    padding: 2px;
    line-height: 28px;
    height: 28px;
    vertical-align: middle
}

.wp-admin .button-cancel {
    padding: 0 5px;
    line-height: 2
}

.meta-box-sortables select {
    max-width: 100%
}

.wp-admin select[multiple] {
    height: auto
}

.submit {
    padding: 1.5em 0;
    margin: 5px 0;
    -webkit-border-bottom-left-radius: 3px;
    border-bottom-left-radius: 3px;
    -webkit-border-bottom-right-radius: 3px;
    border-bottom-right-radius: 3px;
    border: none
}

form p.submit a.cancel:hover {
    text-decoration: none
}

p.submit {
    text-align: left;
    max-width: 100%;
    margin-top: 20px;
    padding-top: 10px
}

.textright p.submit {
    border: none;
    text-align: right
}

table.form-table + input + input + p.submit, table.form-table + input + p.submit, table.form-table + p.submit {
    border-top: none;
    padding-top: 0
}

#major-publishing-actions input, #minor-publishing-actions .preview, #minor-publishing-actions input {
    text-align: center
}

input.all-options, textarea.all-options {
    width: 250px
}

input.large-text, textarea.large-text {
    width: 99%
}

#adduser .form-field input, input.regular-text {
    width: 25em
}

input.small-text {
    width: 50px;
    padding: 1px 6px
}

input[type=number].small-text {
    width: 65px
}

#doaction, #doaction2, #post-query-submit {
    margin: 1px 8px 0 0
}

.tablenav #changeit, .tablenav #clear-recent-list, .tablenav #delete_all, .wp-filter #delete_all {
    margin-top: 1px
}

.tablenav .actions select {
    float: left;
    margin-right: 6px;
    max-width: 200px
}

.ie8 .tablenav .actions select {
    width: 155px
}

.ie8 .tablenav .actions select#cat {
    width: 200px
}

#timezone_string option {
    margin-left: 1em
}

#upload-form label {
    color: #777
}

#your-profile label + a, fieldset label, label {
    vertical-align: middle
}

#misc-publishing-actions label, .options-media-php label[for*="_size_"] {
    vertical-align: baseline
}

#misc-publishing-actions label[for=post_status]:before {
    content: '\f173';
    display: inline-block;
    font: 400 20px/1 dashicons;
    speak: none;
    left: -1px;
    padding: 0 5px 0 0;
    position: relative;
    top: 0;
    text-decoration: none !important;
    vertical-align: top;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

#pass-strength-result {
    background-color: #eee;
    border: 1px solid #ddd;
    float: left;
    margin: 13px 5px 5px 1px;
    padding: 3px 5px;
    text-align: center;
    width: 200px;
    display: none
}

#pass-strength-result.short {
    background-color: #ffa0a0;
    border-color: #f04040
}

#pass-strength-result.bad {
    background-color: #ffb78c;
    border-color: #ff853c
}

#pass-strength-result.good {
    background-color: #ffec8b;
    border-color: #fc0
}

#pass-strength-result.strong {
    background-color: #c3ff88;
    border-color: #8dff1c
}

.indicator-hint {
    padding-top: 8px
}

p.search-box {
    float: right;
    margin: 0
}

.network-admin.themes-php p.search-box {
    clear: left
}

.search-box input[name="s"], .tablenav .search-plugins input[name="s"], .tagsdiv .newtag {
    float: left;
    height: 28px;
    margin: 0 4px 0 0
}

input[type=email].ui-autocomplete-loading, input[type=text].ui-autocomplete-loading {
    background-image: url(../images/loading.gif);
    background-repeat: no-repeat;
    background-position: right center;
    visibility: visible
}

input.ui-autocomplete-input.open {
    border-bottom-color: transparent
}

ul#add-to-blog-users {
    margin: 0 0 0 14px
}

.ui-autocomplete {
    padding: 0;
    margin: 0;
    list-style: none;
    position: absolute;
    z-index: 10000;
    border: 1px solid #5b9dd9;
    -webkit-box-shadow: 0 1px 2px rgba(30, 140, 190, .8);
    box-shadow: 0 1px 2px rgba(30, 140, 190, .8);
    background-color: #fff
}

.ui-autocomplete li {
    margin-bottom: 0;
    padding: 4px 10px;
    white-space: nowrap;
    text-align: left
}

.ui-autocomplete li.ui-state-focus {
    background-color: #ddd;
    cursor: pointer
}

.form-table {
    border-collapse: collapse;
    margin-top: .5em;
    width: 100%;
    clear: both
}

.form-table, .form-table td, .form-table td p, .form-table th, .form-wrap label {
    font-size: 14px
}

.form-table td {
    margin-bottom: 9px;
    padding: 15px 10px;
    line-height: 1.3;
    vertical-align: middle
}

.form-table th, .form-wrap label {
    color: #23282d;
    font-weight: 400;
    text-shadow: none;
    vertical-align: baseline
}

.form-table th {
    vertical-align: top;
    text-align: left;
    padding: 20px 10px 20px 0;
    width: 200px;
    line-height: 1.3;
    font-weight: 600
}

.form-table th.th-full {
    width: auto;
    font-weight: 400
}

.form-table td p {
    margin-top: 4px;
    margin-bottom: 0
}

.form-table td fieldset label {
    margin: .25em 0 .5em !important;
    display: inline-block
}

.form-table td fieldset label, .form-table td fieldset li, .form-table td fieldset p {
    line-height: 1.4em
}

.form-table input.tog, .form-table input[type=radio] {
    margin-top: -4px;
    margin-right: 4px;
    float: none
}

.form-table .pre {
    padding: 8px;
    margin: 0
}

table.form-table td .updated {
    font-size: 13px
}

table.form-table td .updated p {
    font-size: 13px;
    margin: .3em 0
}

#profile-page .form-table textarea {
    width: 500px;
    margin-bottom: 6px
}

#profile-page .form-table #rich_editing {
    margin-right: 5px
}

#your-profile legend {
    font-size: 22px
}

#display_name {
    width: 15em
}

#createuser .form-field input {
    width: 25em
}

.color-option {
    display: inline-block;
    width: 24%;
    padding: 5px 15px 15px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin-bottom: 3px
}

.color-option.selected, .color-option:hover {
    background: #ddd
}

.color-palette {
    width: 100%;
    border-spacing: 0;
    border-collapse: collapse
}

.color-palette td {
    height: 20px;
    padding: 0;
    border: none
}

.color-option {
    cursor: pointer
}

.tool-box .title {
    margin: 8px 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 24px
}

.card {
    position: relative;
    margin-top: 20px;
    padding: .7em 2em 1em;
    min-width: 255px;
    max-width: 520px;
    border: 1px solid #e5e5e5;
    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
    background: #fff
}

.pressthis h4 {
    margin: 2em 0 1em
}

.pressthis textarea {
    width: 100%;
    font-size: 1em
}

#pressthis-code-wrap {
    overflow: auto
}

.pressthis-bookmarklet-wrapper {
    margin: 20px 0 8px;
    vertical-align: top;
    position: relative;
    z-index: 1
}

.pressthis-bookmarklet, .pressthis-bookmarklet:active, .pressthis-bookmarklet:focus, .pressthis-bookmarklet:hover {
    display: inline-block;
    position: relative;
    cursor: move;
    color: #32373c;
    background: #e6e6e6;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #b4b4b4;
    font-style: normal;
    line-height: 16px;
    font-size: 14px;
    text-decoration: none
}

.pressthis-bookmarklet:active {
    outline: 0
}

.pressthis-bookmarklet:after {
    content: '';
    width: 70%;
    height: 55%;
    z-index: -1;
    position: absolute;
    right: 10px;
    bottom: 9px;
    background: 0 0;
    -webkit-transform: skew(20deg) rotate(6deg);
    -ms-transform: skew(20deg) rotate(6deg);
    transform: skew(20deg) rotate(6deg);
    -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, .6);
    box-shadow: 0 10px 8px rgba(0, 0, 0, .6)
}

.pressthis-bookmarklet:hover:after {
    -webkit-transform: skew(20deg) rotate(9deg);
    -ms-transform: skew(20deg) rotate(9deg);
    transform: skew(20deg) rotate(9deg);
    -webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, .7);
    box-shadow: 0 10px 8px rgba(0, 0, 0, .7)
}

.pressthis-bookmarklet span {
    display: inline-block;
    margin: 0;
    padding: 0 12px 8px 9px
}

.pressthis-bookmarklet span:before {
    color: #777;
    font: 400 20px/1 dashicons;
    content: '\f157';
    position: relative;
    display: inline-block;
    top: 4px;
    margin-right: 4px
}

.pressthis-js-toggle, .pressthis-js-toggle.button.button {
    margin-left: 10px;
    padding: 0;
    height: auto;
    vertical-align: top
}

.pressthis-js-toggle .dashicons {
    margin: 5px 8px 6px 7px;
    color: #777
}

#local-time, #utc-time {
    padding-left: 25px;
    font-style: italic
}

.defaultavatarpicker .avatar {
    margin: 2px 0;
    vertical-align: middle
}

.options-general-php input.small-text {
    width: 56px
}

.options-general-php .spinner {
    float: none;
    margin: 0 3px
}

.options-general-php .language-install-spinner, .settings-php .language-install-spinner {
    display: inline-block;
    float: none;
    margin: -3px 5px 0;
    vertical-align: middle
}

.form-field #site-address {
    max-width: 25em
}

.form-field #domain {
    max-width: 22em
}

.form-field #admin-email, .form-field #blog_last_updated, .form-field #blog_registered, .form-field #path, .form-field #site-title {
    max-width: 25em
}

.form-field #path {
    margin-bottom: 5px
}

.request-filesystem-credentials-dialog {
    display: none
}

.request-filesystem-credentials-dialog .notification-dialog {
    top: 15%
}

.request-filesystem-credentials-dialog-content {
    margin: 25px
}

.request-filesystem-credentials-form input[type=password], .request-filesystem-credentials-form input[type=text] {
    display: block
}

.request-filesystem-credentials-dialog input[type=password], .request-filesystem-credentials-dialog input[type=text] {
    width: 100%
}

.request-filesystem-credentials-form .field-title {
    font-weight: 600
}

.request-filesystem-credentials-dialog label[for=hostname], .request-filesystem-credentials-dialog label[for=private_key], .request-filesystem-credentials-dialog label[for=public_key] {
    display: block;
    margin-bottom: 1em
}

.request-filesystem-credentials-dialog .ftp-password, .request-filesystem-credentials-dialog .ftp-username {
    float: left;
    width: 48%
}

.request-filesystem-credentials-dialog .ftp-password {
    margin-left: 4%
}

.request-filesystem-credentials-dialog .request-filesystem-credentials-action-buttons {
    text-align: right
}

#request-filesystem-credentials-dialog .button:not(:last-child), .request-filesystem-credentials-dialog label[for=ftp] {
    margin-right: 10px
}

#request-filesystem-credentials-form .cancel-button {
    display: none
}

#request-filesystem-credentials-dialog .cancel-button {
    display: inline
}

@media screen and (max-width: 782px) {
    textarea {
        -webkit-appearance: none
    }

    input[type=email], input[type=number], input[type=password], input[type=search], input[type=text] {
        -webkit-appearance: none;
        padding: 6px 10px
    }

    input.code {
        padding-bottom: 5px;
        padding-top: 10px
    }

    .widefat th input[type=checkbox], input[type=checkbox] {
        -webkit-appearance: none;
        padding: 10px
    }

    .widefat th input[type=checkbox] {
        margin-bottom: 8px
    }

    .widefat th input[type=checkbox]:before, input[type=checkbox]:checked:before {
        font: 400 30px/1 Dashicons;
        margin: -3px -5px
    }

    input[type=checkbox], input[type=radio] {
        height: 25px;
        width: 25px
    }

    .wp-admin p input[type=checkbox], .wp-admin p input[type=radio] {
        margin-top: -3px
    }

    input[type=radio]:checked:before {
        vertical-align: middle;
        width: 9px;
        height: 9px;
        margin: 7px;
        line-height: 16px
    }

    .wp-upload-form input[type=submit] {
        margin-top: 10px
    }

    #wpbody select {
        height: 36px;
        font-size: 16px
    }

    .wp-admin .button-cancel {
        padding: 0;
        font-size: 14px
    }

    #createuser .form-field input {
        width: 100%
    }

    .form-table {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box
    }

    .form-table td, .form-table th {
        display: block;
        width: auto;
        vertical-align: middle
    }

    .form-table .color-palette td {
        display: table-cell;
        width: 15px
    }

    .form-table table.color-palette {
        margin-right: 10px
    }

    input, textarea {
        font-size: 16px
    }

    #profile-page .form-table textarea, .form-table span.description, .form-table td input[type=email], .form-table td input[type=password], .form-table td input[type=text], .form-table td select, .form-table td textarea {
        width: 100%;
        font-size: 16px;
        line-height: 1.5;
        padding: 7px 10px;
        display: block;
        max-width: none;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box
    }

    #wpbody .form-table td select {
        height: 40px
    }

    .form-table input[type=text].small-text, input[type=number].small-text, input[type=password].small-text, input[type=search].small-text, input[type=text].small-text {
        width: auto;
        max-width: 55px;
        display: inline;
        padding: 3px 6px;
        margin: 0 3px
    }

    #pass-strength-result {
        width: 100%;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding: 8px
    }

    p.search-box {
        float: none;
        position: absolute;
        bottom: 0;
        width: 98%;
        height: 90px;
        margin-bottom: 20px
    }

    p.search-box input[name="s"] {
        height: auto;
        float: none;
        width: 100%;
        margin-bottom: 10px;
        vertical-align: middle;
        -webkit-appearance: none
    }

    p.search-box input[type=submit] {
        margin-bottom: 10px
    }

    .form-table span.description {
        padding: 4px 0 0;
        line-height: 1.4em
    }

    .form-table th {
        padding-top: 10px;
        padding-bottom: 0;
        border-bottom: 0
    }

    .form-table td {
        padding-top: 8px;
        padding-left: 0
    }

    .form-table input.regular-text {
        width: 100%
    }

    .form-table label {
        font-size: 14px
    }

    .form-table fieldset label {
        display: block
    }

    #utc-time {
        margin-top: 10px
    }

    #local-time, #utc-time {
        display: block;
        float: none;
        padding: 0;
        line-height: 2
    }

    .form-field #domain {
        max-width: none
    }
}

@media only screen and (max-width: 768px) {
    .form-field input[type=email], .form-field input[type=password], .form-field input[type=text], .form-field select, .form-field textarea {
        width: 99%
    }

    .form-wrap .form-field {
        padding: 0
    }

    #profile-page .form-table textarea {
        max-width: 400px;
        width: auto
    }
}

@media only screen and (max-height: 480px) {
    .request-filesystem-credentials-dialog .notification-dialog {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        margin: 0;
        left: 0;
        overflow-y: auto
    }
}

@media screen and (max-width: 600px) {
    .color-option {
        width: 49%
    }
}

body.rtl, body.rtl .press-this a.wp-switch-editor {
    font-family: Tahoma, Arial, sans-serif
}

.rtl h1, .rtl h2, .rtl h3, .rtl h4, .rtl h5, .rtl h6 {
    font-family: Arial, sans-serif;
    font-weight: 700
}

body.locale-he-il, body.locale-he-il .press-this a.wp-switch-editor {
    font-family: Arial, sans-serif
}

.locale-he-il em {
    font-style: normal;
    font-weight: 700
}

.locale-zh-cn #local-time, .locale-zh-cn #utc-time, .locale-zh-cn .form-wrap p, .locale-zh-cn .howto, .locale-zh-cn .inline-edit-row fieldset span.checkbox-title, .locale-zh-cn .inline-edit-row fieldset span.title, .locale-zh-cn .js .input-with-default-title, .locale-zh-cn .link-to-original, .locale-zh-cn .tablenav .displaying-num, .locale-zh-cn p.description, .locale-zh-cn p.help, .locale-zh-cn p.install-help, .locale-zh-cn span.description {
    font-style: normal
}

.locale-zh-cn .hdnle a {
    font-size: 12px
}

.locale-zh-cn form.upgrade .hint {
    font-style: normal;
    font-size: 100%
}

.locale-zh-cn #wp-fullscreen-tagline {
    font-family: KaiTi, "楷体", sans-serif
}

.locale-zh-cn #wp-fullscreen-modes a {
    font-size: 12px
}

.locale-zh-cn #sort-buttons {
    font-size: 1em !important
}

.locale-de-de .inline-edit-row fieldset label span.title {
    width: 7em
}

.locale-de-de .inline-edit-row fieldset label span.input-text-wrap {
    margin-left: 7em
}

.locale-de-de #customize-header-actions .button {
    padding: 0 5px 1px
}

.locale-de-de #customize-header-actions .spinner {
    margin: 16px 3px 0
}

.locale-ru-ru .inline-edit-row fieldset label span.title {
    width: 8em
}

.locale-ru-ru .inline-edit-row fieldset label span.input-text-wrap {
    margin-left: 8em
}

.locale-ru-ru.post-new-php .tagsdiv .newtag, .locale-ru-ru.post-php .tagsdiv .newtag {
    width: 165px
}

.locale-ru-ru.press-this .posting {
    margin-right: 277px
}

.locale-ru-ru .press-this-sidebar {
    width: 265px
}

.locale-ru-ru #customize-header-actions .button {
    padding: 0 5px 1px
}

.locale-ru-ru #customize-header-actions .spinner {
    margin: 16px 3px 0
}

.locale-lt-lt .inline-edit-row fieldset label span.title {
    width: 8em
}

.locale-lt-lt .inline-edit-row fieldset label span.input-text-wrap {
    margin-left: 8em
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0
}

html {
    background: #f1f1f1
}

body {
    background: #f1f1f1;
    min-width: 0;
    color: #444;
    font-family: "Open Sans", sans-serif;
    font-size: 13px;
    line-height: 1.4em
}

a {
    color: #0073aa;
    -webkit-transition-property: border, background, color;
    transition-property: border, background, color;
    -webkit-transition-duration: .05s;
    transition-duration: .05s;
    -webkit-transition-timing-function: ease-in-out;
    transition-timing-function: ease-in-out;
    outline: 0
}

a:active, a:hover {
    color: #00a0d2
}

a:focus {
    color: #124964
}

a:active, a:focus {
    outline: dotted thin
}

p {
    line-height: 1.5
}

.login .message {
    border-left: 4px solid #00a0d2;
    background-color: #fff;
    -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1)
}

.login #login_error {
    border-left: 4px solid #dd3d36;
    background: #fff;
    -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1)
}

#loginform p.submit, .login-action-lostpassword p.submit {
    border: none;
    margin: -10px 0 20px
}

.login * {
    margin: 0;
    padding: 0
}

.login form {
    margin-top: 20px;
    margin-left: 0;
    padding: 26px 24px 46px;
    font-weight: 400;
    overflow: hidden;
    background: #fff;
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .13);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .13)
}

.login form .forgetmenot {
    font-weight: 400;
    float: left;
    margin-bottom: 0
}

.login .button-primary {
    float: right
}

#login form p {
    margin-bottom: 0
}

#login form p.submit {
    margin: 0;
    padding: 0
}

.login label {
    color: #777;
    font-size: 14px
}

.login form .forgetmenot label {
    font-size: 12px;
    line-height: 19px
}

.login h1 {
    text-align: center
}

.login h1 a {
    background-image: url(../images/w-logo-blue.png?ver=20131202);
    background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
    -webkit-background-size: 84px;
    background-size: 84px;
    background-position: center top;
    background-repeat: no-repeat;
    color: #999;
    height: 84px;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3em;
    margin: 0 auto 25px;
    padding: 0;
    text-decoration: none;
    width: 84px;
    text-indent: -9999px;
    outline: 0;
    overflow: hidden;
    display: block
}

#login {
    width: 320px;
    margin: auto;
    padding-top: 18%;
}

#login_error, .login .message {
    margin-left: 0;
    padding: 12px
}

.login #backtoblog, .login #nav {
    font-size: 13px;
    padding: 0 24px
}

.login #nav {
    margin: 24px 0 0
}

#backtoblog {
    margin: 16px 0 0
}

.login #backtoblog a, .login #nav a {
    text-decoration: none;
    color: #999
}

.login #backtoblog a:hover, .login #nav a:hover, .login h1 a:hover {
    color: #00a0d2
}

.login form .input, .login input[type=text] {
    font-size: 24px;
    width: 100%;
    padding: 3px;
    margin: 2px 6px 16px 0
}

.login form .input, .login form input[type=checkbox], .login input[type=text] {
    background: #fbfbfb
}

.ie7 .login form .input, .ie8 .login form .input {
    font-family: sans-serif
}

.login #pass-strength-result {
    width: 250px;
    font-weight: 600;
    margin: 12px 0 6px;
    padding: 6px 5px;
    text-align: center
}

.mobile #login {
    padding: 20px 0
}

.mobile #login .message, .mobile #login form, .mobile #login_error {
    margin-left: 0
}

.mobile #login #backtoblog, .mobile #login #nav {
    margin-left: 8px
}

body.interim-login {
    height: auto
}

.interim-login #login {
    padding: 0;
    margin: 5px auto 20px
}

.interim-login.login h1 a {
    width: auto
}

.interim-login #login_error, .interim-login.login .message {
    margin: 0 0 16px
}

.interim-login.login form {
    margin: 0
}

@-ms-viewport {
    width: device-width
}

@media screen and (max-width: 782px) {
    .interim-login input[type=checkbox] {
        height: 16px;
        width: 16px
    }

    .interim-login input[type=checkbox]:checked:before {
        width: 16px;
        font: 400 21px/1 dashicons;
        margin: -3px 0 0 -4px
    }
}


text:
package main

import (
  "github.com/howeyc/fsnotify"
  "log"
  "flag"
  "os"
  "os/exec"
  "os/signal"
  "syscall"
  "fmt"
  "time"
)

func run(command []string) {
  cmd := exec.Command(command[0], command[1:]...)
  buf, err := cmd.CombinedOutput()
  fmt.Printf("%s\n", buf)
  if err != nil {
    log.Println(err)
  }
}

func main() {
  pathPtr := flag.String("path", ".", "path of the target dir")
  deadtimePtr := flag.Uint("deadtime", 1000, "deadtime of the trigger")
  flag.Parse()
  command := flag.Args()

  if len(command) == 0 {
    log.Fatal("usage: fmon.exe [-path targetDir] [-deadtime 1000] {command}")
  }

  done := make(chan os.Signal, 1)
  signal.Notify(done,
    os.Kill,
    os.Interrupt,
    syscall.SIGHUP,
    syscall.SIGINT,
    syscall.SIGTERM,
    syscall.SIGQUIT)

  watcher, err := fsnotify.NewWatcher()
  if err != nil {
    log.Fatal(err)
  }
  defer watcher.Close()
  log.Println("start watching dir: ", *pathPtr)

  // Process events
  go func() {
    for {
      select {
      case ev := <-watcher.Event:
        if (!ev.IsModify()) {
          continue
        }
        log.Println("event:", ev)
        run(command)
        time.Sleep(time.Duration(*deadtimePtr) * time.Millisecond)
        // flush channel
        chanlen := len(watcher.Event)
        for i := 0; i <= chanlen; i++ {
          <- watcher.Event
        }
      case err := <-watcher.Error:
        log.Println("error:", err)
      }
    }
  }()

  err = watcher.Watch(*pathPtr)
  if err != nil {
    log.Fatal(err)
  }

  <- done
  log.Println("Exiting.")
}


text:
package disk

import "github.com/StageAutoControl/controller/pkg/cntl"

// Loader loads the DataStore from the storage
type Loader struct {
	storage *Storage
}

// NewLoader returns a new Loader instance
func NewLoader(storage *Storage) *Loader {
	return &Loader{
		storage: storage,
	}
}

// Load the data from the storage and return a populated data store
func (l *Loader) Load() (*cntl.DataStore, error) {
	data := cntl.NewStore()

	for _, id := range l.storage.List(&cntl.SetList{}) {
		setList := &cntl.SetList{}
		err := l.storage.Read(id, setList)
		if err != nil {
			return nil, err
		}

		data.SetLists[id] = setList
	}

	for _, id := range l.storage.List(&cntl.Song{}) {
		song := &cntl.Song{}
		err := l.storage.Read(id, song)
		if err != nil {
			return nil, err
		}

		data.Songs[id] = song
	}

	for _, id := range l.storage.List(&cntl.DMXDevice{}) {
		dmxDevice := &cntl.DMXDevice{}
		err := l.storage.Read(id, dmxDevice)
		if err != nil {
			return nil, err
		}

		data.DMXDevices[id] = dmxDevice
	}

	for _, id := range l.storage.List(&cntl.DMXDeviceGroup{}) {
		dmxDeviceGroup := &cntl.DMXDeviceGroup{}
		err := l.storage.Read(id, dmxDeviceGroup)
		if err != nil {
			return nil, err
		}

		data.DMXDeviceGroups[id] = dmxDeviceGroup
	}

	for _, id := range l.storage.List(&cntl.DMXDeviceType{}) {
		dmxDeviceType := &cntl.DMXDeviceType{}
		err := l.storage.Read(id, dmxDeviceType)
		if err != nil {
			return nil, err
		}

		data.DMXDeviceTypes[id] = dmxDeviceType
	}

	for _, id := range l.storage.List(&cntl.DMXPreset{}) {
		dmxPreset := &cntl.DMXPreset{}
		err := l.storage.Read(id, dmxPreset)
		if err != nil {
			return nil, err
		}

		data.DMXPresets[id] = dmxPreset
	}

	for _, id := range l.storage.List(&cntl.DMXScene{}) {
		dmxScene := &cntl.DMXScene{}
		err := l.storage.Read(id, dmxScene)
		if err != nil {
			return nil, err
		}

		data.DMXScenes[id] = dmxScene
	}

	for _, id := range l.storage.List(&cntl.DMXAnimation{}) {
		dmxAnimation := &cntl.DMXAnimation{}
		err := l.storage.Read(id, dmxAnimation)
		if err != nil {
			return nil, err
		}

		data.DMXAnimations[id] = dmxAnimation
	}

	for _, id := range l.storage.List(&cntl.DMXTransition{}) {
		dmxTransition := &cntl.DMXTransition{}
		err := l.storage.Read(id, dmxTransition)
		if err != nil {
			return nil, err
		}

		data.DMXTransitions[id] = dmxTransition
	}

	for _, id := range l.storage.List(&cntl.DMXColorVariable{}) {
		dmxColorVariable := &cntl.DMXColorVariable{}
		err := l.storage.Read(id, dmxColorVariable)
		if err != nil {
			return nil, err
		}

		data.DMXColorVariables[id] = dmxColorVariable
	}

	return data, nil
}


text:
{-# LANGUAGE MagicHash, UnboxedTuples #-}

-- !!! simple tests of copying/cloning primitive arrays
--

module Main ( main ) where

import GHC.Exts hiding (IsList(..))
import GHC.Prim
import GHC.ST

main :: IO ()
main = putStr
       (test_copyArray
        ++ "\n" ++ test_copyMutableArray
        ++ "\n" ++ test_copyMutableArrayOverlap
        ++ "\n" ++ test_cloneArray
        ++ "\n" ++ test_cloneArrayStatic
        ++ "\n" ++ test_cloneMutableArray
        ++ "\n" ++ test_cloneMutableArrayEmpty
        ++ "\n" ++ test_cloneMutableArrayStatic
        ++ "\n" ++ test_freezeArray
        ++ "\n" ++ test_freezeArrayStatic
        ++ "\n" ++ test_thawArray
        ++ "\n" ++ test_thawArrayStatic
        ++ "\n"
       )

------------------------------------------------------------------------
-- Constants

-- All allocated arrays are of this size
len :: Int
len = 130

-- We copy these many elements
copied :: Int
copied = len - 2

copiedStatic :: Int
copiedStatic = 16
{-# INLINE copiedStatic #-}  -- to make sure optimization triggers

------------------------------------------------------------------------
-- copyArray#

-- Copy a slice of the source array into a destination array and check
-- that the copy succeeded.
test_copyArray :: String
test_copyArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            src <- unsafeFreezeArray src
            dst <- newArray len (-1)
            -- Leave the first and last element untouched
            copyArray src 1 dst 1 copied
            unsafeFreezeArray dst
    in shows (toList dst len) "\n"

------------------------------------------------------------------------
-- copyMutableArray#

-- Copy a slice of the source array into a destination array and check
-- that the copy succeeded.
test_copyMutableArray :: String
test_copyMutableArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            dst <- newArray len (-1)
            -- Leave the first and last element untouched
            copyMutableArray src 1 dst 1 copied
            unsafeFreezeArray dst
    in shows (toList dst len) "\n"

-- Perform a copy where the source and destination part overlap.
test_copyMutableArrayOverlap :: String
test_copyMutableArrayOverlap =
    let arr = runST $ do
            marr <- fromList inp
            -- Overlap of two elements
            copyMutableArray marr 5 marr 7 8
            unsafeFreezeArray marr
    in shows (toList arr (length inp)) "\n"
  where
     -- This case was known to fail at some point.
     inp = [0,169,196,9,16,25,36,16,25,81,100,121,144,169,196]

------------------------------------------------------------------------
-- cloneArray#

-- Clone a slice of the source array into a destination array and
-- check that the clone succeeded.
test_cloneArray :: String
test_cloneArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            src <- unsafeFreezeArray src
            -- Don't include the first and last element.
            return $! cloneArray src 1 copied
    in shows (toList dst copied) "\n"

--  Check that the static-size optimization works.
test_cloneArrayStatic :: String
test_cloneArrayStatic =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            src <- unsafeFreezeArray src
            -- Don't include the first and last element.
            return $! cloneArray src 1 copiedStatic
    in shows (toList dst copiedStatic) "\n"

------------------------------------------------------------------------
-- cloneMutableArray#

-- Clone a slice of the source array into a destination array and
-- check that the clone succeeded.
test_cloneMutableArray :: String
test_cloneMutableArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            -- Don't include the first and last element.
            dst <- cloneMutableArray src 1 copied
            unsafeFreezeArray dst
    in shows (toList dst copied) "\n"

-- Check that zero-length clones work.
test_cloneMutableArrayEmpty :: String
test_cloneMutableArrayEmpty =
    let dst = runST $ do
            src <- newArray len 0
            dst <- cloneMutableArray src 0 0
            unsafeFreezeArray dst
    in shows (toList dst 0) "\n"

--  Check that the static-size optimization works.
test_cloneMutableArrayStatic :: String
test_cloneMutableArrayStatic =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            -- Don't include the first and last element.
            dst <- cloneMutableArray src 1 copiedStatic
            unsafeFreezeArray dst
    in shows (toList dst copiedStatic) "\n"

------------------------------------------------------------------------
-- freezeArray#

-- Clone a slice of the source array into a destination array and
-- check that the clone succeeded.
test_freezeArray :: String
test_freezeArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            -- Don't include the first and last element.
            freezeArray src 1 copied
    in shows (toList dst copied) "\n"

--  Check that the static-size optimization works.
test_freezeArrayStatic :: String
test_freezeArrayStatic =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            -- Don't include the first and last element.
            freezeArray src 1 copiedStatic
    in shows (toList dst copiedStatic) "\n"

------------------------------------------------------------------------
-- thawArray#

-- Clone a slice of the source array into a destination array and
-- check that the clone succeeded.
test_thawArray :: String
test_thawArray =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            src <- unsafeFreezeArray src
            -- Don't include the first and last element.
            dst <- thawArray src 1 copied
            unsafeFreezeArray dst
    in shows (toList dst copied) "\n"

--  Check that the static-size optimization works.
test_thawArrayStatic :: String
test_thawArrayStatic =
    let dst = runST $ do
            src <- newArray len 0
            fill src 0 len
            src <- unsafeFreezeArray src
            -- Don't include the first and last element.
            dst <- thawArray src 1 copiedStatic
            unsafeFreezeArray dst
    in shows (toList dst copiedStatic) "\n"

------------------------------------------------------------------------
-- Test helpers

-- Initialize the elements of this array, starting at the given
-- offset.  The last parameter specifies the number of elements to
-- initialize.  Element at index @i@ takes the value @i*i@ (i.e. the
-- first actually modified element will take value @off*off@).
fill :: MArray s Int -> Int -> Int -> ST s ()
fill marr off count = go 0
  where
    go i
        | i >= count = return ()
        | otherwise = writeArray marr (off + i) (i*i) >> go (i + 1)

fromList :: [Int] -> ST s (MArray s Int)
fromList xs0 = do
    marr <- newArray (length xs0) bottomElem
    let go [] i = i `seq` return marr
        go (x:xs) i = writeArray marr i x >> go xs (i + 1)
    go xs0 0
  where
    bottomElem = error "undefined element"

------------------------------------------------------------------------
-- Convenience wrappers for Array# and MutableArray#

data Array a = Array { unArray :: Array# a }
data MArray s a = MArray { unMArray :: MutableArray# s a }

newArray :: Int -> a -> ST s (MArray s a)
newArray (I# n#) a = ST $ \s# -> case newArray# n# a s# of
    (# s2#, marr# #) -> (# s2#, MArray marr# #)

indexArray :: Array a -> Int -> a
indexArray arr i@(I# i#)
  | i < 0 || i >= len =
      error $ "bounds error, offset " ++ show i ++ ", length " ++ show len
  | otherwise = case indexArray# (unArray arr) i# of
      (# a #) -> a
  where len = lengthArray arr

writeArray :: MArray s a -> Int -> a -> ST s ()
writeArray marr i@(I# i#) a
  | i < 0 || i >= len =
      error $ "bounds error, offset " ++ show i ++ ", length " ++ show len
  | otherwise = ST $ \ s# ->
    case writeArray# (unMArray marr) i# a s# of
        s2# -> (# s2#, () #)
  where len = lengthMArray marr

lengthArray :: Array a -> Int
lengthArray arr = I# (sizeofArray# (unArray arr))

lengthMArray :: MArray s a -> Int
lengthMArray marr = I# (sizeofMutableArray# (unMArray marr))

unsafeFreezeArray :: MArray s a -> ST s (Array a)
unsafeFreezeArray marr = ST $ \ s# ->
    case unsafeFreezeArray# (unMArray marr) s# of
        (# s2#, arr# #) -> (# s2#, Array arr# #)

copyArray :: Array a -> Int -> MArray s a -> Int -> Int -> ST s ()
copyArray src (I# six#) dst (I# dix#) (I# n#) = ST $ \ s# ->
    case copyArray# (unArray src) six# (unMArray dst) dix# n# s# of
        s2# -> (# s2#, () #)

copyMutableArray :: MArray s a -> Int -> MArray s a -> Int -> Int -> ST s ()
copyMutableArray src (I# six#) dst (I# dix#) (I# n#) = ST $ \ s# ->
    case copyMutableArray# (unMArray src) six# (unMArray dst) dix# n# s# of
        s2# -> (# s2#, () #)

cloneArray :: Array a -> Int -> Int -> Array a
cloneArray src (I# six#) (I# n#) = Array (cloneArray# (unArray src) six# n#)
{-# INLINE cloneArray #-}  -- to make sure optimization triggers

cloneMutableArray :: MArray s a -> Int -> Int -> ST s (MArray s a)
cloneMutableArray src (I# six#) (I# n#) = ST $ \ s# ->
    case cloneMutableArray# (unMArray src) six# n# s# of
        (# s2#, marr# #) -> (# s2#, MArray marr# #)
{-# INLINE cloneMutableArray #-}  -- to make sure optimization triggers

freezeArray :: MArray s a -> Int -> Int -> ST s (Array a)
freezeArray src (I# six#) (I# n#) = ST $ \ s# ->
    case freezeArray# (unMArray src) six# n# s# of
        (# s2#, arr# #) -> (# s2#, Array arr# #)
{-# INLINE freezeArray #-}  -- to make sure optimization triggers

thawArray :: Array a -> Int -> Int -> ST s (MArray s a)
thawArray src (I# six#) (I# n#) = ST $ \ s# ->
    case thawArray# (unArray src) six# n# s# of
        (# s2#, marr# #) -> (# s2#, MArray marr# #)
{-# INLINE thawArray #-}  -- to make sure optimization triggers

toList :: Array a -> Int -> [a]
toList arr n = go 0
  where
    go i | i >= n = []
         | otherwise = indexArray arr i : go (i+1)


text:
set -o xtrace
set -e

# Ensure that the code is warning free.
dartanalyzer --fatal-warnings test/kata_app_test.dart

# Run tests.
dart test/kata_app_test.dart


text:
LightShader::LightShader()
{
	m_vertexShader = 0;
	m_pixelShader = 0;
	m_layout = 0;;
	m_sampleState = 0;
	m_matrixBuffer = 0;
	m_lightBuffer = 0;
}

LightShader::LightShader(const LightShader &)
{

}

LightShader::~LightShader()
{
}

bool LightShader::Initialize(ID3D11Device * device, HWND hwnd)
{
	if (!InitializeShader(device, hwnd, L"./light.vs", L"./light.ps"))
	{
		return false;
	}
	return true;
}

void LightShader::Shutdown()
{
	ShutdownShader();
	return;
}

bool LightShader::Render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, D3DXVECTOR3 lightDirection, D3DXVECTOR4 diffuseColor)
{
	//Set the shader parameters that it will use for rendering.
	if (!SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor))
	{
		return false;
	}

	//Now render the prepared buffers with the shader.
	RenderShader(deviceContext, indexCount);

	return true;
}

bool LightShader::InitializeShader(ID3D11Device * device, HWND hwnd, WCHAR * vsFilename, WCHAR * psFilename)
{
	HRESULT result;
	ID3D10Blob *errorMessage;
	ID3D10Blob *vertexShaderBuffer;
	ID3D10Blob *pixelShaderBuffer;
	D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
	unsigned int numElements;
	D3D11_SAMPLER_DESC samplerDesc;
	D3D11_BUFFER_DESC matrixBufferDesc;
	D3D11_BUFFER_DESC lightBufferDesc;

	//Initialize the pointers this funtions will use to null.
	errorMessage = 0;
	vertexShaderBuffer = 0;
	pixelShaderBuffer = 0;

	//Compile the vertex shader code
	D3DX11CompileFromFile(vsFilename, NULL, NULL, "LightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
				       &vertexShaderBuffer, &errorMessage, &result);
	if (FAILED(result))
	{
		// If the shader failed to compile it should have writen something to the error message.
		if (errorMessage)
		{
			OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
		}
		// If there was nothing in the error message then it simply could not find the shader file itself.
		else
		{
			MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
		}
		return false;
	}

	//Compile the pixel shader code
	D3DX11CompileFromFile(psFilename, NULL, NULL, "LightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
						&pixelShaderBuffer, &errorMessage, &result);
	if (FAILED(result))
	{
		// If the shader failed to compile it should have writen something to the error message.
		if (errorMessage)
		{
			OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
		}
		// If there was  nothing in the error message then it simply could not find the file itself.
		else
		{
			MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
		}
		return false;
	}

	//Create the vertex shader from the buffer
	result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
	if (FAILED(result))
	{
		return false;
	}
	//Create the pixel shader from the buffer
	result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
	if (FAILED(result))
	{
		return false;
	}

	//Setup layout of the data that goes into the shader
	//This setup needs to match the vertexType structure in the ModelClass and in the shader.
	polygonLayout[0].SemanticName = "POSITION";
	polygonLayout[0].SemanticIndex = 0;
	polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
	polygonLayout[0].InputSlot = 0;
	polygonLayout[0].AlignedByteOffset = 0;
	polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
	polygonLayout[0].InstanceDataStepRate = 0;

	polygonLayout[1].SemanticName = "TEXCOORD";
	polygonLayout[1].SemanticIndex = 0;
	polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
	polygonLayout[1].InputSlot = 0;
	polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
	polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
	polygonLayout[1].InstanceDataStepRate = 0;

	polygonLayout[2].SemanticName = "NORMAL";
	polygonLayout[2].SemanticIndex = 0;
	polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
	polygonLayout[2].InputSlot = 0;
	polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
	polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
	polygonLayout[2].InstanceDataStepRate = 0;

	//Get a count of the elements in the layout
	numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);

	//Create the vertex input layout
	result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &m_layout);
	if (FAILED(result))
	{
		return false;
	}

	//Release vertex shader buffer and pixel shader buffer since they are no longer needed.
	vertexShaderBuffer->Release();
	vertexShaderBuffer = 0;

	pixelShaderBuffer->Release();
	pixelShaderBuffer = 0;

	//Create a texture sampler state.
	samplerDesc.Filter = D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
	samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
	samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
	samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
	samplerDesc.MipLODBias = 0.0f;
	samplerDesc.MaxAnisotropy = 1;
	samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
	samplerDesc.BorderColor[0] = 0;
	samplerDesc.BorderColor[1] = 0;
	samplerDesc.BorderColor[2] = 0;
	samplerDesc.BorderColor[3] = 0;
	samplerDesc.MinLOD = 0;
	samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

	//Create the Light sampler state.
	result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
	if (FAILED(result))
	{
		return false;
	}

	//Setup the description of the dynamic matrix constant buffer interface and then use that is in the vertex shader.
	matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
	matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	matrixBufferDesc.MiscFlags = 0;
	matrixBufferDesc.StructureByteStride = 0;

	//Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
	result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
	if (FAILED(result))
	{
		return false;
	}

	//Setup the description of the light dynamic constant buffer that is in the pixel shader.
	//Note that ByteWidth always needs to be a multiple of 16 if using D3D11_BIND_CONSTANT_BUFFER or CreateBuffer will fail.
	lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	lightBufferDesc.ByteWidth = sizeof(LightBufferType);
	lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	lightBufferDesc.MiscFlags = 0;
	lightBufferDesc.StructureByteStride = 0;

	//Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
	result = device->CreateBuffer(&lightBufferDesc, NULL, &m_lightBuffer);
	if (FAILED(result))
	{
		return false;
	}

	return true;
}

void LightShader::ShutdownShader()
{
	//Release the light constant buffer.
	if (m_lightBuffer)
	{
		m_lightBuffer->Release();
		m_lightBuffer = 0;
	}

	//Release the matrix constant buffer.
	if (m_matrixBuffer)
	{
		m_matrixBuffer->Release();
		m_matrixBuffer = 0;
	}

	//Release the sampler state.
	if (m_sampleState)
	{
		m_sampleState->Release();
		m_sampleState = 0;
	}

	//Release the layout
	if (m_layout)
	{
		m_layout->Release();
		m_layout = 0;
	}

	//Release the pixel shader.
	if (m_pixelShader)
	{
		m_pixelShader->Release();
		m_pixelShader = 0;
	}

	//Release the vertex shader.
	if (m_vertexShader)
	{
		m_vertexShader->Release();
		m_vertexShader = 0;
	}

	return;
}

void LightShader::OutputShaderErrorMessage(ID3D10Blob * errorMessage, HWND hwnd, WCHAR *shaderFilename)
{
	char *compileErrors;
	unsigned long bufferSize, i;
	ofstream fout;

	//Get a pointer to the error message text buffer.
	compileErrors = (char *)(errorMessage->GetBufferPointer());

	//Get the length of the message.
	bufferSize = errorMessage->GetBufferSize();

	//Open a file to write the error message to.
	fout.open("shader-error.txt");

	//Write out the error message.
	for (i = 0; i < bufferSize; i++)
	{
		fout << compileErrors[i];
	}

	//Close the file.
	fout.close();

	//Release the error message.
	errorMessage->Release();
	errorMessage = 0;

	//Pop a message up on the screen to notify the user to check the text file for compile errors.
	MessageBox(hwnd, L"Error compiling shade. Check shader-error.txt for message.", shaderFilename, MB_OK);

	return;
}

bool LightShader::SetShaderParameters(ID3D11DeviceContext * deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView *texture, D3DXVECTOR3 lightDirection, D3DXVECTOR4 diffuseColor)
{
	HRESULT result;
	D3D11_MAPPED_SUBRESOURCE mappedResource;
	unsigned int bufferNumber;
	MatrixBufferType *dataPtr;
	LightBufferType *dataPtr2;

	//Transpose the matrices to prepare them for the shader
	D3DXMatrixTranspose(&worldMatrix, &worldMatrix);
	D3DXMatrixTranspose(&viewMatrix, &viewMatrix);
	D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);

	//Lock the constant buffer so it can be written to.
	result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
	if (FAILED(result))
	{
		return false;
	}

	//Get a pointer to the data in the constant buffer.
	dataPtr = (MatrixBufferType*)mappedResource.pData;

	//Copy the matrices into the constant buffer.
	dataPtr->world = worldMatrix;
	dataPtr->view = viewMatrix;
	dataPtr->projection = projectionMatrix;

	//Unlock the constant buffer.
	deviceContext->Unmap(m_matrixBuffer, 0);

	//Set the position of the constant buffer in the vertex shader.
	bufferNumber = 0;

	//Set the constant buffer in the vertex shader with the updated values.
	deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);

	//Set shader Light resource in the pixel shader.
	deviceContext->PSSetShaderResources(0, 1, &texture);

	//Lock the light constant buffer so it can be written to.
	result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
	if (FAILED(result))
	{
		return false;
	}

	//Get a pointer to the data in the constant buffer.
	dataPtr2 = (LightBufferType*)mappedResource.pData;

	//Copy the lighting variables into the constant buffer.
	dataPtr2->diffuseColor = diffuseColor;
	dataPtr2->lightDirection = lightDirection;
	dataPtr2->padding = 0.0f;

	//Unlock the constant buffer.
	deviceContext->Unmap(m_lightBuffer, 0);

	//Set the position of the light constant buffer in the pixel shader.
	bufferNumber = 0;

	//Finally set the light constant buffer in the pixel shader with the updated values.
	deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);

	return true;
}

void LightShader::RenderShader(ID3D11DeviceContext * deviceContext, int indexCount)
{
	//Set the vertex input layout.
	deviceContext->IASetInputLayout(m_layout);

	//Set the vertex and pixel shaders that will be used to render this triangle.
	deviceContext->VSSetShader(m_vertexShader, NULL, 0);
	deviceContext->PSSetShader(m_pixelShader, NULL, 0);

	//Set the sampler state in the pixel shader
	deviceContext->PSSetSamplers(0, 1, &m_sampleState);

	//Render the triangle.
	deviceContext->DrawIndexed(indexCount, 0, 0);

	return;
}


text:
package org.ovirt.engine.core.bll.network;

import java.util.List;
import java.util.Map;

import org.ovirt.engine.core.bll.MacPoolManager;
import org.ovirt.engine.core.bll.context.CompensationContext;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.businessentities.Entities;
import org.ovirt.engine.core.common.businessentities.VmNetworkInterface;
import org.ovirt.engine.core.common.businessentities.Network;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.dal.dbbroker.DbFacade;
import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
import org.ovirt.engine.core.dao.VmNetworkInterfaceDAO;
import org.ovirt.engine.core.dao.VmNetworkStatisticsDAO;
import org.ovirt.engine.core.utils.log.Log;
import org.ovirt.engine.core.utils.log.LogFactory;

/**
 * Helper class to use for adding/removing {@link VmNetworkInterface}s.
 */
public class VmInterfaceManager {

    protected Log log = LogFactory.getLog(getClass());
    /**
     * Add a {@link VmNetworkInterface} to the VM, trying to acquire a MAC from the {@link MacPoolManager}.

     * If the MAC is already in use, a warning will be sent to the user.
     *
     * @param iface
     *            The interface to save.
     * @param compensationContext
     *            Used to snapshot the saved entities.
     * @return true if the MAC wasn't used, false if it was.
     */
    public boolean add(VmNetworkInterface iface, CompensationContext compensationContext, boolean allocateMac) {
        boolean macAdded = false;
        if (allocateMac) {
            iface.setMacAddress(getMacPoolManager().allocateNewMac());
            macAdded = true;
        } else if (getMacPoolManager().IsMacInUse(iface.getMacAddress())) {
            AuditLogableBase logable = new AuditLogableBase();
            logable.AddCustomValue("MACAddr", iface.getMacAddress());
            logable.AddCustomValue("VmName", iface.getVmName());
            log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE);
        } else {
            macAdded = getMacPoolManager().AddMac(iface.getMacAddress());
        }
        getVmNetworkInterfaceDAO().save(iface);
        getVmNetworkStatisticsDAO().save(iface.getStatistics());
        compensationContext.snapshotNewEntity(iface);
        compensationContext.snapshotNewEntity(iface.getStatistics());

        return macAdded;
    }

    /**
     * Remove all {@link VmNetworkInterface}s from the VM, removing from {@link MacPoolManager} if required.
     *
     * @param removeFromMacPool
     *            Should the MAC be removed from {@link MacPoolManager}?
     * @param vmId
     *            The ID of the VM to remove from.
     */
    public void removeAll(boolean removeFromMacPool, Guid vmId) {
        List<VmNetworkInterface> interfaces = getVmNetworkInterfaceDAO().getAllForVm(vmId);
        if (interfaces != null) {
            for (VmNetworkInterface iface : interfaces) {
                if (removeFromMacPool) {
                    getMacPoolManager().freeMac(iface.getMacAddress());
                }

                getVmNetworkInterfaceDAO().remove(iface.getId());
                getVmNetworkStatisticsDAO().remove(iface.getId());
            }
        }
    }

    /**
     * Checks if a Network belongs to the cluster and is a VM Network
     * @param iface
     * @param clusterId
     * @return
     */
    public static boolean isValidVmNetwork(VmNetworkInterface iface, Guid clusterId) {
        Map<String, Network> networksByName =
            Entities.entitiesByName(DbFacade.getInstance()
                    .getNetworkDAO()
                    .getAllForCluster(clusterId));
        String networkName = iface.getNetworkName();
        return (networksByName.containsKey(networkName) && networksByName.get(networkName).isVmNetwork());
    }

    /**
     * Log the given loggable & message to the {@link AuditLogDirector}.
     *
     * @param logable
     * @param auditLogType
     */
    protected void log(AuditLogableBase logable, AuditLogType auditLogType) {
        AuditLogDirector.log(logable, auditLogType);
    }

    protected MacPoolManager getMacPoolManager() {
        return MacPoolManager.getInstance();
    }

    protected VmNetworkStatisticsDAO getVmNetworkStatisticsDAO() {
        return DbFacade.getInstance().getVmNetworkStatisticsDAO();
    }

    protected VmNetworkInterfaceDAO getVmNetworkInterfaceDAO() {
        return DbFacade.getInstance().getVmNetworkInterfaceDAO();
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>Menu: Using The Menu ARIA Plugin</title>

        <!-- Standard reset and fonts -->

        <link rel="stylesheet" type="text/css" href="../../build/reset/reset.css">
        <link rel="stylesheet" type="text/css" href="../../build/fonts/fonts.css">

        <!-- CSS for Menu -->

        <link rel="stylesheet" type="text/css" href="../../build/menu/assets/skins/sam/menu.css">

		<style type="text/css">

            /*
                Setting the "zoom" property to "1" triggers the "hasLayout"
                property in IE.  This is necessary to fix a bug IE where
                mousing mousing off a the text node of MenuItem instance's
                text label, or help text without the mouse actually exiting the
                boundaries of the MenuItem instance will result in the losing
                the background color applied when it is selected.
            */

            #filemenu.visible .yuimenuitemlabel,
            #editmenu.visible .yuimenuitemlabel {

                *zoom: 1;

            }

			/*
				Remove "hasLayout" from the submenu of the file menu.
			*/

            #filemenu.visible .yuimenu .yuimenuitemlabel {

                *zoom: normal;

            }

			/*
				The Menu ARIA Plugin removes the "href" attribute from the <A> element of each
				MenuItem if the value of the "href" is set to "#", resulting in the focus outline
				no longer be rendered in Gecko-based browsers when the <A> element is focused.
				For this reason, it is necessary to restore the focus outline for the <A>.
			*/
			a[role=menuitem]:focus {

				outline: dotted 1px #000;

			}

		</style>

        <!-- Dependency source files -->

        <script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
        <script type="text/javascript" src="../../build/container/container_core.js"></script>

        <!-- Menu source file -->
        <script type="text/javascript" src="../../build/menu/menu.js"></script>

		<script type="text/javascript" src="../container/assets/containerariaplugin.js"></script>
		<script type="text/javascript" src="../menu/assets/menuariaplugin.js"></script>
		<script type="text/javascript">

			(function () {

				var Event = YAHOO.util.Event,
					Dom = YAHOO.util.Dom,
					UA = YAHOO.env.ua,

					/*
						 Define an array of object literals, each containing
						 the data necessary to create the items for a MenuBar.
					*/

					aItemData = [

						{ text: "File", submenu: {  id: "filemenu", itemdata: [

								{ text: "New File", helptext: "Ctrl + N" },
								"New Folder",
								{ text: "Open", helptext: "Ctrl + O" },
								{ text: "Open With...", submenu: { id: "applications", itemdata: [
										"Application 1",
										"Application 2",
										"Application 3",
										"Application 4"
									] }
								},
								{ text: "Print", helptext: "Ctrl + P" }

							] }

						},

						{ text: "Edit", submenu: { id: "editmenu", itemdata: [

								[
									{ text: "Undo", helptext: "Ctrl + Z" },
									{ text: "Redo", helptext: "Ctrl + Y" }
								],

								[
									{ text: "Cut", helptext: "Ctrl + X" },
									{ text: "Copy", helptext: "Ctrl + C" },
									{ text: "Paste", helptext: "Ctrl + V" },
									{ text: "Delete", helptext: "Del" }
								],

								[ { text: "Select All", helptext: "Ctrl + A" } ],

								[
									{ text: "Find", helptext: "Ctrl + F" },
									{ text: "Find Again", helptext: "Ctrl + G" }
								]

							] }

						}

					];

				/*
					 Initialize and render the MenuBar when the page's DOM is ready
					 to be scripted.
				*/

				Event.onDOMReady(function () {

					/*
						Instantiate a MenuBar:  The first argument passed to the constructor
						is the id for the Menu element to be created, the second is an
						object literal of configuration properties.
					*/

					var oMenuBar = new YAHOO.widget.MenuBar("mymenubar", { lazyload: true, itemdata: aItemData });

					/*
						Add a "show" event listener that keeps the left-most
						submenu against the left edge of the browser viewport.
					*/

					function onSubmenuShow() {

						var oIFrame;

						if (this.id == "filemenu") {

							Dom.setX(this.element, 0);

							oIFrame = this.iframe;

							if (oIFrame) {

								Dom.setX(oIFrame, 0);

							}

							this.cfg.setProperty("x", 0, true);

						}

						/*
							Need to set the width for submenus of submenus in IE to prevent the mouseout
							event from firing prematurely when the user mouses off of a MenuItem's
							text node.
						*/

						if ((this.id == "filemenu" || this.id == "editmenu") && YAHOO.env.ua.ie) {

							oElement = this.element;
							nOffsetWidth = oElement.offsetWidth;

							/*
								Measuring the difference of the offsetWidth before and after
								setting the "width" style attribute allows us to compute the
								about of padding and borders applied to the element, which in
								turn allows us to set the "width" property correctly.
							*/

							oElement.style.width = nOffsetWidth + "px";
							oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + "px";

						}

					}

					// Subscribe to the "show" event for each submenu

					oMenuBar.subscribe("show", onSubmenuShow);

					/*
						 Since this MenuBar instance is built completely from
						 script, call the "render" method passing in a node
						 reference for the DOM element that its should be
						 appended to.
					*/

					oMenuBar.render(document.body);

				});

			}());

		</script>

	</head>
	<body class="yui-skin-sam"></body>
</html>