text:
UnitData::UnitData()
    : m_mineralsLost(0)
    , m_gasLost(0)
{
    const int maxTypeID = 1024;
    m_numDeadUnits	    = std::vector<int>(maxTypeID + 1, 0);
    m_numUnits		    = std::vector<int>(maxTypeID + 1, 0);
}

void UnitData::updateUnit(const sc2::Unit & unit)
{
    bool firstSeen = false;
    const auto & it = m_unitMap.find((int)unit.tag);
    if (it == m_unitMap.end())
    {
        firstSeen = true;
        m_unitMap[(int)unit.tag] = UnitInfo();
    }

    UnitInfo & ui   = m_unitMap[(int)unit.tag];
    ui.unit         = unit;
    ui.player       = Util::GetPlayer(unit);
    ui.lastPosition = unit.pos;
    ui.lastHealth   = unit.health;
    ui.lastShields  = unit.shield;
    ui.tag          = (int)unit.tag;
    ui.type         = unit.unit_type;
    ui.progress     = unit.build_progress;

    if (firstSeen)
    {
        m_numUnits[ui.type]++;
    }
}

void UnitData::killUnit(const sc2::Unit & unit)
{
    //_mineralsLost += unit->getType().mineralPrice();
    //_gasLost += unit->getType().gasPrice();
    m_numUnits[unit.unit_type]--;
    m_numDeadUnits[unit.unit_type]++;

    m_unitMap.erase((int)unit.tag);
}

void UnitData::removeBadUnits()
{
    for (auto iter = m_unitMap.begin(); iter != m_unitMap.end();)
    {
        if (badUnitInfo(iter->second))
        {
            m_numUnits[iter->second.type]--;
            iter = m_unitMap.erase(iter);
        }
        else
        {
            iter++;
        }
    }
}

bool UnitData::badUnitInfo(const UnitInfo & ui) const
{
    return false;
}

int UnitData::getGasLost() const
{
    return m_gasLost;
}

int UnitData::getMineralsLost() const
{
    return m_mineralsLost;
}

int UnitData::getNumUnits(sc2::UnitTypeID t) const
{
    return m_numUnits[t];
}

int UnitData::getNumDeadUnits(sc2::UnitTypeID t) const
{
    return m_numDeadUnits[t];
}

const std::map<int, UnitInfo> & UnitData::getUnitInfoMap() const
{
    return m_unitMap;
}


text:
absConfig.pushAfterBootstrap('abs.connexionFeature');

angular.module('abs.connexionFeature').config(connexionConfig);

connexionConfig.$inject = ['$stateProvider'];
function connexionConfig($stateProvider){
  $stateProvider.state('signup', {
    url: '/signup',
    controller: 'SignupPageController',
    controllerAs: 'vm',
    templateUrl: 'views/signup-page.html',
    data: {
      pageTitle: 'Sign Up page',
      pageDesc: 'Sign Up page to access features.'
    }
  }).state('login', {
    url: '/login',
    controller: 'LoginPageController',
    controllerAs: 'vm',
    templateUrl: 'views/login-page.html',
    data: {
      pageTitle: 'Login page',
      pageDesc: 'Login page to access features.'
    }
  });
}

redpajama_set_name: RedPajamaGithub


text:
// Accord Statistics Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2014
// cesarsouza at gmail.com
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

namespace Accord.Statistics.Kernels
{

    /// <summary>
    ///   Kernel function interface.
    /// </summary>
    ///
    /// <remarks>
    /// <para>
    ///   In Machine Learning and statistics, a Kernel is a function that returns
    ///   the value of the dot product between the images of the two arguments.</para>
    ///
    /// <para>  <c>k(x,y) = ‹S(x),S(y)›</c></para>
    ///
    /// <para>
    ///   References:
    ///   <list type="bullet">
    ///     <item><description><a href="http://www.support-vector.net/icml-tutorial.pdf">
    ///     http://www.support-vector.net/icml-tutorial.pdf </a></description></item>
    ///   </list></para>
    /// </remarks>
    ///
    public interface IKernel
    {
        /// <summary>
        ///   The kernel function.
        /// </summary>
        ///
        /// <param name="x">Vector <c>x</c> in input space.</param>
        /// <param name="y">Vector <c>y</c> in input space.</param>
        /// <returns>Dot product in feature (kernel) space.</returns>
        ///
        double Function(double[] x, double[] y);

    }
}


text:
<!doctype html>
<title>CSS Test Reference</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://www.mozilla.org" title="Mozilla">
<div>Hello Kittie


text:
package eu.seaclouds.platform.planner.core.application.topology.nodetemplate;

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

public interface NodeTemplate {

    public static final String TYPE = "type";

    public String getNodeTemplateId();

    public Map<String, Object> transform();

    boolean isDeployedOnIaaS();

    public Map<String, Object> getNodeTypeDefinition();

    public String getModuleType();

    public String getType();

    public String getHostNodeName();

    List<Map<String, Object>> getArtifacts();

    public List<Map<String, Object>> getRequirements();

    public Object getPropertyValue(String propertyName);

    public void updateProperties(Map<String, Object> properties);

    public void addProperty(String propertyId, Object updatingValue);

    public void removeProperty(String propertyName);

}


text:
angular-paylogic-shopping-service
=================================

