text:
import IndexMap from '../source/IndexMap.js';
import TransformedSource from '../source/TransformedSource.js';
import DiagnosticMessage from '../diagnostics/DiagnosticMessage.js';

const trigraphMap = {
	'=': '#',
	'(': '[',
	'/': '\\',
	')': ']',
	'\'': '^',
	'<': '{',
	'!': '|',
	'>': '}',
	'-': '~'
};

export default class TrigraphParser {

	static process(context, source) {
		let content = source.content();
		let startIndex = 0;
		let builder = '';
		let mapping = null;

		for (let i = 0; i < content.length - 2; i++) {
			if (content[i] === '?' && content[i + 1] === '?') {
				if (content[i + 2] in trigraphMap) {
					context.emitDiagnostics(new DiagnosticMessage(DiagnosticMessage.LEVEL_WARNING, 'Use of trigraph is discouraged', source.range(i, i + 2, i + 3)));

					if (!builder) {
						mapping = new IndexMap();
					}
					builder += content.substring(startIndex, i);
					builder += trigraphMap[content[i + 2]];
					i += 2;
					startIndex = i + 1;
					mapping.addMapping(builder.length, startIndex);
				}
			}
		}

		if (!builder) {
			return source;
		} else {
			builder += content.substring(startIndex);
			return new TransformedSource(source, builder, mapping);
		}
	}

}


text:
package org.apache.lucene.gdata.server.registry.configuration;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import org.apache.lucene.gdata.utils.ReflectionUtils;

/**
 * PropertyInjector is used to set member variables / properties of classes via
 * setter methods using the
 * {@link org.apache.lucene.gdata.server.registry.configuration.ComponentConfiguration}
 * class.
 *

 * To populate a object with properties from a ComponentConfiguration instance
 * the class or a superclass of the object to populate has to provide at least
 * one setter method with a single parameter. The object to populate is set via
 * the {@link PropertyInjector#setTargetObject} method. The class of the object
 * will be analyzed for setter methods having a "set" prefix in their method
 * name. If one of the found setter methods is annotated with
 * {@link org.apache.lucene.gdata.server.registry.configuration.Requiered} this
 * property is interpreted as a mandatory property. Mandatory properties must be
 * available in the provided ComponentConfiguration, if not the injection will
 * fail.

 * The
 * {@link org.apache.lucene.gdata.server.registry.configuration.ComponentConfiguration}
 * contains key / value pairs where the key must match the signature of the
 * setter method without the 'set' prefix and must begin with a lower case
 * character. KeybufferSize does match a method signature
 * of setBufferSize The type of the parameter will be
 * reflected via the Reflection API and instantiated with the given value if
 * possible.
 *

 *

 * Setter methods without a Required annotation will be set if
 * the property is present in the ComponentConfiguration
 *

 *
This class does not support overloaded setter methods.

 * @author Simon Willnauer
 * @see org.apache.lucene.gdata.server.registry.configuration.Requiered
 * @see org.apache.lucene.gdata.server.registry.configuration.ComponentConfiguration
 */
public class PropertyInjector {
    private static final String SETTER_PREFIX = "set";

    private Class targetClass;

    private Object target;

    private Map<String, Method> requieredProperties = new HashMap<String, Method>();

    private Map<String, Method> optionalProperties = new HashMap<String, Method>();

    /**
     * Sets the object to be populated with the properties provided in the ComponentConfiguration.
     * @param o - the object to populate
     */
    public void setTargetObject(final Object o) {
        if (o == null)
            throw new IllegalArgumentException("TargetObject must not be null");
        this.target = o;
        this.targetClass = o.getClass();
        try {
            registerProperties(this.targetClass);
        } catch (Exception e) {
            throw new InjectionException("can access field -- "
                    + e.getMessage(), e);

        }
        if (this.requieredProperties.isEmpty()
                && this.optionalProperties.isEmpty())
            throw new InjectionException(
                    "Given type has no public setter methods -- "
                            + o.getClass().getName());

    }

    protected int getRequiredSize() {
        return this.requieredProperties.size();
    }

    protected int getOptionalSize() {
        return this.optionalProperties.size();
    }

    private void registerProperties(final Class clazz)
            throws SecurityException, NoSuchFieldException {
        if (clazz == null)
            return;
        Method[] methodes = clazz.getMethods();
        for (int i = 0; i < methodes.length; i++) {
            if (methodes[i].getName()
                    .startsWith(PropertyInjector.SETTER_PREFIX)) {
                String methodName = methodes[i].getName();
                String fieldName = getFieldName(methodName);
                if (methodes[i].getAnnotation(Requiered.class) != null)
                    this.requieredProperties.put(fieldName, methodes[i]);
                else
                    this.optionalProperties.put(fieldName, methodes[i]);

            }

        }
        registerProperties(clazz.getSuperclass());
    }

    private String getFieldName(final String setterMethodName) {
        // remove 'set' prefix --> first char as lowerCase
        String retVal = setterMethodName.substring(3);
        String firstLetter = retVal.substring(0, 1);
        retVal = retVal.replaceFirst(firstLetter, firstLetter.toLowerCase());
        return retVal;
    }

    /**
     * Injects the properties stored in the ComponentConfiguration
     * to the corresponding methods of the target object
     * @param bean - configuration bean containing all properties to set.
     *
     */
    public void injectProperties(final ComponentConfiguration bean) {
        if (bean == null)
            throw new IllegalArgumentException("bean must not be null");
        if (this.target == null)
            throw new IllegalStateException("target is not set -- null");
        Set<Entry<String, Method>> requiered = this.requieredProperties
                .entrySet();
        // set required properties
        for (Entry<String, Method> entry : requiered) {
            if (!bean.contains(entry.getKey()))
                throw new InjectionException(
                        "Required property can not be set -- value not in configuration bean; Property: "
                                + entry.getKey()
                                + "for class "
                                + this.targetClass.getName());
            populate(bean, entry);

        }
        Set<Entry<String, Method>> optinal = this.optionalProperties.entrySet();
        // set optional properties
        for (Entry<String, Method> entry : optinal) {
            if (bean.contains(entry.getKey()))
                populate(bean, entry);
        }

    }

    private void populate(ComponentConfiguration bean,
            Entry<String, Method> entry) {
        String value = bean.get(entry.getKey());
        Method m = entry.getValue();
        Class<?>[] parameterTypes = m.getParameterTypes();
        if (parameterTypes.length > 1)
            throw new InjectionException("Setter has more than one parameter "
                    + m.getName() + " -- can not invoke method -- ");
        Object parameter = null;
        try {

            parameter = createObject(value, parameterTypes[0]);
        } catch (InjectionException e) {
            throw new InjectionException(
                    "parameter object creation failed for method "
                            + m.getName() + " in class: "
                            + this.targetClass.getName(), e);
        }
        // only setters with one parameter are supported
        Object[] parameters = { parameter };
        try {
            m.invoke(this.target, parameters);
        } catch (Exception e) {
            throw new InjectionException("Can not set value of type "
                    + value.getClass().getName()
                    + " -- can not invoke method -- " + e.getMessage(), e);

        }
    }

    private Object createObject(String s, Class<?> clazz) {

        try {
            // if class is requested use s as fully qualified class name
            if (clazz == Class.class)
                return Class.forName(s);
            // check for primitive type
            if (clazz.isPrimitive())
                clazz = ReflectionUtils.getPrimitiveWrapper(clazz);
            boolean defaultConst = false;
            boolean stringConst = false;
            Constructor[] constructors = clazz.getConstructors();
            if (constructors.length == 0)
                defaultConst = true;
            for (int i = 0; i < constructors.length; i++) {
                if (constructors[i].getParameterTypes().length == 0) {
                    defaultConst = true;
                    continue;
                }
                if (constructors[i].getParameterTypes().length == 1
                        && constructors[i].getParameterTypes()[0]
                                .equals(String.class))
                    stringConst = true;
            }
            /*
             * if there is a string constructor use the string as a parameter
             */
            if (stringConst) {
                Constructor constructor = clazz
                        .getConstructor(new Class[] { String.class });
                return constructor.newInstance(new Object[] { s });
            }
            /*
             * if no string const. but a default const. -- use the string as a
             * class name
             */
            if (defaultConst)
                return Class.forName(s).newInstance();
            throw new InjectionException(
                    "Parameter can not be created -- no default or String constructor found for class "
                            + clazz.getName());

        } catch (Exception e) {

            throw new InjectionException("can not create object for setter", e);
        }

    }

    /**
     * Sets all members to their default values and clears the internal used
     * {@link Map} instances
     *
     * @see Map#clear()
     */
    public void clear() {
        this.target = null;
        this.targetClass = null;
        this.optionalProperties.clear();
        this.requieredProperties.clear();
    }

}

redpajama_set_name: RedPajamaGithub


text:
dudeName="HardTef"
ladyName="HardJulie"
# --
while true
do
  #echo -e "HTTP/1.1 200 OK\nContent-type: text/html\n\n$(echo 'Hello Tef from Bash' | base64)" \
  # RETURN DATA TO CLIENT
  echo -e "HTTP/1.1 200 OK\n"\
"Access-Control-Allow-Origin: *\n"\
"Content-type: text/html\n\n"\
"$(echo 'DATA FROM SERVER: \n'\
        'Hello World from the localServer [Bash] !'\
        '%s[color: #FE524C]INFOS:%s[color: #050504] from the localServer =>' "${dudeName}" 'welcomed' "$ladyName" '[Bash]'\
  | base64)" \
      | nc -l -p 3000 \
        | head -1 \
          | while read -a lines
            do
              # LOG DATA TO SERVER TERMINAL
              echo -e "\n\nDATA FROM CLIENT:"
              echo ${lines[1]:14} | base64 -d;
              # TODO: parse the dude & lady names, display that as client infos, and write to a fifo that inputs to nc in order to respond dynamic stuff
              echo;
            done;
done;


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.engine.impl.history.async.json.transformer;

import org.flowable.engine.impl.history.async.HistoryJsonConstants;
import org.flowable.engine.impl.interceptor.CommandContext;

import com.fasterxml.jackson.databind.node.ObjectNode;

public abstract class AbstractNeedsTaskHistoryJsonTransformer extends AbstractHistoryJsonTransformer {

