text:
"use strict";
/**
 * @module opcua.transport
 */
require("requirish")._(module);

// system requires
var assert = require("better-assert");

var net = require("net");
var _ = require("underscore");
var util = require("util");

// opcua requires
var BinaryStream = require("lib/misc/binaryStream").BinaryStream;
var TCP_transport = require("lib/transport/tcp_transport").TCP_transport;
var getFakeTransport = require("lib/transport/tcp_transport").getFakeTransport;
var HelloMessage = require("_generated_/_auto_generated_HelloMessage").HelloMessage;
var packTcpMessage = require("lib/nodeopcua").packTcpMessage;

var utils = require("lib/misc/utils");

var debugLog = utils.make_debugLog(__filename);
// var doDebug = opcua.utils.checkDebugFlag(__filename);
// var hexDump = opcua.utils.hexDump;

var parseEndpointUrl = require("lib/nodeopcua").parseEndpointUrl;
var readMessageHeader = require("lib/misc/message_header").readMessageHeader;

var TCPErrorMessage = require("lib/datamodel/structures").TCPErrorMessage;
var AcknowledgeMessage = require("_generated_/_auto_generated_AcknowledgeMessage").AcknowledgeMessage;
var decodeMessage = require("lib/nodeopcua").decodeMessage;

function createClientSocket(endpoint_url) {
    // create a socket based on Url
    var ep = parseEndpointUrl(endpoint_url);
    var port = ep.port;
    var hostname = ep.hostname;
    switch (ep.protocol) {
        case "opc.tcp":
            return net.connect({host: hostname, port: port});
        case "fake":
            var fakeSocket = getFakeTransport();
            assert(ep.protocol === "fake", " Unsupported transport protocol");
            process.nextTick(function () {
                fakeSocket.emit("connect");
            });
            return fakeSocket;
        case "http":
        case "https":
        default:
            throw new Error("this transport protocol is currently not supported :" + ep.protocol);
            return null;

    }
}

/**
 * a ClientTCP_transport connects to a remote server socket and
 * initiates a communication with a HEL/ACK transaction.
 * It negociates the communication parameters with the other end.
 *
 * @class ClientTCP_transport
 * @extends TCP_transport
 * @constructor
 *
 *
 *
 * @example
 *
 *    ```javascript
 *    var transport = ClientTCP_transport(url);
 *
 *    transport.timeout = 1000;
 *
 *    transport.connect(function(err)) {
 *         if (err) {
 *            // cannot connect
 *         } else {
 *            // connected
 *
 *         }
 *    });
 *    ....
 *
 *    transport.write(message_chunk,'F');
 *
 *    ....
 *
 *    transport.on("message",function(message_chunk) {
 *        // do something with message from server...
 *    });
 *
 *
 *    ```
 *
 *
 */
var ClientTCP_transport = function () {
    TCP_transport.call(this);

};
util.inherits(ClientTCP_transport, TCP_transport);

/**
 * @method connect
 * @async
 * @param endpoint_url {String}
 * @param callback {Function} the callback function
 * @param [options={}]
 */
ClientTCP_transport.prototype.connect = function (endpoint_url, callback, options) {

    assert(_.isFunction(callback));

    options = options || {};

    var self = this;

    self.protocolVersion = (options.protocolVersion !== undefined) ? options.protocolVersion : self.protocolVersion;
    assert(_.isFinite(self.protocolVersion));

    var ep = parseEndpointUrl(endpoint_url);

    var hostname = require("os").hostname();

    self.endpoint_url = endpoint_url;

    self.serverUri = "urn:" + hostname + ":Sample";

    debugLog("endpoint_url =", endpoint_url, "ep", ep);

    try {
        self._socket = createClientSocket(endpoint_url);
    }
    catch (err) {
        return callback(err);
    }
    self._socket.name = "CLIENT";
    self._install_socket(self._socket);

    function _on_socket_error(err) {
        // this handler will catch attempt to connect to an inaccessible address.
        assert(err instanceof Error);
        callback(err);
    }

    self._socket.on("error", _on_socket_error);

    self._socket.on("connect", function () {
        self._socket.removeListener("error", _on_socket_error);
        self._perform_HEL_ACK_transaction(callback);
    });

};

ClientTCP_transport.prototype._handle_ACK_response = function (message_chunk, callback) {

    var self = this;
    var _stream = new BinaryStream(message_chunk);
    var messageHeader = readMessageHeader(_stream);
    var err;

    if (messageHeader.isFinal !== "F") {
        err = new Error(" invalid ACK message");
        callback(err);
        return;
    }

    var responseClass, response;

    if (messageHeader.msgType === "ERR") {
        responseClass = TCPErrorMessage;
        _stream.rewind();
        response = decodeMessage(_stream, responseClass);

        callback(new Error("Code 0x" + response.name.toString(16) + " : " + response.reason));

    } else {
        responseClass = AcknowledgeMessage;
        _stream.rewind();
        response = decodeMessage(_stream, responseClass);
        self.parameters = response;
        callback(null);
    }

};

ClientTCP_transport.prototype._send_HELLO_request = function () {

    var self = this;
    assert(self._socket);
    assert(_.isFinite(self.protocolVersion));
    assert(self.endpoint_url.length > 0, " expecting a valid endpoint url");

    // Write a message to the socket as soon as the client is connected,
    // the server will receive it as message from the client
    var request = new HelloMessage({
        protocolVersion: self.protocolVersion,
        receiveBufferSize: 8192,
        sendBufferSize: 8192,
        maxMessageSize: 0, // 0 - no limits
        maxChunkCount: 0, // 0 - no limits
        endpointUrl: self.endpoint_url
    });

    var messageChunk = packTcpMessage("HEL", request);
    self._write_chunk(messageChunk);

};

