text:
package ru.webim.android.demo.client.util;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;

import androidx.cardview.widget.CardView;

import ru.webim.android.demo.client.R;

public class DynamicContextDialog extends Dialog implements DialogInterface.OnDismissListener {
    private View visibleView;
    private View menuView;
    private FrameLayout containerView;
    private int statusBarHeight;
    private int leftNavigationBarHeight;
    private int windowWidth;
    private int windowHeight;
    private float dimAmount;
    private final int visibleViewMargin;
    private Matrix matrix = new Matrix();
    private Paint bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private Activity parentActivity;
    private ConfigurationChangedListener configurationChangedListener;

    DynamicContextDialog(Context context, Activity parentActivity) {
        super(context, R.style.DynamicContextMenuTheme);

        this.parentActivity = parentActivity;

        containerView = new FrameLayout(getContext());

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        Window window = getWindow();
        if (window != null) {
            window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.MATCH_PARENT);
            window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        }

        visibleViewMargin = (int) context.getResources().getDimension(R.dimen.visible_area_margin);

        containerView.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
            if (isShowing()) {
                if (configurationChangedListener != null) {
                    configurationChangedListener.configurationChanged();
                }
                visibleView.post(() -> {
                    calculateScreenSize();
                    drawVisibleArea();
                });
            }
        });
        setOnDismissListener(this);
        setContentView(containerView);
    }

    private void calculateScreenSize() {
        View usableView = parentActivity.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
        windowWidth = usableView.getWidth();
        windowHeight = usableView.getHeight();
        statusBarHeight = getScreenHeight(parentActivity.getBaseContext()) - windowHeight;

        Rect visibleFrame = new Rect();
        getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleFrame);

        leftNavigationBarHeight = visibleFrame.left;
    }

    void setVisibleView(View visibleView) {
        this.visibleView = visibleView;
    }

    View setContextMenuRes(int contextMenuRes) {
        menuView = LayoutInflater.from(getContext()).inflate(contextMenuRes, containerView, false);
        menuView.setVisibility(View.INVISIBLE);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.gravity = Gravity.CENTER;
        containerView.removeAllViews();
        containerView.addView(menuView, layoutParams);
        return menuView;
    }

    void setDimAmount(float dimAmount) {
        this.dimAmount = dimAmount;
    }

    private void drawVisibleArea() {
        int[] positionArray = new int[2];
        visibleView.getLocationOnScreen(positionArray);
        setContextMenuGravity(positionArray);
        Bitmap bitmap = Bitmap.createBitmap(windowWidth, windowHeight, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(Color.argb((int) (255 * dimAmount), 0, 0, 0));
        Bitmap visibleViewBitmap = bitmapFromView(visibleView);
        if (visibleView instanceof CardView) {
            CardView cardView = (CardView) visibleView;
            BitmapShader bitmapShader = new BitmapShader(visibleViewBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
            matrix.reset();
            matrix.setTranslate(positionArray[0] - leftNavigationBarHeight, positionArray[1] - statusBarHeight);
            bitmapShader.setLocalMatrix(matrix);
            bitmapPaint.setShader(bitmapShader);
            canvas.drawRoundRect(
                new RectF(positionArray[0] - leftNavigationBarHeight,
                        positionArray[1] - statusBarHeight,
                        positionArray[0] - leftNavigationBarHeight + visibleView.getMeasuredWidth(),
                        positionArray[1] + visibleView.getMeasuredHeight() - statusBarHeight),
                cardView.getRadius(),
                cardView.getRadius(),
                bitmapPaint);
        } else {
            canvas.drawBitmap(
                visibleViewBitmap,
                new Rect(0, 0, visibleView.getMeasuredWidth(), visibleView.getMeasuredHeight()),
                new Rect(positionArray[0] - leftNavigationBarHeight,
                        positionArray[1] - statusBarHeight,
                        positionArray[0] - leftNavigationBarHeight + visibleView.getMeasuredWidth(),
                        positionArray[1] + visibleView.getMeasuredHeight() - statusBarHeight),
                null);
        }

        containerView.setBackground(new BitmapDrawable(getContext().getResources(), bitmap));
        if (menuView != null && menuView.getVisibility() == View.INVISIBLE) {
            menuView.setVisibility(View.VISIBLE);
        }
    }

    private void setContextMenuGravity(int[] viewPosition) {
        if (menuView == null) {
            return;
        }

        int bottomPositionVisibleView = viewPosition[1] + visibleView.getHeight() - statusBarHeight;
        int topPositionVisibleView = viewPosition[1] - statusBarHeight;
        int leftPositionVisibleView = viewPosition[0] - leftNavigationBarHeight;
        int rightPositionVisibleView = viewPosition[0] + visibleView.getWidth() - leftNavigationBarHeight;
        int menuViewHeight = menuView.getHeight();
        int menuViewWidth = menuView.getWidth();

        if (bottomPositionVisibleView + visibleViewMargin + menuViewHeight <= windowHeight) {
            // align below of view
            menuView.setY(bottomPositionVisibleView + visibleViewMargin);
        } else if (topPositionVisibleView - visibleViewMargin - menuViewHeight >= 0) {
            // align above of view
            menuView.setY(topPositionVisibleView - visibleViewMargin - menuViewHeight);
        } else {
            // align right / left / center of view
            menuView.setY(windowHeight - menuViewHeight - visibleViewMargin);
            if (windowWidth - rightPositionVisibleView + visibleViewMargin >= menuViewWidth) {
                menuView.setX(rightPositionVisibleView + visibleViewMargin);
            } else if (leftPositionVisibleView + visibleViewMargin >= menuViewWidth) {
                menuView.setX(leftPositionVisibleView - visibleViewMargin - menuViewWidth);
            } else {
                menuView.setX(windowWidth / 2f - menuViewWidth / 2f);
            }
            return;
        }

        if (menuViewWidth <= visibleView.getWidth()) {
            // align center horizontally of view
            menuView.setX(leftPositionVisibleView + visibleView.getWidth() / 2f - menuViewWidth / 2f);
        } else if (leftPositionVisibleView + menuViewWidth > windowWidth) {
            // align to the right of view
            menuView.setX(rightPositionVisibleView - menuViewWidth);
        } else {
            // align to the left of view
            menuView.setX(leftPositionVisibleView);
        }
    }

    private int getScreenHeight(Context context) {
        WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Point screenSize = new Point();
        if (windowManager != null) {
            windowManager.getDefaultDisplay().getSize(screenSize);
        }
        return screenSize.y;
    }

    private Bitmap bitmapFromView(View view) {
        Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
        view.draw(canvas);
        return bitmap;
    }

    @Override
    public void onDismiss(DialogInterface dialog) {
        if (menuView != null) {
            menuView.setVisibility(View.INVISIBLE);
        }
        containerView.setBackground(new ColorDrawable(Color.TRANSPARENT));
    }

    void setConfigurationChangedListener(ConfigurationChangedListener configurationChangedListener) {
        this.configurationChangedListener = configurationChangedListener;
    }

    void setOnShadowAreaClickListener(View.OnClickListener clickListener) {
        containerView.setOnClickListener(clickListener);
    }

    public interface ConfigurationChangedListener {
        void configurationChanged();
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos.implementation.directconnectivity;

import com.azure.cosmos.BridgeInternal;
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.DirectConnectionConfig;
import com.azure.cosmos.implementation.AsyncDocumentClient.Builder;
import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry;
import com.azure.cosmos.models.CosmosClientTelemetryConfig;
import com.azure.cosmos.implementation.Configs;
import com.azure.cosmos.implementation.ConnectionPolicy;
import com.azure.cosmos.implementation.Database;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.implementation.DocumentCollection;
import com.azure.cosmos.implementation.DocumentServiceRequestValidator;
import com.azure.cosmos.implementation.FeedResponseListValidator;
import com.azure.cosmos.implementation.OperationType;
import com.azure.cosmos.implementation.RequestOptions;
import com.azure.cosmos.implementation.ResourceResponse;
import com.azure.cosmos.implementation.ResourceResponseValidator;
import com.azure.cosmos.implementation.ResourceType;
import com.azure.cosmos.implementation.RxDocumentServiceRequest;
import com.azure.cosmos.implementation.SpyClientUnderTestFactory;
import com.azure.cosmos.implementation.StoredProcedure;
import com.azure.cosmos.implementation.StoredProcedureResponse;
import com.azure.cosmos.implementation.TestConfigurations;
import com.azure.cosmos.implementation.TestSuiteBase;
import com.azure.cosmos.models.CosmosQueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.ModelBridgeInternal;
import com.azure.cosmos.models.PartitionKey;
import org.mockito.stubbing.Answer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.spy;

/**
 * The purpose of the tests in this class is to ensure the request are routed through direct connectivity stack.
 * The tests in other test classes validate the actual behaviour and different scenarios.
 */
public class DCDocumentCrudTest extends TestSuiteBase {

    private final static int QUERY_TIMEOUT = 40000;
    private final static String PARTITION_KEY_FIELD_NAME = "mypk";

    private static Database createdDatabase;
    private static DocumentCollection createdCollection;

    private SpyClientUnderTestFactory.ClientWithGatewaySpy client;

    @DataProvider
    public static Object[][] directClientBuilder() {
        return new Object[][] { { createDCBuilder(Protocol.TCP) } };
    }

    static Builder createDCBuilder(Protocol protocol) {

        ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig());

        Configs configs = spy(new Configs());
        doAnswer((Answer<Protocol>) invocation -> protocol).when(configs).getProtocol();

        return new Builder()
            .withServiceEndpoint(TestConfigurations.HOST)
            .withConfigs(configs)
            .withConnectionPolicy(connectionPolicy)
            .withConsistencyLevel(ConsistencyLevel.SESSION)
            .withContentResponseOnWriteEnabled(true)
            .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY)
            .withClientTelemetryConfig(
                            new CosmosClientTelemetryConfig()
                                .sendClientTelemetryToService(ClientTelemetry.DEFAULT_CLIENT_TELEMETRY_ENABLED));
    }

    @Factory(dataProvider = "directClientBuilder")
    public DCDocumentCrudTest(Builder clientBuilder) {
        super(clientBuilder);
    }

    @Test(groups = { "direct" }, timeOut = TIMEOUT)
    public void executeStoredProc() {
        StoredProcedure storedProcedure = new StoredProcedure();
        storedProcedure.setId(UUID.randomUUID().toString());
        storedProcedure.setBody("function() {var x = 10;}");

        Mono<ResourceResponse<StoredProcedure>> createObservable = client
                .createStoredProcedure(getCollectionLink(), storedProcedure, null);

        ResourceResponseValidator<StoredProcedure> validator = new ResourceResponseValidator.Builder<StoredProcedure>()
                .withId(storedProcedure.getId())
                .build();

        validateSuccess(createObservable, validator, TIMEOUT);

        // creating a stored proc will go through gateway so clearing captured requests

        client.getCapturedRequests().clear();

        // execute the created storedProc and ensure it goes through direct connectivity stack
        String storedProcLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + storedProcedure.getId();

        RequestOptions options = new RequestOptions();
        options.setPartitionKey(new PartitionKey("dummy"));
        StoredProcedureResponse storedProcedureResponse =  client
                .executeStoredProcedure(storedProcLink, options, null).block();

        assertThat(storedProcedureResponse.getStatusCode()).isEqualTo(200);

        // validate the request routed through direct stack
        validateNoStoredProcExecutionOperationThroughGateway();
    }

    /**
     * Tests document creation through direct mode
     */
    @Test(groups = { "direct" }, timeOut = TIMEOUT)
    public void create() {
        final Document docDefinition = getDocumentDefinition();

        Mono<ResourceResponse<Document>> createObservable = client.createDocument(
            this.getCollectionLink(), docDefinition, null, false);

        ResourceResponseValidator<Document> validator = new ResourceResponseValidator.Builder<Document>()
            .withId(docDefinition.getId())
            .build();

        validateSuccess(createObservable, validator, TIMEOUT);
        validateNoDocumentOperationThroughGateway();
    }

    /**
     * Tests document read through direct https.
     * @throws Exception
     */
    @Test(groups = { "direct" }, timeOut = TIMEOUT)
    public void read() throws Exception {
        Document docDefinition = this.getDocumentDefinition();
        Document document = client.createDocument(getCollectionLink(), docDefinition, null, false).block().getResource();

        // give times to replicas to catch up after a write
        waitIfNeededForReplicasToCatchUp(clientBuilder());

        String pkValue = document.getString(PARTITION_KEY_FIELD_NAME);

        RequestOptions options = new RequestOptions();
        options.setPartitionKey(new PartitionKey(pkValue));

        String docLink =
                String.format("dbs/%s/colls/%s/docs/%s", createdDatabase.getId(), createdCollection.getId(), document.getId());

        ResourceResponseValidator<Document> validator = new ResourceResponseValidator.Builder<Document>()
                .withId(docDefinition.getId())
                .build();

        validateSuccess(client.readDocument(docLink, options), validator, TIMEOUT);

        validateNoDocumentOperationThroughGateway();
    }

    /**
     * Tests document upsert through direct https.
     * @throws Exception
     */
    @Test(groups = { "direct" }, timeOut = TIMEOUT)
    public void upsert() throws Exception {

        final Document docDefinition = getDocumentDefinition();

        final Document document = client.createDocument(getCollectionLink(), docDefinition, null, false)
            .block()
            .getResource();

        // give times to replicas to catch up after a write
        waitIfNeededForReplicasToCatchUp(clientBuilder());

        String pkValue = document.getString(PARTITION_KEY_FIELD_NAME);
        RequestOptions options = new RequestOptions();
        options.setPartitionKey(new PartitionKey(pkValue));

        String propName = "newProp";
        String propValue = "hello";
        BridgeInternal.setProperty(document, propName, propValue);

        ResourceResponseValidator<Document> validator = ResourceResponseValidator.<Document>builder()
            .withProperty(propName, propValue)
            .build();
        validateSuccess(client.upsertDocument(getCollectionLink(), document, options, false), validator, TIMEOUT);

        validateNoDocumentOperationThroughGateway();
    }

    @Test(groups = { "direct" }, timeOut = QUERY_TIMEOUT)
    public void crossPartitionQuery() {

        truncateCollection(createdCollection);
        waitIfNeededForReplicasToCatchUp(clientBuilder());

        client.getCapturedRequests().clear();

        int cnt = 1000;
        List<Document> documentList = new ArrayList<>();
        for(int i = 0; i < cnt; i++) {
            Document docDefinition = getDocumentDefinition();
            documentList.add(docDefinition);
        }

        documentList = bulkInsert(client, getCollectionLink(), documentList).map(ResourceResponse::getResource).collectList().single().block();

        waitIfNeededForReplicasToCatchUp(clientBuilder());

        CosmosQueryRequestOptions options = new CosmosQueryRequestOptions();
        options.setMaxDegreeOfParallelism(-1);
        ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 100);

        Flux<FeedResponse<Document>> results = client.queryDocuments(
            getCollectionLink(), "SELECT * FROM r", options, Document.class);

        FeedResponseListValidator<Document> validator = new FeedResponseListValidator.Builder<Document>()
                .totalSize(documentList.size())
                .exactlyContainsInAnyOrder(documentList.stream().map(Document::getResourceId).collect(Collectors.toList())).build();

        validateQuerySuccess(results, validator, QUERY_TIMEOUT);
        validateNoDocumentQueryOperationThroughGateway();
        // validates only the first query for fetching query plan goes to gateway.
        assertThat(client.getCapturedRequests().stream().filter(r -> r.getResourceType() == ResourceType.Document)).hasSize(1);
    }

    private void validateNoStoredProcExecutionOperationThroughGateway() {
        // this validates that Document related requests don't go through gateway
        DocumentServiceRequestValidator<RxDocumentServiceRequest> validateResourceTypesSentToGateway
            = DocumentServiceRequestValidator.<RxDocumentServiceRequest>builder()
            .resourceTypeIn(ResourceType.DatabaseAccount,
                ResourceType.Database,
                ResourceType.DocumentCollection,
                ResourceType.PartitionKeyRange)
                .build();

        // validate that all gateway captured requests are non document resources
        for(RxDocumentServiceRequest request: client.getCapturedRequests()) {
            validateResourceTypesSentToGateway.validate(request);
        }
    }

    private void validateNoDocumentOperationThroughGateway() {
        // this validates that Document related requests don't go through gateway
        DocumentServiceRequestValidator<RxDocumentServiceRequest> validateResourceTypesSentToGateway
            = DocumentServiceRequestValidator.<RxDocumentServiceRequest>builder()
            .resourceTypeIn(ResourceType.DatabaseAccount,
                ResourceType.Database,
                ResourceType.DocumentCollection,
                ResourceType.PartitionKeyRange)
                .build();

        // validate that all gateway captured requests are non document resources
        for(RxDocumentServiceRequest request: client.getCapturedRequests()) {
            validateResourceTypesSentToGateway.validate(request);
        }
    }

    private void validateNoDocumentQueryOperationThroughGateway() {
        // this validates that Document related requests don't go through gateway
        DocumentServiceRequestValidator<RxDocumentServiceRequest> validateResourceTypesSentToGateway
            = DocumentServiceRequestValidator.builder()
            .resourceTypeIn(ResourceType.DatabaseAccount,
                ResourceType.Database,
                ResourceType.DocumentCollection,
                ResourceType.PartitionKeyRange)
                .build();

        // validate that all gateway captured requests are non document resources
        for(RxDocumentServiceRequest request: client.getCapturedRequests()) {
            if (request.getOperationType() == OperationType.Query
                    || request.getOperationType() == OperationType.QueryPlan) {
                assertThat(request.getPartitionKeyRangeIdentity()).isNull();
            } else {
                validateResourceTypesSentToGateway.validate(request);
            }
        }
    }

    @BeforeClass(groups = { "direct" }, timeOut = SETUP_TIMEOUT)
    public void before_DCDocumentCrudTest() {

        RequestOptions options = new RequestOptions();
        options.setOfferThroughput(10100);
        createdDatabase = SHARED_DATABASE;
        createdCollection = createCollection(createdDatabase.getId(), getCollectionDefinition(), options);
        client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder());

        assertThat(client.getCapturedRequests()).isNotEmpty();
    }

    @AfterClass(groups = { "direct" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true)
    public void afterClass() {
        safeClose(client);
    }

    @BeforeMethod(groups = { "direct" })
    public void beforeMethod(Method method) {
        client.getCapturedRequests().clear();
    }

    private String getCollectionLink() {
        return String.format("/dbs/%s/colls/%s", createdDatabase.getId(), createdCollection.getId());
    }

    private Document getDocumentDefinition() {
        Document doc = new Document();
        doc.setId(UUID.randomUUID().toString());
        BridgeInternal.setProperty(doc, PARTITION_KEY_FIELD_NAME, UUID.randomUUID().toString());
        BridgeInternal.setProperty(doc, "name", "Hafez");
        return doc;
    }

}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

