text:
/* @test
 * @bug 5099956
 * @summary The server-side DGC implementation remote object should
 * only be exported at a given endpoint while there are DGC-enabled
 * remote objects also exported at that same endpoint, in order to
 * minimize exposure to certain unmarshalling denial-of-service
 * attacks (such as a "large object" attack), given that the
 * server-side DGC implementation does not support access control.
 * Also, when the server-side DGC implementation remote object is
 * exported, it should ignore codebase annotations when unmarshalling
 * arguments, in order to minimize exposure to unmarshallling
 * denial-of-service attacks that involve downloading untrusted code.
 *
 * @library ../../../../../testlibrary
 * @build DgcServerExposure ForeignUuid
 * @build TestLibrary
 * @run main/othervm/policy=security.policy DgcServerExposure
 */

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.net.URL;
import java.net.URLClassLoader;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.ServerException;
import java.rmi.UnmarshalException;
import net.jini.export.Exporter;
import net.jini.id.Uuid;
import net.jini.id.UuidFactory;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicInvocationHandler;
import net.jini.jeri.AtomicInvocationHandler;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.BasicObjectEndpoint;
import net.jini.jeri.Endpoint;
import net.jini.jeri.InvocationLayerFactory;
import net.jini.jeri.ObjectEndpoint;
import net.jini.jeri.ServerEndpoint;
import net.jini.jeri.tcp.TcpEndpoint;
import net.jini.jeri.tcp.TcpServerEndpoint;

public class DgcServerExposure {

    private static final Uuid DGC_ID =
	UuidFactory.create("d32cd1bc-273c-11b2-8841-080020c9e4a1");

    private static final String foreignUuidClassName = "ForeignUuid";

    private static final int PORT_A = 2019;
    private static final int PORT_B = 2020;

    private static final InvocationLayerFactory ilf =
	new BasicILFactory(null, null,
			   DgcServerExposure.class.getClassLoader());

    private static final Uuid clientID = UuidFactory.generate();
    private static long nextSequenceNum = Long.MIN_VALUE;

    public static void main(String[] args) throws Exception {
	System.err.println("\nRegression test for bug 5099956\n");

	if (System.getSecurityManager() == null) {
	    System.setSecurityManager(new SecurityManager());
	}

	/*
	 * Obtain a Uuid instance that will not be locally loadable
	 * by the DGC server implementation.
	 */
	URL codebase =
	    TestLibrary.installClassInCodebase(foreignUuidClassName,
					       "codebase");
	ClassLoader foreignUuidLoader =
	    URLClassLoader.newInstance(
		new URL[] { codebase },
		DgcServerExposure.class.getClassLoader());
	Class foreignUuidClass = Class.forName(foreignUuidClassName, false,
					       foreignUuidLoader);
	Uuid foreignUuid = (Uuid) foreignUuidClass.newInstance();

	/*
	 * Establish two server endpoints and proxies for calling the
	 * DGC servers at each of those endpoints.
	 */
	ServerEndpoint seA = TcpServerEndpoint.getInstance(PORT_A);
	ServerEndpoint seB = TcpServerEndpoint.getInstance(PORT_B);

	DgcServer dgcA = makeDgcProxy(TcpEndpoint.getInstance("", PORT_A));
	DgcServer dgcB = makeDgcProxy(TcpEndpoint.getInstance("", PORT_B));

	/*
	 * Export non-DGC-enabled remote object (A0) on endpoint A.
	 *
	 * - DGC call to A should fail.
	 */
	Remote implA0 = new Remote() { };
	Exporter expA0 = new BasicJeriExporter(seA, ilf, false, false);
	expA0.export(implA0);
	System.err.println("\t{A0}");

	System.err.print("DGC call to A ");
	verifyFailure(dgcA);

	/*
	 * Export DGC-enabled remote object (B1) on endpoint B.
	 *
	 * - DGC call to A should still fail.
	 * - DGC call to B should succeed.
	 * - DGC call to B with foreign UUID class should fail.
	 */
	Remote implB1 = new Remote() { };
	Exporter expB1 = new BasicJeriExporter(seB, ilf, true, false);
	expB1.export(implB1);
	System.err.println("\t{A0}\t{B1}");

	System.err.print("DGC call to A ");
	verifyFailure(dgcA);
	System.err.print("DGC call to B ");
	verifySuccess(dgcB);
	System.err.print("DGC call to B with foreign UUID class ");
	verifyFailureWithUuid(dgcB, foreignUuid);

	/*
	 * Export DGC-enabled remote object (A1) on endpoint A.
	 *
	 * - DGC call to A should now succeed.
	 */
	Remote implA1 = new Remote() { };
	Exporter expA1 = new BasicJeriExporter(seA, ilf, true, false);
	expA1.export(implA1);
	System.err.println("\t{A0,A1}\t{B1}");

	System.err.print("DGC call to A ");
	verifySuccess(dgcA);

	/*
	 * Unexport A1.
	 *
	 * - DGC call to A should fail again.
	 * - DGC call to B should still succeed.
	 */
	expA1.unexport(true);
	System.err.println("\t{A0}\t{B1}");

	System.err.print("DGC call to A ");
	verifyFailure(dgcA);
	System.err.print("DGC call to B ");
	verifySuccess(dgcB);

	/*
	 * Export non-DGC-enabled remote object (B0) on endpoint B, to
	 * maintain listening on B.  Then clear reference to B1,
	 * letting it become garbage collected.
	 *
	 * - DGC call to B should now fail.
	 */

	Remote implB0 = new Remote() { };
	Exporter expB0 = new BasicJeriExporter(seB, ilf, false, false);
	expB0.export(implB0);
	System.err.println("\t{A0}\t{B0,B1}");

	implB1 = null;
	System.gc();
	Thread.sleep(3000);
	System.err.println("\t{A0}\t{B0}");

	System.err.print("DGC call to B ");
	verifyFailure(dgcB);

	System.err.println("TEST PASSED");
    }

    private static void verifySuccess(DgcServer dgc) {
	try {
	    dgc.dirty(clientID, nextSequenceNum++, new Uuid[] { });
	    System.err.println("succeeds as expected");
	} catch (RemoteException e) {
	    throw new RuntimeException("TEST FAILED: unexpected failure", e);
	}
    }

    private static void verifyFailure(DgcServer dgc) {
	try {
	    dgc.dirty(clientID, nextSequenceNum++, new Uuid[] { });
	    throw new RuntimeException("TEST FAILED: unexpected success");
	} catch (NoSuchObjectException e) {
	    System.err.println(
		"throws NoSuchObjectException as expected");
	} catch (RemoteException e) {
	    throw new RuntimeException("TEST FAILED: unexpected failure", e);
	}
    }

    private static void verifyFailureWithUuid(DgcServer dgc, Uuid uuid) {
	try {
	    dgc.dirty(clientID, nextSequenceNum++, new Uuid[] { uuid });
	    throw new RuntimeException("TEST FAILED: unexpected success");
	} catch (ServerException e) {
	    Throwable cause = e.getCause();
	    if (cause instanceof UnmarshalException &&
		cause.getCause() instanceof ClassNotFoundException)
	    {
		System.err.println("throws ServerException as expected");
	    } else {
		throw new RuntimeException("TEST FAILED: unexpected failure",
					   e);
	    }
	} catch (RemoteException e) {
	    throw new RuntimeException("TEST FAILED: unexpected failure", e);
	}
    }

    /**
     * JGDMS uses AtomicMarshalInputStream and AtomicMarshalOutputStream
     * for all DGC endpoints, annotations are not written into the stream.
     * @param e
     * @return
     */
    private static DgcServer makeDgcProxy(Endpoint e) {
	ObjectEndpoint oe = new BasicObjectEndpoint(e, DGC_ID, false);
        // The appended test output shows what happens when BasicInvocationHandler
        // is used.
	InvocationHandler ih = new AtomicInvocationHandler(oe, null, false);
	return (DgcServer)
	    Proxy.newProxyInstance(DgcServer.class.getClassLoader(),
				   new Class[] { DgcServer.class }, ih);
    }

    private interface DgcServer extends Remote {
	long dirty(Uuid clientID, long sequenceNum, Uuid[] ids)
	    throws RemoteException;
	void clean(Uuid clientID, long sequenceNum, Uuid[] ids, boolean strong)
	    throws RemoteException;
    }
}

/*
Regression test for bug 5099956
    [jtreg]
    [jtreg] TEST_LIBRARY: C:\Users\peter\Documents\NetBeansProjects\JGDMS\qa\jtreg\JTwork\classes\net\jini\jeri\BasicJeriExporter\dgcServerExposure\ForeignUuid.class
    [jtreg] TEST_LIBRARY: C:\Users\peter\Documents\NetBeansProjects\JGDMS\qa\jtreg\JTwork\scratch\codebase\ForeignUuid.class
    [jtreg] TEST_LIBRARY: Installed class "ForeignUuid" in codebase file:C:/Users/peter/Documents/NetBeansProjects/JGDMS/qa/jtreg/JTwork/scratch/codebase/
    [jtreg] 	{A0}
    [jtreg] DGC call to A throws NoSuchObjectException as expected
    [jtreg] 	{A0}	{B1}
    [jtreg] DGC call to A throws NoSuchObjectException as expected
    [jtreg] DGC call to B succeeds as expected
    [jtreg] DGC call to B with foreign UUID class WARNING: An illegal reflective access operation has occurred
    [jtreg] WARNING: Illegal reflective access by org.apache.river.api.io.ThrowableSerializer$1 (file:/C:/Users/peter/Documents/NetBeansProjects/JGDMS/qa/jtreg/JTlib-tmp/jgdms-platform-3.1.1-SNAPSHOT.jar) to field java.lang.Throwable.detailMessage
    [jtreg] WARNING: Please consider reporting this to the maintainers of org.apache.river.api.io.ThrowableSerializer$1
    [jtreg] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    [jtreg] WARNING: All illegal access operations will be denied in a future release
    [jtreg] java.lang.RuntimeException: TEST FAILED: unexpected failure
    [jtreg] 	at DgcServerExposure.verifyFailureWithUuid(DgcServerExposure.java:228)
    [jtreg] 	at DgcServerExposure.main(DgcServerExposure.java:139)
    [jtreg] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [jtreg] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [jtreg] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [jtreg] 	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    [jtreg] 	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    [jtreg] 	at java.base/java.lang.Thread.run(Thread.java:830)
    [jtreg] Caused by: java.rmi.UnmarshalException: exception unmarshalling response; nested exception is:
    [jtreg] 	java.io.OptionalDataException
    [jtreg] 	at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:908)
    [jtreg] 	at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:707)
    [jtreg] 	at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:576)
    [jtreg] 	at $Proxy0.dirty(Unknown Source)
    [jtreg] 	at DgcServerExposure.verifyFailureWithUuid(DgcServerExposure.java:215)
    [jtreg] 	... 7 more
    [jtreg] Caused by: java.io.OptionalDataException
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1669)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    [jtreg] 	at net.jini.io.MarshalInputStream.readAnnotation(MarshalInputStream.java:464)
    [jtreg] 	at net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:349)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1941)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1827)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2115)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)
    [jtreg] 	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    [jtreg] 	at net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1411)
    [jtreg] 	at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:893)
    [jtreg] 	... 11 more
*/

