text:
package qub;

/**
 * The Iterator interface defines a type that can synchronously iterate over a collection of values.
 * @param <T> The type of value that the Iterator returns.
 */
public interface Iterator<T> extends java.lang.Iterable<T>
{
    /**
     * Advance to this Iterator's first value if the Iterator hasn't started yet. If it has already started, then do
     * nothing.
     */
    default Iterator<T> start()
    {
        if (!this.hasStarted())
        {
            this.next();
        }
        return this;
    }

    /**
     * Whether or not this Iterator has begun iterating over its values.
     * @return Whether or not this Iterator has begun iterating over its values.
     */
    boolean hasStarted();

    /**
     * Whether or not this Iterator has a current value.
     * @return Whether or not this Iterator has a current value.
     */
    boolean hasCurrent();

    /**
     * Get the current value that this Iterator is pointing at.
     * @return The current value that this Iterator is pointing at.
     */
    T getCurrent();

    /**
     * Get the next value for this Iterator. Returns whether or not a new value was found.
     * @return Whether or not a new value was found.
     */
    boolean next();

    /**
     * Return the current value for this Iterator and advance this Iterator to the next value.
     * @return The current value for this Iterator.
     */
    default T takeCurrent()
    {
        final T current = getCurrent();
        next();
        return current;
    }

    /**
     * Get whether or not this Iterator contains any values. This function may move this Iterator
     * forward one position, but it can be called multiple times without consuming any of the
     * values in this Iterator.
     * @return Whether or not this Iterator contains any values.
     */
    default boolean any()
    {
        return this.start().hasCurrent();
    }

    /**
     * Get the number of values that are in this Iterator. This will iterate through all of the
     * values in this Iterator. Use this method only if you care how many values are in the
     * Iterator, not what the values actually are.
     * @return The number of values that are in this Iterator.
     */
    default int getCount()
    {
        int result = this.hasCurrent() ? 1 : 0;
        while (this.next()) {
            ++result;
        }
        return result;
    }

    /**
     * Get the first value in this Iterator. This may advance the Iterator once.
     * @return The first value of this Iterator, or null if this Iterator has no (more) values.
     */
    default T first()
    {
        this.start();
        return this.hasCurrent() ? this.getCurrent() : null;
    }

    /**
     * Get the first value in this Iterator that isMatch the provided condition.
     * @param condition The condition to run against each of the values in this Iterator.
     * @return The first value of this Iterator that isMatch the provided condition, or null if this
     * Iterator has no values that match the condition.
     */
    default T first(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        T result = null;
        boolean foundResult = false;

        T current;
        if (this.hasCurrent())
        {
            current = this.getCurrent();
            if (condition.run(current))
            {
                result = current;
                foundResult = true;
            }
        }

        if (!foundResult)
        {
            while (this.next())
            {
                current = this.getCurrent();
                if (condition.run(current))
                {
                    result = current;
                    break;
                }
            }
        }

        return result;
    }

    /**
     * Get the last value in this Iterator. This will iterate through all of the values in this
     * Iterator.
     * @return The last value of this Iterator, or null if this Iterator has no (more) values.
     */
    default T last()
    {
        T result = null;

        if (this.hasCurrent())
        {
            result = getCurrent();
        }

        while (next())
        {
            result = getCurrent();
        }

        return result;
    }

    /**
     * Get the last value in this Iterator that isMatch the provided condition.
     * @param condition The condition to run against each of the values in this Iterator.
     * @return The last value of this Iterator that isMatch the provided condition, or null if this
     * Iterator has no values that match the condition.
     */
    default T last(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        T result = null;

        T current;
        if (hasCurrent())
        {
            current = getCurrent();
            if (condition.run(current))
            {
                result = getCurrent();
            }
        }

        while (next())
        {
            current = getCurrent();
            if (condition.run(current))
            {
                result = current;
            }
        }

        return result;
    }

    /**
     * Get whether or not this Iterator contains the provided value using the standard equals()
     * method to compare values.
     * @param value The value to look for in this Iterator.
     * @return Whether or not this Iterator contains the provided value.
     */
    default boolean contains(T value)
    {
        return contains((T iteratorValue) -> Comparer.equal(iteratorValue, value));
    }

    /**
     * Get whether or not this Iterator contains a value that isMatch the provided condition.
     * @param condition The condition to check against the values in this Iterator.
     * @return Whether or not this Iterator contains a value that isMatch the provided condition.
     */
    default boolean contains(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        boolean result = false;

        if (hasCurrent())
        {
            result = condition.run(getCurrent());
        }

        while (!result && next())
        {
            result = condition.run(getCurrent());
        }

        return result;
    }

    /**
     * Create a new Iterator that will iterate over no more than the provided number of values create
     * this Iterator.
     * @param toTake The number of values to take create this Iterator.
     * @return A new Iterator that will iterate over no more than the provided number of values create
     * this Iterator.
     */
    default Iterator<T> take(int toTake)
    {
        return new TakeIterator<>(this, toTake);
    }

    /**
     * Create a new {@link Iterator} that will take and return elements in this {@link Iterator}
     * until it finds an element that makes the provided condition true.
     * @param condition The condition.
     * @return A new {@link Iterator} that will take and return elements in this {@link Iterator}
     * until it finds an element that makes the provided condition true.
     */
    default Iterator<T> takeUntil(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        return this.takeWhile(Functions.not(condition));
    }

    /**
     * Create a new {@link Iterator} that will take and return elements in this {@link Iterator}
     * until it finds an element that makes the provided condition false.
     * @param condition The condition.
     * @return A new {@link Iterator} that will take and return elements in this {@link Iterator}
     * until it finds an element that makes the provided condition false.
     */
    default Iterator<T> takeWhile(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        return TakeWhileIterator.create(this, condition);
    }

    /**
     * Create a new Iterator that will skip over the first toSkip number of elements in this
     * Iterator and then iterate over the remaining elements.
     * @param toSkip The number of elements to skip.
     * @return A new Iterator that will skip over the first toSkip number of elements in this
     * Iterator and then iterate over the remaining elements.
     */
    default Iterator<T> skip(int toSkip)
    {
        return new SkipIterator<>(this, toSkip);
    }

    /**
     * Create a new Iterator that will skip over the elements in this Iterator until it finds an
     * element that makes the provided condition true. The returned Iterator will start at the
     * element after the element that made the condition true.
     * @param condition The condition.
     * @return a new Iterator that will skip over the elements in this Iterator until it finds an
     * element that makes the provided condition true.
     */
    default Iterator<T> skipUntil(Function1<T,Boolean> condition)
    {
        return new SkipUntilIterator<>(this, condition);
    }

    /**
     * Create a new Iterator that only returns the values create this Iterator that satisfy the given
     * condition.
     * @param condition The condition values must satisfy to be returned create the created Iterator.
     * @return An Iterator that only returns the values create this Iterator that satisfy the given
     * condition.
     */
    default Iterator<T> where(Function1<T,Boolean> condition)
    {
        PreCondition.assertNotNull(condition, "condition");

        return new WhereIterator<>(this, condition);
    }

    /**
     * Convert this Iterator into an Iterator that returns values of type U instead of type T.
     * @param conversion The function to use to convert values of type T to type U.
     * @param <U> The type to convert values of type T to.
     * @return An Iterator that returns values of type U instead of type T.
     */
    default <U> Iterator<U> map(Function1<T,U> conversion)
    {
        return new MapIterator<>(this, conversion);
    }

    /**
     * Convert this Iterator into an Iterator that only returns the values in this Iterator that are
     * of type or sub-classes of type U.
     * @param type The type to filter the results to.
     * @param <U> The type to return.
     * @return An Iterator that only returns the values in this Iterator that are of type of
     * sub-classes of type U.
     */
    default <U> Iterator<U> instanceOf(Class<U> type)
    {
        return new InstanceOfIterator<>(this, type);
    }

    /**
     * Create a java.util.Iterator that will iterate over this Iterator.
     * @return A java.util.Iterator that will iterate over this Iterator.
     */
    default java.util.Iterator<T> iterator()
    {
        return IteratorToJavaIteratorAdapter.create(this);
    }

    /**
     * Create an Array from the values in this Iterator.
     * @return An Array from the values in this Iterator.
     */
    default Array<T> toArray()
    {
        return Array.create(this);
    }

    /**
     * Create a List from the values in this Iterator.
     * @return A List from the values in this Iterator.
     */
    default List<T> toList()
    {
        return List.create(this);
    }

    /**
     * Create a Set from the values in this Iterator.
     * @return A Set from the values in this Iterator.
     */
    default Set<T> toSet()
    {
        return Set.create(this);
    }

    /**
     * Create a Map from the values in this Iterator.
     * @param getKey The function that will select the key from a value.
     * @param <K> The type of value that will serve as the keys of the map.
     * @param <V> The type of value that will serve as the values of the map.
     * @return A Map from the values in this Iterator.
     */
    default <K,V> MutableMap<K,V> toMap(Function1<T,K> getKey, Function1<T,V> getValue)
    {
        return Map.create(this, getKey, getValue);
    }

    /**
     * Create a CustomDecorator that will wrap around this Iterator.
     * @return A CustomDecorator that will wrap around this Iterator.
     */
    default CustomIterator<T> customize()
    {
        return CustomIterator.create(this);
    }

    /**
     * Get an Iterator that will invoke the provided action whenever a new value is iterated to.
     * @param action The action to run when a new value is iterated to.
     * @return An Iterator that will invoke the provided action whenever a new value is iterated
     * to.
     */
    default Iterator<T> onValue(Action0 action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.onValue((T currentValue) -> { action.run(); });
    }

    /**
     * Get an Iterator that will invoke the provided action whenever a new value is iterated to.
     * @param action The action to run when a new value is iterated to.
     * @return An Iterator that will invoke the provided action whenever a new value is iterated
     * to.
     */
    default Iterator<T> onValue(Action1<T> action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.customize()
            .setNextFunction((Iterator<T> innerIterator) ->
            {
                final boolean hasCurrent = innerIterator.next();
                if (hasCurrent)
                {
                    action.run(innerIterator.getCurrent());
                }
                return hasCurrent;
            });
    }

    /**
     * Ignore any errors that occur while iterating.
     * @return An Iterator that will ignore any errors that occur while iterating.
     */
    default Iterator<T> catchError()
    {
        return this.catchError(Action0.empty);
    }

    /**
     * Run the provided action on any errors that occur while iterating.
     * @param action The action to run if this Iterator has an error while iterating.
     * @return An Iterator that will run the provided action on any errors that occur while
     * iterating.
     */
    default Iterator<T> catchError(Action0 action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.catchError(Throwable.class, action);
    }