    @Override
    public boolean isApplicable(ObjectNode historicalData, CommandContext commandContext) {
        String taskId = getStringFromJson(historicalData, HistoryJsonConstants.ID);
        return commandContext.getHistoricTaskInstanceEntityManager().findById(taskId) != null;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using NinthChevron.Data.Expressions;

namespace NinthChevron.Data.Converters
{
    internal class ConstantConverter : BaseConverter<ConstantExpression>
    {
        internal ConstantConverter() : base(ExpressionType.Constant) { }

        public override Expression Convert(ExpressionConverter converter, ConstantExpression expression)
        {
            if (typeof(IInternalQuery).IsAssignableFrom(expression.Type))
            {
                IInternalQuery set = (IInternalQuery)expression.Value;
                return converter.CreateQuery(set.Context, expression.Type.GetGenericArguments()[0]);
            }

            object[] attributes = expression.Type.GetCustomAttributes(typeof(SqlKeywordAttribute), true);
            if (attributes != null && attributes.Length > 0)
                return new KeywordExpression(expression.Value);

            return expression;
        }
    }
}


text:
package mpei.bkm.model.logic.statement;

import mpei.bkm.model.commonfeatures.InnerPart;

public class Imp extends Statement {
    @InnerPart
    private Statement left;
    @InnerPart
    private Statement right;

    public Imp(Statement left, Statement right) {
        super();

        this.left = left;
        this.right = right;
    }

    public Statement getLeft() {
        return left;
    }

    public void setLeft(Statement left) {
        this.left = left;
    }

    public Statement getRight() {
        return right;
    }

    public void setRight(Statement right) {
        this.right = right;
    }
}


text:
layout: post
title:  "#EnglishGrammar, Lesson Forty-four - Expressões Idiomáticas D, E, F"
date: 2017-06-12 23:26:00
categories: English grammar lesson
---

**D**

**dare come what may** | topar com qualquer parada
**day after day = day in, day out** | todos os dias
**dead as a door nail** | mortinho da Silva
**dead easy** | facílimo
**dead end** | beco sem saída
**die for joy** | morrer de alegria
**dilly-dally** | perder tempo, embromar
**dirt-cheap** | baratíssimo
**dirty look** | olhar feio
**doctor up** | falsificar
**dog one's steps** | seguir alguém
**do in** | matar, surrar
**don't be long** | não se demorar
**don't judge a book by its cover** | as aparência enganam
**don't mention it** | de nada, não tem de que (inglaterra)
**do one's best** | fazer o melhor possível
**do the death** | repetir exageradamente
**doublecross** | trair
**double talk** | conversa mole
**do up brown** | fazer algo por completo
**do well by someone** | tratar bem alguém
**down and out** | acabado, falido
**down at the heels** | necessitado, em dificuladde
**down on one's luck** | azarado
**down-to-earth** | simples, direto; com os pés no chão
**do you happen to...** | por acaso você...
**draw aside** | chamar de lado
**drawing cards** | atração principal de um espetáculo
**draw interest** | render juros
**dream boat** | namorado ideal, homem atraente
**dress a window** | decorar uma vitrina
**dressed fit to kill** | muito bem vestido
**drive a bargain** | pechinchar
**drive one to the wall** | colocar alguém em situação difícil
**drown in one's own juice** | sofres as más consequências
**drum up** | fazer reclame
**dry behind the ears** | adulto experiente
**dry up!** | cale-se!
**duck out** | fugir, escapar
**dumbbell** | pessoa estúpida
**dyed-in-the-wool** | fanático

**E**

**each man for himself and God for all** | um por si e Deus por todos
**each one to his trade** | cada macaco no seu galho
**each to his own taste** | cada louco com sua mania
**ease someone of/out of** | tirar, roubar
**ease up** | acalmar-se
**easy going** | amigável, natural
**eat crow** | rebaixar-se
**eat humble pie** | humilhar-se. desculpar-se
**eat one's head off** | censurar, comer muito; não valer o que come
**eat one's heart out** | sofrer em silêncio
**eat one's words** | retirar o que disse
**eat out of house and home** | levar à ruina
**ebb of life** | velhice
**egghead** | pessoa intelectual
**egg on** | encorajar, provocar
**eke out** | ganhar a vida com sacrifícios
**elbow one's way** | abrir caminho à força
**empty** | faminto, inútil, desocupado, fútil
**end justifies the means** | o fim justifica os meios
**end to end** | de cabo a rabo
**even or odd** | par ou ímpar
**even so** | mesmo assim
**every little while** | de vez quando
**every mother's son** | todos sem exceção
**everything comes to him who waits** | quem espera sempre alcança
**experience is the mother of wisdom** | a experiência é a mãe da sabedoria
**eve-opener** | aperitivo

**F**

**faced with** | diante de
**face it out** | fazer frente a; enfrentar, assumir a reponsabilidade
**face to face** | frente a frente
**face the music** | aguentar as consequências
**face up to** | enfrentar a realidade sem medo
**fair and square** | honesto, justo
**fair to middling** | passável, mais ou menos
**fair-weather friend** | amigo só nas horas boas
**fall asleep at the switch** | dormir no ponto
**fall down on job** | não dar conta do recado
**fall for** | ser enganado; enamorar-se, prender-se a alguém
**fall guy** | bode expiatório
**fall in love (with)** | apaixonar-se por alguém
**fall on one's feet** | sair-se de uma situação difícil; ter sorte inexperada
**faltar an excuse** | balbuciar uma desculpa
**fancy that!** | imagine só!
**far and away** | sem sombra de dúvida
**far be it from me!** | longe de mim!
**farewell** | adeus!
**fast asleep** | em sono profundo
**fasten one's eye on** | fixar/pregar os olhos em alguém
**feel at home** | ficar à vontade
**feel cheap** | sentir-se baixo, vil
**feel for** | sentir pena de
**feel in one's bones** |  pressentir, ter intuição
**feel like having/doing** | estar dispoto a; apetecer; ter vontade de
**feel on** | sondar
**feel one's way** | agir com cuidado, andar as apalpadelas
**feel small** | sentir-se envergonhado
**feign an excuse** | invetar uma desculpa
**fend for one's self** | defender-se sozinho
**few and far between** | raro
**fifty-fifty** | meio a meio
**fight shy of** | evitar
**figure on** | contar com
**find fault with** | censurar
**fire away** | pôr mão à obra
**fire up** | enfurecer-se
**first of all** | antes de mais nada
**first thing off the bat** | sem perda de tempo
**fit as a fiddle** | em ótima forma, bem disposto
**fit to be tied** | doido varrido, irritado
**flight of satirs** | lance de escadas
**flip one's lip** | ficar uma fúria
**floor someone** | surpreender alguém
**flunk out** | ser reprovado, levar bomba
**fly-by-night** | irresponsável
**fly in the face of** | nadar ou remar contra maré
**fly into a rage** | enraivecer-se
**fly off at a tangent** | escapar pela tangente, mudar de assunto
**fly off the handles** | perder as estribeiras
**fly open** | abrir de sopetão
**folks** | gente, pessoal
**follow one's nose** | seguir em frente
**fool around** | divertir-se brincar
**fool away** | desperdiçar
**foot the bill** | pagar as despesas
**for a change** | para variar
**for all I know** | pelo que eu sei
**for a while** | por algum tempo
**for fun** | de brincadeira
**for good = forever** | para sempre
**for heavens' sake! = for God' sake!** | pelo amor de Deus
**for instance** | por exemplo
**for keeps** | para sempre
**for laughs** | por esporte
**for one's money** | de sua escolha, que lhe convém
**for sure** | com certeza
**for the birds** | de péssima qualidade
**for the life of me** | como se a minha vida dependesse disso
**for the sake of** | por causa de
**frame of mind** | disposição mental
**frame up** | acusação falsa
**free and easy** | esbanjador
**free for nothing** | grátis
**free hand** | carta branca
**fresh as a daisy** | bem disposto
**fret and fume** | tornar-se furioso ou inquieto
**from time to time** | de vez em quando
**from the cradle to the grave** | durante a vida inteira
**from the word go** | completamente
**from scratch** | da estaca zero
**fuck off!** | não enche!
**funny bone** | senso de humor


text:
// Code generated by client-gen. DO NOT EDIT.

package v1alpha1

import (
	v1alpha1 "github.com/openebs/maya/pkg/apis/openebs.io/ndm/v1alpha1"
	scheme "github.com/openebs/maya/pkg/client/generated/openebs.io/ndm/v1alpha1/clientset/internalclientset/scheme"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	types "k8s.io/apimachinery/pkg/types"
	watch "k8s.io/apimachinery/pkg/watch"
	rest "k8s.io/client-go/rest"
)

// BlockDeviceClaimsGetter has a method to return a BlockDeviceClaimInterface.
// A group's client should implement this interface.
type BlockDeviceClaimsGetter interface {
	BlockDeviceClaims(namespace string) BlockDeviceClaimInterface
}

// BlockDeviceClaimInterface has methods to work with BlockDeviceClaim resources.
type BlockDeviceClaimInterface interface {
	Create(*v1alpha1.BlockDeviceClaim) (*v1alpha1.BlockDeviceClaim, error)
	Update(*v1alpha1.BlockDeviceClaim) (*v1alpha1.BlockDeviceClaim, error)
	UpdateStatus(*v1alpha1.BlockDeviceClaim) (*v1alpha1.BlockDeviceClaim, error)
	Delete(name string, options *v1.DeleteOptions) error
	DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
	Get(name string, options v1.GetOptions) (*v1alpha1.BlockDeviceClaim, error)
	List(opts v1.ListOptions) (*v1alpha1.BlockDeviceClaimList, error)
	Watch(opts v1.ListOptions) (watch.Interface, error)
	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDeviceClaim, err error)
	BlockDeviceClaimExpansion
}

// blockDeviceClaims implements BlockDeviceClaimInterface
type blockDeviceClaims struct {
	client rest.Interface
	ns     string
}

// newBlockDeviceClaims returns a BlockDeviceClaims
func newBlockDeviceClaims(c *OpenebsV1alpha1Client, namespace string) *blockDeviceClaims {
	return &blockDeviceClaims{
		client: c.RESTClient(),
		ns:     namespace,
	}
}

// Get takes name of the blockDeviceClaim, and returns the corresponding blockDeviceClaim object, and an error if there is any.
func (c *blockDeviceClaims) Get(name string, options v1.GetOptions) (result *v1alpha1.BlockDeviceClaim, err error) {
	result = &v1alpha1.BlockDeviceClaim{}
	err = c.client.Get().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		Name(name).
		VersionedParams(&options, scheme.ParameterCodec).
		Do().
		Into(result)
	return
}

// List takes label and field selectors, and returns the list of BlockDeviceClaims that match those selectors.
func (c *blockDeviceClaims) List(opts v1.ListOptions) (result *v1alpha1.BlockDeviceClaimList, err error) {
	result = &v1alpha1.BlockDeviceClaimList{}
	err = c.client.Get().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		VersionedParams(&opts, scheme.ParameterCodec).
		Do().
		Into(result)
	return
}

// Watch returns a watch.Interface that watches the requested blockDeviceClaims.
func (c *blockDeviceClaims) Watch(opts v1.ListOptions) (watch.Interface, error) {
	opts.Watch = true
	return c.client.Get().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		VersionedParams(&opts, scheme.ParameterCodec).
		Watch()
}

// Create takes the representation of a blockDeviceClaim and creates it.  Returns the server's representation of the blockDeviceClaim, and an error, if there is any.
func (c *blockDeviceClaims) Create(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) {
	result = &v1alpha1.BlockDeviceClaim{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		Body(blockDeviceClaim).
		Do().
		Into(result)
	return
}

// Update takes the representation of a blockDeviceClaim and updates it. Returns the server's representation of the blockDeviceClaim, and an error, if there is any.
func (c *blockDeviceClaims) Update(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) {
	result = &v1alpha1.BlockDeviceClaim{}
	err = c.client.Put().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		Name(blockDeviceClaim.Name).
		Body(blockDeviceClaim).
		Do().
		Into(result)
	return
}

// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().

func (c *blockDeviceClaims) UpdateStatus(blockDeviceClaim *v1alpha1.BlockDeviceClaim) (result *v1alpha1.BlockDeviceClaim, err error) {
	result = &v1alpha1.BlockDeviceClaim{}
	err = c.client.Put().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		Name(blockDeviceClaim.Name).
		SubResource("status").
		Body(blockDeviceClaim).
		Do().
		Into(result)
	return
}

// Delete takes name of the blockDeviceClaim and deletes it. Returns an error if one occurs.
func (c *blockDeviceClaims) Delete(name string, options *v1.DeleteOptions) error {
	return c.client.Delete().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		Name(name).
		Body(options).
		Do().
		Error()
}

// DeleteCollection deletes a collection of objects.
func (c *blockDeviceClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
	return c.client.Delete().
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		VersionedParams(&listOptions, scheme.ParameterCodec).
		Body(options).
		Do().
		Error()
}

// Patch applies the patch and returns the patched blockDeviceClaim.
func (c *blockDeviceClaims) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.BlockDeviceClaim, err error) {
	result = &v1alpha1.BlockDeviceClaim{}
	err = c.client.Patch(pt).
		Namespace(c.ns).
		Resource("blockdeviceclaims").
		SubResource(subresources...).
		Name(name).
		Body(data).
		Do().
		Into(result)
	return
}


text:
..
 This work is licensed under a Creative Commons Attribution 3.0 Unported
 License.