/*

The original MarshalInputStream did not utilise codebase annotations, however
the implementation of MarshalInputStream still reads an annotation from the
stream, while AtomicMarshalInputStream does not unless codebase annotations are
enabled.   If we enabled annotations in AtomicMarshalInputStream, by passing
true for useCodebaseAnnotation in the constructor, then it would be compatible,
but not secure.

If we want backward compatibility we could create additional constructors
for AtomicMarshalInputStream and AtomicMarshalOutputStream with the desired
behaviour.  But full compatibility would only be achived for basic TCP endpoints
in any case.

This means that JGDMS DGC is not fully backward compatible with River, however
services will still be compatible when DGC is turned off.  In any case River / Jini
JERI DGC should not be used as it is a security vulnerability.  Secure endpoints
with DGC enabled would provide an entry point for an attacker to unmarshall
a gadget attack as the original DGC implementation required anonymous
clients, which is no longer supported for SSLEndpoint's for JGDMS, while for
River / Jini it requres enabling insecure SSL TLS Ciphers.

98  DgcRequestDispatcher(Unreferenced unrefCallback, ObjectTable table ) {
99 	        this.unrefCallback = unrefCallback;
100 	        this.table = table;
101 	        try {
102 	            dgcDispatcher =
103 	                new BasicInvocationDispatcher(
104 	                    dgcDispatcherMethods, dgcServerCapabilities,
105 	                    null, null, this.getClass().getClassLoader())
106 	                {
107 	                    protected ObjectInputStream createMarshalInputStream(
108 	                        Object impl,
109 	                        InboundRequest request,
110 	                        boolean integrity,
111 	                        Collection context)
112 	                        throws IOException
113 	                    {
114 	                        ClassLoader loader = getClassLoader();
115 	                        return new MarshalInputStream(
116 	                            request.getRequestInputStream(),
117 	                            loader, integrity, loader,
118 	                            Collections.unmodifiableCollection(context));
119 	                        // useStreamCodebases() not invoked
120 	                    }
121 	                };
122 	        } catch (ExportException e) {
123 	            throw new AssertionError();
124 	        }
125 	        this.dgcServer = table.getDgcServer(this);
126 	    }

*/


text:
Spree::Core::Engine.routes.draw do

  namespace :admin do
    #get :eposnow, to: 'eposnow#index'
    #scope module: :eposnow do
    #  resources 'Eposnow::Customer'
    #resources [:eposnow, :customers]
    #end
    namespace :eposnow do
    #scope module: :eposnow do #, as: 'admin_eposnow' do
      resources :categories, only: [:index] do
        collection do
          post :sync
        end
      end
      resources :customers, except: [:destroy]
      resources :product_stocks, except: [:destroy] do
        collection do
          post :sync_all
        end
      end
      resources :locations, except: [:destroy] do
        member do
          post :link
        end
      end
      resources :products, only: [:index, :show, :new, :create] do
        member do
          patch :sync
        end
        collection do
          post :sync_all
        end
      end
    end

    resource :eposnow, only: [:update, :edit] do
      get 'products/:id', to: 'eposnows#product', as: :product
      collection do
        #get :products
        get :transactions
        get :staff
      end
    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.internal.locksupport.operations;

import com.hazelcast.internal.locksupport.LockResource;
import com.hazelcast.internal.locksupport.LockStoreImpl;
import com.hazelcast.internal.services.ObjectNamespace;
import com.hazelcast.internal.util.UuidUtil;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.internal.serialization.Data;
import com.hazelcast.spi.impl.NodeEngine;
import com.hazelcast.spi.impl.operationservice.BackupAwareOperation;
import com.hazelcast.spi.impl.operationservice.Notifier;
import com.hazelcast.spi.impl.operationservice.SplitBrainProtectionCheckAwareOperation;
import com.hazelcast.internal.partition.IPartition;
import com.hazelcast.internal.partition.IPartitionService;

import java.io.IOException;
import java.util.UUID;

/**
 * Locally executed operation which unlocks a lock if it is held by a
 * specific owner.
 */
public class LocalLockCleanupOperation extends UnlockOperation
        implements Notifier, BackupAwareOperation, SplitBrainProtectionCheckAwareOperation {

    private final UUID uuid;

    /**
     * This constructor should not be used to obtain an instance of this class; it exists to fulfill IdentifiedDataSerializable
     * coding conventions.
     */
    public LocalLockCleanupOperation() {
        uuid = UuidUtil.newUnsecureUUID();
    }

    public LocalLockCleanupOperation(ObjectNamespace namespace, Data key, UUID uuid) {
        super(namespace, key, -1, true);
        this.uuid = uuid;
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        LockResource lock = lockStore.getLock(key);
        if (uuid.equals(lock.getOwner())) {
            ILogger logger = getLogger();
            if (logger.isFinestEnabled()) {
                logger.finest(
                        "Unlocking lock owned by UUID: " + uuid + ", thread ID: " + lock.getThreadId() + ", count: "
                                + lock.getLockCount());
            }
            response = lockStore.forceUnlock(key);
        }
    }

    @Override
    public boolean shouldBackup() {
        final NodeEngine nodeEngine = getNodeEngine();
        IPartitionService partitionService = nodeEngine.getPartitionService();
        IPartition partition = partitionService.getPartition(getPartitionId());
        return partition.isLocal() && Boolean.TRUE.equals(response);
    }

    @Override
    protected void writeInternal(ObjectDataOutput out) throws IOException {
        throw new UnsupportedOperationException("LocalLockCleanupOperation is local only.");
    }

    @Override
    protected void readInternal(ObjectDataInput in) throws IOException {
        throw new UnsupportedOperationException("LocalLockCleanupOperation is local only.");
    }

    @Override
    public int getClassId() {
        throw new UnsupportedOperationException("LocalLockCleanupOperation is local only.");
    }

    @Override
    public boolean shouldCheckSplitBrainProtection() {
        return false;
    }
}


text: google-site-verification: google1e3cab16b5f75771.html


text:
<?xml version="1.0" encoding="utf-8"?>
<!--    Copyright 2015 Jonas Uekoetter                                         -->

<!--    Licensed under the Apache License,Version2.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.                                         -->
<resources>
    <string name="app_name">Brainfuck</string>

    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="source_code">Source Code:</string>
    <string name="source_code_hint">Here goes the source code</string>
    <string name="input">Input:</string>
    <string name="output">Output:</string>
    <string name="compile">Compile Brainfuck Code</string>
    <string name="no_settings_yet">Unfortunately there are no settings yet. Check back later</string>
</resources>


text:
import logging

import six

from . import argument, errors, serializers

logger = logging.getLogger(__name__)
marker = object()

class Field(object):
    def __init__(self, name, argument):
        self.name = name
        self.argument = argument
        self.__doc__ = self.argument.__doc__

    def present(self, instance):
        return self.argument.present(instance)

    def get_value(self, instance):
        retval = instance._values.get(self.name, marker)
        if retval is marker:
            return self.argument.get_default(instance)
        return retval

    def delete_value(self, instance):
        if self.name in instance._values:
            del instance._values[self.name]

    def clean_value(self, instance, value):
        try:
            value = self.argument.clean(instance, value)
            if hasattr(instance, "clean_{}".format(self.name)):
                value = getattr(instance, "clean_{}".format(self.name))(value)
        except errors.InvalidParameter as e:
            raise errors.InvalidParameter("{}: {}".format(self.name, e.args[0]))
        return value

    def __set__(self, instance, value):
        if value is None:
            self.delete_value(instance)
            return

        value = self.argument.adapt(value)
        if isinstance(value, serializers.Serializer):
            for dep in value.dependencies(instance):
                if dep != instance:
                    instance.add_dependency(dep)
        else:
            value = self.clean_value(instance, value)
            for dep in self.argument.serializer.dependencies(value):
                if dep != instance:
                    instance.add_dependency(dep)
        instance._values[self.name] = value

    def __get__(self, instance, owner):
        if instance is None:
            return self
        return self.get_value(instance)

class Meta(object):
    def __init__(self):
        self.plans = {}
        self.fields = {}
        self.field_order = []

    def get_plan(self, plan):
        for cls in self.mro:
            if hasattr(cls, "meta") and plan in cls.meta.plans:
                return cls.meta.plans[plan]

    def iter_fields_in_order(self):
        for name in self.field_order:
            yield self.fields[name]

class ResourceType(type):

    __all_resources__ = {}
    __lazy_lookups__ = {}

    def __new__(meta_cls, class_name, bases, new_attrs):
        meta = new_attrs["meta"] = Meta()

        # FIXME: What order to process the bases in?
        for base in bases:
            if hasattr(base, "meta") and isinstance(base.meta, Meta):
                meta.fields.update(base.meta.fields)
                meta.field_order.extend(base.meta.field_order)

        # A resource can set its own field_order. An example of when this is
        # useful is the AWS subnet. We want to validate that its cidr_block
        # fits inside the cidr_block of its parent vpc. So the vpc must always
        # be processed first. This guarantee can't be made with kwargs on
        # cpython.
        if "field_order" in new_attrs:
            meta.field_order.extend(new_attrs["field_order"])
            del new_attrs["field_order"]

        # Replace all Argument instances with Field instances. The Field type
        # handles the 'clean' stage of input processing and the storage of
        # data passed in.
        for name, value in new_attrs.items():
            if isinstance(value, argument.Argument):
                field = new_attrs[name] = Field(name, value)
                meta.fields[name] = field
                meta.field_order.append(name)
                value.name = name

        # De-duplicate the field_order list
        field_order = []
        for field in meta.field_order:
            if field not in field_order:
                field_order.append(field)
        meta.field_order = field_order

        # Actually build a class
        cls = type.__new__(meta_cls, class_name, bases, new_attrs)
        cls.meta.mro = cls.mro()

        # Allow fields to contribute to the class...
        for field in cls.meta.iter_fields_in_order():
            field.argument.contribute_to_class(cls)

        # Fire any signals.
        name = ".".join((cls.__module__, cls.__name__))
        meta_cls.__all_resources__[name] = cls

        for callable, args, kwargs in meta_cls.__lazy_lookups__.get(name, []):
            callable(*args, **kwargs)

        return cls

    @classmethod
    def add_callback(cls, name, callback, *args, **kwargs):
        cls.__lazy_lookups__.setdefault(name, []).append((callback, args, kwargs))