    /**
     * Run the provided action on any errors that occur while iterating.
     * @param action The action to run if this Iterator has an error while iterating.
     * @return An Iterator that will run the provided action on any errors that occur while
     * iterating.
     */
    default Iterator<T> catchError(Action1<Throwable> action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.catchError(Throwable.class, (Throwable parentError) ->
        {
            action.run(Exceptions.unwrap(parentError));
        });
    }

    /**
     * Ignore any errors of the provided type that occur while iterating.
     * @param errorType The type of error to catch.
     * @param <TError> The type of error to catch.
     * @return An Iterator that will ignore any errors of the provided type while iterating.
     */
    default <TError extends Throwable> Iterator<T> catchError(Class<TError> errorType)
    {
        PreCondition.assertNotNull(errorType, "errorType");

        return this.catchError(errorType, Action0.empty);
    }

    /**
     * Run the provided action on any errors of the provided type that occur while iterating.
     * @param errorType The type of error to catch.
     * @param action The action to run if this Iterator has an error of the provided type while
     *               iterating.
     * @param <TError> The type of error to catch.
     * @return An Iterator that will run the provided action on any errors of the provided type
     * that occur while iterating.
     */
    default <TError extends Throwable> Iterator<T> catchError(Class<TError> errorType, Action0 action)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(action, "action");

        return this.catchError(errorType, (TError parentError) ->
        {
            action.run();
        });
    }

    /**
     * Run the provided action on any errors of the provided type that occur while iterating.
     * @param errorType The type of error to catch.
     * @param action The action to run if this Iterator has an error of the provided type while
     *               iterating.
     * @param <TError> The type of error to catch.
     * @return An Iterator that will run the provided action on any errors of the provided type
     * that occur while iterating.
     */
    default <TError extends Throwable> Iterator<T> catchError(Class<TError> errorType, Action1<TError> action)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(action, "action");

        return this.customize()
            .setNextFunction((Iterator<T> iterator) ->
            {
                boolean result;
                while (true)
                {
                    try
                    {
                        result = iterator.next();
                        break;
                    }
                    catch (Throwable e)
                    {
                        final TError error = Exceptions.getInstanceOf(e, errorType);
                        if (error == null)
                        {
                            throw e;
                        }
                        else
                        {
                            action.run(error);
                        }
                    }
                }
                return result;
            });
    }

    /**
     * Run the provided action if this Iterator has an error while iterating.
     * @param action The action to run if this Iterator has an error while iterating.
     * @return The Iterator that will run the provided action if it has an error while iterating.
     */
    default Iterator<T> onError(Action0 action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.onError((Throwable error) ->
        {
            action.run();
        });
    }

    /**
     * Run the provided action if this Iterator has an error while iterating.
     * @param action The action to run if this Iterator has an error while iterating.
     * @return The Iterator that will run the provided action if it has an error while iterating.
     */
    default Iterator<T> onError(Action1<Throwable> action)
    {
        PreCondition.assertNotNull(action, "action");

        return this.onError(Throwable.class, (Throwable parentError) ->
        {
            action.run(Exceptions.unwrap(parentError));
        });
    }

    /**
     * Run the provided action if this Iterator has an error of the provided type while iterating.
     * @param errorType The type of error to run the provided action for.
     * @param action The action to run if this Iterator has an error of the provided type while iterating.
     * @return The Iterator that will run the provided action if it has an error of the provided
     * type while iterating.
     */
    default <TError extends Throwable> Iterator<T> onError(Class<TError> errorType, Action0 action)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(action, "action");

        return this.onError(errorType, (TError error) ->
        {
            action.run();
        });
    }

    /**
     * Run the provided action if this Iterator has an error of the provided type while iterating.
     * @param errorType The type of error to run the provided action for.
     * @param action The action to run if this Iterator has an error of the provided type while iterating.
     * @return The Iterator that will run the provided action if it has an error of the provided
     * type while iterating.
     */
    default <TError extends Throwable> Iterator<T> onError(Class<TError> errorType, Action1<TError> action)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(action, "action");

        return this.catchError(Throwable.class, (Throwable parentError) ->
        {
            final TError expectedError = Exceptions.getInstanceOf(parentError, errorType);
            if (expectedError != null)
            {
                action.run(expectedError);
            }
            throw Exceptions.asRuntime(parentError);
        });
    }

    /**
     * If this Iterator has an error while iterating, catch it and convert it to the error returned
     * by the provided function.
     * @param function The function that will return the new error.
     * @return The Iterator that will throw new errors.
     */
    default Iterator<T> convertError(Function0<? extends Throwable> function)
    {
        PreCondition.assertNotNull(function, "function");

        return this.catchError(() ->
        {
            throw Exceptions.asRuntime(function.run());
        });
    }

    /**
     * If this Iterator has an error while iterating, catch it and convert it to the error returned
     * by the provided function.
     * @param function The function that will return the new error.
     * @return The Iterator that will throw new errors.
     */
    default Iterator<T> convertError(Function1<Throwable,? extends Throwable> function)
    {
        PreCondition.assertNotNull(function, "function");

        return this.catchError((Throwable error) ->
        {
            throw Exceptions.asRuntime(function.run(Exceptions.unwrap(error)));
        });
    }

    /**
     * If this Iterator has an error of the provided type while iterating, catch it and convert it
     * to the error returned by the provided function.
     * @param errorType The type of error to convert.
     * @param function The function that will return the new error.
     * @return The Iterator that will throw new errors.
     */
    default Iterator<T> convertError(Class<? extends Throwable> errorType, Function0<? extends Throwable> function)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(function, "function");

        return this.catchError(errorType, () ->
        {
            throw Exceptions.asRuntime(function.run());
        });
    }

    /**
     * If this Iterator has an error of the provided type while iterating, catch it and convert it
     * to the error returned by the provided function.
     * @param errorType The type of error to convert.
     * @param function The function that will return the new error.
     * @return The Iterator that will throw new errors.
     */
    default <TErrorIn extends Throwable> Iterator<T> convertError(Class<TErrorIn> errorType, Function1<TErrorIn,? extends Throwable> function)
    {
        PreCondition.assertNotNull(errorType, "errorType");
        PreCondition.assertNotNull(function, "function");

        return this.catchError(errorType, (TErrorIn error) ->
        {
            throw Exceptions.asRuntime(function.run(error));
        });
    }

    /**
     * Iterate through each of the values in this Iterator.
     */
    default void await()
    {
        while (this.next())
        {
        }
    }

    /**
     * Create an empty iterator.
     * @param <T> The type of values to iterate over.
     * @return The empty iterator.
     */
    static <T> Iterator<T> create()
    {
        return EmptyIterator.create();
    }

    /**
     * Create an iterator for the provided values.
     * @param values The values to iterate over.
     * @return The iterator that will iterate over the provided values.
     */
    static Iterator<Byte> createFromBytes(byte... values)
    {
        PreCondition.assertNotNull(values, "values");

        return new ByteArrayIterator(values);
    }

    /**
     * Create an Iterator for the provided values.
     * @param values The values to iterate.
     * @return The Iterator for the provided values.
     */
    static Iterator<Byte> create(byte[] values, int startIndex, int length)
    {
        PreCondition.assertNotNull(values, "values");
        PreCondition.assertStartIndex(startIndex, values.length);
        PreCondition.assertLength(length, startIndex, values.length);

        return new ByteArrayIterator(values, startIndex, length);
    }

    /**
     * Create an iterator for the provided values.
     * @param values The values to iterate over.
     * @return The iterator that will iterate over the provided values.
     */
    static Iterator<Character> create(char[] values)
    {
        return new CharacterArrayIterator(values);
    }

    /**
     * Create an iterator for the provided values.
     * @param values The values to iterate over.
     * @return The iterator that will iterate over the provided values.
     */
    static Iterator<Integer> create(int[] values)
    {
        return IntegerArrayIterator.create(values);
    }

    /**
     * Create an iterator for the provided values.
     * @param values The values to iterate over.
     * @param <T> The type of the values.
     * @return The iterator that will iterate over the provided values.
     */
    @SafeVarargs
    static <T> Iterator<T> create(T... values)
    {
        return Iterable.create(values).iterate();
    }

    /**
     * Create an Iterator that will invoke the provided action to determine what its next value(s)
     * should be.
     * @param getNextValuesAction The action that will be invoked to determine what the next
     *                            value(s) for the returned Iterator should be.
     * @param <T> The type of values returned by the Iterator.
     * @return An Iterator that will invoke the provided action to determine what its next value(s)
     * should be.
     */
    static <T> Iterator<T> create(Action1<IteratorActions<T>> getNextValuesAction)
    {
        PreCondition.assertNotNull(getNextValuesAction, "getNextValuesAction");

        return BasicIterator.create(getNextValuesAction);
    }

    /**
     * Create an Iterator that will invoke the provided action to determine what its next value(s)
     * should be.
     * @param getNextValuesAction The action that will be invoked to determine what the next
     *                            value(s) for the returned Iterator should be.
     * @param <T> The type of values returned by the Iterator.
     * @return An Iterator that will invoke the provided action to determine what its next value(s)
     * should be.
     */
    static <T> Iterator<T> create(Action2<IteratorActions<T>,Getter<T>> getNextValuesAction)
    {
        PreCondition.assertNotNull(getNextValuesAction, "getNextValuesAction");

        return BasicIterator.create(getNextValuesAction);
    }

    /**
     * Get whether or not the provided iterator is null or empty.
     * @param iterator The iterator to check.
     * @param <T> The type of values in the Iterator.
     * @return Whether or not the provided iterator is null or empty.
     */
    static <T> boolean isNullOrEmpty(Iterator<T> iterator)
    {
        return iterator == null || !iterator.any();
    }

    /**
     * Get the value in this Iterable that is the maximum based on the provided comparer function.
     * @param comparer The function to use to compare the values in this Iterable.
     * @return The maximum value in this Iterable based on the provided comparer function.
     */
    default T minimum(Function2<T,T,Comparison> comparer)
    {
        PreCondition.assertNotNull(comparer, "comparer");

        T result = null;

        this.start();
        if (this.hasCurrent())
        {
            result = this.getCurrent();
            while (this.next())
            {
                final T current = this.getCurrent();
                if (comparer.run(current, result) == Comparison.LessThan)
                {
                    result = current;
                }
            }
        }

        return result;
    }

    /**
     * Get the value in this Iterable that is the maximum based on the provided comparer function.
     * @param comparer The function to use to compare the values in this Iterable.
     * @return The maximum value in this Iterable based on the provided comparer function.
     */
    default T maximum(Function2<T,T,Comparison> comparer)
    {
        PreCondition.assertNotNull(comparer, "comparer");

        T result = null;

        this.start();
        if (this.hasCurrent())
        {
            result = this.getCurrent();
            while (this.next())
            {
                final T current = this.getCurrent();
                if (comparer.run(current, result) == Comparison.GreaterThan)
                {
                    result = current;
                }
            }
        }

        return result;
    }
}