function metaGeneratorHelper() {
  return `<meta name="generator" content="Hexo ${this.env.version}">`;
}

module.exports = metaGeneratorHelper;


text:
function Start(){

	this.gameObject.transform.rotation.x = Random.rotation.x;
	this.gameObject.transform.rotation.y = Random.rotation.y;
	this.gameObject.transform.rotation.z = Random.rotation.z;

}


text:
package org.wso2.carbon.dataservices.google.tokengen.servlet;

import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.hp.hpl.jena.sparql.lib.org.json.JSONException;
import com.hp.hpl.jena.sparql.lib.org.json.JSONObject;
import com.hp.hpl.jena.sparql.lib.org.json.JSONTokener;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.dataservices.common.DBConstants;
import org.wso2.carbon.dataservices.google.tokengen.servlet.util.AuthCode;
import org.wso2.carbon.dataservices.google.tokengen.servlet.util.CodeHolder;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Servlet class to ping and retrieve access token and refresh token once auth code is available
 */
public class TokenEndpoint extends HttpServlet {
    private static final Log log = LogFactory.getLog(TokenEndpoint.class);

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) {
        AuthCode authCode = CodeHolder.getInstance().getAuthCodeForSession(request.getSession().getId());
        String responseMsg = "";
        JSONObject resJson = new JSONObject();
        int responseStatus;
        if (authCode != null) {
            if (log.isDebugEnabled()) {
                log.debug("Request received for retrieve access token from session - " + request.getSession().getId());
            }
            StringBuffer jb = new StringBuffer();
            JSONObject jsonObject;
            String line = null;
            try {
                BufferedReader reader = request.getReader();
                while ((line = reader.readLine()) != null) {
                    jb.append(line);
                }

                jsonObject = new JSONObject(new JSONTokener(jb.toString()));
                String clientId = jsonObject.getString(DBConstants.GSpread.CLIENT_ID);
                String clientSecret = jsonObject.getString(DBConstants.GSpread.CLIENT_SECRET);
                String redirectURIs = jsonObject.getString(DBConstants.GSpread.REDIRECT_URIS);

                if (clientId == null || clientId.isEmpty()) {
                    responseStatus = HttpStatus.SC_BAD_REQUEST;
                    responseMsg = "ClientID is null or empty";
                } else if (clientSecret == null || clientSecret.isEmpty()) {
                    responseStatus = HttpStatus.SC_BAD_REQUEST;
                    responseMsg = "Client Secret is null or empty";
                } else if (redirectURIs == null || redirectURIs.isEmpty()) {
                    responseStatus = HttpStatus.SC_BAD_REQUEST;
                    responseMsg = "Redirect URIs is null or empty";
                } else {
                    HttpTransport httpTransport = new NetHttpTransport();
                    JacksonFactory jsonFactory = new JacksonFactory();

                    // Step 2: Exchange auth code for tokens
                    GoogleTokenResponse googleTokenResponse = new GoogleAuthorizationCodeTokenRequest(
                            httpTransport, jsonFactory, "https://www.googleapis.com/oauth2/v3/token",
                            clientId, clientSecret, authCode.getAuthCode(), redirectURIs).execute();
                    resJson.append(DBConstants.GSpread.ACCESS_TOKEN, googleTokenResponse.getAccessToken());
                    resJson.append(DBConstants.GSpread.REFRESH_TOKEN, googleTokenResponse.getRefreshToken());
                    responseMsg = resJson.toString();
                    responseStatus = HttpStatus.SC_OK;
                    if (log.isDebugEnabled()) {
                        log.debug("Access token request successfully served for client id " + clientId);
                    }
                }
            } catch (JSONException e) {
                responseStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
                responseMsg = "Error in Processing accessTokenRequest Error - " + e.getMessage();
                log.error(responseMsg, e);
            } catch (IOException e) {
                responseStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
                responseMsg = "Error in Processing accessTokenRequest Error - " + e.getMessage();
                log.error(responseMsg, e);
            } catch (Exception e) {
                responseStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
                responseMsg = "Error in Processing accessTokenRequest Error - " + e.getMessage();
                log.error(responseMsg, e);
            }
        } else {
            responseStatus = HttpStatus.SC_ACCEPTED;
            responseMsg = resJson.toString();
        }
        try {
            PrintWriter out = response.getWriter();
            out.println(responseMsg);
            response.setStatus(responseStatus);
        } catch (IOException e) {
            log.error("Error Getting print writer to write http response Error - " + e.getMessage(), e);
            response.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR);
        }
    }
}


