text:
    lexer.lua
    Created by Masatoshi Teruya on 14/04/28.

    Copyright 2014 Masatoshi Teruya. All rights reserved.

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

--]]
-- patterns
local PAT_SYMBOL = '[-+*/^.<>=~"\'(){}%%%[%],:;#%s]';
local PAT_NONIDENT = '[^%w_]';
local PAT_NUMBER = '%d+';
local PAT_TRIM = '^[%s]*(.*[^%s])[%s]*$';
-- types
local T_EPAIR = -1;
local T_UNKNOWN = 0;
local T_SPACE = 1;
local T_LITERAL = 2;
local T_LABEL = 3;
local T_VAR = 4;
local T_MEMBER = 5;
local T_VLIST = 6;
local T_KEYWORD = 7;
local T_OPERATOR = 8;
local T_NUMBER = 9;
local T_BRACKET_OPEN = 10;
local T_BRACKET_CLOSE = 11;
local T_PAREN_OPEN = 12;
local T_PAREN_CLOSE = 13;
local T_CURLY_OPEN = 14;
local T_CURLY_CLOSE = 15;

-- set keywords
local KEYWORD = {};
do
    for _, v in ipairs({
        'break', 'goto', 'do', 'end', 'while', 'repeat', 'until', 'for', 'in',
        'if', 'elseif', 'else', 'then', 'function', 'return', 'local', 'true',
        'false', 'nil'
    }) do
        KEYWORD[v] = T_KEYWORD;
    end
end

-- symbol type table
local SYMBOL_TYPE = {
    [' '] = T_SPACE,
    ['::'] = T_LABEL,
    ['.'] = T_MEMBER,
    [':'] = T_MEMBER,
    [','] = T_VLIST,
    ['['] = T_BRACKET_OPEN,
    [']'] = T_BRACKET_CLOSE,
    ['('] = T_PAREN_OPEN,
    [')'] = T_PAREN_CLOSE,
    ['{'] = T_CURLY_OPEN,
    ['}'] = T_CURLY_CLOSE
};
do
    -- literal
    for _, v in ipairs({
        '"', '\'', '[[', ']]', '[='
    }) do
        SYMBOL_TYPE[v] = T_LITERAL;
    end
    -- operator
    for _, v in ipairs({
        '+', '-', '*', '/', '%', '^', ';', '..', '<', '<=',
        '>', '>=', '=', '==', '~=', '#', 'and', 'or', 'not'
    }) do
        SYMBOL_TYPE[v] = T_OPERATOR;
    end
end

-- symbol look-ahead table
local SYMBOL_LA = {};
do
    for _, v in ipairs({
        '+', '-', '*', '/', '%', '^', ',', ';', '(', ')', '{', '}', '"', '\'',
        '#', ']'
    }) do
        SYMBOL_LA[v] = 0;
    end

    for _, v in ipairs({
        '.', '[', '<', '>', '=', '~', ':'
    }) do
        SYMBOL_LA[v] = 1;
    end
end

local function trim( str )
    return str:match( PAT_TRIM );
end

local function handleBracketLiteralToken( state, head, tail, token )
    local category = SYMBOL_TYPE[token];
    local lhead, ltail, pat;

    if token == '[[' then
        pat = ']]';
    else
        -- find end of open bracket
        lhead, ltail = state.expr:find( '^%[=+%[', head );

        if not lhead then
            state.error = T_EPAIR;
            return head, tail, T_EPAIR, token;
        end

        -- update tail index
        tail = ltail;
        -- create close bracket pattern
        pat = ']' .. state.expr:sub( lhead + 1, ltail - 1 ) .. ']';
    end

    lhead = tail;
    while( lhead ) do
        lhead, ltail = state.expr:find( pat, lhead + 1, true );
        -- found close symbol and not escape sequence: [\] at front
        if lhead and state.expr:byte( lhead - 1 ) ~= 0x5C then
            -- substruct literal
            token = state.expr:sub( head, ltail );
            -- update cursor
            state.cur = ltail + 1;

            return head, ltail, category, token;
        end
    end

    state.error = T_EPAIR;
    return head, tail, T_EPAIR, token;
end

local function handleEnclosureToken( state, head, tail, token )
    if token ~= ']]' then
        local category = SYMBOL_TYPE[token];
        local pat = token;
        local lhead = tail;
        local ltail;

        while( lhead ) do
            lhead, ltail = state.expr:find( pat, lhead + 1, true );
            -- found close symbol and not escape sequence: [\] at front
            if lhead and state.expr:byte( lhead - 1 ) ~= 0x5C then
                -- substruct literal
                token = state.expr:sub( head, ltail );
                -- update cursor
                state.cur = ltail + 1;

                return head, ltail, category, token;
            end
        end
    end

    state.error = T_EPAIR;
    return head, tail, T_EPAIR, token;
end

local function handleSymToken( state, head, tail, token )
    local category = token == '~' and T_OPERATOR or SYMBOL_TYPE[token];

    if not category then
        category = T_UNKNOWN;
    elseif category == T_LITERAL then
        return handleEnclosureToken( state, head, tail, token );
    elseif category == T_OPERATOR or category == T_MEMBER or
           category == T_BRACKET_OPEN or category == T_BRACKET_CLOSE then
        local len = SYMBOL_LA[token];

        -- check next char
        if len > 0 then
            local chk = state.expr:sub( head, head + len );
            local t = SYMBOL_TYPE[chk];

            if t == T_OPERATOR then
                token = chk;
                tail = head + len;
                category = t;
            elseif t == T_LITERAL or t == T_LABEL then
                token = chk;
                tail = head + len;

                -- bracket literal
                if token:byte( 1 ) == 0x5B then
                    return handleBracketLiteralToken( state, head, tail, token );
                end

                return handleEnclosureToken( state, head, tail, token );
            end
        end
    end
    -- update cursor
    state.cur = tail + 1;

    return head, tail, category, token;
end

local function handleNameToken( state, head, tail, token )
    local shead, stail = token:find( PAT_NONIDENT );
    local category;

    -- found unknown symbol
    if shead then
        category = T_UNKNOWN;
        if shead == 1 then
            token = token:sub( shead, stail );
            tail = head;
        else
            token = token:sub( 1, shead - 1 );
            tail = tail - shead;
        end
    else
        category = KEYWORD[token] or SYMBOL_TYPE[token];

        if not category then
            if token:find( PAT_NUMBER ) then
                category = T_NUMBER;
            else
                category = T_VAR;
            end
        end
    end

    -- update cursor
    state.cur = tail + 1;

    return head, tail, category, token;
end

local function nextToken( state )
    local head, tail, token, handle;

    if state.error or state.cur >= state.len then
        return head, tail;
    end

    -- lookup symbol
    head, tail = state.expr:find( PAT_SYMBOL, state.cur );

    -- found symbol
    if head then
        -- substract symbol token
        if state.cur == head then
            token = state.expr:sub( head, tail );
            handle = handleSymToken;
        -- substract left token
        else
            token = trim( state.expr:sub( state.cur, head - 1 ) );
            tail = head - 1;
            head = state.cur;
            handle = handleNameToken;
        end
    -- substract remain
    else
        head = state.cur;
        tail = state.len;
        token = trim( state.expr:sub( head ) );
        handle = handleNameToken;
    end

    return handle( state, head, tail, token );
end

local function scan( expr )
    return nextToken, {
        iden = false,
        expr = expr,
        len = #expr + 1,
        cur = 1,
        head = 0,
        tail = 0
    }, 1;
end

return {
    scan = scan,
    -- types
    T_EPAIR = T_EPAIR,
    T_UNKNOWN = T_UNKNOWN,
    T_SPACE = T_SPACE,
    T_LITERAL = T_LITERAL,
    T_LABEL = T_LABEL,
    T_VAR = T_VAR,
    T_MEMBER = T_MEMBER,
    T_VLIST = T_VLIST,
    T_KEYWORD = T_KEYWORD,
    T_OPERATOR = T_OPERATOR,
    T_NUMBER = T_NUMBER,
    T_BRACKET_OPEN = T_BRACKET_OPEN,
    T_BRACKET_CLOSE = T_BRACKET_CLOSE,
    T_PAREN_OPEN = T_PAREN_OPEN,
    T_PAREN_CLOSE = T_PAREN_CLOSE,
    T_CURLY_OPEN = T_CURLY_OPEN,
    T_CURLY_CLOSE = T_CURLY_CLOSE
};


text:
package org.apache.tinkerpop.gremlin.process.computer.traversal;

