text:
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "ORKChoiceAnswerFormatHelper.h"
#import "ORKAnswerFormat_internal.h"

@interface ORKChoiceAnswerFormatHelperTests : XCTestCase

@end

@implementation ORKChoiceAnswerFormatHelperTests

- (NSArray *)textChoices {

    static NSArray *choices = nil;

    if (choices == nil) {
        choices = @[[ORKTextChoice choiceWithText:@"choice 01" value:@"c1"],
                        [ORKTextChoice choiceWithText:@"choice 02" value:@"c2"],
                        [ORKTextChoice choiceWithText:@"choice 03" value:@"c3"],
                        [ORKTextChoice choiceWithText:@"choice 04" value:@"c4"]];
    }

    return choices;
}

- (NSArray *)imageChoices {

    static NSArray *choices = nil;

    if (choices == nil) {
        choices = @[[ORKImageChoice choiceWithNormalImage:nil selectedImage:nil text:@"choice 01" value:@"c1"],
                    [ORKImageChoice choiceWithNormalImage:nil selectedImage:nil text:@"choice 02" value:@"c2"],
                    [ORKImageChoice choiceWithNormalImage:nil selectedImage:nil text:@"choice 03" value:@"c3"]];
    }

    return choices;
}

- (void)testCount {

    {
        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithStyle:ORKChoiceAnswerStyleSingleChoice
                                         textChoices:[self textChoices]];
        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        XCTAssertEqual(formatHelper.choiceCount, [self textChoices].count, @"");
    }

    {
        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithImageChoices:[self imageChoices]];
        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        XCTAssertEqual(formatHelper.choiceCount, [self imageChoices].count, @"");
    }

    {
        ORKAnswerFormat *answerFormat = [ORKAnswerFormat valuePickerAnswerFormatWithTextChoices:[self textChoices]];
        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        XCTAssertEqual(formatHelper.choiceCount, [self textChoices].count+1, @"");
    }
}

- (void)testTextChoice {
    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithStyle:ORKChoiceAnswerStyleSingleChoice
                                                               textChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [textChoices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
            ORKTextChoice *tc = obj;
            ORKTextChoice *tc2 = [formatHelper textChoiceAtIndex:idx];
            XCTAssertEqual(tc, tc2, @"");
            XCTAssertNil([formatHelper imageChoiceAtIndex:idx],@"");
        }];
    }

    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat valuePickerAnswerFormatWithTextChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [textChoices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
            ORKTextChoice *tc = obj;
            ORKTextChoice *tc2 = [formatHelper textChoiceAtIndex:idx+1];
            XCTAssertEqual(tc, tc2, @"");
            XCTAssertNil([formatHelper imageChoiceAtIndex:idx],@"");
        }];
    }
}

- (void)testImageChoice {
    {
        NSArray *imageChoices = [self imageChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithImageChoices:imageChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [imageChoices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
            ORKImageChoice *tc = obj;
            ORKImageChoice *tc2 = [formatHelper imageChoiceAtIndex:idx];
            XCTAssertEqual(tc, tc2, @"");
            XCTAssertNil([formatHelper textChoiceAtIndex:idx],@"");
        }];
    }
}

- (void)verifyAnswerForSelectedIndexes:(ORKChoiceAnswerFormatHelper *)formatHelper choices:(NSArray *)choices {
    NSMutableArray *indexArray = [NSMutableArray new];

    [choices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

        id answer = [formatHelper answerForSelectedIndex:idx];

        XCTAssert([answer isKindOfClass:[NSArray class]]);
        NSArray *answerArray = answer;

        id value = ((ORKTextChoice *)choices[idx]).value;

        if (value == nil) {
            value = @(idx);
        }

        XCTAssert(answerArray.count == 1 && [answerArray.firstObject isEqual:value], @"%@", answerArray);

        answer = [formatHelper answerForSelectedIndexes:@[@(idx)]];
        XCTAssert([answer isKindOfClass:[NSArray class]]);
        answerArray = answer;

        XCTAssert(answerArray.count == 1 && [answerArray.firstObject isEqual:value], @"%@", answerArray);

        [indexArray addObject:@(idx)];

        answer = [formatHelper answerForSelectedIndexes:indexArray];
        XCTAssert([answer isKindOfClass:[NSArray class]]);
        answerArray = answer;

        XCTAssertEqual(answerArray.count, idx + 1, @"%@", answerArray);

    }];
}

- (void)testAnswerForSelectedIndexes {
    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat valuePickerAnswerFormatWithTextChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        id answer = [formatHelper answerForSelectedIndexes:@[@(0)]];

        XCTAssert(answer == ORKNullAnswerValue(), @"%@", answer);

        answer = [formatHelper answerForSelectedIndex:0];

        XCTAssert(answer == ORKNullAnswerValue(), @"%@", answer);

        [textChoices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

            id answer = [formatHelper answerForSelectedIndex:idx+1];

            id value = ((ORKTextChoice *)textChoices[idx]).value;

            if (value == nil) {
                value = @(idx);
            }

            XCTAssert([answer isKindOfClass:[NSArray class]]);
            NSArray *answerArray = answer;
            XCTAssert(answerArray.count == 1 && [answerArray.firstObject isEqual:value], @"%@", answer);

            answer = [formatHelper answerForSelectedIndexes:@[@(idx+1)]];
            XCTAssert([answer isKindOfClass:[NSArray class]]);
            answerArray = answer;

            XCTAssert(answerArray.count == 1 && [answerArray.firstObject isEqual:value], @"%@", answer);
        }];

    }

    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithStyle:ORKChoiceAnswerStyleSingleChoice
                                                               textChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [self verifyAnswerForSelectedIndexes:formatHelper choices:textChoices];
    }

    {
        NSArray *imageChoices = [self imageChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithImageChoices:imageChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [self verifyAnswerForSelectedIndexes:formatHelper choices:imageChoices];
    }
}

- (void)verifySelectedIndexesForAnswer:(ORKChoiceAnswerFormatHelper *)formatHelper choices:(NSArray *)choices {

    NSArray *indexes = [formatHelper selectedIndexesForAnswer:nil];

    XCTAssertEqual(indexes.count, 0, @"%@", indexes);

    indexes = [formatHelper selectedIndexesForAnswer:ORKNullAnswerValue()];

    XCTAssertEqual(indexes.count, 0, @"%@", indexes);

    NSNumber *indexNumber = [formatHelper selectedIndexForAnswer:nil];

    XCTAssertNil(indexNumber, @"%@", indexNumber);

    indexNumber = [formatHelper selectedIndexForAnswer:ORKNullAnswerValue()];

    XCTAssertNil(indexNumber, @"%@", indexNumber);

    [choices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

        id value = ((ORKTextChoice *)obj).value;

        if (value == nil) {
            value = @(idx);
        }

        NSNumber *indexNumber = [formatHelper selectedIndexForAnswer:@[value]];

        XCTAssertEqualObjects(indexNumber, @(idx), @"%@ vs %@", indexNumber, @(idx));

        NSArray *indexArray = [formatHelper selectedIndexesForAnswer:@[value]];

        XCTAssertEqualObjects( indexArray.firstObject, @(idx), @"%@ vs %@", indexArray[0], @(idx));

    }];
}

- (void)testSelectedIndexesForAnswer {
    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat valuePickerAnswerFormatWithTextChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        NSArray *indexes = [formatHelper selectedIndexesForAnswer:nil];

        XCTAssertEqualObjects(indexes.firstObject, @(0), @"%@", indexes);

        indexes = [formatHelper selectedIndexesForAnswer:ORKNullAnswerValue()];

        XCTAssertEqualObjects(indexes.firstObject, @(0), @"%@", indexes);

        NSNumber *indexNumber = [formatHelper selectedIndexForAnswer:nil];

        XCTAssert([indexNumber isKindOfClass:[NSNumber class]] && indexNumber.unsignedIntegerValue == 0, @"%@", indexNumber);

        indexNumber = [formatHelper selectedIndexForAnswer:ORKNullAnswerValue()];

        XCTAssert([indexNumber isKindOfClass:[NSNumber class]] && indexNumber.unsignedIntegerValue == 0, @"%@", indexNumber);

        [textChoices enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

            id value = ((ORKTextChoice *)obj).value;

            if (value == nil) {
                value = @(idx);
            }

            NSNumber *indexNumber = [formatHelper selectedIndexForAnswer:@[value]];

            XCTAssertEqualObjects(indexNumber, @(idx+1), @"%@ vs %@", indexNumber, @(idx+1));

            NSArray *indexArray = [formatHelper selectedIndexesForAnswer:@[value]];

            XCTAssertEqualObjects(indexArray.firstObject, @(idx+1), @"%@ vs %@", indexArray[0], @(idx+1));

        }];

    }

    {
        NSArray *textChoices = [self textChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithStyle:ORKChoiceAnswerStyleSingleChoice
                                                               textChoices:textChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

       [self verifySelectedIndexesForAnswer:formatHelper choices:textChoices];

    }

    {
        NSArray *imageChoices = [self imageChoices];

        ORKAnswerFormat *answerFormat = [ORKAnswerFormat choiceAnswerFormatWithImageChoices:imageChoices];

        ORKChoiceAnswerFormatHelper *formatHelper = [[ORKChoiceAnswerFormatHelper alloc] initWithAnswerFormat:answerFormat];

        [self verifySelectedIndexesForAnswer:formatHelper choices:imageChoices];

    }
}

@end


text:
package com.github.ilyamurzinov.ecareapp.config;

import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;

public class SecurityInit extends AbstractSecurityWebApplicationInitializer {

}

redpajama_set_name: RedPajamaGithub


text:
if test "$(command -v thefuck)"; then
	eval "$(thefuck --alias)"
fi


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.jruyi.me (JRuyi API 1.2.0)</title>
<meta name="date" content="2014-02-20">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

org.jruyi.me

Interfaces

IConsumer

IEndpoint

IMessage

IPostHandler

IPreHandler

IProcessor

IProducer

IRoute

IRouteSet

IRoutingTable

Classes

MeConstants


text:
  This intention converts boolean comparison expression not(a negop b) into a op b.
  Where op and negop are mutually inverse comparison operators, like == and !=.


text:
package org.elasticsearch.xpack.ml.rest.inference;

import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.ml.action.PutTrainedModelAction;
import org.elasticsearch.xpack.core.ml.inference.TrainedModelConfig;
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.List;

