text:
describe(tableNames[0].name, function () {
    let table = tableNames[0];
    it("DB.getInst()[dbName][table.name].clear()", function (done) {
        DB.getInst()[dbName][table.name].clear()
            .then(result => {
                expect(result).toBeUndefined();
                done();
            }).catch((error) => { fail(error); done(); });
    });
    it("DB.getInst()[dbName][table.name].add(table.data)", function (done) {
        fetch('base/assets/data/' + table.name + '.json').then(response => response.json()).then(data => {
            table.data = data;
            DB.getInst()[dbName][table.name].add(data)
                .then(count => {
                    expect(count).toBeDefined();
                    expect(count).toBe(table.data.length);
                    done();
                }).catch((error) => { fail(error); done(); });
        }).catch((error) => { fail(error); done();});
    });
    it("DB.getInst()[dbName][table.name].get()", function (done) {
        DB.getInst()[dbName][table.name].get()
            .then(result => {
                expect(result).toBeDefined();
                expect(result.arr.length).toBe(table.data.length);
                console.log(result.arr[0]);
                expect(result.arr[0].categoryId).toEqual(table.data[0].categoryId);
                expect(result.arr[0].categoryName).toEqual(table.data[0].categoryName);
                expect(result.arr[0].description).toEqual(table.data[0].description);
                done();
            }).catch((error) => { fail(error); done(); });
    });
    it("DB.getInst()[dbName][table.name].get(table.data.categoryId)", function (done) {
        DB.getInst()[dbName][table.name].get(table.data[1].categoryId)
            .then(result => {
                expect(result).toBeDefined();
                expect(result.categoryId).toEqual(table.data[1].categoryId);
                expect(result.categoryName).toEqual(table.data[1].categoryName);
                expect(result.description[1]).toEqual(table.data[1].description[1]);
                done();
            }).catch((error) => { fail(error); done(); });
    });
});


text:
datacube.api.workflow.cell_chunk module
=======================================

.. automodule:: datacube.api.workflow.cell_chunk
    :members:
    :undoc-members:
    :show-inheritance:

redpajama_set_name: RedPajamaGithub


text:
namespace loss
{
    class User;
    class Kernel;

    class IProcess
    {
        public:
            IProcess(const std::string &name, const User *user, uint32_t id, Kernel *kernel);

            typedef boost::coroutines::asymmetric_coroutine<void>::pull_type ThreadType;
            typedef boost::coroutines::asymmetric_coroutine<void>::push_type YieldType;

            enum Status
            {
                NotRunning,
                Idle,
                Running,
                Blocked,
                Complete
            };

            void resume();
            void run();
            virtual int32_t shutdown();

            inline ProcessInfo &info()
            {
                return _info;
            }
            VirtualFileSystem &vfs();

            void write_std_out(const std::string &message);

            typedef std::chrono::steady_clock ClockType;
            std::chrono::time_point<ClockType> finish_time;

            inline Status status() const
            {
                return _status;
            }
            void status(Status status);

            void check_for_yield();

            void yield();

            virtual int32_t run_impl() = 0;

        private:

            ProcessInfo _info;
            std::unique_ptr<ThreadType> _thread;
            YieldType *_yield;
            Status _status;
    };
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;

namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph
{
    /// <summary>
    /// Represents an event vertex for serialization. See https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#events for further details.
    /// </summary>
    internal sealed class Event : Vertex
    {
        public string Kind { get; }
        public string Scope { get; }
        public Id<Element> Data { get; }

        private Event(EventKind kind, string scope, Id<Element> data, IdFactory idFactory)
            : base(label: "$event", idFactory)
        {
            this.Kind = kind switch { EventKind.Begin => "begin", EventKind.End => "end", _ => throw new ArgumentException(nameof(kind)) };
            this.Scope = scope;
            this.Data = data;
        }

        public Event(EventKind kind, Id<LsifProject> data, IdFactory idFactory)
            : this(kind, "project", data.As<LsifProject, Element>(), idFactory)
        {
        }

        public Event(EventKind kind, Id<LsifDocument> data, IdFactory idFactory)
            : this(kind, "document", data.As<LsifDocument, Element>(), idFactory)
        {
        }

        public enum EventKind
        {
            Begin,
            End
        }
    }
}


text:
package org.apache.commons.beanutils2.locale;

import java.beans.IndexedPropertyDescriptor;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;

import org.apache.commons.beanutils2.BeanUtilsBean;
import org.apache.commons.beanutils2.ContextClassLoaderLocal;
import org.apache.commons.beanutils2.ConvertUtils;
import org.apache.commons.beanutils2.ConvertUtilsBean;
import org.apache.commons.beanutils2.DynaBean;
import org.apache.commons.beanutils2.DynaClass;
import org.apache.commons.beanutils2.DynaProperty;
import org.apache.commons.beanutils2.MappedPropertyDescriptor;
import org.apache.commons.beanutils2.PropertyUtilsBean;
import org.apache.commons.beanutils2.expression.Resolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
Utility methods for populating JavaBeans properties
 * via reflection in a locale-dependent manner.

 *
 * @since 1.7
 */
public class LocaleBeanUtilsBean extends BeanUtilsBean {

    /**
     * Contains {@code LocaleBeanUtilsBean} instances indexed by context classloader.
     */
    private static final ContextClassLoaderLocal<LocaleBeanUtilsBean>
            LOCALE_BEANS_BY_CLASSLOADER = new ContextClassLoaderLocal<LocaleBeanUtilsBean>() {
                        // Creates the default instance used when the context classloader is unavailable
                        @Override
                        protected LocaleBeanUtilsBean initialValue() {
                            return new LocaleBeanUtilsBean();
                        }
                    };

     /**
      * Gets singleton instance
      *
      * @return the singleton instance
      */
     public static LocaleBeanUtilsBean getLocaleBeanUtilsInstance() {
        return LOCALE_BEANS_BY_CLASSLOADER.get();
     }

    /**
     * Sets the instance which provides the functionality for {@link LocaleBeanUtils}.
     * This is a pseudo-singleton - an single instance is provided per (thread) context classloader.
     * This mechanism provides isolation for web apps deployed in the same container.
     *
     * @param newInstance a new singleton instance
     */
    public static void setInstance(final LocaleBeanUtilsBean newInstance) {
        LOCALE_BEANS_BY_CLASSLOADER.set(newInstance);
    }

    /** All logging goes through this logger */
    private final Log log = LogFactory.getLog(LocaleBeanUtilsBean.class);

    /** Convertor used by this class */
    private final LocaleConvertUtilsBean localeConvertUtils;

    /** Construct instance with standard conversion bean */
    public LocaleBeanUtilsBean() {
        this.localeConvertUtils = new LocaleConvertUtilsBean();
    }

    /**
     * Construct instance that uses given locale conversion
     *
     * @param localeConvertUtils use this {@code localeConvertUtils} to perform
     * conversions
     * @param convertUtilsBean use this for standard conversions
     * @param propertyUtilsBean use this for property conversions
     */
    public LocaleBeanUtilsBean(
                            final LocaleConvertUtilsBean localeConvertUtils,
                            final ConvertUtilsBean convertUtilsBean,
                            final PropertyUtilsBean propertyUtilsBean) {
        super(convertUtilsBean, propertyUtilsBean);
        this.localeConvertUtils = localeConvertUtils;
    }

    /**
     * Construct instance that uses given locale conversion
     *
     * @param localeConvertUtils use this {@code localeConvertUtils} to perform
     * conversions
     */
    public LocaleBeanUtilsBean(final LocaleConvertUtilsBean localeConvertUtils) {
        this.localeConvertUtils = localeConvertUtils;
    }

    /**
     * Gets the bean instance used for conversions
     *
     * @return the locale converter bean instance
     */
    public LocaleConvertUtilsBean getLocaleConvertUtils() {
        return localeConvertUtils;
    }

    /**
     * Gets the default Locale
     * @return the default locale
     */
    public Locale getDefaultLocale() {
        return getLocaleConvertUtils().getDefaultLocale();
    }

    /**
     * Sets the default Locale.
     *
     * @param locale the default locale
     */
    public void setDefaultLocale(final Locale locale) {
        getLocaleConvertUtils().setDefaultLocale(locale);
    }

    /**
     * Is the pattern to be applied localized
     * (Indicate whether the pattern is localized or not)
     *
     * @return {@code true} if pattern is localized,
     * otherwise {@code false}
     */
    public boolean getApplyLocalized() {
        return getLocaleConvertUtils().getApplyLocalized();
    }

    /**
     * Sets whether the pattern is applied localized
     * (Indicate whether the pattern is localized or not)
     *
     * @param newApplyLocalized {@code true} if pattern is localized,
     * otherwise {@code false}
     */
    public void setApplyLocalized(final boolean newApplyLocalized) {
        getLocaleConvertUtils().setApplyLocalized(newApplyLocalized);
    }