import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
import org.apache.tinkerpop.gremlin.process.computer.Messenger;
import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
import org.apache.tinkerpop.gremlin.process.traversal.step.Bypassing;
import org.apache.tinkerpop.gremlin.process.traversal.step.LocalBarrier;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMatrix;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.Attachable;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public final class TraverserExecutor {

    public static boolean execute(final Vertex vertex, final Messenger<TraverserSet<Object>> messenger, final TraversalMatrix<?, ?> traversalMatrix, final Memory memory, final boolean returnHaltedTraversers) {

        final TraversalSideEffects traversalSideEffects = traversalMatrix.getTraversal().getSideEffects();
        final AtomicBoolean voteToHalt = new AtomicBoolean(true);
        final TraverserSet<Object> haltedTraversers = vertex.value(TraversalVertexProgram.HALTED_TRAVERSERS);
        final TraverserSet<Object> activeTraversers = new TraverserSet<>();
        final TraverserSet<Object> toProcessTraversers = new TraverserSet<>();

        ////////////////////////////////
        // GENERATE LOCAL TRAVERSERS //
        ///////////////////////////////

        // these are traversers that are going from OLTP to OLAP
        final TraverserSet<Object> maybeActiveTraversers = memory.get(TraversalVertexProgram.ACTIVE_TRAVERSERS);
        final Iterator<Traverser.Admin<Object>> iterator = maybeActiveTraversers.iterator();
        while (iterator.hasNext()) {
            final Traverser.Admin<Object> traverser = iterator.next();
            if (vertex.equals(TraverserExecutor.getHostingVertex(traverser.get()))) {
                // iterator.remove(); ConcurrentModificationException
                traverser.attach(Attachable.Method.get(vertex));
                traverser.setSideEffects(traversalSideEffects);
                toProcessTraversers.add(traverser);
            }
        }
        // these are traversers that exist from from a local barrier
        vertex.<TraverserSet<Object>>property(TraversalVertexProgram.ACTIVE_TRAVERSERS).ifPresent(previousActiveTraversers -> {
            IteratorUtils.removeOnNext(previousActiveTraversers.iterator()).forEachRemaining(traverser -> {
                traverser.attach(Attachable.Method.get(vertex));
                traverser.setSideEffects(traversalSideEffects);
                toProcessTraversers.add(traverser);
            });
            vertex.property(TraversalVertexProgram.ACTIVE_TRAVERSERS).remove();
        });
        // these are traversers that have been messaged to the vertex
        final Iterator<TraverserSet<Object>> messages = messenger.receiveMessages();
        while (messages.hasNext()) {
            final Iterator<Traverser.Admin<Object>> traversers = messages.next().iterator();
            while (traversers.hasNext()) {
                final Traverser.Admin<Object> traverser = traversers.next();
                traversers.remove();
                traverser.attach(Attachable.Method.get(vertex));
                traverser.setSideEffects(traversalSideEffects);
                toProcessTraversers.add(traverser);
            }
        }

        ///////////////////////////////
        // PROCESS LOCAL TRAVERSERS //
        //////////////////////////////

        // while there are still local traversers, process them until they leave the vertex or halt (i.e. isHalted()).
        while (!toProcessTraversers.isEmpty()) {
            // process local traversers and if alive, repeat, else halt.
            Step<Object, Object> previousStep = EmptyStep.instance();
            Iterator<Traverser.Admin<Object>> traversers = toProcessTraversers.iterator();
            while (traversers.hasNext()) {
                final Traverser.Admin<Object> traverser = traversers.next();
                traversers.remove();
                final Step<Object, Object> currentStep = traversalMatrix.getStepById(traverser.getStepId());
                if (!currentStep.getId().equals(previousStep.getId()) && !(previousStep instanceof EmptyStep))
                    TraverserExecutor.drainStep(vertex, previousStep, activeTraversers, haltedTraversers, memory, returnHaltedTraversers);
                currentStep.addStart(traverser);
                previousStep = currentStep;
            }
            TraverserExecutor.drainStep(vertex, previousStep, activeTraversers, haltedTraversers, memory, returnHaltedTraversers);
            assert toProcessTraversers.isEmpty();
            // process all the local objects and send messages or store locally again
            if (!activeTraversers.isEmpty()) {
                traversers = activeTraversers.iterator();
                while (traversers.hasNext()) {
                    final Traverser.Admin<Object> traverser = traversers.next();
                    traversers.remove();
                    if (traverser.get() instanceof Element || traverser.get() instanceof Property) {      // GRAPH OBJECT
                        // if the element is remote, then message, else store it locally for re-processing
                        final Vertex hostingVertex = TraverserExecutor.getHostingVertex(traverser.get());
                        if (!vertex.equals(hostingVertex)) { // necessary for path access
                            voteToHalt.set(false);
                            traverser.detach();
                            messenger.sendMessage(MessageScope.Global.of(hostingVertex), new TraverserSet<>(traverser));
                        } else {
                            if (traverser.get() instanceof Attachable)   // necessary for path access to local object
                                traverser.attach(Attachable.Method.get(vertex));
                            toProcessTraversers.add(traverser);
                        }
                    } else                                                                              // STANDARD OBJECT
                        toProcessTraversers.add(traverser);
                }
                assert activeTraversers.isEmpty();
            }
        }
        return voteToHalt.get();
    }

    private static void drainStep(final Vertex vertex, final Step<Object, Object> step, final TraverserSet<Object> activeTraversers, final TraverserSet<Object> haltedTraversers, final Memory memory, final boolean returnHaltedTraversers) {
        if (step instanceof Barrier) {
            if (step instanceof Bypassing)
                ((Bypassing) step).setBypass(true);
            if (step instanceof LocalBarrier) {
                final LocalBarrier<Object> barrier = (LocalBarrier<Object>) step;
                final TraverserSet<Object> traverserSet = vertex.<TraverserSet<Object>>property(TraversalVertexProgram.ACTIVE_TRAVERSERS).orElse(new TraverserSet<>());
                vertex.property(TraversalVertexProgram.ACTIVE_TRAVERSERS, traverserSet);
                while (barrier.hasNextBarrier()) {
                    final TraverserSet<Object> barrierSet = barrier.nextBarrier();
                    IteratorUtils.removeOnNext(barrierSet.iterator()).forEachRemaining(traverser -> {
                        if (traverser.isHalted()) {
                            traverser.detach();
                            haltedTraversers.add(traverser);
                            if (returnHaltedTraversers)
                                memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(traverser.split()));
                        } else {
                            traverser.detach();
                            traverserSet.add(traverser);
                        }
                    });
                }
                memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
            } else {
                final Barrier barrier = (Barrier) step;
                while (barrier.hasNextBarrier()) {
                    memory.add(step.getId(), barrier.nextBarrier());
                }
                memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
            }
        } else { // LOCAL PROCESSING
            step.forEachRemaining(traverser -> {
                if (traverser.isHalted()) {
                    traverser.detach();
                    haltedTraversers.add(traverser);
                    if (returnHaltedTraversers)
                        memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(traverser.split()));
                } else {
                    activeTraversers.add(traverser);
                }
            });
        }
    }

    private static Vertex getHostingVertex(final Object object) {
        Object obj = object;
        while (true) {
            if (obj instanceof Vertex)
                return (Vertex) obj;
            else if (obj instanceof Edge)
                return ((Edge) obj).outVertex();
            else if (obj instanceof Property)
                obj = ((Property) obj).element();
            else
                throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.rohos.logon1;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

/**
 * Created by Alex on 03.01.14.
 * Rohos Loogn Key How it works help
 *
 * @author AlexShilon
 */
public class HelpActivity extends Activity {

    private final String TAG = "HelpActiviy";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_help);

        Button learnMore = findViewById(R.id.learn_more);
        learnMore.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                openWebPage();
            }
        });

        //setPageContentView(R.layout.activity_help);
        //setTextViewHtmlFromResource(R.id.details, R.string.howitworks_page_enter_code_details);
    }

    private void openWebPage() {
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://www.rohos.com/2013/12/login-unlock-computer-by-using-smartphone/"));
            startActivity(intent);
        } catch (Exception e) {
           // Log.e(TAG, e.toString());
        }
    }

    /*@Override
    protected void onRightButtonPressed() {
        //startPageActivity(IntroVerifyDeviceActivity.class);
    }*/
}


text:
package de.iritgo.aktera.ui.listing;

import java.sql.SQLException;
import java.util.Map;
import de.iritgo.aktera.authentication.defaultauth.entity.UserDAO;
import de.iritgo.aktera.model.ModelException;
import de.iritgo.aktera.model.ModelRequest;
import de.iritgo.aktera.model.ModelResponse;
import de.iritgo.aktera.permissions.PermissionException;
import de.iritgo.aktera.persist.PersistenceException;
import de.iritgo.aktera.spring.SpringTools;
import de.iritgo.aktera.ui.tools.UserTools;
import de.iritgo.simplelife.string.StringTools;

/**
 * Base class for all listing handlers.
 */
public class ListingHandler
{
	/** The default handler */
	private ListingHandler defaultHandler;

	/**
	 * Set the default handler.
	 *
	 * @param defaultHandler The new default handler
	 */
	public void setDefaultHandler(ListingHandler defaultHandler)
	{
		this.defaultHandler = defaultHandler;
	}

	/**
	 * This method is called before the listing is actually created.
	 *
	 * @param req The model request
	 * @param listing The listing
	 * @param context The list context
	 * @throws ModelException In case of an error
	 */
	public void adjustListing(ModelRequest req, ListingDescriptor listing, ListContext context) throws ModelException
	{
	}

	/**
	 * Override this method if you want to provide a list of search categories.
	 *
	 * @param request The model request
	 * @param listing The listing
	 * @return A map of (value, label) entries
	 * @throws ModelException In case of an error
	 */
	public Map<String, String> createSearchCategories(ModelRequest request, ListingDescriptor listing)
		throws ModelException
	{
		return null;
	}

	/**
	 * Override this method to provide the currently selected search category
	 *
	 * @param request The model request
	 * @param listing The listing descriptor
	 * @return The currently selected search category
	 * @throws ModelException In case of an error
	 */
	public String getCurrentSearchCategory(ModelRequest request, ListingDescriptor listing) throws ModelException
	{
		Object category = request.getParameter(listing.getId() + "SearchCategory");

		return category != null ? category.toString() : null;
	}

	/**
	 * Actually create the listing response.
	 *
	 * @param request The model request
	 * @param listing The listing
	 * @param handler The listing handler
	 * @param context The list context
	 * @return A listing filler
	 * @throws ModelException In case of an error
	 * @throws PersistenceException In case of a database error
	 */
	public ListFiller createListing(ModelRequest request, ListingDescriptor listing, ListingHandler handler,
					ListContext context) throws ModelException, PersistenceException
	{
		return defaultHandler.createListing(request, listing, handler, context);
	}

	/**
	 * Handle one item of the query result.
	 *
	 * @param req The model request
	 * @param res The model response
	 * @param listing The listing
	 * @param item The cell item
	 * @param set The result set
	 * @throws ModelException In case of an error
	 * @throws PersistenceException In case of a database error
	 * @throws SQLException In case of a database error
	 */
	public CellData handleResult(ModelRequest req, ModelResponse res, ListingDescriptor listing,
					@SuppressWarnings("unused") RowData data, @SuppressWarnings("unused") ColumnDescriptor column)
		throws PersistenceException, ModelException, SQLException
	{
		return new CellData();
	}

	/**
	 * Retrieve the actual user id. This is either the current user, or the user provided
	 * by the request parameter "userId".
	 *
	 * @return The user id
	 * @throws ModelException In case of a general error
	 * @throws PersistenceException in case of a database error
	 * @throws PermissionException If the current user has no permission to upload files
	 * for another user
	 */
	protected Integer getActualUserId(ModelRequest request)
		throws PersistenceException, PermissionException, ModelException
	{
		if (! StringTools.isTrimEmpty(request.getParameter("userId")))
		{
			int userId = request.getParameterAsInt("userId", - 1);

			if (! UserTools.currentUserIsInGroup(request, "manager") && UserTools.getCurrentUserId(request) != userId)
			{
				throw new PermissionException("Permission denied to edit com device function keys of user " + userId);
			}

			return userId;
		}

		return UserTools.getCurrentUserId(request);
	}

