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

<title>CreativeErrorReason</title>
<meta name="date" content="2013-12-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.google.api.ads.dfp.v201211

Class CreativeErrorReason

java.lang.Object

com.google.api.ads.dfp.v201211.CreativeErrorReason

All Implemented Interfaces:

java.io.Serializable

public class CreativeErrorReason
extends java.lang.Object
implements java.io.Serializable

See Also:

Serialized Form

Field Summary

Fields

Modifier and Type
Field and Description

static java.lang.String
_CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

static java.lang.String
_CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

static java.lang.String
_CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

static java.lang.String
_CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

static java.lang.String
_DESTINATION_URL_REQUIRED

static java.lang.String
_DUPLICATE_ASSET_IN_CREATIVE

static java.lang.String
_FLASH_AND_FALLBACK_URL_ARE_SAME

static java.lang.String
_INVALID_AD_EXCHANGE_CREATIVE_SIZE

static java.lang.String
_INVALID_ADSENSE_CREATIVE_SIZE

static java.lang.String
_INVALID_COMPANY_TYPE

static java.lang.String
_INVALID_INTERNAL_REDIRECT_URL

static java.lang.String
_MISSING_FEATURE

static java.lang.String
_UNKNOWN

static CreativeErrorReason
CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

static CreativeErrorReason
CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

static CreativeErrorReason
CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

static CreativeErrorReason
CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

static CreativeErrorReason
DESTINATION_URL_REQUIRED

static CreativeErrorReason
DUPLICATE_ASSET_IN_CREATIVE

static CreativeErrorReason
FLASH_AND_FALLBACK_URL_ARE_SAME

static CreativeErrorReason
INVALID_AD_EXCHANGE_CREATIVE_SIZE

static CreativeErrorReason
INVALID_ADSENSE_CREATIVE_SIZE

static CreativeErrorReason
INVALID_COMPANY_TYPE

static CreativeErrorReason
INVALID_INTERNAL_REDIRECT_URL

static CreativeErrorReason
MISSING_FEATURE

static CreativeErrorReason
UNKNOWN

Constructor Summary

Constructors

Modifier
Constructor and Description

protected
CreativeErrorReason(java.lang.String value)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
equals(java.lang.Object obj)

static CreativeErrorReason
fromString(java.lang.String value)

static CreativeErrorReason
fromValue(java.lang.String value)

static org.apache.axis.encoding.Deserializer
getDeserializer(java.lang.String mechType,
               java.lang.Class _javaType,
               javax.xml.namespace.QName _xmlType)

static org.apache.axis.encoding.Serializer
getSerializer(java.lang.String mechType,
             java.lang.Class _javaType,
             javax.xml.namespace.QName _xmlType)

static org.apache.axis.description.TypeDesc
getTypeDesc()

Return type metadata object

java.lang.String
getValue()

int
hashCode()

java.lang.Object
readResolve()

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

_FLASH_AND_FALLBACK_URL_ARE_SAME

public static final java.lang.String _FLASH_AND_FALLBACK_URL_ARE_SAME

See Also:

Constant Field Values

_INVALID_INTERNAL_REDIRECT_URL

public static final java.lang.String _INVALID_INTERNAL_REDIRECT_URL

See Also:

Constant Field Values

_DESTINATION_URL_REQUIRED

public static final java.lang.String _DESTINATION_URL_REQUIRED

See Also:

Constant Field Values

_CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

public static final java.lang.String _CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

See Also:

Constant Field Values

_CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

public static final java.lang.String _CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

See Also:

Constant Field Values

_MISSING_FEATURE

public static final java.lang.String _MISSING_FEATURE

See Also:

Constant Field Values

_INVALID_COMPANY_TYPE

public static final java.lang.String _INVALID_COMPANY_TYPE

See Also:

Constant Field Values

_INVALID_ADSENSE_CREATIVE_SIZE

public static final java.lang.String _INVALID_ADSENSE_CREATIVE_SIZE

See Also:

Constant Field Values

_INVALID_AD_EXCHANGE_CREATIVE_SIZE

public static final java.lang.String _INVALID_AD_EXCHANGE_CREATIVE_SIZE

See Also:

Constant Field Values

_DUPLICATE_ASSET_IN_CREATIVE

public static final java.lang.String _DUPLICATE_ASSET_IN_CREATIVE

See Also:

Constant Field Values

_CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

public static final java.lang.String _CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

See Also:

Constant Field Values

_CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

public static final java.lang.String _CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

See Also:

Constant Field Values

_UNKNOWN

public static final java.lang.String _UNKNOWN

See Also:

Constant Field Values

FLASH_AND_FALLBACK_URL_ARE_SAME

public static final CreativeErrorReason FLASH_AND_FALLBACK_URL_ARE_SAME

INVALID_INTERNAL_REDIRECT_URL

public static final CreativeErrorReason INVALID_INTERNAL_REDIRECT_URL

DESTINATION_URL_REQUIRED

public static final CreativeErrorReason DESTINATION_URL_REQUIRED

CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

public static final CreativeErrorReason CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_CREATIVE

CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

public static final CreativeErrorReason CANNOT_CREATE_OR_UPDATE_LEGACY_DFP_MOBILE_CREATIVE

MISSING_FEATURE

public static final CreativeErrorReason MISSING_FEATURE

INVALID_COMPANY_TYPE

public static final CreativeErrorReason INVALID_COMPANY_TYPE

INVALID_ADSENSE_CREATIVE_SIZE

public static final CreativeErrorReason INVALID_ADSENSE_CREATIVE_SIZE

INVALID_AD_EXCHANGE_CREATIVE_SIZE

public static final CreativeErrorReason INVALID_AD_EXCHANGE_CREATIVE_SIZE

DUPLICATE_ASSET_IN_CREATIVE

public static final CreativeErrorReason DUPLICATE_ASSET_IN_CREATIVE

CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

public static final CreativeErrorReason CREATIVE_ASSET_CANNOT_HAVE_ID_AND_BYTE_ARRAY

CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

public static final CreativeErrorReason CANNOT_CREATE_OR_UPDATE_UNSUPPORTED_CREATIVE

UNKNOWN

public static final CreativeErrorReason UNKNOWN

Constructor Detail

CreativeErrorReason

protected CreativeErrorReason(java.lang.String value)

Method Detail

getValue

public java.lang.String getValue()

fromValue

public static CreativeErrorReason fromValue(java.lang.String value)
                                     throws java.lang.IllegalArgumentException

Throws:

java.lang.IllegalArgumentException

fromString

public static CreativeErrorReason fromString(java.lang.String value)
                                      throws java.lang.IllegalArgumentException

Throws:

java.lang.IllegalArgumentException

equals

public boolean equals(java.lang.Object obj)

Overrides:

equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:

hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

readResolve

public java.lang.Object readResolve()
                             throws java.io.ObjectStreamException

Throws:

java.io.ObjectStreamException

getSerializer

public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType,
                                                java.lang.Class _javaType,
                                                javax.xml.namespace.QName _xmlType)

getDeserializer

public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType,
                                                    java.lang.Class _javaType,
                                                    javax.xml.namespace.QName _xmlType)

getTypeDesc

public static org.apache.axis.description.TypeDesc getTypeDesc()

Return type metadata object

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="reactiveui.routing.usecases.android" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
	<uses-sdk android:minSdkVersion="21" />
	<application android:allowBackup="true" android:label="@string/app_name"></application>
</manifest>

redpajama_set_name: RedPajamaGithub


text:
import logging

from sevenbridges.models.link import Link
from sevenbridges.models.member import Member
from sevenbridges.decorators import inplace_reload
from sevenbridges.meta.resource import Resource
from sevenbridges.meta.collection import Collection
from sevenbridges.meta.transformer import Transform
from sevenbridges.meta.fields import HrefField, StringField

logger = logging.getLogger(__name__)

class Dataset(Resource):
    """Central resource for managing datasets."""

    _URL = {
        'query': '/datasets',
        'owned_by': '/datasets/{username}',
        'get': '/datasets/{id}',
        'delete': '/datasets/{id}',
        'members': '/datasets/{id}/members',
        'member': '/datasets/{id}/members/{username}',
        'permissions': '/datasets/{id}/members/{username}/permissions',
    }

    href = HrefField(read_only=True)
    id = StringField(read_only=True)
    name = StringField(read_only=False)
    description = StringField(read_only=False)

    def __str__(self):
        return f'<Dataset: id={self.id}>'

    def __eq__(self, other):
        if type(other) is not type(self):
            return False
        return self is other or self.id == other.id

    @classmethod
    def query(cls, visibility=None, api=None):
        """Query ( List ) datasets
        :param visibility: If provided as 'public', retrieves public datasets
        :param api: Api instance
        :return: Collection object
        """
        api = api if api else cls._API

        return super()._query(
            url=cls._URL['query'],
            visibility=visibility,
            fields='_all', api=api
        )

    @classmethod
    def get_owned_by(cls, username, api=None):
        """Query ( List ) datasets by owner
        :param api: Api instance
        :param username: Owner username
        :return: Collection object
        """
        api = api if api else cls._API

        return super()._query(
            url=cls._URL['owned_by'].format(username=username),
            fields='_all',
            api=api
        )

    @inplace_reload
    def save(self, inplace=True):
        """Save all modification to the dataset on the server.
        :param inplace: Apply edits on the current instance or get a new one.
        :return: Dataset instance.
        """
        modified_data = self._modified_data()
        if modified_data:
            dataset_request_data = {}

            name = modified_data.pop('name', None)
            description = modified_data.pop('description', None)
            dataset_request_data.update(modified_data)

            if name:
                dataset_request_data['name'] = name

            if description:
                dataset_request_data['description'] = description

            response = self._api.patch(
                url=self._URL['get'].format(id=self.id),
                data=dataset_request_data
            )
            data = response.json()

            dataset = Dataset(api=self._api, **data)
            return dataset

    def get_members(self, api=None):
        """Retrieve dataset members
        :param api: Api instance
        :return: Collection object
        """
        api = api or self._API

        response = api.get(url=self._URL['members'].format(id=self.id))

        data = response.json()
        total = response.headers['x-total-matching-query']
        members = [Member(api=api, **member) for member in data['items']]
        links = [Link(**link) for link in data['links']]
        href = data['href']

        return Collection(
            resource=Member,
            href=href,
            total=total,
            items=members,
            links=links,
            api=api
        )

    def get_member(self, username, api=None):
        """Retrieve dataset member
        :param username: Member name
        :param api: Api instance
        :return: Member object
        """
        api = api if api else self._API

        response = api.get(
            url=self._URL['member'].format(id=self.id, username=username),
        )
        data = response.json()
        return Member(api=api, **data)

    def add_member(self, username, permissions, api=None):
        """Add member to a dataset
        :param username: Member username
        :param permissions: Permissions dict
        :param api: Api instance
        :return: New member instance
        """
        api = api or self._API
        data = {
            'username': username,
            'permissions': permissions
        }

        response = api.post(
            url=self._URL['members'].format(id=self.id),
            data=data
        )
        data = response.json()
        return Member(api=api, **data)

    def remove_member(self, member, api=None):
        """Remove member from a dataset
        :param member: Member username
        :param api: Api instance
        :return: None
        """
        api = api or self._API
        username = Transform.to_member(member)

        api.delete(
            url=self._URL['member'].format(
                id=self.id,
                username=username
            )
        )