    /**
     * Gets the value of the specified locale-sensitive indexed property
     * of the specified bean, as a String. The zero-relative index of the
     * required value must be included (in square brackets) as a suffix to
     * the property name, or {@code IllegalArgumentException} will be
     * thrown.
     *
     * @param bean Bean whose property is to be extracted
     * @param name {@code propertyname[index]} of the property value
     *  to be extracted
     * @param pattern The conversion pattern
     * @return The indexed property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getIndexedProperty(
                                    final Object bean,
                                    final String name,
                                    final String pattern)
                                        throws
                                            IllegalAccessException,
                                            InvocationTargetException,
                                            NoSuchMethodException {
        final Object value = getPropertyUtils().getIndexedProperty(bean, name);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the specified locale-sensitive indexed property
     * of the specified bean, as a String using the default conversion pattern of
     * the corresponding {@link LocaleConverter}. The zero-relative index
     * of the required value must be included (in square brackets) as a suffix
     * to the property name, or {@code IllegalArgumentException} will be thrown.
     *
     * @param bean Bean whose property is to be extracted
     * @param name {@code propertyname[index]} of the property value
     *  to be extracted
     * @return The indexed property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getIndexedProperty(
                                    final Object bean,
                                    final String name)
                                        throws
                                            IllegalAccessException,
                                            InvocationTargetException,
                                            NoSuchMethodException {
        return getIndexedProperty(bean, name, null);
    }

    /**
     * Gets the value of the specified locale-sensetive indexed property
     * of the specified bean, as a String using the specified conversion pattern.
     * The index is specified as a method parameter and
     * must *not* be included in the property name expression
     *
     * @param bean Bean whose property is to be extracted
     * @param name Simple property name of the property value to be extracted
     * @param index Index of the property value to be extracted
     * @param pattern The conversion pattern
     * @return The indexed property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getIndexedProperty(final Object bean,
                                            final String name, final int index, final String pattern)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
        final Object value = getPropertyUtils().getIndexedProperty(bean, name, index);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the specified locale-sensetive indexed property
     * of the specified bean, as a String using the default conversion pattern of
     * the corresponding {@link LocaleConverter}.
     * The index is specified as a method parameter and
     * must *not* be included in the property name expression
     *
     * @param bean Bean whose property is to be extracted
     * @param name Simple property name of the property value to be extracted
     * @param index Index of the property value to be extracted
     * @return The indexed property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getIndexedProperty(final Object bean,
                                            final String name, final int index)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
        return getIndexedProperty(bean, name, index, null);
    }

    /**
     * Gets the value of the specified simple locale-sensitive property
     * of the specified bean, converted to a String using the specified
     * conversion pattern.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Name of the property to be extracted
     * @param pattern The conversion pattern
     * @return The property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getSimpleProperty(final Object bean, final String name, final String pattern)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
        final Object value = getPropertyUtils().getSimpleProperty(bean, name);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the specified simple locale-sensitive property
     * of the specified bean, converted to a String using the default
     * conversion pattern of the corresponding {@link LocaleConverter}.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Name of the property to be extracted
     * @return The property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getSimpleProperty(final Object bean, final String name)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
        return getSimpleProperty(bean, name, null);
    }

    /**
     * Gets the value of the specified mapped locale-sensitive property
     * of the specified bean, as a String using the specified conversion pattern.
     * The key is specified as a method parameter and must *not* be included in
     * the property name expression.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Simple property name of the property value to be extracted
     * @param key Lookup key of the property value to be extracted
     * @param pattern The conversion pattern
     * @return The mapped property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getMappedProperty(
                                    final Object bean,
                                    final String name,
                                    final String key,
                                    final String pattern)
                                        throws
                                            IllegalAccessException,
                                            InvocationTargetException,
                                            NoSuchMethodException {
        final Object value = getPropertyUtils().getMappedProperty(bean, name, key);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the specified mapped locale-sensitive property
     * of the specified bean, as a String
     * The key is specified as a method parameter and must *not* be included
     * in the property name expression
     *
     * @param bean Bean whose property is to be extracted
     * @param name Simple property name of the property value to be extracted
     * @param key Lookup key of the property value to be extracted
     * @return The mapped property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getMappedProperty(final Object bean,
                                           final String name, final String key)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {
        return getMappedProperty(bean, name, key, null);
    }

    /**
     * Gets the value of the specified locale-sensitive mapped property
     * of the specified bean, as a String using the specified pattern.
     * The String-valued key of the required value
     * must be included (in parentheses) as a suffix to
     * the property name, or {@code IllegalArgumentException} will be
     * thrown.
     *
     * @param bean Bean whose property is to be extracted
     * @param name {@code propertyname(index)} of the property value
     *  to be extracted
     * @param pattern The conversion pattern
     * @return The mapped property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getMappedPropertyLocale(
                                        final Object bean,
                                        final String name,
                                        final String pattern)
                                            throws
                                                IllegalAccessException,
                                                InvocationTargetException,
                                                NoSuchMethodException {
        final Object value = getPropertyUtils().getMappedProperty(bean, name);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the specified locale-sensitive mapped property
     * of the specified bean, as a String using the default
     * conversion pattern of the corresponding {@link LocaleConverter}.
     * The String-valued key of the required value
     * must be included (in parentheses) as a suffix to
     * the property name, or {@code IllegalArgumentException} will be
     * thrown.
     *
     * @param bean Bean whose property is to be extracted
     * @param name {@code propertyname(index)} of the property value
     *  to be extracted
     * @return The mapped property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getMappedProperty(final Object bean, final String name)
                                    throws
                                        IllegalAccessException,
                                        InvocationTargetException,
                                        NoSuchMethodException {
        return getMappedPropertyLocale(bean, name, null);
    }

    /**
     * Gets the value of the (possibly nested) locale-sensitive property
     * of the specified name, for the specified bean,
     * as a String using the specified pattern.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Possibly nested name of the property to be extracted
     * @param pattern The conversion pattern
     * @return The nested property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws IllegalArgumentException if a nested reference to a
     *  property returns null
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getNestedProperty(
                                    final Object bean,
                                    final String name,
                                    final String pattern)
                                        throws
                                            IllegalAccessException,
                                            InvocationTargetException,
                                            NoSuchMethodException {
        final Object value = getPropertyUtils().getNestedProperty(bean, name);
        return getLocaleConvertUtils().convert(value, pattern);
    }

    /**
     * Gets the value of the (possibly nested) locale-sensitive property
     * of the specified name, for the specified bean, as a String using the default
     * conversion pattern of the corresponding {@link LocaleConverter}.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Possibly nested name of the property to be extracted
     * @return The nested property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws IllegalArgumentException if a nested reference to a
     *  property returns null
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getNestedProperty(final Object bean, final String name)
                                    throws
                                        IllegalAccessException,
                                        InvocationTargetException,
                                        NoSuchMethodException {
        return getNestedProperty(bean, name, null);
    }

    /**
     * Gets the value of the specified locale-sensitive property
     * of the specified bean, no matter which property reference
     * format is used, as a String using the specified conversion pattern.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Possibly indexed and/or nested name of the property
     *  to be extracted
     * @param pattern The conversion pattern
     * @return The nested property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    public String getProperty(final Object bean, final String name, final String pattern)
                                throws
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException {
        return getNestedProperty(bean, name, pattern);
    }

    /**
     * Gets the value of the specified locale-sensitive property
     * of the specified bean, no matter which property reference
     * format is used, as a String using the default
     * conversion pattern of the corresponding {@link LocaleConverter}.
     *
     * @param bean Bean whose property is to be extracted
     * @param name Possibly indexed and/or nested name of the property
     *  to be extracted
     * @return The property's value, converted to a String
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     * @throws NoSuchMethodException if an accessor method for this
     *  property cannot be found
     */
    @Override
    public String getProperty(final Object bean, final String name)
                                throws
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException {
        return getNestedProperty(bean, name);
    }

    /**
     * Sets the specified locale-sensitive property value, performing type
     * conversions as required to conform to the type of the destination property
     * using the default conversion pattern of the corresponding {@link LocaleConverter}.
     *
     * @param bean Bean on which setting is to be performed
     * @param name Property name (can be nested/indexed/mapped/combo)
     * @param value Value to be set
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     */
    @Override
    public void setProperty(final Object bean, final String name, final Object value)
                                throws
                                    IllegalAccessException,
                                    InvocationTargetException {
        setProperty(bean, name, value, null);
    }