import static java.util.Collections.singletonList;
import static org.elasticsearch.rest.RestRequest.Method.PUT;

public class RestPutTrainedModelAction extends BaseRestHandler {

    @Override
    public List<Route> routes() {
        return singletonList(
            new Route(PUT, MachineLearning.BASE_PATH + "inference/{" + TrainedModelConfig.MODEL_ID.getPreferredName() + "}"));
    }

    @Override
    public String getName() {
        return "xpack_ml_put_trained_model_action";
    }

    @Override
    protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
        String id = restRequest.param(TrainedModelConfig.MODEL_ID.getPreferredName());
        XContentParser parser = restRequest.contentParser();
        PutTrainedModelAction.Request putRequest = PutTrainedModelAction.Request.parseRequest(id, parser);
        putRequest.timeout(restRequest.paramAsTime("timeout", putRequest.timeout()));

        return channel -> client.execute(PutTrainedModelAction.INSTANCE, putRequest, new RestToXContentListener<>(channel));
    }
}


text:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;

using UnityEngine;

namespace UnityExtension
{
    public static class GameObjectExt
    {
        //------------------------------------------------------------------------------------------------------------
        public static T GetOrAddComponent<T>(this GameObject lGo) where T : Component
        {
            T lComponent = lGo.GetComponent<T>();
            if (lComponent == null)
            {
                lComponent = lGo.gameObject.AddComponent<T>();
            }
            return lComponent;
        }

        //------------------------------------------------------------------------------------------------------------
        public static T GetComponentOfChild<T>(this GameObject lGo, string lName) where T : Component
        {
            T lComponent = null;
            Transform lTransform = lGo.transform.Find(lName);
            if (lTransform != null)
            {
                lComponent = lTransform.GetComponent<T>();
            }
            return lComponent;
        }

        //------------------------------------------------------------------------------------------------------------
        public static T[] GetComponentsOfChild<T>(this GameObject lGo, string lName) where T : Component
        {
            T[] lComponent = null;
            Transform lTransform = lGo.transform.Find(lName);
            if (lTransform != null)
            {
                lComponent = lTransform.GetComponents<T>();
            }
            return lComponent;
        }

        //------------------------------------------------------------------------------------------------------------
        public static GameObject InstantiateAsChild(this GameObject lGo, GameObject lObject)
        {
            GameObject lNewGo = lObject != null ? (GameObject)GameObject.Instantiate(lObject) : new GameObject();
            lNewGo.transform.parent = lGo.transform;
            lNewGo.transform.localPosition = Vector3.zero;
            lNewGo.transform.localRotation = Quaternion.identity;
            lNewGo.transform.localScale = Vector3.one;
            return lNewGo;
        }

        //------------------------------------------------------------------------------------------------------------
        public static bool DestroyChildIfExists(this GameObject lGo, string lName)
        {
            Transform lTransform = lGo.transform.Find(lName);
            if (lTransform != null)
            {
                GameObject.Destroy(lTransform.gameObject);
                return true;
            }
            else
            {
                return false;
            }
        }

        //------------------------------------------------------------------------------------------------------------
        public static bool ContainsChildren(this GameObject lGo, params string[] lPaths)
        {
            for (int lCount = 0; lCount < lPaths.Length; ++lCount)
            {
                if (lGo.transform.Find(lPaths[lCount]) == null)
                {
                    return false;
                }
            }
            return true;
        }

        //------------------------------------------------------------------------------------------------------------
        public static bool IsChildOf(this GameObject lGo, GameObject lParent)
        {
            Transform lTransform = lGo.transform;
            while (lTransform.parent != null)
            {
                if (lTransform == lParent.transform)
                {
                    return true;
                }
                lTransform = lTransform.parent;
            }
            return false;
        }

        //------------------------------------------------------------------------------------------------------------
        public static void SetLayerRecursively(this GameObject lGo, int lLayer)
        {
            lGo.layer = lLayer;
            foreach (Transform lTransform in lGo.transform)
            {
                lTransform.gameObject.SetLayerRecursively(lLayer);
            }
        }
    }
}


text:
var Dispatcher = require('./Dispatcher');

var merge = require('react/lib/merge');

var AppDispatcher = merge(Dispatcher.prototype, {

    /**
     * A bridge function between the views and the dispatcher, marking the action
     * as a view action.  Another variant here could be handleServerAction.
     * @param  {object} action The data coming from the view.
     */
    handleViewAction: function(action) {
        this.dispatch({
            source: 'VIEW_ACTION',
            action: action
        });
    }

});

module.exports = AppDispatcher;


text:
using Scaffold;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System;
using Newtonsoft.Json;

namespace App.Models
{
    public class Blob: BaseEntity
    {

        public Blob()
        {
        }

        public Blob(MultipartFile fResult)
        {
            Type = fResult.Type;
            Size = fResult.Size;
            Name = fResult.Name;
        }

        public string Name { get; set;}

        public string Type { get; set; }

        public long Size { get; set; }

        public String RelativeFileName
        {
            get
            {
                var fileName = Id.ToString();
                if (Name != null)
                    fileName = fileName + Path.GetExtension(Name);
                return fileName;
            }
        }

        [JsonIgnore]
        public string FilePath
        {
            get
            {
                String root = null;
                if (HttpContext.Current != null)
                    root = HttpContext.Current.Server.MapPath("~/Content/files");
                else
                    root = MapPath("~/Content/files");
                Directory.CreateDirectory(root);
                return Path.Combine(root, RelativeFileName);
            }
        }

        private string MapPath(string seedFile)
        {

            var absolutePath = new Uri(AppDomain.CurrentDomain.BaseDirectory).LocalPath;
            var directoryName = Path.GetDirectoryName(absolutePath);
            var path = Path.Combine(directoryName, ".." + seedFile.TrimStart('~').Replace('/', '\\'));

            return path;
        }
    }
}


text:
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
/* body {
  font-family: 'Lato', sans-serif;
  font-size: 17px;
  line-height: 1.5em;
  margin: 0;
  padding: 0;
  background-color: red !important;
} */
/*
html {
  height: 100%;
}

#main {}

.container {
  margin: auto;
}

#main-header {
  border-bottom: solid 10px #6892D5;
  background-color: #F8FCFB;
}

#game {
  background-color: #F8FCFB;
}

p,
form,
input,
button {
  font-family: 'Raleway'
} */

html,
body {
  height: 100%;
  background-color: #A6E4E7;
}

.jumbotron.vertical-center {
  background-color: #A6E4E7;
  border-radius: 0;
  margin-bottom: 0; /* Remove the default bottom margin of .jumbotron */
}
/* .jumbotron {
  background-image: -ms-linear-gradient(
    top left,
    #8e9fe6 0%,
    #f5f5f5 100%
  ) !important;
  background-image: -moz-linear-gradient(
    top left,
    #8e9fe6 0%,
    #f5f5f5 100%
  ) !important;
  background-image: -o-linear-gradient(
    top left,
    #8e9fe6 0%,
    #f5f5f5 100%
  ) !important;
  background-image: -webkit-gradient(
    linear,
    left top,
    right bottom,
    color-stop(0, #8e9fe6),
    color-stop(100, #f5f5f5)
  ) !important;
  background-image: -webkit-linear-gradient(
    top left,
    #8e9fe6 0%,
    #f5f5f5 100%
  ) !important;
  background-image: linear-gradient(
    to bottom right,
    #8e9fe6 0%,
    #f5f5f5 100%
  ) !important;
}*/
.vertical-center {
  min-height: 100%; /* Fallback for vh unit */
  min-height: 100vh; /* You might also want to use
                        'height' property instead.

                        Note that for percentage values of
                        'height' or 'min-height' properties,
                        the 'height' of the parent element
                        should be specified explicitly.

                        In this case the parent of '.vertical-center'
                        is the <body> element */

  /* Make it a flex container */
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;

  /* Align the bootstrap's container vertically */
  -webkit-box-align: center;
  -webkit-align-items: center;
  -moz-box-align: center;
  -ms-flex-align: center;
  align-items: center;

  /* In legacy web browsers such as Firefox 9
     we need to specify the width of the flex container */
  width: 100%;

  /* Also 'margin: 0 auto' doesn't have any effect on flex items in such web browsers
     hence the bootstrap's container won't be aligned to the center anymore.

     Therefore, we should use the following declarations to get it centered again */
  -webkit-box-pack: center;
  -moz-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.container {
  background-color: #F9F9F9;
}
.title {
  padding-top: 10px;
}
.shadow {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  border-radius: 5px;
}
.enharmonics {
  padding-top: 10px;
}
.natural-notes {
  padding-bottom: 10px;
}
.sharps {
  padding: 10px;
  margin: 5px;
  background-color:#B9BBDF;
}
.flats {
  padding: 10px;
  margin: 5px;
  background-color:#B9DFC1;
}
.natural {
  padding: 10px;
  margin: 5px;
  background-color:#DFCDB9
}
.try-it-button {
  background-color:#DDDDDD
}
#stringFret {
  font-size: 3em;
  margin-bottom: 0;
}
#answer {
  font-size: 2em;
  margin-bottom: 0;
}
#score {
  font-size: 2em;
  margin-bottom: 0;
}


text:
.. _policyenf_setup:

Setting up policy enforcement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Before you use the policy enforcement feature, configure Murano and Congress
properly.

.. note::

   This article does not cover Murano and Congress configuration options
   useful for Murano application deployment, for example, DNS setup,
   floating IPs, and so on.

**To enable policy enforcement, complete the following tasks:**

#. In Murano:

   * Enable the ``enable_model_policy_enforcer`` option
     in the ``murano.conf`` file:

    .. code-block:: ini

        [engine]
        # Enable model policy enforcer using Congress (boolean value)
        enable_model_policy_enforcer = true

    * Restart murano-engine.

#. Verify that Congress is installed and available in your OpenStack
   environment. See the details in the `Congress official documentation
   <http://congress.readthedocs.org/en/latest/>`_.

#. `Install the congress command-line client
   <http://docs.openstack.org/user-guide/common/cli_install_openstack_command_line_clients.html>`_
   as any other OpenStack command-line client.