An [AngularJS](https://angularjs.org/) service that encapsulates the functionality provided by the [Paylogic Shopping Service](https://shopping-service-docs.sandbox.paylogic.com/).

## Getting Started

``angular-paylogic-shopping-service`` requires [Bower](http://bower.io/) and [CoffeeScript](http://coffeescript.org/).

Run ``bower install`` from the root directory of the project to install all the dependencies.

Start a web server, e.g. ``python -m SimpleHTTPServer`` from the root directory of the project and check the demo at [http://localhost:8000/demo.html](http://localhost:8000/demo.html).

The example will not work for the public (unfortunately..) as it requires basic authentication to access the API, and credentials are not provided.

## Configure

``angular-paylogic-shopping-service`` requires basic authentication. For this reason, it can be configured with an apiKey and apiSecret using AngularJS [app bootstrap](https://docs.angularjs.org/guide/bootstrap) feature.

```javascript
var apiKey, apiSecret;

// Define your app, and configure the service
angular.module("demoApp", ["angular-paylogic-shopping-service"])
    .config(function(paylogicShoppingServiceProvider) {
        // Configure the shopping service api with key and secret.
        paylogicShoppingServiceProvider.configure({
          "apiKey": apiKey,
          "apiSecret": apiSecret
        });
    })

// Load the privates and bootstrap the app asynchronously.
$.get("private.json", function(response) {
    apiKey = response.apiKey;
    apiSecret = response.apiSecret;
    angular.element(document).ready(function() {
        angular.bootstrap(document, ["demoApp"]);
    });
});
```

with ``private.json`` having the following format.

```javascript
{
    "apiKey": "Your key here.",
    "apiSecret": "Your secret here."
}
```

## How to use

``angular-paylogic-shopping-service`` exposes a single ``paylogicShoppingService`` component that can be used in the following way to interact with resources.

```javascript
// Inject the angular-paylogic-shopping-service module.
angular.module("app", ["angular-paylogic-shopping-service"])
    // Inject the paylogicShoppingService service in a controller.
    .controller("mainController", function($scope, paylogicShoppingService) {
        // Will return all, as no filtering was specified.
        $scope.events = paylogicShoppingService.events.query();

        // products.get works, even if it is not defined in Product service, as it is a standard method of $resource.
        $scope.product = paylogicShoppingService.products.get({
            productUid: "30df20dd0b0e4bc58f0663edc8a4f640"
        });
    });
```

There is a more [detailed example](https://github.com/spirosikmd/angular-paylogic-shopping-service/blob/master/demo.html) that demonstrates a complete buying process.


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="MeshDataTool" inherits="Reference" category="Core" version="3.1">
	<brief_description>
	</brief_description>
	<description>
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="clear">
			<return type="void">
			</return>
			<description>
			</description>
		</method>
		<method name="commit_to_surface">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="mesh" type="ArrayMesh">
			</argument>
			<description>
			</description>
		</method>
		<method name="create_from_surface">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="mesh" type="ArrayMesh">
			</argument>
			<argument index="1" name="surface" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_edge_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_edge_faces" qualifiers="const">
			<return type="PoolIntArray">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_edge_meta" qualifiers="const">
			<return type="Variant">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_edge_vertex" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="vertex" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_face_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_face_edge" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="edge" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_face_meta" qualifiers="const">
			<return type="Variant">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_face_normal" qualifiers="const">
			<return type="Vector3">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_face_vertex" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="vertex" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_format" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_material" qualifiers="const">
			<return type="Material">
			</return>
			<description>
			</description>
		</method>
		<method name="get_vertex" qualifiers="const">
			<return type="Vector3">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_bones" qualifiers="const">
			<return type="PoolIntArray">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_color" qualifiers="const">
			<return type="Color">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_vertex_edges" qualifiers="const">
			<return type="PoolIntArray">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_faces" qualifiers="const">
			<return type="PoolIntArray">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_meta" qualifiers="const">
			<return type="Variant">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_normal" qualifiers="const">
			<return type="Vector3">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_tangent" qualifiers="const">
			<return type="Plane">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_uv" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_uv2" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_vertex_weights" qualifiers="const">
			<return type="PoolRealArray">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_edge_meta">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="meta" type="Variant">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_face_meta">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="meta" type="Variant">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_material">
			<return type="void">
			</return>
			<argument index="0" name="material" type="Material">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="vertex" type="Vector3">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_bones">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="bones" type="PoolIntArray">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_color">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="color" type="Color">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_meta">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="meta" type="Variant">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_normal">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="normal" type="Vector3">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_tangent">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="tangent" type="Plane">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_uv">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="uv" type="Vector2">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_uv2">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="uv2" type="Vector2">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_vertex_weights">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<argument index="1" name="weights" type="PoolRealArray">
			</argument>
			<description>
			</description>
		</method>
	</methods>
	<constants>
	</constants>
</class>


text:
<?php

namespace Oro\Bundle\DraftBundle\Tests\Unit\Provider;

use Oro\Bundle\DraftBundle\Provider\ChainDraftableFieldsExclusionProvider;
use Oro\Bundle\DraftBundle\Provider\DraftableFieldsExclusionProviderInterface;

class ChainDraftableFieldsExclusionProviderTest extends \PHPUnit\Framework\TestCase
{
    public function testGetExcludedFieldsNoProviders(): void
    {
        $chainProvider = new ChainDraftableFieldsExclusionProvider([]);

        $this->assertEquals([], $chainProvider->getExcludedFields(\stdClass::class));
    }

    public function testGetExcludedFields(): void
    {
        $provider1 = $this->getProviderMock(\stdClass::class, true, 1, ['field_1']);
        $provider2 = $this->getProviderMock(\stdClass::class, false, 0, ['field_2']);
        $provider3 = $this->getProviderMock(\stdClass::class, true, 1, ['field_3']);

        $chainProvider = new ChainDraftableFieldsExclusionProvider([
            $provider1,
            $provider2,
            $provider3
        ]);

        $this->assertEquals(['field_1', 'field_3'], $chainProvider->getExcludedFields(\stdClass::class));
    }

    public function testGetExcludedFieldsWhenAllProvidersDidNotReturnFields(): void
    {
        $provider1 = $this->getProviderMock(\stdClass::class, true, 1, []);

        $chainProvider = new ChainDraftableFieldsExclusionProvider([
            $provider1,
        ]);

        $this->assertEquals([], $chainProvider->getExcludedFields(\stdClass::class));
    }

    /**
     * @param string $className
     * @param bool $isSupport
     * @param int $getExcludedFieldsCalls
     * @param array $excludedFields
     * @return DraftableFieldsExclusionProviderInterface|\PHPUnit\Framework\MockObject\MockObject
     */
    private function getProviderMock(
        string $className,
        bool $isSupport,
        int $getExcludedFieldsCalls,
        array $excludedFields
    ) {
        $provider = $this->createMock(DraftableFieldsExclusionProviderInterface::class);
        $provider->expects($this->once())
            ->method('isSupport')
            ->with($className)
            ->willReturn($isSupport);
        $provider->expects($this->exactly($getExcludedFieldsCalls))
            ->method('getExcludedFields')
            ->willReturn($excludedFields);

        return $provider;
    }
}


text:
"use strict";

function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Test = function Test() {
  _classCallCheck(this, Test);
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbIlRlc3QiXSwibWFwcGluZ3MiOiI7Ozs7OztJQUFNQSxJIiwiZmlsZSI6ImJhci5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59Il19


text:
Expected results.
### Service
+ [BidLandscapeService](../../services/BidLandscapeService.md)

### Namespace
[BidLandscapeService#Namespace](../../services/BidLandscapeService.md#namespace)

| Field | Data Type | Description |
|---|---|---|
| campaignId| xsd:long| Campaign ID. |
| adGroupId| xsd:long| Ad Gropup ID. |
| startDate| xsd:string| Start date. |
| endDate| xsd:string| End date. |
| landscapePoints[]| LandscapePoints| This field is a container that stores the estimate results. |
| BidLandscape.Type| xsd:string| The subtype of BidLandscape. |

この 作品 は クリエイティブ・コモンズ 表示 - 改変禁止 2.1 日本 ライセンスの下に提供されています。


text:
'use strict'

const api = module.exports = require('express').Router()

api
  .get('/heartbeat', (req, res) => res.send({ok: true}))
  .use('/auth', require('./auth'))
  .use('/users', require('./users'))
  .use('/products', require('./products'))
  .use('/orders', require('./orders'))
  .use('/userSessions', require('./userSessions'))
  .use('/reviews', require('./reviews'))

// No routes matched? 404.
api.use((req, res) => res.status(404).end())


text:
package debop4k.data.orm.hibernate.usertypes.encrypt;

import debop4k.core.cryptography.Cryptographyx;
import debop4k.core.cryptography.Encryptor;
import debop4k.core.cryptography.RC2Encryptor;

/**
 * {@link RC2Encryptor} 를 이용하여,
 * 문자열을 암호화/복호화를 수행해주는 UserType 입니다.
 *
 * @author sunghyouk.bae@gmail.com
 * @since 2015. 8. 27.
 */
public class TripleDESStringUserType extends EncryptedStringUserType {

  @Override
  public Encryptor encrytor() {
    return Cryptographyx.getTRIPLE_DES();
  }

}


text:
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets;
using osu.Game.Screens.Play.HUD;
using osu.Game.Users;
using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
{
    public class ParticipantPanel : MultiplayerRoomComposite, IHasContextMenu
    {
        public readonly MultiplayerRoomUser User;

        [Resolved]
        private IAPIProvider api { get; set; }

        [Resolved]
        private RulesetStore rulesets { get; set; }

        private SpriteIcon crown;

        private OsuSpriteText userRankText;
        private ModDisplay userModsDisplay;
        private StateDisplay userStateDisplay;

        private IconButton kickButton;

        public ParticipantPanel(MultiplayerRoomUser user)
        {
            User = user;

            RelativeSizeAxes = Axes.X;
            Height = 40;
        }

        [BackgroundDependencyLoader]
        private void load()
        {
            var user = User.User;

            var backgroundColour = Color4Extensions.FromHex("#33413C");

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 18),
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        crown = new SpriteIcon
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Icon = FontAwesome.Solid.Crown,
                            Size = new Vector2(14),
                            Colour = Color4Extensions.FromHex("#F7E65D"),
                            Alpha = 0
                        },
                        new TeamDisplay(User),
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking = true,
                            CornerRadius = 5,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour = backgroundColour
                                },
                                new UserCoverBackground
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    RelativeSizeAxes = Axes.Both,
                                    Width = 0.75f,
                                    User = user,
                                    Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f))
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Spacing = new Vector2(10),
                                    Direction = FillDirection.Horizontal,
                                    Children = new Drawable[]
                                    {
                                        new UpdateableAvatar
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            RelativeSizeAxes = Axes.Both,
                                            FillMode = FillMode.Fit,
                                            User = user
                                        },
                                        new UpdateableFlag
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Size = new Vector2(30, 20),
                                            Country = user?.Country
                                        },
                                        new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                                            Text = user?.Username
                                        },
                                        userRankText = new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font = OsuFont.GetFont(size: 14),
                                        }
                                    }
                                },
                                new Container
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    AutoSizeAxes = Axes.Both,
                                    Margin = new MarginPadding { Right = 70 },
                                    Child = userModsDisplay = new ModDisplay
                                    {
                                        Scale = new Vector2(0.5f),
                                        ExpansionMode = ExpansionMode.AlwaysContracted,
                                    }
                                },
                                userStateDisplay = new StateDisplay
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Margin = new MarginPadding { Right = 10 },
                                }
                            }
                        },
                        kickButton = new KickButton
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Alpha = 0,
                            Margin = new MarginPadding(4),
                            Action = () => Client.KickUser(User.UserID),
                        },
                    },
                }
            };
        }

        protected override void OnRoomUpdated()
        {
            base.OnRoomUpdated();

            if (Room == null || Client.LocalUser == null)
                return;

            const double fade_time = 50;

            var ruleset = rulesets.GetRuleset(Room.Settings.RulesetID).CreateInstance();

            var currentModeRank = User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank;
            userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;

            userStateDisplay.UpdateStatus(User.State, User.BeatmapAvailability);

            if ((User.BeatmapAvailability.State == DownloadState.LocallyAvailable) && (User.State != MultiplayerUserState.Spectating))
                userModsDisplay.FadeIn(fade_time);
            else
                userModsDisplay.FadeOut(fade_time);

            if (Client.IsHost && !User.Equals(Client.LocalUser))
                kickButton.FadeIn(fade_time);
            else
                kickButton.FadeOut(fade_time);

            if (Room.Host?.Equals(User) == true)
                crown.FadeIn(fade_time);
            else
                crown.FadeOut(fade_time);

            // If the mods are updated at the end of the frame, the flow container will skip a reflow cycle: https://github.com/ppy/osu-framework/issues/4187
            // This looks particularly jarring here, so re-schedule the update to that start of our frame as a fix.
            Schedule(() => userModsDisplay.Current.Value = User.Mods.Select(m => m.ToMod(ruleset)).ToList());
        }

        public MenuItem[] ContextMenuItems
        {
            get
            {
                if (Room == null)
                    return null;

                // If the local user is targetted.
                if (User.UserID == api.LocalUser.Value.Id)
                    return null;

                // If the local user is not the host of the room.
                if (Room.Host?.UserID != api.LocalUser.Value.Id)
                    return null;

                int targetUser = User.UserID;

                return new MenuItem[]
                {
                    new OsuMenuItem("Give host", MenuItemType.Standard, () =>
                    {
                        // Ensure the local user is still host.
                        if (!Client.IsHost)
                            return;

                        Client.TransferHost(targetUser);
                    }),
                    new OsuMenuItem("Kick", MenuItemType.Destructive, () =>
                    {
                        // Ensure the local user is still host.
                        if (!Client.IsHost)
                            return;

                        Client.KickUser(targetUser);
                    })
                };
            }
        }

        public class KickButton : IconButton
        {
            public KickButton()
            {
                Icon = FontAwesome.Solid.UserTimes;
                TooltipText = "Kick";
            }

            [BackgroundDependencyLoader]
            private void load(OsuColour colours)
            {
                IconHoverColour = colours.Red;
            }
        }
    }
}


