text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Popup image scaling - jQuery Mobile Demos</title>
	<link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
	<link rel="stylesheet" href="../../css/themes/default/jquery.mobile.css">
	<link rel="stylesheet" href="../_assets/css/jqm-demos.css">

 Demos

        Menu
        Search

Scaling images

The framework CSS contains rules that make images that are immediate children of the popup scale to fit the screen. Because of the absolute positioning of the popup container and screen, the height is not adjusted to screen height on all browsers. You can prevent vertical scrolling with a simple script that sets the max-height of the image.

The handler is bound to the popupbeforeposition event, which ensures the image is not only scaled before it is shown but also when the window is resized (e.g. orientation change). In this code example the height is reduced by 60 to take a top and bottom tolerance of 30 pixels into account.

			Photo landscape
			Photo portrait

				Close

				Close

	<?php include( '../jqm-navmenu.php' ); ?>

jQuery Mobile Demos version

Copyright 2014 The jQuery Foundation

<?php include( '../jqm-search.php' ); ?>


text:
var containerMock;
var ContainerMock = Ember.Object.extend({
  init: function() {
    this.injections    = [];
    this.registrations = {};
  },
  register: function(name, factory, options) {
    this.registrations[name] = {
      factory: factory,
      options: options
    };
  },
  lookup: function(name) {
    return this.registrations[name];
  },
  injection: function(target, property, name) {
    var registration = this.lookup(name);
    if (registration) {
      this.injections.push({
        target:   target,
        property: property,
        object:   registration.factory
      });
    }
  }
});

var applicationMock;
var ApplicationMock = Ember.Object.extend({
});

var authorizerMock;
var AuthorizerMock = Ember.Object.extend({
  authorize: function() {
    this.authorized = true;
  }
});
AuthorizerMock.reopenClass({
  create: function(options) {
    return (authorizerMock = this._super(options));
  }
});

var ajaxPrefilterMock;
var AjaxPrefilterMock = Ember.Object.extend({
  ajaxPrefilterCapture: function(prefilter) {
    this.registeredAjaxPrefilter = prefilter;
  }
});

module('Ember.SimpleAuth', {
  originalAjaxPrefilter: Ember.$.ajaxPrefilter,
  setup: function() {
    containerMock         = ContainerMock.create();
    applicationMock       = ApplicationMock.create();
    ajaxPrefilterMock     = AjaxPrefilterMock.create();
    Ember.$.ajaxPrefilter = Ember.$.proxy(ajaxPrefilterMock.ajaxPrefilterCapture, ajaxPrefilterMock);
  },
  teardown: function() {
    Ember.$.ajaxPrefilter = this.originalAjaxPrefilter;
  }
});

test('assigns the authentication route', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock, { authenticationRoute: 'somewhere' });

  equal(Ember.SimpleAuth.authenticationRoute, 'somewhere', 'Ember.SimpleAuth assigns authenticationRoute when specified for setup.');
});

test('assigns the route after authentication', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock, { routeAfterAuthentication: 'somewhere' });

  equal(Ember.SimpleAuth.routeAfterAuthentication, 'somewhere', 'Ember.SimpleAuth assigns routeAfterAuthentication when specified for setup.');
});

test('assigns the route after session invalidation', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock, { routeAfterInvalidation: 'somewhere' });

  equal(Ember.SimpleAuth.routeAfterInvalidation, 'somewhere', 'Ember.SimpleAuth assigns routeAfterInvalidation when specified for setup.');
});

test('registers the OAuth2 authenticator with the container', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock);
  var injection = containerMock.lookup('ember-simple-auth:authenticators:oauth2');

  equal(injection.factory, Ember.SimpleAuth.Authenticators.OAuth2, 'Ember.SimpleAuth registers the OAuth2 authenticator.');
});

test('injects the session in models, views, controllers and routes', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock);

  Ember.$.each(['model', 'view', 'controller', 'view'], function(i, component) {
    var injection = Ember.$.grep(containerMock.injections, function(injection) {
      return injection.target === component;
    })[0];

    equal(injection.object.constructor, Ember.SimpleAuth.Session, 'Ember.SimpleAuth injects the session into ' + component + '.');
    equal(injection.property, 'session', 'Ember.SimpleAuth makes the session available as "session" in ' + component + '.');
  });
});

test('assigns the store and container to the session', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock, { store: Ember.SimpleAuth.Stores.Ephemeral });

  var session = containerMock.injections[0].object;

  equal(session.container, containerMock, 'Ember.SimpleAuth assigns the container to the session.');
  equal(session.store.constructor, Ember.SimpleAuth.Stores.Ephemeral, 'Ember.SimpleAuth assigns the correct store to the session.');
});

test('registers an AJAX prefilter that authorizes requests', function() {
  Ember.SimpleAuth.setup(containerMock, applicationMock, { authorizer: AuthorizerMock });

  ajaxPrefilterMock.registeredAjaxPrefilter({ url: 'some' }, {}, {});
  ok(authorizerMock.authorized, "Ember.SimpleAuth registers an AJAX prefilter that authorizes requests that fo the the application's origin.");

  authorizerMock.authorized = false;
  ajaxPrefilterMock.registeredAjaxPrefilter({ url: 'https://a.different.domain:1234' }, {}, {});
  ok(!authorizerMock.authorized, 'Ember.SimpleAuth registers an AJAX prefilter that does not authorize cross-origin requests.');

  Ember.SimpleAuth.setup(containerMock, applicationMock, { crossOriginWhitelist: ['https://a.different.domain:1234'], authorizer: AuthorizerMock, store: Ember.SimpleAuth.Stores.Ephemeral });
  ajaxPrefilterMock.registeredAjaxPrefilter({ url: 'https://a.different.domain:1234' }, {}, {});
  ok(authorizerMock.authorized, 'Ember.SimpleAuth registers an AJAX prefilter that authorizes cross-origin requests when the origin is in the crossOriginWhitelist.');

  Ember.SimpleAuth.setup(containerMock, applicationMock, { crossOriginWhitelist: ['http://a.different.domain'], authorizer: AuthorizerMock, store: Ember.SimpleAuth.Stores.Ephemeral });
  ajaxPrefilterMock.registeredAjaxPrefilter({ url: 'http://a.different.domain:80' }, {}, {});
  ok(authorizerMock.authorized, 'Ember.SimpleAuth registers an AJAX prefilter that authorizes cross-origin requests when the origin is in the crossOriginWhitelist where default ports can be left out.');
});

redpajama_set_name: RedPajamaGithub


text:
package com.tommeng.simplejackexample.request;

import android.support.annotation.NonNull;

import okhttp3.FormBody;
import okhttp3.RequestBody;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class PostRequest extends BaseRequest {
    private Map<String, String> formParams = new HashMap<>();

    public PostRequest(@NonNull String url, @NonNull Class<?> responseType) {
        super(url, Method.POST, responseType);
    }

    @NonNull
    public Map<String, String> getFormParams() {
        return formParams;
    }

    public PostRequest setFormParams(@NonNull Map<String, String> formParams) {
        this.formParams = formParams;
        return this;
    }

    public PostRequest addFormParam(String key, String value) {
        this.formParams.put(key, value);
        return this;
    }

    @Override
    public RequestBody getRequestBody() {
        if (!formParams.isEmpty()) {
            FormBody.Builder builder = new FormBody.Builder();
            Set<Map.Entry<String, String>> entries = formParams.entrySet();
            for (Map.Entry<String, String> entry : entries) {
                builder.add(entry.getKey(), entry.getValue());
            }
            return builder.build();
        }
        return null;
    }
}


text:
package com.system.distribute.file.helper;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpContentDecompressor;

import io.netty.handler.stream.ChunkedWriteHandler;

public class HttpUploadClientIntializer extends ChannelInitializer<SocketChannel> {

    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        // Create a default pipeline implementation.
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("codec", new HttpClientCodec());

        // Remove the following line if you don't want automatic content decompression.
        pipeline.addLast("inflater", new HttpContentDecompressor());

        // to be used since huge file transfer
        pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());

        pipeline.addLast("handler", new HttpUploadClientHandler());
    }
}


text:
{% extends "!layout.html" %}

{% block rootrellink %}

home|

search|

documentation  »

{% endblock %}

{% block relbar1 %}

{{ super() }}
{% endblock %}