text:
package com.google.maps.android.utils.demo;

import android.widget.Toast;

import de.quist.app.maps.utils.clustering.ClusterManager;
import com.google.maps.android.utils.demo.model.MyItem;

import org.json.JSONException;

import java.io.InputStream;
import java.util.List;

/**
 * Simple activity demonstrating ClusterManager.
 */
public class ClusteringDemoActivity extends BaseDemoActivity {
    private ClusterManager<MyItem> mClusterManager;

    @Override
    protected void startDemo() {
        getMap().moveCamera(BuildConfig.MAP_BINDING.cameraUpdateFactory().newLatLngZoom(BuildConfig.MAP_BINDING.newLatLng(51.503186, -0.126446), 10));

        mClusterManager = new ClusterManager<MyItem>(this, BuildConfig.MAP_BINDING, getMap());
        getMap().setOnCameraChangeListener(mClusterManager);

        try {
            readItems();
        } catch (JSONException e) {
            Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show();
        }
    }

    private void readItems() throws JSONException {
        InputStream inputStream = getResources().openRawResource(R.raw.radar_search);
        List<MyItem> items = new MyItemReader().read(inputStream);
        mClusterManager.addItems(items);
    }
}


text:
package org.apache.drill.exec.expr.fn.impl;

import io.netty.buffer.DrillBuf;
import org.apache.drill.exec.expr.DrillAggFunc;
import org.apache.drill.exec.expr.annotations.FunctionTemplate;
import org.apache.drill.exec.expr.annotations.Output;
import org.apache.drill.exec.expr.annotations.Param;
import org.apache.drill.exec.expr.annotations.Workspace;
import org.apache.drill.exec.expr.holders.NullableVarCharHolder;
import org.apache.drill.exec.expr.holders.ObjectHolder;
import org.apache.drill.exec.expr.holders.VarCharHolder;
import org.apache.drill.exec.record.metadata.TupleMetadata;
import org.apache.drill.exec.vector.complex.reader.FieldReader;

import javax.inject.Inject;

public class SchemaFunctions {

  /**
   * Aggregate function which infers schema from incoming data and returns string representation of {@link TupleMetadata}
   * with incoming schema.
   */
  @FunctionTemplate(name = "schema",
                    scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE,
                    isInternal = true,
                    isVarArg = true)
  public static class SchemaFunction implements DrillAggFunc {

    @Param FieldReader[] inputs;
    @Output NullableVarCharHolder out;
    @Inject DrillBuf buf;
    @Workspace ObjectHolder columnsHolder;

    @Override
    public void setup() {
      columnsHolder = new ObjectHolder();
    }

    @Override
    public void add() {
      java.util.Map<String, org.apache.drill.exec.record.MaterializedField> columns;
      if (columnsHolder.obj == null) {
        // Janino does not support diamond operator for this case :(
        columnsHolder.obj = new java.util.LinkedHashMap<String, org.apache.drill.exec.record.MaterializedField>();
      }

      columns = (java.util.Map<String, org.apache.drill.exec.record.MaterializedField>) columnsHolder.obj;

      for (int i = 0; i < inputs.length; i += 2) {
        String columnName = inputs[i].readObject().toString();
        // Janino cannot infer type
        org.apache.drill.exec.record.MaterializedField materializedField =
            (org.apache.drill.exec.record.MaterializedField) columns.get(columnName);
        org.apache.drill.common.types.TypeProtos.MajorType type = inputs[i + 1].getType(); // lgtm [java/index-out-of-bounds]
        if (materializedField != null && !materializedField.getType().equals(type)) {
          org.apache.drill.common.types.TypeProtos.MinorType leastRestrictiveType =
              org.apache.drill.exec.resolver.TypeCastRules.getLeastRestrictiveType(
                  java.util.Arrays.asList(materializedField.getType().getMinorType(), type.getMinorType()));
          org.apache.drill.common.types.TypeProtos.DataMode leastRestrictiveMode =
              org.apache.drill.exec.resolver.TypeCastRules.getLeastRestrictiveDataMode(
                  java.util.Arrays.asList(materializedField.getType().getMode(), type.getMode()));

          org.apache.drill.exec.record.MaterializedField clone = materializedField.clone();
          clone.replaceType(materializedField.getType().toBuilder()
              .setMinorType(leastRestrictiveType)
              .setMode(leastRestrictiveMode)
              .build());
          columns.put(columnName, clone);
        } else {
          if (type.getMinorType() == org.apache.drill.common.types.TypeProtos.MinorType.MAP) {
            columns.put(columnName, inputs[i + 1].getField()); // lgtm [java/index-out-of-bounds]
          } else {
            columns.put(columnName, org.apache.drill.exec.record.MaterializedField.create(columnName, type));
          }
        }
      }
    }

    @Override
    public void output() {
      org.apache.drill.exec.record.metadata.SchemaBuilder schemaBuilder =
          new org.apache.drill.exec.record.metadata.SchemaBuilder();

      java.util.Map<String, org.apache.drill.exec.record.MaterializedField> columns =
          (java.util.Map<String, org.apache.drill.exec.record.MaterializedField>) columnsHolder.obj;

      if (columns == null) {
        return;
      }

      for (org.apache.drill.exec.record.MaterializedField materializedField : columns.values()) {
        // Janino compiler cannot infer types from generics :(
        schemaBuilder.add((org.apache.drill.exec.record.MaterializedField) materializedField);
      }

      byte[] type = schemaBuilder.build().jsonString().getBytes();
      buf = buf.reallocIfNeeded(type.length);
      buf.setBytes(0, type);
      out.buffer = buf;
      out.start = 0;
      out.end = type.length;
      out.isSet = 1;
    }

    @Override
    public void reset() {
      columnsHolder.obj = null;
    }
  }

  /**
   * Aggregate function which accepts VarChar column with string representations of {@link TupleMetadata}
   * and returns string representation of {@link TupleMetadata} with merged schema.
   */
  @FunctionTemplate(name = "merge_schema",
                    scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE,
                    isInternal = true)
  public static class MergeNullableSchemaFunction implements DrillAggFunc {

    @Param NullableVarCharHolder input;
    @Output NullableVarCharHolder out;
    @Inject DrillBuf buf;
    @Workspace ObjectHolder schemaHolder;

    @Override
    public void setup() {
      schemaHolder = new ObjectHolder();
    }

    @Override
    public void add() {
      if (input.isSet == 0) {
        return;
      }

      org.apache.drill.exec.record.metadata.TupleMetadata currentSchema =
          org.apache.drill.exec.expr.fn.impl.SchemaFunctions.getTupleMetadata(
              org.apache.drill.common.util.DrillStringUtils.toBinaryString(input.buffer, input.start, input.end));
      if (schemaHolder.obj == null) {
        schemaHolder.obj = currentSchema;
        return;
      }

      org.apache.drill.exec.record.metadata.TupleMetadata resolvedSchema =
          (org.apache.drill.exec.record.metadata.TupleMetadata) schemaHolder.obj;

      if (!resolvedSchema.isEquivalent(currentSchema)) {
        throw new UnsupportedOperationException("merge_schema function does not support schema changes.");
      }
    }

    @Override
    public void output() {
      org.apache.drill.exec.record.metadata.TupleMetadata resolvedSchema =
          (org.apache.drill.exec.record.metadata.TupleMetadata) schemaHolder.obj;

      byte[] type = resolvedSchema.jsonString().getBytes();
      buf = buf.reallocIfNeeded(type.length);
      buf.setBytes(0, type);
      out.buffer = buf;
      out.start = 0;
      out.end = type.length;
      out.isSet = 1;
    }

    @Override
    public void reset() {
      schemaHolder.obj = null;
    }

  }

  @FunctionTemplate(name = "merge_schema",
                    scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE,
                    isInternal = true)
  public static class MergeSchemaFunction implements DrillAggFunc {

    @Param VarCharHolder input;
    @Output VarCharHolder out;
    @Inject DrillBuf buf;
    @Workspace ObjectHolder schemaHolder;

    @Override
    public void setup() {
      schemaHolder = new ObjectHolder();
    }

    @Override
    public void add() {
      org.apache.drill.exec.record.metadata.TupleMetadata currentSchema = org.apache.drill.exec.expr.fn.impl.SchemaFunctions.getTupleMetadata(
          org.apache.drill.common.util.DrillStringUtils.toBinaryString(input.buffer, input.start, input.end));
      if (schemaHolder.obj == null) {
        schemaHolder.obj = currentSchema;
        return;
      }

      org.apache.drill.exec.record.metadata.TupleMetadata resolvedSchema =
          (org.apache.drill.exec.record.metadata.TupleMetadata) schemaHolder.obj;

      if (!resolvedSchema.isEquivalent(currentSchema)) {
        throw new UnsupportedOperationException("merge_schema function does not support schema changes.");
      }
    }

    @Override
    public void output() {
      org.apache.drill.exec.record.metadata.TupleMetadata resolvedSchema =
          (org.apache.drill.exec.record.metadata.TupleMetadata) schemaHolder.obj;

      byte[] type = resolvedSchema.jsonString().getBytes();
      buf = buf.reallocIfNeeded(type.length);
      buf.setBytes(0, type);
      out.buffer = buf;
      out.start = 0;
      out.end = type.length;
    }

