text:
<?php

/* SyliusWebBundle:Backend/Product:_form.html.twig */
class __TwigTemplate_2fd0b006c432f73c7cf0c659987b0b2fe86ad88334a4ebbc219025078c3a4e7a extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'errors');
        echo "
";
        // line 2
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_tabs.html.twig")->display($context);
        // line 3
        echo "

    ";
        // line 5
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_main.html.twig")->display($context);
        // line 6
        echo "    ";
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_options.html.twig")->display($context);
        // line 7
        echo "    ";
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_properties.html.twig")->display($context);
        // line 8
        echo "    ";
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_categorization.html.twig")->display($context);
        // line 9
        echo "    ";
        $this->env->loadTemplate("SyliusWebBundle:Backend/Product/Form:_images.html.twig")->display($context);
        // line 10
        echo "

";
        // line 13
        echo $this->env->getExtension('form')->renderer->searchAndRenderBlock($this->getAttribute((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), "_token"), 'widget');
        echo "
";
    }

    public function getTemplateName()
    {
        return "SyliusWebBundle:Backend/Product:_form.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  48 => 13,  40 => 9,  37 => 8,  34 => 7,  31 => 6,  29 => 5,  25 => 3,  23 => 2,  19 => 1,  113 => 32,  111 => 31,  105 => 30,  100 => 28,  94 => 25,  91 => 24,  88 => 23,  81 => 19,  75 => 18,  71 => 17,  68 => 16,  65 => 15,  43 => 10,  39 => 7,  35 => 6,  32 => 5,  27 => 3,);
    }
}

redpajama_set_name: RedPajamaGithub


text:
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "txbuf.h"
#include "bacdef.h"
#include "bacdcode.h"
#include "apdu.h"
#include "npdu.h"
#include "reject.h"
#include "handlers.h"
#include "device.h"

/** @file noserv.c  Handles an unrecognized/unsupported service. */

/** Handler to be invoked when a Service request is received for which no
 *  handler has been defined.
 * @ingroup MISCHNDLR
 * This handler builds a Reject response packet, and sends it.
 *
 * @param service_request [in] The contents of the service request (unused).
 * @param service_len [in] The length of the service_request (unused).
 * @param src [in] BACNET_ADDRESS of the source of the message
 * @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
 *                          decoded from the APDU header of this message.
 */
void handler_unrecognized_service(
    uint8_t * service_request,
    uint16_t service_len,
    BACNET_ADDRESS * src,
    BACNET_CONFIRMED_SERVICE_DATA * service_data)
{
    int len = 0;
    int pdu_len = 0;
    int bytes_sent = 0;
    BACNET_NPDU_DATA npdu_data;
    BACNET_ADDRESS my_address;

    (void) service_request;
    (void) service_len;

    /* encode the NPDU portion of the packet */
    datalink_get_my_address(&my_address);
    npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
    pdu_len =
        npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
        &npdu_data);
    /* encode the APDU portion of the packet */
    len =
        reject_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
        service_data->invoke_id, REJECT_REASON_UNRECOGNIZED_SERVICE);
    pdu_len += len;
    /* send the data */
    bytes_sent =
        datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0],
        pdu_len);
#if PRINT_ENABLED
    if (bytes_sent > 0) {
        fprintf(stderr, "Sent Reject!\n");
    } else {
        fprintf(stderr, "Failed to Send Reject (%s)!\n", strerror(errno));
    }
#else
    bytes_sent = bytes_sent;
#endif
}


text:
package scheduler

// This file tests the scheduler.

import (
	"context"
	"fmt"
	"testing"
	"time"

	"github.com/google/go-cmp/cmp"
	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/client-go/informers"
	clientset "k8s.io/client-go/kubernetes"
	corelisters "k8s.io/client-go/listers/core/v1"
	restclient "k8s.io/client-go/rest"
	"k8s.io/client-go/tools/cache"
	"k8s.io/client-go/tools/events"
	"k8s.io/kubernetes/pkg/scheduler"
	kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config"
	"k8s.io/kubernetes/pkg/scheduler/profile"
	"k8s.io/kubernetes/test/integration/framework"
	testutils "k8s.io/kubernetes/test/integration/util"
)

type nodeMutationFunc func(t *testing.T, n *v1.Node, nodeLister corelisters.NodeLister, c clientset.Interface)

type nodeStateManager struct {
	makeSchedulable   nodeMutationFunc
	makeUnSchedulable nodeMutationFunc
}

// TestSchedulerCreationFromConfigMap verifies that scheduler can be created
// from configurations provided by a ConfigMap object and then verifies that the
// configuration is applied correctly.
func TestSchedulerCreationFromConfigMap(t *testing.T) {
	_, s, closeFn := framework.RunAMaster(nil)
	defer closeFn()

	ns := framework.CreateTestingNamespace("configmap", s, t)
	defer framework.DeleteTestingNamespace(ns, s, t)

	clientSet := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
	defer clientSet.CoreV1().Nodes().DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{})
	informerFactory := informers.NewSharedInformerFactory(clientSet, 0)

	for i, test := range []struct {
		policy          string
		expectedPlugins map[string][]kubeschedulerconfig.Plugin
	}{
		{
			policy: `{
				"kind" : "Policy",
				"apiVersion" : "v1",
				"predicates" : [
					{"name" : "PodFitsResources"}
				],
				"priorities" : [
					{"name" : "ImageLocalityPriority", "weight" : 1}
				]
			}`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"PreFilterPlugin": {
					{Name: "NodeResourcesFit"},
				},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "NodeResourcesFit"},
					{Name: "TaintToleration"},
				},
				"ScorePlugin": {
					{Name: "ImageLocality", Weight: 1},
				},
				"BindPlugin": {{Name: "DefaultBinder"}},
			},
		},
		{
			policy: `{
				"kind" : "Policy",
				"apiVersion" : "v1"
			}`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"PreFilterPlugin": {
					{Name: "NodeResourcesFit"},
					{Name: "NodePorts"},
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
				},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "NodeResourcesFit"},
					{Name: "NodeName"},
					{Name: "NodePorts"},
					{Name: "NodeAffinity"},
					{Name: "VolumeRestrictions"},
					{Name: "TaintToleration"},
					{Name: "EBSLimits"},
					{Name: "GCEPDLimits"},
					{Name: "NodeVolumeLimits"},
					{Name: "AzureDiskLimits"},
					{Name: "VolumeBinding"},
					{Name: "VolumeZone"},
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
				},
				"PreScorePlugin": {
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
					{Name: "DefaultPodTopologySpread"},
					{Name: "TaintToleration"},
				},
				"ScorePlugin": {
					{Name: "NodeResourcesBalancedAllocation", Weight: 1},
					{Name: "PodTopologySpread", Weight: 2},
					{Name: "ImageLocality", Weight: 1},
					{Name: "InterPodAffinity", Weight: 1},
					{Name: "NodeResourcesLeastAllocated", Weight: 1},
					{Name: "NodeAffinity", Weight: 1},
					{Name: "NodePreferAvoidPods", Weight: 10000},
					{Name: "DefaultPodTopologySpread", Weight: 1},
					{Name: "TaintToleration", Weight: 1},
				},
				"ReservePlugin":   {{Name: "VolumeBinding"}},
				"UnreservePlugin": {{Name: "VolumeBinding"}},
				"PreBindPlugin":   {{Name: "VolumeBinding"}},
				"BindPlugin":      {{Name: "DefaultBinder"}},
				"PostBindPlugin":  {{Name: "VolumeBinding"}},
			},
		},
		{
			policy: `{
				"kind" : "Policy",
				"apiVersion" : "v1",
				"predicates" : [],
				"priorities" : []
			}`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "TaintToleration"},
				},
				"BindPlugin": {{Name: "DefaultBinder"}},
			},
		},
		{
			policy: `apiVersion: v1
kind: Policy
predicates:
- name: PodFitsResources
priorities:
- name: ImageLocalityPriority
  weight: 1
`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"PreFilterPlugin": {
					{Name: "NodeResourcesFit"},
				},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "NodeResourcesFit"},
					{Name: "TaintToleration"},
				},
				"ScorePlugin": {
					{Name: "ImageLocality", Weight: 1},
				},
				"BindPlugin": {{Name: "DefaultBinder"}},
			},
		},
		{
			policy: `apiVersion: v1
kind: Policy
`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"PreFilterPlugin": {
					{Name: "NodeResourcesFit"},
					{Name: "NodePorts"},
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
				},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "NodeResourcesFit"},
					{Name: "NodeName"},
					{Name: "NodePorts"},
					{Name: "NodeAffinity"},
					{Name: "VolumeRestrictions"},
					{Name: "TaintToleration"},
					{Name: "EBSLimits"},
					{Name: "GCEPDLimits"},
					{Name: "NodeVolumeLimits"},
					{Name: "AzureDiskLimits"},
					{Name: "VolumeBinding"},
					{Name: "VolumeZone"},
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
				},
				"PreScorePlugin": {
					{Name: "PodTopologySpread"},
					{Name: "InterPodAffinity"},
					{Name: "DefaultPodTopologySpread"},
					{Name: "TaintToleration"},
				},
				"ScorePlugin": {
					{Name: "NodeResourcesBalancedAllocation", Weight: 1},
					{Name: "PodTopologySpread", Weight: 2},
					{Name: "ImageLocality", Weight: 1},
					{Name: "InterPodAffinity", Weight: 1},
					{Name: "NodeResourcesLeastAllocated", Weight: 1},
					{Name: "NodeAffinity", Weight: 1},
					{Name: "NodePreferAvoidPods", Weight: 10000},
					{Name: "DefaultPodTopologySpread", Weight: 1},
					{Name: "TaintToleration", Weight: 1},
				},
				"ReservePlugin":   {{Name: "VolumeBinding"}},
				"UnreservePlugin": {{Name: "VolumeBinding"}},
				"PreBindPlugin":   {{Name: "VolumeBinding"}},
				"BindPlugin":      {{Name: "DefaultBinder"}},
				"PostBindPlugin":  {{Name: "VolumeBinding"}},
			},
		},
		{
			policy: `apiVersion: v1
kind: Policy
predicates: []
priorities: []
`,
			expectedPlugins: map[string][]kubeschedulerconfig.Plugin{
				"QueueSortPlugin": {{Name: "PrioritySort"}},
				"FilterPlugin": {
					{Name: "NodeUnschedulable"},
					{Name: "TaintToleration"},
				},
				"BindPlugin": {{Name: "DefaultBinder"}},
			},
		},
	} {
		// Add a ConfigMap object.
		configPolicyName := fmt.Sprintf("scheduler-custom-policy-config-%d", i)
		policyConfigMap := v1.ConfigMap{
			ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceSystem, Name: configPolicyName},
			Data:       map[string]string{kubeschedulerconfig.SchedulerPolicyConfigMapKey: test.policy},
		}

		policyConfigMap.APIVersion = "v1"
		clientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Create(context.TODO(), &policyConfigMap, metav1.CreateOptions{})

		eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1beta1().Events("")})
		stopCh := make(chan struct{})
		eventBroadcaster.StartRecordingToSink(stopCh)

		sched, err := scheduler.New(clientSet,
			informerFactory,
			scheduler.NewPodInformer(clientSet, 0),
			profile.NewRecorderFactory(eventBroadcaster),
			nil,
			scheduler.WithAlgorithmSource(kubeschedulerconfig.SchedulerAlgorithmSource{
				Policy: &kubeschedulerconfig.SchedulerPolicySource{
					ConfigMap: &kubeschedulerconfig.SchedulerPolicyConfigMapSource{
						Namespace: policyConfigMap.Namespace,
						Name:      policyConfigMap.Name,
					},
				},
			}),
			scheduler.WithProfiles(kubeschedulerconfig.KubeSchedulerProfile{
				SchedulerName: v1.DefaultSchedulerName,
				PluginConfig: []kubeschedulerconfig.PluginConfig{
					{
						Name: "VolumeBinding",
						Args: &kubeschedulerconfig.VolumeBindingArgs{
							BindTimeoutSeconds: 30,
						},
					},
				},
			}),
		)
		if err != nil {
			t.Fatalf("couldn't make scheduler config for test %d: %v", i, err)
		}

		schedPlugins := sched.Profiles[v1.DefaultSchedulerName].ListPlugins()
		if diff := cmp.Diff(test.expectedPlugins, schedPlugins); diff != "" {
			t.Errorf("unexpected plugins diff (-want, +got): %s", diff)
		}
	}
}