text:
import React, { Component, PropTypes } from 'react'
import classnames from 'classnames'
import TodoTextInput from './TodoTextInput'
import ReactUIDebugger from './../../../../build/react-ui-debugger'

class TodoItem extends Component {
  static propTypes = {
    todo: PropTypes.object.isRequired,
    editTodo: PropTypes.func.isRequired,
    deleteTodo: PropTypes.func.isRequired,
    completeTodo: PropTypes.func.isRequired
  }

  state = {
    editing: false
  }

  handleDoubleClick = () => {
    this.setState({ editing: true })
  }

  handleSave = (id, text) => {
    if (text.length === 0) {
      this.props.deleteTodo(id)
    } else {
      this.props.editTodo(id, text)
    }
    this.setState({ editing: false })
  }

  render() {
    const { todo, completeTodo, deleteTodo } = this.props

    let element
    if (this.state.editing) {
      element = (
        <TodoTextInput text={todo.text}
                       editing={this.state.editing}
                       onSave={(text) => this.handleSave(todo.id, text)} />
      )
    } else {
      element = (

          <input className="toggle"
                 type="checkbox"
                 checked={todo.completed}
                 onChange={() => completeTodo(todo.id)} />

            {todo.text}

          <button className="destroy"
                  onClick={() => deleteTodo(todo.id)} />

      )
    }

    return (

        {element}

    )
  }
}

export default ReactUIDebugger(TodoItem)


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>

// System.Collections.Generic.List`1<UnityEngine.AnimationClip>
struct List_1_t854525466;
// UnityEngine.AnimationClip
struct AnimationClip_t57566497;

#include "mscorlib_System_ValueType4014882752.h"

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif

// System.Collections.Generic.List`1/Enumerator<UnityEngine.AnimationClip>
struct  Enumerator_t3235275754
{
public:
	// System.Collections.Generic.List`1<T> System.Collections.Generic.List`1/Enumerator::l
	List_1_t854525466 * ___l_0;
	// System.Int32 System.Collections.Generic.List`1/Enumerator::next
	int32_t ___next_1;
	// System.Int32 System.Collections.Generic.List`1/Enumerator::ver
	int32_t ___ver_2;
	// T System.Collections.Generic.List`1/Enumerator::current
	AnimationClip_t57566497 * ___current_3;

public:
	inline static int32_t get_offset_of_l_0() { return static_cast<int32_t>(offsetof(Enumerator_t3235275754, ___l_0)); }
	inline List_1_t854525466 * get_l_0() const { return ___l_0; }
	inline List_1_t854525466 ** get_address_of_l_0() { return &___l_0; }
	inline void set_l_0(List_1_t854525466 * value)
	{
		___l_0 = value;
		Il2CppCodeGenWriteBarrier(&___l_0, value);
	}

	inline static int32_t get_offset_of_next_1() { return static_cast<int32_t>(offsetof(Enumerator_t3235275754, ___next_1)); }
	inline int32_t get_next_1() const { return ___next_1; }
	inline int32_t* get_address_of_next_1() { return &___next_1; }
	inline void set_next_1(int32_t value)
	{
		___next_1 = value;
	}