    /**
     * Sets the specified locale-sensitive property value, performing type
     * conversions as required to conform to the type of the destination
     * property using the specified conversion pattern.
     *
     * @param bean Bean on which setting is to be performed
     * @param name Property name (can be nested/indexed/mapped/combo)
     * @param value Value to be set
     * @param pattern The conversion pattern
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     */
    public void setProperty(
                            final Object bean,
                            String name,
                            final Object value,
                            final String pattern)
                                throws
                                    IllegalAccessException,
                                    InvocationTargetException {
        // Trace logging (if enabled)
        if (log.isTraceEnabled()) {
            final StringBuilder sb = new StringBuilder("  setProperty(");
            sb.append(bean);
            sb.append(", ");
            sb.append(name);
            sb.append(", ");
            if (value == null) {
                sb.append("<NULL>");
            }
            else if (value instanceof String) {
                sb.append((String) value);
            }
            else if (value instanceof String[]) {
                final String[] values = (String[]) value;
                sb.append('[');
                for (int i = 0; i < values.length; i++) {
                    if (i > 0) {
                        sb.append(',');
                    }
                    sb.append(values[i]);
                }
                sb.append(']');
            }
            else {
                sb.append(value.toString());
            }
            sb.append(')');
            log.trace(sb.toString());
        }

        // Resolve any nested expression to get the actual target bean
        Object target = bean;
        final Resolver resolver = getPropertyUtils().getResolver();
        while (resolver.hasNested(name)) {
            try {
                target = getPropertyUtils().getProperty(target, resolver.next(name));
                name = resolver.remove(name);
            } catch (final NoSuchMethodException e) {
                return; // Skip this property setter
            }
        }
        if (log.isTraceEnabled()) {
            log.trace("    Target bean = " + target);
            log.trace("    Target name = " + name);
        }

        // Declare local variables we will require
        final String propName = resolver.getProperty(name); // Simple name of target property
        final int index  = resolver.getIndex(name);         // Indexed subscript value (if any)
        final String key = resolver.getKey(name);           // Mapped key value (if any)

        final Class<?> type = definePropertyType(target, name, propName);
        if (type != null) {
            final Object newValue = convert(type, index, value, pattern);
            invokeSetter(target, propName, key, index, newValue);
        }
    }

    /**
     * Calculate the property type.
     *
     * @param target The bean
     * @param name The property name
     * @param propName The Simple name of target property
     * @return The property's type
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     */
    protected Class<?> definePropertyType(final Object target, final String name, final String propName)
            throws IllegalAccessException, InvocationTargetException {
        Class<?> type = null;               // Java type of target property

        if (target instanceof DynaBean) {
            final DynaClass dynaClass = ((DynaBean) target).getDynaClass();
            final DynaProperty dynaProperty = dynaClass.getDynaProperty(propName);
            if (dynaProperty == null) {
                return null; // Skip this property setter
            }
            type = dynaProperty.getType();
        }
        else {
            PropertyDescriptor descriptor = null;
            try {
                descriptor =
                        getPropertyUtils().getPropertyDescriptor(target, name);
                if (descriptor == null) {
                    return null; // Skip this property setter
                }
            }
            catch (final NoSuchMethodException e) {
                return null; // Skip this property setter
            }
            if (descriptor instanceof MappedPropertyDescriptor) {
                type = ((MappedPropertyDescriptor) descriptor).
                        getMappedPropertyType();
            }
            else if (descriptor instanceof IndexedPropertyDescriptor) {
                type = ((IndexedPropertyDescriptor) descriptor).
                        getIndexedPropertyType();
            }
            else {
                type = descriptor.getPropertyType();
            }
        }
        return type;
    }

    /**
     * Convert the specified value to the required type using the
     * specified conversion pattern.
     *
     * @param type The Java type of target property
     * @param index The indexed subscript value (if any)
     * @param value The value to be converted
     * @param pattern The conversion pattern
     * @return The converted value
     */
    protected Object convert(final Class<?> type, final int index, final Object value, final String pattern) {
        if (log.isTraceEnabled()) {
            log.trace("Converting value '" + value + "' to type:" + type);
        }

        Object newValue = null;

        if (type.isArray() && index < 0) { // Scalar value into array
            if (value instanceof String) {
                final String[] values = new String[1];
                values[0] = (String) value;
                newValue = getLocaleConvertUtils().convert(values, type, pattern);
            }
            else if (value instanceof String[]) {
                newValue = getLocaleConvertUtils().convert((String[]) value, type, pattern);
            }
            else {
                newValue = value;
            }
        }
        else if (type.isArray()) {         // Indexed value into array
            if (value instanceof String) {
                newValue = getLocaleConvertUtils().convert((String) value,
                        type.getComponentType(), pattern);
            }
            else if (value instanceof String[]) {
                newValue = getLocaleConvertUtils().convert(((String[]) value)[0],
                        type.getComponentType(), pattern);
            }
            else {
                newValue = value;
            }
        } else if (value instanceof String) {
            newValue = getLocaleConvertUtils().convert((String) value, type, pattern);
        }
        else if (value instanceof String[]) {
            newValue = getLocaleConvertUtils().convert(((String[]) value)[0],
                    type, pattern);
        }
        else {
            newValue = value;
        }
        return newValue;
    }

    /**
     *  Convert the specified value to the required type.
     *
     * @param type The Java type of target property
     * @param index The indexed subscript value (if any)
     * @param value The value to be converted
     * @return The converted value
     */
    protected Object convert(final Class<?> type, final int index, final Object value) {
        Object newValue = null;

        if (type.isArray() && index < 0) { // Scalar value into array
            if (value instanceof String) {
                final String[] values = new String[1];
                values[0] = (String) value;
                newValue = ConvertUtils.convert(values, type);
            }
            else if (value instanceof String[]) {
                newValue = ConvertUtils.convert((String[]) value, type);
            }
            else {
                newValue = value;
            }
        }
        else if (type.isArray()) {         // Indexed value into array
            if (value instanceof String) {
                newValue = ConvertUtils.convert((String) value,
                        type.getComponentType());
            }
            else if (value instanceof String[]) {
                newValue = ConvertUtils.convert(((String[]) value)[0],
                        type.getComponentType());
            }
            else {
                newValue = value;
            }
        } else if (value instanceof String) {
            newValue = ConvertUtils.convert((String) value, type);
        }
        else if (value instanceof String[]) {
            newValue = ConvertUtils.convert(((String[]) value)[0],
                    type);
        }
        else {
            newValue = value;
        }
        return newValue;
    }

    /**
     * Invoke the setter method.
     *
     * @param target The bean
     * @param propName The Simple name of target property
     * @param key The Mapped key value (if any)
     * @param index The indexed subscript value (if any)
     * @param newValue The value to be set
     *
     * @throws IllegalAccessException if the caller does not have
     *  access to the property accessor method
     * @throws InvocationTargetException if the property accessor method
     *  throws an exception
     */
    protected void invokeSetter(final Object target, final String propName, final String key, final int index,
            final Object newValue)
            throws IllegalAccessException, InvocationTargetException {

        try {
            if (index >= 0) {
                getPropertyUtils().setIndexedProperty(target, propName,
                        index, newValue);
            }
            else if (key != null) {
                getPropertyUtils().setMappedProperty(target, propName,
                        key, newValue);
            }
            else {
                getPropertyUtils().setProperty(target, propName, newValue);
            }
        }
        catch (final NoSuchMethodException e) {
            throw new InvocationTargetException
                    (e, "Cannot set " + propName);
        }
    }
}


text:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

use ReviewQueueV1\ReviewQueueV1;

require_once __DIR__ . '/../vendor/autoload.php';

$reviewQueueApi = new ReviewQueueV1('lVwU8ioiS9Aw1qc0l7Ubv12aWNMVUPVdvTn');

try {

    $allReviews = [];

    $reviewsAPI = $reviewQueueApi->reviews();

    // Get first page of reviews
    $firstPageOfReviews = $reviewsAPI->getAll(200, 1);
    $allReviews[1] = $firstPageOfReviews;

    //
    //$currentPage = $reviewsAPI->client->headers['X-Pagination-Current-Page'];
    //$totalPages = $reviewsAPI->client->headers['X-Pagination-Page-Count'];
    //$totalCount = $reviewsAPI->client->headers['X-Pagination-Total-Count'];

    // Links
    $links = $reviewsAPI->links;

    echo "Rate Limit Limit: " . $reviewsAPI->client->headers['X-Rate-Limit-Limit'] . "
";
    echo "Rate Limit Remaining: " . $reviewsAPI->client->headers['X-Rate-Limit-Remaining'] . "
";
    echo "Rate Limit Reset: " . $reviewsAPI->client->headers['X-Rate-Limit-Reset'] . "
";

    // Page meta
    $currentPage = $reviewsAPI->meta->currentPage;
    $totalCount = $reviewsAPI->meta->totalCount;
    $itemsPerPage = $reviewsAPI->meta->perPage;
    $pageCount = $reviewsAPI->meta->pageCount;

    echo 'Current Page: ' . $currentPage . "
";
    echo 'Total Count: ' . $totalCount . "
";
    echo 'Items Per Page: ' . $itemsPerPage . "
";
    echo 'Page Count: ' . $pageCount . "
";

    // First page
    echo "
";
    print_r($allReviews[1]);
    echo "
";

    if ($totalCount > 1) {

        for ($nextPage = $currentPage + 1; $nextPage <= $pageCount; $nextPage++) {

            $allReviews[$nextPage] = $reviewsAPI->getAll($nextPage);
            echo "
";
            print_r($allReviews[$nextPage]);
            echo "
";

        }
    }
} catch (Exception $e) {
    echo($e->getMessage());
}

// Send a review request
//$reviewRequest = $reviewQueueApi->reviewRequest();
//$response = $reviewRequest->create('+18135002096');
//echo $reviewRequest->client->responseCode;
//echo $response->status;
//echo $response->phone_number;

//$response = $reviewRequest->getByID(256);
////echo $reviewRequest->client->responseCode;
//print_r($response);


text:
package com.py.autofillinstall;

import android.content.Context;
import android.content.SharedPreferences;

public class SharePreferencesUtils {
    /**
     * 保存在手机里面的文件名
     */
    private static final String FILE_NAME = "share_date";