	/**
	 * Retrieve the actual user id. This is either the current user, or the user provided
	 * by the request parameter "userId".
	 *
	 * @return The user id
	 * @throws ModelException In case of a general error
	 * @throws PersistenceException in case of a database error
	 * @throws PermissionException If the current user has no permission to upload files
	 * for another user
	 */
	protected String getActualUserName(ModelRequest request)
		throws PersistenceException, PermissionException, ModelException
	{
		if (! StringTools.isTrimEmpty(request.getParameter("userId")))
		{
			int userId = request.getParameterAsInt("userId", - 1);
			if (! UserTools.currentUserIsInGroup(request, "manager") && UserTools.getCurrentUserId(request) != userId)
			{
				throw new PermissionException("Permission denied to edit com device function keys of user " + userId);
			}
			UserDAO userDAO = (UserDAO) SpringTools.getBean(UserDAO.ID);
			return userDAO.findUserById(userId).getName();
		}
		return UserTools.getCurrentUserName(request);
	}
}


text:
package admin.cbas.eict.de;

import org.jdesktop.swingx.calendar.SingleDaySelectionModel;
import org.jdesktop.swingx.JXDatePicker;

import javax.swing.*;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.DateFormatter;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.awt.*;

/**
 * This is licensed under LGPL.  License can be found here:  http://www.gnu.org/licenses/lgpl-3.0.txt
 *
 * This is provided as is.  If you have questions please direct them to charlie.hubbard at gmail dot you know what.
 */
public class DateTimePicker extends JXDatePicker {
    /**
	 *
	 */
	private static final long serialVersionUID = 1068132004796943387L;
	private JSpinner timeSpinner;
    private JPanel timePanel;
    private DateFormat timeFormat;

    public DateTimePicker() {
        super();
        getMonthView().setSelectionModel(new SingleDaySelectionModel());
    }

    public DateTimePicker( Date d ) {
        this();
        setDate(d);
    }

    public void commitEdit() throws ParseException {
        commitTime();
        super.commitEdit();
    }

    public void cancelEdit() {
        super.cancelEdit();
        setTimeSpinners();
    }

    @Override
    public JPanel getLinkPanel() {
        super.getLinkPanel();
        if( timePanel == null ) {
            timePanel = createTimePanel();
        }
        setTimeSpinners();
        return timePanel;
    }

