text:
package org.kie.server.services.impl;

import java.util.concurrent.TimeUnit;

import org.drools.core.command.runtime.AdvanceSessionTimeCommand;
import org.drools.core.command.runtime.DisposeCommand;
import org.drools.core.command.runtime.GetGlobalCommand;
import org.drools.core.command.runtime.GetSessionTimeCommand;
import org.drools.core.command.runtime.SetGlobalCommand;
import org.drools.core.command.runtime.process.StartProcessCommand;
import org.drools.core.command.runtime.rule.AgendaGroupSetFocusCommand;
import org.drools.core.command.runtime.rule.DeleteCommand;
import org.drools.core.command.runtime.rule.FireAllRulesCommand;
import org.drools.core.command.runtime.rule.GetFactHandlesCommand;
import org.drools.core.command.runtime.rule.GetObjectCommand;
import org.drools.core.command.runtime.rule.GetObjectsCommand;
import org.drools.core.command.runtime.rule.InsertElementsCommand;
import org.drools.core.command.runtime.rule.InsertObjectCommand;
import org.drools.core.command.runtime.rule.ModifyCommand;
import org.drools.core.command.runtime.rule.QueryCommand;
import org.junit.Ignore;
import org.junit.Test;
import org.kie.server.api.marshalling.Marshaller;
import org.kie.server.api.marshalling.MarshallerFactory;
import org.kie.server.api.marshalling.MarshallingFormat;

import static org.junit.Assert.assertEquals;

public class CommandsMarshallingTest {
    private Marshaller marshaller = MarshallerFactory.getMarshaller( MarshallingFormat.XSTREAM, Thread.currentThread().getContextClassLoader() );

    @Test
    public void testMarshallInsertObjectCommand() {
        String xmlCommand = "<insert>\n" +
                            "  <string>String value</string>\n" +
                            "</insert>";
        InsertObjectCommand command = marshaller.unmarshall( xmlCommand, InsertObjectCommand.class );
        assertEquals( "String value", command.getObject().toString() );

        assertEquals( xmlCommand, marshaller.marshall( command ) );
    }

    @Test
    public void testMarshallModifyCommand() {
        String xmlCommand = "<modify fact-handle=\"0:234:345:456:567:789\">\n" +
                            "  <set accessor=\"age\" value=\"30\"/>\n" +
                            "</modify>";
        ModifyCommand command = marshaller.unmarshall(xmlCommand, ModifyCommand.class);
        assertEquals(1, command.getSetters().size());

        assertEquals("<modify fact-handle=\"0:234:345:456:567:789:NON_TRAIT:null\">\n" +
                "  <set accessor=\"age\" value=\"30\"/>\n" +
                "</modify>", marshaller.marshall(command));
    }

    @Test
    public void testMarshallGetObjectCommand() {
        String xmlCommand = "<get-object fact-handle=\"0:234:345:456:567:789\" out-identifier=\"test\"/>";
        GetObjectCommand command = marshaller.unmarshall(xmlCommand, GetObjectCommand.class);
        assertEquals("test", command.getOutIdentifier());

        assertEquals("<get-object fact-handle=\"0:234:345:456:567:789:NON_TRAIT:null\" out-identifier=\"test\"/>", marshaller.marshall(command));
    }