ClientTCP_transport.prototype._perform_HEL_ACK_transaction = function (callback) {

    var self = this;
    assert(self._socket);
    assert(_.isFunction(callback));

    var counter = 0;

    self._install_one_time_message_receiver(function on_ACK_response(err, data) {

        assert(counter === 0);
        counter += 1;

        if (err) {
            callback(err);
            self._socket.end();
        } else {
            self._handle_ACK_response(data, function (inner_err) {
                callback(inner_err);
            });
        }
    });

    self._send_HELLO_request();
};

exports.ClientTCP_transport = ClientTCP_transport;


text:
from bluebottle.donations.models import Donation
from rest_framework import serializers

from bluebottle.members.serializers import UserPreviewSerializer
from bluebottle.projects.serializers import \
    ProjectPreviewSerializer as BaseProjectPreviewSerializer, ProjectPreviewSerializer
from bluebottle.fundraisers.models import Fundraiser
from bluebottle.orders.models import Order
from bluebottle.projects.models import Project

class ManageDonationSerializer(serializers.ModelSerializer):
    project = serializers.SlugRelatedField(slug_field='slug', queryset=Project.objects)
    fundraiser = serializers.PrimaryKeyRelatedField(required=False, allow_null=True, queryset=Fundraiser.objects)
    order = serializers.PrimaryKeyRelatedField(queryset=Order.objects)
    amount = serializers.DecimalField(
        max_digits=10, decimal_places=2, max_value=1500000
    )
    status = serializers.CharField(read_only=True)

    class Meta:
        model = Donation
        fields = ('id', 'project', 'fundraiser', 'amount', 'status', 'order',
                  'anonymous', 'completed', 'created', 'reward')

        # FIXME Add validations for amount and project phase

class PreviewDonationSerializer(serializers.ModelSerializer):
    project = ProjectPreviewSerializer()
    fundraiser = serializers.PrimaryKeyRelatedField(required=False,
                                                    queryset=Fundraiser.objects)
    payment_method = serializers.SerializerMethodField()
    user = UserPreviewSerializer(source='public_user')

    class Meta:
        model = Donation
        fields = ('id', 'project', 'fundraiser', 'user', 'created',
                  'anonymous', 'amount', 'reward', 'payment_method')

    def get_payment_method(self, obj):
        return obj.get_payment_method()

class PreviewDonationWithoutAmountSerializer(PreviewDonationSerializer):
    payment_method = serializers.SerializerMethodField()

    class Meta:
        model = Donation
        fields = ('id', 'project', 'fundraiser', 'user', 'created',
                  'anonymous', 'payment_method')

    def get_payment_method(self, obj):
        return obj.get_payment_method()

class DefaultDonationSerializer(PreviewDonationSerializer):
    class Meta:
        model = Donation
        fields = PreviewDonationSerializer.Meta.fields + ('amount', 'reward')

class LatestDonationProjectSerializer(BaseProjectPreviewSerializer):
    task_count = serializers.IntegerField()
    owner = UserPreviewSerializer()

    class Meta(BaseProjectPreviewSerializer):
        model = BaseProjectPreviewSerializer.Meta.model
        fields = ('id', 'title', 'image', 'status', 'pitch', 'country',
                  'task_count', 'allow_overfunding', 'is_campaign',
                  'amount_asked', 'amount_donated', 'amount_needed',
                  'deadline', 'status', 'owner')

class LatestDonationSerializer(serializers.ModelSerializer):
    project = LatestDonationProjectSerializer()
    payment_method = serializers.SerializerMethodField()
    user = UserPreviewSerializer

    class Meta:
        model = Donation
        fields = ('id', 'project', 'fundraiser', 'user', 'created',
                  'anonymous', 'amount', 'payment_method')

    def get_payment_method(self, obj):
        return obj.get_payment_method()