	inline static int32_t get_offset_of_ver_2() { return static_cast<int32_t>(offsetof(Enumerator_t3235275754, ___ver_2)); }
	inline int32_t get_ver_2() const { return ___ver_2; }
	inline int32_t* get_address_of_ver_2() { return &___ver_2; }
	inline void set_ver_2(int32_t value)
	{
		___ver_2 = value;
	}

	inline static int32_t get_offset_of_current_3() { return static_cast<int32_t>(offsetof(Enumerator_t3235275754, ___current_3)); }
	inline AnimationClip_t57566497 * get_current_3() const { return ___current_3; }
	inline AnimationClip_t57566497 ** get_address_of_current_3() { return &___current_3; }
	inline void set_current_3(AnimationClip_t57566497 * value)
	{
		___current_3 = value;
		Il2CppCodeGenWriteBarrier(&___current_3, value);
	}
};

#ifdef __clang__
#pragma clang diagnostic pop
#endif


text:
/*
 * Do not modify this file. This file is generated from the iam-2010-05-08.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

using Amazon.Runtime;
using Amazon.Runtime.Internal;

namespace Amazon.IdentityManagement.Model
{
    ///
    /// Contains the response to a successful GetServerCertificate request.
    ///
    public partial class GetServerCertificateResponse : AmazonWebServiceResponse
    {
        private ServerCertificate _serverCertificate;

        ///
        /// Gets and sets the property ServerCertificate.
        /// <para>
        /// Information about the server certificate.
        /// </para>
        ///
        public ServerCertificate ServerCertificate
        {
            get { return this._serverCertificate; }
            set { this._serverCertificate = value; }
        }

        // Check to see if ServerCertificate property is set
        internal bool IsSetServerCertificate()
        {
            return this._serverCertificate != null;
        }

    }
}


text:
module Remi
  module Dataview
    extend self

    @chart = nil
    @tpl = nil

    def view(dataset)
      create_google_table(dataset)
      table_tpl

      unless File.directory?(RemiConfig.work_dirname)
        FileUtils.mkdir_p(RemiConfig.work_dirname)
      end

      file_name = "visualr-#{dataset.name}-#{Digest::MD5.hexdigest Time.new.to_s}.html"
      viewdata_fullpath = File.join(RemiConfig.work_dirname,file_name);
      File.open(viewdata_fullpath,'w') do |f|
        f.write table_tpl.result(binding)
      end

      Launchy.open(viewdata_fullpath)
    end

    def create_google_table(dataset)
      google_table = GoogleVisualr::DataTable.new

      Datastep.read dataset do |ds|
        if ds._N_ == 1
          # Send all columns as strings, until we have some better typing rules
          dataset.vars.each do |var_name,var_key|
            google_table.new_column('string', var_name)
          end
        end

        if ds._N_ <= 1000
          google_table.add_rows(1)

          ivar = -1
          dataset.vars.each do |var_name,var_obj|
            google_table.set_cell(dataset._N_ - 1,ivar += 1, dataset[var_name].to_s)
          end
        else
          break
        end
      end

=begin
      # I would like to support number formats in some fashion like this
      google_table.set_cell(0, 0, 'Mike'  )
      google_table.set_cell(0, 1, {:v => 10000, :f => '$10,000'})
      google_table.set_cell(0, 2, true  )
      google_table.set_cell(1, 0, 'Jim'   )
      google_table.set_cell(1, 1, {:v => 8000 , :f => '$8,000' })
      google_table.set_cell(1, 2, false )
=end

      opts   = { :showRowNumber => true }
      @chart = GoogleVisualr::Interactive::Table.new(google_table, opts)
    end

    def table_tpl
      @tpl = ERB.new <<-EOF.unindent
      <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>

          <meta http-equiv='content-type' content='text/html; charset=utf-8'/>
          <title>
            Google Visualization API Sample
          </title>

            <%= @chart.to_js('table')%>

      EOF
    end
  end
end


text:
"""Storage backend management
"""

import urlparse

from oslo.config import cfg
from stevedore import driver

from ceilometer.openstack.common.gettextutils import _  # noqa
from ceilometer.openstack.common import log
from ceilometer import service
from ceilometer import utils

LOG = log.getLogger(__name__)

STORAGE_ENGINE_NAMESPACE = 'ceilometer.storage'

OLD_STORAGE_OPTS = [
    cfg.StrOpt('database_connection',
               secret=True,
               default=None,
               help='DEPRECATED - Database connection string',
               ),
]

cfg.CONF.register_opts(OLD_STORAGE_OPTS)

STORAGE_OPTS = [
    cfg.IntOpt('time_to_live',
               default=-1,
               help="""number of seconds that samples are kept
in the database for (<= 0 means forever)"""),
]

cfg.CONF.register_opts(STORAGE_OPTS, group='database')

cfg.CONF.import_opt('connection',
                    'ceilometer.openstack.common.db.sqlalchemy.session',
                    group='database')

class StorageBadVersion(Exception):
    """Error raised when the storage backend version is not good enough."""

def get_engine(conf):
    """Load the configured engine and return an instance."""
    if conf.database_connection:
        conf.set_override('connection', conf.database_connection,
                          group='database')
    engine_name = urlparse.urlparse(conf.database.connection).scheme
    LOG.debug(_('looking for %(name)r driver in %(namespace)r') % (
              {'name': engine_name,
               'namespace': STORAGE_ENGINE_NAMESPACE}))
    mgr = driver.DriverManager(STORAGE_ENGINE_NAMESPACE,
                               engine_name,
                               invoke_on_load=True)
    return mgr.driver

def get_connection(conf):
    """Return an open connection to the database."""
    return get_engine(conf).get_connection(conf)

class SampleFilter(object):
    """Holds the properties for building a query from a meter/sample filter.

    :param user: The sample owner.
    :param project: The sample project.
    :param start: Earliest time point in the request.
    :param start_timestamp_op: Earliest timestamp operation in the request.
    :param end: Latest time point in the request.
    :param end_timestamp_op: Latest timestamp operation in the request.
    :param resource: Optional filter for resource id.
    :param meter: Optional filter for meter type using the meter name.
    :param source: Optional source filter.
    :param metaquery: Optional filter on the metadata
    """
    def __init__(self, user=None, project=None,
                 start=None, start_timestamp_op=None,
                 end=None, end_timestamp_op=None,
                 resource=None, meter=None,
                 source=None, metaquery={}):
        self.user = user
        self.project = project
        self.start = utils.sanitize_timestamp(start)
        self.start_timestamp_op = start_timestamp_op
        self.end = utils.sanitize_timestamp(end)
        self.end_timestamp_op = end_timestamp_op
        self.resource = resource
        self.meter = meter
        self.source = source
        self.metaquery = metaquery

class EventFilter(object):
    """Properties for building an Event query.

    :param start: UTC start datetime (mandatory)
    :param end: UTC end datetime (mandatory)
    :param event_type: the name of the event. None for all.
    :param traits: the trait filter dict, all of which are optional
                    {'key': <key>,
                    't_string': <value>,
                    't_int': <value>,
                    't_datetime': <value>
                    't_float': <value>}
                   currently, only one trait dict is supported.
    """

    def __init__(self, start, end, event_type=None, traits={}):
        self.start = utils.sanitize_timestamp(start)
        self.end = utils.sanitize_timestamp(end)
        self.event_type = event_type
        self.traits = traits

def dbsync():
    service.prepare_service()
    get_connection(cfg.CONF).upgrade()

def expirer():
    service.prepare_service()
    LOG.debug(_("Clearing expired metering data"))
    storage_conn = get_connection(cfg.CONF)
    storage_conn.clear_expired_metering_data(
        cfg.CONF.database.time_to_live)


text:
package com.ait.lienzo.ks.client.views.components;

import com.ait.lienzo.client.core.shape.Layer;
import com.ait.lienzo.client.core.shape.MultiPath;
import com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor;
import com.ait.lienzo.client.core.shape.wires.IDockingAcceptor;
import com.ait.lienzo.client.core.shape.wires.WiresContainer;
import com.ait.lienzo.client.core.shape.wires.WiresManager;
import com.ait.lienzo.client.core.shape.wires.WiresShape;
import com.ait.lienzo.client.core.types.Point2D;
import com.ait.lienzo.ks.client.ui.components.KSSimple;
import com.ait.lienzo.ks.client.views.AbstractToolBarViewComponent;
import com.ait.lienzo.shared.core.types.ColorName;

public class WiresDockingViewComponent extends AbstractToolBarViewComponent
{
    private final KSSimple m_label = new KSSimple("  White-smoke shape can contain both red and blue shapes.  " + "Only blue shape can be docked to while-somke shape..  ", 1);

    public WiresDockingViewComponent()
    {
        final Layer layer = new Layer();

        getToolBarContainer().add(m_label);

        final WiresManager wires_manager = WiresManager.get(layer);

        wires_manager.setContainmentAcceptor(IContainmentAcceptor.ALL);

        wires_manager.setDockingAcceptor(new IDockingAcceptor()
        {
            @Override
            public boolean dockingAllowed(final WiresContainer parent, final WiresShape child)
            {
                return acceptDocking(parent, child);
            }

            @Override
            public boolean acceptDocking(final WiresContainer parent, final WiresShape child)
            {
                final String pd = getUserData(parent);
                final String cd = getUserData(child);
                return "parent".equals(pd) && "dock".equals(cd);
            }

            @Override
            public int getHotspotSize()
            {
                return IDockingAcceptor.HOTSPOT_SIZE;
            }

            private String getUserData(final WiresContainer shape)
            {
                return ((null != shape) && (null != shape.getContainer()) && (null != shape.getContainer().getUserData())) ? shape.getContainer().getUserData().toString() : null;
            }
        });

        final MultiPath parentMultiPath = new MultiPath().rect(0, 0, 400, 400).setStrokeColor("#000000").setFillColor(ColorName.WHITESMOKE);
        final WiresShape parentShape = new WiresShape(parentMultiPath);
        parentShape.getContainer().setUserData("parent");
        wires_manager.register(parentShape);
        parentShape.setLocation(new Point2D(500, 200)).setDraggable(true);
        wires_manager.getMagnetManager().createMagnets(parentShape);

        final MultiPath childMultiPath = new MultiPath().rect(0, 0, 100, 100).setStrokeColor(ColorName.RED).setFillColor(ColorName.RED);
        final WiresShape childShape = new WiresShape(childMultiPath);
        childShape.getContainer().setUserData("child");
        wires_manager.register(childShape);
        childShape.setLocation(new Point2D(50, 200)).setDraggable(true);

        wires_manager.getMagnetManager().createMagnets(childShape);

        final MultiPath dockMultiPath = new MultiPath().rect(0, 0, 100, 100).setStrokeColor(ColorName.BLUE).setFillColor(ColorName.BLUE);
        final WiresShape dockShape = new WiresShape(dockMultiPath);
        dockShape.getContainer().setUserData("dock");
        wires_manager.register(dockShape);
        dockShape.setLocation(new Point2D(50, 400)).setDraggable(true);
        wires_manager.getMagnetManager().createMagnets(dockShape);

        getLienzoPanel().add(layer);

        getLienzoPanel().setBackgroundLayer(getBackgroundLayer());

        getWorkingContainer().add(getLienzoPanel());
    }
}


text:
 <#
 .SYNOPSIS
     Installs NodeJs from http://nodejs.org/dist on a machine
 .DESCRIPTION
     This script installs NodeJs from http://nodejs.org/dist on a machine.
 .PARAMETER Version
     The version of NodeJS to install.
 .LINK
     https://nodejs.org/en/
 #>
param(
    [Parameter(Mandatory = $true)]
    $Version
)

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
$InstallDir = $PSScriptRoot + '\nodejs' # Always install to workitem root / nodejs

Set-StrictMode -Version 1

if (Get-Command "node.exe" -ErrorAction SilentlyContinue)
{
    Write-Host "Found node.exe in PATH"
    exit
}

if (Test-Path "$InstallDir\node.exe")
{
    Write-Host "Node.exe found at $InstallDir\node.exe"
    exit
}

$nodeFile="node-v$Version-win-x64"
$url="http://nodejs.org/dist/v$Version/$nodeFile.zip"
Write-Host "Starting download of NodeJs ${Version} from $url"
& $PSScriptRoot\Download.ps1 $url nodejs.zip
Write-Host "Done downloading NodeJS ${Version}"

$tempPath = [System.IO.Path]::GetTempPath()
$tempDir = Join-Path $tempPath nodejs
New-Item -Path "$tempDir" -ItemType "directory" -Force
Write-Host "Extracting to $tempDir"

if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) {
    # Use built-in commands where possible as they are cross-plat compatible
    Microsoft.PowerShell.Archive\Expand-Archive -Path "nodejs.zip" -DestinationPath $tempDir -Force
}
else {
    Remove-Item $tempDir -Recurse -ErrorAction Ignore
    # Fallback to old approach for old installations of PowerShell
    Add-Type -AssemblyName System.IO.Compression.FileSystem
    [System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
}

Write-Host "Expanded NodeJs to $tempDir, moving $tempDir\$nodeFile to $InstallDir subdir"
move $tempDir\$nodeFile $InstallDir
if (Test-Path "$InstallDir\node.exe")
{
    Write-Host "Node.exe copied to $InstallDir"
}
else
{
    Write-Host "Node.exe not copied to $InstallDir"
}


text:
package org.mousephenotype.cda.db.utilities;

import com.zaxxer.hikari.HikariDataSource;
import org.mousephenotype.cda.utilities.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.sql.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.*;

/**
 * Created by jmason on 26/03/2014.
 */
