text:
package batch

// Copyright (c) Microsoft and contributors.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

import (
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/azure"
	"github.com/Azure/go-autorest/autorest/validation"
	"net/http"
)

// ApplicationOperationsClient is the client for the ApplicationOperations
// methods of the Batch service.
type ApplicationOperationsClient struct {
	ManagementClient
}

// NewApplicationOperationsClient creates an instance of the
// ApplicationOperationsClient client.
func NewApplicationOperationsClient(subscriptionID string) ApplicationOperationsClient {
	return NewApplicationOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewApplicationOperationsClientWithBaseURI creates an instance of the
// ApplicationOperationsClient client.
func NewApplicationOperationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationOperationsClient {
	return ApplicationOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// ActivateApplicationPackage activates the specified application package.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. id is the id of the
// application. version is the version of the application to activate.
// parameters is the parameters for the request.
func (client ApplicationOperationsClient) ActivateApplicationPackage(resourceGroupName string, accountName string, id string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: parameters,
			Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "ActivateApplicationPackage")
	}

	req, err := client.ActivateApplicationPackagePreparer(resourceGroupName, accountName, id, version, parameters)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "ActivateApplicationPackage", nil, "Failure preparing request")
	}

	resp, err := client.ActivateApplicationPackageSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "ActivateApplicationPackage", resp, "Failure sending request")
	}

	result, err = client.ActivateApplicationPackageResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "ActivateApplicationPackage", resp, "Failure responding to request")
	}

	return
}

// ActivateApplicationPackagePreparer prepares the ActivateApplicationPackage request.
func (client ApplicationOperationsClient) ActivateApplicationPackagePreparer(resourceGroupName string, accountName string, id string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"id":                autorest.Encode("path", id),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
		"version":           autorest.Encode("path", version),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsJSON(),
		autorest.AsPost(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{id}/versions/{version}/activate", pathParameters),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// ActivateApplicationPackageSender sends the ActivateApplicationPackage request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) ActivateApplicationPackageSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// ActivateApplicationPackageResponder handles the response to the ActivateApplicationPackage request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) ActivateApplicationPackageResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// AddApplication adds an application to the specified Batch account.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application. parameters is the parameters for the request.
func (client ApplicationOperationsClient) AddApplication(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (result Application, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "AddApplication")
	}

	req, err := client.AddApplicationPreparer(resourceGroupName, accountName, applicationID, parameters)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplication", nil, "Failure preparing request")
	}

	resp, err := client.AddApplicationSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplication", resp, "Failure sending request")
	}

	result, err = client.AddApplicationResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplication", resp, "Failure responding to request")
	}

	return
}

// AddApplicationPreparer prepares the AddApplication request.
func (client ApplicationOperationsClient) AddApplicationPreparer(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsJSON(),
		autorest.AsPut(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	if parameters != nil {
		preparer = autorest.DecoratePreparer(preparer,
			autorest.WithJSON(parameters))
	}
	return preparer.Prepare(&http.Request{})
}

// AddApplicationSender sends the AddApplication request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) AddApplicationSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// AddApplicationResponder handles the response to the AddApplication request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) AddApplicationResponder(resp *http.Response) (result Application, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// AddApplicationPackage creates an application package record.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application. version is the version of the application.
func (client ApplicationOperationsClient) AddApplicationPackage(resourceGroupName string, accountName string, applicationID string, version string) (result AddApplicationPackageResult, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "AddApplicationPackage")
	}

	req, err := client.AddApplicationPackagePreparer(resourceGroupName, accountName, applicationID, version)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplicationPackage", nil, "Failure preparing request")
	}

	resp, err := client.AddApplicationPackageSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplicationPackage", resp, "Failure sending request")
	}

	result, err = client.AddApplicationPackageResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "AddApplicationPackage", resp, "Failure responding to request")
	}

	return
}

// AddApplicationPackagePreparer prepares the AddApplicationPackage request.
func (client ApplicationOperationsClient) AddApplicationPackagePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
		"version":           autorest.Encode("path", version),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsPut(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// AddApplicationPackageSender sends the AddApplicationPackage request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) AddApplicationPackageSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// AddApplicationPackageResponder handles the response to the AddApplicationPackage request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) AddApplicationPackageResponder(resp *http.Response) (result AddApplicationPackageResult, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// DeleteApplication deletes an application.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application.
func (client ApplicationOperationsClient) DeleteApplication(resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "DeleteApplication")
	}

	req, err := client.DeleteApplicationPreparer(resourceGroupName, accountName, applicationID)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplication", nil, "Failure preparing request")
	}

	resp, err := client.DeleteApplicationSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplication", resp, "Failure sending request")
	}

	result, err = client.DeleteApplicationResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplication", resp, "Failure responding to request")
	}

	return
}

// DeleteApplicationPreparer prepares the DeleteApplication request.
func (client ApplicationOperationsClient) DeleteApplicationPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// DeleteApplicationSender sends the DeleteApplication request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) DeleteApplicationSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// DeleteApplicationResponder handles the response to the DeleteApplication request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) DeleteApplicationResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// DeleteApplicationPackage deletes an application package record and its
// associated binary file.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application. version is the version of the application to
// delete.
func (client ApplicationOperationsClient) DeleteApplicationPackage(resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "DeleteApplicationPackage")
	}

	req, err := client.DeleteApplicationPackagePreparer(resourceGroupName, accountName, applicationID, version)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplicationPackage", nil, "Failure preparing request")
	}

	resp, err := client.DeleteApplicationPackageSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplicationPackage", resp, "Failure sending request")
	}

	result, err = client.DeleteApplicationPackageResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "DeleteApplicationPackage", resp, "Failure responding to request")
	}

	return
}

// DeleteApplicationPackagePreparer prepares the DeleteApplicationPackage request.
func (client ApplicationOperationsClient) DeleteApplicationPackagePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
		"version":           autorest.Encode("path", version),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// DeleteApplicationPackageSender sends the DeleteApplicationPackage request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) DeleteApplicationPackageSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// DeleteApplicationPackageResponder handles the response to the DeleteApplicationPackage request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) DeleteApplicationPackageResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// GetApplication gets information about the specified application.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application.
func (client ApplicationOperationsClient) GetApplication(resourceGroupName string, accountName string, applicationID string) (result Application, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "GetApplication")
	}

	req, err := client.GetApplicationPreparer(resourceGroupName, accountName, applicationID)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplication", nil, "Failure preparing request")
	}

	resp, err := client.GetApplicationSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplication", resp, "Failure sending request")
	}

	result, err = client.GetApplicationResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplication", resp, "Failure responding to request")
	}

	return
}

// GetApplicationPreparer prepares the GetApplication request.
func (client ApplicationOperationsClient) GetApplicationPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// GetApplicationSender sends the GetApplication request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) GetApplicationSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// GetApplicationResponder handles the response to the GetApplication request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) GetApplicationResponder(resp *http.Response) (result Application, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// GetApplicationPackage gets information about the specified application
// package.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application. version is the version of the application.
func (client ApplicationOperationsClient) GetApplicationPackage(resourceGroupName string, accountName string, applicationID string, version string) (result GetApplicationPackageResult, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "GetApplicationPackage")
	}

	req, err := client.GetApplicationPackagePreparer(resourceGroupName, accountName, applicationID, version)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplicationPackage", nil, "Failure preparing request")
	}

	resp, err := client.GetApplicationPackageSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplicationPackage", resp, "Failure sending request")
	}

	result, err = client.GetApplicationPackageResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "GetApplicationPackage", resp, "Failure responding to request")
	}

	return
}

// GetApplicationPackagePreparer prepares the GetApplicationPackage request.
func (client ApplicationOperationsClient) GetApplicationPackagePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
		"version":           autorest.Encode("path", version),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// GetApplicationPackageSender sends the GetApplicationPackage request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) GetApplicationPackageSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// GetApplicationPackageResponder handles the response to the GetApplicationPackage request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) GetApplicationPackageResponder(resp *http.Response) (result GetApplicationPackageResult, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// List lists all of the applications in the specified account.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. maxresults is the