redpajama_set_name: RedPajamaGithub


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

    var SlidingRender = Backbone.Marionette.Behavior.extend({

        collectionEvents: {
            'reset': '_reset',

            'remove': function (item, collection, options) {
                //  When a rendered view is lost - render the next one since there's a spot in the viewport
                if (this._indexWithinRenderRange(options.index)) {
                    var rendered = this._renderElementAtIndex(this.maxRenderIndex);

                    //  If failed to render next item and there are previous items waiting to be rendered, slide view back 1 item
                    if (!rendered && this.minRenderIndex > 0) {
                        this.ui.list.scrollTop(this.lastScrollTop - this.itemViewHeight);
                    }
                }

                this._setHeightPaddingTop();
            },

            'add': function (item, collection) {
                var index = collection.indexOf(item);
                var indexWithinRenderRange = this._indexWithinRenderRange(index);
                var viewportFull = collection.length > this.maxRenderIndex;

                if (indexWithinRenderRange && viewportFull) {
                    this._removeItemsByIndex(this.maxRenderIndex, 1);
                }

                this._setHeightPaddingTop();
            },

            'change:active': function (item, active) {
                if (active) {
                    this._scrollToItem(item);
                }
            }
        },

        ui: {
            list: '.list'
        },

        //  Enables progressive rendering of children by keeping track of indices which are currently rendered.
        minRenderIndex: 0,
        maxRenderIndex: 0,

        //  The height of a rendered itemView in px. Including padding/margin.
        itemViewHeight: 40,
        viewportHeight: -1,

        //  Keep track of where user is scrolling from to determine direction and amount changed.
        lastScrollTop: 0,

        onShow: function () {
            //  If the collection implements getActiveItem - scroll to the active item.
            if (this.view.collection.getActiveItem) {
                if (this.view.collection.length > 0) {
                    this._scrollToItem(this.view.collection.getActiveItem());
                }
            }
        },

        onFullyVisible: function () {
            var self = this;
            //  Throttle the scroll event because scrolls can happen a lot and don't need to re-calculate very often.
            this.ui.list.scroll(_.throttle(function () {
                self._setRenderedElements(this.scrollTop);
            }, 20));
        },

        initialize: function (options) {
            if (_.isUndefined(options) || _.isUndefined(options.viewportHeight)) throw "SlidingRender expects to be initialized with a viewportHeight";
            this.viewportHeight = options.viewportHeight;

            //  Allow N items to be rendered initially where N is how many items need to cover the viewport.
            this.minRenderIndex = this._getMinRenderIndex(0);
            this.maxRenderIndex = this._getMaxRenderIndex(0);

            //  IMPORTANT: Stub out the view's implementation of addItemView with the slidingRender version.
            this.view.addItemView = this._addItemView.bind(this);
            //  Since slidingRender appends before/after depending on scrollDirection it is important to use the indexed version of appendHtml.
            this.view.appendHtml = this._appendHtml;
        },

        onRender: function () {
            this._setHeightPaddingTop();
        },

        //  jQuery UI's sortable needs to be able to know the minimum rendered index. Whenever an external
        //  event requests the min render index -- return it!
        onGetMinRenderIndex: function() {
            this.view.triggerMethod('GetMinRenderIndexReponse', {
                minRenderIndex: this.minRenderIndex
            });
        },

        //  Whenever the viewport height is changed -- adjust the items which are currently rendered to match
        onSetViewportHeight: function (request) {
            this.viewportHeight = request.viewportHeight;

            //  Unload or load N items where N is the difference in viewport height.
            var currentMaxRenderIndex = this.maxRenderIndex;

            var newMaxRenderIndex = this._getMaxRenderIndex(this.lastScrollTop);
            var indexDifference = currentMaxRenderIndex - newMaxRenderIndex;

            //  Be sure to update before potentially adding items or else they won't render.
            this.maxRenderIndex = newMaxRenderIndex;
            if (indexDifference > 0) {
                //  Unload N items, subtract 1 because maxRenderIndex is exclusive (TODO: rework math so maxRenderIndex is inclusive))
                var startIndex = currentMaxRenderIndex - 1;

                //  Only remove items if need be -- collection's length might be so small that the viewport's height isn't affecting rendered count.
                if (this.view.collection.length > startIndex) {
                    this._removeItemsByIndex(startIndex, indexDifference);
                }
            }
            else if (indexDifference < 0) {
                //  TODO: removing items had a bug in it -- does this have the same one (what if the collection's length is small and no items need appending?)
                //  Load N items
                for (var count = 0; count < Math.abs(indexDifference); count++) {
                    this._renderElementAtIndex(currentMaxRenderIndex + 1 + count);
                }
            }

            this._setHeightPaddingTop();
        },

        //  When deleting an element from a list it's important to render the next element (if any) since
        //  usually this only happens during scroll, but positions change when removing.
        _renderElementAtIndex: function (index) {
            var rendered = false;

            if (this.view.collection.length >= index) {
                var item = this.view.collection.at(index - 1);
                var ItemView = this.view.getItemView(item);

                //  Adjust the itemView's index to account for where it is actually being added in the list
                this._addItemView(item, ItemView, index - 1);
                rendered = true;
            }

            return rendered;
        },

        _setRenderedElements: function (scrollTop) {
            //  TODO: Probably better to use .min/.max instead of calculate here:
            //  Figure out the range of items currently rendered:
            var oldMinRenderIndex = this._getMinRenderIndex(this.lastScrollTop);
            var oldMaxRenderIndex = this._getMaxRenderIndex(this.lastScrollTop);

            //  Figure out the range of items which need to be rendered:
            var minRenderIndex = this._getMinRenderIndex(scrollTop);
            var maxRenderIndex = this._getMaxRenderIndex(scrollTop);

            var itemsToAdd = [];
            var itemsToRemove = [];

            //  Append items in the direction being scrolled and remove items being scrolled away from.
            var direction = scrollTop > this.lastScrollTop ? 'down' : 'up';

            if (direction === 'down') {
                //  Need to remove items which are less than the new minRenderIndex
                if (minRenderIndex > oldMinRenderIndex) {
                    itemsToRemove = this.view.collection.slice(oldMinRenderIndex, minRenderIndex);
                }

                //  Need to add items which are greater than oldMaxRenderIndex and ltoe maxRenderIndex
                if (maxRenderIndex > oldMaxRenderIndex) {
                    itemsToAdd = this.view.collection.slice(oldMaxRenderIndex, maxRenderIndex);
                }
            } else {
                //  Need to add items which are greater than oldMinRenderIndex and ltoe minRenderIndex
                if (minRenderIndex < oldMinRenderIndex) {
                    itemsToAdd = this.view.collection.slice(minRenderIndex, oldMinRenderIndex);
                }

                //  Need to remove items which are greater than the new maxRenderIndex
                if (maxRenderIndex < oldMaxRenderIndex) {
                    itemsToRemove = this.view.collection.slice(maxRenderIndex, oldMaxRenderIndex);
                }
            }

            if (itemsToAdd.length > 0 || itemsToRemove.length > 0) {
                this.minRenderIndex = minRenderIndex;
                this.maxRenderIndex = maxRenderIndex;

                if (direction === 'down') {
                    //  Items will be appended from oldMaxRenderIndex forward.
                    this._addItems(itemsToAdd, oldMaxRenderIndex, true);
                } else {
                    this._addItems(itemsToAdd, minRenderIndex, false);
                }

                this._removeItems(itemsToRemove);
                this._setHeightPaddingTop();
            }

            this.lastScrollTop = scrollTop;
        },

        //  Reset min/max, scrollTop, paddingTop and height to their default values.
        _reset: function () {
            this.ui.list.scrollTop(0);
            this.lastScrollTop = 0;

            this.minRenderIndex = this._getMinRenderIndex(0);
            this.maxRenderIndex = this._getMaxRenderIndex(0);

            this._setHeightPaddingTop();
        },

        _setHeightPaddingTop: function() {
            this._setPaddingTop();
            this._setHeight();
        },

        //  Adjust padding-top to properly position relative items inside of list since not all items are rendered.
        _setPaddingTop: function () {
            this.view.ui.itemContainer.css('padding-top', this._getPaddingTop());
        },

        _getPaddingTop: function () {
            return this.minRenderIndex * this.itemViewHeight;
        },

        //  Set the elements height calculated from the number of potential items rendered into it.
        //  Necessary because items are lazy-appended for performance, but scrollbar size changing not desired.
        _setHeight: function () {
            //  Subtracting minRenderIndex is important because of how CSS renders the element. If you don't subtract minRenderIndex
            //  then the rendered items will push up the height of the element by minRenderIndex * itemViewHeight.
            var height = (this.view.collection.length - this.minRenderIndex) * this.itemViewHeight;

            //  Keep height set to at least the viewport height to allow for proper drag-and-drop target - can't drop if height is too small.
            if (height < this.viewportHeight) {
                height = this.viewportHeight;
            }

            this.view.ui.itemContainer.height(height);
        },

        _addItems: function (models, indexOffset, isAddingToEnd) {
            //  Leverage Marionette's style of rendering for performance.
            this.view.initRenderBuffer();
            this.view.startBuffering();

            var ItemView;
            _.each(models, function (model, index) {
                ItemView = this.view.getItemView(model);

                if (isAddingToEnd) {
                    //  Adjust the itemView's index to account for where it is actually being added in the list
                    this._addItemView(model, ItemView, index + indexOffset);
                } else {
                    //  Adjust the itemView's index to account for where it is actually being added in the list, but
                    //  also provide the unmodified index because this is the location in the rendered itemViewList in which it will be added.
                    this._addItemView(model, ItemView, index, index + indexOffset);
                }
            }, this);

            this.view.endBuffering();
        },

        //  Remove N items from the end of the render item list.
        _removeItemsByIndex: function (startIndex, countToRemove) {
            for (var index = 0; index < countToRemove; index++) {
                var item = this.view.collection.at(startIndex - index);
                var childView = this.view.children.findByModel(item);
                this.view.removeChildView(childView);
            }
        },

        _removeItems: function (models) {
            _.each(models, function (model) {
                var childView = this.view.children.findByModel(model);

                this.view.removeChildView(childView);
            }, this);
        },

        _addItemView: function (item, ItemView, index, indexOverride) {
            //  indexOverride is necessary because the 'actual' index of an item is different from its rendered position's index.
            var shouldAdd;
            if (_.isUndefined(indexOverride)) {
                shouldAdd = this._indexWithinRenderRange(index);
            } else {
                shouldAdd = this._indexWithinRenderRange(indexOverride);
            }

            if (shouldAdd) {
                Backbone.Marionette.CompositeView.prototype.addItemView.apply(this.view, arguments);
            }
        },

        _appendHtml: function (collectionView, itemView, index) {
            var childrenContainer = collectionView.itemViewContainer ? collectionView.$(collectionView.itemViewContainer) : collectionView.$el;
            var children = childrenContainer.children();
            if (children.size() <= index) {
                childrenContainer.append(itemView.el);
            } else {
                children.eq(index).before(itemView.el);
            }
        },

        _getMinRenderIndex: function (scrollTop) {
            var minRenderIndex = Math.floor(scrollTop / this.itemViewHeight);
            return minRenderIndex;
        },

        _getMaxRenderIndex: function (scrollTop) {
            var maxRenderIndex = Math.ceil((scrollTop / this.itemViewHeight) + (this.viewportHeight / this.itemViewHeight));
            return maxRenderIndex;
        },

        //  Returns true if an itemView at the given index would not be fully visible -- part of it rendering out of the top of the viewport.
        _indexOverflowsTop: function (index) {
            var position = index * this.itemViewHeight;
            var scrollPosition = this.ui.list.scrollTop();

            var overflowsTop = position < scrollPosition;

            return overflowsTop;
        },

        _indexOverflowsBottom: function (index) {
            //  Add one to index because want to get the bottom of the element and not the top.
            var position = (index + 1) * this.itemViewHeight;
            var scrollPosition = this.ui.list.scrollTop() + this.viewportHeight;

            var overflowsBottom = position > scrollPosition;

            return overflowsBottom;
        },

        _indexWithinRenderRange: function (index) {
            return index >= this.minRenderIndex && index < this.maxRenderIndex;
        },

        //  TODO: Animation?
        //  Ensure that the active item is visible by setting the container's scrollTop to a position which allows it to be seen.
        _scrollToItem: function (item) {
            var itemIndex = this.view.collection.indexOf(item);

            var overflowsTop = this._indexOverflowsTop(itemIndex);
            var overflowsBottom = this._indexOverflowsBottom(itemIndex);

            //  Only scroll to the item if it isn't in the viewport.
            if (overflowsTop || overflowsBottom) {
                var scrollTop = 0;

                //  If the item needs to be made visible from the bottom, offset the viewport's height:
                if (overflowsBottom) {
                    //  Add 1 to index because want the bottom of the element and not the top.
                    scrollTop = (itemIndex + 1) * this.itemViewHeight - this.viewportHeight;
                }
                else if (overflowsTop) {
                    scrollTop = itemIndex * this.itemViewHeight;
                }

                this.ui.list.scrollTop(scrollTop);
            }
        }
    });

    return SlidingRender;
});


