text:
package org.springframework.security.config.annotation.method.configuration;

import java.util.Map;

import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AutoProxyRegistrar;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

/**
 * Dynamically determines which imports to include using the
 * {@link EnableGlobalMethodSecurity} annotation.
 *
 * @author Rob Winch
 * @since 3.2
 */
final class GlobalMethodSecuritySelector implements ImportSelector {

    public final String[] selectImports(AnnotationMetadata importingClassMetadata) {
        Class<EnableGlobalMethodSecurity> annoType = EnableGlobalMethodSecurity.class;
        Map<String, Object> annotationAttributes = importingClassMetadata.getAnnotationAttributes(annoType.getName(), false);
        AnnotationAttributes attributes = AnnotationAttributes.fromMap(annotationAttributes);
        Assert.notNull(attributes, String.format(
                "@%s is not present on importing class '%s' as expected",
                annoType.getSimpleName(), importingClassMetadata.getClassName()));

        // TODO would be nice if could use BeanClassLoaderAware (does not work)
        Class<?> importingClass = ClassUtils.resolveClassName(importingClassMetadata.getClassName(), ClassUtils.getDefaultClassLoader());
        boolean skipMethodSecurityConfiguration = GlobalMethodSecurityConfiguration.class.isAssignableFrom(importingClass);

        AdviceMode mode = attributes.getEnum("mode");
        String autoProxyClassName = AdviceMode.PROXY == mode ? AutoProxyRegistrar.class.getName()
                : GlobalMethodSecurityAspectJAutoProxyRegistrar.class.getName();
        if(skipMethodSecurityConfiguration) {
            return new String[] { autoProxyClassName };
        }
        return new String[] { autoProxyClassName,
                GlobalMethodSecurityConfiguration.class.getName()};
    }
}


text:
using iQQ.Net.WebQQCore.Im.Event;
using System;
using iQQ.Net.WebQQCore.Im.Http;

namespace iQQ.Net.WebQQCore.Im
{
    public delegate void QQActionListener(object sender, QQActionEvent e);
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

var expect = require('expect.js');
var joi    = require('joi');
var rewire = require('rewire');
var schema = require('./schema');

describe('logger (error logging)', function() {
    describe('when logging error', function() {
        var cfg
        var consoleEntry;
        var logEntry;

        before(function(done) {
            var logger = rewire('../lib/logger');

            logger.config({
                console: true,
                payload: true
            }, function() {
                cfg = logger.__get__("cfg");

                logger.__set__('consoleWriter', {
                    log: function(_consoleEntry) {
                        consoleEntry = _consoleEntry;
                    }
                });

                logger.__set__('client', {
                    rpush: function(listname, _logEntry) {
                        logEntry = _logEntry;
                    }
                });

                logger.error({}, new Error('test'));

                done();
            });
        });

        it('should push error log to redis', function() {
            joi.validate(logEntry, schema.error, function(err) {
                if(err) {
                    throw err;
                }
            });
        });

        it('should write to console out', function() {
            expect(consoleEntry).to.not.be(undefined);
        });

        it('should increment sequence number', function() {
            expect(cfg.sequencenumber).to.equal(2);
        });
    });
});


text:
title: Fondamentaux
category: Sécurité informatique
---

## Sécurité & sûreté

La **sécurité** (safety) est une mesure contre les accidents, ex: gilet de sauvetage.
La **sûreté** (security) est une mesure contre les actes délibérés, ex: vérification des sacs.
Par abus de langage, on parle généralement de sécurité dans les deux cas.

## Principes fondamentaux

La sécurité informatique doit être capable de garantir trois principes primordiaux :

1. La **confidentialité** (confidentiality), interdire l'accès aux donnés aux personnes non légitimes. Ce qui passe par

   * le contrôle de l'usage de données
   * l'anonymat des données / utilisation d'un pseudonyme
   * des communications "invisibles" des personnes externes

2. L'**intégrité** (integrity), protéger les données de mauvaises modifications ou suppressions. Ce qui passe par