    private JPanel createTimePanel() {
        JPanel newPanel = new JPanel();
        newPanel.setLayout(new FlowLayout());
        //newPanel.add(panelOriginal);

        SpinnerDateModel dateModel = new SpinnerDateModel();
        timeSpinner = new JSpinner(dateModel);
        ((JSpinner.DateEditor) timeSpinner.getEditor()).getFormat().applyPattern("HH:mm:ss");
        //((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField().setEditable(false);
        if( timeFormat == null ) timeFormat = new SimpleDateFormat("HH:mm:ss");
        JFormattedTextField tf = ((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField();
        tf.setText(timeFormat.format(new Date()));
        updateTextFieldFormat();
        newPanel.add(new JLabel( "Time:" ) );
        newPanel.add(timeSpinner);
        newPanel.setBackground(Color.WHITE);
        return newPanel;
    }

    private void updateTextFieldFormat() {
        if( timeSpinner == null ) return;
        JFormattedTextField tf = ((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField();
        DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory();
        DateFormatter formatter = (DateFormatter) factory.getDefaultFormatter();
        // Change the date format to only show the hours
        formatter.setFormat( timeFormat );
    }

    private void commitTime() {
        Date date = getDate();
        if (date != null) {
            Date time = (Date) timeSpinner.getValue();
            GregorianCalendar timeCalendar = new GregorianCalendar();
            timeCalendar.setTime( time );

            GregorianCalendar calendar = new GregorianCalendar();
            calendar.setTime(date);
            calendar.set(Calendar.HOUR_OF_DAY, timeCalendar.get( Calendar.HOUR_OF_DAY ) );
            calendar.set(Calendar.MINUTE, timeCalendar.get( Calendar.MINUTE ) );
            calendar.set(Calendar.SECOND, timeCalendar.get( Calendar.SECOND) );
            calendar.set(Calendar.MILLISECOND, 0);

            Date newDate = calendar.getTime();
            setDate(newDate);
        }

    }

    private void setTimeSpinners() {
        Date date = getDate();
        if (date != null) {
            timeSpinner.setValue( date );
        }
    }

    public DateFormat getTimeFormat() {
        return timeFormat;
    }

    public void setTimeFormat(DateFormat timeFormat) {
        this.timeFormat = timeFormat;
        updateTextFieldFormat();
    }

}


text:
class User < ActiveRecord::Base
  devise :cas_authenticatable, :trackable

end


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.appservice.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.http.rest.PagedIterable;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListingPrivateEndpointConnection;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListingPrivateLinkResource;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsUpdatingPrivateEndpointConnection;
import com.azure.resourcemanager.resources.models.ResourceGroup;
import com.azure.resourcemanager.resources.fluentcore.arm.models.GroupableResource;
import com.azure.resourcemanager.resources.fluentcore.model.Creatable;
import com.azure.resourcemanager.resources.fluentcore.model.Updatable;
import com.azure.resourcemanager.storage.models.StorageAccount;
import com.azure.resourcemanager.storage.models.StorageAccountSkuType;
import java.util.Map;
import reactor.core.publisher.Mono;

/** An immutable client-side representation of an Azure Function App. */
@Fluent
public interface FunctionApp extends FunctionAppBasic, WebAppBase, Updatable<FunctionApp.Update>,
    SupportsListingPrivateLinkResource,
    SupportsListingPrivateEndpointConnection,
    SupportsUpdatingPrivateEndpointConnection {

    /** @return the entry point to deployment slot management API under the function app */
    FunctionDeploymentSlots deploymentSlots();

    /** @return the storage account associated with the function app */
    StorageAccount storageAccount();

    /** @return the master key for the function app */
    String getMasterKey();

    /** @return the master key for the function app */
    Mono<String> getMasterKeyAsync();

    /**
     * List function information elements.
     *
     * @return list of function information elements
     */
    PagedIterable<FunctionEnvelope> listFunctions();

    /**
     * Retrieve the function key for a specific function.
     *
     * @param functionName the name of the function
     * @return the function key
     */
    Map<String, String> listFunctionKeys(String functionName);

    /**
     * Retrieve the function key for a specific function.
     *
     * @param functionName the name of the function
     * @return the function key
     */
    Mono<Map<String, String>> listFunctionKeysAsync(String functionName);

    /**
     * Adds a key to a function in this function app.
     *
     * @param functionName the name of the function
     * @param keyName the name of the key to add
     * @param keyValue optional. If not provided, a value will be generated.
     * @return the added function key
     */
    NameValuePair addFunctionKey(String functionName, String keyName, String keyValue);

    /**
     * Adds a key to a function in this function app.
     *
     * @param functionName the name of the function
     * @param keyName the name of the key to add
     * @param keyValue optional. If not provided, a value will be generated.
     * @return the added function key
     */
    Mono<NameValuePair> addFunctionKeyAsync(String functionName, String keyName, String keyValue);

    /**
     * Removes a key to a function in this function app.
     *
     * @param functionName the name of the function
     * @param keyName the name of the key to remove
     */
    void removeFunctionKey(String functionName, String keyName);

    /**
     * Removes a key to a function in this function app.
     *
     * @param functionName the name of the function
     * @param keyName the name of the key to remove
     * @return the completable of the operation
     */
    Mono<Void> removeFunctionKeyAsync(String functionName, String keyName);

    /**
     * Triggers a function.
     *
     * @param functionName the name of the function
     * @param payload the payload to be serialized to JSON
     */
    void triggerFunction(String functionName, Object payload);

    /**
     * Triggers a function.
     *
     * @param functionName the name of the function
     * @param payload the payload to be serialized to JSON
     * @return the completable of the operation
     */
    Mono<Void> triggerFunctionAsync(String functionName, Object payload);

    /** Syncs the triggers on the function app. */
    void syncTriggers();

    /**
     * Syncs the triggers on the function app.
     *
     * @return a completable for the operation
     */
    Mono<Void> syncTriggersAsync();

    /**************************************************************
     * Fluent interfaces to provision a Function App
     **************************************************************/

    /** Container interface for all the definitions that need to be implemented. */
    interface Definition
        extends DefinitionStages.Blank,
            DefinitionStages.ExistingAppServicePlanWithGroup,
            DefinitionStages.WithStorageAccount,
            DefinitionStages.WithDockerContainerImage,
            DefinitionStages.WithCredentials,
            DefinitionStages.WithCreate {
    }

    /** Grouping of all the function app definition stages. */
    interface DefinitionStages {
        /** The first stage of the function app definition. */
        interface Blank extends DefinitionWithRegion<NewAppServicePlanWithGroup> {
            /**
             * Uses an existing Windows app service plan for the function app.
             *
             * @param appServicePlan the existing app service plan
             * @return the next stage of the definition
             */
            ExistingAppServicePlanWithGroup withExistingAppServicePlan(AppServicePlan appServicePlan);

            /**
             * Uses an existing Linux app service plan for the function app.
             *
             * @param appServicePlan the existing app service plan
             * @return the next stage of the definition
             */
            ExistingLinuxPlanWithGroup withExistingLinuxAppServicePlan(AppServicePlan appServicePlan);
        }

        /**
         * A function app definition allowing resource group to be specified when an existing app service plan is used.
         */
        interface ExistingAppServicePlanWithGroup extends GroupableResource.DefinitionStages.WithGroup<WithCreate> {
        }

        /**
         * A function app definition allowing resource group to be specified when a new app service plan is to be
         * created.
         */
        interface NewAppServicePlanWithGroup {
            /**
             * Associates the resource with an existing resource group.
             *
             * @param groupName the name of an existing resource group to put this resource in.
             * @return the next stage of the definition
             */
            WithCreate withExistingResourceGroup(String groupName);

            /**
             * Associates the resource with an existing resource group.
             *
             * @param group an existing resource group to put the resource in
             * @return the next stage of the definition
             */
            WithCreate withExistingResourceGroup(ResourceGroup group);

            /**
             * Creates a new resource group to put the resource in.
             *
             *
The group will be created in the same location as the resource.
             *
             * @param name the name of the new group
             * @return the next stage of the definition
             */
            WithCreate withNewResourceGroup(String name);

            /**
             * Creates a new resource group to put the resource in.
             *
             *
The group will be created in the same location as the resource. The group's name is automatically
             * derived from the resource's name.
             *
             * @return the next stage of the definition
             */
            WithCreate withNewResourceGroup();

            /**
             * Creates a new resource group to put the resource in, based on the definition specified.
             *
             * @param groupDefinition a creatable definition for a new resource group
             * @return the next stage of the definition
             */
            WithCreate withNewResourceGroup(Creatable<ResourceGroup> groupDefinition);
        }

        /** A function app definition allowing app service plan to be set. */
        interface WithNewAppServicePlan {
            /**
             * Creates a new Windows consumption plan to use.
             *
             * @return the next stage of the definition
             */
            WithCreate withNewConsumptionPlan();

            /**
             * Creates a new Windows consumption plan to use.
             *
             * @param appServicePlanName the name of the new consumption plan
             * @return the next stage of the definition
             */
            WithCreate withNewConsumptionPlan(String appServicePlanName);

            /**
             * Creates a new Windows free app service plan. This will fail if there are 10 or more free plans in the
             * current subscription.
             *
             * @return the next stage of the definition
             */
            WithCreate withNewFreeAppServicePlan();

            /**
             * Creates a new Windows shared app service plan.
             *
             * @return the next stage of the definition
             */
            WithCreate withNewSharedAppServicePlan();

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            WithCreate withNewAppServicePlan(PricingTier pricingTier);

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param appServicePlanName the name of the new app service plan
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            WithCreate withNewAppServicePlan(String appServicePlanName, PricingTier pricingTier);

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param appServicePlanCreatable the new app service plan creatable
             * @return the next stage of the definition
             */
            WithCreate withNewAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable);

            /**
             * Creates a new Linux consumption plan to use.
             *
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewLinuxConsumptionPlan();

            /**
             * Creates a new Linux consumption plan to use.
             *
             * @param appServicePlanName the name of the new consumption plan
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewLinuxConsumptionPlan(String appServicePlanName);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewLinuxAppServicePlan(PricingTier pricingTier);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param appServicePlanName the name of the new app service plan
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewLinuxAppServicePlan(String appServicePlanName, PricingTier pricingTier);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param appServicePlanCreatable the new app service plan creatable
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewLinuxAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable);
        }

        /**
         * A function app definition allowing storage account to be specified. A storage account is required for storing
         * function execution runtime, triggers, and logs.
         */
        interface WithStorageAccount {
            /**
             * Creates a new storage account to use for the function app.
             *
             * @param name the name of the storage account
             * @param sku the sku of the storage account
             * @return the next stage of the definition
             */
            WithCreate withNewStorageAccount(String name, StorageAccountSkuType sku);

            /**
             * Creates a new storage account to use for the function app.
             *
             * @param storageAccount a creatable definition for a new storage account
             * @return the next stage of the definition
             */
            WithCreate withNewStorageAccount(Creatable<StorageAccount> storageAccount);

            /**
             * Specifies the storage account to use for the function app.
             *
             * @param storageAccount the storage account to use
             * @return the next stage of the definition
             */
            WithCreate withExistingStorageAccount(StorageAccount storageAccount);
        }

        /** A function app definition allowing runtime version to be specified. */
        interface WithRuntimeVersion {
            /**
             * Specifies the runtime for the function app.
             *
             * @param runtime the Azure Functions runtime
             * @return the next stage of the definition
             */
            WithCreate withRuntime(String runtime);

            /**
             * Specifies the runtime version for the function app.
             *
             * @param version the version of the Azure Functions runtime
             * @return the next stage of the definition
             */
            WithCreate withRuntimeVersion(String version);

            /**
             * Uses the latest runtime version for the function app.
             *
             * @return the next stage of the definition
             */
            WithCreate withLatestRuntimeVersion();
        }

        /** A function app definition allowing daily usage quota to be specified. */
        interface WithDailyUsageQuota {
            /**
             * Specifies the daily usage data cap.
             *
             * @param quota the daily usage quota
             * @return the next stage of the definition
             */
            WithCreate withDailyUsageQuota(int quota);

            /**
             * Specifies the daily usage data cap.
             *
             * @return the next stage of the definition
             */
            WithCreate withoutDailyUsageQuota();
        }

        /**
         * A function app definition with sufficient inputs to create a new function app in the cloud, but exposing
         * additional optional inputs to specify.
         */
        interface WithCreate
            extends Creatable<FunctionApp>,
                DefinitionStages.WithNewAppServicePlan,
                DefinitionStages.WithStorageAccount,
                DefinitionStages.WithRuntimeVersion,
                DefinitionStages.WithDailyUsageQuota,
                WebAppBase.DefinitionStages.WithCreate<FunctionApp> {
        }

        /**
         * A function app definition allowing resource group to be specified when an existing app service plan is used.
         */
        interface ExistingLinuxPlanWithGroup {
            /**
             * Associates the resource with an existing resource group.
             *
             * @param groupName the name of an existing resource group to put this resource in.
             * @return the next stage of the definition
             */
            WithDockerContainerImage withExistingResourceGroup(String groupName);

            /**
             * Associates the resource with an existing resource group.
             *
             * @param group an existing resource group to put the resource in
             * @return the next stage of the definition
             */
            WithDockerContainerImage withExistingResourceGroup(ResourceGroup group);

            /**
             * Creates a new resource group to put the resource in.
             *
             *
The group will be created in the same location as the resource.
             *
             * @param name the name of the new group
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewResourceGroup(String name);

            /**
             * Creates a new resource group to put the resource in.
             *
             *
The group will be created in the same location as the resource. The group's name is automatically
             * derived from the resource's name.
             *
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewResourceGroup();

            /**
             * Creates a new resource group to put the resource in, based on the definition specified.
             *
             * @param groupDefinition a creatable definition for a new resource group
             * @return the next stage of the definition
             */
            WithDockerContainerImage withNewResourceGroup(Creatable<ResourceGroup> groupDefinition);
        }

        /** A function app definition allowing docker image source to be specified. */
        interface WithDockerContainerImage {
            /**
             * Specifies the docker container image to be a built in one.
             *
             * @param runtimeStack the runtime stack installed on the image
             * @return the next stage of the definition
             */
            WithCreate withBuiltInImage(FunctionRuntimeStack runtimeStack);

            /**
             * Specifies the docker container image to be one from Docker Hub.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @return the next stage of the definition
             */
            WithCreate withPublicDockerHubImage(String imageAndTag);

            /**
             * Specifies the docker container image to be one from Docker Hub.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @return the next stage of the definition
             */
            WithCredentials withPrivateDockerHubImage(String imageAndTag);

            /**
             * Specifies the docker container image to be one from a private registry.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @param serverUrl the URL to the private registry server
             * @return the next stage of the definition
             */
            WithCredentials withPrivateRegistryImage(String imageAndTag, String serverUrl);
        }

        /** A function app definition allowing docker registry credentials to be set. */
        interface WithCredentials {
            /**
             * Specifies the username and password for Docker Hub.
             *
             * @param username the username for Docker Hub
             * @param password the password for Docker Hub
             * @return the next stage of the web app update
             */
            WithCreate withCredentials(String username, String password);
        }
    }

    /** Grouping of all the function app update stages. */
    interface UpdateStages {
        /** A function app update allowing app service plan to be set. */
        interface WithAppServicePlan {
            /**
             * Creates a new Windows consumption plan to use.
             *
             * @return the next stage of the function app update
             */
            Update withNewConsumptionPlan();

            /**
             * Creates a new Windows consumption plan to use.
             *
             * @param appServicePlanName the name of the new consumption plan
             * @return the next stage of the function app update
             */
            Update withNewConsumptionPlan(String appServicePlanName);

            /**
             * Creates a new Windows free app service plan. This will fail if there are 10 or more free plans in the
             * current subscription.
             *
             * @return the next stage of the function app update
             */
            Update withNewFreeAppServicePlan();

            /**
             * Creates a new Windows shared app service plan.
             *
             * @return the next stage of the function app update
             */
            Update withNewSharedAppServicePlan();

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the function app update
             */
            Update withNewAppServicePlan(PricingTier pricingTier);

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param appServicePlanName the name of the new app service plan
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the function app update
             */
            Update withNewAppServicePlan(String appServicePlanName, PricingTier pricingTier);

            /**
             * Creates a new Windows app service plan to use.
             *
             * @param appServicePlanCreatable the new app service plan creatable
             * @return the next stage of the function app update
             */
            Update withNewAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable);

            /**
             * Uses an existing Windows app service plan for the function app.
             *
             * @param appServicePlan the existing app service plan
             * @return the next stage of the function app update
             */
            Update withExistingAppServicePlan(AppServicePlan appServicePlan);

            /**
             * Uses an existing Linux app service plan for the function app.
             *
             * @param appServicePlan the existing app service plan
             * @return the next stage of the definition
             */
            Update withExistingLinuxAppServicePlan(AppServicePlan appServicePlan);

            /**
             * Creates a new Linux consumption plan to use.
             *
             * @return the next stage of the definition
             */
            Update withNewLinuxConsumptionPlan();

            /**
             * Creates a new Linux consumption plan to use.
             *
             * @param appServicePlanName the name of the new consumption plan
             * @return the next stage of the definition
             */
            Update withNewLinuxConsumptionPlan(String appServicePlanName);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            Update withNewLinuxAppServicePlan(PricingTier pricingTier);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param appServicePlanName the name of the new app service plan
             * @param pricingTier the sku of the app service plan
             * @return the next stage of the definition
             */
            Update withNewLinuxAppServicePlan(String appServicePlanName, PricingTier pricingTier);

            /**
             * Creates a new Linux app service plan to use.
             *
             * @param appServicePlanCreatable the new app service plan creatable
             * @return the next stage of the definition
             */
            Update withNewLinuxAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable);
        }

        /** A function app update allowing runtime version to be specified. */
        interface WithRuntimeVersion {
            /**
             * Specifies the runtime for the function app.
             *
             * @param runtime the Azure Functions runtime
             * @return the next stage of the definition
             */
            Update withRuntime(String runtime);

            /**
             * Specifies the runtime version for the function app.
             *
             * @param version the version of the Azure Functions runtime
             * @return the next stage of the function app update
             */
            Update withRuntimeVersion(String version);

            /**
             * Uses the latest runtime version for the function app.
             *
             * @return the next stage of the function app update
             */
            Update withLatestRuntimeVersion();
        }

        /**
         * A function app definition allowing storage account to be specified. A storage account is required for storing
         * function execution runtime, triggers, and logs.
         */
        interface WithStorageAccount {
            /**
             * Creates a new storage account to use for the function app.
             *
             * @param name the name of the storage account
             * @param sku the sku of the storage account
             * @return the next stage of the function app update
             */
            Update withNewStorageAccount(String name, StorageAccountSkuType sku);

            /**
             * Specifies the storage account to use for the function app.
             *
             * @param storageAccount the storage account to use
             * @return the next stage of the function app update
             */
            Update withExistingStorageAccount(StorageAccount storageAccount);
        }

        /** A function app definition allowing daily usage quota to be specified. */
        interface WithDailyUsageQuota {
            /**
             * Specifies the daily usage data cap.
             *
             * @param quota the daily usage quota
             * @return the next stage of the function app update
             */
            Update withDailyUsageQuota(int quota);

            /**
             * Specifies the daily usage data cap.
             *
             * @return the next stage of the function app update
             */
            Update withoutDailyUsageQuota();
        }

        /** A function app update allowing docker image source to be specified. */
        interface WithDockerContainerImage {
            /**
             * Specifies the docker container image to be a built in one.
             *
             * @param runtimeStack the runtime stack installed on the image
             * @return the next stage of the web app update
             */
            Update withBuiltInImage(FunctionRuntimeStack runtimeStack);

            /**
             * Specifies the docker container image to be one from Docker Hub.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @return the next stage of the web app update
             */
            Update withPublicDockerHubImage(String imageAndTag);

            /**
             * Specifies the docker container image to be one from Docker Hub.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @return the next stage of the web app update
             */
            WithCredentials withPrivateDockerHubImage(String imageAndTag);

            /**
             * Specifies the docker container image to be one from a private registry.
             *
             * @param imageAndTag image and optional tag (eg 'image:tag')
             * @param serverUrl the URL to the private registry server
             * @return the next stage of the web app update
             */
            WithCredentials withPrivateRegistryImage(String imageAndTag, String serverUrl);
        }

        /** A function app update allowing docker hub credentials to be set. */
        interface WithCredentials {
            /**
             * Specifies the username and password for Docker Hub.
             *
             * @param username the username for Docker Hub
             * @param password the password for Docker Hub
             * @return the next stage of the web app update
             */
            Update withCredentials(String username, String password);
        }
    }

    /** The template for a function app update operation, containing all the settings that can be modified. */
    interface Update
        extends WebAppBase.Update<FunctionApp>,
            UpdateStages.WithAppServicePlan,
            UpdateStages.WithRuntimeVersion,
            UpdateStages.WithStorageAccount,
            UpdateStages.WithDailyUsageQuota,
            UpdateStages.WithDockerContainerImage,
            UpdateStages.WithCredentials {
    }
}


text:
#pragma once

#include <pcl/features/feature.h>

namespace pcl
{
  /** \brief CRHEstimation estimates the Camera Roll Histogram (CRH) descriptor for a given
   * point cloud dataset containing XYZ data and normals, as presented in:
   *   - CAD-Model Recognition and 6 DOF Pose Estimation
   *     A. Aldoma, N. Blodow, D. Gossow, S. Gedikli, R.B. Rusu, M. Vincze and G. Bradski
   *     ICCV 2011, 3D Representation and Recognition (3dRR11) workshop
   *     Barcelona, Spain, (2011)
   *
   * The suggested PointOutT is pcl::Histogram<90>. //dc (real) + 44 complex numbers (real, imaginary) + nyquist (real)
   *
   * \author Aitor Aldoma
   * \ingroup features
   */
  template<typename PointInT, typename PointNT, typename PointOutT = pcl::Histogram<90> >
  class CRHEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
  {
    public:
      using Ptr = boost::shared_ptr<CRHEstimation<PointInT, PointNT, PointOutT> >;
      using ConstPtr = boost::shared_ptr<const CRHEstimation<PointInT, PointNT, PointOutT> >;

      using Feature<PointInT, PointOutT>::feature_name_;
      using Feature<PointInT, PointOutT>::getClassName;
      using Feature<PointInT, PointOutT>::indices_;
      using Feature<PointInT, PointOutT>::k_;
      using Feature<PointInT, PointOutT>::search_radius_;
      using Feature<PointInT, PointOutT>::surface_;
      using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;

      using PointCloudOut = typename Feature<PointInT, PointOutT>::PointCloudOut;

      /** \brief Constructor. */
      CRHEstimation () :
        vpx_ (0), vpy_ (0), vpz_ (0), nbins_ (90)
      {
        k_ = 1;
        feature_name_ = "CRHEstimation";
      }
      ;

      /** \brief Set the viewpoint.
       * \param[in] vpx the X coordinate of the viewpoint
       * \param[in] vpy the Y coordinate of the viewpoint
       * \param[in] vpz the Z coordinate of the viewpoint
       */
      inline void
      setViewPoint (float vpx, float vpy, float vpz)
      {
        vpx_ = vpx;
        vpy_ = vpy;
        vpz_ = vpz;
      }

      /** \brief Get the viewpoint.
       * \param[out] vpx the X coordinate of the viewpoint
       * \param[out] vpy the Y coordinate of the viewpoint
       * \param[out] vpz the Z coordinate of the viewpoint
       */
      inline void
      getViewPoint (float &vpx, float &vpy, float &vpz)
      {
        vpx = vpx_;
        vpy = vpy_;
        vpz = vpz_;
      }

      inline void
      setCentroid (Eigen::Vector4f & centroid)
      {
        centroid_ = centroid;
      }

    private:
      /** \brief Values describing the viewpoint ("pinhole" camera model assumed).
       * By default, the viewpoint is set to 0,0,0.
       */
      float vpx_, vpy_, vpz_;

      /** \brief Number of bins, this should match the Output type */
      int nbins_;

      /** \brief Centroid to be used */
      Eigen::Vector4f centroid_;

      /** \brief Estimate the CRH histogram at
       * a set of points given by <setInputCloud (), setIndices ()> using the surface in
       * setSearchSurface ()
       *
       * \param[out] output the resultant point cloud with a CRH histogram
       */
      void
      computeFeature (PointCloudOut &output) override;
  };
}

#ifdef PCL_NO_PRECOMPILE
#include <pcl/features/impl/crh.hpp>
#endif


text:
package org.springframework.boot.autoconfigure.batch;

import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.configuration.annotation.BatchConfigurer;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;

/**
 * Basic {@link BatchConfigurer} implementation.
 *
 * @author Dave Syer
 * @author Andy Wilkinson
 */
@Component
public class BasicBatchConfigurer implements BatchConfigurer {

	private static Log logger = LogFactory.getLog(BasicBatchConfigurer.class);

	private final DataSource dataSource;

	private final EntityManagerFactory entityManagerFactory;

	private PlatformTransactionManager transactionManager;

	private JobRepository jobRepository;

	private JobLauncher jobLauncher;

	private JobExplorer jobExplorer;

	/**
	 * Create a new {@link BasicBatchConfigurer} instance.
	 * @param dataSource the underlying data source
	 */
	public BasicBatchConfigurer(DataSource dataSource) {
		this(dataSource, null);
	}

	/**
	 * Create a new {@link BasicBatchConfigurer} instance.
	 * @param dataSource the underlying data source
	 * @param entityManagerFactory the entity manager factory (or {@code null})
	 */
	public BasicBatchConfigurer(DataSource dataSource,
			EntityManagerFactory entityManagerFactory) {
		this.entityManagerFactory = entityManagerFactory;
		this.dataSource = dataSource;
	}

	@Override
	public JobRepository getJobRepository() {
		return this.jobRepository;
	}

	@Override
	public PlatformTransactionManager getTransactionManager() {
		return this.transactionManager;
	}

	@Override
	public JobLauncher getJobLauncher() {
		return this.jobLauncher;
	}

	@Override
	public JobExplorer getJobExplorer() throws Exception {
		return this.jobExplorer;
	}

	@PostConstruct
	public void initialize() {
		try {
			this.transactionManager = createTransactionManager();
			this.jobRepository = createJobRepository();
			this.jobLauncher = createJobLauncher();
			this.jobExplorer = createJobExplorer();
		}
		catch (Exception ex) {
			throw new IllegalStateException("Unable to initialize Spring Batch", ex);
		}
	}

	private JobExplorer createJobExplorer() throws Exception {
		JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
		jobExplorerFactoryBean.setDataSource(this.dataSource);
		jobExplorerFactoryBean.afterPropertiesSet();
		return jobExplorerFactoryBean.getObject();
	}

	private JobLauncher createJobLauncher() throws Exception {
		SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
		jobLauncher.setJobRepository(getJobRepository());
		jobLauncher.afterPropertiesSet();
		return jobLauncher;
	}

	protected JobRepository createJobRepository() throws Exception {
		JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
		factory.setDataSource(this.dataSource);
		if (this.entityManagerFactory != null) {
			logger.warn("JPA does not support custom isolation levels, so locks may not be taken when launching Jobs");
			factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
		}
		factory.setTransactionManager(getTransactionManager());
		factory.afterPropertiesSet();
		return factory.getObject();
	}

	protected PlatformTransactionManager createTransactionManager() {
		if (this.entityManagerFactory != null) {
			return new JpaTransactionManager(this.entityManagerFactory);
		}
		return new DataSourceTransactionManager(this.dataSource);
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  example4_slony.xml
  DBSteward maven plugin example slony node and replica set definition
-->
<dbsteward>
  <database>
    <role>
      <application>someapp</application>
      <owner>someapp_dba</owner>
      <replication>someapp_slony</replication>
      <readonly>someapp_readonly</readonly>
    </role>
    <slony clusterName="someapp">
      <!-- these slony nodes are local db replicas for continuous integration testing: -->
      <slonyNode id="101" comment="someapp primary db"      dbName="someapp"   dbHost="localhost" dbUser="someapp_slony" dbPassword="drowssapynols1" />
      <slonyNode id="102" comment="someapp local replica B" dbName="someapp_b" dbHost="localhost" dbUser="someapp_slony" dbPassword="drowssapynols1" />
      <slonyNode id="103" comment="someapp local replica C" dbName="someapp_c" dbHost="localhost" dbUser="someapp_slony" dbPassword="drowssapynols1" />
      <!-- remote nodes might look like this:
      <slonyNode id="101" comment="someapp primary db"        dbName="someapp" dbHost="someapp-db.prod"   dbUser="someapp_slony" dbPassword="drowssapynols1" />
      <slonyNode id="102" comment="someapp local replica db"  dbName="someapp" dbHost="someapp-db.backup" dbUser="someapp_slony" dbPassword="drowssapynols1" />
      <slonyNode id="103" comment="someapp remote replica db" dbName="someapp" dbHost="someapp-db.remote" dbUser="someapp_slony" dbPassword="drowssapynols1" />
      -->
      <slonyReplicaSet id="500" originNodeId="101" upgradeSetId="501" comment="user account replication">
        <slonyReplicaSetNode id="102" providerNodeId="101" />
        <slonyReplicaSetNode id="103" providerNodeId="102" />
      </slonyReplicaSet>
      <slonyReplicaSet id="600" originNodeId="101" upgradeSetId="601" comment="search results synchronization">
        <slonyReplicaSetNode id="102" providerNodeId="101" />
        <slonyReplicaSetNode id="103" providerNodeId="102" />
      </slonyReplicaSet>
    </slony>
  </database>
</dbsteward>


text:
#ifndef EasyAACEncoder_API_H
#define	EasyAACEncoder_API_H

#ifdef _WIN32
#define Easy_API  __declspec(dllexport)
#define Easy_APICALL  __stdcall
#else
#define Easy_API
#define Easy_APICALL
#endif

#define Easy_Handle void*

///* Audio Codec */
enum Law
{
	Law_ULaw	=	0, 		/**< U law */
	Law_ALaw	=	1, 		/**< A law */
	Law_PCM16	=	2, 		/**< 16 bit uniform PCM values. original pcm data */
	Law_G726	=	3		/**< G726 */
};

///* Rate Bits */
enum Rate
{
	Rate16kBits=2,	/**< 16k bits per second (2 bits per ADPCM sample) */
	Rate24kBits=3,	/**< 24k bits per second (3 bits per ADPCM sample) */
	Rate32kBits=4,	/**< 32k bits per second (4 bits per ADPCM sample) */
	Rate40kBits=5	/**< 40k bits per second (5 bits per ADPCM sample) */
};

typedef struct _g711param
{
	;
}G711Param;

typedef struct _g726param
{
	unsigned char ucRateBits;//Rate16kBits Rate24kBits Rate32kBits Rate40kBits
}G726Param;

typedef struct _initParam
{
	unsigned char	ucAudioCodec;			// Law_uLaw  Law_ALaw Law_PCM16 Law_G726
	unsigned char	ucAudioChannel;			//1
	unsigned int	u32AudioSamplerate;		//8000
	unsigned int	u32PCMBitSize;			//16
	union
	{
		G711Param g711param;
		G726Param g726param;
	};

}InitParam;

#ifdef __cplusplus
extern "C"
{
#endif
	/* Create AAC Encoder Handle */
	Easy_API Easy_Handle Easy_APICALL Easy_AACEncoder_Init(InitParam initPar);

	/* Input original data, output the encoede AAC data */
	Easy_API int Easy_APICALL Easy_AACEncoder_Encode(Easy_Handle handle, unsigned char* inbuf, unsigned int inlen, unsigned char* outbuf, unsigned int* outlen);

	/* Close Encoder Handle */
	Easy_API void Easy_APICALL Easy_AACEncoder_Release(Easy_Handle handle);

#ifdef __cplusplus
}
#endif

#endif	/* EasyAACEncoder_API_H */


text:
using std::string;

namespace net {

std::ostream& operator<<(std::ostream& os,
                         const QuicPaddingFrame& padding_frame) {
  os << "{ num_padding_bytes: " << padding_frame.num_padding_bytes << " }\n";
  return os;
}

}  // namespace net


text:
package nnwakutory.controller.waku;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import nnwakutory.controller.BaseController;

public class WakuConfiguration extends BaseController implements Initializable {
	@FXML
	private VBox tagListVBox;
	@FXML
	private ScrollPane tagListBoxScrollPane;

	public WakuConfiguration() {
		super(WakuConfiguration.class);
	}

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		try {
			TagsRowTemplate row = new TagsRowTemplate(1);
			tagListVBox.getChildren().add(0, row);
		} catch (IOException e) {
			outputException(e);
		}
	}

	@FXML
	private void onAddTagClicked() {
		if (tagListVBox.getChildren().size() < 10) {
			try {
				// 1行追加
				TagsRowTemplate row = new TagsRowTemplate(tagListVBox.getChildren().size() + 1);
				tagListVBox.getChildren().add(row);

				// 一番下へスクロールする
				tagListBoxScrollPane.setVvalue(tagListBoxScrollPane.getVmax());
			} catch (Exception e) {
				outputException(e);
			}
		}
	}
}


text:
package org.projectfloodlight.openflow.protocol;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.jboss.netty.buffer.ChannelBuffer;

public interface OFAsyncConfigPropPacketInSlave extends OFObject, OFAsyncConfigProp {
    int getType();
    long getMask();
    OFVersion getVersion();

    void writeTo(ChannelBuffer channelBuffer);

    Builder createBuilder();
    public interface Builder extends OFAsyncConfigProp.Builder {
        OFAsyncConfigPropPacketInSlave build();
        int getType();
        long getMask();
        Builder setMask(long mask);
        OFVersion getVersion();
    }
}


text:
import { isDict, isStream } from './primitives';
import { DecodeStream } from './stream';
import { Jbig2Image } from './jbig2';
import { shadow } from '../shared/util';

/**
 * For JBIG2's we use a library to decode these images and
 * the stream behaves like all the other DecodeStreams.
 */
let Jbig2Stream = (function Jbig2StreamClosure() {
  function Jbig2Stream(stream, maybeLength, dict, params) {
    this.stream = stream;
    this.maybeLength = maybeLength;
    this.dict = dict;
    this.params = params;

    DecodeStream.call(this, maybeLength);
  }

  Jbig2Stream.prototype = Object.create(DecodeStream.prototype);

  Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
    get() {
      // If `this.maybeLength` is null, we'll get the entire stream.
      return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
    },
    configurable: true,
  });

  Jbig2Stream.prototype.ensureBuffer = function(requested) {
    // No-op, since `this.readBlock` will always parse the entire image and
    // directly insert all of its data into `this.buffer`.
  };

  Jbig2Stream.prototype.readBlock = function() {
    if (this.eof) {
      return;
    }
    let jbig2Image = new Jbig2Image();

    let chunks = [];
    if (isDict(this.params)) {
      let globalsStream = this.params.get('JBIG2Globals');
      if (isStream(globalsStream)) {
        let globals = globalsStream.getBytes();
        chunks.push({ data: globals, start: 0, end: globals.length, });
      }
    }
    chunks.push({ data: this.bytes, start: 0, end: this.bytes.length, });
    let data = jbig2Image.parseChunks(chunks);
    let dataLength = data.length;

    // JBIG2 had black as 1 and white as 0, inverting the colors
    for (let i = 0; i < dataLength; i++) {
      data[i] ^= 0xFF;
    }
    this.buffer = data;
    this.bufferLength = dataLength;
    this.eof = true;
  };

  return Jbig2Stream;
})();

export {
  Jbig2Stream,
};


text:
- A single definition of an API (Swagger spec)
- Generates all the boilerplate you need
	- Clients and servers in many languages
- Documentation generation from comments in Swagger spec
- Auto-generation of an API explorer


text:
package buffer

import (
	"sync"

	"github.com/influxdata/telegraf"
	"github.com/influxdata/telegraf/selfstat"
)

var (
	MetricsWritten = selfstat.Register("agent", "metrics_written", map[string]string{})
	MetricsDropped = selfstat.Register("agent", "metrics_dropped", map[string]string{})
)

// Buffer is an object for storing metrics in a circular buffer.
type Buffer struct {
	sync.Mutex
	buf   []telegraf.Metric
	first int
	last  int
	size  int
	empty bool
}

// NewBuffer returns a Buffer
//   size is the maximum number of metrics that Buffer will cache. If Add is
//   called when the buffer is full, then the oldest metric(s) will be dropped.
func NewBuffer(size int) *Buffer {
	return &Buffer{
		buf:   make([]telegraf.Metric, size),
		first: 0,
		last:  0,
		size:  size,
		empty: true,
	}
}

// IsEmpty returns true if Buffer is empty.
func (b *Buffer) IsEmpty() bool {
	return b.empty
}

// Len returns the current length of the buffer.
func (b *Buffer) Len() int {
	if b.empty {
		return 0
	} else if b.first <= b.last {
		return b.last - b.first + 1
	}
	// Spans the end of array.
	// size - gap in the middle
	return b.size - (b.first - b.last - 1) // size - gap
}

func (b *Buffer) push(m telegraf.Metric) {
	// Empty
	if b.empty {
		b.last = b.first // Reset
		b.buf[b.last] = m
		b.empty = false
		return
	}

	b.last++
	b.last %= b.size

	// Full
	if b.first == b.last {
		MetricsDropped.Incr(1)
		b.first = (b.first + 1) % b.size
	}
	b.buf[b.last] = m
}

// Add adds metrics to the buffer.
func (b *Buffer) Add(metrics ...telegraf.Metric) {
	b.Lock()
	defer b.Unlock()
	for i := range metrics {
		MetricsWritten.Incr(1)
		b.push(metrics[i])
	}
}

// Batch returns a batch of metrics of size batchSize.
// the batch will be of maximum length batchSize. It can be less than batchSize,
// if the length of Buffer is less than batchSize.
func (b *Buffer) Batch(batchSize int) []telegraf.Metric {
	b.Lock()
	defer b.Unlock()
	outLen := min(b.Len(), batchSize)
	out := make([]telegraf.Metric, outLen)
	if outLen == 0 {
		return out
	}

	// We copy everything right of first up to last, count or end
	// b.last >= rightInd || b.last < b.first
	// therefore wont copy past b.last
	rightInd := min(b.size, b.first+outLen) - 1

	copyCount := copy(out, b.buf[b.first:rightInd+1])

	// We've emptied the ring
	if rightInd == b.last {
		b.empty = true
	}
	b.first = rightInd + 1
	b.first %= b.size

	// We circle back for the rest
	if copyCount < outLen {
		right := min(b.last, outLen-copyCount)
		copy(out[copyCount:], b.buf[b.first:right+1])
		// We've emptied the ring
		if right == b.last {
			b.empty = true
		}
		b.first = right + 1
		b.first %= b.size
	}
	return out
}

func min(a, b int) int {
	if b < a {
		return b
	}
	return a
}


text:
require "spec_helper"

describe "`unattended-upgrades` setup" do
  describe package("unattended-upgrades") do
    it { should be_installed }
  end