text:
<?php

namespace Da\DiBundle\Tests\Fixtures\Compiler;

class NonInterfacedService
{
	public function test()
	{
	}
}


text:
            Não foi possível realizar o seu cadastro!. Por favor, entre em contato com o administrador do site para informar o erro!

    <?php if (isset($_SESSION['form_error'])): ?>

                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $_SESSION['form_error']; ?>

        <?php
        unset($_SESSION['form_error']);
        //Finaliza a sessão para a mensagem não ficar sendo exibida com reflesh
        ?>
    <?php endif; ?>


text:
/**
 * Created by jibin on 17/7/10.
 */

import React, {Component} from 'react';

import AutosizeInput from '../src/component/AutosizeInput.js';

class TestAutoSizeInput extends Component{
    constructor(){
        super();
        this.state = {
            selectedValue : ''
        };
    }

    onChange(event){
        console.log(event.target.value);

        this.setState({
            selectedValue: event.target.value
        });
    }

    render(){

        return (
            <div>
                <AutosizeInput
                    value={this.state.selectedValue}
                    onChange={this.onChange.bind(this)}
                    placeholder="请选择"
                    placeholderIsMinWidth={true}
                />
            </div>
        );
    }
}

export default TestAutoSizeInput;


text:
var Lab = require('lab');
var Code = require('code');
var Hapi = require('hapi');
var Boom = require('boom');
var lab = exports.lab = Lab.script();