@Component
public class SqlUtils {

    private static final Logger      logger      = LoggerFactory.getLogger(SqlUtils.class);
    private              CommonUtils commonUtils = new CommonUtils();

    // Hikari parameters:
    //    https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby
    private final static Integer INITIAL_POOL_CONNECTIONS = 1;
    private final static Integer MAXIMUM_POOL_SIZE        = 100;            // Default is 10. OntologyParserTest times out with 10.

    /**
     * Overloaded helper methods for preparing SQL statement
     * @param s statement to use to insert
     * @param var variable being inserted
     * @param index position in the statement to insert the variable
     * @throws SQLException
     */
    static public void setSqlParameter(PreparedStatement s, Integer var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.INTEGER);
        } else {
            s.setInt(index, var);
        }
    }
    static public void setSqlParameter(PreparedStatement s, Long var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.INTEGER);
        } else {
            s.setLong(index, var);
        }
    }
    static public void setSqlParameter(PreparedStatement s, String var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.VARCHAR);
        } else {
            s.setString(index, var);
        }
    }
    static public void setSqlParameter(PreparedStatement s, Boolean var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.BOOLEAN);
        } else {
            s.setBoolean(index, var);
        }
    }
    static public void setSqlParameter(PreparedStatement s, Float var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.FLOAT);
        } else {
            s.setFloat(index, var);
        }
    }
    static public void setSqlParameter(PreparedStatement s, Double var, int index) throws SQLException {
        if(var==null) {
            s.setNull(index, Types.DOUBLE);
        } else {
            s.setDouble(index, var);
        }
    }

    static public void setSqlParameter(PreparedStatement s, Timestamp var, int index) throws SQLException {

        if (var == null) {
            s.setNull(index, Types.TIMESTAMP);
        } else {
            s.setTimestamp(index, var);
        }
    }

    /**
     * Given a date string, this method attempts to convert the date to a
     * java.sql.Date object and, if successful, returns the date. If
     * not successful, returns null.
     *
     * @param dateString The date string against which to attempt conversion
     * @return the java.sql.Date date, if successful; null otherwise
     */
    public java.sql.Date tryParseStringToDbDate(String dateString) {
        java.sql.Date retVal = null;

        try {
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = df.parse(dateString);
            retVal = new java.sql.Date(date.getTime());
        }
        catch(ParseException e) { }

        return retVal;
    }

	/**
	 * Determine if a column exists in a table specific for a MySQL database
	 *
	 * @param connection the connection to use to query the database
	 * @param tableName the table to
	 * @param columnName the column in the table
	 * @return true = column name exists in table, false = column missing from table
	 * @throws SQLException on db access error
	 */
	public Boolean columnInSchemaMysql(Connection connection, String tableName, String columnName) throws SQLException {

		Boolean found = Boolean.FALSE;
		String columnQuery = "SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=(SELECT database()) AND TABLE_NAME=? AND column_name=?";

		try (PreparedStatement p = connection.prepareStatement(columnQuery)) {
			p.setString(1, tableName);
			p.setString(2, columnName);
			ResultSet r = p.executeQuery();
			if (r.next()) {
				found = Boolean.TRUE;
			}
		}

		return found;
	}

    /**
     * Given two {@link JdbcTemplate} instances and a query, executes the query against {@code jdbc1}, then
     * against {@code jdbc2}, returning the set difference of the results found in {@code jdbc1} but not
     * found in {@code jdbc2}. If there are no differences, an empty list is returned. If results are returned,
     * the first row is the column headings. Subsequent rows are the data.. Strict comparison rules are used for Strings:
     * i.e., no mapping of null to empty string, no trimming of strings, no lowercasing of strings before comparison.
     *
     * @param jdbc1 the first {@link JdbcTemplate} instance
     * @param jdbc2 the second {@link JdbcTemplate} instance
     * @param query the query to execute against both {@link JdbcTemplate} instances
     *
     * @return the set difference of the results found in jdbc1 but not found in jdbc2. If there are no differences,
     *         an empty list is returned.
     *
     * @throws Exception
     */
    public List<String[]> queryDiff(NamedParameterJdbcTemplate jdbc1, NamedParameterJdbcTemplate jdbc2, String query) throws Exception {
        return queryDiff(jdbc1, jdbc2, query, false);
    }

    /**
     * Given two {@link JdbcTemplate} instances and a query, executes the query against {@code jdbc1}, then
     * against {@code jdbc2}, returning the set difference of the results found in {@code jdbc1} but not
     * found in {@code jdbc2}. If there are no differences, an empty list is returned. If results are returned,
     * the first row is the column headings. Subsequent rows are the data.
     *
     * @param jdbc1 the first {@link JdbcTemplate} instance
     * @param jdbc2 the second {@link JdbcTemplate} instance
     * @param query the query to execute against both {@link JdbcTemplate} instances
     * @param useLenient if true, for String types, trim leading and trailing spaces, lowercase the strings, and convert NULLs to empty strings first.
     *                   if false, use exact comparison.
     *
     * @return the set difference of the results found in jdbc1 but not found in jdbc2. If there are no differences,
     *         an empty list is returned.
     *
     * @throws Exception
     */
    public List<String[]> queryDiff(NamedParameterJdbcTemplate jdbc1, NamedParameterJdbcTemplate jdbc2, String query, boolean useLenient) throws Exception {
        List<String[]> results = new ArrayList<>();

        Set<List<String>> results1 = new HashSet<>();
        SqlRowSet         rs1      = jdbc1.queryForRowSet(query, new HashMap<>());
        while (rs1.next()) {
            results1.add(getData(rs1, useLenient));
        }

        Set<List<String>> results2 = new HashSet<>();
        SqlRowSet rs2 = jdbc2.queryForRowSet(query, new HashMap<>());
        while (rs2.next()) {
            results2.add(getData(rs2, useLenient));
        }

        // Fill the results list with the rows found in results1 but not found in results2.
        results1.removeAll(results2);

        if ( ! results1.isEmpty()) {
            String[] columnNames = rs1.getMetaData().getColumnNames();
            results.add(columnNames);

            Iterator<List<String>> it = results1.iterator();
            while (it.hasNext()) {
                results.add(it.next().toArray(new String[0]));
            }
        }

        return results;
    }

    /**
     * Given a valid {@link NamedParameterJdbcTemplate} instance, returns that connection's database name, database
     * server name, and database port number in a {@link Map}:
     *

     *
key: dbname

     *
key: dbserver

     *
key: dbport

     *

     *
     * @param jdbc the {@link NamedParameterJdbcTemplate} instance to query
     *
     * @return the connection's database name, database server name, and database port number
     */
    public Map<String, String> getDbInfo(NamedParameterJdbcTemplate jdbc) {

        Map<String, String> results = new HashMap<>();

        String s = jdbc.getJdbcOperations().queryForObject("SELECT DATABASE()", String.class);
        results.put("dbname", s);

        s = jdbc.getJdbcOperations().queryForObject("SELECT @@HOSTNAME", String.class);
        results.put("dbserver", s);

        s = jdbc.getJdbcOperations().queryForObject("SELECT @@PORT", String.class);
        results.put("dbport", s);

        return results;
    }

    /**
     * Given a valid {@link NamedParameterJdbcTemplate} instance, returns that connection's database name, database
     * server name, and database port number in a {@link String} in the format dbserver:dbport/dbname
     *
     * @param jdbc the {@link NamedParameterJdbcTemplate} instance to query
     *
     * @return the connection's database name, database server name, and database port number in a {@link String} in the
     * format dbserver:dbport/dbname
     */
    public String getDbInfoString(NamedParameterJdbcTemplate jdbc) {
        Map<String, String> info = getDbInfo(jdbc);

        return info.get("dbserver") + ":" + info.get("dbport") + "/" + info.get("dbname");
    }

    /**
     *
     * @param jdbc valid {@link NamedParameterJdbcTemplate} instance
     *
     * @return the database name
     */
    public String getDatabaseName(NamedParameterJdbcTemplate jdbc) {
        Map<String, String> dbinfo = getDbInfo(jdbc);

        return dbinfo.get("dbname");
    }

    /**
     * Given two {@link JdbcTemplate} instances of the same schema type and a query that produces a single int/long
     * value, this method executes the query against {@code jdbcPrevious}, then against {@code jdbcCurrent}. The status,
     * query, counts, ratio, delta, and a column indicating whether or not the ratio is below the threshold are returned
     * as row 2 of the results list.
     *
     * @param jdbcPrevious the previous {@link JdbcTemplate} instance
     * @param jdbcCurrent the current {@link JdbcTemplate} instance
     * @param delta the ratio of currentValue / previousValue beneath which the query should be marked as a warning
     * @param query the query to execute against both {@link JdbcTemplate} instances. The query should return a single
     *              int/long value.
     *
     * @return a {@link List} of strings with the results. The first list element is the heading. The second list
     * element is the results, encapsulated as a set of strings.
     */
    public List<String[]> queryForLongValue(NamedParameterJdbcTemplate jdbcPrevious, NamedParameterJdbcTemplate jdbcCurrent, Double delta, String query) {
        List<String[]> results = new ArrayList<>();

        long previousValue = jdbcPrevious.queryForObject(query, new HashMap<>(), Long.class);
        long currentValue = jdbcCurrent.queryForObject(query, new HashMap<>(), Long.class);

        // Let's not divide by zero.
        double ratio = 1;
        if (previousValue > 0)
            ratio = ((double)currentValue / previousValue);

        results.add(new String[] {"Status", "Query", "Previous count", "Current count", "Ratio", "Delta", "Below Delta"});
        results.add(new String[] {
                (ratio < delta ? "FAIL" : "SUCCESS"),
                query,
                Long.toString(previousValue),
                Long.toString(currentValue),
                String.format("%.5f", ratio),
                String.format("%.5f", delta),
                (ratio < delta ? "true" : "false")
        });

        return results;
    }

    public void createSpringBatchTables(DataSource datasource) {

        logger.info("Creating SPRING BATCH tables");
        org.springframework.core.io.Resource r = new ClassPathResource("org/springframework/batch/core/schema-mysql.sql");
        ResourceDatabasePopulator            p = new ResourceDatabasePopulator(r);
        p.execute(datasource);
    }

    /**
     * Given an {@link SqlRowSet}, extracts each column of data, converting to type {@link String} as necessary,
     * returning the row's cells in a {@link List<String>}. Strict comparison rules are used for Strings: i.e., no
     * mapping of null to empty string, no trimming of strings, no lowercasing of strings before comparison.
     *
     * @param rs the sql result containng a row of data
     *
     * @return the row's cells in a {@link List<String>}
     *
     * @throws Exception
     */
    public List<String> getData(SqlRowSet rs) throws Exception {
        return getData(rs, false);
    }

    /**
     * Given an {@link SqlRowSet}, extracts each column of data, converting to type {@link String} as necessary,
     * returning the row's cells in a {@link List<String>}.
     * NOTE: for String types, trim leading and trailing spaces, lowercase the strings, and convert NULLs to empty strings first.
     *
     * @param rs the sql result containng a row of data
     * @param useLenient if true, for String types, trim leading and trailing spaces, lowercase the strings, and convert NULLs to empty strings first.
     *                   if false, use exact comparison.
     *
     * @return the row's cells in a {@link List<String>}
     *
     * @throws Exception
     */
    public List<String> getData(SqlRowSet rs, boolean useLenient) throws Exception {
        List<String> newRow = new ArrayList<>();

        SqlRowSetMetaData md = rs.getMetaData();

        // Start index at 1, as column indexes are 1-relative.
        for (int i = 1; i <= md.getColumnCount(); i++) {
            int sqlType = md.getColumnType(i);
            switch (sqlType) {
                case Types.CHAR:
                case Types.VARCHAR:
                case Types.LONGVARCHAR:
                    String s = rs.getString(i);
                    if (useLenient) {
                        if (s == null) {
                            s = "";                                     // remap null strings to empty string
                        }
                        newRow.add(s.trim().toLowerCase());             // trim spaces and convert to lowercase
                    } else {
                        newRow.add(s);
                    }
                    break;

                case Types.INTEGER:
                case Types.TINYINT:
                    newRow.add(Integer.toString(rs.getInt(i)));
                    break;

                case Types.BIT:
                    newRow.add(rs.getBoolean(i) ? "1" : "0");
                    break;

                case Types.BIGINT:
                    newRow.add(Long.toString(rs.getLong(i)));
                    break;

                case Types.TIMESTAMP:
                case Types.DATE:
                    Timestamp ts = rs.getTimestamp(i);
                    String formattedDate = "";
                    if (ts != null)  {
                        Date date = new Date(ts.getTime());
                        if (date != null) {
                            DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                            formattedDate = dateFormat.format(date);
                        }
                    }
                    newRow.add(formattedDate);
                    break;

                case Types.REAL:
                case Types.FLOAT:
                    newRow.add(Double.toString(rs.getDouble(i)));
                    break;

                default:
                    throw new Exception("No rule to handle sql type '" + md.getColumnTypeName(i) + "' (" + sqlType + ").");
            }
        }

        return newRow;
    }

    /**
     * From https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby
     * maxLifetime:
     * This property controls the maximum lifetime of a connection in the pool. An in-use connection will never be retired,
     * only when it is closed will it then be removed. On a connection-by-connection basis, minor negative attenuation is
     * applied to avoid mass-extinction in the pool. We strongly recommend setting this value, and it should be several
     * seconds shorter than any database or infrastructure imposed connection time limit. A value of 0 indicates no maximum
     * lifetime (infinite lifetime), subject of course to the idleTimeout setting. Default: 1800000 (30 minutes)
     * @param url
     * @param username
     * @param password
     * @return
     */

    public static DataSource getConfiguredDatasource(String url, String username, String password) {
        HikariDataSource ds = new HikariDataSource();
        ds.setJdbcUrl(url);
        ds.setDriverClassName("com.mysql.cj.jdbc.Driver");
        ds.setUsername(username);
        ds.setPassword(password);
        ds.setConnectionInitSql("SELECT 1");
        ds.setMinimumIdle(INITIAL_POOL_CONNECTIONS);
        ds.setMaximumPoolSize(MAXIMUM_POOL_SIZE);

        try {
            logger.info("Using database {} with URL: {}", ds.getConnection().getCatalog(), url);

        } catch (Exception e) {

            System.err.println(e.getLocalizedMessage());
            e.printStackTrace();
        }

        return ds;
    }
}


