text:
package common

import (
	"context"
	"fmt"
	"strconv"
	"time"

	"k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/uuid"
	"k8s.io/apimachinery/pkg/watch"
	watchtools "k8s.io/client-go/tools/watch"
	podutil "k8s.io/kubernetes/pkg/api/v1/pod"
	"k8s.io/kubernetes/pkg/client/conditions"
	"k8s.io/kubernetes/test/e2e/framework"
	imageutils "k8s.io/kubernetes/test/utils/image"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = framework.KubeDescribe("InitContainer [NodeConformance]", func() {
	f := framework.NewDefaultFramework("init-container")
	var podClient *framework.PodClient
	BeforeEach(func() {
		podClient = f.PodClient()
	})

	/*
		Release: v1.12
		Testname: init-container-starts-app-restartnever-pod
		Description: Ensure that all InitContainers are started
		and all containers in pod are voluntarily terminated with exit status 0,
		and the system is not going to restart any of these containers
		when Pod has restart policy as RestartNever.
	*/
	framework.ConformanceIt("should invoke init containers on a RestartNever pod", func() {
		By("creating the pod")
		name := "pod-init-" + string(uuid.NewUUID())
		value := strconv.Itoa(time.Now().Nanosecond())
		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: name,
				Labels: map[string]string{
					"name": "foo",
					"time": value,
				},
			},
			Spec: v1.PodSpec{
				RestartPolicy: v1.RestartPolicyNever,
				InitContainers: []v1.Container{
					{
						Name:    "init1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
					{
						Name:    "init2",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
				},
				Containers: []v1.Container{
					{
						Name:    "run1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
				},
			},
		}
		framework.Logf("PodSpec: initContainers in spec.initContainers")
		startedPod := podClient.Create(pod)
		w, err := podClient.Watch(metav1.SingleObject(startedPod.ObjectMeta))
		Expect(err).NotTo(HaveOccurred(), "error watching a pod")
		wr := watch.NewRecorder(w)
		ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
		defer cancel()
		event, err := watchtools.UntilWithoutRetry(ctx, wr, conditions.PodCompleted)
		Expect(err).To(BeNil())
		framework.CheckInvariants(wr.Events(), framework.ContainerInitInvariant)
		endPod := event.Object.(*v1.Pod)
		Expect(endPod.Status.Phase).To(Equal(v1.PodSucceeded))
		_, init := podutil.GetPodCondition(&endPod.Status, v1.PodInitialized)
		Expect(init).NotTo(BeNil())
		Expect(init.Status).To(Equal(v1.ConditionTrue))

		Expect(len(endPod.Status.InitContainerStatuses)).To(Equal(2))
		for _, status := range endPod.Status.InitContainerStatuses {
			Expect(status.Ready).To(BeTrue())
			Expect(status.State.Terminated).NotTo(BeNil())
			Expect(status.State.Terminated.ExitCode).To(BeZero())
		}
	})

	/*
		Release: v1.12
		Testname: init-container-starts-app-restartalways-pod
		Description: Ensure that all InitContainers are started
		and all containers in pod started
		and at least one container is still running or is in the process of being restarted
		when Pod has restart policy as RestartAlways.
	*/
	framework.ConformanceIt("should invoke init containers on a RestartAlways pod", func() {
		By("creating the pod")
		name := "pod-init-" + string(uuid.NewUUID())
		value := strconv.Itoa(time.Now().Nanosecond())
		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: name,
				Labels: map[string]string{
					"name": "foo",
					"time": value,
				},
			},
			Spec: v1.PodSpec{
				InitContainers: []v1.Container{
					{
						Name:    "init1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
					{
						Name:    "init2",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
				},
				Containers: []v1.Container{
					{
						Name:  "run1",
						Image: imageutils.GetPauseImageName(),
						Resources: v1.ResourceRequirements{
							Limits: v1.ResourceList{
								v1.ResourceCPU:    *resource.NewMilliQuantity(100, resource.DecimalSI),
								v1.ResourceMemory: *resource.NewQuantity(50*1024*1024, resource.DecimalSI),
							},
						},
					},
				},
			},
		}
		framework.Logf("PodSpec: initContainers in spec.initContainers")
		startedPod := podClient.Create(pod)
		w, err := podClient.Watch(metav1.SingleObject(startedPod.ObjectMeta))
		Expect(err).NotTo(HaveOccurred(), "error watching a pod")
		wr := watch.NewRecorder(w)
		ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
		defer cancel()
		event, err := watchtools.UntilWithoutRetry(ctx, wr, conditions.PodRunning)
		Expect(err).To(BeNil())
		framework.CheckInvariants(wr.Events(), framework.ContainerInitInvariant)
		endPod := event.Object.(*v1.Pod)
		Expect(endPod.Status.Phase).To(Equal(v1.PodRunning))
		_, init := podutil.GetPodCondition(&endPod.Status, v1.PodInitialized)
		Expect(init).NotTo(BeNil())
		Expect(init.Status).To(Equal(v1.ConditionTrue))

		Expect(len(endPod.Status.InitContainerStatuses)).To(Equal(2))
		for _, status := range endPod.Status.InitContainerStatuses {
			Expect(status.Ready).To(BeTrue())
			Expect(status.State.Terminated).NotTo(BeNil())
			Expect(status.State.Terminated.ExitCode).To(BeZero())
		}
	})

	/*
		Release: v1.12
		Testname: init-container-fails-stops-app-restartalways-pod
		Description: Ensure that app container is not started
		when all InitContainers failed to start
		and Pod has restarted for few occurrences
		and pod has restart policy as RestartAlways.
	*/
	framework.ConformanceIt("should not start app containers if init containers fail on a RestartAlways pod", func() {
		By("creating the pod")
		name := "pod-init-" + string(uuid.NewUUID())
		value := strconv.Itoa(time.Now().Nanosecond())

		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: name,
				Labels: map[string]string{
					"name": "foo",
					"time": value,
				},
			},
			Spec: v1.PodSpec{
				InitContainers: []v1.Container{
					{
						Name:    "init1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/false"},
					},
					{
						Name:    "init2",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
				},
				Containers: []v1.Container{
					{
						Name:  "run1",
						Image: imageutils.GetPauseImageName(),
						Resources: v1.ResourceRequirements{
							Limits: v1.ResourceList{
								v1.ResourceCPU:    *resource.NewMilliQuantity(100, resource.DecimalSI),
								v1.ResourceMemory: *resource.NewQuantity(50*1024*1024, resource.DecimalSI),
							},
						},
					},
				},
			},
		}
		framework.Logf("PodSpec: initContainers in spec.initContainers")
		startedPod := podClient.Create(pod)
		w, err := podClient.Watch(metav1.SingleObject(startedPod.ObjectMeta))
		Expect(err).NotTo(HaveOccurred(), "error watching a pod")

		wr := watch.NewRecorder(w)
		ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
		defer cancel()
		event, err := watchtools.UntilWithoutRetry(
			ctx, wr,
			// check for the first container to fail at least once
			func(evt watch.Event) (bool, error) {
				switch t := evt.Object.(type) {
				case *v1.Pod:
					for _, status := range t.Status.ContainerStatuses {
						if status.State.Waiting == nil {
							return false, fmt.Errorf("container %q should not be out of waiting: %#v", status.Name, status)
						}
						if status.State.Waiting.Reason != "PodInitializing" {
							return false, fmt.Errorf("container %q should have reason PodInitializing: %#v", status.Name, status)
						}
					}
					if len(t.Status.InitContainerStatuses) != 2 {
						return false, nil
					}
					status := t.Status.InitContainerStatuses[1]
					if status.State.Waiting == nil {
						return false, fmt.Errorf("second init container should not be out of waiting: %#v", status)
					}
					if status.State.Waiting.Reason != "PodInitializing" {
						return false, fmt.Errorf("second init container should have reason PodInitializing: %#v", status)
					}
					status = t.Status.InitContainerStatuses[0]
					if status.State.Terminated != nil && status.State.Terminated.ExitCode == 0 {
						return false, fmt.Errorf("first init container should have exitCode != 0: %#v", status)
					}
					// continue until we see an attempt to restart the pod
					return status.LastTerminationState.Terminated != nil, nil
				default:
					return false, fmt.Errorf("unexpected object: %#v", t)
				}
			},
			// verify we get two restarts
			func(evt watch.Event) (bool, error) {
				switch t := evt.Object.(type) {
				case *v1.Pod:
					status := t.Status.InitContainerStatuses[0]
					if status.RestartCount < 3 {
						return false, nil
					}
					framework.Logf("init container has failed twice: %#v", t)
					// TODO: more conditions
					return true, nil
				default:
					return false, fmt.Errorf("unexpected object: %#v", t)
				}
			},
		)
		Expect(err).To(BeNil())
		framework.CheckInvariants(wr.Events(), framework.ContainerInitInvariant)
		endPod := event.Object.(*v1.Pod)
		Expect(endPod.Status.Phase).To(Equal(v1.PodPending))
		_, init := podutil.GetPodCondition(&endPod.Status, v1.PodInitialized)
		Expect(init).NotTo(BeNil())
		Expect(init.Status).To(Equal(v1.ConditionFalse))
		Expect(init.Reason).To(Equal("ContainersNotInitialized"))
		Expect(init.Message).To(Equal("containers with incomplete status: [init1 init2]"))
		Expect(len(endPod.Status.InitContainerStatuses)).To(Equal(2))
	})

	/*
		Release: v1.12
		Testname: init-container-fails-stops-app-restartnever-pod
		Description: Ensure that app container is not started
		when atleast one InitContainer fails to start and Pod has restart policy as RestartNever.
	*/
	framework.ConformanceIt("should not start app containers and fail the pod if init containers fail on a RestartNever pod", func() {
		By("creating the pod")
		name := "pod-init-" + string(uuid.NewUUID())
		value := strconv.Itoa(time.Now().Nanosecond())
		pod := &v1.Pod{
			ObjectMeta: metav1.ObjectMeta{
				Name: name,
				Labels: map[string]string{
					"name": "foo",
					"time": value,
				},
			},
			Spec: v1.PodSpec{
				RestartPolicy: v1.RestartPolicyNever,
				InitContainers: []v1.Container{
					{
						Name:    "init1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
					},
					{
						Name:    "init2",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/false"},
					},
				},
				Containers: []v1.Container{
					{
						Name:    "run1",
						Image:   imageutils.GetE2EImage(imageutils.BusyBox),
						Command: []string{"/bin/true"},
						Resources: v1.ResourceRequirements{
							Limits: v1.ResourceList{
								v1.ResourceCPU:    *resource.NewMilliQuantity(100, resource.DecimalSI),
								v1.ResourceMemory: *resource.NewQuantity(50*1024*1024, resource.DecimalSI),
							},
						},
					},
				},
			},
		}
		framework.Logf("PodSpec: initContainers in spec.initContainers")
		startedPod := podClient.Create(pod)

		w, err := podClient.Watch(metav1.SingleObject(startedPod.ObjectMeta))
		Expect(err).NotTo(HaveOccurred(), "error watching a pod")

		wr := watch.NewRecorder(w)
		ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
		defer cancel()
		event, err := watchtools.UntilWithoutRetry(
			ctx, wr,
			// check for the second container to fail at least once
			func(evt watch.Event) (bool, error) {
				switch t := evt.Object.(type) {
				case *v1.Pod:
					for _, status := range t.Status.ContainerStatuses {
						if status.State.Waiting == nil {
							return false, fmt.Errorf("container %q should not be out of waiting: %#v", status.Name, status)
						}
						if status.State.Waiting.Reason != "PodInitializing" {
							return false, fmt.Errorf("container %q should have reason PodInitializing: %#v", status.Name, status)
						}
					}
					if len(t.Status.InitContainerStatuses) != 2 {
						return false, nil
					}
					status := t.Status.InitContainerStatuses[0]
					if status.State.Terminated == nil {
						if status.State.Waiting != nil && status.State.Waiting.Reason != "PodInitializing" {
							return false, fmt.Errorf("second init container should have reason PodInitializing: %#v", status)
						}
						return false, nil
					}
					if status.State.Terminated != nil && status.State.Terminated.ExitCode != 0 {
						return false, fmt.Errorf("first init container should have exitCode != 0: %#v", status)
					}
					status = t.Status.InitContainerStatuses[1]
					if status.State.Terminated == nil {
						return false, nil
					}
					if status.State.Terminated.ExitCode == 0 {
						return false, fmt.Errorf("second init container should have failed: %#v", status)
					}
					return true, nil
				default:
					return false, fmt.Errorf("unexpected object: %#v", t)
				}
			},
			conditions.PodCompleted,
		)
		Expect(err).To(BeNil())
		framework.CheckInvariants(wr.Events(), framework.ContainerInitInvariant)
		endPod := event.Object.(*v1.Pod)

		Expect(endPod.Status.Phase).To(Equal(v1.PodFailed))
		_, init := podutil.GetPodCondition(&endPod.Status, v1.PodInitialized)
		Expect(init).NotTo(BeNil())
		Expect(init.Status).To(Equal(v1.ConditionFalse))
		Expect(init.Reason).To(Equal("ContainersNotInitialized"))
		Expect(init.Message).To(Equal("containers with incomplete status: [init2]"))
		Expect(len(endPod.Status.InitContainerStatuses)).To(Equal(2))
		Expect(endPod.Status.ContainerStatuses[0].State.Waiting).ToNot(BeNil())
	})
})