text:
package gameover.fwk.pool

import com.badlogic.gdx.math.{Rectangle, Vector2}

object RectanglePool extends ObjectPool[Rectangle] {

  def instantiateObject: Rectangle = new Rectangle

  def obtain(rectangle: Rectangle): Rectangle = obtain().set(rectangle)

  def obtain(v1: Vector2, v2: Vector2): Rectangle = obtain().set(v1.x, v1.y, v2.x, v2.y)

  def obtain(x1: Float, y1: Float, x2: Float, y2: Float): Rectangle = obtain().set(x1, y1, x2, y2)
}

redpajama_set_name: RedPajamaGithub


text:
package org.compass.core.test.engine.lucene.transaction.readcommitted;

import org.compass.core.config.CompassEnvironment;
import org.compass.core.config.CompassSettings;
import org.compass.core.lucene.LuceneEnvironment;

/**
 * @author kimchy
 */
public class RAMReadCommittedNonConcurrentTransactionEngineTests extends AbstractReadCommittedTransactionTests {

    protected CompassSettings buildCompassSettings() {
        CompassSettings settings = super.buildCompassSettings();
        settings.setSetting(CompassEnvironment.CONNECTION, "ram://target/testindex");
        settings.setBooleanSetting(LuceneEnvironment.Transaction.Processor.ReadCommitted.CONCURRENT_OPERATIONS, false);
        return settings;
    }
}


text:
<?xml version="1.0"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>Sakai IFrame Portlet</display-name>

  <servlet>
    <servlet-name>PortletIFrame</servlet-name>
    <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
    <init-param>
    <param-name>portlet-name</param-name>
    <param-value>PortletIFrame</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
      <servlet-name>PortletIFrame</servlet-name>
      <url-pattern>/PlutoInvoker/PortletIFrame</url-pattern>
  </servlet-mapping>

</web-app>


text:
class EXPA::Search < ActiveEXPA::Base
    class << self

    end
end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.serviceusage.v1.model;

/**
 * Experimental service configuration. These configuration options can only be used by whitelisted
 * users.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Service Usage API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Experimental extends com.google.api.client.json.GenericJson {

  /**
   * Authorization configuration.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private AuthorizationConfig authorization;

  /**
   * Authorization configuration.
   * @return value or {@code null} for none
   */
  public AuthorizationConfig getAuthorization() {
    return authorization;
  }

  /**
   * Authorization configuration.
   * @param authorization authorization or {@code null} for none
   */
  public Experimental setAuthorization(AuthorizationConfig authorization) {
    this.authorization = authorization;
    return this;
  }

  @Override
  public Experimental set(String fieldName, Object value) {
    return (Experimental) super.set(fieldName, value);
  }

  @Override
  public Experimental clone() {
    return (Experimental) super.clone();
  }

}


text:
<?php

namespace Google\Service\Directory;

class RoleAssignments extends \Google\Collection
{
  protected $collection_key = 'items';
  /**
   * @var string
   */
  public $etag;
  protected $itemsType = RoleAssignment::class;
  protected $itemsDataType = 'array';
  /**
   * @var string
   */
  public $kind;
  /**
   * @var string
   */
  public $nextPageToken;

  /**
   * @param string
   */
  public function setEtag($etag)
  {
    $this->etag = $etag;
  }
  /**
   * @return string
   */
  public function getEtag()
  {
    return $this->etag;
  }
  /**
   * @param RoleAssignment[]
   */
  public function setItems($items)
  {
    $this->items = $items;
  }
  /**
   * @return RoleAssignment[]
   */
  public function getItems()
  {
    return $this->items;
  }
  /**
   * @param string
   */
  public function setKind($kind)
  {
    $this->kind = $kind;
  }
  /**
   * @return string
   */
  public function getKind()
  {
    return $this->kind;
  }
  /**
   * @param string
   */
  public function setNextPageToken($nextPageToken)
  {
    $this->nextPageToken = $nextPageToken;
  }
  /**
   * @return string
   */
  public function getNextPageToken()
  {
    return $this->nextPageToken;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RoleAssignments::class, 'Google_Service_Directory_RoleAssignments');


text:
#include <CoreFoundation/CFDictionary.h>
#include <CoreFoundation/CFNumber.h>
#include <CoreFoundation/CFData.h>

#include "vda.h"
#include "libavutil/avutil.h"
#include "h264.h"

struct vda_buffer {
    CVPixelBufferRef cv_buffer;
};
#include "internal.h"
#include "vda_vt_internal.h"

/* Decoder callback that adds the vda frame to the queue in display order. */
static void vda_decoder_callback(void *vda_hw_ctx,
                                 CFDictionaryRef user_info,
                                 OSStatus status,
                                 uint32_t infoFlags,
                                 CVImageBufferRef image_buffer)
{
    struct vda_context *vda_ctx = vda_hw_ctx;

    if (infoFlags & kVDADecodeInfo_FrameDropped)
        vda_ctx->cv_buffer = NULL;

    if (!image_buffer)
        return;

    if (vda_ctx->cv_pix_fmt_type != CVPixelBufferGetPixelFormatType(image_buffer))
        return;

    vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer);
}

static int vda_sync_decode(VTContext *ctx, struct vda_context *vda_ctx)
{
    OSStatus status;
    CFDataRef coded_frame;
    uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames

    coded_frame = CFDataCreate(kCFAllocatorDefault,
                               ctx->bitstream,
                               ctx->bitstream_size);

    status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);

    if (kVDADecoderNoErr == status)
        status = VDADecoderFlush(vda_ctx->decoder, flush_flags);

    CFRelease(coded_frame);

    return status;
}

static int vda_old_h264_start_frame(AVCodecContext *avctx,
                                av_unused const uint8_t *buffer,
                                av_unused uint32_t size)
{
    VTContext *vda = avctx->internal->hwaccel_priv_data;
    struct vda_context *vda_ctx = avctx->hwaccel_context;

    if (!vda_ctx->decoder)
        return -1;

    vda->bitstream_size = 0;

    return 0;
}

static int vda_old_h264_decode_slice(AVCodecContext *avctx,
                                 const uint8_t *buffer,
                                 uint32_t size)
{
    VTContext *vda              = avctx->internal->hwaccel_priv_data;
    struct vda_context *vda_ctx = avctx->hwaccel_context;
    void *tmp;

    if (!vda_ctx->decoder)
        return -1;

    tmp = av_fast_realloc(vda->bitstream,
                          &vda->allocated_size,
                          vda->bitstream_size + size + 4);
    if (!tmp)
        return AVERROR(ENOMEM);

    vda->bitstream = tmp;

    AV_WB32(vda->bitstream + vda->bitstream_size, size);
    memcpy(vda->bitstream + vda->bitstream_size + 4, buffer, size);

    vda->bitstream_size += size + 4;

    return 0;
}

static void vda_h264_release_buffer(void *opaque, uint8_t *data)
{
    struct vda_buffer *context = opaque;
    CVPixelBufferRelease(context->cv_buffer);
    av_free(context);
}

static int vda_old_h264_end_frame(AVCodecContext *avctx)
{
    H264Context *h                      = avctx->priv_data;
    VTContext *vda                      = avctx->internal->hwaccel_priv_data;
    struct vda_context *vda_ctx         = avctx->hwaccel_context;
    AVFrame *frame                      = h->cur_pic_ptr->f;
    struct vda_buffer *context;
    AVBufferRef *buffer;
    int status;

    if (!vda_ctx->decoder || !vda->bitstream)
        return -1;

    status = vda_sync_decode(vda, vda_ctx);
    frame->data[3] = (void*)vda_ctx->cv_buffer;

    if (status)
        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);

    if (!vda_ctx->use_ref_buffer || status)
        return status;

    context = av_mallocz(sizeof(*context));
    buffer = av_buffer_create(NULL, 0, vda_h264_release_buffer, context, 0);
    if (!context || !buffer) {
        CVPixelBufferRelease(vda_ctx->cv_buffer);
        av_free(context);
        return -1;
    }

    context->cv_buffer = vda_ctx->cv_buffer;
    frame->buf[3] = buffer;

    return status;
}

int ff_vda_create_decoder(struct vda_context *vda_ctx,
                          uint8_t *extradata,
                          int extradata_size)
{
    OSStatus status;
    CFNumberRef height;
    CFNumberRef width;
    CFNumberRef format;
    CFDataRef avc_data;
    CFMutableDictionaryRef config_info;
    CFMutableDictionaryRef buffer_attributes;
    CFMutableDictionaryRef io_surface_properties;
    CFNumberRef cv_pix_fmt;

    vda_ctx->priv_bitstream = NULL;
    vda_ctx->priv_allocated_size = 0;

    /* Each VCL NAL in the bitstream sent to the decoder
     * is preceded by a 4 bytes length header.
     * Change the avcC atom header if needed, to signal headers of 4 bytes. */
    if (extradata_size >= 4 && (extradata[4] & 0x03) != 0x03) {
        uint8_t *rw_extradata;

        if (!(rw_extradata = av_malloc(extradata_size)))
            return AVERROR(ENOMEM);

        memcpy(rw_extradata, extradata, extradata_size);

        rw_extradata[4] |= 0x03;

        avc_data = CFDataCreate(kCFAllocatorDefault, rw_extradata, extradata_size);

        av_freep(&rw_extradata);
    } else {
        avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
    }

    config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                            4,
                                            &kCFTypeDictionaryKeyCallBacks,
                                            &kCFTypeDictionaryValueCallBacks);

    height   = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
    width    = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
    format   = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);

    CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_SourceFormat, format);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_avcCData, avc_data);

    buffer_attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                                  2,
                                                  &kCFTypeDictionaryKeyCallBacks,
                                                  &kCFTypeDictionaryValueCallBacks);
    io_surface_properties = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                                      0,
                                                      &kCFTypeDictionaryKeyCallBacks,
                                                      &kCFTypeDictionaryValueCallBacks);
    cv_pix_fmt  = CFNumberCreate(kCFAllocatorDefault,
                                 kCFNumberSInt32Type,
                                 &vda_ctx->cv_pix_fmt_type);
    CFDictionarySetValue(buffer_attributes,
                         kCVPixelBufferPixelFormatTypeKey,
                         cv_pix_fmt);
    CFDictionarySetValue(buffer_attributes,
                         kCVPixelBufferIOSurfacePropertiesKey,
                         io_surface_properties);

    status = VDADecoderCreate(config_info,
                              buffer_attributes,
                              (VDADecoderOutputCallback *)vda_decoder_callback,
                              vda_ctx,
                              &vda_ctx->decoder);

    CFRelease(height);
    CFRelease(width);
    CFRelease(format);
    CFRelease(avc_data);
    CFRelease(config_info);
    CFRelease(io_surface_properties);
    CFRelease(cv_pix_fmt);
    CFRelease(buffer_attributes);

    return status;
}