    @Test
    public void testMarshallInsertElementsCommand() {
        String xmlCommand = "<insert-elements>\n" +
                "  <string>test1</string>\n" +
                "  <string>test2</string>\n" +
                "</insert-elements>";
        InsertElementsCommand command = marshaller.unmarshall(xmlCommand, InsertElementsCommand.class);
        assertEquals(2, command.getObjects().size());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallFireAllRulesCommand() {
        String xmlCommand = "<fire-all-rules max=\"10\" out-identifier=\"result\"/>";
        FireAllRulesCommand command = marshaller.unmarshall(xmlCommand, FireAllRulesCommand.class);
        assertEquals(10, command.getMax());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallDisposeCommand() {
        String xmlCommand = "<dispose/>";
        DisposeCommand command = marshaller.unmarshall(xmlCommand, DisposeCommand.class);

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallStartProcessCommand() {
        String xmlCommand = "<start-process processId=\"org.drools.task.processOne\" out-identifier=\"id\"/>";
        StartProcessCommand command = marshaller.unmarshall(xmlCommand, StartProcessCommand.class);
        assertEquals("org.drools.task.processOne", command.getProcessId());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallQueryCommand() {
        String xmlCommand = "<query out-identifier=\"persons-out\" name=\"persons\"/>";
        QueryCommand command = marshaller.unmarshall(xmlCommand, QueryCommand.class);
        assertEquals("persons", command.getName());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallSetGlobalCommand() {
        String xmlCommand = "<set-global identifier=\"helper\" out-identifier=\"output\">\n" +
                "  <list/>\n" +
                "</set-global>";
        SetGlobalCommand command = marshaller.unmarshall(xmlCommand, SetGlobalCommand.class);
        assertEquals("helper", command.getIdentifier());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallGetGlobalCommand() {
        String xmlCommand = "<get-global identifier=\"helper\" out-identifier=\"helperOutput\"/>";
        GetGlobalCommand command = marshaller.unmarshall(xmlCommand, GetGlobalCommand.class);
        assertEquals("helper", command.getIdentifier());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallGetObjectsCommand() {
        String xmlCommand = "<get-objects out-identifier=\"objects\"/>";
        GetObjectsCommand command = marshaller.unmarshall(xmlCommand, GetObjectsCommand.class);
        assertEquals("objects", command.getOutIdentifier());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    @Ignore("Set focus command not yet supported")
    public void testMarshallAgendaGroupSetFocusCommand() {
        String xmlCommand = "<agenda-group-set-focus name=\"my-agenda-group\"/>";
        AgendaGroupSetFocusCommand command = marshaller.unmarshall(xmlCommand, AgendaGroupSetFocusCommand.class);
        assertEquals("my-agenda-group", command.getName());

        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallDeleteCommand() {
        String xmlCommand = "<delete fact-handle=\"0:234:345:456:567:789\"/>";
        DeleteCommand command = marshaller.unmarshall(xmlCommand, DeleteCommand.class);

        assertEquals("<delete fact-handle=\"0:234:345:456:567:789:NON_TRAIT:null\"/>", marshaller.marshall(command));
    }

    @Test
    public void testMarshallGetFactHandlesCommand() {
        String xmlCommand = "<get-fact-handles/>";
        GetFactHandlesCommand command = marshaller.unmarshall( xmlCommand, GetFactHandlesCommand.class );

        assertEquals("<get-fact-handles disconnected=\"false\"/>", marshaller.marshall(command));
    }

    @Test
    public void testMarshallGetSessionTimeCommand() {
        String xmlCommand = "<get-session-time out-identifier=\"session-currenttime\"/>";
        GetSessionTimeCommand command = marshaller.unmarshall( xmlCommand, GetSessionTimeCommand.class );
        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    @Test
    public void testMarshallAdvanceSessionTimeCommand() {
        String xmlCommand = "<advance-session-time out-identifier=\"session-advancecurrenttime\" amount=\"2\" unit=\"DAYS\"/>";
        AdvanceSessionTimeCommand command = marshaller.unmarshall( xmlCommand, AdvanceSessionTimeCommand.class );
        assertEquals( 2L, command.getAmount() );
        assertEquals( TimeUnit.DAYS, command.getUnit() );
        assertEquals(xmlCommand, marshaller.marshall(command));
    }

    // TODO determine what other commands are supported and add tests for them

}


text:
import { SortedMapStructure, getItemByIndex } from '../internals';

export function at<K, V, U> (index: number, map: SortedMapStructure<K, V, U>): [K, V]|undefined {
  return getItemByIndex(index, map._sorted);
}

redpajama_set_name: RedPajamaGithub


text:
using Magelia.WebStore.Models.Parts;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using System;

namespace Magelia.WebStore.Drivers
{
    public class BasketPartDriver : ContentPartDriver<BasketPart>
    {
        protected override String Prefix
        {
            get
            {
                return "Magelia_WebStore_Basket";
            }
        }

        protected override DriverResult Display(BasketPart part, String displayType, dynamic shapeHelper)
        {
            return this.ContentShape(
                "Parts_Basket",
                () => shapeHelper.Parts_Basket(BasketPartId: part.Id)
            );
        }

        protected override DriverResult Editor(BasketPart part, dynamic shapeHelper)
        {
            return this.ContentShape(
                "Parts_Basket_Edit",
                () => shapeHelper.EditorTemplate(
                    Model: part,
                    Prefix: this.Prefix,
                    TemplateName: "Parts/Basket"
                )
            );
        }

        protected override DriverResult Editor(BasketPart part, IUpdateModel updater, dynamic shapeHelper)
        {
            updater.TryUpdateModel(part, this.Prefix, null, null);
            return this.Editor(part, shapeHelper);
        }
    }
}


text:
/*
   lz4.c and lz4.h are verbatim copies from Mozilla source tree mfbt/lz4.*
   (Mercurial) rev: c3f5e6079284 (2016-05-12) and carry their own license.
*/

/* Build: copy src/ref_compress/jsonlz4.c to src/ and then:
 * gcc -Wall -o jsonlz4 jsonlz4.c lz4.c
 */

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>

#include "lz4.h"

const char mozlz4_magic[] = {109, 111, 122, 76, 122, 52, 48, 0};  /* "mozLz40\0" */
const int decomp_size = 4;  /* 4 bytes size come after the header */

void exit_usage(int code) {
    fprintf((code ? stderr : stdout), "%s",
            "Usage: jsonlz4 [-h] IN_FILE OUT_FILE\n"
            "   -h  Display this help and exit.\n"
            "Compress IN_FILE to OUT_FILE with same format as Firefox bookmarks backup.\n"
            "If IN_FILE is '-', compress from standard input.\n"
            "If OUT_FILE is '-', compress to standard output.\n"
            "Note: IN_FILE is transferred to memory entirely before compressing.\n"
            "Compression is also done in memory entirely before output.\n"
            "Note: it's not recommended to use this tool, as it creates non standard files.\n"
           );
    exit(code);
}

/* If required, prevents EOL translations with f. Returns non-zero on failure */
int ensure_binary(FILE *f)
{
#ifdef _WIN32
    /* -1 is failure: https://msdn.microsoft.com/en-us/library/tw4k6df8.aspx */
    return _setmode(_fileno(f), O_BINARY) == -1;
#else
    return 0;  /* not required */
#endif
}

#define INITIAL_ALLOC_SIZE (32 * 1024)

/* if fname is NULL, reads from stdin till EOF */
void *file_to_mem(const char *fname, size_t *out_size)
{
    unsigned char *buf = 0, *rv = 0;
    size_t buf_size = 0, got = 0;
    FILE *f = fname ? fopen(fname, "rb") : stdin;
    if (!f)
        return 0;  /* can't do anything */
    if (!fname && ensure_binary(f))
        fprintf(stderr, "Warning: cannot set stdin to binary mode\n");

    do {
        buf_size = got ? got * 2 : INITIAL_ALLOC_SIZE;
        if (buf_size <= got || !(buf = realloc(buf, buf_size)))
            break;  /* size_t wrap-around or OOM: break before EOF */
        rv = buf;
        got += fread(buf + got, 1, buf_size - got, f);
    } while (got == buf_size);  /* otherwise feof(f) or ferror(f) */

    if (!buf || !feof(f) || ferror(f)) {
        if (rv)
            free(rv);
        rv = 0;
    }

    if (f && fname)
        fclose(f);
    if (rv && out_size)
        *out_size = got;
    return rv;
}

const size_t magic_size = sizeof mozlz4_magic;

#define ERR_CLEANUP(...) { fprintf(stderr, "Error: " __VA_ARGS__); goto cleanup; }

int main(int argc, char **argv)
{
    size_t isize = 0, osize = 0;
    const char *iname = 0, *oname = 0;
    char *idata = 0, *odata = 0;
    FILE *ofile = 0;
    int rv = 1, i, csize;

    /* process arguments */
    if (argc != 3)
        exit_usage(argc == 2 && !strcmp(argv[1], "-h") ? 0 : 1);
    if (strcmp("-", argv[1]))
        iname = argv[1];
    if (strcmp("-", argv[2]))
        oname = argv[2];

    /* read input file and allocate buffer for output file */
    if (!(idata = file_to_mem(iname, &isize)))
        ERR_CLEANUP("cannot read file '%s'\n", iname ? iname : "<stdin>");
    if (!(odata = malloc(magic_size + decomp_size + LZ4_compressBound(isize))))
        ERR_CLEANUP("cannot allocate memory for output\n");

    // write header and size of decompressed data at the beginning
    memcpy(odata, mozlz4_magic, magic_size);
    for (i = magic_size; i < magic_size + decomp_size; i++)
        odata[i] = (isize >> (8 * (i - magic_size))) & 0xff;

    /* compress */
    if (!(csize = LZ4_compress(idata, odata + i, isize)))
        ERR_CLEANUP("compression failed\n");
    osize = csize + magic_size + decomp_size;

    /* write output */
    if (!(ofile = oname ? fopen(oname, "wb") : stdout))
        ERR_CLEANUP("cannot open '%s' for writing\n", oname);
    if (!oname && ensure_binary(ofile))
        fprintf(stderr, "Warning: cannot set stdout to binary mode\n");
    if (osize != fwrite(odata, 1, osize, ofile))
        ERR_CLEANUP("cannot write to '%s'\n", oname ? oname : "<stdout>");

    rv = 0;

cleanup:
    if (ofile && oname)
        fclose(ofile);
    if (odata)
        free(odata);
    if (idata)
        free(idata);

    return rv;
}


text:
<?php
declare(strict_types=1);

namespace Gdbots\Tests\Pbj\WellKnown;

use Gdbots\Pbj\WellKnown\Microtime;
use PHPUnit\Framework\TestCase;

/**
 * Some of the tests run many iterations to ensure that different values
 * returned from microtime() and gettimeofday() calls cover more possibilites.
 */
class MicrotimeTest extends TestCase
{
    protected int $testCount = 2500;

    public function testFromTimeOfDay()
    {
        $i = $this->testCount;
        do {
            $tod = gettimeofday();
            $sec = $tod['sec'];
            $usec = $tod['usec'];
            $str = $sec . str_pad((string)$tod['usec'], 6, '0', STR_PAD_LEFT);
            $m = Microtime::fromTimeOfDay($tod);

            $this->assertSame($sec, $m->getSeconds());
            $this->assertSame($sec, (int)$m->toDateTime()->format('U'));
            $this->assertSame($usec, $m->getMicroSeconds());
            $this->assertSame($str, $m->toString());
            --$i;
        } while ($i > 0);
    }

    public function testFromString()
    {
        $i = $this->testCount;
        do {
            $tod = gettimeofday();
            $sec = $tod['sec'];
            $usec = $tod['usec'];
            $str = $sec . str_pad((string)$tod['usec'], 6, '0', STR_PAD_LEFT);
            $m = Microtime::fromString($str);

            $this->assertSame($sec, $m->getSeconds());
            $this->assertSame($sec, (int)$m->toDateTime()->format('U'));
            $this->assertSame($usec, $m->getMicroSeconds());
            $this->assertSame($str, $m->toString());
            --$i;
        } while ($i > 0);
    }

    /**
     * verifies that the microsecond precision is properly padded with
     * zeroes when a full 6 digits are not provided.  padding is done on
     * the right side.  e.g. 123 becomes 123000,
     */
    public function testFromStringPrecision()
    {
        $sec = time();
        $i = 6;
        do {
            $usec = str_repeat('1', $i);
            $usecFixed = (int)str_pad((string)$usec, 6, '0');
            $str = $sec . $usecFixed;
            $m = Microtime::fromString($sec . $usec);
            $this->assertSame($sec, $m->getSeconds());
            $this->assertSame($sec, (int)$m->toDateTime()->format('U'));
            $this->assertSame($usecFixed, $m->getMicroSeconds());
            $this->assertSame($str, $m->toString());
            --$i;
        } while ($i > 2);
    }

    public function testToDateTime()
    {
        $microtime = microtime(true);
        [$sec, $usec] = explode('.', (string)$microtime);
        $usec = str_pad((string)$usec, 6, '0');
        $date = \DateTime::createFromFormat('U.u', $sec . '.' . $usec);
        $m = Microtime::fromString($sec . $usec);
        $this->assertSame($date->format('Y-m-d H:i:s.u'), $m->toDateTime()->format('Y-m-d H:i:s.u'));
        $this->assertSame(
            Microtime::fromDateTime($date)->toDateTime()->format('Y-m-d H:i:s.u'),
            $m->toDateTime()->format('Y-m-d H:i:s.u')
        );
    }

    public function testDateTimeComparison()
    {
        $microtime = microtime(true);
        [$sec, $usec] = explode('.', (string)$microtime);
        $usec = str_pad((string)$usec, 6, '0');
        $date = \DateTime::createFromFormat('U.u', $sec . '.' . $usec);
        $m = Microtime::fromString($sec . $usec);
        $this->assertSame($date->format('Y-m-d H:i:s.u'), $m->toDateTime()->format('Y-m-d H:i:s.u'));
        $this->assertEquals($date, $m->toDateTime());
        $this->assertEquals($m->toDateTime()->getOffset(), (new \DateTime('UTC'))->getOffset());
    }

    /**
     * Funky test as float values get rounded when you clip digits and recreate
     * them so what we're doing is verifying the float that is regenerated
     * from the object results in the same 16 digit integer.
     */
    public function testToFloat()
    {
        $i = $this->testCount;
        do {
            $microtime = microtime(true);
            $m = Microtime::fromFloat($microtime);
            $f1 = substr(str_pad(str_replace('.', '', (string)$microtime), 16, '0'), 0, 16);
            $f2 = substr(str_pad(str_replace('.', '', (string)$m->toFloat()), 16, '0'), 0, 16);
            $this->assertSame($f1, $f2);
            --$i;
        } while ($i > 0);
    }
}


text:
BUILD_TOOL_DIR=`pwd`
PROJECT_DIR=`dirname $BUILD_TOOL_DIR`

cd $PROJECT_DIR/implementations/hps.dotnet
dotnet build --configuration Debug
dotnet test --configuration Debug
Hps.Cmd/bin/Debug/netcoreapp3.0/Hps.Cmd --version
cd $BUILD_TOOL_DIR


text:
@interface ScrollViewController : BaseViewController

@property (strong, nonatomic) BTGlassScrollView *glassScrollView;
@property (strong, nonatomic) CityModel *cityObjc;
@property (nonatomic, assign) int index;

- (id)initWithImage:(UIImage *)image cityInfo:(CityModel *)cityObjc;
//- (id)initWithImage:(UIImage *)image cityInfo:(NSString *)cityid;

- (void)showFahrenheitTem;
- (void)showCelsiusTem;
- (void)fetchRealTimeTemInfo;

@end


text:
const app = require("../../express");
const userModel = require("../models/user/user.model");
const accountModel = require("../models/account/account.model");

const passport = require("passport");
const LocalStrategy = require("passport-local").Strategy;
const bcrypt = require("bcrypt-nodejs");

const GoogleStrategy = require("passport-google-oauth20").Strategy;

passport.serializeUser(function(user, done) {
    done(null, user);
});

passport.deserializeUser(function(user, done) {
    userModel.findUserById(user._id)
        .then(function(user) {
            done(null, user);
        }, function(err) {
            done(err, null);
        });
});

passport.use(
    new LocalStrategy(
        function(username, password, done) {
            userModel.findUserByUsername(username)
                .then(
                    function(user) {
                        if(user && bcrypt.compareSync(password, user.password)) {
                            return done(null, user);
                        } else {
                            return done(null, false);
                        }
                    },
                    function(err) {
                        if(err) {
                            console.log(err);
                            return done(err);
                        }
                    }
                )
        }));

passport.use(new GoogleStrategy(
    {
        clientID: process.env.GOOGLE_CLIENT_ID,
        clientSecret: process.env.GOOGLE_CLIENT_SECRET,
        callbackURL: process.env.callbackURL || "http://localhost:3000/googleoauthcallback",
    }, function(accessToken, refreshToken, profile, cb) {
        userModel.findOrCreate({googleId: profile.id},
            function(err, user) {
                return cb(err, user);
            });
    }
));

app.get('/api/accounts', findUserAccounts);
app.get('/api/users', findUsers);
app.get('/api/user', findUserByCredentials);
app.post('/api/user', createUser);
app.put('/api/user', updateUser);
app.post('/api/login', passport.authenticate('local'), login);
app.get('/api/isloggedin', isLoggedIn);
app.get('/api/logout', function(req, res){
    req.logout();
    res.sendStatus(200);
});
app.get('/auth/googleOAuth', passport.authenticate('google', {scope: ['profile']}));
app.get('/googleoauthcallback', passport.authenticate('google'), googleLogin);
app.delete('/api/user/:userId', deleteUser);

function deleteUser(req, res) {
    const userId = req.params['userId'];

    userModel.deleteUser(userId)
	.then((response) => {
	    res.json(response);
	});
}

function findUserAccounts(req, res) {
    if(!req.user) {
        res.sendStatus(404);
        return;
    }

    userModel.findOne({_id: req.user._id})
        .populate('accounts')
        .exec(function (err, users) {
            res.json(users.accounts);
        });
}

function googleLogin(req, res) {
    if(req.user) {
        res.redirect('/');
    } else  {
        res.sendStatus(404);
    }
}

function isLoggedIn(req, res) {
    res.send(req.isAuthenticated() ? req.user : 'not logged in');
}

function login(req, res) {
    // If this function gets called, authentication was successful.
    // If authentication fails, Passport will respond with a 401 Unauthorized status
    if(req.isAuthenticated()) {
        console.log('Logged in');
        res.json(req.user);
    } else {
        res.sendStatus(404);
    }
}

function updateUser(req, res) {
    const user = req.body;
    const userId = user._id;

    delete user._id;

    userModel.updateUser(userId, user)
        .then(function(response) {
            console.log(response);
            res.json(response);
        }, function(err) {
            console.log(err);
        });
}

function findUserByCredentials(req, res) {
    const username = req.query.username;

    userModel.findOne({username: username})
        .then(function(user) {
            res.json(user);
        });
}

function createUser(req, res) {
    const user = req.body;
    user.password = bcrypt.hashSync(user.password);

    userModel.createUser(user)
        .then(function(createdUser) {
	    req.login(createdUser, function(err) {
		if(!err) {
		    res.json(createdUser);
		}
	    });
        });
}

function findUsers(req, res) {
    userModel.findUsers()
        .then(function(users) {
            if(users) {
                res.json(users);
            } else {
                res.sendStatus(404);
            }
        });
}


text:
\hypertarget{classLevel}{}\section{Level Class Reference}
\label{classLevel}\index{Level@{Level}}

This class stores a \hyperlink{classStage}{Stage} and Objects and can move them and display them.

{\ttfamily \#include $<$level.\+h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\mbox{\Hypertarget{classLevel_a81689e48aaf6d5421721bd06f480e4e1}\label{classLevel_a81689e48aaf6d5421721bd06f480e4e1}}
void \hyperlink{classLevel_a81689e48aaf6d5421721bd06f480e4e1}{create} ()
\begin{DoxyCompactList}\small\item\em Create the \hyperlink{classLevel}{Level} based on the given stage. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_ac9bb5473dece11462e702fe418590f24}\label{classLevel_ac9bb5473dece11462e702fe418590f24}}
void \hyperlink{classLevel_ac9bb5473dece11462e702fe418590f24}{set\+Stage} (\hyperlink{classStage}{Stage} s)
\begin{DoxyCompactList}\small\item\em Give a \hyperlink{classStage}{Stage} to the \hyperlink{classLevel}{Level}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a962fd10cb871d2fdd98230dc079bff34}\label{classLevel_a962fd10cb871d2fdd98230dc079bff34}}
void \hyperlink{classLevel_a962fd10cb871d2fdd98230dc079bff34}{set\+Stage} (\hyperlink{classMap}{Map} m, \hyperlink{classTileset}{Tileset} t)
\begin{DoxyCompactList}\small\item\em Create a \hyperlink{classStage}{Stage} for the \hyperlink{classLevel}{Level} by giving a \hyperlink{classMap}{Map} and a \hyperlink{classTileset}{Tileset}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a3fcaa774a00e39090336b5a61d88e3e2}\label{classLevel_a3fcaa774a00e39090336b5a61d88e3e2}}
void \hyperlink{classLevel_a3fcaa774a00e39090336b5a61d88e3e2}{set\+Scale} (int w, int h)
\begin{DoxyCompactList}\small\item\em Scale the \hyperlink{classLevel}{Level} by giving it the width and height to scale by. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_af6fe8bc2dd6623fcbaa739403a239d77}\label{classLevel_af6fe8bc2dd6623fcbaa739403a239d77}}
void \hyperlink{classLevel_af6fe8bc2dd6623fcbaa739403a239d77}{set\+Scale} (int s)
\begin{DoxyCompactList}\small\item\em Scale the \hyperlink{classLevel}{Level} by giving it a single integer to scale by. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a02e915f95e181dcfe95553e923a73a39}\label{classLevel_a02e915f95e181dcfe95553e923a73a39}}
void \hyperlink{classLevel_a02e915f95e181dcfe95553e923a73a39}{calc\+Pos} ()
\begin{DoxyCompactList}\small\item\em Calculate the position of the level based on coordinates. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_ade9e45f70f2f3f81c120bb161f87218f}\label{classLevel_ade9e45f70f2f3f81c120bb161f87218f}}
vector$<$ \hyperlink{classTile}{Tile} $>$ \hyperlink{classLevel_ade9e45f70f2f3f81c120bb161f87218f}{get\+Tiles\+To\+Render} ()
\begin{DoxyCompactList}\small\item\em Return the Tiles that are currently on the screen. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a80d185e702151c5b5764c1cadcd9064d}\label{classLevel_a80d185e702151c5b5764c1cadcd9064d}}
vector$<$ \hyperlink{classObject}{Object} $>$ \hyperlink{classLevel_a80d185e702151c5b5764c1cadcd9064d}{get\+Objects\+To\+Render} ()
\begin{DoxyCompactList}\small\item\em Return the Objects that are currently on the screen. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a1a95e314e19e1fdba6850e9aa8da856e}\label{classLevel_a1a95e314e19e1fdba6850e9aa8da856e}}
vector$<$ \hyperlink{classEntity}{Entity} $>$ \hyperlink{classLevel_a1a95e314e19e1fdba6850e9aa8da856e}{get\+Entities\+To\+Render} ()
\begin{DoxyCompactList}\small\item\em Return the Entities that are currently on the screen. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a9184b25173fbf468a63a633bd3510bd6}\label{classLevel_a9184b25173fbf468a63a633bd3510bd6}}
void \hyperlink{classLevel_a9184b25173fbf468a63a633bd3510bd6}{move} (int mx, int my)
\begin{DoxyCompactList}\small\item\em Move the screen by passing in how much to move on the x and y coordinates. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_af4788055ad02e14ea48958c9c871fee3}\label{classLevel_af4788055ad02e14ea48958c9c871fee3}}
void {\bfseries move\+Entity} (int id, int mx, int my)
\item
\mbox{\Hypertarget{classLevel_a3ff79425060f959496d64aa052ef3cf6}\label{classLevel_a3ff79425060f959496d64aa052ef3cf6}}
void \hyperlink{classLevel_a3ff79425060f959496d64aa052ef3cf6}{set\+Coord} (double x, double y)
\begin{DoxyCompactList}\small\item\em Set the coordinate for the screen with a given x and y. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a6212b3c03b3efc82cf69e642cc093959}\label{classLevel_a6212b3c03b3efc82cf69e642cc093959}}
void \hyperlink{classLevel_a6212b3c03b3efc82cf69e642cc093959}{setX} (double x)
\begin{DoxyCompactList}\small\item\em Set the x coordinate. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a7c67443008f7e0f4b5d1630ff2dcf179}\label{classLevel_a7c67443008f7e0f4b5d1630ff2dcf179}}
void \hyperlink{classLevel_a7c67443008f7e0f4b5d1630ff2dcf179}{setY} (double y)
\begin{DoxyCompactList}\small\item\em Set the y coordinate. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a5de2ec6e9ec70130b18fe6050b9e89a0}\label{classLevel_a5de2ec6e9ec70130b18fe6050b9e89a0}}
double \hyperlink{classLevel_a5de2ec6e9ec70130b18fe6050b9e89a0}{getX} () const
\begin{DoxyCompactList}\small\item\em Get the x coordinate. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a39f75f6099a7a08e8dc5119bfce853b0}\label{classLevel_a39f75f6099a7a08e8dc5119bfce853b0}}
double \hyperlink{classLevel_a39f75f6099a7a08e8dc5119bfce853b0}{getY} () const
\begin{DoxyCompactList}\small\item\em Get the y coordinate. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_ad559b0aa6e81fcc4651cc4c50d4c0c65}\label{classLevel_ad559b0aa6e81fcc4651cc4c50d4c0c65}}
\hyperlink{classObject}{Object} {\bfseries get\+Screen} () const
\item
\mbox{\Hypertarget{classLevel_a22a202624bb540acc74b678b74b60c9d}\label{classLevel_a22a202624bb540acc74b678b74b60c9d}}
void \hyperlink{classLevel_a22a202624bb540acc74b678b74b60c9d}{set\+Screen\+Size} (int w, int h)
\begin{DoxyCompactList}\small\item\em Set the size of the screen by passing in the width and height. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a6f522671fde4a9d25945a9df651f6e28}\label{classLevel_a6f522671fde4a9d25945a9df651f6e28}}
void \hyperlink{classLevel_a6f522671fde4a9d25945a9df651f6e28}{set\+Precise} (bool p)
\begin{DoxyCompactList}\small\item\em Active precise if you want the coordinates in a map file to go to that exact pixel, or leave it off if you want it to go to that \hyperlink{classTile}{Tile}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a85e4149562c645b6ee11e7a0338dc6d6}\label{classLevel_a85e4149562c645b6ee11e7a0338dc6d6}}
void \hyperlink{classLevel_a85e4149562c645b6ee11e7a0338dc6d6}{add\+Object} (\hyperlink{classObject}{Object} o)
\begin{DoxyCompactList}\small\item\em Add \hyperlink{classObject}{Object} to \hyperlink{classLevel}{Level}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a227e7b01aecb4cfd14cd54233788dee2}\label{classLevel_a227e7b01aecb4cfd14cd54233788dee2}}
void \hyperlink{classLevel_a227e7b01aecb4cfd14cd54233788dee2}{add\+Object} (vector$<$ \hyperlink{classObject}{Object} $>$ o)
\begin{DoxyCompactList}\small\item\em Add vector of Objects to \hyperlink{classLevel}{Level}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a9345e51c6abbc422864bf6954c5f6312}\label{classLevel_a9345e51c6abbc422864bf6954c5f6312}}
int \hyperlink{classLevel_a9345e51c6abbc422864bf6954c5f6312}{add\+Entity} (\hyperlink{classEntity}{Entity} e)
\begin{DoxyCompactList}\small\item\em Add \hyperlink{classEntity}{Entity} to \hyperlink{classLevel}{Level}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a6c4584d5aa383888461406de600a43c1}\label{classLevel_a6c4584d5aa383888461406de600a43c1}}
void \hyperlink{classLevel_a6c4584d5aa383888461406de600a43c1}{add\+Entity} (vector$<$ \hyperlink{classEntity}{Entity} $>$ e)
\begin{DoxyCompactList}\small\item\em Add vector of \hyperlink{classEntity}{Entity}\textquotesingle{}s to \hyperlink{classLevel}{Level}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_afc8426f1adb6037dd71b26e4bd63db92}\label{classLevel_afc8426f1adb6037dd71b26e4bd63db92}}
int \hyperlink{classLevel_afc8426f1adb6037dd71b26e4bd63db92}{set\+Main\+Entity} (\hyperlink{classEntity}{Entity} e)
\begin{DoxyCompactList}\small\item\em Set main \hyperlink{classEntity}{Entity}. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_ab7cf0af8d8c89da5a2dc9d3e3b978637}\label{classLevel_ab7cf0af8d8c89da5a2dc9d3e3b978637}}
int \hyperlink{classLevel_ab7cf0af8d8c89da5a2dc9d3e3b978637}{set\+Main\+Entity} (int m)
\begin{DoxyCompactList}\small\item\em Tell \hyperlink{classLevel}{Level} which one \hyperlink{classEntity}{Entity} is the main one. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classLevel_a69a4cae59576b540090202ab3c22e8d5}\label{classLevel_a69a4cae59576b540090202ab3c22e8d5}}
void {\bfseries set\+Camera\+Margin} (int wm, int hm)
\item
\mbox{\Hypertarget{classLevel_ae2df583cad2a4bbda86e4043d4b81a70}\label{classLevel_ae2df583cad2a4bbda86e4043d4b81a70}}
void {\bfseries center\+Camera} (int percentage)
\item
\mbox{\Hypertarget{classLevel_a72667cfc3b4e98433f4faac78e30e83e}\label{classLevel_a72667cfc3b4e98433f4faac78e30e83e}}
void {\bfseries set\+Lens\+Margin} (int wn, int hm)
\item
\mbox{\Hypertarget{classLevel_ac39dbca241ee739f5f9c2a750c3750f4}\label{classLevel_ac39dbca241ee739f5f9c2a750c3750f4}}
void {\bfseries center\+Lens} (int percentage)
\item
\mbox{\Hypertarget{classLevel_a11a17dbe04938950421d001a8f94cbbc}\label{classLevel_a11a17dbe04938950421d001a8f94cbbc}}
\hyperlink{classObject}{Object} {\bfseries get\+Camera} ()
\item
\mbox{\Hypertarget{classLevel_a33bd74850ef322de8d76572f9fea312f}\label{classLevel_a33bd74850ef322de8d76572f9fea312f}}
\hyperlink{classObject}{Object} {\bfseries get\+Lens} ()
\end{DoxyCompactItemize}

