text:
use Adjustment;
use Orientable;
use ScrollType;
use SensitivityType;
use Widget;
use ffi;
use gdk;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use libc;
use signal::Inhibit;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;

glib_wrapper! {
    pub struct Range(Object<ffi::GtkRange>): Widget, Orientable;

    match fn {
        get_type => || ffi::gtk_range_get_type(),
    }
}

pub trait RangeExt {
    fn get_adjustment(&self) -> Adjustment;

    fn get_fill_level(&self) -> f64;

    fn get_flippable(&self) -> bool;

    fn get_inverted(&self) -> bool;

    fn get_lower_stepper_sensitivity(&self) -> SensitivityType;

    fn get_min_slider_size(&self) -> i32;

    fn get_range_rect(&self) -> gdk::Rectangle;

    fn get_restrict_to_fill_level(&self) -> bool;

    fn get_round_digits(&self) -> i32;

    fn get_show_fill_level(&self) -> bool;

    fn get_slider_range(&self) -> (i32, i32);

    fn get_slider_size_fixed(&self) -> bool;

    fn get_upper_stepper_sensitivity(&self) -> SensitivityType;

    fn get_value(&self) -> f64;

    fn set_adjustment(&self, adjustment: &Adjustment);

    fn set_fill_level(&self, fill_level: f64);

    fn set_flippable(&self, flippable: bool);

    fn set_increments(&self, step: f64, page: f64);

    fn set_inverted(&self, setting: bool);

    fn set_lower_stepper_sensitivity(&self, sensitivity: SensitivityType);

    fn set_min_slider_size(&self, min_size: i32);

    fn set_range(&self, min: f64, max: f64);

    fn set_restrict_to_fill_level(&self, restrict_to_fill_level: bool);

    fn set_round_digits(&self, round_digits: i32);

    fn set_show_fill_level(&self, show_fill_level: bool);

    fn set_slider_size_fixed(&self, size_fixed: bool);

    fn set_upper_stepper_sensitivity(&self, sensitivity: SensitivityType);

    fn set_value(&self, value: f64);

    fn connect_adjust_bounds<F: Fn(&Self, f64) + 'static>(&self, f: F) -> u64;

    fn connect_change_value<F: Fn(&Self, ScrollType, f64) -> Inhibit + 'static>(&self, f: F) -> u64;

    fn connect_move_slider<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> u64;

    fn connect_value_changed<F: Fn(&Self) + 'static>(&self, f: F) -> u64;
}

impl<O: IsA<Range> + IsA<glib::object::Object>> RangeExt for O {
    fn get_adjustment(&self) -> Adjustment {
        unsafe {
            from_glib_none(ffi::gtk_range_get_adjustment(self.to_glib_none().0))
        }
    }

    fn get_fill_level(&self) -> f64 {
        unsafe {
            ffi::gtk_range_get_fill_level(self.to_glib_none().0)
        }
    }

    fn get_flippable(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_range_get_flippable(self.to_glib_none().0))
        }
    }

    fn get_inverted(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_range_get_inverted(self.to_glib_none().0))
        }
    }

    fn get_lower_stepper_sensitivity(&self) -> SensitivityType {
        unsafe {
            from_glib(ffi::gtk_range_get_lower_stepper_sensitivity(self.to_glib_none().0))
        }
    }

    fn get_min_slider_size(&self) -> i32 {
        unsafe {
            ffi::gtk_range_get_min_slider_size(self.to_glib_none().0)
        }
    }

    fn get_range_rect(&self) -> gdk::Rectangle {
        unsafe {
            let mut range_rect = gdk::Rectangle::uninitialized();
            ffi::gtk_range_get_range_rect(self.to_glib_none().0, range_rect.to_glib_none_mut().0);
            range_rect
        }
    }

    fn get_restrict_to_fill_level(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_range_get_restrict_to_fill_level(self.to_glib_none().0))
        }
    }

    fn get_round_digits(&self) -> i32 {
        unsafe {
            ffi::gtk_range_get_round_digits(self.to_glib_none().0)
        }
    }

    fn get_show_fill_level(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_range_get_show_fill_level(self.to_glib_none().0))
        }
    }

    fn get_slider_range(&self) -> (i32, i32) {
        unsafe {
            let mut slider_start = mem::uninitialized();
            let mut slider_end = mem::uninitialized();
            ffi::gtk_range_get_slider_range(self.to_glib_none().0, &mut slider_start, &mut slider_end);
            (slider_start, slider_end)
        }
    }

    fn get_slider_size_fixed(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_range_get_slider_size_fixed(self.to_glib_none().0))
        }
    }

    fn get_upper_stepper_sensitivity(&self) -> SensitivityType {
        unsafe {
            from_glib(ffi::gtk_range_get_upper_stepper_sensitivity(self.to_glib_none().0))
        }
    }

    fn get_value(&self) -> f64 {
        unsafe {
            ffi::gtk_range_get_value(self.to_glib_none().0)
        }
    }

    fn set_adjustment(&self, adjustment: &Adjustment) {
        unsafe {
            ffi::gtk_range_set_adjustment(self.to_glib_none().0, adjustment.to_glib_none().0);
        }
    }

    fn set_fill_level(&self, fill_level: f64) {
        unsafe {
            ffi::gtk_range_set_fill_level(self.to_glib_none().0, fill_level);
        }
    }

    fn set_flippable(&self, flippable: bool) {
        unsafe {
            ffi::gtk_range_set_flippable(self.to_glib_none().0, flippable.to_glib());
        }
    }

    fn set_increments(&self, step: f64, page: f64) {
        unsafe {
            ffi::gtk_range_set_increments(self.to_glib_none().0, step, page);
        }
    }

    fn set_inverted(&self, setting: bool) {
        unsafe {
            ffi::gtk_range_set_inverted(self.to_glib_none().0, setting.to_glib());
        }
    }

    fn set_lower_stepper_sensitivity(&self, sensitivity: SensitivityType) {
        unsafe {
            ffi::gtk_range_set_lower_stepper_sensitivity(self.to_glib_none().0, sensitivity.to_glib());
        }
    }

    fn set_min_slider_size(&self, min_size: i32) {
        unsafe {
            ffi::gtk_range_set_min_slider_size(self.to_glib_none().0, min_size);
        }
    }

    fn set_range(&self, min: f64, max: f64) {
        unsafe {
            ffi::gtk_range_set_range(self.to_glib_none().0, min, max);
        }
    }

    fn set_restrict_to_fill_level(&self, restrict_to_fill_level: bool) {
        unsafe {
            ffi::gtk_range_set_restrict_to_fill_level(self.to_glib_none().0, restrict_to_fill_level.to_glib());
        }
    }

    fn set_round_digits(&self, round_digits: i32) {
        unsafe {
            ffi::gtk_range_set_round_digits(self.to_glib_none().0, round_digits);
        }
    }

    fn set_show_fill_level(&self, show_fill_level: bool) {
        unsafe {
            ffi::gtk_range_set_show_fill_level(self.to_glib_none().0, show_fill_level.to_glib());
        }
    }

    fn set_slider_size_fixed(&self, size_fixed: bool) {
        unsafe {
            ffi::gtk_range_set_slider_size_fixed(self.to_glib_none().0, size_fixed.to_glib());
        }
    }

    fn set_upper_stepper_sensitivity(&self, sensitivity: SensitivityType) {
        unsafe {
            ffi::gtk_range_set_upper_stepper_sensitivity(self.to_glib_none().0, sensitivity.to_glib());
        }
    }

    fn set_value(&self, value: f64) {
        unsafe {
            ffi::gtk_range_set_value(self.to_glib_none().0, value);
        }
    }

    fn connect_adjust_bounds<F: Fn(&Self, f64) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&Self, f64) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "adjust-bounds",
                transmute(adjust_bounds_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_change_value<F: Fn(&Self, ScrollType, f64) -> Inhibit + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&Self, ScrollType, f64) -> Inhibit + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "change-value",
                transmute(change_value_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_move_slider<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&Self, ScrollType) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "move-slider",
                transmute(move_slider_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_value_changed<F: Fn(&Self) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "value-changed",
                transmute(value_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }
}

unsafe extern "C" fn adjust_bounds_trampoline<P>(this: *mut ffi::GtkRange, value: libc::c_double, f: glib_ffi::gpointer)
where P: IsA<Range> {
    callback_guard!();
    let f: &Box_<Fn(&P, f64) + 'static> = transmute(f);
    f(&Range::from_glib_none(this).downcast_unchecked(), value)
}