text:
package org.wso2.carbon.um.ws.service.dao;

import java.util.Date;

public class RealmConfigurationDTO {

    private String userStoreClass = null;
    private String authorizationManagerClass = null;
    private String adminRoleName = null;
    private String adminUserName = null;
    private String adminPassword = null;
    private String everyOneRoleName = null;
    private String realmClassName = null;
    private RealmPropertyDTO[] userStoreProperties = new RealmPropertyDTO[0];
    private RealmPropertyDTO[] authzProperties = new RealmPropertyDTO[0];
    private RealmPropertyDTO[] realmProperties = new RealmPropertyDTO[0];
    boolean isReadOnly = true;
    private int tenantId;
    private Date persistedTimestamp;
    private int maxUserListLength = -1;

    public RealmConfigurationDTO() {

    }

    public String getUserStoreClass() {
        return userStoreClass;
    }

    public void setUserStoreClass(String userStoreClass) {
        this.userStoreClass = userStoreClass;
    }

    public String getAuthorizationManagerClass() {
        return authorizationManagerClass;
    }

    public void setAuthorizationManagerClass(String authorizationManagerClass) {
        this.authorizationManagerClass = authorizationManagerClass;
    }

    public String getAdminRoleName() {
        return adminRoleName;
    }

    public void setAdminRoleName(String adminRoleName) {
        this.adminRoleName = adminRoleName;
    }