class Resource(six.with_metaclass(ResourceType)):

    dot_ignore = False
    default_plan = None

    ensure = argument.List(argument.String())

    def __init__(self, parent, **kwargs):
        self._values = {}
        self.dependencies = set()
        self.parent = parent

        params = self.clean(kwargs)
        for field in self.meta.iter_fields_in_order():
            if field.name in params:
                setattr(self, field.name, params[field.name])

    @classmethod
    def clean(cls, value):
        if not isinstance(value, dict):
            raise errors.InvalidParameter(
                "{!r} cannot be adapted into a {}".format(value, cls.resource_name)
            )

        params = {}
        compound_params = {}
        for key, subvalue in value.items():
            if "__" in key:
                key, subkey = key.split("__", 1)
                compound_params.setdefault(key, {})[subkey] = subvalue
                continue
            params[key] = subvalue

        for key, val in compound_params.items():
            if key in params:
                raise errors.InvalidParameter(
                    'Cannot set "{}" and "{}__{}"'.format(
                        key, key, next(iter(val.keys()))
                    )
                )
            params[key] = val

        for key in params.keys():
            if key not in cls.meta.fields:
                raise errors.InvalidParameter(
                    "{!r} is not a valid option for a {}".format(key, cls.resource_name)
                )

        return params

    def identifier(self):
        """ Returns a serializer that renders the identity of the resource, e.g. 'ami-123456' """
        return serializers.Context(serializers.Const(self), serializers.Identifier())

    def get_property(self, property_name):
        """ Returns a serializer that renders a property fetched by describing a remote resource """
        return serializers.Property(property_name, serializers.Const(self))

    def serializer_with_kwargs(self, **kwargs):
        return serializers.Context(
            serializers.Const(self), serializers.Resource(**kwargs)
        )

    def diff(self, runner, value, **kwargs):
        return serializers.Resource(**kwargs).diff(runner, self, value)

    @property
    def arguments(self):
        return list(
            (name, field.argument) for (name, field) in self.meta.iter_fields_in_order()
        )

    @property
    def workspace(self):
        if self.parent:
            return self.parent.workspace

    def add_dependency(self, dependency):
        if self.workspace != dependency:
            self.dependencies.add(dependency)

    def __str__(self):
        if hasattr(self, "name"):
            return "{} '{}'".format(self.resource_name, self.name)
        return self.resource_name

    def __lt__(self, other):
        return str(self) < str(other)


text:
/*
Plugin Name: WP-Digg Style Paginator
Plugin URI: http://www.mis-algoritmos.com/2007/09/09/wp-digg-style-pagination-plugin-v-10/
Author: Victor De la Rocha
Author URI: http://www.mis-algoritmos.com
*/
/*CSS Flickr style pagination*/
	div.pagination {
		padding: 3px;
		margin: 3px;
		text-align:center;
	}

	div.pagination a {
		border: 1px solid #dedfde;
		margin-right:3px;
		padding:2px 6px;

		background-position:bottom;
		text-decoration: none;

		color: #0061de;
	}
	div.pagination a:hover, div.meneame a:active {
		border: 1px solid #000;
		background-image:none;
		background-color:#0061de;
		color: #fff;
	}
	div.pagination span.current {
		margin-right:3px;
		padding:2px 6px;

		font-weight: bold;
		color: #ff0084;
	}
	div.pagination span.disabled {
		margin-right:3px;
		padding:2px 6px;

		color: #adaaad;
	}


text:
// This file is automatically generated.

package adila.db;

/*
 * Claresta S6Plus
 *
 * DEVICE: S6Plus
 * MODEL: S6Plus
 */
final class s6plus_s6plus {
    public static final String DATA = "Claresta|S6Plus|";
}


text:
#include "../Common/rhi_Private.h"
#include "../Common/rhi_Pool.h"
#include "../Common/rhi_Utils.h"
#include "../Common/rhi_FormatConversion.h"
#include "../rhi_Public.h"
#include "rhi_GLES2.h"
#include "Debug/DVAssert.h"
#include "Logger/Logger.h"
#include "_gl.h"

namespace rhi
{
//==============================================================================

struct FramebufferGLES2_t
{
    Handle color[MAX_RENDER_TARGET_COUNT];
    GLuint colorUID[MAX_RENDER_TARGET_COUNT];
    TextureFace colorFace[MAX_RENDER_TARGET_COUNT];
    unsigned colorLevel[MAX_RENDER_TARGET_COUNT];
    uint32 colorCount = 0;
    Handle depthStencil = InvalidHandle;
    GLuint depthStencilUID = 0;
    TextureFace face = TextureFace::TEXTURE_FACE_NONE;
    uint32_t level = 0;
    GLuint frameBuffer = 0;
};
static std::vector<FramebufferGLES2_t> TextureFBO;

class TextureGLES2_t : public ResourceImpl<TextureGLES2_t, Texture::Descriptor>
{
public:
    TextureGLES2_t();

    bool Create(const Texture::Descriptor& desc, bool forceExecute = false);
    void Destroy(bool forceExecute);

    uint32 uid = 0;
    uint32 uid2 = 0;
    uint32 width = 0;
    uint32 height = 0;
    uint32 sampleCount = 1;
    TextureFormat format = TextureFormat::TEXTURE_FORMAT_R8G8B8A8;
    uint32 mappedLevel = 0;
    GLenum mappedFace = 0;

    void* mappedData = nullptr;
    SamplerState::Descriptor::Sampler samplerState;
    GLint fbo = 0;

