text:
package eu.smartenit.sbox.ntm.dtm.sender;

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

import eu.smartenit.sbox.db.dao.DC2DCCommunicationDAO;
import eu.smartenit.sbox.db.dto.AS;
import eu.smartenit.sbox.db.dto.CloudDC;
import eu.smartenit.sbox.db.dto.DARouter;
import eu.smartenit.sbox.db.dto.DC2DCCommunication;
import eu.smartenit.sbox.db.dto.DC2DCCommunicationID;
import eu.smartenit.sbox.db.dto.Direction;
import eu.smartenit.sbox.db.dto.EndAddressPairTunnelID;
import eu.smartenit.sbox.db.dto.NetworkAddressIPv4;
import eu.smartenit.sbox.db.dto.SDNController;
import eu.smartenit.sbox.db.dto.Tunnel;

/**
 * Helper class for creation of structures that can be returned by mocked
 * {@link DC2DCCommunicationDAO}.
 *
 * @author Lukasz Lopatowski
 * @version 1.2
 *
 */
class DBStructuresBuilder {

	public static List<DC2DCCommunication> communicationsOnTrafficSender;

	public static String sdnController1Address = "100.1.1.1";
	public static String sdnController2Address = "101.1.1.1";

	public static String remoteCloudDCNetwork11 = "1.1.10.0";
	public static String remoteCloudDCNetwork12 = "1.1.11.0";
	public static String remoteCloudDCNetwork21 = "1.2.10.0";
	public static String remoteCloudDCNetwork31 = "2.1.10.0";
	public static String remoteCloudDCNetwork32 = "2.1.11.0";

	public static String localDARDPID1 = "00:00:00:00:00:00:00:01";
	public static String localDARDPID2 = "00:00:00:00:00:00:00:02";
	public static String localDARDPID3 = "00:00:00:00:00:00:00:03";

	private static String localTEndDAR1 = "100.1.3.1";
	private static String localTEndDAR2 = "100.1.3.2";
	private static String localTEndDAR3 = "101.1.3.1";
	private static String remoteTEndAS11 = "1.1.3.1";
	private static String remoteTEndAS12 = "1.1.4.1";
	private static String remoteTEndAS21 = "2.1.3.1";
	private static String remoteTEndAS22 = "2.1.4.1";

	private static Tunnel tunnel1 = new Tunnel(new EndAddressPairTunnelID("100-1 to 1 (1)", address(localTEndDAR1), address(remoteTEndAS11)), null, null, null, null, 1);
	private static Tunnel tunnel2 = new Tunnel(new EndAddressPairTunnelID("100-1 to 1 (2)", address(localTEndDAR1), address(remoteTEndAS12)), null, null, null, null, 2);
	private static Tunnel tunnel3 = new Tunnel(new EndAddressPairTunnelID("100-1 to 2 (1)", address(localTEndDAR1), address(remoteTEndAS21)), null, null, null, null, 3);
	private static Tunnel tunnel4 = new Tunnel(new EndAddressPairTunnelID("100-1 to 2 (2)", address(localTEndDAR1), address(remoteTEndAS22)), null, null, null, null, 4);
	private static Tunnel tunnel5 = new Tunnel(new EndAddressPairTunnelID("100-2 to 1 (1)", address(localTEndDAR2), address(remoteTEndAS11)), null, null, null, null, 1);
	private static Tunnel tunnel6 = new Tunnel(new EndAddressPairTunnelID("100-2 to 1 (2)", address(localTEndDAR2), address(remoteTEndAS12)), null, null, null, null, 2);
	private static Tunnel tunnel7 = new Tunnel(new EndAddressPairTunnelID("100-2 to 2 (1)", address(localTEndDAR2), address(remoteTEndAS21)), null, null, null, null, 3);
	private static Tunnel tunnel8 = new Tunnel(new EndAddressPairTunnelID("100-2 to 2 (2)", address(localTEndDAR2), address(remoteTEndAS22)), null, null, null, null, 4);
	private static Tunnel tunnel9 = new Tunnel(new EndAddressPairTunnelID("101-1 to 2 (1)", address(localTEndDAR3), address(remoteTEndAS21)), null, null, null, null, 1);
	private static Tunnel tunnel10 = new Tunnel(new EndAddressPairTunnelID("101-1 to 2 (2)", address(localTEndDAR3), address(remoteTEndAS22)), null, null, null, null, 2);

	static {
		AS remoteAS1 = new AS();
		remoteAS1.setAsNumber(1);
		remoteAS1.setLocal(false);
		CloudDC remoteCloud1 = new CloudDC("remoteCloud1", remoteAS1, null, null, Arrays.asList(new NetworkAddressIPv4(remoteCloudDCNetwork11, 28), new NetworkAddressIPv4(remoteCloudDCNetwork12, 28)));
		CloudDC remoteCloud2 = new CloudDC("remoteCloud2", remoteAS1, null, null, Arrays.asList(new NetworkAddressIPv4(remoteCloudDCNetwork21, 28)));

		AS remoteAS2 = new AS();
		remoteAS2.setAsNumber(2);
		remoteAS2.setLocal(false);
		CloudDC remoteCloud3 = new CloudDC("remoteCloud3", remoteAS2, null, null, Arrays.asList(new NetworkAddressIPv4(remoteCloudDCNetwork31, 28), new NetworkAddressIPv4(remoteCloudDCNetwork32, 28)));

		AS localAS100 = new AS();
		localAS100.setAsNumber(100);
		localAS100.setLocal(true);
		SDNController controller1 = new SDNController(new NetworkAddressIPv4(sdnController1Address, 32), null, new NetworkAddressIPv4(sdnController1Address, 32), 30, null, 40);
		DARouter daRouter1 = new DARouter(new NetworkAddressIPv4("100.1.2.1", 32), "testCommunity", localDARDPID1);
		DARouter daRouter2 = new DARouter(new NetworkAddressIPv4("100.1.2.2", 32), "testCommunity", localDARDPID2);
		controller1.setDaRouters(Arrays.asList(daRouter1, daRouter2));
		CloudDC localCloud1 = new CloudDC("localCloud1", localAS100, daRouter1, controller1, null);
		CloudDC localCloud2 = new CloudDC("localCloud2", localAS100, daRouter2, controller1, null);
		CloudDC localCloud3 = new CloudDC("localCloud3", localAS100, daRouter2, controller1, null);

		AS localAS101 = new AS();
		localAS101.setAsNumber(101);
		localAS101.setLocal(true);
		SDNController controller2 = new SDNController(new NetworkAddressIPv4(sdnController2Address, 32), null, new NetworkAddressIPv4(sdnController2Address, 32), 50, null, 60);
		DARouter daRouter3 = new DARouter(new NetworkAddressIPv4("101.1.2.1", 32), "testCommunity", localDARDPID3);
		daRouter3.setLocalDCOfSwitchPortNumbers(Arrays.asList(10, 11));
		controller2.setDaRouters(Arrays.asList(daRouter3));
		CloudDC localCloud4 = new CloudDC("localCloud4", localAS101, daRouter3, controller2, null);

		DC2DCCommunicationID id1 = new DC2DCCommunicationID(1, "localCloud1-remoteCloud1", 100, "localCloud1", 1, "remoteCloud1");
		List<Tunnel> tunnels1 = new ArrayList<>(Arrays.asList(tunnel1, tunnel2));
		DC2DCCommunication communication1 = new DC2DCCommunication(id1, Direction.outcomingTraffic, remoteCloud1, localCloud1, null, tunnels1);

		DC2DCCommunicationID id2 = new DC2DCCommunicationID(2, "localCloud1-remoteCloud3", 100, "localCloud1", 2, "remoteCloud3");
		List<Tunnel> tunnels2 = new ArrayList<>(Arrays.asList(tunnel3, tunnel4));
		DC2DCCommunication communication2 = new DC2DCCommunication(id2, Direction.outcomingTraffic, remoteCloud3, localCloud1, null, tunnels2);

		DC2DCCommunicationID id3 = new DC2DCCommunicationID(3, "localCloud2-remoteCloud3", 100, "localCloud2", 2, "remoteCloud3");
		List<Tunnel> tunnels3 = new ArrayList<>(Arrays.asList(tunnel7, tunnel8));
		DC2DCCommunication communication3 = new DC2DCCommunication(id3, Direction.outcomingTraffic, remoteCloud3, localCloud2, null, tunnels3);

		DC2DCCommunicationID id4 = new DC2DCCommunicationID(4, "localCloud3-remoteCloud1", 100, "localCloud3", 1, "remoteCloud1");
		List<Tunnel> tunnels4 = new ArrayList<>(Arrays.asList(tunnel5, tunnel6));
		DC2DCCommunication communication4 = new DC2DCCommunication(id4, Direction.outcomingTraffic, remoteCloud1, localCloud3, null, tunnels4);

		DC2DCCommunicationID id5 = new DC2DCCommunicationID(5, "localCloud3-remoteCloud2", 100, "localCloud3", 1, "remoteCloud2");
		List<Tunnel> tunnels5 = new ArrayList<>(Arrays.asList(tunnel5, tunnel6));
		DC2DCCommunication communication5 = new DC2DCCommunication(id5, Direction.outcomingTraffic, remoteCloud2, localCloud3, null, tunnels5);

		DC2DCCommunicationID id6 = new DC2DCCommunicationID(6, "localCloud3-remoteCloud3", 100, "localCloud3", 2, "remoteCloud3");
		List<Tunnel> tunnels6 = new ArrayList<>(Arrays.asList(tunnel7, tunnel8));
		DC2DCCommunication communication6 = new DC2DCCommunication(id6, Direction.outcomingTraffic, remoteCloud3, localCloud3, null, tunnels6);

		DC2DCCommunicationID id7 = new DC2DCCommunicationID(7, "localCloud4-remoteCloud3", 101, "localCloud4", 2, "remoteCloud3");
		List<Tunnel> tunnels7 = new ArrayList<>(Arrays.asList(tunnel9, tunnel10));
		DC2DCCommunication communication7 = new DC2DCCommunication(id7, Direction.outcomingTraffic, remoteCloud3, localCloud4, null, tunnels7);

		DC2DCCommunicationID id11 = new DC2DCCommunicationID(11, "remoteCloud3-localCloud4", 2, "remoteCloud3", 101, "localCloud4");
		DC2DCCommunication communication11 = new DC2DCCommunication(id11, Direction.incomingTraffic, remoteCloud3, localCloud4, null, null);

		DC2DCCommunicationID id12 = new DC2DCCommunicationID(12, "remoteCloud1-localCloud2", 1, "remoteCloud1", 100, "localCloud2");
		DC2DCCommunication communication12 = new DC2DCCommunication(id12, Direction.incomingTraffic, remoteCloud1, localCloud2, null, null);

		communicationsOnTrafficSender = new ArrayList<DC2DCCommunication>(
				Arrays.asList(communication1, communication2, communication3, communication4, communication5, communication6, communication7,
						communication11, communication12));
	}