{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
{% block sidebar2 %}{% endblock %}


text:
<?php
//
// Plaintext Test
//

// Set content type
header("Content-type: text/plain");
// Set content length
header("Content-Length: 13");

?>
Hello, World!


text:
'use strict'

/**
 * Module dependencies.
 */

const originalServeStatic = require('serve-static')

/**
 * @param {String} root
 * @param {Object} options
 * @return {Promise}
 * @api public
 */

function serveStatic(root, options) {
  const fn = originalServeStatic(root, options)
  return (ctx, next) => {
    return new Promise((resolve, reject) => {
      // hacked statusCode
      if (ctx.status === 404) ctx.status = 200
      // unnecessary response by koa
      ctx.respond = false
      // 404, serve-static forward non-404 errors
      // force throw error
      fn(ctx.req, ctx.res, reject)
    })
  }
}

module.exports = serveStatic


text:
import unittest
from unittest.mock import Mock
from django.db.models import Model, Manager
from django.forms import HiddenInput, TextInput
from django_lookup_widgets.widgets import LookupPopupWidget
from django_lookup_widgets_tests.models import ModelStub

class LookupPopupWidgetTests(unittest.TestCase):

    _search_button_label = "SEARCH"

    def setUp(self):
        model_class = Mock(Model)
        model_class.objects = Mock(Manager)
        model_class.objects.get = Mock(return_value=ModelStub())

        self.get_model = Mock(return_value=model_class)

        self.subject = LookupPopupWidget("models.Model",
                                         "url",
                                         model_loader=self.get_model,
                                         search_button_label=self._search_button_label,
                                         height=1,
                                         width=1)

    def test_model_is_loaded_when_decompressing(self):
        self.subject.decompress("pk")
        self.get_model.assert_called_once_with("models.Model")

    def test_decompress_returns_a_two_None_values_list(self):
        decompressed_data = self.subject.decompress(None)

        self.assertEqual(len(decompressed_data), 2)
        self.assertListEqual(decompressed_data, [None, None])

    def test_decompress_returns_a_two_filled_elements_list(self):
        decompressed_data = self.subject.decompress(object())

        self.assertEqual(len(decompressed_data), 2)
        self.assertListEqual(decompressed_data, [1, 'value'])

    def test_render_append_button_at_the_end_of_widget(self):
        widget_name = "widget_name"

        popup_call = "window.open('url', '%s', 'width=1,height=1')" % widget_name

        expected_button = self._build_button_html(popup_call, widget_name)

        rendered_widget = self.subject.render(widget_name, "widget value")

        self.assertTrue(rendered_widget.endswith(expected_button))

    def test_has_two_sub_widgets_one_hidden_and_one_text(self):
        self.assertEqual(len(self.subject.widgets), 2)

        self.assertIsInstance(self.subject.widgets[0], HiddenInput)
        self.assertIsInstance(self.subject.widgets[1], TextInput)

    def _build_button_html(self, popup_call, widget_name):
        button_template = "<button type='button' id='%s' onclick=\"%s\">%s</button>"
        return button_template % (widget_name, popup_call, self._search_button_label)


text:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <corners android:radius="10dip"/>
    <gradient
        android:startColor="#F0B0FF"
        android:centerColor="@color/pinkish"
        android:endColor="#F0B0FF"
        android:type="linear"
        android:angle="135"/>
</shape>


text:
Spree::Product.class_eval do
  include AlgoliaProductIndex
end


text:
/* tslint:disable:max-line-length */
/**
 * Test Swagger
 * v1
 * example.com/api-base-path
 */

import {HttpErrorResponse} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Actions, Effect, ofType} from '@ngrx/effects';

import {of} from 'rxjs';

import {catchError, map, switchMap} from 'rxjs/operators';
import {OrderService} from '../../../../controllers/Order';
import * as actions from './actions';

@Injectable()
export class OrderEffects {
  @Effect()
  Order = this.storeActions.pipe(
    ofType<actions.Start>(actions.Actions.START),
    switchMap((action: actions.Start) => this.orderService.order(action.payload)
      .pipe(
        map(result => new actions.Success(result)),
        catchError((error: HttpErrorResponse) => of(new actions.Error(error))),
      ),
    ),
  );

  constructor(
    private storeActions: Actions,
    private orderService: OrderService,
  ) {}
}


text:
module.exports = {

  test: {
    client: 'pg',
    connection: 'postgres://localhost/weddingdbtest',
    migrations: {
      directory: __dirname + '/server/db/migrations'
    },
    seeds: {
      directory: __dirname + '/server/db/seeds/test'
    }
  },
  development: {
    client: 'pg',
    connection: 'postgres://localhost/weddingdb',
    migrations: {
      directory: __dirname + '/server/db/migrations'
    },
    seeds: {
      directory: __dirname + '/server/db/seeds/development'
    }
  },
  production: {
    client: 'pg',
    connection: process.env.DATABASE_URL,
    migrations: {
      directory: __dirname + '/server/db/migrations'
    },
    seeds: {
      directory: __dirname + '/server/db/seeds/production'
    }
  }
}


text:
import time
import json
from chatbot.utils import *

def render_weather(t):
    if hasattr(t.module, 'location'):
        location = t.module.location
    else:
        location = get_location()
        if location:
            if 'city' in location:
                location = location.get('city')
    city = query_city_info(location)
    if 'id' in city:
        id = city['id']
        weather = get_weather_by_id(id)
        weather_prop = parse_weather(weather)
        desc = weather_prop['weather']
        temperature = '{} degrees'.format(weather_prop['temperature'])
        return t.render(weatherdesc=desc, temperature=temperature, location=city)

def render_location(t):
    location = get_location()
    if location:
        neighborhood = location.get('neighborhood')
        city = location.get('city')
        if city:
            if neighborhood:
                location = '%s %s' % (neighborhood, city)
            else:
                location = city
            if location:
                return t.render(location=location)
            else:
                logger.warn("Can't find location")

def render_face_emotion(t):
    time.sleep(3)
    emotion = get_emotion(3) # the the emotion in the past 3 secs
    if emotion is not None:
        return t.render(faceemotion=emotion)

def render_object_detected(t):
    time.sleep(3)
    item = get_detected_object(10)
    if item is not None:
        item = ' '.join(item.split('_'))
        return t.render(objectdetected=item)


text:
namespace gnr{

class Plane : public Shape
{
public :
	Plane();
	void draw(GLint a);
	void draw();
	static void drawPlaneMultiple(mPolygon polygon, Vector3d &normal, int step, GLint texture, bool wholeTexture);// draw plane with given corner
	static void drawPlane2(mPolygon &vertexes, Vector3d &normal);// draw a plane
	void drawPlane(mPolygon &p, GLint texture);
	~Plane();
	Plane(GLfloat x, GLfloat y, GLfloat z, GLfloat length,GLfloat width,Vector3d &dir);
	Vector3d direction;// plane dir,normal
	GLfloat planelength;
	GLfloat planewidth;
};

}//namespace gnr
#endif


text:
package com.github.davidmoten.rtree;

import static com.github.davidmoten.rtree.geometry.Geometries.rectangle;
import static org.junit.Assert.*;

import org.junit.Test;

import com.github.davidmoten.rtree.geometry.Rectangle;

public class RectangleTest {

    private static final double PRECISION = 0.00001;