    /**
     * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
     *
     * @param context
     * @param key
     * @param object
     */
    public static void setParam(Context context, String key, Object object) {

        String type = object.getClass().getSimpleName();
        SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();

        if ("String".equals(type)) {
            editor.putString(key, (String) object);
        } else if ("Integer".equals(type)) {
            editor.putInt(key, (Integer) object);
        } else if ("Boolean".equals(type)) {
            editor.putBoolean(key, (Boolean) object);
        } else if ("Float".equals(type)) {
            editor.putFloat(key, (Float) object);
        } else if ("Long".equals(type)) {
            editor.putLong(key, (Long) object);
        }

        editor.commit();
    }

    /**
     * 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
     *
     * @param context
     * @param key
     * @param defaultObject
     * @return
     */
    public static Object getParam(Context context, String key, Object defaultObject) {
        String type = defaultObject.getClass().getSimpleName();
        SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);

        if ("String".equals(type)) {
            return sp.getString(key, (String) defaultObject);
        } else if ("Integer".equals(type)) {
            return sp.getInt(key, (Integer) defaultObject);
        } else if ("Boolean".equals(type)) {
            return sp.getBoolean(key, (Boolean) defaultObject);
        } else if ("Float".equals(type)) {
            return sp.getFloat(key, (Float) defaultObject);
        } else if ("Long".equals(type)) {
            return sp.getLong(key, (Long) defaultObject);
        }

        return null;
    }
}


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

package org.modeshape.jcr.cache.document;

import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import org.infinispan.Cache;
import org.infinispan.distexec.DistributedCallable;
import org.infinispan.schematic.SchematicDb;
import org.infinispan.schematic.SchematicEntry;
import org.infinispan.schematic.document.Document;
import org.infinispan.schematic.document.EditableDocument;
import org.modeshape.common.SystemFailureException;
import org.modeshape.jcr.InfinispanUtil;
import org.modeshape.jcr.InfinispanUtil.Combiner;
import org.modeshape.jcr.InfinispanUtil.Location;
import org.modeshape.jcr.value.Name;
import org.modeshape.jcr.value.binary.ExternalBinaryValue;

/**
 * An implementation of {@link DocumentStore} which always uses the local cache to store/retrieve data and which provides some
 * additional methods for exposing local cache information.
 *
 * @author Horia Chiorean (hchiorea@redhat.com)
 */
public class LocalDocumentStore implements DocumentStore {

    private final SchematicDb database;
    private String localSourceKey;

    /**
     * Creates a new local store with the given database
     *
     * @param database a {@link SchematicDb} instance which must be non-null.
     */
    public LocalDocumentStore( SchematicDb database ) {
        this.database = database;
    }

    @Override
    public boolean containsKey( String key ) {
        return database.containsKey(key);
    }

    @Override
    public SchematicEntry get( String key ) {
        return database.get(key);
    }

    @Override
    public SchematicEntry storeDocument( String key,
                                         Document document ) {
        return putIfAbsent(key, document);
    }

    @Override
    public void updateDocument( String key,
                                Document document,
                                SessionNode sessionNode ) {
        // do nothing, the way the local store updates is via deltas
    }

    @Override
    public String newDocumentKey( String parentKey,
                                  Name documentName,
                                  Name documentPrimaryType ) {
        // the local store doesn't generate explicit keys for new nodes
        return null;
    }

    /**
     * Store the supplied document and metadata at the given key.
     *
     * @param key the key or identifier for the document
     * @param document the document that is to be stored
     * @return the existing entry for the supplied key, or null if there was no entry and the put was successful
     * @see SchematicDb#putIfAbsent(String, org.infinispan.schematic.document.Document,
     *      org.infinispan.schematic.document.Document)
     */
    public SchematicEntry putIfAbsent( String key,
                                       Document document ) {
        return database.putIfAbsent(key, document, null);
    }

    /**
     * Store the supplied document and metadata at the given key.
     *
     * @param key the key or identifier for the document
     * @param document the document that is to be stored
     * @see SchematicDb#put(String, org.infinispan.schematic.document.Document, org.infinispan.schematic.document.Document)
     */
    public void put( String key,
                     Document document ) {
        database.put(key, document, null);
    }

    /**
     * Store the supplied document in the local db
     *
     * @param entryDocument the document that contains the metadata document, content document, and key
     */
    public void put( Document entryDocument ) {
        database.put(entryDocument);
    }

    /**
     * Replace the existing document and metadata at the given key with the document that is supplied. This method does nothing if
     * there is not an existing entry at the given key.
     *
     * @param key the key or identifier for the document
     * @param document the new document that is to replace the existing document (or binary content) the replacement
     */
    public void replace( String key,
                         Document document ) {
        database.replace(key, document, null);
    }

    @Override
    public boolean remove( String key ) {
        return database.remove(key) != null;
    }

    @Override
    public boolean prepareDocumentsForUpdate( Collection<String> keys ) {
        return database.lock(keys);
    }

    @Override
    public boolean updatesRequirePreparing() {
        return database.isExplicitLockingEnabled();
    }

    @Override
    public LocalDocumentStore localStore() {
        return this;
    }

    @Override
    public TransactionManager transactionManager() {
        return localCache().getAdvancedCache().getTransactionManager();
    }

    @Override
    public XAResource xaResource() {
        return localCache().getAdvancedCache().getXAResource();
    }

    @Override
    public void setLocalSourceKey( String sourceKey ) {
        this.localSourceKey = sourceKey;
    }

    @Override
    public String getLocalSourceKey() {
        return this.localSourceKey;
    }

    @Override
    public String createExternalProjection( String projectedNodeKey,
                                            String sourceName,
                                            String externalPath,
                                            String alias ) {
        throw new UnsupportedOperationException("External projections are not supported in the local document store");
    }

    @Override
    public Document getChildrenBlock( String key ) {
        // Look up the information in the database ...
        SchematicEntry entry = get(key);
        if (entry == null) {
            // There is no such node ...
            return null;
        }
        return entry.getContentAsDocument();
    }

    @Override
    public Document getChildReference( String parentKey,
                                       String childKey ) {
        return null; // don't support this
    }

    /**
     * Returns the local Infinispan cache.
     *
     * @return a {@code non-null} {@link Cache} instance.
     */
    public Cache<String, SchematicEntry> localCache() {
        return database.getCache();
    }

    @Override
    public ExternalBinaryValue getExternalBinary( String sourceName,
                                                  String id ) {
        throw new UnsupportedOperationException("External binaries are only supported by the federated document store");
    }

    /**
     * Perform the supplied operation on each stored document that is accessible within this process. Each document will be
     * operated upon in a separate transaction, which will be committed if the operation is successful or rolledback if the
     * operation cannot be complete successfully.
     * <p>
     * Generally, this method executes the operation upon all documents. If there is an error processing a single document, that
     * document is skipped and the execution will continue with the next document(s). However, if there is an exception with the
     * transactions or another system failure, this method will terminate with an exception.
     *
     * @param operation the operation to be performed
     * @return the summary of the number of documents that were affected
     * @throws InterruptedException if the process is interrupted
     * @throws ExecutionException if there is an error while getting executing the operation
     */
    public DocumentOperationResults performOnEachDocument( DocumentOperation operation )
        throws InterruptedException, ExecutionException {
        DistributedOperation distOp = new DistributedOperation(operation);
        return InfinispanUtil.execute(database.getCache(), Location.LOCALLY, distOp, distOp);
    }

    /**
     * An operation upon a persisted document.
     */
    public static abstract class DocumentOperation implements Serializable {
        private static final long serialVersionUID = 1L;
        protected Cache<String, SchematicEntry> cache;

        /**
         * Invoked by execution environment after the operation has been migrated for execution to a specific Infinispan node.
         *
         * @param cache cache whose keys are used as input data for this DistributedCallable task
         */
        public void setEnvironment( Cache<String, SchematicEntry> cache ) {
            this.cache = cache;
        }

        /**
         * Execute the operation upon the given {@link EditableDocument}.
         *
         * @param key the document's key; never null
         * @param document the editable document; never null
         * @return true if the operation modified the document, or false otherwise
         */
        public abstract boolean execute( String key,
                                         EditableDocument document );
    }

    public static class DocumentOperationResults implements Serializable {
        private static final long serialVersionUID = 1L;

        private long modifiedCount;
        private long unmodifiedCount;
        private long skipCount;
        private long failureCount;

        /**
         * Return the number of documents that were successfully updated/modified by the operation.
         *
         * @return the number of modified documents
         */
        public long getModifiedCount() {
            return modifiedCount;
        }

        /**
         * Return the number of documents that were not updated/modified by the operation.
         *
         * @return the number of unmodified documents
         */
        public long getUnmodifiedCount() {
            return unmodifiedCount;
        }

        /**
         * Return the number of documents that caused some failure.
         *
         * @return the number of failed documents
         */
        public long getFailureCount() {
            return failureCount;
        }

        /**
         * Return the number of documents that were skipped by the operation because the document could not be obtained in an
         * timely fashion.
         *
         * @return the number of skipped documents
         */
        public long getSkipCount() {
            return skipCount;
        }