    public String getAdminUserName() {
        return adminUserName;
    }

    public void setAdminUserName(String adminUserName) {
        this.adminUserName = adminUserName;
    }

    public String getAdminPassword() {
        return adminPassword;
    }

    public void setAdminPassword(String adminPassword) {
        this.adminPassword = adminPassword;
    }

    public String getEveryOneRoleName() {
        return everyOneRoleName;
    }

    public void setEveryOneRoleName(String everyOneRoleName) {
        this.everyOneRoleName = everyOneRoleName;
    }

    public String getRealmClassName() {
        return realmClassName;
    }

    public void setRealmClassName(String realmClassName) {
        this.realmClassName = realmClassName;
    }

    public RealmPropertyDTO[] getUserStoreProperties() {
        return userStoreProperties;
    }

    public void setUserStoreProperties(RealmPropertyDTO[] userStoreProperties) {
        this.userStoreProperties = userStoreProperties;
    }

    public RealmPropertyDTO[] getAuthzProperties() {
        return authzProperties;
    }

    public void setAuthzProperties(RealmPropertyDTO[] authzProperties) {
        this.authzProperties = authzProperties;
    }

    public RealmPropertyDTO[] getRealmProperties() {
        return realmProperties;
    }

    public void setRealmProperties(RealmPropertyDTO[] realmProperties) {
        this.realmProperties = realmProperties;
    }

    public boolean isReadOnly() {
        return isReadOnly;
    }

    public void setReadOnly(boolean isReadOnly) {
        this.isReadOnly = isReadOnly;
    }

    public int getTenantId() {
        return tenantId;
    }

    public void setTenantId(int tenantId) {
        this.tenantId = tenantId;
    }

    public Date getPersistedTimestamp() {
        return persistedTimestamp;
    }

    public void setPersistedTimestamp(Date persistedTimestamp) {
        this.persistedTimestamp = persistedTimestamp;
    }

    public int getMaxUserListLength() {
        return maxUserListLength;
    }

    public void setMaxUserListLength(int maxUserListLength) {
        this.maxUserListLength = maxUserListLength;
    }

}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _FSL_ADC_ETC_H_
#define _FSL_ADC_ETC_H_

#include "fsl_common.h"

/*!
 *  @addtogroup adc_etc
 *  @{
 */

/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief ADC_ETC driver version */
#define FSL_ADC_ETC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */
/*! @brief The mask of status flags cleared by writing 1. */
#define ADC_ETC_DMA_CTRL_TRGn_REQ_MASK 0xFF0000U

/*!
* @brief ADC_ETC customized status flags mask.
*/
enum _adc_etc_status_flag_mask
{
    kADC_ETC_Done0StatusFlagMask = 1U,
    kADC_ETC_Done1StatusFlagMask = 2U,
    kADC_ETC_Done2StatusFlagMask = 4U,
    kADC_ETC_ErrorStatusFlagMask = 8U,
};

/*!
* @brief External triggers sources.
*/
typedef enum _adc_etc_external_trigger_source
{
    /* External XBAR sources. Support HW or SW mode. */
    kADC_ETC_Trg0TriggerSource = 0U, /* External XBAR trigger0 source. */
    kADC_ETC_Trg1TriggerSource = 1U, /* External XBAR trigger1 source. */
    kADC_ETC_Trg2TriggerSource = 2U, /* External XBAR trigger2 source. */
    kADC_ETC_Trg3TriggerSource = 3U, /* External XBAR trigger3 source. */
    kADC_ETC_Trg4TriggerSource = 4U, /* External XBAR trigger4 source. */
    kADC_ETC_Trg5TriggerSource = 5U, /* External XBAR trigger5 source. */
    kADC_ETC_Trg6TriggerSource = 6U, /* External XBAR trigger6 source. */
    kADC_ETC_Trg7TriggerSource = 7U, /* External XBAR trigger7 source. */
    /* External TSC sources. Only support HW mode. */
    kADC_ETC_TSC0TriggerSource = 8U, /* External TSC trigger0 source. */
    kADC_ETC_TSC1TriggerSource = 9U, /* External TSC trigger1 source. */
} adc_etc_external_trigger_source_t;

/*!
* @brief Interrupt enable/disable mask.
*/
typedef enum _adc_etc_interrupt_enable
{
    kADC_ETC_InterruptDisable = 0U,     /* Disable the ADC_ETC interrupt. */
    kADC_ETC_Done0InterruptEnable = 1U, /* Enable the DONE0 interrupt when ADC conversions complete. */
    kADC_ETC_Done1InterruptEnable = 2U, /* Enable the DONE1 interrupt when ADC conversions complete. */
    kADC_ETC_Done2InterruptEnable = 3U, /* Enable the DONE2 interrupt when ADC conversions complete. */
} adc_etc_interrupt_enable_t;

#if defined(FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL) && FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL
/*!
* @brief DMA mode selection.
*/
typedef enum _adc_etc_dma_mode_selection
{
    kADC_ETC_TrigDMAWithLatchedSignal = 0U,  /* Trig DMA_REQ with latched signal, REQ will be cleared when ACK and source request cleared. */
    kADC_ETC_TrigDMAWithPulsedSignal = 1U,   /* Trig DMA_REQ with pulsed signal, REQ will be cleared by ACK only. */
} adc_etc_dma_mode_selection_t;
#endif /*FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL*/

/*!
 * @brief ADC_ETC configuration.
 */
typedef struct _adc_etc_config
{
    bool enableTSCBypass;         /* If bypass TSC, TSC would trigger ADC directly.
                                     Otherwise TSC would trigger ADC through ADC_ETC. */
    bool enableTSC0Trigger;       /* Enable external TSC0 trigger. It is valid when enableTSCBypass = false. */
    bool enableTSC1Trigger;       /* Enable external TSC1 trigger. It is valid when enableTSCBypass = false.*/
#if defined(FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL) && FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL
    adc_etc_dma_mode_selection_t dmaMode; /* Select the ADC_ETC DMA mode. */
#endif /*FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL*/
    uint32_t TSC0triggerPriority; /* External TSC0 trigger priority, 7 is highest, 0 is lowest. */
    uint32_t TSC1triggerPriority; /* External TSC1 trigger priority, 7 is highest, 0 is lowest. */
    uint32_t clockPreDivider;     /* Pre-divider for trig delay and interval. Available range is 0-255.
                                    Clock would be divided by (clockPreDivider+1). */
    uint32_t XBARtriggerMask;     /* Enable the corresponding trigger source. Available range is trigger0:0x01 to
                                     trigger7:0x80
                                     For example, XBARtriggerMask = 0x7U, which means trigger0, trigger1 and trigger2 is
                                     enabled. */
} adc_etc_config_t;