    @Test
    public void testDistanceToSelfIsZero() {
        Rectangle r = rectangle(0, 0, 1, 1);
        assertEquals(0, r.distance(r), PRECISION);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testXParametersWrongOrderThrowsException() {
        rectangle(2, 0, 1, 1);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testYParametersWrongOrderThrowsException() {
        rectangle(0, 2, 1, 1);
    }

    @Test
    public void testDistanceToOverlapIsZero() {
        Rectangle r = rectangle(0, 0, 2, 2);
        Rectangle r2 = rectangle(1, 1, 3, 3);

        assertEquals(0, r.distance(r2), PRECISION);
        assertEquals(0, r2.distance(r), PRECISION);
    }

    @Test
    public void testDistanceWhenSeparatedByXOnly() {
        Rectangle r = rectangle(0, 0, 2, 2);
        Rectangle r2 = rectangle(3, 0, 4, 2);

        assertEquals(1, r.distance(r2), PRECISION);
        assertEquals(1, r2.distance(r), PRECISION);
    }

    @Test
    public void testDistanceWhenSeparatedByXOnlyAndOverlapOnY() {
        Rectangle r = rectangle(0, 0, 2, 2);
        Rectangle r2 = rectangle(3, 1.5f, 4, 3.5f);

        assertEquals(1, r.distance(r2), PRECISION);
        assertEquals(1, r2.distance(r), PRECISION);
    }

    @Test
    public void testDistanceWhenSeparatedByDiagonally() {
        Rectangle r = rectangle(0, 0, 2, 1);
        Rectangle r2 = rectangle(3, 6, 10, 8);

        assertEquals(Math.sqrt(26), r.distance(r2), PRECISION);
        assertEquals(Math.sqrt(26), r2.distance(r), PRECISION);
    }

    @Test
    public void testInequalityWithNull() {
        assertFalse(rectangle(0, 0, 1, 1).equals(null));
    }

    @Test
    public void testSimpleEquality() {
        Rectangle r = rectangle(0, 0, 2, 1);
        Rectangle r2 = rectangle(0, 0, 2, 1);

        assertTrue(r.equals(r2));
    }

    @Test
    public void testSimpleInEquality1() {
        Rectangle r = rectangle(0, 0, 2, 1);
        Rectangle r2 = rectangle(0, 0, 2, 2);

        assertFalse(r.equals(r2));
    }

    @Test
    public void testSimpleInEquality2() {
        Rectangle r = rectangle(0, 0, 2, 1);
        Rectangle r2 = rectangle(1, 0, 2, 1);

        assertFalse(r.equals(r2));
    }

    @Test
    public void testSimpleInEquality3() {
        Rectangle r = rectangle(0, 0, 2, 1);
        Rectangle r2 = rectangle(0, 1, 2, 1);

        assertFalse(r.equals(r2));
    }

    @Test
    public void testSimpleInEquality4() {
        Rectangle r = rectangle(0, 0, 2, 2);
        Rectangle r2 = rectangle(0, 0, 1, 2);

        assertFalse(r.equals(r2));
    }

    @Test
    public void testGeometry() {
        Rectangle r = rectangle(0, 0, 2, 1);
        assertTrue(r.equals(r.geometry()));
    }

    @Test
    public void testIntersects() {
        Rectangle a = rectangle(14, 14, 86, 37);
        Rectangle b = rectangle(13, 23, 50, 80);
        assertTrue(a.intersects(b));
        assertTrue(b.intersects(a));
    }

    @Test
    public void testIntersectsNoRectangleContainsCornerOfAnother() {
        Rectangle a = rectangle(10, 10, 50, 50);
        Rectangle b = rectangle(28.0, 4.0, 34.0, 85.0);
        assertTrue(a.intersects(b));
        assertTrue(b.intersects(a));
    }

    @Test
    public void testIntersectsOneRectangleContainsTheOther() {
        Rectangle a = rectangle(10, 10, 50, 50);
        Rectangle b = rectangle(20, 20, 40, 40);
        assertTrue(a.intersects(b));
        assertTrue(b.intersects(a));
    }

    @Test
    public void testContains() {
        Rectangle r = rectangle(10,20,30,40);
        assertTrue(r.contains(20,30));
    }

    @Test
    public void testContainsReturnsFalseWhenLessThanMinY() {
        Rectangle r = rectangle(10,20,30,40);
        assertFalse(r.contains(20,19));
    }

    @Test
    public void testContainsReturnsFalseWhenGreaterThanMaxY() {
        Rectangle r = rectangle(10,20,30,40);
        assertFalse(r.contains(20,41));
    }

    @Test
    public void testContainsReturnsFalseWhenGreaterThanMaxX() {
        Rectangle r = rectangle(10,20,30,40);
        assertFalse(r.contains(31,30));
    }

    @Test
    public void testContainsReturnsFalseWhenLessThanMinX() {
        Rectangle r = rectangle(10,20,30,40);
        assertFalse(r.contains(9,30));
    }

}


text: Template with angular and bootstrap, perfect to start your app.


text:
<?php

/** ScalarResult DAO. */
class Validation_ScalarResultDao extends AppDao
{
    public $_model = 'ScalarResult';
    public $_module = 'validation';
}


text:
<!doctype html>

    <title>Upvote</title>
    <meta content="initial-scale=1" name="viewport">

    <base href="/">

    <meta charset="utf-8">

    <link rel="stylesheet" href="/app_css.css">
    <link rel="icon" href="/static/images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Extended" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <md-content id="uv-all-content" layout="row" flex>
      <uv-sidenav is-open="main.isSidenavOpen" is-admin="false">
        <uv-nav-button
          uv-href="/blockables"
          icon="list_alt"
          title="Applications">
        </uv-nav-button>
        <uv-nav-button
          uv-href="/hosts"
          icon="computer"
          title="Hosts">
        </uv-nav-button>
      </uv-sidenav>

        <uv-titlebar is-sidenav-open="main.isSidenavOpen" ng-cloak>{{main.page.title}}</uv-titlebar>

          <ng-view></ng-view>

    </md-content>

    {# Load AngularJS from the CDN. These are likely to be cached in the user's
      browser already and we don't need to serve them. #}

    {% if debug %}

    {% else %}

    {% endif %}


text:
<?php

declare(strict_types=1);

namespace Biplane\YandexDirect\Api\V5\Contract;

/**
 * Auto-generated code.
 */
class PrivilegeEnum
{
    public const EDIT_CAMPAIGNS = 'EDIT_CAMPAIGNS';

    public const IMPORT_XLS = 'IMPORT_XLS';

    public const TRANSFER_MONEY = 'TRANSFER_MONEY';
}


text:
package vnpt.technology.ssdc.model;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;

/**
 * This class is used to represent an address with address,
 * city, province and postal-code information.
 *
 * @author Matt Raible
 */
@Embeddable
@Indexed
public class Address extends BaseObject implements Serializable {
    private static final long serialVersionUID = 3617859655330969141L;
    private String address;
    private String city;
    private String province;
    private String country;
    private String postalCode;

    @Column(length = 150)
    @Field
    public String getAddress() {
        return address;
    }

    @Column(length = 50)
    @Field
    public String getCity() {
        return city;
    }

    @Column(length = 100)
    @Field
    public String getProvince() {
        return province;
    }

    @Column(length = 100)
    @Field
    public String getCountry() {
        return country;
    }

    @Column(name = "postal_code", length = 15)
    @Field(analyze= Analyze.NO)
    public String getPostalCode() {
        return postalCode;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    /**
     * Overridden equals method for object comparison. Compares based on hashCode.
     *
     * @param o Object to compare
     * @return true/false based on hashCode
     */
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Address)) {
            return false;
        }

        final Address address1 = (Address) o;

        return this.hashCode() == address1.hashCode();
    }

    /**
     * Overridden hashCode method - compares on address, city, province, country and postal code.
     *
     * @return hashCode
     */
    public int hashCode() {
        int result;
        result = (address != null ? address.hashCode() : 0);
        result = 29 * result + (city != null ? city.hashCode() : 0);
        result = 29 * result + (province != null ? province.hashCode() : 0);
        result = 29 * result + (country != null ? country.hashCode() : 0);
        result = 29 * result + (postalCode != null ? postalCode.hashCode() : 0);
        return result;
    }

    /**
     * Returns a multi-line String with key=value pairs.
     *
     * @return a String representation of this class.
     */
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("country", this.country)
                .append("address", this.address)
                .append("province", this.province)
                .append("postalCode", this.postalCode)
                .append("city", this.city).toString();
    }
}


text:
'use strict';

var ImageStylePropTypes = require('ImageStylePropTypes');
var TextStylePropTypes = require('TextStylePropTypes');
var ViewStylePropTypes = require('ViewStylePropTypes');

var keyMirror = require('keyMirror');
var matricesDiffer = require('matricesDiffer');
var processColor = require('processColor');
var processTransform = require('processTransform');
var sizesDiffer = require('sizesDiffer');

var ReactNativeStyleAttributes = {
  ...keyMirror(ViewStylePropTypes),
  ...keyMirror(TextStylePropTypes),
  ...keyMirror(ImageStylePropTypes),
};

ReactNativeStyleAttributes.transform = { process: processTransform };
ReactNativeStyleAttributes.transformMatrix = { diff: matricesDiffer };
ReactNativeStyleAttributes.shadowOffset = { diff: sizesDiffer };

// Do not rely on this attribute.
ReactNativeStyleAttributes.decomposedMatrix = 'decomposedMatrix';

var colorAttributes = { process: processColor };
ReactNativeStyleAttributes.backgroundColor = colorAttributes;
ReactNativeStyleAttributes.borderBottomColor = colorAttributes;
ReactNativeStyleAttributes.borderColor = colorAttributes;
ReactNativeStyleAttributes.borderLeftColor = colorAttributes;
ReactNativeStyleAttributes.borderRightColor = colorAttributes;
ReactNativeStyleAttributes.borderTopColor = colorAttributes;
ReactNativeStyleAttributes.color = colorAttributes;
ReactNativeStyleAttributes.shadowColor = colorAttributes;
ReactNativeStyleAttributes.textDecorationColor = colorAttributes;
ReactNativeStyleAttributes.tintColor = colorAttributes;
ReactNativeStyleAttributes.textShadowColor = colorAttributes;

module.exports = ReactNativeStyleAttributes;


text:
  <!DOCTYPE html>

    <% if (htmlWebpackPlugin.options.trackJSToken) { %>

    <% } %>
  <meta charset="UTF-8">

Users

      Id
      First Name
      Last Name
      Email


text:
package com.tgb.media.server.models;

public class Response<T> {

    public String status;
    public String error;
    public T[] results;

}


text:
//=============================================================================
/**
 *  @file  Bug_4189_Regression_Test.cpp
 *
 * This test shows the reuse address issue on broadcast sockets.
 * Start two process instances of this test on the same host within x sec.
 * For broadcast sockets it should be possible to open the same port more than
 * once at the time on a host.
 */
//=============================================================================

#include "test_config.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Log_Msg.h"
#include "ace/SOCK_Dgram_Bcast.h"
#include "ace/Thread_Manager.h"

int result = 0;

const int UDP_PORT = 3000;
const int SEC_TO_KEEP_SOCKET_OPEN = 2;

#if defined (ACE_HAS_THREADS)

int reuseAddr_test (void)
{
# if defined ACE_WIN32 || !defined ACE_LACKS_IOCTL
  ACE_SOCK_Dgram_Bcast sock1;
  if (sock1.open(ACE_INET_Addr(UDP_PORT),PF_INET,0,1) != 0)
  {
    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not open socket for broadcast on port %d\n"), UDP_PORT ));
    ++result;
  }
  else
  {
    // Keep the socket open for some time
    ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Opened socket on port %d and keep it open for %d sec\n"), UDP_PORT,  SEC_TO_KEEP_SOCKET_OPEN));

    ACE_OS::sleep(ACE_Time_Value(SEC_TO_KEEP_SOCKET_OPEN,0));

    sock1.close();
  }
# endif
  return result;
}

/* \brief Thread main function to run run_receiver function
   \note run_receiver return valu is stored in receiver_exit_code global variable
*/
static ACE_THR_FUNC_RETURN run_thread_receiver (void *)
{
  reuseAddr_test ();
  return 0;
}
#endif /* defined (ACE_HAS_THREADS) */

int run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Bug_4189_Regression_Test"));

#if defined (ACE_HAS_THREADS)
  if (ACE_Thread_Manager::instance ()->spawn_n (2, run_thread_receiver) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       ACE_TEXT ("spawn_n ()")), -1);

  ACE_Thread_Manager::instance ()->wait ();
#endif

  ACE_END_TEST;
  return result;
}


text:
package com.raizlabs.android.databasecomparison.interfaces;

/**
 * Description:
 */
public interface IContact<AddressBook extends IAddressBook> extends ISaveable {

    public String getName();

    public void setName(String name);

    public String getEmail();

    public void setEmail(String email);

    public AddressBook getAddressBookField();

    public void setAddressBook(AddressBook addressBook);
}


text:
#ifndef SkRTree_DEFINED
#define SkRTree_DEFINED

#include "SkBBoxHierarchy.h"
#include "SkRect.h"
#include "SkTDArray.h"

/**
 * An R-Tree implementation. In short, it is a balanced n-ary tree containing a hierarchy of
 * bounding rectangles.
 *
 * It only supports bulk-loading, i.e. creation from a batch of bounding rectangles.
 * This performs a bottom-up bulk load using the STR (sort-tile-recursive) algorithm.
 *
 * TODO: Experiment with other bulk-load algorithms (in particular the Hilbert pack variant,
 * which groups rects by position on the Hilbert curve, is probably worth a look). There also
 * exist top-down bulk load variants (VAMSplit, TopDownGreedy, etc).
 *
 * For more details see:
 *
 *  Beckmann, N.; Kriegel, H. P.; Schneider, R.; Seeger, B. (1990). "The R*-tree:
 *      an efficient and robust access method for points and rectangles"
 */