text:
/* @flow strict-local */
import * as Sentry from '@sentry/react-native';
import { nativeApplicationVersion } from 'expo-application';

import config from './config';

export const isSentryActive = (): boolean => {
  // Hub#getClient() is documented as possibly returning undefined, but the
  // significance of `undefined` is not. In practice, it appears to be
  // `undefined` exactly when `Sentry.init()` has not yet been called.
  const client = Sentry.getCurrentHub().getClient();

  /* The `enabled` option in getOptions() is theoretically togglable at runtime:
     https://github.com/getsentry/sentry-javascript/issues/2039#issuecomment-486674574
     We avoid this, however, as it will only toggle the JavaScript SDK and not
     the lower-level native-code SDKs. */
  // return (client && client.getOptions().enabled) ?? false;

  return !!client;
};

const preventNoise = (): void => {
  /* Sentry should not normally be used in debug mode. (For one thing, the
     debug-mode build process doesn't ordinarily create bundles or .map files,
     so you'll probably get nonsensical stack traces.) */
  if (process.env.NODE_ENV === 'development' && config.sentryKey !== null) {
    /* If you have some reason to initialize Sentry in debug mode anyway, please
       change the app's version name (currently specified in `ios/Info.plist`
       and/or `android/app/build.gradle`) to something that doesn't look like a
       normal version number -- preferably with your name and/or Github ID in
       it. This will allow events produced by these debug builds to be easily
       identified in the Sentry console. */
    if (nativeApplicationVersion !== null && nativeApplicationVersion.match(/^\d+\.\d+\.\d+$/)) {
      throw new Error('Sentry should not be initialized in debug builds');
    }
  }

  /* Jest has no reason to even _try_ to initialize Sentry, even if `sentryKey`
     is `null`. */
  // (See the following links concerning detecting Jest.)
  //   [1] https://jestjs.io/docs/en/24.0/getting-started.html#using-babel
  //   [2] https://stackoverflow.com/a/52231746
  if (process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined) {
    throw new Error('Sentry must not be initialized during testing!');
  }
};

/** Initialize Sentry into its default configuration. */
export const initializeSentry = () => {
  // Check to make sure it's safe to run Sentry. Abort if not.
  preventNoise();

  const key = config.sentryKey;
  if (key !== null) {
    // The DSN is formatted as an `https:` URL. Omit the scheme.
    const displayKey = `${key.slice(8, 12)}......`;
    // eslint-disable-next-line no-console
    console.log(`Sentry key ${displayKey} provided; initializing`);

    Sentry.init({
      dsn: key,
      ignoreErrors: [
        // RN's fetch implementation can raise these; we sometimes mimic it
        'Network request failed',
      ],
    });
  } else {
    // This is normal behavior when running locally; only published release
    // builds will have a Sentry key.

    // (It's not documented anywhere what happens when functions on Sentry are
    // called without first initializing Sentry. Fortunately, it seems to have
    // worked without warnings, so far.)

    // eslint-disable-next-line no-console
    console.log('no Sentry key provided; skipping initialization');
  }
};


text:
package com.squareup.wire.sample;

import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableSet;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
import com.squareup.wire.java.JavaGenerator;
import com.squareup.wire.schema.IdentifierSet;
import com.squareup.wire.schema.Location;
import com.squareup.wire.schema.ProtoFile;
import com.squareup.wire.schema.Schema;
import com.squareup.wire.schema.SchemaLoader;
import com.squareup.wire.schema.Service;
import com.squareup.wire.schema.Type;
import java.io.File;
import java.io.IOException;

/**
 * Reads in .proto files, links 'em together, prunes 'em, and emits both types and services. This
 * can be used to either complement or replace {@code WireCompiler}.
 */
public final class CodegenSample {
  private final Log log;
  private final ImmutableSet<String> sources;
  private final ImmutableSet<String> protos;
  private final String generatedSourceDirectory;
  private final IdentifierSet identifierSet;

  public CodegenSample(Log log, ImmutableSet<String> sources,
      ImmutableSet<String> protos, String generatedSourceDirectory,
      IdentifierSet identifierSet) {
    this.log = log;
    this.sources = sources;
    this.protos = protos;
    this.generatedSourceDirectory = generatedSourceDirectory;
    this.identifierSet = identifierSet;
  }

  public void execute() throws IOException {
    Schema schema = loadSchema();

    if (!identifierSet.isEmpty()) {
      schema = retainRoots(schema);
    }

    JavaGenerator javaGenerator = JavaGenerator.get(schema);
    ServiceGenerator serviceGenerator = new ServiceGenerator(javaGenerator);

    for (ProtoFile protoFile : schema.protoFiles()) {
      for (Type type : protoFile.types()) {
        Stopwatch stopwatch = Stopwatch.createStarted();
        TypeSpec typeSpec = javaGenerator.generateType(type);
        ClassName javaTypeName = (ClassName) javaGenerator.typeName(type.type());
        writeJavaFile(javaTypeName, typeSpec, type.location(), stopwatch);
      }

      for (Service service : protoFile.services()) {
        Stopwatch stopwatch = Stopwatch.createStarted();
        ClassName javaTypeName = (ClassName) javaGenerator.typeName(service.type());
        TypeSpec typeSpec = serviceGenerator.api(service);
        writeJavaFile(javaTypeName, typeSpec, service.location(), stopwatch);
      }
    }
  }

  private Schema loadSchema() throws IOException {
    Stopwatch stopwatch = Stopwatch.createStarted();
    SchemaLoader loader = new SchemaLoader();
    for (String source : sources) {
      loader.addSource(new File(source));
    }
    for (String proto : protos) {
      loader.addProto(proto);
    }
    Schema schema = loader.load();
    log.info("Loaded %s proto files in %s", schema.protoFiles().size(), stopwatch);
    return schema;
  }

  private Schema retainRoots(Schema schema) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    int oldSize = countTypes(schema);

    Schema prunedSchema = schema.prune(identifierSet);
    int newSize = countTypes(prunedSchema);

    log.info("Pruned schema from %s types to %s types in %s", oldSize, newSize, stopwatch);

    return prunedSchema;
  }

  private void writeJavaFile(ClassName javaTypeName, TypeSpec typeSpec, Location location,
      Stopwatch stopwatch) throws IOException {
    JavaFile.Builder builder = JavaFile.builder(javaTypeName.packageName(), typeSpec)
        .addFileComment("Code generated by $L, do not edit.", CodegenSample.class.getName());
    if (location != null) {
      builder.addFileComment("\nSource file: $L", location.getPath());
    }
    JavaFile javaFile = builder.build();
    try {
      javaFile.writeTo(new File(generatedSourceDirectory));
    } catch (IOException e) {
      throw new IOException("Failed to write " + javaFile.packageName + "."
          + javaFile.typeSpec.name + " to " + generatedSourceDirectory, e);
    }
    log.info("Generated %s in %s", javaTypeName, stopwatch);
  }

  private int countTypes(Schema prunedSchema) {
    int result = 0;
    for (ProtoFile protoFile : prunedSchema.protoFiles()) {
      result += protoFile.types().size();
    }
    return result;
  }

  interface Log {
    void info(String format, Object... args);
  }
}


text:
import * as types from "../../constants/action-types";
import TeamMember from "../../models/team-member";
import * as firebaseDataLayer from "../../data-sources/firebase-data-layer";

export function removeTeamMember(teamId: string, teamMember: Object) {
    return () => firebaseDataLayer.removeTeamMember(teamId, teamMember);
}

export function revokeInvitation(teamId: string, membershipId: string) {
    return (dispatch) => firebaseDataLayer.revokeInvitation(teamId, membershipId)
        .then(dispatch({ type: types.REVOKE_INVITATION_SUCCESS, data: { teamId, membershipId } }))
        .catch(error => ({ type: types.REVOKE_INVITATION_FAIL, data: { teamId, membershipId }, error }));
}

export function updateTeamMember(teamId: string, member: TeamMember, status: string) {
    const _newMember = TeamMember.create(Object.assign({}, member, { memberStatus: status || member.memberStatus }));
    return async function () {
        firebaseDataLayer.updateTeamMember(teamId, _newMember);
    };
}

export function deleteMessage(userId: string, messageId: string) {
    return async function () {
        firebaseDataLayer.deleteMessage(userId, messageId);
    };
}


text:
/*
 *
 *
 *
 */
package com.yhy.medicine.mapper;

import com.yhy.core.mapper.BaseMapper;
import com.yhy.medicine.domain.MedicineMedType;