#. For Congress, configure the following policies that policy enforcement uses
   during the evaluation:

   * ``murano`` policy

      It is created by the Congress` murano datasource driver, which is a part
      of Congress. Configure it for the OpenStack project (tenant) where you plan to
      deploy your Murano application. Datasource driver retrieves deployed
      Murano environments and populates Congress' murano policy tables.
      See :ref:`policyenf_dev` for details.

      Remove the existing ``murano`` policy and create a new ``murano`` policy
      configured for the ``demo`` project, by running:

      .. code-block:: console

         # remove default murano datasource configuration, because it is using 'admin' project. We need 'demo' project to be used.
         openstack congress datasource delete murano
         openstack congress datasource create murano murano --config username="$OS_USERNAME" --config tenant_name="demo"  --config password="$OS_PASSWORD" --config auth_url="$OS_AUTH_URL"

   * ``murano_system`` policy

      It holds the user-defined rules for policy enforcement. Typically,
      the rules use tables from other policies, for example, murano, nova,
      keystone, and others. Policy enforcement expects the ``predeploy_errors``
      table here that is available on the ``predeploy_errors`` rules creation.

      Create the ``murano_system`` rule, by running:

      .. code-block:: console

         # create murano_system policy
         openstack congress policy create murano_system

         # resolves objects within environment
         openstack congress policy rule create murano_system 'murano_env_of_object(oid,eid):-murano:connected(eid,oid), murano:objects(eid,tid,"io.murano.Environment")'

   * ``murano_action`` policy with internal management rules.

     These rules are used internally in the policy enforcement request
     and stored in a dedicated ``murano_action`` policy that is
     created here. They are important in case an environment is redeployed.

     .. code-block:: console

        # create murano_action policy
        openstack congress policy create murano_action --kind action

        # register action deleteEnv
        openstack congress policy rule create murano_action 'action("deleteEnv")'

        # states
        openstack congress policy rule create murano_action 'murano:states-(eid, st) :- deleteEnv(eid), murano:states( eid, st)'

        # parent_types
        openstack congress policy rule create murano_action 'murano:parent_types-(tid, type) :- deleteEnv(eid), murano:connected(eid, tid),murano:parent_types(tid,type)'
        openstack congress policy rule create murano_action 'murano:parent_types-(eid, type) :- deleteEnv(eid), murano:parent_types(eid,type)'

        # properties
        openstack congress policy rule create murano_action 'murano:properties-(oid, pn, pv) :- deleteEnv(eid), murano:connected(eid, oid), murano:properties(oid, pn, pv)'
        openstack congress policy rule create murano_action 'murano:properties-(eid, pn, pv) :- deleteEnv(eid), murano:properties(eid, pn, pv)'

        # objects
        openstack congress policy rule create murano_action 'murano:objects-(oid, pid, ot) :- deleteEnv(eid), murano:connected(eid, oid), murano:objects(oid, pid, ot)'
        openstack congress policy rule create murano_action 'murano:objects-(eid, tnid, ot) :- deleteEnv(eid), murano:objects(eid, tnid, ot)'

        # relationships
        openstack congress policy rule create murano_action 'murano:relationships-(sid, tid, rt) :- deleteEnv(eid), murano:connected(eid, sid), murano:relationships( sid, tid, rt)'
        openstack congress policy rule create murano_action 'murano:relationships-(eid, tid, rt) :- deleteEnv(eid), murano:relationships(eid, tid, rt)'

        # connected
        openstack congress policy rule create murano_action 'murano:connected-(tid, tid2) :- deleteEnv(eid), murano:connected(eid, tid), murano:connected(tid,tid2)'
        openstack congress policy rule create murano_action 'murano:connected-(eid, tid) :- deleteEnv(eid), murano:connected(eid,tid)'


text:
#ifndef LEDGER_CORE_CURRENCIES_HPP
#define LEDGER_CORE_CURRENCIES_HPP

#ifndef LIBCORE_EXPORT
#if defined(_MSC_VER)
#include <libcore_export.h>
#else
#define LIBCORE_EXPORT
#endif
#endif

#include <api/Currency.hpp>
#include <wallet/algorand/AlgorandLikeCurrencies.hpp> // Declares ALGO
#include <wallet/cosmos/CosmosLikeCurrencies.hpp>     // Declares ATOM

namespace ledger {
    namespace core {
        namespace currencies {
            extern LIBCORE_EXPORT const std::vector<api::Currency> ALL;
            extern LIBCORE_EXPORT const api::Currency BITCOIN;
            extern LIBCORE_EXPORT const api::Currency BITCOIN_TESTNET;
            extern LIBCORE_EXPORT const api::Currency BITCOIN_REGTEST;
            extern LIBCORE_EXPORT const api::Currency BITCOIN_CASH;
            extern LIBCORE_EXPORT const api::Currency BITCOIN_GOLD;
            extern LIBCORE_EXPORT const api::Currency ZCASH;
            extern LIBCORE_EXPORT const api::Currency ZENCASH;
            extern LIBCORE_EXPORT const api::Currency LITECOIN;
            extern LIBCORE_EXPORT const api::Currency PEERCOIN;
            extern LIBCORE_EXPORT const api::Currency DIGIBYTE;
            extern LIBCORE_EXPORT const api::Currency HCASH;
            extern LIBCORE_EXPORT const api::Currency QTUM;
            extern LIBCORE_EXPORT const api::Currency STEALTHCOIN;
            extern LIBCORE_EXPORT const api::Currency VERTCOIN;
            extern LIBCORE_EXPORT const api::Currency VIACOIN;
            extern LIBCORE_EXPORT const api::Currency DASH;
            extern LIBCORE_EXPORT const api::Currency DOGECOIN;
            extern LIBCORE_EXPORT const api::Currency STRATIS;
            extern LIBCORE_EXPORT const api::Currency KOMODO;
            extern LIBCORE_EXPORT const api::Currency POSWALLET;
            extern LIBCORE_EXPORT const api::Currency PIVX;
            extern LIBCORE_EXPORT const api::Currency CLUBCOIN;
            extern LIBCORE_EXPORT const api::Currency DECRED;
            extern LIBCORE_EXPORT const api::Currency STAKENET;
            extern LIBCORE_EXPORT const api::Currency ETHEREUM;
            extern LIBCORE_EXPORT const api::Currency ETHEREUM_ROPSTEN;
            extern LIBCORE_EXPORT const api::Currency ETHEREUM_CLASSIC;
            extern LIBCORE_EXPORT const api::Currency RIPPLE;
            extern LIBCORE_EXPORT const api::Currency TEZOS;
            extern LIBCORE_EXPORT const api::Currency STELLAR;
        }; // namespace currencies
    }      // namespace core
} // namespace ledger

#endif // LEDGER_CORE_CURRENCIES_HPP


text:
Within cache2k the concept _storage_ means that cached data is stored outside
the core heap data structures. This includes persistence, off heap storage, or
remote/network storage. All storage variants, share common properties and
therefore a common part of their configuration.

A cache can have more than one storage configured.

## Features

### Offline clear()

Caches may be cleared during operation. A storage need some time to proceed
with the clear operation, e.g. when 1TB of files need to be deleted.
A cache.clear() initiates a storage clear, but continues operation and
buffers all storage requests, until the storage is ready.

### Storage aggregation

## Error handling

A storage implementations may throw exceptions and leave it to the
general error handling mechanism to do something useful. Depending on
 the situation the exception will be propagated to the application or
 not.

### Default handling mode

The idea of the default handling is that it goes with the cache paradigm.
A read operation may return an entry or not, even when an entry was
stored before. In the event of an exception the problem just gets counted
and logged and no entry will be returned.

Cache mutations are more difficult. After a successful cache put the new entry
  mut be returned or no entry. Returning the previous entry would be a failure.

### Reliable handling mode

This mode can be used when critical data is stored. If a mutation is not
successful an exceptions is propagated to the application.

### Overview per cache operation

| Storage operation | Default mode                                |  Reliable mode    |
  ----------------- | ------------------------------------------- | ----------------- |
| open              | disable and ignore                          | disable and propagate, cache unusable |
| put               | mitigate and ignore / disable and propagate | disable and propagate, cache unusable |
| get               | ignore                                      | disable and propagate, cache unusable |
| remove            | disable and propagate                       | disable and propagate, cache unusable |
| contains          | ignore                                      | disable and propagate, cache unusable |
| flush             | disable and ignore                          | disable and propagate, cache unusable |
| expire            | disable and ignore                          | disable and propagate, cache unusable |
| iterate/visit     | disable and ignore                          | disable and propagate, cache unusable |

- *disable and ignore*: Storage module is disabled, cache continues operation without storage interaction
- *disable and propagate*: Storage module disabled, exceptions will be propagated to the application
- *cache unusable*: Complete cache is unusable and will throw exceptions
- *mitigate and ignore*: If put() fails, try to remove the entry, if this works ignore the problem
- *ignore*: Just count the error. get() returns null

### Future Improvements

Support for shaky storage should be better. A network connected storage should be able to
 allow temporary exceptions and get back online later. Ideas:

   * Queue in storage operations and play back the changes when the storage becomes online later.
     This is essentially an asynchronous operation mode.
   * For put: Pin the entry in the heap cache and just schedule a redo.

## Monitoring

General counters?

A cache clear operation will return immediately and not hold up any other operations while the
storage implementation may need some time to cleanup, e.g. if 1TB of files need to be
 removed. During this time storage operations are buffered and sent to the storage
 when it is back online. The cache alert level switches to orange when the storage
 is performing the clear. This way we have alerting when the clear is taking to
 long or does not finish at all.

## Logging

##


text:
package example.springdata.jpa.java8;

import java.util.Optional;

import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 * Repository to manage {@link Customer} instances.
 *
 * @author Oliver Gierke
 */
public interface CustomerRepository extends Repository<Customer, Long> {

	/**
	 * Special customization of {@link CrudRepository#findOne(java.io.Serializable)} to return a JDK 8 {@link Optional}.
	 *
	 * @param id
	 * @return
	 */
	Optional<Customer> findOne(Long id);

	/**
	 * Saves the given {@link Customer}.
	 *
	 * @param customer
	 * @return
	 */
	<S extends Customer> S save(S customer);

	/**
	 * Sample method to derive a query from using JDK 8's {@link Optional} as return type.
	 *
	 * @param lastname
	 * @return
	 */
	Optional<Customer> findByLastname(String lastname);

	/**
	 * Sample default method to show JDK 8 feature support.
	 *
	 * @param customer
	 * @return
	 */
	default Optional<Customer> findByLastname(Customer customer) {
		return findByLastname(customer == null ? null : customer.lastname);
	}
}


text:
from "CP-20150323-TR70-mouse2-1-son.oib", slices 10-16

![Plot](https://raw.githubusercontent.com/petteriTeikari/twoPhotonVessels/master/demos/segmentationDemo/testData/inputPlot_init.png)

![Variables](https://raw.githubusercontent.com/petteriTeikari/twoPhotonVessels/master/demos/segmentationDemo/testData/inputVariables.png)

edges     - manually refined from Canny output

edgesFill - filled semi-automatically using some of the edge linking functions from Peter Kovesi (http://www.peterkovesi.com/matlabfns/index.html#edgelink)

gvf_OOF   - 3D Gradient Vector Flow of OOF, using the code from Erik Smistad: https://github.com/smistad/3D-Gradient-Vector-Flow-for-Matlab

gvf_im    - 3D Gradient Vector Flow of actual image stack

im        - input image stack, from 2-PM

OOF-3D    - Optimally Oriented Flux (OOF) of the input, http://www.mathworks.com/matlabcentral/fileexchange/41612-optimally-oriented-flux--oof--for-3d-curvilinear-structure-detection

## ASETS Level-sets for binary segmentation (2D)
https://github.com/ASETS/asetsMatlabLevelSets

We can test the segmentation algorithm with various refined images (see Segment - Pre-Process in demo_segmentationMethods.m), and speed functions (e.g. output of an OOF or GVF) to drive the active contours

![Test Images ASETS 2D](https://raw.githubusercontent.com/petteriTeikari/twoPhotonVessels/master/demos/segmentationDemo/demoFiguresOut/asets_2D_input.png)

Which can give us for example the following segmentation (see asets_demoWrapper_2D.m using the "fusion" image as the input, and the manually refined edgeFill as the speed function (both inputs kinda cheating as there has been manual labor):

![Test Output ASETS 2D](https://raw.githubusercontent.com/petteriTeikari/twoPhotonVessels/master/demos/segmentationDemo/demoFiguresOut/asets_2D_exampleOutput.png)

The evolution can be visualized with an animated gif (export_fig in Matlab, and ImageMagick in Ubuntu):

![Test Output ASETS 2D](https://raw.githubusercontent.com/petteriTeikari/twoPhotonVessels/master/demos/segmentationDemo/demoFiguresOut/anim_asets2D_squareInitSmall.gif)


text:
package com.hbakkum.rundeck.plugins.hipchat.http;

import com.hbakkum.rundeck.plugins.hipchat.HipChatNotificationPluginException;
import us.monoid.json.JSONException;
import us.monoid.json.JSONObject;
import us.monoid.web.Resty;
import us.monoid.web.TextResource;

import java.io.IOException;
import java.net.HttpURLConnection;

import static com.hbakkum.rundeck.plugins.hipchat.HipChatNotificationPluginUtils.getResponseCode;
import static com.hbakkum.rundeck.plugins.hipchat.HipChatNotificationPluginUtils.isNotEmpty;
import static us.monoid.web.Resty.content;

/**
 * @author Hayden Bakkum
 */
public class RestyHttpRequestExecutor implements HttpRequestExecutor {

    private String proxyHost;
    private int proxyPort = -1;

    @Override
    public void setProxy(final String proxyHost, final int proxyPort) {
        this.proxyHost = proxyHost;
        this.proxyPort = proxyPort;
    }

    @Override
    public HttpResponse execute(final String url) {
        HttpURLConnection httpConnection = null;
        try {
            final Resty resty = new Resty();
            if (isProxySet()) {
                resty.setProxy(proxyHost, proxyPort);
            }
            final TextResource textResource = resty.text(url);
            httpConnection = textResource.http();

            return toHttpResponse(textResource, httpConnection);

        } catch (IOException ioEx) {
            throw new HipChatNotificationPluginException("Error opening connection to HipChat URL: [" + ioEx.getMessage() + "].", ioEx);

        } finally {
            if (httpConnection != null) {
                httpConnection.disconnect();
            }
        }
    }

    @Override
    public HttpResponse execute(final String url, final String jsonRequestBody) {
        HttpURLConnection httpConnection = null;
        try {
            final Resty resty = new Resty();
            if (isProxySet()) {
                resty.setProxy(proxyHost, proxyPort);
            }
            final TextResource textResource = resty.text(url, content(new JSONObject(jsonRequestBody)));
            httpConnection = textResource.http();

            return toHttpResponse(textResource, httpConnection);

        } catch (IOException ioEx) {
            throw new HipChatNotificationPluginException("Error opening connection to HipChat URL: [" + ioEx.getMessage() + "].", ioEx);

        } catch (JSONException jsonEx) {
            throw new HipChatNotificationPluginException("Malformed JSON request body: [" + jsonEx.getMessage() + "].", jsonEx);

        } finally {
            if (httpConnection != null) {
                httpConnection.disconnect();
            }
        }
    }

    private boolean isProxySet() {
        return isNotEmpty(proxyHost) && proxyPort > -1;
    }

    private HttpResponse toHttpResponse(final TextResource textResource, final HttpURLConnection httpConnection) {
        final int responseCode = getResponseCode(httpConnection);
        final String contentType = httpConnection.getHeaderField("content-type");
        final String responseBody = textResource.toString();

        return new HttpResponse(responseCode, contentType, responseBody);
    }

}


text:
@class Joystick;

@protocol JoystickNotificationDelegate

- (void)joystickAxisChanged:(Joystick *)joystick atAxisIndex:(int)axis;
- (void)joystickAdded:(Joystick *)joystick;
- (void)joystickButton:(int)buttonIndex state:(BOOL)pressed onJoystick:(Joystick*)joystick;

@end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Hexagonia variabilis Lloyd

### Remarks
null


text:
$(document).ready(function() {
  $('.wy-menu').onePageNav();
});


text:
package org.apache.tinkerpop.gremlin.process.traversal.step.map;

import org.apache.commons.lang.ArrayUtils;
import org.apache.tinkerpop.gremlin.process.traversal.Compare;
import org.apache.tinkerpop.gremlin.process.traversal.Contains;
import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.step.GraphComputing;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.tinkerpop.gremlin.util.iterator.EmptyIterator;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.function.Supplier;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 * @author Pieter Martin
 */
public class GraphStep<S, E extends Element> extends AbstractStep<S, E> implements GraphComputing {

    protected final Class<E> returnClass;
    protected Object[] ids;
    protected transient Supplier<Iterator<E>> iteratorSupplier;
    protected boolean isStart;
    protected boolean done = false;
    private Traverser.Admin<S> head = null;
    private Iterator<E> iterator = EmptyIterator.instance();

    public GraphStep(final Traversal.Admin traversal, final Class<E> returnClass, final boolean isStart, final Object... ids) {
        super(traversal);
        this.returnClass = returnClass;
        this.ids = (ids.length == 1 && ids[0] instanceof Collection) ? ((Collection) ids[0]).toArray(new Object[((Collection) ids[0]).size()]) : ids;
        this.isStart = isStart;
        this.iteratorSupplier = () -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ?
                this.getTraversal().getGraph().get().vertices(this.ids) :
                this.getTraversal().getGraph().get().edges(this.ids));
    }

    public String toString() {
        return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), Arrays.toString(this.ids));
    }

    public Class<E> getReturnClass() {
        return this.returnClass;
    }

    public boolean isStartStep() {
        return this.isStart;
    }

    public static boolean isStartStep(final Step<?, ?> step) {
        return step instanceof GraphStep && ((GraphStep) step).isStartStep();
    }

    public boolean returnsVertex() {
        return this.returnClass.equals(Vertex.class);
    }

    public boolean returnsEdge() {
        return this.returnClass.equals(Edge.class);
    }

    public void setIteratorSupplier(final Supplier<Iterator<E>> iteratorSupplier) {
        this.iteratorSupplier = iteratorSupplier;
    }

    public Object[] getIds() {
        return this.ids;
    }

    public void addIds(final Object... newIds) {
        this.ids = ArrayUtils.addAll(this.ids,
                (newIds.length == 1 && newIds[0] instanceof Collection) ?
                        ((Collection) newIds[0]).toArray(new Object[((Collection) newIds[0]).size()]) :
                        newIds);
    }

    public void clearIds() {
        this.ids = new Object[0];
    }

    @Override
    public void onGraphComputer() {
        this.iteratorSupplier = Collections::emptyIterator;
        for (int i = 0; i < this.ids.length; i++) {    // if this is going to OLAP, convert to ids so you don't serialize elements
            if (this.ids[i] instanceof Element)
                this.ids[i] = ((Element) this.ids[i]).id();
        }
    }

    @Override
    protected Traverser.Admin<E> processNextStart() {
        while (true) {
            if (this.iterator.hasNext()) {
                return this.isStart ? this.getTraversal().getTraverserGenerator().generate(this.iterator.next(), (Step) this, 1l) : this.head.split(this.iterator.next(), this);
            } else {
                if (this.isStart) {
                    if (this.done)
                        throw FastNoSuchElementException.instance();
                    else {
                        this.done = true;
                        this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
                    }
                } else {
                    this.head = this.starts.next();
                    this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
                }
            }
        }
    }

    @Override
    public void reset() {
        super.reset();
        this.head = null;
        this.done = false;
        this.iterator = EmptyIterator.instance();
    }

    @Override
    public int hashCode() {
        int result = super.hashCode() ^ this.returnClass.hashCode();
        for (final Object id : this.ids) {
            result ^= id.hashCode();
        }
        return result;
    }

    /**
     * Helper method for providers that want to "fold in" {@link HasContainer}'s based on id checking into the ids of the {@link GraphStep}.
     *
     * @param graphStep    the GraphStep to potentially {@link GraphStep#addIds(Object...)}.
     * @param hasContainer The {@link HasContainer} to check for id validation.
     * @return true if the {@link HasContainer} updated ids and thus, was processed.
     */
    public static boolean processHasContainerIds(final GraphStep<?, ?> graphStep, final HasContainer hasContainer) {
        if (hasContainer.getKey().equals(T.id.getAccessor()) && (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
            graphStep.addIds(hasContainer.getValue());
            return true;
        }
        return false;
    }
}


text:
package io.dropwizard.testing.junit;

import org.junit.ClassRule;
import org.junit.Test;

import javax.ws.rs.client.ClientBuilder;

import static io.dropwizard.testing.ResourceHelpers.resourceFilePath;
import static io.dropwizard.testing.ConfigOverride.config;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class DropwizardAppRuleConfigOverrideTest {

    @ClassRule
    public static final DropwizardAppRule<TestConfiguration> RULE =
            new DropwizardAppRule<>(TestApplication.class, resourceFilePath("test-config.yaml"),
                    config("message", "A new way to say Hooray!"));

    @Test
    public void supportsConfigAttributeOverrides() {
        final String content = ClientBuilder.newClient().target("http://localhost:" + RULE.getLocalPort() + "/test")
                .request().get(String.class);

        assertThat(content, is("A new way to say Hooray!"));
    }
}


text:
<?php

if (!defined('BASEPATH'))
  exit('No direct script access allowed');

class Admin extends MY_Controller
{
  public function __construct()
  {
    parent::__construct();
    if ($this->is_logged_in() == FALSE)
    {
      redirect('auth');
    }
    else
    {
      $this->load->model('album_model');
      $this->load->model('image_model');
      $this->load->model('feed_model');
    }
  }

  /**
   * Displays list of albums for regular users. Admins can see all albums.
   */
  public function album()
  {
    $uri = $this->uri->segment(3);
    $offset = ( ! empty($uri) && is_numeric($uri)) ? $uri : 0;
    $per_page = 10;

    if ($this->is_admin() === TRUE)
    {
      $album_data = $this->album_model->paginate($per_page, $offset);
      $total = count($this->album_model->fetch_all());
    }
    else
    {
      $album_data = $this->album_model->paginate_by_user_id($this->get_user_id(), $per_page, $offset);
      $total = count($this->album_model->fetch_by_user_id($this->get_user_id()));
    }

    for ($i = 0; $i < count($album_data); $i++)
    {
      $album_data[$i]['images'] = $this->image_model->get_last_ten_by_album_id($album_data[$i]['id']);
    }
    $data = array();
    $data['albums'] = $album_data;

    $this->load->library('pagination');

    $config = array();
    $config['base_url']         = site_url('album/index');
    $config['total_rows']       = $total;
    $config['per_page']         = $per_page;
    $config['full_tag_open']    = '

';
    $config['full_tag_close']   = '

';
    $config['first_link']       = '← First';
    $config['last_link']        = 'Last →';
    $config['first_tag_open']   = '
';
    $config['first_tag_close']  = '
';
    $config['prev_link']        = 'Previous';
    $config['prev_tag_open']    = '
';
    $config['prev_tag_close']   = '
';
    $config['next_link']        = 'Next';
    $config['next_tag_open']    = '
';
    $config['next_tag_close']   = '
';
    $config['last_tag_open']    = '
';
    $config['last_tag_close']   = '
';
    $config['cur_tag_open']     =  '
';
    $config['cur_tag_close']    = '
';
    $config['num_tag_open']     = '
';
    $config['num_tag_close']    = '
';
    $config['num_links']        = 4;

    $this->pagination->initialize($config);

    $this->load->model('user_model');
    $data['user'] = $this->user_model->find_by_id($this->get_user_id());

    $flash_login_success = $this->session->flashdata('flash_message');

    if (isset($flash_login_success) && ! empty($flash_login_success))
    {
      $data['flash'] = $flash_login_success;
    }

    $data['is_admin'] = $this->is_admin();
    $session_data = $this->get_user_data();
    $data['email_address'] = $session_data['email_address'];
    $data['feed_id'] = $this->session->userdata('feed_id');
    //echo $this->feed_model->get_feed_uuid(3);

    $this->load->view('album/index', $data);
  }

  /**
   * View form for creation of album.
   */
  public function create()
  {
    $this->load->helper('form');
    $this->load->view('album/create');
  }

  /**
   * Process album addition.
   */
  public function add()
  {
    // Validate form.
    $this->load->helper('form');
    $this->load->library('form_validation');
    $this->form_validation->set_error_delimiters('
Error: ', '
');
    $user_data = $this->session->all_userdata();
    $this->form_validation->set_rules('album_name', 'Album Name', 'trim|required|max_length[45]|xss_clean');
    if ($this->form_validation->run() == FALSE)
    {
      // Form didn't validate
      $this->load->view('album/create');
    }
    else
    {
      // Success, create album & redirect
      $now = date('Y-m-d H:i:s');
      $data = array(
                   'name'       => $this->input->post('album_name'),
                   'uuid'       => $this->create_uuid(),
                   'created_by' => $user_data['user_id'],
                   'updated_by' => $user_data['user_id'],
                   'created_at' => $now,
                   'updated_at' => $now);
      $new_ablum_id = $this->album_model->create($data);

      $this->load->model('config_model');
      $this->config_model->create(array(
          'album_id' => $new_ablum_id,
          'thumb_width' => 100,
          'thumb_height' => 100,
          'crop_thumbnails' => 0
      ));

      $this->session->set_flashdata('flash_message', "Successfully created album.");
      redirect('album/images/' . $new_ablum_id);
    }
  }

  /**
   * Display stored album to edit.
   *
   * @param type $album_id
   */
  public function edit($album_id)
  {
    $this->load->helper('form');

    $data = array();
    $data['album'] = $this->album_model->find_by_id($album_id);

    $this->load->view('album/edit', $data);
  }

  /**
   *
   * @param type $album_id
   */
  public function update($album_id)
  {
    // Validate form.
    $this->load->helper('form');
    $this->load->library('form_validation');
    $this->form_validation->set_error_delimiters('
Error: ', '
');

    $data = array();
    $data['album'] = $this->album_model->find_by_id($album_id);
    $user_data = $this->session->all_userdata();

    $this->form_validation->set_rules('album_name', 'Album Name', 'trim|required|max_length[45]|xss_clean');
    if ($this->form_validation->run() == FALSE)
    {
      // Form didn't validate
      $this->load->view('album/create', $data);
    }
    else
    {
      // Success, create album & redirect
      $now = date('Y-m-d H:i:s');
      $data = array(
                   'name' => $this->input->post('album_name'),
                   'created_by' => $user_data['user_id'],
                   'updated_by' => $user_data['user_id'],
                   'created_at' => $now,
                   'updated_at' => $now);
      $this->album_model->update($data, $album_id);
      $this->session->set_flashdata('flash_message', "Successfully updated album.");
      redirect('album');
    }
  }

  /**
   * Deletes album, according image records and files.
   *
   * @param type $album_id
   */
  public function remove($album_id)
  {
    // Delete all photos with this album id
    $rs = $this->image_model->get_images_by_album_id($album_id);
    if ( ! empty($rs))
    {
      foreach ($rs as $image)
      {
        $file_name = $image->path . $image->file_name;
        $thumbnail_name = $image->path . $image->raw_name . '_thumb' . $image->file_ext;
        if (file_exists($file_name))
        {
          unlink($file_name);
        }
        if (file_exists($thumbnail_name))
        {
          unlink($thumbnail_name);
        }
      }
    }
    // Delete image records
    $this->image_model->delete_by_album_id($album_id);
    // Delete album record
    $this->album_model->delete($album_id);
    // Delete album config
    $this->load->model('config_model');
    $this->config_model->delete_by_album_id($album_id);
    // Delete feeds
    $this->load->model('feed_model');
    $this->feed_model->delete_albums_by_album_id($album_id);

    $this->session->set_flashdata('flash_message', "Successfully deleted album.");
    redirect('album');
  }

  /**
   * Displays images for selected album.
   *
   * @param type $album_id
   */
  public function images($album_id)
  {
    $this->load->model('config_model');

    $data = array();
    $data['config']    = $this->config_model->get_by_album_id($album_id);
    $data['album']     = $this->album_model->find_by_id($album_id);
    $data['images']    = $this->image_model->get_images_by_album_id($album_id);
    $data['user_id']   = $this->get_user_id();

    $flash_login_success = $this->session->flashdata('flash_message');
    if (isset($flash_login_success) && ! empty($flash_login_success))
    {
      $data['flash'] = $flash_login_success;
    }

    $this->load->view('album/images', $data);
  }

  /**
   * Displays configuration options for album, also processes form.
   *
   * @param type $album_id
   * @return type
   */
  public function configure($album_id)
  {
    $this->load->model('config_model');
    $this->load->helper('form');

    $thumb_width = $this->input->post('thumb_width');

    if (isset($thumb_width) && ! empty($thumb_width))
    {
      $this->load->library('form_validation');
      $this->form_validation->set_error_delimiters('
Error: ', '
');
      $this->form_validation->set_rules('thumb_width', 'Thumbnail width', 'trim|required|max_length[3]|less_than[300]|greater_than[0]|is_natural|xss_clean');
      $this->form_validation->set_rules('thumb_height', 'Thumbnail height', 'trim|required|max_length[3]|less_than[300]|greater_than[0]|is_natural|xss_clean');

      if ($this->form_validation->run() != FALSE)
      {
        $this->config_model->update_by_album_id(array(
            'album_id'        => $album_id,
            'thumb_width'     => $this->input->post('thumb_width'),
            'thumb_height'    => $this->input->post('thumb_height'),
            'crop_thumbnails' => $this->input->post('crop_thumbnails'),
            'auto_publish'    => $this->input->post('auto_publish')
        ), $album_id);

        // Update all album's thumbnails
        $images = $this->image_model->get_images_by_album_id($album_id);
        if ( ! empty($images))
        {
          $this->load->library('image_lib');
          $config = array();
          foreach ($images as $image)
          {
            $config['image_library']   = 'gd2';
            $config['source_image']    = './uploads/' . $image->file_name;
            $config['create_thumb']    = TRUE;
            $config['maintain_ratio']  = TRUE;
            $config['width']           = $this->input->post('thumb_width');
            $config['height']          = $this->input->post('thumb_height');
            $config['thumb_marker']    = '_thumb';
            // TODO Handle cropping
            $this->image_lib->initialize($config);
            $this->image_lib->resize();
            $this->image_lib->clear();
            $config = array();
          }
        }

        $now = date('Y-m-d H:i:s');
        $this->album_model->update(array('updated_at' => $now), $album_id);

        redirect("album/images/$album_id");
        return;
      }
    }

    $data = array();
    $data['config'] = $this->config_model->get_by_album_id($album_id);
    $data['album'] = $this->album_model->find_by_id($album_id);

    $this->load->view('album/config', $data);
  }

  /**
   * Handles resizing of images per album.
   *
   * @param type $filename
   */
  public function resize($album_id, $image_id)
  {
    $this->load->model('config_model');
    $image = $this->image_model->find_by_id($image_id);
    if (isset($image))
    {
      $album_config = $this->config_model->get_by_album_id($album_id);

      $this->load->library('image_lib');
      $config = array();
      $config['image_library']   = 'gd2';
      $config['source_image']    = './uploads/' . $image->file_name;
      $config['create_thumb']    = TRUE;
      $config['maintain_ratio']  = TRUE;
      $config['width']           = $album_config->thumb_width;
      $config['height']          = $album_config->thumb_height;
      $config['thumb_marker']    = '_thumb';
      // TODO Handle cropping
      $this->image_lib->initialize($config);
      $this->image_lib->resize();

      $success = $this->image_lib->resize();
      $this->image_lib->clear();
    }

    if ($success == TRUE)
    {
      echo $image->raw_name . '_thumb' . $image->file_ext;
    } else {
      echo 'failure';
    }
  }

  /**
   * Handles reordering of images.
   */
  public function reorder()
  {
    // Reorder images with incoming AJAX request
    if( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
    {
      foreach ($this->input->get('order_num', TRUE) as $position => $image_id)
      {
        $this->image_model->reorder($image_id, $position + 1);
      }
      echo 'success';
    }
  }

}


text:
import app from '~/app';
import template from "text!./view-resource.directive.html";
import '~/views/directives/record-options';
import '~/views/forms/directives/view-terms-hierarchy';
import viewResourceT from '~/app-text/views/forms/view/view-resource.json';
app.directive("viewResource", ['translationService', function (translationService) {
	return {
		restrict   : "EAC",
		template: template,
		replace    : true,
		transclude : false,
		scope: {
			document: "=ngModel",
			locale  : "=",
			target  : "@linkTarget",
			hide : "@"
		},
		controller : ["$scope", "IStorage", "$http","realm",function ($scope, storage, $http, realm)
		{
			translationService.set('viewResourceT', viewResourceT);
			$scope.isABS = realm.is('ABS');
			$scope.isBCH = realm.is('BCH');

			//====================
			//
			//====================
			$scope.display = function(field) {

				if(!$scope.hide) return true; //show all fields

				return( $scope.hide.indexOf(field) >= 0 ? false : true);
			};

		}]
	};
}]);


text:
module <%= prefix %>.<%= module %>.<%= $namespace %>.test {
  'use strict';

  describe(`Unit: ${Namespace}.<%= classedName %>Controller`, () => {

    beforeEach(module(Namespace));

    var controller: I<%= classedName %>Controller;
    beforeEach(inject($controller => controller = $controller(ID.<%= classedName %>Controller)));

    it('should contain a <%= classedName %> controller', () => should.exist(controller));
  });
}


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>SK2| Affordable Web Desgin</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Lato|Oswald" rel="stylesheet">
<link rel="icon" type="image/png" href="logo2.png">

HOME

MY SERVICES

MY WORK

PRICE

CONTACT

Web App Devolpment

Web Design & Devolpment

Mobile First

Who Am I

I am a freelance fullstack web devolper with skills in HTML5,CSS3,Javascript, Node.js and PHP.
			I have been learing to code and program and create ever since I was 13. Over the years I have expanded my knowledge to AI, Web App Devolpment.
			I always put mobile first because in the 21st century everything is done a phone from ordering food to makeing money transfers.
			I am happy about any project and I am much cheaper than many web devolpers and desingers with hourly rates starting at just $7.15.

My Work and Craft

Web site name

Wesite name

Website

Website name

Website name

Webstie name

Pricing and Packages

			Package
			Detials
			Price

			Starter
			Great Package for a person  who is starting a small local busniess
			or is starting an affiledted marketing website
			 $9.99 per month

			Pro
			Great for anyone who is starting an online busniess
			or courses this packages covers everything from a website
			to the marketing of your course we are there for you every step
			of the way to grow your business
			 $19.99 per month

			Bussiness
			Anyone who wants to grow there online apperacne and grow
			your business this is the right one for you. Form anylitch tools for
			your website to knowing what people are wanting and buying
			 $39.99 Per month

			Enterprise
			For a copmany that is rapidly growing and is worth 6 figures to
			10 figures
			Contact

  <form action="/action_page.php">
    First Name
    <input type="text" id="fname" name="firstname" placeholder="Your name..">

    Last Name
    <input type="text" id="lname" name="lastname" placeholder="Your last name..">

	Email
	<input type="text" id="Email" name="mail" placeholder="example@example.com">

    What Can We Offer You
    <select id="country" name="country">
      <option value="australia">Web Desgin & Devolpment</option>
      <option value="canada">Web App Devolpment</option>
      <option value="usa">Graphical Desing or Online Marketing</option>
    </select>

    <input type="submit" value="Submit">
  </form>

HOME

MY SERVICES

MY WORK

PRICE

CONTACT

 copywrite &copy Skippynose2


text:
package com.amazonaws.services.quicksight.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.quicksight.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * ActiveIAMPolicyAssignment JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ActiveIAMPolicyAssignmentJsonUnmarshaller implements Unmarshaller<ActiveIAMPolicyAssignment, JsonUnmarshallerContext> {

    public ActiveIAMPolicyAssignment unmarshall(JsonUnmarshallerContext context) throws Exception {
        ActiveIAMPolicyAssignment activeIAMPolicyAssignment = new ActiveIAMPolicyAssignment();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("AssignmentName", targetDepth)) {
                    context.nextToken();
                    activeIAMPolicyAssignment.setAssignmentName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("PolicyArn", targetDepth)) {
                    context.nextToken();
                    activeIAMPolicyAssignment.setPolicyArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return activeIAMPolicyAssignment;
    }

    private static ActiveIAMPolicyAssignmentJsonUnmarshaller instance;

    public static ActiveIAMPolicyAssignmentJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new ActiveIAMPolicyAssignmentJsonUnmarshaller();
        return instance;
    }
}


text: * [Description](docs/description.md)


text:
import Ember from 'ember';

export default Ember.Controller.extend({
  counter: 0,
  startIncrementingCounter: function(){
    var controller = this;
    window.setInterval(function(){
      Ember.run(controller, 'incrementProperty', 'counter', 10);
    }, 3000);
  }.on('init')
});


text:
package restconfig;

import com.sun.jersey.spi.container.ContainerRequest;
import com.sun.jersey.spi.container.ContainerResponse;
import com.sun.jersey.spi.container.ContainerResponseFilter;
import utils.config.ConfigProperties;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CORSFilter implements ContainerResponseFilter {

    @Override
    public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
        String method = request.getMethod();
        try {
            if (method.equals("GET")) {
                response.getHttpHeaders().add("Access-Control-Allow-Origin", ConfigProperties.getPropertyParam("get_origin"));
            } else {
                response.getHttpHeaders().add("Access-Control-Allow-Origin", ConfigProperties.getPropertyParam("other_origin"));
            }
            response.getHttpHeaders().add("Access-Control-Allow-Methods", "GET, POST");
            response.getHttpHeaders().add("Access-Control-Allow-Headers", "Content-Type, Accept, Accept-Encoding");
            response.getHttpHeaders().add("Access-Control-Allow-Credentials", "false");
        } catch (IOException ex) {
            Logger.getLogger(CORSFilter.class.getName()).log(Level.SEVERE, null, ex);
        }
        return response;
    }

}


text:
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
 */
package org.hibernate.orm.type.descriptor.java.internal;

import java.sql.Types;

import org.hibernate.orm.type.descriptor.java.spi.AbstractBasicTypeDescriptor;
import org.hibernate.orm.type.descriptor.spi.JdbcRecommendedSqlTypeMappingContext;
import org.hibernate.orm.type.descriptor.spi.WrapperOptions;
import org.hibernate.orm.type.descriptor.sql.spi.SqlTypeDescriptor;

/**
 * Descriptor for {@link Short} handling.
 *
 * @author Steve Ebersole
 */
public class ShortJavaDescriptor extends AbstractBasicTypeDescriptor<Short> {
	public static final ShortJavaDescriptor INSTANCE = new ShortJavaDescriptor();

	public ShortJavaDescriptor() {
		super( Short.class );
	}

	@Override
	public SqlTypeDescriptor getJdbcRecommendedSqlType(JdbcRecommendedSqlTypeMappingContext context) {
		return context.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor( Types.TINYINT );
	}

	@Override
	public String toString(Short value) {
		return value == null ? null : value.toString();
	}
	@Override
	public Short fromString(String string) {
		return Short.valueOf( string );
	}

	@SuppressWarnings({ "unchecked" })
	@Override
	public <X> X unwrap(Short value, Class<X> type, WrapperOptions options) {
		if ( value == null ) {
			return null;
		}
		if ( Short.class.isAssignableFrom( type ) ) {
			return (X) value;
		}
		if ( Byte.class.isAssignableFrom( type ) ) {
			return (X) Byte.valueOf( value.byteValue() );
		}
		if ( Integer.class.isAssignableFrom( type ) ) {
			return (X) Integer.valueOf( value.intValue() );
		}
		if ( Long.class.isAssignableFrom( type ) ) {
			return (X) Long.valueOf( value.longValue() );
		}
		if ( Double.class.isAssignableFrom( type ) ) {
			return (X) Double.valueOf( value.doubleValue() );
		}
		if ( Float.class.isAssignableFrom( type ) ) {
			return (X) Float.valueOf( value.floatValue() );
		}
		if ( String.class.isAssignableFrom( type ) ) {
			return (X) value.toString();
		}
		throw unknownUnwrap( type );
	}
	@Override
	public <X> Short wrap(X value, WrapperOptions options) {
		if ( value == null ) {
			return null;
		}
		if ( Short.class.isInstance( value ) ) {
			return (Short) value;
		}
		if ( Number.class.isInstance( value ) ) {
			return ( (Number) value ).shortValue();
		}
		if ( String.class.isInstance( value ) ) {
			return Short.valueOf( ( (String) value ) );
		}
		throw unknownWrap( value.getClass() );
	}
}


text:
package core;

//dfernandez@cvc.uab.es

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

public class ProgrammedEvent extends SpecialTask implements Serializable {

  private static final long serialVersionUID = 1L;

  private Date startingDate;

  private Date endingDate;

  /**
   * Programmed event constructor.
   *
   * @param root Project root object.
   * @param name Task instance name.
   * @param description Task instance descrpition.
   * @param father Father activity of the new task.
   * @param nstartingDate Used to start the task in a future date.
   */
  public ProgrammedEvent(String name, String description, Project father, ArrayList<Activity> root,
      Date nstartingDate, Date nendingDate) {
    super(name, description, father, root, "ProgrammedEvent");
    assert ((name != null) && (description != null) && (father != null));
    startingDate = nstartingDate;
    endingDate = nendingDate;
  }

  /**
   * No arg constructor used to serialize.
   */
  public ProgrammedEvent() {

  }

  @Override
  public Task getNextTask() {
    return null;
  }

  @Override
  public Date getTaskStartDate() {
    return startingDate;
  }

  @Override
  public int getTimeLimit() {
    return 0;
  }

  public Date getEndingDate() {
    return endingDate;
  }

  public void setEndingDate(Date endingDate) {
    this.endingDate = endingDate;
  }
}


text:
from seabreeze.pyseabreeze.features._base import SeaBreezeFeature

# Definition
# ==========
#
# TODO: This feature needs to be implemented for pyseabreeze
#
class SeaBreezeGPIOFeature(SeaBreezeFeature):
    identifier = "gpio"

    modes = dict(
        GPIO_OUTPUT_PUSH_PULL=0x00,
        GPIO_OPEN_DRAIN_OUTPUT=0x01,
        DAC_OUTPUT=0x02,
        GPIO_INPUT_HIGH_Z=0x80,
        GPIO_INPUT_PULL_DOWN=0x81,
        ADC_INPUT=0x82,
    )

    def get_number_of_gpio_pins(self) -> int:
        raise NotImplementedError("implement in derived class")

    def get_gpio_output_enable_vector(self) -> int:
        raise NotImplementedError("implement in derived class")

    def set_gpio_output_enable_vector(
        self, output_enable_vector: int, bit_mask: int
    ) -> None:
        raise NotImplementedError("implement in derived class")

    def get_gpio_value_vector(self) -> int:
        raise NotImplementedError("implement in derived class")

    def set_gpio_value_vector(self, value_vector: int, bit_mask: int) -> None:
        raise NotImplementedError("implement in derived class")

    def get_number_of_egpio_pins(self) -> int:
        raise NotImplementedError("implement in derived class")

    def get_egpio_available_modes(self, pin_number: int) -> int:
        raise NotImplementedError("implement in derived class")

    def get_egpio_current_mode(self, pin_number: int) -> int:
        raise NotImplementedError("implement in derived class")

    def set_egpio_mode(self, pin_number: int, mode: int, value: float = 0.0) -> None:
        raise NotImplementedError("implement in derived class")

    def get_egpio_output_vector_vector(self) -> int:
        raise NotImplementedError("implement in derived class")

    def set_egpio_output_vector(self, output_vector: int, bit_mask: int) -> None:
        raise NotImplementedError("implement in derived class")

    def get_egpio_value(self, pin_number: int) -> float:
        raise NotImplementedError("implement in derived class")

    def set_egpio_value(self, pin_number: int, value: float) -> None:
        raise NotImplementedError("implement in derived class")


text:
{% from "macros/datatables.html" import row_assignment_name, row_weight, row_due_date, row_category,
                                        row_not_visible_before, row_cannot_build_after,
                                        row_is_group, row_full_score, row_assignment_min_score,
                                        row_assignment_max_score, row_start_auto_building,
                                        row_end_auto_building, row_assignment_status,
                                        row_auto_build_status, row_grades_reported, row_average,
                                        row_standard_deviation, cell_gradeslog_student, cell_grade,
                                        cell_slip, cell_grade_updated, cell_build_name, cell_status,
                                        cell_source, cell_commit, cell_message, cell_build_started
                                        %}
{% from "macros/pagination.html" import pagination %}
{% extends "_ta.html" %}
{% block content %}

{% for (name, full_score, min_score, max_score, weight, due_date, category, is_group,
        manual_grading, not_visible_before, cannot_build_after, start_auto_building,
        end_auto_building, count, average, stddev) in [assignment_info] %}
{% if page == 1 %}

Assignment Details

            {{ row_assignment_name(name) }}
            {{ row_weight(weight) }}
            {{ row_full_score(full_score) }}
            {{ row_assignment_min_score(min_score) }}
            {{ row_assignment_max_score(max_score) }}
            {{ row_due_date(due_date) }}
            {{ row_category(category) }}
        {% if groups_enabled %}
            {{ row_is_group(is_group) }}
        {% endif %}
            {{ row_not_visible_before(not_visible_before) }}
        {% if not manual_grading %}
            {{ row_cannot_build_after(cannot_build_after) }}
            {{ row_assignment_status(manual_grading, not_visible_before, cannot_build_after) }}
            {{ row_start_auto_building(start_auto_building) }}
            {{ row_end_auto_building(end_auto_building) }}
            {{ row_auto_build_status(manual_grading, start_auto_building, end_auto_building) }}
        {% endif %}

Statistics

            {{ row_grades_reported(count) }}
            {{ row_average(average) }}
            {{ row_standard_deviation(stddev) }}
            {% if count %}

                    <svg class="ob2-graph js-ob2-graph" style="width: 100%;"
                         data-endpoint="{{ url_for("ta.assignments_one_grade_distribution",
                                                   name=name, _csrf_token=generate_csrf_token()) }}"
                         data-type="histogram" data-aspectratio="2.5">

            {% endif %}
            {% if builds %}

                    <svg class="ob2-graph js-ob2-graph" style="width: 100%;"
                         data-endpoint="
                         {{- url_for("ta.assignments_one_timeseries_grade_percentiles", name=name,
                                     _csrf_token=generate_csrf_token()) }}"
                         data-type="smooth" data-aspectratio="2.5">

            {% endif %}

Grades for {{ name }}

                Name
                SID
                GitHub
                Email
                Grade
                Slip {{ slip_unit_name() }}
                Updated

        {% for user_id, name, sid, github, email, super, score, slipunits, updated in grades %}

                {{ cell_gradeslog_student(name, github, user_id, super) }}
                {{ sid }}

                {% if github %}
                    {{ github }}
                {% else %}
                    —
                {% endif %}

                    {{ email }}

                {{ cell_grade(score, full_score) }}
                {{ cell_slip(slipunits) }}
                {{ cell_grade_updated(updated) }}

        {% endfor %}

{% endif %}
{% if not manual_grading %}

Builds for {{ name }}

    {% if page > 1 %}
    {{ pagination(page, "ta.assignments_one", more_pages, kwargs={"name": name}) }}

    {% endif %}

                Build name
                Status
                Source
                Commit
                Message
                Started

        {% for (build_name, source, status, score, commit, message, started) in builds %}

                {{ cell_build_name(build_name, link_to="ta") }}
                {{ cell_status(status, score, full_score) }}
                {{ cell_source(source, link_to="ta") }}
                {{ cell_commit(commit, source) }}
                {{ cell_message(message) }}
                {{ cell_build_started(started) }}

        {% endfor %}

{% if page != 1 or more_pages %}

    {{ pagination(page, "ta.assignments_one", more_pages, kwargs={"name": name}) }}

{% endif %}
{% endif %}
{% endfor %}
{% endblock %}


text:
require_relative './kubeclient_helper'

class TestProvisioner
  extend KubeclientHelper

  class << self
    def prepare_cluster
      WebMock.allow_net_connect!
      $stderr.print("Preparing test cluster... ")
      [ENV['PARALLELISM'].to_i, 4].max.times { |i| prepare_pv("pv000#{i}") }
      $stderr.puts "Done."
      WebMock.disable_net_connect!
    end

    def claim_namespace(test_name)
      prefix = "k8sdeploy-"
      suffix = "-#{SecureRandom.hex(8)}"
      max_base_length = 63 - (prefix + suffix).length # namespace name length must be <= 63 chars
      ns_name = prefix + test_name.gsub(/[^-a-z0-9]/, '-').slice(0, max_base_length) + suffix

      create_namespace(ns_name)
      ns_name
    end

    def delete_namespace(namespace)
      kubeclient.delete_namespace(namespace) if namespace.present?
    rescue KubeException => e
      raise unless e.is_a?(Kubeclient::ResourceNotFoundError)
    end

    def prepare_pv(name, storage_class_name: nil)
      existing_pvs = kubeclient.get_persistent_volumes(label_selector: "name=#{name}")
      return if existing_pvs.present?

      pv = Kubeclient::Resource.new(kind: 'PersistentVolume')
      pv.metadata = {
        name: name,
        labels: { name: name },
      }
      pv.spec = {
        accessModes: %w(ReadWriteOnce),
        capacity: { storage: "150Mi" },
        hostPath: { path: "/data/#{name}" },
        persistentVolumeReclaimPolicy: "Recycle",
      }
      pv.spec[:storageClassName] = storage_class_name if storage_class_name.present?

      kubeclient.create_persistent_volume(pv)
    end

    private

    def create_namespace(namespace)
      ns = Kubeclient::Resource.new(kind: 'Namespace')
      ns.metadata = { name: namespace }
      kubeclient.create_namespace(ns)
    end
  end
end


text:
import {createStore, applyMiddleware, compose} from 'redux';
import createDebounce from 'redux-debounce';
import thunk from 'redux-thunk';
import {apiMiddleware} from 'redux-api-middleware';
import timeoutScheduler from '../middleware/timeout';
import persistState from 'redux-localstorage';

import rootReducer from '../reducers';

const debouncer = createDebounce({ simple: 300 });

export default function configureStore (initialState, ...middlewares) {
  const enhancer = compose(
    applyMiddleware(
      debouncer,
      timeoutScheduler,
      thunk,
      apiMiddleware,
      ...middlewares
    ),
    persistState('connection', { key: 'micromdm' })
  );

  const store = createStore(
    rootReducer,
    initialState,
    enhancer
  );

  return store;
}


text:
"""This module contains the general information for AdaptorEthCompQueueProfile ManagedObject."""

from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta

class AdaptorEthCompQueueProfileConsts:
    pass

class AdaptorEthCompQueueProfile(ManagedObject):
    """This is AdaptorEthCompQueueProfile class."""

    consts = AdaptorEthCompQueueProfileConsts()
    naming_props = set([])

    mo_meta = {
        "classic": MoMeta("AdaptorEthCompQueueProfile", "adaptorEthCompQueueProfile", "eth-comp-q", VersionMeta.Version151f, "InputOutput", 0x1f, [], ["admin", "read-only", "user"], [u'adaptorHostEthIf'], [], ["Get", "Set"]),
        "modular": MoMeta("AdaptorEthCompQueueProfile", "adaptorEthCompQueueProfile", "eth-comp-q", VersionMeta.Version2013e, "InputOutput", 0x1f, [], ["admin", "read-only", "user"], [u'adaptorHostEthIf'], [], ["Get", "Set"])
    }

    prop_meta = {

        "classic": {
            "count": MoPropertyMeta("count", "count", "uint", VersionMeta.Version151f, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], ["1-512"]),
            "dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version151f, MoPropertyMeta.READ_WRITE, 0x4, 0, 255, None, [], []),
            "rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version151f, MoPropertyMeta.READ_WRITE, 0x8, 0, 255, None, [], []),
            "status": MoPropertyMeta("status", "status", "string", VersionMeta.Version151f, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
            "child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version151f, MoPropertyMeta.INTERNAL, None, None, None, None, [], []),
            "ring_size": MoPropertyMeta("ring_size", "ringSize", "string", VersionMeta.Version151f, MoPropertyMeta.READ_ONLY, None, None, None, None, [], ["1-1"]),
        },

        "modular": {
            "count": MoPropertyMeta("count", "count", "uint", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], ["1-512"]),
            "dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x4, 0, 255, None, [], []),
            "rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x8, 0, 255, None, [], []),
            "status": MoPropertyMeta("status", "status", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
            "child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version2013e, MoPropertyMeta.INTERNAL, None, None, None, None, [], []),
            "ring_size": MoPropertyMeta("ring_size", "ringSize", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_ONLY, None, None, None, None, [], ["1-1"]),
        },

    }

    prop_map = {

        "classic": {
            "count": "count",
            "dn": "dn",
            "rn": "rn",
            "status": "status",
            "childAction": "child_action",
            "ringSize": "ring_size",
        },

        "modular": {
            "count": "count",
            "dn": "dn",
            "rn": "rn",
            "status": "status",
            "childAction": "child_action",
            "ringSize": "ring_size",
        },

    }

    def __init__(self, parent_mo_or_dn, **kwargs):
        self._dirty_mask = 0
        self.count = None
        self.status = None
        self.child_action = None
        self.ring_size = None

        ManagedObject.__init__(self, "AdaptorEthCompQueueProfile", parent_mo_or_dn, **kwargs)


text:
#ifndef BOOST_SPIRIT_INCLUDE_LEX_SET_STATE
#define BOOST_SPIRIT_INCLUDE_LEX_SET_STATE
#include <boost/spirit/home/lex/set_state.hpp>
#endif


text:
<appendix xmlns="http://docbook.org/ns/docbook"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd">
  <title>Optimising for Performance</title>
  <para>
    This appendix lists some suggestions on how to get the best possible performance from your
    evolutionary Java programs.  Much of the advice here applies whether or not you are using the
    Watchmaker Framework to develop your evolutionary programs.
  </para>
  <para>
    As with all optimisations in software development, the golden rule is don't do it unless you have
    a demonstrable need for improved performance.  Optimisations often introduce complexity and make
    code harder to maintain.  Before starting on any optimisations, always use a profiler to identify
    the bottlenecks in your application.  This will pinpoint the areas where optimisations are most
    likely to beneficial.  It is pointless to expend effort to try to speed up a routine that accounts
    for only 0.1% of the CPU time.
  </para>

    <title>Optimising the Fitness Evaluator</title>
    <indexterm><primary>fitness function</primary><secondary>optimisation of</secondary></indexterm>
    <para>
      For most non-trivial evolutionary algorithms, the bulk of the work is the evaluation of
      candidate solutions.  For this reason the fitness function is often the obvious place to
      make improvements.  A fitness evaluator should do no more work than is absolutely
      necessary on each invocation. If there is some initialisation that is repeated unnecessarily,
      consider moving it to the constructor.  If similar calculations are performed every time,
      consider pre-computing the possible results and using a look-up table.  When you consider
      that the evaluator may be invoked millions of times in a single run, it is clear that even
      small optimisations to the fitness function may add up to substantial reductions in running
      time.
    </para>

      <title>The Caching Fitness Evaluator</title>
      <indexterm><primary>CachingFitnessEvaluator</primary></indexterm>
      <indexterm><primary>fitness function</primary><secondary>caching</secondary></indexterm>
      <indexterm><primary>elitism</primary></indexterm>
      <para>
        In some evolutionary programs individuals can survive from generation to generation unmodified.
        The most obvious example of this is elitism.  Individuals that are preserved through elitism
        will appear unaltered in the next generation and may survive for many generations.  Individuals
        may also survive without modification if the evolutionary operators in use are probabilistic and
        don't always affect every candidate.
      </para>
      <para>
        If fitness evaluations are expensive, it is wasteful to repeatedly recalculate fitness values
        for unaltered individuals.  The Watchmaker Framework provides the
        <classname>org.uncommons.watchmaker.framework.CachingFitnessEvaluator</classname> class to
        address this problem.  It acts as a wrapper for your fitness evaluator and caches the results
        of fitness calculations.  If the same candidate is evaluated twice, the cached value is returned
        the second time thus avoiding the cost of recalculating the fitness score.  The cache uses Java's
        weak references to avoid memory leakage (if the candidate does not survive, the associated cache
        entry will also be garbage collected).
      </para>
      <note>
        <para>
          Caching of fitness scores is provided as an option rather than as the default Watchmaker
          Framework behaviour because caching is only valid when fitness evaluations are
          <emphasis>isolated</emphasis> and <emphasis>repeatable</emphasis>.  An isolated fitness
          evaluation is one where the result depends only upon the candidate being evaluated.  This is
          not the case when candidates are evaluated against the other members of the population.
          Caching should not be used if it is possible for multiple evaluations of the same candidate
          to return different scores.
        </para>
      </note>

    <title>Minimising the Search Space</title>
    <para>
      An evolutionary algorithm is a type of non-deterministic search.  The algorithm is
      searching the space of all possible solutions to find one that is good enough.  The
      larger the search space, the longer it is likely to take to converge on a
      satisfactory solution.
      For this reason, anything we can do to constrain the search space, without
      handicapping the algorithm, is likely to be beneficial.  This includes choosing
      an efficient candidate representation and using evolutionary operators that
      avoid generating useless or invalid solutions.
      A little intelligent design can go a long way.
    </para>

    <title>Random Number Generators</title>
    <indexterm><primary>random number generator</primary></indexterm>
    <indexterm><primary>Random</primary></indexterm>
    <indexterm><primary>RNG</primary></indexterm>
    <indexterm><primary>SecureRandom</primary></indexterm>
    <para>
      The random number generator (RNG) is a core component of any evolutionary simulation.  It is
      used for selection, for cross-over and for mutation.  A slow random number generator can be
      a bottleneck.  Most programming languages provide a mechanism to generate random numbers.
      Unfortunately, few of them are ideal.  The Java standard library includes two RNGs,
      <classname>java.util.Random</classname> and <classname>java.security.SecureRandom</classname>.
      These should be avoided for statistical and performance reasons respectively.
    </para>
    <indexterm><primary>MersenneTwisterRNG</primary></indexterm>
    <para>
      The Watchmaker Framework comes bundled with three high-quality RNGs provided by the Uncommons
      Maths project.  Of these, the <classname>org.uncommons.maths.random.MersenneTwisterRNG</classname>
      is the most suitable for the majority of evolutionary programs.  Alternatively, you can use any
      third party RNG that is a sub-class of <classname>java.util.Random</classname>.
    </para>

    <title>JVM Options</title>
    <indexterm><primary>Java Virtual Machine</primary></indexterm>
    <indexterm><primary>JVM</primary></indexterm>
    <para>
      The Java Virtual Machine (JVM) is a complex piece of software.  It is designed to run a huge
      variety different programs.  As such, its default configuration is not optimised for the
      particular needs of evolutionary computation.  This section lists some of the JVM options
      that you can tweak to try to achieve better performance.
    </para>

      <title>Server VM</title>
      <indexterm><primary>server VM</primary></indexterm>
      <para>
        The Sun JVM provides two modes of operation, one optimised for client applications (the
        default) and one for server applications.  The server VM takes marginally longer to start
        up but provides substantially better performance for long-running processes and is therefore
        a better choice for most evolutionary algorithms.  The server VM is enabled using the
        <literal>-server</literal> switch.
      </para>

      <title>Garbage Collection</title>
      <indexterm><primary>garbage collection</primary></indexterm>
      <para>
        Evolutionary algorithms create many short-lived objects. Modern JVMs, with their generational
        garbage collectors, are typically well tuned for this usage pattern. However, you may find
        that by modifying the settings you are able to improve throughput.
      </para>
      <para>
        Garbage collectors make a trade-off between overall throughput and pause time. For
        evolutionary algorithms we typically want to maximise throughput, even at the expense of
        introducing noticeable pauses in the program's execution. What is most important is how soon
        the program completes, not how smoothly it runs.
      </para>
      <para>
        You can get information on what the garbage collector is doing by starting the JVM with the
        <literal>-verbosegc</literal> switch. If you find that the program is spending a lot of time
        collecting garbage, it may be because it is short of memory. If you have sufficient RAM,
        increasing the maximum size of the Java heap (using the <literal>-Xmx</literal> switch) may
        improve things.
      </para>

      <title>Alternative JVMs</title>
      <para>
        Sun Microsystems is not the only provider of virtual machines for Java. If your platform is
        supported, you may also have the option of using a JVM from BEA, IBM or some other third party.
        These virtual machines have different performance characteristics and different garbage
        collector implementations. If you have tried everything else and still need something faster,
        you may find that a different JVM will perform better.  Then again, it may not.
      </para>

</appendix>


text:
require_relative "../test_helper"
class Download::InstagramTest < Minitest::Test
  def test_should_download_valid_image
    url = "http://example.com/image.jpg"
    stub_request(:get, /graph\.facebook\.com/).to_return(body: {thumbnail_url: url}.to_json)

    stub_request(:get, url).to_return(headers: {content_type: "image/jpg"}, body: "12345678")
    download = Download.download!("https://www.instagram.com/p/CMGfYFaJoF7/", minimum_size: 8)
    assert download.valid?
    assert_instance_of Download::Instagram, download
  end
end