 https://creativecommons.org/licenses/by/3.0/legalcode

===========================
Remote Device Communication
===========================

https://blueprints.launchpad.net/dragonflow/+spec/remote-device-communication

This spec proposes the solution of communicating to a remote device which
is not managed by Dragonflow.

Problem Description
===================

In the common scenario, a VM not only needs to communicate with another VM
but also a physical machine, however, the virtual or physical machine
may not be managed by Dragonflow, in this spec we call them remote device,
if a VM in Dragonflow wants to communicate to remote device, Dragonflow
needs to know some info of the remote device.

Usually we would deploy a VTEP for virtual or physical machine in DC network,
such as the Openvswitch vxlan port, the VTEP TOR(top of rack) and the
physical router which support VTEP, so if Dragonflow knows the correct VTEP
IP, VM in Dragonflow could access remote device by the overlay network.

The remote device may belong to one tenant or it has no tenant info at all.
It could be managed by another cloud OS and how the remote device knows the
location of the VM in Dragonflow and accesses it is out of the scope of this
spec.

Proposed Change
===============

To resolve the problem, the general idea is we should tell the info of remote
device to Dragonflow. We can invoke the Neutron API create_port and provide
the info of remote device, plugin will assign a specific chassis name for
the remote device and publish the create_port message. After the chassis
receives the message, it will create corresponding tunnel port to the remote
chassis and install the forwarding rules.

Neutron Plugin
--------------

When we invoke the create_port Neutron API provided by Neutron plugin in
Dragonflow, it will process it:

1. We put the info that indicates the Neutron port is a remote device port
into the binding_profile field so that Neutron plugin could recognize it:

binding_profile = {"port_key": "remote_port",
                   "host_ip": remote_chassis_ip}

2. When the Neutron plugin finds it is a remote port by the binding_profile
field in the create_port message, it will assign the remote_chassis_ip as
the chassis name of the remote port, because the remote_chassis_ip should be
unique in DC network. Then it will store the lport in DF DB and publish the
message with corresponding topic, if the lport belongs to some tenant, we
could use tenant_id as the topic.

DF Local Controller
-------------------

DF local controller will process above notification message:

1. DF local controller will analyse the create_port message and find it is a
remote device port by the specific chassis name, and also it will fetch
the remote tunnel ip by the chassis name.

2. Local controller will check whether local chassis has the tunnel port from
itself to the specific remote chassis, if not, it will create the tunnel
port and establish the tunnel to the remote chassis.

3. After the tunnel port has been created, local controller will notify the
create_lport message to Apps, it will be considered a normal remote port as
in current implementation.

On the other hand, when the remote device port is deleted from local cache,
it means there are no need to communicate to the remote chassis anymore
for the local controller, it should delete the corresponding tunnel port and
forwarding rules.


text:
package com.github.anba.es6draft.runtime.objects;

import static com.github.anba.es6draft.runtime.AbstractOperations.*;
import static com.github.anba.es6draft.runtime.internal.Errors.newTypeError;
import static com.github.anba.es6draft.runtime.internal.Properties.createProperties;
import static com.github.anba.es6draft.runtime.objects.RegExpConstructor.EscapeRegExpPattern;
import static com.github.anba.es6draft.runtime.objects.RegExpConstructor.RegExpInitialise;
import static com.github.anba.es6draft.runtime.types.Null.NULL;
import static com.github.anba.es6draft.runtime.types.Undefined.UNDEFINED;
import static com.github.anba.es6draft.runtime.types.builtins.ExoticArray.ArrayCreate;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.Iterator;
import java.util.List;
import java.util.regex.MatchResult;

import com.github.anba.es6draft.regexp.MatchState;
import com.github.anba.es6draft.regexp.RegExpMatcher;
import com.github.anba.es6draft.runtime.ExecutionContext;
import com.github.anba.es6draft.runtime.Realm;
import com.github.anba.es6draft.runtime.internal.CompatibilityOption;
import com.github.anba.es6draft.runtime.internal.Initialisable;
import com.github.anba.es6draft.runtime.internal.Messages;
import com.github.anba.es6draft.runtime.internal.Properties.Accessor;
import com.github.anba.es6draft.runtime.internal.Properties.Attributes;
import com.github.anba.es6draft.runtime.internal.Properties.CompatibilityExtension;
import com.github.anba.es6draft.runtime.internal.Properties.Function;
import com.github.anba.es6draft.runtime.internal.Properties.Prototype;
import com.github.anba.es6draft.runtime.internal.Properties.Value;
import com.github.anba.es6draft.runtime.types.BuiltinSymbol;
import com.github.anba.es6draft.runtime.types.Callable;
import com.github.anba.es6draft.runtime.types.Intrinsics;
import com.github.anba.es6draft.runtime.types.ScriptObject;
import com.github.anba.es6draft.runtime.types.Type;
import com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject;

/**
 *
21 Text Processing

 *
21.2 RegExp (Regular Expression) Objects

 *

 *
21.2.5 Properties of the RegExp Prototype Object
 *
21.2.6 Properties of RegExp Instances
 *

 */
public final class RegExpPrototype extends OrdinaryObject implements Initialisable {
    public RegExpPrototype(Realm realm) {
        super(realm);
    }

    @Override
    public void initialise(ExecutionContext cx) {
        createProperties(this, cx, Properties.class);
        createProperties(this, cx, AdditionalProperties.class);
    }

    /**
     * 21.2.5 Properties of the RegExp Prototype Object
     */
    public enum Properties {
        ;

        private static RegExpObject thisRegExpValue(ExecutionContext cx, Object object) {
            if (object instanceof RegExpObject) {
                RegExpObject obj = (RegExpObject) object;
                if (obj.isInitialised()) {
                    return obj;
                }
                throw newTypeError(cx, Messages.Key.UninitialisedObject);
            }
            throw newTypeError(cx, Messages.Key.IncompatibleObject);
        }

        @Prototype
        public static final Intrinsics __proto__ = Intrinsics.ObjectPrototype;

        /**
         * 21.2.5.1 RegExp.prototype.constructor
         */
        @Value(name = "constructor")
        public static final Intrinsics constructor = Intrinsics.RegExp;

        /**
         * 21.2.5.2 RegExp.prototype.exec(string)
         */
        @Function(name = "exec", arity = 1)
        public static Object exec(ExecutionContext cx, Object thisValue, Object string) {
            /* steps 1-4 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            String s = ToFlatString(cx, string);
            /* step 7 */
            return RegExpExec(cx, r, s);
        }

        /**
         * 21.2.5.3 get RegExp.prototype.global
         */
        @Accessor(name = "global", type = Accessor.Type.Getter)
        public static Object global(ExecutionContext cx, Object thisValue) {
            /* steps 1-5 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 6-7 */
            return r.getOriginalFlags().indexOf('g') != -1;
        }

        /**
         * 21.2.5.4 get RegExp.prototype.ignoreCase
         */
        @Accessor(name = "ignoreCase", type = Accessor.Type.Getter)
        public static Object ignoreCase(ExecutionContext cx, Object thisValue) {
            /* steps 1-5 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 6-7 */
            return r.getOriginalFlags().indexOf('i') != -1;
        }

        /**
         * 21.2.5.6 get RegExp.prototype.multiline
         */
        @Accessor(name = "multiline", type = Accessor.Type.Getter)
        public static Object multiline(ExecutionContext cx, Object thisValue) {
            /* steps 1-5 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 6-7 */
            return r.getOriginalFlags().indexOf('m') != -1;
        }

        /**
         * 21.2.5.9 get RegExp.prototype.source
         */
        @Accessor(name = "source", type = Accessor.Type.Getter)
        public static Object source(ExecutionContext cx, Object thisValue) {
            /* steps 1-7 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* step 8 */
            return EscapeRegExpPattern(r.getOriginalSource(), r.getOriginalFlags());
        }

        /**
         * 21.2.5.11 get RegExp.prototype.sticky
         */
        @Accessor(name = "sticky", type = Accessor.Type.Getter)
        public static Object sticky(ExecutionContext cx, Object thisValue) {
            /* steps 1-5 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 6-7 */
            return r.getOriginalFlags().indexOf('y') != -1;
        }

        /**
         * 21.2.5.12 RegExp.prototype.test(string)
         */
        @Function(name = "test", arity = 1)
        public static Object test(ExecutionContext cx, Object thisValue, Object string) {
            /* steps 1-4 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            String s = ToFlatString(cx, string);
            /* steps 7-9 */
            MatchResult m = getMatcherOrNull(cx, r, s);
            if (m == null) {
                return false;
            }
            RegExpConstructor.storeLastMatchResult(cx, r, s, m);
            return true;
        }