        protected void recordModified() {
            ++modifiedCount;
        }

        protected void recordUnmodified() {
            ++unmodifiedCount;
        }

        protected void recordFailure() {
            ++failureCount;
        }

        protected void recordSkipped() {
            ++skipCount;
        }

        protected DocumentOperationResults combine( DocumentOperationResults other ) {
            if (other != null) {
                this.modifiedCount += other.modifiedCount;
                this.unmodifiedCount += other.unmodifiedCount;
                this.skipCount += other.skipCount;
                this.failureCount += other.failureCount;
            }
            return this;
        }

        @Override
        public String toString() {
            return "" + modifiedCount + " documents changed, " + unmodifiedCount + " unchanged, " + skipCount + " skipped, and "
                   + failureCount + " resulted in errors or failures";
        }
    }

    protected static class DistributedOperation
        implements DistributedCallable<String, SchematicEntry, DocumentOperationResults>, Serializable,
        Combiner<DocumentOperationResults> {
        private static final long serialVersionUID = 1L;

        private transient Cache<String, SchematicEntry> cache;
        private transient Set<String> inputKeys;
        private transient TransactionManager txnMgr;
        private transient DocumentOperation operation;

        protected DistributedOperation( DocumentOperation operation ) {
            this.operation = operation;
        }

        @Override
        public void setEnvironment( Cache<String, SchematicEntry> cache,
                                    Set<String> inputKeys ) {
            assert this.cache != null;
            assert this.inputKeys != null;
            this.cache = cache;
            this.inputKeys = inputKeys;
            this.txnMgr = this.cache.getAdvancedCache().getTransactionManager();
            this.operation.setEnvironment(this.cache);
        }

        @Override
        public DocumentOperationResults call() throws Exception {
            DocumentOperationResults results = new DocumentOperationResults();
            for (String key : inputKeys) {
                // We operate upon each document within a transaction ...
                try {
                    txnMgr.begin();
                    SchematicEntry entry = cache.get(key);
                    EditableDocument doc = entry.editDocumentContent();
                    if (operation.execute(key, doc)) {
                        results.recordModified();
                    } else {
                        results.recordUnmodified();
                    }
                    txnMgr.commit();
                } catch (org.infinispan.util.concurrent.TimeoutException e) {
                    // Couldn't wait long enough for the lock, so skip this for now ...
                    results.recordSkipped();
                } catch (NotSupportedException err) {
                    // No nested transactions are supported ...
                    results.recordFailure();
                    throw new SystemFailureException(err);
                } catch (SecurityException err) {
                    // No privilege to commit ...
                    results.recordFailure();
                    throw new SystemFailureException(err);
                } catch (IllegalStateException err) {
                    // Not associated with a txn??
                    results.recordFailure();
                    throw new SystemFailureException(err);
                } catch (RollbackException err) {
                    // Couldn't be committed, but the txn is already rolled back ...
                    results.recordFailure();
                } catch (HeuristicMixedException err) {
                    // Rollback has occurred ...
                    results.recordFailure();
                } catch (HeuristicRollbackException err) {
                    // Rollback has occurred ...
                    results.recordFailure();
                } catch (SystemException err) {
                    // System failed unexpectedly ...
                    results.recordFailure();
                    throw new SystemFailureException(err);
                } catch (Throwable t) {
                    // any other exception/error we should rollback and just continue (skipping this key for now) ...
                    txnMgr.rollback();
                    results.recordFailure();
                    continue;
                }
            }
            return results;
        }

        @Override
        public DocumentOperationResults combine( DocumentOperationResults priorResult,
                                                 DocumentOperationResults newResult ) {
            return priorResult.combine(newResult);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:overScrollMode="always"
        android:isScrollContainer="true"
        android:scrollbarAlwaysDrawVerticalTrack="true"
        android:scrollbars="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
   		android:layout_height="match_parent"
   		android:orientation="vertical">

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="FC: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirFc"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="FR: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirFr"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="TAS: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirTas"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="TAD: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirTad"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="SpO2: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirSpo2"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="DTX: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirDtx"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="Tª: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirTa"
            	    android:layout_weight="9"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="10" >

            	<TextView
            	    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:text="GCS: "
                    android:layout_weight="1"
                    android:gravity="center_vertical"/>

            	<EditText
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:id="@+id/txtAnadirGcs"
            	    android:layout_weight="3"/>

            	<Button
            	    android:layout_width="fill_parent"
            	    android:layout_height="match_parent"
            	    android:text="Asignar Glasgow"
            	    android:id="@+id/btnAnadirGcs"
            	    android:layout_weight="5"/>
        </TableRow>
    </TableLayout>
</LinearLayout>
</ScrollView>


text:
<?xml version="1.0" encoding="utf-8"?>
<DexEntry>
  <General>
    <Name>Gothitelle</Name>
    <SpeciesName>Astral Body</SpeciesName>
    <GrowthGroup>MediumSlow</GrowthGroup>
    <EggGroup1>Human-Like</EggGroup1>
    <EggGroup2>Undiscovered</EggGroup2>
  </General>
</DexEntry>


text:
@interface PodsDummy_Pods_BFPaperCheckboxTests : NSObject
@end
@implementation PodsDummy_Pods_BFPaperCheckboxTests
@end


text:
<!DOCTYPE html>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>Troubleshooting : revIgniter User Guide</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="robots" content="all" />
		<meta name="author" content="Ralf Bitter" />
		<meta name='description' content='revIgniter User Guide' />

		<link rel="stylesheet" media="screen" href="../css/bootstrap.min.css">

		<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../images/apple-touch-icon-144-precomposed.png">
		<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../images/apple-touch-icon-114-precomposed.png">
		<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../images/apple-touch-icon-72-precomposed.png">
		<link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon-57-precomposed.png">

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

          </button>
    			revIgniter User Guide Version 1.9.4

          <form class="navbar-form navbar-right" role="search" method="get" action="http://www.google.com/search">

 				<input type="hidden" name="as_sitesearch" id="as_sitesearch" value="revigniter.com/userGuide/" />
 		        Search User Guide   <input type="search" placeholder="Search ..." name="q" id="q" class="revignitorsearch" accesskey="s" autosave="bsn_srch" results="5" />
 				 <input type="image" id="submitSearch" src="../images/searchGo.png" alt="Search Go Button" />

 		 	 		</form>

revIgniter Home

User Guide Home

Troubleshooting

Table of Contents Page

Table of Contents

Close

Troubleshooting

Handler Names

Make sure to put all your handler names in your controller as a comma separated list into the global
variable <samp>gControllerHandlers</samp>, otherwise you get a "Page Not Found" error.

See the comments in the sample files in the <dfn>application/controllers</dfn> folder.

Error Logging

If you enable error logging in <dfn>application/config/config.lc</dfn> make sure that the <dfn>system/logs</dfn> folder is writable.

Search-Engine Friendly URLs

If you find that no matter what you put in your URL only your default page is loading, it might be that your server
does not support the PATH_INFO variable needed to serve search-engine friendly URLs. This does not apply to the
On-Rev hosting service.

As a first step, open your <dfn>application/config/config.lc</dfn> file and look for the URI Protocol
information. It will recommend that you try a couple alternate settings.  If it still doesn't work you may try to use
query string based URLs by setting <samp>gConfig["enableQueryStrings"]</samp> in the <dfn>config.lc</dfn> file to TRUE.

Setting Headers and Cookies

If you have problems setting headers or cookies watch out for whitespace. Make sure that there is no whitespace before the <?rev tag of your script files and that no whitespace follows the terminating "?>" tag. Generally it is better to leave terminating "?>" tags off, this way whitespace at the end of the script does not accidentally output content to the browser. Furthermore make sure that your files are not saved using UTF-8 (BOM). Using BOM prevents changing any header because characters are sent prior to sending headers, this means headers you set or cookies can not be sent.

gData Variables

If you use LiveCode server prior to version 6.1.3 dont't forget to add a space between the right array bracket and the merge brackets of your gData variables in your view files.

Code in View Files

Keep in mind, that using return statements enclosed in "<?" and "?>" is the only way to include LiveCode in your view files like in the following example:

<? put "<ul>" into tToDo
repeat for each item thisItem in gData["toDoList"]
  put "<li>" & thisItem & "</li>" after tToDo
end repeat
put "</ul>" after tToDo
return tToDo ?>

Lion and Mountain Lion

There is a bug (9869) in LiveCode Server confirmed by RunRev. LiveCode Server versions 4.6.3 up to 5.0.2 have two incorrect path environment variables on Lion and Mountain Lion. These variables are:

$_SERVER["PATH_TRANSLATED"]

$_SERVER["PATH_INFO"]

As revIgniter is heavily dependent on path variables this means that there is no way to run revIgniter using the said OS / server versions.
Note: This issue is fixed in LiveCode Server release: 6.0.0-rc-1.

Email Library

As of server version 7.0.6-rc-1 the SMTP protocol is not available on Linux because the commands open socket with message and write to socket are still not working in the Linux server engine. On Mac OS X SMTP should work as expected since server version 7.0.1.
Update: Sockets work in Linux server engine since version 7.1.0 RC 1 too. This means you can use the SMTP protocol on Linux.

Trackback Library

As of server version 7.0.6-rc-1 the Trackback library does not work on Linux because the write to socket command is still not working in the Linux server engine. On Mac OS X Trackback should work as expected since server version 7.0.1.
Update: Sockets work in Linux server engine since version 7.1.0 RC 1 too. This means you can use the Trackback library on Linux.

Previous Topic:  Upgrading from a Previous Version
 ::
Top of Page ::
User Guide Home ::
Next Topic:  revIgniter at a Glance

revIgniter :: Copyright © 2009 - 2016 :: dimensionB Bitter u. Bitter GmbH


text:
using namespace PBD;

GenericConstraintsModel::GenericConstraintsModel() :
	SimulationModel()
{
}

GenericConstraintsModel::~GenericConstraintsModel(void)
{
}

bool GenericConstraintsModel::addGenericDistanceConstraint(const unsigned int particle1, const unsigned int particle2, const Real stiffness)
{
	GenericDistanceConstraint *c = new GenericDistanceConstraint();
	const bool res = c->initConstraint(*this, particle1, particle2, stiffness);
	if (res)
		m_constraints.push_back(c);
	return res;
}

bool GenericConstraintsModel::addGenericIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2,
				const unsigned int particle3, const unsigned int particle4, const Real stiffness)
{
	GenericIsometricBendingConstraint *c = new GenericIsometricBendingConstraint();
	const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness);
	if (res)
		m_constraints.push_back(c);
	return res;
}

bool GenericConstraintsModel::addGenericHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis)
{
	GenericHingeJoint *c = new GenericHingeJoint();
	const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos, axis);
	if (res)
		m_constraints.push_back(c);
	return res;
}