/**
 * 药品类型表Mapper接口.
 *
 * @author yhy
 * @version 2016-05-22
 * @----------------------------------------------------------------------------------------
 * @updated 修改描述.
 * @updated by yhy
 * @updated at 2016-05-22
 */
public interface MedicineMedTypeMapper extends BaseMapper<MedicineMedType, String> {

}


text:
using System;
using System.ComponentModel.Composition;
using PIT.Business.Entities;
using PIT.WPF.Core.Contracts;

namespace PIT.WPF.Core
{
    [Export(typeof(IPITWindowManager))]
    public class PITWindowManager : IPITWindowManager
    {
    	private double _primaryScreenWidth;
		private double _primaryScreenHeight;

        public void ApplyScreenBoundaries(double screenWidht, double screenheight)
        {
            _primaryScreenWidth = screenWidht;
            _primaryScreenHeight = screenheight;
        }

        public WindowLocation GetCenteredWindowLocation(double desiredWidth, double desiredHeight)
        {
            return GetCenteredWindow(desiredWidth, desiredHeight,
                new System.Windows.Rect(0.0, 0.0, _primaryScreenWidth, _primaryScreenHeight));
        }

        private WindowLocation GetCenteredWindow(double desiredWidth, double desiredHeight, System.Windows.Rect parentArea)
        {
            var windowLocation = new WindowLocation();

            windowLocation.Width = Math.Min(desiredWidth, parentArea.Width - 50.0);
            windowLocation.Height = Math.Min(desiredHeight, parentArea.Height - 50.0);
            windowLocation.Left = parentArea.Left + (parentArea.Width - windowLocation.Width) / 2.0;
            windowLocation.Top = parentArea.Top + (parentArea.Height - windowLocation.Height) / 2.0;

            return windowLocation;
        }
    }
}


text:
<!DOCTYPE html>

    <title>ngDraggable</title>
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/2.3.1/spruce/bootstrap.min.css">

ngDraggable Example

TEST

        Drop area #1

            {{obj.name}}

        Drop area #2

            {{obj.name}}

footer


text:
package org.openpipeline.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Utility class for reading and writing a small file that stores a timestamp.
 * Can be used by connectors to keep track of a timestamp for checkpointing.
 */
public class VersionUtil {

	/**
	 * Read a timestamp from a file.  If the file does not exist a timestamp of -1 is returned.
	 * @param filename the name of the file that contains the timestamp.
	 * @return the timestamp in milliseconds
	 * @throws IOException
	 */
	public static long readTimestamp(String filename) throws IOException {
		File f = new File(filename);
		long updateTime = -1;
		if (f.exists()) {
			BufferedReader br = new BufferedReader(new FileReader(filename));
			String line = br.readLine();
			updateTime = Long.parseLong(line);
			br.close();
		}
		return updateTime;
	}

	/**
	 * Write a timestamp to a file.  If the file does not exist then an attemp will be
	 * made to create it.
	 * @param filename the name of the file that contains the timestamp.
	 * @param millis the timestamp in milliseconds
	 * @throws IOException
	 */
	public static void writeTimestamp(String filename, long millis) throws IOException {
		File f = new File(filename);
		if (!f.exists()) {
			f.createNewFile();
		}
		FileWriter writer = new FileWriter(f);
		writer.write(String.valueOf(millis));
		writer.close();
	}
}


text:
import unittest
import mock
import sublime
import ctypes

sublime.packagesPath = mock.Mock()
sublime.packagesPath.return_value = "XXX"

import sublimeplugin
import executepscommand

class SimpleTestCase(unittest.TestCase):

    def test_regionsToPoShArray(self):
        view = mock.Mock()
        rgs = ["'one'", "'two'", "three"]

        view.substr = mock.Mock()
        view.substr.side_effect = lambda x: x

        expected = "'''one''','''two''','three'"
        actual = executepscommand.regionsToPoShArray(view, rgs)

        self.assertEquals(expected, actual)

    def test_getThisPackageNameNonDebug(self):
        executepscommand.DEBUG = True
        expected = "XXXPowershellUtils"
        actual = executepscommand.getThisPackageName()

        self.assertEquals(expected, actual)

    def test_getThisPackageNameNonDebug(self):
        executepscommand.DEBUG = False
        expected = "PowershellUtils"
        actual = executepscommand.getThisPackageName()

        self.assertEquals(expected, actual)

    def test_getPathToPoShScript(self):
        expected = r"XXX\PowershellUtils\psbuff.ps1"
        actual = executepscommand.getPathToPoShScript()

        self.assertEquals(expected, actual)

    def test_getPathToPoShHistoryDB(self):
        expected = r"XXX\PowershellUtils\pshist.txt"
        actual = executepscommand.getPathToPoShHistoryDB()

        self.assertEquals(expected, actual)

    def test_getPathToOutputSink(self):
        expected = r"XXX\PowershellUtils\out.xml"
        actual = executepscommand.getPathToOutputSink()

        self.assertEquals(expected, actual)

    def test_buildPoShCmdLine(self):
        expected = ["powershell",
                        "-noprofile",
                        "-nologo",
                        "-noninteractive",
                        # PoSh 2.0 lets you specify an ExecutionPolicy
                        # from the cmdline, but 1.0 doesn't.
                        "-executionpolicy", "remotesigned",
                        "-file", executepscommand.getPathToPoShScript(), ]

        actual = executepscommand.buildPoShCmdLine()

        self.assertEquals(expected, actual)

class TestCase_Helpers(unittest.TestCase):

    def test_getOEMCP(self):

        expected = str(ctypes.windll.kernel32.GetOEMCP())
        actual = executepscommand.getOEMCP()

        self.assertEquals(expected, actual)

class TestCase_HistoryFunctionality(unittest.TestCase):

    def setUp(self):
        self.command = executepscommand.RunExternalPSCommandCommand()

    def test_NewCommandIsAppendedToHistory(self):
        self.command._addToPSHistory("1")

        self.assertEquals(["1"], self.command.PSHistory)

    def test_ExistingCommandIsDiscarded(self):

        self.command._addToPSHistory("1")
        self.command._addToPSHistory("1")

        self.assertEquals(len(self.command.PSHistory), 1)

    def test_HistoryIsPoppedIfUpperLimitIsExceeded(self):

        historyMaxCount = executepscommand.RunExternalPSCommandCommand.PoSh_HISTORY_MAX_LENGTH
        newCommands = [str(x) for x in range(historyMaxCount)]

        map(self.command._addToPSHistory, newCommands)

        actual = newCommands[0]

        lastCommand = self.command.PSHistory[0]
        self.command._addToPSHistory("NEW_COMMAND")

        self.assertNotEquals(lastCommand, self.command.PSHistory[0])

if __name__ == "__main__":
    unittest.main()


text:
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace FourWheels.Data.DbContexts
{
    public interface IFourWheelsSqlDbContext
    {
        DbSet<TEntity> Set<TEntity>()
            where TEntity : class;

        DbEntityEntry<TEntity> Entry<TEntity>(TEntity entity)
            where TEntity : class;

        int SaveChanges();
    }
}


text:
package com.navercorp.pinpoint.web.filter;

import java.util.List;

import com.navercorp.pinpoint.common.bo.SpanBo;

/**
 *
 * @author netspider
 * @author emeroad
 */
public interface Filter {
    boolean ACCEPT = true;
    boolean REJECT = false;

    Filter NONE = new Filter() {
        @Override
        public boolean include(List<SpanBo> transaction) {
            return ACCEPT;
        }
    };

    boolean include(List<SpanBo> transaction);
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Abelardo</logradouro><bairro>Graças</bairro><cidade>Recife</cidade><uf>PE</uf><cep>52050310</cep></feed>


text:
import flask
from flask import Flask, jsonify
from flask import render_template
from RestfulRel.methods import *
import json
import time

app = Flask(__name__)

@app.route('/')
@app.route('/index')
def index():

    return 'Send rest calls to <url>/rest/native?query=<query>'

@app.route('/rest/<action>/', methods=['GET'], defaults={'path': ''})
@app.route('/rest/<action>/<path:path>', methods=['GET'])
def rest_call(action, path):
    internal = InternalMethods()

    try:
        db = ("DB", flask.request.headers['DB'], flask.request)
        user = ("USER", flask.request.headers['USER'], flask.request)
        pass_word = ("PASS", flask.request.headers['PASS'], flask.request)
        mode = ("MODE", flask.request.headers['MODE'], flask.request)
    except KeyError as e:
            return(error(
                   403,
                   "authentication headers not provided",
                   validheaders=['DB', 'USER', 'PASS', 'MODE']))
    print mode[0]
    if mode[1] == 'rdf_mode':
        try:
            model = ("MODEL", flask.request.headers['MODEL'], flask.request)
        except KeyError as e:
            return(error(402,'please provide model for rdf_mode'))
        print model
        user_conn = internal.db_connect(db, user, pass_word, mode, model=model)

    else:
        user_conn = internal.db_connect(db, user, pass_word, mode)
    #print flask.request.headers
    json_response = internal.rest_call(user_conn, action, path, flask.request.headers)
    return json_response


text:
<!DOCTYPE html>

    <link rel="shortcut icon" href="<?php echo base_url(); ?>public/favicon.ico">
    <link href="<?php echo base_url(); ?>public/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="<?php echo base_url(); ?>public/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <link href="<?php echo base_url(); ?>public/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>public/css/animate.min.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>public/css/style.min.css?v=4.0.0" rel="stylesheet">
    <base target="_blank">

                            编号
                            登录地址
                            登录ip
                            登录时间