\subsection{Detailed Description}
This class stores a \hyperlink{classStage}{Stage} and Objects and can move them and display them.

Definition at line 10 of file level.\+h.

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item
level.\+h\item
level.\+cpp\end{DoxyCompactItemize}


text:
<?php

/**
 * PBXManager ListView Model Class
 */

class PBXManager_ListView_Model extends Vtiger_ListView_Model {

    /**
    * Overrided to remove add button
    */
    public function getBasicLinks(){
		$basicLinks = array();
		return $basicLinks;
	}

    /**
    * Overrided to remove Mass Edit Option
    */
    public function getListViewMassActions($linkParams) {
		$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
		$moduleModel = $this->getModule();

		$linkTypes = array('LISTVIEWMASSACTION');
		$links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);

		if($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'Delete')) {
			$massActionLinks[] = array(
				'linktype' => 'LISTVIEWMASSACTION',
				'linklabel' => 'LBL_DELETE',
				'linkurl' => 'javascript:Vtiger_List_Js.massDeleteRecords("index.php?module='.$moduleModel->get('name').'&action=MassDelete");',
				'linkicon' => ''
			);

		    foreach($massActionLinks as $massActionLink) {
			$links['LISTVIEWMASSACTION'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
		    }
		}

		return $links;
	}

    /**
    * Overrided to add HTML content for callstatus irrespective of the filters
    */

   public function getListViewEntries($pagingModel) {
        $db = PearDatabase::getInstance();

        $moduleName = $this->getModule()->get('name');
        $moduleFocus = CRMEntity::getInstance($moduleName);
        $moduleModel = Vtiger_Module_Model::getInstance($moduleName);

        //Add the direction field to the query irrespective of filter
        $queryGenerator = $this->get('query_generator');
        $fields = $queryGenerator->getFields();
        array_push($fields, 'direction');
        $queryGenerator->setFields($fields);
        $this->set('query_generator', $queryGenerator);
        //END

        $listViewContoller = $this->get('listview_controller');

        $searchKey = $this->get('search_key');
        $searchValue = $this->get('search_value');
        $operator = $this->get('operator');
        if (!empty($searchKey)) {
            $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
        }

        $orderBy = $this->getForSql('orderby');
        $sortOrder = $this->getForSql('sortorder');

        //List view will be displayed on recently created/modified records
        if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
            $orderBy = 'modifiedtime';
            $sortOrder = 'DESC';
        }

        if (!empty($orderBy)) {
            $columnFieldMapping = $moduleModel->getColumnFieldMapping();
            $orderByFieldName = $columnFieldMapping[$orderBy];
            $orderByFieldModel = $moduleModel->getField($orderByFieldName);

            if ($orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
                //IF it is reference add it in the where fields so that from clause will be having join of the table
                $queryGenerator = $this->get('query_generator');
                $queryGenerator->addWhereField($orderByFieldName);
                //$queryGenerator->whereFields[] = $orderByFieldName;
            }
        }
        $listQuery = $this->getQuery();

        $sourceModule = $this->get('src_module');
        if (!empty($sourceModule)) {
            if (method_exists($moduleModel, 'getQueryByModuleField')) {
                $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
                if (!empty($overrideQuery)) {
                    $listQuery = $overrideQuery;
                }
            }
        }

        $startIndex = $pagingModel->getStartIndex();
        $pageLimit = $pagingModel->getPageLimit();

        if (!empty($orderBy)) {
            if ($orderByFieldModel->isReferenceField()) {
                $referenceModules = $orderByFieldModel->getReferenceList();

                $referenceNameFieldOrderBy = array();
                foreach ($referenceModules as $referenceModuleName) {
                    $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                    $referenceNameFields = $referenceModuleModel->getNameFields();
                    $columnList = array();
                    foreach ($referenceNameFields as $nameField) {
                        $fieldModel = $referenceModuleModel->getField($nameField);
                        $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                    }
                    if (count($columnList) > 1) {
                        $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                    } else {
                        $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                    }
                }
                $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
            } else {
                $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
            }
        }

        $viewid = ListViewSession::getCurrentView($moduleName);
        ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);

        $listQuery .= " LIMIT $startIndex," . ($pageLimit + 1);

        $listResult = $db->pquery($listQuery, array());

        $listViewRecordModels = array();
        $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);

        $pagingModel->calculatePageRange($listViewEntries);

        if ($db->num_rows($listResult) > $pageLimit) {
            array_pop($listViewEntries);
            $pagingModel->set('nextPageExists', true);
        } else {
            $pagingModel->set('nextPageExists', false);
        }

        //Adding the HTML content based on the callstatus and direction to the records
        foreach ($listViewEntries as $recordId => $record) {
            //To Replace RecordingUrl by Icon
            $recordingUrl = explode('>', $listViewEntries[$recordId]['recordingurl']);
            $url = explode('<', $recordingUrl[1]);
            if ($url[0] != '' && $listViewEntries[$recordId]['callstatus'] == 'completed') {
                $listViewEntries[$recordId]['recordingurl'] = $recordingUrl[0] . '>' . '' . '';
            } else {
                $listViewEntries[$recordId]['recordingurl'] = '';
            }

            if ($listViewEntries[$recordId]['direction'] == 'outbound') {
                if ($listViewEntries[$recordId]['callstatus'] == 'ringing' || $listViewEntries[$recordId]['callstatus'] == 'in-progress') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else if ($listViewEntries[$recordId]['callstatus'] == 'completed') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else if ($listViewEntries[$recordId]['callstatus'] == 'no-answer') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                }
            } else if ($listViewEntries[$recordId]['direction'] == 'inbound') {
                if ($listViewEntries[$recordId]['callstatus'] == 'ringing' || $listViewEntries[$recordId]['callstatus'] == 'in-progress') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else if ($listViewEntries[$recordId]['callstatus'] == 'completed') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else if ($listViewEntries[$recordId]['callstatus'] == 'no-answer') {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                } else {
                    $listViewEntries[$recordId]['callstatus'] = '
                         ' . $listViewEntries[$recordId]["callstatus"] . '';
                }
            }
        }
        //END

        $index = 0;
        foreach ($listViewEntries as $recordId => $record) {
            $rawData = $db->query_result_rowdata($listResult, $index++);
            $record['id'] = $recordId;
            $listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record, $rawData);
        }

        return $listViewRecordModels;
    }

}