bool GenericConstraintsModel::addGenericSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis)
{
	GenericSliderJoint *c = new GenericSliderJoint();
	const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos, axis);
	if (res)
		m_constraints.push_back(c);
	return res;
}

bool GenericConstraintsModel::addGenericBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos)
{
	GenericBallJoint *c = new GenericBallJoint();
	const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos);
	if (res)
		m_constraints.push_back(c);
	return res;
}


text:
package org.apache.hadoop.hdfs;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.server.namenode.ZookeeperTxId;
import org.apache.hadoop.hdfs.util.InjectionEvent;
import org.apache.hadoop.util.InjectionHandler;
import org.apache.hadoop.util.SerializableUtils;
import org.apache.hadoop.fs.FileAlreadyExistsException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooDefs.Perms;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Id;
import org.apache.zookeeper.data.Stat;

public class AvatarZooKeeperClient {

  private static Log LOG = LogFactory.getLog(AvatarZooKeeperClient.class.getName());

  private String connection;
  private int timeout;
  private int connectTimeout;
  private boolean watch;
  // Prefix under which the data for this client will be stored
  private String prefix;
  // The directory under which the session id for the current avatar is stored.
  private static final String ssid = "ssid";
  // The directory under which the last transaction id for the primary avatar is
  // stored.
  private static final String txid = "txid";
  private Watcher watcher;
  private ZooKeeper zk;
  private final int failoverCheckPeriod;
  private final boolean closeConnOnEachOp;

  // Making it large enough to be sure that the cluster is down
  // these retries go one after another so they do not take long
  public static final int ZK_CONNECTION_RETRIES = 10;
  private static final int ZK_INIT_RETRIES = 5;
  public static final int ZK_CONNECT_TIMEOUT_DEFAULT = 10000; // 10 seconds

  public AvatarZooKeeperClient(Configuration conf, Watcher watcher) {
    this(conf, watcher, true);
  }

  public AvatarZooKeeperClient(Configuration conf, Watcher watcher,
      boolean closeConnOnEachOp) {
    this.connection = conf.get("fs.ha.zookeeper.quorum");
    this.timeout = conf.getInt("fs.ha.zookeeper.timeout", 3000);
    this.connectTimeout = conf.getInt("fs.ha.zookeeper.connect.timeout",
        ZK_CONNECT_TIMEOUT_DEFAULT);
    this.watch = conf.getBoolean("fs.ha.zookeeper.watch", false);
    this.prefix = conf.get("fs.ha.zookeeper.prefix", "/hdfs");
    this.watcher = new ProxyWatcher(watcher);
    if (watcher == null) {
      // If there was no watcher regardless of the watch policy in the conf
      // set it to false. Since there is no watcher being set
      watch = false;
    }
    this.failoverCheckPeriod = conf.getInt("fs.avatar.failover.checkperiod",
        FailoverClientHandler.FAILOVER_CHECK_PERIOD);
    this.closeConnOnEachOp = closeConnOnEachOp;
  }

  private static class ProxyWatcher implements Watcher {
    private Watcher impl;
    ProxyWatcher(Watcher impl) {
      this.impl = impl;
    }

    public void process(WatchedEvent event) {
      if (event.getType() == Event.EventType.None
              && event.getState() == Event.KeeperState.SyncConnected) {
        // The ZooKeeper client is connected
        synchronized (this) {
          this.notifyAll();
        }
      }
    }
  }

  public synchronized void clearPrimary(String address) throws IOException {
    String node = getRegistrationNode(address);
    zkCreateRecursively(node, null, true, null);
  }

  /**
   * Creates a node in zookeeper denoting the current session id of the primary
   * avatarnode of the cluster. The primary avatarnode always syncs this
   * information to zookeeper when it starts.
   *
   * @param address
   *          the address of the cluster, used to create the path name for the
   *          znode
   * @param ssid
   *          the session id of the primary avatarnode
   * @throws IOException
   */
  public synchronized void registerPrimarySsId(String address, Long ssid)
      throws IOException {
    String node = getSsIdNode(address);
    zkCreateRecursively(node, SerializableUtils.toBytes(ssid), true,
        ssid.toString());
  }

  /**
   * Creates a node in zookeeper denoting the current session id and the last
   * transaction id processed by the primary avatarnode. This is used by the
   * primary avatarnode when it shuts down cleanly.
   *
   * @param address
   *          the address of the cluster, used to create the path name for the
   *          znode
   * @param lastTxid
   *          the last transaction id in the primary avatarnode
   * @throws IOException
   */
  public synchronized void registerLastTxId(String address,
      ZookeeperTxId lastTxid)
      throws IOException {
    String node = getLastTxIdNode(address);
    zkCreateRecursively(node, lastTxid.toBytes(), true, lastTxid.toString());
  }

  public synchronized void registerPrimary(String address, String realAddress,
      boolean overwrite)
    throws UnsupportedEncodingException, IOException {
    String node = getRegistrationNode(address);
    zkCreateRecursively(node, realAddress.getBytes("UTF-8"), overwrite,
        realAddress);
  }