  describe package("mailutils") do
    it { should be_installed }
  end

  describe file("/etc/apt/apt.conf.d/50unattended-upgrades") do
    it { should be_a_file }
    it { should be_mode 644 }
    it { should be_owned_by "root" }
    it { should be_grouped_into "root" }
    it { should contain %(Mail "root@localhost";) }
    it { should contain %(Remove-Unused-Dependencies "false";) }
    it { should contain %(Automatic-Reboot "false";) }
  end

  describe file("/etc/apt/apt.conf.d/20auto-upgrades") do
    it { should be_a_file }
    it { should be_mode 644 }
    it { should be_owned_by "root" }
    it { should be_grouped_into "root" }
    it { should contain %(APT::Periodic::Update-Package-Lists "1";) }
    it { should contain %(APT::Periodic::Unattended-Upgrade "1";) }
  end
end


text:
package vfs

import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path"
	"strings"
	"sync"

	"k8s.io/kops/upup/pkg/fi/cloudup/terraformWriter"
)

type MemFSPath struct {
	context  *MemFSContext
	location string

	mutex    sync.Mutex
	contents []byte
	children map[string]*MemFSPath
}

var _ Path = &MemFSPath{}
var _ TerraformPath = &MemFSPath{}

type MemFSContext struct {
	clusterReadable bool
	root            *MemFSPath
}