                        <?php
                        foreach ($admin_log as $item) {
                            ?>

                                <?php echo $item->loginLog_id ?>
                                <?php echo $item->loginLog_address ?>
                                <?php echo $item->loginLog_IP ?>
                                <?php echo $item->loginLog_time ?>

                            <?php
                        }
                        ?>


text:
/*  data-vote.h was generated by yup.py (yupp) 1.0c2
    out of data-vote.yu-h
 *//**
 *  \file  data-vote.h (data-vote.yu-h)
 *  \brief  Data voting.
 *  \author  Vitaly Kravtsov (in4lio@gmail.com)
 *  \copyright  See the LICENSE file.
 */

#define LOGGING
#define LINK_CONSOLE

#define LINK_UT

#define LINK_UT_UT
#define LINK_UT_CORO
#define LINK_UT_DATA

#ifndef DATA_VOTE_H
#define DATA_VOTE_H

#ifdef  DATA_VOTE_IMPLEMENT
#define DATA_VOTE_EXT
#define DATA_VOTE_INIT( ... ) \
	= __VA_ARGS__

#ifdef __cplusplus
#define DATA_VOTE_EXT_C \
	extern "C"
#else
#define DATA_VOTE_EXT_C \
	extern
#endif

#define DATA_VOTE_VAR( decl ) \
	decl
#define DATA_VOTE_VAR_INIT( decl, ... ) \
	decl = __VA_ARGS__

#ifdef __cplusplus
#define DATA_VOTE_VAR_C( decl ) \
	extern "C" decl; decl
#define DATA_VOTE_VAR_C_INIT( decl, ... ) \
	extern "C" decl; decl = __VA_ARGS__
#else
#define DATA_VOTE_VAR_C( decl ) \
	decl
#define DATA_VOTE_VAR_C_INIT( decl, ... ) \
	decl = __VA_ARGS__
#endif

#define DATA_VOTE_INL

#else  /* DATA_VOTE_IMPLEMENT */
#define DATA_VOTE_EXT \
	extern
#define DATA_VOTE_INIT( ... )

#ifdef __cplusplus
#define DATA_VOTE_EXT_C \
	extern "C"
#else
#define DATA_VOTE_EXT_C \
	extern
#endif

#define DATA_VOTE_VAR( decl ) \
	extern decl
#define DATA_VOTE_VAR_INIT( decl, ... ) \
	extern decl

#ifdef __cplusplus
#define DATA_VOTE_VAR_C( decl ) \
	extern "C" decl
#define DATA_VOTE_VAR_C_INIT( decl, ... ) \
	extern "C" decl
#else
#define DATA_VOTE_VAR_C( decl ) \
	extern decl
#define DATA_VOTE_VAR_C_INIT( decl, ... ) \
	extern decl
#endif

#if __GNUC__ && !__GNUC_STDC_INLINE__
#define DATA_VOTE_INL \
	extern inline
#else
#define DATA_VOTE_INL \
	inline
#endif

#endif /* DATA_VOTE_IMPLEMENT */

/**
 *  \addtogroup data
 *  \{
 */

/**
 *  \brief Voting of dword values (on exact matching).
 *  \param result Voted value pointer.
 *  \param valid_1 Validity flag of 1st channel.
 *  \param value_1 Value of 1st channel.
 *  \param valid_2 Validity flag of 2nd channel.
 *  \param value_2 Value of 2nd channel.
 *  \param valid_3 Validity flag of 3th channel.
 *  \param value_3 Value of 3th channel.
 *  \return Validity flag of majority opinion.
 */
DATA_VOTE_EXT_C bool vote_dword( dword *result, bool valid_1, dword value_1, bool valid_2, dword value_2, bool valid_3, dword value_3 );

/**
 *  \brief Voting of word values (on exact matching).
 *  \param result Voted value pointer.
 *  \param valid_1 Validity flag of 1st channel.
 *  \param value_1 Value of 1st channel.
 *  \param valid_2 Validity flag of 2nd channel.
 *  \param value_2 Value of 2nd channel.
 *  \param valid_3 Validity flag of 3th channel.
 *  \param value_3 Value of 3th channel.
 *  \return Validity flag of majority opinion.
 */
DATA_VOTE_EXT_C bool vote_word( word *result, bool valid_1, word value_1, bool valid_2, word value_2, bool valid_3, word value_3 );

/**
 *  \brief Voting of byte values (on exact matching).
 *  \param result Voted value pointer.
 *  \param valid_1 Validity flag of 1st channel.
 *  \param value_1 Value of 1st channel.
 *  \param valid_2 Validity flag of 2nd channel.
 *  \param value_2 Value of 2nd channel.
 *  \param valid_3 Validity flag of 3th channel.
 *  \param value_3 Value of 3th channel.
 *  \return Validity flag of majority opinion.
 */
DATA_VOTE_EXT_C bool vote_byte( byte *result, bool valid_1, byte value_1, bool valid_2, byte value_2, bool valid_3, byte value_3 );

/**
 *  \brief Voting of dword values (bit-by-bit).
 *  \param result Voted value pointer.
 *  \param _1 (unused)
 *  \param value_1 Value of 1st channel.
 *  \param _2 (unused)
 *  \param value_2 Value of 2nd channel.
 *  \param _3 (unused)
 *  \param value_3 Value of 3th channel.
 *  \return true.
 */
DATA_VOTE_EXT_C bool vote_bit_dword( dword *result, bool _1, dword value_1, bool _2, dword value_2, bool _3, dword value_3 );
;

/** \} */

#undef DATA_VOTE_EXT
#undef DATA_VOTE_INIT
#undef DATA_VOTE_EXT_C
#undef DATA_VOTE_VAR
#undef DATA_VOTE_VAR_INIT
#undef DATA_VOTE_VAR_C
#undef DATA_VOTE_VAR_C_INIT
#undef DATA_VOTE_INL
#endif


text:
using System;
using Csla;
using SelfLoadRO.DataAccess;
using SelfLoadRO.DataAccess.ERCLevel;

namespace SelfLoadRO.Business.ERCLevel
{

    /// <summary>
    /// D07_Country_Child (read only object).<br/>
    /// This is a generated base class of <see cref="D07_Country_Child"/> business object.
    /// </summary>
    /// <remarks>
    /// This class is an item of <see cref="D06_Country"/> collection.
    /// </remarks>
    [Serializable]
    public partial class D07_Country_Child : ReadOnlyBase<D07_Country_Child>
    {

        #region Business Properties

        /// <summary>
        /// Maintains metadata about <see cref="Country_Child_Name"/> property.
        /// </summary>
        public static readonly PropertyInfo<string> Country_Child_NameProperty = RegisterProperty<string>(p => p.Country_Child_Name, "Regions Child Name");
        /// <summary>
        /// Gets the Regions Child Name.
        /// </summary>
        /// <value>The Regions Child Name.</value>
        public string Country_Child_Name
        {
            get { return GetProperty(Country_Child_NameProperty); }
        }

        #endregion

        #region Factory Methods

        /// <summary>
        /// Factory method. Loads a <see cref="D07_Country_Child"/> object, based on given parameters.
        /// </summary>
        /// <param name="country_ID1">The Country_ID1 parameter of the D07_Country_Child to fetch.</param>
        /// <returns>A reference to the fetched <see cref="D07_Country_Child"/> object.</returns>
        internal static D07_Country_Child GetD07_Country_Child(int country_ID1)
        {
            return DataPortal.FetchChild<D07_Country_Child>(country_ID1);
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="D07_Country_Child"/> class.
        /// </summary>
        /// <remarks> Do not use to create a Csla object. Use factory methods instead.</remarks>
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public D07_Country_Child()
        {
            // Use factory methods and do not use direct creation.
        }

        #endregion

        #region Data Access

        /// <summary>
        /// Loads a <see cref="D07_Country_Child"/> object from the database, based on given criteria.
        /// </summary>
        /// <param name="country_ID1">The Country ID1.</param>
        protected void Child_Fetch(int country_ID1)
        {
            var args = new DataPortalHookArgs(country_ID1);
            OnFetchPre(args);
            using (var dalManager = DalFactorySelfLoadRO.GetManager())
            {
                var dal = dalManager.GetProvider<ID07_Country_ChildDal>();
                var data = dal.Fetch(country_ID1);
                Fetch(data);
            }
            OnFetchPost(args);
        }

        /// <summary>
        /// Loads a <see cref="D07_Country_Child"/> object from the given <see cref="D07_Country_ChildDto"/>.
        /// </summary>
        /// <param name="data">The D07_Country_ChildDto to use.</param>
        private void Fetch(D07_Country_ChildDto data)
        {
            // Value properties
            LoadProperty(Country_Child_NameProperty, data.Country_Child_Name);
            var args = new DataPortalHookArgs(data);
            OnFetchRead(args);
        }

        #endregion

        #region DataPortal Hooks

        /// <summary>
        /// Occurs after setting query parameters and before the fetch operation.
        /// </summary>
        partial void OnFetchPre(DataPortalHookArgs args);

        /// <summary>
        /// Occurs after the fetch operation (object or collection is fully loaded and set up).
        /// </summary>
        partial void OnFetchPost(DataPortalHookArgs args);

        /// <summary>
        /// Occurs after the low level fetch operation, before the data reader is destroyed.
        /// </summary>
        partial void OnFetchRead(DataPortalHookArgs args);

        #endregion

    }
}


text:
package com.beanframework.cronjob.config;

import java.util.Properties;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import com.beanframework.cronjob.CronjobConstants;
import com.beanframework.cronjob.context.AutowiringSpringBeanJobFactory;
import com.beanframework.cronjob.listener.CronjobGlobalListener;

@Configuration
@ConditionalOnProperty(name = "quartz.enabled")
public class CronJobConfig {

	@Autowired
	private ApplicationContext applicationContext;

	@Value(CronjobConstants.QUARTZ_PROPERTIES_CLASSPATH)
	private String quartzPropertiesClasspath;

	@Bean
	public Properties quartzProperties() throws Exception {
		PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
		propertiesFactoryBean.setLocation(new ClassPathResource(quartzPropertiesClasspath));
		propertiesFactoryBean.afterPropertiesSet();
		return propertiesFactoryBean.getObject();
	}

	@Bean
	public CronjobGlobalListener globalJobListener() {
		return new CronjobGlobalListener();
	}