  private void zkCreateRecursively(String zNode, byte[] data,
      boolean overwrite, String strData) throws IOException {
    try {
    initZK();
    } catch (InterruptedException ie) {
      throw new IOException(ie);
    }
    System.out.println("updating (" + zNode + ")-> (" + strData + ")");
    String[] parts = zNode.split("/");
    String path = "";
    byte[] payLoad = new byte[0];
    List<ACL> acls = new ArrayList<ACL>(1);
    acls.add(new ACL(Perms.ALL, new Id("world", "anyone")));

    try {
      for (int i = 0; i < parts.length; i++) {
        if (parts[i].isEmpty())
          continue;
        path += "/" + parts[i];
        if (i == parts.length - 1) {
          payLoad = data;
        }
        boolean created = false;
        while (!created) {
          // While loop to keep trying through the ConnectionLoss exceptions
          try {
            if ((zk.exists(path, false)) != null) {
              // -1 indicates that we should update zNode regardless of its
              // version
              // since we are not utilizing versions in zNode - this is the best
              if (i == parts.length - 1 && !overwrite) {
                throw new FileAlreadyExistsException("ZNode " + path + " already exists.");
              }
              zk.setData(path, payLoad, -1);
            } else {
              zk.create(path, payLoad, acls, CreateMode.PERSISTENT);
            }
            created = true;
          } catch (KeeperException ex) {
            ex.printStackTrace();
            if (KeeperException.Code.CONNECTIONLOSS != ex.code()) {
              throw ex;
            }
          }
        }
      }
      FileSystem.LOG.info("Wrote zNode " + zNode);
    } catch (KeeperException e) {
      e.printStackTrace();
    } catch (InterruptedException e) {
      e.printStackTrace();
      Thread.currentThread().interrupt();
    } finally {
      try {
        if (closeConnOnEachOp) {
          stopZK();
        }
      } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
      }
    }
  }

  /**
   * Tries to connect to ZooKeeper. To be used when we need to test if the
   * ZooKeeper cluster is available and the config is correct
   *
   * @throws IOException
   * @throws InterruptedException
   */
  public synchronized void primeConnection() throws IOException,
      InterruptedException {
    initZK();
    if (!watch) {
      stopZK();
    }
  }

  private void initZK() throws IOException, InterruptedException {
    synchronized (watcher) {
      for (int i = 0; i < ZK_INIT_RETRIES; i++) {
        try {
          if (zk == null || zk.getState() == ZooKeeper.States.CLOSED) {
            zk = new ZooKeeper(connection, timeout, watcher);
          }
          break;
        } catch (IOException ie) {
          if (i == ZK_INIT_RETRIES - 1) {
            throw ie;
          }
          FileSystem.LOG.info("Connection to zookeeper could not be"
              + "established retrying....", ie);
          Thread.sleep(3000);
        }
      }
      if (zk.getState() != ZooKeeper.States.CONNECTED) {
        watcher.wait(this.connectTimeout);
      }
      if (zk.getState() != ZooKeeper.States.CONNECTED) {
        // Close any open connections to avoid fd leak.
        zk.close();
        throw new IOException("Timed out trying to connect to ZooKeeper");
      }
    }
  }

  private void stopZK() throws InterruptedException {
    if (zk == null)
      return;
    zk.close();
    zk = null;
  }

  /**
   * Get the information stored in the node of zookeeper. If retry is set
   * to true it will keep retrying until the data in that node is available
   * (failover case). If the retry is set to false it will return the first
   * value that it gets from the zookeeper.
   *
   * @param node the path of zNode in zookeeper
   * @param stat {@link Stat} object that will contain stats of the node
   * @param retry if true will retry until the data in znode is not null
   * @return byte[] the data in the znode
   * @throws IOException
   * @throws KeeperException
   * @throws InterruptedException
   */
  private synchronized byte[] getNodeData(String node, Stat stat,
      boolean retry, boolean sync)
      throws IOException, KeeperException, InterruptedException {
    int failures = 0;

    byte[] data = null;
    while (data == null) {
      initZK();
      try {
        if (sync) {
          SyncUtil su = new SyncUtil();
          su.sync(zk, node);
        }
        data = zk.getData(node, watch, stat);
        if (data == null && retry) {
          // Failover is in progress
          // reset the failures
          failures = 0;
          DistributedAvatarFileSystem.LOG.info("Failover is in progress. Waiting");
          try {
            Thread.sleep(failoverCheckPeriod);
          } catch (InterruptedException iex) {
            Thread.currentThread().interrupt();
          }
        } else {
          return data;
        }
      } catch (KeeperException kex) {
        if (KeeperException.Code.CONNECTIONLOSS == kex.code()
            && failures < ZK_CONNECTION_RETRIES) {
          failures++;
          // This means there was a failure connecting to zookeeper
          // we should retry since some nodes might be down.
          continue;
        }
        throw kex;
      } finally {
        if (closeConnOnEachOp) {
          stopZK();
        }
      }
    }
    return data;
  }

  /**
   * Retrieves the current session id for the cluster from zookeeper.
   *
   * @param address
   *          the address of the cluster
   * @param sync
   *          whether or not to perform a sync before read
   * @throws IOException
   * @throws KeeperException
   * @throws InterruptedException
   */
  public Long getPrimarySsId(String address, boolean sync) throws IOException,
      KeeperException, InterruptedException, ClassNotFoundException {
    Stat stat = new Stat();
    String node = getSsIdNode(address);
    byte[] data = getNodeData(node, stat, false, sync);
    if (data == null) {
      return null;
    }
    return (Long) SerializableUtils.getFromBytes(data, Long.class);
  }

  /**
   * Retrieves the last transaction id of the primary from zookeeper.
   *
   * @param address
   *          the address of the cluster
   * @param sync
   *          whether or not to perform a sync before read
   * @throws IOException
   * @throws KeeperException
   * @throws InterruptedException
   */
  public ZookeeperTxId getPrimaryLastTxId(String address, boolean sync)
      throws IOException,
      KeeperException, InterruptedException, ClassNotFoundException {
    Stat stat = new Stat();
    String node = getLastTxIdNode(address);
    byte[] data = getNodeData(node, stat, false, sync);
    if (data == null) {
      return null;
    }
    return ZookeeperTxId.getFromBytes(data);
  }

  /**
   * Retrieves the primary address for the cluster, this does not perform a
   * sync before it reads the znode.
   */
  public String getPrimaryAvatarAddress(String address, Stat stat, boolean retry)
      throws IOException, KeeperException, InterruptedException {
    return getPrimaryAvatarAddress(address, stat, retry, false);
  }

  public String getPrimaryAvatarAddress(String address, Stat stat,
      boolean retry, boolean sync)
    throws IOException, KeeperException, InterruptedException {
    String node = getRegistrationNode(address);
    byte[] data = getNodeData(node, stat, retry, sync);
    if (data == null) {
      return null;
    }
    return new String(data, "UTF-8");
  }

  /**
   * Gets the {@link Stat} of the node. Will create and destroy connection if
   * the AvatarZooKeeperClient is not configured to set watchers
   *
   * @param node
   *          the path of zNode to get {@link Stat} for
   * @return {@link Stat} of the node
   * @throws IOException
   * @throws KeeperException
   * @throws InterruptedException
   */
  private synchronized Stat getNodeStats(String node) throws IOException,
      KeeperException, InterruptedException {
    int failures = 0;
    boolean gotStats = false;
    Stat res = null;
    while (!gotStats) {
      initZK();
      try {
        res = zk.exists(node, watch);
        // Since stats can be null we have to control the execution with a flag
        gotStats = true;
      } catch (KeeperException kex) {
        if (KeeperException.Code.CONNECTIONLOSS == kex.code()
            && failures < ZK_CONNECTION_RETRIES) {
          failures++;
          continue;
        }
        throw kex;
      } finally {
      }
    }
    return res;
  }

  public long getPrimaryRegistrationTime(URI address) throws IOException,
      KeeperException, InterruptedException {
    InjectionHandler
        .processEvent(InjectionEvent.AVATARZK_GET_REGISTRATION_TIME);
    String node = getRegistrationNode(address.getAuthority());
    return getNodeStats(node).getMtime();
  }
  /*
   * ZNode address is formed by the logical name of the filesystem:
   * dfs.data.xxx.com:9000 will be represented by zNode
   * /prefix/dfs.data.xxx.com/9000 in ZooKeeper
   */
  private String getRegistrationNode(String clusterAddress) {
    return prefix + "/" + clusterAddress.replaceAll("[:]", "/").toLowerCase();
  }

  /**
   * Computes the znode for the session id of the primary avatar, the format is
   * /prefix/ssid/dfs.data.xxx.com/9000
   *
   * @param clusterAddress
   *          the address of the cluster
   * @return the znode to store the ssid in the following format :
   *         /prefix/ssid/dfs.data.xxx.com/9000
   */
  private String getSsIdNode(String clusterAddress) {
    return prefix + "/" + ssid + "/"
        + clusterAddress.replaceAll("[:]", "/").toLowerCase();
  }

  /**
   * Computes the znode for the session id of the primary avatar, the format is
   * /prefix/txid/dfs.data.xxx.com/9000
   *
   * @param clusterAddress
   *          the address of the cluster
   * @return the znode to store the ssid in the following format :
   *         /prefix/txid/dfs.data.xxx.com/9000
   */
  private String getLastTxIdNode(String clusterAddress) {
    return prefix + "/" + txid + "/"
        + clusterAddress.replaceAll("[:]", "/").toLowerCase();
  }

  public synchronized void shutdown() throws InterruptedException {
    stopZK();
  }

  /**
   * Helper class for syncing data to ZK.
   */
  static class SyncUtil implements AsyncCallback.VoidCallback {
    private static final int MAX_SYNC_WAIT_TIME = 5 * 1000; // 5 sec
    volatile int rc = -1;

    @Override
    public synchronized void processResult(int rc, String path, Object ctx) {
      this.rc = rc;
      this.notify();
    }

    synchronized boolean sync(ZooKeeper zk, String path)
        throws InterruptedException {
      zk.sync(path, this, null);
      this.wait(MAX_SYNC_WAIT_TIME);
      if (rc != KeeperException.Code.OK.intValue()) {
        LOG.info("Cannot sync ZK for path: " + path + " return code: " + rc);
        return false;
      }
      LOG.info("Synced ZK for path: " + path);
      return true;
    }
  }
}