class SkRTree : public SkBBoxHierarchy {
public:

    /**
     * If you have some prior information about the distribution of bounds you're expecting, you
     * can provide an optional aspect ratio parameter. This allows the bulk-load algorithm to
     * create better proportioned tiles of rectangles.
     */
    explicit SkRTree(SkScalar aspectRatio = 1);
    ~SkRTree() override {}

    void insert(const SkRect[], int N) override;
    void search(const SkRect& query, SkTDArray<int>* results) const override;
    size_t bytesUsed() const override;

    // Methods and constants below here are only public for tests.

    // Return the depth of the tree structure.
    int getDepth() const { return fCount ? fRoot.fSubtree->fLevel + 1 : 0; }
    // Insertion count (not overall node count, which may be greater).
    int getCount() const { return fCount; }

    // Get the root bound.
    SkRect getRootBound() const override;

    // These values were empirically determined to produce reasonable performance in most cases.
    static const int kMinChildren = 6,
                     kMaxChildren = 11;

private:
    struct Node;

    struct Branch {
        union {
            Node* fSubtree;
            int fOpIndex;
        };
        SkRect fBounds;
    };

    struct Node {
        uint16_t fNumChildren;
        uint16_t fLevel;
        Branch fChildren[kMaxChildren];
    };

    void search(Node* root, const SkRect& query, SkTDArray<int>* results) const;

    // Consumes the input array.
    Branch bulkLoad(SkTDArray<Branch>* branches, int level = 0);

    // How many times will bulkLoad() call allocateNodeAtLevel()?
    static int CountNodes(int branches, SkScalar aspectRatio);

    Node* allocateNodeAtLevel(uint16_t level);

    // This is the count of data elements (rather than total nodes in the tree)
    int fCount;
    SkScalar fAspectRatio;
    Branch fRoot;
    SkTDArray<Node> fNodes;

    typedef SkBBoxHierarchy INHERITED;
};

#endif