        /**
         * 21.2.5.14 get RegExp.prototype.unicode
         */
        @Accessor(name = "unicode", type = Accessor.Type.Getter)
        public static Object unicode(ExecutionContext cx, Object thisValue) {
            /* steps 1-5 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 6-7 */
            return r.getOriginalFlags().indexOf('u') != -1;
        }

        /**
         * 21.2.5.13 RegExp.prototype.toString()
         */
        @Function(name = "toString", arity = 0)
        public static Object toString(ExecutionContext cx, Object thisValue) {
            /* steps 1-4 */
            RegExpObject r = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            CharSequence source = ToString(cx, Get(cx, r, "source"));
            if (source.length() == 0) {
                source = "(?:)";
            }
            /* step 7 */
            StringBuilder result = new StringBuilder().append('/').append(source).append('/');
            /* steps 8-10 */
            if (ToBoolean(Get(cx, r, "global"))) {
                result.append('g');
            }
            /* steps 11-13 */
            if (ToBoolean(Get(cx, r, "ignoreCase"))) {
                result.append('i');
            }
            /* steps 14-16 */
            if (ToBoolean(Get(cx, r, "multiline"))) {
                result.append('m');
            }
            /* steps 17-19 */
            if (ToBoolean(Get(cx, r, "unicode"))) {
                result.append('u');
            }
            /* steps 20-22 */
            if (ToBoolean(Get(cx, r, "sticky"))) {
                result.append('y');
            }
            /* step 23 */
            return result.toString();
        }

        /**
         * 21.2.5.5 RegExp.prototype.match (string)
         */
        @Function(name = "match", arity = 1)
        public static Object match(ExecutionContext cx, Object thisValue, Object string) {
            /* steps 1-4 */
            RegExpObject rx = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            String s = ToFlatString(cx, string);
            /* steps 7-8 */
            boolean global = ToBoolean(Get(cx, rx, "global"));
            if (!global) {
                /* step 9 */
                return RegExpExec(cx, rx, s);
            } else {
                /* step 10 */
                Put(cx, rx, "lastIndex", 0, true);
                ScriptObject array = ArrayCreate(cx, 0);
                int n = 0;
                boolean lastMatch = true;
                MatchResult lastMatchResult = null;
                while (lastMatch) {
                    // Object result = RegExpExec(realm, rx, s);
                    MatchResult result = getMatcherOrNull(cx, rx, s);
                    if (result == null) {
                        lastMatch = false;
                    } else {
                        lastMatchResult = result;
                        // FIXME: spec issue (bug 1467)
                        if (result.start() == result.end()) {
                            int thisIndex = (int) ToInteger(cx, Get(cx, rx, "lastIndex"));
                            Put(cx, rx, "lastIndex", thisIndex + 1, true);
                        }
                        // Object matchStr = Get(Type.objectValue(result), "0");
                        String matchStr = s.substring(result.start(), result.end());
                        CreateDataPropertyOrThrow(cx, array, ToString(n), matchStr);
                        n += 1;
                    }
                }
                if (n == 0) {
                    return NULL;
                }
                RegExpConstructor.storeLastMatchResult(cx, rx, s, lastMatchResult);
                return array;
            }
        }

        /**
         * 21.2.5.7 RegExp.prototype.replace (S, replaceValue)
         */
        @Function(name = "replace", arity = 2)
        public static Object replace(ExecutionContext cx, Object thisValue, Object s,
                Object replaceValue) {
            /* steps 1-4 */
            RegExpObject rx = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            String string = ToFlatString(cx, s);
            // FIXME: spec issue - always call ToString(replValue) even if no match
            if (!IsCallable(replaceValue)) {
                replaceValue = ToFlatString(cx, replaceValue);
            }
            List<MatchResult> matches = new ArrayList<>();
            // cf. RegExp.prototype.match
            boolean global = ToBoolean(Get(cx, rx, "global"));
            if (!global) {
                MatchResult result = getMatcherOrNull(cx, rx, string);
                if (result == null) {
                    return string;
                }
                matches.add(result);
            } else {
                // cf. RegExp.prototype.match, step 10.a
                Put(cx, rx, "lastIndex", 0, true);
                int n = 0;
                boolean lastMatch = true;
                while (lastMatch) {
                    // Object result = RegExpExec(realm, rx, s);
                    MatchResult result = getMatcherOrNull(cx, rx, string);
                    if (result == null) {
                        lastMatch = false;
                    } else {
                        // FIXME: spec issue (bug 1467)
                        if (result.start() == result.end()) {
                            int thisIndex = (int) ToInteger(cx, Get(cx, rx, "lastIndex"));
                            Put(cx, rx, "lastIndex", thisIndex + 1, true);
                        }
                        matches.add(result);
                        n += 1;
                    }
                }
                if (n == 0) {
                    return string;
                }
            }

            if (IsCallable(replaceValue)) {
                Callable fun = (Callable) replaceValue;
                StringBuilder result = new StringBuilder();
                int lastMatch = 0;
                for (MatchResult matchResult : matches) {
                    RegExpConstructor.storeLastMatchResult(cx, rx, string, matchResult);
                    Object[] arguments = GetReplaceArguments(rx, matchResult, string);
                    CharSequence replacement = ToString(cx, fun.call(cx, UNDEFINED, arguments));
                    result.append(string, lastMatch, matchResult.start());
                    result.append(replacement);
                    lastMatch = matchResult.end();
                }
                result.append(string, lastMatch, string.length());
                return result.toString();
            } else {
                RegExpConstructor.storeLastMatchResult(cx, rx, string,
                        matches.get(matches.size() - 1));
                String replValue = (String) replaceValue;
                StringBuilder result = new StringBuilder();
                int lastMatch = 0;
                for (MatchResult matchResult : matches) {
                    String replacement = GetReplaceSubstitution(rx, matchResult, replValue, string);
                    result.append(string, lastMatch, matchResult.start());
                    result.append(replacement);
                    lastMatch = matchResult.end();
                }
                result.append(string, lastMatch, string.length());
                return result.toString();
            }
        }

        private static Object[] GetReplaceArguments(RegExpObject rx, MatchResult matchResult,
                String string) {
            int m = matchResult.groupCount();
            Object[] arguments = new Object[m + 3];
            arguments[0] = matchResult.group();
            GroupIterator iterator = new GroupIterator(rx.getRegExpMatcher(), matchResult);
            for (int i = 1; iterator.hasNext(); ++i) {
                String group = iterator.next();
                arguments[i] = (group != null ? group : UNDEFINED);
            }
            arguments[m + 1] = matchResult.start();
            arguments[m + 2] = string;

            return arguments;
        }

        /**
         * Runtime Semantics: GetReplaceSubstitution Abstract Operation
         */
        private static String GetReplaceSubstitution(RegExpObject rx, MatchResult matchResult,
                String replValue, String string) {
            int m = matchResult.groupCount();
            String[] groups = null;
            StringBuilder replacement = new StringBuilder();

            for (int cursor = 0, len = replValue.length(); cursor < len;) {
                char c = replValue.charAt(cursor++);
                if (c == '$' && cursor < len) {
                    c = replValue.charAt(cursor++);
                    switch (c) {
                    case '0':
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9': {
                        int n = c - '0';
                        if (cursor < len) {
                            char d = replValue.charAt(cursor);
                            if (d >= (n == 0 ? '1' : '0') && d <= '9') {
                                int nn = n * 10 + (d - '0');
                                if (nn <= m) {
                                    cursor += 1;
                                    n = nn;
                                }
                            }
                        }
                        if (n == 0 || n > m) {
                            assert n >= 0 && n <= 9;
                            replacement.append('$').append(c);
                        } else {
                            assert n >= 1 && n <= 99;
                            if (groups == null) {
                                groups = RegExpPrototype.groups(rx, matchResult);
                            }
                            String group = groups[n];
                            if (group != null) {
                                replacement.append(group);
                            }
                        }
                        break;
                    }
                    case '&':
                        replacement.append(matchResult.group());
                        break;
                    case '`':
                        replacement.append(string, 0, matchResult.start());
                        break;
                    case '\'':
                        replacement.append(string, matchResult.end(), string.length());
                        break;
                    case '$':
                        replacement.append('$');
                        break;
                    default:
                        replacement.append('$').append(c);
                        break;
                    }
                } else {
                    replacement.append(c);
                }
            }

            return replacement.toString();
        }

        /**
         * 21.2.5.8 RegExp.prototype.search (S)
         */
        @Function(name = "search", arity = 1)
        public static Object search(ExecutionContext cx, Object thisValue, Object s) {
            /* steps 1-4 */
            RegExpObject rx = thisRegExpValue(cx, thisValue);
            /* steps 5-6 */
            String string = ToFlatString(cx, s);
            /* steps 7-8 */
            MatchState matcher = rx.getRegExpMatcher().matcher(string);
            if (matcher.find()) {
                RegExpConstructor.storeLastMatchResult(cx, rx, string, matcher.toMatchResult());
                int result = matcher.start();
                return result;
            }
            return -1;
        }

        /**
         * 21.2.5.10 RegExp.prototype.split (string, limit)
         */
        @Function(name = "split", arity = 2)
        public static Object split(ExecutionContext cx, Object thisValue, Object string,
                Object limit) {
            /* steps 1-4 */
            RegExpObject rx = thisRegExpValue(cx, thisValue);
            /* step 5 (moved after step 14) */
            /* steps 6-7 */
            String s = ToFlatString(cx, string);
            /* steps 8-9 */
            ScriptObject a = ArrayCreate(cx, 0);
            /* step 10 */
            int lengthA = 0;
            /* step 11 */
            long lim = Type.isUndefined(limit) ? 0x1F_FFFF_FFFF_FFFFL : ToLength(cx, limit);
            /* step 12 */
            int size = s.length();
            /* step 13 */
            int p = 0;
            /* step 14 */
            if (lim == 0) {
                return a;
            }
            /* step 5 */
            MatchState matcher = rx.getRegExpMatcher().matcher(s);
            /* step 15 */
            if (size == 0) {
                if (matcher.find()) {
                    RegExpConstructor.storeLastMatchResult(cx, rx, s, matcher.toMatchResult());
                    return a;
                }
                CreateDataProperty(cx, a, "0", s);
                return a;
            }
            /* step 16 */
            int q = p;
            int lastStart = -1;
            while (q != size) {
                boolean match = matcher.find();
                if (!match) {
                    break;
                }
                RegExpConstructor.storeLastMatchResult(cx, rx, s, matcher.toMatchResult());
                int e = matcher.end();
                if (e == p) {
                    q = q + 1;
                } else {
                    String t = s.substring(p, lastStart = matcher.start());
                    CreateDataProperty(cx, a, ToString(lengthA), t);
                    lengthA += 1;
                    if (lengthA == lim) {
                        return a;
                    }
                    p = e;
                    GroupIterator iterator = new GroupIterator(rx.getRegExpMatcher(), matcher);
                    while (iterator.hasNext()) {
                        String cap = iterator.next();
                        CreateDataProperty(cx, a, ToString(lengthA), cap != null ? cap : UNDEFINED);
                        lengthA += 1;
                        if (lengthA == lim) {
                            return a;
                        }
                    }
                    q = p;
                }
            }
            if (lastStart == size) {
                return a;
            }
            /* step 18 */
            String t = s.substring(p, size);
            /* steps 19-20 */
            CreateDataProperty(cx, a, ToString(lengthA), t);
            /* step 21 */
            return a;
        }