	@Bean
	public SchedulerFactoryBean schedulerFactory() throws Exception {
		SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
		schedulerFactory.setQuartzProperties(quartzProperties());

		// Custom job factory of spring with DI support for @Autowired
		AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
		jobFactory.setApplicationContext(applicationContext);
		schedulerFactory.setJobFactory(jobFactory);
		schedulerFactory.setGlobalJobListeners(globalJobListener());

		return schedulerFactory;
	}
}


text:
/* $Id$ */

package org.apache.fop.render.rtf.rtflib.rtfdoc;

/*
 * This file is part of the RTF library of the FOP project, which was originally
 * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
 * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
 * the FOP project.
 */

import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;

/**
 *
A cell in an RTF table, container for paragraphs, lists, etc.

 *
 *
This work was authored by Bertrand Delacretaz (bdelacretaz@codeconsult.ch).

 */

public class RtfTableCell
        extends RtfContainer
        implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
            IRtfExternalGraphicContainer, IRtfTextrunContainer {
    private RtfParagraph paragraph;
    private RtfList list;
    private RtfTable table;
    private RtfExternalGraphic externalGraphic;
    private final RtfTableRow parentRow;
    private boolean setCenter;
    private boolean setRight;
    private int id;
    private RtfParagraphBreak lastBreak;
    private int lastBreakDepth = Integer.MIN_VALUE;

    private static final String TABLE_CELL_PARAGRAPH = "cell";
    private static final String TABLE_CELL_NESTED_PARAGRAPH = "nestcell";

    /** default cell width (in twips ??) */
    public static final int DEFAULT_CELL_WIDTH = 2000;

    /** cell width in twips */
    private int cellWidth;
    private int widthOffset;

    /** cell merging has three states */
    private int vMerge = NO_MERGE;
    private int hMerge = NO_MERGE;

    /** cell merging: this cell is not merged */
    public static final int NO_MERGE = 0;

    /** cell merging: this cell is the start of a range of merged cells */
    public static final int MERGE_START = 1;

    /** cell merging: this cell is part of (but not the start of) a range of merged cells */
    public static final int MERGE_WITH_PREVIOUS = 2;

    /** Create an RTF element as a child of given container */
    RtfTableCell(RtfTableRow parent, Writer w, int cellWidth, int idNum) throws IOException {
        super(parent, w);
        id = idNum;
        parentRow = parent;
        this.cellWidth = cellWidth;
        setCenter = false;
        setRight = false;

    }

    /** Create an RTF element as a child of given container */
    RtfTableCell(RtfTableRow parent, Writer w, int cellWidth, RtfAttributes attrs,
            int idNum) throws IOException {
        super(parent, w, attrs);
        id = idNum;
        parentRow = parent;
        this.cellWidth = cellWidth;
    }

    /**
     * Start a new paragraph after closing current current paragraph, list and table
     * @param attrs attributes of new RtfParagraph
     * @return new RtfParagraph object
     * @throws IOException for I/O problems
     */
    public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
        closeAll();

        // in tables, RtfParagraph must have the intbl attribute
        if (attrs == null) {
            attrs = new RtfAttributes();
        }

        attrs.set("intbl");

        paragraph = new RtfParagraph(this, writer, attrs);

        if (paragraph.attrib.isSet("qc")) {
            setCenter = true;
            attrs.set("qc");
        } else if (paragraph.attrib.isSet("qr")) {
            setRight = true;
            attrs.set("qr");
        } else {
            attrs.set("ql");
        }
        attrs.set("intbl");

        //lines modified by Chris Scott, Westinghouse
        return paragraph;
    }

    /**
     * Start a new external graphic after closing current paragraph, list and table
     * @throws IOException for I/O problems
     * @return new RtfExternalGraphic object
     */
    public RtfExternalGraphic newImage() throws IOException {
        closeAll();
        externalGraphic = new RtfExternalGraphic(this, writer);
        return externalGraphic;
    }

    /**
     * Start a new paragraph with default attributes after closing current
     * paragraph, list and table
     * @return new RtfParagraph object
     * @throws IOException for I/O problems
     */
    public RtfParagraph newParagraph() throws IOException {
        return newParagraph(null);
    }

    /**
     * Start a new list after closing current paragraph, list and table
     * @param attrib attributes for new RtfList
     * @return new RtfList object
     * @throws IOException for I/O problems
     */
    public RtfList newList(RtfAttributes attrib) throws IOException {
        closeAll();
        list = new RtfList(this, writer, attrib);
        return list;
    }

    /**
     * Start a new nested table after closing current paragraph, list and table
     * @param tc table column info for new RtfTable
     * @return new RtfTable object
     * @throws IOException for I/O problems
     */
    public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
        closeAll();
        table = new RtfTable(this, writer, tc);
        return table;
    }

    /**
     * Start a new nested table after closing current paragraph, list and table
     * @param attrs attributes of new RtfTable
     * @param tc table column info for new RtfTable
     * @return new RtfTable object
     * @throws IOException for I/O problems
     */
    // Modified by Boris Poudérous on 07/22/2002
    public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException {
        closeAll();
        table = new RtfTable(this, writer, attrs, tc); // Added tc Boris Poudérous 07/22/2002
        return table;
    }

    /** used by RtfTableRow to write the <celldef> cell definition control words
     *  @param offset sum of the widths of preceeding cells in same row
     *  @return offset + width of this cell
     */
    int writeCellDef(int offset) throws IOException {
        /*
         * Don't write \clmgf or \clmrg. Instead add the widths
         * of all spanned columns and create a single wider cell,
         * because \clmgf and \clmrg won't work in last row of a
         * table (Word2000 seems to do the same).
         * Cause of this, dont't write horizontally merged cells.
         * They just exist as placeholders in TableContext class,
         * and are never written to RTF file.
         */
        // horizontal cell merge codes
        if (hMerge == MERGE_WITH_PREVIOUS) {
            return offset;
        }

        newLine();
        this.widthOffset = offset;

        // vertical cell merge codes
        if (vMerge == MERGE_START) {
            writeControlWord("clvmgf");
        } else if (vMerge == MERGE_WITH_PREVIOUS) {
            writeControlWord("clvmrg");
        }

        /**
         * Added by Boris POUDEROUS on 2002/06/26
         */
        // Cell background color processing :
        writeAttributes(attrib, ITableAttributes.CELL_COLOR);
        /** - end - */

        writeAttributes(attrib, ITableAttributes.ATTRIB_CELL_PADDING);
        writeAttributes(attrib, ITableAttributes.CELL_BORDER);
        writeAttributes(attrib, IBorderAttributes.BORDERS);

        // determine cell width
        int iCurrentWidth = this.cellWidth;
        if (attrib.getValue("number-columns-spanned") != null) {
            // Get the number of columns spanned
            int nbMergedCells = ((Integer)attrib.getValue("number-columns-spanned")).intValue();

            RtfTable tab = getRow().getTable();

            // Get the context of the current table in order to get the width of each column
            ITableColumnsInfo tableColumnsInfo
                = tab.getITableColumnsInfo();

            tableColumnsInfo.selectFirstColumn();

            // Reach the column index in table context corresponding to the current column cell
            // id is the index of the current cell (it begins at 1)
            // getColumnIndex() is the index of the current column in table context (it begins at 0)
            //  => so we must withdraw 1 when comparing these two variables.
            while ((this.id - 1) != tableColumnsInfo.getColumnIndex()) {
               tableColumnsInfo.selectNextColumn();
            }

            // We withdraw one cell because the first cell is already created
            // (it's the current cell) !
            int i = nbMergedCells - 1;
            while (i > 0) {
                tableColumnsInfo.selectNextColumn();
                iCurrentWidth += (int)tableColumnsInfo.getColumnWidth();

                i--;
            }
        }
        final int xPos = offset + iCurrentWidth;

        //these lines added by Chris Scott, Westinghouse
        //some attributes need to be written before opening block
        if (setCenter) {
            writeControlWord("trqc");
        } else if (setRight) {
            writeControlWord("trqr");
        } else {
            writeControlWord("trql");
        }
        writeAttributes(attrib, ITableAttributes.CELL_VERT_ALIGN);

        writeControlWord("cellx" + xPos);

        return xPos;

    }

    /**
     * Overriden to avoid writing any it's a merged cell.
     * @throws IOException for I/O problems
     */
    protected void writeRtfContent() throws IOException {
       // Never write horizontally merged cells.
       if (hMerge == MERGE_WITH_PREVIOUS) {
           return;
       }

       super.writeRtfContent();
    }

    /**
     * Called before writeRtfContent; overriden to avoid writing
     * any it's a merged cell.
     * @throws IOException for I/O problems
     */
    protected void writeRtfPrefix() throws IOException {
        // Never write horizontally merged cells.
        if (hMerge == MERGE_WITH_PREVIOUS) {
            return;
        }

        super.writeRtfPrefix();
    }

    /**
     * The "cell" control word marks the end of a cell
     * @throws IOException for I/O problems
     */
    protected void writeRtfSuffix() throws IOException {
        // Never write horizontally merged cells.
        if (hMerge == MERGE_WITH_PREVIOUS) {
            return;
        }

        if (getRow().getTable().isNestedTable()) {
            //nested table
            if (lastBreak == null) {
                writeControlWordNS("nestcell");
            }
            writeGroupMark(true);
            writeControlWord("nonesttables");
            writeControlWord("par");
            writeGroupMark(false);
        } else {
            // word97 hangs if cell does not contain at least one "par" control word
            // TODO this is what causes the extra spaces in nested table of test
            //      004-spacing-in-tables.fo,
            // but if is not here we generate invalid RTF for word97

            if (setCenter) {
                writeControlWord("qc");
            } else if (setRight) {
                writeControlWord("qr");
            } else {
                RtfElement lastChild = null;

                if (getChildren().size() > 0) {
                    lastChild = (RtfElement) getChildren().get(getChildren().size() - 1);
                }

                if (lastChild != null
                        && lastChild instanceof RtfTextrun) {
                    //Don't write \ql in order to allow for example a right aligned paragraph
                    //in a not right aligned table-cell to write its \qr.
                } else {
                    writeControlWord("ql");
                }
            }

            if (!containsText()) {
                writeControlWord("intbl");

                //R.Marra this create useless paragraph
                //Seem working into Word97 with the "intbl" only
                //writeControlWord("par");
            }

            if (lastBreak == null) {
                writeControlWord("cell");
            }
        }
    }

    //modified by Chris Scott, Westinghouse
    private void closeCurrentParagraph() throws IOException {
        if (paragraph != null) {
            paragraph.close();
        }
    }

    private void closeCurrentList() throws IOException {
        if (list != null) {
            list.close();
        }
    }

    private void closeCurrentTable() throws IOException {
        if (table != null) {
            table.close();
        }
    }

    private void closeCurrentExternalGraphic() throws IOException {
        if (externalGraphic != null) {
            externalGraphic.close();
        }
    }

    private void closeAll()
    throws IOException {
        closeCurrentTable();
        closeCurrentParagraph();
        closeCurrentList();
        closeCurrentExternalGraphic();
    }

    /**
     * @param mergeStatus vertical cell merging status to set
     */
    public void setVMerge(int mergeStatus) { this.vMerge = mergeStatus; }

    /**
     * @return vertical cell merging status
     */
    public int getVMerge() { return this.vMerge; }

    /**
     * Set horizontal cell merging status
     * @param mergeStatus mergeStatus to set
     */
    public void setHMerge(int mergeStatus) {
        this.hMerge = mergeStatus;
    }

    /**
     * @return horizontal cell merging status
     */
    public int getHMerge() {
        return this.hMerge;
    }

    /** get cell width */
    int getCellWidth() { return this.cellWidth; }