text:
<?php
namespace blog\widgets\profile\controllers;

use fay\core\Widget;

class IndexController extends Widget{

	public function index($options){
		$this->view->render();
	}

}


text:
<?php

namespace Room204\UpdateNameMeta\Console\Command;

use Magento\Framework\App\Filesystem\DirectoryList;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Framework\Registry;
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Goodwill\AdminTheme\Model\PricingAlgorithmFunctions;
use Magento\Framework\Filesystem;

/**
 * Created by PhpStorm.
 * User: markcyrulik
 * Date: 11/1/16
 * Time: 6:58 PM
 */
class UpdateInfo extends Command
{

    protected $productCollection;

    protected $_registry;

    protected $_state;

    protected $_categoryRepository;

    protected $_productRepository;

    protected $_priceFunctions;

    /**
     * @var Filesystem
     */
    protected $_filesystem;

    /**
     * Constructor
     */
    public function __construct(
        \Magento\Framework\App\State $state,
        CollectionFactory $productCollection,
        CategoryRepositoryInterface $categoryRepository,
        Registry $registry,
        ProductRepositoryInterface $productRepository,
        \Magento\Eav\Model\Config $eavConfig,
        Filesystem $filesystem

    ) {
        $this->_priceFunctions = new PricingAlgorithmFunctions($eavConfig, $categoryRepository);
        $this->productCollection = $productCollection;
        $this->_registry = $registry;
        $this->_state = $state;
        $this->_filesystem = $filesystem;
        $this->_categoryRepository = $categoryRepository;
        $this->_productRepository = $productRepository;
        parent::__construct();
    }

    /**
     *
     */
    protected function configure()
    {
        $this->setName('room204:updateinfo')
            ->setDescription('Update the Info');
        parent::configure();;
    }

    /**
     * @param InputInterface $input
     * @param OutputInterface $output
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $this->_filesystem->getDirectoryWrite(DirectoryList::VAR_DIR)->getAbsolutePath("reports");
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        $filePath = $path."/".'MetaUpdates.txt';

        $this->_registry->register('isSecureArea', true);
        $this->_state->setAreaCode('adminhtml');

        $allProducts = $this->productCollection
            ->create()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('entity_id', ['gteq' => 152]);

        $output->writeln('Updating Name, meta, etc..');
        $counter = 1;

        /** @var \Magento\Catalog\Model\Product\Interceptor $product */
        foreach ($allProducts as $product) {
            $brand = $product->getData('manufacturer');
            $condition = $product->getData('gw_condition');
            /** @var \Magento\Catalog\Model\Category\Interceptor $category */
            $category = $this->_categoryRepository->get($product->getCategoryIds()[0]);
            $parent = $this->getCategoryParent($product->getCategoryIds()[0]);
            $specSize = (empty($product->getData('gw_specialty_length')) ? null : $product->getData('gw_specialty_length'));

            $output->write(str_pad($product->getId(), 6, "0", STR_PAD_LEFT)."\t");
            $output->write($product->getSku()."\t");

            $categoryText = "Women/".$parent."/".$category->getName();

            if ($parent == "Plus" && $category->getId() == 62) {
                $size = $product->getAttributeText('gw_bra_size');
            } else if ($parent == "Plus") {
                $size = $product->getAttributeText('gw_size_plus_us');
            } else {
                $size = $product->getAttributeText('gw_size_womens_us');
            }

            $productName = $categoryText." ".$product->getAttributeText('manufacturer')." Size ".$size;
            $urlKey = $categoryText." ".$product->getAttributeText('manufacturer')." Size ".$size." ".$product->getSku();

            $metaTitle = $categoryText." ".$product->getAttributeText('manufacturer')." Size ".$size;
            $metaDescription = "Get This ".$product->getAttributeText('manufacturer')." ".$categoryText;

            $currentPrice = number_format($product->getPrice(), 2);
            $newPrice = number_format($this->_priceFunctions->getAlgorithmPrice($brand, $category->getId(), $condition, $parent, $specSize), 2);

            $product->setName($productName);
            $product->setData('meta_description', $metaDescription);
            $product->setData('meta_title', $metaTitle);
            $product->setUrlKey($this->urlFilter($urlKey));
            $product->setPrice($newPrice);

            if ($currentPrice != $newPrice) {
                $changed = "CHANGED\t";
            } else {
                $changed = "UNCHANGED\t";
            }

            $output->write($currentPrice."\t".$newPrice."\t".$changed);

//            $product->save();
            $this->_productRepository->save($product);

            $output->writeln($productName);
            $counter++;
        }

    }

    /**
     * @param string $text
     * @return string
     */
    private function urlFilter($text)
    {
        $text = str_replace(' ', '-', $text);
        $text = preg_replace("[^A-Za-z0-9-]", "", $text);
        return strtolower($text);
    }

    /**
     * @param $category
     *
     * @return string
     */
    private function getCategoryParent($category)
    {
        $category = $this->_categoryRepository->get((int) $category);

        return $this->_categoryRepository->get($category->getParentId())->getName();
    }
}


text:
package org.apache.hadoop.hive.ql.exec.vector;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;

import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

public class TestBytesColumnVector {
  @Test
  public void testSmallBufferReuse() {
    BytesColumnVector col = new BytesColumnVector();
    int smallWriteSize = 1024;
    int largeWriteSize = 1024 * 1024 * 2;

    int rowIdx = 0;
    int bytesWrittenToBytes1 = 0;
    col.reset();

    // Initial write (small value)
    byte[] bytes1 = writeToBytesColumnVector(rowIdx, col, smallWriteSize, 1);
    bytesWrittenToBytes1 += smallWriteSize;
    assertEquals(0, col.start[0]);
    assertEquals(smallWriteSize, col.length[0]);

    // Write a large value. This should use a different byte buffer
    rowIdx++;
    byte[] bytes2 = writeToBytesColumnVector(rowIdx, col, largeWriteSize, -1);
    assertNotSame(bytes1, bytes2);
    assertEquals(0, col.start[1]);
    assertEquals(largeWriteSize, col.length[1]);

    // Another small write. smallBuffer should be re-used for this write
    rowIdx++;
    byte[] bytes3 = writeToBytesColumnVector(rowIdx, col, smallWriteSize, 2);
    bytesWrittenToBytes1 += smallWriteSize;
    assertSame(bytes1, bytes3);
    assertEquals(smallWriteSize, col.start[2]);
    assertEquals(smallWriteSize, col.length[2]);

    // Write another large value. This should use a different byte buffer
    rowIdx++;
    byte[] bytes4 = writeToBytesColumnVector(rowIdx, col, largeWriteSize, -2);
    assertNotSame(bytes1, bytes4);
    assertNotSame(bytes2, bytes4);
    assertEquals(0, col.start[3]);
    assertEquals(largeWriteSize, col.length[3]);

    // Eventually enough small writes should result in another buffer getting created
    boolean gotNewBuffer = false;
    // Test is dependent on getting a new buffer within 1MB.
    // This may need to change as the implementation changes.
    for (int i = 3; i < 1024; ++i) {
      rowIdx++;
      byte[] currBytes = writeToBytesColumnVector(rowIdx, col, smallWriteSize, i);
      if (currBytes == bytes1) {
        bytesWrittenToBytes1 += smallWriteSize;
      } else {
        gotNewBuffer = true;
        break;
      }
    }

    assertTrue(gotNewBuffer);

    // All small writes to the first buffer should be in contiguous memory
    for (int i = 0; i < bytesWrittenToBytes1; ++i) {
      assertEquals((byte) (i / smallWriteSize + 1), bytes1[i]);
    }
  }