// TestSchedulerCreationFromNonExistentConfigMap ensures that creation of the
// scheduler from a non-existent ConfigMap fails.
func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) {
	_, s, closeFn := framework.RunAMaster(nil)
	defer closeFn()

	ns := framework.CreateTestingNamespace("configmap", s, t)
	defer framework.DeleteTestingNamespace(ns, s, t)

	clientSet := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
	defer clientSet.CoreV1().Nodes().DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{})

	informerFactory := informers.NewSharedInformerFactory(clientSet, 0)

	eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: clientSet.EventsV1beta1().Events("")})
	stopCh := make(chan struct{})
	eventBroadcaster.StartRecordingToSink(stopCh)

	_, err := scheduler.New(clientSet,
		informerFactory,
		scheduler.NewPodInformer(clientSet, 0),
		profile.NewRecorderFactory(eventBroadcaster),
		nil,
		scheduler.WithAlgorithmSource(kubeschedulerconfig.SchedulerAlgorithmSource{
			Policy: &kubeschedulerconfig.SchedulerPolicySource{
				ConfigMap: &kubeschedulerconfig.SchedulerPolicyConfigMapSource{
					Namespace: "non-existent-config",
					Name:      "non-existent-config",
				},
			},
		}),
		scheduler.WithProfiles(kubeschedulerconfig.KubeSchedulerProfile{
			SchedulerName: v1.DefaultSchedulerName,
			PluginConfig: []kubeschedulerconfig.PluginConfig{
				{
					Name: "VolumeBinding",
					Args: &kubeschedulerconfig.VolumeBindingArgs{
						BindTimeoutSeconds: 30,
					},
				},
			},
		}),
	)

	if err == nil {
		t.Fatalf("Creation of scheduler didn't fail while the policy ConfigMap didn't exist.")
	}
}

func TestUnschedulableNodes(t *testing.T) {
	testCtx := initTest(t, "unschedulable-nodes")
	defer testutils.CleanupTest(t, testCtx)

	nodeLister := testCtx.InformerFactory.Core().V1().Nodes().Lister()
	// NOTE: This test cannot run in parallel, because it is creating and deleting
	// non-namespaced objects (Nodes).
	defer testCtx.ClientSet.CoreV1().Nodes().DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{})

	goodCondition := v1.NodeCondition{
		Type:              v1.NodeReady,
		Status:            v1.ConditionTrue,
		Reason:            fmt.Sprintf("schedulable condition"),
		LastHeartbeatTime: metav1.Time{Time: time.Now()},
	}
	// Create a new schedulable node, since we're first going to apply
	// the unschedulable condition and verify that pods aren't scheduled.
	node := &v1.Node{
		ObjectMeta: metav1.ObjectMeta{Name: "node-scheduling-test-node"},
		Spec:       v1.NodeSpec{Unschedulable: false},
		Status: v1.NodeStatus{
			Capacity: v1.ResourceList{
				v1.ResourcePods: *resource.NewQuantity(32, resource.DecimalSI),
			},
			Conditions: []v1.NodeCondition{goodCondition},
		},
	}
	nodeKey, err := cache.MetaNamespaceKeyFunc(node)
	if err != nil {
		t.Fatalf("Couldn't retrieve key for node %v", node.Name)
	}

	// The test does the following for each nodeStateManager in this list:
	//	1. Create a new node
	//	2. Apply the makeUnSchedulable function
	//	3. Create a new pod
	//  4. Check that the pod doesn't get assigned to the node
	//  5. Apply the schedulable function
	//  6. Check that the pod *does* get assigned to the node
	//  7. Delete the pod and node.

	nodeModifications := []nodeStateManager{
		// Test node.Spec.Unschedulable=true/false
		{
			makeUnSchedulable: func(t *testing.T, n *v1.Node, nodeLister corelisters.NodeLister, c clientset.Interface) {
				n.Spec.Unschedulable = true
				if _, err := c.CoreV1().Nodes().Update(context.TODO(), n, metav1.UpdateOptions{}); err != nil {
					t.Fatalf("Failed to update node with unschedulable=true: %v", err)
				}
				err = waitForReflection(t, nodeLister, nodeKey, func(node interface{}) bool {
					// An unschedulable node should still be present in the store
					// Nodes that are unschedulable or that are not ready or
					// have their disk full (Node.Spec.Conditions) are excluded
					// based on NodeConditionPredicate, a separate check
					return node != nil && node.(*v1.Node).Spec.Unschedulable == true
				})
				if err != nil {
					t.Fatalf("Failed to observe reflected update for setting unschedulable=true: %v", err)
				}
			},
			makeSchedulable: func(t *testing.T, n *v1.Node, nodeLister corelisters.NodeLister, c clientset.Interface) {
				n.Spec.Unschedulable = false
				if _, err := c.CoreV1().Nodes().Update(context.TODO(), n, metav1.UpdateOptions{}); err != nil {
					t.Fatalf("Failed to update node with unschedulable=false: %v", err)
				}
				err = waitForReflection(t, nodeLister, nodeKey, func(node interface{}) bool {
					return node != nil && node.(*v1.Node).Spec.Unschedulable == false
				})
				if err != nil {
					t.Fatalf("Failed to observe reflected update for setting unschedulable=false: %v", err)
				}
			},
		},
	}

	for i, mod := range nodeModifications {
		unSchedNode, err := testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{})
		if err != nil {
			t.Fatalf("Failed to create node: %v", err)
		}

		// Apply the unschedulable modification to the node, and wait for the reflection
		mod.makeUnSchedulable(t, unSchedNode, nodeLister, testCtx.ClientSet)

		// Create the new pod, note that this needs to happen post unschedulable
		// modification or we have a race in the test.
		myPod, err := createPausePodWithResource(testCtx.ClientSet, "node-scheduling-test-pod", testCtx.NS.Name, nil)
		if err != nil {
			t.Fatalf("Failed to create pod: %v", err)
		}

		// There are no schedulable nodes - the pod shouldn't be scheduled.
		err = testutils.WaitForPodToScheduleWithTimeout(testCtx.ClientSet, myPod, 2*time.Second)
		if err == nil {
			t.Errorf("Test %d: Pod scheduled successfully on unschedulable nodes", i)
		}
		if err != wait.ErrWaitTimeout {
			t.Errorf("Test %d: failed while trying to confirm the pod does not get scheduled on the node: %v", i, err)
		} else {
			t.Logf("Test %d: Pod did not get scheduled on an unschedulable node", i)
		}

		// Apply the schedulable modification to the node, and wait for the reflection
		schedNode, err := testCtx.ClientSet.CoreV1().Nodes().Get(context.TODO(), unSchedNode.Name, metav1.GetOptions{})
		if err != nil {
			t.Fatalf("Failed to get node: %v", err)
		}
		mod.makeSchedulable(t, schedNode, nodeLister, testCtx.ClientSet)

		// Wait until the pod is scheduled.
		if err := testutils.WaitForPodToSchedule(testCtx.ClientSet, myPod); err != nil {
			t.Errorf("Test %d: failed to schedule a pod: %v", i, err)
		} else {
			t.Logf("Test %d: Pod got scheduled on a schedulable node", i)
		}
		// Clean up.
		if err := deletePod(testCtx.ClientSet, myPod.Name, myPod.Namespace); err != nil {
			t.Errorf("Failed to delete pod: %v", err)
		}
		err = testCtx.ClientSet.CoreV1().Nodes().Delete(context.TODO(), schedNode.Name, metav1.DeleteOptions{})
		if err != nil {
			t.Errorf("Failed to delete node: %v", err)
		}
	}
}