        /**
         * 21.2.5.15 RegExp.prototype.@@isRegExp
         */
        @Value(name = "[Symbol.isRegExp]", symbol = BuiltinSymbol.isRegExp,
                attributes = @Attributes(writable = false, enumerable = false, configurable = true))
        public static final boolean isRegExp = true;

    }

    /**
     * B.2.5 Additional Properties of the RegExp.prototype Object
     */
    @CompatibilityExtension(CompatibilityOption.RegExpPrototype)
    public enum AdditionalProperties {
        ;

        /**
         * B.2.5.1 RegExp.prototype.compile (pattern, flags )
         */
        @Function(name = "compile", arity = 2)
        public static Object compile(ExecutionContext cx, Object thisValue, Object pattern,
                Object flags) {
            /* step 1 (omitted) */
            /* step 2 */
            if (!(thisValue instanceof RegExpObject)) {
                throw newTypeError(cx, Messages.Key.IncompatibleObject);
            }
            RegExpObject r = (RegExpObject) thisValue;
            // FIXME: spec issue - delay extensible check after side effects?
            /*
             * re = /abc/;
             * re.compile({
             *   toString() {
             *     re.compile("def");
             *     Object.preventExtensions(re);
             *     return "ghi";
             *   }
             * });
             */
            /* step 3 */
            boolean extensible = IsExtensible(cx, r);
            /* step 4 */
            if (!extensible) {
                throw newTypeError(cx, Messages.Key.NotExtensible);
            }
            Object p, f;
            if (pattern instanceof RegExpObject) {
                /* step 5 */
                RegExpObject rx = (RegExpObject) pattern;
                if (!rx.isInitialised()) {
                    throw newTypeError(cx, Messages.Key.UninitialisedObject);
                }
                if (!Type.isUndefined(flags)) {
                    throw newTypeError(cx, Messages.Key.NotUndefined);
                }
                p = rx.getOriginalSource();
                f = rx.getOriginalFlags();
            } else {
                /* step 6 */
                p = pattern;
                f = flags;
            }
            /* step 7 */
            return RegExpInitialise(cx, r, p, f);
        }
    }

    /**
     * Runtime Semantics: RegExpExec Abstract Operation
     */
    public static Object RegExpExec(ExecutionContext cx, RegExpObject r, String s) {
        /* steps 1-15 */
        MatchResult m = getMatcherOrNull(cx, r, s);
        if (m == null) {
            return NULL;
        }
        RegExpConstructor.storeLastMatchResult(cx, r, s, m);
        /* steps 16-25 */
        return toMatchResult(cx, r, s, m);
    }

    /**
     * Runtime Semantics: RegExpExec Abstract Operation (1)
     */
    private static MatchResult getMatcherOrNull(ExecutionContext cx, RegExpObject r, String s) {
        /* step 1 */
        assert r.isInitialised();
        /* step 2 */
        int length = s.length();
        /* step 3 */
        Object lastIndex = Get(cx, r, "lastIndex");
        /* steps 4-5 */
        double i = ToInteger(cx, lastIndex);
        /* steps 6-7 */
        boolean global = ToBoolean(Get(cx, r, "global"));
        /* steps 8-9 */
        boolean sticky = ToBoolean(Get(cx, r, "sticky"));
        /* step 10 */
        if (!global && !sticky) {
            i = 0;
        }
        /* step 13.a */
        if (i < 0 || i > length) {
            Put(cx, r, "lastIndex", 0, true);
            return null;
        }
        /* step 11 */
        RegExpMatcher matcher = r.getRegExpMatcher();
        /* steps 12-13 */
        MatchState m = matcher.matcher(s);
        boolean matchSucceeded;
        if (!sticky) {
            matchSucceeded = m.find((int) i);
        } else {
            matchSucceeded = m.matches((int) i);
        }
        if (!matchSucceeded) {
            Put(cx, r, "lastIndex", 0, true);
            return null;
        }
        /* step 14 */
        int e = m.end();
        /* step 15 */
        if (global || sticky) {
            Put(cx, r, "lastIndex", e, true);
        }
        return m.toMatchResult();
    }

    /**
     * Runtime Semantics: RegExpExec Abstract Operation (2)
     */
    private static ScriptObject toMatchResult(ExecutionContext cx, RegExpObject r, String s,
            MatchResult m) {
        assert r.isInitialised();
        /* step 14 */
        int e = m.end();
        /* step 16 */
        int n = m.groupCount();
        /* step 17 */
        ScriptObject array = ArrayCreate(cx, n + 1);
        /* step 18 */
        int matchIndex = m.start();
        /* steps 19-21 */
        CreateDataProperty(cx, array, "index", matchIndex);
        CreateDataProperty(cx, array, "input", s);
        /* step 22 */
        String matchedSubstr = s.substring(matchIndex, e);
        /* step 23 */
        CreateDataProperty(cx, array, "0", matchedSubstr);
        /* step 24 */
        GroupIterator iterator = new GroupIterator(r.getRegExpMatcher(), m);
        for (int i = 1; iterator.hasNext(); ++i) {
            String capture = iterator.next();
            CreateDataProperty(cx, array, ToString(i), (capture != null ? capture : UNDEFINED));
        }
        /* step 25 */
        return array;
    }

    /**
     * Returns the filtered capturing groups of the {@link MatchResult} argument
     */
    public static String[] groups(RegExpObject r, MatchResult m) {
        assert r.isInitialised();
        GroupIterator iterator = new GroupIterator(r.getRegExpMatcher(), m);
        int c = m.groupCount();
        String[] groups = new String[c + 1];
        groups[0] = m.group();
        for (int i = 1; iterator.hasNext(); ++i) {
            groups[i] = iterator.next();
        }
        return groups;
    }

    private static final class GroupIterator implements Iterator<String> {
        private final MatchResult result;
        private final BitSet negativeLAGroups;
        private int group = 1;
        // start index of last valid group in matched string
        private int last;

        GroupIterator(RegExpMatcher r, MatchResult result) {
            this.result = result;
            this.negativeLAGroups = r.getNegativeLookaheadGroups();
            this.last = result.start();
        }

        @Override
        public boolean hasNext() {
            return group <= result.groupCount();
        }

        @Override
        public String next() {
            int group = this.group++;
            if (result.start(group) >= last && !negativeLAGroups.get(group)) {
                last = result.start(group);
                return result.group(group);
            } else {
                return null;
            }
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}


text:
<?hh
require_once 'vendor/autoload.php';
require_once 'di.hh';

@session_start();

$server = new \Lx\JsonRpcXp\Server();
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\External($di_container);
	}, 'external'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\Maindesk($di_container);
	}, 'maindesk'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\User($di_container);
	}, 'user'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\Settings($di_container);
	}, 'settings'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\Shiplist($di_container);
	}, 'shiplist'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\Planetlist($di_container);
	}, 'planetlist'
);
$server->registerFactory(
	function() use ($di_container) {
		return new \STU\Core\RPC\Ship($di_container, $di_container->ship_component_factory);
	}, 'ship'
);
header('Access-Control-Allow-Origin: *');

$transport = new \Lx\JsonRpcXp\Transport\Http();
$transport->handle($server);


text:
Triggered when a stream is requested to expand beyond the maximum length specified by the responsible RecyclableMemoryStreamManager.

```csharp
public event EventHandler<StreamOverCapacityEventArgs> StreamOverCapacity;
```

## See Also

* class [StreamOverCapacityEventArgs](../RecyclableMemoryStreamManager.StreamOverCapacityEventArgs.md)
* class [RecyclableMemoryStreamManager](../RecyclableMemoryStreamManager.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

<!-- DO NOT EDIT: generated by xmldocmd for Microsoft.IO.RecyclableMemoryStream.dll -->


text:
Data Type and Type Casting

Literal and Variable

int year = 2019;

Programming elements like 2019 called Literal.
A value of a specific data type is generated from the literal.
Every programming language has its own set of literals.
Mostly, values are created with the same type as a literal.

The programming elements as the year called Variable.
A variable is a storage location with a name in order to save the value.
The size of storage capacity varies depending on the Data Type.

Data Type

Data type in Java is divided into two types.

Primitive Data Types

Reference Data Types

Primitive Data Types are a Data Type for normal data.
Reference Data Types are a Data Type for reference data.

Primitive Data Types

Primitive Data Types are boolean, char, byte, short, int, long, float, and double.

boolean

The boolean data type has only two possible values: true and false.

boolean signIn = true;

char

The char data type is a single 16-bit Unicode character.
Always use 'single quotes' for char literals.
The following example expresses characters, unicode characters, and control characters using single quotation marks ('').

char grade = 'A';
char ch = '\uFFFF';
('\uFFFF' is the character correspond to FFFF (Hex) in UTF-16)
char ech = '\n';//line feed
char ech = '\b';//backspace
char ech = '\t';//tab
char ech = '\\';//backspace
char ech = '\"';//double quote
char ech = '\'';//single quote

byte

The byte data type is an 8-bit integer.

byte weight = 71;

short

The short data type is a 16-bit integer.

short bill = 30000;

int

The int data type is a 32-bit integer.

int balance = 56219618;

long

The long data type is a 64-bit two's complement integer.
Numbers with an L at the end are long type literals.

long balance = 56219618L;

float

The float data type is a 32-bit floating point.
Numbers with f at the end are float type literals.

long rate = 6.195f;

double

The double data type is a 64-bit floating point.

long rate = 6.195;

The rule that determines the data type of the value

The following is an explanation of how the data type of the value is determined.

int i1 = 3;//integral number without any additional character is a int literal.
long l1 = 4;//4 is an int literal.

Mostly, values of the same type as the literal type are created.
However, an int literal can be a byte or short-form value.
Consider the following example.

byte b = 1; //1 is an int literal, but it is a byte value.
short s = 2; //2 is an int literal, but it is a short value.

Java requires these rules because there are no special literals for bytes and shorts.

Not all literals are a value.

int i2 = 3000000000; //compile error

3000000000 (3 billion) is an int literal, but out of the int range.
As a result, an int value is not created and a compilation error occurs.

An integer number followed by an L is a long literal.

long l2 = 3000000000L; //3000000000L is a long literal.

Numbers with decimal point or numbers followed by an D or d are double literal.

double d1 = 3.14;  //3.14 is a double literal.
double d2 = 3.14D; //3.14D is a double literal.
double d3 = 3.14d; //3.14d is a double literal.
float f1 = 3.14;   //compile error. A double type value can not be assigned to a float type variable.

Numbers followed by f are float literal.

float f2 = 3.14f; //3.14f is a float literal.

Reference Data Types

In a Java variable declaration,
you must put the data type before the variable.

Student john = new Student();

Student is the data type of the variable john and Student is not primitive data type.
therefore, Student is a reference data type.
When new Student() is executed, the reference to created student object is assigned to the varible john.
A reference to an object is the address of the object in memory.
Now, if you use the varibale john and .(dot), you can access to the student object which john is referring to as below;

john.name = "John Adams";

Type Casting

Type casting means that converting the data type of value to desired data type.
Type Casting is divided into two types.
One is called Up-Casting, it happens automatically by the JVM.
The Other is called Down-Casting, if you want it happens, put (desired data type) before literals or variables.

Up-Casting

long money = 300;//300 is int literal and value of 300 is created as int type.

Java is strict on the data type applies. So, variable money shall be assigned a value of long type.
In this case, JVM converted 300 of int type to 300 of long type before the assignment.
Automatic type casting happens to a large datatypes direction from a small data type.

byte --> short --> int --> long --> float --> double)