int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
{
    OSStatus status = kVDADecoderNoErr;

    if (vda_ctx->decoder)
        status = VDADecoderDestroy(vda_ctx->decoder);

    return status;
}

AVHWAccel ff_h264_vda_old_hwaccel = {
    .name           = "h264_vda",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = AV_CODEC_ID_H264,
    .pix_fmt        = AV_PIX_FMT_VDA_VLD,
    .start_frame    = vda_old_h264_start_frame,
    .decode_slice   = vda_old_h264_decode_slice,
    .end_frame      = vda_old_h264_end_frame,
    .uninit         = ff_videotoolbox_uninit,
    .priv_data_size = sizeof(VTContext),
};

void ff_vda_output_callback(void *opaque,
                            CFDictionaryRef user_info,
                            OSStatus status,
                            uint32_t infoFlags,
                            CVImageBufferRef image_buffer)
{
    AVCodecContext *ctx = opaque;
    VTContext *vda = ctx->internal->hwaccel_priv_data;

    if (vda->frame) {
        CVPixelBufferRelease(vda->frame);
        vda->frame = NULL;
    }

    if (!image_buffer)
        return;

    vda->frame = CVPixelBufferRetain(image_buffer);
}

static int vda_h264_end_frame(AVCodecContext *avctx)
{
    H264Context *h        = avctx->priv_data;
    VTContext *vda        = avctx->internal->hwaccel_priv_data;
    AVVDAContext *vda_ctx = avctx->hwaccel_context;
    AVFrame *frame        = h->cur_pic_ptr->f;
    uint32_t flush_flags  = 1 << 0; ///< kVDADecoderFlush_emitFrames
    CFDataRef coded_frame;
    OSStatus status;

    if (!vda->bitstream_size)
        return AVERROR_INVALIDDATA;

    coded_frame = CFDataCreate(kCFAllocatorDefault,
                               vda->bitstream,
                               vda->bitstream_size);

    status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);

    if (status == kVDADecoderNoErr)
        status = VDADecoderFlush(vda_ctx->decoder, flush_flags);

    CFRelease(coded_frame);

    if (!vda->frame)
        return AVERROR_UNKNOWN;

    if (status != kVDADecoderNoErr) {
        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
        return AVERROR_UNKNOWN;
    }

    return ff_videotoolbox_buffer_create(vda, frame);
}

int ff_vda_default_init(AVCodecContext *avctx)
{
    AVVDAContext *vda_ctx = avctx->hwaccel_context;
    OSStatus status = kVDADecoderNoErr;
    CFNumberRef height;
    CFNumberRef width;
    CFNumberRef format;
    CFDataRef avc_data;
    CFMutableDictionaryRef config_info;
    CFMutableDictionaryRef buffer_attributes;
    CFMutableDictionaryRef io_surface_properties;
    CFNumberRef cv_pix_fmt;
    int32_t fmt = 'avc1', pix_fmt = vda_ctx->cv_pix_fmt_type;

    // kCVPixelFormatType_420YpCbCr8Planar;

    avc_data = ff_videotoolbox_avcc_extradata_create(avctx);

    config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                            4,
                                            &kCFTypeDictionaryKeyCallBacks,
                                            &kCFTypeDictionaryValueCallBacks);

    height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &avctx->height);
    width  = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &avctx->width);
    format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &fmt);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_avcCData, avc_data);
    CFDictionarySetValue(config_info, kVDADecoderConfiguration_SourceFormat, format);

    buffer_attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                                  2,
                                                  &kCFTypeDictionaryKeyCallBacks,
                                                  &kCFTypeDictionaryValueCallBacks);
    io_surface_properties = CFDictionaryCreateMutable(kCFAllocatorDefault,
                                                      0,
                                                      &kCFTypeDictionaryKeyCallBacks,
                                                      &kCFTypeDictionaryValueCallBacks);
    cv_pix_fmt      = CFNumberCreate(kCFAllocatorDefault,
                                     kCFNumberSInt32Type,
                                     &pix_fmt);

    CFDictionarySetValue(buffer_attributes,
                         kCVPixelBufferPixelFormatTypeKey,
                         cv_pix_fmt);
    CFDictionarySetValue(buffer_attributes,
                         kCVPixelBufferIOSurfacePropertiesKey,
                         io_surface_properties);

    status = VDADecoderCreate(config_info,
                              buffer_attributes,
                              (VDADecoderOutputCallback *)ff_vda_output_callback,
                              avctx,
                              &vda_ctx->decoder);

    CFRelease(format);
    CFRelease(height);
    CFRelease(width);
    CFRelease(avc_data);
    CFRelease(config_info);
    CFRelease(cv_pix_fmt);
    CFRelease(io_surface_properties);
    CFRelease(buffer_attributes);

    if (status != kVDADecoderNoErr) {
        av_log(avctx, AV_LOG_ERROR, "Cannot initialize VDA %d\n", status);
    }

    switch (status) {
    case kVDADecoderHardwareNotSupportedErr:
    case kVDADecoderFormatNotSupportedErr:
        return AVERROR(ENOSYS);
    case kVDADecoderConfigurationError:
        return AVERROR(EINVAL);
    case kVDADecoderDecoderFailedErr:
        return AVERROR_INVALIDDATA;
    case kVDADecoderNoErr:
        return 0;
    default:
        return AVERROR_UNKNOWN;
    }
}

AVHWAccel ff_h264_vda_hwaccel = {
    .name           = "h264_vda",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = AV_CODEC_ID_H264,
    .pix_fmt        = AV_PIX_FMT_VDA,
    .alloc_frame    = ff_videotoolbox_alloc_frame,
    .start_frame    = ff_videotoolbox_h264_start_frame,
    .decode_slice   = ff_videotoolbox_h264_decode_slice,
    .end_frame      = vda_h264_end_frame,
    .uninit         = ff_videotoolbox_uninit,
    .priv_data_size = sizeof(VTContext),
};


text:
An overview of the moving pieces in app deployment currently (ex. chef, puppet,
salt, ansible, git, omnibus, compass, less, DB migrations, databases).

## Description

Deploying a moderately complex web application has become quite a challenge over
the years. As best-practices have evolved, it has become progressively more
time-consuming to keep up with what tools exist and how to use them effectively.
This talk will provide an overview of the ecosystem and provide pointers for
more information about individual components or problems.

## Audience

People deploying web apps but not very familiar with server operations.

## Objectives

Provide signposts in the rats nest of crazy that is app deployment.

## Abstract

Modern web applications are immensely complex collections of multiple
interacting systems. Many new web developers don't have the time to learn all
the different pieces and tools, and often their application stability and
agility suffer for it. This talk will cover a few of the major groups of tools
involved in running an application including databases, web servers, and
configuration managers.

## Outline

* Intro (2m)
* Databases (5m)
  * MySQL fragmentation (Maria, etc)
  * Postgres w/ replication, new things
  * Whirlwind tour of NoSQL
  * DB migration strategies
* Web servers (5m)
  * Apache/Nginx
    * No really, mod_wsgi is still awesome
  * Gunicorn
  * uwsgi
  * Twisted
  * Using a CDN for assets
  * PaaS
* Server config (5m)
  * Chef
  * Puppet
  * Salt
  * Ansible
  * 12-factor
* Deploy orchestration and artifacts (5m)
  * Fabric
  * MCollective
  * Git/Hg as deploy sources
  * Omnibus
  * Artifactory
* Q/A


text:
//
//  QRCodeDetailViewController.m
//  ImitationWeChat
//
//  Created by wany on 15/7/17.
//  Copyright (c) 2015年 wany. All rights reserved.
//

#import "QRCodeDetailViewController.h"

@interface QRCodeDetailViewController ()
@property (nonatomic,strong) UIWebView *webView;
@end

@implementation QRCodeDetailViewController