    uint32 isMapped : 1;
    uint32 updatePending : 1;
    uint32 isCubeMap : 1;
    uint32 isRenderTarget : 1;
    uint32 isRenderBuffer : 1;
    uint32 forceSetSamplerState : 1;
};

RHI_IMPL_RESOURCE(TextureGLES2_t, Texture::Descriptor)

typedef ResourcePool<TextureGLES2_t, RESOURCE_TEXTURE, Texture::Descriptor, true> TextureGLES2Pool;
RHI_IMPL_POOL(TextureGLES2_t, RESOURCE_TEXTURE, Texture::Descriptor, true);

TextureGLES2_t::TextureGLES2_t()
    : isMapped(false)
    , updatePending(false)
    , isCubeMap(false)
    , isRenderTarget(false)
    , isRenderBuffer(false)
    , forceSetSamplerState(true)
{
}

//------------------------------------------------------------------------------

bool TextureGLES2_t::Create(const Texture::Descriptor& desc, bool forceExecute)
{
    DVASSERT(desc.levelCount);

    bool success = false;
    UpdateCreationDesc(desc);

    GLuint glObjects[2] = { 0, 0 };

    bool is_render_buffer = false;

    fbo = 0;

    if ((desc.format == TEXTURE_FORMAT_D16) || (desc.format == TEXTURE_FORMAT_D24S8))
    {
        is_render_buffer = true;
        GLCommand cmd1 = { GLCommand::GEN_RENDERBUFFERS, { static_cast<uint64>(_GLES2_IsGlDepth24Stencil8Supported ? 1 : 2),
                                                           reinterpret_cast<uint64>(glObjects) } };

        ExecGL(&cmd1, 1);

        if (cmd1.status == GL_NO_ERROR)
        {
            if (_GLES2_IsGlDepth24Stencil8Supported)
            {
                GLCommand d24s8cmd[] =
                {
                  { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, glObjects[0] } },
                  { GLCommand::RENDERBUFFER_STORAGE, { GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, desc.width, desc.height, desc.sampleCount } },
                  { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, 0 } }
                };
                ExecGL(d24s8cmd, countof(d24s8cmd), forceExecute);

                // Store depth/stencil buffer index as secondary stencil index for iOS/Android
                glObjects[1] = glObjects[0];
            }
            else
            {
                GLuint depthComponentFormat = GL_DEPTH_COMPONENT16;
			#if defined(__DAVAENGINE_ANDROID__)
                if (_GLES2_IsGlDepthNvNonLinearSupported)
                {
                    depthComponentFormat = GL_DEPTH_COMPONENT16_NONLINEAR_NV;
                }
			#endif
                GLCommand d16s8cmd[] =
                {
                  { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, glObjects[0] } },
                  { GLCommand::RENDERBUFFER_STORAGE, { GL_RENDERBUFFER, depthComponentFormat, desc.width, desc.height, desc.sampleCount } },

                  { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, glObjects[1] } },
                  { GLCommand::RENDERBUFFER_STORAGE, { GL_RENDERBUFFER, GL_STENCIL_INDEX8, desc.width, desc.height, desc.sampleCount } },

                  { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, 0 } }
                };
                ExecGL(d16s8cmd, countof(d16s8cmd), forceExecute);
            }
        }
    }
    else if (desc.sampleCount > 1) // create multisampled render target texture
    {
        DVASSERT(desc.isRenderTarget); // do not support plain multisampled textures
        DVASSERT(desc.type == rhi::TextureType::TEXTURE_TYPE_2D); // do not support cube maps now

        GLint int_fmt = GetGLRenderTargetFormat(desc.format);

        GLCommand gen = { GLCommand::GEN_RENDERBUFFERS, { 1, reinterpret_cast<uint64>(glObjects) } };
        ExecGL(&gen, 1, forceExecute);

        is_render_buffer = true;
        GLCommand cmd[] =
        {
          { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, glObjects[0] } },
          { GLCommand::RENDERBUFFER_STORAGE, { GL_RENDERBUFFER, static_cast<uint64>(int_fmt), desc.width, desc.height, desc.sampleCount } },
          { GLCommand::BIND_RENDERBUFFER, { GL_RENDERBUFFER, 0 } }
        };

        ExecGL(cmd, countof(cmd), forceExecute);
    }
    else // create plain texture
    {
        GLenum target = (desc.type == TEXTURE_TYPE_CUBE) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
        uint32 cmd2_cnt = 2;
        GLCommand cmd2[4 + countof(desc.initialData)] =
        {
          { GLCommand::GEN_TEXTURES, { 1, reinterpret_cast<uint64>(glObjects) } },
          { GLCommand::SET_ACTIVE_TEXTURE, { GL_TEXTURE0 + 0 } }
        };

        if (desc.autoGenMipmaps && !desc.isRenderTarget)
        {
            cmd2[3].func = GLCommand::GENERATE_MIPMAP;
            ++cmd2_cnt;
        }

        // process initial-data, if any
        {
            uint32 array_sz = (desc.type == TEXTURE_TYPE_CUBE) ? 6 : 1;
            GLenum face[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z };
            GLint int_fmt = 0;
            GLint fmt = 0;
            GLenum type = 0;
            bool compressed = false;
            GetGLTextureFormat(desc.format, &int_fmt, &fmt, &type, &compressed);

            DVASSERT(desc.levelCount <= countof(desc.initialData));
            for (unsigned s = 0; s != array_sz; ++s)
            {
                cmd2[cmd2_cnt].func = GLCommand::BIND_TEXTURE;
                cmd2[cmd2_cnt].arg[0] = (desc.type == TEXTURE_TYPE_CUBE) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
                cmd2[cmd2_cnt].arg[1] = uint64(glObjects);
                ++cmd2_cnt;

                target = (desc.type == TEXTURE_TYPE_CUBE) ? face[s] : GL_TEXTURE_2D;

                for (unsigned m = 0; m != desc.levelCount; ++m)
                {
                    GLCommand* cmd = cmd2 + cmd2_cnt;
                    void* data = desc.initialData[s * desc.levelCount + m];

                    if (data)
                    {
                        Size2i sz = TextureExtents(Size2i(desc.width, desc.height), m);
                        uint32 data_sz = TextureSize(desc.format, sz.dx, sz.dy);

                        cmd->func = GLCommand::TEX_IMAGE2D;
                        cmd->arg[0] = target;
                        cmd->arg[1] = m;
                        cmd->arg[2] = uint64(int_fmt);
                        cmd->arg[3] = uint64(sz.dx);
                        cmd->arg[4] = uint64(sz.dy);
                        cmd->arg[5] = 0;
                        cmd->arg[6] = uint64(fmt);
                        cmd->arg[7] = type;
                        cmd->arg[8] = uint64(data_sz);
                        cmd->arg[9] = reinterpret_cast<uint64>(data);
                        cmd->arg[10] = compressed;

                        if (desc.format == TEXTURE_FORMAT_R4G4B4A4)
                            _FlipRGBA4_ABGR4(data, data, data_sz);
                        else if (desc.format == TEXTURE_FORMAT_R5G5B5A1)
                            _RGBA5551toABGR1555(data, data, data_sz);

                        ++cmd2_cnt;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            cmd2[cmd2_cnt].func = GLCommand::RESTORE_TEXTURE0;
            ++cmd2_cnt;
        }

        ExecGL(cmd2, cmd2_cnt, forceExecute);
    }

    if (glObjects[0])
    {
        uid = glObjects[0];
        uid2 = glObjects[1];
        mappedData = nullptr;
        width = desc.width;
        height = desc.height;
        format = desc.format;
        sampleCount = desc.sampleCount;
        isCubeMap = desc.type == TEXTURE_TYPE_CUBE;
        isRenderTarget = desc.isRenderTarget;
        isRenderBuffer = is_render_buffer;
        isMapped = false;
        forceSetSamplerState = true;

        if (isRenderTarget && !isRenderBuffer)
        {
            GLint int_fmt = 0;
            GLint fmt = 0;
            GLenum type = 0;
            bool compressed = false;
            GetGLTextureFormat(format, &int_fmt, &fmt, &type, &compressed);
            DVASSERT(!compressed);

            if (isCubeMap)
            {
                DVASSERT(desc.levelCount < 16);
                unsigned cmd3Count = 2;
                GLCommand cmd3[4 + 6 * 16] =
                {
                  { GLCommand::BIND_TEXTURE, { GL_TEXTURE_CUBE_MAP, uint64(&(this->uid)) } },
                  { GLCommand::SET_ACTIVE_TEXTURE, { GL_TEXTURE0 + 0 } }
                };

                for (unsigned m = 0; m != desc.levelCount; ++m)
                {
                    GLenum face[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z };
                    Size2i sz = TextureExtents(Size2i(desc.width, desc.height), m);

                    for (unsigned f = 0; f != countof(face); ++f)
                    {
                        cmd3[cmd3Count].func = GLCommand::TEX_IMAGE2D;
                        cmd3[cmd3Count].arg[0] = face[f];
                        cmd3[cmd3Count].arg[1] = m;
                        cmd3[cmd3Count].arg[2] = uint64(int_fmt);
                        cmd3[cmd3Count].arg[3] = uint64(sz.dx);
                        cmd3[cmd3Count].arg[4] = uint64(sz.dy);
                        cmd3[cmd3Count].arg[5] = 0;
                        cmd3[cmd3Count].arg[6] = uint64(fmt);
                        cmd3[cmd3Count].arg[7] = type;
                        cmd3[cmd3Count].arg[8] = 0;
                        cmd3[cmd3Count].arg[9] = 0;
                        cmd3[cmd3Count].arg[10] = 0;
                        ++cmd3Count;
                    }
                }

                if (desc.levelCount == 1)
                {
                    cmd3[cmd3Count].func = GLCommand::TEX_PARAMETER_I;
                    cmd3[cmd3Count].arg[0] = GL_TEXTURE_CUBE_MAP;
                    cmd3[cmd3Count].arg[1] = GL_TEXTURE_MAG_FILTER;
                    cmd3[cmd3Count].arg[2] = GL_NEAREST;
                    ++cmd3Count;

                    cmd3[cmd3Count].func = GLCommand::TEX_PARAMETER_I;
                    cmd3[cmd3Count].arg[0] = GL_TEXTURE_CUBE_MAP;
                    cmd3[cmd3Count].arg[1] = GL_TEXTURE_MIN_FILTER;
                    cmd3[cmd3Count].arg[2] = GL_NEAREST;
                    ++cmd3Count;
                }
                else
                {
                    cmd3[cmd3Count].func = GLCommand::TEX_PARAMETER_I;
                    cmd3[cmd3Count].arg[0] = GL_TEXTURE_CUBE_MAP;
                    cmd3[cmd3Count].arg[1] = GL_TEXTURE_MAG_FILTER;
                    cmd3[cmd3Count].arg[2] = GL_LINEAR;
                    ++cmd3Count;

                    cmd3[cmd3Count].func = GLCommand::TEX_PARAMETER_I;
                    cmd3[cmd3Count].arg[0] = GL_TEXTURE_CUBE_MAP;
                    cmd3[cmd3Count].arg[1] = GL_TEXTURE_MIN_FILTER;
                    cmd3[cmd3Count].arg[2] = GL_LINEAR;
                    ++cmd3Count;
                }

                #if !defined(__DAVAENGINE_ANDROID__)
                cmd3[cmd3Count].func = GLCommand::TEX_PARAMETER_I;
                cmd3[cmd3Count].arg[0] = GL_TEXTURE_CUBE_MAP;
                cmd3[cmd3Count].arg[1] = GL_TEXTURE_MAX_LEVEL;
                cmd3[cmd3Count].arg[2] = desc.levelCount - 1;
                ++cmd3Count;
                #endif

                cmd3[cmd3Count].func = GLCommand::RESTORE_TEXTURE0;
                ++cmd3Count;

                ExecGL(cmd3, cmd3Count, forceExecute);
            }
            else
            {
                GLCommand cmd3[] =
                {
                  { GLCommand::BIND_TEXTURE, { GL_TEXTURE_2D, uint64(&(this->uid)) } },
                  { GLCommand::TEX_IMAGE2D, { GL_TEXTURE_2D, 0, uint64(int_fmt), uint64(desc.width), uint64(desc.height), 0, uint64(fmt), type, 0, 0, 0 } },
                  { GLCommand::TEX_PARAMETER_I, { GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST } },
                  { GLCommand::TEX_PARAMETER_I, { GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST } },
                  { GLCommand::RESTORE_TEXTURE0, {} }
                };
                ExecGL(cmd3, countof(cmd3), forceExecute);
            }
        }

        success = true;
    }

    return success;
}

//------------------------------------------------------------------------------

void TextureGLES2_t::Destroy(bool forceExecute)
{
    GLCommand cmd[64] = {};
    GLint doomed_fbo[64];
    size_t cmd_cnt = 1;

    if (isRenderTarget || isRenderBuffer)
    {
        cmd[0].func = isRenderBuffer ? GLCommand::DELETE_RENDERBUFFERS : GLCommand::DELETE_TEXTURES;
        cmd[0].arg[0] = 1;
        cmd[0].arg[1] = uint64(&(uid));

        if ((uid2 != 0) && (uid2 != uid))
        {
            cmd[cmd_cnt].func = GLCommand::DELETE_RENDERBUFFERS;
            cmd[cmd_cnt].arg[0] = 1;
            cmd[cmd_cnt].arg[1] = uint64(&(uid2));
            ++cmd_cnt;
        }

        for (std::vector<FramebufferGLES2_t>::iterator f = TextureFBO.begin(); f != TextureFBO.end();)
        {
            bool do_delete = false;

            if (!isRenderBuffer)
            {
                for (const GLuint *t = f->colorUID, *t_end = f->colorUID + f->colorCount; t != t_end; ++t)
                {
                    if (*t == uid)
                    {
                        do_delete = true;
                        break;
                    }
                }
            }

            if (isRenderBuffer && f->depthStencilUID != 0 && (f->depthStencilUID == uid || f->depthStencilUID == uid2))
                do_delete = true;

            if (do_delete)
            {
                if (cmd_cnt == countof(cmd) - 1)
                {
                    ExecGL(cmd, static_cast<uint32>(cmd_cnt), forceExecute);
                    cmd_cnt = 0;
                }
                DVASSERT(cmd_cnt <= countof(cmd) - 1);
                doomed_fbo[cmd_cnt] = f->frameBuffer;
                cmd[cmd_cnt].func = GLCommand::DELETE_FRAMEBUFFERS;
                cmd[cmd_cnt].arg[0] = 1;
                cmd[cmd_cnt].arg[1] = uint64(&(doomed_fbo[cmd_cnt]));
                ++cmd_cnt;

                f = TextureFBO.erase(f);
            }
            else
            {
                ++f;
            }
        }
    }
    else
    {
        cmd[0].func = GLCommand::DELETE_TEXTURES;
        cmd[0].arg[0] = 1;
        cmd[0].arg[1] = uint64(&(uid));
    }

    if (cmd_cnt)
        ExecGL(cmd, static_cast<uint32>(cmd_cnt), forceExecute);

    DVASSERT(!isMapped);

    if (mappedData)
    {
        ::free(mappedData);

        mappedData = nullptr;
        width = 0;
        height = 0;
    }
    MarkRestored();
}

//------------------------------------------------------------------------------

static void gles2_Texture_Delete(Handle tex, bool forceExecute)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    self->Destroy(forceExecute);
    TextureGLES2Pool::Free(tex);
}

//------------------------------------------------------------------------------

static Handle gles2_Texture_Create(const Texture::Descriptor& desc)
{
    Handle handle = TextureGLES2Pool::Alloc();
    TextureGLES2_t* tex = TextureGLES2Pool::Get(handle);

    if (tex->Create(desc) == false)
    {
        TextureGLES2Pool::Free(handle);
        handle = InvalidHandle;
    }

    return handle;
}

//------------------------------------------------------------------------------

static void* gles2_Texture_Map(Handle tex, unsigned level, TextureFace face)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    void* data = nullptr;
    uint32 data_sz = TextureSize(self->format, self->width, self->height, level);

    DVASSERT(!self->isRenderBuffer);
    DVASSERT(!self->isMapped);

    self->mappedData = reinterpret_cast<uint8*>(::realloc(self->mappedData, data_sz));

    if (self->mappedData)
    {
        if (self->isRenderTarget)
        {
            DVASSERT(level == 0);
            DVASSERT(self->fbo != 0);
            GLint internalFormat;
            GLint format;
            GLenum type;
            bool compressed;
            GetGLTextureFormat(self->format, &internalFormat, &format, &type, &compressed);

            GLCommand cmd[] =
            {
              { GLCommand::BIND_FRAMEBUFFER, { GL_FRAMEBUFFER, uint64(self->fbo) } },
              { GLCommand::READ_PIXELS, { 0, 0, self->width, self->height, static_cast<uint64>(format), type, uint64(self->mappedData) } },
              { GLCommand::BIND_FRAMEBUFFER, { GL_FRAMEBUFFER, _GLES2_Bound_FrameBuffer } },
            };

            ExecGL(cmd, countof(cmd));

            data = self->mappedData;
            self->mappedLevel = 0;
            self->isMapped = true;
        }
        else
        {
            data = self->mappedData;
            self->mappedLevel = level;
            self->isMapped = true;
            self->mappedFace = face;
        }
    }

    if (self->format == TEXTURE_FORMAT_R4G4B4A4)
    {
        _FlipRGBA4_ABGR4(self->mappedData, self->mappedData, data_sz);
    }
    else if (self->format == TEXTURE_FORMAT_R5G5B5A1)
    {
        _ABGR1555toRGBA5551(self->mappedData, self->mappedData, data_sz);
    }

    return data;
}