func NewMemFSContext() *MemFSContext {
	c := &MemFSContext{}
	c.root = &MemFSPath{
		context:  c,
		location: "",
	}
	return c
}

// MarkClusterReadable pretends the current memfscontext is cluster readable; this is useful for tests
func (c *MemFSContext) MarkClusterReadable() {
	c.clusterReadable = true
}

func (c *MemFSPath) HasChildren() bool {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	return len(c.children) != 0
}

func (c *MemFSPath) IsClusterReadable() bool {
	return c.context.clusterReadable
}

var _ HasClusterReadable = &MemFSPath{}

func NewMemFSPath(context *MemFSContext, location string) *MemFSPath {
	return context.root.Join(location).(*MemFSPath)
}

func (p *MemFSPath) Join(relativePath ...string) Path {
	p.mutex.Lock()
	defer p.mutex.Unlock()

	joined := path.Join(relativePath...)
	tokens := strings.Split(joined, "/")
	current := p
	for _, token := range tokens {
		if current.children == nil {
			current.children = make(map[string]*MemFSPath)
		}
		child := current.children[token]
		if child == nil {
			child = &MemFSPath{
				context:  p.context,
				location: path.Join(current.location, token),
			}
			current.children[token] = child
		}
		current = child
		current.mutex.Lock()
		defer current.mutex.Unlock()
	}
	return current
}