  /**
   * Test the setVal, setConcat, and StringExpr.padRight methods.
   */
  @Test
  public void testConcatAndPadding() {
    BytesColumnVector col = new BytesColumnVector();
    col.reset();
    byte[] prefix = "緑".getBytes(StandardCharsets.UTF_8);

    // fill the column with 'test'
    for(int row=0; row < col.vector.length; ++row) {
      col.setVal(row, prefix, 0, prefix.length);
    }
    for(int row=0; row < col.vector.length; ++row) {
      assertEquals("row " + row, "緑", col.toString(row));
    }

    // pad out to 6 characters
    for(int row=0; row < col.vector.length; ++row) {
      StringExpr.padRight(col, row, col.vector[row], col.start[row],
          col.length[row], 6);
    }
    for(int row=0; row < col.vector.length; ++row) {
      assertEquals("row " + row, "緑     ", col.toString(row));
    }

    // concat the row digits
    for(int row=0; row < col.vector.length; ++row) {
      byte[] rowStr = Integer.toString(row).getBytes(StandardCharsets.UTF_8);
      col.setConcat(row, col.vector[row], col.start[row], col.length[row],
          rowStr, 0, rowStr.length);
    }
    for(int row=0; row < col.vector.length; ++row) {
      assertEquals("row " + row, "緑     " + row, col.toString(row));
    }

    // We end up allocating 20k, so we should have expanded the small buffer
    assertEquals(32 * 1024, col.bufferSize());
  }

  @Test
  public void testBufferOverflow() {
    BytesColumnVector col = new BytesColumnVector(2048);
    col.reset();
    assertEquals(BytesColumnVector.DEFAULT_BUFFER_SIZE, col.bufferSize());

    // pick a size below 1m so that we use the small buffer;
    final int size = BytesColumnVector.MAX_SIZE_FOR_SMALL_ITEM - 1024;

    // run through once to expand the small value buffer
    for(int row=0; row < col.vector.length; ++row) {
      writeToBytesColumnVector(row, col, size, row);
    }
    // it should have resized a bunch of times
    byte[] sharedBuffer = col.getValPreallocatedBytes();
    assertNotSame(sharedBuffer, col.vector[0]);
    assertSame(sharedBuffer, col.vector[1024]);

    // reset the column, but make sure the buffer isn't reallocated
    col.reset();
    assertEquals(BytesColumnVector.MAX_SIZE_FOR_SHARED_BUFFER, col.bufferSize());

    // fill up the vector now with the large buffer
    for(int row=0; row < col.vector.length; ++row) {
      writeToBytesColumnVector(row, col, size, row);
    }
    assertEquals(BytesColumnVector.MAX_SIZE_FOR_SHARED_BUFFER, col.bufferSize());
    // Now the first 1025 rows should all be the shared buffer,
    // because 1025 * size < MAX_SIZE_FOR_SMALL_BUFFER
    for(int row=0; row < 1025; ++row) {
      assertSame("row " + row, sharedBuffer, col.vector[row]);
      assertEquals("row " + row, row * size, col.start[row]);
      assertEquals("row " + row, size, col.length[row]);
    }
    // the rest should be custom buffers
    for(int row=1025; row < col.vector.length; ++row) {
      assertNotSame("row " + row, sharedBuffer, col.vector[row]);
      assertEquals("row " + row, 0, col.start[row]);
      assertEquals("row " + row, size, col.length[row]);
    }
  }

  /**
   * Make sure that ORC's redact mask won't get into trouble by increasing
   * the size of the allocation before calling setValPreallocated.
   */
  @Test
  public void testMultipleReallocations() {
    BytesColumnVector vector = new BytesColumnVector();
    vector.reset();

    // add a value
    vector.ensureValPreallocated(1000);
    byte[] bytes = vector.getValPreallocatedBytes();
    assertEquals(16 * 1024, bytes.length);
    assertEquals(0, vector.getValPreallocatedStart());
    // now ask for more memory
    vector.ensureValPreallocated(5000);
    // It shouldn't have needed to resize
    assertSame(bytes, vector.getValPreallocatedBytes());
    assertEquals(0, vector.getValPreallocatedStart());
    // actually use 2000 of the bytes
    vector.setValPreallocated(0, 2000);

    // add another value
    vector.ensureValPreallocated(10000);
    assertSame(bytes, vector.getValPreallocatedBytes());
    assertEquals(2000, vector.getValPreallocatedStart());
    vector.setValPreallocated(1, 3000);

    // check to make sure the values are allocated correctly
    assertSame(bytes, vector.vector[0]);
    assertEquals(0, vector.start[0]);
    assertEquals(2000, vector.length[0]);
    assertSame(bytes, vector.vector[1]);
    assertEquals(2000, vector.start[1]);
    assertEquals(3000, vector.length[1]);
  }

  // Write a value to the column vector, and return back the byte buffer used.
  private static byte[] writeToBytesColumnVector(int rowIdx, BytesColumnVector col, int writeSize, int val) {
    col.ensureValPreallocated(writeSize);
    byte[] bytes = col.getValPreallocatedBytes();
    int startIdx = col.getValPreallocatedStart();
    Arrays.fill(bytes, startIdx, startIdx + writeSize, (byte) val);
    col.setValPreallocated(rowIdx, writeSize);
    return bytes;
  }
}


text:
var readline = require('readline');
var net = require('net');
var _ = require('lodash');
var EventEmitter = require('events').EventEmitter;
var ircMessage = require('../../libs/message');

module.exports = function() {
	EventEmitter.init(this);

	var self = this;
	var server = net.createServer(function (socket) {
		self.emit('transport', new Transport(socket));
	});

	server.listen(3333, '127.0.0.1');
}

function Transport(socket) {
	var self = this;

	EventEmitter.init(this);

	this.socket = socket;
	this.connected = true;

	this.rl = readline.createInterface(socket, socket);
	this.rl.on('line', function(line) {
		var msg = ircMessage.parse(line);
		self.emit('message', msg);
	});

	this.socket.on('close', function() {
		self.connected = false;
		self.emit('disconnect');
	});
}

Transport.prototype.write = function() {
	var args = Array.prototype.slice.call(arguments);
	this.connected && this.socket.write(args.join(' ') + '\n');
};


text:
#include "third_party/blink/renderer/core/layout/layout_theme.h"

#include "build/build_config.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/fileapi/file.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_element.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_options_collection.h"
#include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_option_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/html/forms/spin_button_element.h"
#include "third_party/blink/renderer/core/html/forms/text_control_inner_elements.h"
#include "third_party/blink/renderer/core/html/html_collection.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h"
#include "third_party/blink/renderer/core/html/shadow/shadow_element_utils.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/layout_theme_font_provider.h"
#include "third_party/blink/renderer/core/layout/layout_theme_mobile.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/computed_style_initial_values.h"
#include "third_party/blink/renderer/platform/file_metadata.h"
#include "third_party/blink/renderer/platform/fonts/font_selector.h"
#include "third_party/blink/renderer/platform/graphics/touch_action.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "ui/base/ui_base_features.h"
#include "ui/native_theme/native_theme.h"

// The methods in this file are shared by all themes on every platform.