unsafe extern "C" fn change_value_trampoline<P>(this: *mut ffi::GtkRange, scroll: ffi::GtkScrollType, value: libc::c_double, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<Range> {
    callback_guard!();
    let f: &Box_<Fn(&P, ScrollType, f64) -> Inhibit + 'static> = transmute(f);
    f(&Range::from_glib_none(this).downcast_unchecked(), from_glib(scroll), value).to_glib()
}

unsafe extern "C" fn move_slider_trampoline<P>(this: *mut ffi::GtkRange, step: ffi::GtkScrollType, f: glib_ffi::gpointer)
where P: IsA<Range> {
    callback_guard!();
    let f: &Box_<Fn(&P, ScrollType) + 'static> = transmute(f);
    f(&Range::from_glib_none(this).downcast_unchecked(), from_glib(step))
}

unsafe extern "C" fn value_changed_trampoline<P>(this: *mut ffi::GtkRange, f: glib_ffi::gpointer)
where P: IsA<Range> {
    callback_guard!();
    let f: &Box_<Fn(&P) + 'static> = transmute(f);
    f(&Range::from_glib_none(this).downcast_unchecked())
}


text:
//// [index.d.ts]
// Secondary references may be duplicated if they agree in content

/// <reference types="alpha" />
declare var foo: any;

//// [index.d.ts]
declare var alpha: any;

//// [index.d.ts]
/// <reference types="alpha" />
declare var bar: any;

//// [index.d.ts]
declare var alpha: any;

//// [root.ts]
/// <reference types="foo" />
/// <reference types="bar" />

//// [root.js]
/// <reference types="foo" />
/// <reference types="bar" />

redpajama_set_name: RedPajamaGithub


text:
var ModalViewModel = require('../../../../../javascripts/cartodb3/components/modals/modal-view-model');

describe('components/modals/modal-view-model', function () {
  beforeEach(function () {
    this.createContentViewResult = {};
    this.createContentView = jasmine.createSpy('createContentView').and.returnValue(this.createContentViewResult);
    this.model = new ModalViewModel({
      createContentView: this.createContentView
    });
  });

  it('should allow show/hide modal', function () {
    expect(this.model.get('show')).toBe(true);
    expect(this.model.isHidden()).toBe(false);

    this.model.hide();
    expect(this.model.get('show')).toBe(false);
    expect(this.model.isHidden()).toBe(true);

    this.model.show();
    expect(this.model.get('show')).toBe(true);
    expect(this.model.isHidden()).toBe(false);
  });

  describe('.createContentView', function () {
    beforeEach(function () {
      this.view = this.model.createContentView();
    });

    it('should create content view given viewModel', function () {
      expect(this.createContentView).toHaveBeenCalled();
      expect(this.createContentView).toHaveBeenCalledWith(this.model);
    });

    it('should return created view', function () {
      expect(this.view).toBe(this.createContentViewResult);
    });
  });
});


text:
using Xunit;

[assembly: CollectionBehavior(CollectionBehavior.CollectionPerClass)]


text:
import copy
import pytest

from configuration import available_ports, PROTOCOLS
from common import ProviderOptions, Ciphers, Certificates, data_bytes
from fixtures import managed_process
from providers import Provider, S2N, OpenSSL
from utils import invalid_test_parameters, get_parameter_name, get_expected_s2n_version, to_bytes

def multi_cipher_name(c):
    return ':'.join([x.name for x in c])

multi_cipher = [Ciphers.AES256_SHA, Ciphers.ECDHE_ECDSA_AES256_SHA]
@pytest.mark.uncollect_if(func=invalid_test_parameters)
@pytest.mark.parametrize("multi_cipher", [multi_cipher], ids=multi_cipher_name)
@pytest.mark.parametrize("provider", [OpenSSL])
@pytest.mark.parametrize("protocol", PROTOCOLS, ids=get_parameter_name)
@pytest.mark.parametrize("certificate", [Certificates.RSA_4096_SHA384, Certificates.ECDSA_384], ids=get_parameter_name)
def test_s2n_server_low_latency(managed_process, multi_cipher, provider, protocol, certificate):
    if provider is OpenSSL and 'openssl-1.0.2' in provider.get_version():
        pytest.skip('{} does not allow setting max fragmentation for packets'.format(provider))

    port = next(available_ports)

    random_bytes = data_bytes(65519)
    client_options = ProviderOptions(
        mode=Provider.ClientMode,
        port=port,
        cipher=multi_cipher,
        data_to_send=random_bytes,
        insecure=True,
        protocol=protocol)

    server_options = copy.copy(client_options)
    server_options.data_to_send = None
    server_options.mode = Provider.ServerMode
    server_options.extra_flags = ['--prefer-low-latency']
    server_options.key = certificate.key
    server_options.cert = certificate.cert
    server_options.cipher = None

    server = managed_process(S2N, server_options, timeout=5)
    client = managed_process(provider, client_options, timeout=5)

    for results in client.get_results():
        results.assert_success()

    expected_version = get_expected_s2n_version(protocol, provider)

    for results in server.get_results():
        results.assert_success()
        assert to_bytes("Actual protocol version: {}".format(expected_version)) in results.stdout
        assert random_bytes in results.stdout

@pytest.mark.uncollect_if(func=invalid_test_parameters)
@pytest.mark.parametrize("multi_cipher", [multi_cipher], ids=multi_cipher_name)
@pytest.mark.parametrize("provider", [OpenSSL])
@pytest.mark.parametrize("protocol", PROTOCOLS, ids=get_parameter_name)
@pytest.mark.parametrize("certificate", [Certificates.RSA_4096_SHA384, Certificates.ECDSA_384], ids=get_parameter_name)
@pytest.mark.parametrize("frag_len", [512, 2048, 8192, 12345, 16384], ids=get_parameter_name)
def test_s2n_server_framented_data(managed_process, multi_cipher, provider, protocol, frag_len, certificate):
    if provider is OpenSSL and 'openssl-1.0.2' in provider.get_version():
        pytest.skip('{} does not allow setting max fragmentation for packets'.format(provider))

    port = next(available_ports)

    random_bytes = data_bytes(65519)
    client_options = ProviderOptions(
        mode=Provider.ClientMode,
        port=port,
        cipher=multi_cipher,
        data_to_send=random_bytes,
        insecure=True,
        extra_flags=['-max_send_frag', str(frag_len)],
        protocol=protocol)

    server_options = copy.copy(client_options)
    server_options.extra_flags = None
    server_options.data_to_send = None
    server_options.mode = Provider.ServerMode
    server_options.key = certificate.key
    server_options.cert = certificate.cert
    server_options.cipher = None

    server = managed_process(S2N, server_options, timeout=5)
    client = managed_process(provider, client_options, timeout=5)

    for results in client.get_results():
        results.assert_success()

    expected_version = get_expected_s2n_version(protocol, provider)

    for results in server.get_results():
        results.assert_success()
        assert to_bytes("Actual protocol version: {}".format(expected_version)) in results.stdout
        assert random_bytes in results.stdout


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

import java.math.*;

import javax.annotation.Generated;

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

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

/**
 * GetSatelliteResult JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetSatelliteResultJsonUnmarshaller implements Unmarshaller<GetSatelliteResult, JsonUnmarshallerContext> {

    public GetSatelliteResult unmarshall(JsonUnmarshallerContext context) throws Exception {
        GetSatelliteResult getSatelliteResult = new GetSatelliteResult();

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

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

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

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("dateCreated", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult.setDateCreated(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));
                }
                if (context.testExpression("lastUpdated", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult.setLastUpdated(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));
                }
                if (context.testExpression("noradSatelliteID", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult.setNoradSatelliteID(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("satelliteArn", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult.setSatelliteArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("satelliteId", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult.setSatelliteId(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("tags", targetDepth)) {
                    context.nextToken();
                    getSatelliteResult
                            .setTags(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class))
                                    .unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return getSatelliteResult;
    }

    private static GetSatelliteResultJsonUnmarshaller instance;

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


text:
<?php

namespace Minsal\shcpBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * ShcpParPresent
 *
 * @ORM\Table(name="shcp_par_present", indexes={@ORM\Index(name="IDX_6181903CD766E548", columns={"id_admision_parto"})})
 * @ORM\Entity
 */
class ShcpParPresent
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @ORM\SequenceGenerator(sequenceName="shcp_par_present_id_seq", allocationSize=1, initialValue=1)
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="pres_edad_gesta_sem", type="integer", nullable=true)
     */
    private $presEdadGestaSem;

    /**
     * @var integer
     *
     * @ORM\Column(name="pres_edad_gesta_dias", type="integer", nullable=true)
     */
    private $presEdadGestaDias;

    /**
     * @var string
     *
     * @ORM\Column(name="pres_basado_en", type="string", nullable=true)
     */
    private $presBasadoEn;

    /**
     * @var string
     *
     * @ORM\Column(name="pres_present_situacion", type="string", nullable=true)
     */
    private $presPresentSituacion;

    /**
     * @var string
     *
     * @ORM\Column(name="pres_tam_fetal_acorde", type="string", nullable=true)
     */
    private $presTamFetalAcorde;

    /**
     * @var string
     *
     * @ORM\Column(name="pres_acomp_trabajo_parto", type="string", nullable=true)
     */
    private $presAcompTrabajoParto;

    /**
     * @var string
     *
     * @ORM\Column(name="pres_acomp_parto", type="string", nullable=true)
     */
    private $presAcompParto;

    /**
     * @var \ShcpParAdmision
     *
     * @ORM\OneToOne(targetEntity="ShcpParAdmision", inversedBy="present")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="id_admision_parto", referencedColumnName="id")
     * })
     */
    private $idAdmisionParto;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set presEdadGestaSem
     *
     * @param integer $presEdadGestaSem
     * @return ShcpParPresent
     */
    public function setPresEdadGestaSem($presEdadGestaSem)
    {
        $this->presEdadGestaSem = $presEdadGestaSem;

        return $this;
    }

    /**
     * Get presEdadGestaSem
     *
     * @return integer
     */
    public function getPresEdadGestaSem()
    {
        return $this->presEdadGestaSem;
    }

    /**
     * Set presEdadGestaDias
     *
     * @param integer $presEdadGestaDias
     * @return ShcpParPresent
     */
    public function setPresEdadGestaDias($presEdadGestaDias)
    {
        $this->presEdadGestaDias = $presEdadGestaDias;

        return $this;
    }

    /**
     * Get presEdadGestaDias
     *
     * @return integer
     */
    public function getPresEdadGestaDias()
    {
        return $this->presEdadGestaDias;
    }

    /**
     * Set presBasadoEn
     *
     * @param string $presBasadoEn
     * @return ShcpParPresent
     */
    public function setPresBasadoEn($presBasadoEn)
    {
        $this->presBasadoEn = $presBasadoEn;

        return $this;
    }

    /**
     * Get presBasadoEn
     *
     * @return string
     */
    public function getPresBasadoEn()
    {
        return $this->presBasadoEn;
    }

    /**
     * Set presPresentSituacion
     *
     * @param string $presPresentSituacion
     * @return ShcpParPresent
     */
    public function setPresPresentSituacion($presPresentSituacion)
    {
        $this->presPresentSituacion = $presPresentSituacion;

        return $this;
    }

    /**
     * Get presPresentSituacion
     *
     * @return string
     */
    public function getPresPresentSituacion()
    {
        return $this->presPresentSituacion;
    }

    /**
     * Set presTamFetalAcorde
     *
     * @param string $presTamFetalAcorde
     * @return ShcpParPresent
     */
    public function setPresTamFetalAcorde($presTamFetalAcorde)
    {
        $this->presTamFetalAcorde = $presTamFetalAcorde;

        return $this;
    }

    /**
     * Get presTamFetalAcorde
     *
     * @return string
     */
    public function getPresTamFetalAcorde()
    {
        return $this->presTamFetalAcorde;
    }

    /**
     * Set presAcompTrabajoParto
     *
     * @param string $presAcompTrabajoParto
     * @return ShcpParPresent
     */
    public function setPresAcompTrabajoParto($presAcompTrabajoParto)
    {
        $this->presAcompTrabajoParto = $presAcompTrabajoParto;

        return $this;
    }

    /**
     * Get presAcompTrabajoParto
     *
     * @return string
     */
    public function getPresAcompTrabajoParto()
    {
        return $this->presAcompTrabajoParto;
    }

    /**
     * Set presAcompParto
     *
     * @param string $presAcompParto
     * @return ShcpParPresent
     */
    public function setPresAcompParto($presAcompParto)
    {
        $this->presAcompParto = $presAcompParto;

        return $this;
    }

    /**
     * Get presAcompParto
     *
     * @return string
     */
    public function getPresAcompParto()
    {
        return $this->presAcompParto;
    }

    /**
     * Set idAdmisionParto
     *
     * @param \Minsal\shcpBundle\Entity\ShcpParAdmision $idAdmisionParto
     * @return ShcpParPresent
     */
    public function setIdAdmisionParto(\Minsal\shcpBundle\Entity\ShcpParAdmision $idAdmisionParto = null)
    {
        $this->idAdmisionParto = $idAdmisionParto;

        return $this;
    }

    /**
     * Get idAdmisionParto
     *
     * @return \Minsal\shcpBundle\Entity\ShcpParAdmision
     */
    public function getIdAdmisionParto()
    {
        return $this->idAdmisionParto;
    }
}