So, it is called Up-Casting.
Even so float occupies 4 bytes of memory size and long occupies 8 bytes of memory size, but long are automatically cast to float.

float x = 10L;//JVM convert 10 of long type to 10 of float type automatically.

Up-Casting in arithmetic

int x = 3 + 3.5 + 4; //compile error

Value of 3.5 is created as a double type and value of 3 and 4 are created as int type.
In the arithmetic which int type and larger type than int participates in,
every value will converted to the largest data type of values as below;

int x = 3.0 + 3.5 + 4.0;

The result of 3.0 + 3.5 + 4.0 is dobule and can not be assigned to an int type variable x, resulting in a compile error.

Down-Casting

float f = 1.1; //compile error

The above code occurs a compile error because you cannot assign double to float.
Type casting from large type to small type does not happen automatically.

float f = (float) 1.1;

The above code converts value of double type to value of float type.
Forcing data types to be changed using parentheses is called down casting.
Let's assume the value assigned to b in the following.

byte b = (byte) 258;

2 is assigned to b.
When int converts to byte, front 3 bytes of 4 bytes is lost.

For arithmetic operations involving byte or short values, all values are cast to int type before the operation proceeds.

short s1 = 1;
short s2 = 2;
short sum = s1 + s2; //compile error

When s1 and s2 participate in an operation, they are all cast as an int type, so the result is an int type value.
If you want to avoid compilation errors. cast as shown below;

short sum = (short) (s1 + s2);

다음 예에서 z에 할당되는 값을 예상해 보자.

int x = 10;
int y = 4;
int z = x / y;

We expect 2.5, but z is assigned 2.
Since x and y are both int types, the operation result is also of type int.
If you want z to be assigned a value of 2.5,
you must change the type of the variable z to double and cast either x or y to a double.

double z = (double) x / y;

If you cast x to a double type,
y is automatically cast to the double.

References

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

http://stackoverflow.com/questions/4331200/what-do-f-and-d-mean-at-the-end-of-numeric-literals

http://en.wikipedia.org/wiki/Literal_%28computer_programming%29


text:
from __future__ import with_statement

import os.path, sys
sys.path += [
    os.path.dirname(__file__),
    os.path.join(os.path.dirname(__file__), 'third_party.zip'),
]

import inspect

import wingapi

import shared

def comment_hr():
    '''
    Enter a horizontal line of "#" characters going until character 79.

    Example:

        #######################################################################

    Suggested key combination: `Insert H`
    '''

    editor = wingapi.gApplication.GetActiveEditor()
    assert isinstance(editor, wingapi.CAPIEditor)

    document = editor.GetDocument()
    assert isinstance(document, wingapi.CAPIDocument)

    with shared.UndoableAction(document):

        original_start, original_end = editor.GetSelection()
        original_end_line_number = \
                document.GetLineNumberFromPosition(original_end)
        original_document_length = document.GetLength()
        original_line_count = document.GetLineCount()

        indent_size = shared.get_indent_size_in_pos(editor, original_start)

        string_to_write = (' ' * indent_size) + ('#' * (79 - indent_size)) + \
                                                                           '\n'

        assert len(string_to_write) == 79

        start_line_number = document.GetLineNumberFromPosition(original_start)
        start_line_first_char = document.GetLineStart(start_line_number)
        document.InsertChars(start_line_first_char, string_to_write)

        editor.ExecuteCommand('home')


text:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="40dp"
    android:height="40dp"
    android:viewportWidth="40"
    android:viewportHeight="40"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M11.958,25.625 L10,23.667 20,13.667 30,23.625 28.042,25.583 20,17.583Z"/>
</vector>


text:
class Shop::ShopSessionCart < Shop::ShopCartBase

  attr_accessor :user
  attr_reader :currency

  # cart_storage and be either and end_user or a array in the session variable
  def initialize(cart_storage,currency,user=nil)
    @cart_storage = cart_storage
    @user = user || EndUser.new
    @currency = currency
  end

  def clear
     cart_storage = [ ]
  end

   attr_accessor :shipping

  def add_product(product,quantity,options={})
    @products = nil
    @cart_storage.each do |item|
      if(item[:cart_item_type] == product.class.to_s &&
         item[:cart_item_id] == product.id &&
         item[:options] == options)
          item[:quantity] += quantity
          return
      end
    end
    @cart_storage << { :cart_item_type => product.class.to_s, :cart_item_id => product.id, :quantity => quantity, :options => options }
  end

  def edit_product(product,quantity,options={},quantity_options=nil)
    @products = nil

    @cart_storage.each do |item|
      if(item[:cart_item_type] == product.class.to_s &&
         item[:cart_item_id] == product.id &&
         item[:options] == options)
        if quantity > 0
          item[:quantity] = quantity
          item[:quantity_options] = quantity_options
          return
        else
          @cart_storage.delete(item)
          return
        end
      end
    end
  end

  def products_count
    @cart_storage.length
  end

  def products(reload = false)
    @products = nil if reload

    return @products if @products
    @products = @cart_storage.collect do |itm|
      if itm[:cart_item_type] == "Shop::ShopProduct"
        prd = Shop::ShopProduct.find_by_id(itm[:cart_item_id], :include => :prices)
      else
        prd = itm[:cart_item_type].constantize.find_by_id(itm[:cart_item_id])
      end
      if prd
        cart_product = Shop::ShopCartProduct.new(:end_user => @user, :cart_item => prd, :quantity => itm[:quantity], :options => itm[:options],:quantity_options => itm[:quantity_options]||{}  )
      else
        @cart_storage.delete(itm)
        cart_product = nil
      end
    end.find_all { |itm| !itm.blank? }
  end

  def validate_cart!
    products.each do |prd|
      item = prd.item
      if item
        cart_limit = item.cart_limit(prd.options,self) if item.respond_to?(:cart_limit)

        if item.respond_to?(:update_cart_options!)
          save_changes = item.update_cart_options!(prd,self)
          edit_product(item,prd.quantity,prd.options,prd.quantity_options) if save_changes
        end
        if cart_limit && cart_limit == 0
          edit_product(item,0,prd.options)
        elsif !cart_limit.blank? && prd.quantity > cart_limit
          edit_product(item,cart_limit,prd.options,prd.quantity_options)
        end
      else
        edit_product(item,0,prd.options)
      end
    end
    @products=nil
  end

end


text:
export default function snakeToCamel(text, snakeSeparator) {
  let sep = snakeSeparator || '-';
  let re = new RegExp(`(\\${sep}\\w)`, 'g');
  return text.replace(re, (m) => { return m[1].toUpperCase(); });
}


text:
var worker = require('./worker');

module.exports = worker;


text:
zoo
===

Resources for 'The CS Education Zoo' web show


text:
public class LiteralExpr implements Expr {
    int cte;

    public LiteralExpr(int cte) {
        this.cte = cte;
    }

    public void accept(Visitor vis) {
        vis.visit(this);
    }

}


text:
package com.intellij.openapi.diff.impl.highlighting;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.ex.DiffFragment;
import org.jetbrains.annotations.NotNull;

public enum FragmentSide {

  SIDE1(0, 0) {
    @Override
    public String getText(DiffFragment fragment) {
      return fragment.getText1();
    }

    @Override
    protected DiffFragment createDiffFragment(String text, String otherText) {
      return new DiffFragment(text, otherText);
    }

    @Override
    public FragmentSide otherSide() {
      return SIDE2;
    }
  },

  SIDE2(1, 2) {
    @Override
    public String getText(DiffFragment fragment) {
      return fragment.getText2();
    }

    @Override
    protected DiffFragment createDiffFragment(String text, String otherText) {
      return new DiffFragment(otherText, text);
    }

    @Override
    public FragmentSide otherSide() {
      return SIDE1;
    }
  };

  private static final Logger LOG = Logger.getInstance(FragmentSide.class);

  private final int myIndex;
  private final int myMergeIndex;

  FragmentSide(int index, int mergeIndex) {
    myIndex = index;
    myMergeIndex = mergeIndex;
  }

  public DiffFragment createFragment(String text, String otherText, boolean modified) {
    DiffFragment fragment = createDiffFragment(text, otherText);
    if (!fragment.isOneSide()) fragment.setModified(modified);
    return fragment;
  }

  public abstract String getText(DiffFragment fragment);
  public abstract FragmentSide otherSide();
  protected abstract DiffFragment createDiffFragment(String text, String otherText);

  public int getIndex() {
    return myIndex;
  }

  public int getMergeIndex() {
    return myMergeIndex;
  }

  public String getOtherText(DiffFragment fragment) {
    return otherSide().getText(fragment);
  }

  public IllegalArgumentException invalidException() {
    return new IllegalArgumentException(String.valueOf(this));
  }

  public static FragmentSide chooseSide(DiffFragment oneSide) {
    LOG.assertTrue(oneSide.isOneSide());
    return oneSide.getText1() == null ? SIDE2 : SIDE1;
  }

  @NotNull
  public static FragmentSide fromIndex(int index) {
    for (FragmentSide side : FragmentSide.values()) {
      if (side.getIndex() == index) {
        return side;
      }
    }
    throw new IllegalArgumentException(String.valueOf(index));
  }

}


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Chapter 1. Boost.Convert 2.0</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Chapter 1. Boost.Convert 2.0">
<link rel="next" href="boost_convert/introduction.html" title="Introduction">

Home
Libraries
People
FAQ
More

Chapter 1. Boost.Convert 2.0

Vladimir Batov

Copyright © 2009-2014 Vladimir Batov

        Distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt.

Table of Contents

Rationale

Introduction