namespace blink {

namespace {

// This function should match to the user-agent stylesheet.
ControlPart AutoAppearanceFor(const Element& element) {
  if (IsA<HTMLButtonElement>(element))
    return kButtonPart;
  if (IsA<HTMLMeterElement>(element))
    return kMeterPart;
  if (IsA<HTMLProgressElement>(element))
    return kProgressBarPart;
  if (IsA<HTMLTextAreaElement>(element))
    return kTextAreaPart;
  if (IsA<SpinButtonElement>(element))
    return kInnerSpinButtonPart;
  if (const auto* select = DynamicTo<HTMLSelectElement>(element))
    return select->UsesMenuList() ? kMenulistPart : kListboxPart;

  if (const auto* input = DynamicTo<HTMLInputElement>(element)) {
    const AtomicString& type = input->type();
    if (type == input_type_names::kCheckbox)
      return kCheckboxPart;
    if (type == input_type_names::kRadio)
      return kRadioPart;
    if (input->IsTextButton())
      return kPushButtonPart;
    if (type == input_type_names::kColor) {
      return input->FastHasAttribute(html_names::kListAttr) ? kMenulistPart
                                                            : kSquareButtonPart;
    }
    if (type == input_type_names::kRange)
      return kSliderHorizontalPart;
    if (type == input_type_names::kSearch)
      return kSearchFieldPart;
    if (type == input_type_names::kDate ||
        type == input_type_names::kDatetimeLocal ||
        type == input_type_names::kMonth || type == input_type_names::kTime ||
        type == input_type_names::kWeek) {
#if BUILDFLAG(IS_ANDROID)
      return kMenulistPart;
#else
      return kTextFieldPart;
#endif
    }
    if (type == input_type_names::kEmail || type == input_type_names::kNumber ||
        type == input_type_names::kPassword || type == input_type_names::kTel ||
        type == input_type_names::kText || type == input_type_names::kUrl)
      return kTextFieldPart;

    // Type=hidden/image/file.
    return kNoControlPart;
  }

  if (element.IsInUserAgentShadowRoot()) {
    const AtomicString& id_value =
        element.FastGetAttribute(html_names::kIdAttr);
    if (id_value == shadow_element_names::kIdSliderThumb)
      return kSliderThumbHorizontalPart;
    if (id_value == shadow_element_names::kIdSearchClearButton ||
        id_value == shadow_element_names::kIdClearButton)
      return kSearchFieldCancelButtonPart;

    // Slider container elements and -webkit-meter-inner-element don't have IDs.
    if (IsSliderContainer(element))
      return kSliderHorizontalPart;
    if (element.ShadowPseudoId() ==
        shadow_element_names::kPseudoMeterInnerElement)
      return kMeterPart;
  }
  return kNoControlPart;
}

}  // namespace

LayoutTheme& LayoutTheme::GetTheme() {
  if (RuntimeEnabledFeatures::MobileLayoutThemeEnabled()) {
    DEFINE_STATIC_REF(LayoutTheme, layout_theme_mobile,
                      (LayoutThemeMobile::Create()));
    return *layout_theme_mobile;
  }
  return NativeTheme();
}

LayoutTheme::LayoutTheme() : has_custom_focus_ring_color_(false) {
  UpdateForcedColorsState();
}

ControlPart LayoutTheme::AdjustAppearanceWithAuthorStyle(
    ControlPart part,
    const ComputedStyle& style) {
  if (IsControlStyled(part, style))
    return part == kMenulistPart ? kMenulistButtonPart : kNoControlPart;
  return part;
}

ControlPart LayoutTheme::AdjustAppearanceWithElementType(
    const ComputedStyle& style,
    const Element* element) {
  ControlPart part = style.EffectiveAppearance();
  if (!element)
    return kNoControlPart;

  ControlPart auto_appearance = AutoAppearanceFor(*element);
  if (part == auto_appearance)
    return part;

  switch (part) {
    // No restrictions.
    case kNoControlPart:
    case kMediaSliderPart:
    case kMediaSliderThumbPart:
    case kMediaVolumeSliderPart:
    case kMediaVolumeSliderThumbPart:
    case kMediaControlPart:
      return part;

    // Aliases of 'auto'.
    // https://drafts.csswg.org/css-ui-4/#typedef-appearance-compat-auto
    case kAutoPart:
    case kCheckboxPart:
    case kRadioPart:
    case kPushButtonPart:
    case kSquareButtonPart:
    case kInnerSpinButtonPart:
    case kListboxPart:
    case kMenulistPart:
    case kMeterPart:
    case kProgressBarPart:
    case kSliderHorizontalPart:
    case kSliderThumbHorizontalPart:
    case kSearchFieldPart:
    case kSearchFieldCancelButtonPart:
    case kTextAreaPart:
      return auto_appearance;

      // The following keywords should work well for some element types
      // even if their default appearances are different from the keywords.

    case kButtonPart:
      return (auto_appearance == kPushButtonPart ||
              auto_appearance == kSquareButtonPart)
                 ? part
                 : auto_appearance;

    case kMenulistButtonPart:
      return auto_appearance == kMenulistPart ? part : auto_appearance;

    case kSliderVerticalPart:
      return auto_appearance == kSliderHorizontalPart ? part : auto_appearance;

    case kSliderThumbVerticalPart:
      return auto_appearance == kSliderThumbHorizontalPart ? part
                                                           : auto_appearance;

    case kTextFieldPart:
      if (IsA<HTMLInputElement>(*element) &&
          To<HTMLInputElement>(*element).type() == input_type_names::kSearch)
        return part;
      return auto_appearance;
  }

  return part;
}

void LayoutTheme::AdjustStyle(const Element* e, ComputedStyle& style) {
  ControlPart original_part = style.Appearance();
  style.SetEffectiveAppearance(original_part);
  if (original_part == ControlPart::kNoControlPart)
    return;

  // Force inline and table display styles to be inline-block (except for table-
  // which is block)
  if (style.Display() == EDisplay::kInline ||
      style.Display() == EDisplay::kInlineTable ||
      style.Display() == EDisplay::kTableRowGroup ||
      style.Display() == EDisplay::kTableHeaderGroup ||
      style.Display() == EDisplay::kTableFooterGroup ||
      style.Display() == EDisplay::kTableRow ||
      style.Display() == EDisplay::kTableColumnGroup ||
      style.Display() == EDisplay::kTableColumn ||
      style.Display() == EDisplay::kTableCell ||
      style.Display() == EDisplay::kTableCaption)
    style.SetDisplay(EDisplay::kInlineBlock);
  else if (style.Display() == EDisplay::kListItem ||
           style.Display() == EDisplay::kTable)
    style.SetDisplay(EDisplay::kBlock);

  ControlPart part = AdjustAppearanceWithAuthorStyle(
      AdjustAppearanceWithElementType(style, e), style);
  style.SetEffectiveAppearance(part);
  DCHECK_NE(part, kAutoPart);
  if (part == kNoControlPart)
    return;
  DCHECK(e);
  // After this point, a Node must be non-null Element if
  // EffectiveAppearance() != kNoControlPart.

  AdjustControlPartStyle(style);

  // Call the appropriate style adjustment method based off the appearance
  // value.
  switch (part) {
    case kMenulistPart:
      return AdjustMenuListStyle(style);
    case kMenulistButtonPart:
      return AdjustMenuListButtonStyle(style);
    case kSliderThumbHorizontalPart:
    case kSliderThumbVerticalPart:
      return AdjustSliderThumbStyle(style);
    case kSearchFieldCancelButtonPart:
      return AdjustSearchFieldCancelButtonStyle(style);
    default:
      break;
  }

  if (IsSliderContainer(*e))
    AdjustSliderContainerStyle(*e, style);
}

String LayoutTheme::ExtraDefaultStyleSheet() {
  return g_empty_string;
}

String LayoutTheme::ExtraFullscreenStyleSheet() {
  return String();
}

Color LayoutTheme::ActiveSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  Color color = PlatformActiveSelectionBackgroundColor(color_scheme);
#if BUILDFLAG(IS_MAC)
  // BlendWithWhite() darkens Mac system colors too much.
  // Apply .8 (204/255) alpha instead, same as Safari.
  if (color_scheme == mojom::blink::ColorScheme::kDark)
    return Color(color.Red(), color.Green(), color.Blue(), 204);
#endif
  return color.BlendWithWhite();
}

Color LayoutTheme::InactiveSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveSelectionBackgroundColor(color_scheme)
      .BlendWithWhite();
}

Color LayoutTheme::ActiveSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformActiveSelectionForegroundColor(color_scheme);
}

Color LayoutTheme::InactiveSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveSelectionForegroundColor(color_scheme);
}

Color LayoutTheme::ActiveListBoxSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformActiveListBoxSelectionBackgroundColor(color_scheme);
}

Color LayoutTheme::InactiveListBoxSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveListBoxSelectionBackgroundColor(color_scheme);
}

Color LayoutTheme::ActiveListBoxSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformActiveListBoxSelectionForegroundColor(color_scheme);
}

Color LayoutTheme::InactiveListBoxSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveListBoxSelectionForegroundColor(color_scheme);
}

Color LayoutTheme::PlatformSpellingMarkerUnderlineColor() const {
  return Color(255, 0, 0);
}

Color LayoutTheme::PlatformGrammarMarkerUnderlineColor() const {
  return Color(192, 192, 192);
}

Color LayoutTheme::PlatformActiveSpellingMarkerHighlightColor() const {
  return Color(255, 0, 0, 102);
}

Color LayoutTheme::PlatformActiveSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  // Use a blue color by default if the platform theme doesn't define anything.
  return Color(0, 0, 255);
}

Color LayoutTheme::PlatformActiveSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  // Use a white color by default if the platform theme doesn't define anything.
  return Color::kWhite;
}

Color LayoutTheme::PlatformInactiveSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  // Use a grey color by default if the platform theme doesn't define anything.
  // This color matches Firefox's inactive color.
  return Color(176, 176, 176);
}

Color LayoutTheme::PlatformInactiveSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  // Use a black color by default.
  return Color::kBlack;
}

Color LayoutTheme::PlatformActiveListBoxSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformActiveSelectionBackgroundColor(color_scheme);
}

Color LayoutTheme::PlatformActiveListBoxSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformActiveSelectionForegroundColor(color_scheme);
}

Color LayoutTheme::PlatformInactiveListBoxSelectionBackgroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveSelectionBackgroundColor(color_scheme);
}

Color LayoutTheme::PlatformInactiveListBoxSelectionForegroundColor(
    mojom::blink::ColorScheme color_scheme) const {
  return PlatformInactiveSelectionForegroundColor(color_scheme);
}

bool LayoutTheme::IsControlStyled(ControlPart part,
                                  const ComputedStyle& style) const {
  switch (part) {
    case kPushButtonPart:
    case kSquareButtonPart:
    case kButtonPart:
    case kProgressBarPart:
      return style.HasAuthorBackground() || style.HasAuthorBorder();

    case kMenulistPart:
    case kSearchFieldPart:
    case kTextAreaPart:
    case kTextFieldPart:
      return style.HasAuthorBackground() || style.HasAuthorBorder() ||
             style.BoxShadow();

    default:
      return false;
  }
}

bool LayoutTheme::ShouldDrawDefaultFocusRing(const Node* node,
                                             const ComputedStyle& style) const {
  if (!node)
    return true;
  if (!style.HasEffectiveAppearance() && !node->IsLink())
    return true;
  // We can't use LayoutTheme::isFocused because outline:auto might be
  // specified to non-:focus rulesets.
  if (node->IsFocused() && !node->ShouldHaveFocusAppearance())
    return false;
  return true;
}

void LayoutTheme::AdjustCheckboxStyle(ComputedStyle& style) const {
  // A summary of the rules for checkbox designed to match WinIE:
  // width/height - honored (WinIE actually scales its control for small widths,
  // but lets it overflow for small heights.)
  // font-size - not honored (control has no text), but we use it to decide
  // which control size to use.
  SetCheckboxSize(style);

  // padding - not honored by WinIE, needs to be removed.
  style.ResetPadding();

  // border - honored by WinIE, but looks terrible (just paints in the control
  // box and turns off the Windows XP theme) for now, we will not honor it.
  style.ResetBorder();
}

void LayoutTheme::AdjustRadioStyle(ComputedStyle& style) const {
  // A summary of the rules for checkbox designed to match WinIE:
  // width/height - honored (WinIE actually scales its control for small widths,
  // but lets it overflow for small heights.)
  // font-size - not honored (control has no text), but we use it to decide
  // which control size to use.
  SetRadioSize(style);

  // padding - not honored by WinIE, needs to be removed.
  style.ResetPadding();

  // border - honored by WinIE, but looks terrible (just paints in the control
  // box and turns off the Windows XP theme) for now, we will not honor it.
  style.ResetBorder();
}

void LayoutTheme::AdjustButtonStyle(ComputedStyle& style) const {}

void LayoutTheme::AdjustInnerSpinButtonStyle(ComputedStyle&) const {}

void LayoutTheme::AdjustMenuListStyle(ComputedStyle& style) const {
  // Menulists should have visible overflow
  // https://bugs.webkit.org/show_bug.cgi?id=21287
  style.SetOverflowX(EOverflow::kVisible);
  style.SetOverflowY(EOverflow::kVisible);
}

void LayoutTheme::AdjustMenuListButtonStyle(ComputedStyle&) const {}

void LayoutTheme::AdjustSliderContainerStyle(const Element& e,
                                             ComputedStyle& style) const {
  DCHECK(IsSliderContainer(e));

  if (style.EffectiveAppearance() == kSliderVerticalPart) {
    style.SetTouchAction(TouchAction::kPanX);
    style.SetWritingMode(WritingMode::kVerticalRl);
    // It's always in RTL because the slider value increases up even in LTR.
    style.SetDirection(TextDirection::kRtl);
  } else {
    style.SetTouchAction(TouchAction::kPanY);
    style.SetWritingMode(WritingMode::kHorizontalTb);
    if (To<HTMLInputElement>(e.OwnerShadowHost())->list()) {
      style.SetAlignSelf(StyleSelfAlignmentData(ItemPosition::kCenter,
                                                OverflowAlignment::kUnsafe));
    }
  }
  style.SetEffectiveAppearance(kNoControlPart);
}

void LayoutTheme::AdjustSliderThumbStyle(ComputedStyle& style) const {
  AdjustSliderThumbSize(style);
}

void LayoutTheme::AdjustSliderThumbSize(ComputedStyle&) const {}

void LayoutTheme::AdjustSearchFieldCancelButtonStyle(ComputedStyle&) const {}

void LayoutTheme::PlatformColorsDidChange() {
  UpdateForcedColorsState();
  Page::PlatformColorsChanged();
}

void LayoutTheme::ColorSchemeDidChange() {
  Page::ColorSchemeChanged();
}

void LayoutTheme::ColorProvidersDidChange() {
  Page::ColorProvidersChanged();
}

void LayoutTheme::SetCaretBlinkInterval(base::TimeDelta interval) {
  caret_blink_interval_ = interval;
}

base::TimeDelta LayoutTheme::CaretBlinkInterval() const {
  // Disable the blinking caret in web test mode, as it introduces
  // a race condition for the pixel tests. http://b/1198440
  return WebTestSupport::IsRunningWebTest() ? base::TimeDelta()
                                            : caret_blink_interval_;
}