func (p *MemFSPath) WriteFile(r io.ReadSeeker, acl ACL) error {
	data, err := ioutil.ReadAll(r)
	if err != nil {
		return fmt.Errorf("error reading data: %v", err)
	}
	p.contents = data
	return nil
}

func (p *MemFSPath) CreateFile(data io.ReadSeeker, acl ACL) error {
	// Check if exists
	if p.contents != nil {
		return os.ErrExist
	}

	return p.WriteFile(data, acl)
}

// ReadFile implements Path::ReadFile
func (p *MemFSPath) ReadFile() ([]byte, error) {
	if p.contents == nil {
		return nil, os.ErrNotExist
	}
	// TODO: Copy?
	return p.contents, nil
}

// WriteTo implements io.WriterTo
func (p *MemFSPath) WriteTo(out io.Writer) (int64, error) {
	if p.contents == nil {
		return 0, os.ErrNotExist
	}
	n, err := out.Write(p.contents)
	return int64(n), err
}

func (p *MemFSPath) ReadDir() ([]Path, error) {
	p.mutex.Lock()
	defer p.mutex.Unlock()

	var paths []Path
	for _, f := range p.children {
		paths = append(paths, f)
	}
	return paths, nil
}

func (p *MemFSPath) ReadTree() ([]Path, error) {
	var paths []Path
	p.readTree(&paths)
	return paths, nil
}

func (p *MemFSPath) readTree(dest *[]Path) {
	p.mutex.Lock()
	defer p.mutex.Unlock()

	for _, f := range p.children {
		if !f.HasChildren() {
			*dest = append(*dest, f)
		}
		f.readTree(dest)
	}
}

func (p *MemFSPath) Base() string {
	return path.Base(p.location)
}

func (p *MemFSPath) Path() string {
	return "memfs://" + p.location
}

func (p *MemFSPath) String() string {
	return p.Path()
}

func (p *MemFSPath) Remove() error {
	p.contents = nil
	return nil
}

func (p *MemFSPath) RemoveAllVersions() error {
	return p.Remove()
}

func (p *MemFSPath) Location() string {
	return p.location
}

// Terraform support for integration tests.

func (p *MemFSPath) TerraformProvider() (*TerraformProvider, error) {
	return &TerraformProvider{
		Name: "aws",
		Arguments: map[string]string{
			"region": "us-test-1",
		},
	}, nil
}

type terraformMemFSFile struct {
	Bucket   string                   `json:"bucket" cty:"bucket"`
	Key      string                   `json:"key" cty:"key"`
	Content  *terraformWriter.Literal `json:"content,omitempty" cty:"content"`
	Acl      *string                  `json:"acl,omitempty" cty:"acl"`
	SSE      string                   `json:"server_side_encryption,omitempty" cty:"server_side_encryption"`
	Provider *terraformWriter.Literal `json:"provider,omitempty" cty:"provider"`
}

func (p *MemFSPath) RenderTerraform(w *terraformWriter.TerraformWriter, name string, data io.Reader, acl ACL) error {
	bytes, err := ioutil.ReadAll(data)
	if err != nil {
		return fmt.Errorf("reading data: %v", err)
	}

	content, err := w.AddFileBytes("aws_s3_bucket_object", name, "content", bytes, false)
	if err != nil {
		return fmt.Errorf("rendering S3 file: %v", err)
	}

	var requestAcl *string
	if acl != nil {
		s3Acl, ok := acl.(*S3Acl)
		if !ok {
			return fmt.Errorf("write to %s with ACL of unexpected type %T", p, acl)
		}
		requestAcl = s3Acl.RequestACL
	}

	tf := &terraformMemFSFile{
		Bucket:   "testingBucket",
		Key:      p.location,
		Content:  content,
		SSE:      "AES256",
		Acl:      requestAcl,
		Provider: terraformWriter.LiteralTokens("aws", "files"),
	}
	return w.RenderResource("aws_s3_bucket_object", name, tf)
}


text:
<?php
/**
 * 消息中心之消息推送数据访问层
 *
 * the last known user to change this file in the repository  <$LastChangedBy: guoshaobo $>
 * @author Su qian <suqian@pipi.cn>
 * @version $Id: MessageRelationModel.php 14036 2013-08-21 01:37:01Z guoshaobo $
 * @package model
 * @subpackage message
 */
class MessagePushModel extends PipiActiveRecord {

	public function tableName(){
		return '{{message_push}}';
	}

	/**
	 * @param unknown_type $className
	 * @return MessagePushModel
	 */
	public static function model($className = __CLASS__){
		return parent::model($className);
	}

	public function getDbConnection(){
		return Yii::app()->db_user;
	}

	public function delPushByIds(array $pushIds){
		if(empty($pushIds)){
			return array();
		}
		$criteria = $this->getDbCriteria();
		$criteria->addInCondition('push_id',$pushIds);
		return $this->deleteAll($criteria);
	}

	public function searchPush(Array $condition = array(),$offset = 0,$pageSize=20,$isLimit=true){
		$result = array();
		$criteria = $this->getDbCriteria();
		$criteria->order = 'push_id DESC';

		if (!empty($condition['target_id'])){
			$criteria->compare('target_id', $condition['target_id']);
		}

		if (isset($condition['type']) && is_numeric($condition['type'])){
			$criteria->compare('type', $condition['type']);
		}

		if (isset($condition['rank']) && is_numeric($condition['rank'])){
			$criteria->compare('rank', $condition['rank']);
		}

		if (isset($condition['is_send']) && is_numeric($condition['is_send'])){
			$criteria->compare('is_send', $condition['is_send']);
		}

		if (!empty($condition['create_time_on'])){
			$criteria->addCondition('create_time>='.strtotime($condition['create_time_on']));
		}

		if (!empty($condition['create_time_end'])){
			$criteria->addCondition('create_time<='.strtotime($condition['create_time_end']));
		}

		if (!empty($condition['send_time_on'])){
			$criteria->addCondition('send_time>='.strtotime($condition['send_time_on']));
		}

		if (!empty($condition['send_time_end'])){
			$criteria->addCondition('send_time<='.strtotime($condition['send_time_end']));
		}

		if (!empty($condition['receive_uid'])){
			$criteria->compare('receive_uid', $condition['receive_uid']);
		}

		$result['count'] = $this->count($criteria);
		if ($isLimit){
			$criteria->offset = $offset;
			$criteria->limit = $pageSize;
		}
		$result['list'] = $this->findAll($criteria);
		return $result;
	}
}