text:
<template name="home">

                {{> navigation}}

{{Config.title}}

                            {{{Config.subtitle}}}

                            {{#if currentUser}}
                             Go to dashboard
                            {{else}}
                            Get started
                            {{/if}}

How it works

{{{Config.subtitle}}}

1. Step 1

You search a business & order food

2. Step 2

You will receive a sms for payment and delivery details

3. Step 3

The delivery can be tracked realtime and you will be kept up to date at all time!

A revolutionary product

Do really cool stuff really quickly

                        Made by MeteorFactory

</template>


text:
package org.hudsonci.inject.internal.extension;

import hudson.Extension;
import hudson.ExtensionComponent;

import org.hudsonci.inject.Priority;
import org.sonatype.inject.BeanEntry;

import java.lang.annotation.Annotation;

/**
 * Smoothie component extension holder.
 *
 * @author Jason Dillon
 * @since 1.397
 */
public class SmoothieComponent<T>
    extends ExtensionComponent<T>
{
    private final BeanEntry<Annotation,T> bean;

    private final T value;

    private final double priority;

    public SmoothieComponent(final BeanEntry<Annotation,T> bean) {
        super(null);
        this.bean = bean;
        this.value = bean.getValue();
        this.priority = priorityOf(bean);
    }

    public BeanEntry<Annotation,T> getBean() {
        return bean;
    }

    public Class<?> getType() {
        return getBean().getImplementationClass();
    }

    @Override
    public T getInstance() {
        return value;
    }

    public double getPriority() {
        return priority;
    }

    @Override
    public double ordinal() {
        return getPriority();
    }

    @Override
    public String toString() {
        return "SmoothieComponent{" +
            "type=" + getType() +
            ", priority=" + getPriority() +
            ", bean=" + bean +
            '}';
    }

    //
    // IsOptional helpers
    //

    public static boolean isOptional(final BeanEntry<Annotation,?> beanEntry) {
        try {
            Boolean isOptional = isOptional(beanEntry.getKey());
            if (isOptional == null) {
                isOptional = isOptional(beanEntry.getImplementationClass());
                if (isOptional == null) {
                    isOptional = isOptional(beanEntry.getValue());
                    if (isOptional == null) {
                        return false;
                    }
                }
            }
            return isOptional.booleanValue();
        } catch (Throwable e) {
            return false;
        }
    }

    public static Boolean isOptional(final Object component) {
        if (component != null) {
            return isOptional(component.getClass());
        }
        return null;
    }

    public static Boolean isOptional(final Class<?> type) {
        if (type != null) {
            Extension extension = type.getAnnotation(Extension.class);
            if (extension != null) {
                return Boolean.valueOf(extension.optional());
            }
            ExtensionQualifier qualifier = type.getAnnotation(ExtensionQualifier.class);
            if (qualifier != null) {
                return Boolean.valueOf(qualifier.extension().optional());
            }
        }
        return null;
    }

    public static Boolean isOptional(final Annotation annotation) {
        if (annotation != null) {
            if (annotation instanceof Extension) {
                return Boolean.valueOf(((Extension)annotation).optional());
            }
            if (annotation instanceof ExtensionQualifier) {
                return Boolean.valueOf(((ExtensionQualifier)annotation).extension().optional());
            }
        }
        return null;
    }

    //
    // Priority helpers
    //

    public static final double DEFAULT_PRIORITY = 0;

    public static double priorityOf(final BeanEntry<Annotation, ?> beanEntry) {
        try {
            Double priority = priorityOf(beanEntry.getKey());
            if (priority == null) {
                priority = priorityOf(beanEntry.getImplementationClass());
                if (priority == null) {
                    priority = priorityOf(beanEntry.getValue());
                    if (priority == null) {
                        return DEFAULT_PRIORITY;
                    }
                }
            }
            return priority.doubleValue();
        } catch (Throwable e) {
            return DEFAULT_PRIORITY;
        }
    }

    public static Double priorityOf(final Object component) {
        if (component != null) {
            return priorityOf(component.getClass());
        }
        return null;
    }

    public static Double priorityOf(final Class<?> type) {
        if (type != null) {
            Extension extension = type.getAnnotation(Extension.class);
            if (extension != null) {
                return Double.valueOf(extension.ordinal());
            }
            ExtensionQualifier qualifier = type.getAnnotation(ExtensionQualifier.class);
            if (qualifier != null) {
                return Double.valueOf(qualifier.extension().ordinal());
            }
            Priority priority = type.getAnnotation(Priority.class);
            if (priority != null) {
                return Double.valueOf(priority.value());
            }
        }
        return null;
    }

    public static Double priorityOf(final Annotation annotation) {
        if (annotation != null) {
            if (annotation instanceof Extension) {
                return Double.valueOf(((Extension)annotation).ordinal());
            }
            if (annotation instanceof ExtensionQualifier) {
                return Double.valueOf(((ExtensionQualifier)annotation).extension().ordinal());
            }
            if (annotation instanceof Priority) {
                return Double.valueOf(((Priority)annotation).value());
            }
        }
        return null;
    }
}


text:
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():

    return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
		[TestAction.create_mini_vm, 'vm1', 'cluster=cluster2'],
		[TestAction.destroy_vm, 'vm1'],
		[TestAction.create_mini_vm, 'vm2', 'cluster=cluster2'],
		[TestAction.create_vm_backup, 'vm2', 'vm2-backup1'],
		[TestAction.create_mini_vm, 'vm3', 'cluster=cluster1'],
		[TestAction.start_vm, 'vm3'],
		[TestAction.stop_vm, 'vm3'],
		[TestAction.create_volume, 'volume1', 'cluster=cluster2', 'flag=scsi'],
		[TestAction.resize_data_volume, 'volume1', 5*1024*1024],
		[TestAction.poweroff_only, 'cluster=cluster1'],
		[TestAction.create_volume, 'volume2', 'cluster=cluster1', 'flag=scsi'],
		[TestAction.attach_volume, 'vm3', 'volume2'],
		[TestAction.detach_volume, 'volume2'],
		[TestAction.create_volume, 'volume3', 'cluster=cluster2', 'flag=thin,scsi'],
		[TestAction.add_image, 'image1', 'root', 'http://172.20.1.28/mirror/diskimages/centos_vdbench.qcow2'],
		[TestAction.attach_volume, 'vm3', 'volume2'],
		[TestAction.start_vm, 'vm3'],
		[TestAction.create_volume_backup, 'volume2', 'volume2-backup2'],
		[TestAction.stop_vm, 'vm3'],
		[TestAction.use_volume_backup, 'volume2-backup2'],
		[TestAction.delete_image, 'image1'],
		[TestAction.expunge_image, 'image1'],
		[TestAction.create_vm_backup, 'vm2', 'vm2-backup3'],
		[TestAction.change_vm_ha, 'vm3'],
		[TestAction.poweroff_only, 'cluster=cluster1'],
		[TestAction.resize_data_volume, 'volume2', 5*1024*1024],
		[TestAction.create_volume, 'volume4', 'cluster=cluster1', 'flag=scsi'],
		[TestAction.attach_volume, 'vm3', 'volume4'],
		[TestAction.delete_volume, 'volume1'],
		[TestAction.recover_volume, 'volume1'],
		[TestAction.create_volume, 'volume5', 'cluster=cluster1', 'flag=scsi'],
		[TestAction.attach_volume, 'vm3', 'volume5'],
		[TestAction.create_volume_backup, 'volume5', 'volume5-backup4'],
		[TestAction.delete_volume_backup, 'volume5-backup4'],
		[TestAction.create_mini_vm, 'vm4', 'cpu=random', 'cluster=cluster2'],
		[TestAction.delete_volume, 'volume1'],
		[TestAction.expunge_volume, 'volume1'],
		[TestAction.add_image, 'image2', 'root', os.environ.get('isoForVmUrl')],
		[TestAction.create_vm_by_image, 'image2', 'iso', 'vm5', 'cluster=cluster1'],
		[TestAction.create_vm_backup, 'vm3', 'vm3-backup5'],
		[TestAction.resize_data_volume, 'volume3', 5*1024*1024],
		[TestAction.poweroff_only, 'cluster=cluster2'],
		[TestAction.attach_volume, 'vm2', 'volume3'],
		[TestAction.start_vm, 'vm2'],
		[TestAction.create_volume_backup, 'volume3', 'volume3-backup9'],
		[TestAction.stop_vm, 'vm2'],
		[TestAction.delete_volume_backup, 'volume3-backup9'],
])

'''
The final status:
Running:['vm3', 'vm5']
Stopped:['vm4', 'vm2']
Enadbled:['vm2-backup1', 'volume2-backup2', 'vm2-backup3', 'vm3-backup5', 'volume2-backup5', 'volume4-backup5', 'volume5-backup5', 'image2']
attached:['volume2', 'volume4', 'volume5', 'volume3']
Detached:[]
Deleted:['vm1', 'volume5-backup4', 'volume3-backup9']
Expunged:['volume1', 'image1']
Ha:['vm3']
Group:
	vm_backup2:['vm2-backup3']---vm2@
	vm_backup3:['vm3-backup5', 'volume2-backup5', 'volume4-backup5', 'volume5-backup5']---vm3@volume2_volume4_volume5
	vm_backup1:['vm2-backup1']---vm2@
'''