// maximum number of items to return in the response.
func (client ApplicationOperationsClient) List(resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResult, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "List")
	}

	req, err := client.ListPreparer(resourceGroupName, accountName, maxresults)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", nil, "Failure preparing request")
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure sending request")
	}

	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure responding to request")
	}

	return
}

// ListPreparer prepares the List request.
func (client ApplicationOperationsClient) ListPreparer(resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}
	if maxresults != nil {
		queryParameters["maxresults"] = autorest.Encode("query", *maxresults)
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// ListNextResults retrieves the next set of results, if any.
func (client ApplicationOperationsClient) ListNextResults(lastResults ListApplicationsResult) (result ListApplicationsResult, err error) {
	req, err := lastResults.ListApplicationsResultPreparer()
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", nil, "Failure preparing next results request")
	}
	if req == nil {
		return
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure sending next results request")
	}

	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "List", resp, "Failure responding to next results request")
	}

	return
}

// UpdateApplication updates settings for the specified application.
//
// resourceGroupName is the name of the resource group that contains the Batch
// account. accountName is the name of the Batch account. applicationID is
// the id of the application. parameters is the parameters for the request.
func (client ApplicationOperationsClient) UpdateApplication(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (result autorest.Response, err error) {
	if err := validation.Validate([]validation.Validation{
		{TargetValue: resourceGroupName,
			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}},
		{TargetValue: accountName,
			Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
				{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
				{Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
		return result, validation.NewErrorWithValidationError(err, "batch.ApplicationOperationsClient", "UpdateApplication")
	}

	req, err := client.UpdateApplicationPreparer(resourceGroupName, accountName, applicationID, parameters)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "UpdateApplication", nil, "Failure preparing request")
	}

	resp, err := client.UpdateApplicationSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "UpdateApplication", resp, "Failure sending request")
	}

	result, err = client.UpdateApplicationResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "batch.ApplicationOperationsClient", "UpdateApplication", resp, "Failure responding to request")
	}

	return
}