    /**
     * Overridden so that nested tables cause extra rows to be added after the row
     * that contains this cell
     * disabled for V0.3 - nested table support is not done yet
     * @throws IOException for I/O problems
     */
    /*
    protected void writeRtfContent()
    throws IOException {
        int extraRowIndex = 0;
        RtfTableCell extraCell = null;

        for (Iterator it = getChildren().iterator(); it.hasNext();) {
            final RtfElement e = (RtfElement)it.next();
            if (e instanceof RtfTable) {
                // nested table - render its cells in supplementary rows after current row,
                // and put the remaining content of this cell in a new cell after nested table
                // Line added by Boris Poudérous
        parentRow.getExtraRowSet().setParentITableColumnsInfo(
                ((RtfTable)this.getParentOfClass(e.getClass())).getITableColumnsInfo());
        extraRowIndex = parentRow.getExtraRowSet().addTable((RtfTable)e,
                extraRowIndex, widthOffset);
                // Boris Poudérous added the passing of the current cell
                // attributes to the new cells (in order not to have cell without
                // border for example)
        extraCell = parentRow.getExtraRowSet().createExtraCell(extraRowIndex,
                widthOffset, this.getCellWidth(), attrib);
                extraRowIndex++;

            } else if (extraCell != null) {
                // we are after a nested table, add elements to the extra cell created for them
                extraCell.addChild(e);

            } else {
                // before a nested table, normal rendering
                e.writeRtf();
            }
        }
    }*/

    /**
     * A table cell always contains "useful" content, as it is here to take some
     * space in a row.
     * Use containsText() to find out if there is really some useful content in the cell.
     * TODO: containsText could use the original isEmpty implementation?
     * @return false (always)
     */
    public boolean isEmpty() {
        return false;
    }

    /** true if the "par" control word must be written for given RtfParagraph
     *  (which is not the case for the last non-empty paragraph of the cell)
     */
    boolean paragraphNeedsPar(RtfParagraph p) {
        // true if there is at least one non-empty paragraph after p in our children
        boolean pFound = false;
        boolean result = false;
        for (Iterator it = getChildren().iterator(); it.hasNext();) {
            final Object o = it.next();
            if (!pFound) {
                // set pFound when p is found in the list
                pFound =  (o == p);
            } else {
                if (o instanceof RtfParagraph) {
                    final RtfParagraph p2 = (RtfParagraph)o;
                    if (!p2.isEmpty()) {
                        // found a non-empty paragraph after p
                        result = true;
                        break;
                    }
                } else if (o instanceof RtfTable) {
                    break;
                }
            }
        }
        return result;
    }

    /**
     * Returns the current RtfTextrun object.
     * Opens a new one if necessary.
     * @return The RtfTextrun object
     * @throws IOException Thrown when an IO-problem occurs
     */
    public RtfTextrun getTextrun() throws IOException {
        RtfAttributes attrs = new RtfAttributes();

        if (!getRow().getTable().isNestedTable()) {
            attrs.set("intbl");
        }

        RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, attrs);

        //Suppress the very last \par, because the closing \cell applies the
        //paragraph attributes.
        textrun.setSuppressLastPar(true);

        return textrun;
    }

    /**
     * Get the parent row.
     * @return The parent row.
     */
    public RtfTableRow getRow() {
        RtfElement e = this;
        while (e.parent != null) {
            if (e.parent instanceof RtfTableRow) {
                return (RtfTableRow) e.parent;
            }

            e = e.parent;
        }

        return null;
    }

    /**
     * The table cell decides whether or not a newly added paragraph break
     * will be used to write the cell-end control word.
     * For nested tables it is not necessary.
     *
     * @param parBreak the paragraph break element
     * @param breakDepth The depth is necessary for picking the correct break element.
     * If it is deeper inside the whole cell it will be used, and if there is something on
     * the same level (depth) it is also set because the method is called for all breaks
     * in the correct order.
     */
    public void setLastParagraph(RtfParagraphBreak parBreak, int breakDepth) {
        if (parBreak != null && breakDepth >= lastBreakDepth) {
            lastBreak = parBreak;
            lastBreakDepth = breakDepth;
        }
    }

    /**
     * The last paragraph break was just stored before,
     * now the control word is really switched
     */
    public void finish() {
      //If it is nested and contains another table do not set it
      if (getRow().getTable().isNestedTable() && table != null) {
          lastBreak = null;
      } else if (lastBreak != null) {
              lastBreak.switchControlWord(
                                          getRow().getTable().isNestedTable()
                                          ? TABLE_CELL_NESTED_PARAGRAPH
                                          : TABLE_CELL_PARAGRAPH);
      }
    }
}


text:
require 'clue.class'

local M = clue.class("Fn")

function M:init(fn)
    self.fn = fn
end

function M:__call(...)
    return self.fn(...)
end

function M:__tostring()
    return tostring(self.fn)
end

function M:__eq(other)
    return self.fn == other.fn
end

function M:with_meta(m)
    local wm = M.new(self.fn)
    wm.meta = m
    return wm
end

clue.fn = M.new

function clue.apply_to(f, args)
    local function unpack_seq(s)
        if not s then
            return
        end
        return s:first(), unpack_seq(s:next())
    end
    return f(unpack_seq(clue.seq(args)))
end


text:
"use strict";

define([
    'angularAMD',
    '../views/sidebar/sidebar',
    'hammer',
    'ngRoute',
    'ngMocks',
    'ngResource',
    'ngAnimate',
    'ngAria',
    'ngMaterial',
    'angularLoadingBar',
    'ngTranslate',
    'ngTranslateLoader'
], function (angularAMD, sidebar) {
    var app = angular.module("myApp", [
        'ngRoute',
        'ngAria',
        'ngAnimate',
        'ngResource',
        'angular-loading-bar',
        'ngMaterial',
        'pascalprecht.translate'
    ]);

    app.config(['$routeProvider', '$locationProvider', 'cfpLoadingBarProvider',
        function ($routeProvider, $locationProvider, cfpLoadingBarProvider) {
            $routeProvider
                .when("/deploy/list/:id", angularAMD.route({
                    templateUrl: './views/deploy/list.html',
                    controllerUrl: '../views/deploy/list'
                }))
                .when("/project/list", angularAMD.route({
                    templateUrl: './views/project/list.html',
                    controllerUrl: '../views/project/list'
                }))
                .when("/project/edit", angularAMD.route({
                    templateUrl: './views/project/edit.html',
                    controllerUrl: '../views/project/edit'
                }))
                .when("/project/edit/:id", angularAMD.route({
                    templateUrl: './views/project/edit.html',
                    controllerUrl: '../views/project/edit'
                }))
                .when("/cluster/list", angularAMD.route({
                    templateUrl: './views/cluster/list.html',
                    controllerUrl: '../views/cluster/list'
                }))
                .when("/cluster/edit", angularAMD.route({
                    templateUrl: './views/cluster/edit.html',
                    controllerUrl: '../views/cluster/edit'
                }))
                .when("/cluster/edit/:id", angularAMD.route({
                    templateUrl: './views/cluster/edit.html',
                    controllerUrl: '../views/cluster/edit'
                }))
                .when("/node/list", angularAMD.route({
                    templateUrl: './views/node/list.html',
                    controllerUrl: '../views/node/list'
                }))
                .when("/node/add", angularAMD.route({
                    templateUrl: './views/node/add.html',
                    controllerUrl: '../views/node/add'
                }))
                .when("/user/list", angularAMD.route({
                    templateUrl: './views/user/list.html',
                    controllerUrl: '../views/user/list'
                }))
                .when("/user/edit/:id", angularAMD.route({
                    templateUrl: './views/user/edit.html',
                    controllerUrl: '../views/user/edit'
                }))
                .when("/user/edit", angularAMD.route({
                    templateUrl: './views/user/edit.html',
                    controllerUrl: '../views/user/edit'
                }))
                .when("/user/changepwd", angularAMD.route({
                    templateUrl: './views/user/changepwd.html',
                    controllerUrl: '../views/user/changepwd'
                }))
                .when("/login", angularAMD.route({
                    templateUrl: './views/user/login.html',
                    controllerUrl: '../views/user/login'
                }))
                .when("/logout", angularAMD.route({
                    templateUrl: './views/user/logout.html',
                    controllerUrl: '../views/user/logout'
                }))
                .otherwise({redirectTo: '/project/list'});

            //$locationProvider.html5Mode(true);
            cfpLoadingBarProvider.includeSpinner = false;
        }]);

    app.config(['$translateProvider',
        function ($translateProvider) {
            $translateProvider.useStaticFilesLoader({
                prefix: './languages/',
                suffix: '.json'
            });

            $translateProvider.determinePreferredLanguage(function () {
                var supportLanguage = [
                    'zh-cn'
                ];

                return 'zh-cn'
            });
        }]);

    app.run(function ($rootScope, $location, $mdDialog, $mdToast, $animate) {
        $rootScope.checkErr = function (json) {
            if (json && json.errno == 401) {
                $location.path("/login")
            }
            if (json && json.errno != 0) {
                console.log(json);
                $mdToast.show(
                    $mdToast.simple().content(json.errmsg).action("close").hideDelay(0)
                );
                return true
            }
            return false
        }
        $rootScope.confirmDialog = $mdDialog.confirm()
            .title('Are you ABSOLUTELY sure?')
            .content('This action CANNOT be undone. This will permanently delete this item.')
            .ok('Delete')
            .cancel('Cancel')

        $rootScope.loadingDialog = {
            tpl: '<md-dialog aria-label="">' +
            '<md-content class="">' +
            '
' +
            '<md-progress-circular md-mode="indeterminate"></md-progress-circular>' +
            '

' +
            '
 ' +
            '</md-content>' +
            '</md-dialog>',
            show: function (content) {
                var self = this;
                var dialog = {
                    controller: self.showCtrl,
                    template: self.tpl,
                    bindToController: true,
                    controllerAs: "ctrl",
                    locals: {
                        content: content
                    }
                }
                $mdDialog.show(dialog).then()
            },
            hide: function () {
                $mdDialog.hide()
            },
            showCtrl: function ($scope, $mdDialog) {
            }
        }
    })

    return angularAMD.bootstrap(app);
});


text:
Ember.Handlebars.registerBoundHelper('formatTakenAt', function(takenAt) {
  return moment(takenAt).format('LLL Z');
});


text:
<template name="signup">

           EVSD

                 Home

<link rel="stylesheet" href="signup.css">

      <form class="col s12">

Evergreen Valley High School Speech and Debate
 Sign Up Form

STUDENT INFORMATION

            account_circle
            <input type="text" name="firstName" class="validate" autofocus required>
            Student First Name

            <input type="text" name="middleName" class="validate">
            Student Middle Name

            <input type="text" name="lastName" class="validate" required>
            Student Last Name

            grade
            <input type="text" name="studentGrade"  placeholder="Freshman/Sophomore/Junior/Senior" class="validate" required>
            Student Grade

            today
            <input type="text" name="DOB" placeholder="MM/DD/YYYY" class="validate" required>
            Student Date of Birth

            email
            <input type="email" name="emailAddress" class="validate" required>
            Student Email Address

            lock_outline
            <input type="password" name="password" class="validate" required>
            Password

            phone
            <input type="text" name="studentPhoneNo" class="validate" required>
            Student Phone Number

            assignment_ind
            <input type="text" name="studentId" class="validate" required>
            Student ID Number