text:
<?php

namespace UserlandSession\Tests\Storage;

use UserlandSession\Handler\PdoHandler;
use UserlandSession\BuiltIns;

class PdoHandlerTest extends \PHPUnit_Framework_TestCase {

    /**
     * @var PdoHandler
     */
    protected $handler;

    /**
     * @var string[]
     */
    protected $params;

    /**
     * @var \PDO
     */
    protected $pdo;

    function setUp() {
        BuiltIns::reset();

        $this->params = (require __DIR__ . '/../../../db_params.php');

        $p = $this->params;
        $dsn = "{$p['driver']}:host={$p['host']};dbname={$p['dbname']};charset=UTF8";
        $username = $p['username'];
        $password = $p['password'];
        $this->pdo = new \PDO($dsn, $username, $password);

        $this->handler = new PdoHandler(array(
            'table' => $this->params['table'],
            'pdo' => $this->pdo,
        ));
        $this->handler->open(null, 'name');
    }

    function tearDown() {
        $this->pdo->query("TRUNCATE TABLE `{$this->params['table']}`");
        BuiltIns::reset();
    }

    function testParamsConstructor() {
        $p = $this->params;
        $storage = new PdoHandler(array(
            'table' => $p['table'],
            'dsn' => "{$p['driver']}:host={$p['host']};dbname={$p['dbname']};charset=UTF8",
            'username' => $p['username'],
            'password' => $p['password'],
        ));
        $storage->open(null, 'name');
        $storage->write('foo', 'bar');
        $this->assertSame('bar', $storage->read('foo'));
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    function testMissingTable() {
        new PdoHandler(array(
            'pdo' => $this->pdo,
        ));
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    function testBadPdoType() {
        new PdoHandler(array(
            'table' => $this->params['table'],
            'pdo' => 'not a PDO',
        ));
    }

    function testOpen() {
        $this->handler->close();
        $this->assertTrue($this->handler->open(null, 'name'));
    }

    function testClose() {
        $this->assertTrue($this->handler->close());
    }

    function testReadWrite() {
        $this->assertFalse($this->handler->read('foo'));

        $this->handler->write('foo', 'bar');
        $this->assertSame('bar', $this->handler->read('foo'));
    }

    function testDestroy() {
        $this->handler->write('foo', 'bar');

        $this->assertFalse($this->handler->destroy('goo'));
        $this->assertTrue($this->handler->destroy('foo'));
        $this->assertFalse($this->handler->read('foo'));
    }

    function testGc() {
        BuiltIns::getInstance()->timeOffset = -3600;
        $this->handler->write('60mago', 'bar');

        BuiltIns::getInstance()->timeOffset = -1800;
        $this->handler->write('30mago', 'bar');

        BuiltIns::getInstance()->timeOffset = 0;
        $this->handler->write('now', 'bar');

        $this->handler->gc(3000);
        $this->assertFalse($this->handler->read('60mago'));
        $this->assertSame('bar', $this->handler->read('30mago'));
        $this->assertSame('bar', $this->handler->read('now'));

        $this->handler->gc(900);
        $this->assertFalse($this->handler->read('30mago'));
        $this->assertSame('bar', $this->handler->read('now'));

        BuiltIns::getInstance()->timeOffset = 30;
        $this->handler->gc(0);
        $this->assertFalse($this->handler->read('now'));
    }

    function testBinaryData() {
        $expected = array(
            'Valid ASCII' => "a",
            'Valid 2 Octet Sequence' => "\xc3\xb1",
            'Invalid 2 Octet Sequence' => "\xc3\x28",
            'Invalid Sequence Identifier' => "\xa0\xa1",
            'Valid 3 Octet Sequence' => "\xe2\x82\xa1",
            'Invalid 3 Octet Sequence (in 2nd Octet)' => "\xe2\x28\xa1",
            'Invalid 3 Octet Sequence (in 3rd Octet)' => "\xe2\x82\x28",
            'Valid 4 Octet Sequence' => "\xf0\x90\x8c\xbc",
            'Invalid 4 Octet Sequence (in 2nd Octet)' => "\xf0\x28\x8c\xbc",
            'Invalid 4 Octet Sequence (in 3rd Octet)' => "\xf0\x90\x28\xbc",
            'Invalid 4 Octet Sequence (in 4th Octet)' => "\xf0\x28\x8c\x28",
            'Valid 5 Octet Sequence (but not Unicode!)' => "\xf8\xa1\xa1\xa1\xa1",
            'Valid 6 Octet Sequence (but not Unicode!)' => "\xfc\xa1\xa1\xa1\xa1\xa1",
        );
        $this->handler->write('foo', serialize($expected));

        $returned = unserialize($this->handler->read('foo'));

        $this->assertSame($expected, $returned);
    }
}


text:
@interface MessagingManager (Test)
- (void)connectClientWithCompletion:(void(^)(BOOL succeeded, NSError *error))handler;
@end

@interface MessagingManagerLoginTests : XCTestCase
@property (strong, nonatomic) id messagingManagerMock;
@property (strong, nonatomic) id sessionManagerMock;
@property (copy, nonatomic) NSString *username;
@property (copy, nonatomic) NSString *token;
@property (strong, nonatomic) NSError *error;
@end

@implementation MessagingManagerLoginTests

- (void)setUp {
  [super setUp];

  self.messagingManagerMock = OCMPartialMock([MessagingManager sharedManager]);
  self.sessionManagerMock = self.sessionManagerMock = OCMClassMock([SessionManager class]);

  self.username = @"hello";

  self.error = [NSError errorWithDomain:@"" code:400 userInfo:nil];

  self.token = @"test-token";
}

- (void)tearDown {
  [super tearDown];
  [self.sessionManagerMock stopMocking];
  [self.messagingManagerMock stopMocking];
}

- (void)testLoginUser {
  [self prepareLoginWithSuccessStatus:YES clientStatus:YES];
  [self.messagingManagerMock loginWithUsername:self.username
                                    completion:^(BOOL succeeded, NSError *error) {
                                      XCTAssertTrue(succeeded, @"Login should be successful");
                                    }];
  OCMVerifyAll(self.sessionManagerMock);
  OCMVerifyAll(self.messagingManagerMock);
}

- (void)testLoginUserWithFailedClient {
  [self prepareLoginWithSuccessStatus:YES clientStatus:NO];
  [self.messagingManagerMock loginWithUsername:self.username
                                    completion:^(BOOL succeeded, NSError *error) {
                                      XCTAssertNotNil(error, @"Login should fail");
                                    }];
  OCMVerifyAll(self.sessionManagerMock);
  OCMVerifyAll(self.messagingManagerMock);
}

- (void)prepareLoginWithSuccessStatus:(BOOL)status clientStatus:(BOOL)clientStatus {
  if (status) {
    [self prepareClientConnectStatus:clientStatus];
  }

  OCMExpect([self.sessionManagerMock loginWithUsername:self.username]);
}

- (void)prepareClientConnectStatus:(BOOL)status {
  id connectBlock = nil;

  if (status) {
    connectBlock = [OCMArg invokeBlockWithArgs:OCMOCK_VALUE((BOOL){YES}), [OCMArg defaultValue], nil];
  }
  else {
    connectBlock = [OCMArg invokeBlockWithArgs:OCMOCK_VALUE((BOOL){NO}), self.error, nil];
  }

  OCMExpect([self.messagingManagerMock connectClientWithCompletion:connectBlock]);
}

@end


text:
// Originally submitted to OSEHRA 2/21/2017 by DSS, Inc.
// Authored by DSS, Inc. 2014-2017

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VA.Gov.Artemis.Commands.Dsio.Notes
{
    /// <summary>
    /// Class to hold discrete data for a note
    /// </summary>
    ///
    public class DsioNoteData: Dictionary<string, string>
    {
        /// <summary>
        /// Creates object from plain Dictionary<string, string> object
        /// </summary>
        /// <param name="original">The Dictionary<string, string> which the DsioNoteData will be based on</param>
        /// <returns>A new DsioNoteData</returns>
        public static DsioNoteData FromDictionary(Dictionary<string, string> original)
        {
            // *** Create from plain dictionary ***

            DsioNoteData returnData = new DsioNoteData();

            if (original != null)
                if (original.Count > 0)
                    foreach (string key in original.Keys)
                        if (key.Length > 30)
                            throw new ArgumentException();
                        else
                            returnData.Add(key, original[key]);

            return returnData;
        }

        /// <summary>
        /// Gets the parameter as expected by DSIO RPC's
        /// </summary>
        /// <returns>A string array which can be passed to VistA RPC's</returns>
        public string[] ToParameter()
        {
            List<string> returnList = new List<string>();

            // Format is Type^ID^Field^Value
            // Type: S = Single, M = Multiple, WP = Word Processing
            // ID: Needed as consolidating ID for multiples

            //(S,M,WP)^CONTROL^LABEL 1^SOME VALUE^INDEX^NOTE TEXT

            //(S,M,WP)^CONTROL^LABEL 1^INDEX(OPTIONAL ONLY FOR M)^VALUE

            // S^COVERAGE_1^COVERAGE_1^^False

            //foreach (string key in this.Keys)
            //    returnList.Add(string.Format("{0}^{1}^{2}^{3}^{4}", "S", key.ToUpper(), key.ToUpper(),"", this[key]));

            // *** Changes for DSIO_DDCS_2_T1.KID
            //CONTROL^(INDEXED^VALUE)

            foreach (string key in this.Keys)
                returnList.Add(string.Format("{0}^^{1}", key.ToUpper(), this[key]));

            return returnList.ToArray();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Serenity.Web.Forms
{
    public class TableHeader : TableCell
    {
        public TableHeader()
        {
        }
        public TableHeader(params Control[] contents)
            : base(contents)
        {
        }
        public TableHeader(string content)
            : base(new TextControl(content))
        {

        }
        protected override string DefaultName
        {
            get
            {
                return "th";
            }
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <solid android:color="#00000000" />

</shape><!-- From: file:/C:/Users/12125/Desktop/OCR/textfairy/app/src/main/res/drawable/default_thumbnail.xml -->


text:
require 'ancestry'

module Transit
  class Page < ApplicationRecord

    include Transit::Model

    # All pages should use publishing, slugs, and tracking
    transit :publishable,
            sluggable: ':name'

    validates :title, :name, :slug, presence: true
    validate :slug_is_unique
    validates :identifier, uniqueness: true

    before_validation :sanitize_slug
    before_validation :generate_identifier

    serialize :keywords
    has_ancestry orphan_strategy: :rootify, cache_depth: true

    has_many :attachments, class_name: "Transit::Media", as: :attachable

    scope :top_level, -> { roots }

    ##
    # The absolute path to this page
    #
    def absolute_path
      File.join('/', Transit.config.inherit_parent_slugs ? absolute_path_with_ancestry : self.slug.to_s)
    end

    ##
    # Used to set keywords via comma separated string
    #
    def keyword_list=(words)
      self.keywords = words.split(",").compact.map!(&:strip)
    end

    ##
    # Display keywords as a comma separated string.
    #
    def keyword_list
      [self.keywords].flatten.compact.join(",")
    end

    ##
    # Does this page have children?
    #
    def pages?
      self.children.exists?
    end

    ##
    # When explicitly publishing pages,
    # deploy all region changes.
    #
    def publish!
      update(region_data: region_draft)
      super
    end

    ##
    # Build regions from the stored data hash.
    #
    def regions
      RegionBuilder.new(self.region_data || self.region_draft_data)
    end

    private

    ##
    # When inherit_parent_slugs is enabled, the absolute_path for
    # this page should include slugs from its parents.
    #
    def absolute_path_with_ancestry
      [self.ancestors(:to_depth => self.depth).pluck(:slug), self.slug].flatten.compact.map do |part|
        sanitize_uri_fragment(part)
      end.reject(&:blank?)
    end

    ##
    # If an identifier hasn't been set, auto-generate
    # one from the name of the page.
    #
    def generate_identifier
      self.identifier ||= self.name.to_s.to_slug.underscore
    end

    ##
    # In the event slugs are entered by end-users, this ensures they are
    # always truncated to non-absolute paths.
    #
    # If inherit_parent_slugs is enabled, it also ensures that the parent slug
    # isnt stored as part of the slug.
    #
    # Also generates the full path.
    #
    def sanitize_slug
      return true unless self.slug.present?
      if Transit.config.inherit_parent_slugs && self.parent.present?
        slug_parts   = self.slug.to_s.split("/").compact
        parent_parts = self.ancestors(:to_depth => self.depth).pluck(:slug).reverse
        self.slug    = slug_parts.drop_while{ |part| part == parent_parts.shift }.join("/")
      end
      self.slug      = sanitize_uri_fragment(self.slug)
      self.full_path = self.absolute_path.sub(/^\//, '')
    end

    ##
    # Check for unique slugs. Within the base install, this method
    # is simply stubbed out. It exists to allow uniqueness checking
    # from extensions/additional engines etc.
    #
    def slug_is_unique
      true
    end

    ##
    # Removes protocols, and invalid characters from a url fragment
    # @param [String] frag The fragment to sanitize
    #
    def sanitize_uri_fragment(frag)
      return nil if frag.nil?
      frag   = frag.gsub(/^(http|ftp|sftp|file)?:?(\/{1,2})?/i, "")
      parts  = frag.split("/")
      parts.shift if (parts.size > 1 && parts.first =~ /.*(\.)[a-z]{2,4}/i)
      parts.join("/")
    end

  end
end


text:
package com.intellij.openapi.util;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ReflectionUtil;
import org.jdom.Element;
import org.jdom.IllegalDataException;
import org.jetbrains.annotations.NotNull;

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

@SuppressWarnings({"HardCodedStringLiteral"})
@Deprecated
public class JDOMExternalizableStringList extends ArrayList<String> implements JDOMExternalizable {
  private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.JDOMExternalizableStringList");

  private static final String ATTR_LIST = "list";
  private static final String ATTR_LISTSIZE = "size";
  private static final String ATTR_ITEM = "item";
  private static final String ATTR_INDEX = "index";
  private static final String ATTR_CLASS = "class";
  private static final String ATTR_VALUE = "itemvalue";

  public JDOMExternalizableStringList(int initialCapacity) {
    super(initialCapacity);
  }

  public JDOMExternalizableStringList() {
  }

  public JDOMExternalizableStringList(@NotNull Collection<? extends String> c) {
    super(c);
  }

  @Override
  public void readExternal(Element element) {
    readList(this, element);
  }

  public static void readList(@NotNull List<String> strings, Element element) {
    strings.clear();

    Class callerClass = null;
    for (Element listElement : element.getChildren(ATTR_LIST)) {
      if (callerClass == null) {
        callerClass = ReflectionUtil.findCallerClass(2);
        assert callerClass != null;
      }
      final ClassLoader classLoader = callerClass.getClassLoader();
      for (Element listItemElement : listElement.getChildren(ATTR_ITEM)) {
        if (!ATTR_ITEM.equals(listItemElement.getName())) {
          throw new IllegalDataException("Unable to read list item. Unknown element found: " + listItemElement.getName());
        }
        String itemClassString = listItemElement.getAttributeValue(ATTR_CLASS);
        Class itemClass;
        try {
          itemClass = Class.forName(itemClassString, true, classLoader);
        }
        catch (ClassNotFoundException ex) {
          throw new IllegalDataException("Unable to read list item: unable to load class: " + itemClassString + " \n" + ex.getMessage());
        }

        String listItem = listItemElement.getAttributeValue(ATTR_VALUE);

        LOG.assertTrue(String.class.equals(itemClass));

        strings.add(listItem);
      }
    }
  }

  @Override
  public void writeExternal(Element element) {
    writeList(this, element);
  }

  public static void writeList(@NotNull List<String> strings, @NotNull Element element) {
    int listSize = strings.size();
    Element listElement = new Element(ATTR_LIST);
    listElement.setAttribute(ATTR_LISTSIZE, Integer.toString(listSize));
    element.addContent(listElement);
    for (int i = 0; i < listSize; i++) {
      String listItem = strings.get(i);
      if (listItem != null) {
        Element itemElement = new Element(ATTR_ITEM);
        itemElement.setAttribute(ATTR_INDEX, Integer.toString(i));
        itemElement.setAttribute(ATTR_CLASS, listItem.getClass().getName());
        itemElement.setAttribute(ATTR_VALUE, DefaultJDOMExternalizer.filterXMLCharacters(listItem));
        listElement.addContent(itemElement);
      }
    }
  }
}


text:
#region Usings

using System;
using System.Linq;
using System.Collections.Generic;

using org.GraphDefined.Vanaheimr.Illias;
using org.GraphDefined.Vanaheimr.Illias.Votes;
using org.GraphDefined.Vanaheimr.Illias.Collections;

#endregion

namespace org.GraphDefined.Vanaheimr.Balder.InMemory
{

    /// <summary>
    /// The abstract graph element is the base class for all property graph elements:
    /// The vertices, edges, multiedges, hyperedges and the property graph itself.
    /// </summary>
    /// <typeparam name="TId">The graph element identification.</typeparam>
    /// <typeparam name="TRevId">The graph element revision identification.</typeparam>
    /// <typeparam name="TLabel">The type of the graph element label.</typeparam>
    /// <typeparam name="TKey">The type of the graph element property keys.</typeparam>
    /// <typeparam name="TValue">The type of the graph element property values.</typeparam>
    public abstract class AGraphElement<TId, TRevId, TLabel, TKey, TValue>
                              : IGraphElement<TId, TRevId, TLabel, TKey, TValue>

        where TId     : IEquatable<TId>,    IComparable<TId>,    IComparable, TValue
        where TRevId  : IEquatable<TRevId>, IComparable<TRevId>, IComparable, TValue
        where TLabel  : IEquatable<TLabel>, IComparable<TLabel>, IComparable, TValue
        where TKey    : IEquatable<TKey>,   IComparable<TKey>,   IComparable

    {

        #region Data

        /// <summary>
        /// Good for explicit locking of this object
        /// during complex operations.
        /// </summary>
        protected readonly Object LockObject;

        /// <summary>
        /// The datastructure holding all graph properties.
        /// </summary>
        protected readonly IDictionary<TKey, TValue> PropertyData;

        /// <summary>
        /// A delegate to create a new vote.
        /// </summary>
        private readonly Func<IVote<Boolean>> VoteCreator;

        #endregion

        #region Properties

        #region IdKey

        /// <summary>
        /// The property key of the identification.
        /// </summary>
        public TKey IdKey { get; private set; }

        #endregion

        #region Id

        /// <summary>
        /// An identifier that is unique to its inheriting class.
        /// All vertices, edges, multiedges and hyperedges of a graph must have an unique identifier.
        /// </summary>
        public TId Id
        {
            get
            {

                TValue _TValue;

                if (PropertyData.TryGetValue(IdKey, out _TValue))
                    return (TId) _TValue;

                return default(TId);

            }
        }

        //ToDo: Solve ambiguity!
        //TValue IReadOnlyProperties<TKey, TValue>.Id
        //{
        //    get
        //    {

        //        TValue _TValue;

        //        if (PropertyData.TryGetValue(IdKey, out _TValue))
        //            return _TValue;

        //        return default(TId);

        //    }
        //}

        #endregion

        #region RevIdKey

        /// <summary>
        /// The property key of the revision identification.
        /// </summary>
        public TKey RevIdKey { get; private set; }

        #endregion

        #region RevId

        /// <summary>
        /// The RevId extends the Id to identify multiple revisions of
        /// an element during the lifetime of a graph. A RevId should
        /// additionally be unique among all elements of a graph.
        /// </summary>
        public TRevId RevId
        {
            get
            {

                TValue _TValue;

                if (PropertyData.TryGetValue(RevIdKey, out _TValue))
                    return (TRevId) (Object) _TValue;

                return default(TRevId);

            }
        }

        //ToDo: Solve ambiguity!
        //TValue IReadOnlyProperties<TKey, TValue>.RevId
        //{
        //    get
        //    {

        //        TValue _TValue;

        //        if (PropertyData.TryGetValue(RevIdKey, out _TValue))
        //            return _TValue;

        //        return default(TId);

        //    }
        //}

        #endregion

        #region LabelKey

        /// <summary>
        /// The property key of the label.
        /// </summary>
        public TKey LabelKey { get; private set; }

        #endregion

        #region Label

        /// <summary>
        /// Provides a label of something.
        /// </summary>
        public TLabel Label
        {
            get
            {

                TValue _TValue;

                if (PropertyData.TryGetValue(LabelKey, out _TValue))
                    return (TLabel) (Object) _TValue;

                return default(TLabel);

            }
        }

        #endregion

        #endregion

        #region Events

        #region OnPropertyAdding

        /// <summary>
        /// Called when a property value will be added.
        /// </summary>
        public event PropertyAddingEventHandler<TKey, TValue> OnPropertyAdding;

        #endregion

        #region OnPropertyAdded

        /// <summary>
        /// Called whenever a property value was added.
        /// </summary>
        public event PropertyAddedEventHandler<TKey, TValue> OnPropertyAdded;

        #endregion

        #region OnPropertyChanging

        /// <summary>
        /// Called whenever a property value will be changed.
        /// </summary>
        public event PropertyChangingEventHandler<TKey, TValue> OnPropertyChanging;

        #endregion

        #region OnPropertyChanged

        /// <summary>
        /// Called whenever a property value was changed.
        /// </summary>
        public event PropertyChangedEventHandler<TKey, TValue> OnPropertyChanged;

        #endregion

        #region OnPropertyRemoving

        /// <summary>
        /// Called whenever a property value will be removed.
        /// </summary>
        public event PropertyRemovingEventHandler<TKey, TValue> OnPropertyRemoving;

        #endregion

        #region OnPropertyRemoved

        /// <summary>
        /// Called whenever a property value was removed.
        /// </summary>
        public event PropertyRemovedEventHandler<TKey, TValue> OnPropertyRemoved;

        #endregion

        #endregion

        #region (internal) Send[...]Notifications(...)

        #region (internal) SendPropertyAdditionVote(Key, Value)

        /// <summary>
        /// Notify and send a vore about a property to be added.
        /// </summary>
        /// <param name="Key">The key of the property to be added.</param>
        /// <param name="Value">The value of the property to be added.</param>
        internal Boolean SendPropertyAdditionVote(TKey Key, TValue Value)
        {

            var Vote = VoteCreator();

            if (OnPropertyAdding != null)
                OnPropertyAdding(this, Key, Value, Vote);

            return Vote.Result;

        }

        #endregion

        #region (internal) SendPropertyAddedNotification(Key, Value)

        /// <summary>
        /// Notify about an added property.
        /// </summary>
        /// <param name="Key">The key of the added property.</param>
        /// <param name="Value">The value of the added property.</param>
        internal void SendPropertyAddedNotification(TKey Key, TValue Value)
        {
            if (OnPropertyAdded != null)
                OnPropertyAdded(this, Key, Value);
        }

        #endregion

        #region (internal) SendPropertyChangingVote(Key, OldValue, NewValue)

        /// <summary>
        /// Notify and send vote about a property to be changed.
        /// </summary>
        /// <param name="Key">The key of the property to be changed.</param>
        /// <param name="OldValue">The old value of the property to be changed.</param>
        /// <param name="NewValue">The new value of the property to be changed.</param>
        internal Boolean SendPropertyChangingVote(TKey Key, TValue OldValue, TValue NewValue)
        {

            var Vote = VoteCreator();

            if (OnPropertyChanging != null)
                OnPropertyChanging(this, Key, OldValue, NewValue, Vote);

            return Vote.Result;

        }

        #endregion

        #region (internal) SendPropertyChangedNotification(Key, OldValue, NewValue)

        /// <summary>
        /// Notify about a changed property.
        /// </summary>
        /// <param name="Key">The key of the changed property.</param>
        /// <param name="OldValue">The old value of the changed property.</param>
        /// <param name="NewValue">The new value of the changed property.</param>
        internal void SendPropertyChangedNotification(TKey Key, TValue OldValue, TValue NewValue)
        {
            if (OnPropertyChanged != null)
                OnPropertyChanged(this, Key, OldValue, NewValue);
        }

        #endregion

        #region (internal) SendPropertyRemovalVote(Key, Value)

        /// <summary>
        /// Notify and send vote about a property to be removed.
        /// </summary>
        /// <param name="Key">The key of the property to be removed.</param>
        /// <param name="Value">The value of the property to be removed.</param>
        internal Boolean SendPropertyRemovalVote(TKey Key, TValue Value)
        {

            var Vote = VoteCreator();

            if (OnPropertyRemoving != null)
                OnPropertyRemoving(this, Key, Value, Vote);

            return Vote.Result;

        }

        #endregion

        #region (internal) SendPropertyRemovedNotification(Key, Value)

        /// <summary>
        /// Notify about a removed property.
        /// </summary>
        /// <param name="Key">The key of the removed property.</param>
        /// <param name="Value">The value of the removed property.</param>
        internal void SendPropertyRemovedNotification(TKey Key, TValue Value)
        {
            if (OnPropertyRemoved != null)
                OnPropertyRemoved(this, Key, Value);
        }

        #endregion

        #endregion

        #region (internal protected) Constructor(s)

        #region (internal protected) AGraphElement(Id, Label, IdKey, RevIdKey, LabelKey, DatastructureInitializer, PropertiesInitializer = null, VoteCreator = null)

        /// <summary>
        /// Creates a new abstract graph element.
        /// </summary>
        /// <param name="Id">The Id of this graph element.</param>
        /// <param name="Label">The label of the graph element.</param>
        /// <param name="IdKey">The key to access the Id of this graph element.</param>
        /// <param name="RevIdKey">The key to access the RevId of this graph element.</param>
        /// <param name="LabelKey">The key to access the Label of this graph element.</param>
        /// <param name="DatastructureInitializer">A delegate to initialize the properties datastructure of the this graph element.</param>
        /// <param name="PropertiesInitializer">A delegate to do some initial operations like adding some properties.</param>
        /// <param name="VoteCreator">A delegate to create a new vote.</param>
        internal protected AGraphElement(TId                                   Id,
                                         TLabel                                Label,
                                         TKey                                  IdKey,
                                         TKey                                  RevIdKey,
                                         TKey                                  LabelKey,
                                         IDictionaryInitializer<TKey, TValue>  DatastructureInitializer,
                                         IPropertiesInitializer<TKey, TValue>  PropertiesInitializer  = null,
                                         Func<IVote<Boolean>>                  VoteCreator = null)

        {

            #region Initial checks

            if (IdKey    == null)
                throw new ArgumentNullException("IdKey", "The given IdKey must not be null!");

            if (Id       == null)
                throw new ArgumentNullException("Id", "The given Id must not be null!");

            if (RevIdKey == null)
                throw new ArgumentNullException("RevIdKey", "The given RevIdKey must not be null!");

            if (LabelKey == null)
                throw new ArgumentNullException("LabelKey", "The given LabelKey must not be null!");

            if (DatastructureInitializer == null)
                throw new ArgumentNullException("DatastructureInitializer", "The given DatastructureInitializer must not be null!");

            #endregion

            // Good for explicit locking of this object
            // during complex operations...
            this.LockObject    = new Object();

            this.IdKey         = IdKey;
            this.RevIdKey      = RevIdKey;
            this.LabelKey      = LabelKey;
            this.PropertyData  = DatastructureInitializer();
            this.PropertyData.Add(IdKey,    Id);
            this.PropertyData.Add(RevIdKey, RevId);
            this.PropertyData.Add(LabelKey, Label);

            this.VoteCreator   = (VoteCreator != null) ? VoteCreator
                                                       : () => new VetoVote();

            if (PropertiesInitializer != null)
                PropertiesInitializer(this);

        }

        #endregion

        #endregion

        #region IDynamicGraphObject<PropertyVertex> Members

        #region GetDynamicMemberNames()

        /// <summary>
        /// Returns an enumeration of all property keys.
        /// </summary>
        public virtual IEnumerable<String> GetDynamicMemberNames()
        {

            return PropertyData.Keys.
                                Select(key => key.ToString());

        }

        #endregion

        #region SetMember(Binder, Object)

        /// <summary>
        /// Sets a new property or overwrites an existing.
        /// </summary>
        /// <param name="Binder">The property key</param>
        /// <param name="Object">The property value</param>
        public virtual Object SetMember(String Binder, Object Object)
        {
            return Set((TKey) (Object) Binder, (TValue) Object);
        }

        #endregion

        #region GetMember(Binder)

        /// <summary>
        /// Returns the value of the given property key.
        /// </summary>
        /// <param name="Binder">The property key.</param>
        public virtual Object GetMember(String Binder)
        {
            TValue _Object;
            TryGetProperty((TKey) (Object) Binder, out _Object);
            return _Object as Object;
        }

        #endregion

        #region DeleteMember(Binder)

        /// <summary>
        /// Tries to remove the property identified by the given property key.
        /// </summary>
        /// <param name="Binder">The property key.</param>
        public virtual Object DeleteMember(String Binder)
        {

            try
            {
                PropertyData.Remove((TKey) (Object) Binder);
                return true;
            }
            catch
            { }

            return false;

        }

        #endregion

        #endregion

        #region IProperties Members

        #region Set(Key, Value)

        /// <summary>
        /// Add a KeyValuePair to the graph element.
        /// If a value already exists for the given key, then the previous value is overwritten.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <param name="newValue">A value.</param>
        public virtual IProperties<TKey, TValue> Set(TKey Key, TValue newValue)
        {

            #region Initial Checks

            if (Key.Equals(IdKey))
                throw new IdentificationChangeException();

            if (Key.Equals(RevIdKey))
                throw new RevIdentificationChangeException();

            if (Key.Equals(Label))
                throw new RevIdentificationChangeException();

            #endregion

            TValue oldValue;

            if (PropertyData.TryGetValue(Key, out oldValue))
            {
                if (SendPropertyChangingVote(Key, oldValue, newValue))
                {
                    PropertyData[Key] = newValue;
                    SendPropertyChangedNotification(Key, oldValue, newValue);
                }
            }

            else
            {
                if (SendPropertyAdditionVote(Key, newValue))
                {
                    PropertyData.Add(Key, newValue);
                    SendPropertyAddedNotification(Key, newValue);
                }
            }

            return this;

        }

        #endregion

        #region ContainsKey(Key)

        /// <summary>
        /// Determines if the specified key exists.
        /// </summary>
        /// <param name="Key">A key.</param>
        public Boolean ContainsKey(TKey Key)
        {
            return PropertyData.ContainsKey(Key);
        }

        #endregion

        #region ContainsValue(Value)

        /// <summary>
        /// Determines if the specified value exists.
        /// </summary>
        /// <param name="Value">A value.</param>
        public Boolean ContainsValue(TValue Value)
        {

            return PropertyData.Values.
                                Any(v => v.Equals(Value));

        }

        #endregion

        #region Contains(Key, Value)

        /// <summary>
        /// Determines if the given key and value exists.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <param name="Value">A value.</param>
        public Boolean Contains(TKey Key, TValue Value)
        {

            TValue _Value;

            if (PropertyData.TryGetValue(Key, out _Value))
                return Value.Equals(_Value);

            return false;

        }

        #endregion

        #region Contains(KeyValuePair)

        /// <summary>
        /// Determines if the given KeyValuePair exists.
        /// </summary>
        /// <param name="KeyValuePair">A KeyValuePair.</param>
        public Boolean Contains(KeyValuePair<TKey, TValue> KeyValuePair)
        {
            return PropertyData.Contains(KeyValuePair);
        }

        #endregion

        #region this[Key]

        /// <summary>
        /// Return the value associated with the given key.
        /// </summary>
        /// <param name="Key">A key.</param>
        public virtual TValue this[TKey Key]
        {
            get
            {

                TValue _Object;

                PropertyData.TryGetValue(Key, out _Object);

                return _Object;

            }
        }

        #endregion

        #region TryGetProperty(Key, out Value)

        /// <summary>
        /// Return the value associated with the given key.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <param name="Value">The associated value.</param>
        /// <returns>True if the returned value is valid. False otherwise.</returns>
        public virtual Boolean TryGetProperty(TKey Key, out TValue Value)
        {
            return PropertyData.TryGetValue(Key, out Value);
        }

        #endregion

        #region TryGetProperty<T>(Key, out Value)

        /// <summary>
        /// Return the value associated with the given key.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <param name="Value">The associated value.</param>
        /// <returns>True if the returned value is valid. False otherwise.</returns>
        public virtual Boolean TryGetProperty<T>(TKey Key, out T Value)
        {

            TValue _Value;

            if (PropertyData.TryGetValue(Key, out _Value))
            {

                try
                {
                    Value = (T) (Object) _Value;
                }
                catch (Exception)
                {
                    Value = default(T);
                    return false;
                }

                return true;

            }

            Value = default(T);
            return false;

        }

        #endregion

        #region GetProperties(Include = null)

        /// <summary>
        /// Return a filtered enumeration of all KeyValuePairs.
        /// </summary>
        /// <param name="Include">A delegate to filter properties based on their keys and values.</param>
        /// <returns>A enumeration of all key/value pairs matching the given KeyValueFilter.</returns>
        public virtual IEnumerable<KeyValuePair<TKey, TValue>> GetProperties(KeyValueFilter<TKey, TValue> Include = null)
        {

            return (Include == null) ? PropertyData.Where(kvp => kvp.Value != null)
                                     : PropertyData.Where(kvp => kvp.Value != null && Include(kvp.Key, kvp.Value));

        }

        #endregion

        #region Keys

        /// <summary>
        /// An enumeration of all property keys.
        /// </summary>
        public IEnumerable<TKey> Keys
        {
            get
            {
                return PropertyData.Keys;
            }
        }

        #endregion

        #region Values

        /// <summary>
        /// An enumeration of all property values.
        /// </summary>
        public IEnumerable<TValue> Values
        {
            get
            {
                return PropertyData.Values;
            }
        }

        #endregion

        #region Remove(Key)

        /// <summary>
        /// Removes all KeyValuePairs associated with the given key.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <returns>The value associated with that key prior to the removal.</returns>
        public virtual TValue Remove(TKey Key)
        {

            #region Initial Checks

            if (Key.Equals(IdKey))
                throw new ArgumentException("Removing the Id property is not allowed!");

            if (Key.Equals(RevIdKey))
                throw new ArgumentException("Removing the RevId property is not allowed!");

            #endregion

            TValue _Value;

            if (PropertyData.TryGetValue(Key, out _Value))
            {
                if (SendPropertyRemovalVote(Key, _Value))
                {

                    if (!PropertyData.Remove(Key))
                        throw new Exception("Could not delete '" + Key + "'!");

                    SendPropertyRemovedNotification(Key, _Value);

                }
            }

            return _Value;

        }

        #endregion

        #region Remove(Key, Value)

        /// <summary>
        /// Remove the given key and value pair.
        /// </summary>
        /// <param name="Key">A key.</param>
        /// <param name="Value">A value.</param>
        /// <returns>The value associated with that key prior to the removal.</returns>
        public TValue Remove(TKey Key, TValue Value)
        {

            #region Initial Checks

            if (Key.Equals(IdKey))
                throw new ArgumentException("Removing the Id property is not allowed!");

            if (Key.Equals(RevIdKey))
                throw new ArgumentException("Removing the RevId property is not allowed!");

            #endregion

            TValue _Value;

            if (TryGetProperty(Key, out _Value))
            {
                if (_Value.Equals(Value))
                {
                    if (SendPropertyRemovalVote(Key, _Value))
                    {
                        Remove(Key);
                        SendPropertyRemovedNotification(Key, _Value);
                        return _Value;
                    }
                }
            }

            return default(TValue);

        }

        #endregion

        #region Remove(KeyValueFilter = null)

        /// <summary>
        /// Remove all KeyValuePairs specified by the given KeyValueFilter.
        /// Removing the Id or RevId property is not supported!
        /// </summary>
        /// <param name="KeyValueFilter">A delegate to remove properties based on their keys and values.</param>
        /// <returns>A enumeration of all key/value pairs removed by the given KeyValueFilter before their removal.</returns>
        public IEnumerable<KeyValuePair<TKey, TValue>> Remove(KeyValueFilter<TKey, TValue> KeyValueFilter = null)
        {

            var ToDelete = new List<KeyValuePair<TKey, TValue>>();
            var Deleted  = new List<KeyValuePair<TKey, TValue>>();

            // Collect KeyValuePair to delete...
            if (KeyValueFilter != null)
                foreach (var KeyValuePair in PropertyData)
                    if (KeyValueFilter(KeyValuePair.Key, KeyValuePair.Value))
                        if (KeyValuePair.Key.Equals(IdKey))
                            throw new ArgumentException("Removing the Id property is not allowed!");
                        else if (KeyValuePair.Key.Equals(RevIdKey))
                            throw new ArgumentException("Removing the RevId property is not allowed!");
                        else
                            ToDelete.Add(KeyValuePair);

            // Delete them now...
            foreach (var KeyValuePair in ToDelete)
                if (SendPropertyRemovalVote(KeyValuePair.Key, KeyValuePair.Value))
                {
                    Remove(KeyValuePair.Key);
                    Deleted.Add(KeyValuePair);
                    SendPropertyRemovedNotification(KeyValuePair.Key, KeyValuePair.Value);
                }

            // Return deleted KeyValuePairs
            return Deleted;

        }

        #endregion

        #endregion

        #region IEnumerable Members

        /// <summary>
        /// An enumerator of all key-value pairs stored.
        /// </summary>
        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
        {
            return PropertyData.GetEnumerator();
        }

        /// <summary>
        /// An enumerator of all key-value pairs stored.
        /// </summary>
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return PropertyData.GetEnumerator();
        }

        #endregion

        #region IComparable Members

        #region CompareTo(Object)

        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Object">An object to compare with.</param>
        public virtual Int32 CompareTo(Object Object)
        {

            if (Object == null)
                throw new ArgumentNullException("The given Object must not be null!");

            // Check if the given object can be casted to a AGraphElement
            var AGraphElement = Object as AGraphElement<TId, TRevId, TLabel, TKey, TValue>;

            if ((Object) AGraphElement == null)
                throw new ArgumentException("The given object is not a AGraphElement!");

            return CompareTo(AGraphElement);

        }

        #endregion

        #region CompareTo(Id)

        /// <summary>
        /// Compares this object to an identification.
        /// </summary>
        /// <param name="Id">An Id to compare with.</param>
        public Int32 CompareTo(TId Id)
        {

            if ((Object) Id == null)
                throw new ArgumentNullException("The given Id must not be null!");

            return Id.CompareTo(Id);

        }

        #endregion

        #region CompareTo(IReadOnlyGraphElement)

        /// <summary>
        /// Compares this object to another readonly GraphElement.
        /// </summary>
        /// <param name="IReadOnlyGraphElement">An IReadOnlyGraphElement to compare with.</param>
        public Int32 CompareTo(IReadOnlyGraphElement<TId, TRevId, TLabel, TKey, TValue> IReadOnlyGraphElement)
        {

            if ((Object) IReadOnlyGraphElement == null)
                throw new ArgumentNullException("The given GraphElement must not be null!");

            return Id.CompareTo(IReadOnlyGraphElement.Id);

        }

        #endregion

        #region CompareTo(IGraphElement)

        /// <summary>
        /// Compares this object to another GraphElement.
        /// </summary>
        /// <param name="IGraphElement">An IGraphElement to compare with.</param>
        public Int32 CompareTo(IGraphElement<TId, TRevId, TLabel, TKey, TValue> IGraphElement)
        {

            if ((Object) IGraphElement == null)
                throw new ArgumentNullException("The given GraphElement must not be null!");

            return Id.CompareTo(IGraphElement.Id);

        }

        #endregion

        #endregion

        #region IEquatable Members

        #region Equals(Object)

        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Object">An object to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(Object Object)
        {

            if (Object == null)
                return false;

            // Check if the given object can be casted to a AGraphElement
            var AGraphElement = Object as AGraphElement<TId, TRevId, TLabel, TKey, TValue>;

            if ((Object) AGraphElement == null)
                return false;

            return this.Equals(AGraphElement);

        }

        #endregion

        #region Equals(Id)

        /// <summary>
        /// Compares this object to an identification.
        /// </summary>
        /// <param name="Id">An Id to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(TId Id)
        {

            if ((Object) Id == null)
                return false;

            return Id.Equals(Id);

        }

        #endregion

        #region Equals(IReadOnlyGraphElement)

        /// <summary>
        /// Compares this object to an IReadOnlyGraphElement.
        /// </summary>
        /// <param name="IReadOnlyGraphElement">An IReadOnlyGraphElement to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(IReadOnlyGraphElement<TId, TRevId, TLabel, TKey, TValue> IReadOnlyGraphElement)
        {

            if ((Object) IReadOnlyGraphElement == null)
                return false;

            return Id.Equals(IReadOnlyGraphElement.Id);

        }

        #endregion

        #region Equals(IGraphElement)

        /// <summary>
        /// Compares this object to an IGraphElement.
        /// </summary>
        /// <param name="IGraphElement">An IGraphElement to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(IGraphElement<TId, TRevId, TLabel, TKey, TValue> IGraphElement)
        {

            if ((Object)IGraphElement == null)
                return false;

            return Id.Equals(IGraphElement.Id);

        }

        #endregion

        #endregion

        #region GetHashCode()

        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            return Id.GetHashCode();
        }

        #endregion

        #region ToString()

        /// <summary>
        /// Return a string representation of this object.
        /// </summary>
        public override String ToString()
        {

            var IdString = (Id == null) ? "<null>" : Id.ToString();

            return this.GetType().Name + "(Id = " + IdString + ")";

        }

        #endregion

    }

}


text:
package com.lvxingpai.idgen

import java.net.InetSocketAddress

import com.google.inject.name.Names
import com.google.inject.{ AbstractModule, Guice, Key }
import com.lvxingpai.etcd.EtcdStoreModule
import com.twitter.finagle.builder.ServerBuilder
import com.twitter.finagle.thrift.ThriftServerFramedCodec
import com.typesafe.config.{ Config, ConfigException, ConfigFactory }
import org.apache.thrift.protocol.TBinaryProtocol.Factory

import scala.util.Try

/**
 * Created by zephyre on 11/18/15.
 */
object IdGenServer extends App {
  main(args)

  override def main(args: Array[String]): Unit = {
    import scala.concurrent.ExecutionContext.Implicits.global

    val injector = Guice.createInjector(new EtcdStoreModule(ConfigFactory.defaultApplication()))
    val handler = injector.getInstance(classOf[IdGenHandler])
    val conf = injector.getInstance(Key.get(classOf[Config], Names.named("etcdConf")))

    for {
      port <- Try(conf getInt "idgen.port") recover {
        case _: ConfigException.Missing => 9000
      }
      maxConcur <- Try(conf getInt "idgen.maxConcur") recover {
        case _: ConfigException.Missing => 1000
      }
    } yield {
      val service = new IdGen$FinagleService(handler, new Factory())
      ServerBuilder()
        .bindTo(new InetSocketAddress(port))
        .codec(ThriftServerFramedCodec())
        .name("idgen")
        .maxConcurrentRequests(maxConcur)
        .build(service)
    }
  }
}


text:
layout  : example
title   : Extending Functionality Using `ext` Option
name    : using-ext
example : core ext
---
{% include common.html %}

Please open your browser's debug console to see the output.

Extending Core

{% capture example_textarea %}
<textarea id="core-ext" class="example" rows="1"></textarea>
{% endcapture %}

{% capture example_script %}

{% endcapture %}

{% include live_demo.html %}

Extending A Plugin

{% capture example_textarea %}
<textarea id="tags-ext" class="example" rows="1"></textarea>
{% endcapture %}

{% capture example_script %}

{% endcapture %}

{% include live_demo.html %}

Extending ItemManager

{% capture example_textarea %}
<textarea id="itemmanager-ext" class="example" rows="1"></textarea>
{% endcapture %}

{% capture example_script %}

{% endcapture %}

{% include live_demo.html %}


text:
#ifndef MODULES_PERCEPTION_OBSTACLE_CAMERA_DETECTOR_COMMON_UTIL_H_
#define MODULES_PERCEPTION_OBSTACLE_CAMERA_DETECTOR_COMMON_UTIL_H_

#include <cuda_runtime.h>
#include <caffe/caffe.hpp>
#include <memory>

namespace apollo {
namespace perception {

#define CUDA_CHECK(condition)                                         \
  /* Code block avoids redefinition of cudaError_t error */           \
  do {                                                                \
    cudaError_t error = condition;                                    \
    CHECK_EQ(error, cudaSuccess) << " " << cudaGetErrorString(error); \
  } while (0)

void gpu_memcpy(const size_t N, const void *X, void *Y);

inline void perception_gpu_memset(const size_t N, const int alpha, void *X) {
  CUDA_CHECK(cudaMemset(X, alpha, N));
}
inline void perception_memset(const size_t N, const int alpha, void *X) {
  memset(X, alpha, N);
}

inline void PerceptionMallocHost(void **ptr, size_t size, bool *use_cuda) {
  CUDA_CHECK(cudaMallocHost(ptr, size));
  *use_cuda = true;
  return;
}

inline void PerceptionFreeHost(void *ptr, bool use_cuda) {
  if (use_cuda) {
    CUDA_CHECK(cudaFreeHost(ptr));
    return;
  }
  free(ptr);
  return;
}

int divup(int a, int b);

void resize(cv::Mat frame, caffe::Blob<float> *dst,
            std::shared_ptr<caffe::SyncedMemory> src_gpu, int start_axis);
// resize with mean and scale
void resize(cv::Mat frame, caffe::Blob<float> *dst,
            std::shared_ptr<caffe::SyncedMemory> src_gpu, int start_axis,
            const float mean_b, const float mean_g, const float mean_r,
            const float scale);

void yuyv2bgr(const uint8_t *yuv, uint8_t *rgb, const int pixel_num);
}  // namespace perception
}  // namespace apollo

#endif  // MODULES_PERCEPTION_OBSTACLE_CAMERA_DETECTOR_COMMON_UTIL_H_


text:
module Jekyll
  module Commands
    class Doctor < Command
      class << self
        def process(options)
          site = Jekyll::Site.new(options)
          site.read

          unless deprecated_relative_permalinks(site)
            Jekyll.logger.info "Your test results", "are in. Everything looks fine."
          end
        end

        def deprecated_relative_permalinks(site)
          contains_deprecated_pages = false
          site.pages.each do |page|
            if page.uses_relative_permalinks
              Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
                                  " permalinks which will be deprecated in" +
                                  " Jekyll v1.1 and beyond."
              contains_deprecated_pages = true
            end
          end
          contains_deprecated_pages
        end
      end
    end
  end
end


text:
import React from 'react'
import { useReduxCommand } from '@resolve-js/redux'
import { ListGroupItem, Form } from 'react-bootstrap'
import { StaticImage } from './StaticImage'
const ShoppingListItem = ({ shoppingListId, item: { id, checked, text } }) => {
  const { execute: toggleItem } = useReduxCommand({
    type: 'toggleShoppingItem',
    aggregateId: shoppingListId,
    aggregateName: 'ShoppingList',
    payload: {
      id,
    },
  })
  const { execute: removeItem } = useReduxCommand({
    type: 'removeShoppingItem',
    aggregateId: shoppingListId,
    aggregateName: 'ShoppingList',
    payload: {
      id,
    },
  })
  return (
    <ListGroupItem key={id}>
      <Form.Check
        inline
        type="checkbox"
        label={text}
        checked={checked}
        onChange={() => toggleItem()}
      />
      <StaticImage
        className="example-close-button"
        src="/close-button.png"
        onClick={removeItem}
      />
    </ListGroupItem>
  )
}
export default ShoppingListItem


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _htmlMinifierTerser = require("html-minifier-terser");

var _default = options => function process(html, result) {
  const minimizeOptions = typeof options.minimize === 'boolean' || typeof options.minimize === 'undefined' ? {
    collapseWhitespace: true,
    conservativeCollapse: true,
    keepClosingSlash: true,
    minifyCSS: true,
    minifyJS: true,
    removeAttributeQuotes: true,
    removeComments: true,
    removeScriptTypeAttributes: true,
    removeStyleLinkTypeAttributes: true,
    useShortDoctype: true
  } : options.minimize;

  try {
    // eslint-disable-next-line no-param-reassign
    html = (0, _htmlMinifierTerser.minify)(html, minimizeOptions);
  } catch (error) {
    result.messages.push({
      type: 'error',
      value: error
    });
  }

  return html;
};

exports.default = _default;


text:
/*                     __                                               *\
 **     ________ ___   / /  ___     Scala API                            **
 **    / __/ __// _ | / /  / _ |    (c) 2003-2009, LAMP/EPFL             **
 **  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
 ** /____/\___/_/ |_/____/_/ | |                                         **
 **                          |/                                          **
 \*                                                                      */

// $Id: ResizableArray.scala 19219 2009-10-22 09:43:14Z moors $

package wandou.collection

import scala.collection.generic._
import scala.collection.mutable.Builder
import scala.collection.mutable.IndexedSeq
import scala.collection.mutable.IndexedSeqOptimized
import scala.reflect.ClassTag

/**
 * This class is used internally to implement data structures that
 *  are based on resizable arrays.
 *
 *  @tparam A    type of the elements contained in this resizeable array.
 *
 *  @author  Matthias Zenger, Burak Emir
 *  @author Martin Odersky
 *  @author Caoyuan Deng
 *  @version 2.8
 *  @since   1
 */
trait ResizableArray[A] extends IndexedSeq[A]
    with GenericTraversableTemplate[A, ResizableArray]
    with IndexedSeqOptimized[A, ResizableArray[A]] {

  /** trait can not have type parameters like ResizableArray[A : ClassTag], so we have define an implicit val here */
  protected implicit val m: ClassTag[A]

  override def companion: GenericCompanion[ResizableArray] = ResizableArray

  protected def elementClass: Option[Class[A]] = None
  protected def initialSize: Int = 16
  protected def maxCapacity: Int = Int.MaxValue
  protected[collection] var cursor0: Int = 0

  protected[collection] var array: Array[A] = makeArray(initialSize)

  /**
   * Under case of calling new ArrayList[T] where T is not specified explicitly
   * during compile time, ie. the T is got during runtime, 'm' may be "_ <: Any",
   * or, AnyRef. In this case, we should pass in an elementClass and create array via
   *   java.lang.reflect.Array.newInstance(x, size)
   */
  protected def makeArray(size: Int) = {
    elementClass match {
      case Some(x) =>
        java.lang.reflect.Array.newInstance(x, size).asInstanceOf[Array[A]]
      case None =>
        // If the A is specified under compile time, that's ok, an Array[A] will be
        // created (if A is primitive type, will also create a primitive typed array @see scala.reflect.Manifest)
        // If A is specified under runtime, will create a Array[AnyRef]
        new Array[A](size)
    }
  }

  protected var size0: Int = 0

  //##########################################################################
  // implement/override methods of IndexedSeq[A]

  /**
   * Returns the length of this resizable array.
   */
  def length: Int = size0

  /**
   * Translate idx to true idx of underlying array according to cursor0
   * if idx >= size0, will return -1
   */
  final protected def trueIdx(idx: Int) = {
    val idx1 = cursor0 + idx
    if (idx1 < size0) {
      idx1
    } else {
      idx1 - size0
    }
  }

  final protected def shiftCursor(n: Int) {
    cursor0 += n
    while (cursor0 >= maxCapacity) {
      cursor0 -= maxCapacity
    }
  }

  def apply(idx: Int) = {
    if (idx >= size0) throw new IndexOutOfBoundsException(idx.toString)
    array(trueIdx(idx))
  }

  def update(idx: Int, elem: A) {
    if (idx >= size0) throw new IndexOutOfBoundsException(idx.toString)
    array(trueIdx(idx)) = elem
  }

  override def foreach[U](f: A => U) {
    var i = 0
    while (i < size0) {
      f(array(trueIdx(i)))
      i += 1
    }
  }

  /**
   * Fills the given array xs with at most `len` elements of
   *  this traversable starting at position `start`.
   *  Copying will stop once either the end of the current traversable is reached or
   *  `len` elements have been copied or the end of the array is reached.
   *
   *  @param  xs the array to fill.
   *  @param  start starting index.
   *  @param  len number of elements to copy
   */
  override def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) {
    val len1 = math.min(math.min(len, xs.length - start), size)
    if (len1 > 0) {
      val srcStart1 = trueIdx(0)
      val nBehindCursor = size0 - srcStart1
      if (nBehindCursor >= len1) {
        scala.compat.Platform.arraycopy(array, srcStart1, xs, start, len1)
      } else {
        scala.compat.Platform.arraycopy(array, srcStart1, xs, start, nBehindCursor)
        scala.compat.Platform.arraycopy(array, 0, xs, start + nBehindCursor, len1 - nBehindCursor)
      }
    }
  }

  //##########################################################################

  /**
   * remove elements of this array at indices after sz
   */
  def reduceToSize(sz: Int) {
    require(sz <= size0)
    if (cursor0 == 0) {
      if (m.runtimeClass.isPrimitive) {
        while (size0 > sz) {
          size0 -= 1
        }
      } else {
        while (size0 > sz) {
          size0 -= 1
          array(size0) = null.asInstanceOf[A]
        }
      }
    } else {
      val newArray = makeArray(array.length)

      val nBehindCursor = math.min(sz, size0 - cursor0)
      if (nBehindCursor > 0) {
        scala.compat.Platform.arraycopy(array, cursor0, newArray, 0, nBehindCursor)
      }
      val nBeforeCursor = sz - nBehindCursor
      if (nBeforeCursor > 0) {
        scala.compat.Platform.arraycopy(array, 0, newArray, nBehindCursor, nBeforeCursor)
      }

      array = newArray
      cursor0 = 0
      size0 = sz
    }
  }

  /** Ensure that the internal array has at least `n` cells. */
  protected def ensureSize(n: Int) {
    // Use a Long to prevent overflows
    val arrayLength: Long = array.length
    if (n > arrayLength) {
      var newSize: Long = arrayLength + initialSize
      while (newSize <= n)
        newSize += initialSize
      // Clamp newSize to maxCapacity
      if (newSize > maxCapacity) newSize = maxCapacity

      val newArray = makeArray(newSize.toInt)
      scala.compat.Platform.arraycopy(array, 0, newArray, 0, size0)
      array = newArray
    }
  }

  /**
   * Swap two elements of this array.
   */
  protected def swap(a: Int, b: Int) {
    val a1 = trueIdx(a)
    val b1 = trueIdx(b)
    val h = array(a1)
    array(a1) = array(b1)
    array(b1) = h
  }
}

object ResizableArray extends SeqFactory[ResizableArray] {
  implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, ResizableArray[A]] = new GenericCanBuildFrom[A]
  def newBuilder[A]: Builder[A, ResizableArray[A]] = new ArrayList[Any].asInstanceOf[ArrayList[A]]
}


text:
namespace TheSlum.Items
{
    public class Pill : Bonus
    {
        private const int HealthEffectDefault = 0;
        private const int DefenseEffectDefault = 0;
        private const int AttackEffectDefault = 1000;
        private const int TimeoutTurns = 1;

        public Pill(string id)
            : base(id, HealthEffectDefault, DefenseEffectDefault, AttackEffectDefault)
        {
            this.Timeout = TimeoutTurns;
            this.Countdown = TimeoutTurns;
        }
    }
}


text:
package org.apache.nutch.indexwriter.solr;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.nutch.indexer.CleaningJob;
import org.apache.nutch.indexer.NutchDocument;
import org.apache.nutch.indexer.IndexWriter;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.common.SolrInputDocument;

public class SolrIndexWriter implements IndexWriter {

  public static final Logger LOG = LoggerFactory
      .getLogger(SolrIndexWriter.class);

  private HttpSolrServer solr;
  private SolrMappingReader solrMapping;

  private Configuration config;

  private final List<SolrInputDocument> inputDocs = new ArrayList<SolrInputDocument>();

  private int batchSize;
  private int numDeletes = 0;
  private boolean delete = false;

  protected static long documentCount = 0;

  @Override
  public void open(Configuration conf) throws IOException {
    solr = SolrUtils.getHttpSolrServer(conf);
    batchSize = conf.getInt(SolrConstants.COMMIT_SIZE, 1000);
    solrMapping = SolrMappingReader.getInstance(conf);
  }

  @Override
  public void write(NutchDocument doc) throws IOException {
    final SolrInputDocument inputDoc = new SolrInputDocument();
    for (final Entry<String, List<String>> e : doc) {
      for (final String val : e.getValue()) {

        Object val2 = val;
        if (e.getKey().equals("content") || e.getKey().equals("title")) {
          val2 = SolrUtils.stripNonCharCodepoints(val);
        }

        inputDoc.addField(solrMapping.mapKey(e.getKey()), val2);
        String sCopy = solrMapping.mapCopyKey(e.getKey());
        if (sCopy != e.getKey()) {
          inputDoc.addField(sCopy, val2);
        }
      }
    }
    inputDoc.setDocumentBoost(doc.getScore());
    inputDocs.add(inputDoc);
    documentCount++;
    if (inputDocs.size() >= batchSize) {
      try {
        LOG.info("Adding " + Integer.toString(inputDocs.size()) + " documents");
        solr.add(inputDocs);
      } catch (final SolrServerException e) {
        throw new IOException(e);
      }
      inputDocs.clear();
    }
  }

  @Override
  public void close() throws IOException {
    try {
      if (!inputDocs.isEmpty()) {
        LOG.info("Adding " + Integer.toString(inputDocs.size()) + " documents");
        solr.add(inputDocs);
        inputDocs.clear();
      } else if (numDeletes > 0) {
        LOG.info("Deleted " + Integer.toString(numDeletes) + " documents");
      }
    } catch (final SolrServerException e) {
      throw new IOException(e);
    }
  }

  @Override
  public Configuration getConf() {
    return config;
  }

  @Override
  public void setConf(Configuration conf) {
    config = conf;
    String serverURL = conf.get(SolrConstants.SERVER_URL);
    delete = config.getBoolean(CleaningJob.ARG_COMMIT, false);
    if (serverURL == null) {
      String message = "Missing SOLR URL. Should be set via -D "
          + SolrConstants.SERVER_URL;
      message += "\n" + describe();
      LOG.error(message);
      throw new RuntimeException(message);
    }
  }

  @Override
  public void delete(String key) throws IOException {
    if (delete) {
      try {
        solr.deleteById(key);
        numDeletes++;
      } catch (final SolrServerException e) {
        throw makeIOException(e);
      }
    }
  }

  @Override
  public void update(NutchDocument doc) throws IOException {
    write(doc);
  }

  @Override
  public void commit() throws IOException {
    try {
      solr.commit();
      LOG.info("Total " + documentCount
          + (documentCount > 1 ? " documents are " : " document is ")
          + "added.");
    } catch (SolrServerException e) {
      throw makeIOException(e);
    }
  }

  public static IOException makeIOException(SolrServerException e) {
    final IOException ioe = new IOException();
    ioe.initCause(e);
    return ioe;
  }

  @Override
  public String describe() {
    StringBuffer sb = new StringBuffer("SOLRIndexWriter\n");
    sb.append("\t").append(SolrConstants.SERVER_URL)
        .append(" : URL of the SOLR instance (mandatory)\n");
    sb.append("\t").append(SolrConstants.COMMIT_SIZE)
        .append(" : buffer size when sending to SOLR (default 1000)\n");
    sb.append("\t")
        .append(SolrConstants.MAPPING_FILE)
        .append(
            " : name of the mapping file for fields (default solrindex-mapping.xml)\n");
    sb.append("\t").append(SolrConstants.USE_AUTH)
        .append(" : use authentication (default false)\n");
    sb.append("\t").append(SolrConstants.USERNAME)
        .append(" : username for authentication\n");
    sb.append("\t").append(SolrConstants.PASSWORD)
        .append(" : password for authentication\n");
    return sb.toString();
  }

}


text:
metroblockd
==============

Provides extended API functionality over metronotesd (such as market information, asset history, etc). Works alongside metronotesd.


text:
require 'spec_helper'

describe Booker::Models::ItineraryTimeSlotsList do
  it 'has the correct attributes' do
    ['ItineraryTimeSlots'].each do |attr|
      expect(subject).to respond_to(attr)
    end
  end
end