static FontDescription& GetCachedFontDescription(CSSValueID system_font_id) {
  DEFINE_STATIC_LOCAL(FontDescription, caption, ());
  DEFINE_STATIC_LOCAL(FontDescription, icon, ());
  DEFINE_STATIC_LOCAL(FontDescription, menu, ());
  DEFINE_STATIC_LOCAL(FontDescription, message_box, ());
  DEFINE_STATIC_LOCAL(FontDescription, small_caption, ());
  DEFINE_STATIC_LOCAL(FontDescription, status_bar, ());
  DEFINE_STATIC_LOCAL(FontDescription, webkit_mini_control, ());
  DEFINE_STATIC_LOCAL(FontDescription, webkit_small_control, ());
  DEFINE_STATIC_LOCAL(FontDescription, webkit_control, ());
  DEFINE_STATIC_LOCAL(FontDescription, default_description, ());
  switch (system_font_id) {
    case CSSValueID::kCaption:
      return caption;
    case CSSValueID::kIcon:
      return icon;
    case CSSValueID::kMenu:
      return menu;
    case CSSValueID::kMessageBox:
      return message_box;
    case CSSValueID::kSmallCaption:
      return small_caption;
    case CSSValueID::kStatusBar:
      return status_bar;
    case CSSValueID::kWebkitMiniControl:
      return webkit_mini_control;
    case CSSValueID::kWebkitSmallControl:
      return webkit_small_control;
    case CSSValueID::kWebkitControl:
      return webkit_control;
    case CSSValueID::kNone:
      return default_description;
    default:
      NOTREACHED();
      return default_description;
  }
}

void LayoutTheme::SystemFont(CSSValueID system_font_id,
                             FontDescription& font_description,
                             const Document* document) {
  font_description = GetCachedFontDescription(system_font_id);
  if (font_description.IsAbsoluteSize())
    return;

  font_description.SetStyle(
      LayoutThemeFontProvider::SystemFontStyle(system_font_id));
  font_description.SetWeight(
      LayoutThemeFontProvider::SystemFontWeight(system_font_id));
  font_description.SetSpecifiedSize(
      LayoutThemeFontProvider::SystemFontSize(system_font_id, document));
  font_description.SetIsAbsoluteSize(true);
  const AtomicString& system_font =
      LayoutThemeFontProvider::SystemFontFamily(system_font_id);
  font_description.FirstFamily().SetFamily(
      system_font, FontFamily::InferredTypeFor(system_font));
  font_description.SetGenericFamily(FontDescription::kNoFamily);
}

Color LayoutTheme::SystemColor(CSSValueID css_value_id,
                               mojom::blink::ColorScheme color_scheme) const {
  if (!WebTestSupport::IsRunningWebTest() && InForcedColorsMode())
    return SystemColorFromNativeTheme(css_value_id, color_scheme);
  return DefaultSystemColor(css_value_id, color_scheme);
}

Color LayoutTheme::DefaultSystemColor(
    CSSValueID css_value_id,
    mojom::blink::ColorScheme color_scheme) const {
  switch (css_value_id) {
    case CSSValueID::kActiveborder:
      return 0xFFFFFFFF;
    case CSSValueID::kActivecaption:
      return 0xFFCCCCCC;
    case CSSValueID::kActivetext:
      return 0xFFFF0000;
    case CSSValueID::kAppworkspace:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF000000
                                                              : 0xFFFFFFFF;
    case CSSValueID::kBackground:
      return 0xFF6363CE;
    case CSSValueID::kButtonborder:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF6B6B6B
                                                              : 0xFF767676;
    case CSSValueID::kButtonface:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF444444
                                                              : 0xFFDDDDDD;
    case CSSValueID::kButtonhighlight:
      return 0xFFDDDDDD;
    case CSSValueID::kButtonshadow:
      return 0xFF888888;
    case CSSValueID::kButtontext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kCaptiontext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kField:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF000000
                                                              : 0xFFFFFFFF;
    case CSSValueID::kFieldtext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kGraytext:
      return 0xFF808080;
    case CSSValueID::kHighlight:
      return 0xFFB5D5FF;
    case CSSValueID::kHighlighttext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kInactiveborder:
      return 0xFFFFFFFF;
    case CSSValueID::kInactivecaption:
      return 0xFFFFFFFF;
    case CSSValueID::kInactivecaptiontext:
      return 0xFF7F7F7F;
    case CSSValueID::kInfobackground:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFB46E32
                                                              : 0xFFFBFCC5;
    case CSSValueID::kInfotext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kLinktext:
      return 0xFF0000EE;
    case CSSValueID::kMark:
      return 0xFFFFFF00;
    case CSSValueID::kMarktext:
      return 0xFF000000;
    case CSSValueID::kMenu:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF404040
                                                              : 0xFFF7F7F7;
    case CSSValueID::kMenutext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kScrollbar:
      return 0xFFFFFFFF;
    case CSSValueID::kText:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kThreeddarkshadow:
      return 0xFF666666;
    case CSSValueID::kThreedface:
      return 0xFFC0C0C0;
    case CSSValueID::kThreedhighlight:
      return 0xFFDDDDDD;
    case CSSValueID::kThreedlightshadow:
      return 0xFFC0C0C0;
    case CSSValueID::kThreedshadow:
      return 0xFF888888;
    case CSSValueID::kVisitedtext:
      return 0xFF551A8B;
    case CSSValueID::kWindow:
    case CSSValueID::kCanvas:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFF000000
                                                              : 0xFFFFFFFF;
    case CSSValueID::kWindowframe:
      return 0xFFCCCCCC;
    case CSSValueID::kWindowtext:
    case CSSValueID::kCanvastext:
      return color_scheme == mojom::blink::ColorScheme::kDark ? 0xFFFFFFFF
                                                              : 0xFF000000;
    case CSSValueID::kInternalActiveListBoxSelection:
      return ActiveListBoxSelectionBackgroundColor(color_scheme);
    case CSSValueID::kInternalActiveListBoxSelectionText:
      return ActiveListBoxSelectionForegroundColor(color_scheme);
    case CSSValueID::kInternalInactiveListBoxSelection:
      return InactiveListBoxSelectionBackgroundColor(color_scheme);
    case CSSValueID::kInternalInactiveListBoxSelectionText:
      return InactiveListBoxSelectionForegroundColor(color_scheme);
    default:
      break;
  }
  NOTREACHED();
  return Color();
}

Color LayoutTheme::SystemColorFromNativeTheme(
    CSSValueID css_value_id,
    mojom::blink::ColorScheme color_scheme) const {
  blink::WebThemeEngine::SystemThemeColor theme_color;
  switch (css_value_id) {
    case CSSValueID::kActivetext:
    case CSSValueID::kLinktext:
    case CSSValueID::kVisitedtext:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kHotlight;
      break;
    case CSSValueID::kButtonface:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kButtonFace;
      break;
    case CSSValueID::kButtonborder:
    case CSSValueID::kButtontext:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kButtonText;
      break;
    case CSSValueID::kGraytext:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kGrayText;
      break;
    case CSSValueID::kHighlight:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kHighlight;
      break;
    case CSSValueID::kHighlighttext:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kHighlightText;
      break;
    case CSSValueID::kWindow:
    case CSSValueID::kCanvas:
    case CSSValueID::kField:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kWindow;
      break;
    case CSSValueID::kWindowtext:
    case CSSValueID::kCanvastext:
    case CSSValueID::kFieldtext:
      theme_color = blink::WebThemeEngine::SystemThemeColor::kWindowText;
      break;
    default:
      return DefaultSystemColor(css_value_id, color_scheme);
  }
  DCHECK(Platform::Current() && Platform::Current()->ThemeEngine());
  const absl::optional<SkColor> system_color =
      Platform::Current()->ThemeEngine()->GetSystemColor(theme_color);
  if (system_color)
    return Color(system_color.value());
  return DefaultSystemColor(css_value_id, color_scheme);
}

Color LayoutTheme::PlatformTextSearchHighlightColor(
    bool active_match,
    mojom::blink::ColorScheme color_scheme) const {
  if (active_match) {
    if (InForcedColorsMode())
      return GetTheme().SystemColor(CSSValueID::kHighlight, color_scheme);
    return Color(255, 150, 50);  // Orange.
  }
  return Color(255, 255, 0);     // Yellow.
}

Color LayoutTheme::PlatformTextSearchColor(
    bool active_match,
    mojom::blink::ColorScheme color_scheme) const {
  if (InForcedColorsMode() && active_match)
    return GetTheme().SystemColor(CSSValueID::kHighlighttext, color_scheme);
  return Color::kBlack;
}

Color LayoutTheme::TapHighlightColor() {
  return GetTheme().PlatformTapHighlightColor();
}

void LayoutTheme::SetCustomFocusRingColor(const Color& c) {
  custom_focus_ring_color_ = c;
  has_custom_focus_ring_color_ = true;
}

Color LayoutTheme::FocusRingColor(
    mojom::blink::ColorScheme color_scheme) const {
  return has_custom_focus_ring_color_ ? custom_focus_ring_color_
                                      : GetTheme().PlatformFocusRingColor();
}

bool LayoutTheme::DelegatesMenuListRendering() const {
  return delegates_menu_list_rendering_;
}

void LayoutTheme::SetDelegatesMenuListRenderingForTesting(bool flag) {
  delegates_menu_list_rendering_ = flag;
}

String LayoutTheme::DisplayNameForFile(const File& file) const {
  return file.name();
}

bool LayoutTheme::SupportsCalendarPicker(const AtomicString& type) const {
  DCHECK(RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled());
  if (type == input_type_names::kTime)
    return true;

  return type == input_type_names::kDate ||
         type == input_type_names::kDatetime ||
         type == input_type_names::kDatetimeLocal ||
         type == input_type_names::kMonth || type == input_type_names::kWeek;
}

void LayoutTheme::AdjustControlPartStyle(ComputedStyle& style) {
  // Call the appropriate style adjustment method based off the appearance
  // value.
  switch (style.EffectiveAppearance()) {
    case kCheckboxPart:
      return AdjustCheckboxStyle(style);
    case kRadioPart:
      return AdjustRadioStyle(style);
    case kPushButtonPart:
    case kSquareButtonPart:
    case kButtonPart:
      return AdjustButtonStyle(style);
    case kInnerSpinButtonPart:
      return AdjustInnerSpinButtonStyle(style);
    default:
      break;
  }
}

bool LayoutTheme::HasCustomFocusRingColor() const {
  return has_custom_focus_ring_color_;
}

Color LayoutTheme::GetCustomFocusRingColor() const {
  return custom_focus_ring_color_;
}

void LayoutTheme::UpdateForcedColorsState() {
  in_forced_colors_mode_ =
      Platform::Current() && Platform::Current()->ThemeEngine() &&
      Platform::Current()->ThemeEngine()->GetForcedColors() !=
          ForcedColors::kNone;
}

}  // namespace blink


text:
**Extends WSDropdown**

This component provides another way to hav a multi select with dropdown.
It renders an input which opens a dropdown on focus. Items selected from the dropdown
appear in a list below the input.

**Properties**

-   `filtered` **[boolean][1]** Must be true to tell the underlaying dropdown that the filtering is outside

### componentDidMount

Bind event listeners when attached to DOM

Returns **void**

### componentWillUnmount

Unbind event listeners before detaching from dom

Returns **void**

### onClickIcon

Focus input on icon click

**Parameters**

-   `event` **[MouseEvent][2]** JavaScript event object

Returns **void**

### onKeyUp

Handle input change

**Parameters**

-   `event` **[KeyboardEvent][3]** JavaScript event object

Returns **void**

### onFocus

Opening dropdown when focusing the input

**Parameters**

-   `event` **[Event][4]** JavaScript event object

Returns **void**