Getting Started

Basic
      Deployment

Flexibility
      and Adaptability to Change

Basic
      Conversion-Failure Detection

Better Error Detection

Default Converter

Alternative Interface

Converters

Integration of
    User-Defined Types

Boost.Convert with Standard Algorithms

Performance

Converters
      Compared

Boost.Convert
      Overhead

The Bigger
      Picture

Beyond Basic Conversions

Converters in Detail

boost::cnv::lexical_cast
      Converter

boost::cnv::stream
      Converter

Formatting
        Support

Numeric
          Base

Field
          Width, Fill Character and Adjustment

Leading
          Whitespace Characters

Format
          of Boolean Values

Locale
        Support

Supported
        String Types

Wide
          String

Custom
          String Types

The
        Default Constructible Type Requirement

boost::cnv::strtol
      Converter

Basic
        Deployment

Formatting
        Support

Numeric
          Base (bin, oct, dec, hex)

Field
          Width, Fill Character and Adjustment

Leading
          Whitespace Characters

Floating-Point
          Precision

Supported
        String Types

Wide
          String

Custom
          String Types

Design
    Notes

Requirements

Converter
      Signature

User
      Interface Signature

Supporting Tools

BOOST_DECLARE_HAS_MEMBER

BOOST_DECLARE_IS_CALLABLE

boost::cnv::is_cnv

Supported Compilers

Acknowledgements

Boost.Convert C++ Reference

Header <boost/convert.hpp>

Header <boost/convert/base.hpp>

Header <boost/convert/lexical_cast.hpp>

Header <boost/convert/parameters.hpp>

Header <boost/convert/printf.hpp>

Header <boost/convert/spirit.hpp>

Header <boost/convert/stream.hpp>

Header <boost/convert/strtol.hpp>

Header <boost/make_default.hpp>

Rationale

      I was using textual configuration files extensively and also was processing
      and preparing considerable amounts of data in XML. Consequently, I had a need
      for an extendible library that would provide a uniform
      interface to convert various data between their internal binary representations
      and external (predominantly textual) representations.

      The boost::lexical_cast library (with its orthogonal
      and extendible design) looked very promising compared to others (see The String Formatters of Manor
      Farm by H. Sutter for the discussion of alternatives). Unfortunately,

          many deployed user types simply did not meet boost::lexical_cast
          requirements (namely, Default
          Constructibility);

          failure to convert a user-provided configuration parameter was not that
          rare or exceptional to justify the hassle and the overhead of exception
          processing and, consequently, additional flexibility (if,
          when and how) to handle conversion
          failures was needed;

          additional conversion-related functionality (formatting and locale support)
          were needed.

      The original hope was to see boost::lexical_cast
      extended to be applicable to a wider range of deployment scenarios. However,
      after discussions with Kevlin Henney (the boost::lexical_cast
      author) and in the Boost Developers forum it was collectively decided that
      the desired extensions were not compatible with the original design and the
      idea of what boost::lexical_cast embodied and, therefore, a new
      component with richer interface and functionality was needed. That decision
      resulted in the development of Boost.Convert described
      in this document.

Index

Last revised: December 14, 2015 at 09:13:54 GMT


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">
    <meta name="description" content="Source to the Rust file `/home/jacob/.cargo/registry/src/github.com-1ecc6299db9ec823/ncollide_utils-0.6.0/center.rs`.">
    <meta name="keywords" content="rust, rustlang, rust-lang">

    <title>center.rs.html -- source</title>

    <link rel="stylesheet" type="text/css" href="../../normalize.css">
    <link rel="stylesheet" type="text/css" href="../../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../../main.css">

        <form class="search-form js-only">

                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press 'S' to search, '?' for more options…"
                       type="search">

        </form>

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

use na;
use math::Point;

/// Computes the center of a set of point.
#[inline]
pub fn center<P: Point>(pts: &[P]) -> P {
    assert!(pts.len() >= 1, "Cannot compute the center of less than 1 point.");

    let denom: P::Real = na::convert(1.0 / (pts.len() as f64));

    let mut piter = pts.iter();
    let mut res   = *piter.next().unwrap() * denom;

    for pt in piter {
        res.axpy(denom, pt);
    }

    res
}

Help

Keyboard Shortcuts

?

Show this help dialog

S

Focus the search field

⇤

Move up in search results

⇥

Move down in search results

⏎

Go to active search result

+

Collapse/expand all sections

Search Tricks

                    Prefix searches with a type followed by a colon (e.g.
                    fn:) to restrict the search to a given type.

                    Accepted types are: fn, mod,
                    struct, enum,
                    trait, type, macro,
                    and const.

                    Search functions by type signature (e.g.
                    vec -> usize or * -> vec)


text:
var newTab,
  i = 0;

var app = new Vue({
  // We want to target the div with an id of 'llist'
  // el: '#example-container',

  // Here we can register any values or collections that hold data
  // for the application
  data: {
    postMessageEvents: [],
    allTabs: [],
    openedTabs: [],
    closedTabs: []
  },

  // Anything within the ready function will run when the application loads
  ready: function() {},

  // Methods we want to use in our application are registered here
  methods: {
    openNewTab: function(ev) {
      var config = {
        url: 'http://localhost:3000/example/vue-js/child.html',
        windowName: 'Child - ' + ++i,
        windowFeatures: ''
      };
      parent.openNewTab(config);
    },
    closeAllTabs: function() {
      parent.closeAllTabs();
      app.showList();
    },
    closeTab: function(id) {
      parent.closeTab(id);
      app.showList();
    },
    broadCastTo: function(tab) {
      parent.broadCastTo(tab, 'Yo! Message from parent!!');
    },
    broadCastAll: function() {
      parent.broadCastAll('Yo! Broadcasted Message from parent to ALL!');
    },
    onHandshakeCallback: function(data) {
      data.type = 'open';
      this.showPMList(data);
    },
    onChildCommunication: function(data) {
      data.type = 'custom';
      this.showPMList(data);
    },
    onChildDisconnect: function(data) {
      data.type = 'close';
      this.showPMList(data);
    },
    showPMList: function(data) {
      this.postMessageEvents.push(data);
    },
    showList: function() {
      // if (!newTab) { return; }

      (this.allTabs = parent.getAllTabs()),
      (this.openedTabs = parent.getOpenedTabs()),
      (this.closedTabs = parent.getClosedTabs());
    }
  }
});

app.$mount('#example-container');

var parent = new AcrossTabs.default.Parent({
  onHandshakeCallback: app.onHandshakeCallback,
  onChildCommunication: app.onChildCommunication,
  onPollingCallback: app.showList,
  onChildDisconnect: app.onChildDisconnect
});


text:
package edu.samplu.admin.test;

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

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

/**
 * TODO Administrator don't forget to fill this in.
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class ReferenceCampusTypeBlanketAppIT {
    private Selenium selenium;
    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
        selenium.start();
    }

    @Test
    public void testCampusType() throws Exception {
        selenium.open(System.getProperty("remote.public.url"));
        assertEquals("Login", selenium.getTitle());
        selenium.type("__login_user", "admin");
        selenium.click("//input[@value='Login']");
        selenium.waitForPageToLoad("30000");
        assertEquals("Kuali Portal Index", selenium.getTitle());
        selenium.click("link=Administration");
        selenium.waitForPageToLoad("30000");
        assertEquals("Kuali Portal Index", selenium.getTitle());
        selenium.click("link=Campus Type");
        selenium.waitForPageToLoad("30000");
        assertEquals("Kuali Portal Index", selenium.getTitle());
        selenium.selectFrame("iframeportlet");
        selenium.click("//img[@alt='create new']");
        selenium.waitForPageToLoad("30000");
        String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
        assertTrue(selenium.isElementPresent("methodToCall.cancel"));
        selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Campus Type");
        selenium.type("//input[@id='document.newMaintainableObject.code']", "I");
        selenium.type("//input[@id='document.newMaintainableObject.name']", "Indianapolis");
        selenium.click("methodToCall.blanketApprove");
        selenium.waitForPageToLoad("30000");
        selenium.selectWindow("null");
        selenium.click("//img[@alt='doc search']");
        selenium.waitForPageToLoad("30000");
        assertEquals("Kuali Portal Index", selenium.getTitle());
        selenium.selectFrame("iframeportlet");
        selenium.click("//input[@name='methodToCall.search' and @value='search']");
        selenium.waitForPageToLoad("30000");

        docId= "link=" + docId;
        assertTrue(selenium.isElementPresent(docId));
        if(selenium.isElementPresent(docId)){
            assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
        }else{
            assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));
            assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
        }
    }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}


text:
class CreateSuggestions < ActiveRecord::Migration
  def change
    create_table :suggestions do |t|
      t.string :name
      t.text :description
      t.string :submitter

      t.timestamps
    end
  end
end


text:
package org.omg.CosNaming;

/**
* org/omg/CosNaming/NameHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u72/5732/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
* Tuesday, December 22, 2015 7:17:37 PM PST
*/

/**
   * A name is a sequence of name components.
   */
public final class NameHolder implements org.omg.CORBA.portable.Streamable
{
  public org.omg.CosNaming.NameComponent value[] = null;

  public NameHolder ()
  {
  }

  public NameHolder (org.omg.CosNaming.NameComponent[] initialValue)
  {
    value = initialValue;
  }

  public void _read (org.omg.CORBA.portable.InputStream i)
  {
    value = org.omg.CosNaming.NameHelper.read (i);
  }

  public void _write (org.omg.CORBA.portable.OutputStream o)
  {
    org.omg.CosNaming.NameHelper.write (o, value);
  }

  public org.omg.CORBA.TypeCode _type ()
  {
    return org.omg.CosNaming.NameHelper.type ();
  }

}


text:
published: true
title: Tasting on Split
layout: post
tags:
  - eat
date: '2016-08-24 20:00:00 +0300'
---
Defining Croatian food is a bit challenging because different parts of the country have their own specialties. But Mediterranean influence is heavy, and seafood is a staple along the coast. It also features many sweets, like dried fig cakes. A little known tidbit is that Croatia has among the best olive oils in the world, and they have the awards to prove it.

The currency in Croatia is the kuna, and at the time of writing, the exchange rate was about 6.50 kunas to US$1. All businesses are listed from most budget-friendly to least within each category.