//------------------------------------------------------------------------------

static void
gles2_Texture_Unmap(Handle tex)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    Size2i sz = TextureExtents(Size2i(self->width, self->height), self->mappedLevel);
    GLint int_fmt;
    GLint fmt;
    GLenum type;
    bool compressed;

    uint32 textureDataSize = TextureSize(self->format, sz.dx, sz.dy);
    GetGLTextureFormat(self->format, &int_fmt, &fmt, &type, &compressed);

    DVASSERT(self->isMapped);
    if (self->format == TEXTURE_FORMAT_R4G4B4A4)
    {
        _FlipRGBA4_ABGR4(self->mappedData, self->mappedData, textureDataSize);
    }
    else if (self->format == TEXTURE_FORMAT_R5G5B5A1)
    {
        _RGBA5551toABGR1555(self->mappedData, self->mappedData, textureDataSize);
    }

    GLenum ttarget = (self->isCubeMap) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
    GLenum target = GL_TEXTURE_2D;

    if (self->isCubeMap)
    {
        switch (self->mappedFace)
        {
        case TEXTURE_FACE_POSITIVE_X:
            target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
            break;
        case TEXTURE_FACE_NEGATIVE_X:
            target = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
            break;
        case TEXTURE_FACE_POSITIVE_Y:
            target = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
            break;
        case TEXTURE_FACE_NEGATIVE_Y:
            target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
            break;
        case TEXTURE_FACE_POSITIVE_Z:
            target = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
            break;
        case TEXTURE_FACE_NEGATIVE_Z:
            target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
            break;
        default:
            break;
        }
    }

    GLCommand cmd[] =
    {
      { GLCommand::SET_ACTIVE_TEXTURE, { GL_TEXTURE0 + 0 } },
      { GLCommand::BIND_TEXTURE, { ttarget, uint64(&(self->uid)) } },
      { GLCommand::TEX_IMAGE2D, { target, self->mappedLevel, uint64(int_fmt), uint64(sz.dx), uint64(sz.dy), 0, uint64(fmt), type, uint64(textureDataSize), reinterpret_cast<uint64>(self->mappedData), compressed } },
      { GLCommand::RESTORE_TEXTURE0, {} }
    };

    ExecGL(cmd, countof(cmd));

    self->isMapped = false;
    ::free(self->mappedData);
    self->mappedData = nullptr;
}

//------------------------------------------------------------------------------

void gles2_Texture_Update(Handle tex, const void* data, uint32 level, TextureFace face)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    Size2i sz = TextureExtents(Size2i(self->width, self->height), level);
    GLint int_fmt;
    GLint fmt;
    GLenum type;
    bool compressed;
    uint32 textureDataSize = TextureSize(self->format, sz.dx, sz.dy);

    DVASSERT(!self->isRenderBuffer);
    DVASSERT(!self->isMapped);

    GetGLTextureFormat(self->format, &int_fmt, &fmt, &type, &compressed);

    if (self->format == TEXTURE_FORMAT_R4G4B4A4 || self->format == TEXTURE_FORMAT_R5G5B5A1)
    {
        gles2_Texture_Map(tex, level, face);
        memcpy(self->mappedData, data, textureDataSize);
        gles2_Texture_Unmap(tex);
    }
    else
    {
        GLenum ttarget = (self->isCubeMap) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
        GLenum target = GL_TEXTURE_2D;

        if (self->isCubeMap)
        {
            switch (face)
            {
            case TEXTURE_FACE_POSITIVE_X:
                target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
                break;
            case TEXTURE_FACE_NEGATIVE_X:
                target = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
                break;
            case TEXTURE_FACE_POSITIVE_Y:
                target = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
                break;
            case TEXTURE_FACE_NEGATIVE_Y:
                target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
                break;
            case TEXTURE_FACE_POSITIVE_Z:
                target = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
                break;
            case TEXTURE_FACE_NEGATIVE_Z:
                target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
                break;
            default:
                DVASSERT(0, "Invalid TextureFace provided");
            }
        }

        GLCommand cmd[] =
        {
          { GLCommand::SET_ACTIVE_TEXTURE, { GL_TEXTURE0 + 0 } },
          { GLCommand::BIND_TEXTURE, { ttarget, uint64(&(self->uid)) } },
          { GLCommand::TEX_IMAGE2D, { target, uint64(level), uint64(int_fmt), uint64(sz.dx), uint64(sz.dy), 0, uint64(fmt), type, uint64(textureDataSize), reinterpret_cast<uint64>(data), compressed } },
          { GLCommand::RESTORE_TEXTURE0, {} }
        };

        ExecGL(cmd, countof(cmd));
    }
}

//------------------------------------------------------------------------------

bool gles2_Texture_NeedRestore(Handle tex)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    return self->NeedRestore();
}

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

struct
SamplerStateGLES2_t
{
    SamplerState::Descriptor::Sampler fragmentSampler[MAX_FRAGMENT_TEXTURE_SAMPLER_COUNT];
    uint32 fragmentSamplerCount;
    SamplerState::Descriptor::Sampler vertexSampler[MAX_VERTEX_TEXTURE_SAMPLER_COUNT];
    uint32 vertexSamplerCount;
};

typedef ResourcePool<SamplerStateGLES2_t, RESOURCE_SAMPLER_STATE, SamplerState::Descriptor, false> SamplerStateGLES2Pool;
RHI_IMPL_POOL(SamplerStateGLES2_t, RESOURCE_SAMPLER_STATE, SamplerState::Descriptor, false);
static const SamplerStateGLES2_t* _CurSamplerState = nullptr;

//------------------------------------------------------------------------------

static Handle
gles2_SamplerState_Create(const SamplerState::Descriptor& desc)
{
    Handle handle = SamplerStateGLES2Pool::Alloc();
    SamplerStateGLES2_t* state = SamplerStateGLES2Pool::Get(handle);

    state->fragmentSamplerCount = desc.fragmentSamplerCount;
    for (unsigned i = 0; i != desc.fragmentSamplerCount; ++i)
    {
        state->fragmentSampler[i] = desc.fragmentSampler[i];
    }

    state->vertexSamplerCount = desc.vertexSamplerCount;
    for (unsigned i = 0; i != desc.vertexSamplerCount; ++i)
    {
        state->vertexSampler[i] = desc.vertexSampler[i];
    }

    return handle;
}

//------------------------------------------------------------------------------

static void
gles2_SamplerState_Delete(Handle hstate)
{
    SamplerStateGLES2_t* state = SamplerStateGLES2Pool::Get(hstate);

    if (_CurSamplerState == state)
        _CurSamplerState = nullptr;

    SamplerStateGLES2Pool::Free(hstate);
}

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

namespace SamplerStateGLES2
{
void Init(uint32 maxCount)
{
    SamplerStateGLES2Pool::Reserve(maxCount);
}
void SetupDispatch(Dispatch* dispatch)
{
    dispatch->impl_SamplerState_Create = &gles2_SamplerState_Create;
    dispatch->impl_SamplerState_Delete = &gles2_SamplerState_Delete;
}

void SetToRHI(Handle hstate)
{
    SamplerStateGLES2_t* state = SamplerStateGLES2Pool::Get(hstate);

    _CurSamplerState = state;
}
}

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

static GLenum
_TextureFilterGLES2(TextureFilter filter)
{
    GLenum f = GL_LINEAR;

    switch (filter)
    {
    case TEXFILTER_NEAREST:
        f = GL_NEAREST;
        break;
    case TEXFILTER_LINEAR:
        f = GL_LINEAR;
        break;
    }

    return f;
}

//------------------------------------------------------------------------------

static GLenum
_TextureMinMipFilterGLES2(TextureFilter minfilter, TextureMipFilter mipfilter)
{
    GLenum f = GL_LINEAR_MIPMAP_LINEAR;

    switch (mipfilter)
    {
    case TEXMIPFILTER_NONE:
        f = (minfilter == TEXFILTER_NEAREST) ? GL_NEAREST : GL_LINEAR;
        break;
    case TEXMIPFILTER_NEAREST:
        f = (minfilter == TEXFILTER_NEAREST) ? GL_NEAREST_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_NEAREST;
        break;
    case TEXMIPFILTER_LINEAR:
        f = (minfilter == TEXFILTER_NEAREST) ? GL_NEAREST_MIPMAP_LINEAR : GL_LINEAR_MIPMAP_LINEAR;
        break;
    }

    return f;
}

//------------------------------------------------------------------------------

static GLenum
_AddrModeGLES2(TextureAddrMode mode)
{
    GLenum m = GL_REPEAT;

    switch (mode)
    {
    case TEXADDR_WRAP:
        m = GL_REPEAT;
        break;
    case TEXADDR_CLAMP:
        m = GL_CLAMP_TO_EDGE;
        break;
    case TEXADDR_MIRROR:
        m = GL_MIRRORED_REPEAT;
        break;
    }

    return m;
}

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