### onBlur

Close dropdown when blurring the input

**Parameters**

-   `event` **[Object][5]** JavaScript event object

Returns **void**

### stopPropagation

Stop propagation of native change events

**Parameters**

-   `event` **[Event][4]** JavaScript event object

Returns **void**

### setValue

Create new value

**Parameters**

-   `item` **[Object][5]** Selected item

Returns **void**

### removeItem

Remove clicked item from value list

**Parameters**

-   `item` **[Object][5]** Clicked item

Returns **void**

### renderTrigger

Returns **JSX**

### render

Returns **JSX**

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[2]: https://developer.mozilla.org/docs/Web/API/MouseEvent

[3]: https://developer.mozilla.org/docs/Web/API/KeyboardEvent

[4]: https://developer.mozilla.org/docs/Web/API/Event

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object


text:
package endpoints

// TODO: The API is not yet implemented.

import (
	"context"
	"encoding/json"
	"errors"
	"strings"

	clientv3 "go.etcd.io/etcd/client/v3"
	"go.etcd.io/etcd/client/v3/naming/endpoints/internal"

	"go.uber.org/zap"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)

type endpointManager struct {
	// Client is an initialized etcd client.
	client *clientv3.Client
	target string
}

// NewManager creates an endpoint manager which implements the interface of 'Manager'.
func NewManager(client *clientv3.Client, target string) (Manager, error) {
	if client == nil {
		return nil, errors.New("invalid etcd client")
	}

	if target == "" {
		return nil, errors.New("invalid target")
	}

	em := &endpointManager{
		client: client,
		target: target,
	}
	return em, nil
}

func (m *endpointManager) Update(ctx context.Context, updates []*UpdateWithOpts) (err error) {
	ops := make([]clientv3.Op, 0, len(updates))
	for _, update := range updates {
		if !strings.HasPrefix(update.Key, m.target+"/") {
			return status.Errorf(codes.InvalidArgument, "endpoints: endpoint key should be prefixed with '%s/' got: '%s'", m.target, update.Key)
		}

		switch update.Op {
		case Add:
			internalUpdate := &internal.Update{
				Op:       internal.Add,
				Addr:     update.Endpoint.Addr,
				Metadata: update.Endpoint.Metadata,
			}

			var v []byte
			if v, err = json.Marshal(internalUpdate); err != nil {
				return status.Error(codes.InvalidArgument, err.Error())
			}
			ops = append(ops, clientv3.OpPut(update.Key, string(v), update.Opts...))
		case Delete:
			ops = append(ops, clientv3.OpDelete(update.Key, update.Opts...))
		default:
			return status.Error(codes.InvalidArgument, "endpoints: bad update op")
		}
	}
	_, err = m.client.KV.Txn(ctx).Then(ops...).Commit()
	return err
}

func (m *endpointManager) AddEndpoint(ctx context.Context, key string, endpoint Endpoint, opts ...clientv3.OpOption) error {
	return m.Update(ctx, []*UpdateWithOpts{NewAddUpdateOpts(key, endpoint, opts...)})
}

func (m *endpointManager) DeleteEndpoint(ctx context.Context, key string, opts ...clientv3.OpOption) error {
	return m.Update(ctx, []*UpdateWithOpts{NewDeleteUpdateOpts(key, opts...)})
}

func (m *endpointManager) NewWatchChannel(ctx context.Context) (WatchChannel, error) {
	resp, err := m.client.Get(ctx, m.target, clientv3.WithPrefix(), clientv3.WithSerializable())
	if err != nil {
		return nil, err
	}

	lg := m.client.GetLogger()
	initUpdates := make([]*Update, 0, len(resp.Kvs))
	for _, kv := range resp.Kvs {
		var iup internal.Update
		if err := json.Unmarshal(kv.Value, &iup); err != nil {
			lg.Warn("unmarshal endpoint update failed", zap.String("key", string(kv.Key)), zap.Error(err))
			continue
		}
		up := &Update{
			Op:       Add,
			Key:      string(kv.Key),
			Endpoint: Endpoint{Addr: iup.Addr, Metadata: iup.Metadata},
		}
		initUpdates = append(initUpdates, up)
	}

	upch := make(chan []*Update, 1)
	if len(initUpdates) > 0 {
		upch <- initUpdates
	}
	go m.watch(ctx, resp.Header.Revision+1, upch)
	return upch, nil
}

func (m *endpointManager) watch(ctx context.Context, rev int64, upch chan []*Update) {
	defer close(upch)

	lg := m.client.GetLogger()
	opts := []clientv3.OpOption{clientv3.WithRev(rev), clientv3.WithPrefix()}
	wch := m.client.Watch(ctx, m.target, opts...)
	for {
		select {
		case <-ctx.Done():
			return
		case wresp, ok := <-wch:
			if !ok {
				lg.Warn("watch closed", zap.String("target", m.target))
				return
			}
			if wresp.Err() != nil {
				lg.Warn("watch failed", zap.String("target", m.target), zap.Error(wresp.Err()))
				return
			}

			deltaUps := make([]*Update, 0, len(wresp.Events))
			for _, e := range wresp.Events {
				var iup internal.Update
				var err error
				var op Operation
				switch e.Type {
				case clientv3.EventTypePut:
					err = json.Unmarshal(e.Kv.Value, &iup)
					op = Add
					if err != nil {
						lg.Warn("unmarshal endpoint update failed", zap.String("key", string(e.Kv.Key)), zap.Error(err))
						continue
					}
				case clientv3.EventTypeDelete:
					iup = internal.Update{Op: internal.Delete}
					op = Delete
				default:
					continue
				}
				up := &Update{Op: op, Key: string(e.Kv.Key), Endpoint: Endpoint{Addr: iup.Addr, Metadata: iup.Metadata}}
				deltaUps = append(deltaUps, up)
			}
			if len(deltaUps) > 0 {
				upch <- deltaUps
			}
		}
	}
}

func (m *endpointManager) List(ctx context.Context) (Key2EndpointMap, error) {
	resp, err := m.client.Get(ctx, m.target, clientv3.WithPrefix(), clientv3.WithSerializable())
	if err != nil {
		return nil, err
	}

	eps := make(Key2EndpointMap)
	for _, kv := range resp.Kvs {
		var iup internal.Update
		if err := json.Unmarshal(kv.Value, &iup); err != nil {
			continue
		}

		eps[string(kv.Key)] = Endpoint{Addr: iup.Addr, Metadata: iup.Metadata}
	}
	return eps, nil
}


text:
package org.n52.iceland.binding;

/**
 * Constants for Binding. Contains endpoint definitions.
 * @since 1.0.0
 *
 */
public interface BindingConstants {

    String SOAP_BINDING_ENDPOINT = "/soap";

    String POX_BINDING_ENDPOINT = "/pox";

    String KVP_BINDING_ENDPOINT = "/kvp";

}


text:
/**
 * Blessed
 */

function blessed() {
  return blessed.program.apply(null, arguments);
}

blessed.program = blessed.Program = require('./program');
blessed.tput = blessed.Tput = require('./tput');
blessed.widget = require('./widget');
blessed.colors = require('./colors');
blessed.unicode = require('./unicode');
blessed.helpers = require('./helpers');

blessed.helpers.sprintf = blessed.tput.sprintf;
blessed.helpers.tryRead = blessed.tput.tryRead;
blessed.helpers.merge(blessed, blessed.helpers);

blessed.helpers.merge(blessed, blessed.widget);

/**
 * Expose
 */

module.exports = blessed;


text:
layout: center
permalink: /404.html
---

# 404

My apologies dear friend, but these are not the droids you are looking for. Or really anything. If you're looking for a blog post, [this is where you shall find it]({{ site.baseurl }}/writing).

  Home
  Contact


text:
package de.plushnikov.enumid;

import lombok.EnumId;
import lombok.RequiredArgsConstructor;
import lombok.Getter;

public class EnumIdExample {
    @RequiredArgsConstructor
    public enum Status {
        WAITING(0),
        READY(1),
        SKIPPED(-1),
        COMPLETED(5);

        @EnumId
        @Getter
        private final int code;
    }

    public static void main(String[] args) {
        Status x = Status.COMPLETED;
        x = Status.findByCode(0);
        System.out.println(Status.COMPLETED.getCode());
        System.out.println(x);
    }
}


text:
set -o errexit
set -o nounset
set -o pipefail

export GO111MODULE=on

readonly REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
readonly TMP_DIFFROOT="$(mktemp -d -p ${REPO_ROOT_DIR})"

cleanup() {
  rm -rf "${TMP_DIFFROOT}"
}

trap "cleanup" EXIT SIGINT

cleanup

# Save working tree state
mkdir -p "${TMP_DIFFROOT}/pkg"
cp -aR "${REPO_ROOT_DIR}/go.sum" "${REPO_ROOT_DIR}/pkg" "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}"

# TODO(mattmoor): We should be able to rm -rf pkg/client/ and vendor/

"${REPO_ROOT_DIR}/hack/update-codegen.sh"
echo "Diffing ${REPO_ROOT_DIR} against freshly generated codegen"
ret=0

diff -Naupr "${REPO_ROOT_DIR}/pkg" "${TMP_DIFFROOT}/pkg" || ret=1
diff -Naupr --no-dereference "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1

# Restore working tree state
rm -fr "${TMP_DIFFROOT}/config"
rm -fr "${REPO_ROOT_DIR}/go.sum"  "${REPO_ROOT_DIR}/pkg" "${REPO_ROOT_DIR}/vendor"
cp -aR "${TMP_DIFFROOT}"/* "${REPO_ROOT_DIR}"

if [[ $ret -eq 0 ]]
then
  echo "${REPO_ROOT_DIR} up to date."
else
  echo "ERROR: ${REPO_ROOT_DIR} is out of date. Please run ./hack/update-codegen.sh"
  exit 1
fi


text:
<?php

namespace OroCRM\Bundle\CampaignBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Oro\Bundle\SecurityBundle\Annotation\AclAncestor;
use Oro\Bundle\DataGridBundle\Extension\Pager\PagerInterface;

use OroCRM\Bundle\CampaignBundle\Entity\Campaign;

/**
 * @Route("/campaign/event")
 */
class CampaignEventController extends Controller
{
    /**
     * @param string $period
     * @param string $campaignCode
     * @return array
     *
     * @Route("/plot/{period}/{campaignCode}", name="orocrm_campaign_event_plot")
     * @AclAncestor("orocrm_campaign_view")
     * @Template
     */
    public function plotAction($period, $campaignCode)
    {
        $supportedPeriods = [
            Campaign::PERIOD_HOURLY,
            Campaign::PERIOD_DAILY,
            Campaign::PERIOD_MONTHLY,
        ];
        if (!in_array($period, $supportedPeriods)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Supported periods are: %s. %s given',
                    implode(', ', $supportedPeriods),
                    $period
                )
            );
        }

        $gridName = sprintf('campaign-tracking-detailed-report-%s-grid', $period);

        $gridParameters = [
            'code'                           => $campaignCode,
            PagerInterface::PAGER_ROOT_PARAM => [
                PagerInterface::DISABLED_PARAM => true
            ]
        ];

        $datagrid = $this
            ->get('oro_datagrid.datagrid.manager')
            ->getDatagridByRequestParams(
                $gridName,
                $gridParameters
            );

        $chartName = 'campaign_line_chart';
        $chartView = $this
            ->get('oro_chart.view_builder')
            ->setDataGrid($datagrid)
            ->setOptions(
                array_merge_recursive(
                    [
                        'name'             => $chartName,
                        'default_settings' => [
                            'period' => $period
                        ]
                    ],
                    $this
                        ->get('oro_chart.config_provider')
                        ->getChartConfig($chartName)
                )
            )
            ->getView();

        return [
            'chartView' => $chartView
        ];
    }
}