func TestMultipleSchedulers(t *testing.T) {
	// This integration tests the multi-scheduler feature in the following way:
	// 1. create a default scheduler
	// 2. create a node
	// 3. create 3 pods: testPodNoAnnotation, testPodWithAnnotationFitsDefault and testPodWithAnnotationFitsFoo
	//	  - note: the first two should be picked and scheduled by default scheduler while the last one should be
	//	          picked by scheduler of name "foo-scheduler" which does not exist yet.
	// 4. **check point-1**:
	//	   - testPodNoAnnotation, testPodWithAnnotationFitsDefault should be scheduled
	//	   - testPodWithAnnotationFitsFoo should NOT be scheduled
	// 5. create a scheduler with name "foo-scheduler"
	// 6. **check point-2**:
	//     - testPodWithAnnotationFitsFoo should be scheduled
	// 7. stop default scheduler
	// 8. create 2 pods: testPodNoAnnotation2 and testPodWithAnnotationFitsDefault2
	//    - note: these two pods belong to default scheduler which no longer exists
	// 9. **check point-3**:
	//     - testPodNoAnnotation2 and testPodWithAnnotationFitsDefault2 should NOT be scheduled

	// 1. create and start default-scheduler
	testCtx := initTest(t, "multi-scheduler")
	defer testutils.CleanupTest(t, testCtx)

	// 2. create a node
	node := &v1.Node{
		ObjectMeta: metav1.ObjectMeta{Name: "node-multi-scheduler-test-node"},
		Spec:       v1.NodeSpec{Unschedulable: false},
		Status: v1.NodeStatus{
			Capacity: v1.ResourceList{
				v1.ResourcePods: *resource.NewQuantity(32, resource.DecimalSI),
			},
		},
	}
	testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{})

	// 3. create 3 pods for testing
	t.Logf("create 3 pods for testing")
	testPod, err := createPausePodWithResource(testCtx.ClientSet, "pod-without-scheduler-name", testCtx.NS.Name, nil)
	if err != nil {
		t.Fatalf("Failed to create pod: %v", err)
	}

	defaultScheduler := "default-scheduler"
	testPodFitsDefault, err := createPausePod(testCtx.ClientSet, initPausePod(&pausePodConfig{Name: "pod-fits-default", Namespace: testCtx.NS.Name, SchedulerName: defaultScheduler}))
	if err != nil {
		t.Fatalf("Failed to create pod: %v", err)
	}

	fooScheduler := "foo-scheduler"
	testPodFitsFoo, err := createPausePod(testCtx.ClientSet, initPausePod(&pausePodConfig{Name: "pod-fits-foo", Namespace: testCtx.NS.Name, SchedulerName: fooScheduler}))
	if err != nil {
		t.Fatalf("Failed to create pod: %v", err)
	}

	// 4. **check point-1**:
	//		- testPod, testPodFitsDefault should be scheduled
	//		- testPodFitsFoo should NOT be scheduled
	t.Logf("wait for pods scheduled")
	if err := testutils.WaitForPodToSchedule(testCtx.ClientSet, testPod); err != nil {
		t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPod.Name, err)
	} else {
		t.Logf("Test MultiScheduler: %s Pod scheduled", testPod.Name)
	}

	if err := testutils.WaitForPodToSchedule(testCtx.ClientSet, testPodFitsDefault); err != nil {
		t.Errorf("Test MultiScheduler: %s Pod not scheduled: %v", testPodFitsDefault.Name, err)
	} else {
		t.Logf("Test MultiScheduler: %s Pod scheduled", testPodFitsDefault.Name)
	}

	if err := testutils.WaitForPodToScheduleWithTimeout(testCtx.ClientSet, testPodFitsFoo, time.Second*5); err == nil {
		t.Errorf("Test MultiScheduler: %s Pod got scheduled, %v", testPodFitsFoo.Name, err)
	} else {
		t.Logf("Test MultiScheduler: %s Pod not scheduled", testPodFitsFoo.Name)
	}

	// 5. create and start a scheduler with name "foo-scheduler"
	fooProf := kubeschedulerconfig.KubeSchedulerProfile{SchedulerName: fooScheduler}
	testCtx = testutils.InitTestSchedulerWithOptions(t, testCtx, true, nil, time.Second, scheduler.WithProfiles(fooProf))
	testutils.SyncInformerFactory(testCtx)
	go testCtx.Scheduler.Run(testCtx.Ctx)

	//	6. **check point-2**:
	//		- testPodWithAnnotationFitsFoo should be scheduled
	err = testutils.WaitForPodToSchedule(testCtx.ClientSet, testPodFitsFoo)
	if err != nil {
		t.Errorf("Test MultiScheduler: %s Pod not scheduled, %v", testPodFitsFoo.Name, err)
	} else {
		t.Logf("Test MultiScheduler: %s Pod scheduled", testPodFitsFoo.Name)
	}

	//	7. delete the pods that were scheduled by the default scheduler, and stop the default scheduler
	if err := deletePod(testCtx.ClientSet, testPod.Name, testCtx.NS.Name); err != nil {
		t.Errorf("Failed to delete pod: %v", err)
	}
	if err := deletePod(testCtx.ClientSet, testPodFitsDefault.Name, testCtx.NS.Name); err != nil {
		t.Errorf("Failed to delete pod: %v", err)
	}

	// The rest of this test assumes that closing StopEverything will cause the
	// scheduler thread to stop immediately.  It won't, and in fact it will often
	// schedule 1 more pod before finally exiting.  Comment out until we fix that.
	//
	// See https://github.com/kubernetes/kubernetes/issues/23715 for more details.

	/*
		close(schedulerConfig.StopEverything)

		//	8. create 2 pods: testPodNoAnnotation2 and testPodWithAnnotationFitsDefault2
		//		- note: these two pods belong to default scheduler which no longer exists
		podWithNoAnnotation2 := createPod("pod-with-no-annotation2", nil)
		podWithAnnotationFitsDefault2 := createPod("pod-with-annotation-fits-default2", schedulerAnnotationFitsDefault)
		testPodNoAnnotation2, err := clientSet.CoreV1().Pods(ns.Name).Create(podWithNoAnnotation2)
		if err != nil {
			t.Fatalf("Failed to create pod: %v", err)
		}
		testPodWithAnnotationFitsDefault2, err := clientSet.CoreV1().Pods(ns.Name).Create(podWithAnnotationFitsDefault2)
		if err != nil {
			t.Fatalf("Failed to create pod: %v", err)
		}

		//	9. **check point-3**:
		//		- testPodNoAnnotation2 and testPodWithAnnotationFitsDefault2 should NOT be scheduled
		err = wait.Poll(time.Second, time.Second*5, testutils.PodScheduled(clientSet, testPodNoAnnotation2.Namespace, testPodNoAnnotation2.Name))
		if err == nil {
			t.Errorf("Test MultiScheduler: %s Pod got scheduled, %v", testPodNoAnnotation2.Name, err)
		} else {
			t.Logf("Test MultiScheduler: %s Pod not scheduled", testPodNoAnnotation2.Name)
		}
		err = wait.Poll(time.Second, time.Second*5, testutils.PodScheduled(clientSet, testPodWithAnnotationFitsDefault2.Namespace, testPodWithAnnotationFitsDefault2.Name))
		if err == nil {
			t.Errorf("Test MultiScheduler: %s Pod got scheduled, %v", testPodWithAnnotationFitsDefault2.Name, err)
		} else {
			t.Logf("Test MultiScheduler: %s Pod scheduled", testPodWithAnnotationFitsDefault2.Name)
		}
	*/
}

func TestMultipleSchedulingProfiles(t *testing.T) {
	testCtx := initTest(t, "multi-scheduler", scheduler.WithProfiles(
		kubeschedulerconfig.KubeSchedulerProfile{
			SchedulerName: "default-scheduler",
		},
		kubeschedulerconfig.KubeSchedulerProfile{
			SchedulerName: "custom-scheduler",
		},
	))
	defer testutils.CleanupTest(t, testCtx)

	node := &v1.Node{
		ObjectMeta: metav1.ObjectMeta{Name: "node-multi-scheduler-test-node"},
		Spec:       v1.NodeSpec{Unschedulable: false},
		Status: v1.NodeStatus{
			Capacity: v1.ResourceList{
				v1.ResourcePods: *resource.NewQuantity(32, resource.DecimalSI),
			},
		},
	}
	if _, err := testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}); err != nil {
		t.Fatal(err)
	}

	evs, err := testCtx.ClientSet.CoreV1().Events(testCtx.NS.Name).Watch(testCtx.Ctx, metav1.ListOptions{})
	if err != nil {
		t.Fatal(err)
	}
	defer evs.Stop()

	for _, pc := range []*pausePodConfig{
		{Name: "foo", Namespace: testCtx.NS.Name},
		{Name: "bar", Namespace: testCtx.NS.Name, SchedulerName: "unknown-scheduler"},
		{Name: "baz", Namespace: testCtx.NS.Name, SchedulerName: "default-scheduler"},
		{Name: "zet", Namespace: testCtx.NS.Name, SchedulerName: "custom-scheduler"},
	} {
		if _, err := createPausePod(testCtx.ClientSet, initPausePod(pc)); err != nil {
			t.Fatal(err)
		}
	}

	wantProfiles := map[string]string{
		"foo": "default-scheduler",
		"baz": "default-scheduler",
		"zet": "custom-scheduler",
	}

	gotProfiles := make(map[string]string)
	if err := wait.Poll(100*time.Millisecond, 30*time.Second, func() (bool, error) {
		var ev watch.Event
		select {
		case ev = <-evs.ResultChan():
		case <-time.After(30 * time.Second):
			return false, nil
		}
		e, ok := ev.Object.(*v1.Event)
		if !ok || e.Reason != "Scheduled" {
			return false, nil
		}
		gotProfiles[e.InvolvedObject.Name] = e.ReportingController
		return len(gotProfiles) >= len(wantProfiles), nil
	}); err != nil {
		t.Errorf("waiting for scheduling events: %v", err)
	}

	if diff := cmp.Diff(wantProfiles, gotProfiles); diff != "" {
		t.Errorf("pods scheduled by the wrong profile (-want, +got):\n%s", diff)
	}
}

// This test will verify scheduler can work well regardless of whether kubelet is allocatable aware or not.
func TestAllocatable(t *testing.T) {
	testCtx := initTest(t, "allocatable")
	defer testutils.CleanupTest(t, testCtx)

	// 2. create a node without allocatable awareness
	nodeRes := &v1.ResourceList{
		v1.ResourcePods:   *resource.NewQuantity(32, resource.DecimalSI),
		v1.ResourceCPU:    *resource.NewMilliQuantity(30, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(30, resource.BinarySI),
	}
	allocNode, err := createNode(testCtx.ClientSet, "node-allocatable-scheduler-test-node", nodeRes)
	if err != nil {
		t.Fatalf("Failed to create node: %v", err)
	}

	// 3. create resource pod which requires less than Capacity
	podName := "pod-test-allocatable"
	podRes := &v1.ResourceList{
		v1.ResourceCPU:    *resource.NewMilliQuantity(20, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(20, resource.BinarySI),
	}
	testAllocPod, err := createPausePodWithResource(testCtx.ClientSet, podName, testCtx.NS.Name, podRes)
	if err != nil {
		t.Fatalf("Test allocatable unawareness failed to create pod: %v", err)
	}

	// 4. Test: this test pod should be scheduled since api-server will use Capacity as Allocatable
	err = testutils.WaitForPodToScheduleWithTimeout(testCtx.ClientSet, testAllocPod, time.Second*5)
	if err != nil {
		t.Errorf("Test allocatable unawareness: %s Pod not scheduled: %v", testAllocPod.Name, err)
	} else {
		t.Logf("Test allocatable unawareness: %s Pod scheduled", testAllocPod.Name)
	}

	// 5. Change the node status to allocatable aware, note that Allocatable is less than Pod's requirement
	allocNode.Status = v1.NodeStatus{
		Capacity: v1.ResourceList{
			v1.ResourcePods:   *resource.NewQuantity(32, resource.DecimalSI),
			v1.ResourceCPU:    *resource.NewMilliQuantity(30, resource.DecimalSI),
			v1.ResourceMemory: *resource.NewQuantity(30, resource.BinarySI),
		},
		Allocatable: v1.ResourceList{
			v1.ResourcePods:   *resource.NewQuantity(32, resource.DecimalSI),
			v1.ResourceCPU:    *resource.NewMilliQuantity(10, resource.DecimalSI),
			v1.ResourceMemory: *resource.NewQuantity(10, resource.BinarySI),
		},
	}

	if _, err := testCtx.ClientSet.CoreV1().Nodes().UpdateStatus(context.TODO(), allocNode, metav1.UpdateOptions{}); err != nil {
		t.Fatalf("Failed to update node with Status.Allocatable: %v", err)
	}

	if err := deletePod(testCtx.ClientSet, testAllocPod.Name, testCtx.NS.Name); err != nil {
		t.Fatalf("Failed to remove the first pod: %v", err)
	}

	// 6. Make another pod with different name, same resource request
	podName2 := "pod-test-allocatable2"
	testAllocPod2, err := createPausePodWithResource(testCtx.ClientSet, podName2, testCtx.NS.Name, podRes)
	if err != nil {
		t.Fatalf("Test allocatable awareness failed to create pod: %v", err)
	}

	// 7. Test: this test pod should not be scheduled since it request more than Allocatable
	if err := testutils.WaitForPodToScheduleWithTimeout(testCtx.ClientSet, testAllocPod2, time.Second*5); err == nil {
		t.Errorf("Test allocatable awareness: %s Pod got scheduled unexpectedly, %v", testAllocPod2.Name, err)
	} else {
		t.Logf("Test allocatable awareness: %s Pod not scheduled as expected", testAllocPod2.Name)
	}
}

// TestSchedulerInformers tests that scheduler receives informer events and updates its cache when
// pods are scheduled by other schedulers.
func TestSchedulerInformers(t *testing.T) {
	// Initialize scheduler.
	testCtx := initTest(t, "scheduler-informer")
	defer testutils.CleanupTest(t, testCtx)
	cs := testCtx.ClientSet

	defaultPodRes := &v1.ResourceRequirements{Requests: v1.ResourceList{
		v1.ResourceCPU:    *resource.NewMilliQuantity(200, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(200, resource.BinarySI)},
	}
	defaultNodeRes := &v1.ResourceList{
		v1.ResourcePods:   *resource.NewQuantity(32, resource.DecimalSI),
		v1.ResourceCPU:    *resource.NewMilliQuantity(500, resource.DecimalSI),
		v1.ResourceMemory: *resource.NewQuantity(500, resource.BinarySI),
	}

	type nodeConfig struct {
		name string
		res  *v1.ResourceList
	}

	tests := []struct {
		name                string
		nodes               []*nodeConfig
		existingPods        []*v1.Pod
		pod                 *v1.Pod
		preemptedPodIndexes map[int]struct{}
	}{
		{
			name:  "Pod cannot be scheduled when node is occupied by pods scheduled by other schedulers",
			nodes: []*nodeConfig{{name: "node-1", res: defaultNodeRes}},
			existingPods: []*v1.Pod{
				initPausePod(&pausePodConfig{
					Name:          "pod1",
					Namespace:     testCtx.NS.Name,
					Resources:     defaultPodRes,
					Labels:        map[string]string{"foo": "bar"},
					NodeName:      "node-1",
					SchedulerName: "foo-scheduler",
				}),
				initPausePod(&pausePodConfig{
					Name:          "pod2",
					Namespace:     testCtx.NS.Name,
					Resources:     defaultPodRes,
					Labels:        map[string]string{"foo": "bar"},
					NodeName:      "node-1",
					SchedulerName: "bar-scheduler",
				}),
			},
			pod: initPausePod(&pausePodConfig{
				Name:      "unschedulable-pod",
				Namespace: testCtx.NS.Name,
				Resources: defaultPodRes,
			}),
			preemptedPodIndexes: map[int]struct{}{2: {}},
		},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			for _, nodeConf := range test.nodes {
				_, err := createNode(cs, nodeConf.name, nodeConf.res)
				if err != nil {
					t.Fatalf("Error creating node %v: %v", nodeConf.name, err)
				}
			}

			pods := make([]*v1.Pod, len(test.existingPods))
			var err error
			// Create and run existingPods.
			for i, p := range test.existingPods {
				if pods[i], err = runPausePod(cs, p); err != nil {
					t.Fatalf("Error running pause pod: %v", err)
				}
			}
			// Create the new "pod".
			unschedulable, err := createPausePod(cs, test.pod)
			if err != nil {
				t.Errorf("Error while creating new pod: %v", err)
			}
			if err := waitForPodUnschedulable(cs, unschedulable); err != nil {
				t.Errorf("Pod %v got scheduled: %v", unschedulable.Name, err)
			}

			// Cleanup
			pods = append(pods, unschedulable)
			testutils.CleanupPods(cs, t, pods)
			cs.PolicyV1beta1().PodDisruptionBudgets(testCtx.NS.Name).DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{})
			cs.CoreV1().Nodes().DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{})
		})
	}
}