/*!
* @brief ADC_ETC trigger chain configuration.
*/
typedef struct _adc_etc_trigger_chain_config
{
    bool enableB2BMode;           /* Enable ADC_ETC BackToBack mode. when not enabled B2B mode,
                                     wait until interval delay is reached. */
    uint32_t ADCHCRegisterSelect; /* Select relevant ADC_HCx register to trigger. 1U : HC0, 2U: HC1, 4U: HC2 ... */
    uint32_t ADCChannelSelect;    /* Select ADC sample channel. */
    adc_etc_interrupt_enable_t InterruptEnable; /* Enable/disable Interrupt. */
} adc_etc_trigger_chain_config_t;

/*!
* @brief ADC_ETC trigger configuration.
*/
typedef struct _adc_etc_trigger_config
{
    bool enableSyncMode; /* Enable the sync Mode, In SyncMode ADC1 and ADC2 are controlled by the same trigger source.
                            In AsyncMode ADC1 and ADC2 are controlled by separate trigger source. */
    bool enableSWTriggerMode;     /* Enable the sofware trigger mode. */
    uint32_t triggerChainLength;  /* TRIG chain length to the ADC. 0: Trig length is 1. ... 7: Trig length is 8. */
    uint32_t triggerPriority;     /* External trigger priority, 7 is highest, 0 is lowest. */
    uint32_t sampleIntervalDelay; /* Set sampling interval delay. */
    uint32_t initialDelay;        /* Set trigger initial delay. */
} adc_etc_trigger_config_t;

/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif

/*!
 * @name Initialization
 * @{
 */

/*!
* @brief Initialize the ADC_ETC module.
*
* @param base ADC_ETC peripheral base address.
* @param config Pointer to "adc_etc_config_t" structure.
*/
void ADC_ETC_Init(ADC_ETC_Type *base, const adc_etc_config_t *config);

/*!
* @brief De-Initialize the ADC_ETC module.
*
* @param base ADC_ETC peripheral base address.
*/
void ADC_ETC_Deinit(ADC_ETC_Type *base);

/*!
* @brief Gets an available pre-defined settings for the ADC_ETC's configuration.
* This function initializes the ADC_ETC's configuration structure with available settings. The default values are:
* @code
*   config->enableTSCBypass = true;
*   config->enableTSC0Trigger = false;
*   config->enableTSC1Trigger = false;
*   config->TSC0triggerPriority = 0U;
*   config->TSC1triggerPriority = 0U;
*   config->clockPreDivider = 0U;
*   config->XBARtriggerMask = 0U;
* @endCode
*
* @param config Pointer to "adc_etc_config_t" structure.
*/
void ADC_ETC_GetDefaultConfig(adc_etc_config_t *config);

/*!
* @brief Set the external XBAR trigger configuration.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index.
* @param config Pointer to "adc_etc_trigger_config_t" structure.
*/
void ADC_ETC_SetTriggerConfig(ADC_ETC_Type *base, uint32_t triggerGroup, const adc_etc_trigger_config_t *config);

/*!
* @brief Set the external XBAR trigger chain configuration.
* For example, if triggerGroup is set to 0U and chainGroup is set to 1U, which means Trigger0 source's chain1 would be
* configurated.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index. Available number is 0~7.
* @param chainGroup Trigger chain group index. Available number is 0~7.
* @param config Pointer to "adc_etc_trigger_chain_config_t" structure.
*/
void ADC_ETC_SetTriggerChainConfig(ADC_ETC_Type *base,
                                   uint32_t triggerGroup,
                                   uint32_t chainGroup,
                                   const adc_etc_trigger_chain_config_t *config);

/*!
* @brief Gets the interrupt status flags of external XBAR and TSC triggers.
*
* @param base ADC_ETC peripheral base address.
* @param sourceIndex trigger source index.
*
* @return Status flags mask of trigger. Refer to "_adc_etc_status_flag_mask".
*/
uint32_t ADC_ETC_GetInterruptStatusFlags(ADC_ETC_Type *base, adc_etc_external_trigger_source_t sourceIndex);

/*!
* @brief Clears the ADC_ETC's interrupt status falgs.
*
* @param base ADC_ETC peripheral base address.
* @param sourceIndex trigger source index.
* @param mask Status flags mask of trigger. Refer to "_adc_etc_status_flag_mask".
*/
void ADC_ETC_ClearInterruptStatusFlags(ADC_ETC_Type *base,
                                       adc_etc_external_trigger_source_t sourceIndex,
                                       uint32_t mask);

/*!
* @brief Enable the DMA corresponding to each trigger source.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index. Available number is 0~7.
*/
static inline void ADC_ETC_EnableDMA(ADC_ETC_Type *base, uint32_t triggerGroup)
{
    /* Avoid clearing status flags at the same time. */
    base->DMA_CTRL =
        (base->DMA_CTRL | (ADC_ETC_DMA_CTRL_TRIG0_ENABLE_MASK << triggerGroup)) & ~ADC_ETC_DMA_CTRL_TRGn_REQ_MASK;
}

/*!
* @brief Disable the DMA corresponding to each trigger sources.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index. Available number is 0~7.
*/
static inline void ADC_ETC_DisableDMA(ADC_ETC_Type *base, uint32_t triggerGroup)
{
    /* Avoid clearing status flags at the same time. */
    base->DMA_CTRL =
        (base->DMA_CTRL & ~(ADC_ETC_DMA_CTRL_TRIG0_ENABLE_MASK << triggerGroup)) & ~ADC_ETC_DMA_CTRL_TRGn_REQ_MASK;
}

/*!
 * @brief Get the DMA request status falgs. Only external XBAR sources support DMA request.
 *
 * @param base ADC_ETC peripheral base address.
 * @return Mask of external XBAR tirgger's DMA request asserted flags. Available range is trigger0:0x01 to
 * trigger7:0x80.
 */
static inline uint32_t ADC_ETC_GetDMAStatusFlags(ADC_ETC_Type *base)
{
    return (((base->DMA_CTRL) & ADC_ETC_DMA_CTRL_TRGn_REQ_MASK) >> ADC_ETC_DMA_CTRL_TRIG0_REQ_SHIFT);
}

/*!
 * @brief Clear the DMA request status falgs. Only external XBAR sources support DMA request.
 *
 * @param base ADC_ETC peripheral base address.
 * @param mask Mask of external XBAR tirgger's DMA request asserted flags. Available range is trigger0:0x01 to
 * trigger7:0x80.
 */