namespace TextureGLES2
{
void Init(uint32 maxCount)
{
    TextureGLES2Pool::Reserve(maxCount);
}

void SetupDispatch(Dispatch* dispatch)
{
    dispatch->impl_Texture_Create = &gles2_Texture_Create;
    dispatch->impl_Texture_Delete = &gles2_Texture_Delete;
    dispatch->impl_Texture_Map = &gles2_Texture_Map;
    dispatch->impl_Texture_Unmap = &gles2_Texture_Unmap;
    dispatch->impl_Texture_Update = &gles2_Texture_Update;
    dispatch->impl_Texture_NeedRestore = &gles2_Texture_NeedRestore;
}

void InvalidateCache()
{
    _GLES2_LastActiveTexture = -1;
}

void SetToRHI(Handle tex, unsigned unit_i, uint32 base_i)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);
    bool fragment = base_i != DAVA::InvalidIndex;
    uint32 sampler_i = (base_i == DAVA::InvalidIndex) ? unit_i : base_i + unit_i;
    GLenum target = (self->isCubeMap) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;

    const SamplerState::Descriptor::Sampler* sampler = (fragment) ? _CurSamplerState->fragmentSampler + unit_i : _CurSamplerState->vertexSampler + unit_i;

    if (uint32(_GLES2_LastActiveTexture) != GL_TEXTURE0 + sampler_i)
    {
        GL_CALL(glActiveTexture(GL_TEXTURE0 + sampler_i));
        _GLES2_LastActiveTexture = GL_TEXTURE0 + sampler_i;
    }

    GL_CALL(glBindTexture(target, self->uid));

    if (sampler_i == 0)
    {
        _GLES2_LastSetTex0 = self->uid;
        _GLES2_LastSetTex0Target = target;
    }

    if ((self->forceSetSamplerState || memcmp(&(self->samplerState), sampler, sizeof(rhi::SamplerState::Descriptor::Sampler))) && !self->isRenderBuffer)
    {
        GL_CALL(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, _TextureMinMipFilterGLES2(TextureFilter(sampler->minFilter), TextureMipFilter(sampler->mipFilter))));
        GL_CALL(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, _TextureFilterGLES2(TextureFilter(sampler->magFilter))));

        GL_CALL(glTexParameteri(target, GL_TEXTURE_WRAP_S, _AddrModeGLES2(TextureAddrMode(sampler->addrU))));
        GL_CALL(glTexParameteri(target, GL_TEXTURE_WRAP_T, _AddrModeGLES2(TextureAddrMode(sampler->addrV))));

        if (rhi::DeviceCaps().isAnisotropicFilteringSupported())
        {
            DVASSERT(sampler->anisotropyLevel >= 1);
            DVASSERT(sampler->anisotropyLevel <= rhi::DeviceCaps().maxAnisotropy);
            GL_CALL(glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler->anisotropyLevel));
        }

        self->samplerState = *sampler;
        self->forceSetSamplerState = false;
    }
}

unsigned GetFrameBuffer(const Handle* color, const TextureFace* face, const unsigned* level, uint32 colorCount, Handle depthStencil)
{
    GLuint fb = 0;

    for (const FramebufferGLES2_t& f : TextureFBO)
    {
        if (f.colorCount == colorCount
            && memcmp(f.color, color, sizeof(Handle) * colorCount) == 0
            && memcmp(f.colorFace, face, sizeof(TextureFace) * colorCount) == 0
            && memcmp(f.colorLevel, level, sizeof(unsigned) * colorCount) == 0
            && (f.depthStencil == depthStencil)
            )
        {
            fb = f.frameBuffer;
            break;
        }
    }

    if (fb == 0)
    {
        GL_CALL(glGenFramebuffers(1, &fb));
        DVASSERT(fb != 0);
        GL_CALL(glBindFramebuffer(GL_FRAMEBUFFER, fb));

        for (unsigned i = 0; i != colorCount; ++i)
        {
            TextureGLES2_t* tex = TextureGLES2Pool::Get(color[i]);

            if (tex->isRenderBuffer)
            {
                DVASSERT(glIsRenderbuffer(tex->uid));
                GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_RENDERBUFFER, tex->uid));
            }
            else
            {
                GLenum target = GL_TEXTURE_2D;
                if (tex->isCubeMap)
                {
                    switch (face[i])
                    {
                    case TextureFace::TEXTURE_FACE_POSITIVE_X:
                        target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
                        break;
                    case TextureFace::TEXTURE_FACE_NEGATIVE_X:
                        target = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
                        break;
                    case TextureFace::TEXTURE_FACE_POSITIVE_Y:
                        target = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
                        break;
                    case TextureFace::TEXTURE_FACE_NEGATIVE_Y:
                        target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
                        break;
                    case TextureFace::TEXTURE_FACE_POSITIVE_Z:
                        target = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
                        break;
                    case TextureFace::TEXTURE_FACE_NEGATIVE_Z:
                        target = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
                        break;
                    default:
                        DVASSERT(0, "Invalid TextureFace provided");
                    }
                }
                /*
                 * GFX_COMPLETE
                 * There was another function around, called "glFramebufferTextureLayer"
                 * In case of emergency or sudden break of rendering to cubemap levels or layers contact s_reznik
                 */
                GL_CALL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, target, tex->uid, level[i]));
            }
        }

        if (depthStencil != InvalidHandle && depthStencil != DefaultDepthBuffer)
        {
            TextureGLES2_t* ds = TextureGLES2Pool::Get(depthStencil);

		#if defined(__DAVAENGINE_IPHONE__) || defined(__DAVAENGINE_ANDROID__)
            GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ds->uid));
            if (ds->uid2)
            {
                GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, ds->uid2));
            }
		#else
            GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, ds->uid));
		#endif
        }

	#if !(defined __DAVAENGINE_IPHONE__ || defined __DAVAENGINE_ANDROID__)
        GLenum b[MAX_RENDER_TARGET_COUNT] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
        GL_CALL(glDrawBuffers(colorCount, b));
	#endif

        int status = 0;
        GL_CALL(status = glCheckFramebufferStatus(GL_FRAMEBUFFER));

        if (status == GL_FRAMEBUFFER_COMPLETE)
        {
            FramebufferGLES2_t f;
            f.colorCount = colorCount;
            memcpy(f.color, color, sizeof(Handle) * colorCount);
            memcpy(f.colorFace, face, sizeof(TextureFace) * colorCount);
            memcpy(f.colorLevel, level, sizeof(unsigned) * colorCount);
            f.depthStencil = depthStencil;
            f.depthStencilUID = (depthStencil != InvalidHandle && depthStencil != DefaultDepthBuffer) ? TextureGLES2Pool::Get(depthStencil)->uid : 0;
            f.frameBuffer = fb;

            for (unsigned i = 0; i != colorCount; ++i)
            {
                TextureGLES2_t* tex = TextureGLES2Pool::Get(color[i]);

                f.colorUID[i] = tex->uid;

                if (tex->fbo == 0)
                    tex->fbo = fb;
            }

            TextureFBO.push_back(f);
        }
        else
        {
            DAVA::Logger::Error("glCheckFramebufferStatus = %08X", status);
            DVASSERT(status == GL_FRAMEBUFFER_COMPLETE);
        }

        GL_CALL(glBindFramebuffer(GL_FRAMEBUFFER, _GLES2_Bound_FrameBuffer));
    }

    return fb;
}

void ResolveMultisampling(Handle fromTexture, Handle toTexture)
{
    DVASSERT(fromTexture != rhi::InvalidHandle);
    TextureGLES2_t* from = TextureGLES2Pool::Get(fromTexture);
    TextureGLES2_t* to = toTexture == rhi::InvalidHandle ? nullptr : TextureGLES2Pool::Get(toTexture);

    GLuint targetBuffer = _GLES2_Default_FrameBuffer;

    bool fromHasDepthFormat = (from->format == TextureFormat::TEXTURE_FORMAT_D16) || (from->format == TextureFormat::TEXTURE_FORMAT_D24S8);
    DVASSERT(!fromHasDepthFormat);
    //    DVASSERT(!from->fbo.empty());

    if (to != nullptr)
    {
        bool toHasDepthFormat = (to->format == TextureFormat::TEXTURE_FORMAT_D16) || (to->format == TextureFormat::TEXTURE_FORMAT_D24S8);
        DVASSERT(!toHasDepthFormat);
        //        if (to->fbo.empty())
        if (to->fbo == 0)
        {
            // force create frame-buffer object
            Handle colorTex = toTexture;
            TextureFace colorFace = TEXTURE_FACE_NONE;
            unsigned colorLevel = 0;

            GetFrameBuffer(&colorTex, &colorFace, &colorLevel, 1, InvalidHandle);
        }
        targetBuffer = to->fbo;
    }

    _GLES2_Bound_FrameBuffer = from->fbo;
    GL_CALL(glBindFramebuffer(GL_READ_FRAMEBUFFER, _GLES2_Bound_FrameBuffer));
    GL_CALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targetBuffer));

#if defined(__DAVAENGINE_IPHONE__)
    ios_gl_resolve_multisampling(0, 0, from->width, from->height, 0, 0, from->width, from->height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
#elif defined(__DAVAENGINE_ANDROID__)
    DVASSERT(glBlitFramebuffer != nullptr);
#endif

    GL_CALL(glBlitFramebuffer(0, 0, from->width, from->height, 0, 0, from->width, from->height, GL_COLOR_BUFFER_BIT, GL_LINEAR));
    GL_CALL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _GLES2_Bound_FrameBuffer));
}

Size2i Size(Handle tex)
{
    TextureGLES2_t* self = TextureGLES2Pool::Get(tex);

    return Size2i(self->width, self->height);
}

void ReCreateAll()
{
    TextureGLES2Pool::ReCreateAll();
}

unsigned
NeedRestoreCount()
{
    return TextureGLES2Pool::PendingRestoreCount();
}

} // namespace TextureGLES2

//==============================================================================
} // namespace rhi


text:
module WowzaRest
  module CoreExt
    module String
      module Inflections
        # its mainly used when converting json attrs to getters/setters methods
        # wowza rest api responses sometimes have attributes that contains dots
        # and this causes problems when trying to convert it to a method
        # thats why i have to replace all dots with underscores
        def underscore
          gsub(/::/, '/')
            .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
            .gsub(/([a-z\d])([A-Z])/, '\1_\2')
            .tr('-', '_')
            .tr('.', '_')
            .downcase
        end

        def camelize
          tr('-', '_')
            .gsub(/\b[A-Z]+/, &:downcase)
            .gsub(/_(.)/, &:upcase)
            .tr('_', '')
        end
      end
    end
  end
end


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkExporterWrap.h"
#include "vtkVRMLExporterWrap.h"
#include "vtkObjectWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkVRMLExporterWrap::ptpl;

VtkVRMLExporterWrap::VtkVRMLExporterWrap()
{ }

VtkVRMLExporterWrap::VtkVRMLExporterWrap(vtkSmartPointer<vtkVRMLExporter> _native)
{ native = _native; }

VtkVRMLExporterWrap::~VtkVRMLExporterWrap()
{ }

void VtkVRMLExporterWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkVRMLExporter").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("VRMLExporter").ToLocalChecked(), ConstructorGetter);
}

void VtkVRMLExporterWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkVRMLExporterWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkExporterWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkExporterWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkVRMLExporterWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetFileName", GetFileName);
	Nan::SetPrototypeMethod(tpl, "getFileName", GetFileName);

	Nan::SetPrototypeMethod(tpl, "GetSpeed", GetSpeed);
	Nan::SetPrototypeMethod(tpl, "getSpeed", GetSpeed);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetFileName", SetFileName);
	Nan::SetPrototypeMethod(tpl, "setFileName", SetFileName);

	Nan::SetPrototypeMethod(tpl, "SetSpeed", SetSpeed);
	Nan::SetPrototypeMethod(tpl, "setSpeed", SetSpeed);