var expect = Code.expect;
var before = lab.before;
var after = lab.after;
var describe = lab.describe;
var it = lab.it;

var defaultHandler = function (request, reply) {

    reply('success');
};

var defaultValidateFunc = function (token, callback) {

    return callback(null, token === '12345678',  { token: token });
};

var alwaysRejectValidateFunc = function (token, callback) {

    return callback(null, false, { token: token });
};

var alwaysErrorValidateFunc = function (token, callback) {

    return callback({ Error:'Error' }, false, null);
};

var boomErrorValidateFunc = function (token, callback) {

    return callback(Boom.badImplementation('test info'), false, null);
};

var noCredentialValidateFunc = function (token, callback) {

    return callback(null, true, null);
};

var server = new Hapi.Server({ debug: false });
server.connection();

before(function (done){

    server.register(require('../'), function (err) {

        expect(err).to.not.exist();

        server.auth.strategy('default', 'bearer-access-token', true, {
            validateFunc: defaultValidateFunc
        });

        server.auth.strategy('default_named_access_token', 'bearer-access-token', {
            validateFunc: defaultValidateFunc,
            accessTokenName: 'my_access_token'
        });

        server.auth.strategy('always_reject', 'bearer-access-token', {
            validateFunc: alwaysRejectValidateFunc
        });

        server.auth.strategy('with_error_strategy', 'bearer-access-token', {
            validateFunc: alwaysErrorValidateFunc
        });

        server.auth.strategy('boom_error_strategy', 'bearer-access-token', {
            validateFunc: boomErrorValidateFunc
        });

        server.auth.strategy('no_credentials', 'bearer-access-token', {
            validateFunc: noCredentialValidateFunc
        });

        server.auth.strategy('query_token_enabled', 'bearer-access-token', {
            validateFunc: defaultValidateFunc,
            allowQueryToken: true
        });

        server.auth.strategy('query_token_disabled', 'bearer-access-token', {
            validateFunc: defaultValidateFunc,
            allowQueryToken: false
        });

        server.auth.strategy('multiple_headers', 'bearer-access-token', {
            validateFunc: defaultValidateFunc,
            allowMultipleHeaders: true
        });

        server.auth.strategy('custom_token_type', 'bearer-access-token', {
            validateFunc: defaultValidateFunc,
            tokenType: 'Basic'
        });

        server.route([
            { method: 'POST', path: '/basic', handler: defaultHandler, config: { auth: 'default' } },
            { method: 'POST', path: '/basic_default_auth', handler: defaultHandler, config: { } },
            { method: 'GET', path: '/basic_named_token', handler: defaultHandler, config: { auth: 'default_named_access_token' } },
            { method: 'GET', path: '/basic_validate_error', handler: defaultHandler, config: { auth: 'with_error_strategy' } },
            { method: 'GET', path: '/boom_validate_error', handler: defaultHandler, config: { auth: 'boom_error_strategy' } },
            { method: 'GET', path: '/always_reject', handler: defaultHandler, config: { auth: 'always_reject' } },
            { method: 'GET', path: '/no_credentials', handler: defaultHandler, config: { auth: 'no_credentials' } },
            { method: 'GET', path: '/query_token_disabled', handler: defaultHandler, config: { auth: 'query_token_disabled' } },
            { method: 'GET', path: '/query_token_enabled', handler: defaultHandler, config: { auth: 'query_token_enabled' } },
            { method: 'GET', path: '/multiple_headers_enabled', handler: defaultHandler, config: { auth: 'multiple_headers' } },
            { method: 'GET', path: '/custom_token_type', handler: defaultHandler, config: { auth: 'custom_token_type' } }
        ]);

        done();
    });
});

after(function (done) {

    server = null;
    done();
});