Does the student have a Facebook account?

              <input name="facebookAccount" type="radio" value = "yes" id = "facebookAccounty" required/>
              Yes

              <input name="facebookAccount" type="radio" value = "no" id = "facebookAccountn" required/>
              No

Is he/she in the Speech & Debate Facebook group?

              <input name="facebookEvsd" type="radio" id="facebookEvsdy" value = "yes" required>
              Yes

              <input name="facebookEvsd" type="radio" id="facebookEvsdn" value = "no" required/>
              No

Is the student a part of the Speech & Debate Schoolloop group?

              <input name="schoolloopEvsd" type="radio" id="schoolloopEvsdy" value = "yes" required/>
              Yes

              <input name="schoolloopEvsd" type="radio" id="schoolloopEvsdn" value = "no" required/>
              No

PARENT/GUARDIAN INFORMATION

First Parent Guardian Information

            account_circle
            <input type="text" name="firstParent" class="validate" required>
            Name (First and Last)

            email
            <input type="email" name="firstParentEmailAddress" class="validate" required>
            Email

            phone
            <input type="text" name="firstParentPhoneNo" class="validate" required>
            Phone Number

            work
            <input type="text" name="firstParentEmployer" class="validate" required>
            Employer

We will use this information for the sole purpose of sending you your company's donation matching policy so that it is easier for you to pursue a corporate donation matching, which is a key source of funding for EVSD. Without this donation matching, more costs will have to be shared by the students and parents.

Second Parent Guardian Information

            account_circle
            <input type="text" name="secondParent" class="validate" required>
            Name (First and Last)

            email
            <input type="email" name="secondParentEmailAddress" class="validate" required>
            Email

            phone
            <input type="text" name="secondParentPhoneNo" class="validate" required>
            Phone Number

            work
            <input type="text" name="secondParentEmployer" class="validate" required>
            Employer

We will use this information for the sole purpose of sending you your company's donation matching policy so that it is easier for you to pursue a corporate donation matching, which is a key source of funding for EVSD. Without this donation matching, more costs will have to be shared by the students and parents.

MISCELLANEOUS

            location_on
            <textarea name="findOut" class="materialize-textarea"></textarea>
            How did the student find out about EVHS Speech and Debate?

            help
            <textarea name="whyjoin" class="materialize-textarea"></textarea>
            Why does the student want to join EVHS Speech and Debate?

            warning
            <textarea name="concerns" class="materialize-textarea"></textarea>
            Are there any concerns (including allergies, medical needs, or anything else) that we should be aware of?

Waiver

          <input type="checkbox" class="filled-in" id="filled-in-box" required>
          We, the student registering and the parent/guardian registering, will fill out, sign, and submit through this website the following form.

            File
            <input type="file" required>

            <input class="file-path validate" type="text" placeholder="Upload Signed Waiver">

Payment Information

EVSD Annual Contribution: $250

                As reviewed in the Parent Orientation, this is the bare minimum we need to cover coaching expenses and salaries, facilities, school tournament fees, club events, financial aid & subsidies to students, league fees, professional material, and much more.
                Most schools ask for around $400-$600, so we are trying our best to do with as little aid as possible. Please contact team administration at evhs.sd@gmail.com for questions or concerns.
                We use Paypal and Stripe software to power our payment process, which means our platform is verified and 100% safe. Because we are a registered 501c3 under California State Government and an ESUHSD Booster, your contribution is tax-deductible.

        {{> Template.dynamic template="creditCard" data="signup"}}

        <button type="submit" id="submitBtn" class="btn waves-effect waves-light" data-loading-text="Setting up your membership..">
          Sign me up
          send
        </button>

Hey look more hidden text

      </form>

</template>


text:
<?xml version="1.0" encoding="UTF-8"?>
<oval_definitions xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd    http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5">
  <generator>
    <oval:schema_version>5.9</oval:schema_version>
    <oval:timestamp>2009-05-21T11:46:00-04:00</oval:timestamp>
    <terms_of_use>Copyright (c) 2002-2011, The MITRE Corporation. All rights reserved. The contents of this file are subject to the license described in terms.txt.</terms_of_use>
  </generator>
  <definitions>
    <definition id="oval:org.mitre.oval.test:def:270" version="1" class="miscellaneous">
      <metadata>
        <title>Evaluate to true if the oval-def:local_variable construct is properly supported</title>
        <description>This definition is intended to evalutate to true if the interpreter properly supports the oval-def:local_variable construct.</description>
      </metadata>
      <criteria operator="AND">
        <criterion comment="Test that the local_variable construct is supported with a single value." test_ref="oval:org.mitre.oval.test:tst:827"/>
        <criterion comment="Test that the local_variable construct is supported with multiple values." test_ref="oval:org.mitre.oval.test:tst:553"/>
      </criteria>
    </definition>
  </definitions>
  <tests>
    <variable_test id="oval:org.mitre.oval.test:tst:827" version="1" comment="Test that the local_variable construct is supported with a single value." check_existence="at_least_one_exists" check="all" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <object object_ref="oval:org.mitre.oval.test:obj:677"/>
      <state state_ref="oval:org.mitre.oval.test:ste:590"/>
    </variable_test>
    <variable_test id="oval:org.mitre.oval.test:tst:553" version="1" comment="Test that the local_variable construct is supported with multiple values." check_existence="at_least_one_exists" check="all" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <object object_ref="oval:org.mitre.oval.test:obj:87"/>
      <state state_ref="oval:org.mitre.oval.test:ste:52"/>
    </variable_test>
  </tests>
  <objects>
    <variable_object id="oval:org.mitre.oval.test:obj:677" version="1" comment="This variable_object contains the int value '9'." xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <var_ref>oval:org.mitre.oval.test:var:540</var_ref>
    </variable_object>
    <variable_object id="oval:org.mitre.oval.test:obj:87" version="1" comment="This variable_object contains the int values '15',18','20','24','30','36','40', and '48'." xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <var_ref>oval:org.mitre.oval.test:var:302</var_ref>
    </variable_object>
  </objects>
  <states>
    <variable_state id="oval:org.mitre.oval.test:ste:590" version="1" comment="This state represents a variable_object where the value is equal to '9'." xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <value datatype="int">9</value>
    </variable_state>
    <variable_state id="oval:org.mitre.oval.test:ste:52" version="1" comment="This state represents a variable_object where all of the values are greater than '7'." xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
      <value datatype="int" operation="greater than">7</value>
    </variable_state>
  </states>
  <variables>
    <local_variable id="oval:org.mitre.oval.test:var:540" version="1" comment="A local_variable that contains the int value '9'." datatype="int">
      <literal_component>9</literal_component>
    </local_variable>
    <constant_variable id="oval:org.mitre.oval.test:var:302" version="1" comment="A constant_variable that contains the int values '15',18','20','24','30','36','40', and '48'." datatype="int">
      <value>15</value>
      <value>18</value>
      <value>20</value>
      <value>24</value>
      <value>30</value>
      <value>36</value>
      <value>40</value>
      <value>48</value>
    </constant_variable>
    <local_variable id="oval:org.mitre.oval.test:var:867" version="1" comment="A local_variable that contains the int values '15',18','20','24','30','36','40', and '48'." datatype="int">
      <variable_component var_ref="oval:org.mitre.oval.test:var:302"/>
    </local_variable>
  </variables>
</oval_definitions>


text:
title: Custom EntityFramework Provider
page_title: Custom EntityFramework Provider - RadGantt
description: Check our Web Forms article about Custom EntityFramework Provider.
slug: gantt/resources/data-binding/custom-entityframework-provider
tags: custom,entityframework,provider
published: True
position: 4
---

# Custom EntityFramework Provider

This help article extends the [Custom Entity Provider]({%slug gantt/data-binding/providers/custom-entityframework-provider%}) guidance. It shows how to add support for the **Resources** in the **Gantt** using Custom Provider.

## Implementing Resources using Custom Entity Provider.

To enable this functionality:

* a few additional methods of the custom provider needs to be overridden - *GetResources(), GetAssignments(), UpdateAssignment(), InsertAssignment() and DeleteAssignment()*.

* set the **EnableResources** property of the Gantt to **true**.

````C#
public override List<ITask> GetTasks()
{
  ...
}

public override ITask UpdateTask(ITask task)
{
  ...
}

public override ITask DeleteTask(ITask task)
{
   ...
}

public override ITask InsertTask(ITask task)
{
    ...
}

public override List<IDependency> GetDependencies()
{
    ...
}

public override IDependency DeleteDependency(IDependency dependency)
{
    ...
}

public override IDependency InsertDependency(IDependency dependency)
{
   ...
}

public override List<IResource> GetResources()
{
   ...
}

public override List<IAssignment> GetAssignments()
{
   ...
}

public override IAssignment UpdateAssignment(IAssignment assignment)
{
   ...
}

public override IAssignment InsertAssignment(IAssignment assignment)
{
   ...
}
public override IAssignment DeleteAssignment(IAssignment assignment)
{
   ...
}
````
````VB
Public Overrides Function GetTasks() As List(Of ITask)
    ...
End Function

Public Overrides Function UpdateTask(task As ITask) As ITask
    ....
End Function

Public Overrides Function InsertTask(task As ITask) As ITask
    ...
End Function

Public Overrides Function InsertTask(task As ITask) As ITask
    ...
End Function

Public Overrides Function GetDependencies() As List(Of IDependency)
    ...
End Function

Public Overrides Function DeleteDependency(dependency As IDependency) As IDependency
    ...
End Function

Public Overrides Function InsertDependency(dependency As IDependency) As IDependency
    ...
End Function

Public Overrides Function GetResources() As List(Of IResource)
    ...
End Function

Public Overrides Function GetAssignments() As List(Of IAssignment)
    ...
End Function

Public Overrides Function UpdateAssignment(assignment As IAssignment) As IAssignment
    ...
End Function

Public Overrides Function InsertAssignment(assignment As IAssignment) As IAssignment
    ...
End Function

Public Overrides Function DeleteAssignment(assignment As IAssignment) As IAssignment
    ...
End Function
````

[Here](https://www.telerik.com/support/code-library/implementing-gantt-resources-with-custom-entity-provider) you can find a code library with a runnable sample project, based the above instructions.

# See Also

 * [Resources]({%slug gantt/resources/overview%})

 * [Custom Entity Provider]({%slug gantt/data-binding/providers/custom-entityframework-provider%})


text:
char *GetFirst (char *Directory);
char *GetNext (void);
void Debug (char DisplayMsg, char *msg, ...);
void ShowDebuggers (int val);

#define RETRY_MODE    1
#define NO_RETRY_MODE 2

int SendPrinterCommand (char *Command, int Mode);