text:
extern "C" __global__
    __launch_bounds__(CK_PARAM_TUNABLE_BLOCK_SIZE, 2) void gridwise_convolution_implicit_gemm_v4r4_ncdhw_kczyx_nkdhw(
        const FLOAT* const __restrict__ p_in_global,
        const FLOAT* const __restrict__ p_wei_global,
        FLOAT* const __restrict__ p_out_global)
{
    using namespace ck;

    // read problem parameters
    constexpr index_t N  = CK_PARAM_PROBLEM_N;
    constexpr index_t K  = CK_PARAM_PROBLEM_K;
    constexpr index_t C  = CK_PARAM_PROBLEM_C;
    constexpr index_t Di = CK_PARAM_PROBLEM_DI;
    constexpr index_t Hi = CK_PARAM_PROBLEM_HI;
    constexpr index_t Wi = CK_PARAM_PROBLEM_WI;
    constexpr index_t Do = CK_PARAM_PROBLEM_DO;
    constexpr index_t Ho = CK_PARAM_PROBLEM_HO;
    constexpr index_t Wo = CK_PARAM_PROBLEM_WO;
    constexpr index_t Z  = CK_PARAM_PROBLEM_Z;
    constexpr index_t Y  = CK_PARAM_PROBLEM_Y;
    constexpr index_t X  = CK_PARAM_PROBLEM_X;

    constexpr index_t ConvStrideD = CK_PARAM_PROBLEM_CONV_STRIDE_D;
    constexpr index_t ConvStrideH = CK_PARAM_PROBLEM_CONV_STRIDE_H;
    constexpr index_t ConvStrideW = CK_PARAM_PROBLEM_CONV_STRIDE_W;

    constexpr index_t ConvDilationD = CK_PARAM_PROBLEM_CONV_DILATION_D;
    constexpr index_t ConvDilationH = CK_PARAM_PROBLEM_CONV_DILATION_H;
    constexpr index_t ConvDilationW = CK_PARAM_PROBLEM_CONV_DILATION_W;

    constexpr index_t InLeftPadD = CK_PARAM_PROBLEM_IN_LEFT_PAD_D;
    constexpr index_t InLeftPadH = CK_PARAM_PROBLEM_IN_LEFT_PAD_H;
    constexpr index_t InLeftPadW = CK_PARAM_PROBLEM_IN_LEFT_PAD_W;

    constexpr index_t InRightPadD = CK_PARAM_PROBLEM_IN_RIGHT_PAD_D;
    constexpr index_t InRightPadH = CK_PARAM_PROBLEM_IN_RIGHT_PAD_H;
    constexpr index_t InRightPadW = CK_PARAM_PROBLEM_IN_RIGHT_PAD_W;

    constexpr index_t BlockSize = CK_PARAM_TUNABLE_BLOCK_SIZE;
    constexpr index_t GridSize  = CK_PARAM_DEPENDENT_GRID_SIZE;

    constexpr index_t GemmMPerBlock = CK_PARAM_TUNABLE_GEMM_M_PER_BLOCK;
    constexpr index_t GemmNPerBlock = CK_PARAM_TUNABLE_GEMM_N_PER_BLOCK;
    constexpr index_t GemmKPerBlock = CK_PARAM_TUNABLE_GEMM_K_PER_BLOCK;

    constexpr auto in_ncdhw_desc =
        make_native_tensor_descriptor_packed(Sequence<N, C, Di, Hi, Wi>{});
    constexpr auto wei_kczyx_desc = make_native_tensor_descriptor_packed(Sequence<K, C, Z, Y, X>{});
    constexpr auto out_nkdhw_desc =
        make_native_tensor_descriptor_packed(Sequence<N, K, Do, Ho, Wo>{});

    using ConvStrides   = Sequence<ConvStrideD, ConvStrideH, ConvStrideW>;
    using ConvDilations = Sequence<ConvDilationD, ConvDilationH, ConvDilationW>;

    using InLeftPads  = Sequence<InLeftPadD, InLeftPadH, InLeftPadW>;
    using InRightPads = Sequence<InRightPadD, InRightPadH, InRightPadW>;

    // read and calculate tuning parameter
    constexpr index_t GemmMPerThread     = CK_PARAM_TUNABLE_GEMM_M_PER_THREAD;
    constexpr index_t GemmNPerThread     = CK_PARAM_TUNABLE_GEMM_N_PER_THREAD;
    constexpr index_t GemmMLevel0Cluster = CK_PARAM_TUNABLE_GEMM_M_LEVEL0_CLUSTER;
    constexpr index_t GemmNLevel0Cluster = CK_PARAM_TUNABLE_GEMM_N_LEVEL0_CLUSTER;
    constexpr index_t GemmMLevel1Cluster = CK_PARAM_TUNABLE_GEMM_M_LEVEL1_CLUSTER;
    constexpr index_t GemmNLevel1Cluster = CK_PARAM_TUNABLE_GEMM_N_LEVEL1_CLUSTER;
    constexpr index_t GemmKPerThread     = 1;

    constexpr index_t ThreadGemmDataPerRead_GemmM = GemmMPerThread;
    constexpr index_t ThreadGemmDataPerRead_GemmN = GemmNPerThread;

    // A matrix
    constexpr index_t GemmABlockCopyClusterLengths_GemmK =
        CK_PARAM_TUNABLE_GEMM_A_BLOCK_COPY_CLUSTER_LENGTHS_GEMM_K;

    constexpr index_t GemmABlockCopyClusterLengths_GemmM =
        CK_PARAM_TUNABLE_GEMM_A_BLOCK_COPY_CLUSTER_LENGTHS_GEMM_M;

    constexpr index_t GemmABlockCopyThreadSliceLengths_GemmK =
        GemmKPerBlock / GemmABlockCopyClusterLengths_GemmK;

    constexpr index_t GemmABlockCopyThreadSliceLengths_GemmM =
        GemmMPerBlock / GemmABlockCopyClusterLengths_GemmM;

    using GemmABlockCopyThreadSliceLengths_GemmK_GemmM =
        Sequence<GemmABlockCopyThreadSliceLengths_GemmK, GemmABlockCopyThreadSliceLengths_GemmM>;

    using GemmABlockCopyThreadClusterLengths_GemmK_GemmM =
        Sequence<GemmABlockCopyClusterLengths_GemmK, GemmABlockCopyClusterLengths_GemmM>;

    constexpr index_t GemmABlockCopySrcDataPerRead_GemmK =
        CK_PARAM_TUNABLE_GEMM_A_BLOCK_COPY_SRC_DATA_PER_READ_GEMM_K;

    constexpr index_t GemmABlockCopyDstDataPerWrite_GemmM =
        CK_PARAM_TUNABLE_GEMM_A_BLOCK_COPY_DST_DATA_PER_WRITE_GEMM_M;

    // B matrix
    constexpr index_t GemmBBlockCopyClusterLengths_GemmK =
        CK_PARAM_TUNABLE_GEMM_B_BLOCK_COPY_CLUSTER_LENGTHS_GEMM_K;

    constexpr index_t GemmBBlockCopyClusterLengths_GemmN =
        CK_PARAM_TUNABLE_GEMM_B_BLOCK_COPY_CLUSTER_LENGTHS_GEMM_N;

    constexpr index_t GemmBBlockCopyThreadSliceLengths_GemmK =
        GemmKPerBlock / GemmBBlockCopyClusterLengths_GemmK;

    constexpr index_t GemmBBlockCopyThreadSliceLengths_GemmN =
        GemmNPerBlock / GemmBBlockCopyClusterLengths_GemmN;

    using GemmBBlockCopyThreadSliceLengths_GemmK_GemmN =
        Sequence<GemmBBlockCopyThreadSliceLengths_GemmK, GemmBBlockCopyThreadSliceLengths_GemmN>;

    using GemmBBlockCopyThreadClusterLengths_GemmK_GemmN =
        Sequence<GemmBBlockCopyClusterLengths_GemmK, GemmBBlockCopyClusterLengths_GemmN>;

    constexpr index_t GemmBBlockCopySrcDataPerRead_GemmN =
        CK_PARAM_TUNABLE_GEMM_B_BLOCK_COPY_SRC_DATA_PER_READ_GEMM_N;

    constexpr index_t GemmBBlockCopyDstDataPerWrite_GemmN =
        CK_PARAM_TUNABLE_GEMM_B_BLOCK_COPY_DST_DATA_PER_WRITE_GEMM_N;

    // C matrix
    constexpr index_t GemmCThreadCopyDstDataPerWrite_GemmN1 =
        CK_PARAM_TUNABLE_GEMM_C_THREAD_COPY_DST_DATA_PER_WRITE_GEMM_N1;

    constexpr auto gridwise_conv = GridwiseConvolutionImplicitGemm_v4r4_ncdhw_kczyx_nkdhw<
        GridSize,
        BlockSize,
        FLOAT,
        FLOAT_ACCUM,
        decltype(in_ncdhw_desc),
        decltype(wei_kczyx_desc),
        decltype(out_nkdhw_desc),
        ConvStrides,
        ConvDilations,
        InLeftPads,
        InRightPads,
        GemmMPerBlock,
        GemmNPerBlock,
        GemmKPerBlock,
        GemmMPerThread,
        GemmNPerThread,
        GemmKPerThread,
        GemmMLevel0Cluster,
        GemmNLevel0Cluster,
        GemmMLevel1Cluster,
        GemmNLevel1Cluster,
        ThreadGemmDataPerRead_GemmM,
        ThreadGemmDataPerRead_GemmN,
        GemmABlockCopyThreadSliceLengths_GemmK_GemmM,
        GemmABlockCopyThreadClusterLengths_GemmK_GemmM,
        GemmABlockCopySrcDataPerRead_GemmK,
        GemmABlockCopyDstDataPerWrite_GemmM,
        GemmBBlockCopyThreadSliceLengths_GemmK_GemmN,
        GemmBBlockCopyThreadClusterLengths_GemmK_GemmN,
        GemmBBlockCopySrcDataPerRead_GemmN,
        GemmBBlockCopyDstDataPerWrite_GemmN,
        GemmCThreadCopyDstDataPerWrite_GemmN1>{};

    gridwise_conv.Run(p_in_global, p_wei_global, p_out_global);
}