text:
title: Create a Column Gap Using grid-column-gap
localeTitle: Criar uma lacuna de coluna usando a lacuna da coluna de grade
---
## Criar uma lacuna de coluna usando a lacuna da coluna de grade

Este desafio requer que você adicione uma lacuna de 20px entre todas as colunas do CSS Grid no .container.

### Sugestão

Para adicionar a lacuna entre as colunas de uma grade, usamos:

```css
grid-column-gap: parameter;
```

onde parâmetro é o intervalo necessário.

### Solução

Como o desafio tem você adicionando uma lacuna de 20px, você adicionaria a seguinte linha ao codeblock CSS .container.

```css
grid-column-gap: 20px;

```


text:
A clone of, a now defunct insult bot, "Roody" which insults you.

## Installation

Windows:

```
# Installing modules
pip install discord.py
pip install asyncio
pip install bs4

# Running
python roody.py
```

Linux:

```
# Installing modules
pip install discord.py
pip install asyncio
pip install bs4

# Running
/usr/bin/python3.5 roody.py
```


text:
#ifndef INCLUDED_com_haxepunk_graphics_atlas_Atlas
#define INCLUDED_com_haxepunk_graphics_atlas_Atlas

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

HX_DECLARE_CLASS4(com,haxepunk,graphics,atlas,Atlas)
HX_DECLARE_CLASS4(com,haxepunk,graphics,atlas,AtlasData)
HX_DECLARE_CLASS4(com,haxepunk,graphics,atlas,AtlasRegion)
namespace com{
namespace haxepunk{
namespace graphics{
namespace atlas{

class HXCPP_CLASS_ATTRIBUTES  Atlas_obj : public hx::Object{
	public:
		typedef hx::Object super;
		typedef Atlas_obj OBJ_;
		Atlas_obj();
		Void __construct(Dynamic source);

	public:
		static hx::ObjectPtr< Atlas_obj > __new(Dynamic source);
		static Dynamic __CreateEmpty();
		static Dynamic __Create(hx::DynamicArray inArgs);
		~Atlas_obj();

		HX_DO_RTTI;
		static void __boot();
		static void __register();
		void __Mark(HX_MARK_PARAMS);
		void __Visit(HX_VISIT_PARAMS);
		::String __ToString() const { return HX_CSTRING("Atlas"); }

		::com::haxepunk::graphics::atlas::AtlasData _data;
		virtual Void prepareTile( int tile,Float x,Float y,int layer,Float scaleX,Float scaleY,Float angle,Float red,Float green,Float blue,Float alpha);
		Dynamic prepareTile_dyn();

		virtual Void destroy( );
		Dynamic destroy_dyn();

		virtual int get_height( );
		Dynamic get_height_dyn();

		virtual int get_width( );
		Dynamic get_width_dyn();

		static int drawCallThreshold;
		static bool smooth;
		static ::com::haxepunk::graphics::atlas::AtlasRegion loadImageAsRegion( Dynamic source);
		static Dynamic loadImageAsRegion_dyn();

		static bool toggleLayerVisibility( int layer);
		static Dynamic toggleLayerVisibility_dyn();

};

} // end namespace com
} // end namespace haxepunk
} // end namespace graphics
} // end namespace atlas

#endif /* INCLUDED_com_haxepunk_graphics_atlas_Atlas */


text:
package org.apache.hadoop.ozone.lock;
/*
 This package contains the lock related classes.
 */


text:
<?php

namespace NNGenie\InfosMatBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Genre
 *
 * @ORM\Table(name="genre")
 * @ORM\Entity(repositoryClass="NNGenie\InfosMatBundle\Repository\GenreRepository")
 */
class Genre
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="bigint", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="nom", type="string", length=255, nullable=true)
     */
    private $nom;

    /**
     * @var string
     *
     * @ORM\Column(name="code", type="string", length=255, nullable=true)
     */
    private $code;

    /**
     * @var \Famille
     *
     * @ORM\ManyToOne(targetEntity="Famille", inversedBy="genres")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="famille", referencedColumnName="id")
     * })
     */
    private $famille;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Marque", mappedBy="genres")
     */
    private $marques;
/**
     * @var integer
     *
     * @ORM\Column(name="statut", type="integer", nullable=true)
     */
    private $statut;

    /**
    * @ORM\OneToMany(targetEntity="Materiel", mappedBy="genre", cascade={"remove", "persist"})
    */
    private $materiels;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->statut = 1;
        $this->marques = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return Genre
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * Get nom
     *
     * @return string
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set code
     *
     * @param string $code
     * @return Genre
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    /**
     * Get code
     *
     * @return string
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Set famille
     *
     * @param \NNGenie\InfosMatBundle\Entity\Famille $famille
     * @return Genre
     */
    public function setFamille(\NNGenie\InfosMatBundle\Entity\Famille $famille = null)
    {
        $this->famille = $famille;

        return $this;
    }

    /**
     * Get famille
     *
     * @return \NNGenie\InfosMatBundle\Entity\Famille
     */
    public function getFamille()
    {
        return $this->famille;
    }

    /**
     * Add marque
     *
     * @param \NNGenie\InfosMatBundle\Entity\Marque $marque
     * @return Genre
     */
    public function addMarque(\NNGenie\InfosMatBundle\Entity\Marque $marque)
    {
        $this->marques[] = $marque;

        return $this;
    }

    /**
     * Remove marque
     *
     * @param \NNGenie\InfosMatBundle\Entity\Marque $marque
	 * @return Genre
     */
    public function removeMarque(\NNGenie\InfosMatBundle\Entity\Marque $marque)
    {
        $this->marques->removeElement($marque);
		return $this;
    }

    /**
     * Get marques
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMarques()
    {
        return $this->marques;
    }

    /**
     * Set
     *
     * @param \Doctrine\Common\Collections\Collection $marques
     * @return Genre
     */
    public function setMarques(\Doctrine\Common\Collections\Collection $marques = null)
    {
        $this->marques = $marques;

        return $this;
    }

    /**
     * Set statut
     *
     * @param integer $statut
     * @return Genre
     */
    public function setStatut($statut)
    {
        $this->statut = $statut;

        return $this;
    }

    /**
     * Get statut
     *
     * @return integer
     */
    public function getStatut()
    {
        return $this->statut;
    }

    /**
     * Add materiel
     *
     * @param \NNGenie\InfosMatBundle\Entity\Materiel $materiel
     * @return Genre
     */
    public function addMateriel(\NNGenie\InfosMatBundle\Entity\Materiel $materiel)
    {
        $this->materiels[] = $materiel;
        return $this;
    }

    /**
     * Get materiels
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMateriels()
    {
        return $this->materiels;
    }

    /**
     * Set materiels
     *
     * @param \Doctrine\Common\Collections\Collection $materiels
     * @return Genre
     */
    public function setMateriels(\Doctrine\Common\Collections\Collection $materiels = null)
    {
        $this->materiels = $materiels;

        return $this;
    }

    /**
     * Remove materiel
     *
     * @param \NNGenie\InfosMatBundle\Entity\Materiel $materiel
     * @return Genre
     */
    public function removeMateriel(\NNGenie\InfosMatBundle\Entity\Materiel $materiel)
    {
        $this->materiels->removeElement($materiel);
		return $this;
    }
}


text:
Router.route('/media', {name: 'mediaMenu'});

Router.route('/media/items', {name: 'mediaItems'});
Router.route('/media/item/:_id', {
    name: 'mediaSettings',
    data: function () {return media.findOne(this.params._id);}
});

Router.route('/media/playlists', {name: 'mediaPlaylists'});
Router.route('/media/playlist/:_id', {
    name: 'mediaPlaylistSettings',
    data: function () {return mediaplaylists.findOne(this.params._id);}
});

