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

<title>BinaryOp (dollar-script 0.4.5195 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="date" content="2017-09-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

SEARCH:
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package dollar.internal.runtime.script.operators

Class BinaryOp

java.lang.Object

dollar.internal.runtime.script.operators.BinaryOp

All Implemented Interfaces:

Operator, java.util.function.BiFunction<T,T,T>, java.util.function.BinaryOperator<dollar.api.Value>

public class BinaryOp
extends java.lang.Object
implements java.util.function.BinaryOperator<dollar.api.Value>, Operator

Constructor Summary

Constructors

Constructor
Description

BinaryOp(boolean immediate,
        @NotNull Op operation,
        @NotNull dollar.api.script.DollarParser parser,
        @NotNull java.util.function.BiFunction<dollar.api.Value,dollar.api.Value,dollar.api.Value> function,
        boolean pure)

BinaryOp(@NotNull dollar.api.script.DollarParser parser,
        @NotNull Op operation,
        @NotNull java.util.function.BiFunction<dollar.api.Value,dollar.api.Value,dollar.api.Value> function,
        boolean pure)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method
Description

@NotNull dollar.api.Value
apply(@NotNull dollar.api.Value lhs,
     @NotNull dollar.api.Value rhs)

void
setSource(@NotNull dollar.api.script.Source source)

void
validate(@NotNull Op op)

Methods inherited from interface java.util.function.BiFunction

andThen

Methods inherited from interface java.util.function.BinaryOperator

maxBy, minBy

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

BinaryOp

public BinaryOp(@NotNull
                @NotNull dollar.api.script.DollarParser parser,
                @NotNull
                @NotNull Op operation,
                @NotNull
                @NotNull java.util.function.BiFunction<dollar.api.Value,dollar.api.Value,dollar.api.Value> function,
                boolean pure)

BinaryOp

public BinaryOp(boolean immediate,
                @NotNull
                @NotNull Op operation,
                @NotNull
                @NotNull dollar.api.script.DollarParser parser,
                @NotNull
                @NotNull java.util.function.BiFunction<dollar.api.Value,dollar.api.Value,dollar.api.Value> function,
                boolean pure)

Method Detail

apply

@NotNull
public @NotNull dollar.api.Value apply(@NotNull
                                       @NotNull dollar.api.Value lhs,
                                       @NotNull
                                       @NotNull dollar.api.Value rhs)

Specified by:

apply in interface java.util.function.BiFunction<T extends java.lang.Object,T extends java.lang.Object,T extends java.lang.Object>

setSource

public void setSource(@NotNull
                      @NotNull dollar.api.script.Source source)

Specified by:

setSource in interface Operator

validate

public void validate(@NotNull
                     @NotNull Op op)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2017. All rights reserved.


text:
package com.photoviewer.presentation.di.modules;

import dagger.Module;
import dagger.Provides;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import javax.inject.Named;
import javax.inject.Singleton;

@Module(library = true, complete = false) public class RxModule {

  public static final String COMPUTATION = "computation";
  public static final String IO = "io";
  public static final String MAIN_THREAD = "main_thread";

  @Provides @Singleton @Named(IO) Scheduler provideIoScheduler() {
    return Schedulers.io();
  }

  @Provides @Singleton @Named(MAIN_THREAD)
  Scheduler provideMainScheduler() {
    return AndroidSchedulers.mainThread();
  }

  @Provides @Singleton @Named(COMPUTATION) Scheduler provideComputationScheduler() {
    return Schedulers.computation();
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.mifos.test.acceptance.collectionsheet;

import java.io.IOException;
import java.sql.SQLException;

import org.dbunit.DatabaseUnitException;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.mifos.framework.util.DbUnitUtilities;
import org.mifos.test.acceptance.framework.ClientsAndAccountsHomepage;
import org.mifos.test.acceptance.framework.HomePage;
import org.mifos.test.acceptance.framework.MifosPage;
import org.mifos.test.acceptance.framework.UiTestCaseBase;
import org.mifos.test.acceptance.framework.collectionsheet.CollectionSheetEntryConfirmationPage;
import org.mifos.test.acceptance.framework.collectionsheet.CollectionSheetEntryEnterDataPage;
import org.mifos.test.acceptance.framework.collectionsheet.CollectionSheetEntryPreviewDataPage;
import org.mifos.test.acceptance.framework.collectionsheet.CollectionSheetEntrySelectPage;
import org.mifos.test.acceptance.framework.collectionsheet.CollectionSheetEntrySelectPage.SubmitFormParameters;
import org.mifos.test.acceptance.framework.testhelpers.CollectionSheetEntryTestHelper;
import org.mifos.test.acceptance.remote.InitializeApplicationRemoteTestingService;
import org.mifos.test.framework.util.SimpleDataSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;

@ContextConfiguration(locations={"classpath:ui-test-context.xml"})
@Test(sequential = true, groups = {"collectionsheet","acceptance","ui"})
public class CollectionSheetEntryAttendanceTest extends UiTestCaseBase {

    private static final int ATTENDANCE_P = CollectionSheetEntryEnterDataPage.ATTENDANCE_P;
    private static final int ATTENDANCE_A = CollectionSheetEntryEnterDataPage.ATTENDANCE_A;
    private static final int ATTENDANCE_AA = CollectionSheetEntryEnterDataPage.ATTENDANCE_AA;
    private static final int ATTENDANCE_L = CollectionSheetEntryEnterDataPage.ATTENDANCE_L;

    private static final int[] BASIC_ATTENDANCE_VALUES = new int[] { ATTENDANCE_L, ATTENDANCE_AA, ATTENDANCE_A, ATTENDANCE_P };
    private static final int[] OVERWRITE_ATTENDANCE_VALUES = new int[] { ATTENDANCE_P, ATTENDANCE_P, ATTENDANCE_P, ATTENDANCE_L };
    private static final int[] SECOND_CENTER_ATTENDANCE_VALUES = new int[] { ATTENDANCE_AA, ATTENDANCE_A, ATTENDANCE_L };

    private static final String CUSTOMER_ATTENDANCE = "CUSTOMER_ATTENDANCE";

    @Autowired
    private DriverManagerDataSource dataSource;
    @Autowired
    private DbUnitUtilities dbUnitUtilities;
    @Autowired
    private InitializeApplicationRemoteTestingService initRemote;

    @AfterMethod(alwaysRun = true)
    public void logOut() {
        (new MifosPage(selenium)).logout();
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    @Test(sequential = true, groups = {"smoke"})
    public void defaultAdminUserEntersAttendanceData() throws Exception {
        enterAndVerifyBasicAttendanceData();
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    public void secondCollectionSheetEntryOverwritesFirstAttendanceData() throws Exception {
        CollectionSheetEntryConfirmationPage confirmationPage = enterAndVerifyBasicAttendanceData();
        verifyAttendanceData(this.getBasicAttendanceDataSet());
        SubmitFormParameters formParameters = getFormParametersForCenter2();
        enterAttendanceDataForSecondCenter(confirmationPage, formParameters, OVERWRITE_ATTENDANCE_VALUES, getOverwriteAttendanceDataSet());
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    public void enteringAttendanceDataForOneCenterDoesNotAffectOtherCenters() throws Exception {
        CollectionSheetEntryConfirmationPage confirmationPage = enterAndVerifyBasicAttendanceData();
        verifyAttendanceData(this.getBasicAttendanceDataSet());
        SubmitFormParameters formParameters = getFormParametersForCenter1();
        enterAttendanceDataForSecondCenter(confirmationPage, formParameters, SECOND_CENTER_ATTENDANCE_VALUES, getTwoCenterAttendanceDataSet());
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    private void enterAttendanceDataForSecondCenter(CollectionSheetEntryConfirmationPage confirmationPage, SubmitFormParameters formParameters, int[] attendanceValues, IDataSet dataSetToVerify)
    throws Exception, DataSetException, IOException {
        HomePage homePage = confirmationPage.navigateToHomePage();
        ClientsAndAccountsHomepage clientsAndAccountsPage = homePage.navigateToClientsAndAccountsUsingHeaderTab();
        CollectionSheetEntrySelectPage selectPage = clientsAndAccountsPage.navigateToEnterCollectionSheetDataUsingLeftMenu();
        CollectionSheetEntryEnterDataPage enterDataPage = selectPage.submitAndGotoCollectionSheetEntryEnterDataPage(formParameters);
        enterAttendanceData(enterDataPage, attendanceValues);
        submitDataAndVerifySuccessPage(formParameters, enterDataPage);
        verifyAttendanceData(dataSetToVerify);
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    public CollectionSheetEntryConfirmationPage enterAndVerifyBasicAttendanceData() throws DatabaseUnitException, SQLException, IOException,
            Exception, DataSetException {
        initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "acceptance_small_001_dbunit.xml.zip", dataSource, selenium);
        SubmitFormParameters formParameters = getFormParametersForCenter2();
        CollectionSheetEntryEnterDataPage enterDataPage = navigateToCollectionSheetEntryPage(formParameters);
        enterAttendanceData(enterDataPage, BASIC_ATTENDANCE_VALUES);
        CollectionSheetEntryConfirmationPage confirmationPage = submitDataAndVerifySuccessPage(formParameters, enterDataPage);
        verifyAttendanceData(getBasicAttendanceDataSet());
        return confirmationPage;
    }

    private void enterAttendanceData(CollectionSheetEntryEnterDataPage enterDataPage, int[] attendanceValues) {
        int id = 0;
    	for (int attendance : attendanceValues) {
            enterDataPage.enterAttendance(id, attendance);
            id++;
        }
    }

    private CollectionSheetEntryEnterDataPage navigateToCollectionSheetEntryPage(SubmitFormParameters formParameters) {
        CollectionSheetEntrySelectPage selectPage = new CollectionSheetEntryTestHelper(selenium).loginAndNavigateToCollectionSheetEntrySelectPage();
        selectPage.verifyPage();
        CollectionSheetEntryEnterDataPage enterDataPage = selectPage
                .submitAndGotoCollectionSheetEntryEnterDataPage(formParameters);
        return enterDataPage;
    }

    private CollectionSheetEntryConfirmationPage submitDataAndVerifySuccessPage(SubmitFormParameters formParameters,
            CollectionSheetEntryEnterDataPage enterDataPage) {
        CollectionSheetEntryPreviewDataPage previewPage =
            enterDataPage.submitAndGotoCollectionSheetEntryPreviewDataPage();
        previewPage.verifyPage(formParameters);
        CollectionSheetEntryConfirmationPage confirmationPage =
            previewPage.submitAndGotoCollectionSheetEntryConfirmationPage();
        confirmationPage.verifyPage();
        return confirmationPage;
    }

    private SubmitFormParameters getFormParametersForCenter2() {
        SubmitFormParameters formParameters = new SubmitFormParameters();
        formParameters.setBranch("Office2");
        formParameters.setLoanOfficer("John Okoth");
        formParameters.setCenter("Center2");
        formParameters.setPaymentMode("Cash");
        return formParameters;
    }

    private SubmitFormParameters getFormParametersForCenter1() {
        SubmitFormParameters formParameters = new SubmitFormParameters();
        formParameters.setBranch("Office1");
        formParameters.setLoanOfficer("Bagonza Wilson");
        formParameters.setCenter("Center1");
        formParameters.setPaymentMode("Cash");
        return formParameters;
    }

    @SuppressWarnings("PMD.SignatureDeclareThrowsException") // one of the dependent methods throws Exception
    private void verifyAttendanceData(IDataSet attendanceDataSet) throws Exception {
        IDataSet databaseDataSet = dbUnitUtilities.getDataSetForTable(dataSource, CUSTOMER_ATTENDANCE);
        dbUnitUtilities.verifyTable(CUSTOMER_ATTENDANCE, databaseDataSet, attendanceDataSet);
    }

    private IDataSet getBasicAttendanceDataSet() throws DataSetException, IOException {
        SimpleDataSet attendanceDataSet = new SimpleDataSet();
        addBasicAttendanceRows(attendanceDataSet);
        return attendanceDataSet.getDataSet();
    }

    private IDataSet getOverwriteAttendanceDataSet() throws DataSetException, IOException {
        SimpleDataSet attendanceDataSet = new SimpleDataSet();
        addAttendanceRow(attendanceDataSet, 1, 8, ATTENDANCE_P);
        addAttendanceRow(attendanceDataSet, 2, 9, ATTENDANCE_P);
        addAttendanceRow(attendanceDataSet, 3, 10, ATTENDANCE_P);
        addAttendanceRow(attendanceDataSet, 4, 11, ATTENDANCE_L);
        return attendanceDataSet.getDataSet();
    }

    private IDataSet getTwoCenterAttendanceDataSet() throws DataSetException, IOException {
        SimpleDataSet attendanceDataSet = new SimpleDataSet();
        addBasicAttendanceRows(attendanceDataSet);
        addAttendanceRow(attendanceDataSet, 5, 3, ATTENDANCE_AA);
        addAttendanceRow(attendanceDataSet, 6, 4, ATTENDANCE_A);
        addAttendanceRow(attendanceDataSet, 7, 5, ATTENDANCE_L);
        return attendanceDataSet.getDataSet();
    }

    private void addBasicAttendanceRows(SimpleDataSet attendanceDataSet) {
        addAttendanceRow(attendanceDataSet, 1, 8, ATTENDANCE_L);
        addAttendanceRow(attendanceDataSet, 2, 9, ATTENDANCE_AA);
        addAttendanceRow(attendanceDataSet, 3, 10, ATTENDANCE_A);
        addAttendanceRow(attendanceDataSet, 4, 11, ATTENDANCE_P);
    }

    private void addAttendanceRow(SimpleDataSet dataSet, int id, int customerId, int attendance) {
        dataSet.row(CUSTOMER_ATTENDANCE, "ID=" + id,"MEETING_DATE=[null]","CUSTOMER_ID=" + customerId,"ATTENDANCE=" + attendance);
    }

}


text:
package de.hpi.bpt.chimera.parser.datamodel;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import de.hpi.bpt.chimera.validation.NameValidation;
import de.hpi.bpt.chimera.model.datamodel.DataClass;
import de.hpi.bpt.chimera.model.datamodel.DataModel;

public class DataModelParser {
	private static final Logger log = Logger.getLogger((DataModelParser.class).getName());

	private DataModelParser() {
	}

	/**
	 * Parse DataModel out of datamodelJson.
	 *
	 * @param datamodelJson
	 * @return DataModel
	 */
	public static DataModel parseDataModel(final JSONObject datamodelJson) {
		DataModel dataModel = new DataModel();
		try {
			int versionNumber = datamodelJson.getInt("revision");
			dataModel.setVersionNumber(versionNumber);

			List<DataClass> dataModelClasses = getDataModelClasses(datamodelJson.getJSONArray("dataclasses"));
			dataModel.setDataModelClasses(dataModelClasses);
		} catch (JSONException e) {
			log.error(e);
			throw new JSONException("Invalid DataModel->" + e.getMessage());
		}
		return dataModel;
	}

	/**
	 * Create List of DataClasses and EventClasses. Uses DataModelClassParser.
	 * Therefore check whether DataModelClass is DataClass or EventClass.
	 *
	 * @param classJsonArray
	 * @return List of DataModelClasses
	 */
	private static List<DataClass> getDataModelClasses(final JSONArray classJsonArray) {
		int arraySize = classJsonArray.length();
		List<DataClass> dataModelClasses = new ArrayList<>();

		for (int i = 0; i < arraySize; i++) {
			JSONObject classJson = classJsonArray.getJSONObject(i);

			// TODO: rework parsing of event class
			try {
				if (classJson.getBoolean("is_event")) {
					DataClass eventClass = DataModelClassParser.parseDataClass(classJson);
					eventClass.setEvent(true);
					dataModelClasses.add(eventClass);
				} else {
					dataModelClasses.add(DataModelClassParser.parseDataClass(classJson));
				}
			} catch (JSONException e) {
				log.error(e);
				throw new JSONException("Invalid DataModelClass->" + e.getMessage());
			}
		}

		NameValidation.validateNameFrequency(dataModelClasses);

		return dataModelClasses;
	}
}


text:
package au.gov.ga.geodesy.support.mapper.orika.geodesyml;

import au.gov.ga.geodesy.domain.model.sitelog.SiteIdentification;
import au.gov.ga.geodesy.port.adapter.geodesyml.GeodesyMLMarshaller;
import au.gov.ga.geodesy.port.adapter.geodesyml.GeodesyMLUtils;
import au.gov.ga.geodesy.support.TestResources;
import au.gov.ga.geodesy.support.marshalling.moxy.GeodesyMLMoxy;
import au.gov.ga.geodesy.support.utils.GMLDateUtils;
import au.gov.xml.icsm.geodesyml.v_0_3.GeodesyMLType;
import au.gov.xml.icsm.geodesyml.v_0_3.SiteIdentificationType;
import au.gov.xml.icsm.geodesyml.v_0_3.SiteLogType;
import org.testng.annotations.Test;

import java.io.Reader;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class SiteIdentificationMapperTest {

    private SiteIdentificationMapper mapper = new SiteIdentificationMapper();
    private GeodesyMLMarshaller marshaller = new GeodesyMLMoxy();

    /**
     * Test mapping from SiteIdentificationType to SiteIdentification and back
     * to SiteIdentificationType.
     **/
    @Test
    public void testMapping() throws Exception {
        try (Reader mobs = TestResources.customGeodesyMLSiteLogReader("MOBS")) {
            GeodesyMLType geodesyML = marshaller.unmarshal(mobs, GeodesyMLType.class).getValue();
            SiteLogType siteLogType = GeodesyMLUtils.getElementFromJAXBElements(geodesyML.getElements(), SiteLogType.class)
                .findFirst()
                .get();

            SiteIdentificationType siteIdTypeA = siteLogType.getSiteIdentification();
            SiteIdentification siteId = mapper.to(siteIdTypeA);

            assertThat(siteId.getSiteName(), equalTo(siteIdTypeA.getSiteName()));
            assertThat(siteId.getFourCharacterId(), equalTo(siteIdTypeA.getFourCharacterID()));
            assertThat(siteId.getMonumentInscription(), equalTo(siteIdTypeA.getMonumentInscription()));
            assertThat(siteId.getIersDOMESNumber(), equalTo(siteIdTypeA.getIersDOMESNumber()));
            assertThat(siteId.getCdpNumber(), equalTo(siteIdTypeA.getCdpNumber()));
            assertThat(siteId.getMonumentDescription(), equalTo(siteIdTypeA.getMonumentDescription().getValue()));
            assertThat(siteId.getHeightOfMonument(), equalTo(String.valueOf(siteIdTypeA.getHeightOfTheMonument())));
            assertThat(siteId.getMonumentFoundation(), equalTo(siteIdTypeA.getMonumentFoundation()));
            assertThat(siteId.getFoundationDepth(), equalTo(String.valueOf(siteIdTypeA.getFoundationDepth())));
            assertThat(siteId.getMarkerDescription(), equalTo(siteIdTypeA.getMarkerDescription()));
            assertThat(siteId.getDateInstalled(), equalTo(GMLDateUtils.stringToDateMultiParsers(siteIdTypeA.getDateInstalled().getValue().get(0))));
            assertThat(siteId.getGeologicCharacteristic(), equalTo(siteIdTypeA.getGeologicCharacteristic().getValue()));
            assertThat(siteId.getBedrockType(), equalTo(siteIdTypeA.getBedrockType()));
            assertThat(siteId.getBedrockCondition(), equalTo(siteIdTypeA.getBedrockCondition()));
            assertThat(siteId.getFractureSpacing(), equalTo(siteIdTypeA.getFractureSpacing()));
            assertThat(siteId.getFaultZonesNearby(), equalTo(siteIdTypeA.getFaultZonesNearby().getValue()));
            assertThat(siteId.getDistanceActivity(), equalTo(siteIdTypeA.getDistanceActivity()));
            assertThat(siteId.getNotes(), equalTo(siteIdTypeA.getNotes()));

            SiteIdentificationType siteIdTypeB = mapper.from(siteId);

            assertThat(siteIdTypeB.getSiteName(), equalTo(siteId.getSiteName()));
            assertThat(siteIdTypeB.getFourCharacterID(),equalTo( siteId.getFourCharacterId()));
            assertThat(siteIdTypeB.getMonumentInscription(), equalTo(siteId.getMonumentInscription()));
            assertThat(siteIdTypeB.getIersDOMESNumber(), equalTo(siteId.getIersDOMESNumber()));
            assertThat(siteIdTypeB.getCdpNumber(), equalTo(siteId.getCdpNumber()));
            assertThat(siteIdTypeB.getMonumentDescription().getValue(), equalTo(siteId.getMonumentDescription()));
            assertThat(siteIdTypeB.getMonumentDescription().getCodeSpace(), equalTo("eGeodesy/monumentDescription"));
            assertThat(String.valueOf(siteIdTypeB.getHeightOfTheMonument()), equalTo(siteId.getHeightOfMonument()));
            assertThat(siteIdTypeB.getMonumentFoundation(), equalTo(siteId.getMonumentFoundation()));
            assertThat(String.valueOf(siteIdTypeB.getFoundationDepth()), equalTo(siteId.getFoundationDepth()));
            assertThat(siteIdTypeB.getMarkerDescription(), equalTo(siteId.getMarkerDescription()));
            assertThat(GMLDateUtils.stringToDateMultiParsers(siteIdTypeB.getDateInstalled().getValue().get(0)), equalTo(siteId.getDateInstalled()));
            assertThat(siteIdTypeB.getGeologicCharacteristic().getValue(), equalTo(siteId.getGeologicCharacteristic()));
            assertThat(siteIdTypeB.getGeologicCharacteristic().getCodeSpace(), equalTo("eGeodesy/geologicCharacteristic"));
            assertThat(siteIdTypeB.getBedrockType(), equalTo(siteId.getBedrockType()));
            assertThat(siteIdTypeB.getBedrockCondition(), equalTo(siteId.getBedrockCondition()));
            assertThat(siteIdTypeB.getFractureSpacing(), equalTo(siteId.getFractureSpacing()));
            assertThat(siteIdTypeB.getFaultZonesNearby().getValue(), equalTo(siteId.getFaultZonesNearby()));
            assertThat(siteIdTypeB.getFaultZonesNearby().getCodeSpace(), equalTo("eGeodesy/faultZonesNearby"));
            assertThat(siteIdTypeB.getDistanceActivity(), equalTo(siteId.getDistanceActivity()));
            assertThat(siteIdTypeB.getNotes(), equalTo(siteId.getNotes()));
        }
    }
}


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

import java.util.Map;
import java.util.Map.Entry;

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

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

/**
 * TestInvokeMethodResult JSON Unmarshaller
 */
public class TestInvokeMethodResultJsonUnmarshaller implements
        Unmarshaller<TestInvokeMethodResult, JsonUnmarshallerContext> {

    public TestInvokeMethodResult unmarshall(JsonUnmarshallerContext context)
            throws Exception {
        TestInvokeMethodResult testInvokeMethodResult = new TestInvokeMethodResult();

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

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

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

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("status", targetDepth)) {
                    context.nextToken();
                    testInvokeMethodResult.setStatus(IntegerJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("body", targetDepth)) {
                    context.nextToken();
                    testInvokeMethodResult.setBody(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("headers", targetDepth)) {
                    context.nextToken();
                    testInvokeMethodResult
                            .setHeaders(new MapUnmarshaller<String, String>(
                                    StringJsonUnmarshaller.getInstance(),
                                    StringJsonUnmarshaller.getInstance())
                                    .unmarshall(context));
                }
                if (context.testExpression("log", targetDepth)) {
                    context.nextToken();
                    testInvokeMethodResult.setLog(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("latency", targetDepth)) {
                    context.nextToken();
                    testInvokeMethodResult.setLatency(LongJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null
                        || context.getLastParsedParentElement().equals(
                                currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return testInvokeMethodResult;
    }

    private static TestInvokeMethodResultJsonUnmarshaller instance;

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


text:
package com.sksamuel.elastic4s.http

import com.sksamuel.elastic4s.Show
import com.sksamuel.exts.Logging
import com.sksamuel.exts.OptionImplicits._

/**
  * @tparam T the type of the request object handled by this handler
  * @tparam U the type of the response object returned by this handler
  */
abstract class Handler[T, U: Manifest] extends Logging {
  def responseHandler: ResponseHandler[U] = ResponseHandler.default[U]
  def build(t: T): ElasticRequest
}

// models everything needed to send the request to elasticsearch
// all request types, like SearchRequest, UpdateRequest, etc ultimately are converted
// into this case class by a RequestBuilder instance.
case class ElasticRequest(method: String, endpoint: String, params: Map[String, String], entity: Option[HttpEntity])

object ElasticRequestShow extends Show[ElasticRequest] {
  override def show(t: ElasticRequest): String = {
    val header = s"${t.method}:${t.endpoint}?${t.params.map { case (k, v) => k + "=" + v }.mkString("&")}"
    t.entity.fold(header) { body =>
      s"$header\n$body"
    }
  }
}

object ElasticRequest {

  def apply(method: String, endpoint: String): ElasticRequest = apply(method, endpoint, Map.empty[String, Any])

  def apply(method: String, endpoint: String, body: HttpEntity): ElasticRequest =
    apply(method, endpoint, Map.empty[String, Any], body)

  def apply(method: String, endpoint: String, params: Map[String, Any]): ElasticRequest =
    apply(method, endpoint, params.mapValues(_.toString), None)

  def apply(method: String, endpoint: String, params: Map[String, Any], body: HttpEntity): ElasticRequest =
    apply(method, endpoint, params.mapValues(_.toString), body.some)
}


text:
<?php
namespace Bolt\Extension\IComeFromTheNet\BookMe\Bundle\Ledger\Schema;

use Bolt\Extension\IComeFromTheNet\BookMe\Model\VirtualColumnTable;

class LedgerJournalTypeTable extends VirtualColumnTable
{

    /**
     * {@inheritdoc}
     */
    protected function addColumns()
    {

        $this->table->addOption('comment','Defines the Journal Types used in Transaction Grouping');

        $this->table->addColumn('journal_type_id',"integer",array("unsigned" => true, "autoincrement" => true));
        $this->table->addColumn('journal_name',"string",array("length" => 50));
        $this->table->addColumn('journal_name_slug',"string",array("length" => 50));
        $this->table->addColumn('hide_ui',"boolean",array("default" => false));

    }

    /**
     * {@inheritdoc}
     */
    protected function addIndexes()
    {

    }

    /**
     * {@inheritdoc}
     */
    protected function setPrimaryKey()
    {
        $this->table->setPrimaryKey(array("journal_type_id"));
    }

    /**
     * Set the table's foreign key constraints.
     */
    protected function addForeignKeyConstraints()
    {

    }
}
/* End of Table */


text:
import random
import unittest
from robot.output.loggerhelper import LEVELS

from robot.reporting.jsmodelbuilders import JsBuildingContext
from robot.utils.asserts import assert_equals

class TestStringContext(unittest.TestCase):

    def test_add_empty_string(self):
        self._verify([''], [0] , ('*',))

    def test_add_text(self):
        self._verify(['Hello!'], [1] , ('*', '*Hello!'))

    def test_add_several_texts(self):
        self._verify(['Hello!', '', 'Foo'], [1, 0, 2] , ('*', '*Hello!', '*Foo'))

    def _verify(self, strings, exp_ids, exp_strings):
        ctx = JsBuildingContext()
        results = [ctx.string(s) for s in strings]
        assert_equals(results, exp_ids)
        assert_equals(ctx.strings, exp_strings)

class TestTimestamp(unittest.TestCase):

    def setUp(self):
        self._context = JsBuildingContext()

    def test_timestamp(self):
        assert_equals(self._context.timestamp('20110603 12:00:00.042'), 0)
        assert_equals(self._context.timestamp('20110603 12:00:00.043'), 1)
        assert_equals(self._context.timestamp('20110603 12:00:00.000'), -42)
        assert_equals(self._context.timestamp('20110603 12:00:01.041'), 999)
        assert_equals(self._context.timestamp('20110604 12:00:00.042'),
                      24 * 60 * 60 * 1000)

    def test_none_timestamp(self):
        assert_equals(self._context.timestamp(None), None)

class TestMinLogLevel(unittest.TestCase):

    def setUp(self):
        self._context = JsBuildingContext()

    def test_trace_is_identified_as_smallest_log_level(self):
        self._messages(LEVELS.keys())
        assert_equals('TRACE', self._context.min_level)

    def test_debug_is_identified_when_no_trace(self):
        self._messages([l for l in LEVELS if l != 'TRACE'])
        assert_equals('DEBUG', self._context.min_level)

    def test_info_is_smallest_when_no_debug_or_trace(self):
        self._messages(['INFO', 'WARN', 'ERROR', 'FAIL'])
        assert_equals('INFO', self._context.min_level)

    def _messages(self, levels):
        levels = levels[:]
        random.shuffle(levels)
        for level in levels:
            self._context.message_level(level)

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


text:
module Capybara
  module Facebook
    module Macros
      VERSION = "0.1"
    end
  end
end


text:
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Friend Class clsCapture

	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	'       Visual Basic 4.0 16 Capture Routines
	'
	' This module contains several routines for capturing windows into a
	' picture.  All the routines work on 16 bit Windows
	' platforms.
	' The routines also have palette support.
	'
	' CreateBitmapPicture - Creates a picture object from a bitmap and
	' palette.
	' CaptureWindow - Captures any window given a window handle.
	' CaptureActiveWindow - Captures the active window on the desktop.
	' CaptureForm - Captures the entire form.
	' CaptureClient - Captures the client area of a form.
	' CaptureScreen - Captures the entire screen.
	' PrintPictureToFitPage - prints any picture as big as possible on
	' the page.
	'
	' NOTES
	'    - No error trapping is included in these routines.
	'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

	Private Const NormFont As String = "Arial"
	Private Const NormSize As Short = 9
	Private Const RASTERCAPS As Integer = 38
	Private Const RC_PALETTE As Integer = &H100
	Private Const SIZEPALETTE As Integer = 104
	Private Const COLOR_BTNFACE As Short = 15

	'**************************************************************************
	' CreateBitmapPicture - Creates a bitmap type Picture object from a
	'                       bitmap and palette.
	' hBmp - Handle to a bitmap.
	'
	' hPal - Handle to a Palette. (Can be null if the bitmap doesn't
	'        use a palette.)
	'
	' Returns - A Picture object containing the bitmap.
	'**************************************************************************
	Public Function CreateBitmapPicture(ByVal hBmp As Integer, ByVal hPal As Integer) As System.Drawing.Image

		Dim r As Integer
		Dim pic As PicBmp
        Dim IPic As System.Drawing.Bitmap
		'UPGRADE_WARNING: Arrays in structure IID_IDispatch may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
		Dim IID_IDispatch As GUID

		'**************************************************************************
		'* Fill in with IDispatch Interface ID.
        '**************************************************************************
        IID_IDispatch.Data1 = &H20400
        IID_IDispatch.Data4(0) = &HC0
        IID_IDispatch.Data4(7) = &H46

        '**************************************************************************
        '* Fill Pic with necessary parts.
        '**************************************************************************
        pic.Size = Len(pic) ' Length of structure.
        pic.hBmp = hBmp ' Handle to bitmap.
        pic.hPal = hPal ' Handle to palette (may be null).

        '**************************************************************************
        '* Create Picture object and return it.
        '**************************************************************************
        r = OleCreatePictureIndirect(pic, IID_IDispatch, 1, IPic)
        CreateBitmapPicture = IPic

	End Function

	'**************************************************************************
	' CaptureWindow - Captures any portion of a window.
	'
	' hWndSrc - Handle to the window to be captured.
	'
	' Client - If True CaptureWindow captures from the client area of the
	'          window. If False CaptureWindow captures from the entire window.
	'
	' iLeft, iTop, iWidth, iHeight - Specify the portion of the window
	'                                        to capture. Dimensions need to be
	'                                        specified in pixels.
	'
	' Returns - A Picture object containing a bitmap of the specified
	'           portion of the window that was captured.
	'**************************************************************************
	Public Function CaptureWindow(ByVal hWndSrc As Integer, ByVal Client As Boolean, ByVal iLeft As Integer, ByVal iTop As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, Optional ByRef vMakeSemiMono As Object = Nothing) As System.Drawing.Image

		Dim bMakeSemiMono As Boolean
		Dim hDCMemory As Integer
		Dim hBmp As Integer
		Dim hBmpPrev As Integer
		Dim r As Integer
		Dim hDCSrc As Integer
		Dim hPal As Integer
		Dim hPalPrev As Integer
		Dim RasterCapsScrn As Integer
		Dim HasPaletteScrn As Integer
		Dim PaletteSizeScrn As Integer
		'UPGRADE_WARNING: Arrays in structure LogPal may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
		Dim LogPal As LOGPALETTE

		On Error Resume Next

		bMakeSemiMono = False
		'UPGRADE_NOTE: IsMissing() was changed to IsNothing(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8AE1CB93-37AB-439A-A4FF-BE3B6760BB23"'
		'UPGRADE_WARNING: Couldn't resolve default property of object vMakeSemiMono. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If Not (IsNothing(vMakeSemiMono)) Then bMakeSemiMono = vMakeSemiMono

		'**************************************************************************
		'* Depending on the value of Client get the proper device context.
		'**************************************************************************
		hDCSrc = IIf(Client, GetDC(hWndSrc), GetWindowDC(hWndSrc))

		'**************************************************************************
		'* Create a memory device context for the copy process. Then create a
		'* bitmap and place it in the memory DC.
		'**************************************************************************
		hDCMemory = CreateCompatibleDC(hDCSrc)
		hBmp = CreateCompatibleBitmap(hDCSrc, iWidth, iHeight)
		hBmpPrev = SelectObject(hDCMemory, hBmp)

		'**************************************************************************
		'* Set all the pixels in the memory DC to white. (This is incase we call
		'* TransBmp below.)
		'**************************************************************************
		r = BitBlt(hDCMemory, 0, 0, iWidth, iHeight, hDCSrc, iLeft, iTop, &HFF0062)

		'**************************************************************************
		'* Get screen properties.
		'**************************************************************************
		RasterCapsScrn = GetDeviceCaps(hDCSrc, RASTERCAPS) ' Raster capabilities.
		HasPaletteScrn = RasterCapsScrn And RC_PALETTE ' Palette support.
		PaletteSizeScrn = GetDeviceCaps(hDCSrc, SIZEPALETTE) ' Size of palette.

		'**************************************************************************
		'* If the screen has a palette make a copy and realize it.
		'**************************************************************************
		If (HasPaletteScrn And (PaletteSizeScrn = 256)) Then
			LogPal.palVersion = &H300
			LogPal.palNumEntries = 256
			r = GetSystemPaletteEntries(hDCSrc, 0, 256, LogPal.palPalEntry(0))
			hPal = CreatePalette(LogPal)

			'************************************************************************
			'* Select the new palette into the memory DC and realize it.
			'************************************************************************
			hPalPrev = SelectPalette(hDCMemory, hPal, 0)
			r = RealizePalette(hDCMemory)
		End If

		'**************************************************************************
		'* If the button face color should be converted to white then create the
		'* bitmap in the memory DC via the TransBmp function rather than BitBlt.
		'**************************************************************************
		If (bMakeSemiMono) Then
			Call TransBmp(hDCMemory, hDCSrc, iLeft, iTop, iWidth, iHeight, 0, 0, GetSysColor(COLOR_BTNFACE))
		Else
			'************************************************************************
			'* Copy the on-screen image into the memory DC. Then remove the new copy
			'* of the on-screen image.
			'************************************************************************
            Dim vbSrcCopy As Integer = &HCC0020
            r = BitBlt(hDCMemory, 0, 0, iWidth, iHeight, hDCSrc, iLeft, iTop, vbSrcCopy)
		End If

		hBmp = SelectObject(hDCMemory, hBmpPrev)

		'**************************************************************************
		'* If screen has a palette, get back the palette selected previously.
		'**************************************************************************
		If (HasPaletteScrn And (PaletteSizeScrn = 256)) Then hPal = SelectPalette(hDCMemory, hPalPrev, 0)

		'**************************************************************************
		'* Release the device context resources back to the system.
		'**************************************************************************
		r = DeleteDC(hDCMemory)
		r = ReleaseDC(hWndSrc, hDCSrc)

		'**************************************************************************
		'* Call CreateBitmapPicture to create a picture object from the bitmap and
		'* palette handles. Then return the resulting picture object.
		'**************************************************************************
		CaptureWindow = CreateBitmapPicture(hBmp, hPal)

	End Function

	'**************************************************************************
	' CaptureWindowArea - Captures an area of a form.
	'
	' frmSrc - The Form object to capture.
	'
	' Returns - A Picture object containing a bitmap of the entire form.
	'**************************************************************************
	Public Function CaptureWindowArea(ByRef frmSrc As System.Windows.Forms.Form, ByRef iLeft As Integer, ByRef iTop As Integer, ByRef iWidth As Integer, ByRef iHeight As Integer, Optional ByRef vMakeSemiMono As Object = Nothing) As System.Drawing.Image

		Dim bMakeSemiMono As Boolean

		On Error Resume Next

		bMakeSemiMono = False
		'UPGRADE_NOTE: IsMissing() was changed to IsNothing(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8AE1CB93-37AB-439A-A4FF-BE3B6760BB23"'
		'UPGRADE_WARNING: Couldn't resolve default property of object vMakeSemiMono. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If Not (IsNothing(vMakeSemiMono)) Then bMakeSemiMono = vMakeSemiMono

		'**************************************************************************
		'* Call CaptureWindow to capture the entire form given its window handle
		'* and then return the resulting Picture object.
		'**************************************************************************
		With frmSrc
			CaptureWindowArea = CaptureWindow(.Handle.ToInt32, True, iLeft, iTop, iWidth, iHeight, bMakeSemiMono)
		End With

	End Function

	'**************************************************************************
	' CaptureScreen - Captures the entire screen.
	'
	' Returns - A Picture object containing a bitmap of the screen.
	'**************************************************************************
	Public Function CaptureScreen() As System.Drawing.Image

		'  Dim hWndScreen As Long

		'  On Error Resume Next

		'**************************************************************************
		'* Get a handle to the desktop window.
		'**************************************************************************
		'  hWndScreen = GetDesktopWindow()

		'**************************************************************************
		'* Call CaptureWindow to capture the entire desktop give the handle and
		'* and return the resulting Picture object.
		'**************************************************************************
		'  Set CaptureScreen = CaptureWindow(hWndScreen, False, 0, 0, _
		'Screen.Width \ Screen.TwipsPerPixelX, _
		'Screen.Height \ Screen.TwipsPerPixelY)

	End Function

	'**************************************************************************
	' CaptureForm - Captures an entire form including title bar and border.
	'
	' frmSrc - The Form object to capture.
	'
	' Returns - A Picture object containing a bitmap of the entire form.
	'**************************************************************************
	Public Function CaptureForm(ByRef frmSrc As System.Windows.Forms.Form) As System.Drawing.Image

		'  On Error Resume Next

		'**************************************************************************
		'* Call CaptureWindow to capture the entire form given its window handle
		'* and then return the resulting Picture object.
		'**************************************************************************
		'  With frmSrc
		'    Set CaptureForm = CaptureWindow(.hWnd, False, 0, 0, _
		'.ScaleX(.Width, vbTwips, vbPixels), _
		'.ScaleY(.Height, vbTwips, vbPixels))
		'  End With

	End Function

	'**************************************************************************
	' CaptureClient - Captures the client area of a form.
	'
	' frmSrc - The Form object to capture.
	'
	' Returns - A Picture object containing a bitmap of the form's client area.
	'**************************************************************************
	Public Function CaptureClient(ByRef frmSrc As System.Windows.Forms.Form) As System.Drawing.Image

		'  On Error Resume Next

		'**************************************************************************
		'* Call CaptureWindow to capture the client area of the form given its
		'* window handle and return the resulting Picture object.
		'**************************************************************************
		'  With frmSrc
		'    Set CaptureClient = CaptureWindow(.hWnd, True, 0, 0, _
		'.ScaleX(.ScaleWidth, .ScaleMode, vbPixels), _
		'.ScaleY(.ScaleHeight, .ScaleMode, vbPixels))
		'  End With

	End Function

	'**************************************************************************
	' CaptureActiveWindow - Captures the currently active window on the screen.
	'
	' Returns - A Picture object containing a bitmap of the active window.
	'**************************************************************************
	Public Function CaptureActiveWindow() As System.Drawing.Image

		'  Dim hWndActive As Integer
		'  Dim r As Integer
		'  Dim RectActive As RECT

		'  On Error Resume Next

		'**************************************************************************
		'* Get a handle to the active/foreground window and the dimensions of that
		'* window.
		'**************************************************************************
		'  hWndActive = GetForegroundWindow()
		'  r = GetWindowRect(hWndActive, RectActive)

		'**************************************************************************
		'* Call CaptureWindow to capture the active window given its handle and
		'* return the Resulting Picture object.
		'**************************************************************************
		'  With RectActive
		'    Set CaptureActiveWindow = CaptureWindow(hWndActive, False, 0, 0, _
		'.Right - .Left, .Bottom - .Top)
		'  End With

	End Function

	Public Sub PrintChart(ByRef pic As System.Drawing.Image, ByRef sDescription As String)
		Dim Printer As New Printer

        On Error Resume Next

        '*******************************************************
        '* Don't change frmMenu to 'Printer' or this won't
        '* work. It really should be 'Printer' but doing
        '* a Printer.ScaleX method has the effect of beginning
        '* a new page after which setting the orientation won't
        '* work. ARRRGGGGHHH! frmMenu.ScaleX and Printer.ScaleX
        '* appeared to return the same values. I hope that will
        '* always be the case.
        '*******************************************************
        'UPGRADE_ISSUE: Picture property pic.Width was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
        'UPGRADE_ISSUE: Form method frmMenu.ScaleX was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
        'If (frmMenu.ScaleX(Printer.ScaleWidth, Printer.ScaleMode, 8) < pic.Width) Then
        'Printer.Orientation = PrinterObjectConstants.vbPRORLandscape
        'Else
        Printer.Orientation = PrinterObjectConstants.vbPRORPortrait
        'End If

        Printer.Font = VB6.FontChangeName(Printer.Font, "")
        Printer.Font = VB6.FontChangeName(Printer.Font, "Arial")
        Printer.Font = VB6.FontChangeSize(Printer.Font, 10)

        Printer.Print()
        Printer.Print(sDescription)
        Printer.Print("Date/Time: " & vbTab & VB6.Format(Now, "Medium Date") & " " & VB6.Format(Now, "Medium Time"))
        Printer.PaintPicture(pic, 0, (Printer.TextHeight("X") * 5.5))
        Printer.EndDoc()

	End Sub

	'**************************************************************************
	' PrintPicture - Prints a Picture object.
	'
	' Prn - Destination Printer object.
	'
	' Pic - Source Picture object.
	'**************************************************************************
	Public Sub PrintPicture(ByRef prn As Printer, ByRef pic As System.Drawing.Image)

		'  Const vbHiMetric As Integer = 8
		'  Dim PicRatio As Double
		'  Dim PrnWidth As Double
		'  Dim PrnHeight As Double
		'  Dim PrnRatio As Double
		'  Dim PrnPicWidth As Double
		'  Dim PrnPicHeight As Double

		'  On Error Resume Next

		'  With Prn
		'**************************************************************************
		'* Determine if picture should be printed in landscape or portrait and set
		'* the orientation. Then calculate device independent Width-to-Height
		'* ratio for picture.
		'**************************************************************************
		'    .Orientation = IIf(pic.Height >= pic.Width, vbPRORPortrait, vbPRORLandscape)
		'    PicRatio = pic.Width / pic.Height

		'**************************************************************************
		'* Calculate the dimentions of the printable area in HiMetric.
		'**************************************************************************
		'    PrnWidth = .ScaleX(.ScaleWidth, .ScaleMode, vbHiMetric)
		'    PrnHeight = .ScaleY(.ScaleHeight, .ScaleMode, vbHiMetric)

		'**************************************************************************
		'* Calculate device independent Width to Height ratio for printer.
		'**************************************************************************
		'    PrnRatio = PrnWidth / PrnHeight

		'**************************************************************************
		'* Scale the output to the printable area.
		'**************************************************************************
		'    If (PicRatio >= PrnRatio) Then
		'      '************************************************************************
		'      '* Scale picture to fit full width of printable area.
		'      '************************************************************************
		'      PrnPicWidth = .ScaleX(PrnWidth, vbHiMetric, .ScaleMode)
		'      PrnPicHeight = .ScaleY(PrnWidth / PicRatio, vbHiMetric, .ScaleMode)
		'    Else
		'      '************************************************************************
		'      '* Scale picture to fit full height of printable area.
		'      '************************************************************************
		'      PrnPicHeight = .ScaleY(PrnHeight, vbHiMetric, .ScaleMode)
		'      PrnPicWidth = .ScaleX(PrnHeight * PicRatio, vbHiMetric, .ScaleMode)
		'    End If

		'**************************************************************************
		'* Print the picture using the PaintPicture method.
		'**************************************************************************
		'    .PaintPicture pic, 0, 0, pic.Width, pic.Height
		'  End With

	End Sub

	'**************************************************************************
	' PrintPictureToFitPage - Prints a Picture object as big as possible.
	'
	' Prn - Destination Printer object.
	'
	' Pic - Source Picture object.
	'**************************************************************************
	Public Sub PrintPictureToFitPage(ByRef prn As Printer, ByRef pic As System.Drawing.Image)

		'  Const vbHiMetric As Integer = 8
		'  Dim PicRatio As Double
		'  Dim PrnWidth As Double
		'  Dim PrnHeight As Double
		'  Dim PrnRatio As Double
		'  Dim PrnPicWidth As Double
		'  Dim PrnPicHeight As Double

		'  On Error Resume Next

		'  With Prn
		'**************************************************************************
		'* Determine if picture should be printed in landscape or portrait and set
		'* the orientation. Then calculate device independent Width-to-Height
		'* ratio for picture.
		'**************************************************************************
		'    .Orientation = IIf(pic.Height >= pic.Width, vbPRORPortrait, vbPRORLandscape)
		'    PicRatio = pic.Width / pic.Height

		'**************************************************************************
		'* Calculate the dimentions of the printable area in HiMetric.
		'**************************************************************************
		'    PrnWidth = .ScaleX(.ScaleWidth, .ScaleMode, vbHiMetric)
		'    PrnHeight = .ScaleY(.ScaleHeight, .ScaleMode, vbHiMetric)

		'**************************************************************************
		'* Calculate device independent Width to Height ratio for printer.
		'**************************************************************************
		'    PrnRatio = PrnWidth / PrnHeight

		'**************************************************************************
		'* Scale the output to the printable area.
		'**************************************************************************
		'    If (PicRatio >= PrnRatio) Then
		'************************************************************************
		'* Scale picture to fit full width of printable area.
		'************************************************************************
		'      PrnPicWidth = .ScaleX(PrnWidth, vbHiMetric, .ScaleMode)
		'      PrnPicHeight = .ScaleY(PrnWidth / PicRatio, vbHiMetric, .ScaleMode)
		'    Else
		'************************************************************************
		'* Scale picture to fit full height of printable area.
		'************************************************************************
		'      PrnPicHeight = .ScaleY(PrnHeight, vbHiMetric, .ScaleMode)
		'      PrnPicWidth = .ScaleX(PrnHeight * PicRatio, vbHiMetric, .ScaleMode)
		'    End If

		'**************************************************************************
		'* Print the picture using the PaintPicture method.
		'**************************************************************************
		'    .PaintPicture pic, 0, 0, PrnPicWidth, PrnPicHeight
		'  End With

	End Sub

	Public Sub TransBmp(ByRef OutDstDC As Integer, ByRef SrcDC As Integer, ByVal iLeft As Integer, ByVal iTop As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByRef DstX As Integer, ByRef DstY As Integer, ByRef TransColor As Integer)

		'DstDC- Device context into which image must be
		'drawn transparently

		'OutDstDC- Device context into image is actually drawn,
		'even though it is made transparent in terms of DstDC

		'Src- Device context of source to be made transparent
		'in color TransColor

		'SrcRect- Rectangular region within SrcDC to be made
		'transparent in terms of DstDC, and drawn to OutDstDC

		'DstX, DstY - Coordinates in OutDstDC (and DstDC)
		'where the transparent bitmap must go. In most
		'cases, OutDstDC and DstDC will be the same

		Dim DstDC As Integer
		Dim nRet As Integer
		Dim MonoMaskDC, hMonoMask As Integer
		Dim MonoInvDC, hMonoInv As Integer
		Dim ResultDstDC, hResultDst As Integer
		Dim ResultSrcDC, hResultSrc As Integer
		Dim hPrevMask, hPrevInv As Integer
		Dim hPrevSrc, hPrevDst As Integer

		DstDC = OutDstDC

		'create monochrome mask and inverse masks
		MonoMaskDC = CreateCompatibleDC(DstDC)
		MonoInvDC = CreateCompatibleDC(DstDC)
		hMonoMask = CreateBitmap(iWidth, iHeight, 1, 1, 0)
		hMonoInv = CreateBitmap(iWidth, iHeight, 1, 1, 0)
		hPrevMask = SelectObject(MonoMaskDC, hMonoMask)
		hPrevInv = SelectObject(MonoInvDC, hMonoInv)

		'create keeper DCs and bitmaps
		ResultDstDC = CreateCompatibleDC(DstDC)
		ResultSrcDC = CreateCompatibleDC(DstDC)
		hResultDst = CreateCompatibleBitmap(DstDC, iWidth, iHeight)
		hResultSrc = CreateCompatibleBitmap(DstDC, iWidth, iHeight)
		hPrevDst = SelectObject(ResultDstDC, hResultDst)
		hPrevSrc = SelectObject(ResultSrcDC, hResultSrc)

        Dim vbSrcCopy As Integer = &HCC0020
        Dim vbSrcAnd As Integer = &H8800C6
        Dim vbSrcInvert As Integer = &H660046
        Dim vbNotSrcCopy As Integer = &H330008

		'copy src to monochrome mask
		Dim OldBC As Integer
		OldBC = SetBkColor(SrcDC, TransColor)
        nRet = BitBlt(MonoMaskDC, 0, 0, iWidth, iHeight, SrcDC, iLeft, iTop, vbSrcCopy)
		TransColor = SetBkColor(SrcDC, OldBC)

		'create inverse of mask
        nRet = BitBlt(MonoInvDC, 0, 0, iWidth, iHeight, MonoMaskDC, 0, 0, vbNotSrcCopy)

		'get background
        nRet = BitBlt(ResultDstDC, 0, 0, iWidth, iHeight, DstDC, DstX, DstY, vbSrcCopy)

		'AND with Monochrome mask
        nRet = BitBlt(ResultDstDC, 0, 0, iWidth, iHeight, MonoMaskDC, 0, 0, vbSrcAnd)

		'get overlapper
        nRet = BitBlt(ResultSrcDC, 0, 0, iWidth, iHeight, SrcDC, iLeft, iTop, vbSrcCopy)

		'AND with inverse monochrome mask
        nRet = BitBlt(ResultSrcDC, 0, 0, iWidth, iHeight, MonoInvDC, 0, 0, vbSrcAnd)

		'XOR these two
        nRet = BitBlt(ResultDstDC, 0, 0, iWidth, iHeight, ResultSrcDC, 0, 0, vbSrcInvert)

		'output results
        nRet = BitBlt(OutDstDC, DstX, DstY, iWidth, iHeight, ResultDstDC, 0, 0, vbSrcCopy)

		'clean up
		hMonoMask = SelectObject(MonoMaskDC, hPrevMask)
		DeleteObject(hMonoMask)

		hMonoInv = SelectObject(MonoInvDC, hPrevInv)
		DeleteObject(hMonoInv)

		hResultDst = SelectObject(ResultDstDC, hPrevDst)
		DeleteObject(hResultDst)

		hResultSrc = SelectObject(ResultSrcDC, hPrevSrc)
		DeleteObject(hResultSrc)

		DeleteDC(MonoMaskDC)
		DeleteDC(MonoInvDC)
		DeleteDC(ResultDstDC)
		DeleteDC(ResultSrcDC)

	End Sub
End Class


text:
<?php
use BITS\BITS;

?>

<?php $pesan = isset($_SESSION['id_project']) ? "Anda sedang mengelola project - ".BITS::getName("project", $_SESSION['id_project']) : 'Silahkan Pilih project !'; echo $pesan; ?>


text:
'use strict';

var STATIC = Symbol('static'),
    METHOD = Symbol('method');

module.exports = {
  STATIC: STATIC,
  METHOD: METHOD
};


text:
<?php

namespace App\Http\Controllers\ids\vvgh;

use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Input;

class IDSPressInfoController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        $row = Input::get('row');
        $form = Input::get('form');

        $data = DB::connection('sqlsrv_mls')
            ->table('PKVInfo')
            ->where('Row', '=', $row)
            ->where('Form', '=', $form)
            ->get();

        $equip = DB::connection('sqlsrv_ids')
            ->table('Equipment')
            ->select('TypeIDL', 'TypeIDR')
            ->where('EquipID', '=', str_pad($row, 2, '0', STR_PAD_LEFT).''.str_pad($form, 2, '0', STR_PAD_LEFT))
            ->get();

        return view('ids.vvgh.pressinfo', ['row' => $row, 'form' => $form, 'data' => $data, 'equip' => $equip]);
    }
}


text:
require 'soap/rpc/driver'

File.dirname(__FILE__) + "/broadvox/errors"
File.dirname(__FILE__) + "/broadvox/base"
File.dirname(__FILE__) + "/broadvox/availability"
File.dirname(__FILE__) + "/broadvox/orders"


text:
using System;
using System.Collections.Generic;
using System.Text;
using Dawn;
using FclEx.Extensions.Json;
using FclEx.Http.Core;
using FclEx.Http.Services;
using FclEx.Utils;
using Newtonsoft.Json.Linq;

namespace FclEx.Actions
{
    public static class Extensions
    {
        public static IAction<HttpRes> ToAction(this HttpReq req, IHttpService? httpService = null, bool unwrapError = true)
        {
            return (new HttpReqAction(req, httpService ?? HttpClientService.Default, unwrapError));
        }

        public static IAction<T> ReadJson<T>(this IAction<HttpRes> action, string? path = null)
        {
            return action.Bind(m => m.ReadJson<T>(path));
        }

        public static IAction<HttpRes> NextReq<T>(this IAction<(HttpRes, T)> action, Func<T, HttpReq> func,
            IHttpService? httpService = null, bool unwrapError = true)
        {
            Guard.Argument(func, nameof(func)).NotNull();
            return action.Next((res, data) => func(data).ToAction(httpService, unwrapError));
        }

        public static IAction<HttpRes> NextReq<T>(this IAction<T> action, Func<T, HttpReq> func,
            IHttpService? httpService = null, bool unwrapError = true)
        {
            Guard.Argument(func, nameof(func)).NotNull();
            return action.Next(data => func(data).ToAction(httpService, unwrapError));
        }

        public static IAction<HttpRes>? TryRedirect(this HttpRes res, IHttpService httpService, Func<HttpRes, string> urlFunc)
        {
            Guard.Argument(urlFunc, nameof(urlFunc)).NotNull();
            var url = urlFunc(res);
            return url == null ? null : HttpReq.Get(url).ToAction(httpService);
        }

        public static IAction<HttpRes>? TryRedirect(this HttpRes res, IHttpService httpService, string url)
        {
            return res.TryRedirect(httpService, r => url);
        }

        public static IAction<HttpRes> NextReq<T>(this IAction<T> action, HttpReq httpReq, IHttpService? httpService = null, bool unwrapError = true)
        {
            Guard.Argument(httpReq, nameof(httpReq)).NotNull();
            return action.NextReq(m => httpReq, httpService, unwrapError);
        }
    }
}


text:
class CreateSpreeBitCreditsCheckouts < ActiveRecord::Migration
  def up
  end

  def down
  end
end


text:
@interface BBNode ()

@property (nonatomic, readonly, assign) css_node_t *node;
@property (nonatomic, readonly, assign) CGRect frame;

@end

static bool alwaysDirty(void *context) {
    return true;
}

static css_node_t * getChild(void *context, int i) {
    BBNode *self = (__bridge BBNode *)context;
    BBNode *child = self.children[i];
    return child.node;
}

static css_dim_t measureNode(void *context, float width) {
    BBNode *self = (__bridge BBNode *)context;
    CGSize size = self.measure(width);
    return (css_dim_t){ size.width, size.height };
}

@implementation BBNode

- (void)dealloc {
    free_css_node(_node);
}

- (instancetype)init {
    self = [super init];
    if (self) {

        _node = new_css_node();
        _node->context = (__bridge void *)self;
        _node->is_dirty = alwaysDirty;
        _node->get_child = getChild;

        self.width = CSS_UNDEFINED;
        self.height = CSS_UNDEFINED;
        self.children = @[];
        self.flexDirection = BBFlexDirectionColumn;
        self.margin = BBEdgesMakeUniform(0);
        self.padding = BBEdgesMakeUniform(0);
        self.justification = BBJustificationFlexStart;
        self.selfAlignment = BBSelfAlignmentAuto;
        self.childAlignment = BBChildAlignmentStretch;

    }
    return self;
}

- (BBLayout *)layoutWithMaxWidth:(CGFloat)maxWidth {
    [self prepareForLayout];
    layoutNode(self.node, maxWidth, self.node->style.direction);
    NSArray *children = [self createLayoutsFromChildren:self];
    return [[BBLayout alloc] initWithFrame:self.frame children:children];
}

- (NSArray *)createLayoutsFromChildren:(BBNode *)node {
    return [node.children bb_map:^id(BBNode *child) {
        NSArray *childLayouts = [self createLayoutsFromChildren:child];
        return [[BBLayout alloc] initWithFrame:child.frame children:childLayouts];
    }];
}

- (void)prepareForLayout {
    for (BBNode *child in self.children) {
        [child prepareForLayout];
    }

    // Apparently we need to reset these before laying out, otherwise the layout
    // has some weird additive effect.
    self.node->layout.position[CSS_LEFT] = 0;
    self.node->layout.position[CSS_TOP] = 0;
    self.node->layout.dimensions[CSS_WIDTH] = CSS_UNDEFINED;
    self.node->layout.dimensions[CSS_HEIGHT] = CSS_UNDEFINED;
}

- (void)setChildren:(NSArray *)children {
    _children = [children copy];
    _node->children_count = (int)children.count;
}

- (CGRect)frame {
    return CGRectMake(self.node->layout.position[CSS_LEFT], self.node->layout.position[CSS_TOP], self.node->layout.dimensions[CSS_WIDTH], self.node->layout.dimensions[CSS_HEIGHT]);
}

- (void)setMeasure:(CGSize (^)(CGFloat))measure {
    _measure = [measure copy];
    _node->measure = (_measure != nil ? measureNode : NULL);
}

- (void)setFlex:(CGFloat)flex {
    self.node->style.flex = flex;
}

- (CGFloat)flex {
    return self.node->style.flex;
}

- (void)setFlexDirection:(BBFlexDirection)direction {
    self.node->style.flex_direction = (int)direction;
}

- (BBFlexDirection)flexDirection {
    return (BBFlexDirection)self.node->style.flex_direction;
}

- (void)setWrap:(BOOL)wrap {
    self.node->style.flex_wrap = wrap;
}

- (BOOL)wrap {
    return self.node->style.flex_wrap;
}

- (void)setJustification:(BBJustification)justification {
    self.node->style.justify_content = (int)justification;
}

- (BBJustification)justification {
    return (BBJustification)self.node->style.justify_content;
}

- (void)setSelfAlignment:(BBSelfAlignment)selfAlignment {
    self.node->style.align_self = (int)selfAlignment;
}

- (BBSelfAlignment)selfAlignment {
    return (BBSelfAlignment)self.node->style.align_self;
}

- (void)setChildAlignment:(BBChildAlignment)childAlignment {
    self.node->style.align_items = (int)childAlignment;
}

- (BBChildAlignment)childAlignment {
    return (BBChildAlignment)self.node->style.align_items;
}

- (void)setSize:(CGSize)size {
    self.width = size.width;
    self.height = size.height;
}

- (CGSize)size {
    return CGSizeMake(self.width, self.height);
}

- (void)setWidth:(CGFloat)width {
    self.node->style.dimensions[CSS_WIDTH] = width;
}

- (CGFloat)width {
    return self.node->style.dimensions[CSS_WIDTH];
}

- (void)setHeight:(CGFloat)height {
    self.node->style.dimensions[CSS_HEIGHT] = height;
}

- (CGFloat)height {
    return self.node->style.dimensions[CSS_HEIGHT];
}

- (void)setMargin:(BBEdges)margin {
    self.leftMargin = margin.left;
    self.rightMargin = margin.right;
    self.bottomMargin = margin.bottom;
    self.topMargin = margin.top;
}

- (BBEdges)margin {
    return BBEdgesMake(self.topMargin, self.leftMargin, self.bottomMargin, self.rightMargin);
}

- (void)setLeftMargin:(CGFloat)leftMargin {
    self.node->style.margin[CSS_LEFT] = leftMargin;
}

- (CGFloat)leftMargin {
    return self.node->style.margin[CSS_LEFT];
}

- (void)setRightMargin:(CGFloat)rightMargin {
    self.node->style.margin[CSS_RIGHT] = rightMargin;
}

- (CGFloat)rightMargin {
    return self.node->style.margin[CSS_RIGHT];
}

- (void)setTopMargin:(CGFloat)topMargin {
    self.node->style.margin[CSS_TOP] = topMargin;
}

- (CGFloat)topMargin {
    return self.node->style.margin[CSS_TOP];
}

- (void)setBottomMargin:(CGFloat)bottomMargin {
    self.node->style.margin[CSS_BOTTOM] = bottomMargin;
}

- (CGFloat)bottomMargin {
    return self.node->style.margin[CSS_BOTTOM];
}

- (void)setPadding:(BBEdges)padding {
    self.leftPadding = padding.left;
    self.rightPadding = padding.right;
    self.bottomPadding = padding.bottom;
    self.topPadding = padding.top;
}

- (BBEdges)padding {
    return BBEdgesMake(self.topPadding, self.leftPadding, self.bottomPadding, self.rightPadding);
}

- (void)setLeftPadding:(CGFloat)leftPadding {
    self.node->style.padding[CSS_LEFT] = leftPadding;
}

- (CGFloat)leftPadding {
    return self.node->style.padding[CSS_LEFT];
}

- (void)setRightPadding:(CGFloat)rightPadding {
    self.node->style.padding[CSS_RIGHT] = rightPadding;
}

- (CGFloat)rightPadding {
    return self.node->style.padding[CSS_RIGHT];
}

- (void)setTopPadding:(CGFloat)topPadding {
    self.node->style.padding[CSS_TOP] = topPadding;
}

- (CGFloat)topPadding {
    return self.node->style.padding[CSS_TOP];
}

- (void)setBottomPadding:(CGFloat)bottomPadding {
    self.node->style.padding[CSS_BOTTOM] = bottomPadding;
}

- (CGFloat)bottomPadding {
    return self.node->style.padding[CSS_BOTTOM];
}

@end


text:
define(['lib/news_special/bootstrap', 'model/eventStrs', 'data/dataset', 'data/nations_dataset'], function (news, eventStrs, dataset, nationsDataset) {

    'use strict';

    var ExternalIdMediator = function () {

        /********************************************************
            * VARIABLES
        ********************************************************/
        this.testVar = true;

        /********************************************************
            * INIT STUFF
        ********************************************************/
        this.addEventListeners();
    };

    ExternalIdMediator.prototype = {

        addEventListeners: function () {
            news.pubsub.on(eventStrs.processExternalId, this.handleExternalId.bind(this));
        },

        handleExternalId: function (data) {
            /*********************
                * LOAD REGION DATA USING THE ID PARAM
            *********************/
            if (dataset.hasOwnProperty(data.id)) {
                var councilData = dataset[data.id];
                councilData.nation = data.nation;

                this.handleRegionResponse(councilData);

            } else if (nationsDataset.hasOwnProperty(data.id)) {
                var nationsCouncilData = nationsDataset[data.id];
                nationsCouncilData.nation = data.nation;

                this.handleRegionResponse(nationsCouncilData);

            } else {
                // console.log('Data not found for id', data.id);
                throw new Error('Data not found for id: ' + data.id);
            }

        },

        handleRegionResponse: function (data) {
            if (data.nation === 'England') {
                //validate the returned data first!
                //translate the returned data into a format the app can injest!
                var usefulDataSchema = {};

                usefulDataSchema.authorityName = data.authorityName;
                usefulDataSchema.regionName = data.regionName;
                usefulDataSchema.niGroup = data.niGroup;

                usefulDataSchema.homeCare = {};
                usefulDataSchema.homeCare.localCost = parseFloat(data.homeLocal);

                usefulDataSchema.residentialCare = {};
                usefulDataSchema.residentialCare.localCost = parseFloat(data.residentialLocal);
                usefulDataSchema.residentialCare.regionCost = parseFloat(data.residentialRegion);
                usefulDataSchema.residentialCare.privateCost = parseFloat(data.residentialPrivate);

                news.pubsub.emit(eventStrs.displayEngland, [usefulDataSchema]);

            } else {
                news.pubsub.emit(eventStrs['display' + data.nation], [data]);
            }

        }

    };

    return ExternalIdMediator;

});


text:
layout: base
title:  'Statistics of Number[psor] in UD_Mbya_Guarani-Thomas'
udver: '2'
---

## Treebank Statistics: UD_Mbya_Guarani-Thomas: Features: `Number[psor]`

This feature is language-specific.
It occurs with 2 different values: `Plur`, `Sing`.

This is a layered feature with the following layers: <tt>Number</tt>, <tt>Number[psor]</tt>.

54 tokens (4%) have a non-empty value of `Number[psor]`.
33 types (9%) occur at least once with a non-empty value of `Number[psor]`.
20 lemmas (7%) occur at least once with a non-empty value of `Number[psor]`.
The feature is used with 1 part-of-speech tags: <tt>NOUN</tt> (54; 4% instances).

### `NOUN`

54 <tt>NOUN</tt> tokens (32% of all `NOUN` tokens) have a non-empty value of `Number[psor]`.

The most frequent other feature values with which `NOUN` and `Number[psor]` co-occurred: <tt>Clusivity[psor]</tt><tt>=EMPTY</tt> (32; 59%).

`NOUN` tokens may have the following values of `Number[psor]`:

Paradigm embiapo	<tt>Plur</tt>	<tt>Sing</tt>

<tt><tt>Clusivity[psor]</tt><tt>=In</tt>|<tt>Number[psor]</tt><tt>=Plur</tt></tt>	ñanerembiapo

<tt><tt>Number[psor]</tt><tt>=Sing</tt></tt>		cherembiapo, cherembiapokue

## Relations with Agreement in `Number[psor]`

The 10 most frequent relations where parent and child node agree in `Number[psor]`:
<tt>NOUN --[<tt>conj</tt>]--> NOUN</tt> (5; 100%).


text:
var currentServersSpec = null;
var currentHostname = null;
var currentServersList = null;
var serverItemsVersion = 0;

var STATE_LATENT = 0;
var STATE_DOWN = 1;
var STATE_NOT_SERVING = 2;
var STATE_SERVING = 3;

function makeServersList()
{
    var serverList = new Array();

    var specs = (systemConfig.serversSpec.length > 0) ? systemConfig.serversSpec.split(",") : new Array();
    var foundUs = false;
    for ( var i = 0; i < specs.length; ++i )
    {
        var parts = specs[i].split(":");

        var thisSpec = {};
        var index = (parts.length > 2) ? 1 : 0;
        thisSpec.serverId = parseInt(parts[index++]);
        thisSpec.hostname = parts[index];
        if ( thisSpec.hostname === systemConfig.hostname )
        {
            foundUs = true;
        }

        serverList.push(thisSpec);
    }
    if ( !foundUs )
    {
        thisSpec = {};
        thisSpec.serverId = -1;
        thisSpec.hostname = systemConfig.hostname;
        serverList.push(thisSpec);
    }

    serverList.sort(function(a, b){
        return a.serverId - b.serverId;
    });

    return serverList;
}

function buildServerItems()
{
    var serversList = makeServersList();
    if ( (currentServersSpec != systemConfig.serversSpec) || (currentHostname != systemConfig.hostname) )
    {
        ++serverItemsVersion;
        internalBuildServerItems(serversList);
    }
    updateServerState(serversList);
}

function destroyOldServerItems()
{
    for ( var i = 0; i < currentServersList.length; ++i )
    {
        var domId = '#cp-' + i;
        $(domId + '-power-button').button("destroy");
        $(domId + '-4ltr-button').button("destroy");
        $(domId + '-log-button').button("destroy");

        $(domId + '-power-button').unbind("click");
        $(domId + '-4ltr-button').unbind("click");
        $(domId + '-log-button').unbind("click");
        $(domId + '-open-window').unbind("click");
    }
}

function internalBuildServerItems(serversList)
{
    if ( currentServersList != null )
    {
        destroyOldServerItems();
    }

    currentServersSpec = systemConfig.serversSpec;
    currentHostname = systemConfig.hostname;
    currentServersList = serversList;

    var content = "";
    for ( var i = 0; i < serversList.length; ++i )
    {
        var spec = serversList[i];
        var domId = 'cp-' + i;

        var thisItem = $('#base-server-item-base').html();
        thisItem = thisItem.replace("$SERVER_ID$", spec.serverId);
        thisItem = thisItem.replace("$SERVER_HOSTNAME$", spec.hostname);
        thisItem = thisItem.replace(/\$BASE_ID\$/gi, domId);

        content += thisItem;
    }
    $('#base-server-item').html(content);

    for ( i = 0; i < serversList.length; ++i )
    {
        spec = serversList[i];
        domId = '#cp-' + i;

        makeLightSwitch(domId + '-instance-restarts-enabled', null, true);
        makeLightSwitch(domId + '-cleanup-enabled', null, true);
        makeLightSwitch(domId + '-backups-enabled', null, true);
        if ( systemState.backupActive )
        {
            $(domId + '-backups-enabled-control').show();
        }

        var serverIdContent = "Server Id: " + spec.serverId;
        var hostnameContent = "Hostname: " + spec.hostname;
        if ( spec.hostname === systemConfig.hostname )
        {
            hostnameContent += '(This server)';
            $(domId + '-log-button').hide();
            $(domId + '-open-window').hide();
        }
        else
        {
            $(domId + '-open-window').click(openWindowForInstance(spec.hostname));
        }

        $(domId + '-server-id').html(serverIdContent);
        $(domId + '-hostname').html(hostnameContent);

        $(domId + '-power-button').button({
            disabled: true,
            icons:{
                primary:"ui-icon-alert"
            }
        });

        $(domId + '-4ltr-button').button({
            disabled: true,
            icons:{
                primary:"ui-icon-circle-zoomin"
            }
        }).click(word4ltrDialog(spec.hostname));

        $(domId + '-log-button').button({
            disabled: true,
            icons:{
                primary:"ui-icon-info"
            }
        }).click(logDialog(spec.hostname));
    }

    $('#base-server-item').colorTip();
}

function stopStartDialog(hostname)
{
    return function() {
        okCancelDialog(hostname, "Are you sure you want to restart this server?", function(){
            makeRemoteCall(URL_CLUSTER_RESTART_BASE, hostname);
        });
    };
}

function stopDialog(hostname)
{
    return function() {
        okCancelDialog(hostname, "Are you sure you want to stop this server?", function(){
            makeRemoteCall(URL_CLUSTER_STOP_BASE, hostname);
        });
    };
}

function startDialog(hostname)
{
    return function() {
        okCancelDialog(hostname, "Are you sure you want to start this server?", function(){
            makeRemoteCall(URL_CLUSTER_START_BASE, hostname);
        });
    };
}

function logDialog(hostname)
{
    return function() {
        $('#log-text').text("Loading...");

        function getLog() {
            makeRemoteCall(URL_CLUSTER_LOG_BASE, hostname, function(text){
                $('#log-text').text(text);
            });
        }
        getLog();

        $('#log-refresh-button').unbind("click");
        $('#log-refresh-button').click(getLog);

        $('#log-dialog').dialog("option", "title", hostname);
        $('#log-dialog').dialog("open");
    };
}

function openWindowForInstance(hostname)
{
    return function() {
        var replceHostname = hostname;
        if ( location.port )
        {
            replceHostname += ':' + location.port;
        }
        var thisUrl = location.href;
        var newUrl = thisUrl.replace(location.host, replceHostname);
        window.open(newUrl, '_blank');
    };
}

function word4ltrDialog(hostname)
{
    return function() {
        $('#word-4ltr-button').unbind("click");

        $('#word-4ltr-button').click(function(){
            $('#word-4ltr-text').text("Loading...");
            makeRemoteCall(URL_CLUSTER_4LTR_BASE + $('#word-4ltr').val() + "/", hostname, function(text){
                $('#word-4ltr-text').text(text);
            })
        });

        $('#word-4ltr-text').text("");
        $('#word-4ltr-dialog').dialog("option", "title", hostname);
        $('#word-4ltr-dialog').dialog("open");
    };
}

function makeRemoteCall(baseUrl, hostname, callback)
{
    $.getJSON(baseUrl + hostname + '?ts=' + Date.now(), function(data){
        if ( data.success )
        {
            if ( callback )
            {
                callback(eval(data.response));
            }
        }
        else
        {
            messageDialog("Error", "Could not complete message to " + hostname + ". Message: " + data.errorMessage);
        }
    });
}

function handleSwitch(hostname, type)
{
    return function(isChecked) {
        makeRemoteCall(URL_CLUSTER_SET_CONFIG_BASE + type + "/" + isChecked + "/", hostname);
    };
}

function updateOneServerState(index, data, hostname)
{
    var statusColor;
    var statusMessage = "";

    domId = '#cp-' + index;
    if ( data.success )
    {
        var isRunning = ((data.response.state == STATE_SERVING) || (data.response.state == STATE_NOT_SERVING));

        $(domId + '-power-button').button("option", "disabled", false);
        $(domId + '-4ltr-button').button("option", "disabled", !isRunning);
        $(domId + '-log-button').button("option", "disabled", false);

        var spec = currentServersList[index];
        if ( data.response.switches.restarts )
        {
            $(domId + '-power-button').button("option", "label", "Restart...");
            $(domId + '-power-button').click(stopStartDialog(spec.hostname));
        }
        else if ( systemState.running )
        {
            $(domId + '-power-button').button("option", "label", "Stop...");
            $(domId + '-power-button').click(stopDialog(spec.hostname));
        }
        else
        {
            $(domId + '-power-button').button("option", "label", "Start...");
            $(domId + '-power-button').click(startDialog(spec.hostname));
        }

        ableLightSwitch(domId + '-instance-restarts-enabled', handleSwitch(hostname, "restarts"));
        ableLightSwitch(domId + '-cleanup-enabled', handleSwitch(hostname, "cleanup"));
        ableLightSwitch(domId + '-backups-enabled', handleSwitch(hostname, "backups"));

        checkLightSwitch(domId + '-instance-restarts-enabled', data.response.switches.restarts);
        checkLightSwitch(domId + '-cleanup-enabled', data.response.switches.cleanup);
        checkLightSwitch(domId + '-backups-enabled', data.response.switches.backups);

        statusMessage = data.response.description;
        switch ( data.response.state )
        {
            default:
            case STATE_LATENT:
            {
                statusColor = "#FFF";
                break;
            }

            case STATE_SERVING:
            {
                statusColor = "#0E0";
                break;
            }

            case STATE_NOT_SERVING:
            {
                statusColor = "#FF0";
                break;
            }

            case STATE_DOWN:
            {
                statusColor = "#F00";
                break;
            }
        }
    }
    else
    {
        $(domId + '-power-button').button("option", "disabled", true);
        $(domId + '-4ltr-button').button("option", "disabled", true);
        $(domId + '-log-button').button("option", "disabled", true);

        ableLightSwitch(domId + '-instance-restarts-enabled', null, false);
        ableLightSwitch(domId + '-cleanup-enabled', null, false);
        ableLightSwitch(domId + '-backups-enabled', null, false);

        statusColor = "#F00";
        statusMessage = data.errorMessage;
    }
    $(domId + '-status-indicator').css('background-color', statusColor);
    $(domId + '-status-message').html("Status: " + statusMessage);
}

function updateServerState(serversList)
{
    var localServerItemsVersion = serverItemsVersion;
    for ( var i = 0; i < serversList.length; ++i )
    {
        var spec = serversList[i];
        var thisHostname = spec.hostname;
        if ( thisHostname === systemConfig.hostname )
        {
            thisHostname = "localhost";
        }
        var callback = function(index, hostname) {
            return function(data) {
                if ( serverItemsVersion === localServerItemsVersion )
                {
                    updateOneServerState(index, data, hostname);
                }
            };
        };
        $.getJSON(URL_CLUSTER_GET_STATE_BASE + thisHostname + '?ts=' + getNow(), callback(i, thisHostname));
    }
}


text:
<?php
namespace johnmccuk;

require 'vendor/autoload.php';

use \Exception;
use \Datetime;
use \DateInterval;
use \DatePeriod;

/**
 * Class for holding a single postcodes and its related crime data data
 *
 * @class PostcodeCrimeData
 * @since 07/06/2017
 * @author John McCracken <johnmccuk@gmail.com>
 * @link https://github.com/johnmccuk/postcode-crimes
 */
class PostcodeCrimeData
{
    /*
    * @var array $postcodeData
    * @var GuzzleHttp\Client $client
    * @var array $crimeData
    * @var array $commonCrimeMonthlyTotals
    * @var array $crimeCounts
    * @var string $mostCommonCrime
    * @var float $mostCommonCrimeAverage
    * @var DateTime $fromDate
    * @var DateTime $toDate
    */
    protected $postcodeData;
    protected $client;
    protected $crimeData;
    protected $commonCrimeMonthlyTotals = [];
    protected $crimeCounts = [];
    protected $mostCommonCrime;
    protected $mostCommonCrimeAverage;
    protected $fromDate;
    protected $toDate;

    /**
    * @method __construct
    * @param GuzzleHttp\Client $client
    * @param array $postcode
    * @param DateTime $fromDate
    * @param DateTime $toDate
    */
    public function __construct(\GuzzleHttp\Client $client, array $postcode, DateTime $fromDate, DateTime $toDate)
    {
        if (array_key_exists('postcode', $postcode) === false) {
            throw new Exception('invalid postcode');
        }
        if (array_key_exists('longitude', $postcode) === false || array_key_exists('latitude', $postcode) == false) {
            throw new Exception('invalid coordinates');
        }

        $this->postcodeData = $postcode;
        $this->client = $client;
        $this->fromDate = $fromDate;
        $this->toDate = $toDate;

        $this->retrieveCrimeData();
        $this->calculateCrimeStatistics();
    }

    /**
    * Getter for the objects postcode
    * @method getPostcode
    * @return string
    */
    public function getPostcode()
    {
        return $this->postcodeData['postcode'];
    }

    /**
    * Getter for the objects Longitude
    * @method getLongitude
    * @return string
    */
    public function getLongitude()
    {
        return $this->postcodeData['longitude'];
    }

    /**
    * Getter for the objects Latitude
    * @method getLatitude
    * @return string
    */
    public function getLatitude()
    {
        return $this->postcodeData['latitude'];
    }

    /**
    * Getter for the objects 'from' date range
    * @method getFromDate
    * @return DateTime
    */
    public function getFromDate()
    {
        return $this->fromDate;
    }

    /**
    * Getter for the objects 'to' date range
    * @method getToDate
    * @return DateTime
    */
    public function getToDate()
    {
        return $this->toDate;
    }

    /**
    * Getter for the objects 'crimeData' values
    * @method getCrimeData
    * @return array
    */
    public function getCrimeData()
    {
        return $this->crimeData;
    }

    /**
    * Getter for the objects 'mostCommonCrime' value
    * @method getMostCommonCrime
    * @return string
    */
    public function getMostCommonCrime()
    {
        return $this->mostCommonCrime;
    }

    /**
    * Getter for the objects 'mostCommonCrimeAverage' value
    * @method getMostCommonCrimeAverage
    * @return float
    */
    public function getMostCommonCrimeAverage()
    {
        return $this->mostCommonCrimeAverage;
    }

    /**
    * Iterate and calculate the crime data for each month
    * @method retrieveCrimeData
    * @return null
    */
    protected function retrieveCrimeData()
    {
        $startDate = clone $this->fromDate;
        $interval = new DateInterval('P1M');
        $daterange = new DatePeriod($startDate, $interval, $this->toDate);

        foreach ($daterange as $date) {
            try {
                $this->crimeData[] = $this->getMonthlyCrimes($date);
            } catch (Exception $e) {
                syslog(LOG_WARNING, __FILE__ . ' '. __FUNCTION__ .'() '. __LINE__ . ' '. $e->getMessage());
                continue;
            }
        }
    }

    /**
    * Iterate and calculate the crime data for each month
    * @method getMonthlyCrimes
    * @param DateTime $date
    * @return array
    */
    protected function getMonthlyCrimes(DateTime $date)
    {
        $baseUrl = 'https://data.police.uk/api/crimes-street/all-crime?';

        $requestParams = [
            'lat' => $this->postcodeData['latitude'],
            'lng' => $this->postcodeData['longitude'],
            'date' => $date->format('Y-m'),
        ];

        $url = $baseUrl. http_build_query($requestParams);

        $response = $this->client->get($url);

        if ($response->getStatusCode() != "200") {
            syslog(LOG_WARNING, __FILE__ . ' '. __FUNCTION__ .'() '. __LINE__ . ' '. $response->getStatusCode() . ' '. $response->getBody()->getContents());
            throw new Exception('Invalid API call '. $response->getStatusCode());
        }
        return json_decode($response->getBody()->getContents(), true);
    }

    /**
    * Calculate the relevant crime statistics
    * @method calculateCrimeStatistics
    * @return null
    */
    protected function calculateCrimeStatistics()
    {
        foreach ($this->crimeData as $key => $monthlyData) {
            $this->countMonthlyCrimes($monthlyData);
        }

        //select the category with the highest count
        arsort($this->crimeCounts);
        reset($this->crimeCounts);
        $this->mostCommonCrime = key($this->crimeCounts);

        //work out the average for the most common crime
        $monthlyCounts = [];
        foreach ($this->crimeData as $key => $monthlyData) {
            $monthlyCounts[] = $this->countMonthlyCommonCrimesCount($monthlyData, $this->mostCommonCrime);
        }

        $this->mostCommonCrimeAverage = round(array_sum($monthlyCounts) / count($monthlyCounts), 1);
    }

    /**
    * from the passed array, calculate how many times each crime occurrs
    * @method countMonthlyCrimes
    * @param array $monthlyCrimes
    * @return null
    */
    protected function countMonthlyCrimes(array $monthlyCrimes)
    {
        foreach ($monthlyCrimes as $key => $crime) {
            if (array_key_exists($crime['category'], $this->crimeCounts) == false) {
                $this->crimeCounts[$crime['category']] = 1;
                continue;
            }
            $this->crimeCounts[$crime['category']]++;
        }
    }

    /**
    * Iterate and calculate the crime data for each month
    * @method countMonthlyCommonCrimesCount
    * @param array $monthlyCrimes
    * @param string $commonCrime crime category
    * @return integer
    */
    protected function countMonthlyCommonCrimesCount(array $monthlyCrimes, $commonCrime)
    {
        $count = 0;
        foreach ($monthlyCrimes as $key => $crime) {
            if ($crime['category'] == $commonCrime) {
                $count++;
            }
        }
        return $count;
    }
}


text:
struct _EXCEPTION_POINTERS;
struct _CONTEXT;
#endif

namespace base {
namespace debug {

// Enables stack dump to console output on exception and signals.
// When enabled, the process will quit immediately. This is meant to be used in
// unit_tests only! This is not thread-safe: only call from main thread.
// In sandboxed processes, this has to be called before the sandbox is turned
// on.
// Calling this function on Linux opens /proc/self/maps and caches its
// contents. In non-official builds, this function also opens the object files
// that are loaded in memory and caches their file descriptors (this cannot be
// done in official builds because it has security implications).
BASE_EXPORT bool EnableInProcessStackDumping();

// A stacktrace can be helpful in debugging. For example, you can include a
// stacktrace member in a object (probably around #ifndef NDEBUG) so that you
// can later see where the given object was created from.
class BASE_EXPORT StackTrace {
 public:
  // Creates a stacktrace from the current location.
  StackTrace();

  // Creates a stacktrace from an existing array of instruction
  // pointers (such as returned by Addresses()).  |count| will be
  // trimmed to |kMaxTraces|.
  StackTrace(const void* const* trace, size_t count);

#if defined(OS_WIN)
  // Creates a stacktrace for an exception.
  // Note: this function will throw an import not found (StackWalk64) exception
  // on system without dbghelp 5.1.
  StackTrace(_EXCEPTION_POINTERS* exception_pointers);
  StackTrace(_CONTEXT* context);
#endif

  // Copying and assignment are allowed with the default functions.

  ~StackTrace();

  // Gets an array of instruction pointer values. |*count| will be set to the
  // number of elements in the returned array.
  const void* const* Addresses(size_t* count) const;

  // Prints the stack trace to stderr.
  void Print() const;

#if !defined(__UCLIBC__)
  // Resolves backtrace to symbols and write to stream.
  void OutputToStream(std::ostream* os) const;
#endif

  // Resolves backtrace to symbols and returns as string.
  std::string ToString() const;

 private:
#if defined(OS_WIN)
  void InitTrace(_CONTEXT* context_record);
#endif

  // From http://msdn.microsoft.com/en-us/library/bb204633.aspx,
  // the sum of FramesToSkip and FramesToCapture must be less than 63,
  // so set it to 62. Even if on POSIX it could be a larger value, it usually
  // doesn't give much more information.
  static const int kMaxTraces = 62;

  void* trace_[kMaxTraces];

  // The number of valid frames in |trace_|.
  size_t count_;
};

namespace internal {

#if defined(OS_POSIX) && !defined(OS_ANDROID)
// POSIX doesn't define any async-signal safe function for converting
// an integer to ASCII. We'll have to define our own version.
// itoa_r() converts a (signed) integer to ASCII. It returns "buf", if the
// conversion was successful or NULL otherwise. It never writes more than "sz"
// bytes. Output will be truncated as needed, and a NUL character is always
// appended.
BASE_EXPORT char *itoa_r(intptr_t i,
                         char *buf,
                         size_t sz,
                         int base,
                         size_t padding);
#endif  // defined(OS_POSIX) && !defined(OS_ANDROID)

}  // namespace internal

}  // namespace debug
}  // namespace base

#endif  // BASE_DEBUG_STACK_TRACE_H_


text:
$(document).ready(function() {
	$("#formAuthentification").submit(function() {
		var username = document.getElementById("username").value;
		var password = document.getElementById("password").value;

		$.ajax({
			type: 'GET',
//			url: '../rest/?login='+username+'&pass='+password+'&request=/',
			url: '../rest/?login='+username+'&pass='+password,
			data: "json",
			timeout: 10000,
			success: function(data) {
				if (data.status == "success" & data.code == 200) {
					$('#erreur').html("");
				}
			},
			error: function(jqXHR, textStatus, errorThrown) {
				$('#erreur').html("Mauvais identifians de connexion");
			},
			complete: function(XMLHttpRequest, textStatus) {
				var auth = XMLHttpRequest.getResponseHeader("Auth");
				if (auth != null) {
					document.location.href = "nav.html?auth=" + auth;
				}
			}
		});
		return false;
	});
});


text:
<?php

/**
 * Debugging tools.
 *
 * This file gives a developer a set of tools useful for performing code
 * consistency checks. This includes scoping code blocks to ensure that
 * only the interesting iteration of a loop gets outputted, a paint()
 * function that acts like var_dump() with pre tags, and conditional
 * printing.
 */

/*
TODO
 * Integrate into SimpleTest so it tells us whether or not there were any
   not cleaned up debug calls.
 * Custom var_dump() that ignores blacklisted properties
 * DEPRECATE AND REMOVE ALL CALLS!
*/

/**#@+
 * Convenience global functions. Corresponds to method on Debugger.
 */
function paint($mixed) {
    $Debugger =& Debugger::instance();
    return $Debugger->paint($mixed);
}
function paintIf($mixed, $conditional) {
    $Debugger =& Debugger::instance();
    return $Debugger->paintIf($mixed, $conditional);
}
function paintWhen($mixed, $scopes = array()) {
    $Debugger =& Debugger::instance();
    return $Debugger->paintWhen($mixed, $scopes);
}
function paintIfWhen($mixed, $conditional, $scopes = array()) {
    $Debugger =& Debugger::instance();
    return $Debugger->paintIfWhen($mixed, $conditional, $scopes);
}
function addScope($id = false) {
    $Debugger =& Debugger::instance();
    return $Debugger->addScope($id);
}
function removeScope($id) {
    $Debugger =& Debugger::instance();
    return $Debugger->removeScope($id);
}
function resetScopes() {
    $Debugger =& Debugger::instance();
    return $Debugger->resetScopes();
}
function isInScopes($array = array()) {
    $Debugger =& Debugger::instance();
    return $Debugger->isInScopes($array);
}
/**#@-*/

/**
 * The debugging singleton. Most interesting stuff happens here.
 */
class Debugger
{

    public $shouldPaint = false;
    public $paints  = 0;
    public $current_scopes = array();
    public $scope_nextID = 1;
    public $add_pre = true;

    public function Debugger() {
        $this->add_pre = !extension_loaded('xdebug');
    }

    public static function &instance() {
        static $soleInstance = false;
        if (!$soleInstance) $soleInstance = new Debugger();
        return $soleInstance;
    }

    public function paintIf($mixed, $conditional)  {
        if (!$conditional) return;
        $this->paint($mixed);
    }

    public function paintWhen($mixed, $scopes = array()) {
        if (!$this->isInScopes($scopes)) return;
        $this->paint($mixed);
    }

    public function paintIfWhen($mixed, $conditional, $scopes = array()) {
        if (!$conditional) return;
        if (!$this->isInScopes($scopes)) return;
        $this->paint($mixed);
    }

    public function paint($mixed) {
        $this->paints++;
        if($this->add_pre) echo '<pre>';
        var_dump($mixed);
        if($this->add_pre) echo '</pre>';
    }

    public function addScope($id = false) {
        if ($id == false) {
            $id = $this->scope_nextID++;
        }
        $this->current_scopes[$id] = true;
    }

    public function removeScope($id) {
        if (isset($this->current_scopes[$id])) unset($this->current_scopes[$id]);
    }

    public function resetScopes() {
        $this->current_scopes = array();
        $this->scope_nextID = 1;
    }

    public function isInScopes($scopes = array()) {
        if (empty($this->current_scopes)) {
            return false;
        }
        if (!is_array($scopes)) {
            $scopes = array($scopes);
        }
        foreach ($scopes as $scope_id) {
            if (empty($this->current_scopes[$scope_id])) {
                return false;
            }
        }
        if (empty($scopes)) {
            if ($this->scope_nextID == 1) {
                return false;
            }
            for($i = 1; $i < $this->scope_nextID; $i++) {
                if (empty($this->current_scopes[$i])) {
                    return false;
                }
            }
        }
        return true;
    }

}

// vim: et sw=4 sts=4


text:
import Build from './build.model.js';
import config from '../../config';

export async function getAllBuildRecords (ctx) {
  try {
    const builds = await Build.find({}).populate('project').sort({time: 'desc'});
    ctx.body = { errCode: 0, errMsg: 'success', data: builds };
  } catch (err) {
    ctx.throw(422, err.message);
  }
};

export async function getBuildRecordByProjectId (ctx) {
  try {
    const projectId = ctx.params.id;
    const build = await Build.find({ project: projectId }).sort({time: 'desc'});
    ctx.body = { errCode: 0, errMsg: 'success', data: build };
  } catch (err) {
    ctx.throw(422, err.message);
  }
};

export async function addBuildRecord (buildRecord) {
  buildRecord.time = new Date();
  return await Build.create(buildRecord);
};