   * l'authenticité: la vérification de l'identité des participants à une communication
   * la non-répudiation: qu'émetteur et récepteur du message ne puissent pas être quelqu'un d'autre que celui qu'il dit être
   * l'auditabilité: l'enregistrement des modifications intervenues sur un fichier ou un système

3. La **disponibilité** (availability), que les données soient disponibles pour les utilisateurs légitimes

![](https://i.imgur.com/UGVYy4R.png)

## Menaces

Pour garantir ces principes, il faut se prémunir
– des erreurs et défaillances humaines
– des défaillances matérielle (panne, incendie, inondation, etc)
– des défaillances logicielles (bug)
– de la malveillance informatique interne (virus) ou externe (accès illégal, attaques)

![Statistiques sur les types de menaces](https://i.imgur.com/VcQZj7h.png)

## Prévention des accidents

* Sauvegarder les données et mettre en place un système de restauration
* Utiliser du matériel fiable: onduleur, disques RAID, alimentations, liens réseau et machines multiples
* Placer le matériel dans des sites protégés des accidents naturels  data center

## Prévention de la malveillance

* Respecter le principe du triple A
  * authentification: On authentifie l'utilisateur soit par
    - quelque chose que l'utilisateur connaît: code personnel (CB, digicode), mot de passe ou phrase (passphrase)
    - quelque chose que l'utilisateur possède: clé physique, carte d'accès (puce, bande magnétique), téléphone
    - la biométrie de l'utilisateur: empreinte digitale ou palmaire, reconnaissance visuelle, iris ou rétine de l'oeil, ADN
    - ou une emprunte de l'utilisateur: signature manuscrite, emrpunte vocale

  * autorisation: Une fois authentifié, on définit des autorisations pour cet utilisateur: droit de lecture, écriture, exécution, création, suppression, changement des droits... Les droits d'un groupe d'utilisateur peuvent être gérés au niveau système (ACL) ou au niveau réseau (LDAP).

  * journalisation (accounting): Mise en place de journaux (logs).
    Les logs sont par défaut situés dans le répertoire `/var/log` sous Unix.
    Un serveur de logs et une surveillance des logs peut être mise en place: alertes par mail, SMS.

* Mettre en place des mesures de contrôle d'accès: ACL, certificats, One-Time Passwords (OTP)
* Utiliser des réseaux sécurisés: VPN, tunnels
* Mettre en place des mécanismes de chiffrement et de signature électronique: cryptographie
* Mettre en place des système de détection/prévention d'intrusion: IDS
* Mettre en place des système de défense contre les attaques: firewall


text:
package org.apache.ojb.odmg;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.ClassUtils;
import org.apache.ojb.broker.Identity;
import org.apache.ojb.broker.IdentityFactory;
import org.apache.ojb.broker.OJBRuntimeException;
import org.apache.ojb.broker.PersistenceBrokerInternal;
import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.CollectionProxyListener;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.FieldType;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
import org.apache.ojb.broker.util.BrokerHelper;
import org.apache.ojb.broker.util.logging.Logger;
import org.apache.ojb.broker.util.logging.LoggerFactory;

/**
 * This class encapsulates classes used to take persistence capable object
 * state snapshoot and to detect changed fields or references.
 *
 * @version $Id: Image.java,v 1.1 2007-08-24 22:17:37 ewestfal Exp $
 */
public abstract class Image
{
    static Logger log = LoggerFactory.getLogger(Image.class);
    private long timestamp = System.currentTimeMillis();

    private Image()
    {
    }

    boolean illegalImageComparison(Image oldImage)
    {
        return timestamp < oldImage.timestamp;
    }

    public abstract void cleanup(boolean reuse);

    public abstract boolean modified(Image other);

    abstract void referenceProcessing(Image oldImage);

    public void performReferenceDetection(Image oldImage)
    {
        if(illegalImageComparison(oldImage))
        {
            throw new ImageException("The specified Image object is newer than current one, wrong Image order!");
        }
        referenceProcessing(oldImage);
    }

    //===================================================================
    // inner class
    //===================================================================
    public static class MultipleRef extends Image implements CollectionProxyListener
    {
        static final int IS_NORMAL_OBJECT = 11;
        static final int IS_MATERIALIZED_PROXY = 13;
        static final int IS_UNMATERIALIZED_PROXY = 17;

        private ImageListener listener;
        private final CollectionDescriptor cod;
        private final Object collectionOrArray;
        private Map references;
        private int status;
        private boolean hasTransientIdentity;
        private boolean isRefreshed;

        public MultipleRef(ImageListener listener, CollectionDescriptor cod, Object collectionOrArray)
        {
            this.listener = listener;
            this.cod = cod;
            this.collectionOrArray = collectionOrArray;
            this.isRefreshed = true;
            this.hasTransientIdentity = false;
            this.references = Collections.EMPTY_MAP;
            init();
        }

        private void init()
        {
            CollectionProxy colProxy = ProxyHelper.getCollectionProxy(collectionOrArray);
            if(colProxy != null)
            {
                if(colProxy.isLoaded())
                {
                    status = IS_MATERIALIZED_PROXY;
                    /*
                    TODO: avoid this cast
                    e.g. change CollectionProxy interface - CollectionProxy should
                    extend Collection to support Iterator
                    */
                    handleReferencedObjects(((Collection) colProxy).iterator());
                }
                else
                {
                    status = IS_UNMATERIALIZED_PROXY;
                    if(log.isDebugEnabled()) log.debug("Unmaterialized proxy collection, use proxy listener");
                    colProxy.addListener(this);
                }
            }
            else
            {
                status = IS_NORMAL_OBJECT;
                if(collectionOrArray != null)
                {
                    Iterator it = BrokerHelper.getCollectionIterator(collectionOrArray);
                    handleReferencedObjects(it);
                }
            }
        }

        void handleReferencedObjects(Iterator it)
        {
            if(it == null) return;
            references = new HashMap();
            if(log.isDebugEnabled()) log.debug("Handle collection references");
            IdentityFactory idFac = listener.getBroker().serviceIdentity();
            Identity oid;
            Object obj;
            while(it.hasNext())
            {
                obj = it.next();
                oid = idFac.buildIdentity(obj);
                if(!hasTransientIdentity && oid.isTransient())
                {
                    hasTransientIdentity = true;
                }
                references.put(oid, obj);
            }
        }

        public void cleanup(boolean reuse)
        {
            if(log.isDebugEnabled()) log.debug("Cleanup collection image, reuse=" + reuse);
            if(reuse)
            {
                isRefreshed = false;
            }
            else
            {
                if(status == IS_UNMATERIALIZED_PROXY)
                {
                    CollectionProxy colProxy = ProxyHelper.getCollectionProxy(collectionOrArray);
                    if(colProxy != null)
                    {
                        colProxy.removeListener(this);
                    }
                }
            }
        }

        void referenceProcessing(Image oldImage)
        {
            MultipleRef oldRefs = (MultipleRef) oldImage;
            if(incommensurableProxies(oldRefs))
            {
                if(isUnmaterializedProxy()) handleReferencedObjects(BrokerHelper.getCollectionIterator(collectionOrArray));
                if(oldRefs.isUnmaterializedProxy()) oldRefs.handleReferencedObjects(BrokerHelper.getCollectionIterator(oldRefs.collectionOrArray));
            }
            if(!isRefreshed) refreshIdentities();
            if(!oldRefs.isRefreshed) oldRefs.refreshIdentities();

            // find deleted reference objects
            if(oldRefs.references.size() > 0)
            {
                Iterator oldIter = oldRefs.references.entrySet().iterator();
                while(oldIter.hasNext())
                {
                    Map.Entry entry = (Map.Entry) oldIter.next();
                    Identity oldOid = (Identity) entry.getKey();
                    /*
                    search for deleted objects: if in the new image an object
                    from the old image is not contained, we found a deleted object
                    */
                    if(!isUnmaterializedProxy() && !containsReference(oldOid))
                    {
                        listener.deletedXToN(cod, entry.getValue(), oldOid);
                    }
                }
            }

            // find new reference objects
            if(references.size() > 0)
            {
                Iterator newIter = references.entrySet().iterator();
                while(newIter.hasNext())
                {
                    Map.Entry entry = (Map.Entry) newIter.next();
                    Identity newOid = (Identity) entry.getKey();
                    /*
                    search for added objects: if in the old image an object
                    from the new image is not contained, we found a added object
                    */
                    if(!oldRefs.containsReference(newOid))
                    {
                        listener.addedXToN(cod, entry.getValue(), newOid);
                    }
                }
            }
        }

        /**
         * To detect deleted (added) collection objects it's necessary iterate over the old (new) image collection.
         * If the old (new) image collection is a unmaterialized proxy we have to check if the new (old) image collection
         * is the same proxy instance or not.
         * E.g. if the user exchange one another the unmaterialized proxy collection objects of two main objects,
         * then both proxy need to be materialized to assign the changed FK field values.
         */
        private boolean incommensurableProxies(MultipleRef oldImage)
        {
            boolean result = false;
            // deleted objects
            if(oldImage.isUnmaterializedProxy() || isUnmaterializedProxy())
            {
                result = !collectionOrArray.equals(oldImage.collectionOrArray);
            }
            return result;
        }

        private void refreshIdentities()
        {
            // if no transient identities are used, nothing to do
            if(hasTransientIdentity && references.size() > 0)
            {
                hasTransientIdentity = false;
                // we need independent key list from Map
                List list = new ArrayList(references.keySet());
                IdentityFactory idFac = listener.getBroker().serviceIdentity();
                Identity oid, newOid;
                Object obj;
                for(int i = 0; i < list.size(); i++)
                {
                    oid = (Identity) list.get(i);
                    if(oid.isTransient())
                    {
                        obj = references.remove(oid);
                        newOid = idFac.buildIdentity(obj);
                        references.put(newOid, obj);
                        if(!hasTransientIdentity && oid.isTransient())
                        {
                            hasTransientIdentity = true;
                        }
                    }
                }
                isRefreshed = true;
            }
        }

        /**
         * Always return 'false', because changed 1:n or m:n references do not
         * affect the main object.
         */
        public boolean modified(Image other)
        {
            return false;
        }

        boolean containsReference(Identity oid)
        {
            if(!isRefreshed) refreshIdentities();
            return references.containsKey(oid);
        }

        Map getIdentityReferenceObjectMap()
        {
            if(!isRefreshed) refreshIdentities();
            return references;
        }

        boolean isMaterializedProxy()
        {
            return status == IS_MATERIALIZED_PROXY;
        }

        boolean isUnmaterializedProxy()
        {
            return status == IS_UNMATERIALIZED_PROXY;
        }

        // CollectionProxy Listener methods
        //---------------------------------
        public void beforeLoading(CollectionProxyDefaultImpl colProxy)
        {
            //noop
        }

        public void afterLoading(CollectionProxyDefaultImpl colProxy)
        {
            if(status == IS_UNMATERIALIZED_PROXY)
            {
                status = IS_MATERIALIZED_PROXY;
                handleReferencedObjects(colProxy.iterator());
                colProxy.removeListener(this);
            }
        }

        public String toString()
        {
            return ClassUtils.getShortClassName(this.getClass()) + "[references-size="
                    + (references != null ? "" + references.size() : "undefined") + "]";
        }
    }

    //===================================================================
    // inner class
    //===================================================================
    public static class SingleRef extends Image
    {
        private Object referenceObjOrProxy;
        private Identity oid = null;
        private final ImageListener listener;
        private final ObjectReferenceDescriptor ord;

        public SingleRef(ImageListener listener, ObjectReferenceDescriptor ord, Object reference)
        {
            this.listener = listener;
            this.ord = ord;
            this.referenceObjOrProxy = reference;
        }

        public void cleanup(boolean reuse)
        {
            if(!reuse)
            {
                referenceObjOrProxy = null;
            }
        }

        void referenceProcessing(Image oldImage)
        {
            SingleRef oldRef = (SingleRef) oldImage;
            boolean isSame = getReferenceObjectOrProxy() == oldRef.getReferenceObjectOrProxy();
            if(!isSame)
            {
                Identity newOid = getIdentity();
                Identity oldOid = oldRef.getIdentity();
                if(newOid == null)
                {
                    if(oldOid != null)
                    {
                        listener.deletedOneToOne(ord, oldRef.getReferenceObjectOrProxy(), oldOid, true);
                    }
                }
                else
                {
                    if(oldOid == null)
                    {
                        listener.addedOneToOne(ord, getReferenceObjectOrProxy(), newOid);
                    }
                    else
                    {
                        if(!newOid.equals(oldOid))
                        {
                            listener.deletedOneToOne(ord, oldRef.getReferenceObjectOrProxy(), oldOid, false);
                            listener.addedOneToOne(ord, getReferenceObjectOrProxy(), newOid);
                        }
                    }
                }
            }
        }

        public Object getReferenceObjectOrProxy()
        {
            return referenceObjOrProxy;
        }

        private Identity getIdentity()
        {
            if(oid == null || oid.isTransient())
            {
                if(referenceObjOrProxy != null)
                {
                    oid = listener.getBroker().serviceIdentity().buildIdentity(referenceObjOrProxy);
                }
            }
            return oid;
        }

        /**
         * If a 1:1 reference has changed it will
         * affects the main object (FK needs update).
         */
        public boolean modified(Image toCompare)
        {
            boolean modified = false;
            if(!(this == toCompare))
            {
                if(toCompare instanceof Image.SingleRef)
                {
                    Image.SingleRef other = (Image.SingleRef) toCompare;
                    Identity current = getIdentity();
                    Identity otherOid = other.getIdentity();
                    modified = current != null ? !current.equals(otherOid) : !(otherOid == null);
                }
            }
            return modified;
        }

        public String toString()
        {
            return ClassUtils.getShortClassName(this.getClass()) + "[reference=" + getIdentity() + "]";
        }
    }

    //===================================================================
    // inner class
    //===================================================================
    public static class Field extends Image
    {
        private final FieldType type;
        private final Object value;

        public Field(FieldType type, Object value)
        {
            this.type = type;
            this.value = value;
        }

        public void cleanup(boolean reuse)
        {
        }

        void referenceProcessing(Image oldImage)
        {
            // nothing to do
        }

        /** If a field value has changed return 'true'. */
        public boolean modified(Image other)
        {
            boolean result = false;
            if(this == other)
            {
                result = true;
            }
            else
            {
                if(other instanceof Field)
                {
                    result = !type.equals(value, ((Field) other).value);
                }
            }
            return result;
        }

        public String toString()
        {
            return ClassUtils.getShortClassName(this.getClass()) + "[type=" + type + ", value=" + value + "]";
        }
    }

    //===================================================================
    // inner interface
    //===================================================================
    public static interface ImageListener
    {
        public void addedOneToOne(ObjectReferenceDescriptor ord, Object refObjOrProxy, Identity oid);

        public void deletedOneToOne(ObjectReferenceDescriptor ord, Object refObjOrProxy, Identity oid, boolean needsUnlink);

        public void addedXToN(CollectionDescriptor ord, Object refObjOrProxy, Identity oid);

        public void deletedXToN(CollectionDescriptor ord, Object refObjOrProxy, Identity oid);

        public PersistenceBrokerInternal getBroker();
    }

    //====================================================
    // inner class
    //====================================================

    /**
     * Thrown if something unexpected is happen when handling the
     * object images for state detection.
     */
    public static class ImageException extends OJBRuntimeException
    {
        public ImageException()
        {
        }

        public ImageException(String msg)
        {
            super(msg);
        }

        public ImageException(Throwable cause)
        {
            super(cause);
        }

        public ImageException(String msg, Throwable cause)
        {
            super(msg, cause);
        }
    }
}


text:
package org.uberfire.ext.plugin.client.editor;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;

import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.NavPills;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.RequiresResize;
import com.google.gwt.user.client.ui.Widget;
import org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;
import org.uberfire.ext.plugin.client.code.CodeElement;
import org.uberfire.ext.plugin.client.widget.split.HorizontalSplit;
import org.uberfire.ext.plugin.model.CodeType;
import org.uberfire.ext.plugin.model.PluginContent;
import org.uberfire.ext.plugin.model.PluginSimpleContent;
import org.uberfire.ext.widgets.common.client.ace.AceEditor;
import org.uberfire.ext.widgets.common.client.ace.AceEditorMode;
import org.uberfire.ext.widgets.common.client.ace.AceEditorTheme;
import org.uberfire.mvp.Command;
import org.uberfire.mvp.ParameterizedCommand;

import static org.uberfire.ext.plugin.client.code.CodeList.*;

@Dependent
public class PerspectiveEditorView
        extends BaseEditorViewImpl
        implements RequiresResize {

    interface ViewBinder
            extends
            UiBinder<Widget, PerspectiveEditorView> {

    }

    private static ViewBinder uiBinder = GWT.create( ViewBinder.class );

    @UiField
    FlowPanel htmlPanel;

    @UiField
    FlowPanel content;

    @UiField
    HorizontalSplit leftHorizontalSplit;

    @UiField
    FlowPanel topArea;

    @UiField
    FlowPanel topContent;

    @UiField
    FlowPanel bottomArea;

    @UiField
    FlowPanel bottomContent;

    @UiField
    NavPills lifecycleHolder;

    @UiField
    Dropdown lifecycles;

    protected final AceEditor templateEditor = new AceEditor();
    protected final AceEditor jsEditor = new AceEditor();

    protected Map<CodeType, String> codeMap = new HashMap<CodeType, String>();
    protected CodeType currentElement = null;

    protected PluginContent pluginContent;

    @PostConstruct
    public void init() {
        initWidget( uiBinder.createAndBindUi( this ) );

        htmlPanel.getElement().getStyle().setBackgroundColor( "#F6F6F6" );

        setup( MAIN, DIVIDER, ON_OPEN, ON_CLOSE, ON_SHUTDOWN, DIVIDER, PANEL_TYPE );

        leftHorizontalSplit.init( topArea, bottomArea, content, editorResizing );

        setupEditor( templateEditor, topContent );
        setupEditor( jsEditor, bottomContent );

        templateEditor.startEditor();
        templateEditor.setMode( AceEditorMode.JAVASCRIPT );
        templateEditor.setTheme( AceEditorTheme.CHROME );

        jsEditor.startEditor();
        jsEditor.setMode( AceEditorMode.JAVASCRIPT );
        jsEditor.setTheme( AceEditorTheme.CHROME );
    }

    final Command editorResizing = new Command() {
        @Override
        public void execute() {
            templateEditor.redisplay();

            Double editorHeight = 100 - ( ( (double) lifecycleHolder.getOffsetHeight() / bottomArea.getOffsetHeight() ) * 100 );
            if ( editorHeight.equals( Double.NaN ) || editorHeight.doubleValue() <= 0d ) {
                return;
            }
            jsEditor.setHeight( editorHeight + "%" );
            jsEditor.redisplay();

        }
    };

    final ParameterizedCommand<CodeType> codeChange = new ParameterizedCommand<CodeType>() {
        @Override
        public void execute( final CodeType parameter ) {
            codeMap.put( currentElement, jsEditor.getText() );
            currentElement = parameter;
            final String content = codeMap.get( currentElement );
            if ( content != null ) {
                jsEditor.setText( content );
            } else {
                jsEditor.setText( "" );
            }
            jsEditor.setFocus();
        }
    };

    private void setup( final CodeElement... elements ) {
        lifecycles.setIcon( elements[ 0 ].getIcon() );
        lifecycles.setText( elements[ 0 ].toString() );
        currentElement = elements[ 0 ].getType();

        for ( final CodeElement element : elements ) {
            element.addNav( lifecycles, codeChange );
        }
    }

    protected void setupContent( final PluginContent pluginContent ) {

        for ( final Map.Entry<CodeType, String> entry : pluginContent.getCodeMap().entrySet() ) {
            codeMap.put( entry.getKey(), entry.getValue() );
        }

        jsEditor.setText( codeMap.get( currentElement ) );
        templateEditor.setText( pluginContent.getTemplate() );

        this.pluginContent = pluginContent;
    }

    private void setupEditor( final AceEditor editor,
                              final FlowPanel content ) {
        editor.setWidth( "100%" );
        editor.setHeight( "100%" );

        content.add( editor );
    }

    public String getTemplate() {
        return templateEditor.getText();
    }

    public Map<CodeType, String> getCodeMap() {
        codeMap.put( currentElement, jsEditor.getText() );
        return codeMap;
    }

    public PluginSimpleContent getContent() {
        return new PluginSimpleContent( pluginContent, getTemplate(), getCodeMap() );
    }

    @Override
    public void onResize() {
        htmlPanel.setHeight( getParent().getParent().getOffsetHeight() + "px" );
        leftHorizontalSplit.getElement().getStyle().setTop( topArea.getOffsetHeight() - 6, Style.Unit.PX );
        editorResizing.execute();
    }
}


text:
#include "./aom_scale_rtcd.h"
#include "aom_scale/aom_scale.h"
#include "aom_mem/aom_mem.h"
/****************************************************************************
 *  Imports
 ****************************************************************************/

/****************************************************************************
 *
 *
 *  INPUTS        : const unsigned char *source : Pointer to source data.
 *                  unsigned int source_width   : Stride of source.
 *                  unsigned char *dest         : Pointer to destination data.
 *                  unsigned int dest_width     : Stride of destination
 *                                                (NOT USED).
 *
 *  OUTPUTS       : None.
 *
 *  RETURNS       : void
 *
 *  FUNCTION      : Copies horizontal line of pixels from source to
 *                  destination scaling up by 4 to 5.
 *
 *  SPECIAL NOTES : None.
 *
 ****************************************************************************/
void aom_horizontal_line_5_4_scale_c(const unsigned char *source,
                                     unsigned int source_width,
                                     unsigned char *dest,
                                     unsigned int dest_width) {
  const unsigned char *const source_end = source + source_width;
  (void)dest_width;

  while (source < source_end) {
    const unsigned int a = source[0];
    const unsigned int b = source[1];
    const unsigned int c = source[2];
    const unsigned int d = source[3];
    const unsigned int e = source[4];

    dest[0] = (unsigned char)a;
    dest[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
    dest[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
    dest[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);

    source += 5;
    dest += 4;
  }
}

void aom_vertical_band_5_4_scale_c(unsigned char *source, int src_pitch,
                                   unsigned char *dest, int dest_pitch,
                                   unsigned int dest_width) {
  const unsigned char *const dest_end = dest + dest_width;
  while (dest < dest_end) {
    const unsigned int a = source[0 * src_pitch];
    const unsigned int b = source[1 * src_pitch];
    const unsigned int c = source[2 * src_pitch];
    const unsigned int d = source[3 * src_pitch];
    const unsigned int e = source[4 * src_pitch];

    dest[0 * dest_pitch] = (unsigned char)a;
    dest[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
    dest[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
    dest[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);

    ++source;
    ++dest;
  }
}

/*7***************************************************************************
 *
 *  ROUTINE       : aom_horizontal_line_3_5_scale_c
 *
 *  INPUTS        : const unsigned char *source : Pointer to source data.
 *                  unsigned int source_width   : Stride of source.
 *                  unsigned char *dest         : Pointer to destination data.
 *                  unsigned int dest_width     : Stride of destination
 *                                                (NOT USED).
 *
 *  OUTPUTS       : None.
 *
 *  RETURNS       : void
 *
 *  FUNCTION      : Copies horizontal line of pixels from source to
 *                  destination scaling up by 3 to 5.
 *
 *  SPECIAL NOTES : None.
 *
 *
 ****************************************************************************/
void aom_horizontal_line_5_3_scale_c(const unsigned char *source,
                                     unsigned int source_width,
                                     unsigned char *dest,
                                     unsigned int dest_width) {
  const unsigned char *const source_end = source + source_width;
  (void)dest_width;
  while (source < source_end) {
    const unsigned int a = source[0];
    const unsigned int b = source[1];
    const unsigned int c = source[2];
    const unsigned int d = source[3];
    const unsigned int e = source[4];

    dest[0] = (unsigned char)a;
    dest[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
    dest[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);

    source += 5;
    dest += 3;
  }
}

void aom_vertical_band_5_3_scale_c(unsigned char *source, int src_pitch,
                                   unsigned char *dest, int dest_pitch,
                                   unsigned int dest_width) {
  const unsigned char *const dest_end = dest + dest_width;
  while (dest < dest_end) {
    const unsigned int a = source[0 * src_pitch];
    const unsigned int b = source[1 * src_pitch];
    const unsigned int c = source[2 * src_pitch];
    const unsigned int d = source[3 * src_pitch];
    const unsigned int e = source[4 * src_pitch];

    dest[0 * dest_pitch] = (unsigned char)a;
    dest[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
    dest[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);

    ++source;
    ++dest;
  }
}

/****************************************************************************
 *
 *  ROUTINE       : aom_horizontal_line_1_2_scale_c
 *
 *  INPUTS        : const unsigned char *source : Pointer to source data.
 *                  unsigned int source_width   : Stride of source.
 *                  unsigned char *dest         : Pointer to destination data.
 *                  unsigned int dest_width     : Stride of destination
 *                                                (NOT USED).
 *
 *  OUTPUTS       : None.
 *
 *  RETURNS       : void
 *
 *  FUNCTION      : Copies horizontal line of pixels from source to
 *                  destination scaling up by 1 to 2.
 *
 *  SPECIAL NOTES : None.
 *
 ****************************************************************************/
void aom_horizontal_line_2_1_scale_c(const unsigned char *source,
                                     unsigned int source_width,
                                     unsigned char *dest,
                                     unsigned int dest_width) {
  const unsigned char *const source_end = source + source_width;
  (void)dest_width;
  while (source < source_end) {
    dest[0] = source[0];
    source += 2;
    ++dest;
  }
}

void aom_vertical_band_2_1_scale_c(unsigned char *source, int src_pitch,
                                   unsigned char *dest, int dest_pitch,
                                   unsigned int dest_width) {
  (void)dest_pitch;
  (void)src_pitch;
  memcpy(dest, source, dest_width);
}

void aom_vertical_band_2_1_scale_i_c(unsigned char *source, int src_pitch,
                                     unsigned char *dest, int dest_pitch,
                                     unsigned int dest_width) {
  const unsigned char *const dest_end = dest + dest_width;
  (void)dest_pitch;
  while (dest < dest_end) {
    const unsigned int a = source[-src_pitch] * 3;
    const unsigned int b = source[0] * 10;
    const unsigned int c = source[src_pitch] * 3;
    dest[0] = (unsigned char)((8 + a + b + c) >> 4);
    ++source;
    ++dest;
  }
}


text:
async function f() {
  let promise = new Promise((resolve, reject) => {
    setTimeout(() => reject("Task completed with error."), 2000);
  });

  console.log('Start.'); // "start!"
  try {
    let result = await promise; // wait untill promise resolve
    console.log(result); // "done!"
    return result;
  } catch (err) {
    console.log('Rejected: ' + err); // "rejected"
    throw err;
  }
}

f().then((data) => console.log('Really finished: ' + data))
  .catch((data) => console.log('Really finished REJECT: ' + data));


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        protocol/ftp.h
// Purpose:     interface of wxFTP
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxFTP

    wxFTP can be used to establish a connection to an FTP server and perform all the
    usual operations. Please consult the RFC 959 (http://www.w3.org/Protocols/rfc959/)
    for more details about the FTP protocol.

    wxFTP can thus be used to create a (basic) FTP @b client.

    To use a command which doesn't involve file transfer (i.e. directory oriented
    commands) you just need to call a corresponding member function or use the
    generic wxFTP::SendCommand() method.
    However to actually transfer files you just get or give a stream to or from this
    class and the actual data are read or written using the usual stream methods.

    Example of using wxFTP for file downloading:

    @code
        wxFTP ftp;

        // if you don't use these lines anonymous login will be used
        ftp.SetUser("user");
        ftp.SetPassword("password");

        if ( !ftp.Connect("ftp.wxwidgets.org") )
        {
            wxLogError("Couldn't connect");
            return;
        }

        ftp.ChDir("/pub/2.8.9");
        const char *filename = "wxWidgets-2.8.9.tar.bz2";
        int size = ftp.GetFileSize(filename);
        if ( size == -1 )
        {
            wxLogError("Couldn't get the file size for \"%s\"", filename);
        }

        wxInputStream *in = ftp.GetInputStream(filename);
        if ( !in )
        {
            wxLogError("Couldn't get the file");
        }
        else
        {
            char *data = new char[size];
            if ( !in->Read(data, size) )
            {
                wxLogError("Read error: %d", ftp.GetError());
            }
            else
            {
                // file data is in the buffer
                ...
            }

            delete [] data;
            delete in;
        }

        // gracefully close the connection to the server
        ftp.Close();
    @endcode

    To upload a file you would do (assuming the connection to the server was opened
    successfully):

    @code
        wxOutputStream *out = ftp.GetOutputStream("filename");
        if ( out )
        {
            out->Write(...); // your data
            delete out;
        }
    @endcode

    @library{wxnet}
    @category{net}

    @see wxSocketBase
*/
class wxFTP : public wxProtocol
{
public:
    /**
        Transfer modes used by wxFTP.
    */
  enum TransferMode {
        NONE,       //!< not set by user explicitly.
        ASCII,
        BINARY
  };
    /**
        Default constructor.
    */
  wxFTP();
    /**
        Destructor will close the connection if connected.
    */
  virtual ~wxFTP();
    //@{
    /**
        Connect to the FTP server to default port (21) of the specified @a host.
     */
  virtual bool Connect(const wxString& host);
    /**
        Connect to the FTP server to any port of the specified @a host.
        By default (@a port = 0), connection is made to default FTP port (21)
        of the specified @a host.

        @since 2.9.1
     */
  virtual bool Connect(const wxString& host, unsigned short port);
    //@}

    /**
        @name Functions for managing the FTP connection
     */
    //@{

    /**
        Aborts the download currently in process, returns @true if ok, @false
        if an error occurred.
    */
  virtual bool Abort();
    /**
        Gracefully closes the connection with the server.
    */
  virtual bool Close();
    /**
        Send the specified @a command to the FTP server. @a ret specifies
        the expected result.

        @return @true if the command has been sent successfully, else @false.
    */
  bool CheckCommand(const wxString& command, char ret);
    /**
        Returns the last command result, i.e. the full server reply for the last command.
    */
  const wxString& GetLastResult();
    /**
        Send the specified @a command to the FTP server and return the first
        character of the return code.
    */
  char SendCommand(const wxString& command);
    /**
        Sets the transfer mode to ASCII. It will be used for the next transfer.
    */
  bool SetAscii();
    /**
        Sets the transfer mode to binary. It will be used for the next transfer.
    */
  bool SetBinary();
    /**
        If @a pasv is @true, passive connection to the FTP server is used.

        This is the default as it works with practically all firewalls.
        If the server doesn't support passive mode, you may call this function
        with @false as argument to use an active connection.
    */
  void SetPassive(bool pasv);
    /**
        Sets the password to be sent to the FTP server to be allowed to log in.
    */
  virtual void SetPassword(const wxString& passwd);
    /**
        Sets the transfer mode to the specified one. It will be used for the next
        transfer.

        If this function is never called, binary transfer mode is used by default.
    */
  bool SetTransferMode(TransferMode mode);
    /**
        Sets the user name to be sent to the FTP server to be allowed to log in.
    */
  virtual void SetUser(const wxString& user);
    //@}

    /**
        @name Filesystem commands
     */
    //@{

    /**
        Change the current FTP working directory.
        Returns @true if successful.
    */
  bool ChDir(const wxString& dir);
    /**
        Create the specified directory in the current FTP working directory.
        Returns @true if successful.
    */
  bool MkDir(const wxString& dir);
    /**
        Returns the current FTP working directory.
    */
  wxString Pwd();
    /**
        Rename the specified @a src element to @e dst. Returns @true if successful.
    */
  bool Rename(const wxString& src, const wxString& dst);
    /**
        Remove the specified directory from the current FTP working directory.
        Returns @true if successful.
    */
  bool RmDir(const wxString& dir);
    /**
        Delete the file specified by @e path. Returns @true if successful.
    */
  bool RmFile(const wxString& path);
    /**
        Returns @true if the given remote file exists, @false otherwise.
    */
  bool FileExists(const wxString& filename);
    /**
        The GetList() function is quite low-level. It returns the list of the files in
        the current directory. The list can be filtered using the @a wildcard string.

        If @a wildcard is empty (default), it will return all files in directory.
        The form of the list can change from one peer system to another. For example,
        for a UNIX peer system, it will look like this:

        @verbatim
        -r--r--r--   1 guilhem  lavaux      12738 Jan 16 20:17 cmndata.cpp
        -r--r--r--   1 guilhem  lavaux      10866 Jan 24 16:41 config.cpp
        -rw-rw-rw-   1 guilhem  lavaux      29967 Dec 21 19:17 cwlex_yy.c
        -rw-rw-rw-   1 guilhem  lavaux      14342 Jan 22 19:51 cwy_tab.c
        -r--r--r--   1 guilhem  lavaux      13890 Jan 29 19:18 date.cpp
        -r--r--r--   1 guilhem  lavaux       3989 Feb  8 19:18 datstrm.cpp
        @endverbatim

        But on Windows system, it will look like this:

        @verbatim
        winamp~1 exe    520196 02-25-1999  19:28  winamp204.exe
            1 file(s)           520 196 bytes
        @endverbatim

        @return @true if the file list was successfully retrieved, @false otherwise.

        @see GetFilesList()
    */
  bool GetDirList(wxArrayString& files, const wxString& wildcard = wxEmptyString);
    /**
        Returns the file size in bytes or -1 if the file doesn't exist or the size
        couldn't be determined.

        Notice that this size can be approximative size only and shouldn't be used
        for allocating the buffer in which the remote file is copied, for example.
    */
  int GetFileSize(const wxString& filename);
    /**
        This function returns the computer-parsable list of the files in the current
        directory (optionally only of the files matching the @e wildcard, all files
        by default).

        This list always has the same format and contains one full (including the
        directory path) file name per line.

        @return @true if the file list was successfully retrieved, @false otherwise.

        @see GetDirList()
    */
  bool GetFilesList(wxArrayString& files, const wxString& wildcard = wxEmptyString);
    //@}

    /**
        @name Download and upload functions
     */

    //@{
    /**
        Creates a new input stream on the specified path.

        You can use all but the seek functionality of wxStreamBase.
        wxStreamBase::Seek() isn't available on all streams. For example, HTTP or FTP
        streams do not deal with it. Other functions like wxStreamBase::Tell() are
        not available for this sort of stream, at present.

        You will be notified when the EOF is reached by an error.

        @return Returns @NULL if an error occurred (it could be a network failure
                or the fact that the file doesn't exist).
    */
  virtual wxInputStream* GetInputStream(const wxString& path);
    /**
        Initializes an output stream to the specified @a file.

        The returned stream has all but the seek functionality of wxStreams.
        When the user finishes writing data, he has to delete the stream to close it.

        @return An initialized write-only stream.
                Returns @NULL if an error occurred (it could be a network failure
                or the fact that the file doesn't exist).
    */
  virtual wxOutputStream* GetOutputStream(const wxString& file);
    //@}
};


text:
import argparse
import csv, os, time
import MySQLdb  # http://sourceforge.net/projects/mysql-python/
import result
from result import Result
import gspread, getpass # https://pypi.python.org/pypi/gspread/ (v0.1.0)

# Get command line arguments
parser = argparse.ArgumentParser(description='Load SNP and locus data')
parser.add_argument('--db', type=str, help='MySQL database name')
parser.add_argument('--yhost', type=str, help='MySQL host')
parser.add_argument('--username', type=str, help='MySQL username')
parser.add_argument('--password', type=str, help='MySQL password')
parser.add_argument('--tag', type=str, help='Tag to place in results file')
parser.add_argument('--remote', action='store_true', help='Enable remote reporting')
parser.add_argument('--rkey', help='Google document key')
args = parser.parse_args()

# Set default variables
remote = False
databaseName = 'snp_research'
username = 'dev'
password = ''
sqlHost = '127.0.0.1'
tag = ''
docKey = ''

# Update any present from CLI
if args.remote and args.rkey is not None: # If set to remote log and document key is present, log to GDocs
    remote = True
    docKey = args.rkey
else:
    remote = False

if args.db is not None: # If set, use as database name for MySQL
    databaseName = args.db
if args.username is not None: # MySQL username
    username = args.username
if args.password is not None: # MySQL password
    password = args.password
if args.yhost is not None: # MySQL host name
    sqlHost = args.yhost
if args.tag is not None: # Tag to place in results file
    tag = args.tag

# Open results file, print headers
resultsFileName = 'results-mysqlqueries'
if resultsFileName != "":
    resultsFileName += '-' + tag
resultsFileName += '.txt'
resultsFile = open(resultsFileName, 'w')
result = Result()
resultsFile.write(result.toHeader() + '\n')

if remote:
    gusername = raw_input("Enter Google username: ")
    gpassword = getpass.getpass("Enter Google password: ")
    gs = gspread.Client(auth=(gusername,gpassword))
    gs.login()
    ss = gs.open_by_key(docKey)
    ws = ss.add_worksheet(tag + "-" + str(time.time()),1,1)
    ws.append_row(result.headerArr())

# Create MySQL database, tables if not exists
mysqlConnection = MySQLdb.connect(host=sqlHost,user=username,passwd=password,db=databaseName)
cursor = mysqlConnection.cursor()

genes = ["ACSL6","ZDHHC8","TPH1","SYN2","DISC1","DISC2","COMT","FXYD6","ERBB4","DAOA","MEGF10","SLC18A1","DYM","SREBF2","NXRN1","CSF2RA","IL3RA","DRD2"]

for z in range(1,11):
    for g in genes:
        result = Result()
        result.method = "MySQL-QrySet" + str(z)
        result.tag = tag + "-" + g + "/" + str(z)
        print "Running queries: " + g + "/" + str(z)

        qryStart = time.time()
        cursor.execute("SELECT count(distinct s.rsid) FROM locus l, snp s WHERE l.snp_id = s.id AND l.gene = '" + g + "'")
        qryEnd = time.time()
        result.qryByGene = qryEnd-qryStart

        qryStart = time.time()
        cursor.execute("SELECT count(distinct s.rsid) FROM locus l, snp s WHERE l.snp_id = s.id AND l.gene = '" + g + "' AND s.has_sig = true")
        qryEnd = time.time()
        result.qryByGeneSig = qryEnd-qryStart

        resultsFile.write(result.toString() + '\n')
        if remote:
            try:
                print "Sending to GDocs..."
                gs.login()
                ws.append_row(result.stringArr())
            except:
                print "Unable to send to GDocs, continuing..."

print "Run complete!"


text:
<?php

/**
 * Created by PhpStorm.
 * User: tebazil
 * Date: 17.09.15
 * Time: 16:58
 */
class GeneratorConfiguratorTest extends PHPUnit_Framework_TestCase
{
    private $configurator;
    public function __construct($name = null, array $data = array(), $dataName = '')
    {
        $this->configurator = new \tebazil\dbseeder\GeneratorConfigurator();
        parent::__construct($name, $data, $dataName);
    }

    public function testPk() {
        $this->assertEquals('pk', $this->configurator->pk());
    }

    public function testRelation() {
        $table = 'table';
        $column = 'column';
        $this->assertEquals(['relation',$table, $column], $this->configurator->relation($table, $column));
    }

    public function testGetFakerConfigurator() {
        $this->assertInstanceOf('tebazil\dbseeder\FakerConfigurator', $this->configurator->getFakerConfigurator());
    }

}


text:
#ifndef _DtxWorkRecord_
#define _DtxWorkRecord_

#include "qpid/broker/BrokerImportExport.h"
#include "qpid/broker/DtxBuffer.h"
#include "qpid/broker/TransactionalStore.h"

#include "qpid/framing/amqp_types.h"
#include "qpid/sys/Mutex.h"

#include <algorithm>
#include <functional>
#include <vector>

#include <boost/intrusive_ptr.hpp>

namespace qpid {
namespace broker {

struct DtxTimeout;

/**
 * Represents the work done under a particular distributed transaction
 * across potentially multiple channels. Identified by a xid. Allows
 * that work to be prepared, committed and rolled-back.
 */
class DtxWorkRecord
{
    typedef std::vector<boost::intrusive_ptr<DtxBuffer> >Work;

    const std::string xid;
    TransactionalStore* const store;
    bool completed;
    bool rolledback;
    bool prepared;
    bool expired;
    boost::intrusive_ptr<DtxTimeout> timeout;
    Work work;
    std::auto_ptr<TPCTransactionContext> txn;
    qpid::sys::Mutex lock;

    bool check();
    void abort();
    bool prepare(TransactionContext* txn);
public:
    QPID_BROKER_EXTERN DtxWorkRecord(const std::string& xid,
                                     TransactionalStore* const store);
    QPID_BROKER_EXTERN ~DtxWorkRecord();
    QPID_BROKER_EXTERN bool prepare();
    QPID_BROKER_EXTERN bool commit(bool onePhase);
    QPID_BROKER_EXTERN void rollback();
    QPID_BROKER_EXTERN void add(boost::intrusive_ptr<DtxBuffer> ops);
    void recover(std::auto_ptr<TPCTransactionContext> txn, boost::intrusive_ptr<DtxBuffer> ops);
    void timedout();
    void setTimeout(boost::intrusive_ptr<DtxTimeout> t);
    boost::intrusive_ptr<DtxTimeout> getTimeout();
    std::string getXid() const { return xid; }
    bool isCompleted() const { return completed; }
    bool isRolledback() const { return rolledback; }
    bool isPrepared() const { return prepared; }
    bool isExpired() const { return expired; }
};

}} // qpid::broker

#endif


text:
NTRU Patent Licensing
=======================
Security Innovation NTRU cryptographic software invention and reference source code including NTRUCrypt and NTRUSign/PASS is a **dual license** product available under open source and standard commercial licensing.

GPL
===========
NTRU cryptographic patents may be used  as long as the user adheres to version two (2) or higher of the GPL License. For  details please refer to COPYING-2.txt included in this distribution.

The GPLv2 license may also be found on the gnu.org website at: (http://www.gnu.org/licenses/gpl-2.0.html)

Commercial Licensing
====================
Businesses and enterprises that wish to incorporate NTRU cryptography into proprietary appliances or other commercial software products for re-distribution must have a commercial license. Commercial licenses are available using flexible licensing terms on a one time per product fee or running royalty.  For details please refer to COMMERCIAL LICENSE.doc included in this distribution.

NTRU Patents Covered under license
===================================
**Invention	U.S. Patent No.	U.S. Issue Date	U.S. Application No.
U.S. Filing Date	Countries**

Secure User Identification based on constrained polynomials	6,076,163
Jun13, 2000	08/954,712	Oct 20, 1997	US

Public key cryptosystem method and apparatus	6,081,597	Jun 27, 2000 08/914,449
Aug 19, 1997	US, Japan, Canada, Australia, Israel, China, Europe

Ring-based public key cryptosystem method	6,298,137	Oct 2, 2001	09/543,708
Apr 5, 2000	US, Europe, Canada

Secure user identification based on ring homomorphisms 6,959,085 Oct 25, 2005 09/564,112
May 3, 2000	US, Europe, Canada

Speed enhanced cryptographic method and apparatus 7,031,468 Apr 18, 2006	09/939,531
Aug 24, 2001	US, Europe, Canada

Digital signature and authentication method and apparatus 7,308,097 Dec 11, 2007 10/313,082
Dec 6, 2002	US, Europe, Canada

Digital signature and authentication method and apparatus 7,913,088 Mar 22, 2011 11/986,101
Nov 20, 2007	US, Europe, Canada

Digital signature and authentication method and apparatus Pending Pending 20090070590
Mar 12, 2009	US, Europe, Canada

Security enhanced public key cryptosystem Pending Pending Pending Aug 12, 2001	US


text:
[![Build Status](https://secure.travis-ci.org/doctrine/common.png)](http://travis-ci.org/doctrine/common)

The Doctrine Common project is a library that provides extensions to core PHP functionality.

## More resources:

* [Website](http://www.doctrine-project.org)
* [Documentation](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/)
* [Issue Tracker](http://www.doctrine-project.org/jira/browse/DCOM)
* [Downloads](http://github.com/doctrine/common/downloads)


text:
module Azure end
module Azure::CognitiveServices end
module Azure::CognitiveServices::Customimagesearch end
module Azure::CognitiveServices::Customimagesearch::V1_0 end


text:
package ghissues;

import act.controller.annotation.UrlContext;
import act.db.ebean.EbeanDao;
import act.util.*;
import org.osgl.mvc.annotation.GetAction;
import org.osgl.mvc.annotation.PostAction;

import javax.inject.Inject;
import javax.persistence.Entity;
import javax.persistence.Id;

@UrlContext("28")
public class Gh28 extends LogSupport {

    @Entity(name = "foo")
    public static class Foo implements SimpleBean {
        @Id
        public Integer id;

        public String name;
    }

    @Inject
    private EbeanDao<Integer, Foo> dao;

    @PostAction
    @PropertySpec("id")
    public Foo create(Foo foo) {
        return dao.save(foo);
    }

    @GetAction("first")
    public Foo first() {
        return dao.q().first();
    }

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ModalType = void 0;
var ModalType;
exports.ModalType = ModalType;

(function (ModalType) {
  ModalType["PAGE"] = "page";
  ModalType["CARD"] = "card";
})(ModalType || (exports.ModalType = ModalType = {}));
//# sourceMappingURL=types.js.map


text:
#include "VoxelRenderOctree.h"
#include "VoxelDebug/VoxelDebugManager.h"
#include "VoxelMessages.h"
#include "Async/Async.h"

DECLARE_DWORD_ACCUMULATOR_STAT(TEXT("Voxel Render Octrees Count"), STAT_VoxelRenderOctreesCount, STATGROUP_VoxelCounters);
DEFINE_VOXEL_MEMORY_STAT(STAT_VoxelRenderOctreesMemory);

static TAutoConsoleVariable<int32> CVarMaxRenderOctreeChunks(
	TEXT("voxel.renderer.MaxRenderOctreeChunks"),
	1000000,
	TEXT("Max render octree chunks. Allows to stop the creation of the octree before it gets too big & freezes your computer"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarLogRenderOctreeBuildTime(
	TEXT("voxel.renderer.LogRenderOctreeBuildTime"),
	0,
	TEXT("If true, will log the render octree build times"),
	ECVF_Default);

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

FVoxelRenderOctreeAsyncBuilder::FVoxelRenderOctreeAsyncBuilder(uint8 OctreeDepth, const FVoxelIntBox& WorldBounds)
	: FVoxelAsyncWork(STATIC_FNAME("Render Octree Build"), EVoxelTaskType::RenderOctree, EPriority::Null)
	, OctreeDepth(OctreeDepth)
	, WorldBounds(WorldBounds)
{
	SetIsDone(true);
}

void FVoxelRenderOctreeAsyncBuilder::Init(const FVoxelRenderOctreeSettings& InOctreeSettings, TVoxelSharedPtr<FVoxelRenderOctree> InOctree)
{
	VOXEL_FUNCTION_COUNTER();

	OctreeSettings = InOctreeSettings;
	OldOctree = InOctree;

	SetIsDone(false);
	Counter = FPlatformTime::Seconds();
	Log = "Render octree build stats:";
}

#define LOG_TIME_IMPL(Name, Counter) Log += "\n\t" Name ": " + FString::SanitizeFloat((FPlatformTime::Seconds() - Counter) * 1000.f) + "ms"; Counter = FPlatformTime::Seconds();
#define LOG_TIME(Name) LOG_TIME_IMPL("\t" Name, Counter)

void FVoxelRenderOctreeAsyncBuilder::ReportBuildTime()
{
	VOXEL_FUNCTION_COUNTER();

	LOG_TIME("Waiting for game thread");

	if (CVarLogRenderOctreeBuildTime.GetValueOnGameThread())
	{
		LOG_VOXEL(Log, TEXT("%s"), *Log);
	}

	if (bTooManyChunks)
	{
		FVoxelMessages::Error(FString::Printf(TEXT(
			"Render octree update was stopped!\n"
			"Max render octree chunks count reached: voxel.renderer.MaxRenderOctreeChunks < %d.\n"
			"This is caused by too demanding LOD settings.\n"
			"You can try the following: \n"
			"- reduce World Size\n"
			"- increase Max LOD\n"
			"- reduce invokers distances"), NumberOfChunks));
	}
}

void FVoxelRenderOctreeAsyncBuilder::DoWork()
{
	VOXEL_ASYNC_FUNCTION_COUNTER();

	LOG_TIME_IMPL("Waiting in thread pool", Counter);

	double WorkStartTime = FPlatformTime::Seconds();

	{
		VOXEL_ASYNC_SCOPE_COUNTER("Deleting previous octree");
		OctreeToDelete.Reset();
		LOG_TIME("Deleting previous octree");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("Resetting arrays");
		ChunkUpdates.Reset();
		NewOctree.Reset();
		LOG_TIME("Resetting arrays");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("Cloning octree");
		NewOctree = OldOctree.IsValid() ? MakeVoxelShared<FVoxelRenderOctree>(*OldOctree) : MakeVoxelShared<FVoxelRenderOctree>(OctreeSettings.ChunkSize, OctreeDepth);
		LOG_TIME("Cloning octree");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("ResetDivisionType");
		NewOctree->ResetDivisionType();
		LOG_TIME("ResetDivisionType");
	}

	bool bChanged;
	{
		VOXEL_ASYNC_SCOPE_COUNTER("UpdateSubdividedByDistance");
		bChanged = NewOctree->UpdateSubdividedByDistance(OctreeSettings);
		LOG_TIME("UpdateSubdividedByDistance");
		Log += "; Need to recompute neighbors: " + FString(bChanged ? "true" : "false");
	}

	if (bChanged)
	{
		VOXEL_ASYNC_SCOPE_COUNTER("UpdateSubdividedByNeighbors");
		int32 UpdateSubdividedByNeighborsCounter = 0;
		while (NewOctree->UpdateSubdividedByNeighbors(OctreeSettings)) { UpdateSubdividedByNeighborsCounter++; }
		LOG_TIME("UpdateSubdividedByNeighbors");
		Log += "; Iterations: " + FString::FromInt(UpdateSubdividedByNeighborsCounter);
	}
	else
	{
		VOXEL_ASYNC_SCOPE_COUNTER("ReuseOldNeighbors");
		NewOctree->ReuseOldNeighbors();
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("UpdateSubdividedByOthers");
		NewOctree->UpdateSubdividedByOthers(OctreeSettings);
		LOG_TIME("UpdateSubdividedByOthers");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("DeleteChunks");
		NewOctree->DeleteChunks(ChunkUpdates);
		LOG_TIME("DeleteChunks");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("GetUpdates");
		NewOctree->GetUpdates(NewOctree->UpdateIndex + 1, bChanged, OctreeSettings, ChunkUpdates);
		LOG_TIME("GetUpdates");
	}

	{
		VOXEL_ASYNC_SCOPE_COUNTER("Sort By LODs");
		// Make sure that LOD 0 chunks are processed first
		ChunkUpdates.Sort([](const auto& A, const auto& B) { return A.LOD < B.LOD; });
		LOG_TIME("Sort By LODs");
	}

	if (OldOctree.IsValid())
	{
		VOXEL_ASYNC_SCOPE_COUNTER("Find previous chunks");
		for (auto& ChunkUpdate : ChunkUpdates)
		{
			if (ChunkUpdate.NewSettings.bVisible && !ChunkUpdate.OldSettings.bVisible)
			{
				OldOctree->GetVisibleChunksOverlappingBounds(ChunkUpdate.Bounds, ChunkUpdate.PreviousChunks);
			}
		}
	}
	LOG_TIME("Find previous chunks");

	{
		VOXEL_ASYNC_SCOPE_COUNTER("Deleting old octree");
		OldOctree.Reset();
		LOG_TIME("Deleting old octree");
	}

	NumberOfChunks = NewOctree->CurrentChunksCount;
	bTooManyChunks = NewOctree->IsCanceled();

	if (bTooManyChunks)
	{
		NewOctree.Reset();
	}

	LOG_TIME_IMPL("Total time working", WorkStartTime);
}

#undef LOG_TIME

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

#define CHECK_MAX_CHUNKS_COUNT_IMPL(ReturnValue) if (IsCanceled()) { return ReturnValue; }
#define CHECK_MAX_CHUNKS_COUNT() CHECK_MAX_CHUNKS_COUNT_IMPL(;)
#define CHECK_MAX_CHUNKS_COUNT_BOOL() CHECK_MAX_CHUNKS_COUNT_IMPL(false)

FVoxelRenderOctree::FVoxelRenderOctree(uint32 ChunkSize, uint8 LOD)
	: TSimpleVoxelOctree(ChunkSize, LOD)
	, Root(this)
	, ChunkId(GetId())
	, OctreeBounds(GetBounds())
{
	check(LOD > 0);
	check(ChunkId <= Root->RootIdCounter);
	Root->CurrentChunksCount++;

	INC_DWORD_STAT_BY(STAT_VoxelRenderOctreesCount, 1);
	INC_VOXEL_MEMORY_STAT_BY(STAT_VoxelRenderOctreesMemory, sizeof(FVoxelRenderOctree));
}

FVoxelRenderOctree::FVoxelRenderOctree(const FVoxelRenderOctree& Source)
	: TSimpleVoxelOctree(Source.ChunkSize, Source.Height)
	, RootIdCounter(Source.RootIdCounter)
	, Root(this)
	, ChunkId(Source.ChunkId)
	, OctreeBounds(GetBounds())
	, UpdateIndex(Source.UpdateIndex)
{
	check(ChunkId <= Root->RootIdCounter);
	Root->CurrentChunksCount++;
	ChunkSettings = Source.ChunkSettings;
	if (Source.HasChildren())
	{
		CreateChildren(Source.GetChildren());
	}

	INC_DWORD_STAT_BY(STAT_VoxelRenderOctreesCount, 1);
	INC_VOXEL_MEMORY_STAT_BY(STAT_VoxelRenderOctreesMemory, sizeof(FVoxelRenderOctree));
}

FVoxelRenderOctree::FVoxelRenderOctree(const FVoxelRenderOctree& Parent, uint8 ChildIndex)
	: TSimpleVoxelOctree(Parent, ChildIndex)
	, Root(Parent.Root)
	, ChunkId(GetId())
	, OctreeBounds(GetBounds())
	, UpdateIndex(Parent.UpdateIndex)
{
	check(ChunkId <= Root->RootIdCounter);
	Root->CurrentChunksCount++;

	INC_DWORD_STAT_BY(STAT_VoxelRenderOctreesCount, 1);
	INC_VOXEL_MEMORY_STAT_BY(STAT_VoxelRenderOctreesMemory, sizeof(FVoxelRenderOctree));
}

FVoxelRenderOctree::FVoxelRenderOctree(const FVoxelRenderOctree& Parent, uint8 ChildIndex, const ChildrenArray& SourceChildren)
	: TSimpleVoxelOctree(Parent, ChildIndex)
	, Root(Parent.Root)
	, ChunkId(SourceChildren[ChildIndex].ChunkId)
	, OctreeBounds(GetBounds())
	, UpdateIndex(Parent.UpdateIndex)
{
	Root->CurrentChunksCount++;

	auto& Source = SourceChildren[ChildIndex];
	ChunkSettings = Source.ChunkSettings;
	if (Source.HasChildren())
	{
		CreateChildren(Source.GetChildren());
	}

	INC_DWORD_STAT_BY(STAT_VoxelRenderOctreesCount, 1);
	INC_VOXEL_MEMORY_STAT_BY(STAT_VoxelRenderOctreesMemory, sizeof(FVoxelRenderOctree));
}

FVoxelRenderOctree::~FVoxelRenderOctree()
{
	Root->CurrentChunksCount--;
	DEC_DWORD_STAT_BY(STAT_VoxelRenderOctreesCount, 1);
	DEC_VOXEL_MEMORY_STAT_BY(STAT_VoxelRenderOctreesMemory, sizeof(FVoxelRenderOctree));
}

///////////////////////////////////////////////////////////////////////////////

void FVoxelRenderOctree::ResetDivisionType()
{
	ChunkSettings.OldDivisionType = ChunkSettings.DivisionType;
	ChunkSettings.DivisionType = EDivisionType::Uninitialized;

	if (!!HasChildren())
	{
		for (auto& Child : GetChildren())
		{
			Child.ResetDivisionType();
		}
	}
}

bool FVoxelRenderOctree::UpdateSubdividedByDistance(const FVoxelRenderOctreeSettings& Settings)
{
	CHECK_MAX_CHUNKS_COUNT_BOOL();

	if (ShouldSubdivideByDistance(Settings))
	{
		ChunkSettings.DivisionType = EDivisionType::ByDistance;

		if (!HasChildren())
		{
			CreateChildren();
		}

		bool bChanged = ChunkSettings.OldDivisionType != EDivisionType::ByDistance;
		for (auto& Child : GetChildren())
		{
			bChanged |= Child.UpdateSubdividedByDistance(Settings);
		}

		return bChanged;
	}
	else
	{
		return ChunkSettings.OldDivisionType == EDivisionType::ByDistance;
	}
}

bool FVoxelRenderOctree::UpdateSubdividedByNeighbors(const FVoxelRenderOctreeSettings& Settings)
{
	CHECK_MAX_CHUNKS_COUNT_BOOL();

	bool bShouldContinue = false;

	if (ChunkSettings.DivisionType == EDivisionType::Uninitialized && ShouldSubdivideByNeighbors(Settings))
	{
		ChunkSettings.DivisionType = EDivisionType::ByNeighbors;

		if (!HasChildren())
		{
			CreateChildren();
		}

		bShouldContinue = true;
	}

	if (ChunkSettings.DivisionType != EDivisionType::Uninitialized)
	{
		for (auto& Child : GetChildren())
		{
			bShouldContinue |= Child.UpdateSubdividedByNeighbors(Settings);
		}
	}

	return bShouldContinue;
}

void FVoxelRenderOctree::ReuseOldNeighbors()
{
	if (ChunkSettings.OldDivisionType == EDivisionType::ByNeighbors)
	{
		ChunkSettings.DivisionType = EDivisionType::ByNeighbors;
	}

	if (!!HasChildren())
	{
		for (auto& Child : GetChildren())
		{
			Child.ReuseOldNeighbors();
		}
	}
}

void FVoxelRenderOctree::UpdateSubdividedByOthers(const FVoxelRenderOctreeSettings& Settings)
{
	CHECK_MAX_CHUNKS_COUNT();

	if (ChunkSettings.DivisionType == EDivisionType::Uninitialized && ShouldSubdivideByOthers(Settings))
	{
		ChunkSettings.DivisionType = EDivisionType::ByOthers;

		if (!HasChildren())
		{
			CreateChildren();
		}
	}

	if (ChunkSettings.DivisionType != EDivisionType::Uninitialized)
	{
		for (auto& Child : GetChildren())
		{
			Child.UpdateSubdividedByOthers(Settings);
		}
	}
}

void FVoxelRenderOctree::DeleteChunks(TArray<FVoxelChunkUpdate>& ChunkUpdates)
{
	CHECK_MAX_CHUNKS_COUNT();

	if (ChunkSettings.DivisionType == EDivisionType::Uninitialized)
	{
		if (HasChildren())
		{
			for (auto& Child : GetChildren())
			{
				ensure(Child.ChunkSettings.DivisionType == EDivisionType::Uninitialized);

				Child.DeleteChunks(ChunkUpdates);

				if (Child.ChunkSettings.Settings.HasRenderChunk())
				{
					//ensureVoxelSlowNoSideEffects(!ChunkUpdates.FindByPredicate([&](const FVoxelChunkUpdate& ChunkUpdate) { return ChunkUpdate.Id == Child.ChunkId; }));
					ChunkUpdates.Emplace(
						FVoxelChunkUpdate
						{
							Child.ChunkId,
							Child.Height,
							Child.OctreeBounds,
							Child.ChunkSettings.Settings,
							{},
							{}
						});
				}
			}
			DestroyChildren();
		}
	}
	else
	{
		for (auto& Child : GetChildren())
		{
			Child.DeleteChunks(ChunkUpdates);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

void FVoxelRenderOctree::GetUpdates(
	uint32 InUpdateIndex,
	bool bRecomputeTransitionMasks,
	const FVoxelRenderOctreeSettings& Settings,
	TArray<FVoxelChunkUpdate>& ChunkUpdates,
	bool bInVisible)
{
	CHECK_MAX_CHUNKS_COUNT();

	UpdateIndex++;
	check(UpdateIndex == InUpdateIndex);

	if (!OctreeBounds.Intersect(Settings.WorldBounds))
	{
		return;
	}

	FVoxelChunkSettings NewSettings{};

	// NOTE: we DO want bEnableRender = false to disable VisibleChunks settings
	NewSettings.bVisible = Settings.bEnableRender && Height <= Settings.ChunksCullingLOD && bInVisible;

	if (!HasChildren())
	{
		check(ChunkSettings.DivisionType == EDivisionType::Uninitialized);
	}
	else
	{
		check(ChunkSettings.DivisionType != EDivisionType::Uninitialized);
		bool bChildrenVisible;
		if (ChunkSettings.DivisionType == EDivisionType::ByDistance || ChunkSettings.DivisionType == EDivisionType::ByNeighbors)
		{
			// There are visible children
			NewSettings.bVisible = false;
			bChildrenVisible = true;
		}
		else
		{
			check(ChunkSettings.DivisionType == EDivisionType::ByOthers);
			bChildrenVisible = false;
		}

		for (auto& Child : GetChildren())
		{
			Child.GetUpdates(UpdateIndex, bRecomputeTransitionMasks, Settings, ChunkUpdates, bChildrenVisible);
		}
	}

	NewSettings.bEnableCollisions =
		Settings.bEnableCollisions &&
		((Height == 0 &&
			IsInvokerInRange(Settings.Invokers,
				[](const FVoxelInvokerSettings& Invoker) { return Invoker.bUseForCollisions; },
				[](const FVoxelInvokerSettings& Invoker) { return Invoker.CollisionsBounds; })
		 )
		 ||
		 (NewSettings.bVisible && Settings.bComputeVisibleChunksCollisions && Height <= Settings.VisibleChunksCollisionsMaxLOD)
	    );

	NewSettings.bEnableNavmesh =
		Settings.bEnableNavmesh &&
		((Height == 0 &&
			IsInvokerInRange(Settings.Invokers,
				[](const FVoxelInvokerSettings& Invoker) { return Invoker.bUseForNavmesh; },
				[](const FVoxelInvokerSettings& Invoker) { return Invoker.NavmeshBounds; })
		)
		||
		(NewSettings.bVisible && Settings.bComputeVisibleChunksNavmesh && Height <= Settings.VisibleChunksNavmeshMaxLOD)
		);

	check(NewSettings.TransitionsMask == 0);
	if (NewSettings.HasRenderChunk())
	{
		if (NewSettings.bVisible && Settings.bEnableTransitions)
		{
			if (bRecomputeTransitionMasks)
			{
				for (int32 DirectionIndex = 0; DirectionIndex < 6; DirectionIndex++)
				{
					const auto Direction = EVoxelDirectionFlag::Type(1 << DirectionIndex);
					const FVoxelRenderOctree* AdjacentChunk = GetVisibleAdjacentChunk(Direction, 0);
					if (AdjacentChunk && AdjacentChunk->OctreeBounds.Intersect(Settings.WorldBounds))
					{
						check(
							(AdjacentChunk->Height == Height - 1) ||
							(AdjacentChunk->Height == Height) ||
							(AdjacentChunk->Height == Height + 1)
						);
						if (Settings.bInvertTransitions ? (AdjacentChunk->Height > Height) : (AdjacentChunk->Height < Height))
						{
							NewSettings.TransitionsMask |= Direction;
						}
					}
				}
			}
			else
			{
				NewSettings.TransitionsMask = ChunkSettings.Settings.TransitionsMask;
			}
		}
	}

	if (ChunkSettings.Settings != NewSettings && (ChunkSettings.Settings.HasRenderChunk() || NewSettings.HasRenderChunk()))
	{
		// Too slow ensureVoxelSlowNoSideEffects(!ChunkUpdates.FindByPredicate([&](const FVoxelChunkUpdate& ChunkUpdate) { return ChunkUpdate.Id == ChunkId; }));
		ChunkUpdates.Emplace(
			FVoxelChunkUpdate
			{
				ChunkId,
				Height,
				OctreeBounds,
				ChunkSettings.Settings,
				NewSettings,
				{}
			});
	}

	ChunkSettings.Settings = NewSettings;
}

void FVoxelRenderOctree::GetChunksToUpdateForBounds(const FVoxelIntBox& Bounds, TArray<uint64>& ChunksToUpdate, const FVoxelOnChunkUpdate& OnChunkUpdate) const
{
	if (!OctreeBounds.Intersect(Bounds))
	{
		return;
	}

	if (ChunkSettings.Settings.HasRenderChunk())
	{
		OnChunkUpdate.Broadcast(OctreeBounds);
		ChunksToUpdate.Add(ChunkId);
	}

	if (!!HasChildren())
	{
		for (auto& Child : GetChildren())
		{
			Child.GetChunksToUpdateForBounds(Bounds, ChunksToUpdate, OnChunkUpdate);
		}
	}
}

void FVoxelRenderOctree::GetVisibleChunksOverlappingBounds(const FVoxelIntBox& Bounds, TArray<uint64, TInlineAllocator<8>>& VisibleChunks) const
{
	if (!OctreeBounds.Intersect(Bounds))
	{
		return;
	}

	if (ChunkSettings.Settings.bVisible)
	{
		VisibleChunks.Add(ChunkId);
	}

	if (!!HasChildren())
	{
		for (auto& Child : GetChildren())
		{
			Child.GetVisibleChunksOverlappingBounds(Bounds, VisibleChunks);
		}
	}
}

FORCEINLINE bool FVoxelRenderOctree::IsCanceled() const
{
	return Root->CurrentChunksCount >= CVarMaxRenderOctreeChunks.GetValueOnAnyThread();
}

///////////////////////////////////////////////////////////////////////////////

bool FVoxelRenderOctree::ShouldSubdivideByDistance(const FVoxelRenderOctreeSettings& Settings) const
{
	if (!Settings.bEnableRender)
	{
		return false;
	}
	if (Height == 0)
	{
		return false;
	}
	if (!OctreeBounds.Intersect(Settings.WorldBounds))
	{
		return false;
	}
	if (Height <= Settings.MinLOD)
	{
		return false;
	}
	if (Height > Settings.MaxLOD)
	{
		return true;
	}

	for (auto& Invoker : Settings.Invokers)
	{
		if (Invoker.bUseForLOD && OctreeBounds.Intersect(Invoker.LODBounds) && Height > Invoker.LODToSet)
		{
			return true;
		}
	}

	return false;
}

bool FVoxelRenderOctree::ShouldSubdivideByNeighbors(const FVoxelRenderOctreeSettings& Settings) const
{
	if (Height == 0)
	{
		return false;
	}
	if (!OctreeBounds.Intersect(Settings.WorldBounds))
	{
		return false;
	}
	for (int32 DirectionIndex = 0; DirectionIndex < 6; DirectionIndex++)
	{
		const auto Direction = EVoxelDirectionFlag::Type(1 << DirectionIndex);
		for (int32 Index = 0; Index < 4; Index++) // Iterate the 4 adjacent subdivided chunks
		{
			const FVoxelRenderOctree* AdjacentChunk = GetVisibleAdjacentChunk(Direction, Index);
			if (!AdjacentChunk)
			{
				continue;
			}

			if (AdjacentChunk->Height + 1 < Height)
			{
				return true;
			}
			if (AdjacentChunk->Height >= Height)
			{
				check(Index == 0);
				break; // No need to continue, 4 indices are the same chunk
			}
		}
	}
	return false;
}

bool FVoxelRenderOctree::ShouldSubdivideByOthers(const FVoxelRenderOctreeSettings& Settings) const
{
	if (!Settings.bEnableCollisions && !Settings.bEnableNavmesh)
	{
		return false;
	}
	if (Height == 0)
	{
		return false;
	}
	if (!OctreeBounds.Intersect(Settings.WorldBounds))
	{
		return false;
	}

	if (Settings.bEnableCollisions && IsInvokerInRange(Settings.Invokers,
		[](const FVoxelInvokerSettings& Invoker) { return Invoker.bUseForCollisions; },
		[](const FVoxelInvokerSettings& Invoker) { return Invoker.CollisionsBounds; }))
	{
		return true;
	}
	if (Settings.bEnableNavmesh && IsInvokerInRange(Settings.Invokers,
		[](const FVoxelInvokerSettings& Invoker) { return Invoker.bUseForNavmesh; },
		[](const FVoxelInvokerSettings& Invoker) { return Invoker.NavmeshBounds; }))
	{
		return true;
	}

	return false;
}

///////////////////////////////////////////////////////////////////////////////

inline bool IsVisibleParent(const FVoxelRenderOctree* Chunk)
{
	return Chunk->ChunkSettings.DivisionType == FVoxelRenderOctree::EDivisionType::ByDistance || Chunk->ChunkSettings.DivisionType == FVoxelRenderOctree::EDivisionType::ByNeighbors;
}

const FVoxelRenderOctree* FVoxelRenderOctree::GetVisibleAdjacentChunk(EVoxelDirectionFlag::Type Direction, int32 Index) const
{
	const int32 HalfSize = Size() / 2;
	const int32 HalfHalfSize = Size() / 4;

	int32 S = HalfSize + HalfHalfSize; // Size / 2: on the border; Size / 4: center of child chunk
	int32 X, Y;
	if (Index & 0x1)
	{
		X = -HalfHalfSize;
	}
	else
	{
		X = HalfHalfSize;
	}
	if (Index & 0x2)
	{
		Y = -HalfHalfSize;
	}
	else
	{
		Y = HalfHalfSize;
	}

	FIntVector P;
	switch (Direction)
	{
	default: check(false);
	case EVoxelDirectionFlag::XMin:
		P = Position + FIntVector(-S, X, Y);
		break;
	case EVoxelDirectionFlag::XMax:
		P = Position + FIntVector(S, X, Y);
		break;
	case EVoxelDirectionFlag::YMin:
		P = Position + FIntVector(X, -S, Y);
		break;
	case EVoxelDirectionFlag::YMax:
		P = Position + FIntVector(X, S, Y);
		break;
	case EVoxelDirectionFlag::ZMin:
		P = Position + FIntVector(X, Y, -S);
		break;
	case EVoxelDirectionFlag::ZMax:
		P = Position + FIntVector(X, Y, S);
		break;
	}

	if (Root->OctreeBounds.Contains(P))
	{
		const FVoxelRenderOctree* Ptr = Root;

		while (IsVisibleParent(Ptr))
		{
			Ptr = &Ptr->GetChild(P);
		}

		check(Ptr->OctreeBounds.Contains(P));

		return Ptr;
	}
	else
	{
		return nullptr;
	}
}

template<typename T1, typename T2>
bool FVoxelRenderOctree::IsInvokerInRange(const TArray<FVoxelInvokerSettings>& Invokers, T1 SelectInvoker, T2 GetInvokerBounds) const
{
	for (auto& Invoker : Invokers)
	{
		if (SelectInvoker(Invoker))
		{
			if (OctreeBounds.Intersect(GetInvokerBounds(Invoker)))
			{
				return true;
			}
		}
	}
	return false;
}

///////////////////////////////////////////////////////////////////////////////

uint64 FVoxelRenderOctree::GetId()
{
	return ++Root->RootIdCounter;
}


text:
set -e

VARIABLES="\
ALLUXIO_MASTER_BIND_HOST \
ALLUXIO_MASTER_WEB_BIND_HOST \
ALLUXIO_WORKER_BIND_HOST \
ALLUXIO_WORKER_DATA_BIND_HOST \
ALLUXIO_WORKER_WEB_BIND_HOST \
ALLUXIO_MASTER_HOSTNAME \
ALLUXIO_MASTER_WEB_HOSTNAME \
ALLUXIO_WORKER_HOSTNAME \
ALLUXIO_WORKER_DATA_HOSTNAME \
ALLUXIO_WORKER_WEB_HOSTNAME"

for var in ${VARIABLES}; do
  sed -i "s/# ${var}/${var}/g" /alluxio/conf/alluxio-env.sh
done


text:
<?xml version="1.0" encoding="utf-8"?>
<Template>
  <ObjCategoryID type="uint32" default="0" description="?" />
  <ObjTypeID type="uint32" default="0" description="Numerical ID of Gismo, set by stage info.">
	<!-- stg100 Gismo -->
<!-- 	<Enum value="0" description="stg100_obj_woodbox" />
	<Enum value="1" description="stg100_obj_dustbox" />
	<Enum value="2" description="stg100_obj_potA" />
	<Enum value="3" description="stg100_obj_potB" />
	<Enum value="4" description="stg100_obj_bench01" />
	<Enum value="5" description="stg100_obj_bench02" />
	<Enum value="6" description="stg100_obj_arrow01" />
	<Enum value="7" description="stg100_obj_arrow02" /> -->
	<!-- stg200 Gismo -->
	<Enum value="0" description="stg200_obj_ginger" />
	<Enum value="1" description="stg200_obj_popcorn" />
	<Enum value="2" description="stg200_obj_wafer" />
	<Enum value="3" description="stg200_obj_tank" />
	<Enum value="4" description="stg200_obj_barricade" />
	<Enum value="5" description="stg200_obj_popcorn2" />
	<!-- stg400 Gismo -->
<!-- 	<Enum value="0" description="stg400_obj_plabox" />
	<Enum value="1" description="stg400_obj_oildrum" />
	<Enum value="2" description="stg400_obj_barricade" />
	<Enum value="3" description="stg400_obj_safetydrum" /> -->
	<!-- stg500 Gismo -->
<!-- 	<Enum value="0" description="stg500_obj_barricadeA" />
	<Enum value="1" description="stg500_obj_barricadeB" />
	<Enum value="2" description="stg500_obj_jarA" />
	<Enum value="3" description="stg500_obj_jarB" />
	<Enum value="4" description="stg500_obj_lanternA" />
	<Enum value="5" description="stg500_obj_lanternB" />
	<Enum value="6" description="stg500_obj_jarC" /> -->
	<!-- stg600 Gismo -->
<!-- 	<Enum value="0" description="stg600_obj_barricade" />
	<Enum value="1" description="stg600_obj_bench" />
	<Enum value="2" description="stg600_obj_tankA" />
	<Enum value="3" description="stg600_obj_planterA" />
	<Enum value="4" description="stg600_obj_planterB" />
	<Enum value="5" description="stg600_obj_lampA" /> -->
  </ObjTypeID>
  <Extra type="RawByteLength" length="8" />
</Template>