-(UIWebView *)webView{
    if (!_webView) {
        _webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
        [self.view addSubview:_webView];
    }
    return _webView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"识别结果";
    self.view.backgroundColor = [UIColor whiteColor];
    [self.webView loadHTMLString:_showQrData baseURL:[NSURL URLWithString:@"http://www.baidu.com"]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package org.jcodec.containers.mkv.boxes;
import java.nio.ByteBuffer;

/**
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed under FreeBSD License
 *
 * EBML IO implementation
 *
 * @author The JCodec project
 *
 */
public class EbmlUlong extends EbmlBin {

    public EbmlUlong(byte[] id) {
        super(id);
        data = ByteBuffer.allocate(8);
    }

    public static EbmlUlong createEbmlUlong(byte[] id, long value) {
        EbmlUlong e = new EbmlUlong(id);
        e.setUlong(value);
        return e;
    }

    public void setUlong(long value){
        data.putLong(value);
        data.flip();
    }

    public long getUlong() {
        return data.duplicate().getLong();
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>RewardProto.RewardPacket</title>
<meta name="date" content="2017-03-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

kr.ac.mju.islab

Class RewardProto.RewardPacket

java.lang.Object

com.google.protobuf.AbstractMessageLite

com.google.protobuf.AbstractMessage

com.google.protobuf.GeneratedMessageV3

kr.ac.mju.islab.RewardProto.RewardPacket

All Implemented Interfaces:

com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.io.Serializable, RewardProto.RewardPacketOrBuilder

Enclosing class:

RewardProto

public static final class RewardProto.RewardPacket
extends com.google.protobuf.GeneratedMessageV3
implements RewardProto.RewardPacketOrBuilder

Protobuf type reward.RewardPacket

See Also:

Serialized Form

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
RewardProto.RewardPacket.Builder

Protobuf type reward.RewardPacket

Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3

com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable

Field Summary

Fields

Modifier and Type
Field and Description

static int
AUX_FIELD_NUMBER

static int
E1_FIELD_NUMBER

static int
E2_FIELD_NUMBER

static int
E3_FIELD_NUMBER

static int
ELIST1_FIELD_NUMBER

static int
ELIST2_FIELD_NUMBER

static int
ISVALID_FIELD_NUMBER

static int
PID_FIELD_NUMBER

Method Summary

All Methods Static Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

boolean
equals(java.lang.Object obj)

java.lang.String
getAux(int index)

repeated string aux = 8;

com.google.protobuf.ByteString
getAuxBytes(int index)

repeated string aux = 8;

int
getAuxCount()

repeated string aux = 8;

com.google.protobuf.ProtocolStringList
getAuxList()

repeated string aux = 8;

static RewardProto.RewardPacket
getDefaultInstance()

RewardProto.RewardPacket
getDefaultInstanceForType()

static com.google.protobuf.Descriptors.Descriptor
getDescriptor()

com.google.protobuf.ByteString
getE1()

optional bytes e1 = 3;

com.google.protobuf.ByteString
getE2()

optional bytes e2 = 4;

com.google.protobuf.ByteString
getE3()

optional bytes e3 = 5;

com.google.protobuf.ByteString
getEList1(int index)

repeated bytes eList1 = 6;

int
getEList1Count()

repeated bytes eList1 = 6;

java.util.List<com.google.protobuf.ByteString>
getEList1List()

repeated bytes eList1 = 6;

com.google.protobuf.ByteString
getEList2(int index)

repeated bytes eList2 = 7;

int
getEList2Count()

repeated bytes eList2 = 7;

java.util.List<com.google.protobuf.ByteString>
getEList2List()

repeated bytes eList2 = 7;

boolean
getIsValid()

optional bool isValid = 2;

com.google.protobuf.Parser<RewardProto.RewardPacket>
getParserForType()

int
getPid()

optional int32 pid = 1;

int
getSerializedSize()

com.google.protobuf.UnknownFieldSet
getUnknownFields()

int
hashCode()

boolean
isInitialized()

static RewardProto.RewardPacket.Builder
newBuilder()

static RewardProto.RewardPacket.Builder
newBuilder(RewardProto.RewardPacket prototype)

RewardProto.RewardPacket.Builder
newBuilderForType()

static RewardProto.RewardPacket
parseDelimitedFrom(java.io.InputStream input)

static RewardProto.RewardPacket
parseDelimitedFrom(java.io.InputStream input,
                  com.google.protobuf.ExtensionRegistryLite extensionRegistry)

static RewardProto.RewardPacket
parseFrom(byte[] data)

static RewardProto.RewardPacket
parseFrom(byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)

static RewardProto.RewardPacket
parseFrom(com.google.protobuf.ByteString data)

static RewardProto.RewardPacket
parseFrom(com.google.protobuf.ByteString data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)

static RewardProto.RewardPacket
parseFrom(com.google.protobuf.CodedInputStream input)

static RewardProto.RewardPacket
parseFrom(com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)

static RewardProto.RewardPacket
parseFrom(java.io.InputStream input)

static RewardProto.RewardPacket
parseFrom(java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)

static com.google.protobuf.Parser<RewardProto.RewardPacket>
parser()

RewardProto.RewardPacket.Builder
toBuilder()

void
writeTo(com.google.protobuf.CodedOutputStream output)

Methods inherited from class com.google.protobuf.GeneratedMessageV3

getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof

Methods inherited from class com.google.protobuf.AbstractMessage

findInitializationErrors, getInitializationErrorString, toString

Methods inherited from class com.google.protobuf.AbstractMessageLite

toByteArray, toByteString, writeDelimitedTo, writeTo

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Methods inherited from interface com.google.protobuf.MessageOrBuilder

findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof

Methods inherited from interface com.google.protobuf.MessageLite

toByteArray, toByteString, writeDelimitedTo, writeTo

Field Detail

PID_FIELD_NUMBER

public static final int PID_FIELD_NUMBER

See Also:

Constant Field Values

ISVALID_FIELD_NUMBER

public static final int ISVALID_FIELD_NUMBER

See Also:

Constant Field Values

E1_FIELD_NUMBER

public static final int E1_FIELD_NUMBER

See Also:

Constant Field Values

E2_FIELD_NUMBER

public static final int E2_FIELD_NUMBER

See Also:

Constant Field Values

E3_FIELD_NUMBER

public static final int E3_FIELD_NUMBER

See Also:

Constant Field Values

ELIST1_FIELD_NUMBER

public static final int ELIST1_FIELD_NUMBER

See Also:

Constant Field Values

ELIST2_FIELD_NUMBER

public static final int ELIST2_FIELD_NUMBER

See Also:

Constant Field Values

AUX_FIELD_NUMBER

public static final int AUX_FIELD_NUMBER

See Also:

Constant Field Values

Method Detail

getUnknownFields

public final com.google.protobuf.UnknownFieldSet getUnknownFields()

Specified by:

getUnknownFields in interface com.google.protobuf.MessageOrBuilder

Overrides:

getUnknownFields in class com.google.protobuf.GeneratedMessageV3

getDescriptor

public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()

getPid

public int getPid()

optional int32 pid = 1;

Specified by:

getPid in interface RewardProto.RewardPacketOrBuilder

getIsValid

public boolean getIsValid()

optional bool isValid = 2;

Specified by:

getIsValid in interface RewardProto.RewardPacketOrBuilder

getE1

public com.google.protobuf.ByteString getE1()

optional bytes e1 = 3;

Specified by:

getE1 in interface RewardProto.RewardPacketOrBuilder

getE2

public com.google.protobuf.ByteString getE2()

optional bytes e2 = 4;

Specified by:

getE2 in interface RewardProto.RewardPacketOrBuilder

getE3

public com.google.protobuf.ByteString getE3()

optional bytes e3 = 5;

Specified by:

getE3 in interface RewardProto.RewardPacketOrBuilder

getEList1List

public java.util.List<com.google.protobuf.ByteString> getEList1List()

repeated bytes eList1 = 6;

Specified by:

getEList1List in interface RewardProto.RewardPacketOrBuilder

getEList1Count

public int getEList1Count()

repeated bytes eList1 = 6;

Specified by:

getEList1Count in interface RewardProto.RewardPacketOrBuilder

getEList1

public com.google.protobuf.ByteString getEList1(int index)

repeated bytes eList1 = 6;

Specified by:

getEList1 in interface RewardProto.RewardPacketOrBuilder

getEList2List

public java.util.List<com.google.protobuf.ByteString> getEList2List()

repeated bytes eList2 = 7;

Specified by:

getEList2List in interface RewardProto.RewardPacketOrBuilder

getEList2Count

public int getEList2Count()

repeated bytes eList2 = 7;

Specified by:

getEList2Count in interface RewardProto.RewardPacketOrBuilder

getEList2

public com.google.protobuf.ByteString getEList2(int index)

repeated bytes eList2 = 7;

Specified by:

getEList2 in interface RewardProto.RewardPacketOrBuilder

getAuxList

public com.google.protobuf.ProtocolStringList getAuxList()

repeated string aux = 8;

Specified by:

getAuxList in interface RewardProto.RewardPacketOrBuilder

getAuxCount

public int getAuxCount()

repeated string aux = 8;

Specified by:

getAuxCount in interface RewardProto.RewardPacketOrBuilder

getAux

public java.lang.String getAux(int index)

repeated string aux = 8;

Specified by:

getAux in interface RewardProto.RewardPacketOrBuilder

getAuxBytes

public com.google.protobuf.ByteString getAuxBytes(int index)

repeated string aux = 8;

Specified by:

getAuxBytes in interface RewardProto.RewardPacketOrBuilder

isInitialized

public final boolean isInitialized()

Specified by:

isInitialized in interface com.google.protobuf.MessageLiteOrBuilder

Overrides:

isInitialized in class com.google.protobuf.GeneratedMessageV3

writeTo

public void writeTo(com.google.protobuf.CodedOutputStream output)
             throws java.io.IOException

Specified by:

writeTo in interface com.google.protobuf.MessageLite

Overrides:

writeTo in class com.google.protobuf.GeneratedMessageV3

Throws:

java.io.IOException

getSerializedSize

public int getSerializedSize()

Specified by:

getSerializedSize in interface com.google.protobuf.MessageLite

Overrides:

getSerializedSize in class com.google.protobuf.GeneratedMessageV3

equals

public boolean equals(java.lang.Object obj)

Specified by:

equals in interface com.google.protobuf.Message

Overrides:

equals in class com.google.protobuf.AbstractMessage

hashCode

public int hashCode()

Specified by:

hashCode in interface com.google.protobuf.Message

Overrides:

hashCode in class com.google.protobuf.AbstractMessage

parseFrom

public static RewardProto.RewardPacket parseFrom(com.google.protobuf.ByteString data)
                                          throws com.google.protobuf.InvalidProtocolBufferException

Throws:

com.google.protobuf.InvalidProtocolBufferException

parseFrom

public static RewardProto.RewardPacket parseFrom(com.google.protobuf.ByteString data,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws com.google.protobuf.InvalidProtocolBufferException

Throws:

com.google.protobuf.InvalidProtocolBufferException

parseFrom

public static RewardProto.RewardPacket parseFrom(byte[] data)
                                          throws com.google.protobuf.InvalidProtocolBufferException

Throws:

com.google.protobuf.InvalidProtocolBufferException

parseFrom

public static RewardProto.RewardPacket parseFrom(byte[] data,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws com.google.protobuf.InvalidProtocolBufferException

Throws:

com.google.protobuf.InvalidProtocolBufferException

parseFrom

public static RewardProto.RewardPacket parseFrom(java.io.InputStream input)
                                          throws java.io.IOException

Throws:

java.io.IOException

parseFrom

public static RewardProto.RewardPacket parseFrom(java.io.InputStream input,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws java.io.IOException

Throws:

java.io.IOException

parseDelimitedFrom

public static RewardProto.RewardPacket parseDelimitedFrom(java.io.InputStream input)
                                                   throws java.io.IOException

Throws:

java.io.IOException

parseDelimitedFrom

public static RewardProto.RewardPacket parseDelimitedFrom(java.io.InputStream input,
                                                          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                   throws java.io.IOException

Throws:

java.io.IOException

parseFrom

public static RewardProto.RewardPacket parseFrom(com.google.protobuf.CodedInputStream input)
                                          throws java.io.IOException

Throws:

java.io.IOException

parseFrom

public static RewardProto.RewardPacket parseFrom(com.google.protobuf.CodedInputStream input,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws java.io.IOException

Throws:

java.io.IOException

newBuilderForType

public RewardProto.RewardPacket.Builder newBuilderForType()

Specified by:

newBuilderForType in interface com.google.protobuf.Message

Specified by:

newBuilderForType in interface com.google.protobuf.MessageLite

newBuilder

public static RewardProto.RewardPacket.Builder newBuilder()

newBuilder

public static RewardProto.RewardPacket.Builder newBuilder(RewardProto.RewardPacket prototype)

toBuilder

public RewardProto.RewardPacket.Builder toBuilder()

Specified by:

toBuilder in interface com.google.protobuf.Message

Specified by:

toBuilder in interface com.google.protobuf.MessageLite

getDefaultInstance

public static RewardProto.RewardPacket getDefaultInstance()

parser

public static com.google.protobuf.Parser<RewardProto.RewardPacket> parser()

getParserForType

public com.google.protobuf.Parser<RewardProto.RewardPacket> getParserForType()

Specified by:

getParserForType in interface com.google.protobuf.Message

Specified by:

getParserForType in interface com.google.protobuf.MessageLite

Overrides:

getParserForType in class com.google.protobuf.GeneratedMessageV3

getDefaultInstanceForType

public RewardProto.RewardPacket getDefaultInstanceForType()

Specified by:

getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder

Specified by:

getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
layout: post
status: publish
published: true
title: RSS feed
author:
  display_name: Tomas Restrepo
  login: tomasr
  email: tomas@winterdom.com
  url: http://winterdom.com/
author_login: tomasr
author_email: tomas@winterdom.com
author_url: http://winterdom.com/
wordpress_id: 432
wordpress_url: http://winterdom.com/2002/04/rssfeed
date: '2002-04-23 05:25:10 +0000'
date_gmt: '2002-04-23 05:25:10 +0000'
categories:
- Blogging
tags: []
comments: []
---

Peter also managed to generate and RSS feed

of my weblog using RssDistiller,

which is available here.


text:
set -eo pipefail

package=$1
version=$2
if [[ -z "$package" ]] || [[ -z "$version" ]]; then
  echo "usage: $0 <package-name> <version> <<bin_name>/<arch_name>/<archive_type>>..."
  exit 1
fi
shift
shift
package_split=(${package//\// })
package_name=${package_split[-1]}

package_path="$GOPATH/src/$package"
readme="$package_path/README.md"
license="$package_path/LICENSE"
basename="${package_name}_${version}_"
insidebinname="${package_name}"
archives=("$@")

for archive in "${archives[@]}"
do
    archive_split=(${archive//\// })
    bin=${archive_split[0]}
    arch=${archive_split[1]}
    type=${archive_split[2]}

    archive_name="${basename}${arch}.${type}"
    echo "Creating $archive_name"

    if [ "$type" = "deb" ]; then
        echo "Archive deb not implemented"
    elif [ "$type" = "zip" ]; then
        cp "${bin}" "/tmp/$insidebinname"
        rm -f "$archive_name"
        zip "$archive_name" -j "$license"  -j "$readme" -j "/tmp/$insidebinname"
        echo zip "$archive_name" -j "$license"  -j "$readme" -j "/tmp/$insidebinname"
    elif [ "$type" = "tar.gz" ]; then
        cp "${bin}" "/tmp/$insidebinname"
        tar -czvf "$archive_name" --directory=$(dirname "$license") $(basename "$license") --directory=$(dirname "$readme") $(basename "$readme") --directory=$(dirname "/tmp/$insidebinname") "$insidebinname"
    else
        echo "Archive $type not implemented"
    fi
done


text:
from JumpScale import j
import lzma
import JumpScale.baselib.gitlab

class ChangeTrackerClient():
    def __init__(self, MDPath,namespace="backup"):
        self.errors=[]

        self.excludes=["*.pyc"]

        self.MDPath = MDPath

        if cachePath=="":
            cachePath="/opt/backup/CACHE"

        self.cachePath = cachePath  # Intermediate link path!

        # Local blob STOR
        self.STORpath="/opt/backup/STOR"

        passwd = j.application.config.get('grid.master.superadminpasswd')
        login="root"
        # blobstor2 client
        # self.client = j.servers.zdaemon.getZDaemonClient("127.0.0.1",port=2345,user=login,passwd=passwd,ssl=False,sendformat='m', returnformat='m',category="blobserver")
        self.client=j.clients.blobstor2.getClient(namespace=namespace, name=blobclientname)
        self.namespace=namespace
        self.repoId=1 # will be implemented later with osis
        self.compress=False
        self.errors=[]

    def _normalize(self, path):
        path=path.replace("'","\\'")
        path=path.replace("[","\\[")
        path=path.replace("]","\\]")
        return path

    def action_link(self, src, dest):
        #DO NOT IMPLEMENT YET
        j.system.fs.createDir(j.system.fs.getDirName(dest))
        print "link:%s %s"%(src, dest)

        if j.system.fs.exists(path=dest):
            stat=j.system.fs.statPath(dest)
            if stat.st_nlink<2:
                raise RuntimeError("only support linked files")
        else:
            cmd="ln '%s' '%s'"%(self._normalize(src),self._normalize(dest))
            try:
                j.system.process.execute(cmd)
            except Exception,e:
                print "ERROR",
                print cmd
                print e
                self.errors.append(["link",cmd,e])

    def _dump2stor(self, data,key=""):
        if len(data)==0:
            return ""
        if key=="":
            key = j.tools.hash.md5_string(data)
        data2 = lzma.compress(data) if self.compress else data
        if not self.client.exists(key=key,repoId=self.repoId):
            self.client.set(key=key, data=data2,repoId=self.repoId)

        return key

    def _read_file(self,path, block_size=0):
        if block_size==0:
            block_size=self._MB4

        with open(path, 'rb') as f:
            while True:
                piece = f.read(block_size)
                if piece:
                    yield piece
                else:
                    return

    def doError(self,path,msg):
        self.errors.append([path,msg])

    def _handleMetadata(self, path,destination,prefix,ttype,linkdest=None,fullcheck=False):
        """
        @return (mdchange,contentchange) True if changed, False if not
        @param destination is destination inside target dir
        """
        # print "MD:%s "%path,

        srcpart=j.system.fs.pathRemoveDirPart(path,prefix,True)
        dest=j.system.fs.joinPaths(self.MDPath,"MD",destination,srcpart)
        dest2=j.system.fs.joinPaths(destination,srcpart)
        dest2=dest2.lstrip("/")
        change=False

        try:
            stat=j.system.fs.statPath(path)
        except Exception,e:
            if not j.system.fs.exists(path):
                #can be link which does not exist
                #or can be file which is deleted in mean time
                self.doError(path,"could not find, so could not backup.")
                return (False,False,"",dest2)

        #next goes for all types
        if j.system.fs.exists(path=dest):
            if ttype=="D":
                dest+="/.meta"
            item=self.getMDObjectFromFs(dest)

            mdchange=False
        elif ttype=="L":
            dest=j.system.fs.joinPaths(self.MDPath,"LINKS",destination,srcpart)
            if j.system.fs.exists(path=dest):
                if j.system.fs.exists(j.system.fs.joinPaths(dest,".meta")):
                    #is dir
                    dest=j.system.fs.joinPaths(dest,".meta")
                item=self.getMDObjectFromFs(dest)
                mdchange=False
            else:
                item=Item()
                mdchange=True
        else:
            item=Item()
            mdchange=True

        if ttype=="F":
            if fullcheck or item.mtime<>stat.st_mtime or item.size<>stat.st_size:
                newMD5=j.tools.hash.md5(path)
                if item.hash<>newMD5:
                    mdchange=True
                    change=True
                    item.hash=newMD5
        elif ttype=="L":
            if not item.__dict__.has_key("dest"):
                mdchange=True
            elif linkdest<>item.dest:
                mdchange=True

        if mdchange==False:
            #check metadata changed based on mode, uid, gid & mtime
            if ttype=="F":
                if int(item.size)<>int(stat.st_size):
                    mdchange==True
            if int(item.mtime)<>int(stat.st_mtime) or int(item.mode)<>int(stat.st_mode) or\
                    int(item.uid)<>int(stat.st_uid) or int(item.gid)<>int(stat.st_gid):
                mdchange=True

        if mdchange:
            print "MD:%s CHANGE"%path

            # print "MDCHANGE"
            item.mode=int(stat.st_mode)
            item.uid=int(stat.st_uid)
            item.gid=int(stat.st_gid)
            # item.atime=stat.st_atime
            item.ctime=int(stat.st_ctime)
            item.mtime=int(stat.st_mtime)

            if ttype=="F":
                item.size=stat.st_size
                item.type="F"
                j.system.fs.createDir(j.system.fs.getDirName(dest))
            elif ttype=="D":
                item.type="D"
                dest=j.system.fs.joinPaths(self.MDPath,"MD",destination,srcpart,".meta")
                j.system.fs.createDir(j.system.fs.getDirName(dest))
            elif ttype=="L":
                item.dest=linkdest
                if j.system.fs.isDir(path):
                    dest=j.system.fs.joinPaths(self.MDPath,"LINKS",destination,srcpart,".meta")
                    item.type="LD"
                else:
                    dest=j.system.fs.joinPaths(self.MDPath,"LINKS",destination,srcpart)
                    item.type="LF"
                j.system.fs.createDir(j.system.fs.getDirName(dest))

            j.system.fs.writeFile(dest, str(item))

        return (mdchange,change,item.hash,dest2)

    def restore(self, src, dest, namespace):
        """
        src is location on metadata dir
        dest is where to restore to
        """
        self.errors=[]

        if src[0] != "/":
            src = "%s/%s" % (self.MDPath, src.strip())

        if not j.system.fs.exists(path=src):
            raise RuntimeError("Could not find source (on mdstore)")

        for item in j.system.fs.listFilesInDir(src, True):
            destpart=j.system.fs.pathRemoveDirPart(item, src, True)
            destfull=j.system.fs.joinPaths(dest, destpart)

            self.restore1file(item, destfull, namespace)

    def getMDObjectFromFs(self,path):
        itemObj=Item(j.system.fs.fileGetContents(path))
        return itemObj

    def restore1file(self, src, dest, namespace):

        print "restore: %s %s" % (src, dest)

        itemObj=self.getMDObjectFromFs(src)

        j.system.fs.createDir(j.system.fs.getDirName(dest))

        if itemObj.hash.strip()=="":
            j.system.fs.writeFile(dest,"")
            return

        blob_path = self._getBlobPath(namespace, itemObj.hash)
        if j.system.fs.exists(blob_path):
            # Blob exists in cache, we can get it from there!
            print "Blob FOUND in cache: %s" % blob_path
            j.system.fs.copyFile(blob_path, dest)
            return

        # Get the file directly or get the blob storing the hashes of file parts!
        blob_hash = itemObj.hashlist if hasattr(itemObj, "hashlist") else itemObj.hash

        # Get blob from blobstor2
        blob = self.client.get(namespace, blob_hash)

        # Write the blob
        self._writeBlob(dest, blob, itemObj, namespace)

    def _writeBlob(self, dest, blob, item, namespace):
        """
        Write blob to destination
        """

        check="##HASHLIST##"
        if blob.find(check)==0:
            # found hashlist
            print "FOUND HASHLIST %s" % blob
            hashlist = blob[len(check) + 1:]
            j.system.fs.writeFile(dest,"")
            for hashitem in hashlist.split("\n"):
                if hashitem.strip() != "":
                    blob_block = self.client.get(namespace, hashitem)
                    data = lzma.decompress(blob_block)
                    j.system.fs.writeFile(dest, data, append=True)
        else:
            # content is there
            data = lzma.decompress(blob)
            j.system.fs.writeFile(dest, data)

        # chmod/chown
        os.chmod(dest,int(item.mode))
        os.chown(dest,int(item.uid),int(item.gid))

    def backupBatch(self,batch,batchnr=None,total=None):
        """
        batch is [[src,md5]]
        """
        key2paths={}
        for src,md5 in batch:
            key2paths[md5]=(src,md5)

        print "batch nr:%s check"%batchnr
        notexist=self.client.existsBatch(keys=key2paths.keys())
        print "batch checked on unique data"

        nr=batchnr*1000

        for src,md5 in batch:
            nr+=1
            if md5 in notexist:
                hashes=[]
                if j.system.fs.statPath(src).st_size>self._MB4:
                    print "%s/%s:upload file (>4MB) %s"%(nr,total,src)
                    for data in self._read_file(src):
                        hashes.append(self._dump2stor(data))
                    if len(hashes)>1:
                        out = "##HASHLIST##\n"
                        hashparts = "\n".join(hashes)
                        out += hashparts
                        # Store in blobstor
                        out_hash = self._dump2stor(out,key=md5) #hashlist is stored on md5 location of file
                    else:
                        raise RuntimeError("hashist needs to be more than 1.")
                else:
                    print "%s/%s:upload file (<4MB) %s"%(nr,total,src)
                    for data in self._read_file(src):
                        hashes.append(self._dump2stor(data,key=md5))
            else:
                print "%s/%s:no need to upload, exists: %s"%(nr,total,src)

    def backup(self,path,destination="", pathRegexIncludes={},pathRegexExcludes={".*\\.pyc"},childrenRegexExcludes=[".*/dev/.*",".*/proc/.*"],fullcheck=False):

        #check if there is a dev dir, if so will do a special tar
        ##BACKUP:
        #tar Szcvf testDev.tgz saucy-amd64-base/rootfs/dev/
        ##restore
        #tar xzvf testDev.tgz -C testd
        self._createExistsList(destination)

        print "SCAN MD:%s"%path

        self.errors=[]

        if j.system.fs.exists(j.system.fs.joinPaths(path,"dev")):
            cmd="cd %s;tar Szcvf __dev.tgz dev"%path
            j.system.process.execute(cmd)

        destMDClist=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,destination,".mdchanges")
        destFClist=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,destination,".fchanges")
        destFlist=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,destination,".found")
        j.system.fs.createDir(j.system.fs.getDirName(destMDClist))
        j.system.fs.createDir(j.system.fs.getDirName(destFClist))
        j.system.fs.createDir(j.system.fs.getDirName(destFlist))
        mdchanges = open(destMDClist, 'w')
        changes = open(destFClist, 'w')
        found = open(destFlist, 'w')

        w=j.base.fswalker.get()
        callbackMatchFunctions=w.getCallBackMatchFunctions(pathRegexIncludes,pathRegexExcludes,includeFolders=True,includeLinks=True)

        def processfile(path,stat,arg):
            if path[-4:]==".pyc":
                return
            self=arg["self"]
            prefix=arg["prefix"]
            mdchange,fchange,md5,path2=self._handleMetadata(path,arg["destination"],prefix=prefix,ttype="F",fullcheck=arg["fullcheck"])
            if mdchange:
                arg["mdchanges"].write("%s\n"%(path2))
            if arg["fullcheck"] or fchange:
                arg["changes"].write("%s|%s\n"%(path,md5))
            arg["found"].write("%s\n"%path2)

        def processdir(path,stat,arg):
            self=arg["self"]
            prefix=arg["prefix"]
            mdchange,fchange,md5,path=self._handleMetadata(path,arg["destination"],prefix=prefix,ttype="D")
            if mdchange:
                arg["mdchanges"].write("%s\n"%path)
            arg["found"].write("%s\n"%path)

        def processlink(src,dest,stat,arg):
            # print "LINK: %s %s"%(src,dest)
            path=src
            self=arg["self"]
            prefix=arg["prefix"]
            destpart=j.system.fs.pathRemoveDirPart(dest,prefix,True)
            mdchange,fchange,md5,path=self._handleMetadata(path,arg["destination"],prefix=prefix,ttype="L",linkdest=destpart)
            if mdchange:
                arg["mdchanges"].write("%s\n"%path)
            arg["found"].write("%s\n"%path)

        callbackFunctions={}
        callbackFunctions["F"]=processfile
        callbackFunctions["D"]=processdir
        callbackFunctions["L"]=processlink

        arg={}
        arg["self"]=self
        arg["prefix"]=path
        arg["changes"]=changes
        arg["mdchanges"]=mdchanges
        arg["found"]=found
        arg["destination"]=destination
        arg["fullcheck"]=fullcheck

        # arg["batch"]=[]
        w.walk(path,callbackFunctions,arg=arg,callbackMatchFunctions=callbackMatchFunctions,childrenRegexExcludes=childrenRegexExcludes)

        changes.close()
        found.close()
        mdchanges.close()

        # self.backupBatch(arg["batch"])

        if len(self.errors)>0:
            out=""
            for path,msg in self.errors:
                out+="%s:%s\n"%(path,msg)
            epath=j.system.fs.joinPaths(self.MDPath,"ERRORS",destination,"ERRORS.LOG")
            j.system.fs.createDir(j.system.fs.getDirName(epath))
            j.system.fs.writeFile(epath,out)

        #now we need to find the deleted files
        #sort all found files when going over fs
        cmd="sort %s | uniq > %s_"%(destFlist,destFlist)
        j.system.process.execute(cmd)
        originalFiles=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,destination,".mdfound")
        cmd="sort %s | uniq > %s_"%(originalFiles,originalFiles)
        j.system.process.execute(cmd)
        deleted=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,destination,".deleted")
        #now find the diffs
        cmd="diff %s_ %s_ -C 0 | grep ^'- ' > %s"%(originalFiles,destFlist,deleted)
        rcode,result=j.system.process.execute(cmd,False)
        # if not(rcode==1 and result.strip().replace("***ERROR***","")==""):
        #     raise RuntimeError("Could not diff : cmd:%s error: %s"%(cmd,result))

        f=open(deleted, "r")
        for line in f:
            line=line.strip()
            path=line.lstrip("- ")
            dest=j.system.fs.joinPaths(self.MDPath,"MD",path)
            j.system.fs.removeDirTree(dest)
            dest=j.system.fs.joinPaths(self.MDPath,"LINKS",path)
            j.system.fs.removeDirTree(dest)
        f.close()
        print "SCAN DONE MD:%s"%path

        print "START UPLOAD FILES."
        #count lines
        total=0
        f=open(destFClist, "r")
        for line in f:
            total+=1
        f.close()
        print "count done"
        f=open(destFClist, "r")
        counter=0
        batch=[]
        batchnr=0
        for line in f:
            path,md5=line.strip().split("|")
            batch.append([path,md5])
            counter+=1
            if counter>1000:
                self.backupBatch(batch,batchnr=batchnr,total=total)
                batchnr+=1
        #final batch
        self.backupBatch(batch,batchnr=batchnr,total=total)
        f.close()
        print "BACKUP DONE."

    def _createExistsList(self,dest):
        # j.system.fs.pathRemoveDirPart(dest,prefix,True)
        print "Walk over MD, to create files which we already have found."
        destF=j.system.fs.joinPaths(self.STORpath, "../TMP","plists",self.namespace,dest,".mdfound")
        j.system.fs.createDir(j.system.fs.getDirName(destF))
        fileF = open(destF, 'w')

        def processfile(path,stat,arg):
            path2=j.system.fs.pathRemoveDirPart(path, arg["base"], True)
            path2=path2.lstrip("/")
            if path2[0:2]=="MD":
                path2=path2[3:]
            if path2[0:5]=="LINKS":
                path2=path2[6:]
            path2=path2.lstrip("/")
            # print path2
            if path2[-5:]==".meta":
                return
            # print "%s  :   %s"%(path,path2)
            # if j.system.fs.isDir(path2):
            #     path=j.system.fs.joinPaths(path,".meta")
            # md=self.getMDObjectFromFs(path)
            # fileF.write("%s|%s|%s|%s\n"%(path2,md.size,md.mtime,md.hash))
            fileF.write("%s\n"%(path2))

        callbackFunctions={}
        callbackFunctions["F"]=processfile
        callbackFunctions["D"]=processfile

        arg={}
        arg["base"]=self.MDPath
        w=j.base.fswalker.get()
        callbackFunctions["F"]=processfile

        wpath=j.system.fs.joinPaths(self.MDPath,"MD",dest)
        if j.system.fs.exists(path=wpath):
            w.walk(wpath,callbackFunctions=callbackFunctions,arg=arg,childrenRegexExcludes=[])
        wpath=j.system.fs.joinPaths(self.MDPath,"LINKS",dest)
        if j.system.fs.exists(path=wpath):
            w.walk(wpath,callbackFunctions=callbackFunctions,arg=arg,childrenRegexExcludes=[])

        fileF.close()
        print "Walk over MD, DONE"

    def _getBlobPath(self, namespace, key):
        """
        Get the blob path in Cache dir
        """
        # Get the Intermediate path of a certain blob
        storpath = j.system.fs.joinPaths(self.cachePath, namespace, key[0:2], key[2:4], key)
        return storpath

    def _getBlob(self, src, namespace):
        """
        Retrieves the blobs in Cache path
        """

        # Create the Item Object
        itemObj = Item(j.system.fs.fileGetContents(src))

        blob_hash = itemObj.hashlist if hasattr(itemObj, "hashlist") else itemObj.hash

        # Get blob from blobstor2
        blob = self.client.get(key=blob_hash)

        # The path which this blob should be saved
        blob_path = self._getBlobPath(namespace, itemObj.hash)
        j.system.fs.createDir(j.system.fs.getDirName(blob_path))

        self._writeBlob(blob_path, blob, itemObj, namespace)

        return blob_path

    def linkRecipe(self, src, dest, namespace):
        """
        Hardlink Recipe from Cache Dir
        """

        if not self.cachePath:
            raise RuntimeError("Link Path is not Set!")

        if src[0] != "/":
            src = "%s/%s" % (self.MDPath, src.strip())

        if not j.system.fs.exists(path=src):
            raise RuntimeError("Could not find source (on mdstore)")

        for item in j.system.fs.listFilesInDir(src, True):
            # Retrieve blob & blob_path in intermediate location
            blob_path = self._getBlob(item, namespace)

            # the hardlink destination
            destpart = j.system.fs.pathRemoveDirPart(item, src, True)
            destfull = j.system.fs.joinPaths(dest, destpart)

            # Now, make the link
            self.action_link(blob_path, destfull)

class BackupClient:
    """
    """

    def __init__(self,backupname,blobclientName,gitlabName="incubaid"):
        self.blobclientName=blobclientName
        self.gitlabName=gitlabName
        self.gitlab=j.clients.gitlab.get(gitlabName)
        self.backupname=backupname
        self.mdpath="/opt/backup/MD/%s"%backupname
        if not j.system.fs.exists(path=self.mdpath):
            if not self.gitlab.existsProject(namespace=self.gitlab.loginName, name=backupname):
                self.gitlab.createproject(backupname, description='backup set', issues_enabled=0, wall_enabled=0, merge_requests_enabled=0, wiki_enabled=0, snippets_enabled=0, public=0)#, group=accountname)
        self.gitclient = self.gitlab.getGitClient(self.gitlab.loginName, backupname, clean=False,path=self.mdpath)

        self.filemanager=JSFileMgr(MDPath=self.mdpath,namespace="backup",blobclientname=blobclientName)

    def backup(self,path,destination="", pathRegexIncludes={},pathRegexExcludes={},childrenRegexExcludes=[".*/dev/.*","/proc/.*"],fullcheck=False):
        # self._clean()
        self.filemanager.backup(path,destination=destination, pathRegexIncludes=pathRegexIncludes,pathRegexExcludes=pathRegexExcludes,\
            childrenRegexExcludes=childrenRegexExcludes,fullcheck=fullcheck)
        self.commitMD()

    def _clean(self):
        for ddir in j.system.fs.listDirsInDir(self.mdpath,False,True,findDirectorySymlinks=False):
            if ddir.lower()<>".git":
                j.system.fs.removeDirTree(j.system.fs.joinPaths(self.mdpath,ddir))
        for ffile in j.system.fs.listFilesInDir(self.mdpath, recursive=False, followSymlinks=False):
            j.system.fs.remove(ffile)

    def backupRecipe(self,recipe):
        """
        do backup of sources as specified in recipe
        example recipe

        #when star will do for each dir
        /tmp/JSAPPS/apps : * : /DEST/apps
        #when no * then dir & below
        /tmp/JSAPPS/bin :  : /DEST/bin
        #now only for 1 subdir
        /tmp/JSAPPS/apps : asubdirOfApps : /DEST/apps

        """
        self._clean()
        self.filemanager.backupRecipe(recipe)
        self.commitMD()

    def commitMD(self):
        print "commit to git"
        self.gitclient.commit("backup %s"%j.base.time.getLocalTimeHRForFilesystem())
        if j.system.net.tcpPortConnectionTest(self.gitlab.addr,self.gitlab.port):
            #found gitlab
            print "push to git"
            self.gitclient.push()
        else:
            print "WARNING COULD NOT COMMIT CHANGES TO GITLAB, no connection found.\nDO THIS LATER!!!!!!!!!!!!!!!!!!!!!!"


text:
namespace OpenRiaServices.DomainServices.Tools.TextTemplate.CSharpGenerators
{
	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.ComponentModel.DataAnnotations;
	using System.Globalization;
	using System.Linq;
	using System.Reflection;
	using System.Runtime.Serialization;
	using OpenRiaServices.DomainServices;
	using OpenRiaServices.DomainServices.Server;
	using OpenRiaServices.DomainServices.Tools;

	/// <summary>
	/// C# generator for entity types.
	/// </summary>
	public partial class CSharpEntityGenerator
	{
		/// <summary>
		/// Generates entity class in C#.
		/// </summary>
		/// <returns>Generated entity class code.</returns>
		protected override string GenerateDataContractProxy()
		{
			return this.TransformText();
		}

		private void Generate()
		{
			this.Initialize();
			this.GenerateEntityClass();
		}

		private void GenerateEntityClass()
		{
			this.GenerateNamespace();
			this.GenerateOpeningBrace();

			this.GenerateClassDeclaration();
			this.GenerateOpeningBrace();

			this.GenerateBody();

			this.GenerateClosingBrace();
			this.GenerateClosingBrace();
		}

		/// <summary>
		/// Generates entity class body.
		/// </summary>
		/// <remarks>
		/// The default implementation of this method invokes <see cref="GenerateConstructor"/>,
		/// <see cref="GenerateProperties"/>, <see cref="GenerateExtensibilityMethods"/> and <see cref="GenerateCustomMethods"/>.
		/// </remarks>
		protected virtual void GenerateBody()
		{
			this.GenerateConstructor();
			this.GenerateProperties();
			this.GenerateExtensibilityMethods();
			this.GenerateCustomMethods();

			// This is a hook to special case the User type that we define.
			if (this.IsUserType)
			{
				this.GenerateAdditionalUserCode();
			}
		}

		/// <summary>
		/// Generates entity properties.
		/// </summary>
		protected virtual void GenerateProperties()
		{
			this.GeneratePropertiesInternal();
			this.GenerateAssociations();
		}

		private void GenerateAssociations()
		{
			foreach (PropertyDescriptor pd in this.AssociationProperties)
			{
				this.GenerateAssociation(pd);
			}
		}

		/// <summary>
		/// Generates association property.
		/// </summary>
		/// <param name="pd">PropertyDescriptor for the association property to be generated.</param>
		protected virtual void GenerateAssociation(PropertyDescriptor pd)
		{
			if (!IsCollectionType(pd.PropertyType))
			{
				this.GenerateSingletonAssociation(pd);
			}
			else
			{
				this.GenerateCollectionSideAssociation(pd);
			}
		}

		/// <summary>
		/// Generates extensibility methods.
		/// </summary>
		protected virtual void GenerateExtensibilityMethods()
		{
			if (this.GenerateGetIdentity)
			{
				this.GenerateGetIdentityMethod();
			}

			this.GenerateNotificationMethods();
		}

		/// <summary>
		/// Generates the custom methods on the entity.
		/// </summary>
		protected virtual void GenerateCustomMethods()
		{
			IEnumerable<DomainOperationEntry> entityCustomMethods = this.GetEntityCustomMethods();
			foreach (DomainOperationEntry methodEntry in entityCustomMethods.OrderBy(e => e.Name))
			{
				this.GenerateCustomMethod(methodEntry);
				this.GenerateCustomMethodProperties(methodEntry);
			}
		}
	}

	internal class AssociationMetadata
	{
		public PropertyDescriptor PropertyDescriptor { get; private set; }
		public bool IsExternal { get; private set; }
		public bool IsCollection { get; private set; }
		public string PropTypeName { get; private set; }
		public string AssociationTypeName { get; private set; }
		public string PropertyName { get; private set; }
		public string FieldName { get; private set; }
		public IEnumerable<Attribute> Attributes { get; private set; }
		public AssociationAttribute AssociationAttribute { get; private set; }

		public AssociationMetadata(PropertyDescriptor pd)
		{
			this.PropertyDescriptor = pd;
			AttributeCollection propertyAttributes = pd.ExplicitAttributes();
			this.AssociationAttribute = (AssociationAttribute) propertyAttributes[typeof (AssociationAttribute)];
			this.IsExternal = propertyAttributes[typeof (ExternalReferenceAttribute)] != null;
			this.IsCollection = EntityGenerator.IsCollectionType(pd.PropertyType);

			if (!this.IsCollection)
			{
				this.PropTypeName = CodeGenUtilities.GetTypeName(pd.PropertyType);
				this.AssociationTypeName = @"OpenRiaServices.DomainServices.Client.EntityRef<" + this.PropTypeName + ">";
				this.Attributes = propertyAttributes.Cast<Attribute>().Where(a => a.GetType() != typeof (DataMemberAttribute));
			}
			else
			{
				this.PropTypeName = CodeGenUtilities.GetTypeName(TypeUtility.GetElementType(pd.PropertyType));
				this.AssociationTypeName = "OpenRiaServices.DomainServices.Client.EntityCollection<" + this.PropTypeName + ">";

				List<Attribute> attributeList = propertyAttributes.Cast<Attribute>().ToList();
				ReadOnlyAttribute readOnlyAttr = propertyAttributes.OfType<ReadOnlyAttribute>().SingleOrDefault();
				if (readOnlyAttr != null && !propertyAttributes.OfType<EditableAttribute>().Any())
				{
					attributeList.Add(new EditableAttribute(!readOnlyAttr.IsReadOnly));
				}
				this.Attributes = attributeList.Where(a => a.GetType() != typeof (DataMemberAttribute));
			}

			this.PropertyName = CodeGenUtilities.GetSafeName(pd.Name);
			this.FieldName = CodeGenUtilities.MakeCompliantFieldName(this.PropertyName);
		}
	}
}


text:
Ideas, concepts, and code were used from the following sources:

- [Even Better Motherfucking Website](https://evenbettermotherfucking.website/)
  - AUTHOR
    - [Guilherme Pangnotta](http://setetres.st)
  - LICENSE
    - [CC 4.0 International](https://creativecommons.org/licenses/by/4.0)
  - WHAT WAS USED
    - CSS code
  - WHY
    - To give my website a responsive design without a bunch of libraries or custom code that I have no control over
  - CHANGES FROM ORIGINAL WORK
    - None at the momoent

- Cassidy Williams's Personal Blog
  - AUTHOR
    - [Cassidy Williams](https://cassidoo.co/)
  - LICENSE
    - [MIT](https://opensource.org/licenses/MIT)
  - WHAT WAS USED
    - General file layout for Jekyll
  - WHY
    - Needed to learn how Jekyll uses header/footer templating as well as post layouts. Official Jekyll docs weren't cutting it.
  - CHANGES FROM ORIGINAL WORK
    - Almost everything really. Only really used it to learn about how Jekyll's theme and templating systems work on an abstract level.  ¯\\\_(ツ)_/¯


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Revue Mycol. , Paris 1: 307 (1936)

#### Original name
Secotium selenaspora Heim & Le Gal

### Remarks
null


text:
//go:build !providerless
// +build !providerless

package gce

const (
	// AlphaFeatureILBSubsets allows InternalLoadBalancer services to include a subset
	// of cluster nodes as backends instead of all nodes.
	AlphaFeatureILBSubsets = "ILBSubsets"
)

// AlphaFeatureGate contains a mapping of alpha features to whether they are enabled
type AlphaFeatureGate struct {
	features map[string]bool
}

// Enabled returns true if the provided alpha feature is enabled
func (af *AlphaFeatureGate) Enabled(key string) bool {
	if af == nil || af.features == nil {
		return false
	}
	return af.features[key]
}

// NewAlphaFeatureGate marks the provided alpha features as enabled
func NewAlphaFeatureGate(features []string) *AlphaFeatureGate {
	featureMap := make(map[string]bool)
	for _, name := range features {
		featureMap[name] = true
	}
	return &AlphaFeatureGate{featureMap}
}