it('returns 200 and success with correct bearer token header set', function (done) {

    var request = { method: 'POST', url: '/basic', headers: { authorization: 'Bearer 12345678' } };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('returns 200 and success with correct bearer token header set in multiple authorization header', function (done) {

    var request = { method: 'GET', url: '/multiple_headers_enabled', headers: { authorization: 'Bearer 12345678; FD AF6C74D1-BBB2-4171-8EE3-7BE9356EB018' } };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('returns 200 and success with correct bearer token header set in multiple places of the authorization header', function (done) {

    var request = { method: 'GET', url: '/multiple_headers_enabled', headers: { authorization: 'FD AF6C74D1-BBB2-4171-8EE3-7BE9356EB018; Bearer 12345678' } };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('returns 200 and success with correct bearer token query param set', function (done) {

    var request = { method: 'POST', url: '/basic?access_token=12345678' };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('returns 401 error when no bearer token is set when one is required by default', function (done) {

    var request = { method: 'POST', url: '/basic_default_auth' };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('returns 401 when bearer authorization header is not set', function (done) {

    var request = { method: 'POST', url: '/basic', headers: { authorization: 'definitelynotacorrecttoken' } };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('returns 401 error with bearer token type of object (invalid token)', function (done) {

    var request = { method: 'POST', url: '/basic', headers: { authorization: 'Bearer {test: 1}' } };

    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('returns 500 when strategy returns a regular object to validateFunc', function (done) {

    var request = { method: 'GET', url: '/basic_validate_error', headers: { authorization: 'Bearer 12345678' } };
    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(JSON.stringify(res.result)).to.equal('{\"Error\":\"Error\"}');
        done();
    });
});

it('returns 500 when strategy returns a Boom error to validateFunc', function (done) {

    var request = { method: 'GET', url: '/boom_validate_error', headers: { authorization: 'Bearer 12345678' } };
    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(500);
        expect(JSON.stringify(res.result)).to.equal('{\"statusCode\":500,\"error\":\"Internal Server Error\",\"message\":\"An internal server error occurred\"}');
        done();
    });
});

it('returns 401 handles when isValid false passed to validateFunc', function (done) {

    var request = { method: 'GET', url: '/always_reject', headers: { authorization: 'Bearer 12345678' } };
    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('returns 500 when no credentials passed to validateFunc', function (done) {

    var request = { method: 'GET', url: '/no_credentials', headers: { authorization: 'Bearer 12345678' } };
    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(500);
        done();
    });
});

it('returns a 200 on successful auth with access_token query param renamed and set', function (done) {

    var requestQueryToken = { method: 'GET', url: '/basic_named_token?my_access_token=12345678' };
    server.inject(requestQueryToken, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('doesn\'t affect header auth and will return 200 and success when specifying custom access_token name', function (done) {

    var requestQueryToken = { method: 'GET', url: '/basic_named_token', headers: { authorization: 'Bearer 12345678' } };
    server.inject(requestQueryToken, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('allows you to enable auth by query token', function (done) {

    var requestQueryToken = { method: 'GET', url: '/query_token_enabled?access_token=12345678' };
    server.inject(requestQueryToken, function (res) {

        expect(res.statusCode).to.equal(200);
        expect(res.result).to.equal('success');
        done();
    });
});

it('allows you to disable auth by query token', function (done) {

    var requestHeaderToken  = { method: 'GET', url: '/query_token_disabled?access_token=12345678' };
    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('disables multiple auth headers by default', function (done) {

    var request = { method: 'POST', url: '/basic', headers: { authorization: 'RandomAuthHeader 1234; Bearer 12345678' } };
    server.inject(request, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('allows you to enable multiple auth headers', function (done) {

    var requestHeaderToken = { method: 'GET', url: '/multiple_headers_enabled', headers: { authorization: 'RandomAuthHeader 1234; Bearer 12345678' } };
    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(200);
        done();
    });
});

it('return unauthorized when no auth info and multiple headers disabled', function (done) {

    var requestHeaderToken = { method: 'POST', url: '/basic', headers: { authorization: 'x' } };
    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('return unauthorized when no auth info and multiple headers enabled', function (done) {

    var requestHeaderToken = { method: 'GET', url: '/multiple_headers_enabled', headers: { authorization: 'x' } };
    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('return unauthorized when different token type is used', function (done) {

    var requestHeaderToken = { method: 'GET', url: '/custom_token_type', headers: { authorization: 'Bearer 12345678' } };

    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(401);
        done();
    });
});

it('return 200 when correct token type is used', function (done) {

    var requestHeaderToken  = { method: 'GET', url: '/custom_token_type', headers: { authorization: 'Basic 12345678' } };

    server.inject(requestHeaderToken, function (res) {

        expect(res.statusCode).to.equal(200);
        done();
    });
});


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Povežite dodatni zaslon</title>
<link rel="stylesheet" type="text/css" href="../vodnik_1404.css">

Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu

Novice

Forum

Kaj je Ubuntu?

Pogosta vprašanja

Skupnost

Povezave

 »  Namizni vodnik Ubuntu » Nastavitve » Zaslon »

Povežite dodatni zaslon

Za nastavitev drugega zaslona na vašem namiznem računalnik, priključite zaslon. Če ga vaš sistem takoj ne prepozna ali pa bi želeli prilagoditi nastavitve:

Kliknite na svoje ime v vrhnji vrstici in izberite Nastavitve.

Odprite Zasloni.

Kliknite na sliko zaslona, ki jo želite omogočiti ali onemogočiti in ga nato VKLOPITE/IZKLOPITE.

Zaslon z vrhnjo vrstico je glavni zaslon. Za spremembo kateri zaslon je "glavni", kliknite na vrhnjo vrstico in jo povlecite na zaslon, ki ga želite uporabiti kot "glavni" zaslon.

Za spremembo "položaja" zaslona kliknite nanj in ga povlecite na želeni položaj.

Če želite, da oba zaslona prikažeta isto vsebino, izberite polje Zrcali zaslona.

Ko ste z nastavitvami zadovoljni, kliknite Uveljavi in nato kliknite Obdrži te nastavitve.

Za zaprtje Nastavitev zaslona kliknite na x v zgornjem kotu.

Več podrobnosti

Zaslon — Ozadje, velikost in vrtenje, svetlost …

Material v tem dokumentu je na voljo pod prosto licenco. To je prevod dokumentacije Ubuntu, ki jo je sestavila Ubuntu dokumentacijska ekpa za Ubuntu. V slovenščino jo je prevedla skupina Ubuntu prevajalcev. Za poročanje napak v prevodih v tej dokumentaciji ali Ubuntuju pošljite sporočilo na dopisni seznam.


text:
<?php

namespace Zimbra\Admin\Tests\Struct;

use Zimbra\Admin\Tests\ZimbraAdminTestCase;
use Zimbra\Admin\Struct\Policy;
use Zimbra\Admin\Struct\PolicyHolder;
use Zimbra\Enum\Type;

/**
 * Testcase class for PolicyHolder.
 */
class PolicyHolderTest extends ZimbraAdminTestCase
{
    public function testPolicyHolder()
    {
        $id = $this->faker->word;
        $name = $this->faker->word;
        $lifetime = $this->faker->word;
        $policy = new Policy(Type::SYSTEM(), $id, $name, $lifetime);

        $holder = new PolicyHolder($policy);
        $this->assertSame($policy, $holder->getPolicy());
        $holder->setPolicy($policy);
        $this->assertSame($policy, $holder->getPolicy());

        $xml = '<?xml version="1.0"?>' . "\n"
            . '<holder>'
                . '<policy xmlns="urn:zimbraMail" type="' . Type::SYSTEM() . '" id="' . $id . '" name="' . $name . '" lifetime="' . $lifetime . '" />'
            . '</holder>';
        $this->assertXmlStringEqualsXmlString($xml, (string) $holder);

        $array = [
            'holder' => [
                'policy' => [
                    '_jsns' => 'urn:zimbraMail',
                    'type' => Type::SYSTEM()->value(),
                    'id' => $id,
                    'name' => $name,
                    'lifetime' => $lifetime,
                ],
            ],
        ];
        $this->assertEquals($array, $holder->toArray());
    }
}


text:
package org.apache.accumulo.start.classloader.vfs;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelector;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.provider.FileReplicator;
import org.apache.commons.vfs2.provider.UriParser;
import org.apache.commons.vfs2.provider.VfsComponent;
import org.apache.commons.vfs2.provider.VfsComponentContext;

/**
 *
 */
public class UniqueFileReplicator implements VfsComponent, FileReplicator {

  private static final char[] TMP_RESERVED_CHARS = new char[] {'?', '/', '\\', ' ', '&', '"', '\'', '*', '#', ';', ':', '<', '>', '|'};

  private File tempDir;
  private VfsComponentContext context;
  private List<File> tmpFiles = Collections.synchronizedList(new ArrayList<File>());

  public UniqueFileReplicator(File tempDir) {
    this.tempDir = tempDir;
  }

  @Override
  public File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException {
    String baseName = srcFile.getName().getBaseName();

    try {
      tempDir.mkdirs();
      String safeBasename = UriParser.encode(baseName, TMP_RESERVED_CHARS).replace('%', '_');
      File file = File.createTempFile("vfsr_", "_" + safeBasename, tempDir);
      file.deleteOnExit();

      final FileObject destFile = context.toFileObject(file);
      destFile.copyFrom(srcFile, selector);

      return file;
    } catch (IOException e) {
      throw new FileSystemException(e);
    }
  }

  @Override
  public void setLogger(Log logger) {
    // TODO Auto-generated method stub

  }

  @Override
  public void setContext(VfsComponentContext context) {
    this.context = context;
  }

  @Override
  public void init() throws FileSystemException {

  }

  @Override
  public void close() {
    synchronized (tmpFiles) {
      for (File tmpFile : tmpFiles) {
        tmpFile.delete();
      }
    }

    tempDir.delete();
  }
}


text:
require 'test_helper'

class HorariosControllerTest < ActionDispatch::IntegrationTest
  setup do
    @horario = horarios(:one)
  end

  test "should get index" do
    get horarios_url, as: :json
    assert_response :success
  end

  test "should create horario" do
    assert_difference('Horario.count') do
      post horarios_url, params: { horario: { administrador_id: @horario.administrador_id, disponible: @horario.disponible, fecha_fin: @horario.fecha_fin, fecha_inicio: @horario.fecha_inicio } }, as: :json
    end

    assert_response 201
  end

  test "should show horario" do
    get horario_url(@horario), as: :json
    assert_response :success
  end

  test "should update horario" do
    patch horario_url(@horario), params: { horario: { administrador_id: @horario.administrador_id, disponible: @horario.disponible, fecha_fin: @horario.fecha_fin, fecha_inicio: @horario.fecha_inicio } }, as: :json
    assert_response 200
  end

  test "should destroy horario" do
    assert_difference('Horario.count', -1) do
      delete horario_url(@horario), as: :json
    end

    assert_response 204
  end
end


text:
module Azure::Reservations::Mgmt::V2019_04_01_preview
  module Models
    #
    # Model object.
    #
    #
    class ReservationOrderResponse

      include MsRestAzure

      # @return [Integer]
      attr_accessor :etag

      # @return [String] Identifier of the reservation
      attr_accessor :id

      # @return [String] Name of the reservation
      attr_accessor :name

      # @return [String] Friendly name for user to easily identified the
      # reservation.
      attr_accessor :display_name

      # @return [DateTime] This is the DateTime when the reservation was
      # initially requested for purchase.
      attr_accessor :request_date_time

      # @return [DateTime] This is the DateTime when the reservation was
      # created.
      attr_accessor :created_date_time

      # @return [Date] This is the date when the Reservation will expire.
      attr_accessor :expiry_date

      # @return [Integer]
      attr_accessor :original_quantity

      # @return [ReservationTerm] Possible values include: 'P1Y', 'P3Y'
      attr_accessor :term

      # @return [String] Current state of the reservation.
      attr_accessor :provisioning_state

      # @return [ReservationBillingPlan] Possible values include: 'Upfront',
      # 'Monthly'
      attr_accessor :billing_plan

      # @return [ReservationOrderBillingPlanInformation]
      attr_accessor :plan_information

      # @return [Array<ReservationResponse>]
      attr_accessor :reservations

      # @return [String] Type of resource. "Microsoft.Capacity/reservations"
      attr_accessor :type

      #
      # Mapper for ReservationOrderResponse class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ReservationOrderResponse',
          type: {
            name: 'Composite',
            class_name: 'ReservationOrderResponse',
            model_properties: {
              etag: {
                client_side_validation: true,
                required: false,
                serialized_name: 'etag',
                type: {
                  name: 'Number'
                }
              },
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              display_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.displayName',
                type: {
                  name: 'String'
                }
              },
              request_date_time: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.requestDateTime',
                type: {
                  name: 'DateTime'
                }
              },
              created_date_time: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.createdDateTime',
                type: {
                  name: 'DateTime'
                }
              },
              expiry_date: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.expiryDate',
                type: {
                  name: 'Date'
                }
              },
              original_quantity: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.originalQuantity',
                type: {
                  name: 'Number'
                }
              },
              term: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.term',
                type: {
                  name: 'String'
                }
              },
              provisioning_state: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.provisioningState',
                type: {
                  name: 'String'
                }
              },
              billing_plan: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.billingPlan',
                type: {
                  name: 'String'
                }
              },
              plan_information: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.planInformation',
                type: {
                  name: 'Composite',
                  class_name: 'ReservationOrderBillingPlanInformation'
                }
              },
              reservations: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.reservations',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ReservationResponseElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ReservationResponse'
                      }
                  }
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
<!DOCTYPE html>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title>Proverbs 30 (ASV)</title>
<link href="../../../build/mobile.css" rel="stylesheet" />

American Standard VersionProverbs 30<
=
>

30

1 The words of Agur the son of Jakeh; The oracle.

The man saith unto Ithiel, unto Ithiel and Ucal:

2 Surely I am more brutish than any man,

And have not the understanding of a man;

3 And I have not learned wisdom,

Neither have I the knowledge of the Holy One.

4 Who hath ascended up into heaven, and descended?

Who hath gathered the wind in his fists?

Who hath bound the waters in his garment?

Who hath established all the ends of the earth?

What is his name, and what is his son's name, if thou knowest?

5 Every word of God is tried:

He is a shield unto them that take refuge in him.

6 Add thou not unto his words,

Lest he reprove thee, and thou be found a liar.

7 Two things have I asked of thee;

Deny me them not before I die:

8 Remove far from me falsehood and lies;

Give me neither poverty nor riches;

Feed me with the food that is needful for me:

9 Lest I be full, and deny thee, and say, Who is Jehovah?

Or lest I be poor, and steal,

And use profanely the name of my God.

10 Slander not a servant unto his master,

Lest he curse thee, and thou be held guilty.

11 There is a generation that curse their father,

And bless not their mother.

12 There is a generation that are pure in their own eyes,

And yet are not washed from their filthiness.

13 There is a generation, oh how lofty are their eyes!

And their eyelids are lifted up.

14 There is a generation whose teeth are as swords, and their jaw teeth as knives,

To devour the poor from off the earth, and the needy from among men.

15 The horseleach hath two daughters, crying, Give, give.

There are three things that are never satisfied,

Yea, four that say not, Enough:

16 Sheol; and the barren womb;

The earth that is not satisfied with water;

And the fire that saith not, Enough.

17 The eye that mocketh at his father,

And despiseth to obey his mother,

The ravens of the valley shall pick it out,

And the young eagles shall eat it.

18 There are three things which are too wonderful for me,

Yea, four which I know not:

19 The way of an eagle in the air;

The way of a serpent upon a rock;

The way of a ship in the midst of the sea;

And the way of a man with a maiden.

20 So is the way of an adulterous woman;

She eateth, and wipeth her mouth,

And saith, I have done no wickedness.

21 For three things the earth doth tremble,

And for four, which it cannot bear:

22 For a servant when he is king;

And a fool when he is filled with food;

23 For an odious woman when she is married;

And a handmaid that is heir to her mistress.

24 There are four things which are little upon the earth,

But they are exceeding wise:

25 The ants are a people not strong,

Yet they provide their food in the summer;

26 The conies are but a feeble folk,

Yet make they their houses in the rocks;

27 The locusts have no king,

Yet go they forth all of them by bands;

28 The lizard taketh hold with her hands,

Yet is she in kings' palaces.

29 There are three things which are stately in their march,

Yea, four which are stately in going:

30 The lion, which is mightiest among beasts,

And turneth not away for any;

31 The greyhound; the he-goat also;

And the king against whom there is no rising up.

32 If thou hast done foolishly in lifting up thyself,

Or if thou hast thought evil,

Lay thy hand upon thy mouth.

33 For the churning of milk bringeth forth butter,

And the wringing of the nose bringeth forth blood;

So the forcing of wrath bringeth forth strife.

<
=
>