// UpdateApplicationPreparer prepares the UpdateApplication request.
func (client ApplicationOperationsClient) UpdateApplicationPreparer(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"accountName":       autorest.Encode("path", accountName),
		"applicationId":     autorest.Encode("path", applicationID),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsJSON(),
		autorest.AsPatch(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// UpdateApplicationSender sends the UpdateApplication request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationOperationsClient) UpdateApplicationSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// UpdateApplicationResponder handles the response to the UpdateApplication request. The method always
// closes the http.Response Body.
func (client ApplicationOperationsClient) UpdateApplicationResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}


text:
    Login

Sign in to start your session

      <button type="button" class="close" aria-label="Close" ng-click="dismissError()">×</button>
    {{error}}

      <button type="button" class="close" aria-label="Close" ng-click="dismissSuccess()">×</button>
    {{message}}

    <form name="loginForm">

        <input type="email" class="form-control" ng-model="user.email" name="email" placeholder="Email" required>

        <input type="password" class="form-control" ng-model="user.password" name="password" placeholder="Password">

            <button ng-click="login(user)" class="btn btn-primary btn-block">Login</button>
            <button ng-click="resetPassword(user.email)" class="btn btn-default btn-block" ng-if="showReset">Reset password</button>

    </form>

Register a new account

            Resend account verification email

        SCIONLab Topology

redpajama_set_name: RedPajamaGithub


text:
namespace syncer {
namespace syncable {

struct EntryKernel;
class ParentChildIndex;

// A node ordering function.
struct ChildComparator {
  bool operator()(const EntryKernel* a, const EntryKernel* b) const;
};

// An ordered set of nodes.
typedef std::set<EntryKernel*, ChildComparator> OrderedChildSet;
typedef std::shared_ptr<OrderedChildSet> OrderedChildSetRef;

// Container that tracks parent-child relationships.
// Provides fast lookup of all items under a given parent.
class ParentChildIndex {
 public:
  ParentChildIndex();
  ~ParentChildIndex();

  // Returns whether or not this entry belongs in the index.
  // True for all non-deleted, non-root entries.
  static bool ShouldInclude(const EntryKernel* e);

  // Inserts a given child into the index.
  bool Insert(EntryKernel* e);

  // Removes a given child from the index.
  void Remove(EntryKernel* e);

  // Returns true if this item is in the index as a child.
  bool Contains(EntryKernel* e) const;

  // Returns all children of the entry with the given Id.  Returns null if the
  // node has no children or the Id does not identify a valid directory node.
  const OrderedChildSet* GetChildren(const Id& id) const;

  // Returns all children of the entry.  Returns null if the node has no
  // children.
  const OrderedChildSet* GetChildren(EntryKernel* e) const;

  // Returns all siblings of the entry.
  const OrderedChildSet* GetSiblings(EntryKernel* e) const;

 private:
  friend class ParentChildIndexTest;

  typedef std::map<Id, OrderedChildSetRef> ParentChildrenMap;
  typedef std::vector<Id> TypeRootIds;
  typedef std::vector<OrderedChildSetRef> TypeRootChildSets;

  static bool ShouldUseParentId(const Id& parent_id, ModelType model_type);

  // Returns OrderedChildSet that should contain the specified entry
  // based on the entry's Parent ID or model type.
  const OrderedChildSetRef GetChildSet(EntryKernel* e) const;

  // Returns OrderedChildSet that contain entries of the |model_type| type.
  const OrderedChildSetRef GetModelTypeChildSet(ModelType model_type) const;

  // Returns mutable OrderedChildSet that contain entries of the |model_type|
  // type. Create one as necessary.
  OrderedChildSetRef GetOrCreateModelTypeChildSet(ModelType model_type);

  // Returns previously cached model type root ID for the given |model_type|.
  const Id& GetModelTypeRootId(ModelType model_type) const;

  // A map of parent IDs to children.
  // Parents with no children are not included in this map.
  ParentChildrenMap parent_children_map_;

  // This array tracks model type roots IDs.
  TypeRootIds model_type_root_ids_;

  // This array contains pre-defined child sets for
  // non-hierarchical types (types with flat hierarchy) that support entries
  // with implicit parent.
  TypeRootChildSets type_root_child_sets_;

  DISALLOW_COPY_AND_ASSIGN(ParentChildIndex);
};

}  // namespace syncable
}  // namespace syncer

#endif  // COMPONENTS_SYNC_SYNCABLE_PARENT_CHILD_INDEX_H_


text: module.exports = require("./../../_gen/openfl/media/SoundTransform");


text:
package linuxcalls

import (
	"net"

	"github.com/vishvananda/netlink"
	"github.com/vishvananda/netns"
)

// NetlinkAPI interface covers all methods inside linux calls package
// needed to manage linux interfaces.
type NetlinkAPI interface {
	NetlinkAPIWrite
	NetlinkAPIRead
}

// NetlinkAPIWrite interface covers write methods inside linux calls package
// needed to manage linux interfaces.
type NetlinkAPIWrite interface {
	// AddVethInterfacePair configures two connected VETH interfaces
	AddVethInterfacePair(ifName, peerIfName string) error
	// DeleteInterface removes the given interface.
	DeleteInterface(ifName string) error
	// SetInterfaceUp sets interface state to 'up'
	SetInterfaceUp(ifName string) error
	// SetInterfaceDown sets interface state to 'down'
	SetInterfaceDown(ifName string) error
	// AddInterfaceIP adds new IP address
	AddInterfaceIP(ifName string, addr *net.IPNet) error
	// DelInterfaceIP removes IP address from linux interface
	DelInterfaceIP(ifName string, addr *net.IPNet) error
	// SetInterfaceMac sets MAC address
	SetInterfaceMac(ifName string, macAddress string) error
	// SetInterfaceMTU set maximum transmission unit for interface
	SetInterfaceMTU(ifName string, mtu int) error
	// RenameInterface changes interface host name
	RenameInterface(ifName string, newName string) error
	// SetInterfaceAlias sets the alias of the given interface.
	// Equivalent to: `ip link set dev $ifName alias $alias`
	SetInterfaceAlias(ifName, alias string) error
	// SetLinkNamespace puts link into a network namespace.
	SetLinkNamespace(link netlink.Link, ns netns.NsHandle) error
	// SetChecksumOffloading enables/disables Rx/Tx checksum offloading
	// for the given interface.
	SetChecksumOffloading(ifName string, rxOn, txOn bool) error
}

// NetlinkAPIRead interface covers read methods inside linux calls package
// needed to manage linux interfaces.
type NetlinkAPIRead interface {
	// GetLinkByName returns netlink interface type
	GetLinkByName(ifName string) (netlink.Link, error)
	// GetLinkList return all links from namespace
	GetLinkList() ([]netlink.Link, error)
	// LinkSubscribe takes a channel to which notifications will be sent
	// when links change. Close the 'done' chan to stop subscription.
	LinkSubscribe(ch chan<- netlink.LinkUpdate, done <-chan struct{}) error
	// GetAddressList reads all IP addresses
	GetAddressList(ifName string) ([]netlink.Addr, error)
	// InterfaceExists verifies interface existence
	InterfaceExists(ifName string) (bool, error)
	// IsInterfaceUp checks if the interface is UP.
	IsInterfaceUp(ifName string) (bool, error)
	// GetInterfaceType returns linux interface type
	GetInterfaceType(ifName string) (string, error)
	// GetChecksumOffloading returns the state of Rx/Tx checksum offloading
	// for the given interface.
	GetChecksumOffloading(ifName string) (rxOn, txOn bool, err error)
}

// NetLinkHandler is accessor for Netlink methods.
type NetLinkHandler struct {
}

// NewNetLinkHandler creates new instance of Netlink handler.
func NewNetLinkHandler() *NetLinkHandler {
	return &NetLinkHandler{}
}


text:
SRCS[] =
    cassandra_consts.ml
    Cassandra.ml
    Cassandra.mli
    cassandra_types.ml
    cassandra_types.mli

OBJS[] =
    cassandra_types
    cassandra_consts
    Cassandra

OCAMLINCLUDES = $(file thrift)

OCamlPackage(cassandra_thrift, \
	     $(removesuffix $(ls thrift/*.ml)) \
	     $(addprefix gen-ocaml/, $(OBJS)))

OCamlLibrary(cassandra, cassandra_thrift cassandra cassandra_lwt)

$(addsuffixes .cmx .cmo .cmi .o, cassandra): cassandra_thrift.cmi

section
    OCAMLPACKS[] += camlp4.macro
    OCAMLFINDFLAGS += -syntax camlp4o -ppopt $(DEFINES)
    cassandra.cmi cassandra.cmx cassandra.cmo cassandra.o:

section
    OCAMLPACKS[] += lwt.syntax
    OCAMLFINDFLAGS += -syntax camlp4o
    cassandra_lwt.cmi cassandra_lwt.cmx cassandra_lwt.cmo cassandra_lwt.o: \
	cassandra.cmi cassandra.cmx

.DEFAULT: cassandra.cma cassandra.cmxa

.SUBDIRS: gen-ocaml
    OCAMLFLAGS += -for-pack Cassandra_thrift
    # not detected for some reason, quick workaround
    Cassandra.cmi: cassandra_types.cmi cassandra_types.cmx
    cassandra_consts.cmi: cassandra_types.cmi

.SUBDIRS: thrift
    OCAMLFLAGS += -for-pack Cassandra_thrift

.PHONY: clean

clean:
    rm -f $(filter-proper-targets $(ls R, .)) *.annot *.s


text:
module Pact
  module MockService
    module ControlServer

      class Delegator

        HTTP_X_PACT_CONSUMER = 'HTTP_X_PACT_CONSUMER'.freeze
        HTTP_X_PACT_PROVIDER = 'HTTP_X_PACT_PROVIDER'.freeze
        PACT_MOCK_SERVICE_HEADER = {'HTTP_X_PACT_MOCK_SERVICE' => 'true'}.freeze
        NOT_FOUND_RESPONSE = [404, {}, []].freeze

        def initialize app, consumer_name, provider_name
          @app = app
          @consumer_name = consumer_name
          @provider_name = provider_name
        end

        def call env
          return NOT_FOUND_RESPONSE unless consumer_and_provider_headers_match?(env)
          delegate env
        end

        def shutdown
          @app.shutdown
        end

        private

        def consumer_and_provider_headers_match? env
          env[HTTP_X_PACT_CONSUMER] == @consumer_name && env[HTTP_X_PACT_PROVIDER] == @provider_name
        end

        def delegate env
          @app.call(env.merge(PACT_MOCK_SERVICE_HEADER))
        end
      end
    end
  end
end


text:
package org.camelcookbook.rest.binding;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
import java.io.StringWriter;

public class BindingModeTest extends CamelTestSupport {
    private final int port1 = AvailablePortFinder.getNextAvailable();

    private ObjectWriter objectWriter = new ObjectMapper().writer();

    private ItemService getItemService() {
        return context().getRegistry().lookupByNameAndType("itemService", ItemService.class);
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        final JndiRegistry registry = super.createRegistry();

        registry.bind("itemService", new ItemService());

        return registry;
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new BindingModeRoute(port1);
    }

    @Test
    public void testGetMany() throws Exception {
        final Item[] origItems = getItemService().getItems();
        final String origItemsJson = objectWriter.writeValueAsString(origItems);

        String outJson = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items")
                .withHeader(Exchange.HTTP_METHOD, "GET")
                .withHeader("Accept", "application/json")
                .request(String.class);

        assertEquals(origItemsJson, outJson);
    }

    @Test
    public void testGetOne() throws Exception {
        final Item origItem = getItemService().getItem(0);
        final String origItemJson = objectWriter.writeValueAsString(origItem);

        String outJson = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0")
                .withHeader(Exchange.HTTP_METHOD, "GET")
                .withHeader("Accept", "application/json")
                .request(String.class);

        assertEquals(origItemJson, outJson);

        String outXml = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0")
                .withHeader(Exchange.HTTP_METHOD, "GET")
                .withHeader("Accept", "application/xml")
                .request(String.class);

        JAXBContext jaxbContext = JAXBContext.newInstance(Item.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

        Item itemOut = (Item) jaxbUnmarshaller.unmarshal(new StringReader(outXml));

        assertEquals(origItem, itemOut);
    }

    @Test
    public void testGetOneJson() throws Exception {
        final String origValue = objectWriter.writeValueAsString(getItemService().getItem(0));

        String out = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0/json")
                .withHeader(Exchange.HTTP_METHOD, "GET")
                .request(String.class);

        assertEquals(origValue, out);
    }

    @Test
    public void testGetOneXml() throws Exception {
        final Item origItem = getItemService().getItem(0);

        String out = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0/xml")
                .withHeader(Exchange.HTTP_METHOD, "GET")
                .request(String.class);

        JAXBContext jaxbContext = JAXBContext.newInstance(Item.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

        Item itemOut = (Item) jaxbUnmarshaller.unmarshal(new StringReader(out));

        assertEquals(origItem, itemOut);
    }

    @Test
    public void testSetOneJson() throws Exception {
        Item item = getItemService().getItem(0);

        // change name to something different
        item.setName(item.getName() + "Foo");

        final String jsonItem = objectWriter.writeValueAsString(item);

        String out = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0")
                .withHeader(Exchange.HTTP_METHOD, "PUT")
                .withBody(jsonItem)
                .request(String.class);

        assertEquals(item, getItemService().getItem(0));
    }

    @Test
    public void testSetOneXml() throws Exception {
        final Item item = getItemService().getItem(0);

        // change name to something different
        item.setName(item.getName() + "Foo");

        JAXBContext jaxbContext = JAXBContext.newInstance(Item.class);
        Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
        StringWriter sw = new StringWriter();

        jaxbMarshaller.marshal(item, sw);

        String xmlItem = sw.toString();

        String out = fluentTemplate().to("undertow:http://localhost:" + port1 + "/items/0")
                .withHeader(Exchange.HTTP_METHOD, "PUT")
                .withBody(xmlItem)
                .request(String.class);

        assertEquals(item, getItemService().getItem(0));
    }
}


text:
import { AsyncScheduler } from './AsyncScheduler';
export declare class AsapScheduler extends AsyncScheduler {
    flush(): void;
}


text:
.content {
  color: inherit;
  display: flex;
}


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

  <TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:text="Hello, Smuggler"
    android:textSize="48dp"/>

</FrameLayout>


text:
package io.getlime.security.powerauth.lib.nextstep.model.response;

import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * Response object used for looking operations by external transaction ID.
 *
 * @author Roman Strobl, roman.strobl@wultra.com
 */
@Data
public class LookupOperationsByExternalIdResponse {

    @NotNull
    private final List<GetOperationDetailResponse> operations = new ArrayList<>();

}


text:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../test/dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'

ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')

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

RSpec.configure do |config|
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{ENGINE_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

  # If true, the base class of anonymous controllers will be inferred
  # automatically. This will be the default behavior in future versions of
  # rspec-rails.
  config.infer_base_class_for_anonymous_controllers = false

  # Include Engine routes (needed for Controller specs)
  config.include CatarsePaypalAdaptive::Engine.routes.url_helpers

  config.before(:each) do
    PaymentEngines.stub(:configuration).and_return({})
  end
end

def fixture_file(filename)
  return nil if filename.nil?
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
  File.read(file_path)
end

def paypal_setup_purchase_success_response
  { "timestamp"=>"2012-07-23T00:24:21Z", "ack"=>"Success", "correlation_id"=>"dcb8596be51cd", "version"=>"62.0", "build"=>"3332236",
    "token"=>"EC-49X25168KR2556548", "Timestamp"=>"2012-07-23T00:24:21Z", "Ack"=>"Success", "CorrelationID"=>"dcb8596be51cd",
    "Version"=>"62.0", "Build"=>"3332236", "Token"=>"EC-49X25168KR2556548" }
end

def paypal_details_response
  {
    "transaction_id" => "1234",
    "checkout_status" => "PaymentActionCompleted",
    "payment_status" => 'Completed'
  }
end

def paypal_details_response_refunded
  {
    "transaction_id" => "1234",
    "checkout_status" => "PaymentActionCompleted",
    "payment_status" => 'Refunded'
  }
end


text:
package com.cerner.beadledom.client.proxy;

import com.cerner.beadledom.jaxrs.DelegatingGenericResponse;
import com.cerner.beadledom.jaxrs.GenericResponse;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;

/**
 * A JAX-RS resource class proxy implementation with support for {@link GenericResponse}.
 *
 * @author John Leacox
 * @since 2.0
 * @deprecated As of 3.6, use Retrofit (https://github.com/square/retrofit) instead.
 */
@Deprecated
class GenericClientProxy implements InvocationHandler {
  private final Object underlying;

  GenericClientProxy(Object underlying) {
    this.underlying = underlying;
  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    Method underlyingMethod = underlying.getClass().getInterfaces()[0]
        .getMethod(method.getName(), method.getParameterTypes());

    Class<?> returnType = method.getReturnType();
    if (GenericResponse.class.isAssignableFrom(returnType)) {
      Response response;
      try {
        response = (Response) underlyingMethod.invoke(underlying, args);
      } catch (InvocationTargetException e) {
        throw e.getCause();
      }

      return buildGenericResponse(method, response);
    }

    try {
      return underlyingMethod.invoke(underlying, args);
    } catch (InvocationTargetException e) {
      throw e.getCause();
    }
  }

  private Object buildGenericResponse(Method method, Response response) {
    int code = response.getStatus();
    Object entity = null;
    if (!(code < 200 || code >= 300) && response.hasEntity()) {
      ParameterizedType genericReturnType = (ParameterizedType) method.getGenericReturnType();
      Type bodyType = genericReturnType.getActualTypeArguments()[0];

      entity = response.readEntity(new GenericType(bodyType));
    }

    return DelegatingGenericResponse.create(entity, response);
  }
}


text:
namespace rm.ExtensionsTest.Sample
{
	public class SampleClass
	{
		public ComparableClass2 ComparableClass2 { get; set; }
	}
}


text:
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports System.Collections.Immutable
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.UseObjectInitializer
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.UseObjectInitializer
    <ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeFixProviderNames.UseObjectInitializer), [Shared]>
    Friend Class VisualBasicUseObjectInitializerCodeFixProvider
        Inherits AbstractUseObjectInitializerCodeFixProvider(Of
            SyntaxKind,
            ExpressionSyntax,
            StatementSyntax,
            ObjectCreationExpressionSyntax,
            MemberAccessExpressionSyntax,
            AssignmentStatementSyntax,
            VariableDeclaratorSyntax)

        <ImportingConstructor>
        Public Sub New()
        End Sub

        Protected Overrides Function GetNewStatement(
                statement As StatementSyntax, objectCreation As ObjectCreationExpressionSyntax,
                matches As ImmutableArray(Of Match(Of ExpressionSyntax, StatementSyntax, MemberAccessExpressionSyntax, AssignmentStatementSyntax))) As StatementSyntax
            Dim newStatement = statement.ReplaceNode(
                objectCreation,
                GetNewObjectCreation(objectCreation, matches))

            Dim totalTrivia = ArrayBuilder(Of SyntaxTrivia).GetInstance()
            totalTrivia.AddRange(statement.GetLeadingTrivia())
            totalTrivia.Add(SyntaxFactory.ElasticMarker)

            For Each match In matches
                For Each trivia In match.Statement.GetLeadingTrivia()
                    If trivia.Kind = SyntaxKind.CommentTrivia Then
                        totalTrivia.Add(trivia)
                        totalTrivia.Add(SyntaxFactory.ElasticMarker)
                    End If
                Next
            Next

            Return newStatement.WithLeadingTrivia(totalTrivia)
        End Function

        Private Function GetNewObjectCreation(
                objectCreation As ObjectCreationExpressionSyntax,
                matches As ImmutableArray(Of Match(Of ExpressionSyntax, StatementSyntax, MemberAccessExpressionSyntax, AssignmentStatementSyntax))) As ObjectCreationExpressionSyntax

            Return UseInitializerHelpers.GetNewObjectCreation(
                objectCreation,
                SyntaxFactory.ObjectMemberInitializer(
                    CreateFieldInitializers(matches)))
        End Function

        Private Function CreateFieldInitializers(
                matches As ImmutableArray(Of Match(Of ExpressionSyntax, StatementSyntax, MemberAccessExpressionSyntax, AssignmentStatementSyntax))) As SeparatedSyntaxList(Of FieldInitializerSyntax)
            Dim nodesAndTokens = New List(Of SyntaxNodeOrToken)

            For i = 0 To matches.Length - 1
                Dim match = matches(i)

                Dim rightValue = match.Initializer
                If i < matches.Length - 1 Then
                    rightValue = rightValue.WithoutTrailingTrivia()
                End If

                Dim initializer = SyntaxFactory.NamedFieldInitializer(
                    keyKeyword:=Nothing,
                    dotToken:=match.MemberAccessExpression.OperatorToken,
                    name:=SyntaxFactory.IdentifierName(match.MemberName),
                    equalsToken:=match.Statement.OperatorToken,
                    expression:=rightValue).WithPrependedLeadingTrivia(SyntaxFactory.ElasticMarker)

                nodesAndTokens.Add(initializer)
                If i < matches.Length - 1 Then
                    Dim comma = SyntaxFactory.Token(SyntaxKind.CommaToken).
                                              WithTrailingTrivia(match.Initializer.GetTrailingTrivia())
                    nodesAndTokens.Add(comma)
                End If
            Next

            Return SyntaxFactory.SeparatedList(Of FieldInitializerSyntax)(nodesAndTokens)
        End Function
    End Class
End Namespace


text:
angular.module('repository').factory('reportRepository', ['$http', function ($http) {

    var urlBase = 'api/report/';
    var repo = {};

    repo.getIdToNameMappings = function() {
        return $http.get(urlBase + 'idToNameMappings');
    }

    return repo;
}]);


text:
import os
import pytest
from django.urls import reverse

from seahub.options.models import (UserOptions, KEY_FORCE_2FA, VAL_FORCE_2FA)
from seahub.test_utils import BaseTestCase
from seahub.two_factor.models import TOTPDevice, devices_for_user

TRAVIS = 'TRAVIS' in os.environ

@pytest.mark.skipif(TRAVIS, reason="")
class TwoFactorAuthViewTest(BaseTestCase):
    def setUp(self):
        self.login_as(self.admin)

    def test_can_disable_two_factor_auth(self):
        totp = TOTPDevice(user=self.admin, name="", confirmed=1)
        totp.save()

        devices = devices_for_user(self.admin)
        i = 0
        for device in devices_for_user(self.admin):
            if device:
                i+=1
        assert i > 0
        resp = self.client.delete(reverse('two-factor-auth-view', args=[str(self.admin.username)]))
        assert resp.status_code == 200
        i = 0
        for device in devices_for_user(self.admin):
            if device:
                i+=1
        assert i == 0

    def tearDown(self):
        try:
            for device in devices_for_user(self.admin):
                device.delete()
        except:
            pass

    def test_force_2fa(self):
        assert len(UserOptions.objects.filter(email=self.user.email,
                                              option_key=KEY_FORCE_2FA)) == 0

        resp = self.client.put(
            reverse('two-factor-auth-view', args=[self.user.username]),
            'force_2fa=1',
            'application/x-www-form-urlencoded',
        )
        self.assertEqual(200, resp.status_code)

        assert len(UserOptions.objects.filter(email=self.user.email,
                                              option_key=KEY_FORCE_2FA)) == 1

        resp = self.client.put(
            reverse('two-factor-auth-view', args=[self.user.username]),
            'force_2fa=0',
            'application/x-www-form-urlencoded',
        )
        self.assertEqual(200, resp.status_code)

        assert len(UserOptions.objects.filter(email=self.user.email,
                                              option_key=KEY_FORCE_2FA)) == 0


text:
package ion.net.common.db.utils;

import ion.net.common.db.DaoFactory;
import ion.net.common.db.PackageService;
import ion.net.common.db.Sample;
import ion.net.common.db.SampleDao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.esotericsoftware.reflectasm.ConstructorAccess;
import com.esotericsoftware.reflectasm.FieldAccess;
import com.esotericsoftware.reflectasm.MethodAccess;

@Slf4j
@Controller
public class CreatePkgController extends AbstractController {

	@Autowired DataSource dataSource;

	@Override
	@RequestMapping(value = "/createpkg.do")
	protected ModelAndView handleRequestInternal(
			HttpServletRequest request,
			HttpServletResponse response) {

		Class clazz = dataSource.getClass();
		MethodAccess ma = MethodAccess.get(clazz);
//		for(String s : ma.getMethodNames())
//			log.debug(s);

		// String s = (String) ma.invoke(dataSource, "getPassword", null);
		// log.debug(s);

		// PackageService.getPackage("sample_pkg", dataSource, false);
		PackageService.setDataSource(dataSource);
		SampleDao sampleDao = DaoFactory.getDao(SampleDao.class);

		clazz = sampleDao.getClass();
		ma = MethodAccess.get(clazz);
		for(String s : ma.getMethodNames())
			log.debug(s);

		log.debug("sampleDao : "+sampleDao);
		String id = "10";
		List<Sample> ret = sampleDao.retrieveBy(id);
		log.debug("ret.size() : "+ret);
//		for(Sample s1 : ret) {
//			log.debug(s1.getDescription());
//		}

		Connection con = null ;
		PreparedStatement pstmt = null ;
		ResultSet rs_cont = null ;

		String pkg_header = "" ;
		String pkg_body = "" ;

		ModelAndView mv = new ModelAndView("/sample/createpkg") ;
		try {
			if(null == request.getParameter("table_name") || ("").equals(request.getParameter("table_name"))){
				mv.addObject("pkg_header", null) ;
				mv.addObject("pkg_body", null) ;
				return mv ;
			}else if(null == request.getParameter("table_pk") || ("").equals(request.getParameter("table_pk"))){
				mv.addObject("pkg_header", null) ;
				mv.addObject("pkg_body", null) ;
				return mv ;
			}else if(null == request.getParameter("pkg_nm") || ("").equals(request.getParameter("pkg_nm"))){
				mv.addObject("pkg_header", null) ;
				mv.addObject("pkg_body", null) ;
				return mv ;
			}

			String table_name = request.getParameter("table_name").toUpperCase() ; //Table Name. 파라미터로 받을 것
			String table_pk = request.getParameter("table_pk") ;	//Table Primary Key. 콤마(,) 구분. 파라미터로 받을 것
			String pkg_nm = request.getParameter("pkg_nm").toUpperCase() ;	//Package Name. 파리미터로 받을 것

			CreatePkgController cop = new CreatePkgController() ;

			StringBuffer query = new StringBuffer(" SELECT COLUMN_NAME, DATA_TYPE \n")
			.append(" FROM USER_TAB_COLUMNS \n")
			.append(" WHERE TABLE_NAME = ? order by column_id") ;

			con = dataSource.getConnection();
			pstmt = con.prepareStatement(query.toString()) ;
			pstmt.setString(1, table_name) ;

		// log.debug("getNumActive : "+ma.invoke(dataSource, "getNumActive", null));
		// log.debug("getNumIdle : "+ma.invoke(dataSource, "getNumIdle", null));

			rs_cont = pstmt.executeQuery() ;

			List<String> lsCol = new ArrayList<String>() ;
			List<String> lsDataType = new ArrayList<String>() ;

			while(rs_cont.next()){
				lsCol.add(rs_cont.getString("COLUMN_NAME")) ;
				lsDataType.add(rs_cont.getString("DATA_TYPE")) ;
			}
			String declareHeaderStr = "CREATE OR REPLACE PACKAGE "+pkg_nm+" IS\n";
			String declareBodyStr = "CREATE OR REPLACE PACKAGE BODY "+pkg_nm+" IS\n" ;
			String endStr = "END "+pkg_nm+";"+"\n/";

			Date now = new Date();
			SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");

			//Package Header
			StringBuffer resultHeader = new StringBuffer(declareHeaderStr)
			.append(cop.pkgHeader(lsCol, lsDataType, table_pk))
			.append(endStr) ;

			System.out.println("Package Header");
			System.out.println("---------------------------------------------------------------------------------------------");
			System.out.println(resultHeader) ;
			System.out.println("---------------------------------------------------------------------------------------------");

			//Package Body
			StringBuffer resultBody = new StringBuffer(declareBodyStr)
			.append("/******************************************************************************\n")
			.append("\t작성자   : 작성자이름\n")
			.append("\t내용     : 개발자 배포용 샘플 trigger\n")
			.append("\t테이블   : ")
			.append(table_name.toUpperCase())
			.append("\n")
			.append("\t변경내역 : \n")
			.append("\t-- ")
			.append(format.format(now)+" : 최초 작성(작성자 이름)\n")
			.append("******************************************************************************/\n\n")

			.append(cop.pkgBody(table_name, lsCol, lsDataType, table_pk))
			.append(endStr) ;

			System.out.println("Package Body");
			System.out.println("---------------------------------------------------------------------------------------------");
			System.out.println(resultBody) ;

			pkg_header = resultHeader.toString() ;
			pkg_body = resultBody.toString() ;

			pstmt.close() ;
			con.close() ;

		} catch (Exception e){
			e.printStackTrace();
		} finally {
		}
		mv.addObject("pkg_header", pkg_header) ;
		mv.addObject("pkg_body", pkg_body) ;
		return mv ;
	}

	public StringBuffer pkgHeader(List lsCol, List lsDataType, String table_pk){
		StringBuffer pkgHeader = new StringBuffer() ;
		String[] table_pks = table_pk.split(",") ;

		String param = pkgParam(lsCol, lsDataType).toString() ;
		String param_pk = pkgParam(lsCol, lsDataType, table_pks).toString() ;
		String rtnNum = "return number ;" ;
		pkgHeader.append("FUNCTION createWith( ")
		.append(param)
		.append(" )\n")
		.append(rtnNum)
		.append("\n") ;

		pkgHeader.append("FUNCTION updateWith( ")
		.append(param)
		.append(" )\n")
		.append(rtnNum)
		.append("\n") ;

		pkgHeader.append("FUNCTION deleteWith( ")
		.append(param_pk)
		.append(" )\n")
		.append(rtnNum)
		.append("\n") ;

		pkgHeader.append("FUNCTION retrieveBy( ")
		.append(param_pk)
		.append(" )\n")
		.append("return types.cursorType;\n")
		.append(rtnNum)
		.append("\n");
		return pkgHeader ;
	}

	public StringBuffer pkgBody(String table_name, List lsCol, List lsDataType, String table_pk){
		StringBuffer pkgBody = new StringBuffer() ;
		String[] table_pks = table_pk.split(",") ;

		String param = pkgParam(lsCol, lsDataType).toString() ;
		String param_pk = pkgParam(lsCol, lsDataType, table_pks).toString() ;
		String rtnNum = "return NUMBER" ;
		String rtnRowCnt = "return SQL%ROWCOUNT;" ;

		pkgBody.append("FUNCTION createWith(")
		.append(param)
		.append(")\n"+rtnNum+"\nis \nbegin\n")
		.append(insertStr(table_name, lsCol, lsDataType))
		.append("\t"+rtnRowCnt+"\n")
		.append("END createWith ;\n")
		.append("\n") ;

		pkgBody.append("FUNCTION updateWith( ")
		.append(param)
		.append(")\n"+rtnNum+"\nis \nbegin\n")
		.append(updateStr(table_name, table_pk, lsCol, lsDataType))
		.append("\t"+rtnRowCnt+"\n")
		.append("END updateWith ;\n")
		.append("\n") ;

		pkgBody.append("FUNCTION deleteWith(")
		.append(param_pk)
		.append(")\n"+rtnNum+"\nis \nbegin\n")
		.append(deleteStr(table_name, lsCol, table_pks))
		.append("\t"+rtnRowCnt+"\n")
		.append("END deleteWith ;\n")
		.append("\n") ;

		pkgBody.append("FUNCTION retrieveBy(")
		.append(param_pk)
		.append(")\n"+"return types.cursorType is \n")
		.append("rtn_cursor types.cursorType;\n")
		.append("begin \n")
		.append("OPEN rtn_cursor FOR \n")
		.append(retrieveStr(table_name, lsCol, table_pks))
		.append("\treturn rtn_cursor;\n")
		.append("END retrieveBy;")
		.append("\n") ;

		return pkgBody ;
	}

	public StringBuffer retrieveStr(String table_name, List lsCol, String[] table_pks){
		StringBuffer retveStr = new StringBuffer() ;

		retveStr.append("\tselect\n")
		.append(insertColumns(lsCol)+"\n")
		.append("\tfrom "+table_name+"\n")
		.append("\twhere "+whereStr(lsCol, table_pks)+";\n") ;

		return retveStr ;
	}

	public StringBuffer deleteStr(String table_name, List lsCol, String[] table_pks){
		StringBuffer deleteStr = new StringBuffer() ;

		deleteStr.append("\tdelete from "+table_name+"\n")
		.append("\twhere "+whereStr(lsCol, table_pks)+";\n") ;

		return deleteStr ;
	}

	public StringBuffer updateStr(String table_name, String table_pk, List lsCol, List lsDataType){
		StringBuffer updateStr = new StringBuffer() ;

		updateStr.append("\tupdate "+table_name+"\n\tset \n")
		.append(updateColumns(table_pk, lsCol)+";\n") ;

		return updateStr ;
	}

	public StringBuffer updateColumns(String table_pk, List lsCol){
		StringBuffer uStr = new StringBuffer() ;
		String[] table_pks = table_pk.split(",") ;

		int isPk = 0 ;
		for(int i=0; i<lsCol.size(); i++){
			isPk = 0 ;
			for(int j=0; j<table_pks.length; j++){
				if(lsCol.get(i).toString().toLowerCase().equals(table_pks[j].trim())){
					isPk++ ;
				}
			}
			if(isPk == 0){
				if(i == lsCol.size()-1){
					uStr.append("\t\t"+lsCol.get(i).toString().toLowerCase()+" = v_"+lsCol.get(i).toString().toLowerCase()) ;
				}else{
					uStr.append("\t\t"+lsCol.get(i).toString().toLowerCase()+" = v_"+lsCol.get(i).toString().toLowerCase())
					.append(", \n") ;
				}
			}
		}
		uStr.append("\n")
		.append("\twhere "+whereStr(lsCol, table_pks)) ;
		return uStr ;
	}

	public StringBuffer insertStr(String table_name, List lsCol, List lsDataType){
		StringBuffer insertStr = new StringBuffer() ;
		insertStr.append("\tinsert into "+table_name+" (\n")
		.append(insertColumns(lsCol)+")\n")
		.append("\tvalues(\n")
		.append(pkgParam(lsCol)+");\n") ;
		return insertStr ;
	}

	public StringBuffer insertColumns(List lsCol){
		StringBuffer iStr = new StringBuffer() ;
		for(int i=0; i<lsCol.size();i++){
			if(i == lsCol.size()-1){
				iStr.append("\t\t"+lsCol.get(i).toString().toLowerCase());
			}
			else{
				iStr.append("\t\t"+lsCol.get(i).toString().toLowerCase())
				.append(", \n") ;
			}
		}
		return iStr ;
	}

	//파라미터 인자 생성
	public StringBuffer pkgParam(List lsCol){
		StringBuffer content = new StringBuffer() ;
		for(int i=0; i<lsCol.size();i++){
			if(i == lsCol.size()-1){
				content.append("\t\tv_"+lsCol.get(i).toString().toLowerCase()) ;
			}
			else{
				content.append("\t\tv_"+lsCol.get(i).toString().toLowerCase())
				.append(", \n") ;
			}
		}
		return content ;
	}

	//파라미터 인자 생성
	public StringBuffer pkgParam(List lsCol, List lsDataType){
		StringBuffer content = new StringBuffer() ;
		for(int i=0; i<lsCol.size();i++){
			if(i == lsCol.size()-1){
				content.append("v_"+lsCol.get(i).toString().toLowerCase()+" in "+lsDataType.get(i).toString().toLowerCase()) ;
			}
			else{
				content.append("v_"+lsCol.get(i).toString().toLowerCase()+" in "+lsDataType.get(i).toString().toLowerCase())
				.append(", ") ;
			}
		}
		return content ;
	}

	public StringBuffer whereStr(List lsCol, String[] table_pks){
		StringBuffer pkCol = new StringBuffer() ;
		for(int j=0; j<lsCol.size();j++){
			for(int i=0; i< table_pks.length;i++){
				if(lsCol.get(j).toString().toLowerCase().equals(table_pks[i].trim())){
					if(i == table_pks.length-1){
						pkCol.append(table_pks[i].trim()+" = v_"+table_pks[i].trim()) ;
					}else{
						pkCol.append(table_pks[i].trim()+" = v_"+table_pks[i].trim())
						.append(" and ") ;
					}
				}
			}
		}
		return pkCol ;
	}

	//파라미터 인자 생성( PK )
	public StringBuffer pkgParam(List lsCol, List lsDataType, String[] table_pks){
		StringBuffer pkCol = new StringBuffer() ;

		for(int j=0; j<lsCol.size();j++){
			for(int i=0; i< table_pks.length;i++){
				if(lsCol.get(j).toString().toLowerCase().equals(table_pks[i].trim().toLowerCase())){
					if(i == table_pks.length-1){
						pkCol.append("v_"+table_pks[i].trim().toLowerCase()+" in "+lsDataType.get(j).toString().toLowerCase()) ;
					}else{
						pkCol.append("v_"+table_pks[i].trim().toLowerCase()+" in "+lsDataType.get(j).toString().toLowerCase())
						.append(", ") ;
					}
				}else{
					//throw new Exception("Wrong PK") ;
				}
			}
		}
		return pkCol ;
	}

}


text:
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Base abstract class for all the loggers to be used in backup/restore
 *
 * Any message passed will be processed by all the loggers in the defined chain
 * (note some implementations may be not strictly "loggers" but classes performing
 * other sort of tasks (avoiding browser/php timeouts, painters...). One simple 1-way
 * basic chain of commands/responsibility pattern.
 *
 * TODO: Finish phpdocs
 */
abstract class base_logger implements checksumable {

    protected $level;     // minimum level of logging this logger must handle (valid level from @backup class)
    protected $showdate;  // flag to decide if the logger must output the date (true) or no (false)
    protected $showlevel; // flag to decide if the logger must output the level (true) or no (false)
    protected $next; // next logger in the chain

    public function __construct($level, $showdate = false, $showlevel = false) {
        // TODO: check level is correct
        $this->level = $level;
        $this->showdate = $showdate;
        $this->showlevel = $showlevel;
        $this->next = null;
    }

    public final function set_next($next) {
        // TODO: Check is a base logger

        // TODO: Check next hasn't been set already

        // TODO: Avoid circular dependencies
        if ($this->is_circular_reference($next)) {
            $a = new stdclass();
            $a->alreadyinchain = get_class($this);
            $a->main = get_class($next);
            throw new base_logger_exception('logger_circular_reference', $a);
        }

        $this->next = $next;
    }

    public function get_next() {
        return $this->next;
    }

    public function get_level() {
        return $this->level;
    }

    /**
     * Destroy (nullify) the chain of loggers references, also closing resources when needed.
     *
     * @since Moodle 3.1
     */
    public final function destroy() {
        // Recursively destroy the chain.
        if ($this->next !== null) {
            $this->next->destroy();
            $this->next = null;
        }
        // And close every logger.
        $this->close();
    }

    /**
     * Close any resource the logger may have open.
     *
     * @since Moodle 3.1
     */
    public function close() {
        // Nothing to do by default. Only loggers using resources (files, own connections...) need to override this.
    }

// checksumable interface methods

    public function calculate_checksum() {
        // Checksum is a simple md5 hash of classname, level and
        // on each specialised logger, its own atrributes
        // Not following the chain at all.
        return md5(get_class($this) . '-' . $this->level);
    }

    public function is_checksum_correct($checksum) {
        return $this->calculate_checksum() === $checksum;
    }

// Protected API starts here

    abstract protected function action($message, $level, $options = null); // To implement

    public final function process($message, $level, $options = null) {
        $result = true;
        if ($this->level != backup::LOG_NONE && $this->level >= $level
            && !(defined('BEHAT_TEST') && BEHAT_TEST)) { // Perform action conditionally.
            $result = $this->action($message, $level, $options);
        }
        if ($result === false) { // Something was wrong, stop the chain
            return $result;
        }
        if ($this->next !== null) { // The chain continues being processed
            $result = $this->next->process($message, $level, $options);
        }
        return $result;
    }

    protected function is_circular_reference($obj) {
        // Get object all nexts recursively and check if $this is already there
        $nexts = $obj->get_nexts();
        if (array_key_exists($this->calculate_checksum(), $nexts) || $obj == $this) {
            return true;
        }
        return false;
    }

    protected function get_nexts() {
        $nexts = array();
        if ($this->next !== null) {
            $nexts[$this->next->calculate_checksum()] = $this->next->calculate_checksum();
            $nexts = array_merge($nexts, $this->next->get_nexts());
        }
        return $nexts;
    }

    protected function get_datestr() {
        return userdate(time(), '%c');
    }

    protected function get_levelstr($level) {
        $result = 'undefined';
        switch ($level) {
            case backup::LOG_ERROR:
                $result = 'error';
                break;
            case backup::LOG_WARNING:
                $result = 'warn';
                break;
            case backup::LOG_INFO:
                $result = 'info';
                break;
            case backup::LOG_DEBUG:
                $result = 'debug';
                break;
        }
        return $result;
    }

    protected function get_prefix($level, $options) {
        $prefix = '';
        if ($this->showdate) {
            $prefix .= '[' . $this->get_datestr() . '] ';
        }
        if ($this->showlevel) {
            $prefix .= '[' . $this->get_levelstr($level) . '] ';
        }
        return $prefix;
    }
}

/*
 * Exception class used by all the @base_logger stuff
 */
class base_logger_exception extends backup_exception {

    public function __construct($errorcode, $a=NULL, $debuginfo=null) {
        parent::__construct($errorcode, $a, $debuginfo);
    }
}


text:
static void buggyCompilerWorkaround(void)
{
	static const struct LocationChanged dummy =
	{
		.location = _OMNITARGET
	};
}

static void onNvmSettingsChanged(const struct Event *event);

static struct Location location;

void locationInitialise(void)
{
	static const struct EventSubscription onNvmSettingsChangedSubscription =
	{
		.type = NVM_SETTINGS_CHANGED,
		.handler = &onNvmSettingsChanged,
		.state = (void *) 0
	};

	eventSubscribe(&onNvmSettingsChangedSubscription);

	location.latitudeOffset = nvmSettings.application.location.latitudeOffset;
	location.longitudeOffset = nvmSettings.application.location.longitudeOffset;
}

static void onNvmSettingsChanged(const struct Event *event)
{
	if (nvmSettings.application.location.latitudeOffset == location.latitudeOffset &&
		nvmSettings.application.location.longitudeOffset == location.longitudeOffset)
		return;

	static const struct LocationChanged locationChangedEventArgs = { .location = &location };
	location.latitudeOffset = nvmSettings.application.location.latitudeOffset;
	location.longitudeOffset = nvmSettings.application.location.longitudeOffset;
	eventPublish(LOCATION_CHANGED, &locationChangedEventArgs);
}


text:
package com.xebia.sandbox.hadoop.job1.xmlhakker;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.nio.charset.CharacterCodingException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class WikiPageLinksMapper extends Mapper<LongWritable, Text, Text, Text> {

    private static final Pattern wikiLinksPattern = Pattern.compile("\\[.+?\\]");

    @Override
    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        // Returns  String[0] = <title>[TITLE]</title>
        //          String[1] = <text>[CONTENT]</text>
        // !! without the <tags>.
        String[] titleAndText = parseTitleAndText(value);

        String pageString = titleAndText[0];
        if(notValidPage(pageString))
            return;

        Text page = new Text(pageString.replace(' ', '_'));

        Matcher matcher = wikiLinksPattern.matcher(titleAndText[1]);

        //Loop through the matched links in [CONTENT]
        while (matcher.find()) {
            String otherPage = matcher.group();
            //Filter only wiki pages.
            //- some have [[realPage|linkName]], some single [realPage]
            //- some link to files or external pages.
            //- some link to paragraphs into other pages.
            otherPage = getWikiPageFromLink(otherPage);
            if(otherPage == null || otherPage.isEmpty())
                continue;

            // add valid otherPages to the map.
            context.write(page, new Text(otherPage));
        }
    }

    private boolean notValidPage(String pageString) {
        return pageString.contains(":");
    }

    private String getWikiPageFromLink(String aLink){
        if(isNotWikiLink(aLink)) return null;

        int start = aLink.startsWith("[[") ? 2 : 1;
        int endLink = aLink.indexOf("]");

        int pipePosition = aLink.indexOf("|");
        if(pipePosition > 0){
            endLink = pipePosition;
        }

        int part = aLink.indexOf("#");
        if(part > 0){
            endLink = part;
        }

        aLink =  aLink.substring(start, endLink);
        aLink = aLink.replaceAll("\\s", "_");
        aLink = aLink.replaceAll(",", "");
        aLink = sweetify(aLink);

        return aLink;
    }

    private String sweetify(String aLinkText) {
        if(aLinkText.contains("&"))
            return aLinkText.replace("&", "&");

        return aLinkText;
    }

    private String[] parseTitleAndText(Text value) throws CharacterCodingException {
        String[] titleAndText = new String[2];

        int start = value.find("<title>");
        int end = value.find("</title>", start);
        start += 7; //add <title> length.

        titleAndText[0] = Text.decode(value.getBytes(), start, end-start);

        start = value.find("<text");
        start = value.find(">", start);
        end = value.find("</text>", start);
        start += 1;

        if(start == -1 || end == -1) {
            return new String[]{"",""};
        }

        titleAndText[1] = Text.decode(value.getBytes(), start, end-start);

        return titleAndText;
    }

    private boolean isNotWikiLink(String aLink) {
        int start = 1;
        if(aLink.startsWith("[[")){
            start = 2;
        }

        if( aLink.length() < start+2 || aLink.length() > 100) return true;
        char firstChar = aLink.charAt(start);

        if( firstChar == '#') return true;
        if( firstChar == ',') return true;
        if( firstChar == '.') return true;
        if( firstChar == '&') return true;
        if( firstChar == '\'') return true;
        if( firstChar == '-') return true;
        if( firstChar == '{') return true;

        if( aLink.contains(":")) return true; // Matches: external links and translations links
        if( aLink.contains(",")) return true; // Matches: external links and translations links
        if( aLink.contains("&")) return true;

        return false;
    }
}


text:
export npm_config_disturl=https://atom.io/download/atom-shell
export npm_config_target=0.28.2
export npm_config_arch=x64
HOME=~/.electron-gyp npm $@


text:
using System;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Acme.Crm.EntityFrameworkCore;
using Acme.Crm.Localization;
using Acme.Crm.MultiTenancy;
using Acme.Crm.Web.Menus;
using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity.Web;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Web;
using Volo.Abp.SettingManagement.Web;
using Volo.Abp.Swashbuckle;
using Volo.Abp.TenantManagement.Web;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.UI;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;

namespace Acme.Crm.Web
{
    [DependsOn(
        typeof(CrmHttpApiModule),
        typeof(CrmApplicationModule),
        typeof(CrmEntityFrameworkCoreModule),
        typeof(AbpAutofacModule),
        typeof(AbpIdentityWebModule),
        typeof(AbpSettingManagementWebModule),
        typeof(AbpAccountWebIdentityServerModule),
        typeof(AbpAspNetCoreMvcUiBasicThemeModule),
        typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
        typeof(AbpTenantManagementWebModule),
        typeof(AbpAspNetCoreSerilogModule),
        typeof(AbpSwashbuckleModule)
        )]
    public class CrmWebModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
            {
                options.AddAssemblyResource(
                    typeof(CrmResource),
                    typeof(CrmDomainModule).Assembly,
                    typeof(CrmDomainSharedModule).Assembly,
                    typeof(CrmApplicationModule).Assembly,
                    typeof(CrmApplicationContractsModule).Assembly,
                    typeof(CrmWebModule).Assembly
                );
            });
        }

        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var hostingEnvironment = context.Services.GetHostingEnvironment();
            var configuration = context.Services.GetConfiguration();

            ConfigureUrls(configuration);
            ConfigureBundles();
            ConfigureAuthentication(context, configuration);
            ConfigureAutoMapper();
            ConfigureVirtualFileSystem(hostingEnvironment);
            ConfigureLocalizationServices();
            ConfigureNavigationServices();
            ConfigureAutoApiControllers();
            ConfigureSwaggerServices(context.Services);
        }

        private void ConfigureUrls(IConfiguration configuration)
        {
            Configure<AppUrlOptions>(options =>
            {
                options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
            });
        }

        private void ConfigureBundles()
        {
            Configure<AbpBundlingOptions>(options =>
            {
                options.StyleBundles.Configure(
                    BasicThemeBundles.Styles.Global,
                    bundle =>
                    {
                        bundle.AddFiles("/global-styles.css");
                    }
                );
            });
        }

        private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
        {
            context.Services.AddAuthentication()
                .AddJwtBearer(options =>
                {
                    options.Authority = configuration["AuthServer:Authority"];
                    options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
                    options.Audience = "Crm";
                });
        }

        private void ConfigureAutoMapper()
        {
            Configure<AbpAutoMapperOptions>(options =>
            {
                options.AddMaps<CrmWebModule>();
            });
        }

        private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
        {
            if (hostingEnvironment.IsDevelopment())
            {
                Configure<AbpVirtualFileSystemOptions>(options =>
                {
                    options.FileSets.ReplaceEmbeddedByPhysical<CrmDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.Crm.Domain.Shared"));
                    options.FileSets.ReplaceEmbeddedByPhysical<CrmDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.Crm.Domain"));
                    options.FileSets.ReplaceEmbeddedByPhysical<CrmApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.Crm.Application.Contracts"));
                    options.FileSets.ReplaceEmbeddedByPhysical<CrmApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.Crm.Application"));
                    options.FileSets.ReplaceEmbeddedByPhysical<CrmWebModule>(hostingEnvironment.ContentRootPath);
                });
            }
        }

        private void ConfigureLocalizationServices()
        {
            Configure<AbpLocalizationOptions>(options =>
            {
                options.Languages.Add(new LanguageInfo("ar", "ar", "العربية"));
                options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
                options.Languages.Add(new LanguageInfo("en", "en", "English"));
                options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
                options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar"));
                options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish"));
                options.Languages.Add(new LanguageInfo("fr", "fr", "Français"));
                options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in"));
                options.Languages.Add(new LanguageInfo("it", "it", "Italian", "it"));
                options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
                options.Languages.Add(new LanguageInfo("ru", "ru", "Русский"));
                options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak"));
                options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
                options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
                options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
                options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch", "de"));
                options.Languages.Add(new LanguageInfo("es", "es", "Español"));
            });
        }

        private void ConfigureNavigationServices()
        {
            Configure<AbpNavigationOptions>(options =>
            {
                options.MenuContributors.Add(new CrmMenuContributor());
            });
        }

        private void ConfigureAutoApiControllers()
        {
            Configure<AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers.Create(typeof(CrmApplicationModule).Assembly);
            });
        }

        private void ConfigureSwaggerServices(IServiceCollection services)
        {
            services.AddAbpSwaggerGen(
                options =>
                {
                    options.SwaggerDoc("v1", new OpenApiInfo { Title = "Crm API", Version = "v1" });
                    options.DocInclusionPredicate((docName, description) => true);
                    options.CustomSchemaIds(type => type.FullName);
                }
            );
        }

        public override void OnApplicationInitialization(ApplicationInitializationContext context)
        {
            var app = context.GetApplicationBuilder();
            var env = context.GetEnvironment();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAbpRequestLocalization();

            if (!env.IsDevelopment())
            {
                app.UseErrorPage();
            }

            app.UseCorrelationId();
            app.UseStaticFiles();
            app.UseRouting();
            app.UseAuthentication();
            app.UseJwtTokenMiddleware();

            if (MultiTenancyConsts.IsEnabled)
            {
                app.UseMultiTenancy();
            }

            app.UseUnitOfWork();
            app.UseIdentityServer();
            app.UseAuthorization();
            app.UseSwagger();
            app.UseAbpSwaggerUI(options =>
            {
                options.SwaggerEndpoint("/swagger/v1/swagger.json", "Crm API");
            });
            app.UseAuditing();
            app.UseAbpSerilogEnrichers();
            app.UseConfiguredEndpoints();
        }
    }
}


text:
<?php
/* SVN FILE: $Id: pages_controller.php 6311 2008-01-02 06:33:52Z phpnut $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
 * Copyright 2005-2008, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 *  Licensed under The Open Group Test Suite License
 *  Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2008, Cake Software Foundation, Inc.
 * @link				https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
 * @package			cake.tests
 * @subpackage		cake.tests.cases.libs.controller
 * @since			CakePHP(tm) v 1.2.0.5436
 * @version			$Revision: 6311 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2008-01-02 00:33:52 -0600 (Wed, 02 Jan 2008) $
 * @license			http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
 */
uses('controller' . DS . 'controller', 'controller' . DS . 'pages_controller');
/**
 * Short description for class.
 *
 * @package    cake.tests
 * @subpackage cake.tests.cases.libs.controller
 */
class PagesControllerTest extends CakeTestCase {

	function skip() {
		$this->skipif (true, 'PagesControllerTest not implemented');
	}
}
?>