    @Override
    public void reset() {
      schemaHolder.obj = null;
    }
  }

  /**
   * Wraps static method from TupleMetadata to avoid {@link IncompatibleClassChangeError} for JDK 9+.
   * {@see JDK-8147755}.
   *
   * @param serialized tuple metadata in JSON string representation
   * @return {@link TupleMetadata} instance
   */
  public static TupleMetadata getTupleMetadata(String serialized) {
    return TupleMetadata.of(serialized);
  }
}


text:
CreditsScreen::CreditsScreen(sf::RenderWindow& window) {
    _gui.setWindow(window);

    auto resourceHandler = Locator<ResourceHandler>::get();
    auto settings = Locator<Settings>::get();

    auto windowWidth = tgui::bindWidth(_gui);
    auto windowHeight = tgui::bindHeight(_gui);

    auto theme = resourceHandler->get<tgui::Theme>(THEME_DEFAULT);

    auto background = tgui::Picture::create();
    background->setTexture(BACKGROUNDS_DIR + settings->getBackground());
    _gui.add(background);

    const sf::Color CREDITS_COLOR = sf::Color::Black;

    tgui::Label::Ptr lblHansel = theme->load("Label");
    lblHansel->setTextSize(60);
    lblHansel->setTextColor(CREDITS_COLOR);
    lblHansel->setTextStyle(sf::Text::Bold);
    lblHansel->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblHansel->setSize(windowWidth, 70);
    lblHansel->setPosition(0, windowHeight * 2 / 10);
    lblHansel->setText("Hansel De La Cruz");
    _gui.add(lblHansel);

    tgui::Label::Ptr lblHanselTitle = theme->load("Label");
    lblHanselTitle->setTextSize(25);
    lblHanselTitle->setTextColor(CREDITS_COLOR);
    lblHanselTitle->setTextStyle(sf::Text::Bold);
    lblHanselTitle->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblHanselTitle->setSize(windowWidth, 30);
    lblHanselTitle->setPosition(0, lblHansel->getPosition().y + lblHansel->getFullSize().y);
    lblHanselTitle->setText("Lead Developer");
    _gui.add(lblHanselTitle);

    tgui::Label::Ptr lblKyle = theme->load("Label");
    lblKyle->setTextSize(60);
    lblKyle->setTextColor(CREDITS_COLOR);
    lblKyle->setTextStyle(sf::Text::Bold);
    lblKyle->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblKyle->setSize(windowWidth, 70);
    lblKyle->setPosition(0, windowHeight * 4 / 10);
    lblKyle->setText("Kyle Jolicoeur");
    _gui.add(lblKyle);

    tgui::Label::Ptr lblKyleTitle = theme->load("Label");
    lblKyleTitle->setTextSize(25);
    lblKyleTitle->setTextColor(CREDITS_COLOR);
    lblKyleTitle->setTextStyle(sf::Text::Bold);
    lblKyleTitle->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblKyleTitle->setSize(windowWidth, 30);
    lblKyleTitle->setPosition(0, lblKyle->getPosition().y + lblKyle->getFullSize().y);
    lblKyleTitle->setText("Developer");
    _gui.add(lblKyleTitle);

    tgui::Label::Ptr lblJennifer = theme->load("Label");
    lblJennifer->setTextSize(60);
    lblJennifer->setTextColor(CREDITS_COLOR);
    lblJennifer->setTextStyle(sf::Text::Bold);
    lblJennifer->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblJennifer->setSize(windowWidth, 70);
    lblJennifer->setPosition(0, windowHeight * 6 / 10);
    lblJennifer->setText("Jennifer Green");
    _gui.add(lblJennifer);

    tgui::Label::Ptr lblJenniferTitle = theme->load("Label");
    lblJenniferTitle->setTextSize(25);
    lblJenniferTitle->setTextColor(CREDITS_COLOR);
    lblJenniferTitle->setTextStyle(sf::Text::Bold);
    lblJenniferTitle->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    lblJenniferTitle->setSize(windowWidth, 30);
    lblJenniferTitle->setPosition(0, lblJennifer->getPosition().y + lblJennifer->getFullSize().y);
    lblJenniferTitle->setText("Designer");
    _gui.add(lblJenniferTitle);

    tgui::Button::Ptr btnMainMenu = theme->load("Button");
    btnMainMenu->setSize(windowWidth / 5, 50);
    btnMainMenu->setPosition(windowWidth / 2 - btnMainMenu->getFullSize().x / 2, windowHeight * 8 / 10);
    btnMainMenu->setText("Main Menu");
    btnMainMenu->connect("pressed", [] {
        Locator<StateHandler>::get()->pop();
    });
    _gui.add(btnMainMenu);
}

void CreditsScreen::handleEvent(sf::Event& e) {
    _gui.handleEvent(e);
}

void CreditsScreen::update(float delta) {}

void CreditsScreen::draw(sf::RenderWindow& window) {
    _gui.draw();
}


text:
<!DOCTYPE html>

	<title>Editor - Robots Are People Too</title>

	<link type="text/css" rel="stylesheet" href="style.css" />

			Empty
			Solid
			Diagonal

Tiles

			Start
			Goal

Players

			Enemies
			Walls / Buttons
			Cog
			Sign

Objects

			Select
			Help
			Save & Exit

Other

Loading...

	<canvas id="canvas"></canvas>

Text for help sign:

		<input type="text" id="sign-text">
		<button id="sign-text-change">Change</button>
		<button id="sign-text-cancel">Cancel</button>

</body


text:
package org.auraframework.util.type.converter;

import org.auraframework.util.type.Converter;

/**
 * Used by aura.util.type.TypeUtil
 */
public class LongToStringConverter implements Converter<Long, String> {

    @Override
    public String convert(Long value) {
        return value.toString();
    }

    @Override
    public Class<Long> getFrom() {
        return Long.class;
    }

    @Override
    public Class<String> getTo() {
        return String.class;
    }

    @Override
    public Class<?>[] getToParameters() {
        return null;
    }

}


text:
package com.java110.api.components;

import com.java110.core.context.IPageData;
import com.java110.api.smo.IRegisterServiceSMO;
import com.java110.api.smo.sys.ISysServiceSMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * 用户注册事件
 * Created by wuxw on 2019/3/23.
 */
@Component("register")
public class RegisterComponent {

    @Autowired
    IRegisterServiceSMO registerServiceSMOImpl;

    @Autowired
    private ISysServiceSMO sysServiceSMOImpl;

    /**
     * 用户注册
     *
     * @param pd 页面封装数据
     * @return
     */
    public ResponseEntity<String> doRegister(IPageData pd) {
        ResponseEntity<String> responseEntity = null;
        try {
            responseEntity = registerServiceSMOImpl.doRegister(pd);
        } catch (Exception e) {
            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        } finally {
        }

        return responseEntity;
    }

    /**
     * 用户注册
     *
     * @param pd 页面封装数据
     * @return
     */
    public ResponseEntity<String> loadArea(IPageData pd) {
        ResponseEntity<String> responseEntity = null;
        try {
            responseEntity = registerServiceSMOImpl.loadArea(pd);
        } catch (Exception e) {
            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        } finally {
        }

        return responseEntity;
    }

    public ResponseEntity<String> getSysInfo(IPageData pd) {
        return sysServiceSMOImpl.getSysInfo(pd);
    }

    public IRegisterServiceSMO getRegisterServiceSMOImpl() {
        return registerServiceSMOImpl;
    }

    public void setRegisterServiceSMOImpl(IRegisterServiceSMO registerServiceSMOImpl) {
        this.registerServiceSMOImpl = registerServiceSMOImpl;
    }

    public ISysServiceSMO getSysServiceSMOImpl() {
        return sysServiceSMOImpl;
    }

    public void setSysServiceSMOImpl(ISysServiceSMO sysServiceSMOImpl) {
        this.sysServiceSMOImpl = sysServiceSMOImpl;
    }
}


text:
package com.newwordpress.hum.persistence.model;

import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by humin on 4/11/2017.
 */
@Entity
@Table(name="content")
public class Content {
    public Long getId_content() {
        return id_content;
    }

    public void setId_content(Long id_content) {
        this.id_content = id_content;
    }

    public String getPost_title() {
        return post_title;
    }

    public void setPost_title(String post_title) {
        this.post_title = post_title;
    }

    public String getPost_author() {
        return post_author;
    }

    public void setPost_author(String post_author) {
        this.post_author = post_author;
    }

    public Date getPost_date() {
        return post_date;
    }