text:
namespace blink {

typedef CanvasAsyncBlobCreator::IdleTaskStatus IdleTaskStatus;

class MockCanvasAsyncBlobCreator : public CanvasAsyncBlobCreator {
public:
    MockCanvasAsyncBlobCreator(DOMUint8ClampedArray* data, const IntSize& size, MimeType mimeType)
        : CanvasAsyncBlobCreator(data, mimeType, size, nullptr)
    {
    }

    CanvasAsyncBlobCreator::IdleTaskStatus idleTaskStatus()
    {
        return m_idleTaskStatus;
    }

    MOCK_METHOD0(signalTaskSwitchInStartTimeoutEventForTesting, void());
    MOCK_METHOD0(signalTaskSwitchInCompleteTimeoutEventForTesting, void());

protected:
    void createBlobAndInvokeCallback() override { };
    void createNullAndInvokeCallback() override { };
    void signalAlternativeCodePathFinishedForTesting() override;
    void postDelayedTaskToMainThread(const WebTraceLocation&, std::unique_ptr<SameThreadClosure>, double delayMs) override;
};

void MockCanvasAsyncBlobCreator::signalAlternativeCodePathFinishedForTesting()
{
    testing::exitRunLoop();
}

void MockCanvasAsyncBlobCreator::postDelayedTaskToMainThread(const WebTraceLocation& location, std::unique_ptr<SameThreadClosure> task, double delayMs)
{
    DCHECK(isMainThread());
    Platform::current()->mainThread()->getWebTaskRunner()->postTask(location, std::move(task));
}

//==============================================================================
//=================================PNG==========================================
//==============================================================================

class MockCanvasAsyncBlobCreatorWithoutStartPng : public MockCanvasAsyncBlobCreator {
public:
    MockCanvasAsyncBlobCreatorWithoutStartPng(DOMUint8ClampedArray* data, const IntSize& size)
        : MockCanvasAsyncBlobCreator(data, size, MimeTypePng)
    {
    }

protected:
    void scheduleInitiatePngEncoding() override
    {
        // Deliberately make scheduleInitiatePngEncoding do nothing so that idle task never starts
    }
};

//==============================================================================

class MockCanvasAsyncBlobCreatorWithoutCompletePng : public MockCanvasAsyncBlobCreator {
public:
    MockCanvasAsyncBlobCreatorWithoutCompletePng(DOMUint8ClampedArray* data, const IntSize& size)
        : MockCanvasAsyncBlobCreator(data, size, MimeTypePng)
    {
    }

protected:
    void scheduleInitiatePngEncoding() override
    {
        Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE,
        bind(&MockCanvasAsyncBlobCreatorWithoutCompletePng::initiatePngEncoding, this, std::numeric_limits<double>::max()));
    }

    void idleEncodeRowsPng(double deadlineSeconds) override
    {
        // Deliberately make idleEncodeRowsPng do nothing so that idle task never completes
    }
};

//==============================================================================
//=================================JPEG=========================================
//==============================================================================

class MockCanvasAsyncBlobCreatorWithoutStartJpeg : public MockCanvasAsyncBlobCreator {
public:
    MockCanvasAsyncBlobCreatorWithoutStartJpeg(DOMUint8ClampedArray* data, const IntSize& size)
        : MockCanvasAsyncBlobCreator(data, size, MimeTypeJpeg)
    {
    }

protected:
    void scheduleInitiateJpegEncoding(const double&) override
    {
        // Deliberately make scheduleInitiateJpegEncoding do nothing so that idle task never starts
    }
};

//==============================================================================

class MockCanvasAsyncBlobCreatorWithoutCompleteJpeg : public MockCanvasAsyncBlobCreator {
public:
    MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(DOMUint8ClampedArray* data, const IntSize& size)
        : MockCanvasAsyncBlobCreator(data, size, MimeTypeJpeg)
    {
    }

protected:
    void scheduleInitiateJpegEncoding(const double& quality) override
    {
        Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE,
        bind(&MockCanvasAsyncBlobCreatorWithoutCompleteJpeg::initiateJpegEncoding, this, quality, std::numeric_limits<double>::max()));
    }

    void idleEncodeRowsJpeg(double deadlineSeconds) override
    {
        // Deliberately make idleEncodeRowsJpeg do nothing so that idle task never completes
    }
};

//==============================================================================

class CanvasAsyncBlobCreatorTest : public ::testing::Test {
public:
    // Png unit tests
    void prepareMockCanvasAsyncBlobCreatorWithoutStartPng();
    void prepareMockCanvasAsyncBlobCreatorWithoutCompletePng();
    void prepareMockCanvasAsyncBlobCreatorFailPng();

    // Jpeg unit tests
    void prepareMockCanvasAsyncBlobCreatorWithoutStartJpeg();
    void prepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg();
    void prepareMockCanvasAsyncBlobCreatorFailJpeg();

protected:
    CanvasAsyncBlobCreatorTest();
    MockCanvasAsyncBlobCreator* asyncBlobCreator() { return m_asyncBlobCreator.get(); }
    void TearDown() override;

private:
    Persistent<MockCanvasAsyncBlobCreator> m_asyncBlobCreator;
};

CanvasAsyncBlobCreatorTest::CanvasAsyncBlobCreatorTest()
{
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorWithoutStartPng()
{
    IntSize testSize(20, 20);
    ImageData* imageData = ImageData::create(testSize);

    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutStartPng(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorWithoutCompletePng()
{
    IntSize testSize(20, 20);
    ImageData* imageData = ImageData::create(testSize);

    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompletePng(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailPng()
{
    IntSize testSize(0, 0);
    ImageData* imageData = ImageData::create(testSize);

    // We reuse the class MockCanvasAsyncBlobCreatorWithoutCompletePng because this
    // test case is expected to fail at initialization step before completion.
    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompletePng(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorWithoutStartJpeg()
{
    IntSize testSize(20, 20);
    ImageData* imageData = ImageData::create(testSize);

    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutStartJpeg(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg()
{
    IntSize testSize(20, 20);
    ImageData* imageData = ImageData::create(testSize);

    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::prepareMockCanvasAsyncBlobCreatorFailJpeg()
{
    IntSize testSize(0, 0);
    ImageData* imageData = ImageData::create(testSize);

    // We reuse the class MockCanvasAsyncBlobCreatorWithoutCompleteJpeg because this
    // test case is expected to fail at initialization step before completion.
    m_asyncBlobCreator = new MockCanvasAsyncBlobCreatorWithoutCompleteJpeg(imageData->data(), testSize);
}

void CanvasAsyncBlobCreatorTest::TearDown()
{
    m_asyncBlobCreator = nullptr;
}

//==============================================================================

TEST_F(CanvasAsyncBlobCreatorTest, PngIdleTaskNotStartedWhenStartTimeoutEventHappens)
{
    // This test mocks the scenario when idle task is not started when the
    // StartTimeoutEvent is inspecting the idle task status.
    // The whole image encoding process (including initialization)  will then
    // become carried out in the alternative code path instead.
    this->prepareMockCanvasAsyncBlobCreatorWithoutStartPng();
    EXPECT_CALL(*(asyncBlobCreator()), signalTaskSwitchInStartTimeoutEventForTesting());

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true);
    testing::enterRunLoop();

    ::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
    EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask, this->asyncBlobCreator()->idleTaskStatus());
}

TEST_F(CanvasAsyncBlobCreatorTest, PngIdleTaskNotCompletedWhenCompleteTimeoutEventHappens)
{
    // This test mocks the scenario when idle task is not completed when the
    // CompleteTimeoutEvent is inspecting the idle task status.
    // The remaining image encoding process (excluding initialization)  will
    // then become carried out in the alternative code path instead.
    this->prepareMockCanvasAsyncBlobCreatorWithoutCompletePng();
    EXPECT_CALL(*(asyncBlobCreator()), signalTaskSwitchInCompleteTimeoutEventForTesting());

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true);
    testing::enterRunLoop();

    ::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
    EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask, this->asyncBlobCreator()->idleTaskStatus());
}

TEST_F(CanvasAsyncBlobCreatorTest, PngIdleTaskFailedWhenStartTimeoutEventHappens)
{
    // This test mocks the scenario when idle task is not failed during when
    // either the StartTimeoutEvent or the CompleteTimeoutEvent is inspecting
    // the idle task status.
    this->prepareMockCanvasAsyncBlobCreatorFailPng();

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true);
    testing::enterRunLoop();

    EXPECT_EQ(IdleTaskStatus::IdleTaskFailed, this->asyncBlobCreator()->idleTaskStatus());
}

// The below 3 unit tests have exactly same workflow as the above 3 unit tests
// except that they are encoding on JPEG image formats instead of PNG.
TEST_F(CanvasAsyncBlobCreatorTest, JpegIdleTaskNotStartedWhenStartTimeoutEventHappens)
{
    this->prepareMockCanvasAsyncBlobCreatorWithoutStartJpeg();
    EXPECT_CALL(*(asyncBlobCreator()), signalTaskSwitchInStartTimeoutEventForTesting());

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
    testing::enterRunLoop();

    ::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
    EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask, this->asyncBlobCreator()->idleTaskStatus());
}

TEST_F(CanvasAsyncBlobCreatorTest, JpegIdleTaskNotCompletedWhenCompleteTimeoutEventHappens)
{
    this->prepareMockCanvasAsyncBlobCreatorWithoutCompleteJpeg();
    EXPECT_CALL(*(asyncBlobCreator()), signalTaskSwitchInCompleteTimeoutEventForTesting());

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
    testing::enterRunLoop();

    ::testing::Mock::VerifyAndClearExpectations(asyncBlobCreator());
    EXPECT_EQ(IdleTaskStatus::IdleTaskSwitchedToMainThreadTask, this->asyncBlobCreator()->idleTaskStatus());
}

TEST_F(CanvasAsyncBlobCreatorTest, JpegIdleTaskFailedWhenStartTimeoutEventHappens)
{
    this->prepareMockCanvasAsyncBlobCreatorFailJpeg();

    this->asyncBlobCreator()->scheduleAsyncBlobCreation(true, 1.0);
    testing::enterRunLoop();

    EXPECT_EQ(IdleTaskStatus::IdleTaskFailed, this->asyncBlobCreator()->idleTaskStatus());
}

}


text:
<?php

namespace PRS\PicksBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     * @Template()
     */
    public function indexAction()
    {
        return $this->render('PRSPicksBundle:Default:index.html.twig');
    }
}