text:
using UnityEngine;
using System;
using LuaInterface;
using SLua;
using System.Collections.Generic;
public class Lua_UnityEngine_CombineInstance : LuaObject {
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.CombineInstance o;
			o=new UnityEngine.CombineInstance();
			pushValue(l,o);
			return 1;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int get_mesh(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			pushValue(l,self.mesh);
			return 1;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int set_mesh(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			UnityEngine.Mesh v;
			checkType(l,2,out v);
			self.mesh=v;
			setBack(l,self);
			return 0;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int get_subMeshIndex(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			pushValue(l,self.subMeshIndex);
			return 1;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int set_subMeshIndex(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			int v;
			checkType(l,2,out v);
			self.subMeshIndex=v;
			setBack(l,self);
			return 0;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int get_transform(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			pushValue(l,self.transform);
			return 1;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static public int set_transform(IntPtr l) {
		try {
			UnityEngine.CombineInstance self;
			checkValueType(l,1,out self);
			UnityEngine.Matrix4x4 v;
			checkValueType(l,2,out v);
			self.transform=v;
			setBack(l,self);
			return 0;
		}
		catch(Exception e) {
			LuaDLL.luaL_error(l, e.ToString());
			return 0;
		}
	}
	static public void reg(IntPtr l) {
		getTypeTable(l,"UnityEngine.CombineInstance");
		addMember(l,"mesh",get_mesh,set_mesh,true);
		addMember(l,"subMeshIndex",get_subMeshIndex,set_subMeshIndex,true);
		addMember(l,"transform",get_transform,set_transform,true);
		createTypeMetatable(l,constructor, typeof(UnityEngine.CombineInstance),typeof(System.ValueType));
	}
}


text:
package de.rweber.wishlist.ui_interface;
import java.io.IOException;
import java.util.List;
import java.util.UUID;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.labs.repackaged.com.google.common.base.Throwables;

import de.rweber.wishlist.ServiceBus;
import de.rweber.wishlist.command_side.commands.AddItemToWishListCommand;
import de.rweber.wishlist.command_side.commands.ChangeNameOfWishListCommand;
import de.rweber.wishlist.command_side.commands.ClearWishListCommand;
import de.rweber.wishlist.command_side.commands.CreateWishListCommand;
import de.rweber.wishlist.command_side.commands.DeleteWishListCommand;
import de.rweber.wishlist.command_side.commands.RemoveItemFromWishListCommand;
import de.rweber.wishlist.event_store.EventStore;
import de.rweber.wishlist.logging.WebPageHandler;
import de.rweber.wishlist.query_side.IQueryFacade;
import de.rweber.wishlist.query_side.QueryFacade;
import de.rweber.wishlist.query_side.dto.WishListDto;

@SuppressWarnings("serial")
public class WishlistServlet extends HttpServlet {

	//Get wishlist
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
	{
		prepareAndSendRedirect(req, resp, null);
	}

	//Create wish list, change wish list (change name, add item to wish list, clear wish list, remove item from wish list),
	//delete wish list
	public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
	{
		try
		{
			processPost(req, resp);
		}
		catch(Exception e)
		{
			prepareAndSendRedirect(req, resp, Throwables.getRootCause(e).getMessage());
		}
	}

	private void processPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
	{
		ServiceBus bus = ServiceBus.getServiceBus();

		if(((String)req.getParameter("_method")).equals("post"))
		{
			CreateWishListCommand createWishListCommand = new CreateWishListCommand(UUID.randomUUID(), "Wish list");
			bus.Send(createWishListCommand);
		}
		else if(((String)req.getParameter("_method")).equals("put"))
		{
			UUID id = UUID.fromString(req.getParameter("wishlist-id"));

			@SuppressWarnings("unchecked")
			int version = getCurrentVersionOfAggregate((List<WishListDto>)req.getSession().getAttribute("wishLists"), id);

			switch(Integer.parseInt((String)req.getParameter("change-action")))
			{
				case 0: //Change name
					ChangeNameOfWishListCommand changeNameOfWishListCommand = new ChangeNameOfWishListCommand(id, req.getParameter("new-name"), version);
					bus.Send(changeNameOfWishListCommand);
					break;
				case 1: //Clear
					ClearWishListCommand clearWishListCommand = new ClearWishListCommand(id, version);
					bus.Send(clearWishListCommand);
					break;
				case 2: //Add item
					AddItemToWishListCommand addItemToWishListCommand = new AddItemToWishListCommand(id, UUID.randomUUID(), req.getParameter("item-name"), req.getParameter("item-price"), version);
					bus.Send(addItemToWishListCommand);
					break;
				case 3: //Delete item
					RemoveItemFromWishListCommand removeItemFromWishListCommand = new RemoveItemFromWishListCommand(id, UUID.fromString(req.getParameter("item-id")), version);
					bus.Send(removeItemFromWishListCommand);
					break;
			}
		}
		else
		{
			UUID id = UUID.fromString(req.getParameter("wishlist-id"));

			@SuppressWarnings("unchecked")
			int version = getCurrentVersionOfAggregate((List<WishListDto>)req.getSession().getAttribute("wishLists"), id);

			DeleteWishListCommand deleteWishListCommand = new DeleteWishListCommand(id, version);
			bus.Send(deleteWishListCommand);
		}

		prepareAndSendRedirect(req, resp, null);
	}

	private void prepareAndSendRedirect(HttpServletRequest req, HttpServletResponse resp, String errMsg) throws ServletException, IOException
	{
		IQueryFacade queryFacade = new QueryFacade();
		List<WishListDto> wishLists = queryFacade.GetWishLists();

		req.getSession().setAttribute("wishLists", wishLists);
		req.setAttribute("status", errMsg);
		req.setAttribute("webLog", WebPageHandler.getWebPageLog());
		req.setAttribute("eventStoreLog", EventStore.GetEvents());

		req.getRequestDispatcher("/index.jsp").forward(req, resp);
	}

	private int getCurrentVersionOfAggregate(List<WishListDto> wishLists, UUID id)
	{
		int version = 0;

		for(WishListDto wld : wishLists)
		{
			if(wld.getId().equals(id))
			{
				version = wld.getVersion();
			}
		}

		return version;
	}
}


text:
'use strict';

var BaseModel = require("model-toolkit").BaseModel;
var Product = require('./product');

module.exports = class ThreadSpecification extends BaseModel {
    constructor(source) {
        super('thread-specification', '1.0.0');

        this.productId = {};
        this.product = new Product();
        this.rpm=0;
        this.spindle=0;
        this.tpi=0;

        this.copy(source);
    }
};


text:
package org.hisp.dhis.android.core.common;

import androidx.annotation.Nullable;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.gabrielittner.auto.value.cursor.ColumnAdapter;
import com.gabrielittner.auto.value.cursor.ColumnName;

import org.hisp.dhis.android.core.arch.db.adapters.custom.internal.DateFilterPeriodColumnAdapter;
import org.hisp.dhis.android.core.arch.db.adapters.custom.internal.StringSetColumnAdapter;
import org.hisp.dhis.android.core.common.tableinfo.ItemFilterTableInfo;

import java.util.Set;

public abstract class FilterOperators {

    /**
     * Less than or equal to
     */
    @Nullable
    @JsonProperty()
    public abstract String le();

    /**
     * Greater than or equal to
     */
    @Nullable
    @JsonProperty()
    public abstract String ge();

    /**
     * Greater than
     */
    @Nullable
    @JsonProperty()
    public abstract String gt();

    /**
     * Lesser than
     */
    @Nullable
    @JsonProperty()
    public abstract String lt();

    /**
     * Equal to
     */
    @Nullable
    @JsonProperty()
    public abstract String eq();

    /**
     * In a list
     */
    @Nullable
    @JsonProperty()
    @ColumnAdapter(StringSetColumnAdapter.class)
    @ColumnName(ItemFilterTableInfo.Columns.IN)
    public abstract Set<String> in();

    /**
     * Like
     */
    @Nullable
    @JsonProperty()
    public abstract String like();

    /**
     * If the dataItem is of type date, then date filtering parameters are specified using this.
     */
    @Nullable
    @JsonProperty()
    @ColumnAdapter(DateFilterPeriodColumnAdapter.class)
    public abstract DateFilterPeriod dateFilter();

    @JsonPOJOBuilder(withPrefix = "")
    public static abstract class Builder<T extends Builder> {

        public abstract T le(String le);

        public abstract T ge(String ge);

        public abstract T gt(String gt);

        public abstract T lt(String lt);

        public abstract T eq(String eq);

        public abstract T in(Set<String> in);

        public abstract T like(String like);

        public abstract T dateFilter(DateFilterPeriod dateFilter);
    }
}


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

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Alfresco Upload - Options</title>
	<link rel="stylesheet" type="text/css" href="../css/options.css">
	<link rel="stylesheet" type="text/css" href="../css/nprogress.css">
	<link rel="stylesheet" type="text/css" href="../entypo-font/css/entypo.css">

		Root Alfresco<input id="alfresco-root" type="text" placeholder="Root Alfresco">


text:
/****************************************************************************
** Meta object code from reading C++ file 'qhistogram.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.5.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include "../../QtBicVis/qhistogram.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qhistogram.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.5.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_qHistogram_t {
    QByteArrayData data[1];
    char stringdata0[11];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
    Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
    qptrdiff(offsetof(qt_meta_stringdata_qHistogram_t, stringdata0) + ofs \
        - idx * sizeof(QByteArrayData)) \
    )
static const qt_meta_stringdata_qHistogram_t qt_meta_stringdata_qHistogram = {
    {
QT_MOC_LITERAL(0, 0, 10) // "qHistogram"

    },
    "qHistogram"
};
#undef QT_MOC_LITERAL

static const uint qt_meta_data_qHistogram[] = {

 // content:
       7,       // revision
       0,       // classname
       0,    0, // classinfo
       0,    0, // methods
       0,    0, // properties
       0,    0, // enums/sets
       0,    0, // constructors
       0,       // flags
       0,       // signalCount

       0        // eod
};

void qHistogram::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
    Q_UNUSED(_o);
    Q_UNUSED(_id);
    Q_UNUSED(_c);
    Q_UNUSED(_a);
}

const QMetaObject qHistogram::staticMetaObject = {
    { &qPlotWindow::staticMetaObject, qt_meta_stringdata_qHistogram.data,
      qt_meta_data_qHistogram,  qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};

const QMetaObject *qHistogram::metaObject() const
{
    return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}

void *qHistogram::qt_metacast(const char *_clname)
{
    if (!_clname) return Q_NULLPTR;
    if (!strcmp(_clname, qt_meta_stringdata_qHistogram.stringdata0))
        return static_cast<void*>(const_cast< qHistogram*>(this));
    return qPlotWindow::qt_metacast(_clname);
}

int qHistogram::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = qPlotWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    return _id;
}
QT_END_MOC_NAMESPACE


text:
cask 'graphql-playground' do
  version '1.6.2'
  sha256 'a26effde7d740f35e1d5aaa2ec937a1989f6ae5fd9c86361210d5e333b4cc234'

  url "https://github.com/prismagraphql/graphql-playground/releases/download/#{version}/graphql-playground-electron-#{version}.dmg"
  appcast 'https://github.com/prismagraphql/graphql-playground/releases.atom'
  name 'GraphQL Playground'
  homepage 'https://github.com/prismagraphql/graphql-playground'

  app 'GraphQL Playground.app'
end


text:
By default, Sprint comes with a flat directory structure that makes it simple to drop into any web root -- whether localhost or a primary domain on cPanel hosting -- and have it up and running quickly. It works simply for both newer developers and more experienced developers. But it does have its drawback from a security standpoint.

> DISCLAIMER: I am, by no means, a security expert. Any knowledge that I have has been gathered from reading articles from people smarter and more experienced than I am. If you know that I've explained something incorrectly and can tell me the correct solution, or can point to research that invalidates anything said here, please feel free to drop me a line and correct me. I'll make sure to read through it and try to correct either my docs or the code itself.

## What Are The Security Risks
The largest risk is that of a server mis-configuration. It can easily happen, and has happened to even [large corporations like Facebook](http://blog.eun.org/drizzdo/2007/08/facebook_source_code_exposed.html). While typically not devastating, a misconfigured server can send raw source code as text to the browser, instead of running the PHP code itself.

This has two primary ramifications:

- **Source Code Scanning** - outsiders can scan the code the determine things about the site, like the structure, potentially the framework used, etc. All of this information can then be used to determine a plan of attack against the site if the outsider wishes harm. Any known security issues with the framework can then be put into play once they've determined the system it's built on.
- **Configuration Revealed** - Potentially worse, is that they could see the configuration settings of your application and get your database information, or the API settings for your credit card processor, your email service, and more.

While sites have run in the web root for as long as the web has been around, when security is a concern -- which it should be for any site that allows user login -- the more difficult you make it for an intruder to gain any information about your site, the more difficult is it for them to hack it.

## What Is The Solution?
The best solution against this type of mistake is to move as much of your site's code out of the web root as possible. You will need to keep the site's index file and any assets (stylesheets, javascript, images, etc) in the web root, but all other folders can be placed up a level, just outside of web root. To make that work, you would need to modify the following items.

### Index File - Folder Locations
In the main index file (the one that is now in the web root, or public, folder), you need to tell it where it can find a few items, like the rest of the code...

- **autoloader** - modify the include path of the autoloader to point to the new location ( `../vendor/autoload.php` )
- **system_path** - `../system`
- **application_folder** - `../application`

### Module Locations
The module locations currently use `FCPATH` to locate the `myth` folder. Open up `application/config/config.php` and modify the locations as needed.

	$config['modules_locations'] = array(
		APPPATH .'modules/',
		APPPATH .'../myth/CIModules/'
	);

### Theme Locations
Similar to the module locations, the themes will need to be relocated. In default Sprint, there is no magic assets handler. If you've implemented something like that you can, and should, leave the themes out of the web root. Otherwise, you will need to move your `themes` folder into the web root so that the assets can be found that are specific to the theme.

Then, open up `application/config/application.php` and modify the theme locations to point to the new location.

	$config['theme.paths'] = array(
		'bootstrap'  => FCPATH .'themes/bootstrap3',
		'foundation' => FCPATH .'themes/foundation5',
		'docs'       => FCPATH .'themes/docs',
		'email'      => FCPATH .'themes/email'
	);

### sprint File
The `sprint` CLI script will also need to have the `$apppath` variable modified to point to the new `APPPATH` location.


text:
namespace cc {

class CC_EXPORT LayerAnimationValueObserver {
 public:
  virtual ~LayerAnimationValueObserver() { }

  virtual void OnOpacityAnimated(float) = 0;
  virtual void OnTransformAnimated(const gfx::Transform&) = 0;

  virtual bool IsActive() const = 0;
};

} // namespace cc

#endif  // CC_LAYER_ANIMATION_VALUE_OBSERVER_H_


text:
***********
Handoff API
***********

**Last Updated:** October 14, 2015

App developers can use Handoff to launch one app from another app or an external website. Handoff also provides a mechanism for passing data from the originator app to the target app. Using Handoff, apps can be strung together to form a workflow, allowing apps to become modular and specialized in their capabilities. If the handoff is initiated from an app then the HandoffManager can be used. Alternatively, there are REST endpoints (described below) that allow an app to be launched from an external site, but can also be used for app-to-app handoff.

As an example, consider an app called "Hydrograph Plotter" that plots hydrographs. We would like Hydrograph Plotter to be able to accept hydrograph CSV files from other apps so that it can be used as a generic hydrograph viewer. One way to do this would be to define a Handoff endpoint that accepts a URL to a CSV file. The Handoff handler would use that URL to download or pull the CSV file into the app and then redirect it to a page with a plot. The GET request/pull mechanism is used to get around the limitations associated with POST requests, which are required to push or upload files.

Create a Handoff Handler
------------------------

The first step is to define a Handoff handler. The purpose of the Handoff handler is to handle the transfer data from the originator and then redirect the call to a page in the target app. It is implemented as a function that returns a URL or name of a view. For the example, the Handoff handler could be defined as follows:

::

    import os
    import requests
    from .app import HydrographPlotter

    def csv(request, csv_url):
        """
        Handoff handler for csv files.
        """
        # Get a filename in the current user's workspace
        user_workspace = HydrographPlotter.get_user_workspace(request.user)
        filename = os.path.join(user_workspace, 'hydrograph.csv')

        # Initiate a GET request on the CSV URL
        response = requests.get(csv_url, stream=True)

        # Stream content into a file
        with open(filename, 'w') as f:
            for chunk in response.iter_content(chunk_size=512):
                if chunk:
                    f.write(chunk)

        return 'hydrograph_plotter:plot_csv'

This Handoff handler uses the ``requests`` library and the :doc:`./workspaces` to download the file and store it in the current user's workspace. Then it returns the name of a controller called ``plot_csv`` to be redirected to. The ``plot_csv`` controller would need to know to look for a file in the current user's workspace and plot it.

Register Handoff Handler
------------------------

The Handoff handler needs to be registered to make it available for other apps to use. This is done by adding the ``handoff_handlers`` method to the :term:`app class`. This method needs to return a list or tuple of ``HandoffHandler`` objects.

::

    from tethys_sdk.handoff import HandoffHandler

    class HydrographPlotter(TethysAppBase):
        """
        Tethys app class for Hydrograph Plotter
        """
        ...

        def handoff_handlers(self):
            """
            Register some handoff handlers
            """
            handoff_handlers = (HandoffHandler(name='plot-csv',
                                               handler='hydrograph_plotter.handoff.csv'),
            )
            return handoff_handlers

Execute a Handoff
-----------------

To execute a Handoff, the originator app or website needs to provide a link of the form:

::

    http://<host>/handoff/<app_name>/<handler_name>/?param1=x&param2=y

Any parameters that need to be passed with the Handoff call are passed as query parameters on the URL. For our example, the URL would look something like this:

::

    http://www.example.com/hydrograph-plotter/plot-csv/?csv_url=http://www.another.com/url/to/file.csv

The URL must have query parameters for each argument defined in the Handoff handler function or it will throw an error. It will also throw an error if extra query parameters are provided that are not defined as arguments for the Handoff handler function.

View Handoff Endpoints for Apps
-------------------------------

For convenience, a list of the available Handoff endpoints for an app can be viewed by visiting the URL:

::

    http://<host>/handoff/<app_name>/

For our example, the URL would look like this:

::

    http://www.example.com/handoff/hydrograph-plotter/

The output would look something like this:

::

    [{"arguments": ["csv_url"], "name": "plot-csv"}]

HandoffManager
--------------

If a handoff is initiated from an app to another app on the same instance of Tethys then the HandoffManager can be used. This has several benefits including being able to being able to process the handoff in a controller and use Python to add logic or handle errors. Additionally, the HandoffManager will expose HandoffHandlers that are marked as "internal". An internal HanoffHandler can take advantage of the assumption that the both sides of the handoff are on the same system by, for example, using file paths and symbolic links rather than passing large files over the network.

A HandoffHandler can be marked as internal when it is registered in :term:`app class`.

::

    from tethys_sdk.handoff import HandoffHandler

    class HydrographPlotter(TethysAppBase):
        """
        Tethys app class for Hydrograph Plotter
        """
        ...

        def handoff_handlers(self):
            """
            Register some handoff handlers
            """
            handoff_handlers = (HandoffHandler(name='internal-plot-csv',
                                               handler='hydrograph_plotter.handoff.csv_internal',
                                               internal=True),
            )
            return handoff_handlers

An example of an internal HandoffHandler:

::

    import os
    import requests
    from .app import HydrographPlotter

    def csv_internal(request, path_to_csv):
        """
        Internal handoff handler for csv files.
        """
        # Get a filename in the current user's workspace
        user_workspace = HydrographPlotter.get_user_workspace(request.user)

        # Create symbolic link to the csv in the user's workspace
        src = path_to_csv
        dst = os.path.join(user_workspace, 'hydrograph.csv')

        try:
            os.symlink(src, dst)
        except OSError:
            pass

        return 'hydrograph_plotter:plot_csv'

An example of initiating a handoff with the HandoffManager from a controller:

::

    def plot(request):
        handoff_manager = app.get_handoff_manager()
        app_name = 'hydrograph_plotter'
        handler_name = 'internal-plot-csv'

        handler = handoff_manager.get_handler(handler_name, app_name)
        if handler:
            try:
                return redirect(handler(request, path_to_netcdf_file=file_path))
            except Exception, e:
                pass

    return redirect(reverse('my_app:home', kwargs={'message': 'Hydrograph plotting is not working.'}))

HandoffManager API
------------------

.. autoclass:: tethys_apps.base.handoff.HandoffManager
    :members: get_capabilities, get_handler, handoff


text:
/**
 * Show drop downs (ex: the select list of a ComboBox) or popups (ex: right-click context menus).
 * @module delite/popup
 */
define([
	"dcl/advise",
	"dcl/dcl",
	"./BackgroundIframe",
	"./features", // has("config-bgIframe")
	"./place",
	"./Viewport",
	"./theme!" // d-popup class
], function (advise, dcl, BackgroundIframe, has, place, Viewport) {

	function isDocLtr(doc) {
		return !(/^rtl$/i).test(doc.body.dir || doc.documentElement.dir);
	}

	// Mysterious code to workaround iOS problem where clicking a button  below an input will just keep the input
	// focused.  Button gets pointerdown event but not click event.  Test case: popup.html, press "show centered dialog"
	// and first click the <input>, then click the <button> below it.
	document.addEventListener("pointerdown", function () {
		document.body.scrollTop = document.body.scrollTop;
	}, true);

	/**
	 * Arguments to `delite/popup#open()` method.
	 * @typedef {Object} module:delite/popup.OpenArgs
	 * @property {module:delite/Widget} popup - The Widget to display.
	 * @property {module:delite/Widget} parent - The button etc. that is displaying this popup.
	 * @property {Element|Rectangle} around - DOM node (typically a button);
	 * place popup relative to this node.  (Specify this *or* `x` and `y` properties.)
	 * @property {number} x - Absolute horizontal position (in pixels) to place node at.
	 * (Specify this *or* `around` parameter.)
	 * @property {number} y - Absolute vertical position (in pixels) to place node at.
	 * (Specify this *or* `around` parameter.)
	 * @property {string[]} orient - When the `around` parameter is specified, `orient` should be a
	 * list of positions to try, ex. `[ "below", "above" ]`
	 * `delite/popup.open()` tries to position the popup according to each specified position, in order,
	 * until the popup appears fully within the viewport.  The default value is `["below", "above"]`.
	 * When an `(x,y)` position is specified rather than an `around` node, `orient` is either
	 * "R" or "L".  R (for right) means that it tries to put the popup to the right of the mouse,
	 * specifically positioning the popup's top-right corner at the mouse position, and if that doesn't
	 * fit in the viewport, then it tries, in order, the bottom-right corner, the top left corner,
	 * and the top-right corner.
	 *
	 * Alternately, `orient` can be an array `["center"]`, which pops up the specified node in the center of
	 * the viewport, like a dialog.  It will shrink the size of the node if necessary, in which case the node
	 * must be designed so that scrolling occurs in the right place.
	 *
	 * @property {Function} onCancel - Callback when user has canceled the popup by:
	 *
	 * 1. hitting ESC or TAB key
	 * 2. using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog),
	 * causing the widget to emit a "cancel" event
	 *
	 * @property {Function} onExecute - Callback when user has executed the popup
	 * by using the popup widget's proprietary execute mechanism (like an OK button in a dialog, or clicking a choice
	 * in a dropdown list), causing the widget to emit an "execute" or "change" event.
	 * @property {Function} onClose - Callback whenever this popup is closed.
	 * @property {Position} padding - Adding a buffer around the opening position.
	 * This is only used when `around` is not set.
	 * @property {number} maxHeight - The maximum height for the popup.
	 * Any popup taller than this will have scroll bars.
	 * Set to `Infinity` for no max height.  Default is to limit height to available space in viewport,
	 * above or below the `aroundNode` or specified `x/y` position.
	 */

	/**
	 * Function to destroy wrapper when popup widget is destroyed.
	 */
	function destroyWrapper() {
		if (this._popupWrapper) {
			this._popupWrapper.parentNode.removeChild(this._popupWrapper);
			delete this._popupWrapper;
		}
	}

	// TODO: convert from singleton to just a hash of functions; easier to doc that way.

	var PopupManager = dcl(null, /** @lends module:delite/popup */ {
		/**
		 * Stack of information about currently popped up widgets.
		 * See `open()` method to see the properties set in each Object in this stack (widget, wrapper, etc)
		 * (someone opened _stack[0], and then it opened _stack[1], etc.)
		 * @member {*} PopupManager._stack
		 */
		_stack: [],

		/**
		 * Z-index of the first popup.   (If first popup opens other popups they get a higher z-index.)
		 * @member {number} PopupManager._beginZIndex
		 */
		_beginZIndex: 1000,

		_idGen: 1,

		constructor: function () {
			Viewport.on("resize", this._repositionAll.bind(this));
			Viewport.on("scroll", this._viewportScrollHandler.bind(this));
		},

		/**
		 * We check for viewport scroll above, but this code checks for scrolling an inner `<div>`,
		 * thus moving the anchor node.  Using the scrollbar will close all the popups on the screen, but not
		 * if you scroll via a mousewheel or a mousepad double-finger gesture.
		 * @private
		 */
		_checkScroll: function () {
			if (this._firstAroundNode) {	// guard for when clearTimeout() on IE doesn't work
				var oldPos = this._firstAroundPosition,
					newPos = place.position(this._firstAroundNode),
					dx = newPos.x - oldPos.x,
					dy = newPos.y - oldPos.y;

				if (dx || dy) {
					this._firstAroundPosition = newPos;
					this._repositionAll();
				}

				this._aroundMoveListener = setTimeout(this._checkScroll.bind(this), dx || dy ? 10 : 50);
			}
		},

		/**
		 * Reposition all the popups due to viewport size change.
		 * @private
		 */
		_repositionAll: function () {
			this._stack.forEach(function (args) {
				this._size(args);
				this._position(args);
			}, this);
		},

		/**
		 * Reposition all the popups due to viewport scroll.  The main purpose of the function is to handle
		 * automatic scrolling on mobile from the keyboard popping up or when the browser tries to scroll the
		 * focused element to the upper part of the screen.
		 * @private
		 */
		_viewportScrollHandler: function () {
			this._stack.forEach(function (args) {
				if (args.orient[0] !== "center") {	// no need to resize dialogs just due to viewport scroll
					this._size(args);
				}
				this._position(args);
			}, this);
		},

		/**
		 * Initialization for widgets that will be used as popups.
		 * Puts widget inside a wrapper DIV (if not already in one), and returns pointer to that wrapper DIV.
		 * @param {module:delite/Widget} widget
		 * @returns {HTMLElement} The wrapper DIV.
		 * @private
		 */
		_createWrapper: function (widget) {
			var wrapper = widget._popupWrapper;
			if (!wrapper) {
				// Create wrapper <div> for when this widget [in the future] will be used as a popup.
				// This is done early because of IE bugs where creating/moving DOM nodes causes focus
				// to go wonky, see tests/robot/Toolbar.html to reproduce
				wrapper = widget.ownerDocument.createElement("div");
				wrapper.className = "d-popup";
				wrapper.style.display = "none";
				wrapper.setAttribute("role", "region");
				wrapper.setAttribute("aria-label", widget["aria-label"] || widget.label || widget.name || widget.id);
				widget.ownerDocument.body.appendChild(wrapper);

				wrapper.appendChild(widget);
				widget.attachedCallback();

				widget._popupWrapper = wrapper;
				advise.after(widget, "destroy", destroyWrapper);
			}

			return wrapper;
		},

		/**
		 * Moves the popup widget off-screen.  Do not use this method to hide popups when not in use, because
		 * that will create an accessibility issue: the offscreen popup will still be in the tabbing order.
		 * @param {module:delite/Widget} widget
		 * @returns {HTMLElement}
		 */
		moveOffScreen: function (widget) {
			// Create wrapper if not already there, then besides setting visibility:hidden,
			// move it out of the viewport, see #5776, #10111, #13604
			var wrapper = this._createWrapper(widget),
				style = wrapper.style,
				ltr = isDocLtr(widget.ownerDocument);

			// TODO: move to CSS class (d-offscreen?), but need to know direction of widget or at least page
			dcl.mix(style, {
				visibility: "hidden",
				top: "-9999px",
				display: ""
			});
			style[ltr ? "left" : "right"] = "-9999px";
			style[ltr ? "right" : "left"] = "auto";

			return wrapper;
		},

		/**
		 * Detach specified popup widget from document
		 * @param {module:delite/Widget} widget
		 */
		detach: function (widget) {
			if (widget._popupWrapper) {
				widget._popupWrapper.parentNode.removeChild(widget._popupWrapper);
				delete widget._popupWrapper;
				widget.detachedCallback();
			} else if (widget.parentNode) {
				widget.parentNode.removeChild(widget);
				widget.detachedCallback();
			}
		},

		/**
		 * Hide this popup widget (until it is ready to be shown).
		 * Initialization for widgets that will be used as popups.
		 *
		 * Also puts widget inside a wrapper DIV (if not already in one).
		 *
		 * If popup widget needs to layout it should do so when it is made visible,
		 * and popup._onShow() is called.
		 * @param {module:delite/Widget} widget
		 */
		hide: function (widget) {
			// Create wrapper if not already there
			var wrapper = this._createWrapper(widget);

			dcl.mix(wrapper.style, {
				display: "none",
				height: "auto"		// Open may have limited the height to fit in the viewport
			});
		},

		/**
		 * Compute the closest ancestor popup that's *not* a child of another popup.
		 * Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
		 * @returns {module:delite/Widget}
		 */
		getTopPopup: function () {
			var stack = this._stack;
			for (var pi = stack.length - 1; pi > 0 && stack[pi].parent === stack[pi - 1].popup; pi--) {
				/* do nothing, just trying to get right value for pi */
			}
			return stack[pi];
		},

		/**
		 * Popup the widget at the specified position.
		 *
		 * Note that whatever widget called delite/popup.open() should also require activationTracker and listen for
		 * delite-deactivated event to know that focus has moved somewhere
		 * else and thus the popup should be closed.
		 *
		 * @param {module:delite/popup.OpenArgs} args
		 * @returns {*} If orient !== center then returns the alignment of the popup relative to the anchor node.
		 * @example
		 * // Open at the mouse position
		 * popup.open({popup: menuWidget, x: evt.pageX, y: evt.pageY});
		 * @example
		 * // Open the widget as a dropdown
		 * popup.open({parent: this, popup: menuWidget, around: this, onClose: function(){...}});
		 */
		open: function (args) {
			this._prepareToOpen(args);
			this._size(args, true);
			return this._position(args);
		},

		/**
		 * Do the work to display a popup widget, except for positioning.
		 * @param {module:delite/popup.OpenArgs} args
		 * @returns {*}
		 * @private
		 */
		_prepareToOpen: function (args) {
			/* jshint maxcomplexity:12 */

			var stack = this._stack,
				widget = args.popup,
				around = args.around;

			// Generate id for popup if it doesn't already have one.
			if (!widget.id) {
				widget.id = args.around && args.around.id ? args.around.id + "_dropdown" : "popup_" + this._idGen++;
			}

			// If we are opening a new popup that isn't a child of a currently opened popup, then
			// close currently opened popup(s).   This should happen automatically when the old popups
			// gets the delite-activated event, except that event isn't reliable on IE, see [22198].
			// TODO: check if this code still needed for delite
			while (stack.length && (!args.parent || !stack[stack.length - 1].popup.contains(args.parent))) {
				this.close(stack[stack.length - 1].popup);
			}

			// Get pointer to popup wrapper, and create wrapper if it doesn't exist.  Remove display:none (but keep
			// off screen) so we can do sizing calculations.
			var wrapper = this.moveOffScreen(widget);

			var wrapperClasses = ["d-popup"];
			((widget.baseClass || "") + " " + widget.className).split(/ +/).forEach(function (cls) {
				if (cls) {
					wrapperClasses.push(cls + "-popup");
				}
			});
			dcl.mix(wrapper, {
				id: widget.id + "_wrapper",
				className: wrapperClasses.join(" ")
			});
			wrapper.style.zIndex = this._beginZIndex + stack.length;
			wrapper._popupParent = args.parent ? args.parent : null;

			if (stack.length === 0 && around) {
				// First element on stack. Save position of aroundNode and setup listener for changes to that position.
				this._firstAroundNode = around;
				this._firstAroundPosition = place.position(around);
				this._aroundMoveListener = setTimeout(this._checkScroll.bind(this), 50);
			}

			if (has("config-bgIframe") && !widget.bgIframe) {
				// setting widget.bgIframe triggers cleanup in Widget.destroy()
				widget.bgIframe = new BackgroundIframe(wrapper);
			}

			wrapper.style.visibility = "visible";
			widget.style.visibility = "visible";	// counteract effects from HasDropDown

			var handlers = [];

			// provide default escape and tab key handling
			// (this will work for any widget, not just menu)
			var onKeyDown = function (evt) {
				if ((evt.key === "Escape" || evt.key === "Tab") && args.onCancel) {
					evt.stopPropagation();
					evt.preventDefault();
					args.onCancel();
				}
			}.bind(this);
			wrapper.addEventListener("keydown", onKeyDown);
			handlers.push({
				remove: function () {
					wrapper.removeEventListener("keydown", onKeyDown);
				}
			});

			// Watch for cancel/execute events on the popup and notify the caller.
			// Simple widgets like a Calendar will emit "change" events, whereas complex widgets like
			// a TooltipDialog/Menu will emit "execute" events.  No way to tell which event the widget will
			// emit, so listen for both.
			if (args.onCancel) {
				handlers.push(widget.on("cancel", args.onCancel));
			}
			if (args.onExecute) {
				handlers.push(widget.on("execute", args.onExecute));
				handlers.push(widget.on("change", args.onExecute));
			}

			var stackEntry = Object.create(args);
			stackEntry.wrapper = wrapper;
			stackEntry.handlers = handlers;
			stack.push(stackEntry);
		},

		/**
		 * Size or resize the popup specified by args.
		 * @param {module:delite/popup.OpenArgs} args
		 * @param {boolean} measureSize
		 * @returns {*} If orient !== center then returns the alignment of the popup relative to the anchor node.
		 * @private
		 */
		_size: function (args, measureSize) {
			/* jshint maxcomplexity:13 */
			var widget = args.popup,
				wrapper = widget._popupWrapper,
				around = args.around,
				orient = args.orient || ["below", "below-alt", "above", "above-alt"],
				viewport = Viewport.getEffectiveBox(widget.ownerDocument);

			if (measureSize) {
				// Get natural size of popup (i.e. when not squashed to fit within viewport).  First, remove any
				// previous size restriction set on wrapper.  Note that setting wrapper's height and width to "auto"
				// erases scroll position, so should only be done when popup is first shown, before user has scrolled.
				wrapper.style.height = "auto";
				if (orient[0] === "center") {
					// Don't set width to "auto" when orient!=center because it interferes with HasDropDown's
					// autoWidth/forceWidth.
					// TODO: maybe this if() check is no longer necessary to due to parent if(measureSize)
					wrapper.style.width = "auto";
				}

				args._naturalHeight = widget.offsetHeight;
				args._naturalWidth = widget.offsetWidth;
			}

			if (orient[0] === "center") {
				// Limit height and width so dialog fits within viewport.
				wrapper.style.height = args._naturalHeight > viewport.h * 0.9 ? Math.floor(viewport.h * 0.9) + "px" :
					"auto";
				wrapper.style.width = args._naturalWidth > viewport.w * 0.9 ? Math.floor(viewport.w * 0.9) + "px" :
					"auto";
			} else {
				// Limit height to space available in viewport either above or below aroundNode (whichever side has
				// more room).  This may make the popup widget display a scrollbar (or multiple scrollbars).
				var maxHeight;
				if ("maxHeight" in args && args.maxHeight !== -1) {
					maxHeight = args.maxHeight || Infinity;
				} else {
					var aroundPos = around ? around.getBoundingClientRect() : {
						top: args.y - (args.padding || 0),
						height: (args.padding || 0) * 2
					};
					maxHeight = Math.floor(Math.max(aroundPos.top, viewport.h -
						(aroundPos.top + aroundPos.height)));
				}

				wrapper.style.height = args._naturalHeight > maxHeight ? maxHeight + "px" : "auto";
			}

			// Workaround for android < 4.4 bug where popup overflows from wrapper.
			// Probably this code can be removed when/if we get rid of the wrapper div.
			widget.style.height = wrapper.style.height;
		},

		/**
		 * Position the popup specified by args.
		 * @param args
		 * @returns {*} If orient !== center then returns the alignment of the popup relative to the anchor node.
		 * @private
		 */
		_position: function (args) {
			var widget = args.popup,
				wrapper = widget._popupWrapper,
				around = args.around,
				orient = args.orient || ["below", "below-alt", "above", "above-alt"],
				ltr = args.parent ? args.parent.effectiveDir !== "rtl" : isDocLtr(widget.ownerDocument);

			// position the wrapper node
			if (orient[0] === "center") {
				place.center(wrapper);
			} else {
				var layoutFunc = widget.orient ? widget.orient.bind(widget) : null;
				return around ?
					place.around(wrapper, around, orient, ltr, layoutFunc) :
					place.at(wrapper, args, orient === "R" ? ["TR", "BR", "TL", "BL"] : ["TL", "BL", "TR", "BR"],
						args.padding, layoutFunc);
			}
		},

		/**
		 * Close specified popup and any popups that it parented.  If no popup is specified, closes all popups.
		 * @param {module:delite/Widget} [popup]
		 */
		close: function (popup) {
			var stack = this._stack;

			// Basically work backwards from the top of the stack closing popups
			// until we hit the specified popup, but IIRC there was some issue where closing
			// a popup would cause others to close too.  Thus if we are trying to close B in [A,B,C]
			// closing C might close B indirectly and then the while() condition will run where stack===[A]...
			// so the while condition is constructed defensively.
			while ((popup && stack.some(function (elem) {
				return elem.popup === popup;
			})) ||
				(!popup && stack.length)) {
				var top = stack.pop(),
					widget = top.popup,
					onClose = top.onClose;

				if (widget.bgIframe) {
					// push the iframe back onto the stack.
					widget.bgIframe.destroy();
					delete widget.bgIframe;
				}

				var h;
				while ((h = top.handlers.pop())) {
					h.remove();
				}

				// Hide the widget and its wrapper unless it has already been destroyed in above onClose() etc.
				this.hide(widget);

				if (onClose) {
					onClose();
				}
			}

			if (stack.length === 0 && this._aroundMoveListener) {
				clearTimeout(this._aroundMoveListener);
				this._firstAroundNode = this._firstAroundPosition = this._aroundMoveListener = null;
			}
		}
	});

	return new PopupManager();
});


text:
package semanticMarkup.ling.transform.lib;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;

import opennlp.tools.sentdetect.SentenceDetectorME;
import opennlp.tools.sentdetect.SentenceModel;
import opennlp.tools.util.InvalidFormatException;
import semanticMarkup.ling.Token;
import semanticMarkup.ling.transform.ITokenizer;

public class OpenNLPSentencesTokenizer implements ITokenizer{
	private SentenceDetectorME mySentenceDetector;

	public  OpenNLPSentencesTokenizer (String openNLPSentenceDetectorDir) {
		InputStream sentModelIn;

		try {
			sentModelIn = new FileInputStream(openNLPSentenceDetectorDir);
			SentenceModel model = new SentenceModel(sentModelIn);
			this.mySentenceDetector = new SentenceDetectorME(model);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvalidFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	@Override
	public List<Token> tokenize(String text) {
		String[] sentenceArray = this.mySentenceDetector.sentDetect(text);
		List<Token> sentences = new LinkedList<Token>();
		for (String sentence: sentenceArray) {
			Token sentenceElement = new Token(sentence);
			sentences.add(sentenceElement);
		}

		return sentences;
	}

}


text:
module.exports = function(config){
  config.set({

    basePath : '../../../',

    files : [
      'main/resources/static/bower_components/angular/angular.js',
      'main/resources/static/bower_components/angular-route/angular-route.js',
      'main/resources/static/bower_components/angular-mocks/angular-mocks.js',
      'main/resources/static/bower_components/angular-resource/angular-resource.js',
      'main/resources/static/bower_components/angular-filter/angular-filter.js',
      'main/resources/static/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
      'main/resources/static/components/**/*.js',
      'main/resources/static/home/*.js',
      'main/resources/static/product/*.js',
      'test/js/unit/**/*.js'
    ],

    autoWatch : true,

    frameworks: ['jasmine'],

    browsers : ['Chrome'],

    plugins : [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine',
            'karma-junit-reporter'
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

  });
};


text:
package org.hmhb.exception;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import static java.util.Objects.requireNonNull;

/**
 * DTO to hold exception information to send back as JSON in our REST calls.
 */
@Immutable
public class JsonErrorResponse {

    private final int statusCode;
    private final String type;
    private final String message;

    /**
     * Constructs a {@link JsonErrorResponse}.
     *
     * @param statusCode the http status code
     * @param type the exception type (fully qualified name)
     * @param message the exception message
     */
    public JsonErrorResponse(
            int statusCode,
            @Nonnull String type,
            @Nullable String message
    ) {
        this.statusCode = statusCode;
        this.type = requireNonNull(type, "type cannot be null");
        this.message = message; /* Exceptions don't always have a message. */
    }

    public int getStatusCode() {
        return statusCode;
    }

    public String getType() {
        return type;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public boolean equals(Object o) {
        return EqualsBuilder.reflectionEquals(this, o);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

}


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

<title>org.jivesoftware.openfire.commands.admin (Openfire 3.10.2 Javadoc)</title>
<meta name="date" content="2015-06-22">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

org.jivesoftware.openfire.commands.admin

Classes

GetAdminConsoleInfo

GetListActiveUsers

GetNumberActiveUsers

GetNumberOnlineUsers

GetNumberUserSessions

GetServerStats

GetUsersPresence

HttpBindStatus

PacketsNotification


text:
import ActivePaneType from 'foreground/enum/activePaneType';
import ActivePaneView from 'foreground/view/activePane/activePaneView';
import ActivePane from 'foreground/model/activePane/activePane';
import StreamView from 'foreground/view/stream/streamView';
import ActivePlaylistAreaView from 'foreground/view/leftPane/activePlaylistAreaView';
import ViewTestUtility from 'test/foreground/view/viewTestUtility';

describe('ActivePaneView', function() {
  describe('PlaylistActivePaneView', function() {
    beforeEach(function() {
      this.documentFragment = document.createDocumentFragment();
      var stream = TestUtility.buildStream();

      this.view = new ActivePaneView({
        model: new ActivePane({
          type: ActivePaneType.Stream,
          relatedModel: stream
        }),
        streamItems: stream.get('items')
      });
    });

    afterEach(function() {
      this.view.destroy();
    });

    ViewTestUtility.ensureBasicAssumptions.call(this);

    describe('_getContentView', function() {
      it('should return a StreamView', function() {
        var contentView = this.view._getContentView();
        expect(contentView instanceof StreamView).to.equal(true);
      });
    });
  });

  describe('PlaylistActivePaneView', function() {
    beforeEach(function() {
      this.documentFragment = document.createDocumentFragment();
      var stream = TestUtility.buildStream();

      this.view = new ActivePaneView({
        model: new ActivePane({
          type: ActivePaneType.Playlist,
          relatedModel: TestUtility.buildPlaylist()
        }),
        streamItems: stream.get('items')
      });
    });

    afterEach(function() {
      this.view.destroy();
    });

    ViewTestUtility.ensureBasicAssumptions.call(this);

    describe('_getContentView', function() {
      it('should return a ActivePlaylistAreaView', function() {
        var contentView = this.view._getContentView();
        expect(contentView instanceof ActivePlaylistAreaView).to.equal(true);
      });
    });
  });
});


text:
<?php

namespace Controllers;

use Telegramm\Response;

/**
 * Class RunCommand
 *
 * @author WN
 * @package Controllers
 */
class RunCommand
{
    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function run()
    {
        $request = json_decode(file_get_contents("php://input"), true);

        foreach ($request as $row) {
            $params[$row['name']] = $row['value'];
        }

        if (!array_key_exists('command', $params)) return JsonResponse::create(['error' => 'Request a command'], 400)->send();

        $service = new \Telegramm\Command\RunCommand(new \Telegramm\Command\Repository());

        $result = $service->runCommand($params['command']);

        return Response::create(['result' => $result->getMessage()], 200);
    }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mem. New York Bot. Gard. 35:654. 1982

#### Original name
Cassia decumbens Benth.

### Remarks
null


text:
package org.mauritania.photosync.olympus.client

import java.time.{LocalDate, LocalTime}

import org.specs2.mutable.Specification

class FileInfoSpec extends Specification {

  val DefaultFileInfo = FileInfo(
    folder = "FOLDER",
    name = "NAME",
    size = 0L
  )

  "The files info" should {

    "correctly retrieve the date from a machine date" in {
      DefaultFileInfo.copy(date = FileInfo.MinMachineDayticks).humanDate mustEqual FileInfo.MinDate
      DefaultFileInfo.copy(date = FileInfo.MaxMachineDayticks).humanDate mustEqual FileInfo.MaxDate

      DefaultFileInfo.copy(date = 36157).humanDate mustEqual LocalDate.of(2050, 9, 29)
      DefaultFileInfo.copy(date = 36156).humanDate mustEqual LocalDate.of(2050, 9, 28)
      DefaultFileInfo.copy(date = 23073).humanDate mustEqual LocalDate.of(2025, 1, 1)

      DefaultFileInfo.copy(date = 10273).humanDate mustEqual LocalDate.of(2000, 1, 1)
      DefaultFileInfo.copy(date = 10305).humanDate mustEqual LocalDate.of(2000, 2, 1)
      DefaultFileInfo.copy(date = 10337).humanDate mustEqual LocalDate.of(2000, 3, 1)
      DefaultFileInfo.copy(date = 10849).humanDate mustEqual LocalDate.of(2001, 3, 1)
      DefaultFileInfo.copy(date = 11361).humanDate mustEqual LocalDate.of(2002, 3, 1)
      DefaultFileInfo.copy(date = 20014).humanDate mustEqual LocalDate.of(2019, 1, 14)
    }

    "correctly retrieve the time from a machine time" in {
      DefaultFileInfo.copy(time = 0).humanTime mustEqual LocalTime.of(0, 0, 0)
      DefaultFileInfo.copy(time = 44917).humanTime mustEqual LocalTime.of(21, 59, 21)

    }

  }
}