	private static NetworkAddressIPv4 address(String address) {
		return new NetworkAddressIPv4(address, 32);
	}

}


text:
class WebLinks:
    def __init__(self):
        self.nist_url = "https://www.nist.gov/ncnr"
        self.umd_url = "https://www.umd.edu/"
        self.sns_url = "https://neutrons.ornl.gov/"
        self.nsf_url = "https://www.nsf.gov"
        self.isis_url = "https://www.isis.stfc.ac.uk/"
        self.ess_url = "https://europeanspallationsource.se/"
        self.ill_url = "https://www.ill.eu/"
        self.ansto_url = "https://www.ansto.gov.au/"
        self.bam_url = "https://www.bam.de/"
        self.delft_url = \
            "https://www.tudelft.nl/en/faculty-of-applied-sciences/business/facilities/reactor-institute-delft"
        self.inst_url = "https://www.utk.edu"
        self.diamond_url = "http://www.diamond.ac.uk"

        self.homepage_url = "https://www.sasview.org"
        self.download_url = 'https://github.com/SasView/sasview/releases/latest'
        self.marketplace_url = "https://marketplace.sasview.org/"
        self.update_url = 'https://www.sasview.org/latestversion.json'

        self.help_email = "help@sasview.org"

web = WebLinks()

redpajama_set_name: RedPajamaGithub