#ifdef VTK_NODE_PLUS_VTKVRMLEXPORTERWRAP_INITPTPL
	VTK_NODE_PLUS_VTKVRMLEXPORTERWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkVRMLExporterWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkVRMLExporter> native = vtkSmartPointer<vtkVRMLExporter>::New();
		VtkVRMLExporterWrap* obj = new VtkVRMLExporterWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkVRMLExporterWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkVRMLExporterWrap::GetFileName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetFileName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkVRMLExporterWrap::GetSpeed(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	double r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetSpeed();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkVRMLExporterWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkVRMLExporterWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	vtkVRMLExporter * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkVRMLExporterWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkVRMLExporterWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkVRMLExporterWrap *w = new VtkVRMLExporterWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkVRMLExporterWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkVRMLExporter * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkVRMLExporterWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkVRMLExporterWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkVRMLExporterWrap *w = new VtkVRMLExporterWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkVRMLExporterWrap::SetFileName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetFileName(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkVRMLExporterWrap::SetSpeed(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkVRMLExporterWrap *wrapper = ObjectWrap::Unwrap<VtkVRMLExporterWrap>(info.Holder());
	vtkVRMLExporter *native = (vtkVRMLExporter *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetSpeed(
			info[0]->NumberValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}


text:
Fixes:

- Added in the ability to require chief via `f1-dom/chief`

# 8.0.3

Fixes:

- Brought in the module `scientific-to-decimal` to convert all numbers passed to css `transform`. Safari does not allow for numbers in scientific notation in `transform`.

# 8.0.2

Fixes:

- `transform` is now set via building strings of tranformations vs building a matrix. This seems to be more consistent accross browsers.

# 8.0.1

Fixes:

- A quick fix so the world doesnt break. Dropped in a perspective calculation into the matrix3d call because it seems that Chrome doesn't always render perspective properly.

# 8.0.0

Fixes:

- Needed to remove perspective handling from `f1-dom` because `perspective-origin` was completely calculated wrong. Now if developers want to have 3d transforms that use perspective you must define `perspective` on the parent container element. Sorry...


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

using System.Runtime.Serialization;

namespace Azure.ResourceManager.ResourceGraph.Tests
{
    public enum ColumnDataType
    {
        [EnumMember(Value = "string")]
        String,
        [EnumMember(Value = "integer")]
        Integer,
        [EnumMember(Value = "number")]
        Number,
        [EnumMember(Value = "boolean")]
        Boolean,
        [EnumMember(Value = "object")]
        Object
    }
}


text:
#ifndef __rank_h__
#define __rank_h__

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Return values of rank_floats* functions contain these bit fields.
 */
#define RANK_STATUS_TIES  (0x00000001) // ...if ANY ties exist
#define RANK_STATUS_CONST (0x00000002) // ...if ALL values are ties.

void *rank_alloc( int n );
int   rank_floats( float *base, const unsigned int N, int normalize, void *buf );
int   rank_floats_strided( float *base, const unsigned int N, int stride, int normalize, void *buf );
void  rank_free( void * );

#ifdef __cplusplus
}
#endif

#endif


text:
#include "mesh_splitter.h"

#include <assimp/scene.h>

// ----------------------------------------------------------------------------
// Note: this is largely based on assimp's SplitLargeMeshes_Vertex process.
// it is refactored and the coding style is slightly improved, though.
// ----------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
void MeshSplitter :: Execute( aiScene* pScene)
{
	std::vector<std::pair<aiMesh*, unsigned int> > source_mesh_map;

	for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
		SplitMesh(a, pScene->mMeshes[a],source_mesh_map);
	}

	const unsigned int size = static_cast<unsigned int>(source_mesh_map.size());
	if (size != pScene->mNumMeshes)
	{
		// it seems something has been split. rebuild the mesh list
		delete[] pScene->mMeshes;
		pScene->mNumMeshes = size;
		pScene->mMeshes = new aiMesh*[size]();

		for (unsigned int i = 0; i < size;++i) {
			pScene->mMeshes[i] = source_mesh_map[i].first;
		}

		// now we need to update all nodes
		UpdateNode(pScene->mRootNode,source_mesh_map);
	}
}

// ------------------------------------------------------------------------------------------------
void MeshSplitter :: UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map)
{
	// TODO: should better use std::(multi)set for source_mesh_map.

	// for every index in out list build a new entry
	std::vector<unsigned int> aiEntries;
	aiEntries.reserve(pcNode->mNumMeshes + 1);
	for (unsigned int i = 0; i < pcNode->mNumMeshes;++i)	{
		for (unsigned int a = 0, end = static_cast<unsigned int>(source_mesh_map.size()); a < end;++a)	{
			if (source_mesh_map[a].second == pcNode->mMeshes[i])	{
				aiEntries.push_back(a);
			}
		}
	}

	// now build the new list
	delete pcNode->mMeshes;
	pcNode->mNumMeshes = static_cast<unsigned int>(aiEntries.size());
	pcNode->mMeshes = new unsigned int[pcNode->mNumMeshes];

	for (unsigned int b = 0; b < pcNode->mNumMeshes;++b) {
		pcNode->mMeshes[b] = aiEntries[b];
	}

	// recursively update children
	for (unsigned int i = 0, end = pcNode->mNumChildren; i < end;++i)	{
		UpdateNode ( pcNode->mChildren[i], source_mesh_map );
	}
	return;
}

#define WAS_NOT_COPIED 0xffffffff

typedef std::pair <unsigned int,float> PerVertexWeight;
typedef std::vector	<PerVertexWeight> VertexWeightTable;

// ------------------------------------------------------------------------------------------------
VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh)
{
	if (!pMesh || !pMesh->mNumVertices || !pMesh->mNumBones) {
		return NULL;
	}

	VertexWeightTable* const avPerVertexWeights = new VertexWeightTable[pMesh->mNumVertices];
	for (unsigned int i = 0; i < pMesh->mNumBones;++i)	{

		aiBone* bone = pMesh->mBones[i];
		for (unsigned int a = 0; a < bone->mNumWeights;++a)	{
			const aiVertexWeight& weight = bone->mWeights[a];
			avPerVertexWeights[weight.mVertexId].push_back( std::make_pair(i,weight.mWeight) );
		}
	}
	return avPerVertexWeights;
}

// ------------------------------------------------------------------------------------------------
void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh,
	std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map)
{
	// TODO: should better use std::(multi)set for source_mesh_map.

	if (in_mesh->mNumVertices <= LIMIT)	{
		source_mesh_map.push_back(std::make_pair(in_mesh,a));
		return;
	}

	// build a per-vertex weight list if necessary
	VertexWeightTable* avPerVertexWeights = ComputeVertexBoneWeightTable(in_mesh);

	// we need to split this mesh into sub meshes. Estimate submesh size
	const unsigned int sub_meshes = (in_mesh->mNumVertices / LIMIT) + 1;

	// create a std::vector<unsigned int> to remember which vertices have already
	// been copied and to which position (i.e. output index)
	std::vector<unsigned int> was_copied_to;
	was_copied_to.resize(in_mesh->mNumVertices,WAS_NOT_COPIED);

	// Try to find a good estimate for the number of output faces
	// per mesh. Add 12.5% as buffer
	unsigned int size_estimated = in_mesh->mNumFaces / sub_meshes;
	size_estimated += size_estimated / 8;

	// now generate all submeshes
	unsigned int base = 0;
	while (true) {
		const unsigned int out_vertex_index = LIMIT;

		aiMesh* out_mesh = new aiMesh();
		out_mesh->mNumVertices = 0;
		out_mesh->mMaterialIndex = in_mesh->mMaterialIndex;

		// the name carries the adjacency information between the meshes
		out_mesh->mName = in_mesh->mName;

		typedef std::vector<aiVertexWeight> BoneWeightList;
		if (in_mesh->HasBones())	{
			out_mesh->mBones = new aiBone*[in_mesh->mNumBones]();
		}

		// clear the temporary helper array
		if (base)	{
			std::fill(was_copied_to.begin(), was_copied_to.end(), WAS_NOT_COPIED);
		}

		std::vector<aiFace> vFaces;

		// reserve enough storage for most cases
		if (in_mesh->HasPositions()) {
			out_mesh->mVertices = new aiVector3D[out_vertex_index];
		}

		if (in_mesh->HasNormals()) {
			out_mesh->mNormals = new aiVector3D[out_vertex_index];
		}

		if (in_mesh->HasTangentsAndBitangents())	{
			out_mesh->mTangents = new aiVector3D[out_vertex_index];
			out_mesh->mBitangents = new aiVector3D[out_vertex_index];
		}

		for (unsigned int c = 0; in_mesh->HasVertexColors(c);++c)	{
			out_mesh->mColors[c] = new aiColor4D[out_vertex_index];
		}

		for (unsigned int c = 0; in_mesh->HasTextureCoords(c);++c)	{
			out_mesh->mNumUVComponents[c] = in_mesh->mNumUVComponents[c];
			out_mesh->mTextureCoords[c] = new aiVector3D[out_vertex_index];
		}
		vFaces.reserve(size_estimated);

		// (we will also need to copy the array of indices)
		while (base < in_mesh->mNumFaces) {
			const unsigned int iNumIndices = in_mesh->mFaces[base].mNumIndices;

			// doesn't catch degenerates but is quite fast
			unsigned int iNeed = 0;
			for (unsigned int v = 0; v < iNumIndices;++v)	{
				unsigned int index = in_mesh->mFaces[base].mIndices[v];

				// check whether we do already have this vertex
				if (WAS_NOT_COPIED == was_copied_to[index])	{
					iNeed++;
				}
			}
			if (out_mesh->mNumVertices + iNeed > out_vertex_index)	{
				// don't use this face
				break;
			}

			vFaces.push_back(aiFace());
			aiFace& rFace = vFaces.back();

			// setup face type and number of indices
			rFace.mNumIndices = iNumIndices;
			rFace.mIndices = new unsigned int[iNumIndices];

			// need to update the output primitive types
			switch (rFace.mNumIndices)
			{
			case 1:
				out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT;
				break;
			case 2:
				out_mesh->mPrimitiveTypes |= aiPrimitiveType_LINE;
				break;
			case 3:
				out_mesh->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE;
				break;
			default:
				out_mesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
			}

			// and copy the contents of the old array, offset them by current base
			for (unsigned int v = 0; v < iNumIndices;++v) {
				const unsigned int index = in_mesh->mFaces[base].mIndices[v];

				// check whether we do already have this vertex
				if (WAS_NOT_COPIED != was_copied_to[index]) {
					rFace.mIndices[v] = was_copied_to[index];
					continue;
				}

				// copy positions
				out_mesh->mVertices[out_mesh->mNumVertices] = (in_mesh->mVertices[index]);

				// copy normals
				if (in_mesh->HasNormals()) {
					out_mesh->mNormals[out_mesh->mNumVertices] = (in_mesh->mNormals[index]);
				}

				// copy tangents/bi-tangents
				if (in_mesh->HasTangentsAndBitangents()) {
					out_mesh->mTangents[out_mesh->mNumVertices] = (in_mesh->mTangents[index]);
					out_mesh->mBitangents[out_mesh->mNumVertices] = (in_mesh->mBitangents[index]);
				}

				// texture coordinates
				for (unsigned int c = 0;  c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c) {
					if (in_mesh->HasTextureCoords( c)) {
						out_mesh->mTextureCoords[c][out_mesh->mNumVertices] = in_mesh->mTextureCoords[c][index];
					}
				}
				// vertex colors
				for (unsigned int c = 0;  c < AI_MAX_NUMBER_OF_COLOR_SETS;++c) {
					if (in_mesh->HasVertexColors( c)) {
						out_mesh->mColors[c][out_mesh->mNumVertices] = in_mesh->mColors[c][index];
					}
				}
				// check whether we have bone weights assigned to this vertex
				rFace.mIndices[v] = out_mesh->mNumVertices;
				if (avPerVertexWeights) {
					VertexWeightTable& table = avPerVertexWeights[ out_mesh->mNumVertices ];
					for (VertexWeightTable::const_iterator iter = table.begin(), end = table.end(); iter != end;++iter) {
						// allocate the bone weight array if necessary and store it in the mBones field (HACK!)
						BoneWeightList* weight_list = reinterpret_cast<BoneWeightList*>(out_mesh->mBones[(*iter).first]);
						if (!weight_list) {
							weight_list = new BoneWeightList();
							out_mesh->mBones[(*iter).first] = reinterpret_cast<aiBone*>(weight_list);
						}
						weight_list->push_back(aiVertexWeight(out_mesh->mNumVertices,(*iter).second));
					}
				}

				was_copied_to[index] = out_mesh->mNumVertices;
				out_mesh->mNumVertices++;
			}
			base++;
			if(out_mesh->mNumVertices == out_vertex_index) {
				// break here. The face is only added if it was complete
				break;
			}
		}

		// check which bones we'll need to create for this submesh
		if (in_mesh->HasBones()) {
			aiBone** ppCurrent = out_mesh->mBones;
			for (unsigned int k = 0; k < in_mesh->mNumBones;++k) {
				// check whether the bone exists
				BoneWeightList* const weight_list = reinterpret_cast<BoneWeightList*>(out_mesh->mBones[k]);

				if (weight_list) {
					const aiBone* const bone_in = in_mesh->mBones[k];
					aiBone* const bone_out = new aiBone();
					*ppCurrent++ = bone_out;
					bone_out->mName = aiString(bone_in->mName);
					bone_out->mOffsetMatrix =bone_in->mOffsetMatrix;
					bone_out->mNumWeights = (unsigned int)weight_list->size();
					bone_out->mWeights = new aiVertexWeight[bone_out->mNumWeights];

					// copy the vertex weights
					::memcpy(bone_out->mWeights, &(*weight_list)[0],bone_out->mNumWeights * sizeof(aiVertexWeight));

					delete weight_list;
					out_mesh->mNumBones++;
				}
			}
		}

		// copy the face list to the mesh
		out_mesh->mFaces = new aiFace[vFaces.size()];
		out_mesh->mNumFaces = (unsigned int)vFaces.size();

		for (unsigned int p = 0; p < out_mesh->mNumFaces;++p) {
			out_mesh->mFaces[p] = vFaces[p];
		}

		// add the newly created mesh to the list
		source_mesh_map.push_back(std::make_pair(out_mesh,a));

		if (base == in_mesh->mNumFaces) {
			break;
		}
	}

	// delete the per-vertex weight list again
	delete[] avPerVertexWeights;

	// now delete the old mesh data
	delete in_mesh;
}