    public void setPost_date(Date post_date) {
        this.post_date = post_date;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id_content;

    @NotEmpty
    @Column(name="POST_TILE", nullable=false)
    private String post_title;

    @NotEmpty
    @Column(name="POST_AUTHOR", nullable=false)
    private String post_author;

    @NotEmpty
    @Column(name="POST_DATE", nullable=false)
    private Date post_date;

    @NotEmpty
    @Column(name="STATUS", nullable=false)
    private String status;
}


text:
/* global numeral */

export default Ember.Handlebars.makeBoundHelper(function(number) {
  if (isNaN(number)) return '0.00%';
  if (number.toString() === number) return number;
  return numeral(number).format('0.00%');
});


text:
package org.springframework.cloud.deployer.spi.openshift.resources.buildConfig;

import io.fabric8.openshift.api.model.BuildConfig;
import io.fabric8.openshift.api.model.BuildConfigBuilder;
import io.fabric8.openshift.client.OpenShiftClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.deployer.resource.maven.MavenResource;
import org.springframework.cloud.deployer.spi.core.AppDeploymentRequest;
import org.springframework.cloud.deployer.spi.openshift.OpenShiftAppDeployer;
import org.springframework.cloud.deployer.spi.openshift.OpenShiftDeployerProperties;
import org.springframework.cloud.deployer.spi.openshift.OpenShiftDeploymentPropertyKeys;
import org.springframework.cloud.deployer.spi.openshift.OpenShiftSupport;

import java.io.IOException;
import java.util.Map;

public class S2iBinaryInputBuildConfigStrategy extends BuildConfigStrategy
		implements OpenShiftSupport {

	private static Logger logger = LoggerFactory.getLogger(OpenShiftAppDeployer.class);

	private OpenShiftClient client;

	private final OpenShiftDeployerProperties openShiftDeployerProperties;

	private final MavenResource mavenResource;

	public S2iBinaryInputBuildConfigStrategy(
			OpenShiftDeployerProperties openShiftDeployerProperties,
			OpenShiftClient client, Map<String, String> labels,
			MavenResource mavenResource) {
		super(null, client, labels);
		this.client = client;
		this.openShiftDeployerProperties = openShiftDeployerProperties;
		this.mavenResource = mavenResource;
	}

	@Override
	protected BuildConfig buildBuildConfig(AppDeploymentRequest request, String appId,
			Map<String, String> labels) {
		//@formatter:off
		return new BuildConfigBuilder()
			.withNewMetadata()
				.withName(appId)
				.withLabels(labels)
			.endMetadata()
			.withNewSpec()
				.withNewSource()
					.withType("binary")
				.endSource()
				.withNewStrategy()
					.withNewSourceStrategy()
						.withNewFrom()
							.withKind("DockerImage")
							.withName(request.getDeploymentProperties().getOrDefault(
						OpenShiftDeploymentPropertyKeys.OPENSHIFT_S2I_BUILD_IMAGE,
						openShiftDeployerProperties.getDefaultS2iImage()))
						.endFrom()
					.endSourceStrategy()
				.endStrategy()
				.withNewOutput()
					.withNewTo()
						.withKind("ImageStreamTag")
						.withName(getImageTag(request, openShiftDeployerProperties, appId))
					.endTo()
				.endOutput()
			.endSpec()
			.build();
		//@formatter:on
	}

	@Override
	public void applyObject(AppDeploymentRequest request, String appId) {
		try {
			client.buildConfigs().withName(appId).instantiateBinary()
					.asFile(mavenResource.getFilename())
					.fromFile(mavenResource.getFile());
		}
		catch (IOException e) {
			logger.error(String.format("Could not access Maven artifact: %s",
					mavenResource.getFilename()), e);
		}
	}

}


text:
@charset "Shift_JIS";
/* Common style sheet for Tech Notes */

* {margin: 0; padding: 0; border-width: 0;}
body {margin: 8px; background-color: #e0ffff; font-color: black; font-family:"'l'r 'o–¾'©", serif; line-height: 150%; letter-spacing: 1px; max-width: 1024px;}
a:link {color: blue;}
a:visited {color: darkmagenta;}
a:hover {background-color: #a0ffff;}
a:active {color: darkmagenta; overflow: hidden; outline:none; position: relative; top: 1px; left: 1px;}
abbr {border-width: 1px;}

p {text-indent: 1em; margin: 0 0 0.3em 0.5em;}
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
pre em {font-style: italic; font-weight: normal;}
strong {}
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; font-family: monospace; background-color: white;}
pre span.c {color: green;}
pre span.k {color: blue;}
tt {margin: 0 0.2em; letter-spacing: 0; font-family: monospace; }
ol {margin: 0 2.5em;}
ul {margin: 0 2em;}
dl {margin: 0 1em;}
dt {font-family: monospace;}
dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; letter-spacing: 0;}
dl.ret dt {margin: 0.5em 0 0 0 ; font-family: monospace; letter-spacing: 0; font-weight: bold;}
dd {margin: 0 2em;}
hr {border-width: 1px; margin: 1em;}
div.abst {font-family: "'l'r 'oƒSƒVƒbƒN",sans-serif;}
div.para {clear: both; font-family: "'l'r 'o–¾'©",serif;}
div.ret a {font-family: monospace; }
.equ {text-indent: 0; margin: 1em 2em 1em;}
.indent {margin-left: 2em;}
.rset {float: right; margin: 0 0 0.5em 0.5em;}
.lset {float: left; margin: 0 0.5em 0.5em 0.5em;}
ul.flat li {list-style-type: none; margin: 0;}
a.imglnk img {border: 1px solid;}
.iequ {white-space: nowrap; font-weight: bold;}
.clr {clear: both;}
.it {font-style: italic;}
.mfd {font-size: 0.7em; padding: 0 1px; border: 1px solid; white-space : nowrap}

h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0 0.3em;}
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
hr.hds {clear: both; margin-bottom: 1em;}

h2 {font-size: 1.6em; font-family: "'l'r 'oƒSƒVƒbƒN",sans-serif; background-color: #d8d8FF; padding: 0.2em 0.5em; margin: 0 0 0.5em;}
h3 {font-size: 1.5em; font-family: "'l'r 'oƒSƒVƒbƒN",sans-serif; margin: 1.5em 0 0.5em;}
h4 {font-size: 1.2em; font-family: "'l'r 'oƒSƒVƒbƒN",sans-serif; margin: 1em 0 0.2em;}
h5 {font-size: 1em; font-family: "'l'r 'oƒSƒVƒbƒN",sans-serif; margin: 0.5em 0 0em;}
small {font-size: 80%;}
.indent {margin-left: 2em;}

/* Tables */
table {margin: 0.5em 1em; border-collapse: collapse; border: 2px solid black; letter-spacing: 0;}
th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top;}
td {background-color: white; border: 1px solid black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
table.lst td:first-child {font-family: monospace; white-space: nowrap;}
table.lst2 td {font-family: monospace; white-space: nowrap;}
table caption {font-family: sans-serif; font-weight: bold;}
tr.lst3 td {border-width: 2px 1px 1px; }

p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

import { Field } from '../schema.js';
import { DataType, Map_, Struct } from '../type.js';
import { Builder, VariableWidthBuilder } from '../builder.js';

/** @ignore */ type MapValue<K extends DataType = any, V extends DataType = any> = Map_<K, V>['TValue'];
/** @ignore */ type MapValues<K extends DataType = any, V extends DataType = any> = Map<number, MapValue<K, V> | undefined>;
/** @ignore */ type MapValueExt<K extends DataType = any, V extends DataType = any> = MapValue<K, V> | { [key: string]: V } | { [key: number]: V };

/** @ignore */
export class MapBuilder<K extends DataType = any, V extends DataType = any, TNull = any> extends VariableWidthBuilder<Map_<K, V>, TNull> {

    declare protected _pending: MapValues<K, V> | undefined;
    public set(index: number, value: MapValueExt<K, V> | TNull) {
        return super.set(index, value as MapValue<K, V> | TNull);
    }

    public setValue(index: number, value: MapValueExt<K, V>) {
        const row = (value instanceof Map ? value : new Map(Object.entries(value))) as MapValue<K, V>;
        const pending = this._pending || (this._pending = new Map() as MapValues<K, V>);
        const current = pending.get(index) as Map<K, V> | undefined;
        current && (this._pendingLength -= current.size);
        this._pendingLength += row.size;
        pending.set(index, row);
    }

    public addChild(child: Builder<Struct<{ key: K; value: V }>>, name = `${this.numChildren}`) {
        if (this.numChildren > 0) {
            throw new Error('ListBuilder can only have one child.');
        }
        this.children[this.numChildren] = child;
        this.type = new Map_<K, V>(new Field(name, child.type, true), this.type.keysSorted);
        return this.numChildren - 1;
    }

    protected _flushPending(pending: MapValues<K, V>) {
        const offsets = this._offsets;
        const [child] = this.children;
        for (const [index, value] of pending) {
            if (value === undefined) {
                offsets.set(index, 0);
            } else {
                let {
                    [index]: idx,
                    [index + 1]: end
                } = offsets.set(index, value.size).buffer;
                for (const val of value.entries()) {
                    child.set(idx, val);
                    if (++idx >= end) break;
                }
            }
        }
    }
}


text:
export default class BaseHandler {
  options = {}

  context = null

  isDragging = false

  constructor (options, context, vnode) {
    this.setOptions(options)
    this.context = context
    this.vnode = vnode
  }

  ready () {}

  start () {
    this.isDragging = true
  }

  drag () {
    throw new Error('`drag` method must be implemented.')
  }

  end () {
    this.isDragging = false
  }

  destroy () {
    throw new Error('`destroy` method must be implemented.')
  }

  setOptions (options) {
    if (this.isDragging) {
      throw new Error('Do not set `options` while dragging.')
    }
    this.options = options
  }

  reset () {
    throw new Error('`reset` method must be implemented.')
  }
}


text:
.class public Lcom/xiaomi/infra/galaxy/common/model/RowKey;
.super Ljava/lang/Object;

# static fields
.field public static final BEGIN_USER_ID:Ljava/lang/String; = ""

.field public static final END_USER_ID:Ljava/lang/String; = ""

# instance fields
.field private key:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/xiaomi/infra/galaxy/common/model/AttributeValue;",
            ">;"
        }
    .end annotation
.end field

.field private userId:Ljava/lang/String;

# direct methods
.method public constructor <init>()V
    .locals 1

    const/4 v0, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    iput-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    return-void
.end method