- [Coffee & drinks](#coffee--drinks)
  - [4coffee soul food](#coffee-soul-food)
- [Desserts & ice cream](#desserts--ice-cream)
  - [Luka Ice Cream & Cakes](#luka-ice-cream--cakes)
  - [Stella Croatica](#stella-croatica)
- [Grocery stores & farmer's markets](#grocery-stores--farmers-markets)
  - [Konzum](#konzum)
  - [Purex](#purex)
  - [Tommy](#tommy)
  - [Billa](#billa)
- [Restaurants](#restaurants)
  - [Krčma Uskok](#krma-uskok)
  - [Corto Maltese](#corto-maltese-freestyle-food)

## Coffee & drinks

### 4coffee soul food

[Ul. Hrvoja Vukčića Hrvatinića 9, 21000, Split, Croatia](https://goo.gl/maps/n9qseMcMZAw)

[4coffee soul food][4coffee] does not serve food from the southern part of the US, but it is where I had some coffee brewed using a [Hario V60][v60] one morning for 30 kunas. It's a tiny little shop in the northeast corner of Old Town, just outside the [palace][diocletian] walls.

The owner prepared it with care and told me that he's been running [4coffee][4coffee] for a year and a half. I hope he continues to do well: Split needs some specialty coffee in its midst.

Even the little details like how the cups are textured make me smile. (If you're hungry, they also have sandwiches and cookies.)

## Desserts & ice cream

### Luka Ice Cream & Cakes

[Kroatien, Ul. Petra Svačića 2, 21000, Split, Croatia](https://goo.gl/maps/Z3gkw3DgrRq)

Near the [Croatian National Theater](http://www.hnk-split.hr/cnt-en/), you'll find [Luka Ice Creams & Cakes][luka] with two ice cream counters and a formal entryway where you can buy their delicious-looking cakes. (I didn't get to try their cakes, so I can only say that they looked mouthwatering.) I had ice cream for breakfast, so only one of the two counters was open. (Don't panic if you don't see ice cream in the counter you visit first: check the other side.)

Their ice creams contain all-natural ingredients and pack a huge flavor punch! You can get one scoop for 9 kunas, two for 17, or three for 24. It includes a homemade cone, but if you want the chocolate one, you need to pay an extra 2 kunas (worth it). I liked the combination of their pistachio ice cream and yogurt with forest berries.

### Stella Croatica

[Mihovilovići 21A, 21231, Klis, Croatia](https://goo.gl/maps/H3XrJtxrKRK2)

While I was in [Klis][klis], I took a 30-minute factory tour of [Stella Croatica][stella-croatica] for 30 kunas. (Notify them in advance by [emailing them](mailto:info@stella-croatica.hr).) It's a family-owned small business that primarily manufactures traditional Dalmatian desserts and other gourmet foods based on figs, oranges, lemons, almonds, and olives. In fact, their olive oil has taken the gold medal in [OliveJapan](http://olivejapan.com/en/)'s international competition.

Ivana, my tour guide, told me that the buildings that make up their reconstructed Dalmatian village were purchased from an actual village and moved piece by piece to [Stella Croatica][stella-croatica]'s property in [Klis][klis]. The company really cares about carrying on traditions and sharing it with the general public.

At one point, you get to see the production area from the hallway. Through the large windows, you can see the staff cutting, cooking, and packing everything by hand. I saw a batch of cut orange peels ready for the candying process.

What happens to the rest of the orange? [Stella Croatica][stella-croatica] doesn't waste anything: I got to have a glass of fresh-squeezed orange juice, accompanied by a side of their [Maraschino](https://en.wikipedia.org/wiki/Maraschino). (Interestingly, it's the only Croatian product you can by in Vatican City.)

Be sure to allocate time after the tour to take advantage of factory pricing (i.e., half off retail) in their shop. I got a dried fig cake (53 kunas) to share with the [Couchsurfers][cs] I would meet with later that evening, and people seemed to really love it. It was so big that I had enough leftover to snack on twice.

There is also a more thorough option if you have at least two hours: [Stella Croatica][stella-croatica] offers a 90-minute wine, cheese, and olive oil tasting program for 150 kunas. A special feature of the agenda is getting to taste bread baked under a peka (iron bell). The wood-burning stove requires three hours before it's hot enough to bake the bread, and the dough needs an hour to get ready. Needless to say, you must [book this ahead of time](mailto:info@stella-croatica.hr) so that they can prepare for your arrival!

## Grocery stores & farmer's markets

I did visit the [Green Market](https://www.tripadvisor.com/Attraction_Review-g295370-d3420254-Reviews-Green_Market-Split_Split_Dalmatia_County_Dalmatia.html) on the east side of the [palace][diocletian], but after reading that you have to haggle to get a good deal and not knowing a lick of Croatian, I skipped interacting with any of the vendors and went to various grocery stores instead.

### Konzum

[Ul. Stari pazar 2, 21000, Split, Croatia](https://goo.gl/maps/h7AJ62SBKUJ2)

My first grocery store in Split was [Konzum][konzum], and I went there twice in one day: once for breakfast and once for dinner. In the morning, they had a pretty nice selection of hot foods, but by 19:00, they had run out of everything except fries. I grabbed some Dalmatian smoked ham, semi-hard cheese, and a [domestic dunkel](http://www.ratebeer.com/beer/ozujsko-rezano/314956/) to wash it all down. There was some bread involved, too.

### Purex

[Obrov ul. 6, 21000, Split, Croatia](https://goo.gl/maps/jP8m7Vwg3NL2)

Technically, [Purex][purex] is primarily a poultry store, but I had asked the owner of [Kruščić Bakery](https://www.facebook.com/Kruscic.Split) where to find peka-baked bread that I'd heard about from visiting [Stella Croatica](#stella-croatica), and she pointed me to [Purex][purex]. And yes, they sure did have the round loaves sitting behind the counter. You can buy either white or wheat, and they'll sell it in a whole, half, or quarter loaf at 15 kuna per kg. I saved my quarter-loaf of wheat (3.75 kunas) for dinner that day, and it was quite nice: the edges are harder than the rest, likely because it is the thinnest part and more susceptible to the heat of the stove. But the center is fluffy and airy. (See the section about [Tommy](#tommy) for a picture of this special bread.)

### Tommy

[Zagrebačka ul. 37, 21000, Split, Croatia](https://goo.gl/maps/NmuJbdNTFu62)

The staff member at [Tommy][tommy] was what stood out to me about this grocery store: she shared with me that if I bring back my empty beer bottle and my receipt, I can get my 1.25-kuna deposit back. I wanted to avoid eating 150g of cheese in one sitting this time, so at the deli, I asked for 100g of gouda and 100g of [Dalmatina sausage](http://www.podravka.com/product/dalmatina/). Wow, that sausage was quite delicious. I wonder if it's possible to find it outside of Croatia.

The cucumbers were starting to lose their water, but the cherry tomatoes were sweet and satisfying, as was the orange I got. I happened to grab [a bottle of beer](https://www.beeradvocate.com/beer/profile/1730/4877/) made by a sponsor of the [local football team](http://hajduk.hr/eng/article/karlovacko-is-a-new-sponsor-of-hajduk/4711).

### Billa

[Ul. Pavla Šubića 3, 21000, Split, Croatia](https://goo.gl/maps/xFaMaJm1xmM2)

This grocery store has signs posted all over the streets pointing you in its direction. I had low expectations going in since this heavy-handed advertising must not bode well, but I was pleasantly surprised at the size of the store and the quality and selection of goods. It's even located inside a former palace!

A light dinner was all I needed, so I got some fried fish and cabbage salad before going to a [Couchsurfing][cs] event. [Billa][billa] charges 2 kunas for their plasticware sets, available at the prepared foods counter.

## Restaurants

### Krčma Uskok

[Trg Grlo, Klis, Croatia](https://goo.gl/maps/qk6SnhbrtrD2)

To continue my *Game of Thrones* themed visit to the [Klis Fortress](https://en.wikipedia.org/wiki/Fortress_of_Klis), I had roasted whole lamb on a spit for lunch at [Krčma Uskok][uskok]. The owner welcomed me to sit anywhere I wanted, and although the outdoor seats meant I would have to deal with flying ashes from the roaster, the lighting indoors was almost non-existent.

Service was fast and friendly, and the owner seemed happy to entertain my questions about where the lamb comes from (a nearby Dalmatian village that has been raising lambs for 800 years) and how long it takes to roast a whole lamb (somewhere between 1.5-2.5 hours).

I'd wanted to order some domestic draft beer, but he didn't have any at the moment. I went with bread (5 kn: crusty on the outside, soft on the inside), mixed salad (12 kn: lettuce, finely-shredded cabbage, tomatoes, and cucumbers), and 300g of lamb (66 kn: kept hot on the table) instead. Mmm, that lamb was tender and was flavored so nicely. I soaked up all the juices with the bread. They don't have desserts, but [Stella Croatica](#stella-croatica) satisfied that need after lunch.

### Corto Maltese Freestyle Food

[Obrov ul. 7, 21000, Split, Croatia](https://maps.google.com/?q=Corto%20Maltese%20Freestyle%20food%2C%20Obrov%20ul.%207%2C%2021000%2C%20Split%2C%20Croatia&ftid=0x13355dfef52e0c4d:0x35f907cc364d3419&hl=en-US&gl=us)

[Corto Maltese](https://en.wikipedia.org/wiki/Corto_Maltese) is actually a comic book character that this restaurant is named after. Heretofore, I'll be referring to the restaurant rather than the sea captain when I mention [Corto Maltese][corto-maltese]. The ingredients they use are fresh, and their menu has some healthy options.

The first eye-catcher was that they had [Vutra](http://www.vutra.hr), a cannabis liqueur. I had never heard of this before, so obviously, I had to try it. The waitress recommended the Funny Honey (12kn for 0.03L). It was slightly sweet and strong, but I didn't smell any hint of cannabis. Neither did I feel any effects later even though the producer says they use locally grown sativa. Maybe they're using the male plants.

The mussels in Dalmatian sauce (82 kn) were all right, but I had a hard time keeping the mussel sauce off of my clothes. The tomatoes in the seasonal salad (21 kn: with lettuce, cabbage, and cucumbers) actually tasted like tomatoes, so I'm sure they sourced them from a farm.

What was really great was the anchovy sandwich (44 kn: with tomatoes, arugula, and minced garlic) that I returned for when they serve their breakfast menu (before noon). I think this is the best thing they have on their menu: what a shame they don't serve it all day!

[4coffee]: https://www.facebook.com/4coffeesoulfood
[billa]: http://www.billa.hr
[corto-maltese]: http://www.cortomaltese.rocks
[cs]: https://www.couchsurfing.com
[diocletian]: https://en.wikipedia.org/wiki/Diocletian%27s_Palace
[klis]: https://en.wikipedia.org/wiki/Klis
[konzum]: https://www.konzum.hr
[luka]: https://www.facebook.com/LukaIceCream
[purex]: http://www.purex.hr
[stella-croatica]: http://www.stella-croatica.hr/index.php/en
[tommy]: http://tommy.hr/en
[uskok]: https://www.facebook.com/pages/Krčma-Uskok-Klis/239462566164833
[v60]: http://hario.jp


text:
<?php

namespace Bookstore\Entity;

use Doctrine\ORM\EntityRepository;

class CategoriaRepository extends EntityRepository {

}