text:
package com.yiibaiMVC;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class WebStaticPagesController {
	@RequestMapping(value = "/indexStatic", method = RequestMethod.GET)
	public String indexStatic() {
		return "indexStatic";
	}

	@RequestMapping(value = "/staticPage", method = RequestMethod.GET)
	public String redirectStatic() {
		return "redirect:/pages/final.html";
	}
}


text:
#include <aws/lambda/model/EFSMountFailureException.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace Lambda
{
namespace Model
{

EFSMountFailureException::EFSMountFailureException() :
    m_typeHasBeenSet(false),
    m_messageHasBeenSet(false)
{
}

EFSMountFailureException::EFSMountFailureException(JsonView jsonValue) :
    m_typeHasBeenSet(false),
    m_messageHasBeenSet(false)
{
  *this = jsonValue;
}

EFSMountFailureException& EFSMountFailureException::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("Type"))
  {
    m_type = jsonValue.GetString("Type");

    m_typeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Message"))
  {
    m_message = jsonValue.GetString("Message");

    m_messageHasBeenSet = true;
  }

  return *this;
}

JsonValue EFSMountFailureException::Jsonize() const
{
  JsonValue payload;

  if(m_typeHasBeenSet)
  {
   payload.WithString("Type", m_type);

  }

  if(m_messageHasBeenSet)
  {
   payload.WithString("Message", m_message);

  }

  return payload;
}

} // namespace Model
} // namespace Lambda
} // namespace Aws


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

 Copyright 2013 Anis Kadri

 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.

-->

<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="org.test.editconfigtest"
    version="3.0.0">

    <name>Test edit-config</name>

    <!-- android -->
    <platform name="android">
        <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='org.test.DroidGap']" mode="merge">
            <activity android:enabled="true" android:configChanges="keyboardHidden"  />
        </edit-config>
        <edit-config file="AndroidManifest.xml" target="/manifest/application/activity" mode="overwrite">
            <activity android:name="ChildApp" android:label="@string/app_name" android:enabled="true" />
        </edit-config>
    </platform>
</plugin>


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 com.google.gdata.util.parser;

/**
 * The Rule parser has a very simple reason for existence: in
 * order to construct recursive grammars, a parser needs to reference
 * itself. But the normal parser construction routines don't allow that to be
 * done. An alternative to this design would be to allow the modification of
 * the sub-parsers of Alternative, Sequence,
 * etc. after the objects have been constructed.
 *
 * The following matches a sequence of letters and digits that end in a
 * digit. This could be more easily accomplished, but it demonstrates how a
 * recursive parser can be constructed:
 *
 *   Rule r = new Rule();
 *   r.set(Parser.alternative(Chset.DIGIT, Parser.sequence(Chset.ALPHA, r)));
 *   r.parse("a0")   -> matches "a0"
 *   r.parse("a0b1") -> matches "a0b1"
 *   r.parse("a")    -> no match
 *
 * @param <T>
 * @see Parser
 *
 */
public class Rule<T> extends Parser<T> {
  private Parser<T> subject;

  /**
   * Class constructor for a null subject.
   */
  public Rule() {
    this(null);
  }

  /**
   * Class constructor.
   *
   * @param subject The Parser that this parser delegates parsing
   * responsibilities to.
   */
  public Rule(Parser<T> subject) {
    this.subject = subject;
  }

  /**
   * Delegates parsing responsibilties to subject if it is
   * non-null, and returns NO_MATCH otherwise.
   *
   * @see Parser#parse
   */
  @Override
  public int parse(char[] buf, int start, int end, T data) {
    if (subject != null) {
      return subject.parse(buf, start, end, data);
    } else {
      return NO_MATCH;
    }
  }

  /**
   * Sets the subject member.
   *
   * @param subject TheParser that this parser delegates
   * parsing responsibilities to.
   */
  public void set(Parser<T> subject) {
    this.subject = subject;
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:background="@color/color_fafafa"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="12dp"
    >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/comment"
        android:textColor="@color/color_070707"
        android:textSize="@dimen/fontSize_14sp" />
    <TextView
        android:id="@+id/tv_num"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="14dp"
        android:textColor="@color/color_FB9938"
        android:textSize="@dimen/fontSize_14sp"
        />
</LinearLayout>


text:
{% extends "responsive_base.html" %}

{% load url from future %}
{% load i18n %}

{% block head_title %}{% trans "Log out" %}{% endblock %}

{% block page_title %}{% trans "Log out" %}{% endblock %}

{% block body %}
    <form method="POST" action="{% url "account_logout" %}" class="form-horizontal">
        <fieldset>
            {% csrf_token %}

{% trans "Are you sure you want to log out?" %}

                <button type="submit" class="btn btn-success">{% trans "Log out" %}</button>

        </fieldset>
    </form>
{% endblock %}


text:
void
_universe_error_log(NSString* message)
{
	NSLog(@"[Universe/Error/Log] %@", message);
}

void
UNIVERSE_DEBUG_ASSERT(BOOL cond)
{
	[UniverseDoctor panicIf:!cond withMessage:@"Debugging asertion failure!"];
}
void
UNIVERSE_DEBUG_ASSERT_WITH_MESSAGE(BOOL cond, NSString* message)
{
	[UniverseDoctor panicIf:!cond withMessage:message];
}

//void
//UNIVERSE_DEBUG_ASSERT_FOR_EACH_ELEMENTS_IN_ARRAY(NSArray* elements, BOOL(^test)(id element))
//{
//	for (id e in elements)
//	{
//		if (test(e) == NO)
//		{
//			[UniverseDoctor panicWithMessage:@"Debug mode assertion failure."];
//		}
//	}
//}

//void
//UNIVERSE_DEBUG_RUN_FOR_EACH(id collection, void(^block)(id element))
//{
//	BOOL	is_fast_enum	=	[(id)collection conformsToProtocol:@protocol(NSFastEnumeration)];
//
//	if (is_fast_enum == NO)
//	{
//		[UniverseDoctor panicWithMessage:@"The supplied `collection` does not conform `NSFastEnumeration` protocol, and cannot be used with `UNIVERSE_DEBUG_RUN_FOR_EACH` macro."];
//	}
//
//	////
//
//	for (id e in collection)
//	{
//		block(e);
//	}
//}

void
UNIVERSE_UNREACHABLE_CODE()
{
	[UniverseDoctor panicWithMessage:@"Unreacable code! (asserted for debugging)"];
	__builtin_unreachable();
}

#endif

NSString* const	UNIVERSE_DOCUMENT_AUTOSAVE_WINDOW_OUTER_SPLIT			=	@"UNIVERSE_DOCUMENT_AUTOSAVE_WINDOW_OUTER_SPLIT";
NSString* const	UNIVERSE_DOCUMENT_AUTOSAVE_WINDOW_INNER_SPLIT			=	@"UNIVERSE_DOCUMENT_AUTOSAVE_WINDOW_INNER_SPLIT";