.method public static getBeginRowKey()Lcom/xiaomi/infra/galaxy/common/model/RowKey;
    .locals 2

    new-instance v0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;

    invoke-direct {v0}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;-><init>()V

    const-string v1, ""

    invoke-virtual {v0, v1}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->withUserId(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/RowKey;

    return-object v0
.end method

.method public static getEndRowKey()Lcom/xiaomi/infra/galaxy/common/model/RowKey;
    .locals 2

    new-instance v0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;

    invoke-direct {v0}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;-><init>()V

    const-string v1, ""

    invoke-virtual {v0, v1}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->withUserId(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/RowKey;

    return-object v0
.end method

# virtual methods
.method public addKey(Ljava/lang/String;Ljava/lang/Object;)Lcom/xiaomi/infra/galaxy/common/model/RowKey;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    if-nez v0, :cond_0

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    :cond_0
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    invoke-static {v0, p1, p2}, Lcom/xiaomi/infra/galaxy/common/model/AttributeValue;->putAttributeValueInMap(Ljava/util/Map;Ljava/lang/String;Ljava/lang/Object;)V

    return-object p0
.end method

.method public equals(Ljava/lang/Object;)Z
    .locals 4

    const/4 v0, 0x1

    const/4 v1, 0x0

    if-ne p0, p1, :cond_1

    :cond_0
    :goto_0
    return v0

    :cond_1
    if-nez p1, :cond_2

    move v0, v1

    goto :goto_0

    :cond_2
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v2

    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v3

    if-eq v2, v3, :cond_3

    move v0, v1

    goto :goto_0

    :cond_3
    check-cast p1, Lcom/xiaomi/infra/galaxy/common/model/RowKey;

    iget-object v2, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    if-nez v2, :cond_4

    iget-object v2, p1, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    if-eqz v2, :cond_5

    move v0, v1

    goto :goto_0

    :cond_4
    iget-object v2, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    iget-object v3, p1, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    invoke-virtual {v2, v3}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_5

    move v0, v1

    goto :goto_0

    :cond_5
    iget-object v2, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    if-nez v2, :cond_6

    iget-object v2, p1, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    if-eqz v2, :cond_0

    move v0, v1

    goto :goto_0

    :cond_6
    iget-object v2, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    iget-object v3, p1, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_0

    move v0, v1

    goto :goto_0
.end method

.method public getKey()Ljava/util/Map;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/xiaomi/infra/galaxy/common/model/AttributeValue;",
            ">;"
        }
    .end annotation

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    return-object v0
.end method

.method public getUserId()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    return-object v0
.end method

.method public hashCode()I
    .locals 3

    const/4 v1, 0x0

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    if-nez v0, :cond_0

    move v0, v1

    :goto_0
    add-int/lit8 v0, v0, 0x1f

    mul-int/lit8 v0, v0, 0x1f

    iget-object v2, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    if-nez v2, :cond_1

    :goto_1
    add-int/2addr v0, v1

    return v0

    :cond_0
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    invoke-virtual {v0}, Ljava/lang/Object;->hashCode()I

    move-result v0

    goto :goto_0

    :cond_1
    iget-object v1, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->hashCode()I

    move-result v1

    goto :goto_1
.end method

.method public setKey(Ljava/util/Map;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/xiaomi/infra/galaxy/common/model/AttributeValue;",
            ">;)V"
        }
    .end annotation

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->key:Ljava/util/Map;

    return-void
.end method

.method public setUserId(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->userId:Ljava/lang/String;

    return-void
.end method

.method public withKey(Ljava/util/Map;)Lcom/xiaomi/infra/galaxy/common/model/RowKey;
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/xiaomi/infra/galaxy/common/model/AttributeValue;",
            ">;)",
            "Lcom/xiaomi/infra/galaxy/common/model/RowKey;"
        }
    .end annotation

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->setKey(Ljava/util/Map;)V

    return-object p0
.end method

.method public withUserId(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/RowKey;
    .locals 0

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/RowKey;->setUserId(Ljava/lang/String;)V

    return-object p0
.end method


text:
Now that we've accomplished two rounds of DevSecOps and improved our skills significantly, it's time to build something that helps solve a problem.

## OBJECTIVES
- Define a Problem to solve
- Build a Plan of Action (Craws/Walk/Run)

## ASSIGNMENTS
- [Required] Pick a pain-point/problem you faced in DevSecOps Bootcamp and solve it. For example:
  - A command-line tool to further automate cloud deployments.

This assignment is required for Week 9.

Each participant must present a 3-5 minute recorded demo briefly describing the problem, the solution, how the solution works, and any potential iterative improvements to the solution.


text:
#region License

#endregion

using System;
using System.Collections.Specialized;
using System.Security.Principal;

namespace WebSocketSharp.Net
{
  /// <summary>
  /// Holds the user name and other parameters from the HTTP Digest authentication credentials.
  /// </summary>
  public class HttpDigestIdentity : GenericIdentity
  {
    #region Private Fields

    private NameValueCollection _parameters;

    #endregion

    #region Internal Constructors

    internal HttpDigestIdentity (NameValueCollection parameters)
      : base (parameters ["username"], "Digest")
    {
      _parameters = parameters;
    }

    #endregion

    #region Public Properties

    /// <summary>
    /// Gets the algorithm parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the algorithm parameter.
    /// </value>
    public string Algorithm {
      get {
        return _parameters ["algorithm"];
      }
    }

    /// <summary>
    /// Gets the cnonce parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the cnonce parameter.
    /// </value>
    public string Cnonce {
      get {
        return _parameters ["cnonce"];
      }
    }

    /// <summary>
    /// Gets the nc parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the nc parameter.
    /// </value>
    public string Nc {
      get {
        return _parameters ["nc"];
      }
    }

    /// <summary>
    /// Gets the nonce parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the nonce parameter.
    /// </value>
    public string Nonce {
      get {
        return _parameters ["nonce"];
      }
    }

    /// <summary>
    /// Gets the opaque parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the opaque parameter.
    /// </value>
    public string Opaque {
      get {
        return _parameters ["opaque"];
      }
    }

    /// <summary>
    /// Gets the qop parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the qop parameter.
    /// </value>
    public string Qop {
      get {
        return _parameters ["qop"];
      }
    }

    /// <summary>
    /// Gets the realm parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the realm parameter.
    /// </value>
    public string Realm {
      get {
        return _parameters ["realm"];
      }
    }

    /// <summary>
    /// Gets the response parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the response parameter.
    /// </value>
    public string Response {
      get {
        return _parameters ["response"];
      }
    }

    /// <summary>
    /// Gets the uri parameter from the HTTP Digest authentication credentials.
    /// </summary>
    /// <value>
    /// A <see cref="string"/> that represents the uri parameter.
    /// </value>
    public string Uri {
      get {
        return _parameters ["uri"];
      }
    }

    #endregion

    #region Internal Methods

    internal bool IsValid (string password, string realm, string method, string entity)
    {
      var parameters = new NameValueCollection (_parameters);
      parameters ["password"] = password;
      parameters ["realm"] = realm;
      parameters ["method"] = method;
      parameters ["entity"] = entity;

      return _parameters ["response"] == AuthenticationResponse.CreateRequestDigest (parameters);
    }

    #endregion
  }
}


text:
To create a tag locally and remotely:

```
git tag <someTag>
git push --tags <theRemoteYouWantToBeTagged>
```

To delete a tag locally and remotely:

```
git tag --delete <someTag>
git push --delete <theRemoteYouWantToBeTagged> <someTag>
```


text:
function LeafletField(options) {
    var id = options.id;
    var self = this;

    this.defaultLocation = {
        lat: parseFloat(options.defaultLocation.lat),
        lng: parseFloat(options.defaultLocation.lng),
    };

    this.translations = options.translations;
    this.mal = null;
    this.mapEl = $("#" + id + "_map");
    this.zoom = options.zoom;
    this.srid = options.srid;
    this.sourceField = $("#" + id);
    this.addressField = $(options.addressSelector);
    this.zoomField = $(options.zoomSelector);
    this.latLngField = $("#" + id + "_latlng");
    this.tileLayer = options.tileLayer;
    this.tileLayerOptions = options.tileLayerOptions;

    if (this.zoomField && this.zoomField.val()) {
        this.zoom = parseInt(this.zoomField.val());
    }

    if (this.zoomField && !this.zoomField.val()) {
        this.updateZoomLevel(this.zoom);
    }

    if (options.showEmptyLocation) {
        this.addressField.attr("placeholder", this.translations.enter_location);
        this.latLngField.attr("placeholder", this.translations.initialize_map);

        this.mapEl.css("display", "none");

        this.latLngField.on("focus", function () {
            self.mapEl.css("display", "block");
            self.setup();
        });
        this.addressField.on("focus", function () {
            self.mapEl.css("display", "block");
            self.setup();
        });
    } else {
        this.setup();
    }

    this.setup();
}

LeafletField.prototype.setup = function () {
    if (this.hasSetup) {
        return;
    }

    var self = this;

    this.initMap(this.mapEl, this.defaultLocation);
    this.initEvents();
    this.setMapPosition(this.defaultLocation);
    this.updateLatLng(this.defaultLocation);

    this.checkVisibility(function () {
        var coords = self.latLngField.val();
        var latLng = self.parseStrToLatLng(coords);

        self.map.invalidateSize();
        self.updateMapFromCoords(latLng);
    });

    this.hasSetup = true;
};

LeafletField.prototype.initMap = function (mapEl, defaultLocation) {
    var map = L.map(mapEl[0]).setView(defaultLocation, this.zoom);

    L.tileLayer(
        this.tileLayer,
        Object.assign(
            {},
            {
                maxZoom: 19,
            },
            this.tileLayerOptions
        )
    ).addTo(map);

    let marker = L.marker(defaultLocation, { draggable: true }).addTo(map);

    this.map = map;
    this.marker = marker;
};

LeafletField.prototype.initEvents = function () {
    var self = this;

    self.marker.on("dragend", function (event) {
        var latLng = event.target.getLatLng();

        self.setMapPosition(latLng);
        self.updateLatLng(latLng);
        self.writeLocation(latLng);
    });

    self.map.on("zoomend", function (_e) {
        var zoomLevel = self.map.getZoom();
        self.updateZoomLevel(zoomLevel);
    });

    this.latLngField.on("keydown", function (e) {
        if (e.keyCode === 13) {
            e.preventDefault();
            e.stopPropagation();
        }
    });

    this.latLngField.on("input", function (_e) {
        var coords = $(this).val();
        var latLng = self.parseStrToLatLng(coords);

        if (latLng === null) {
            self.displayWarning(
                self.translations.error_message_invalid_location,
                {
                    field: self.latLngField,
                }
            );
            return;
        }

        self.clearFieldMessage({ field: self.latLngField });
        self.updateMapFromCoords(latLng);
        self.writeLocation(latLng);
    });

    this.zoomField.on("keydown", function (e) {
        if (e.keyCode !== 13) {
            // enter (13)
            return;
        }

        e.preventDefault();
        e.stopPropagation();

        var zoom = $(this).val();
        zoom = parseInt(zoom);
        if (isNaN(zoom)) {
            zoom = self.defaultZoom;
        }

        self.map.setZoom(zoom);
        self.updateZoomLevel(zoom);
    });

    this.addressField.on("searchGeocoded", function (_e, latLng) {
        self.setMapPosition(latLng);
        self.updateLatLng(latLng);
        self.writeLocation(latLng);
    });
};

LeafletField.prototype.displayWarning = function (msg, options) {
    var warningMsg;
    var field = options.field;
    var className = this.genMessageId(field);

    this.clearFieldMessage({ field: field });

    warningMsg = document.createElement("p");
    warningMsg.className = "help-block help-warning " + className;
    warningMsg.innerHTML = msg;

    $(warningMsg).insertAfter(field);
};

LeafletField.prototype.clearFieldMessage = function (options) {
    var field = options.field;

    if (!field) {
        return;
    }

    var className = this.genMessageId(field);
    $("." + className).remove();
};

LeafletField.prototype.genMessageId = function (field) {
    return "wagtailgeowdidget__" + field.attr("id") + "--warning";
};

LeafletField.prototype.updateLatLng = function (latLng) {
    this.latLngField.val(latLng.lat + "," + latLng.lng);
};

LeafletField.prototype.updateZoomLevel = function (zoomLevel) {
    this.zoomField.val(zoomLevel);
};

LeafletField.prototype.parseStrToLatLng = function (value) {
    value = value.split(",").map(function (value) {
        return parseFloat(value);
    });

    var latLng;
    try {
        latLng = L.latLng(value[0], value[1]);
    } catch {
        return null;
    }

    if (isNaN(latLng.lat) || isNaN(latLng.lng)) {
        return null;
    }
    return latLng;
};

LeafletField.prototype.updateMapFromCoords = function (latLng) {
    this.setMapPosition(latLng);
};

LeafletField.prototype.setMapPosition = function (latLng) {
    this.marker.setLatLng(latLng);
    this.map.panTo(latLng);
};

LeafletField.prototype.writeLocation = function (latLng) {
    var lat = latLng.lat;
    var lng = latLng.lng;
    var value = LeafletField.buildLocationString(this.srid, lng, lat);

    this.setState(value);
};

LeafletField.buildLocationString = function (srid, lng, lat) {
    return "SRID=" + srid + ";POINT(" + lng + " " + lat + ")";
};

// Duplicate of GeoField.locationStringToStruct
LeafletField.locationStringToStruct = function (locationString) {
    if (!locationString) {
        return {};
    }

    var matches = locationString.match(
        /^SRID=([0-9]{1,});POINT\s?\((-?[0-9\.]{1,})\s(-?[0-9\.]{1,})\)$/
    );

    return {
        srid: matches[1],
        defaultLocation: {
            lng: matches[2],
            lat: matches[3],
        },
    };
};

LeafletField.prototype.checkVisibility = function (callback) {
    var self = this;
    var intervalId = setInterval(function () {
        var visible = self.mapEl.is(":visible");
        if (!visible) {
            return;
        }

        clearInterval(intervalId);
        callback();
    }, 1000);
};

LeafletField.prototype.setState = function (newState) {
    this.sourceField.val(newState);
};

LeafletField.prototype.getState = function () {
    return this.sourceField.val();
};

LeafletField.prototype.getValue = function () {
    return this.sourceField.val();
};

LeafletField.prototype.focus = function () {
    // TODO: Implement this
};


text:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <title>Finagle</title>

Finagle

      Finagle is an extensible RPC system for the JVM, used to
      construct high-concurrency servers. Finagle implements uniform
      client and server APIs for several protocols, and is designed
      for high performance and concurrency. Most of Finagle's code is
      protocol agnostic, simplifying the implementation of new
      protocols.

      Finagle is written in Scala, but provides both Scala and Java idiomatic
      APIs.

GitHub project

User's guide

Developer's Guide

API documentation

Gitter channel

Google group

Blog

Contributing

    We feel that a welcoming community is important and we ask that you follow Twitter's
    Open Source Code of Conduct
    in all interactions with the community.

    Finagle is actively maintained by Twitter's infrastructure
    team, but we have
    many external contributors as well.

    The master branch represents the most recent published release
    while active development happens on the develop branch.

    Before endeavoring on large
    changes, please discuss them with the
    Google groups
    to receive feedback and suggestions.

    For all patches, please review our
    contributing docs.

Other resources

        Twitter engineering blog post motivating and introducting Finagle

Twitter's Scala School ends with an
      introduction to Finagle, and finally
      an example distributed system.

A talk introducing Finagle, given by Marius at ScalaDays 2011

Slides from another talk explaining
      the role of Finagle in Twitter's distributed systems

A blog post
      explaining Twitter's server stack, in which Finagle plays a central role

Matt Ho's NEScala talk about Finagle

Companion Projects

In no particular order...

Finatra - fast, testable, Scala services built on TwitterServer and Finagle

Finch - a pure functional wrapper around Finagle HTTP built with Shapeless and Cats

Finagle Serial - a Mux-powered, Finagle protocol over Scala's case classes with a serialization library of your choice

Finagle OAuth2 - an OAuth2 server-side provider for Finagle

Unfinagled - a small library for using unfiltered as a Finagle frontend

Finagle Postgres - Postgres protocol support for Finagle

Finagle IRC - an implementation of the IRC protocol on Finagle

WebSockets implementation for Finagle

Fintop - a top-like utility for monitoring Finagle services

Fintrospect - adds an intelligent HTTP routing layer to Finagle. It provides a simple way to implement contracts for both server and client-side HTTP services


text:
package org.springframework.context;

import org.springframework.beans.factory.Aware;
import org.springframework.core.io.ResourceLoader;

/**
 * Interface to be implemented by any object that wishes to be notified of the
 * {@link ResourceLoader} (typically the ApplicationContext) that it runs in.
 * This is an alternative to a full {@link ApplicationContext} dependency via
 * the {@link org.springframework.context.ApplicationContextAware} interface.
 *
 *
Note that {@link org.springframework.core.io.Resource} dependencies can also
 * be exposed as bean properties of type {@code Resource} or {@code Resource[]},
 * populated via Strings with automatic type conversion by the bean factory. This
 * removes the need for implementing any callback interface just for the purpose
 * of accessing specific file resources.
 *
 *
You typically need a {@link ResourceLoader} when your application object has to
 * access a variety of file resources whose names are calculated. A good strategy is
 * to make the object use a {@link org.springframework.core.io.DefaultResourceLoader}
 * but still implement {@code ResourceLoaderAware} to allow for overriding when
 * running in an {@code ApplicationContext}. See
 * {@link org.springframework.context.support.ReloadableResourceBundleMessageSource}
 * for an example.
 *
 *
A passed-in {@code ResourceLoader} can also be checked for the
 * {@link org.springframework.core.io.support.ResourcePatternResolver} interface
 * and cast accordingly, in order to resolve resource patterns into arrays of
 * {@code Resource} objects. This will always work when running in an ApplicationContext
 * (since the context interface extends the ResourcePatternResolver interface). Use a
 * {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver} as
 * default; see also the {@code ResourcePatternUtils.getResourcePatternResolver} method.
 *
 *
As an alternative to a {@code ResourcePatternResolver} dependency, consider
 * exposing bean properties of type {@code Resource[]} array, populated via pattern
 * Strings with automatic type conversion by the bean factory at binding time.
 *
 * @author Juergen Hoeller
 * @author Chris Beams
 * @since 10.03.2004
 * @see ApplicationContextAware
 * @see org.springframework.core.io.Resource
 * @see org.springframework.core.io.ResourceLoader
 * @see org.springframework.core.io.support.ResourcePatternResolver
 */
public interface ResourceLoaderAware extends Aware {

	/**
	 * Set the ResourceLoader that this object runs in.
	 *
This might be a ResourcePatternResolver, which can be checked
	 * through {@code instanceof ResourcePatternResolver}. See also the
	 * {@code ResourcePatternUtils.getResourcePatternResolver} method.
	 *
Invoked after population of normal bean properties but before an init callback
	 * like InitializingBean's {@code afterPropertiesSet} or a custom init-method.
	 * Invoked before ApplicationContextAware's {@code setApplicationContext}.
	 * @param resourceLoader the ResourceLoader object to be used by this object
	 * @see org.springframework.core.io.support.ResourcePatternResolver
	 * @see org.springframework.core.io.support.ResourcePatternUtils#getResourcePatternResolver
	 */
	void setResourceLoader(ResourceLoader resourceLoader);

}


text:
@interface UIColor (ChameleonPrivate)

@property (nonatomic, readwrite) NSUInteger count;

#pragma mark - Class Methods

+ (UIColor *)colorFromImage:(UIImage *)image atPoint:(CGPoint)point;

- (UIColor *)colorWithMinimumSaturation:(CGFloat)saturation;

#pragma mark - Instance Methods

- (BOOL)isDistinct:(UIColor *)color;

- (BOOL)getValueForX:(CGFloat *)X
           valueForY:(CGFloat *)Y
           valueForZ:(CGFloat *)Z
               alpha:(CGFloat *)alpha;

- (BOOL)getLightness:(CGFloat *)L
           valueForA:(CGFloat *)A
           valueForB:(CGFloat *)B
               alpha:(CGFloat *)alpha;

@end


text:
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from django.template.defaultfilters import slugify, linebreaks, date, truncatechars

from wagtail.core.models import Page
from wagtail.core.rich_text import RichText

from migration.models import *
from accounts.models import CompsocUser, ShellAccount, DatabaseAccount
from blog.models import BlogPage
from events.models import EventSignup, EventPage, EventType

import time

COMMS_DICT = {
    'NL': 'Newsletter',
    'M': 'Meeting Minutes',
    'N': 'News Item'
}

def migrate_compsoc_memberinfo():
    """
    Amalgamates the old user detail objects into the new CompsocUser and other models
    """
    websites = WebsiteDetails.objects.using('old_data').all()
    nicks = NicknameDetails.objects.using('old_data').all()
    shell_accounts = OldShellAccount.objects.using('old_data').all()
    db_accounts = OldDatabaseAccount.objects.using('old_data').all()
    userinfo = {}

    # Handle shell accounts
    for account in shell_accounts:
        user = get_user_model().objects.filter(id=account.user_id).first()
        new_account = ShellAccount(name=account.name, user=user, status=account.status)
        new_account.save()

    # Handle DB accounts
    for account in db_accounts:
        user = get_user_model().objects.filter(id=account.user_id).first()
        new_account = DatabaseAccount(name=account.name, user=user, status=account.status)
        new_account.save()

    # Handle transfer of Nickname info to CompsocUser model
    for nick in nicks:
        user_id = nick.user_id

        userinfo[user_id] = {
            'nickname': nick.nickname,
            'website_title': '',
            'website_url': ''
        }

    # Handle transfer of Website info to CompsocUser model
    for site in websites:
        user_id = site.user_id

        if user_id in userinfo:
            userinfo[user_id]['website_title'] = site.websiteTitle
            userinfo[user_id]['website_url'] = site.websiteUrl
        else:
            userinfo[user_id] = {
                'nickname': '',
                'website_title': site.websiteTitle,
                'website_url': site.websiteUrl
            }

    # Save new CompsocUser info
    for uid, details in userinfo.items():
        user = get_user_model().objects.filter(id=uid).first()
        new_userinfo = CompsocUser(nickname=details['nickname'], website_title=details['website_title'],
                                   website_url=details['website_url'], user=user)

        print('Restoring {user}'.format(user=new_userinfo))

        new_userinfo.save()

def migrate_old_posts():
    """
    Converts all old posts from a simple page format to one Wagtail accepts
    """
    # id=4 is the specific page ID for the news index page
    index = Page.objects.get(id=4).specific
    old_posts = Communication.objects.using('old_data').all().order_by('date')
    user = get_user_model().objects.get(id=1)

    for post in old_posts:
        if post.title:
            title = post.title
        else:
            title = 'Archived item from {date}'.format(date=date(post.date, 'D jS F Y'))

        slug = slugify('{title} - {rand}'.format(title=title, rand=int(round(time.time() * 1000))))

        if len(post.text) > 512:
            intro = post.text[:512] + '...'
        else:
            intro = post.text

        page = BlogPage(
            search_description='',
            seo_title=title,
            show_in_menus=False,
            slug=slug,
            title=title,
            date=post.date,
            first_published_at=post.date,
            intro=linebreaks(intro),
        )

        page.body.stream_data = [
            ('paragraph', RichText('
{body}
'.format(body=linebreaks(post.text))))
        ]

        page.tags.add(COMMS_DICT[post.type])

        print('Restoring article from {date}'.format(date=post.date))

        index.add_child(instance=page)
        revision = page.save_revision(
            user=user,
            submitted_for_moderation=False
        )
        revision.publish()
        page.save()

def migrate_events():
    event_index = Page.objects.get(id=6).specific
    user = get_user_model().objects.get(id=1)
    old_events = OldEvent.objects.using('old_data').all()

    # Migrate events
    for old_event in old_events:
        old_event_type = old_event.type

        try:
            # We don't actually care about this - its a test to migrate the event across
            event_type = EventType.objects.get(name=old_event_type.name, target=old_event_type.target)
        except EventType.DoesNotExist:
            event_type = EventType(name=old_event_type.name, target=old_event_type.target)
            event_type.save()

        title = '{type} on {date}'.format(type=old_event_type.name, date=date(old_event.start, 'D jS F Y'))
        slug = slugify('{title} - {rand}'.format(title=title, rand=int(round(time.time() * 1000))))

        if old_event.shortDescription:
            description = old_event.shortDescription
        else:
            if old_event_type.info:
                description = old_event_type.info
            else:
                description = old_event_type.name

        new_event = EventPage(
            title=title.strip(),
            slug=slug,
            description=description.strip(),
            start=old_event.start,
            finish=old_event.finish,
            cancelled=old_event.cancelled,
            category=event_type,
            location=old_event.location.name
        )

        new_event.body.stream_data = [
            ('paragraph', RichText('
{body}
'.format(body=linebreaks(old_event.longDescription))))
        ]

        print('Restoring event {type} from {date}'.format(type=old_event.type.name, date=old_event.start))

        event_index.add_child(instance=new_event)
        revision = new_event.save_revision(
            user=user,
            submitted_for_moderation=False
        )
        revision.publish()
        new_event.save()

        # Deal with signups
        old_signups = Signup.objects.using('old_data').filter(event_id=old_event.id)

        for old_signup in old_signups:
            print('Restoring signup for {type} from {date}'.format(type=old_event.type.name, date=old_event.start))
            new_signup = EventSignup(comment=truncatechars(old_signup.comment, 1024),
                                     member=get_user_model().objects.get(id=old_signup.user_id),
                                     event_id=new_event.id, signup_created=old_signup.time)
            new_signup.save()

class Command(BaseCommand):
    def handle(self, *args, **options):
        migrate_compsoc_memberinfo()
        migrate_old_posts()
        migrate_events()


text:
package xyz.jmullin.drifter.assets

import com.badlogic.gdx.assets.AssetManager
import com.badlogic.gdx.audio.{Music, Sound}
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.{BitmapFont, Sprite, TextureAtlas}
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.badlogic.gdx.utils.reflect.{ClassReflection, Field}
import xyz.jmullin.drifter.animation.Animation

/**
 * Used for loading and storing an assets library.
 *
 * '''To use:'''
 *
 * Create a class or object which extends from DrifterAssets, and define one field per asset to load.
 * Assets will be loaded from the classpath based on field type, using the class mapping defined in
 * DrifterAssets.PrefixMap to determine the relative path and file extension to load from.  File names
 * must match the field name specified except in the case of Animation, which takes a suffix indicating the
 * number of frames to load and looks for all files named with that pattern from 1 to N.
 *
 * Call load() to begin loading assets.  To perform inline loading, consult the manager member (see [[AssetManager]] for
 * more information), otherwise simply call finishLoading() to force the application to block until load is complete.
 *
 * After load is completed, call populate() to dump the loaded assets into their respective fields.  After this
 * point these fields can be used to reference assets.
 *
 * @param atlasName Optional filename of the TextureAtlas to load sprites from.
 */
class DrifterAssets(atlasName: Option[String] = None) {
  import xyz.jmullin.drifter.assets.DrifterAssets._

  val manager = new AssetManager

  var primaryAtlas: Option[TextureAtlas] = None
  val atlasPath = atlasName.map(name => s"atlas/$name.atlas")

  /**
   * Retrieves a list of fields from ''this''.
   */
  def fields = {
    ClassReflection.getDeclaredFields(this.getClass)
  }

  /**
   * Triggers loading of all assets defined in ''this''.
   */
  def load() {
    atlasPath.foreach { path =>
      manager.load(path, classOf[TextureAtlas])
    }

    for(field <- fields) {
      if(PrefixMap.contains(field.getType)) {
        manager.load(getAssetPath(field), field.getType)
      }
    }
  }

  /**
   * Forces the asset manager to complete load of any in-process assets.
   */
  def finishLoading() {
    manager.finishLoading()
  }

  /**
   * Populates the fields of ''this'' with the loaded assets.
   */
  def populate() {
    primaryAtlas = atlasPath.map { path =>
      manager.get(path, classOf[TextureAtlas])
    }

    for(field <- fields) {
      if(PrefixMap.contains(field.getType)) {
        val path = getAssetPath(field)

        field.setAccessible(true)
        field.set(this, manager.get(path, field.getType))
      }
    }

    for(field <- fields) {
      if(field.getType == classOf[Sprite]) {
        if(primaryAtlas.isEmpty) {
          throw new RuntimeException(f"No texture atlas loaded to pull sprite '${field.getName}' from.  At least one TextureAtlas is required to load Sprites.")
        }

        field.setAccessible(true)
        field.set(this, primaryAtlas.get.createSprite(field.getName))
      }
      if(field.getType == classOf[Animation]) {
        val pattern = """([a-zA-Z]+)(\d+)""".r

        field.getName match {
          case pattern(baseName, frames) =>
            var sprites = Vector[Sprite]()

            for(i <- 1 to frames.toInt) {
              sprites :+= primaryAtlas.get.createSprite(baseName, i)
            }

            field.setAccessible(true)
            field.set(this, new Animation(sprites))
        }
      }
    }
  }

  def getAssetPath(field: Field) = {
    PrefixMap(field.getType).pathPrefix + field.getName + PrefixMap(field.getType).fileSuffix
  }

  def getAssetPath(t: Class[_], n: String) = {
    PrefixMap(t).pathPrefix + n + PrefixMap(t).fileSuffix
  }

  def dispose() {
    primaryAtlas.foreach(_.dispose)
  }
}

object DrifterAssets {
  // These placeholders can be used to simplify the task of specifying types in an Assets object.
  // NOTE: These return null, and should only be used in the context of an Assets object which has yet
  // to be auto-populated!
  def texture: Texture = null
  def font: BitmapFont = null
  def sound: Sound = null
  def music: Music = null
  def skin: Skin = null
  def atlas: TextureAtlas = null
  def sprite: Sprite = null

  /**
   * Map of classes to asset types.  Currently the assumption is a single type of asset will always correspond
   * to a single well-defined path and file extension.
   */
  val PrefixMap = Map[Class[_], AssetType](
    classOf[Texture] -> AssetType("texture/", ".png"),
    classOf[BitmapFont] -> AssetType("font/", ".fnt"),
    classOf[Sound] -> AssetType("sound/", ".wav"),
    classOf[Music] -> AssetType("music/", ".ogg"),
    classOf[Skin] -> AssetType("skin/", ".json"),
    classOf[TextureAtlas] -> AssetType("atlas/", ".atlas")
  )
}


text:
package sample.actuator;

import java.util.Map;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.boot.context.web.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Integration tests for separate management and main service ports.
 *
 * @author Dave Syer
 */
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DirtiesContext
public class ShutdownSampleActuatorApplicationTests {

	@Autowired
	private SecurityProperties security;

	@LocalServerPort
	private int port;

	@Test
	public void testHome() throws Exception {
		@SuppressWarnings("rawtypes")
		ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
				.getForEntity("http://localhost:" + this.port, Map.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
		@SuppressWarnings("unchecked")
		Map<String, Object> body = entity.getBody();
		assertThat(body.get("message")).isEqualTo("Hello Phil");
	}

	@Test
	public void testShutdown() throws Exception {
		@SuppressWarnings("rawtypes")
		ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
				.postForEntity("http://localhost:" + this.port + "/shutdown", null,
						Map.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
		@SuppressWarnings("unchecked")
		Map<String, Object> body = entity.getBody();
		assertThat(((String) body.get("message"))).contains("Shutting down");
	}

	private String getPassword() {
		return this.security.getUser().getPassword();
	}

}


text:
package net.stoerr.devtools.miscjavadevtools.testutils;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.Test;

/**
 * Test for {@link SimpleBeanFiller}.
 * @author Hans-Peter Störr www.stoerr.net
 */
public class TestSimpleBeanFiller {

    @Test
    public void testFillBean() {
        final TestSimpleBean b1 = makeFilledBean(15);
        assertEquals(
                "TestSimpleBean [astring=Astring#15, anint=1102451004, aninteger=630615769, along=4073800890, adate=Mon Dec 25 15:41:24 CET 2000, acalendar=1127621030000, aboolean=true]",
                b1.toString());

        final TestSimpleBean b2 = makeFilledBean(42);
        assertEquals(
                "TestSimpleBean [astring=Astring#42, anint=860283939, aninteger=388448704, along=4273966635, adate=Fri Mar 17 21:44:31 CET 2000, acalendar=1159788095000, aboolean=false]",
                b2.toString());
        assertEquals("net.stoerr.devtools.miscjavadevtools.testutils.TestSimpleBeanFiller$TestSimpleBean[\n"
                + "  astring=Astring#42\n" + "  anint=860283939\n" + "  aninteger=388448704\n" + "  along=4273966635\n"
                + "  adate=Fri Mar 17 21:44:31 CET 2000\n"
                + "  acalendar=java.util.GregorianCalendar[time=1159788095000]\n" + "  aboolean=false\n]",
                SimpleBeanFiller.stringRep(b2));
    }

    private TestSimpleBean makeFilledBean(final int i) {
        final SimpleBeanFiller filler = new SimpleBeanFiller(i);
        final TestSimpleBean bean = new TestSimpleBean();
        filler.fillBean(bean);
        return bean;
    }

    @Test
    public void testGenericFiller() {
        final TestSimpleBean2 bean = new TestSimpleBean2();
        final SimpleBeanFiller filler = new SimpleBeanFiller(42);
        filler.fillBean(bean);

        assertNotNull(bean.getList());
        assertTrue(bean.getList() instanceof ArrayList);
        assertEquals("[List$0#42, List$1#42, List$2#42]", bean.getList().toString());

        assertNotNull(bean.getMap());
        assertTrue(bean.getMap() instanceof HashMap);
        assertEquals("{1337253675=Map$2#42, 514164281=Map$0#42, 1221775182=Map$1#42}", bean.getMap().toString());

        assertNotNull(bean.getSet());
        assertTrue(bean.getSet() instanceof HashSet);
        assertEquals("[A, H, Z]", bean.getSet().toString());
    }

    public static class TestSimpleBean {
        private String astring;
        private int anint;
        private Integer aninteger;
        private Long along;
        private Date adate;
        private GregorianCalendar acalendar;
        private boolean aboolean;

        public String getAstring() {
            return astring;
        }

        public void setAstring(final String astring) {
            this.astring = astring;
        }

        public int getAnint() {
            return anint;
        }

        public void setAnint(final int anint) {
            this.anint = anint;
        }

        public Integer getAninteger() {
            return aninteger;
        }

        public void setAninteger(final Integer aninteger) {
            this.aninteger = aninteger;
        }

        public Long getAlong() {
            return along;
        }

        public void setAlong(final Long along) {
            this.along = along;
        }

        public Date getAdate() {
            return adate;
        }

        public void setAdate(final Date adate) {
            this.adate = adate;
        }

        public GregorianCalendar getAcalendar() {
            return acalendar;
        }

        public void setAcalendar(final GregorianCalendar acalendar) {
            this.acalendar = acalendar;
        }

        public boolean isAboolean() {
            return aboolean;
        }

        public void setAboolean(final boolean aboolean) {
            this.aboolean = aboolean;
        }

        @Override
        public String toString() {
            return "TestSimpleBean [" + (astring != null ? "astring=" + astring + ", " : "") + "anint=" + anint + ", "
                    + (aninteger != null ? "aninteger=" + aninteger + ", " : "")
                    + (along != null ? "along=" + along + ", " : "") + (adate != null ? "adate=" + adate + ", " : "")
                    + (acalendar != null ? "acalendar=" + acalendar.getTimeInMillis() + ", " : "") + "aboolean="
                    + aboolean + "]";
        }

    }

    public static class TestSimpleBean2 {
        private List<String> list;
        private Map<Integer, String> map;
        private Set<Character> set;

        public void setList(final List<String> list) {
            this.list = list;
        }

        public List<String> getList() {
            return list;
        }

        public void setMap(final Map<Integer, String> map) {
            this.map = map;
        }

        public Map<Integer, String> getMap() {
            return map;
        }

        public void setSet(final Set<Character> set) {
            this.set = set;
        }

        public Set<Character> getSet() {
            return set;
        }
    }

}


text:
"use strict";
/* jshint esnext:true, node:true*/

/** `targetPath` is a path likely the specific task
 * May also be the step (close it explicitly and forcefully)
 * and to the process
 * => {processId}/{stepId}/{taskId}
 *
 * as a string:
 * we could go for indexes OR for ids, for a mixture of both, where it
 * makes sense AND for both in all cases which is redundant.
 *
 * indexes make sense for steps, because these are an ordered list
 * ids make sense for tasks, because they are "unordered" at least
 * semantically (there's an explicit order in the `tasks` list of the
 * step that we use)
 *
 * process: {processId}
 * steps: {index}
 * task: {id} OR {index}:{id} ? => redundant, but maybe helps to reduce errors, i.e. when refactoring?
 * callback: {name}
 *
 * having an id and an index for a task, we can create a fingerprint
 * for the step. though, we can also create a fingerprint by merely
 * using ids! just have to sort the ids before to create a canonical order.
 * So, tasks don't have indexes …
 */
function Path(processId, step, task) {
    Object.defineProperties(this, {
        processId: {value: processId, enumerable: true}
      , step: {value: step, enumerable: true}
      , task: {value: task, enumerable: true}
    });
}

const _p = Path.prototype = Object.create(null);

_p.toString = function() {
    return [...this].join('/');
};

_p[Symbol.iterator] = function* () {
    if(!this.processId)
        return;
    yield this.processId;

    if(!this.step)
        return;
    yield this.step;

    if(!this.task)
        return;
    yield this.task;
};

Path.fromString = function(pathString) {
    return new Path(...pathString.split('/'));
};

exports.Path = Path;


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

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="up" title="FatFs" href="../00index_e.html">
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
<title>FatFs - disk_status</title>

disk_status

The disk_status function gets the disk status.

DSTATUS disk_status (
  BYTE Drive     /* Physical drive number */
);

Parameters

Drive

Specifies the physical drive number to be tested.

Return Values

The disk status is returned in combinatin of following flags.

STA_NOINIT

Indicates that the disk drive has not been initialiezed. This flag is set on: power-on, disk removal and disk_initialize function failed, and cleared on: disk_initialize function succeeded.

STA_NODISK

Indicates that no medium in the drive. It is always cleared on fixed disk drive.

STA_PROTECTED

Indicates that the medium is write protected. It is always cleared on the drive that does not support write protect notch.

Return


text:
class Category < ActiveRecord::Base
  has_many :projects
end


text:
<?php

namespace spec\Ice\JobBundle\CompilerPass;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class WorkerProviderPassSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Ice\JobBundle\CompilerPass\WorkerProviderPass');
        $this->shouldImplement('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface');
    }

    function it_should_add_tagged_factories_to_the_director(
        ContainerBuilder $containerBuilder,
        Definition $definition
    )
    {
        $containerBuilder->hasDefinition('ice.worker.director')->willReturn(true);
        $containerBuilder->hasDefinition('ice.worker.director')->shouldBeCalledTimes(1);
        $containerBuilder->getDefinition('ice.worker.director')->shouldBeCalled();
        $containerBuilder->getDefinition('ice.worker.director')->willReturn($definition);

        $containerBuilder->findTaggedServiceIds('ice.worker.provider')->willReturn([
            'foo'=>[],
            'bar'=>[]
        ]);

        $definition->addMethodCall('addWorkerProvider', Argument::that(function ($args) {
            return is_array($args) && count($args) == 1 && $args[0] instanceof Reference && $args[0]->__toString() === 'foo';
        }))->shouldBeCalledTimes(1);

        $definition->addMethodCall('addWorkerProvider', Argument::that(function ($args) {
            return is_array($args) && count($args) == 1 && $args[0] instanceof Reference && $args[0]->__toString() === 'bar';
        }))->shouldBeCalledTimes(1);

        $this->process($containerBuilder);
    }
}


text:
package software.amazon.awssdk.services.jsonprotocoltests.transform;

import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.runtime.transform.Marshaller;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.http.SdkHttpMethod;
import software.amazon.awssdk.protocols.core.OperationInfo;
import software.amazon.awssdk.protocols.core.ProtocolMarshaller;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.services.jsonprotocoltests.model.EventStreamOperationWithOnlyInputRequest;
import software.amazon.awssdk.utils.Validate;

/**
 * {@link EventStreamOperationWithOnlyInputRequest} Marshaller
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
public class EventStreamOperationWithOnlyInputRequestMarshaller implements Marshaller<EventStreamOperationWithOnlyInputRequest> {
    private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder()
            .requestUri("/2016-03-11/EventStreamOperationWithOnlyInput").httpMethod(SdkHttpMethod.POST)
            .hasExplicitPayloadMember(false).hasImplicitPayloadMembers(true).hasPayloadMembers(true).hasEventStreamingInput(true)
            .build();

    private final BaseAwsJsonProtocolFactory protocolFactory;

    public EventStreamOperationWithOnlyInputRequestMarshaller(BaseAwsJsonProtocolFactory protocolFactory) {
        this.protocolFactory = protocolFactory;
    }

    @Override
    public SdkHttpFullRequest marshall(EventStreamOperationWithOnlyInputRequest eventStreamOperationWithOnlyInputRequest) {
        Validate.paramNotNull(eventStreamOperationWithOnlyInputRequest, "eventStreamOperationWithOnlyInputRequest");
        try {
            ProtocolMarshaller<SdkHttpFullRequest> protocolMarshaller = protocolFactory
                    .createProtocolMarshaller(SDK_OPERATION_BINDING);
            return protocolMarshaller.marshall(eventStreamOperationWithOnlyInputRequest);
        } catch (Exception e) {
            throw SdkClientException.builder().message("Unable to marshall request to JSON: " + e.getMessage()).cause(e).build();
        }
    }
}