Router.route('/media/static/:filepath*', function () {
    var fs = Npm.require('fs');
    var filepath = settings.findOne({key: 'mediadir'}).value + '/' + this.params.filepath;
    var mimetype = MIME.lookup(filepath);

    try {
        var stats = fs.statSync(filepath);
    }

    catch (e) {
        this.next();
        return;
    }

    if (!stats.isFile()) {
        this.next();
        return;
    }

    var status = 200;
    var headers = {
        'Cache-Control': 'max-age=2592000', // 30 days
        'Content-Length': stats.size,
        'Content-Type': mimetype,
        'Accept-Ranges': 'bytes'
    };

    // Very hacky HTTP Range implementation!

    var start = 0; var end = stats.size;
    var range = this.request.headers['range'];

    if (range && range.startsWith('bytes=')) {
        var range = range.slice(6);
        var dashindex = range.indexOf('-');

        if (dashindex <= 0) {
            var start = 0;
            var end = parseInt(range.split('-')[0]);
        } else if (dashindex == range.length - 1) {
            var start = parseInt(range.split('-')[0]);
            var end = stats.size;
        }

        headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`;
        headers['Content-Length'] = end - start;
        var status = 206;
    }

    this.response.writeHead(status, headers);
    var stream = fs.createReadStream(filepath, {start: start, end: end});
    return stream.pipe(this.response);
}, {where: 'server'});


text:
@interface RXUncaughtExceptionHandlerViewController : UIViewController

@end


text:
configs
=======

Public configurations:

* **ZSH**: The ZSH configuration, based on [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh).
* **VIM**: The VIM configuration, using [Vundle](https://github.com/gmarik/Vundle.vim). You need to manually install Vundle.
* **Sublime Text**: The Sublime Text configuration (excluding the private informations).
* **Darcula Colloquy Style**: The Darcula-based Colloquy style. Darcula is the name of the Jetbrains' dark color scheme.


text:
<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

		<?php echo $form->label($model,'id'); ?>
		<?php echo $form->textField($model,'id',array('size'=>10,'maxlength'=>10)); ?>

		<?php echo $form->label($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>50,'maxlength'=>50)); ?>

		<?php echo $form->label($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>

		<?php echo $form->label($model,'add_time'); ?>
		<?php echo $form->textField($model,'add_time'); ?>

		<?php echo $form->label($model,'update_time'); ?>
		<?php echo $form->textField($model,'update_time'); ?>

		<?php echo $form->label($model,'user_id'); ?>
		<?php echo $form->textField($model,'user_id'); ?>

		<?php echo CHtml::submitButton('Search'); ?>

<?php $this->endWidget(); ?>


text:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;

namespace Amazon.EC2.Model
{
    /// <summary>
    /// Port range.
    /// </summary>
    [XmlRootAttribute(IsNullable = false)]
    public class PortRange
    {
        private Decimal? fromField;
        private Decimal? toField;

        /// <summary>
        /// The first port in the range.
        /// A value of -1 indicates all ports.
        /// </summary>
        [XmlElementAttribute(ElementName = "From")]
        public Decimal From
        {
            get { return this.fromField.GetValueOrDefault(); }
            set { this.fromField = value; }
        }

        /// <summary>
        /// Sets the first port in the range.
        /// A value of -1 indicates all ports.
        /// </summary>
        /// <param name="from">The first port in the range. A value of -1 indicates all ports.</param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public PortRange WithFrom(Decimal from)
        {
            this.fromField = from;
            return this;
        }

        /// <summary>
        /// Checks if From property is set
        /// </summary>
        /// <returns>true if From property is set</returns>
        public bool IsSetFrom()
        {
            return this.fromField.HasValue;
        }

        /// <summary>
        /// The last port in the range.
        /// A value of -1 indicates all ports
        /// </summary>
        [XmlElementAttribute(ElementName = "To")]
        public Decimal To
        {
            get { return this.toField.GetValueOrDefault(); }
            set { this.toField = value; }
        }

        /// <summary>
        /// Sets the last port in the range.
        /// A value of -1 indicates all ports
        /// </summary>
        /// <param name="to">The last port in the range. A value of -1 indicates all ports</param>
        /// <returns>this instance</returns>
        [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")]
        public PortRange WithTo(Decimal to)
        {
            this.toField = to;
            return this;
        }

        /// <summary>
        /// Checks if To property is set
        /// </summary>
        /// <returns>true if To property is set</returns>
        public bool IsSetTo()
        {
            return this.toField.HasValue;
        }

    }
}


text:
module Zwemwater
  module Response
    @@statuses = nil
    def self.statuses; @@statuses; end;
    def self.statuses=(value); @@statuses = value; end;

    @@locations = nil
    def self.locations
      return @@locations unless @@locations.nil?
      @@locations = @@statuses['features'].collect { |f| f['properties']['naam'] }
    end

    def self.for(query)
       @@statuses['features'].select { |f| f['properties']['naam'] == query }.first || {}
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>jbpm</artifactId>
    <groupId>org.jbpm</groupId>
    <version>7.2.0-SNAPSHOT</version>
  </parent>

  <artifactId>jbpm-document</artifactId>

  <name>jBPM :: Document Service</name>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>
    <!-- Test: logging -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>


text:
using Jasper.Persistence.Marten.Publishing;

namespace Internal.Generated.JasperHandlers
{
    // START: IncrementBCHandler1209368409
    public class IncrementBCHandler1209368409 : Jasper.Runtime.Handlers.MessageHandler
    {
        private readonly Jasper.Persistence.Marten.Publishing.OutboxedSessionFactory _outboxedSessionFactory;

        public IncrementBCHandler1209368409(Jasper.Persistence.Marten.Publishing.OutboxedSessionFactory outboxedSessionFactory)
        {
            _outboxedSessionFactory = outboxedSessionFactory;
        }

        public override async System.Threading.Tasks.Task HandleAsync(Jasper.IMessageContext context, System.Threading.CancellationToken cancellation)
        {
            var letterHandler = new Jasper.Persistence.Testing.Marten.LetterHandler();
            var incrementBC = (Jasper.Persistence.Testing.Marten.IncrementBC)context.Envelope.Message;
            await using var documentSession = _outboxedSessionFactory.OpenSession(context);
            var eventStore = documentSession.Events;
            // Loading Marten aggregate
            var eventStream = await eventStore.FetchForWriting<Jasper.Persistence.Testing.Marten.LetterAggregate>(incrementBC.LetterAggregateId, cancellation).ConfigureAwait(false);

            var outgoing1 = letterHandler.Handle(incrementBC, eventStream.Aggregate);
            if (outgoing1 != null)
            {
                // Capturing any possible events returned from the command handlers
                eventStream.AppendMany(outgoing1);

            }

            await documentSession.SaveChangesAsync(cancellation).ConfigureAwait(false);
        }

    }

    // END: IncrementBCHandler1209368409

}


text: from server import app as application


text:
<resources>
    <string name="number_picker_increment_button">Suurendamine</string>
    <string name="number_picker_decrement_button">Vähendamine</string>
    <string name="time_picker_increment_minute_button">Minutite suurendamine</string>
    <string name="time_picker_decrement_minute_button">Minutite vähendamine</string>
    <string name="time_picker_increment_hour_button">Tundide suurendamine</string>
    <string name="time_picker_decrement_hour_button">Tundide vähendamine</string>
    <string name="time_picker_increment_set_pm_button">PM-i seadmine</string>
    <string name="time_picker_decrement_set_am_button">AM-i seadmine</string>
    <string name="date_picker_prev_month_button">Eelmine kuu</string>
    <string name="date_picker_next_month_button">Järgmine kuu</string>
    <string name="hour_picker_description">Ringikujuline tunniliugur</string>
    <string name="minute_picker_description">Ringikujuline minutiliugur</string>
    <string name="select_hours">Tundide valimine</string>
    <string name="select_minutes">Minutite valimine</string>
    <string name="select_day">Kuu ja päeva valimine</string>
    <string name="select_year">Aasta valimine</string>
    <string name="time_picker_hour_label">tund</string>
    <string name="time_picker_minute_label">minut</string>
    <string name="time_picker_header_text">Kellaaja määramine</string>
    <string name="time_picker_input_error">Sisestage sobiv kellaaeg</string>
    <string name="time_picker_prompt_label">Sisestage kellaaeg</string>
    <string name="time_picker_text_input_mode_description">Aktiveerige kellaaja sisestamiseks tekstisisestusrežiim.</string>
    <string name="time_picker_radial_mode_description">Aktiveerige kellaaja sisestamiseks kellarežiim.</string>
</resources>


text:
module Web::Controllers::Users
  class Login
    include Web::Action

    def call(params)
      user = UserRepository.get_name params[:user]['name']
      password = params[:user]['password']

      if user
        if user.login password
          session[:user] = user.name
          session[:token] = user.token

          redirect_to '/topics'
        else
          redirect_to '/'
        end
      end
    end
  end
end


text:
<?php

namespace ZfcRbacTest;

use ZfcRbac\Options\UnauthorizedStrategyOptions;

/**
 * @covers \ZfcRbac\Options\UnauthorizedStrategyOptions
 */
class UnauthorizedStrategyOptionsTest extends \PHPUnit_Framework_TestCase
{
    public function testAssertDefaultValues()
    {
        $unauthorizedStrategyOptions = new UnauthorizedStrategyOptions();

        $this->assertEquals('error/403', $unauthorizedStrategyOptions->getTemplate());
    }

    public function testSettersAndGetters()
    {
        $unauthorizedStrategyOptions = new UnauthorizedStrategyOptions([
            'template' => 'error/unauthorized'
        ]);

        $this->assertEquals('error/unauthorized', $unauthorizedStrategyOptions->getTemplate());
    }
}


text:
{% extends "base.html" %}

{% load account %}
{% load url from future %}

{% block head_title %}Sign In{% endblock %}

{% block content %}

Sign In

{% if socialaccount.providers  %}

{% with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, sign up
for a {{ site_name }} account and sign in below:{% endwith %}

    {% include "socialaccount/snippets/provider_list.html" with process="login" %}

or

{% include "socialaccount/snippets/login_extra.html" %}

{% else %}

If you have not created an account yet, then please
sign up first.

{% endif %}

<form role="form" class="col-lg-3 col-md-4 col-sm-6 col-xs-8" method="POST" action="{% url 'account_login' %}">
  {% csrf_token %}

      Username
      <input type="text" class="form-control" id="id_login" name="login" placeholder="Username" />

      Password
      <input type="password" class="form-control" id="id_password" name="password" placeholder="Password" />

  {% if redirect_field_value %}
  <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
  {% endif %}
  <button class="btn btn-primary" type="submit">Sign In</button>
    Forgot Password?
</form>

{% endblock %}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall.Glue.Events;
using System.Windows.Forms;
using FlatRedBall.Glue.FormHelpers;
using FlatRedBall.Glue.Elements;
using FlatRedBall.Glue.SaveClasses;

namespace FlatRedBall.Glue.SetVariable
{
    class ScreenSaveSetVariableLogic
    {
        internal void ReactToScreenChangedValue(string changedMember, object oldValue)
        {
            ScreenSave screenSave = EditorLogic.CurrentScreenSave;

            #region Name

            if (changedMember == "ClassName")
            {
                ReactToChangedClassName(oldValue, screenSave);
            }

            #endregion

            #region BaseScreen

            else if (changedMember == "BaseScreen")
            {
                if (ProjectManager.VerifyInheritanceGraph(screenSave) == ProjectManager.CheckResult.Failed)
                {
                    screenSave.BaseScreen = (string)oldValue;
                }
                else
                {
                    screenSave.UpdateFromBaseType();
                }
            }

            #endregion

            EventResponseSave eventSave = screenSave.GetEvent(changedMember);

            if (eventSave != null)
            {
                //if (!string.IsNullOrEmpty(eventSave.InstanceMethod) && EditorLogic.CurrentElement != null)
                //{
                //    InsertMethodCallInElementIfNecessary(EditorLogic.CurrentScreenSave, eventSave.InstanceMethod);
                //}
            }
        }

        private static void ReactToChangedClassName(object oldValue, ScreenSave screenSave)
        {

        }

    }
}


text:
<?php namespace Fisharebest\Localization\Territory;

class TerritoryBz extends AbstractTerritory implements TerritoryInterface {
	public function code() {
		return 'BZ';
	}

	public function firstDay() {
		return 0;
	}

	public function measurementSystem() {
		return 'US';
	}

	public function paperSize() {
		return 'US-Letter';
	}
}


text:
# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'

require File.expand_path('../dummy/config/environment.rb',  __FILE__)

require 'rspec/rails'
require 'ffaker'
require 'factory_girl'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }

# Requires factories defined in spree_core
# require 'spree/testing_support/factories'
require 'spree/testing_support/controller_requests'
require 'spree/testing_support/authorization_helpers'
# require 'spree/testing_support/url_helpers'

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods

  # == URL Helpers
  #
  # Allows access to Spree's routes in specs:
  #
  # visit spree.admin_path
  # current_path.should eql(spree.products_path)
  # config.include Spree::Core::UrlHelpers

  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true
end


text:
module OpenSocial #:nodoc:

  # Acts as a wrapper for an OpenSocial person.
  #
  # The Person class takes input JSON as an initialization parameter, and
  # iterates through each of the key/value pairs of that JSON. For each key
  # that is found, an attr_accessor is constructed, allowing direct access
  # to the value. Each value is stored in the attr_accessor, either as a
  # String, Fixnum, Hash, or Array.
  #

  class Person < Base

    # Initializes the Person based on the provided json fragment. If no JSON
    # is provided, an empty object (with no attributes) is created.
    def initialize(json)
      set_values(json)
      if @person
        set_values(@person)
        @person = nil
      end
    end

    def set_values(json)
      if json
        json.each do |key, value|
          proper_key = key.snake_case
          begin
            self.send("#{proper_key}=", value)
          rescue NoMethodError
            add_attr(proper_key)
            self.send("#{proper_key}=", value)
          end
        end
      end
    end

    # Returns the complete name of the Person, to the best ability, given
    # available fields.
    def long_name
      if @name && @name['givenName'] && @name['familyName']
        return @name['givenName'] + ' ' + @name['familyName']
      elsif @nickname
        return @nickname
      elsif @display_name
        return @display_name
      else
        return ''
      end
    end

    # Returns the first name or nickname of the Person, to the best ability,
    # given available fields.
    def short_name
      if @name && @name['givenName']
        return @name['givenName']
      elsif @nickname
        return @nickname
      elsif @display_name
        return @display_name
      else
        return ''
      end
    end
  end

  # Provides the ability to request a single Person.
  #
  # The FetchPeopleRequests wraps a simple request to an OpenSocial
  # endpoint for a single person. As parameters, it accepts a user ID and
  # selector and optionally an ID of a particular person, in order to display
  # the user ID's view of that person. This request may be used, standalone,
  # by calling send, or bundled into an RpcRequest.
  #

  class FetchPersonRequest < Request
    # Defines the service fragment for use in constructing the request URL or
    # JSON
    @@SERVICE = 'people'

    # Initializes a request to the specified user, or the default (@me, @self).
    # A valid Connection is not necessary if the request is to be used as part
    # of an RpcRequest.
    def initialize(connection = nil, guid = '@me', selector = '@self')
      super
    end

    # Sends the request, passing in the appropriate SERVICE and specified
    # instance variables.
    def send
      json = send_request(@@SERVICE, @guid, @selector)

      personjson = json['entry']

      if (nil == personjson)
        personjson = json['person']
      end

      return parse_response(personjson)
    end

    # Selects the appropriate fragment from the JSON response in order to
    # create a native object.
    def parse_rpc_response(response)
      return parse_response(response['data'])
    end

    # Converts the request into a JSON fragment that can be used as part of a
    # larger RpcRequest.
    def to_json(*a)
      value = {
        'method' => @@SERVICE + @@GET,
        'params' => {
          'userId' => ["#{@guid}"],
          'groupId' => "#{@selector}"
        },
        'id' => @key
      }.to_json(*a)
    end

    private

    # Converts the JSON response into a person.
    def parse_response(response)
      return Person.new(response)
    end
  end

  # Provides the ability to request a Collection of people by describing their
  # relationship to a single person.
  #
  #  The FetchPeopleRequests wraps a simple request to an OpenSocial
  #  endpoint for a Collection of people. As parameters, it accepts
  #  a user ID and selector. This request may be used, standalone, by calling
  #  send, or bundled into an RpcRequest.
  #

  class FetchPeopleRequest < Request
    # Defines the service fragment for use in constructing the request URL or
    # JSON
    @@SERVICE = 'people'

    # Initializes a request to the specified user's group, or the default (@me,
    # @friends). A valid Connection is not necessary if the request is to be
    # used as part of an RpcRequest.
    def initialize(connection = nil, guid = '@me', selector = '@friends')
      super
    end

    # Sends the request, passing in the appropriate SERVICE and specified
    # instance variables.
    def send
      json = send_request(@@SERVICE, @guid, @selector)

      return parse_response(Person, json['entry'])
    end

    # Selects the appropriate fragment from the JSON response in order to
    # create a native object.
    def parse_rpc_response(response)
      return parse_response(Person, response['data']['list'])
    end

    # Converts the request into a JSON fragment that can be used as part of a
    # larger RPC request.
    def to_json(*a)
      value = {
        'method' => @@SERVICE + @@GET,
        'params' => {
          'userId' => ["#{@guid}"],
          'groupId' => "#{@selector}"
        },
        'id' => @key
      }.to_json(*a)
    end

  end

  # Provides the ability to update the  person data for a given
  # user or set of users
  #
  # Wraps a simple Post, Put or Delete request. The parameters are the same as
  # in the Fetch case, + the post_data parameter, which contains the actual
  # data to be updated.
  #
  class UpdatePersonRequest < Request

    # Defines the service fragment for use in constructing the request URL or
    # JSON
    @@SERVICE = 'people'

    # This is only necessary because of a spec inconsistency
    @@RPC_SERVICE = 'people'

	# Initializes a request to update persons data for the specified user.
    #  or the default (@me, @self). A valid Connection is not necessary
    # if the request is to be used as part of an RpcRequest.
    def initialize(connection = nil, guid = '@me', selector = '@self',
                   pid = nil)
      super(connection, guid, selector, pid)
    end

	# Sends the request, passing in the appropriate SERVICE and specified
    # instance variables.
    def send(post_data)
      json = send_request(@@SERVICE, @guid, @selector, @pid, post_data)

      return json['statusLink']
    end

  end

end


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$(".match-row").click(function() {
        window.document.location = $(this).data("href");
    });


text:
package com.ghx.app.lulu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by guo_hx on 2016/9/22.15:56
 */

public class MainViewPagerAdapter extends FragmentStatePagerAdapter {

    private List<Fragment> mList;

    public MainViewPagerAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        mList = list;
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    @Override
    public int getCount() {
        return mList.size();
    }
}


text:
* Added variable to control whether role should assemble a configuration file or not

## 0.1.0 - January 2015

* Initial version


text:
import currentPathReducer from '../currentPathReducer';
import initialState from '../../state';

import { setCurrentPath } from '../../actions/currentPathActions';

describe('currentPathReducer reducer', () => {
  it('Set the current path on the given state', () => {
    let state = {...initialState} // lets do not mutate initialState;
    let action = setCurrentPath('/news');

    expect(state.currentPath).toEqual('/');

    state.currentPath = currentPathReducer(state.currentPath, action);

    expect(state.currentPath).toEqual('/news');
  });
});


text:
package com.xantoria.flippy.db

import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.collection.mutable.{Map => MMap}

import com.xantoria.flippy.condition.Condition

class InMemoryBackend(implicit val ec: ExecutionContext) extends Backend {
  private val switches = MMap[String, Condition]()

  def deleteSwitch(name: String): Future[Unit] = Future {
    switches.remove(name)
    ()
  }

  def configureSwitch(name: String, condition: Condition): Future[Unit] = {
    Future {
      switches.put(name, condition)
      ()
    }
  }
  def switchConfig(name: String): Future[Option[Condition]] = Future(switches.get(name))

  def listSwitches(
    offset: Option[Int], limit: Option[Int]
  ): Future[List[(String, Condition)]] = Future {
    val from = offset getOrElse 0
    val to = limit map { _ + from } getOrElse switches.size
    switches.toList.slice(from, to)
  }
}


text:
#ifndef AbstractDatabaseServer_h
#define AbstractDatabaseServer_h

#if ENABLE(SQL_DATABASE)

#include "DatabaseBasicTypes.h"
#include "DatabaseDetails.h"
#include "DatabaseError.h"
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>

namespace WebCore {

class DatabaseBackendBase;
class DatabaseBackendContext;
class DatabaseManagerClient;
class SecurityOrigin;

class AbstractDatabaseServer {
public:
    virtual void initialize(const String& databasePath) = 0;

    virtual void setClient(DatabaseManagerClient*) = 0;
    virtual String databaseDirectoryPath() const = 0;
    virtual void setDatabaseDirectoryPath(const String&) = 0;

    virtual String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true) = 0;

    enum OpenAttempt {
        FirstTryToOpenDatabase,
        RetryOpenDatabase
    };

    virtual PassRefPtr<DatabaseBackendBase> openDatabase(RefPtr<DatabaseBackendContext>&, DatabaseType,
        const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize,
        bool setVersionInNewDatabase, DatabaseError&, String& errorMessage, OpenAttempt = FirstTryToOpenDatabase) = 0;

    virtual bool hasEntryForOrigin(SecurityOrigin*) = 0;
    virtual void origins(Vector<RefPtr<SecurityOrigin>>& result) = 0;
    virtual bool databaseNamesForOrigin(SecurityOrigin*, Vector<String>& result) = 0;
    virtual DatabaseDetails detailsForNameAndOrigin(const String&, SecurityOrigin*) = 0;

    virtual unsigned long long usageForOrigin(SecurityOrigin*) = 0;
    virtual unsigned long long quotaForOrigin(SecurityOrigin*) = 0;

    virtual void setQuota(SecurityOrigin*, unsigned long long) = 0;

    virtual void deleteAllDatabases() = 0;
    virtual bool deleteOrigin(SecurityOrigin*) = 0;
    virtual bool deleteDatabase(SecurityOrigin*, const String& name) = 0;

    virtual void interruptAllDatabasesForContext(const DatabaseBackendContext*) = 0;

protected:
    AbstractDatabaseServer() { }
    virtual ~AbstractDatabaseServer() { }
};

} // namespace WebCore

#endif // ENABLE(SQL_DATABASE)

#endif // AbstractDatabaseServer_h


text:
 * support global spinner-size, spinner-color config

## 0.3.2
 * use window.angular in CommonJS (@radotzki)
 * fix memory leak (@mihaipanait)

## 0.3.1
 * remove requirejs from bower.json

## 0.3.0
 * upgrade ladda latest version (0.9.8)
 * AMD(requirejs) / CommonJS(webpack) support
 * support npm

## 0.2.2
 * Requirejs / AMD support

## 0.2.1
 * add "main" field to package.json

## 0.2.0
 * change compile logic
 * fix double curly binding broken issue (#12)
 * source refactoring

## 0.1.15
 * fix ngIf issue (fix #14)

## 0.1.14
 * rollback 0.1.13 (#15)

## 0.1.13
 * fix double curly binding broken issue (#12)

## 0.1.12
 * fix data-ladda attribute style (#13)
 * add test case

## 0.1.11
 * add laddaProvider for default option (#11)

## 0.1.10
 * fix duplicate compile issue (#8)
 * fix ie11 "Invalid argument" issue (#9)

## 0.1.9
 * fix recompiling issue

## 0.1.8
 * fix ng-disabled not working issue

## 0.1.7

 * fix calculating object size timing issue (http://stackoverflow.com/questions/24127502/ladda-ui-is-not-working-in-bootstrap-modal)
 * change angularjs dependency version (>= 1.2.0)


text:
var pkgcloud = require('pkgcloud'),
  fs = require('fs'),
  logging = require('../../common/logging'),
  config = require('../../common/config'),
  _ = require('underscore');

var log = logging.getLogger(process.env.PKGCLOUD_LOG_LEVEL || 'debug');

var provider = process.argv[2];

var client = pkgcloud.storage.createClient(config.getConfig(provider, 2));

client.on('log::*', logging.logFunction);

client.getContainer(process.argv[3], function (err, container) {
  if (err) {
    log.error(err);
    return;
  }

  container.headers['x-container-read'] = process.argv[4];
  client.updateContainerHeaders(container, function (err, container) {
    if (err) {
      log.error(err);
      return;
    }

    log.info(container.toJSON());
  });
});


text:
package layers

import (
	"encoding/binary"
	"fmt"
	"github.com/google/gopacket"
	"net"
)

const (
	IPv6HopByHopOptionJumbogram = 0xC2 // RFC 2675
)

const (
	ipv6MaxPayloadLength = 65535
)

// IPv6 is the layer for the IPv6 header.
type IPv6 struct {
	// http://www.networksorcery.com/enp/protocol/ipv6.htm
	BaseLayer
	Version      uint8
	TrafficClass uint8
	FlowLabel    uint32
	Length       uint16
	NextHeader   IPProtocol
	HopLimit     uint8
	SrcIP        net.IP
	DstIP        net.IP
	HopByHop     *IPv6HopByHop
	// hbh will be pointed to by HopByHop if that layer exists.
	hbh IPv6HopByHop
}

// LayerType returns LayerTypeIPv6
func (i *IPv6) LayerType() gopacket.LayerType { return LayerTypeIPv6 }

func (i *IPv6) NetworkFlow() gopacket.Flow {
	return gopacket.NewFlow(EndpointIPv6, i.SrcIP, i.DstIP)
}

// Search for Jumbo Payload TLV in IPv6HopByHop and return (length, true) if found
func getIPv6HopByHopJumboLength(hopopts *IPv6HopByHop) (uint32, bool, error) {
	var tlv *IPv6HopByHopOption

	for _, t := range hopopts.Options {
		if t.OptionType == IPv6HopByHopOptionJumbogram {
			tlv = t
			break
		}
	}
	if tlv == nil {
		// Not found
		return 0, false, nil
	}
	if len(tlv.OptionData) != 4 {
		return 0, false, fmt.Errorf("Jumbo length TLV data must have length 4")
	}
	l := binary.BigEndian.Uint32(tlv.OptionData)
	if l <= ipv6MaxPayloadLength {
		return 0, false, fmt.Errorf("Jumbo length cannot be less than %d", ipv6MaxPayloadLength+1)
	}
	// Found
	return l, true, nil
}

// Adds zero-valued Jumbo TLV to IPv6 header if it does not exist
// (if necessary add hop-by-hop header)
func addIPv6JumboOption(ip6 *IPv6) {
	var tlv *IPv6HopByHopOption

	if ip6.HopByHop == nil {
		// Add IPv6 HopByHop
		ip6.HopByHop = &IPv6HopByHop{}
		ip6.HopByHop.NextHeader = ip6.NextHeader
		ip6.HopByHop.HeaderLength = 0
		ip6.NextHeader = IPProtocolIPv6HopByHop
	}
	for _, t := range ip6.HopByHop.Options {
		if t.OptionType == IPv6HopByHopOptionJumbogram {
			tlv = t
			break
		}
	}
	if tlv == nil {
		// Add Jumbo TLV
		tlv = &IPv6HopByHopOption{}
		ip6.HopByHop.Options = append(ip6.HopByHop.Options, tlv)
	}
	tlv.SetJumboLength(0)
}

// Set jumbo length in serialized IPv6 payload (starting with HopByHop header)
func setIPv6PayloadJumboLength(hbh []byte) error {
	pLen := len(hbh)
	if pLen < 8 {
		//HopByHop is minimum 8 bytes
		return fmt.Errorf("Invalid IPv6 payload (length %d)", pLen)
	}
	hbhLen := int((hbh[1] + 1) * 8)
	if hbhLen > pLen {
		return fmt.Errorf("Invalid hop-by-hop length (length: %d, payload: %d", hbhLen, pLen)
	}
	offset := 2 //start with options
	for offset < hbhLen {
		opt := hbh[offset]
		if opt == 0 {
			//Pad1
			offset += 1
			continue
		}
		optLen := int(hbh[offset+1])
		if opt == IPv6HopByHopOptionJumbogram {
			if optLen == 4 {
				binary.BigEndian.PutUint32(hbh[offset+2:], uint32(pLen))
				return nil
			}
			return fmt.Errorf("Jumbo TLV too short (%d bytes)", optLen)
		}
		offset += 2 + optLen
	}
	return fmt.Errorf("Jumbo TLV not found")
}

// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
	var jumbo bool
	var err error

	payload := b.Bytes()
	pLen := len(payload)
	if pLen > ipv6MaxPayloadLength {
		jumbo = true
		if opts.FixLengths {
			// We need to set the length later because the hop-by-hop header may
			// not exist or else need padding, so pLen may yet change
			addIPv6JumboOption(ip6)
		} else if ip6.HopByHop == nil {
			return fmt.Errorf("Cannot fit payload length of %d into IPv6 packet", pLen)
		} else {
			_, ok, err := getIPv6HopByHopJumboLength(ip6.HopByHop)
			if err != nil {
				return err
			}
			if !ok {
				return fmt.Errorf("Missing jumbo length hop-by-hop option")
			}
		}
	}
	if ip6.HopByHop != nil {
		if ip6.NextHeader != IPProtocolIPv6HopByHop {
			// Just fix it instead of throwing an error
			ip6.NextHeader = IPProtocolIPv6HopByHop
		}
		err = ip6.HopByHop.SerializeTo(b, opts)
		if err != nil {
			return err
		}
		payload = b.Bytes()
		pLen = len(payload)
		if opts.FixLengths && jumbo {
			err := setIPv6PayloadJumboLength(payload)
			if err != nil {
				return err
			}
		}
	}
	if !jumbo && pLen > ipv6MaxPayloadLength {
		return fmt.Errorf("Cannot fit payload into IPv6 header")
	}
	bytes, err := b.PrependBytes(40)
	if err != nil {
		return err
	}
	bytes[0] = (ip6.Version << 4) | (ip6.TrafficClass >> 4)
	bytes[1] = (ip6.TrafficClass << 4) | uint8(ip6.FlowLabel>>16)
	binary.BigEndian.PutUint16(bytes[2:], uint16(ip6.FlowLabel))
	if opts.FixLengths {
		if jumbo {
			ip6.Length = 0
		} else {
			ip6.Length = uint16(pLen)
		}
	}
	binary.BigEndian.PutUint16(bytes[4:], ip6.Length)
	bytes[6] = byte(ip6.NextHeader)
	bytes[7] = byte(ip6.HopLimit)
	if err := ip6.AddressTo16(); err != nil {
		return err
	}
	copy(bytes[8:], ip6.SrcIP)
	copy(bytes[24:], ip6.DstIP)
	return nil
}

func (ip6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	ip6.Version = uint8(data[0]) >> 4
	ip6.TrafficClass = uint8((binary.BigEndian.Uint16(data[0:2]) >> 4) & 0x00FF)
	ip6.FlowLabel = binary.BigEndian.Uint32(data[0:4]) & 0x000FFFFF
	ip6.Length = binary.BigEndian.Uint16(data[4:6])
	ip6.NextHeader = IPProtocol(data[6])
	ip6.HopLimit = data[7]
	ip6.SrcIP = data[8:24]
	ip6.DstIP = data[24:40]
	ip6.HopByHop = nil
	ip6.BaseLayer = BaseLayer{data[:40], data[40:]}

	// We treat a HopByHop IPv6 option as part of the IPv6 packet, since its
	// options are crucial for understanding what's actually happening per packet.
	if ip6.NextHeader == IPProtocolIPv6HopByHop {
		err := ip6.hbh.DecodeFromBytes(ip6.Payload, df)
		if err != nil {
			return err
		}
		ip6.HopByHop = &ip6.hbh
		pEnd, jumbo, err := getIPv6HopByHopJumboLength(ip6.HopByHop)
		if err != nil {
			return err
		}
		if jumbo && ip6.Length == 0 {
			pEnd := int(pEnd)
			if pEnd > len(ip6.Payload) {
				df.SetTruncated()
				pEnd = len(ip6.Payload)
			}
			ip6.Payload = ip6.Payload[:pEnd]
			return nil
		} else if jumbo && ip6.Length != 0 {
			return fmt.Errorf("IPv6 has jumbo length and IPv6 length is not 0")
		} else if !jumbo && ip6.Length == 0 {
			return fmt.Errorf("IPv6 length 0, but HopByHop header does not have jumbogram option")
		}
	}

	if ip6.Length == 0 {
		return fmt.Errorf("IPv6 length 0, but next header is %v, not HopByHop", ip6.NextHeader)
	} else {
		pEnd := int(ip6.Length)
		if pEnd > len(ip6.Payload) {
			df.SetTruncated()
			pEnd = len(ip6.Payload)
		}
		ip6.Payload = ip6.Payload[:pEnd]
	}
	return nil
}

func (i *IPv6) CanDecode() gopacket.LayerClass {
	return LayerTypeIPv6
}

func (i *IPv6) NextLayerType() gopacket.LayerType {
	if i.HopByHop != nil {
		return i.HopByHop.NextHeader.LayerType()
	}
	return i.NextHeader.LayerType()
}

func decodeIPv6(data []byte, p gopacket.PacketBuilder) error {
	ip6 := &IPv6{}
	err := ip6.DecodeFromBytes(data, p)
	p.AddLayer(ip6)
	p.SetNetworkLayer(ip6)
	if ip6.HopByHop != nil {
		p.AddLayer(ip6.HopByHop)
	}
	if err != nil {
		return err
	}
	if ip6.HopByHop != nil {
		return p.NextDecoder(ip6.HopByHop.NextHeader)
	}
	return p.NextDecoder(ip6.NextHeader)
}

type ipv6HeaderTLVOption struct {
	OptionType, OptionLength uint8
	ActualLength             int
	OptionData               []byte
	OptionAlignment          [2]uint8 // Xn+Y = [2]uint8{X, Y}
}

func (h *ipv6HeaderTLVOption) serializeTo(data []byte, fixLengths bool, dryrun bool) int {
	if fixLengths {
		h.OptionLength = uint8(len(h.OptionData))
	}
	length := int(h.OptionLength) + 2
	if !dryrun {
		data[0] = h.OptionType
		data[1] = h.OptionLength
		copy(data[2:], h.OptionData)
	}
	return length
}

func decodeIPv6HeaderTLVOption(data []byte) (h *ipv6HeaderTLVOption) {
	h = &ipv6HeaderTLVOption{}
	if data[0] == 0 {
		h.ActualLength = 1
		return
	}
	h.OptionType = data[0]
	h.OptionLength = data[1]
	h.ActualLength = int(h.OptionLength) + 2
	h.OptionData = data[2:h.ActualLength]
	return
}

func serializeTLVOptionPadding(data []byte, padLength int) {
	if padLength <= 0 {
		return
	}
	if padLength == 1 {
		data[0] = 0x0
		return
	}
	tlvLength := uint8(padLength) - 2
	data[0] = 0x1
	data[1] = tlvLength
	if tlvLength != 0 {
		for k := range data[2:] {
			data[k+2] = 0x0
		}
	}
	return
}

// If buf is 'nil' do a serialize dry run
func serializeIPv6HeaderTLVOptions(buf []byte, options []*ipv6HeaderTLVOption, fixLengths bool) int {
	var l int

	dryrun := buf == nil
	length := 2
	for _, opt := range options {
		if fixLengths {
			x := int(opt.OptionAlignment[0])
			y := int(opt.OptionAlignment[1])
			if x != 0 {
				n := length / x
				offset := x*n + y
				if offset < length {
					offset += x
				}
				if length != offset {
					pad := offset - length
					if !dryrun {
						serializeTLVOptionPadding(buf[length-2:], pad)
					}
					length += pad
				}
			}
		}
		if dryrun {
			l = opt.serializeTo(nil, fixLengths, true)
		} else {
			l = opt.serializeTo(buf[length-2:], fixLengths, false)
		}
		length += l
	}
	if fixLengths {
		pad := length % 8
		if pad != 0 {
			if !dryrun {
				serializeTLVOptionPadding(buf[length-2:], pad)
			}
			length += pad
		}
	}
	return length - 2
}

type ipv6ExtensionBase struct {
	BaseLayer
	NextHeader   IPProtocol
	HeaderLength uint8
	ActualLength int
}

func decodeIPv6ExtensionBase(data []byte) (i ipv6ExtensionBase) {
	i.NextHeader = IPProtocol(data[0])
	i.HeaderLength = data[1]
	i.ActualLength = int(i.HeaderLength)*8 + 8
	i.Contents = data[:i.ActualLength]
	i.Payload = data[i.ActualLength:]
	return
}

// IPv6ExtensionSkipper is a DecodingLayer which decodes and ignores v6
// extensions.  You can use it with a DecodingLayerParser to handle IPv6 stacks
// which may or may not have extensions.
type IPv6ExtensionSkipper struct {
	NextHeader IPProtocol
	BaseLayer
}

func (i *IPv6ExtensionSkipper) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	extension := decodeIPv6ExtensionBase(data)
	i.BaseLayer = BaseLayer{data[:extension.ActualLength], data[extension.ActualLength:]}
	i.NextHeader = extension.NextHeader
	return nil
}

func (i *IPv6ExtensionSkipper) CanDecode() gopacket.LayerClass {
	return LayerClassIPv6Extension
}

func (i *IPv6ExtensionSkipper) NextLayerType() gopacket.LayerType {
	return i.NextHeader.LayerType()
}

// IPv6HopByHopOption is a TLV option present in an IPv6 hop-by-hop extension.
type IPv6HopByHopOption ipv6HeaderTLVOption

// IPv6HopByHop is the IPv6 hop-by-hop extension.
type IPv6HopByHop struct {
	ipv6ExtensionBase
	Options []*IPv6HopByHopOption
}

// LayerType returns LayerTypeIPv6HopByHop.
func (i *IPv6HopByHop) LayerType() gopacket.LayerType { return LayerTypeIPv6HopByHop }

func (i *IPv6HopByHop) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
	var bytes []byte
	var err error

	o := make([]*ipv6HeaderTLVOption, 0, len(i.Options))
	for _, v := range i.Options {
		o = append(o, (*ipv6HeaderTLVOption)(v))
	}

	l := serializeIPv6HeaderTLVOptions(nil, o, opts.FixLengths)
	bytes, err = b.PrependBytes(l)
	if err != nil {
		return err
	}
	serializeIPv6HeaderTLVOptions(bytes, o, opts.FixLengths)

	length := len(bytes) + 2
	if length%8 != 0 {
		return fmt.Errorf("IPv6HopByHop actual length must be multiple of 8")
	}
	bytes, err = b.PrependBytes(2)
	if err != nil {
		return err
	}
	bytes[0] = uint8(i.NextHeader)
	if opts.FixLengths {
		i.HeaderLength = uint8((length / 8) - 1)
	}
	bytes[1] = uint8(i.HeaderLength)
	return nil
}

func (i *IPv6HopByHop) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	i.ipv6ExtensionBase = decodeIPv6ExtensionBase(data)
	offset := 2
	for offset < i.ActualLength {
		opt := decodeIPv6HeaderTLVOption(data[offset:])
		i.Options = append(i.Options, (*IPv6HopByHopOption)(opt))
		offset += opt.ActualLength
	}
	return nil
}

func decodeIPv6HopByHop(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6HopByHop{}
	err := i.DecodeFromBytes(data, p)
	p.AddLayer(i)
	if err != nil {
		return err
	}
	return p.NextDecoder(i.NextHeader)
}

func (o *IPv6HopByHopOption) SetJumboLength(len uint32) {
	o.OptionType = IPv6HopByHopOptionJumbogram
	o.OptionLength = 4
	o.ActualLength = 6
	if o.OptionData == nil {
		o.OptionData = make([]byte, 4)
	}
	binary.BigEndian.PutUint32(o.OptionData, len)
	o.OptionAlignment = [2]uint8{4, 2}
}

// IPv6Routing is the IPv6 routing extension.
type IPv6Routing struct {
	ipv6ExtensionBase
	RoutingType  uint8
	SegmentsLeft uint8
	// This segment is supposed to be zero according to RFC2460, the second set of
	// 4 bytes in the extension.
	Reserved []byte
	// SourceRoutingIPs is the set of IPv6 addresses requested for source routing,
	// set only if RoutingType == 0.
	SourceRoutingIPs []net.IP
}

// LayerType returns LayerTypeIPv6Routing.
func (i *IPv6Routing) LayerType() gopacket.LayerType { return LayerTypeIPv6Routing }

func decodeIPv6Routing(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Routing{
		ipv6ExtensionBase: decodeIPv6ExtensionBase(data),
		RoutingType:       data[2],
		SegmentsLeft:      data[3],
		Reserved:          data[4:8],
	}
	switch i.RoutingType {
	case 0: // Source routing
		if (i.ActualLength-8)%16 != 0 {
			return fmt.Errorf("Invalid IPv6 source routing, length of type 0 packet %d", i.ActualLength)
		}
		for d := i.Contents[8:]; len(d) >= 16; d = d[16:] {
			i.SourceRoutingIPs = append(i.SourceRoutingIPs, net.IP(d[:16]))
		}
	default:
		return fmt.Errorf("Unknown IPv6 routing header type %d", i.RoutingType)
	}
	p.AddLayer(i)
	return p.NextDecoder(i.NextHeader)
}

// IPv6Fragment is the IPv6 fragment header, used for packet
// fragmentation/defragmentation.
type IPv6Fragment struct {
	BaseLayer
	NextHeader IPProtocol
	// Reserved1 is bits [8-16), from least to most significant, 0-indexed
	Reserved1      uint8
	FragmentOffset uint16
	// Reserved2 is bits [29-31), from least to most significant, 0-indexed
	Reserved2      uint8
	MoreFragments  bool
	Identification uint32
}

// LayerType returns LayerTypeIPv6Fragment.
func (i *IPv6Fragment) LayerType() gopacket.LayerType { return LayerTypeIPv6Fragment }

func decodeIPv6Fragment(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Fragment{
		BaseLayer:      BaseLayer{data[:8], data[8:]},
		NextHeader:     IPProtocol(data[0]),
		Reserved1:      data[1],
		FragmentOffset: binary.BigEndian.Uint16(data[2:4]) >> 3,
		Reserved2:      data[3] & 0x6 >> 1,
		MoreFragments:  data[3]&0x1 != 0,
		Identification: binary.BigEndian.Uint32(data[4:8]),
	}
	p.AddLayer(i)
	return p.NextDecoder(gopacket.DecodeFragment)
}

// IPv6DestinationOption is a TLV option present in an IPv6 destination options extension.
type IPv6DestinationOption ipv6HeaderTLVOption

// IPv6Destination is the IPv6 destination options header.
type IPv6Destination struct {
	ipv6ExtensionBase
	Options []*IPv6DestinationOption
}

// LayerType returns LayerTypeIPv6Destination.
func (i *IPv6Destination) LayerType() gopacket.LayerType { return LayerTypeIPv6Destination }

func (i *IPv6Destination) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	i.ipv6ExtensionBase = decodeIPv6ExtensionBase(data)
	offset := 2
	for offset < i.ActualLength {
		opt := decodeIPv6HeaderTLVOption(data[offset:])
		i.Options = append(i.Options, (*IPv6DestinationOption)(opt))
		offset += opt.ActualLength
	}
	return nil
}

func decodeIPv6Destination(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Destination{}
	err := i.DecodeFromBytes(data, p)
	p.AddLayer(i)
	if err != nil {
		return err
	}
	return p.NextDecoder(i.NextHeader)
}

// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
func (i *IPv6Destination) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
	var bytes []byte
	var err error

	o := make([]*ipv6HeaderTLVOption, 0, len(i.Options))
	for _, v := range i.Options {
		o = append(o, (*ipv6HeaderTLVOption)(v))
	}

	l := serializeIPv6HeaderTLVOptions(nil, o, opts.FixLengths)
	bytes, err = b.PrependBytes(l)
	if err != nil {
		return err
	}
	serializeIPv6HeaderTLVOptions(bytes, o, opts.FixLengths)

	length := len(bytes) + 2
	if length%8 != 0 {
		return fmt.Errorf("IPv6Destination actual length must be multiple of 8")
	}
	bytes, err = b.PrependBytes(2)
	if err != nil {
		return err
	}
	bytes[0] = uint8(i.NextHeader)
	if opts.FixLengths {
		i.HeaderLength = uint8((length / 8) - 1)
	}
	bytes[1] = uint8(i.HeaderLength)
	return nil
}

func checkIPv6Address(addr net.IP) error {
	if len(addr) == net.IPv6len {
		return nil
	}
	if len(addr) == net.IPv4len {
		return fmt.Errorf("address is IPv4")
	}
	return fmt.Errorf("wrong length of %d bytes instead of %d", len(addr), net.IPv6len)
}

func (ip *IPv6) AddressTo16() error {
	if err := checkIPv6Address(ip.SrcIP); err != nil {
		return fmt.Errorf("Invalid source IPv6 address (%s)", err)
	}
	if err := checkIPv6Address(ip.DstIP); err != nil {
		return fmt.Errorf("Invalid destination IPv6 address (%s)", err)
	}
	return nil
}


text:
import {resolve} from './resolve'
import {toNumber} from './util'

export function* group (iterable, _length) {
  const length = toNumber(_length, 1)
  let cache = []

  for (let elem of resolve(iterable)) {
    cache.push(elem)

    if (cache.length >= length) {
      yield cache
      cache = []
    }
  }

  if (cache.length === 0) {
    return
  }

  while (cache.length < length) {
    cache.push(null)
  }
  yield cache
}


text:
from onvif import ONVIFCamera
__author__ = 'vahid'

if __name__ == '__main__':
    mycam = ONVIFCamera('192.168.1.10', 8899, 'admin', 'admin') #, no_cache=True)
    event_service = mycam.create_events_service()
    print(event_service.GetEventProperties())

    pullpoint = mycam.create_pullpoint_service()
    req = pullpoint.create_type('PullMessages')
    req.MessageLimit=100
    print(pullpoint.PullMessages(req))


text:
package com.planet_ink.coffee_mud.Abilities.Misc;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

public class Firebreath extends Dragonbreath
{
	public String ID() { return "Firebreath"; }
	public String name(){ return "Firebreath";}
	public String text(){return "fire";}
	public void setMiscText(String newText){super.setMiscText(text());}
    private static final String[] triggerStrings = {"FIREBREATH"};
    public String[] triggerStrings(){return triggerStrings;}
}


text:
package sql.fredy.metadata;

public class Columns {

// Fredy's make Version
private static String fredysVersion = "Version 1.4   2. Jan.2002";

public String getVersion() {return fredysVersion; }

    int number;

    /**
       * Get the value of number.
       * @return Value of number.
       */
    public int getNumber() {return number;}

    /**
       * Set the value of number.
       * @param v  Value to assign to number.
       */
    public void setNumber(int  v) {this.number = v;}

    String name;

    /**
       * Get the value of name.
       * @return Value of name.
       */
    public String getName() {return name;}

    /**
       * Set the value of name.
       * @param v  Value to assign to name.
       */
    public void setName(String  v) {this.name = v;}

    int lng;

    /**
       * Get the value of lng.
       * @return Value of lng.
       */
    public int getLng() {return lng;}

    /**
       * Set the value of lng.
       * @param v  Value to assign to lng.
       */
    public void setLng(int  v) {this.lng = v;}

    int decDigits;

    /**
       * Get the value of decDigits.
       * @return Value of decDigits.
       */
    public int getDecDigits() {return decDigits;}

    /**
       * Set the value of decDigits.
       * @param v  Value to assign to decDigits.
       */
    public void setDecDigits(int  v) {this.decDigits = v;}

    String  type;

    /**
       * Get the value of type.
       * @return Value of type.
       */
    public String  getType() {return type;}

    /**
       * Set the value of type.
       * @param v  Value to assign to type.
       */
    public void setType(String   v) {this.type = v;}

    String table;

    /**
       * Get the value of table.
       * @return Value of table.
       */
    public String getTable() {return table;}

    /**
       * Set the value of table.
       * @param v  Value to assign to table.
       */
    public void setTable(String  v) {this.table = v;}

    public Columns() {

    }

    public  Columns(int no, String name, String type, int lng, int decDigits, String table) {

	setTable(table);
	setNumber(no);
	setName(name);
	setType(type);
	setLng(lng);
	setDecDigits(decDigits);

    }

}