static inline void ADC_ETC_ClearDMAStatusFlags(ADC_ETC_Type *base, uint32_t mask)
{
    base->DMA_CTRL = ((base->DMA_CTRL) & ~ADC_ETC_DMA_CTRL_TRGn_REQ_MASK) | (mask << ADC_ETC_DMA_CTRL_TRIG0_REQ_SHIFT);
}

/*!
* @brief When enable ,all logical will be reset.
*
* @param base ADC_ETC peripheral base address.
* @param enable Enable/Disable the software reset.
*/
static inline void ADC_ETC_DoSoftwareReset(ADC_ETC_Type *base, bool enable)
{
    if (enable)
    {
        base->CTRL |= ADC_ETC_CTRL_SOFTRST_MASK;
    }
    else
    {
        base->CTRL &= ~ADC_ETC_CTRL_SOFTRST_MASK;
    }
}

/*!
* @brief Do software trigger corresponding to each XBAR trigger sources.
* Each XBAR trigger sources can be configured as HW or SW trigger mode. In hardware trigger mode,
* trigger source is from XBAR. In software mode, trigger source is from software tigger. TSC trigger sources
* can only work in hardware trigger mode.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index. Available number is 0~7.
*/
static inline void ADC_ETC_DoSoftwareTrigger(ADC_ETC_Type *base, uint32_t triggerGroup)
{
    assert(triggerGroup < ADC_ETC_TRIGn_CTRL_COUNT);

    base->TRIG[triggerGroup].TRIGn_CTRL |= ADC_ETC_TRIGn_CTRL_SW_TRIG_MASK;
}

/*!
* @brief Get ADC conversion result from external XBAR sources.
* For example, if triggerGroup is set to 0U and chainGroup is set to 1U, which means the API would
* return Trigger0 source's chain1 conversion result.
*
* @param base ADC_ETC peripheral base address.
* @param triggerGroup Trigger group index. Available number is 0~7.
* @param chainGroup Trigger chain group index. Available number is 0~7.
* @return ADC conversion result value.
*/
uint32_t ADC_ETC_GetADCConversionValue(ADC_ETC_Type *base, uint32_t triggerGroup, uint32_t chainGroup);

#if defined(__cplusplus)
}
#endif

#endif /* _FSL_ADC_ETC_H_ */


text:
Objectif de l'exercice :
-

Creer un Cheatsheet CSS3 en HTML5/CSS3, grace a l'outil framework Foundation 5.


text:
class BuildRunner
  pattr_initialize :payload

  def run
    if repo && relevant_pull_request?
      track_subscribed_build_started
      create_pending_status
      repo.builds.create!(
        violations: violations,
        pull_request_number: payload.pull_request_number,
        commit_sha: payload.head_sha,
      )
      commenter.comment_on_violations(priority_violations)
      create_success_status
      upsert_owner
      track_subscribed_build_completed
    end
  end

  private

  def relevant_pull_request?
    pull_request.opened? || pull_request.synchronize?
  end

  def violations
    @violations ||= style_checker.violations
  end

  def priority_violations
    violations.take(ENV["MAX_COMMENTS"].to_i)
  end

  def style_checker
    StyleChecker.new(pull_request)
  end

  def commenter
    Commenter.new(pull_request)
  end

  def pull_request
    @pull_request ||= PullRequest.new(payload)
  end

  def repo
    @repo ||= Repo.active.
      find_and_update(payload.github_repo_id, payload.full_repo_name)
  end

  def track_subscribed_build_started
    if repo.subscription
      user = repo.subscription.user
      analytics = Analytics.new(user)
      analytics.track_build_started(repo)
    end
  end

  def track_subscribed_build_completed
    if repo.subscription
      user = repo.subscription.user
      analytics = Analytics.new(user)
      analytics.track_build_completed(repo)
    end
  end

  def create_pending_status
    github.create_pending_status(
      payload.full_repo_name,
      payload.head_sha,
      "Hound is reviewing changes."
    )
  end

  def create_success_status
    github.create_success_status(
      payload.full_repo_name,
      payload.head_sha,
      "Hound has reviewed the changes."
    )
  end

  def upsert_owner
    Owner.upsert(
      github_id: payload.repository_owner_id,
      name: payload.repository_owner_name,
      organization: payload.repository_owner_is_organization?
    )
  end

  def github
    @github ||= GithubApi.new(ENV["HOUND_GITHUB_TOKEN"])
  end
end


text:
from bda.plone.payment.tests import Payment_INTEGRATION_TESTING
from bda.plone.payment.tests import set_browserlayer

import unittest2 as unittest

class TestPayment(unittest.TestCase):
    layer = Payment_INTEGRATION_TESTING

    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        set_browserlayer(self.request)

    def test_foo(self):
        self.assertEquals(1, 1)


text:
<!DOCTYPE html>

	<title>Login Page</title>
    <meta charset="utf-8" />

로그인 페이지

<form id="loginForm" method="POST" action="/user/login">
    <input type="text" name="username" placeholder="E-Mail" />

    <input type="password" name="password" value="" />

    <button type="submit" value="Submit">Confirm</button>
    <button type="reset" value="Reset">Reset</button>
</form>


text:
KOBATO is a simple action game developed with Python, Pygame.
Use the arrow keys to operate a red flying object and collect gems while avoiding enemies.

This game has a unique gimmick, **"discontinuous time operation"** , **"pseudo inertia"** .
I recommend playing after reading the note at the end of this document.

## Components
- KOBATO.exe
Double click to start the game.
- data folder
External files (audio files etc.) used in the game are stored.
- replay folder
This directory is created when you use the replay function. A replay file is generated in this, and put it in this when you want to use it. Details will be described later.
- etc
It is a file necessary for execute. Do not move to other places or delete.

## How to play

### Basics
Use the arrow keys to operate a red line.
This is you.

If you hit the enemies that appear under the prescribed conditions, the life (displayed on the upper left of the screen) will decrease.
You will lose tha game when life is exhausted.

When you touch the gem that appear on the screen, the "acquired gems" (displayed on the upper right of the screen) will increase.
Level (stage) will proceed as the number of acquired jewels reaches the prescribed number.
At this time, the number of "acquired gems" will be reset and the number of acquisition orders will be increased by one.
It is clear if you can proceed to level 10. (Score feature is not implemented.)

### Other operations
Other operations are as written on the game start screen.
It is a comment below.

- R
Replay recording starts when you enter "R" on the startup screen.
The replay file is saved in this folder.
- P
Play the replay.
Replay refers to the replay file in the "replay" folder, but if there are multiple files, which one will be played is top of arbitrary order.
- space
Save the screenshot.
- enter
Return to the game start screen.
It is used to reset the game progress.
- esc
Exit from the game.
You can also exit by closing the window.

## Note) About the unique element of this work
This work is basically a simple action game.
But please note the following two points.
These are special elements of this work, and you should be confused if you start without annotations.

### About the "discontinuous time operation"

This game proceeds with a turn system.
One turn begins with one input by the player, movement of all objects and collision judgment are done, and finally the result is outputted on the screen and it ends.
After that, the screen does not change at all until the next input.