text:
"""
    Kubernetes

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: v1.8.2

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from pprint import pformat
from six import iteritems
import re

class V1beta1SubjectAccessReviewSpec(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'extra': 'dict(str, list[str])',
        'group': 'list[str]',
        'non_resource_attributes': 'V1beta1NonResourceAttributes',
        'resource_attributes': 'V1beta1ResourceAttributes',
        'uid': 'str',
        'user': 'str'
    }

    attribute_map = {
        'extra': 'extra',
        'group': 'group',
        'non_resource_attributes': 'nonResourceAttributes',
        'resource_attributes': 'resourceAttributes',
        'uid': 'uid',
        'user': 'user'
    }

    def __init__(self, extra=None, group=None, non_resource_attributes=None, resource_attributes=None, uid=None, user=None):
        """
        V1beta1SubjectAccessReviewSpec - a model defined in Swagger
        """

        self._extra = None
        self._group = None
        self._non_resource_attributes = None
        self._resource_attributes = None
        self._uid = None
        self._user = None
        self.discriminator = None

        if extra is not None:
          self.extra = extra
        if group is not None:
          self.group = group
        if non_resource_attributes is not None:
          self.non_resource_attributes = non_resource_attributes
        if resource_attributes is not None:
          self.resource_attributes = resource_attributes
        if uid is not None:
          self.uid = uid
        if user is not None:
          self.user = user

    @property
    def extra(self):
        """
        Gets the extra of this V1beta1SubjectAccessReviewSpec.
        Extra corresponds to the user.Info.GetExtra() method from the authenticator.  Since that is input to the authorizer it needs a reflection here.

        :return: The extra of this V1beta1SubjectAccessReviewSpec.
        :rtype: dict(str, list[str])
        """
        return self._extra

    @extra.setter
    def extra(self, extra):
        """
        Sets the extra of this V1beta1SubjectAccessReviewSpec.
        Extra corresponds to the user.Info.GetExtra() method from the authenticator.  Since that is input to the authorizer it needs a reflection here.

        :param extra: The extra of this V1beta1SubjectAccessReviewSpec.
        :type: dict(str, list[str])
        """

        self._extra = extra

    @property
    def group(self):
        """
        Gets the group of this V1beta1SubjectAccessReviewSpec.
        Groups is the groups you're testing for.

        :return: The group of this V1beta1SubjectAccessReviewSpec.
        :rtype: list[str]
        """
        return self._group

    @group.setter
    def group(self, group):
        """
        Sets the group of this V1beta1SubjectAccessReviewSpec.
        Groups is the groups you're testing for.

        :param group: The group of this V1beta1SubjectAccessReviewSpec.
        :type: list[str]
        """

        self._group = group

    @property
    def non_resource_attributes(self):
        """
        Gets the non_resource_attributes of this V1beta1SubjectAccessReviewSpec.
        NonResourceAttributes describes information for a non-resource access request

        :return: The non_resource_attributes of this V1beta1SubjectAccessReviewSpec.
        :rtype: V1beta1NonResourceAttributes
        """
        return self._non_resource_attributes

    @non_resource_attributes.setter
    def non_resource_attributes(self, non_resource_attributes):
        """
        Sets the non_resource_attributes of this V1beta1SubjectAccessReviewSpec.
        NonResourceAttributes describes information for a non-resource access request

        :param non_resource_attributes: The non_resource_attributes of this V1beta1SubjectAccessReviewSpec.
        :type: V1beta1NonResourceAttributes
        """

        self._non_resource_attributes = non_resource_attributes

    @property
    def resource_attributes(self):
        """
        Gets the resource_attributes of this V1beta1SubjectAccessReviewSpec.
        ResourceAuthorizationAttributes describes information for a resource access request

        :return: The resource_attributes of this V1beta1SubjectAccessReviewSpec.
        :rtype: V1beta1ResourceAttributes
        """
        return self._resource_attributes

    @resource_attributes.setter
    def resource_attributes(self, resource_attributes):
        """
        Sets the resource_attributes of this V1beta1SubjectAccessReviewSpec.
        ResourceAuthorizationAttributes describes information for a resource access request

        :param resource_attributes: The resource_attributes of this V1beta1SubjectAccessReviewSpec.
        :type: V1beta1ResourceAttributes
        """

        self._resource_attributes = resource_attributes

    @property
    def uid(self):
        """
        Gets the uid of this V1beta1SubjectAccessReviewSpec.
        UID information about the requesting user.

        :return: The uid of this V1beta1SubjectAccessReviewSpec.
        :rtype: str
        """
        return self._uid

    @uid.setter
    def uid(self, uid):
        """
        Sets the uid of this V1beta1SubjectAccessReviewSpec.
        UID information about the requesting user.

        :param uid: The uid of this V1beta1SubjectAccessReviewSpec.
        :type: str
        """

        self._uid = uid

    @property
    def user(self):
        """
        Gets the user of this V1beta1SubjectAccessReviewSpec.
        User is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups

        :return: The user of this V1beta1SubjectAccessReviewSpec.
        :rtype: str
        """
        return self._user

    @user.setter
    def user(self, user):
        """
        Sets the user of this V1beta1SubjectAccessReviewSpec.
        User is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups

        :param user: The user of this V1beta1SubjectAccessReviewSpec.
        :type: str
        """

        self._user = user

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if not isinstance(other, V1beta1SubjectAccessReviewSpec):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other


text:
package buuid

import (
	"encoding/binary"
	"fmt"

	"code.google.com/p/go-uuid/uuid"

	"github.com/getlantern/golog"
)

const (
	EncodedLength = 16
)

var (
	endianness = binary.LittleEndian
	zero       = ID{}

	log = golog.LoggerFor("buuid")
)

// ID is a type 4 UUID.
type ID struct {
	part1 uint64
	part2 uint64
}

// Random creates a random ID (uses uuid.NewRandom() which uses crypto.Random()
// under the covers)
func Random() ID {
	id, err := Read(uuid.NewRandom())
	if err != nil {
		panic(fmt.Sprintf("Unable to generate random peer id: %s", err))
	}
	return id
}

// Read reads the ID from a 16-byte or larger buffer
func Read(b []byte) (ID, error) {
	if len(b) < EncodedLength {
		return zero, fmt.Errorf("Insufficient data to read id, data may be truncated")
	}
	return ID{
		endianness.Uint64(b[0:8]),
		endianness.Uint64(b[8:]),
	}, nil
}

// Write writes the ID to a 16-byte or larger buffer
func (id ID) Write(b []byte) error {
	if len(b) < EncodedLength {
		return fmt.Errorf("Insufficient room to write id")
	}
	endianness.PutUint64(b, id.part1)
	endianness.PutUint64(b[8:], id.part2)
	return nil
}

// ToBytes returns a 16-byte representation of this ID
func (id ID) ToBytes() []byte {
	b := make([]byte, EncodedLength)
	if err := id.Write(b); err != nil {
		log.Errorf("Unable to write as 16-bytes representation: %v", err)
	}
	return b
}

// FromString constructs an ID from the string-encoded version of a uuid.UUID.
func FromString(s string) (ID, error) {
	return Read(uuid.Parse(s))
}

// String() returns the string-encoded version like in uuid.UUID.
func (id ID) String() string {
	b := uuid.UUID(make([]byte, EncodedLength))
	if err := id.Write([]byte(b)); err != nil {
		log.Errorf("Unable to write as string: %v", err)
	}
	return b.String()
}


text:
package de.tum.in.www1.artemis.web.rest.hestia;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import de.tum.in.www1.artemis.domain.ProgrammingExercise;
import de.tum.in.www1.artemis.domain.ProgrammingExerciseTestCase;
import de.tum.in.www1.artemis.domain.hestia.CodeHint;
import de.tum.in.www1.artemis.domain.hestia.ProgrammingExerciseSolutionEntry;
import de.tum.in.www1.artemis.repository.ProgrammingExerciseRepository;
import de.tum.in.www1.artemis.repository.ProgrammingExerciseTestCaseRepository;
import de.tum.in.www1.artemis.repository.hestia.CodeHintRepository;
import de.tum.in.www1.artemis.repository.hestia.ProgrammingExerciseSolutionEntryRepository;
import de.tum.in.www1.artemis.security.Role;
import de.tum.in.www1.artemis.service.AuthorizationCheckService;
import de.tum.in.www1.artemis.web.rest.errors.ConflictException;
import tech.jhipster.web.util.HeaderUtil;

/**
 * REST controller for managing {@link de.tum.in.www1.artemis.domain.hestia.ProgrammingExerciseSolutionEntry}.
 */
@RestController
@RequestMapping("api/")
public class ProgrammingExerciseSolutionEntryResource {

    private final Logger log = LoggerFactory.getLogger(ExerciseHintResource.class);

    private static final String ENTITY_NAME = "programmingExerciseSolutionEntry";

    @Value("${jhipster.clientApp.name}")
    private String applicationName;

    private final ProgrammingExerciseSolutionEntryRepository programmingExerciseSolutionEntryRepository;

    private final ProgrammingExerciseRepository programmingExerciseRepository;

    private final CodeHintRepository codeHintRepository;

    private final ProgrammingExerciseTestCaseRepository programmingExerciseTestCaseRepository;

    private final AuthorizationCheckService authCheckService;

    public ProgrammingExerciseSolutionEntryResource(ProgrammingExerciseSolutionEntryRepository programmingExerciseSolutionEntryRepository,
            ProgrammingExerciseRepository programmingExerciseRepository, CodeHintRepository codeHintRepository,
            ProgrammingExerciseTestCaseRepository programmingExerciseTestCaseRepository, AuthorizationCheckService authCheckService) {
        this.programmingExerciseSolutionEntryRepository = programmingExerciseSolutionEntryRepository;
        this.programmingExerciseRepository = programmingExerciseRepository;
        this.codeHintRepository = codeHintRepository;
        this.programmingExerciseTestCaseRepository = programmingExerciseTestCaseRepository;
        this.authCheckService = authCheckService;
    }

    /**
     * GET programming-exercises/:exerciseId/solution-entries/:solutionEntryId : Get the solution entry with test cases and programming exercise
     * @param exerciseId of the exercise
     * @param solutionEntryId of the solution entry
     * @return the {@link ResponseEntity} with status {@code 200} and with body the solution entries with test cases and exercise,
     * or with status {@code 409 (Conflict)} if the exerciseId or solutionEntryId are not valid.
     */
    @GetMapping("programming-exercises/{exerciseId}/solution-entries/{solutionEntryId}")
    @PreAuthorize("hasRole('TA')")
    public ResponseEntity<ProgrammingExerciseSolutionEntry> getSolutionEntry(@PathVariable Long exerciseId, @PathVariable Long solutionEntryId) {
        log.debug("REST request to retrieve SolutionEntry : {}", solutionEntryId);
        // Reload the exercise from the database as we can't trust data from the client
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.TEACHING_ASSISTANT, exercise, null);

        ProgrammingExerciseSolutionEntry solutionEntry = programmingExerciseSolutionEntryRepository.findByIdWithTestCaseAndProgrammingExerciseElseThrow(solutionEntryId);

        if (!exerciseId.equals(solutionEntry.getTestCase().getExercise().getId())) {
            throw new ConflictException("A solution entry can only be retrieved if the exercise match", ENTITY_NAME, "exerciseIdsMismatch");
        }
        return ResponseEntity.ok(solutionEntry);
    }

    /**
     * GET programming-exercises/:exerciseId/code-hints/:codeHintId/solution-entries : Get all solution entries for a given code hint
     * @param exerciseId of the exercise
     * @param codeHintId of the code hint
     * @return the {@link ResponseEntity} with status {@code 200} and with body the solution entries,
     * or with status {@code 409 (Conflict)} if the exerciseId or codeHintId are not valid.
     */
    @GetMapping("programming-exercises/{exerciseId}/code-hints/{codeHintId}/solution-entries")
    @PreAuthorize("hasRole('USER')")
    public ResponseEntity<Set<ProgrammingExerciseSolutionEntry>> getSolutionEntriesForCodeHint(@PathVariable Long exerciseId, @PathVariable Long codeHintId) {
        log.debug("REST request to retrieve SolutionEntry for CodeHint with id : {}", codeHintId);
        // Reload the exercise from the database as we can't trust data from the client
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.STUDENT, exercise, null);

        CodeHint codeHint = codeHintRepository.findByIdElseThrow(codeHintId);
        if (!exercise.getId().equals(codeHint.getExercise().getId())) {
            throw new ConflictException("A solution entry can only be retrieved if the code hint belongs to the exercise", ENTITY_NAME, "exerciseIdsMismatch");
        }

        Set<ProgrammingExerciseSolutionEntry> solutionEntries = programmingExerciseSolutionEntryRepository.findByCodeHintId(codeHintId);
        return ResponseEntity.ok(solutionEntries);
    }

    /**
     * GET programming-exercises/:exerciseId/test-cases/:testCaseId/solution-entries : Get all solution entries for a given test case
     * @param exerciseId of the exercise
     * @param testCaseId of the test case
     * @return the {@link ResponseEntity} with status {@code 200} and with body the solution entries,
     * or with status {@code 409 (Conflict)} if the exerciseId or testCaseId are not valid.
     */
    @GetMapping("programming-exercises/{exerciseId}/test-cases/{testCaseId}/solution-entries")
    @PreAuthorize("hasRole('USER')")
    public ResponseEntity<Set<ProgrammingExerciseSolutionEntry>> getSolutionEntriesForTestCase(@PathVariable Long exerciseId, @PathVariable Long testCaseId) {
        log.debug("REST request to retrieve SolutionEntry for ProgrammingExerciseTestCase with id : {}", testCaseId);
        // Reload the exercise from the database as we can't trust data from the client
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.STUDENT, exercise, null);

        ProgrammingExerciseTestCase testCase = programmingExerciseTestCaseRepository.findByIdWithExerciseElseThrow(testCaseId);
        if (!exercise.getId().equals(testCase.getExercise().getId())) {
            throw new ConflictException("A solution entry can only be retrieved if the test case belongs to the exercise", ENTITY_NAME, "exerciseIdsMismatch");
        }

        Set<ProgrammingExerciseSolutionEntry> solutionEntries = programmingExerciseSolutionEntryRepository.findByTestCaseId(testCaseId);
        return ResponseEntity.ok(solutionEntries);
    }

    /**
     * POST programming-exercises/:exerciseId/test-cases/:testCaseId/solution-entries : Create a solution entry for a test case
     * @param exerciseId of the exercise
     * @param testCaseId of the test case
     * @param programmingExerciseSolutionEntry the solution entry to be created
     * @return the {@link ResponseEntity} with status {@code 201} and with body the created solution entry,
     * or with status {@code 409 (Conflict)} if the exerciseId, testcaseId, or solution entry are not valid.
     */
    @PostMapping("programming-exercises/{exerciseId}/test-cases/{testCaseId}/solution-entries")
    @PreAuthorize("hasRole('EDITOR')")
    public ResponseEntity<ProgrammingExerciseSolutionEntry> createSolutionEntryForTestCase(@PathVariable Long exerciseId, @PathVariable Long testCaseId,
            @RequestBody ProgrammingExerciseSolutionEntry programmingExerciseSolutionEntry) throws URISyntaxException {
        log.debug("REST request to create SolutionEntry : {}", programmingExerciseSolutionEntry);
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, exercise, null);

        ProgrammingExerciseTestCase testCase = programmingExerciseTestCaseRepository.findByIdWithExerciseElseThrow(testCaseId);
        checkExerciseContainsTestCaseElseThrow(exercise, testCase);

        ProgrammingExerciseSolutionEntry result = programmingExerciseSolutionEntryRepository.save(programmingExerciseSolutionEntry);
        return ResponseEntity.created(new URI("/api/programming-exercises/" + exerciseId + "/solution-entries/" + result.getId()))
                .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())).body(result);
    }

    /**
     * PUT programming-exercises/:exerciseId/test-cases/:testCaseId/solution-entries/:solutionEntryId : Update a solution entry
     * @param exerciseId of the exercise
     * @param testCaseId of the test case
     * @param solutionEntryId of the solution entry
     * @param solutionEntry the updated solution entry
     * @return the {@link ResponseEntity} with status {@code 200} and with body the updated solution entry,
     * or with status {@code 409 (Conflict)} if the exerciseId, testcaseId, solutionEntryId, or solution entry are not valid.
     */
    @PutMapping("programming-exercises/{exerciseId}/test-cases/{testCaseId}/solution-entries/{solutionEntryId}")
    @PreAuthorize("hasRole('EDITOR')")
    public ResponseEntity<ProgrammingExerciseSolutionEntry> updateSolutionEntry(@PathVariable Long exerciseId, @PathVariable Long testCaseId, @PathVariable Long solutionEntryId,
            @RequestBody ProgrammingExerciseSolutionEntry solutionEntry) {
        log.debug("REST request to update SolutionEntry : {}", solutionEntry);
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, exercise, null);

        ProgrammingExerciseTestCase testCase = programmingExerciseTestCaseRepository.findByIdWithExerciseElseThrow(testCaseId);
        ProgrammingExerciseSolutionEntry solutionEntryBeforeSaving = programmingExerciseSolutionEntryRepository
                .findByIdWithTestCaseAndProgrammingExerciseElseThrow(solutionEntryId);

        checkExerciseContainsTestCaseElseThrow(exercise, testCase);
        if (!solutionEntryId.equals(solutionEntryBeforeSaving.getId())) {
            throw new ConflictException("A solution entry can only be updated if the solutionEntryIds match", ENTITY_NAME, "solutionEntryError");
        }

        ProgrammingExerciseSolutionEntry solutionEntryAfterSaving = programmingExerciseSolutionEntryRepository.save(solutionEntry);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, solutionEntryAfterSaving.getId().toString()))
                .body(solutionEntryAfterSaving);
    }

    /**
     * DELETE programming-exercises/:exerciseId/test-cases/:testCaseId/solution-entries/:solutionEntryId : Delete a solution entry
     * @param exerciseId of the exercise
     * @param testCaseId of the test case
     * @param solutionEntryId of the solution entry that is to be deleted
     * @return the {@link ResponseEntity} with status {@code 204},
     * or with status {@code 409 (Conflict)} if the exerciseId, testcaseId, or solutionEntryId are not valid.
     */
    @DeleteMapping("programming-exercises/{exerciseId}/test-cases/{testCaseId}/solution-entries/{solutionEntryId}")
    @PreAuthorize("hasRole('EDITOR')")
    public ResponseEntity<Void> deleteSolutionEntry(@PathVariable Long exerciseId, @PathVariable Long testCaseId, @PathVariable Long solutionEntryId) {
        log.debug("REST request to delete SolutionEntry with id : {}", solutionEntryId);
        ProgrammingExercise exercise = programmingExerciseRepository.findByIdElseThrow(exerciseId);
        authCheckService.checkHasAtLeastRoleForExerciseElseThrow(Role.EDITOR, exercise, null);

        ProgrammingExerciseTestCase testCase = programmingExerciseTestCaseRepository.findByIdWithExerciseElseThrow(testCaseId);
        ProgrammingExerciseSolutionEntry solutionEntry = programmingExerciseSolutionEntryRepository.findByIdWithTestCaseAndProgrammingExerciseElseThrow(solutionEntryId);

        checkExerciseContainsTestCaseElseThrow(exercise, testCase);
        checkTestCaseContainsSolutionEntryElseThrow(testCase, solutionEntry);

        programmingExerciseSolutionEntryRepository.deleteById(solutionEntryId);
        return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, solutionEntry.toString())).build();
    }

    private void checkExerciseContainsTestCaseElseThrow(ProgrammingExercise exercise, ProgrammingExerciseTestCase testCase) {
        if (!exercise.getId().equals(testCase.getExercise().getId())) {
            throw new ConflictException("The test case of the solution entry does not belong to the exercise.", ENTITY_NAME, "exerciseIdsMismatch");
        }
    }

    private void checkTestCaseContainsSolutionEntryElseThrow(ProgrammingExerciseTestCase testCase, ProgrammingExerciseSolutionEntry solutionEntry) {
        if (solutionEntry.getTestCase() == null || !testCase.getId().equals(solutionEntry.getTestCase().getId())) {
            throw new ConflictException("The test case of the solution entry does not belong to the solution entry.", ENTITY_NAME, "solutionEntryError");
        }
    }
}


text:
function draw(this)
%DRAW Draw forward link budget map

% Decide conditions to apply on each link
switch this.option2
    case 'rain_u'
        cond_u = 'rain';
        cond_d = 'clearsky';
    case 'rain_d'
        cond_u = 'clearsky';
        cond_d = 'rain';
    case 'clearsky'
        cond_u = 'clearsky';
        cond_d = 'clearsky';
end

% Availability (100-p) [%]
p = this.prob;

%% Parameters
% Grid coordinates
latE = this.tblGrid.Lat;
lonE = this.tblGrid.Lon;
% Local spherical AER towards satellite
eleE = this.tblGrid.El;
ranE = this.tblGrid.Range;

% Gateway numbers
% Ignore gateways with no assigned grid points
nG = unique(this.tblGrid.Gateway,'sorted');

%% Carrier to noise (uplink)
% Find gateways assigned to each grid point
idG = this.tblGrid.Gateway;

% Gateway coordinates
latG = this.tblStations.Lat;
lonG = this.tblStations.Lon;
% Local spherical AER towards satellite
eleG = this.tblStations.El;
ranG = this.tblStations.Range;

CNR_U = zeros(size(latE));
for n=1:length(nG)
    % Find points assigned to this gateway
    idx = ismember(idG,nG(n));
    % Assume all gateway beams are centered on the exact location of their
    % corresponding ground station (latB,lonB) = (latE,lonE)
    CNR_U(idx) = this.linkU.carrierN(...
        cond_u,latG(n),lonG(n),latG(n),lonG(n),eleG(n),ranG(n),p);
end

%% Input/output power backoff
IBO = zeros(size(latE));
for n=1:length(nG)
    % Find points assigned to this gateway
    idx = ismember(idG,nG(n));
    % Input power back-off
    IBO(idx) = this.linkU.backoff(cond_u,latG(n),lonG(n),eleG(n),p);
end

% Output power back-off
OBO = this.linkD.backoff(IBO);

%% Carrier to noise (downlink)
% Find beams assigned to each grid point
idB = this.tblGrid.Beam;

% User beam coordinates
latB = this.tblBeams.Lat(idB);
lonB = this.tblBeams.Lon(idB);

% By passing the corresponding beam center coordinates as a vector,
% calculations can be simplified significantly
CNR_D = this.linkD.carrierN(cond_d,latB,lonB,latE,lonE,eleE,ranE,OBO,p);

%% Carrier to intermodulation
CIMR = this.linkD.carrierIM(IBO);

%% Carrier to interference
% Find beams assigned to each grid point
idB = this.tblGrid.Beam;
% Find frequencies assigned to each beam
idF = this.tblBeams.Frequency;

% User beam coordinates
latB = this.tblBeams.Lat;
lonB = this.tblBeams.Lon;

CIR = this.linkD.carrierI(latB,lonB,latE,lonE,idB,idF);

%% Carrier to N+I+IM
CT = 10.^(-CNR_U/10)+10.^(-CNR_D/10)+10.^(-CIR/10)+10.^(-CIMR/10);
CT = -10*log10(CT);

%% Plot contour levels
switch this.option1
    case 'CT'
        data = CT;
        unit = 'C/(N+I+IM)';
    case 'CNR_U'
        data = CNR_U;
        unit = 'Uplink C/N';
    case 'CNR_D'
        data = CNR_D;
        unit = 'Downlink C/N';
    case 'CIR'
        data = CIR;
        unit = 'C/I';
    case 'CIMR'
        data = CIMR;
        unit = 'C/IM';
end

this.clear() % Clear map before redrawing

[this.hData,this.hCBar] = this.addSurface(latE,lonE,data);
ylabel(this.hCBar,sprintf('%s (dB)',unit))


text:
Pre pokretanja skripte potrebno je imati instaliran nodejs na vasem kompjuteru:
[NodeJS](nodejs.org/en/)

### Pokretanje skripte:
```js
$ node server.js
```

### Otvaranje stranica
- http://127.0.0.1:8080/partizan
- http://127.0.0.1:8080/crvena-zvezda

Otvorite inspector u chromu i gledajte sta vas browser salje i sta prima kada pokusate da otvorite strane


text:
package com.mongodb.redis.integration.config;

import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

public abstract class AbstractRedisContainerBaseTest extends AbstractMongoContainerBaseTest {

    static DockerImageName redisDockerImageName = DockerImageName.parse("redis");

    @Container
    protected static final GenericContainer REDIS_DB_CONTAINER =
            new GenericContainer(redisDockerImageName).withExposedPorts(6379);

    static {
        REDIS_DB_CONTAINER.start();
    }

    @DynamicPropertySource
    static void setMongoDbContainerURI(DynamicPropertyRegistry propertyRegistry) {
        propertyRegistry.add("spring.redis.host", REDIS_DB_CONTAINER::getHost);
        propertyRegistry.add("spring.redis.port", REDIS_DB_CONTAINER::getFirstMappedPort);
    }
}


text:
package com.owera.xaps.shell;

import com.owera.common.log.Logger;
import com.owera.common.util.PropertyReader;
import com.owera.common.util.PropertyReaderException;

public class Properties {

	private static String propertyfile = "xaps-shell.properties";

	private static PropertyReader pr;
	static {
		try {
			pr = new PropertyReader(propertyfile);
		} catch (PropertyReaderException pre) {
			// If propertyfile is not present, use deault settings. Important for shell-as-deamon
		}
	}

	private static Logger logger = new Logger();

	@SuppressWarnings("unused")
	private static int getInteger(String propertyKey, int defaultValue) {
		try {
			String prop = pr.getProperty(propertyKey);
			return Integer.parseInt(prop);
		} catch (Throwable t) {
			logger.warn("The value of " + propertyKey + " was not a number, instead using default value " + defaultValue);
			return defaultValue;
		}
	}

	private static String getString(String propertyKey, String defaultValue) {
		try {
			String prop = pr.getProperty(propertyKey);
			if (prop == null) {
				logger.warn("The value of " + propertyKey + " was not specified, instead using default value " + defaultValue);
				return defaultValue;
			}
			return prop;
		} catch (Throwable t) {
			return defaultValue;
		}
	}

	public static boolean isRestricted() {
		return getString("restricted", "false").equals("true");
	}

	public static String getSyslogServer() {
		String ss = getString("syslog.server", "localhost:9116");
		int colonPos = ss.indexOf(":");
		if (colonPos == -1)
			return "localhost";
		else
			return ss.substring(0, colonPos);
	}

	public static int getSyslogServerPort() {
		String ss = getString("syslog.server", "localhost:9116");
		int colonPos = ss.indexOf(":");
		if (colonPos == -1)
			return 9116;
		else
			try {
				return Integer.parseInt(ss.substring(colonPos + 1));
			} catch (NumberFormatException nfe) {
				return 9116;
			}
	}

}


text:
package tencentcr

import (
	"reflect"
	"testing"
)

func Test_adapter_createPrivateNamespace(t *testing.T) {
	tests := []struct {
		name      string
		namespace string
		wantErr   bool
	}{
		{namespace: "ut_ns_123", wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			if err := a.createPrivateNamespace(tt.namespace); (err != nil) != tt.wantErr {
				t.Errorf("adapter.createPrivateNamespace() error = %v, wantErr %v", err, tt.wantErr)
			}
		})
	}
}

func Test_adapter_createRepository(t *testing.T) {
	tests := []struct {
		name       string
		namespace  string
		repository string
		wantErr    bool
	}{
		{namespace: "ut_ns_123", repository: "ut_repo_123", wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			if err := a.createRepository(tt.namespace, tt.repository); (err != nil) != tt.wantErr {
				t.Errorf("adapter.createRepository() error = %v, wantErr %v", err, tt.wantErr)
			}
		})
	}
}

func Test_adapter_listNamespaces(t *testing.T) {
	tests := []struct {
		name           string
		wantNamespaces []string
		wantErr        bool
	}{
		{wantNamespaces: []string{}, wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			_, err := a.listNamespaces()
			if (err != nil) != tt.wantErr {
				t.Errorf("adapter.listNamespaces() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
		})
	}
}

func Test_adapter_isNamespaceExist(t *testing.T) {
	tests := []struct {
		name      string
		namespace string
		wantExist bool
		wantErr   bool
	}{
		{namespace: "ut_ns_123", wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			gotExist, err := a.isNamespaceExist(tt.namespace)
			if (err != nil) != tt.wantErr {
				t.Errorf("adapter.isNamespaceExist() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if gotExist != tt.wantExist {
				t.Errorf("adapter.isNamespaceExist() = %v, want %v", gotExist, tt.wantExist)
			}
		})
	}
}

func Test_adapter_listReposByNamespace(t *testing.T) {
	tests := []struct {
		name      string
		namespace string
		wantErr   bool
	}{
		{namespace: "ut_ns_123", wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			_, err := a.listReposByNamespace(tt.namespace)
			if (err != nil) != tt.wantErr {
				t.Errorf("adapter.listReposByNamespace() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
		})
	}
}

func Test_adapter_getImages(t *testing.T) {
	tests := []struct {
		name       string
		namespace  string
		repo       string
		tag        string
		wantImages []string
		wantErr    bool
	}{
		{namespace: "ut_ns_123", repo: "ut_repo_123", wantErr: true},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			a := &adapter{tcrClient: tcrClient}
			_, gotImages, err := a.getImages(tt.namespace, tt.repo, tt.tag)
			if (err != nil) != tt.wantErr {
				t.Errorf("adapter.getImages() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if !reflect.DeepEqual(gotImages, tt.wantImages) {
				t.Errorf("adapter.getImages() = %v, want %v", gotImages, tt.wantImages)
			}
		})
	}
}


text:
(function() {
  'use strict';

  angular
    .module('nqms')
    .factory('deptService', deptServiceFunc);

  /** @ngInject */
  /**
   * [deptServiceFunc 科室数据]
   * @param  {[Object]} $window [全局window对象]
   * @return {[Object]}         [包涵接口和科室列表数据]
   */
  function deptServiceFunc($window, $http, apiHost, $log, toastr, security) {
    var deptList = null;
    var service = {
      apiHost: apiHost,
      getDeptData: getDeptData,
      getCacheDeptList: getCacheDeptList
    };

    return service;

    function getCacheDeptList() {
      if (deptList) {
        return angular.copy(deptList, []);
      }
      return null;
    }

    function getDeptData(deptCode) {
      return $http.get(apiHost.user.getDept, {
          params: {
            deptCode: deptCode || security.getUserinfo()['role'].deptCode
          }
        })
        .then(getDeptListComplete)
        .catch(getDeptListFailed);

      function getDeptListComplete(response) {
        if (response.data.code === '0') {
          // 不传科室code时,获得全部科室数据
          //if (!security.getUserinfo()['role'].deptCode) {
            deptList = response.data.data;
          //}

          return angular.copy(response.data.data, []);
        } else {
          $log.error('获取科室数据失败!\n' + response.data.msg);
        }
      }

      function getDeptListFailed(error) {
        $log.error('获取科室数据失败!\n' + angular.toJson(error.data, true));
      }
    }
  }
})();


text:
from toontown.battle import BattleParticles
from toontown.town import BRStreet, TownLoader

class BRTownLoader(TownLoader.TownLoader):

    def __init__(self, hood, parentFSM, doneEvent):
        TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent)
        self.streetClass = BRStreet.BRStreet
        self.musicFile = 'phase_8/audio/bgm/TB_SZ.ogg'
        self.activityMusicFile = 'phase_8/audio/bgm/TB_SZ_activity.ogg'

    def load(self, zoneId):
        TownLoader.TownLoader.load(self, zoneId)
        dnaFile = 'phase_8/dna/the_burrrgh_' + str(self.branchZone) + '.bdna'
        self.createHood(dnaFile)
        self.windSound = map(loader.loadSfx, ['phase_8/audio/sfx/SZ_TB_wind_1.ogg', 'phase_8/audio/sfx/SZ_TB_wind_2.ogg', 'phase_8/audio/sfx/SZ_TB_wind_3.ogg'])
        self.snow = BattleParticles.loadParticleFile('snowdisk.ptf')
        self.snow.setPos(0, 0, 5)
        self.snowRender = self.geom.attachNewNode('snowRender')
        self.snowRender.setDepthWrite(0)
        self.snowRender.setBin('fixed', 1)

    def unload(self):
        TownLoader.TownLoader.unload(self)
        del self.windSound
        del self.snow
        del self.snowRender

    def enter(self, requestStatus):
        TownLoader.TownLoader.enter(self, requestStatus)
        self.snow.start(camera, self.snowRender)

    def exit(self):
        TownLoader.TownLoader.exit(self)
        self.snow.cleanup()
        self.snowRender.removeNode()


text:
.class Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle$2;
.super Ljava/lang/Object;
.source "OverlayDisplayAdapter.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$1:Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;

# direct methods
.method constructor <init>(Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle$2;->this$1:Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;

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

    return-void
.end method

# virtual methods
.method public run()V
    .locals 4

    iget-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle$2;->this$1:Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;

    iget-object v1, v1, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;->this$0:Lcom/android/server/display/OverlayDisplayAdapter;

    invoke-virtual {v1}, Lcom/android/server/display/OverlayDisplayAdapter;->getSyncRoot()Lcom/android/server/display/DisplayManagerService$SyncRoot;

    move-result-object v2

    monitor-enter v2

    :try_start_0
    iget-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle$2;->this$1:Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;

    invoke-static {v1}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;->-get6(Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;)Lcom/android/server/display/OverlayDisplayWindow;

    move-result-object v0

    iget-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle$2;->this$1:Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;

    const/4 v3, 0x0

    invoke-static {v1, v3}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;->-set0(Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayHandle;Lcom/android/server/display/OverlayDisplayWindow;)Lcom/android/server/display/OverlayDisplayWindow;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v2

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Lcom/android/server/display/OverlayDisplayWindow;->dismiss()V

    :cond_0
    return-void

    :catchall_0
    move-exception v1

    monitor-exit v2

    throw v1
.end method


text:
using System;
using System.Linq;

namespace _05.OrderStudents
{
    class OrderStudents
    {
        static void Main(string[] args)
        {
            var studentArray = new[] {
                new {FirstName = "Pesho", LastName = "Hristov", Age = 10},
                new {FirstName = "Gosho", LastName = "Jorov", Age = 18},
                new {FirstName = "Ivan", LastName = "Iordanov", Age = 20},
                new {FirstName = "Hristo", LastName = "Mihov", Age = 24},
                new {FirstName = "Joro", LastName = "Lazarov", Age = 25},
                new {FirstName = "Joro", LastName = "Ivanov", Age = 25},
                new {FirstName = "Joro", LastName = "Hristov", Age = 25},
            };

            var firstResult = studentArray
                .OrderByDescending(s => s.FirstName)
                .ThenByDescending(s => s.LastName);

            var secondResult =
                from student in studentArray
                orderby student.FirstName descending, student.LastName descending
                select student;

            foreach (var student in firstResult)
            {
                Console.WriteLine(student);
            }
            Console.WriteLine(new string('=', 20));
            foreach (var student in secondResult)
            {
                Console.WriteLine(student);
            }
        }
    }
}


text:
/*!
*  - v1.0.2
*/

.slider-pro {
	position: relative;
	margin: 40px auto;
}

.sp-slides-container {
	position: relative
}

.sp-mask {
	position: relative;
	overflow: hidden
}

.sp-slides {
	position: relative;
	-webkit-backface-visibility: hidden;
	-webkit-perspective: 1000
}

.sp-slide {
	position: absolute
}

.sp-image-container {
	overflow: hidden
}

.sp-image {
	position: relative;
	display: block;
	border: none
}

.sp-thumbnails-container {
	position: relative;
	overflow: hidden
}

.sp-bottom-thumbnails,
.sp-top-thumbnails {
	left: 0;
	margin: 0 auto
}

.sp-left-thumbnails,
.sp-right-thumbnails,
.sp-top-thumbnails {
	position: absolute;
	top: 0
}

.sp-right-thumbnails {
	right: 0
}

.sp-left-thumbnails {
	left: 0
}

.sp-thumbnails {
	position: relative
}

.sp-thumbnail {
	border: none
}

.sp-thumbnail-container {
	position: relative;
	display: block;
	overflow: hidden;
	float: left;
	-moz-box-sizing: border-box;
	box-sizing: border-box
}

.sp-bottom-thumbnails .sp-thumbnail-container,
.sp-top-thumbnails .sp-thumbnail-container {
	margin-left: 2px;
	margin-right: 2px
}

.sp-bottom-thumbnails .sp-thumbnail-container:first-child,
.sp-top-thumbnails .sp-thumbnail-container:first-child {
	margin-left: 0
}

.sp-bottom-thumbnails .sp-thumbnail-container:last-child,
.sp-top-thumbnails .sp-thumbnail-container:last-child {
	margin-right: 0
}

.sp-left-thumbnails .sp-thumbnail-container,
.sp-right-thumbnails .sp-thumbnail-container {
	margin-top: 2px;
	margin-bottom: 2px
}

.sp-left-thumbnails .sp-thumbnail-container:first-child,
.sp-right-thumbnails .sp-thumbnail-container:first-child {
	margin-top: 0
}

.sp-left-thumbnails .sp-thumbnail-container:last-child,
.sp-right-thumbnails .sp-thumbnail-container:last-child {
	margin-bottom: 0
}

.sp-right-thumbnails.sp-has-pointer {
	margin-left: -13px
}

.sp-right-thumbnails.sp-has-pointer .sp-thumbnail {
	position: absolute;
	left: 18px;
	margin-left: 0!important
}

.sp-right-thumbnails.sp-has-pointer .sp-selected-thumbnail:before {
	content: '';
	position: absolute;
	height: 100%;
	border-left: 5px solid cyan;
	left: 0;
	top: 0;
	margin-left: 13px
}

.sp-right-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25c0';
	position: absolute;
	font-family: Arial;
	font-size: 16px;
	line-height: 1;
	color: cyan;
	left: 0;
	top: 50%;
	margin-top: -6px
}

.ie10 .sp-right-thumbnails.sp-has-pointer .sp-selected-thumbnail:after,
.ie11 .sp-right-thumbnails.sp-has-pointer .sp-selected-thumbnail:after,
.ie9 .sp-right-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25bc';
	-ms-transform: rotate(90deg);
	transform: rotate(90deg)
}

.sp-left-thumbnails.sp-has-pointer {
	margin-right: -13px
}

.sp-left-thumbnails.sp-has-pointer .sp-thumbnail {
	position: absolute;
	right: 18px
}

.sp-left-thumbnails.sp-has-pointer .sp-selected-thumbnail:before {
	content: '';
	position: absolute;
	height: 100%;
	border-left: 5px solid cyan;
	right: 0;
	top: 0;
	margin-right: 13px
}

.sp-left-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25ba';
	position: absolute;
	font-family: Arial;
	font-size: 16px;
	line-height: 1;
	color: cyan;
	right: 0;
	top: 50%;
	margin-top: -6px
}

.ie10 .sp-left-thumbnails.sp-has-pointer .sp-selected-thumbnail:after,
.ie11 .sp-left-thumbnails.sp-has-pointer .sp-selected-thumbnail:after,
.ie9 .sp-left-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25b2';
	-ms-transform: rotate(90deg);
	transform: rotate(90deg)
}

.sp-bottom-thumbnails.sp-has-pointer {
	margin-top: -13px
}

.sp-bottom-thumbnails.sp-has-pointer .sp-thumbnail {
	position: absolute;
	top: 18px;
	margin-top: 0!important
}

.sp-bottom-thumbnails.sp-has-pointer .sp-selected-thumbnail:before {
	content: '';
	position: absolute;
	width: 100%;
	border-bottom: 5px solid cyan;
	top: 0;
	margin-top: 13px
}

.sp-bottom-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25b2';
	position: absolute;
	font-family: Arial;
	font-size: 16px;
	line-height: 1;
	color: cyan;
	left: 50%;
	top: 0;
	margin-left: -9px
}

.sp-top-thumbnails.sp-has-pointer {
	margin-bottom: -13px
}

.sp-top-thumbnails.sp-has-pointer .sp-thumbnail {
	position: absolute;
	bottom: 18px
}

.sp-top-thumbnails.sp-has-pointer .sp-selected-thumbnail:before {
	content: '';
	position: absolute;
	width: 100%;
	border-bottom: 5px solid cyan;
	bottom: 0;
	margin-bottom: 13px
}

.sp-top-thumbnails.sp-has-pointer .sp-selected-thumbnail:after {
	content: '\25bc';
	position: absolute;
	font-family: Arial;
	font-size: 16px;
	line-height: 1;
	color: cyan;
	left: 50%;
	bottom: 0;
	margin-left: -9px
}

.sp-layer {
	position: absolute;
	margin: 0;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-webkit-font-smoothing: subpixel-antialiased;
	-webkit-backface-visibility: hidden
}

.sp-black {
	color: #FFF;
	background: #000;
	background: rgba(0, 0, 0, .7)
}

.sp-white {
	color: #000;
	background: #fff;
	background: rgba(255, 255, 255, .7)
}

.sp-rounded {
	border-radius: 10px
}

.sp-padding {
	padding: 10px
}

.sp-grab {
	cursor: url(cur/openhand.cur), move
}

.sp-grabbing {
	cursor: url(cur/closedhand.cur), move
}

.sp-selectable {
	cursor: default
}

.sp-caption-container {
	text-align: center;
	margin-top: 10px;
	font-family: "微软雅黑";
}

.sp-full-screen {
	margin: 0!important;
	background-color: #000
}

.sp-full-screen-button {
	position: absolute;
	top: 5px;
	right: 10px;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	-webkit-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	transform: rotate(45deg)
}

.sp-full-screen-button:before {
	content: '\2195'
}

.sp-fade-full-screen {
	opacity: 0;
	-webkit-transition: opacity .5s;
	transition: opacity .5s
}

.slider-pro:hover .sp-fade-full-screen {
	opacity: 1
}

.sp-buttons {
	position: relative;
	width: 100%;
	text-align: center;
	padding-top: 10px
}

.sp-button {
	width: 10px;
	height: 10px;
	border: 2px solid #000;
	border-radius: 50%;
	margin: 4px;
	display: inline-block;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	cursor: pointer
}

.sp-selected-button {
	background-color: #000
}

@media only screen and (min-width:768px) and (max-width:1024px) {
	.sp-button {
		width: 14px;
		height: 14px
	}
	.sp-has-buttons {
		margin-bottom: 36px
	}
}

@media only screen and (min-width:568px) and (max-width:768px) {
	.sp-button {
		width: 16px;
		height: 16px
	}
	.sp-has-buttons {
		margin-bottom: 38px
	}
}

@media only screen and (min-width:320px) and (max-width:568px) {
	.sp-button {
		width: 18px;
		height: 18px
	}
	.sp-has-buttons {
		margin-bottom: 40px
	}
}

.sp-fade-arrows {
	opacity: 0;
	-webkit-transition: opacity .5s;
	transition: opacity .5s
}

.sp-slides-container:hover .sp-fade-arrows {
	opacity: 1
}

.sp-arrow {
	position: absolute;
	font-size: 40px;
	color: #FFF;
	text-shadow: 1px 1px 1px #666;
	cursor: pointer
}

.sp-vertical .sp-arrow {
	-webkit-transform: rotate(90deg);
	-ms-transform: rotate(90deg);
	transform: rotate(90deg)
}

.sp-horizontal .sp-arrow {
	top: 50%;
	margin-top: -20px
}

.sp-vertical .sp-arrow {
	left: 50%;
	margin-left: -10px
}

.sp-previous-arrow:before {
	content: '\276e'
}

.ie7 .sp-previous-arrow:before,
.ie8 .sp-previous-arrow:before,
.ie9 .sp-previous-arrow:before,
.ios .sp-previous-arrow:before {
	content: '\25c0'
}

.ie7.sp-vertical .sp-previous-arrow:before,
.ie8.sp-vertical .sp-previous-arrow:before {
	content: '\25b2'
}

.sp-next-arrow:before {
	content: '\276f'
}

.ie7 .sp-next-arrow:before,
.ie8 .sp-next-arrow:before,
.ie9 .sp-next-arrow:before,
.ios .sp-next-arrow:before {
	content: '\25b6'
}

.ie7.sp-vertical .sp-next-arrow:before,
.ie8.sp-vertical .sp-next-arrow:before {
	content: '\25bc'
}

.sp-horizontal .sp-previous-arrow {
	left: 20px
}

.sp-horizontal .sp-next-arrow {
	right: 20px
}

.sp-vertical .sp-previous-arrow {
	top: 20px
}

.sp-vertical .sp-next-arrow {
	bottom: 20px
}

.sp-thumbnail-arrows {
	position: absolute
}

.sp-fade-thumbnail-arrows {
	opacity: 0;
	-webkit-transition: opacity .5s;
	transition: opacity .5s
}

.sp-thumbnails-container:hover .sp-fade-thumbnail-arrows {
	opacity: 1
}

.sp-bottom-thumbnails .sp-thumbnail-arrows,
.sp-top-thumbnails .sp-thumbnail-arrows {
	width: 100%;
	top: 50%;
	left: 0;
	margin-top: -10px
}

.sp-left-thumbnails .sp-thumbnail-arrows,
.sp-right-thumbnails .sp-thumbnail-arrows {
	height: 100%;
	top: 0;
	left: 50%;
	margin-left: -5px
}

.sp-thumbnail-arrow {
	position: absolute;
	font-size: 20px;
	color: #FFF;
	text-shadow: 1px 1px 1px #666;
	cursor: pointer
}

.sp-left-thumbnails .sp-thumbnail-arrows .sp-thumbnail-arrow,
.sp-right-thumbnails .sp-thumbnail-arrows .sp-thumbnail-arrow {
	-ms-transform: rotate(90deg);
	-webkit-transform: rotate(90deg);
	transform: rotate(90deg)
}

.sp-previous-thumbnail-arrow:before {
	content: '\276e'
}

.ie7 .sp-previous-thumbnail-arrow:before,
.ie8 .sp-previous-thumbnail-arrow:before,
.ie9 .sp-previous-thumbnail-arrow:before,
.ios .sp-previous-thumbnail-arrow:before {
	content: '\25c0'
}

.ie7.sp-vertical .sp-previous-thumbnail-arrow:before,
.ie8.sp-vertical .sp-previous-thumbnail-arrow:before {
	content: '\25b2'
}

.sp-next-thumbnail-arrow:before {
	content: '\276f'
}

.ie7 .sp-next-thumbnail-arrow:before,
.ie8 .sp-next-thumbnail-arrow:before,
.ie9 .sp-next-thumbnail-arrow:before,
.ios .sp-next-thumbnail-arrow:before {
	content: '\25b6'
}

.ie7.sp-vertical .sp-next-thumbnail-arrow:before,
.ie8.sp-vertical .sp-next-thumbnail-arrow:before {
	content: '\25bc'
}

.sp-bottom-thumbnails .sp-previous-thumbnail-arrow,
.sp-top-thumbnails .sp-previous-thumbnail-arrow {
	left: 0
}

.sp-bottom-thumbnails .sp-next-thumbnail-arrow,
.sp-top-thumbnails .sp-next-thumbnail-arrow {
	right: 0
}

.sp-left-thumbnails .sp-previous-thumbnail-arrow,
.sp-right-thumbnails .sp-previous-thumbnail-arrow {
	top: 0
}

.sp-left-thumbnails .sp-next-thumbnail-arrow,
.sp-right-thumbnails .sp-next-thumbnail-arrow {
	bottom: 0
}

a.sp-video {
	text-decoration: none
}

a.sp-video img {
	-webkit-backface-visibility: hidden;
	border: none
}

a.sp-video:after {
	content: '\25B6';
	position: absolute;
	width: 45px;
	padding-left: 5px;
	height: 50px;
	border: 2px solid #FFF;
	text-align: center;
	font-size: 30px;
	border-radius: 30px;
	top: 0;
	color: #FFF;
	bottom: 0;
	left: 0;
	right: 0;
	background-color: rgba(0, 0, 0, .2);
	margin: auto;
	line-height: 52px
}


text:
For Mongo DB there are multiple new features and improvements in the driver. This include Mongos failover support, authentication, replicaset support, read preferences and aggregation. Let's move throught the different new features starting with.

## Read preferences
Read preferences is now backed by a specification and is more consistent across drivers. With read preferences you can control from where your Reads are happing in a Replicaset and from Mongo DB also in a shard. Let's go through the different types of read Preferences that are available and what they mean.

* **ReadPreference.PRIMARY:** Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags **(This is the default.)**
* **ReadPreference.PRIMARY_PREFERRED:** Read from primary if available, otherwise a secondary.
* **ReadPreference.SECONDARY:** Read from secondary if available, otherwise error.
* **ReadPreference.SECONDARY_PREFERRED:** Read from a secondary if available, otherwise read from the primary.
* **ReadPreference.NEAREST:** All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection. The name NEAREST is chosen to emphasize its use, when latency is most important. For I/O-bound users who want to distribute reads across all members evenly regardless of ping time, set secondaryAcceptableLatencyMS very high. See "Ping Times" below. **A strategy must be enabled on the ReplSet instance to use NEAREST as it requires intermittent setTimeout events, see Db class documentation**

Additionally you can now use tags with all the read preferences to actively choose specific sets of servers in a replicatset or sharded system located in different data centers. The rules are fairly simple as outline below. A server member matches a tag set if its tags match all the tags in the set. For example, a member tagged **{ dc: 'ny', rack: 2, size: 'large' }** matches the tag set **{ dc: 'ny', rack: 2 }**. A member's extra tags don't affect whether it's a match.

Using a read preference is very simple. Below are some examples using it at the db level, collection level and individual query level as well as an example using tags.

Below is a simple example using readpreferences at the db level.

    var MongoClient = require('mongodb').MongoClient
      , format = require('util').format;

    var url = format("mongodb://%s,%s,%s/%s?replicaSet=%s&readPreference=%s"
      , "localhost:27017",
      , "localhost:27018"
      , "localhost:27019"
      , "exampleDb"
      , "foo"
      , "secondaryPreferred");

    MongoClient.connect(url, function(err db) {
      if(!err) {
        console.log("We are connected");
      }
    });

Below is a simple example using readpreferences at the collection level.

    var MongoClient = require('mongodb').MongoClient
      , format = require('util').format;

    var url = format("mongodb://%s,%s,%s/%s?replicaSet=%s&readPreference=%s"
      , "localhost:27017",
      , "localhost:27018"
      , "localhost:27019"
      , "exampleDb"
      , "foo"
      , "secondaryPreferred");

    MongoClient.connect(url, function(err db) {
      if(!err) {
        console.log("We are connected");

        var collection = db.collection('somecollection', {readPreference: ReadPreference.SECONDARY_PREFERRED});
        collection.find({}).toArray(function(err, items) {
          // Done reading from secondary if available
        })
      }
    });

Below is a simple example using readpreferences at the query level.

    var MongoClient = require('mongodb').MongoClient
      , format = require('util').format;

    var url = format("mongodb://%s,%s,%s/%s?replicaSet=%s&readPreference=%s"
      , "localhost:27017",
      , "localhost:27018"
      , "localhost:27019"
      , "exampleDb"
      , "foo"
      , "secondaryPreferred");

    MongoClient.connect(url, function(err db) {
      if(!err) {
        console.log("We are connected");

        var collection = db.collection('somecollection');
        collection.find({}).setReadPreference(new ReadPreference(ReadPreference.SECONDARY_PREFERRED)).toArray(function(err, items) {
          // Done reading from secondary if available
        })
      }
    });

Below is a simple example using a readpreference with tags at the query level. This example will pick from the set of servers tagged with **dc1:ny**.

    var MongoClient = require('mongodb').MongoClient
      , format = require('util').format;

    var url = format("mongodb://%s,%s,%s/%s?replicaSet=%s&readPreference=%s"
      , "localhost:27017",
      , "localhost:27018"
      , "localhost:27019"
      , "exampleDb"
      , "foo"
      , "secondaryPreferred");

    MongoClient.connect(url, function(err db) {
      if(!err) {
        console.log("We are connected");

        var collection = db.collection('somecollection');
        collection.find({}).setReadPreference(new ReadPreference(ReadPreference.SECONDARY_PREFERRED, {"dc1":"ny"})).toArray(function(err, items) {
          // Done reading from secondary if available
        })
      }
    });

## Mongos
There is now a seperate Server type for Mongos that handles not only Mongos read preferences for Mongo DB but also failover and picking the nearest Mongos proxy to your application. To use simply do

    var MongoClient = require('mongodb').MongoClient
      , format = require('util').format;

    var url = format("mongodb://%s,%s/%s"
      , "localhost:50000",
      , "localhost:50001"
      , "exampleDb");

    MongoClient.connect(url, function(err db) {
      if(!err) {
        console.log("We are connected");
      }

      db.close();
    });

Read preferences also work with Mongos from Mongo DB 2.2 or higher allowing you to create more complex deployment setups.

## Aggregation framework helper
The MongoDB aggregation framework provides a means to calculate aggregate values without having to use map-reduce. While map-reduce is powerful, using map-reduce is more difficult than necessary for many simple aggregation tasks, such as totaling or averaging field values.

The driver supports the aggregation framework by adding a helper at the collection level to execute an aggregation pipeline against the documents in that collection. Below is a simple example of using the aggregation framework to perform a group by tags.

    var MongoClient = require('mongodb').MongoClient;

    // Some docs for insertion
    var docs = [{
        title : "this is my title", author : "bob", posted : new Date() ,
        pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
        comments : [
          { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
        ]}];

    MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
      // Create a collection
      db.createCollection('test', function(err, collection) {
        // Insert the docs
        collection.insert(docs, {safe:true}, function(err, result) {

          // Execute aggregate, notice the pipeline is expressed as an Array
          collection.aggregate([
              { $project : {
                author : 1,
                tags : 1
              }},
              { $unwind : "$tags" },
              { $group : {
                _id : {tags : "$tags"},
                authors : { $addToSet : "$author" }
              }}
            ], function(err, result) {
              console.dir(result);
              db.close();
          });
        });
      });
    });

## Replicaset improvements and changes
Replicasets now return to the driver when a primary has been identified allowing for faster connect time meaning the application does not have to wait for the whole set to be identified before being able to run. That said any secondary queries using read preference **ReadPreference.SECONDARY** might fail until at least one secondary is up. To aid in development of layers above the driver now emits to new events.

* **open** is emitted when the driver is ready to be used.
* **fullsetup** is emitted once the whole replicaset is up and running

To ensure better control over timeouts when attempting to connect to replicaset members that might be down there is now two timeout settings.

* **connectTimeoutMS:** set the timeout for the intial connect to the mongod or mongos instance.
* **socketTimeoutMS:** set the timeout for established connections to the mongod or mongos instance.

## High availability "on" by default
The high availability code has been rewritten to run outside a setTimeout allowing for better control and handling. It's also on by default now. It can be disabled using the following settings on the ReplSet class.

 *  **ha** {Boolean, default:true}, turn on high availability.
 *  **haInterval** {Number, default:2000}, time between each replicaset status check.

 This allows the driver to discover new replicaset members or replicaset members who left the set and then returned.

## Better stream support for GridFS
GridFS now supports the streaming api's for node allowing you to pipe content either into or out of a Gridstore object making it easy to work with other streaming api's available.

A simple example is shown below for how to stream from a file on disk to a gridstore object.

    var MongoClient = require('mongodb').MongoClient
      , fs = require('fs')
      , GridStore = mongo.GridStore;

    // Some docs for insertion
    var docs = [{
        title : "this is my title", author : "bob", posted : new Date() ,
        pageViews : 5, tags : [ "fun" , "good" , "fun" ], other : { foo : 5 },
        comments : [
          { author :"joe", text : "this is cool" }, { author :"sam", text : "this is bad" }
        ]}];

    MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
      // Set up gridStore
      var gridStore = new GridStore(client, "test_stream_write", "w");
      // Create a file reader stream to an object
      var fileStream = fs.createReadStream("./test/gridstore/test_gs_working_field_read.pdf");
      gridStore.on("close", function(err) {
        // Just read the content and compare to the raw binary
        GridStore.read(client, "test_stream_write", function(err, gridData) {
          var fileData = fs.readFileSync("./test/gridstore/test_gs_working_field_read.pdf");
          test.deepEqual(fileData, gridData);
          test.done();
        })
      });

      // Pipe it through to the gridStore
      fileStream.pipe(gridStore);
    })

A simple example is shown below for how to stream from a gridfs file to a file on disk.

    var MongoClient = require('mongodb').MongoClient
      , fs = require('fs')
      , GridStore = mongo.GridStore;

    MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
      // Set up gridStore
      var gridStore = new GridStore(client, "test_stream_write_2", "w");
      gridStore.writeFile("./test/gridstore/test_gs_working_field_read.pdf", function(err, result) {
        // Open a readable gridStore
        gridStore = new GridStore(client, "test_stream_write_2", "r");
        // Create a file write stream
        var fileStream = fs.createWriteStream("./test_stream_write_2.tmp");
        fileStream.on("close", function(err) {
          // Read the temp file and compare
          var compareData = fs.readFileSync("./test_stream_write_2.tmp");
          var originalData = fs.readFileSync("./test/gridstore/test_gs_working_field_read.pdf");
          test.deepEqual(originalData, compareData);
          test.done();
        })
        // Pipe out the data
        gridStore.pipe(fileStream);
      });
    })

## toBSON method
If in an object now has a toBSON function it will be called to for custom serialization of the object instance. This can be used to just serialize wanted fields. Deserializing is not affected by this and the application is responsible for deflating objects again.

A simple example below

    var customObject = {
        a:1
        b:2
        toBSON: function() {
          return {a:this.a}
        }
      }

## Much faster BSON C++ parser
Thanks to the awesome people at Lucasfilm Singapore we have a new BSON C++ serializer/deserializer that performs on average 40-50% faster than the current implementation.

## Other minor changes
* Connection pool is now set to 5 by default. Override if there is need for either a bigger or smaller pool per node process.
* Gridfs now ensures an index on the chunks collection on file_id.


text:
function ipi = ipint32(a)
% IPDOUBLE Create a int32 type that supports inplace modification
% ipi = ipint32(v) creates an inplace int32 object from any int32
% matrix v.
%
% Example:
%    ipd = ipint32(ones(5));

ip = inplace(a);
ipi = class(struct([]),'ipint32',ip);