### About the "pseudo inertia"
In this game, all objects are on an invisible grid.
The flying objects move from the intersection of this grid to other one, basically the same as the previous each turn.
The player's input and enemy's direction correction process work as a fine adjustment in the "single grid unit" of the arrival point in this movement.

## About
- Build for Windows PC.
- Tools: Python, Pygame, Py2exe

-  Version: v0.1

- Author: はくし Haxsie
- HP: [空理計画](http://kuuri.net)
- Mail: createblankdevelop@gmail.com
- (c) 2017 空理計画 Kuuri keikaku

## Update
- 2017/02/10
v0.1


text:
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width">
    <title>

            Taufique | Necessary Vim Commands

    </title>
    <meta name="description" content="">
    <link rel="stylesheet" href="https://www.taufique.me/css/bootstrap.css">
    <link rel="stylesheet" href="https://www.taufique.me/css/blog.css">
    <link rel="stylesheet" href="https://www.taufique.me/css/mystyle.css">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,700" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Over+the+Rainbow" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Playfair+Display:700,900" rel="stylesheet">

            Md Taufique Hussain

            Research

            Publications

            Posts

            Journal

            About Me

                                Necessary Vim Commands

                                 2018-07-31

I was introduced to Vim in 2012.
At that time I was working on some Linux Kernel Module develpment and vim was becomming necessary for some text editing purpose.
Initially it felt like pretty wierd back then.
But later it became definition of a unique user experience that I can’t get rid of.
I even discovered that I try to find this experience pretty much everywhere - from file browser to internet browser.
This is not only me, I know many more persons who experience the same as I have.
Here are some useful plugins and commands of Vim that I found useful in my case.
Purpose of this post is not for being an exhaustive reference point.
This is just for my future reference only.

Useful Command List

This is the list of Vim commands which became useful to me.

Table of Contents

Tabs

Line Movement

Search

Tabs

:gt - Switch to next tab

:gT - Switch to previous tab

:{count}gt - Go to tab page {count}. The first tab page has number one. As example, 5gt goes to fifth tab.

:{count}gT - Go {count} tab pages back. Wraps around from the first one to the last one. As example 5gT goes five tabs back from current tab.

Line Movement

To move just a single line -
- :m 71 - Move current line after line 71
- :m 0 - Move current line before first line
- :m $ - Move current line after last line

To move a block of lines -
- :7,11m 71 - Move line 7,8,9,10 and 11 after line 71
- :7,11m 0 - Move line 7,8,9,10 and 11 before first line
- :7,11m $ - Move line 7,8,9,10 and 11 after last line

Search

/text - Searches the given text in the whole document

n - Next occurance of current search result

N - Previous occurance of current search result

* - Searches further occurance of the token on which cursor is placed currently

:set hlsearch - Highlights all the texts found in search result

:nohlsearch - Removes search highlights


text: export { Headset as default } from "./";


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/id_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/ToolbarPopupTheme"
        app:titleTextColor="#FFFFFF"
        app:title="@string/home_title"/>

    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/id_toolbar">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">
            <TextView
                android:id="@+id/tv_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="left"
                android:text="当前解码方案为:"
                android:textSize="14sp"
                android:textColor="@color/colorPrimary"/>

            <Button
                android:id="@+id/tv_videoView"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="useBaseVideoView"
                android:textAllCaps="false"
                android:text="BaseVideoView的使用"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_recycler"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="useBaseVideoViewWithRecycler"
                android:textAllCaps="false"
                android:text="BaseVideoView的Recycler使用"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_window_videoView"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="useWindowVideoView"
                android:textAllCaps="false"
                android:text="WindowVideoView的使用"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_window_play"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="useFloatWindow"
                android:textAllCaps="false"
                android:text="FloatWindow的无缝切播"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_multi_play"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="multiVideoPlay"
                android:textAllCaps="false"
                android:text="多实例播放"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_music_play"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="musicPlay"
                android:textAllCaps="false"
                android:text="音乐播放"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <TextView
                android:id="@+id/tv_avPlayer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:gravity="left"
                android:textAllCaps="false"
                android:text="列表播放全屏切换、无缝续播"
                android:textSize="14sp"
                android:textColor="#000000"/>

            <Button
                android:id="@+id/tv_pager_play"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="viewPagerPlay"
                android:textAllCaps="false"
                android:text="ViewPager中播放"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_local_video"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="singleListPlay"
                android:textAllCaps="false"
                android:text="单列表播放"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:id="@+id/tv_multi_list"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="multiListPlay"
                android:textAllCaps="false"
                android:text="多列表播放"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <Button
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:onClick="shareAnimationVideos"
                android:textAllCaps="false"
                android:text="共享元素转场动画"
                android:textSize="16sp"
                android:textColor="@color/buttonTextColor"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="left"
                android:text="MediaPlayer和ExoPlayer支持的格式有限,如发现出错或不能播放,请尝试使用ijkplayer解码"
                android:textSize="14sp"
                android:textColor="#000000"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="left"
                android:text="注:其它解码方案的接入请参见demo中的ijkplayer和ExoPlayer的接入示例。"
                android:textSize="14sp"
                android:textColor="#ca113f"/>
        </LinearLayout>
    </ScrollView>

</RelativeLayout>


text:
<?php
/**
 * This file is part of the PHP Open Doc library.
 *
 * @author Jason Morriss <lifo101@gmail.com>
 * @since  1.0
 *
 */
namespace PHPDOC;

use PHPDOC\Element\Section,
    PHPDOC\Element\SectionInterface,
    PHPDOC\Property\Properties,
    PHPDOC\Property\PropertiesInterface,
    PHPDOC\Style\StyleInterface,
    PHPDOC\Style\ParagraphStyle,
    PHPDOC\Style\ParagraphStyleInterface,
    PHPDOC\Style\TextStyle,
    PHPDOC\Style\TextStyleInterface
    ;

/**
 * The Document class is the main object interface that allows you to create a
 * document structure that can be saved using one of the Document\Writer
 * classes.
 *
 * @version 1.0
 * @since 1.0
 * @author Jason Morriss  <lifo101@gmail.com>
 */
class Document implements \IteratorAggregate, \ArrayAccess, \Countable
{
    protected $sections;
    protected $styles;
    protected $defaultStyles;
    protected $currentSection;
    protected $properties;

    public function __construct($properties = null)
    {
        $this->properties = new Properties($properties);
        $this->sections = array();
        $this->styles = array();
        $this->defaultStyles = array();

        // apply default styles, if set ...
        if ($this->properties->has('defaultStyles')) {
            foreach ($this->properties['defaultStyles'] as $k => $v) {
                $method = 'setDefault' . ucfirst(strtolower($k)) . 'Style';
                if (method_exists($this, $method)) {
                    $this->$method($v);
                }
            }
        }
    }

    public function getProperties()
    {
        return $this->properties;
    }

    public function setProperty($key, $value)
    {
        $this->properties[$key] = $value;
        return $this;
    }

    public function setProperties($properties)
    {
        if (is_array($properties)) {
            $properties = new Properties($properties);
        }
        if (!($properties instanceof PropertiesInterface)) {
            $type = gettype($properties);
            if ($type == 'object') {
                $type = get_class($properties);
            }
            throw new \InvalidArgumentException("Unexpected properties type of \"$type\" given. Expected PropertiesInterface or array.");
        }
        $this->properties = $properties;
    }

    public function hasStyles()
    {
        return count($this->styles) > 0;
    }

    public function getStyle($name)
    {
        if (isset($this->styles[$name])) {
            return $this->styles[$name];
        }
        return false;
    }

    public function getStyles()
    {
        return $this->styles;
    }

    public function getDefaultStyles()
    {
        return $this->defaultStyles;
    }

    /**
     * Add a new style to the document
     *
     * @param Style $style The style to add
     */
    public function addStyle(StyleInterface $style)
    {
        $this->styles[ strtolower($style->getId()) ] = $style;
        //$this->styles[ strtolower($style->getName()) ] = $style;
        return $style;
    }

    /**
     * Add a default style to the document
     *
     * Shortcut method that allows the caller to add any default style by
     * passing in the proper StyleInterface object.
     *
     * @param StyleInterface $style A Paragraph or Text style
     */
    public function addDefaultStyle(StyleInterface $style)
    {
        $type = $style->getType();
        $method = 'setDefault' . ucfirst(strtolower($type)) . 'Style';
        if (method_exists($this, $method)) {
            $this->$method($style);
        } else {
            throw new \Exception("Unknown default style type \"$type\" given. Expected \"paragraph\" or \"text\"");
        }
    }

    /**
     * Set the default paragraph style.
     *
     * @param mixed $style An array or PropertiesInterface instance
     */
    public function setDefaultParagraphStyle($style)
    {
        $this->defaultStyles['paragraph'] = new ParagraphStyle('DefaultParagraph',
            $style instanceof StyleInterface ? $style->getProperties() : $style
        );
    }

    /**
     * Set the default text style.
     *
     * @param mixed $style An array or PropertiesInterface instance
     */
    public function setDefaultTextStyle($style)
    {
        $this->defaultStyles['text'] = new TextStyle('DefaultText',
            $style instanceof StyleInterface ? $style->getProperties() : $style
        );
    }

    /**
     * Add a new section to the document
     *
     * All elements in a document are presented within sections (each section
     * is essentially a "Page"; but not strictly).
     *
     * @param mixed $name The section name or an instance of SectionInterface
     */
    public function addSection($name = null, $properties = null)
    {
        if ($name instanceof SectionInterface) {
            $section = $name;
        } else {
            $section = new Section($name, $properties);
        }
        $this->currentSection = $section->getName();
        $this->sections[$this->currentSection] = $section;
        return $section;
    }

    /**
     * Return true if the section exists
     *
     * @param string $name The section name
     */
    public function hasSection($name)
    {
        return array_key_exists($name, $this->sections);
    }

    /**
     * Return all sections.
     */
    public function getSections()
    {
        return $this->sections;
    }

    /**
     * Return a section by name or the current section if no name given.
     *
     * @param string $name The name of the section. Null for current.
     */
    public function getSection($name = null)
    {
        if ($name === null) {
            if ($this->currentSection === null) {
                throw new \OutOfBoundsException('No sections defined');
            }
            $name = $this->currentSection;
        }

        if (!array_key_exists($name, $this->sections)) {
            throw new \OutOfBoundsException("Unknown section name \"$name\"");
        }

        return $this->sections[$name];
    }

    /**
     * Remove a section by name.
     *
     * No exception is thrown if the section name does not exist.
     *
     * @param string $name The section name
     */
    public function removeSection($name)
    {
        unset($this->sections[$name]);
    }

    /**
     * Return an iterator for the elements in the section
     *
     * @internal Implements \IteratorAggregate
     */
    public function getIterator()
    {
        return new \ArrayIterator($this->sections);
    }

    /**
     * Returns the total sections currently defined.
     *
     * @internal Implements \Countable
     */
    public function count()
    {
        return count($this->sections);
    }

    /**
     * Set property by key name
     *
     * @internal Implements \ArrayAccess
     */
    public function offsetSet($ofs, $value)
    {
        if ($value instanceof SectionInterface) {
            if (!empty($ofs)) {
                $value->setName($ofs);
            }
            $this->addSection($value);
        } elseif ($value instanceof StyleInterface) {
            if (!empty($ofs)) {
                $value->setId($ofs);
            }
            $this->addStyle($value);
        } else {
            $type = gettype($value);
            if ($type == 'object') {
                $type = get_class($value);
            }
            throw new \UnexpectedValueException("Assignment value not an instance of \"SectionInterface\". Got \"$type\" instead.");
        }
    }

    /**
     * Determine if property exists by key name
     *
     * @internal Implements \ArrayAccess
     */
    public function offsetExists($ofs)
    {
        return $this->hasSection($ofs);
    }

    /**
     * Remove property by key name
     *
     * @internal Implements \ArrayAccess
     */
    public function offsetUnset($ofs)
    {
        unset($this->sections[$ofs]);
    }

    /**
     * Get property by key name
     *
     * @internal Implements \ArrayAccess
     */
    public function offsetGet($ofs)
    {
        return $this->getSection($ofs);
    }
}


text:
package net.jflask;

import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.Arrays;

import com.sun.net.httpserver.HttpExchange;
import net.jflask.util.IO;
import net.jflask.util.Log;

/**
 * Handles a request submitted by the Context, if compatible with the HTTP
 * method and URI schema.
 *
 * @author pcdv
 */
public class MethodHandler implements Comparable<MethodHandler> {

  private static final String[] EMPTY = {};

  /**
   * The HTTP method
   */
  private final String requestMethod;

  /**
   * The method to invoke to process requests.
   */
  private final Method method;

  /**
   * The object to invoke method on.
   */
  private final Object target;

  /**
   * The split URI, eg. { "hello", ":name" }
   */
  private final String[] tok;

  /**
   * The indexes of variables in split URI, eg. { 1 } to extract "world" from
   * "/hello/world" if URI schema is "/hello/:name"
   */
  private final int[] idx;

  private final String converterName;

  private boolean loginRequired;

  private int splat = -1;

  private final String rootURI;

  private final Context ctx;

  @SuppressWarnings("rawtypes")
  private ResponseConverter converter;

  private final String uri;

  public MethodHandler(Context ctx, String uri, Method method, Object target) {
    this.ctx = ctx;
    this.uri = uri;
    this.rootURI = uri;
    this.requestMethod = initHttpRequest(method);
    this.converterName = initConverterName(method);
    this.method = method;
    this.target = target;
    this.tok = uri.isEmpty() ? EMPTY : uri.substring(1).split("/");
    this.idx = calcIndexes(tok);

    if (method.getAnnotation(LoginPage.class) != null)
      ctx.app.setLoginPage(ctx.getRootURI() + uri);

    configure();

    // hack for being able to call method even if not public or if the class
    // is not public
    if (!method.isAccessible())
      method.setAccessible(true);

    for (Class<?> c : method.getParameterTypes()) {
      if (c != String.class)
        throw new RuntimeException//
                  ("Only String supported in method arguments (for now): " +
                   method);
    }
  }

  private static String initConverterName(Method m) {
    Convert c = m.getAnnotation(Convert.class);
    if (c != null)
      return c.value();

    Route route = m.getAnnotation(Route.class);
    if (route.converter().isEmpty())
      return null;
    return route.converter();
  }

  private static String initHttpRequest(Method m) {
    if (m.getAnnotation(Post.class) != null)
      return "POST";
    if (m.getAnnotation(Put.class) != null)
      return "PUT";
    if (m.getAnnotation(Patch.class) != null)
      return "PATCH";
    if (m.getAnnotation(Delete.class) != null)
      return "DELETE";
    Route route = m.getAnnotation(Route.class);
    return route.method();
  }

  /**
   * Called during construction and when App configuration changes that may
   * require adaptation in handlers.
   */
  public void configure() {
    if (method.getAnnotation(LoginRequired.class) != null)
      loginRequired = true;
    else if (method.getAnnotation(LoginNotRequired.class) != null ||
             method.getAnnotation(LoginPage.class) != null)
      loginRequired = false;
    else
      loginRequired = ctx.app.getRequireLoggedInByDefault();

    if (this.converter == null && converterName != null)
      this.converter = ctx.app.getConverter(converterName);
  }

  private int[] calcIndexes(String[] tok) {
    int[] res = new int[tok.length];
    int j = 0;
    for (int i = 0; i < tok.length; i++) {
      if (tok[i].charAt(0) == ':') {
        if (splat != -1)
          throw new IllegalArgumentException("Invalid route: " + rootURI);
        res[j++] = i;
      }
      if (tok[i].charAt(0) == '*') {
        if (i != tok.length - 1)
          throw new IllegalArgumentException("Invalid route: " + rootURI);
        res[j++] = i;
        splat = i;
      }
    }
    return Arrays.copyOf(res, j);
  }

  /**
   * @return true when request was handled, false when it was ignored (eg. not
   * applicable)
   */
  @SuppressWarnings("unchecked")
  public boolean handle(HttpExchange r,
                        String[] uri,
                        Response resp) throws Exception {

    if (!isApplicable(r, uri))
      return false;

    if (loginRequired && !ctx.app.checkLoggedIn(r)) {
      return true;
    }

    Object[] args = extractArgs(uri);

    if (Log.DEBUG)
      Log.debug("Invoking " + target.getClass().getSimpleName() + "." +
                method.getName() +
                Arrays.toString(args));

    Object res = method.invoke(target, args);

    ctx.app.fireSuccess(method, args, res);

    return processResponse(r, resp, res);
  }

  private boolean processResponse(HttpExchange r,
                                  Response resp,
                                  Object res) throws Exception {
    if (converter != null) {
      converter.convert(res, resp);
    }
    else if (converterName != null) {
      throw new IllegalStateException("Converter '" + converterName +
                                      "' not registered in App.");
    }
    else if (res instanceof CustomResponse) {
      // do nothing: status and headers should already be set
    }
    else if (res instanceof String) {
      r.sendResponseHeaders(200, 0);
      r.getResponseBody().write(((String) res).getBytes("UTF-8"));
    }
    else if (res instanceof byte[]) {
      r.sendResponseHeaders(200, 0);
      r.getResponseBody().write((byte[]) res);
    }
    else if (res instanceof InputStream) {
      r.sendResponseHeaders(200, 0);
      IO.pipe((InputStream) res, r.getResponseBody(), false);
    }
    else
      throw new RuntimeException("Unexpected return value: " + res + " from " +
                                 method.toGenericString());

    return true;
  }

  /**
   * Computes the list of arguments to pass to the decorated method.
   */
  private String[] extractArgs(String[] uri) {
    String[] args = new String[idx.length];
    for (int i = 0; i < args.length; i++) {
      args[i] = uri[idx[i]];
    }
    if (splat != -1) {
      for (int i = splat + 1; i < uri.length; i++) {
        args[args.length - 1] += "/" + uri[i];
      }
    }
    return args;
  }

  /**
   * Checks whether current handler should respond to specified request.
   */
  private boolean isApplicable(HttpExchange r, String[] uri) {
    if (!r.getRequestMethod().equals(this.requestMethod))
      return false;

    if (uri.length != tok.length) {
      if (splat == -1 || uri.length < tok.length)
        return false;
    }

    for (int i = 0; i < tok.length; i++) {
      if (tok[i].charAt(0) != ':' && tok[i].charAt(0) != '*' &&
          !tok[i].equals(uri[i]))
        return false;
    }

    return true;
  }

  public int compareTo(MethodHandler o) {
    if (Arrays.equals(tok, o.tok))
      return requestMethod.compareTo(o.requestMethod);
    return uri.compareTo(o.uri);
  }

  public String getURI() {
    return uri;
  }

  public String getVerb() {
    return requestMethod;
  }

  public Method getMethod() {
    return method;
  }

}


text:
using System;
using FluentAssertions;
using FluentHtml.Html.Tag;
using Xunit;

namespace FluentHtml.Tests.Html
{

    public class LinkTests
    {
        [Fact]
        public void LinkStrongNameTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name<Contact, string>(c => c.Name)
                .Action("Schedule", "Invoice")
                .Text("Testing");

            var html = builder.ToHtmlString();
            html.Should().Be("Testing");
        }

        [Fact]
        public void LinkHtml()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name<Contact, string>(c => c.Name)
                .Action("Schedule", "Invoice")
                .Html("
Testing
");

            var html = builder.ToHtmlString();
            html.Should().Be("
Testing
");
        }

        [Fact]
        public void LinkHtmlEncode()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name<Contact, string>(c => c.Name)
                .Action("Schedule", "Invoice")
                .Text("
Testing
");

            var html = builder.ToHtmlString();
            html.Should().Be("<p>Testing</p>");
        }

        [Fact]
        public void LinkSecureNoAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name("CreditLimit")
                .Action("Schedule", "Invoice")
                .Text("1000")
                .Secure("Finance", "Administrator");

            var html = builder.ToHtmlString();
            html.Should().Be("1000");

        }

        [Fact]
        public void LinkSecureAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper("test.user", new[] { "Finance" });

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name("CreditLimit")
                .Action("Schedule", "Invoice")
                .Text("1000")
                .Secure("Finance", "Administrator");

            var html = builder.ToHtmlString();
            html.Should().Be("1000");

        }

    }
}


text:
///\file

#ifndef ETL_COMPARATOR_IS_TRANSPARENT
#define ETL_COMPARATOR_IS_TRANSPARENT

#include "../type_traits.h"

namespace etl
{
#if ETL_USING_CPP11
  template <typename T, typename = void>
  struct comparator_is_transparent : etl::false_type
  {
  };

  template <typename T>
  struct comparator_is_transparent<T, void_t<typename T::is_transparent>> : etl::true_type
  {
  };
#endif
}

#endif